@tryghost/portal 2.68.1 → 2.68.2
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.
- package/package.json +1 -1
- package/umd/portal.min.js +32 -36
- package/umd/portal.min.js.map +1 -1
package/umd/portal.min.js
CHANGED
|
@@ -79,7 +79,7 @@ Url: ${ys(e)}`),!0)}function EC(e,t){return e.type||!t||!t.length?!1:PC(e).some(
|
|
|
79
79
|
* @license MIT
|
|
80
80
|
*/function Uy(e,t){if(e===t)return 0;for(var n=e.length,a=t.length,i=0,o=Math.min(n,a);i<o;++i)if(e[i]!==t[i]){n=e[i],a=t[i];break}return n<a?-1:a<n?1:0}function Eo(e){return an.Buffer&&typeof an.Buffer.isBuffer=="function"?an.Buffer.isBuffer(e):!!(e!=null&&e._isBuffer)}var St=By,Yj=Object.prototype.hasOwnProperty,Hy=Array.prototype.slice,Vy=function(){return(function(){}).name==="foo"}();function Wy(e){return Object.prototype.toString.call(e)}function Gy(e){return Eo(e)||typeof an.ArrayBuffer!="function"?!1:typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e?!!(e instanceof DataView||e.buffer&&e.buffer instanceof ArrayBuffer):!1}var ee=Ly.exports=Zy,Lj=/\s*function\s+([^\(\s]*)\s*/;function Ky(e){if(St.isFunction(e)){if(Vy)return e.name;var t=e.toString(),n=t.match(Lj);return n&&n[1]}}ee.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=Bj(this),this.generatedMessage=!0);var n=t.stackStartFunction||Qe;if(Error.captureStackTrace)Error.captureStackTrace(this,n);else{var a=new Error;if(a.stack){var i=a.stack,o=Ky(n),r=i.indexOf(`
|
|
81
81
|
`+o);if(r>=0){var s=i.indexOf(`
|
|
82
|
-
`,r+1);i=i.substring(s+1)}this.stack=i}}},St.inherits(ee.AssertionError,Error);function qy(e,t){return typeof e=="string"?e.length<t?e:e.slice(0,t):e}function Jy(e){if(Vy||!St.isFunction(e))return St.inspect(e);var t=Ky(e),n=t?": "+t:"";return"[Function"+n+"]"}function Bj(e){return qy(Jy(e.actual),128)+" "+e.operator+" "+qy(Jy(e.expected),128)}function Qe(e,t,n,a,i){throw new ee.AssertionError({message:n,actual:e,expected:t,operator:a,stackStartFunction:i})}ee.fail=Qe;function Zy(e,t){e||Qe(e,!0,t,"==",ee.ok)}ee.ok=Zy,ee.equal=function(t,n,a){t!=n&&Qe(t,n,a,"==",ee.equal)},ee.notEqual=function(t,n,a){t==n&&Qe(t,n,a,"!=",ee.notEqual)},ee.deepEqual=function(t,n,a){qa(t,n,!1)||Qe(t,n,a,"deepEqual",ee.deepEqual)},ee.deepStrictEqual=function(t,n,a){qa(t,n,!0)||Qe(t,n,a,"deepStrictEqual",ee.deepStrictEqual)};function qa(e,t,n,a){if(e===t)return!0;if(Eo(e)&&Eo(t))return Uy(e,t)===0;if(St.isDate(e)&&St.isDate(t))return e.getTime()===t.getTime();if(St.isRegExp(e)&&St.isRegExp(t))return e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase;if((e===null||typeof e!="object")&&(t===null||typeof t!="object"))return n?e===t:e==t;if(Gy(e)&&Gy(t)&&Wy(e)===Wy(t)&&!(e instanceof Float32Array||e instanceof Float64Array))return Uy(new Uint8Array(e.buffer),new Uint8Array(t.buffer))===0;if(Eo(e)!==Eo(t))return!1;a=a||{actual:[],expected:[]};var i=a.actual.indexOf(e);return i!==-1&&i===a.expected.indexOf(t)?!0:(a.actual.push(e),a.expected.push(t),Uj(e,t,n,a))}function Xy(e){return Object.prototype.toString.call(e)=="[object Arguments]"}function Uj(e,t,n,a){if(e==null||t===null||t===void 0)return!1;if(St.isPrimitive(e)||St.isPrimitive(t))return e===t;if(n&&Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;var i=Xy(e),o=Xy(t);if(i&&!o||!i&&o)return!1;if(i)return e=Hy.call(e),t=Hy.call(t),qa(e,t,n);var r=ab(e),s=ab(t),c,u;if(r.length!==s.length)return!1;for(r.sort(),s.sort(),u=r.length-1;u>=0;u--)if(r[u]!==s[u])return!1;for(u=r.length-1;u>=0;u--)if(c=r[u],!qa(e[c],t[c],n,a))return!1;return!0}ee.notDeepEqual=function(t,n,a){qa(t,n,!1)&&Qe(t,n,a,"notDeepEqual",ee.notDeepEqual)},ee.notDeepStrictEqual=Qy;function Qy(e,t,n){qa(e,t,!0)&&Qe(e,t,n,"notDeepStrictEqual",Qy)}ee.strictEqual=function(t,n,a){t!==n&&Qe(t,n,a,"===",ee.strictEqual)},ee.notStrictEqual=function(t,n,a){t===n&&Qe(t,n,a,"!==",ee.notStrictEqual)};function eb(e,t){if(!e||!t)return!1;if(Object.prototype.toString.call(t)=="[object RegExp]")return t.test(e);try{if(e instanceof t)return!0}catch{}return Error.isPrototypeOf(t)?!1:t.call({},e)===!0}function Hj(e){var t;try{e()}catch(n){t=n}return t}function tb(e,t,n,a){var i;if(typeof t!="function")throw new TypeError('"block" argument must be a function');typeof n=="string"&&(a=n,n=null),i=Hj(t),a=(n&&n.name?" ("+n.name+").":".")+(a?" "+a:"."),e&&!i&&Qe(i,n,"Missing expected exception"+a);var o=typeof a=="string",r=!e&&St.isError(i),s=!e&&i&&!n;if((r&&o&&eb(i,n)||s)&&Qe(i,n,"Got unwanted exception"+a),e&&i&&n&&!eb(i,n)||!e&&i)throw i}ee.throws=function(e,t,n){tb(!0,e,t,n)},ee.doesNotThrow=function(e,t,n){tb(!1,e,t,n)},ee.ifError=function(e){if(e)throw e};function nb(e,t){e||Qe(e,!0,t,"==",nb)}ee.strict=Rj(nb,ee,{equal:ee.strictEqual,deepEqual:ee.deepStrictEqual,notEqual:ee.notStrictEqual,notDeepEqual:ee.notDeepStrictEqual}),ee.strict.strict=ee.strict;var ab=Object.keys||function(e){var t=[];for(var n in e)Yj.call(e,n)&&t.push(n);return t},Vj=Ly.exports,Wj=Vj,Gj=function(e){var t,n,a,i,o;for(t=Error.prepareStackTrace,Error.prepareStackTrace=function(r,s){return Error.prepareStackTrace=t,s},n=new Error().stack,o=0;o<n.length&&n[o].getFileName()!==__filename;)o++;Wj(o<n.length,"Unexpected: unable to find caller/index.js in the stack"),e=!e||isNaN(e)?1:e>n.length-2?n.length-2:e,n=n.slice(o+e+1);do i=n.shift(),a=i&&i.getFileName();while(n.length&&a==="module.js");return a};const Kj=Ka,qj=Ka,ib=Fj,Jj=Gj;dd.getCallerRoot=function(){try{return ib(Jj(2))}catch{return}},dd.getProcessRoot=function(){let t=process.cwd();const n=qj.join(t,"current");try{Kj.statSync(n).isDirectory()&&(t=n)}catch{}try{return ib(t)}catch{return}};var Zj=dd,pd={exports:{}},hd,ob;function Xj(){if(ob)return hd;ob=1;var e=1e3,t=e*60,n=t*60,a=n*24,i=a*7,o=a*365.25;hd=function(d,p){p=p||{};var m=typeof d;if(m==="string"&&d.length>0)return r(d);if(m==="number"&&isFinite(d))return p.long?c(d):s(d);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(d))};function r(d){if(d=String(d),!(d.length>100)){var p=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(d);if(p){var m=parseFloat(p[1]),f=(p[2]||"ms").toLowerCase();switch(f){case"years":case"year":case"yrs":case"yr":case"y":return m*o;case"weeks":case"week":case"w":return m*i;case"days":case"day":case"d":return m*a;case"hours":case"hour":case"hrs":case"hr":case"h":return m*n;case"minutes":case"minute":case"mins":case"min":case"m":return m*t;case"seconds":case"second":case"secs":case"sec":case"s":return m*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return m;default:return}}}}function s(d){var p=Math.abs(d);return p>=a?Math.round(d/a)+"d":p>=n?Math.round(d/n)+"h":p>=t?Math.round(d/t)+"m":p>=e?Math.round(d/e)+"s":d+"ms"}function c(d){var p=Math.abs(d);return p>=a?u(d,p,a,"day"):p>=n?u(d,p,n,"hour"):p>=t?u(d,p,t,"minute"):p>=e?u(d,p,e,"second"):d+" ms"}function u(d,p,m,f){var b=p>=m*1.5;return Math.round(d/m)+" "+f+(b?"s":"")}return hd}function Qj(e){n.debug=n,n.default=n,n.coerce=c,n.disable=r,n.enable=i,n.enabled=s,n.humanize=Xj(),n.destroy=u,Object.keys(e).forEach(d=>{n[d]=e[d]}),n.names=[],n.skips=[],n.formatters={};function t(d){let p=0;for(let m=0;m<d.length;m++)p=(p<<5)-p+d.charCodeAt(m),p|=0;return n.colors[Math.abs(p)%n.colors.length]}n.selectColor=t;function n(d){let p,m=null,f,b;function w(...g){if(!w.enabled)return;const y=w,k=Number(new Date),C=k-(p||k);y.diff=C,y.prev=p,y.curr=k,p=k,g[0]=n.coerce(g[0]),typeof g[0]!="string"&&g.unshift("%O");let x=0;g[0]=g[0].replace(/%([a-zA-Z%])/g,(E,N)=>{if(E==="%%")return"%";x++;const z=n.formatters[N];if(typeof z=="function"){const j=g[x];E=z.call(y,j),g.splice(x,1),x--}return E}),n.formatArgs.call(y,g),(y.log||n.log).apply(y,g)}return w.namespace=d,w.useColors=n.useColors(),w.color=n.selectColor(d),w.extend=a,w.destroy=n.destroy,Object.defineProperty(w,"enabled",{enumerable:!0,configurable:!1,get:()=>m!==null?m:(f!==n.namespaces&&(f=n.namespaces,b=n.enabled(d)),b),set:g=>{m=g}}),typeof n.init=="function"&&n.init(w),w}function a(d,p){const m=n(this.namespace+(typeof p>"u"?":":p)+d);return m.log=this.log,m}function i(d){n.save(d),n.namespaces=d,n.names=[],n.skips=[];const p=(typeof d=="string"?d:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const m of p)m[0]==="-"?n.skips.push(m.slice(1)):n.names.push(m)}function o(d,p){let m=0,f=0,b=-1,w=0;for(;m<d.length;)if(f<p.length&&(p[f]===d[m]||p[f]==="*"))p[f]==="*"?(b=f,w=m,f++):(m++,f++);else if(b!==-1)f=b+1,w++,m=w;else return!1;for(;f<p.length&&p[f]==="*";)f++;return f===p.length}function r(){const d=[...n.names,...n.skips.map(p=>"-"+p)].join(",");return n.enable(""),d}function s(d){for(const p of n.skips)if(o(d,p))return!1;for(const p of n.names)if(o(d,p))return!0;return!1}function c(d){return d instanceof Error?d.stack||d.message:d}function u(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}var e0=Qj;(function(e,t){t.formatArgs=a,t.save=i,t.load=o,t.useColors=n,t.storage=r(),t.destroy=(()=>{let c=!1;return()=>{c||(c=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function n(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let c;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(c=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(c[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function a(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const u="color: "+this.color;c.splice(1,0,u,"color: inherit");let d=0,p=0;c[0].replace(/%[a-zA-Z%]/g,m=>{m!=="%%"&&(d++,m==="%c"&&(p=d))}),c.splice(p,0,u)}t.log=console.debug||console.log||(()=>{});function i(c){try{c?t.storage.setItem("debug",c):t.storage.removeItem("debug")}catch{}}function o(){let c;try{c=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch{}return!c&&typeof process<"u"&&"env"in process&&(c=process.env.DEBUG),c}function r(){try{return localStorage}catch{}}e.exports=e0(t);const{formatters:s}=e.exports;s.j=function(c){try{return JSON.stringify(c)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}})(pd,pd.exports);var t0=pd.exports;const n0=Zj,rb=t0;ud.exports=function(t){const n=n0.getCallerRoot();let a;try{const i=Jn("/node_modules/@tryghost/debug/lib")(n+"/package.json");i.alias?a=i.alias:a=i.name}catch{a="undefined"}return rb(a+":"+t)},ud.exports._base=rb;var a0=ud.exports,i0=a0;const o0=[{code:"af",label:"Afrikaans"},{code:"ar",label:"Arabic"},{code:"bg",label:"Bulgarian"},{code:"bn",label:"Bengali"},{code:"bs",label:"Bosnian"},{code:"ca",label:"Catalan"},{code:"cs",label:"Czech"},{code:"da",label:"Danish"},{code:"de",label:"German"},{code:"de-CH",label:"Swiss German"},{code:"el",label:"Greek"},{code:"en",label:"English"},{code:"eo",label:"Esperanto"},{code:"es",label:"Spanish"},{code:"et",label:"Estonian"},{code:"eu",label:"Basque"},{code:"fa",label:"Persian/Farsi"},{code:"fi",label:"Finnish"},{code:"fr",label:"French"},{code:"gd",label:"Gaelic (Scottish)"},{code:"he",label:"Hebrew"},{code:"hi",label:"Hindi"},{code:"hr",label:"Croatian"},{code:"hu",label:"Hungarian"},{code:"id",label:"Indonesian"},{code:"is",label:"Icelandic"},{code:"it",label:"Italian"},{code:"ja",label:"Japanese"},{code:"ko",label:"Korean"},{code:"kz",label:"Kazakh"},{code:"lt",label:"Lithuanian"},{code:"lv",label:"Latvian"},{code:"mk",label:"Macedonian"},{code:"mn",label:"Mongolian"},{code:"ms",label:"Malay"},{code:"nb",label:"Norwegian Bokmål"},{code:"ne",label:"Nepali"},{code:"nl",label:"Dutch"},{code:"nn",label:"Norwegian Nynorsk"},{code:"pa",label:"Punjabi"},{code:"pl",label:"Polish"},{code:"pt",label:"Portuguese"},{code:"pt-BR",label:"Portuguese (Brazil)"},{code:"ro",label:"Romanian"},{code:"ru",label:"Russian"},{code:"si",label:"Sinhala"},{code:"sk",label:"Slovak"},{code:"sl",label:"Slovenian"},{code:"sq",label:"Albanian"},{code:"sr",label:"Serbian"},{code:"sr-Cyrl",label:"Serbian (Cyrillic)"},{code:"sv",label:"Swedish"},{code:"sw",label:"Swahili"},{code:"ta",label:"Tamil"},{code:"th",label:"Thai"},{code:"tr",label:"Turkish"},{code:"uk",label:"Ukrainian"},{code:"ur",label:"Urdu"},{code:"uz",label:"Uzbek"},{code:"vi",label:"Vietnamese"},{code:"zh",label:"Chinese"},{code:"zh-Hant",label:"Traditional Chinese"}],r0=Dj,sb=Ka,fd=Ka,gd=i0("i18n"),lb=o0,cb=lb.map(e=>e.code);function ub(e,t){return e.reduce((n,a)=>{let i;try{i=Jn("/ghost/i18n/lib")(`../locales/${a}/${t}.json`)}catch{i=Jn("/ghost/i18n/lib")(`../locales/en/${t}.json`)}return n[a]={[t]:{...i,...i.default&&typeof i.default=="object"?i.default:{}}},n},{})}function s0(e,t){if(!t)return{[e]:{theme:{}}};let n=[];try{n=fd.readdirSync(t).filter(o=>o.endsWith(".json")).map(o=>o.replace(".json",""))}catch{n=[e,"en"]}return[...new Set([e,...n,"en"])].reduce((i,o)=>{let r,s=!1;const c=sb.join(t,`${o}.json`);if(fd.existsSync(c))try{delete require.cache[Jn("/ghost/i18n/lib").resolve(c)],r=Jn("/ghost/i18n/lib")(c)}catch{gd(`Error loading theme locale file: ${o}`),s=!0}else s=!0;if(s)if(o!=="en")try{const u=sb.join(t,"en.json");fd.existsSync(u)?(delete require.cache[Jn("/ghost/i18n/lib").resolve(u)],r=Jn("/ghost/i18n/lib")(u)):r={}}catch{r={}}else gd("Theme en.json file not found"),r={};return i[o]={theme:{...r,...r.default&&typeof r.default=="object"?r.default:{}}},i},{})}wo.exports=(e="en",t="portal",n={})=>{const a=r0.createInstance(),i={prefix:"{",suffix:"}"};t==="theme"&&(i.escapeValue=!1);let o;return t!=="theme"?o=ub(cb,t):(gd(`generateThemeResources: ${e}, ${n.themePath}`),o=s0(e,n.themePath)),a.init({lng:e,nsSeparator:!1,keySeparator:!1,returnEmptyString:!1,fallbackLng:{no:["nb","en"],default:["en"]},ns:t,defaultNS:t,interpolation:i,resources:o}),a},wo.exports.SUPPORTED_LOCALES=cb,wo.exports.LOCALE_DATA=lb,wo.exports.generateResources=ub;var l0=wo.exports;const $o=l0;Va.exports=$o,Va.exports.default=$o,Va.exports.LOCALE_DATA=$o.LOCALE_DATA,Va.exports.SUPPORTED_LOCALES=$o.SUPPORTED_LOCALES,Va.exports.generateResources=$o.generateResources;var c0=Va.exports;const Os=Ko(c0)("en","portal"),h=Os.t.bind(Os);class xt extends Error{static async fromApiResponse(t){if(t.status===400||t.status===429)try{const n=await t.json();if(n.errors&&Array.isArray(n.errors)&&n.errors.length>0&&n.errors[0].message)return new xt(n.errors[0].message)}catch{return}if(t.status===404){if(!(t.headers.get("content-type")||"").toLowerCase().includes("application/json"))return;try{const a=await t.json();if(a.errors&&Array.isArray(a.errors)&&a.errors.length>0&&a.errors[0].message)return new xt(a.errors[0].message)}catch{return}}if(t.status===500)return new xt("A server error occurred")}}const _s=[];function Zt(e,t){const n=(r,s=null)=>s?h(r,{number:s}):h(r),a=()=>{const r=s=>_s.push(s);_s.length===0&&(r("No member exists with this e-mail address."),r("This site is invite-only, contact the owner for access."),r("Unable to initiate checkout session"),r("This site is not accepting payments at the moment."),r("Too many attempts try again in {number} minutes."),r("Too many attempts try again in {number} hours."),r("Too many attempts try again in {number} days."),r("Too many different sign-in attempts, try again in {number} minutes"),r("Too many different sign-in attempts, try again in {number} hours"),r("Too many different sign-in attempts, try again in {number} days"),r("Failed to send magic link email"),r("This site only accepts paid members."),r("Signups from this email domain are currently restricted."),r("Too many sign-up attempts, try again later"),r("Memberships from this email domain are currently restricted."),r("Invalid verification code"))},i=r=>(_s.length===0&&a(),!!_s.includes(r)),o=(r=null)=>{if(!r)return{preparedMessage:"An error occurred",number:null};const s=r.match(/\d+/);return s&&(r=r.replace(s[0],"{number}")),{preparedMessage:r,number:s?s[0]:null}};if(!e&&!t)return h("An error occurred");if(e instanceof xt||e.message){const{preparedMessage:r,number:s}=o(e.message);return i(r)?n(r,s):t||n(e==null?void 0:e.message)}else return t||h("An error occurred")+": "+e.toString()}class yd extends v.Component{constructor(){super(...arguments),this.handleLoad=()=>{this.setupFrameBaseStyle()}}componentDidMount(){this.node.addEventListener("load",this.handleLoad)}componentWillUnmout(){this.node.removeEventListener("load",this.handleLoad)}setupFrameBaseStyle(){this.node.contentDocument&&(this.iframeHtml=this.node.contentDocument.documentElement,this.iframeHead=this.node.contentDocument.head,this.iframeRoot=this.node.contentDocument.body,this.iframeHtml.setAttribute("dir",this.props.dataDir),this.forceUpdate())}render(){const{children:t,head:n,title:a="",style:i={},dataTestId:o="",dataDir:r="ltr",...s}=this.props;return l.jsxs("iframe",{srcDoc:"<!DOCTYPE html>","data-testid":o,ref:c=>this.node=c,title:a,style:i,frameBorder:"0",dir:r,...s,children:[this.iframeHead&&Eu.createPortal(n,this.iframeHead),this.iframeRoot&&Eu.createPortal(t,this.iframeRoot)]})}}const bd=e=>v.createElement("svg",{id:"Regular",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},v.createElement("defs",null,v.createElement("style",null,".cls-1{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:0.8px;}")),v.createElement("circle",{className:"cls-1",cx:12,cy:9.75,r:5.25}),v.createElement("path",{className:"cls-1",d:"M18.913,20.876a9.746,9.746,0,0,0-13.826,0"}),v.createElement("circle",{className:"cls-1",cx:12,cy:12,r:11.25})),db=`
|
|
82
|
+
`,r+1);i=i.substring(s+1)}this.stack=i}}},St.inherits(ee.AssertionError,Error);function qy(e,t){return typeof e=="string"?e.length<t?e:e.slice(0,t):e}function Jy(e){if(Vy||!St.isFunction(e))return St.inspect(e);var t=Ky(e),n=t?": "+t:"";return"[Function"+n+"]"}function Bj(e){return qy(Jy(e.actual),128)+" "+e.operator+" "+qy(Jy(e.expected),128)}function Qe(e,t,n,a,i){throw new ee.AssertionError({message:n,actual:e,expected:t,operator:a,stackStartFunction:i})}ee.fail=Qe;function Zy(e,t){e||Qe(e,!0,t,"==",ee.ok)}ee.ok=Zy,ee.equal=function(t,n,a){t!=n&&Qe(t,n,a,"==",ee.equal)},ee.notEqual=function(t,n,a){t==n&&Qe(t,n,a,"!=",ee.notEqual)},ee.deepEqual=function(t,n,a){qa(t,n,!1)||Qe(t,n,a,"deepEqual",ee.deepEqual)},ee.deepStrictEqual=function(t,n,a){qa(t,n,!0)||Qe(t,n,a,"deepStrictEqual",ee.deepStrictEqual)};function qa(e,t,n,a){if(e===t)return!0;if(Eo(e)&&Eo(t))return Uy(e,t)===0;if(St.isDate(e)&&St.isDate(t))return e.getTime()===t.getTime();if(St.isRegExp(e)&&St.isRegExp(t))return e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase;if((e===null||typeof e!="object")&&(t===null||typeof t!="object"))return n?e===t:e==t;if(Gy(e)&&Gy(t)&&Wy(e)===Wy(t)&&!(e instanceof Float32Array||e instanceof Float64Array))return Uy(new Uint8Array(e.buffer),new Uint8Array(t.buffer))===0;if(Eo(e)!==Eo(t))return!1;a=a||{actual:[],expected:[]};var i=a.actual.indexOf(e);return i!==-1&&i===a.expected.indexOf(t)?!0:(a.actual.push(e),a.expected.push(t),Uj(e,t,n,a))}function Xy(e){return Object.prototype.toString.call(e)=="[object Arguments]"}function Uj(e,t,n,a){if(e==null||t===null||t===void 0)return!1;if(St.isPrimitive(e)||St.isPrimitive(t))return e===t;if(n&&Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;var i=Xy(e),o=Xy(t);if(i&&!o||!i&&o)return!1;if(i)return e=Hy.call(e),t=Hy.call(t),qa(e,t,n);var r=ab(e),s=ab(t),c,u;if(r.length!==s.length)return!1;for(r.sort(),s.sort(),u=r.length-1;u>=0;u--)if(r[u]!==s[u])return!1;for(u=r.length-1;u>=0;u--)if(c=r[u],!qa(e[c],t[c],n,a))return!1;return!0}ee.notDeepEqual=function(t,n,a){qa(t,n,!1)&&Qe(t,n,a,"notDeepEqual",ee.notDeepEqual)},ee.notDeepStrictEqual=Qy;function Qy(e,t,n){qa(e,t,!0)&&Qe(e,t,n,"notDeepStrictEqual",Qy)}ee.strictEqual=function(t,n,a){t!==n&&Qe(t,n,a,"===",ee.strictEqual)},ee.notStrictEqual=function(t,n,a){t===n&&Qe(t,n,a,"!==",ee.notStrictEqual)};function eb(e,t){if(!e||!t)return!1;if(Object.prototype.toString.call(t)=="[object RegExp]")return t.test(e);try{if(e instanceof t)return!0}catch{}return Error.isPrototypeOf(t)?!1:t.call({},e)===!0}function Hj(e){var t;try{e()}catch(n){t=n}return t}function tb(e,t,n,a){var i;if(typeof t!="function")throw new TypeError('"block" argument must be a function');typeof n=="string"&&(a=n,n=null),i=Hj(t),a=(n&&n.name?" ("+n.name+").":".")+(a?" "+a:"."),e&&!i&&Qe(i,n,"Missing expected exception"+a);var o=typeof a=="string",r=!e&&St.isError(i),s=!e&&i&&!n;if((r&&o&&eb(i,n)||s)&&Qe(i,n,"Got unwanted exception"+a),e&&i&&n&&!eb(i,n)||!e&&i)throw i}ee.throws=function(e,t,n){tb(!0,e,t,n)},ee.doesNotThrow=function(e,t,n){tb(!1,e,t,n)},ee.ifError=function(e){if(e)throw e};function nb(e,t){e||Qe(e,!0,t,"==",nb)}ee.strict=Rj(nb,ee,{equal:ee.strictEqual,deepEqual:ee.deepStrictEqual,notEqual:ee.notStrictEqual,notDeepEqual:ee.notDeepStrictEqual}),ee.strict.strict=ee.strict;var ab=Object.keys||function(e){var t=[];for(var n in e)Yj.call(e,n)&&t.push(n);return t},Vj=Ly.exports,Wj=Vj,Gj=function(e){var t,n,a,i,o;for(t=Error.prepareStackTrace,Error.prepareStackTrace=function(r,s){return Error.prepareStackTrace=t,s},n=new Error().stack,o=0;o<n.length&&n[o].getFileName()!==__filename;)o++;Wj(o<n.length,"Unexpected: unable to find caller/index.js in the stack"),e=!e||isNaN(e)?1:e>n.length-2?n.length-2:e,n=n.slice(o+e+1);do i=n.shift(),a=i&&i.getFileName();while(n.length&&a==="module.js");return a};const Kj=Ka,qj=Ka,ib=Fj,Jj=Gj;dd.getCallerRoot=function(){try{return ib(Jj(2))}catch{return}},dd.getProcessRoot=function(){let t=process.cwd();const n=qj.join(t,"current");try{Kj.statSync(n).isDirectory()&&(t=n)}catch{}try{return ib(t)}catch{return}};var Zj=dd,pd={exports:{}},hd,ob;function Xj(){if(ob)return hd;ob=1;var e=1e3,t=e*60,n=t*60,a=n*24,i=a*7,o=a*365.25;hd=function(d,p){p=p||{};var m=typeof d;if(m==="string"&&d.length>0)return r(d);if(m==="number"&&isFinite(d))return p.long?c(d):s(d);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(d))};function r(d){if(d=String(d),!(d.length>100)){var p=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(d);if(p){var m=parseFloat(p[1]),f=(p[2]||"ms").toLowerCase();switch(f){case"years":case"year":case"yrs":case"yr":case"y":return m*o;case"weeks":case"week":case"w":return m*i;case"days":case"day":case"d":return m*a;case"hours":case"hour":case"hrs":case"hr":case"h":return m*n;case"minutes":case"minute":case"mins":case"min":case"m":return m*t;case"seconds":case"second":case"secs":case"sec":case"s":return m*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return m;default:return}}}}function s(d){var p=Math.abs(d);return p>=a?Math.round(d/a)+"d":p>=n?Math.round(d/n)+"h":p>=t?Math.round(d/t)+"m":p>=e?Math.round(d/e)+"s":d+"ms"}function c(d){var p=Math.abs(d);return p>=a?u(d,p,a,"day"):p>=n?u(d,p,n,"hour"):p>=t?u(d,p,t,"minute"):p>=e?u(d,p,e,"second"):d+" ms"}function u(d,p,m,f){var b=p>=m*1.5;return Math.round(d/m)+" "+f+(b?"s":"")}return hd}function Qj(e){n.debug=n,n.default=n,n.coerce=c,n.disable=r,n.enable=i,n.enabled=s,n.humanize=Xj(),n.destroy=u,Object.keys(e).forEach(d=>{n[d]=e[d]}),n.names=[],n.skips=[],n.formatters={};function t(d){let p=0;for(let m=0;m<d.length;m++)p=(p<<5)-p+d.charCodeAt(m),p|=0;return n.colors[Math.abs(p)%n.colors.length]}n.selectColor=t;function n(d){let p,m=null,f,b;function w(...g){if(!w.enabled)return;const y=w,k=Number(new Date),C=k-(p||k);y.diff=C,y.prev=p,y.curr=k,p=k,g[0]=n.coerce(g[0]),typeof g[0]!="string"&&g.unshift("%O");let x=0;g[0]=g[0].replace(/%([a-zA-Z%])/g,(E,N)=>{if(E==="%%")return"%";x++;const z=n.formatters[N];if(typeof z=="function"){const j=g[x];E=z.call(y,j),g.splice(x,1),x--}return E}),n.formatArgs.call(y,g),(y.log||n.log).apply(y,g)}return w.namespace=d,w.useColors=n.useColors(),w.color=n.selectColor(d),w.extend=a,w.destroy=n.destroy,Object.defineProperty(w,"enabled",{enumerable:!0,configurable:!1,get:()=>m!==null?m:(f!==n.namespaces&&(f=n.namespaces,b=n.enabled(d)),b),set:g=>{m=g}}),typeof n.init=="function"&&n.init(w),w}function a(d,p){const m=n(this.namespace+(typeof p>"u"?":":p)+d);return m.log=this.log,m}function i(d){n.save(d),n.namespaces=d,n.names=[],n.skips=[];const p=(typeof d=="string"?d:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const m of p)m[0]==="-"?n.skips.push(m.slice(1)):n.names.push(m)}function o(d,p){let m=0,f=0,b=-1,w=0;for(;m<d.length;)if(f<p.length&&(p[f]===d[m]||p[f]==="*"))p[f]==="*"?(b=f,w=m,f++):(m++,f++);else if(b!==-1)f=b+1,w++,m=w;else return!1;for(;f<p.length&&p[f]==="*";)f++;return f===p.length}function r(){const d=[...n.names,...n.skips.map(p=>"-"+p)].join(",");return n.enable(""),d}function s(d){for(const p of n.skips)if(o(d,p))return!1;for(const p of n.names)if(o(d,p))return!0;return!1}function c(d){return d instanceof Error?d.stack||d.message:d}function u(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}var e1=Qj;(function(e,t){t.formatArgs=a,t.save=i,t.load=o,t.useColors=n,t.storage=r(),t.destroy=(()=>{let c=!1;return()=>{c||(c=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function n(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let c;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(c=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(c[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function a(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const u="color: "+this.color;c.splice(1,0,u,"color: inherit");let d=0,p=0;c[0].replace(/%[a-zA-Z%]/g,m=>{m!=="%%"&&(d++,m==="%c"&&(p=d))}),c.splice(p,0,u)}t.log=console.debug||console.log||(()=>{});function i(c){try{c?t.storage.setItem("debug",c):t.storage.removeItem("debug")}catch{}}function o(){let c;try{c=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch{}return!c&&typeof process<"u"&&"env"in process&&(c=process.env.DEBUG),c}function r(){try{return localStorage}catch{}}e.exports=e1(t);const{formatters:s}=e.exports;s.j=function(c){try{return JSON.stringify(c)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}})(pd,pd.exports);var t1=pd.exports;const n1=Zj,rb=t1;ud.exports=function(t){const n=n1.getCallerRoot();let a;try{const i=Jn("/node_modules/@tryghost/debug/lib")(n+"/package.json");i.alias?a=i.alias:a=i.name}catch{a="undefined"}return rb(a+":"+t)},ud.exports._base=rb;var a1=ud.exports,i1=a1;const o1=[{code:"af",label:"Afrikaans"},{code:"ar",label:"Arabic"},{code:"bg",label:"Bulgarian"},{code:"bn",label:"Bengali"},{code:"bs",label:"Bosnian"},{code:"ca",label:"Catalan"},{code:"cs",label:"Czech"},{code:"da",label:"Danish"},{code:"de",label:"German"},{code:"de-CH",label:"Swiss German"},{code:"el",label:"Greek"},{code:"en",label:"English"},{code:"eo",label:"Esperanto"},{code:"es",label:"Spanish"},{code:"et",label:"Estonian"},{code:"eu",label:"Basque"},{code:"fa",label:"Persian/Farsi"},{code:"fi",label:"Finnish"},{code:"fr",label:"French"},{code:"gd",label:"Gaelic (Scottish)"},{code:"he",label:"Hebrew"},{code:"hi",label:"Hindi"},{code:"hr",label:"Croatian"},{code:"hu",label:"Hungarian"},{code:"id",label:"Indonesian"},{code:"is",label:"Icelandic"},{code:"it",label:"Italian"},{code:"ja",label:"Japanese"},{code:"ko",label:"Korean"},{code:"kz",label:"Kazakh"},{code:"lt",label:"Lithuanian"},{code:"lv",label:"Latvian"},{code:"mk",label:"Macedonian"},{code:"mn",label:"Mongolian"},{code:"ms",label:"Malay"},{code:"nb",label:"Norwegian Bokmål"},{code:"ne",label:"Nepali"},{code:"nl",label:"Dutch"},{code:"nn",label:"Norwegian Nynorsk"},{code:"pa",label:"Punjabi"},{code:"pl",label:"Polish"},{code:"pt",label:"Portuguese"},{code:"pt-BR",label:"Portuguese (Brazil)"},{code:"ro",label:"Romanian"},{code:"ru",label:"Russian"},{code:"si",label:"Sinhala"},{code:"sk",label:"Slovak"},{code:"sl",label:"Slovenian"},{code:"sq",label:"Albanian"},{code:"sr",label:"Serbian"},{code:"sr-Cyrl",label:"Serbian (Cyrillic)"},{code:"sv",label:"Swedish"},{code:"sw",label:"Swahili"},{code:"ta",label:"Tamil"},{code:"th",label:"Thai"},{code:"tr",label:"Turkish"},{code:"uk",label:"Ukrainian"},{code:"ur",label:"Urdu"},{code:"uz",label:"Uzbek"},{code:"vi",label:"Vietnamese"},{code:"zh",label:"Chinese"},{code:"zh-Hant",label:"Traditional Chinese"}],r1=Dj,sb=Ka,fd=Ka,gd=i1("i18n"),lb=o1,cb=lb.map(e=>e.code);function ub(e,t){return e.reduce((n,a)=>{let i;try{i=Jn("/ghost/i18n/lib")(`../locales/${a}/${t}.json`)}catch{i=Jn("/ghost/i18n/lib")(`../locales/en/${t}.json`)}return n[a]={[t]:{...i,...i.default&&typeof i.default=="object"?i.default:{}}},n},{})}function s1(e,t){if(!t)return{[e]:{theme:{}}};let n=[];try{n=fd.readdirSync(t).filter(o=>o.endsWith(".json")).map(o=>o.replace(".json",""))}catch{n=[e,"en"]}return[...new Set([e,...n,"en"])].reduce((i,o)=>{let r,s=!1;const c=sb.join(t,`${o}.json`);if(fd.existsSync(c))try{delete require.cache[Jn("/ghost/i18n/lib").resolve(c)],r=Jn("/ghost/i18n/lib")(c)}catch{gd(`Error loading theme locale file: ${o}`),s=!0}else s=!0;if(s)if(o!=="en")try{const u=sb.join(t,"en.json");fd.existsSync(u)?(delete require.cache[Jn("/ghost/i18n/lib").resolve(u)],r=Jn("/ghost/i18n/lib")(u)):r={}}catch{r={}}else gd("Theme en.json file not found"),r={};return i[o]={theme:{...r,...r.default&&typeof r.default=="object"?r.default:{}}},i},{})}wo.exports=(e="en",t="portal",n={})=>{const a=r1.createInstance(),i={prefix:"{",suffix:"}"};t==="theme"&&(i.escapeValue=!1);let o;return t!=="theme"?o=ub(cb,t):(gd(`generateThemeResources: ${e}, ${n.themePath}`),o=s1(e,n.themePath)),a.init({lng:e,nsSeparator:!1,keySeparator:!1,returnEmptyString:!1,fallbackLng:{no:["nb","en"],default:["en"]},ns:t,defaultNS:t,interpolation:i,resources:o}),a},wo.exports.SUPPORTED_LOCALES=cb,wo.exports.LOCALE_DATA=lb,wo.exports.generateResources=ub;var l1=wo.exports;const $o=l1;Va.exports=$o,Va.exports.default=$o,Va.exports.LOCALE_DATA=$o.LOCALE_DATA,Va.exports.SUPPORTED_LOCALES=$o.SUPPORTED_LOCALES,Va.exports.generateResources=$o.generateResources;var c1=Va.exports;const Os=Ko(c1)("en","portal"),h=Os.t.bind(Os);class xt extends Error{static async fromApiResponse(t){if(t.status===400||t.status===429)try{const n=await t.json();if(n.errors&&Array.isArray(n.errors)&&n.errors.length>0&&n.errors[0].message)return new xt(n.errors[0].message)}catch{return}if(t.status===404){if(!(t.headers.get("content-type")||"").toLowerCase().includes("application/json"))return;try{const a=await t.json();if(a.errors&&Array.isArray(a.errors)&&a.errors.length>0&&a.errors[0].message)return new xt(a.errors[0].message)}catch{return}}if(t.status===500)return new xt("A server error occurred")}}const _s=[];function Zt(e,t){const n=(r,s=null)=>s?h(r,{number:s}):h(r),a=()=>{const r=s=>_s.push(s);_s.length===0&&(r("No member exists with this e-mail address."),r("This site is invite-only, contact the owner for access."),r("Unable to initiate checkout session"),r("This site is not accepting payments at the moment."),r("Too many attempts try again in {number} minutes."),r("Too many attempts try again in {number} hours."),r("Too many attempts try again in {number} days."),r("Too many different sign-in attempts, try again in {number} minutes"),r("Too many different sign-in attempts, try again in {number} hours"),r("Too many different sign-in attempts, try again in {number} days"),r("Failed to send magic link email"),r("This site only accepts paid members."),r("Signups from this email domain are currently restricted."),r("Too many sign-up attempts, try again later"),r("Memberships from this email domain are currently restricted."),r("Invalid verification code"))},i=r=>(_s.length===0&&a(),!!_s.includes(r)),o=(r=null)=>{if(!r)return{preparedMessage:"An error occurred",number:null};const s=r.match(/\d+/);return s&&(r=r.replace(s[0],"{number}")),{preparedMessage:r,number:s?s[0]:null}};if(!e&&!t)return h("An error occurred");if(e instanceof xt||e.message){const{preparedMessage:r,number:s}=o(e.message);return i(r)?n(r,s):t||n(e==null?void 0:e.message)}else return t||h("An error occurred")+": "+e.toString()}class yd extends v.Component{constructor(){super(...arguments),this.handleLoad=()=>{this.setupFrameBaseStyle()}}componentDidMount(){this.node.addEventListener("load",this.handleLoad)}componentWillUnmout(){this.node.removeEventListener("load",this.handleLoad)}setupFrameBaseStyle(){this.node.contentDocument&&(this.iframeHtml=this.node.contentDocument.documentElement,this.iframeHead=this.node.contentDocument.head,this.iframeRoot=this.node.contentDocument.body,this.iframeHtml.setAttribute("dir",this.props.dataDir),this.forceUpdate())}render(){const{children:t,head:n,title:a="",style:i={},dataTestId:o="",dataDir:r="ltr",...s}=this.props;return l.jsxs("iframe",{srcDoc:"<!DOCTYPE html>","data-testid":o,ref:c=>this.node=c,title:a,style:i,frameBorder:"0",dir:r,...s,children:[this.iframeHead&&Eu.createPortal(n,this.iframeHead),this.iframeRoot&&Eu.createPortal(t,this.iframeRoot)]})}}const bd=e=>v.createElement("svg",{id:"Regular",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},v.createElement("defs",null,v.createElement("style",null,".cls-1{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:0.8px;}")),v.createElement("circle",{className:"cls-1",cx:12,cy:9.75,r:5.25}),v.createElement("path",{className:"cls-1",d:"M18.913,20.876a9.746,9.746,0,0,0-13.826,0"}),v.createElement("circle",{className:"cls-1",cx:12,cy:12,r:11.25})),db=`
|
|
83
83
|
.gh-portal-avatar {
|
|
84
84
|
position: relative;
|
|
85
85
|
display: flex;
|
|
@@ -102,7 +102,7 @@ Url: ${ys(e)}`),!0)}function EC(e,t){return e.type||!t||!t.length?!1:PC(e).some(
|
|
|
102
102
|
opacity: 1;
|
|
103
103
|
max-width: unset;
|
|
104
104
|
}
|
|
105
|
-
`,
|
|
105
|
+
`,u1=({style:e={}})=>({avatarContainer:{...e.avatarContainer||{}},gravatar:{...e.avatarContainer||{}},userIcon:{width:"34px",height:"34px",color:"#fff",...e.userIcon||{}}});function kd({gravatar:e,style:t}){let n=u1({style:t});return l.jsxs("figure",{className:"gh-portal-avatar",style:n.avatarContainer,children:[l.jsx(bd,{style:n.userIcon}),e?l.jsx("img",{style:n.gravatar,src:e,alt:""}):null]})}const _=Z.createContext({site:{},member:{},offers:[],action:"",actionErrorMessage:null,lastPage:"",brandColor:"",pageData:{},doAction:(e,t)=>({action:e,data:t}),dir:"ltr"}),d1=e=>v.createElement("svg",{width:21,height:24,viewBox:"0 0 21 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},v.createElement("path",{d:"M10.533 11.267c2.835 0 5.134-2.299 5.134-5.134C15.667 3.298 13.368 1 10.533 1 7.698 1 5.4 3.298 5.4 6.133s2.298 5.134 5.133 5.134zM1 23c0-2.529 1.004-4.953 2.792-6.741 1.788-1.788 4.213-2.792 6.741-2.792 2.529 0 4.954 1.004 6.741 2.792 1.788 1.788 2.793 4.212 2.793 6.74",stroke:"#fff",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),m1=e=>v.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...e},v.createElement("g",{fill:"none",fillRule:"evenodd"},v.createElement("path",{stroke:"#FFF",strokeWidth:1.5,strokeLinecap:"round",d:"M12.5 2v20M2 12.5h20"}))),p1=e=>v.createElement("svg",{width:25,height:24,viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},v.createElement("path",{d:"M23.5 6v14.25c0 .597-.237 1.169-.659 1.591-.422.422-.994.659-1.591.659s-1.169-.237-1.591-.659c-.422-.422-.659-.994-.659-1.591V3c0-.398-.158-.78-.44-1.06-.28-.282-.662-.44-1.06-.44h-15c-.398 0-.78.158-1.06.44C1.157 2.22 1 2.601 1 3v17.25c0 .597.237 1.169.659 1.591.422.422.994.659 1.591.659h18M4.75 15h10.5M4.75 18h6",stroke:"#fff",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),v.createElement("path",{d:"M14.5 5.25h-9c-.414 0-.75.336-.75.75v4.5c0 .414.336.75.75.75h9c.414 0 .75-.336.75-.75V6c0-.414-.336-.75-.75-.75z",stroke:"#fff",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),h1=e=>v.createElement("svg",{width:24,height:18,viewBox:"0 0 24 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},v.createElement("path",{d:"M21.75 1.5H2.25c-.828 0-1.5.672-1.5 1.5v12c0 .828.672 1.5 1.5 1.5h19.5c.828 0 1.5-.672 1.5-1.5V3c0-.828-.672-1.5-1.5-1.5zM15.687 6.975L19.5 10.5M8.313 6.975L4.5 10.5",stroke:"#fff",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),v.createElement("path",{d:"M22.88 2.014l-9.513 6.56C12.965 8.851 12.488 9 12 9s-.965-.149-1.367-.426L1.12 2.014",stroke:"#fff",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),f1=e=>v.createElement("svg",{width:26,height:26,viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},v.createElement("path",{d:"M17.903 12.016c-.332-1.665-1.491-3.032-3.031-3.654M11.037 8.4C9.252 9.163 8 10.935 8 13c0 .432.055.85.158 1.25M10.44 17.296c.748.447 1.624.704 2.56.704 1.71 0 3.22-.858 4.12-2.167M15.171 21.22c3.643-.96 6.329-4.276 6.329-8.22 0-1.084-.203-2.121-.573-3.075M18.611 6.615C17.114 5.3 15.151 4.5 13 4.5c-2.149 0-4.112.797-5.608 2.113M5.112 9.826c-.395.98-.612 2.052-.612 3.174 0 4.015 2.783 7.38 6.526 8.27",stroke:"#fff",strokeWidth:1.5,strokeLinecap:"round"}),v.createElement("path",{d:"M8.924 24.29c1.273.46 2.645.71 4.076.71 5.52 0 10.17-3.727 11.57-8.803M6.712 2.777C3.285 4.89 1 8.678 1 13c0 3.545 1.537 6.731 3.982 8.928M24.849 11.089C23.933 5.369 18.977 1 13 1c-.69 0-1.367.058-2.025.17",stroke:"#fff",strokeWidth:1.5,strokeLinecap:"round"})),vd=`
|
|
106
106
|
/* Colors
|
|
107
107
|
/* ----------------------------------------------------- */
|
|
108
108
|
:root {
|
|
@@ -425,8 +425,8 @@ Url: ${ys(e)}`),!0)}function EC(e,t){return e.type||!t||!t.length?!1:PC(e).some(
|
|
|
425
425
|
width: 60px;
|
|
426
426
|
height: 60px;
|
|
427
427
|
}
|
|
428
|
-
`+db,Xt=e=>{if(!e)return"";const t=new Date(e),n={year:"numeric",month:"short",day:"numeric"};return t.toLocaleDateString("en-GB",n)};function Tn(){const[e]=window.location.hash.substr(1).split("?"),t=/^\/portal\/?(?:\/(\w+(?:\/\w+)*))?\/?$/,n=/^\/share\/?$/;e&&(t.test(e)||n.test(e))&&window.history.pushState("",document.title,window.location.pathname+window.location.search)}function g0({page:e}){const t={signin:"#/portal/signin",signup:"#/portal/signup"};return Object.keys(t).includes(e)?t[e]:t.default}function pb({page:e,siteUrl:t}){const n=t||`${window.location.protocol}//${window.location.host}${window.location.pathname}`,a=g0({page:e});return`${n}${a}`}function Zn(){return!(navigator&&navigator.cookieEnabled)}function y0({event:e}){var i,o,r,s;const n=(((s=(r=(o=(i=e==null?void 0:e.exception)==null?void 0:i.values)==null?void 0:o[0])==null?void 0:r.stacktrace)==null?void 0:s.frames)||[]).map(c=>c.filename).filter(c=>!!c);return(n[n.length-1]||"").includes("@tryghost/portal")}function rt({member:e={}}){if(Dt({member:e})){const n=(e.subscriptions||[]).find(a=>["active","trialing","unpaid","past_due"].includes(a.status));return!(n!=null&&n.price)&&(n!=null&&n.plan)&&(n.price=n.plan),n}return null}function Pn({member:e={}}){if(!e)return!1;const t=rt({member:e});if(t){const{price:n}=t;return n&&n.amount===0}else if(!t&&e.paid)return!0;return!1}function Dt({member:e={}}){return e&&e.paid}function b0({product:e}){return e!=null&&e.monthlyPrice?e.monthlyPrice.currency:null}function jo({site:e}){return(e==null?void 0:e.editor_default_email_recipients)!=="disabled"}function wd({member:e}){var n;const t=rt({member:e});return(n=t==null?void 0:t.tier)!=null&&n.expiry_at?Xt(t.tier.expiry_at):""}function k0({site:e,member:t}){const n=Xn({member:t}),a=n==null?void 0:n.currency,i=To({site:e});return n!=null&&n.id?i.filter(o=>jd(b0({product:o}),a)):i}function v0({prices:e,currency:t}){return e.filter(n=>jd(n.currency||"",t||""))}function Rs({subscription:e}){var t,n;return e&&e.price?{...e.price,stripe_price_id:e.price.id,id:e.price.price_id,price:e.price.amount/100,name:e.price.nickname,tierId:(t=e.tier)==null?void 0:t.id,cadence:((n=e.price)==null?void 0:n.interval)==="month"?"month":"year",currency:e.price.currency.toLowerCase(),currency_symbol:ke(e.price.currency)}:null}function Xn({member:e}){const t=rt({member:e});return Rs({subscription:t})}function w0({member:e,site:t}){const n=rt({member:e}),a=Rs({subscription:n});return Hs({site:t}).find(o=>o.id===(a==null?void 0:a.product.product_id))}function S0({priceId:e,site:t,member:n}){const a=Xn({member:n}),{tierId:i,cadence:o}=na({site:t,priceId:e});return(a==null?void 0:a.tierId)===i&&(a==null?void 0:a.cadence)===o}function x0({member:e,subscriptionId:t}){return Dt({member:e})?(e.subscriptions||[]).find(a=>a.id===t):null}function hb({member:e}){var n;const t=rt({member:e});return((n=t==null?void 0:t.tier)==null?void 0:n.name)||""}function Ja({plans:e,site:t={}}){return e=e||qs({site:t}),!e||e.length===0||e.length===1&&e[0].type==="free"}function C0(e,t){const a=To({site:e}).find(i=>i.type==="paid");return t==="monthly"?{cadence:"month",tierId:a.id}:t==="yearly"?{cadence:"year",tierId:a.id}:{priceId:t}}function E0({site:e={},priceId:t}){const n=Ks({site:e});if(t==="free")return!n||n.length===0||n.find(a=>a.type==="free");if(n&&n.length>0&&t==="monthly"){const a=n.find(o=>o.name==="Monthly"),i=n.find(o=>o.interval==="month");return a||i}else if(n&&n.length>0&&t==="yearly"){const a=n.find(o=>o.name==="Yearly"),i=n.find(o=>o.interval==="year");return a||i}else if(n&&n.length>0&&t)return n.find(a=>a.id===t);return null}function $0({site:e}){return(e==null?void 0:e.members_signup_access)==="paid"}function Ft({site:e={}}){return(e==null?void 0:e.members_signup_access)==="invite"}function Qt({site:e={},pageQuery:t=""}){return qs({site:e,pageQuery:t}).length>0}function j0({site:e}){return(e==null?void 0:e.recommendations_enabled)===!0}function Ys({site:e}){var t;return((t=e==null?void 0:e.labs)==null?void 0:t.giftSubscriptions)===!0}function zn({site:e}){return(e==null?void 0:e.members_signup_access)!=="none"}function Ls({site:e}){const t=(e==null?void 0:e.members_signup_access)==="all"||(e==null?void 0:e.members_signup_access)==="paid",n=(e==null?void 0:e.is_stripe_configured)||Ja({site:e});return t&&n}function Sd({site:e}){return(e==null?void 0:e.members_signup_access)==="all"}function fb(){return window.location.hostname.replace(/^www\./,"")}function Bs({site:e}){const{portal_products:t}=e||{};return!!t}function Us({site:e}){return(e==null?void 0:e.comments_enabled)&&(e==null?void 0:e.comments_enabled)!=="off"}function T0({site:e}){var t,n,a,i,o;try{if(!e)return null;if(e.tiers&&(e.products=e.tiers),e.products=(t=e.products)==null?void 0:t.map(r=>({...r,monthlyPrice:r.monthly_price,yearlyPrice:r.yearly_price})),e.is_stripe_configured=!!e.paid_members_enabled,(a=(n=e.products)==null?void 0:n[0])!=null&&a.visibility){e.portal_products=e.products.filter(s=>s.visibility!=="none"&&s.type==="paid").map(s=>s.id);const r=e.products.find(s=>s.type==="free");r&&(e.portal_plans=(i=e.portal_plans)==null?void 0:i.filter(s=>s!=="free"),(r==null?void 0:r.visibility)==="public"&&((o=e.portal_plans)==null||o.push("free")))}return e}catch(r){console.warn("[Portal] Failed to read site data:",r)}}function To({site:e}){const{portal_products:t,products:n=[],portal_plans:a=[]}=e||{};return!a.includes("monthly")&&!a.includes("yearly")?[]:n.filter(i=>!!i).filter(i=>e.is_stripe_configured?!0:i.type!=="paid").filter(i=>!!(i.monthlyPrice&&i.yearlyPrice)).filter(i=>Object.keys(i.monthlyPrice).length>0&&Object.keys(i.yearlyPrice).length>0).filter(i=>t&&n.length>1?t.includes(i.id):!0).sort((i,o)=>{var r,s;return((r=i==null?void 0:i.monthlyPrice)==null?void 0:r.amount)-((s=o==null?void 0:o.monthlyPrice)==null?void 0:s.amount)}).map(i=>(i.monthlyPrice={...i.monthlyPrice,currency_symbol:ke(i.monthlyPrice.currency)},i.yearlyPrice={...i.yearlyPrice,currency_symbol:ke(i.yearlyPrice.currency)},i))}function Qn({site:e}){const{products:t=[]}=e||{};return t.find(n=>n.type==="free")}function Hs({site:e}){const{products:t=[],portal_plans:n=[]}=e||{};return!n.includes("monthly")&&!n.includes("yearly")?[]:t.filter(a=>!!a).filter(a=>!!(a.monthlyPrice&&a.yearlyPrice)).filter(a=>Object.keys(a.monthlyPrice).length>0&&Object.keys(a.yearlyPrice).length>0).sort((a,i)=>{var o,r;return((o=a==null?void 0:a.monthlyPrice)==null?void 0:o.amount)-((r=i==null?void 0:i.monthlyPrice)==null?void 0:r.amount)}).map(a=>(a.monthlyPrice={...a.monthlyPrice,currency_symbol:ke(a.monthlyPrice.currency)},a.yearlyPrice={...a.yearlyPrice,currency_symbol:ke(a.yearlyPrice.currency)},a))}function Vs({site:e,pageQuery:t}){const n=To({site:e});return t==="free"?[]:(Po({site:e})&&n.unshift({id:"free",type:"free"}),n)}function Ws({site:e,pageQuery:t}){return Vs({site:e,pageQuery:t}).some(a=>!!(a!=null&&a.trial_days))}function P0({site:e}){const t=Qn({site:e});return(t==null?void 0:t.benefits)||[]}function gb({site:e}){const t=Qn({site:e});return(t==null?void 0:t.name)||"Free"}function z0({site:e}){const t=Qn({site:e});return t==null?void 0:t.description}function I0({site:e}){var n;const t=Qn({site:e});return!!(t!=null&&t.description||(n=t==null?void 0:t.benefits)!=null&&n.length)}function ea({site:e,productId:t}){return Hs({site:e}).find(a=>a.id===t)}function N0({site:e=null,products:t=null}){return!e&&!t?[]:(t||To({site:e})).reduce((i,o)=>(o.monthlyPrice&&o.yearlyPrice&&(i.push(o.monthlyPrice),i.push(o.yearlyPrice)),i),[])}function Po({site:e}){const{portal_plans:t}=e||{};return Sd({site:e})&&t.includes("free")}function ta({site:e}){const{newsletters:t=[]}=e||{};return t==null||t.sort((n,a)=>n.sort_order-a.sort_order),t}function zo({site:e}){const{newsletters:t}=e||{};return(t==null?void 0:t.length)>1}function yb({member:e}){var t;return(t=e==null?void 0:e.email_suppression)==null?void 0:t.suppressed}function bb({site:e}){return Vs({site:e}).length===1&&Po({site:e})}function xd({sub:e}={}){var a;return(!(e!=null&&e.offer)||((a=e==null?void 0:e.offer)==null?void 0:a.type)==="trial")&&(e==null?void 0:e.trial_end_at)&&!A0(new Date(e==null?void 0:e.trial_end_at))}function Gs(e){return(e==null?void 0:e.type)==="percent"&&(e==null?void 0:e.amount)===100&&(e==null?void 0:e.duration)==="repeating"&&(e==null?void 0:e.redemption_type)==="retention"}function A0(e){return e<new Date}function kb({site:e,priceId:t}){return t==="free"?Qn({site:e}):Hs({site:e}).find(a=>{var i,o;return((i=a==null?void 0:a.monthlyPrice)==null?void 0:i.id)===t||((o=a==null?void 0:a.yearlyPrice)==null?void 0:o.id)===t})}function na({site:e,priceId:t}){var o;if(t==="free")return Qn({site:e});const a=Hs({site:e}).find(r=>{var s,c;return((s=r==null?void 0:r.monthlyPrice)==null?void 0:s.id)===t||((c=r==null?void 0:r.yearlyPrice)==null?void 0:c.id)===t});let i="month";return((o=a==null?void 0:a.yearlyPrice)==null?void 0:o.id)===t&&(i="year"),{tierId:a==null?void 0:a.id,cadence:i}}function Ks({site:e,products:t=null}){const{portal_plans:n=[],is_stripe_configured:a}=e||{};return a?N0({site:e,products:t}).filter(o=>!!(o&&o.id)).map(o=>({...o,price_id:o.id,price:o.amount/100,name:o.nickname,currency_symbol:ke(o.currency)})).filter(o=>o.amount!==0&&o.type==="recurring").filter(o=>o.interval==="month"?n.includes("monthly"):o.interval==="year"?n.includes("yearly"):!1).sort((o,r)=>o.amount-r.amount).sort((o,r)=>!o.currency||!r.currency?0:o.currency.localeCompare(r.currency,void 0,{ignorePunctuation:!0})):[]}function M0({site:e}){const t=Ks({site:e});let n={currency:"usd",currency_symbol:"$"};return(t==null?void 0:t.length)>0&&(n.currency=t[0].currency,n.currency_symbol=t[0].currency_symbol),n}function qs({site:e={},pageQuery:t=""}={}){const n=[];if(Po({site:e})){const i=M0({site:e});n.push({id:"free",type:"free",price:0,amount:0,name:gb({site:e}),...i})}return t==="free"&&Po({site:e})||Ks({site:e}).forEach(o=>{n.push(o)}),n}const D0=({member:e})=>e?e.email:"",Cd=({member:e})=>e?e.email_suppression:"",F0=({site:e})=>e&&e.firstpromoter_account,O0=({member:e})=>e?e.name:"",Io=({site:e})=>{var a;const{members_support_address:t,support_email_address:n}=e||{};if(n)return n;if((t==null?void 0:t.indexOf("@"))<0){const i=Ed({site:e}),o=(i==null?void 0:i.replace(/^(www)\.(?=[^/]*\..{2,5})/,""))||"";return`${t}@${o}`}if(((a=t==null?void 0:t.split("@"))==null?void 0:a.length)>1){const[i,o]=t.split("@"),r=(o==null?void 0:o.replace(/^(www)\.(?=[^/]*\..{2,5})/,""))||"";return`${i}@${r}`}return t||""},_0=({site:e})=>{const{default_email_address:t}=e||{},n=t||`noreply@${Ed({site:e})}`,a=ta({site:e}),i=a==null?void 0:a[0];return i&&i.sender_email?i.sender_email:n},Ed=({site:e})=>{try{return new URL(e.url).origin.replace(/^http(s?):\/\//,"").replace(/\/$/,"")}catch{return e.url.replace(/^http(s?):\/\//,"").replace(/\/$/,"")}},ke=e=>Intl.NumberFormat("en",{currency:e,style:"currency"}).format(0).replace(/[\d\s.]/g,""),Js=e=>isNaN(e)?0:e/100,R0=(e={})=>{const t=ke(e.currency),n=Js(e.amount);return`${t}${n}/${e.interval}`},aa=e=>e==null?"":e.toLocaleString(),$d=(e,t)=>{if(e==null)return"";const n=Number(e);if(Number.isNaN(n))return"";const a=Number.isInteger(n)?void 0:{minimumFractionDigits:2,maximumFractionDigits:2};return n.toLocaleString(t,a)},re=({type:e,status:t,autoHide:n,duration:a=2600,closeable:i,state:o,message:r,meta:s={}})=>{let c=0;return o&&o.popupNotification&&(c=(o.popupNotification.count||0)+1),{type:e,status:t,autoHide:n,closeable:i,duration:a,meta:s,message:r,count:c}},vb=({type:e,status:t,autoHide:n,duration:a=2600,closeable:i,state:o,message:r})=>{var u;const s=Number.isInteger(o==null?void 0:o.notificationSequence)?o.notificationSequence:(u=o==null?void 0:o.notification)==null?void 0:u.count,c=Number.isInteger(s)?s+1:0;return{type:e,status:t,autoHide:n,closeable:i,duration:a,message:r,count:c}};function jd(e,t){return(e==null?void 0:e.toLowerCase())===(t==null?void 0:t.toLowerCase())}function wb({site:e,pageQuery:t}){var i,o;const n=/^(?:(\S+?))?\/monthly$/,a=/^(?:(\S+?))?\/yearly$/;if(n.test(t||"")){const[,r]=t.match(n),s=ea({site:e,productId:r});return(i=s==null?void 0:s.monthlyPrice)==null?void 0:i.id}else if(a.test(t||"")){const[,r]=t.match(a),s=ea({site:e,productId:r});return(o=s==null?void 0:s.yearlyPrice)==null?void 0:o.id}return null}const Y0=({offer:e})=>{if(Gs(e)){const t=e.duration_in_months;return t===1?h("1 month"):h("{months} months",{months:t})}else{if(e.type==="fixed")return`${ke(e.currency)}${$d(e.amount/100)}`;if(e.type==="percent")return`${e.amount}%`}return""},Sb=({offer:e,price:t,useFormatted:n=!1})=>{const a=t.amount;let i=a;if(e.type==="fixed"&&jd(e.currency,t.currency))i=Math.max(0,a-e.amount);else if(e.type==="percent"){const r=Math.round(a*(e.amount/100));i=Math.max(0,a-r)}const o=i/100;return n?Intl.NumberFormat("en",{currency:t==null?void 0:t.currency,style:"currency"}).format(o):o},Td=({offer:e})=>e.redemption_type==="retention",L0=({site:e,offer:t})=>(t==null?void 0:t.status)!=="active"?!1:t.tier?!!ea({site:e,productId:t.tier.id}):Td({offer:t});function B0({tier:e,priceId:t}){return e!=null&&e.monthly_price?{id:`price-${t}`,active:!0,type:"recurring",nickname:"Monthly",currency:e.currency,amount:e.monthly_price,interval:"month"}:null}function U0({tier:e,priceId:t}){return e!=null&&e.yearly_price?{id:`price-${t}`,active:!0,type:"recurring",nickname:"Yearly",currency:e.currency,amount:e.yearly_price,interval:"year"}:null}function H0({tier:e}){var t;return(t=e==null?void 0:e.benefits)==null?void 0:t.map(n=>({name:n}))}const V0=({tiers:e})=>{let t=0;return e.map(n=>{let a=B0({tier:n,priceId:t});t+=1;let i=U0({tier:n,priceId:t});t+=1;let o=H0({tier:n});return{...n,benefits:o,monthly_price:a,yearly_price:i}})};function No(){const e="ghost-history";try{const t=sessionStorage.getItem(e);if(t){const n=JSON.parse(t);if(Array.isArray(n))return n}}catch(t){console.warn("[Portal] Failed to load member URL history:",t)}}function W0(e,t=1){const n=new Date(e);if(isNaN(n.getTime()))return null;if(!Number.isInteger(t)||t<1)return n;const a=n.getUTCDate(),i=n.getUTCHours(),o=n.getUTCMinutes(),r=n.getUTCSeconds(),s=n.getUTCMilliseconds();let c=n.getUTCMonth()+t,u=n.getUTCFullYear()+Math.floor(c/12);c=c%12;const d=new Date(Date.UTC(u,c+1,0)).getUTCDate();return new Date(Date.UTC(u,c,Math.min(a,d),i,o,r,s))}function G0({member:e}){if(!(e!=null&&e.created_at))return!1;const t=new Date,n=new Date(e.created_at),a=t.getTime()-n.getTime();return Math.round(a/(1e3*60*60))<24}function Zs({portalPlans:e,portalDefaultPlan:t,selectedInterval:n}){if(n==="month"&&e.includes("monthly"))return"month";if(n==="year"&&e.includes("yearly"))return"year";if(t&&t==="monthly"&&e.includes("monthly"))return"month";if(e.includes("yearly"))return"year";if(e.includes("monthly"))return"month"}function Za(e){return e==="month"?h("month"):e==="year"?h("year"):e}const xb=function(){return K0()||Cb()},K0=function(){const[e]=window.location.hash.substr(1).split("?");return e==="/portal/preview"},Cb=function(){const[e]=window.location.hash.substr(1).split("?");return e==="/portal/preview/offer"},q0={preview:xb,offerPreview:Cb,dev:function({customSiteUrl:e=""}={}){return!1},test:function(){return!1}},de=(e=[],t={})=>e.some(n=>{const a=q0[n];return!!(a&&a(t))}),Eb={"icon-1":d0,"icon-2":m0,"icon-3":p0,"icon-4":h0,"icon-5":f0},$b=({hasText:e})=>({frame:{zIndex:"3999998",position:"fixed",bottom:"0",right:"0",width:"500px",maxWidth:"500px",height:"98px",animation:"250ms ease 0s 1 normal none running animation-bhegco",transition:"opacity 0.3s ease 0s",overflow:"hidden",...{...e?{}:{width:"105px"},...de(["preview"])?{opacity:1}:{}}},userIcon:{width:"34px",height:"34px",color:"#fff"},buttonIcon:{width:"24px",height:"24px",color:"#fff"},closeIcon:{width:"20px",height:"20px",color:"#fff"}}),pm=class pm extends Z.Component{constructor(t){super(t),this.state={},this.container=Z.createRef(),this.height=null,this.width=null}updateHeight(t){this.props.updateHeight&&this.props.updateHeight(t)}updateWidth(t){this.props.updateWidth&&this.props.updateWidth(t)}componentDidMount(){this.container&&(this.height=this.container.current&&this.container.current.offsetHeight,this.width=this.container.current&&this.container.current.offsetWidth,this.updateHeight(this.height),this.updateWidth(this.width))}componentDidUpdate(){if(this.container){const t=this.container.current&&this.container.current.offsetHeight;let n=this.container.current&&this.container.current.offsetWidth;t!==this.height&&(this.height=t,this.updateHeight(this.height)),n!==this.width&&(this.width=n,this.updateWidth(this.width))}}renderTriggerIcon(){const{portal_button_icon:t="",portal_button_style:n=""}=this.context.site||{},a=$b({brandColor:this.context.brandColor}),i=this.context.member&&this.context.member.avatar_image;if(!n.includes("icon")&&!this.context.member)return null;if(i)return l.jsx(kd,{gravatar:i});if(this.context.member)return l.jsx(bd,{style:a.userIcon});if(Object.keys(Eb).includes(t)){const o=Eb[t];return l.jsx(o,{style:a.buttonIcon})}else return t?l.jsx("img",{style:{width:"26px",height:"26px"},src:t,alt:""}):(this.hasText()&&(a.userIcon.width="26px",a.userIcon.height="26px"),l.jsx(bd,{style:a.userIcon}))}hasText(){const{portal_button_signup_text:t,portal_button_style:n}=this.context.site;return["icon-and-text","text-only"].includes(n)&&!this.context.member&&t}renderText(){const{portal_button_signup_text:t}=this.context.site;return this.hasText()?l.jsxs("span",{className:"gh-portal-triggerbtn-label",children:[" ",t," "]}):null}onToggle(){const{showPopup:t,member:n,site:a}=this.context;if(t){this.context.doAction("closePopup");return}if(n){this.context.doAction("openPopup",{page:"accountHome"});return}if(zn({site:a})){const i=Ft({site:a})||!Qt({site:a})?"signin":"signup";this.context.doAction("openPopup",{page:i});return}}render(){const t=this.hasText(),{member:n}=this.context,a=n?"halo":"";return t?l.jsx("div",{className:"gh-portal-triggerbtn-wrapper",ref:this.container,children:l.jsxs("div",{className:"gh-portal-triggerbtn-container with-label",onClick:i=>this.onToggle(i),"data-testid":"portal-trigger-button",children:[this.renderTriggerIcon(),t?this.renderText():""]})}):l.jsx("div",{className:"gh-portal-triggerbtn-wrapper",children:l.jsx("div",{className:"gh-portal-triggerbtn-container "+a,onClick:i=>this.onToggle(i),"data-testid":"portal-trigger-button",children:this.renderTriggerIcon()})})}};pm.contextType=_;let Pd=pm;const hm=class hm extends Z.Component{constructor(t){super(t),this.state={width:null,isMobile:window.innerWidth<640},this.buttonRef=Z.createRef(),this.handleResize=this.handleResize.bind(this)}componentDidMount(){window.addEventListener("resize",this.handleResize),this.handleResize(),setTimeout(()=>{if(this.buttonRef.current){const t=this.buttonRef.current.node;t&&(this.buttonMargin=window.getComputedStyle(t).getPropertyValue("margin-right"))}},0)}componentWillUnmount(){window.removeEventListener("resize",this.handleResize)}handleResize(){this.setState({isMobile:window.innerWidth<640})}onWidthChange(t){this.setState({width:t})}hasText(){const{portal_button_signup_text:t,portal_button_style:n}=this.context.site;return["icon-and-text","text-only"].includes(n)&&!this.context.member&&t}renderFrameStyles(){const{brandColor:t}=this.context,n=t?`:root { --brandcolor: ${t} }`+mb:mb;return l.jsx("style",{dangerouslySetInnerHTML:{__html:n}})}render(){const t=this.context.site,{portal_button:n}=t,{showPopup:a,scrollbarWidth:i}=this.context;if(this.state.isMobile||!n||!zn({site:t})||de(["offerPreview"]))return null;const o=this.hasText(),s={...$b({brandColor:this.context.brandColor,hasText:o}).frame};if(this.state.width){const c=this.state.width+2;s.width=`${c}px`}return i&&a&&(s.marginRight=`calc(${i}px + ${this.buttonMargin})`),l.jsx(yd,{ref:this.buttonRef,dataTestId:"portal-trigger-frame",className:"gh-portal-triggerbtn-iframe",style:s,title:"portal-trigger",head:this.renderFrameStyles(),children:l.jsx(Pd,{isPopupOpen:a,updateWidth:c=>this.onWidthChange(c)})})}};hm.contextType=_;let zd=hm;var jb={exports:{}},J0="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Z0=J0,X0=Z0;function Tb(){}function Pb(){}Pb.resetWarningCache=Tb;var Q0=function(){function e(a,i,o,r,s,c){if(c!==X0){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:Pb,resetWarningCache:Tb};return n.PropTypes=n,n};jb.exports=Q0();var e1=jb.exports;const Id=Ko(e1);function zb(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ao(e){"@babel/helpers - typeof";return Ao=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ao(e)}function t1(e,t){if(Ao(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var a=n.call(e,t);if(Ao(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function n1(e){var t=t1(e,"string");return Ao(t)=="symbol"?t:t+""}function a1(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,n1(a.key),a)}}function Ib(e,t,n){return t&&a1(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function i1(e,t){if(e==null)return{};var n={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(t.includes(a))continue;n[a]=e[a]}return n}function o1(e,t){if(e==null)return{};var n,a,i=i1(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var Nd="TOKEN_PLACEHOLDER",Xs="TOKEN_OPEN_TAG",Ad="TOKEN_CLOSE_TAG",Md="TOKEN_SELF_TAG",Qs="TOKEN_TEXT",Nb="NODE_FRAGMENT",Ab="NODE_TAG_ELEMENT",Mb="NODE_VOID_ELEMENT",Db="NODE_PLACEHOLDER",Fb="NODE_TEXT",r1=["type","children"],He=function(){function e(t){var n=t.type,a=t.children,i=o1(t,r1);zb(this,e),this.type=n,this.children=a||[];for(var o in i)this[o]=i[o];i.token&&(this.string=i.token.string)}return Ib(e,[{key:"appendChild",value:function(n){this.children.push(n)}},{key:"isLeaf",get:function(){return this.children.length===0}}]),e}();He.createTagNode=function(e,t){return new He({type:Ab,children:t,name:e.name,token:e})},He.createFragmentNode=function(e){return new He({type:Nb,children:e})},He.createVoidNode=function(e){return new He({type:Mb,name:e.name,token:e})},He.createTextNode=function(e){return new He({type:Fb,text:e.string,token:e})},He.createPlaceholderNode=function(e){return new He({type:Db,name:e.name,token:e})};var s1=[{type:Nd,regex:/{\s*(\w+)\s*}/g},{type:Xs,regex:/<(\w+)>/g},{type:Ad,regex:/<\/(\w+)>/g},{type:Md,regex:/<(\w+)\s*\/>/g}];function l1(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=c1(e))||t){n&&(e=n);var a=0,i=function(){};return{s:i,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
429
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,r=!1,s;return{s:function(){n=n.call(e)},n:function(){var u=n.next();return o=u.done,u},e:function(u){r=!0,s=u},f:function(){try{!o&&n.return!=null&&n.return()}finally{if(r)throw s}}}}function
|
|
428
|
+
`+db,Xt=e=>{if(!e)return"";const t=new Date(e),n={year:"numeric",month:"short",day:"numeric"};return t.toLocaleDateString("en-GB",n)};function Tn(){const[e]=window.location.hash.substr(1).split("?"),t=/^\/portal\/?(?:\/(\w+(?:\/\w+)*))?\/?$/,n=/^\/share\/?$/;e&&(t.test(e)||n.test(e))&&window.history.pushState("",document.title,window.location.pathname+window.location.search)}function g1({page:e}){const t={signin:"#/portal/signin",signup:"#/portal/signup"};return Object.keys(t).includes(e)?t[e]:t.default}function pb({page:e,siteUrl:t}){const n=t||`${window.location.protocol}//${window.location.host}${window.location.pathname}`,a=g1({page:e});return`${n}${a}`}function Zn(){return!(navigator&&navigator.cookieEnabled)}function y1({event:e}){var i,o,r,s;const n=(((s=(r=(o=(i=e==null?void 0:e.exception)==null?void 0:i.values)==null?void 0:o[0])==null?void 0:r.stacktrace)==null?void 0:s.frames)||[]).map(c=>c.filename).filter(c=>!!c);return(n[n.length-1]||"").includes("@tryghost/portal")}function rt({member:e={}}){if(Dt({member:e})){const n=(e.subscriptions||[]).find(a=>["active","trialing","unpaid","past_due"].includes(a.status));return!(n!=null&&n.price)&&(n!=null&&n.plan)&&(n.price=n.plan),n}return null}function Pn({member:e={}}){if(!e)return!1;const t=rt({member:e});if(t){const{price:n}=t;return n&&n.amount===0}else if(!t&&e.paid)return!0;return!1}function Dt({member:e={}}){return e&&e.paid}function b1({product:e}){return e!=null&&e.monthlyPrice?e.monthlyPrice.currency:null}function jo({site:e}){return(e==null?void 0:e.editor_default_email_recipients)!=="disabled"}function wd({member:e}){var n;const t=rt({member:e});return(n=t==null?void 0:t.tier)!=null&&n.expiry_at?Xt(t.tier.expiry_at):""}function k1({site:e,member:t}){const n=Xn({member:t}),a=n==null?void 0:n.currency,i=To({site:e});return n!=null&&n.id?i.filter(o=>jd(b1({product:o}),a)):i}function v1({prices:e,currency:t}){return e.filter(n=>jd(n.currency||"",t||""))}function Rs({subscription:e}){var t,n;return e&&e.price?{...e.price,stripe_price_id:e.price.id,id:e.price.price_id,price:e.price.amount/100,name:e.price.nickname,tierId:(t=e.tier)==null?void 0:t.id,cadence:((n=e.price)==null?void 0:n.interval)==="month"?"month":"year",currency:e.price.currency.toLowerCase(),currency_symbol:ke(e.price.currency)}:null}function Xn({member:e}){const t=rt({member:e});return Rs({subscription:t})}function w1({member:e,site:t}){const n=rt({member:e}),a=Rs({subscription:n});return Hs({site:t}).find(o=>o.id===(a==null?void 0:a.product.product_id))}function S1({priceId:e,site:t,member:n}){const a=Xn({member:n}),{tierId:i,cadence:o}=na({site:t,priceId:e});return(a==null?void 0:a.tierId)===i&&(a==null?void 0:a.cadence)===o}function x1({member:e,subscriptionId:t}){return Dt({member:e})?(e.subscriptions||[]).find(a=>a.id===t):null}function hb({member:e}){var n;const t=rt({member:e});return((n=t==null?void 0:t.tier)==null?void 0:n.name)||""}function Ja({plans:e,site:t={}}){return e=e||qs({site:t}),!e||e.length===0||e.length===1&&e[0].type==="free"}function C1(e,t){const a=To({site:e}).find(i=>i.type==="paid");return t==="monthly"?{cadence:"month",tierId:a.id}:t==="yearly"?{cadence:"year",tierId:a.id}:{priceId:t}}function E1({site:e={},priceId:t}){const n=Ks({site:e});if(t==="free")return!n||n.length===0||n.find(a=>a.type==="free");if(n&&n.length>0&&t==="monthly"){const a=n.find(o=>o.name==="Monthly"),i=n.find(o=>o.interval==="month");return a||i}else if(n&&n.length>0&&t==="yearly"){const a=n.find(o=>o.name==="Yearly"),i=n.find(o=>o.interval==="year");return a||i}else if(n&&n.length>0&&t)return n.find(a=>a.id===t);return null}function $1({site:e}){return(e==null?void 0:e.members_signup_access)==="paid"}function Ft({site:e={}}){return(e==null?void 0:e.members_signup_access)==="invite"}function Qt({site:e={},pageQuery:t=""}){return qs({site:e,pageQuery:t}).length>0}function j1({site:e}){return(e==null?void 0:e.recommendations_enabled)===!0}function Ys({site:e}){var t;return((t=e==null?void 0:e.labs)==null?void 0:t.giftSubscriptions)===!0}function zn({site:e}){return(e==null?void 0:e.members_signup_access)!=="none"}function Ls({site:e}){const t=(e==null?void 0:e.members_signup_access)==="all"||(e==null?void 0:e.members_signup_access)==="paid",n=(e==null?void 0:e.is_stripe_configured)||Ja({site:e});return t&&n}function Sd({site:e}){return(e==null?void 0:e.members_signup_access)==="all"}function fb(){return window.location.hostname.replace(/^www\./,"")}function Bs({site:e}){const{portal_products:t}=e||{};return!!t}function Us({site:e}){return(e==null?void 0:e.comments_enabled)&&(e==null?void 0:e.comments_enabled)!=="off"}function T1({site:e}){var t,n,a,i,o;try{if(!e)return null;if(e.tiers&&(e.products=e.tiers),e.products=(t=e.products)==null?void 0:t.map(r=>({...r,monthlyPrice:r.monthly_price,yearlyPrice:r.yearly_price})),e.is_stripe_configured=!!e.paid_members_enabled,(a=(n=e.products)==null?void 0:n[0])!=null&&a.visibility){e.portal_products=e.products.filter(s=>s.visibility!=="none"&&s.type==="paid").map(s=>s.id);const r=e.products.find(s=>s.type==="free");r&&(e.portal_plans=(i=e.portal_plans)==null?void 0:i.filter(s=>s!=="free"),(r==null?void 0:r.visibility)==="public"&&((o=e.portal_plans)==null||o.push("free")))}return e}catch(r){console.warn("[Portal] Failed to read site data:",r)}}function To({site:e}){const{portal_products:t,products:n=[],portal_plans:a=[]}=e||{};return!a.includes("monthly")&&!a.includes("yearly")?[]:n.filter(i=>!!i).filter(i=>e.is_stripe_configured?!0:i.type!=="paid").filter(i=>!!(i.monthlyPrice&&i.yearlyPrice)).filter(i=>Object.keys(i.monthlyPrice).length>0&&Object.keys(i.yearlyPrice).length>0).filter(i=>t&&n.length>1?t.includes(i.id):!0).sort((i,o)=>{var r,s;return((r=i==null?void 0:i.monthlyPrice)==null?void 0:r.amount)-((s=o==null?void 0:o.monthlyPrice)==null?void 0:s.amount)}).map(i=>(i.monthlyPrice={...i.monthlyPrice,currency_symbol:ke(i.monthlyPrice.currency)},i.yearlyPrice={...i.yearlyPrice,currency_symbol:ke(i.yearlyPrice.currency)},i))}function Qn({site:e}){const{products:t=[]}=e||{};return t.find(n=>n.type==="free")}function Hs({site:e}){const{products:t=[],portal_plans:n=[]}=e||{};return!n.includes("monthly")&&!n.includes("yearly")?[]:t.filter(a=>!!a).filter(a=>!!(a.monthlyPrice&&a.yearlyPrice)).filter(a=>Object.keys(a.monthlyPrice).length>0&&Object.keys(a.yearlyPrice).length>0).sort((a,i)=>{var o,r;return((o=a==null?void 0:a.monthlyPrice)==null?void 0:o.amount)-((r=i==null?void 0:i.monthlyPrice)==null?void 0:r.amount)}).map(a=>(a.monthlyPrice={...a.monthlyPrice,currency_symbol:ke(a.monthlyPrice.currency)},a.yearlyPrice={...a.yearlyPrice,currency_symbol:ke(a.yearlyPrice.currency)},a))}function Vs({site:e,pageQuery:t}){const n=To({site:e});return t==="free"?[]:(Po({site:e})&&n.unshift({id:"free",type:"free"}),n)}function Ws({site:e,pageQuery:t}){return Vs({site:e,pageQuery:t}).some(a=>!!(a!=null&&a.trial_days))}function P1({site:e}){const t=Qn({site:e});return(t==null?void 0:t.benefits)||[]}function gb({site:e}){const t=Qn({site:e});return(t==null?void 0:t.name)||"Free"}function z1({site:e}){const t=Qn({site:e});return t==null?void 0:t.description}function I1({site:e}){var n;const t=Qn({site:e});return!!(t!=null&&t.description||(n=t==null?void 0:t.benefits)!=null&&n.length)}function ea({site:e,productId:t}){return Hs({site:e}).find(a=>a.id===t)}function N1({site:e=null,products:t=null}){return!e&&!t?[]:(t||To({site:e})).reduce((i,o)=>(o.monthlyPrice&&o.yearlyPrice&&(i.push(o.monthlyPrice),i.push(o.yearlyPrice)),i),[])}function Po({site:e}){const{portal_plans:t}=e||{};return Sd({site:e})&&t.includes("free")}function ta({site:e}){const{newsletters:t=[]}=e||{};return t==null||t.sort((n,a)=>n.sort_order-a.sort_order),t}function zo({site:e}){const{newsletters:t}=e||{};return(t==null?void 0:t.length)>1}function yb({member:e}){var t;return(t=e==null?void 0:e.email_suppression)==null?void 0:t.suppressed}function bb({site:e}){return Vs({site:e}).length===1&&Po({site:e})}function xd({sub:e}={}){var a;return(!(e!=null&&e.offer)||((a=e==null?void 0:e.offer)==null?void 0:a.type)==="trial")&&(e==null?void 0:e.trial_end_at)&&!A1(new Date(e==null?void 0:e.trial_end_at))}function Gs(e){return(e==null?void 0:e.type)==="percent"&&(e==null?void 0:e.amount)===100&&(e==null?void 0:e.duration)==="repeating"&&(e==null?void 0:e.redemption_type)==="retention"}function A1(e){return e<new Date}function kb({site:e,priceId:t}){return t==="free"?Qn({site:e}):Hs({site:e}).find(a=>{var i,o;return((i=a==null?void 0:a.monthlyPrice)==null?void 0:i.id)===t||((o=a==null?void 0:a.yearlyPrice)==null?void 0:o.id)===t})}function na({site:e,priceId:t}){var o;if(t==="free")return Qn({site:e});const a=Hs({site:e}).find(r=>{var s,c;return((s=r==null?void 0:r.monthlyPrice)==null?void 0:s.id)===t||((c=r==null?void 0:r.yearlyPrice)==null?void 0:c.id)===t});let i="month";return((o=a==null?void 0:a.yearlyPrice)==null?void 0:o.id)===t&&(i="year"),{tierId:a==null?void 0:a.id,cadence:i}}function Ks({site:e,products:t=null}){const{portal_plans:n=[],is_stripe_configured:a}=e||{};return a?N1({site:e,products:t}).filter(o=>!!(o&&o.id)).map(o=>({...o,price_id:o.id,price:o.amount/100,name:o.nickname,currency_symbol:ke(o.currency)})).filter(o=>o.amount!==0&&o.type==="recurring").filter(o=>o.interval==="month"?n.includes("monthly"):o.interval==="year"?n.includes("yearly"):!1).sort((o,r)=>o.amount-r.amount).sort((o,r)=>!o.currency||!r.currency?0:o.currency.localeCompare(r.currency,void 0,{ignorePunctuation:!0})):[]}function M1({site:e}){const t=Ks({site:e});let n={currency:"usd",currency_symbol:"$"};return(t==null?void 0:t.length)>0&&(n.currency=t[0].currency,n.currency_symbol=t[0].currency_symbol),n}function qs({site:e={},pageQuery:t=""}={}){const n=[];if(Po({site:e})){const i=M1({site:e});n.push({id:"free",type:"free",price:0,amount:0,name:gb({site:e}),...i})}return t==="free"&&Po({site:e})||Ks({site:e}).forEach(o=>{n.push(o)}),n}const D1=({member:e})=>e?e.email:"",Cd=({member:e})=>e?e.email_suppression:"",F1=({site:e})=>e&&e.firstpromoter_account,O1=({member:e})=>e?e.name:"",Io=({site:e})=>{var a;const{members_support_address:t,support_email_address:n}=e||{};if(n)return n;if((t==null?void 0:t.indexOf("@"))<0){const i=Ed({site:e}),o=(i==null?void 0:i.replace(/^(www)\.(?=[^/]*\..{2,5})/,""))||"";return`${t}@${o}`}if(((a=t==null?void 0:t.split("@"))==null?void 0:a.length)>1){const[i,o]=t.split("@"),r=(o==null?void 0:o.replace(/^(www)\.(?=[^/]*\..{2,5})/,""))||"";return`${i}@${r}`}return t||""},_1=({site:e})=>{const{default_email_address:t}=e||{},n=t||`noreply@${Ed({site:e})}`,a=ta({site:e}),i=a==null?void 0:a[0];return i&&i.sender_email?i.sender_email:n},Ed=({site:e})=>{try{return new URL(e.url).origin.replace(/^http(s?):\/\//,"").replace(/\/$/,"")}catch{return e.url.replace(/^http(s?):\/\//,"").replace(/\/$/,"")}},ke=e=>Intl.NumberFormat("en",{currency:e,style:"currency"}).format(0).replace(/[\d\s.]/g,""),Js=e=>isNaN(e)?0:e/100,R1=(e={})=>{const t=ke(e.currency),n=Js(e.amount);return`${t}${n}/${e.interval}`},aa=e=>e==null?"":e.toLocaleString(),$d=(e,t)=>{if(e==null)return"";const n=Number(e);if(Number.isNaN(n))return"";const a=Number.isInteger(n)?void 0:{minimumFractionDigits:2,maximumFractionDigits:2};return n.toLocaleString(t,a)},re=({type:e,status:t,autoHide:n,duration:a=2600,closeable:i,state:o,message:r,meta:s={}})=>{let c=0;return o&&o.popupNotification&&(c=(o.popupNotification.count||0)+1),{type:e,status:t,autoHide:n,closeable:i,duration:a,meta:s,message:r,count:c}},vb=({type:e,status:t,autoHide:n,duration:a=2600,closeable:i,state:o,message:r})=>{var u;const s=Number.isInteger(o==null?void 0:o.notificationSequence)?o.notificationSequence:(u=o==null?void 0:o.notification)==null?void 0:u.count,c=Number.isInteger(s)?s+1:0;return{type:e,status:t,autoHide:n,closeable:i,duration:a,message:r,count:c}};function jd(e,t){return(e==null?void 0:e.toLowerCase())===(t==null?void 0:t.toLowerCase())}function wb({site:e,pageQuery:t}){var i,o;const n=/^(?:(\S+?))?\/monthly$/,a=/^(?:(\S+?))?\/yearly$/;if(n.test(t||"")){const[,r]=t.match(n),s=ea({site:e,productId:r});return(i=s==null?void 0:s.monthlyPrice)==null?void 0:i.id}else if(a.test(t||"")){const[,r]=t.match(a),s=ea({site:e,productId:r});return(o=s==null?void 0:s.yearlyPrice)==null?void 0:o.id}return null}const Y1=({offer:e})=>{if(Gs(e)){const t=e.duration_in_months;return t===1?h("1 month"):h("{months} months",{months:t})}else{if(e.type==="fixed")return`${ke(e.currency)}${$d(e.amount/100)}`;if(e.type==="percent")return`${e.amount}%`}return""},Sb=({offer:e,price:t,useFormatted:n=!1})=>{const a=t.amount;let i=a;if(e.type==="fixed"&&jd(e.currency,t.currency))i=Math.max(0,a-e.amount);else if(e.type==="percent"){const r=Math.round(a*(e.amount/100));i=Math.max(0,a-r)}const o=i/100;return n?Intl.NumberFormat("en",{currency:t==null?void 0:t.currency,style:"currency"}).format(o):o},Td=({offer:e})=>e.redemption_type==="retention",L1=({site:e,offer:t})=>(t==null?void 0:t.status)!=="active"?!1:t.tier?!!ea({site:e,productId:t.tier.id}):Td({offer:t});function B1({tier:e,priceId:t}){return e!=null&&e.monthly_price?{id:`price-${t}`,active:!0,type:"recurring",nickname:"Monthly",currency:e.currency,amount:e.monthly_price,interval:"month"}:null}function U1({tier:e,priceId:t}){return e!=null&&e.yearly_price?{id:`price-${t}`,active:!0,type:"recurring",nickname:"Yearly",currency:e.currency,amount:e.yearly_price,interval:"year"}:null}function H1({tier:e}){var t;return(t=e==null?void 0:e.benefits)==null?void 0:t.map(n=>({name:n}))}const V1=({tiers:e})=>{let t=0;return e.map(n=>{let a=B1({tier:n,priceId:t});t+=1;let i=U1({tier:n,priceId:t});t+=1;let o=H1({tier:n});return{...n,benefits:o,monthly_price:a,yearly_price:i}})};function No(){const e="ghost-history";try{const t=sessionStorage.getItem(e);if(t){const n=JSON.parse(t);if(Array.isArray(n))return n}}catch(t){console.warn("[Portal] Failed to load member URL history:",t)}}function W1(e,t=1){const n=new Date(e);if(isNaN(n.getTime()))return null;if(!Number.isInteger(t)||t<1)return n;const a=n.getUTCDate(),i=n.getUTCHours(),o=n.getUTCMinutes(),r=n.getUTCSeconds(),s=n.getUTCMilliseconds();let c=n.getUTCMonth()+t,u=n.getUTCFullYear()+Math.floor(c/12);c=c%12;const d=new Date(Date.UTC(u,c+1,0)).getUTCDate();return new Date(Date.UTC(u,c,Math.min(a,d),i,o,r,s))}function G1({member:e}){if(!(e!=null&&e.created_at))return!1;const t=new Date,n=new Date(e.created_at),a=t.getTime()-n.getTime();return Math.round(a/(1e3*60*60))<24}function Zs({portalPlans:e,portalDefaultPlan:t,selectedInterval:n}){if(n==="month"&&e.includes("monthly"))return"month";if(n==="year"&&e.includes("yearly"))return"year";if(t&&t==="monthly"&&e.includes("monthly"))return"month";if(e.includes("yearly"))return"year";if(e.includes("monthly"))return"month"}function Za(e){return e==="month"?h("month"):e==="year"?h("year"):e}const xb=function(){return K1()||Cb()},K1=function(){const[e]=window.location.hash.substr(1).split("?");return e==="/portal/preview"},Cb=function(){const[e]=window.location.hash.substr(1).split("?");return e==="/portal/preview/offer"},q1={preview:xb,offerPreview:Cb,dev:function({customSiteUrl:e=""}={}){return!1},test:function(){return!1}},de=(e=[],t={})=>e.some(n=>{const a=q1[n];return!!(a&&a(t))}),Eb={"icon-1":d1,"icon-2":m1,"icon-3":p1,"icon-4":h1,"icon-5":f1},$b=({hasText:e})=>({frame:{zIndex:"3999998",position:"fixed",bottom:"0",right:"0",width:"500px",maxWidth:"500px",height:"98px",animation:"250ms ease 0s 1 normal none running animation-bhegco",transition:"opacity 0.3s ease 0s",overflow:"hidden",...{...e?{}:{width:"105px"},...de(["preview"])?{opacity:1}:{}}},userIcon:{width:"34px",height:"34px",color:"#fff"},buttonIcon:{width:"24px",height:"24px",color:"#fff"},closeIcon:{width:"20px",height:"20px",color:"#fff"}}),pm=class pm extends Z.Component{constructor(t){super(t),this.state={},this.container=Z.createRef(),this.height=null,this.width=null}updateHeight(t){this.props.updateHeight&&this.props.updateHeight(t)}updateWidth(t){this.props.updateWidth&&this.props.updateWidth(t)}componentDidMount(){this.container&&(this.height=this.container.current&&this.container.current.offsetHeight,this.width=this.container.current&&this.container.current.offsetWidth,this.updateHeight(this.height),this.updateWidth(this.width))}componentDidUpdate(){if(this.container){const t=this.container.current&&this.container.current.offsetHeight;let n=this.container.current&&this.container.current.offsetWidth;t!==this.height&&(this.height=t,this.updateHeight(this.height)),n!==this.width&&(this.width=n,this.updateWidth(this.width))}}renderTriggerIcon(){const{portal_button_icon:t="",portal_button_style:n=""}=this.context.site||{},a=$b({brandColor:this.context.brandColor}),i=this.context.member&&this.context.member.avatar_image;if(!n.includes("icon")&&!this.context.member)return null;if(i)return l.jsx(kd,{gravatar:i});if(this.context.member)return l.jsx(bd,{style:a.userIcon});if(Object.keys(Eb).includes(t)){const o=Eb[t];return l.jsx(o,{style:a.buttonIcon})}else return t?l.jsx("img",{style:{width:"26px",height:"26px"},src:t,alt:""}):(this.hasText()&&(a.userIcon.width="26px",a.userIcon.height="26px"),l.jsx(bd,{style:a.userIcon}))}hasText(){const{portal_button_signup_text:t,portal_button_style:n}=this.context.site;return["icon-and-text","text-only"].includes(n)&&!this.context.member&&t}renderText(){const{portal_button_signup_text:t}=this.context.site;return this.hasText()?l.jsxs("span",{className:"gh-portal-triggerbtn-label",children:[" ",t," "]}):null}onToggle(){const{showPopup:t,member:n,site:a}=this.context;if(t){this.context.doAction("closePopup");return}if(n){this.context.doAction("openPopup",{page:"accountHome"});return}if(zn({site:a})){const i=Ft({site:a})||!Qt({site:a})?"signin":"signup";this.context.doAction("openPopup",{page:i});return}}render(){const t=this.hasText(),{member:n}=this.context,a=n?"halo":"";return t?l.jsx("div",{className:"gh-portal-triggerbtn-wrapper",ref:this.container,children:l.jsxs("div",{className:"gh-portal-triggerbtn-container with-label",onClick:i=>this.onToggle(i),"data-testid":"portal-trigger-button",children:[this.renderTriggerIcon(),t?this.renderText():""]})}):l.jsx("div",{className:"gh-portal-triggerbtn-wrapper",children:l.jsx("div",{className:"gh-portal-triggerbtn-container "+a,onClick:i=>this.onToggle(i),"data-testid":"portal-trigger-button",children:this.renderTriggerIcon()})})}};pm.contextType=_;let Pd=pm;const hm=class hm extends Z.Component{constructor(t){super(t),this.state={width:null,isMobile:window.innerWidth<640},this.buttonRef=Z.createRef(),this.handleResize=this.handleResize.bind(this)}componentDidMount(){window.addEventListener("resize",this.handleResize),this.handleResize(),setTimeout(()=>{if(this.buttonRef.current){const t=this.buttonRef.current.node;t&&(this.buttonMargin=window.getComputedStyle(t).getPropertyValue("margin-right"))}},0)}componentWillUnmount(){window.removeEventListener("resize",this.handleResize)}handleResize(){this.setState({isMobile:window.innerWidth<640})}onWidthChange(t){this.setState({width:t})}hasText(){const{portal_button_signup_text:t,portal_button_style:n}=this.context.site;return["icon-and-text","text-only"].includes(n)&&!this.context.member&&t}renderFrameStyles(){const{brandColor:t}=this.context,n=t?`:root { --brandcolor: ${t} }`+mb:mb;return l.jsx("style",{dangerouslySetInnerHTML:{__html:n}})}render(){const t=this.context.site,{portal_button:n}=t,{showPopup:a,scrollbarWidth:i}=this.context;if(this.state.isMobile||!n||!zn({site:t})||de(["offerPreview"]))return null;const o=this.hasText(),s={...$b({brandColor:this.context.brandColor,hasText:o}).frame};if(this.state.width){const c=this.state.width+2;s.width=`${c}px`}return i&&a&&(s.marginRight=`calc(${i}px + ${this.buttonMargin})`),l.jsx(yd,{ref:this.buttonRef,dataTestId:"portal-trigger-frame",className:"gh-portal-triggerbtn-iframe",style:s,title:"portal-trigger",head:this.renderFrameStyles(),children:l.jsx(Pd,{isPopupOpen:a,updateWidth:c=>this.onWidthChange(c)})})}};hm.contextType=_;let zd=hm;var jb={exports:{}},J1="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Z1=J1,X1=Z1;function Tb(){}function Pb(){}Pb.resetWarningCache=Tb;var Q1=function(){function e(a,i,o,r,s,c){if(c!==X1){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:Pb,resetWarningCache:Tb};return n.PropTypes=n,n};jb.exports=Q1();var e0=jb.exports;const Id=Ko(e0);function zb(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ao(e){"@babel/helpers - typeof";return Ao=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ao(e)}function t0(e,t){if(Ao(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var a=n.call(e,t);if(Ao(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function n0(e){var t=t0(e,"string");return Ao(t)=="symbol"?t:t+""}function a0(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,n0(a.key),a)}}function Ib(e,t,n){return t&&a0(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function i0(e,t){if(e==null)return{};var n={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(t.includes(a))continue;n[a]=e[a]}return n}function o0(e,t){if(e==null)return{};var n,a,i=i0(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var Nd="TOKEN_PLACEHOLDER",Xs="TOKEN_OPEN_TAG",Ad="TOKEN_CLOSE_TAG",Md="TOKEN_SELF_TAG",Qs="TOKEN_TEXT",Nb="NODE_FRAGMENT",Ab="NODE_TAG_ELEMENT",Mb="NODE_VOID_ELEMENT",Db="NODE_PLACEHOLDER",Fb="NODE_TEXT",r0=["type","children"],He=function(){function e(t){var n=t.type,a=t.children,i=o0(t,r0);zb(this,e),this.type=n,this.children=a||[];for(var o in i)this[o]=i[o];i.token&&(this.string=i.token.string)}return Ib(e,[{key:"appendChild",value:function(n){this.children.push(n)}},{key:"isLeaf",get:function(){return this.children.length===0}}]),e}();He.createTagNode=function(e,t){return new He({type:Ab,children:t,name:e.name,token:e})},He.createFragmentNode=function(e){return new He({type:Nb,children:e})},He.createVoidNode=function(e){return new He({type:Mb,name:e.name,token:e})},He.createTextNode=function(e){return new He({type:Fb,text:e.string,token:e})},He.createPlaceholderNode=function(e){return new He({type:Db,name:e.name,token:e})};var s0=[{type:Nd,regex:/{\s*(\w+)\s*}/g},{type:Xs,regex:/<(\w+)>/g},{type:Ad,regex:/<\/(\w+)>/g},{type:Md,regex:/<(\w+)\s*\/>/g}];function l0(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=c0(e))||t){n&&(e=n);var a=0,i=function(){};return{s:i,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
429
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,r=!1,s;return{s:function(){n=n.call(e)},n:function(){var u=n.next();return o=u.done,u},e:function(u){r=!0,s=u},f:function(){try{!o&&n.return!=null&&n.return()}finally{if(r)throw s}}}}function c0(e,t){if(e){if(typeof e=="string")return Ob(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ob(e,t)}}function Ob(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function u0(e,t){var n=[],a=l0(t),i;try{for(a.s();!(i=a.n()).done;)for(var o=i.value,r=o.type,s=o.regex,c;(c=s.exec(e))!==null;)n.push({type:r,string:c[0],name:c[1],start:c.index,end:c.index+c[0].length})}catch(f){a.e(f)}finally{a.f()}n.sort(function(f,b){return f.start-b.start});var u=[],d=0;n.forEach(function(f){if(f.start===d){d=f.end;return}var b=f.start,w=e.substring(d,b);u.push({type:Qs,string:w,text:w,start:d,end:b}),d=f.end});var p=e.substring(d);p!==""&&u.push({type:Qs,string:p,start:d,end:e.length});var m=[].concat(u,n).sort(function(f,b){return f.start-b.start});return m}function d0(e,t){t||(t=s0);var n=u0(e,t),a=new m0(n);return a.parse()}var Mo="Syntax error. Please check if each open tag is closed correctly",_b={type:"EPSILON"},m0=function(){function e(t){zb(this,e),this.tokens=[].concat(t),this.tags=[]}return Ib(e,[{key:"parse",value:function(){var n=this.document();if(!this.predict(_b.type))throw new Error(Mo);return n}},{key:"document",value:function(){var n=this.elementOrData();return He.createFragmentNode(n)}},{key:"element",value:function(){var n=this.openTag(),a=this.elementOrData();return this.endTag(),He.createTagNode(n,a)}},{key:"openTag",value:function(){if(!this.predict(Xs))throw new Error(Mo);return this.pushTag(this.lookahead),this.match(Xs)}},{key:"elementOrData",value:function(){var n=[];if(this.predict(Xs)&&(n.push(this.element()),n=n.concat(this.elementOrData())),this.predict(Md,Qs,Nd)){var a=this.match(this.lookahead.type),i;switch(a.type){case Md:i=He.createVoidNode(a);break;case Qs:i=He.createTextNode(a);break;case Nd:i=He.createPlaceholderNode(a);break}n.push(i),n=n.concat(this.elementOrData())}return n}},{key:"endTag",value:function(){if(!this.predict(Ad))throw new Error(Mo);var n=this.tags.pop();if(n.name!==this.lookahead.name)throw new Error(Mo);this.match(Ad)}},{key:"lookahead",get:function(){return this.tokens.length===0?_b:this.tokens[0]}},{key:"predict",value:function(){for(var n=arguments.length,a=new Array(n),i=0;i<n;i++)a[i]=arguments[i];return a.includes(this.lookahead.type)}},{key:"match",value:function(n){if(!this.predict(n))throw new Error(Mo);var a=this.tokens.shift();return a}},{key:"pushTag",value:function(n){this.tags.push(n)}}]),e}(),p0=function e(t,n,a){var i=t.children.map(function(c,u){return Z.createElement(Z.Fragment,{key:a+u},e(c,n,a))});switch(t.type){case Fb:return t.text;case Nb:return Z.createElement(Z.Fragment,null,i);case Mb:{var o=n[t.name];return typeof o=="function"?o():o||Z.createElement(t.name,null)}case Ab:{var r=n[t.name];if(r===void 0)return Z.createElement(t.name,null,i);if(typeof r=="function")return r(i);if(Z.isValidElement(r)){if(Z.Children.count(r.props.children)!==0)throw new Error("when passing an element as value, the element should not contains children");return Z.cloneElement(r,{children:i})}throw new Error('Invalid mapping value for "'.concat(t.name,'". Only element or render function are accepted'))}case Db:{var s=n[t.name];return s===void 0?(console.warn('missing "'.concat(t.name,'" in mapping')),t.string):typeof s=="function"?s():s}default:return}};function $e(e){var t=e.string,n=e.syntax,a=e.mapping,i=a===void 0?{}:a,o=e.graceful,r=o===void 0?!0:o;try{var s=d0(t,n);return p0(s,i,t)}catch(c){if(r)return console.error(c),t;throw c}}$e.propTypes={string:Id.string.isRequired,mapping:Id.object,graceful:Id.bool};const Dd=vd+`
|
|
430
430
|
.gh-portal-notification-wrapper {
|
|
431
431
|
position: relative;
|
|
432
432
|
overflow: hidden;
|
|
@@ -571,7 +571,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
571
571
|
animation-name: notification-slideout-mobile;
|
|
572
572
|
}
|
|
573
573
|
}
|
|
574
|
-
`,Fd=e=>v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},v.createElement("defs",null,v.createElement("style",null,".a{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.2px !important;}")),v.createElement("path",{className:"a",d:"M.75 23.249l22.5-22.5M23.25 23.249L.75.749"})),Rb=e=>v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},v.createElement("defs",null,v.createElement("style",null,".checkmark-icon-fill{fill:currentColor;}")),v.createElement("path",{className:"checkmark-icon-fill",d:"M12,0A12,12,0,1,0,24,12,12.014,12.014,0,0,0,12,0Zm6.927,8.2-6.845,9.289a1.011,1.011,0,0,1-1.43.188L5.764,13.769a1,1,0,1,1,1.25-1.562l4.076,3.261,6.227-8.451A1,1,0,1,1,18.927,8.2Z"})),Od=e=>v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},v.createElement("defs",null,v.createElement("style",null,".warning-icon-fill{fill:currentColor;}")),v.createElement("path",{className:"warning-icon-fill",d:"M23.25,23.235a.75.75,0,0,0,.661-1.105l-11.25-21a.782.782,0,0,0-1.322,0l-11.25,21A.75.75,0,0,0,.75,23.235ZM12,20.485a1.5,1.5,0,1,1,1.5-1.5A1.5,1.5,0,0,1,12,20.485Zm0-12.25a1,1,0,0,1,1,1V14.7a1,1,0,0,1-2,0V9.235A1,1,0,0,1,12,8.235Z"})),
|
|
574
|
+
`,Fd=e=>v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},v.createElement("defs",null,v.createElement("style",null,".a{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.2px !important;}")),v.createElement("path",{className:"a",d:"M.75 23.249l22.5-22.5M23.25 23.249L.75.749"})),Rb=e=>v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},v.createElement("defs",null,v.createElement("style",null,".checkmark-icon-fill{fill:currentColor;}")),v.createElement("path",{className:"checkmark-icon-fill",d:"M12,0A12,12,0,1,0,24,12,12.014,12.014,0,0,0,12,0Zm6.927,8.2-6.845,9.289a1.011,1.011,0,0,1-1.43.188L5.764,13.769a1,1,0,1,1,1.25-1.562l4.076,3.261,6.227-8.451A1,1,0,1,1,18.927,8.2Z"})),Od=e=>v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},v.createElement("defs",null,v.createElement("style",null,".warning-icon-fill{fill:currentColor;}")),v.createElement("path",{className:"warning-icon-fill",d:"M23.25,23.235a.75.75,0,0,0,.661-1.105l-11.25-21a.782.782,0,0,0-1.322,0l-11.25,21A.75.75,0,0,0,.75,23.235ZM12,20.485a1.5,1.5,0,1,1,1.5-1.5A1.5,1.5,0,0,1,12,20.485Zm0-12.25a1,1,0,0,1,1,1V14.7a1,1,0,0,1-2,0V9.235A1,1,0,0,1,12,8.235Z"})),h0=({action:e,status:t})=>{if(t&&["true","false"].includes(t)){const n=JSON.parse(t);return{type:e,status:n?"success":"error",duration:3e3,autoHide:!!n}}return{}},f0=({status:e,billingOnly:t})=>{if(!t&&["success"].includes(e))return{type:"stripe:checkout",status:["success"].includes(e)?"success":"warning",duration:3e3,autoHide:!0};if(t&&["billing-portal-closed","billing-update-success","billing-update-cancel"].includes(e))return{type:"stripe:billing-update",status:e==="billing-update-cancel"?"warning":"success",duration:3e3,autoHide:!0,closeable:!0}},el=(e=[])=>{const t=window.location.search||"",n=new URLSearchParams(t);e.forEach(i=>{n.delete(i)});const a=n.toString()?`?${n}`:"";window.history.replaceState({},"",`${window.location.pathname}${a}`)};function Yb({billingOnly:e=!1}={}){const t=window.location.search;if(!t)return null;const n=new URLSearchParams(t),a=n.get("action"),i=n.get("success"),o=n.get("stripe");let r=null;return o?f0({status:o,billingOnly:e}):a&&i&&!e?h0({action:a,status:i}):r}const g0=()=>({frame:{zIndex:"4000000",position:"fixed",top:"0",right:"0",maxWidth:"481px",width:"100%",height:"220px",animation:"250ms ease 0s 1 normal none running animation-bhegco",transition:"opacity 0.3s ease 0s",overflow:"hidden"}}),y0=({type:e,status:t,message:n,context:a})=>{const i=pb({page:"signin",siteUrl:a.site.url}),o=pb({page:"signup",siteUrl:a.site.url});if(n)return typeof n=="object"?l.jsxs("p",{children:[n.title?l.jsx("strong",{children:n.title}):null,n.title&&n.subtitle?l.jsx("br",{}):null,n.subtitle||null]}):l.jsx("p",{children:n});if(e==="signin"&&t==="success"&&a.member){const r=a.member.firstname||"";return l.jsxs("p",{children:[l.jsx("strong",{children:r?h("Welcome back, {name}!",{name:r}):h("Welcome back!")}),l.jsx("br",{}),h("You've successfully signed in.")]})}else{if(e==="signin"&&t==="error")return l.jsxs("p",{children:[h("Could not sign in. Login link expired.")," ",l.jsx("br",{}),l.jsx("a",{href:i,target:"_parent",children:h("Click here to retry")})]});if(e==="signup"&&t==="success")return l.jsx("p",{children:l.jsx($e,{mapping:{strong:l.jsx("strong",{})},string:h("You've successfully subscribed to <strong>{siteTitle}</strong>",{siteTitle:a.site.title})})});if(e==="signup-paid"&&t==="success")return l.jsx("p",{children:l.jsx($e,{mapping:{strong:l.jsx("strong",{})},string:h("You've successfully subscribed to <strong>{siteTitle}</strong>",{siteTitle:a.site.title})})});if(e==="updateEmail"&&t==="success")return l.jsx("p",{children:h("Success! Your email is updated.")});if(e==="updateEmail"&&t==="error")return l.jsx("p",{children:h("Could not update email! Invalid link.")});if(e==="signup"&&t==="error")return l.jsxs("p",{children:[h("Signup error: Invalid link"),l.jsx("br",{}),l.jsx("a",{href:o,target:"_parent",children:h("Click here to retry")})]});if(e==="signup-paid"&&t==="error")return l.jsxs("p",{children:[h("Signup error: Invalid link"),l.jsx("br",{}),l.jsx("a",{href:o,target:"_parent",children:h("Click here to retry")})]});if(e==="stripe:checkout"&&t==="success")return a.member?l.jsx("p",{children:h("Success! Your account is fully activated, you now have access to all content.")}):l.jsx("p",{children:h("Success! Check your email for magic link to sign-in.")});if(e==="stripe:checkout"&&t==="warning")return a.member?l.jsx("p",{children:h("Plan upgrade was cancelled.")}):l.jsx("p",{children:h("Plan checkout was cancelled.")});if(e==="support"&&t==="success")return l.jsx("p",{children:h("Thank you for your support!")})}return l.jsx("p",{children:h(t==="success"?"Success":"Error")})},fm=class fm extends Z.Component{constructor(){super(),this.state={className:""}}componentWillUnmount(){clearTimeout(this.timeoutId)}onNotificationClose(){this.props.onHideNotification()}componentDidUpdate(){const{showPopup:t}=this.context;!this.state.className&&t&&this.setState({className:"slideout"})}componentDidMount(){const{autoHide:t,duration:n=2400}=this.props,{showPopup:a}=this.context;a?this.setState({className:"slideout"}):t&&(this.timeoutId=setTimeout(()=>{this.setState({className:"slideout"})},n))}onAnimationEnd(t){(t.animationName==="notification-slideout"||t.animationName==="notification-slideout-mobile")&&this.props.onHideNotification(t)}render(){const{type:t,status:n,message:a}=this.props,{className:i=""}=this.state,o=n?` ${n}`:" neutral",r=i?` ${i}`:"";return l.jsx("div",{className:"gh-portal-notification-wrapper",children:l.jsxs("div",{className:`gh-portal-notification${o}${r}`,onAnimationEnd:s=>this.onAnimationEnd(s),children:[n==="error"?l.jsx(Od,{className:"gh-portal-notification-icon error",alt:""}):l.jsx(Rb,{className:"gh-portal-notification-icon success",alt:""}),l.jsx(y0,{type:t,status:n,message:a,context:this.context}),l.jsx(Fd,{className:"gh-portal-notification-closeicon",alt:"Close",onClick:s=>this.onNotificationClose(s)})]})})}};fm.contextType=_;let _d=fm;const gm=class gm extends Z.Component{constructor(){super();const{type:t,status:n,autoHide:a,duration:i}=Yb()||{};this.state={active:!0,type:t,status:n,message:"",autoHide:a,duration:i,className:"",source:t&&n?"url":null,notificationCount:null}}componentDidMount(){const{showPopup:t}=this.context;this.context.notification?this.showNotification(this.context.notification,"state"):t&&this.setState({active:!1})}componentDidUpdate(){const{notification:t}=this.context;t&&t.count!==this.state.notificationCount&&this.showNotification(t,"state")}showNotification(t,n){clearTimeout(this.timeoutId),this.setState({active:!0,className:"",type:t.type,status:t.status,message:t.message||"",autoHide:t.autoHide,duration:t.duration,source:n,notificationCount:t.count||0})}onHideNotification(){const{type:t,source:n}=this.state;if(n==="url"){const a=[];["signin","signup"].includes(t)?a.push("action","success"):["stripe:checkout"].includes(t)&&a.push("stripe"),el(a),this.context.doAction("refreshMemberData")}else n==="state"&&this.context.doAction("closeNotification");this.setState({active:!1,source:null})}renderFrameStyles(){const{brandColor:t}=this.context,n=t?`:root { --brandcolor: ${t} }`+Dd:Dd;return l.jsx("style",{dangerouslySetInnerHTML:{__html:n}})}render(){const n={...g0({brandColor:this.context.brandColor}).frame};if(!this.state.active)return null;const{type:a,status:i,message:o,autoHide:r,duration:s,notificationCount:c}=this.state;return a&&i?l.jsx(yd,{style:n,title:"portal-notification",head:this.renderFrameStyles(),className:"gh-portal-notification-iframe","data-testid":"portal-notification-frame",children:l.jsx(_d,{type:a,status:i,message:o,autoHide:r,duration:s,onHideNotification:u=>this.onHideNotification(u)},c)}):null}};gm.contextType=_;let Rd=gm;const Xa=e=>v.createElement("svg",{id:"loader-1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",width:"40px",height:"40px",viewBox:"0 0 40 40",enableBackground:"new 0 0 40 40",xmlSpace:"preserve",...e},v.createElement("path",{opacity:.2,fill:"#000",d:"M20.201,5.169c-8.254,0-14.946,6.692-14.946,14.946c0,8.255,6.692,14.946,14.946,14.946 s14.946-6.691,14.946-14.946C35.146,11.861,28.455,5.169,20.201,5.169z M20.201,31.749c-6.425,0-11.634-5.208-11.634-11.634 c0-6.425,5.209-11.634,11.634-11.634c6.425,0,11.633,5.209,11.633,11.634C31.834,26.541,26.626,31.749,20.201,31.749z"}),v.createElement("path",{fill:"#000",d:"M26.013,10.047l1.654-2.866c-2.198-1.272-4.743-2.012-7.466-2.012h0v3.312h0 C22.32,8.481,24.301,9.057,26.013,10.047z"},v.createElement("animateTransform",{attributeType:"xml",attributeName:"transform",type:"rotate",from:"0 20 20",to:"360 20 20",dur:"0.5s",repeatCount:"indefinite"}))),b0=`
|
|
575
575
|
.gh-portal-btn-main {
|
|
576
576
|
box-shadow: none;
|
|
577
577
|
position: relative;
|
|
@@ -631,7 +631,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
631
631
|
.gh-portal-loadingicon.dark rect {
|
|
632
632
|
fill: var(--grey0);
|
|
633
633
|
}
|
|
634
|
-
`,
|
|
634
|
+
`,k0=({brandColor:e,disabled:t,style:n={},isPrimary:a})=>{let i=e||"#3eb0ef",o="1.0",r="auto";return t&&(o="0.5",r="none"),{button:{...a?{backgroundColor:i}:{},opacity:o,pointerEvents:r,...n||{}}}};function me({label:e,onClick:t,disabled:n=!1,retry:a=!1,brandColor:i,isRunning:o,isPrimary:r=!0,isDestructive:s=!1,classes:c="",style:u={},tabIndex:d=void 0,dataTestId:p}){let m=k0({disabled:n,brandColor:i,style:u,isPrimary:r}),f="gh-portal-btn";r&&(f+=" gh-portal-btn-main gh-portal-btn-primary"),s&&(f+=" gh-portal-btn-destructive"),c&&(f+=" "+c),Zn()&&(n=!0);const b=r?"gh-portal-loadingicon":"gh-portal-loadingicon dark";return l.jsx("button",{className:f,style:m.button,onClick:w=>t(w),disabled:n,type:"submit",tabIndex:d,"data-test-button":p,children:o?l.jsx(Xa,{className:b}):e})}const v0=e=>v.createElement("svg",{id:"Regular",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},v.createElement("defs",null,v.createElement("style",null,".cls-1{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.5px;fill-rule:evenodd;}")),v.createElement("path",{className:"cls-1",d:"M16.25,23.25,5.53,12.53a.749.749,0,0,1,0-1.06L16.25.75"})),w0=`
|
|
635
635
|
.gh-portal-btn-back,
|
|
636
636
|
.gh-portal-btn-back:hover {
|
|
637
637
|
box-shadow: none;
|
|
@@ -678,7 +678,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
678
678
|
html[dir="rtl"] .gh-portal-btn-back svg {
|
|
679
679
|
transform: scaleX(-1);
|
|
680
680
|
}
|
|
681
|
-
`;function Qa({label:e=null,hidden:t=!1,onClick:n}){return t?null:(e===null&&(e=h("Back")),l.jsxs("button",{className:"gh-portal-btn gh-portal-btn-back",onClick:a=>n(a),children:[l.jsx(
|
|
681
|
+
`;function Qa({label:e=null,hidden:t=!1,onClick:n}){return t?null:(e===null&&(e=h("Back")),l.jsxs("button",{className:"gh-portal-btn gh-portal-btn-back",onClick:a=>n(a),children:[l.jsx(v0,{})," ",e]}))}const S0=`
|
|
682
682
|
.gh-portal-for-switch label,
|
|
683
683
|
.gh-portal-for-switch .container {
|
|
684
684
|
position: relative;
|
|
@@ -754,7 +754,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
754
754
|
width: 38px !important;
|
|
755
755
|
height: 22px !important;
|
|
756
756
|
}
|
|
757
|
-
`;function tl({id:e,label:t="",onToggle:n,checked:a=!1,dataTestId:i="switch-input"}){const[o,r]=v.useState(a);v.useEffect(()=>{r(a)},[a]);const s=v.useRef(null);return v.useEffect(()=>{s.current&&s.current.checked!==o&&(s.current.checked=o)},[o,e]),l.jsx("div",{className:"gh-portal-for-switch","data-test-switch":i,children:l.jsxs("label",{className:"switch",htmlFor:e,children:[l.jsx("input",{ref:s,type:"checkbox",checked:o,id:e,onChange:()=>{},"aria-label":t}),l.jsx("span",{className:"input-toggle-component",onClick:c=>{r(!o),n(c,!o)},"data-testid":i})]})})}const
|
|
757
|
+
`;function tl({id:e,label:t="",onToggle:n,checked:a=!1,dataTestId:i="switch-input"}){const[o,r]=v.useState(a);v.useEffect(()=>{r(a)},[a]);const s=v.useRef(null);return v.useEffect(()=>{s.current&&s.current.checked!==o&&(s.current.checked=o)},[o,e]),l.jsx("div",{className:"gh-portal-for-switch","data-test-switch":i,children:l.jsxs("label",{className:"switch",htmlFor:e,children:[l.jsx("input",{ref:s,type:"checkbox",checked:o,id:e,onChange:()=>{},"aria-label":t}),l.jsx("span",{className:"input-toggle-component",onClick:c=>{r(!o),n(c,!o)},"data-testid":i})]})})}const x0='.gh-portal-account-header{display:flex;flex-direction:column;align-items:center;margin:0 0 32px}.gh-portal-account-header .gh-portal-avatar{margin:6px 0 8px!important}.gh-portal-account-data{margin-bottom:40px}footer.gh-portal-account-footer{display:flex}.gh-portal-account-footer.paid{margin-top:12px}.gh-portal-account-footermenu{display:flex;align-items:center;list-style:none;padding:0;margin:0}.gh-portal-account-footerright{display:flex;flex-grow:1;align-items:center;justify-content:flex-end}.gh-portal-account-footermenu li{margin-inline-end:16px}.gh-portal-account-footermenu li:last-of-type{margin-inline-end:0}.gh-portal-freeaccount-newsletter{display:flex;align-items:center;justify-content:space-between;margin-top:24px}.gh-portal-freeaccount-newsletter .label{display:flex;flex-direction:column;flex-grow:1}.gh-portal-free-ctatext{margin-top:-12px}.gh-portal-cancelcontinue-container{margin:24px 0 32px}.gh-portal-cancel-banner{position:relative;border-radius:8px;padding:16px;margin-bottom:16px;text-align:center;font-size:1.4rem;line-height:1.5;color:var(--grey1)}.gh-portal-cancel-banner:before{position:absolute;content:"";display:block;background:var(--brandcolor);top:0;right:0;bottom:0;left:0;border-radius:8px;opacity:.05;pointer-events:none;z-index:0}.gh-portal-cancel-banner>*{position:relative;z-index:1}.gh-portal-cancel-banner p{max-width:320px;margin:0 auto 16px}.gh-portal-canceled-badge{display:inline-block;margin-inline-start:6px;padding:6px 8px;font-size:1.1rem;line-height:1em;font-weight:600;letter-spacing:.05px;text-transform:uppercase;color:var(--grey6);background:color-mix(in srgb,var(--grey12) 60%,transparent);border-radius:32px;vertical-align:middle;position:relative;top:-1px}.gh-portal-list-detail .gh-portal-email-notice{display:flex;align-items:center;gap:5px;margin-top:6px;color:var(--red);font-weight:500;font-size:1.25rem;letter-spacing:.2px}.gh-portal-email-notice-icon{width:20px;height:20px}.gh-portal-billing-button-loader{width:32px;height:32px;margin-inline-end:-3px;opacity:.6}.gh-portal-product-icon{width:52px;margin-inline-end:12px;border-radius:2px}.gh-portal-account-discountcontainer{position:relative;display:flex;align-items:center}.gh-portal-account-old-price{text-decoration:line-through;color:var(--grey9)!important}.gh-portal-account-tagicon{width:16px;height:16px;color:var(--brandcolor);margin-inline-end:5px;z-index:999}@media (max-width: 390px){.gh-portal-account-footer{padding:0!important}}@media (max-width: 340px){.gh-portal-account-footer{padding:0!important;flex-wrap:wrap;gap:12px}.gh-portal-account-footer .gh-portal-account-footerright{justify-content:flex-start}}';let pe=(si=class extends Z.Component{constructor(){super(...arguments),this.closePopup=()=>{this.context.doAction("closePopup")}}render(){const{onClick:t}=this.props;return l.jsx("div",{className:"gh-portal-closeicon-container","data-test-button":"close-popup",children:l.jsx(Fd,{className:"gh-portal-closeicon",alt:"Close",onClick:t||this.closePopup,"data-testid":"close-popup"})})}},si.contextType=_,si);const Do=e=>v.createElement("svg",{width:15,height:14,viewBox:"0 0 15 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},v.createElement("path",{d:"M1 6.89286L6.10714 12L13.9643 1",stroke:"#222222",strokeWidth:2}));function nl(e,t){if(isNaN(e)||isNaN(t))return 0;const n=e?100-Math.floor(t/12*100/e):0;return n>=1&&n<100?n:0}const C0=()=>`
|
|
758
758
|
.gh-portal-products {
|
|
759
759
|
display: flex;
|
|
760
760
|
flex-direction: column;
|
|
@@ -1271,7 +1271,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1271
1271
|
min-height: unset;
|
|
1272
1272
|
}
|
|
1273
1273
|
}
|
|
1274
|
-
`,ei=Z.createContext({selectedInterval:"month",selectedProduct:"free",selectedPlan:null,setSelectedProduct:null});function E1({product:e}){return!e.benefits||!e.benefits.length?null:e.benefits.map((t,n)=>{const a=(t==null?void 0:t.id)||`benefit-${n}`;return l.jsxs("div",{className:"gh-portal-product-benefit",children:[l.jsx(Do,{className:"gh-portal-benefit-checkmark",alt:""}),l.jsx("div",{className:"gh-portal-benefit-title",children:t.name})]},a)})}function Yd({product:e,hide:t=!1}){return!e.benefits||!e.benefits.length||t?null:l.jsx("div",{className:"gh-portal-product-benefits",children:l.jsx(E1,{product:e})})}function Lb({price:e}){const{site:t}=v.useContext(_),{portal_plans:n}=t;return!n.includes("monthly")||!n.includes("yearly")?l.jsx("div",{className:"gh-portal-product-alternative-price"}):l.jsx("div",{className:"gh-portal-product-alternative-price",children:R0(e)})}function $1({trialDays:e,discount:t,selectedInterval:n}){const{site:a}=v.useContext(_);return Ws({site:a})?e?l.jsx("span",{className:"gh-portal-discount-label",children:h("{trialDays} days free",{trialDays:e})}):null:n==="year"?l.jsx("span",{className:"gh-portal-discount-label",children:h("{discount}% discount",{discount:t})}):null}function Bb({product:e}){const{selectedInterval:t}=v.useContext(ei),{site:n}=v.useContext(_),a=e.monthlyPrice,i=e.yearlyPrice,o=e.trial_days,r=t==="month"?a:i,s=t==="month"?i:a,c=r.interval==="year"?h("year"):h("month");if(!a||!i)return null;const u=nl(e.monthlyPrice.amount,e.yearlyPrice.amount),d=ke(r.currency);return Ws({site:n})?l.jsx(l.Fragment,{children:l.jsxs("div",{className:"gh-portal-product-card-pricecontainer",children:[l.jsxs("div",{className:"gh-portal-product-card-price-trial",children:[l.jsxs("div",{className:"gh-portal-product-price",children:[l.jsx("span",{className:"currency-sign"+(d.length>1?" long":""),children:d}),l.jsx("span",{className:"amount","data-testid":"product-amount",children:aa(Js(r.amount))}),l.jsxs("span",{className:"billing-period",children:["/",c]})]}),l.jsx($1,{trialDays:o,discount:u,selectedInterval:t})]}),t==="year"?l.jsx(Ub,{discount:u,trialDays:o}):"",l.jsx(Lb,{price:s})]})}):l.jsxs("div",{className:"gh-portal-product-card-pricecontainer",children:[l.jsxs("div",{className:"gh-portal-product-card-price-trial",children:[l.jsxs("div",{className:"gh-portal-product-price",children:[l.jsx("span",{className:"currency-sign"+(d.length>1?" long":""),children:d}),l.jsx("span",{className:"amount","data-testid":"product-amount",children:aa(Js(r.amount))}),l.jsxs("span",{className:"billing-period",children:["/",c]})]}),t==="year"?l.jsx(Ub,{discount:u}):""]}),l.jsx(Lb,{price:s})]})}function j1({products:e,handleChooseSignup:t,error:n}){const{site:a,action:i}=v.useContext(_),{selectedProduct:o,setSelectedProduct:r}=v.useContext(ei);let s=o==="free"?"gh-portal-product-card free checked":"gh-portal-product-card free";const c=Qn({site:a});let u=z0({site:a}),d=i==="signup:running";Zn()&&(d=!0);let p="$";e&&e[1]?p=ke(e[1].monthlyPrice.currency):p="$";const m=bb({site:a}),f=P0({site:a});if(m){if(!u&&!f.length)return null;s+=" only-free"}return!u&&!f.length&&(u="Free preview"),l.jsx(l.Fragment,{children:l.jsxs("div",{className:s,onClick:b=>{b.stopPropagation(),r("free")},"data-test-tier":"free",children:[l.jsxs("div",{className:"gh-portal-product-card-header",children:[l.jsx("h4",{className:"gh-portal-product-name",children:gb({site:a})}),m?"":l.jsx("div",{className:"gh-portal-product-card-pricecontainer free-trial-disabled",children:l.jsxs("div",{className:"gh-portal-product-price",children:[l.jsx("span",{className:"currency-sign"+(p.length>1?" long":""),children:p}),l.jsx("span",{className:"amount","data-testid":"product-amount",children:"0"})]})})]}),l.jsxs("div",{className:"gh-portal-product-card-details",children:[l.jsxs("div",{className:"gh-portal-product-card-detaildata",children:[u?l.jsx("div",{className:"gh-portal-product-description","data-testid":"product-description",children:u}):"",l.jsx(Yd,{product:c})]}),m?"":l.jsxs("div",{className:"gh-portal-btn-product",children:[l.jsx("button",{"data-test-button":"select-tier",className:"gh-portal-btn",disabled:d,onClick:b=>{t(b,"free")},children:o==="free"&&d?l.jsx(Xa,{className:"gh-portal-loadingicon"}):h("Choose")}),n&&l.jsx("div",{className:"gh-portal-error-message",children:n})]})]})]})})}function T1({selectedProduct:e,product:t,disabled:n,noOfProducts:a,trialDays:i}){return e===t.id&&n?l.jsx(Xa,{className:"gh-portal-loadingicon"}):i>0?l.jsx($e,{string:h("Start {amount}-day free trial"),mapping:{amount:i}}):a>1?h("Choose"):h("Continue")}function P1({product:e,products:t,selectedInterval:n,handleChooseSignup:a,error:i}){var f;const{selectedProduct:o,setSelectedProduct:r}=v.useContext(ei),{action:s}=v.useContext(_),c=e.trial_days,u=o===e.id?"gh-portal-product-card checked":"gh-portal-product-card",d=(f=t==null?void 0:t.filter(b=>b.type==="paid"))==null?void 0:f.length;let p=!!["signup:running","checkoutPlan:running"].includes(s);Zn()&&(p=!0);let m=e.description;return(!e.benefits||!e.benefits.length)&&!m&&(m="Full access"),l.jsx(l.Fragment,{children:l.jsxs("div",{className:u,onClick:b=>{b.stopPropagation(),r(e.id)},"data-test-tier":"paid",children:[l.jsxs("div",{className:"gh-portal-product-card-header",children:[l.jsx("h4",{className:"gh-portal-product-name",children:e.name}),l.jsx(Bb,{product:e})]}),l.jsxs("div",{className:"gh-portal-product-card-details",children:[l.jsxs("div",{className:"gh-portal-product-card-detaildata",children:[l.jsx("div",{className:"gh-portal-product-description","data-testid":"product-description",children:m}),l.jsx(Yd,{product:e})]}),l.jsxs("div",{className:"gh-portal-btn-product",children:[l.jsx("button",{"data-test-button":"select-tier",disabled:p,className:"gh-portal-btn",onClick:b=>{const w=Ld({products:t,selectedInterval:n,selectedProduct:e.id});a(b,w.id)},children:l.jsx(T1,{selectedProduct:o,product:e,disabled:p,noOfProducts:d,trialDays:c})}),i&&l.jsx("div",{className:"gh-portal-error-message",children:i})]})]})]},e.id)})}function z1({product:e,products:t,selectedInterval:n,errors:a}){const i=Ld({products:t,selectedInterval:n,selectedProduct:e.id});return i&&i.id&&a&&a[i.id]?a[i.id]:null}function I1({products:e,selectedInterval:t,handleChooseSignup:n,errors:a}){return e.map(i=>{const o=z1({product:i,products:e,selectedInterval:t,errors:a});return i.id==="free"?l.jsx(j1,{products:e,handleChooseSignup:n,error:o},i.id):l.jsx(P1,{products:e,product:i,selectedInterval:t,handleChooseSignup:n,error:o},i.id)})}function Ub({discount:e}){const{site:t}=v.useContext(_),{portal_plans:n}=t;return e===0||!n.includes("monthly")?null:Ws({site:t})?l.jsx(l.Fragment,{children:l.jsx("span",{className:"gh-portal-discount-label-trial",children:h("{discount}% discount",{discount:e})})}):l.jsx(l.Fragment,{children:l.jsx("span",{className:"gh-portal-discount-label",children:h("{discount}% discount",{discount:e})})})}function Hb({selectedInterval:e,setSelectedInterval:t,products:n}){const{site:a}=v.useContext(_),{portal_plans:i}=a,r=n.filter(c=>c.type!=="free").map(c=>{var u,d;return nl((u=c.monthlyPrice)==null?void 0:u.amount,(d=c.yearlyPrice)==null?void 0:d.amount)}),s=Math.max(...r);return!i.includes("monthly")||!i.includes("yearly")?null:l.jsx("div",{className:"gh-portal-logged-out-form-container",children:l.jsxs("div",{className:"gh-portal-products-pricetoggle"+(e==="month"?" left":""),children:[l.jsx("button",{"data-test-button":"switch-monthly","data-testid":"monthly-switch",className:"gh-portal-btn"+(e==="month"?" active":""),onClick:()=>{t("month")},children:h("Monthly")}),l.jsxs("button",{"data-test-button":"switch-yearly","data-testid":"yearly-switch",className:"gh-portal-btn"+(e==="year"?" active":""),onClick:()=>{t("year")},children:[h("Yearly"),s>0&&l.jsx("span",{className:"gh-portal-maximum-discount",children:h("(save {highestYearlyDiscount}%)",{highestYearlyDiscount:s})})]})]})})}function Ld({products:e,selectedProduct:t,selectedInterval:n}){let a=null;if(t==="free")a={id:"free"};else{let i=e.find(o=>o.id===t);i||(i=e.find(o=>o.type==="paid")),a=n==="month"?i==null?void 0:i.monthlyPrice:i==null?void 0:i.yearlyPrice}return a}function Vb({onPlanSelect:e,products:t,type:n=null,handleChooseSignup:a,errors:i}){var x,T;const{site:o,member:r}=v.useContext(_),{portal_plans:s,portal_default_plan:c}=o,u=t.length>0?t[0].id:"free",[d,p]=v.useState(null),[m,f]=v.useState(u),b=Ld({products:t,selectedInterval:d,selectedProduct:m}),w=Zs({portalPlans:s,portalDefaultPlan:c,selectedInterval:d}),g=Pn({member:r}),y=bb({site:o});if(v.useEffect(()=>{f(u)},[u]),v.useEffect(()=>{e(null,b.id)},[b.id,e]),t.length===0)if(g){const E=Io({site:o});return l.jsx("p",{style:{textAlign:"center"},children:h("Please contact {supportAddress} to adjust your complimentary subscription.",{supportAddress:E})})}else return null;let k="gh-portal-products";n==="upgrade"&&(k+=" gh-portal-upgrade-product");let C=((x=t.find(E=>E.id===m))==null?void 0:x.id)||((T=t.find(E=>E.type==="paid"))==null?void 0:T.id);return l.jsx(ei.Provider,{value:{selectedInterval:w,selectedProduct:C,setSelectedProduct:f},children:l.jsxs("section",{className:k,children:[y?"":l.jsx(Hb,{products:t,selectedInterval:w,setSelectedInterval:p}),l.jsx("div",{className:"gh-portal-products-grid",children:l.jsx(I1,{products:t,selectedInterval:w,handleChooseSignup:a,errors:i})})]})})}function N1({onPlanSelect:e,selectedPlan:t,products:n,type:a=null}){var y;const{site:i,member:o}=v.useContext(_),{portal_plans:r}=i,s=Xn({member:o}),c=kb({site:i,priceId:s.id}),u=Zs({portalPlans:r,selectedInterval:s.interval}),d=(c==null?void 0:c.id)||((y=n==null?void 0:n[0])==null?void 0:y.id),[p,m]=v.useState(u),[f,b]=v.useState(d),w=Zs({portalPlans:r,selectedInterval:p});if(v.useEffect(()=>{b(d)},[d]),!r.includes("monthly")&&!r.includes("yearly")||n.length===0)return null;let g="gh-portal-products";return a==="upgrade"&&(g+=" gh-portal-upgrade-product"),a==="changePlan"&&(g+=" gh-portal-upgrade-product gh-portal-change-plan"),l.jsx(ei.Provider,{value:{selectedInterval:w,selectedProduct:f,selectedPlan:t,setSelectedProduct:b},children:l.jsxs("section",{className:g,children:[l.jsx(Hb,{selectedInterval:w,setSelectedInterval:m,products:n}),l.jsx("div",{className:"gh-portal-products-grid",children:l.jsx(D1,{products:n,onPlanSelect:e})})]})})}function A1({product:e}){return e!=null&&e.description?l.jsx("div",{className:"gh-portal-product-description","data-testid":"product-description",children:e.description}):null}function M1({product:e,onPlanSelect:t}){const{member:n,site:a}=v.useContext(_),{selectedProduct:i,setSelectedProduct:o,selectedInterval:r}=v.useContext(ei),s=i===e.id?"gh-portal-product-card checked":"gh-portal-product-card",c=e.monthlyPrice,u=e.yearlyPrice,d=Xn({member:n}),p=r==="month"?c:u,m=S0({member:n,site:a,priceId:p.id});return l.jsxs("div",{className:s+(m?" disabled":""),onClick:f=>{f.stopPropagation(),o(e.id)},"data-test-tier":"paid",children:[l.jsxs("div",{className:"gh-portal-product-card-header",children:[l.jsx("h4",{className:"gh-portal-product-name",children:e.name}),l.jsx(Bb,{product:e})]}),l.jsxs("div",{className:"gh-portal-product-card-details",children:[l.jsxs("div",{className:"gh-portal-product-card-detaildata",children:[e.description?l.jsx(A1,{product:e,selectedPrice:p,activePrice:d}):"",l.jsx(Yd,{product:e})]}),m?l.jsx("div",{className:"gh-portal-btn-product",children:l.jsx("span",{className:"gh-portal-current-plan",children:l.jsx("span",{children:h("Current plan")})})}):l.jsx("div",{className:"gh-portal-btn-product",children:l.jsx("button",{"data-test-button":"select-tier",className:"gh-portal-btn",onClick:()=>{t(null,p==null?void 0:p.id)},children:h("Choose")})})]})]},e.id)}function D1({products:e,onPlanSelect:t}){return e.map(n=>!n||n.id==="free"?null:l.jsx(M1,{product:n,onPlanSelect:t},n.id))}function F1({products:e,selectedPlan:t,onPlanSelect:n,onPlanCheckout:a,changePlan:i=!1}){return Zn()&&(n=()=>{}),i?l.jsx("section",{className:"gh-portal-plans",children:l.jsx("div",{children:l.jsx(N1,{type:"changePlan",products:e,selectedPlan:t,onPlanSelect:n})})}):l.jsx("section",{className:"gh-portal-plans",children:l.jsx("div",{children:l.jsx(Vb,{type:"upgrade",products:e,onPlanSelect:n,handleChooseSignup:(...r)=>{a(...r)}})})})}const O1=`
|
|
1274
|
+
`,ei=Z.createContext({selectedInterval:"month",selectedProduct:"free",selectedPlan:null,setSelectedProduct:null});function E0({product:e}){return!e.benefits||!e.benefits.length?null:e.benefits.map((t,n)=>{const a=(t==null?void 0:t.id)||`benefit-${n}`;return l.jsxs("div",{className:"gh-portal-product-benefit",children:[l.jsx(Do,{className:"gh-portal-benefit-checkmark",alt:""}),l.jsx("div",{className:"gh-portal-benefit-title",children:t.name})]},a)})}function Yd({product:e,hide:t=!1}){return!e.benefits||!e.benefits.length||t?null:l.jsx("div",{className:"gh-portal-product-benefits",children:l.jsx(E0,{product:e})})}function Lb({price:e}){const{site:t}=v.useContext(_),{portal_plans:n}=t;return!n.includes("monthly")||!n.includes("yearly")?l.jsx("div",{className:"gh-portal-product-alternative-price"}):l.jsx("div",{className:"gh-portal-product-alternative-price",children:R1(e)})}function $0({trialDays:e,discount:t,selectedInterval:n}){const{site:a}=v.useContext(_);return Ws({site:a})?e?l.jsx("span",{className:"gh-portal-discount-label",children:h("{trialDays} days free",{trialDays:e})}):null:n==="year"?l.jsx("span",{className:"gh-portal-discount-label",children:h("{discount}% discount",{discount:t})}):null}function Bb({product:e}){const{selectedInterval:t}=v.useContext(ei),{site:n}=v.useContext(_),a=e.monthlyPrice,i=e.yearlyPrice,o=e.trial_days,r=t==="month"?a:i,s=t==="month"?i:a,c=r.interval==="year"?h("year"):h("month");if(!a||!i)return null;const u=nl(e.monthlyPrice.amount,e.yearlyPrice.amount),d=ke(r.currency);return Ws({site:n})?l.jsx(l.Fragment,{children:l.jsxs("div",{className:"gh-portal-product-card-pricecontainer",children:[l.jsxs("div",{className:"gh-portal-product-card-price-trial",children:[l.jsxs("div",{className:"gh-portal-product-price",children:[l.jsx("span",{className:"currency-sign"+(d.length>1?" long":""),children:d}),l.jsx("span",{className:"amount","data-testid":"product-amount",children:aa(Js(r.amount))}),l.jsxs("span",{className:"billing-period",children:["/",c]})]}),l.jsx($0,{trialDays:o,discount:u,selectedInterval:t})]}),t==="year"?l.jsx(Ub,{discount:u,trialDays:o}):"",l.jsx(Lb,{price:s})]})}):l.jsxs("div",{className:"gh-portal-product-card-pricecontainer",children:[l.jsxs("div",{className:"gh-portal-product-card-price-trial",children:[l.jsxs("div",{className:"gh-portal-product-price",children:[l.jsx("span",{className:"currency-sign"+(d.length>1?" long":""),children:d}),l.jsx("span",{className:"amount","data-testid":"product-amount",children:aa(Js(r.amount))}),l.jsxs("span",{className:"billing-period",children:["/",c]})]}),t==="year"?l.jsx(Ub,{discount:u}):""]}),l.jsx(Lb,{price:s})]})}function j0({products:e,handleChooseSignup:t,error:n}){const{site:a,action:i}=v.useContext(_),{selectedProduct:o,setSelectedProduct:r}=v.useContext(ei);let s=o==="free"?"gh-portal-product-card free checked":"gh-portal-product-card free";const c=Qn({site:a});let u=z1({site:a}),d=i==="signup:running";Zn()&&(d=!0);let p="$";e&&e[1]?p=ke(e[1].monthlyPrice.currency):p="$";const m=bb({site:a}),f=P1({site:a});if(m){if(!u&&!f.length)return null;s+=" only-free"}return!u&&!f.length&&(u="Free preview"),l.jsx(l.Fragment,{children:l.jsxs("div",{className:s,onClick:b=>{b.stopPropagation(),r("free")},"data-test-tier":"free",children:[l.jsxs("div",{className:"gh-portal-product-card-header",children:[l.jsx("h4",{className:"gh-portal-product-name",children:gb({site:a})}),m?"":l.jsx("div",{className:"gh-portal-product-card-pricecontainer free-trial-disabled",children:l.jsxs("div",{className:"gh-portal-product-price",children:[l.jsx("span",{className:"currency-sign"+(p.length>1?" long":""),children:p}),l.jsx("span",{className:"amount","data-testid":"product-amount",children:"0"})]})})]}),l.jsxs("div",{className:"gh-portal-product-card-details",children:[l.jsxs("div",{className:"gh-portal-product-card-detaildata",children:[u?l.jsx("div",{className:"gh-portal-product-description","data-testid":"product-description",children:u}):"",l.jsx(Yd,{product:c})]}),m?"":l.jsxs("div",{className:"gh-portal-btn-product",children:[l.jsx("button",{"data-test-button":"select-tier",className:"gh-portal-btn",disabled:d,onClick:b=>{t(b,"free")},children:o==="free"&&d?l.jsx(Xa,{className:"gh-portal-loadingicon"}):h("Choose")}),n&&l.jsx("div",{className:"gh-portal-error-message",children:n})]})]})]})})}function T0({selectedProduct:e,product:t,disabled:n,noOfProducts:a,trialDays:i}){return e===t.id&&n?l.jsx(Xa,{className:"gh-portal-loadingicon"}):i>0?l.jsx($e,{string:h("Start {amount}-day free trial"),mapping:{amount:i}}):a>1?h("Choose"):h("Continue")}function P0({product:e,products:t,selectedInterval:n,handleChooseSignup:a,error:i}){var f;const{selectedProduct:o,setSelectedProduct:r}=v.useContext(ei),{action:s}=v.useContext(_),c=e.trial_days,u=o===e.id?"gh-portal-product-card checked":"gh-portal-product-card",d=(f=t==null?void 0:t.filter(b=>b.type==="paid"))==null?void 0:f.length;let p=!!["signup:running","checkoutPlan:running"].includes(s);Zn()&&(p=!0);let m=e.description;return(!e.benefits||!e.benefits.length)&&!m&&(m="Full access"),l.jsx(l.Fragment,{children:l.jsxs("div",{className:u,onClick:b=>{b.stopPropagation(),r(e.id)},"data-test-tier":"paid",children:[l.jsxs("div",{className:"gh-portal-product-card-header",children:[l.jsx("h4",{className:"gh-portal-product-name",children:e.name}),l.jsx(Bb,{product:e})]}),l.jsxs("div",{className:"gh-portal-product-card-details",children:[l.jsxs("div",{className:"gh-portal-product-card-detaildata",children:[l.jsx("div",{className:"gh-portal-product-description","data-testid":"product-description",children:m}),l.jsx(Yd,{product:e})]}),l.jsxs("div",{className:"gh-portal-btn-product",children:[l.jsx("button",{"data-test-button":"select-tier",disabled:p,className:"gh-portal-btn",onClick:b=>{const w=Ld({products:t,selectedInterval:n,selectedProduct:e.id});a(b,w.id)},children:l.jsx(T0,{selectedProduct:o,product:e,disabled:p,noOfProducts:d,trialDays:c})}),i&&l.jsx("div",{className:"gh-portal-error-message",children:i})]})]})]},e.id)})}function z0({product:e,products:t,selectedInterval:n,errors:a}){const i=Ld({products:t,selectedInterval:n,selectedProduct:e.id});return i&&i.id&&a&&a[i.id]?a[i.id]:null}function I0({products:e,selectedInterval:t,handleChooseSignup:n,errors:a}){return e.map(i=>{const o=z0({product:i,products:e,selectedInterval:t,errors:a});return i.id==="free"?l.jsx(j0,{products:e,handleChooseSignup:n,error:o},i.id):l.jsx(P0,{products:e,product:i,selectedInterval:t,handleChooseSignup:n,error:o},i.id)})}function Ub({discount:e}){const{site:t}=v.useContext(_),{portal_plans:n}=t;return e===0||!n.includes("monthly")?null:Ws({site:t})?l.jsx(l.Fragment,{children:l.jsx("span",{className:"gh-portal-discount-label-trial",children:h("{discount}% discount",{discount:e})})}):l.jsx(l.Fragment,{children:l.jsx("span",{className:"gh-portal-discount-label",children:h("{discount}% discount",{discount:e})})})}function Hb({selectedInterval:e,setSelectedInterval:t,products:n}){const{site:a}=v.useContext(_),{portal_plans:i}=a,r=n.filter(c=>c.type!=="free").map(c=>{var u,d;return nl((u=c.monthlyPrice)==null?void 0:u.amount,(d=c.yearlyPrice)==null?void 0:d.amount)}),s=Math.max(...r);return!i.includes("monthly")||!i.includes("yearly")?null:l.jsx("div",{className:"gh-portal-logged-out-form-container",children:l.jsxs("div",{className:"gh-portal-products-pricetoggle"+(e==="month"?" left":""),children:[l.jsx("button",{"data-test-button":"switch-monthly","data-testid":"monthly-switch",className:"gh-portal-btn"+(e==="month"?" active":""),onClick:()=>{t("month")},children:h("Monthly")}),l.jsxs("button",{"data-test-button":"switch-yearly","data-testid":"yearly-switch",className:"gh-portal-btn"+(e==="year"?" active":""),onClick:()=>{t("year")},children:[h("Yearly"),s>0&&l.jsx("span",{className:"gh-portal-maximum-discount",children:h("(save {highestYearlyDiscount}%)",{highestYearlyDiscount:s})})]})]})})}function Ld({products:e,selectedProduct:t,selectedInterval:n}){let a=null;if(t==="free")a={id:"free"};else{let i=e.find(o=>o.id===t);i||(i=e.find(o=>o.type==="paid")),a=n==="month"?i==null?void 0:i.monthlyPrice:i==null?void 0:i.yearlyPrice}return a}function Vb({onPlanSelect:e,products:t,type:n=null,handleChooseSignup:a,errors:i}){var x,T;const{site:o,member:r}=v.useContext(_),{portal_plans:s,portal_default_plan:c}=o,u=t.length>0?t[0].id:"free",[d,p]=v.useState(null),[m,f]=v.useState(u),b=Ld({products:t,selectedInterval:d,selectedProduct:m}),w=Zs({portalPlans:s,portalDefaultPlan:c,selectedInterval:d}),g=Pn({member:r}),y=bb({site:o});if(v.useEffect(()=>{f(u)},[u]),v.useEffect(()=>{e(null,b.id)},[b.id,e]),t.length===0)if(g){const E=Io({site:o});return l.jsx("p",{style:{textAlign:"center"},children:h("Please contact {supportAddress} to adjust your complimentary subscription.",{supportAddress:E})})}else return null;let k="gh-portal-products";n==="upgrade"&&(k+=" gh-portal-upgrade-product");let C=((x=t.find(E=>E.id===m))==null?void 0:x.id)||((T=t.find(E=>E.type==="paid"))==null?void 0:T.id);return l.jsx(ei.Provider,{value:{selectedInterval:w,selectedProduct:C,setSelectedProduct:f},children:l.jsxs("section",{className:k,children:[y?"":l.jsx(Hb,{products:t,selectedInterval:w,setSelectedInterval:p}),l.jsx("div",{className:"gh-portal-products-grid",children:l.jsx(I0,{products:t,selectedInterval:w,handleChooseSignup:a,errors:i})})]})})}function N0({onPlanSelect:e,selectedPlan:t,products:n,type:a=null}){var y;const{site:i,member:o}=v.useContext(_),{portal_plans:r}=i,s=Xn({member:o}),c=kb({site:i,priceId:s.id}),u=Zs({portalPlans:r,selectedInterval:s.interval}),d=(c==null?void 0:c.id)||((y=n==null?void 0:n[0])==null?void 0:y.id),[p,m]=v.useState(u),[f,b]=v.useState(d),w=Zs({portalPlans:r,selectedInterval:p});if(v.useEffect(()=>{b(d)},[d]),!r.includes("monthly")&&!r.includes("yearly")||n.length===0)return null;let g="gh-portal-products";return a==="upgrade"&&(g+=" gh-portal-upgrade-product"),a==="changePlan"&&(g+=" gh-portal-upgrade-product gh-portal-change-plan"),l.jsx(ei.Provider,{value:{selectedInterval:w,selectedProduct:f,selectedPlan:t,setSelectedProduct:b},children:l.jsxs("section",{className:g,children:[l.jsx(Hb,{selectedInterval:w,setSelectedInterval:m,products:n}),l.jsx("div",{className:"gh-portal-products-grid",children:l.jsx(D0,{products:n,onPlanSelect:e})})]})})}function A0({product:e}){return e!=null&&e.description?l.jsx("div",{className:"gh-portal-product-description","data-testid":"product-description",children:e.description}):null}function M0({product:e,onPlanSelect:t}){const{member:n,site:a}=v.useContext(_),{selectedProduct:i,setSelectedProduct:o,selectedInterval:r}=v.useContext(ei),s=i===e.id?"gh-portal-product-card checked":"gh-portal-product-card",c=e.monthlyPrice,u=e.yearlyPrice,d=Xn({member:n}),p=r==="month"?c:u,m=S1({member:n,site:a,priceId:p.id});return l.jsxs("div",{className:s+(m?" disabled":""),onClick:f=>{f.stopPropagation(),o(e.id)},"data-test-tier":"paid",children:[l.jsxs("div",{className:"gh-portal-product-card-header",children:[l.jsx("h4",{className:"gh-portal-product-name",children:e.name}),l.jsx(Bb,{product:e})]}),l.jsxs("div",{className:"gh-portal-product-card-details",children:[l.jsxs("div",{className:"gh-portal-product-card-detaildata",children:[e.description?l.jsx(A0,{product:e,selectedPrice:p,activePrice:d}):"",l.jsx(Yd,{product:e})]}),m?l.jsx("div",{className:"gh-portal-btn-product",children:l.jsx("span",{className:"gh-portal-current-plan",children:l.jsx("span",{children:h("Current plan")})})}):l.jsx("div",{className:"gh-portal-btn-product",children:l.jsx("button",{"data-test-button":"select-tier",className:"gh-portal-btn",onClick:()=>{t(null,p==null?void 0:p.id)},children:h("Choose")})})]})]},e.id)}function D0({products:e,onPlanSelect:t}){return e.map(n=>!n||n.id==="free"?null:l.jsx(M0,{product:n,onPlanSelect:t},n.id))}function F0({products:e,selectedPlan:t,onPlanSelect:n,onPlanCheckout:a,changePlan:i=!1}){return Zn()&&(n=()=>{}),i?l.jsx("section",{className:"gh-portal-plans",children:l.jsx("div",{children:l.jsx(N0,{type:"changePlan",products:e,selectedPlan:t,onPlanSelect:n})})}):l.jsx("section",{className:"gh-portal-plans",children:l.jsx("div",{children:l.jsx(Vb,{type:"upgrade",products:e,onPlanSelect:n,handleChooseSignup:(...r)=>{a(...r)}})})})}const O0=`
|
|
1275
1275
|
.account-plan.full-size .gh-portal-main-title {
|
|
1276
1276
|
font-size: 3.2rem;
|
|
1277
1277
|
margin-top: 44px;
|
|
@@ -1328,7 +1328,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1328
1328
|
.gh-portal-retention-offer .gh-portal-offer-details > .footnote:first-child {
|
|
1329
1329
|
margin-top: 12px;
|
|
1330
1330
|
}
|
|
1331
|
-
`;function _1({confirmationType:e,pendingOffer:t}){if(e==="changePlan")return h("Confirm subscription");if(e==="cancel")return h("Cancel subscription");if(e==="subscribe")return h("Subscribe");if(e==="offerRetention")return(t==null?void 0:t.display_title)||h("Before you go")}const R1=({showConfirmation:e,confirmationType:t,pendingOffer:n})=>{const{member:a}=v.useContext(_);let i=Dt({member:a})?h("Change plan"):h("Choose a plan");return e&&(i=_1({confirmationType:t,pendingOffer:n})),l.jsx("header",{className:"gh-portal-detail-header",children:l.jsx("h3",{className:"gh-portal-main-title",children:i})})},Y1=({member:e,onCancelSubscription:t,action:n,brandColor:a})=>{const{site:i}=v.useContext(_);if(!e.paid)return null;const o=rt({member:e});if(!o||o.cancel_at_period_end)return null;const r=h("Cancel subscription"),s=["cancelSubscription:running"].includes(n),c=!!s,u=!!o.cancel_at_period_end,d=!o.cancelAtPeriodEnd;return l.jsx("div",{className:"gh-portal-expire-container",children:l.jsx(me,{dataTestId:"cancel-subscription",onClick:()=>{t({subscriptionId:o.id,cancelAtPeriodEnd:!0})},isRunning:s,disabled:c,isPrimary:u,isDestructive:d,classes:Bs({site:i})?"gh-portal-btn-text mt2 mb4":"",brandColor:a,label:r,style:{width:"100%"}})})},L1=({plan:e,type:t,onConfirm:n})=>{const{site:a,action:i,member:o,brandColor:r}=v.useContext(_),[s,c]=v.useState(""),u=rt({member:o}),d=["updateSubscription:running","checkoutPlan:running","cancelSubscription:running"].includes(i),p=h("Confirm"),m=Xt(u.current_period_end),f=Xn({member:o});let b=h("Starting {startDate}",{startDate:m});f.id!==e.id&&(b=h("Starting today"));const w=aa(e.price),g=`${e.currency_symbol}${w}/${Za(e.interval)} – ${b}`,y=kb({site:a,priceId:e==null?void 0:e.id}),k=Bs({site:a})?y==null?void 0:y.name:h("Price");return t==="changePlan"?l.jsxs("div",{className:"gh-portal-logged-out-form-container",children:[l.jsxs("div",{className:"gh-portal-list mb6",children:[l.jsx("section",{children:l.jsxs("div",{className:"gh-portal-list-detail",children:[l.jsx("h3",{children:h("Account")}),l.jsx("p",{children:o.email})]})}),l.jsx("section",{children:l.jsxs("div",{className:"gh-portal-list-detail",children:[l.jsx("h3",{children:k}),l.jsx("p",{children:g})]})})]}),l.jsx(me,{dataTestId:"confirm-action",onClick:C=>n(C,e),isRunning:d,isPrimary:!0,brandColor:r,label:p,style:{width:"100%",height:"40px"}})]}):l.jsxs("div",{className:"gh-portal-logged-out-form-container gh-portal-cancellation-form",children:[l.jsx("p",{children:l.jsx($e,{string:h("If you cancel your subscription now, you will continue to have access until {periodEnd}."),mapping:{periodEnd:l.jsx("strong",{children:Xt(u.current_period_end)})}})}),l.jsxs("section",{className:"gh-portal-input-section",children:[l.jsx("div",{className:"gh-portal-input-labelcontainer",children:l.jsx("label",{className:"gh-portal-input-label",children:h("Cancellation reason")})}),l.jsx("textarea",{"data-test-input":"cancellation-reason",className:"gh-portal-input",label:"Cancellation reason",type:"text",name:"cancellation_reason",placeholder:"",value:s,onChange:C=>c(C.target.value),rows:"2",maxLength:"500"},"cancellation_reason")]}),l.jsx(me,{dataTestId:"confirm-cancel-subscription",onClick:C=>n(C,s),isRunning:d,isPrimary:!0,brandColor:r,label:h("Confirm cancellation"),style:{width:"100%",height:"40px"}})]})},B1=({plans:e,selectedPlan:t,onPlanSelect:n,onCancelSubscription:a})=>{const{member:i,action:o,brandColor:r}=v.useContext(_);return l.jsxs("section",{children:[l.jsx("div",{className:"gh-portal-section gh-portal-accountplans-main",children:l.jsx(Wb,{showLabel:!1,plans:e,selectedPlan:t,onPlanSelect:n,changePlan:!0})}),l.jsx(Y1,{member:i,onCancelSubscription:a,action:o,brandColor:r})]})};function Wb({selectedPlan:e,onPlanSelect:t,onPlanCheckout:n,changePlan:a=!1}){const{site:i,member:o}=v.useContext(_),r=k0({site:i,member:o}),s=Pn({member:o}),c=w0({member:o,site:i});return l.jsx(F1,{products:r.length>0||s||!c?r:[c],selectedPlan:e,changePlan:a,onPlanSelect:t,onPlanCheckout:n})}function U1(e,t){if(Gs(e)){const n=e.duration_in_months;return n===1?h("1 month free"):h("{months} months free",{months:n})}return h("{amount} off",{amount:t})}function H1(e,t,n,a,i){if(Gs(e)){const o=e.duration_in_months,r=W0(i.current_period_end,o),s=r?r.toLocaleDateString("en-GB",{year:"numeric",month:"short",day:"numeric",timeZone:"UTC"}):null;return s?o===1?h("Enjoy a free month on us. You won't be charged until {newBillingDate}.",{newBillingDate:s}):h("Enjoy {months} free months on us. You won't be charged until {newBillingDate}.",{months:o,newBillingDate:s}):o===1?h("Enjoy a free month on us."):h("Enjoy {months} free months on us.",{months:o})}return e.duration==="forever"?h("Enjoy {amountOff} off forever.",{amountOff:a}):e.duration==="once"?h("Save {amountOff} on your next billing cycle. Then {currency}{originalPrice}/{cadence}.",{amountOff:a,currency:n,originalPrice:t,cadence:Za(e.cadence)}):e.duration==="repeating"&&e.duration_in_months===1?h("Save {amountOff} on your next billing cycle. Then {currency}{originalPrice}/{cadence}.",{amountOff:a,currency:n,originalPrice:t,cadence:Za(e.cadence)}):e.duration==="repeating"&&e.duration_in_months>1?h("Save {amountOff} on your next {durationInMonths} billing cycles. Then {currency}{originalPrice}/{cadence}.",{amountOff:a,durationInMonths:e.duration_in_months,currency:n,originalPrice:t,cadence:Za(e.cadence)}):""}const V1=({subscription:e,offer:t,onAcceptOffer:n,onDeclineOffer:a})=>{const{brandColor:i,action:o}=v.useContext(_),r=o==="applyOffer:running",s=Rs({subscription:e}),c=s.amount/100,u=$d(c),d=ke(s.currency),p=Sb({offer:t,price:s}),m=$d(p),f=Y0({offer:t}),b=t.cadence==="month"?h("Monthly"):h("Yearly");let w=b;const g=e.tier;g&&g.name&&(w=`${g.name} - ${b}`);const y=t.display_description||h("We'd hate to see you leave. How about a special offer to stay?"),k=U1(t,f),C=H1(t,u,d,f,e);return l.jsxs("div",{className:"gh-portal-logged-out-form-container gh-portal-offer gh-portal-retention-offer",children:[l.jsx("p",{className:"gh-portal-text-center",children:y}),l.jsxs("div",{className:"gh-portal-offer-bar",children:[l.jsxs("div",{className:"gh-portal-offer-title",children:[l.jsx("h4",{children:w}),l.jsx("h5",{className:"gh-portal-discount-label",children:k})]}),l.jsxs("div",{className:"gh-portal-offer-details",children:[!Gs(t)&&l.jsxs("div",{className:"gh-portal-retention-offer-price",children:[l.jsxs("div",{className:"gh-portal-product-price",children:[l.jsx("span",{className:"currency-sign",children:d}),l.jsx("span",{className:"amount",children:m})]}),l.jsxs("div",{className:"gh-portal-offer-oldprice",children:[d,u]})]}),l.jsx("p",{className:"footnote",children:C})]}),l.jsx(me,{dataTestId:"accept-retention-offer",onClick:n,isRunning:r,disabled:r,isPrimary:!0,brandColor:i,label:h("Continue subscription"),style:{width:"100%",height:"40px",marginTop:"20px"}})]}),l.jsx(me,{dataTestId:"decline-retention-offer",onClick:a,isPrimary:!1,isDestructive:!0,classes:"gh-portal-btn-text",brandColor:i,label:h("No thanks, I want to cancel"),style:{width:"100%",marginTop:"32px",marginBottom:"24px"}})]})},W1=({plans:e,selectedPlan:t,onPlanSelect:n,onPlanCheckout:a})=>{let i="";return e.length===1&&(i="singleplan"),l.jsx("section",{children:l.jsx("div",{className:`gh-portal-section gh-portal-accountplans-main ${i}`,children:l.jsx(Wb,{showLabel:!1,plans:e,selectedPlan:t,onPlanSelect:n,onPlanCheckout:a})})})},G1=({plans:e,selectedPlan:t,confirmationPlan:n,confirmationType:a,showConfirmation:i=!1,pendingOffer:o,onPlanSelect:r,onPlanCheckout:s,onConfirm:c,onCancelSubscription:u,onAcceptRetentionOffer:d,onDeclineRetentionOffer:p})=>{const{member:m}=v.useContext(_);if(!Dt({member:m})||Pn({member:m}))return l.jsx(W1,{plans:e,selectedPlan:t,onPlanSelect:r,onPlanCheckout:s});if(!i)return l.jsx(B1,{plans:e,selectedPlan:t,onCancelSubscription:u,onPlanSelect:r});if(a==="offerRetention"&&o){const f=rt({member:m});if(f)return l.jsx(V1,{subscription:f,offer:o,onAcceptOffer:d,onDeclineOffer:p})}return l.jsx(L1,{plan:n,type:a,onConfirm:c})},ym=class ym extends Z.Component{constructor(t,n){super(t,n),this.onPlanSelect=(a,i)=>{a==null||a.preventDefault();const{member:o}=this.context;if(!Dt({member:o})||Pn({member:o}))this.timeoutId=setTimeout(()=>{this.setState(()=>({selectedPlan:i}))},5);else{const r=this.prices.find(u=>u.id===i),c=this.getActivePriceId({member:o})?"changePlan":"subscribe";i!==this.state.selectedPlan&&this.setState({confirmationPlan:r,confirmationType:c,showConfirmation:!0})}},this.state=this.getInitialState()}componentDidMount(){const{member:t}=this.context;if(!t){this.context.doAction("switchPage",{page:"signin"});return}this.handleCancelActionFromPageData()}componentDidUpdate(){this.handleCancelActionFromPageData()}componentWillUnmount(){clearTimeout(this.timeoutId)}getRetentionOfferSignature(t){var n;return t?[t.id,t.display_title||"",t.display_description||"",t.type||"",t.cadence||"",t.amount||0,t.duration||"",t.duration_in_months||0,t.currency||"",t.status||"",((n=t.tier)==null?void 0:n.id)||""].join("|"):""}handleCancelActionFromPageData(){const{member:t,pageData:n,offers:a}=this.context;if(!t||(n==null?void 0:n.action)!=="cancel"||!(n!=null&&n.subscriptionId))return;const i=(a||[]).find(c=>c.redemption_type==="retention")||null,o=this.getRetentionOfferSignature(i),r=this.getRetentionOfferSignature(this.state.pendingOffer);(this.state.targetSubscriptionId!==n.subscriptionId||this.state.confirmationType!=="offerRetention"||o!==r)&&this.onCancelSubscription({subscriptionId:n.subscriptionId}),n.action=null}getInitialState(){const{member:t,site:n}=this.context;this.prices=Ks({site:n});let a=Xn({member:t});a&&(this.prices=v0({prices:this.prices,currency:a.currency}));let i=a?this.prices.find(r=>r.id===a.id):null;return!Dt({member:t})&&this.prices.length>0&&(i=this.prices[0]),{selectedPlan:i?i.id:null,pendingOffer:null,targetSubscriptionId:null}}handleSignout(t){t.preventDefault(),this.context.doAction("signout")}onBack(){this.state.showConfirmation?this.cancelConfirmPage():this.context.doAction("back")}cancelConfirmPage(){this.setState({showConfirmation:!1,confirmationPlan:null,confirmationType:null,pendingOffer:null,targetSubscriptionId:null})}onPlanCheckout(t,n){const{doAction:a,member:i}=this.context;let{confirmationPlan:o,selectedPlan:r}=this.state;if(n&&(r=n),Dt({member:i})&&!Pn({member:i})){const s=rt({member:i}),c=s?s.id:"";c&&a("updateSubscription",{plan:o.name,planId:o.id,subscriptionId:c,cancelAtPeriodEnd:!1})}else a("checkoutPlan",{plan:r})}onCancelSubscription({subscriptionId:t}){const{member:n,offers:a}=this.context,i=x0({subscriptionId:t,member:n});if(!i)return;const o=Rs({subscription:i}),r=(a||[]).filter(s=>s.redemption_type==="retention");r.length>0?this.setState({showConfirmation:!0,confirmationPlan:o,confirmationType:"offerRetention",pendingOffer:r[0],targetSubscriptionId:t}):this.setState({showConfirmation:!0,confirmationPlan:o,confirmationType:"cancel",pendingOffer:null,targetSubscriptionId:t})}onAcceptRetentionOffer(){const{pendingOffer:t,targetSubscriptionId:n}=this.state;!n||!t||this.context.doAction("applyOffer",{subscriptionId:n,offerId:t.id})}onDeclineRetentionOffer(){this.setState({confirmationType:"cancel",pendingOffer:null})}onCancelSubscriptionConfirmation(t){const{targetSubscriptionId:n}=this.state;if(!n)return null;this.context.doAction("cancelSubscription",{subscriptionId:n,cancelAtPeriodEnd:!0,cancellationReason:t})}getActivePriceId({member:t}){const n=Xn({member:t});return n?n.id:null}onConfirm(t,n){const{confirmationType:a}=this.state;if(a==="cancel")return this.onCancelSubscriptionConfirmation(n);if(["changePlan","subscribe"].includes(a))return this.onPlanCheckout()}render(){const t=this.prices,{selectedPlan:n,showConfirmation:a,confirmationPlan:i,confirmationType:o,pendingOffer:r}=this.state,{lastPage:s}=this.context;return l.jsx(l.Fragment,{children:l.jsxs("div",{className:"gh-portal-content",children:[l.jsx(Qa,{onClick:c=>this.onBack(c),hidden:!s&&!a}),l.jsx(pe,{}),l.jsx(R1,{onBack:c=>this.onBack(c),confirmationType:o,pendingOffer:r,showConfirmation:a}),l.jsx(G1,{plans:t,selectedPlan:n,showConfirmation:a,confirmationPlan:i,confirmationType:o,pendingOffer:r,onConfirm:(...c)=>this.onConfirm(...c),onCancelSubscription:c=>this.onCancelSubscription(c),onAcceptRetentionOffer:()=>this.onAcceptRetentionOffer(),onDeclineRetentionOffer:()=>this.onDeclineRetentionOffer(),onPlanSelect:this.onPlanSelect,onPlanCheckout:(c,u)=>this.onPlanCheckout(c,u)})]})})}};ym.contextType=_;let Bd=ym;const K1=`
|
|
1331
|
+
`;function _0({confirmationType:e,pendingOffer:t}){if(e==="changePlan")return h("Confirm subscription");if(e==="cancel")return h("Cancel subscription");if(e==="subscribe")return h("Subscribe");if(e==="offerRetention")return(t==null?void 0:t.display_title)||h("Before you go")}const R0=({showConfirmation:e,confirmationType:t,pendingOffer:n})=>{const{member:a}=v.useContext(_);let i=Dt({member:a})?h("Change plan"):h("Choose a plan");return e&&(i=_0({confirmationType:t,pendingOffer:n})),l.jsx("header",{className:"gh-portal-detail-header",children:l.jsx("h3",{className:"gh-portal-main-title",children:i})})},Y0=({member:e,onCancelSubscription:t,action:n,brandColor:a})=>{const{site:i}=v.useContext(_);if(!e.paid)return null;const o=rt({member:e});if(!o||o.cancel_at_period_end)return null;const r=h("Cancel subscription"),s=["cancelSubscription:running"].includes(n),c=!!s,u=!!o.cancel_at_period_end,d=!o.cancelAtPeriodEnd;return l.jsx("div",{className:"gh-portal-expire-container",children:l.jsx(me,{dataTestId:"cancel-subscription",onClick:()=>{t({subscriptionId:o.id,cancelAtPeriodEnd:!0})},isRunning:s,disabled:c,isPrimary:u,isDestructive:d,classes:Bs({site:i})?"gh-portal-btn-text mt2 mb4":"",brandColor:a,label:r,style:{width:"100%"}})})},L0=({plan:e,type:t,onConfirm:n})=>{const{site:a,action:i,member:o,brandColor:r}=v.useContext(_),[s,c]=v.useState(""),u=rt({member:o}),d=["updateSubscription:running","checkoutPlan:running","cancelSubscription:running"].includes(i),p=h("Confirm"),m=Xt(u.current_period_end),f=Xn({member:o});let b=h("Starting {startDate}",{startDate:m});f.id!==e.id&&(b=h("Starting today"));const w=aa(e.price),g=`${e.currency_symbol}${w}/${Za(e.interval)} – ${b}`,y=kb({site:a,priceId:e==null?void 0:e.id}),k=Bs({site:a})?y==null?void 0:y.name:h("Price");return t==="changePlan"?l.jsxs("div",{className:"gh-portal-logged-out-form-container",children:[l.jsxs("div",{className:"gh-portal-list mb6",children:[l.jsx("section",{children:l.jsxs("div",{className:"gh-portal-list-detail",children:[l.jsx("h3",{children:h("Account")}),l.jsx("p",{children:o.email})]})}),l.jsx("section",{children:l.jsxs("div",{className:"gh-portal-list-detail",children:[l.jsx("h3",{children:k}),l.jsx("p",{children:g})]})})]}),l.jsx(me,{dataTestId:"confirm-action",onClick:C=>n(C,e),isRunning:d,isPrimary:!0,brandColor:r,label:p,style:{width:"100%",height:"40px"}})]}):l.jsxs("div",{className:"gh-portal-logged-out-form-container gh-portal-cancellation-form",children:[l.jsx("p",{children:l.jsx($e,{string:h("If you cancel your subscription now, you will continue to have access until {periodEnd}."),mapping:{periodEnd:l.jsx("strong",{children:Xt(u.current_period_end)})}})}),l.jsxs("section",{className:"gh-portal-input-section",children:[l.jsx("div",{className:"gh-portal-input-labelcontainer",children:l.jsx("label",{className:"gh-portal-input-label",children:h("Cancellation reason")})}),l.jsx("textarea",{"data-test-input":"cancellation-reason",className:"gh-portal-input",label:"Cancellation reason",type:"text",name:"cancellation_reason",placeholder:"",value:s,onChange:C=>c(C.target.value),rows:"2",maxLength:"500"},"cancellation_reason")]}),l.jsx(me,{dataTestId:"confirm-cancel-subscription",onClick:C=>n(C,s),isRunning:d,isPrimary:!0,brandColor:r,label:h("Confirm cancellation"),style:{width:"100%",height:"40px"}})]})},B0=({plans:e,selectedPlan:t,onPlanSelect:n,onCancelSubscription:a})=>{const{member:i,action:o,brandColor:r}=v.useContext(_);return l.jsxs("section",{children:[l.jsx("div",{className:"gh-portal-section gh-portal-accountplans-main",children:l.jsx(Wb,{showLabel:!1,plans:e,selectedPlan:t,onPlanSelect:n,changePlan:!0})}),l.jsx(Y0,{member:i,onCancelSubscription:a,action:o,brandColor:r})]})};function Wb({selectedPlan:e,onPlanSelect:t,onPlanCheckout:n,changePlan:a=!1}){const{site:i,member:o}=v.useContext(_),r=k1({site:i,member:o}),s=Pn({member:o}),c=w1({member:o,site:i});return l.jsx(F0,{products:r.length>0||s||!c?r:[c],selectedPlan:e,changePlan:a,onPlanSelect:t,onPlanCheckout:n})}function U0(e,t){if(Gs(e)){const n=e.duration_in_months;return n===1?h("1 month free"):h("{months} months free",{months:n})}return h("{amount} off",{amount:t})}function H0(e,t,n,a,i){if(Gs(e)){const o=e.duration_in_months,r=W1(i.current_period_end,o),s=r?r.toLocaleDateString("en-GB",{year:"numeric",month:"short",day:"numeric",timeZone:"UTC"}):null;return s?o===1?h("Enjoy a free month on us. You won't be charged until {newBillingDate}.",{newBillingDate:s}):h("Enjoy {months} free months on us. You won't be charged until {newBillingDate}.",{months:o,newBillingDate:s}):o===1?h("Enjoy a free month on us."):h("Enjoy {months} free months on us.",{months:o})}return e.duration==="forever"?h("Enjoy {amountOff} off forever.",{amountOff:a}):e.duration==="once"?h("Save {amountOff} on your next billing cycle. Then {currency}{originalPrice}/{cadence}.",{amountOff:a,currency:n,originalPrice:t,cadence:Za(e.cadence)}):e.duration==="repeating"&&e.duration_in_months===1?h("Save {amountOff} on your next billing cycle. Then {currency}{originalPrice}/{cadence}.",{amountOff:a,currency:n,originalPrice:t,cadence:Za(e.cadence)}):e.duration==="repeating"&&e.duration_in_months>1?h("Save {amountOff} on your next {durationInMonths} billing cycles. Then {currency}{originalPrice}/{cadence}.",{amountOff:a,durationInMonths:e.duration_in_months,currency:n,originalPrice:t,cadence:Za(e.cadence)}):""}const V0=({subscription:e,offer:t,onAcceptOffer:n,onDeclineOffer:a})=>{const{brandColor:i,action:o}=v.useContext(_),r=o==="applyOffer:running",s=Rs({subscription:e}),c=s.amount/100,u=$d(c),d=ke(s.currency),p=Sb({offer:t,price:s}),m=$d(p),f=Y1({offer:t}),b=t.cadence==="month"?h("Monthly"):h("Yearly");let w=b;const g=e.tier;g&&g.name&&(w=`${g.name} - ${b}`);const y=t.display_description||h("We'd hate to see you leave. How about a special offer to stay?"),k=U0(t,f),C=H0(t,u,d,f,e);return l.jsxs("div",{className:"gh-portal-logged-out-form-container gh-portal-offer gh-portal-retention-offer",children:[l.jsx("p",{className:"gh-portal-text-center",children:y}),l.jsxs("div",{className:"gh-portal-offer-bar",children:[l.jsxs("div",{className:"gh-portal-offer-title",children:[l.jsx("h4",{children:w}),l.jsx("h5",{className:"gh-portal-discount-label",children:k})]}),l.jsxs("div",{className:"gh-portal-offer-details",children:[!Gs(t)&&l.jsxs("div",{className:"gh-portal-retention-offer-price",children:[l.jsxs("div",{className:"gh-portal-product-price",children:[l.jsx("span",{className:"currency-sign",children:d}),l.jsx("span",{className:"amount",children:m})]}),l.jsxs("div",{className:"gh-portal-offer-oldprice",children:[d,u]})]}),l.jsx("p",{className:"footnote",children:C})]}),l.jsx(me,{dataTestId:"accept-retention-offer",onClick:n,isRunning:r,disabled:r,isPrimary:!0,brandColor:i,label:h("Continue subscription"),style:{width:"100%",height:"40px",marginTop:"20px"}})]}),l.jsx(me,{dataTestId:"decline-retention-offer",onClick:a,isPrimary:!1,isDestructive:!0,classes:"gh-portal-btn-text",brandColor:i,label:h("No thanks, I want to cancel"),style:{width:"100%",marginTop:"32px",marginBottom:"24px"}})]})},W0=({plans:e,selectedPlan:t,onPlanSelect:n,onPlanCheckout:a})=>{let i="";return e.length===1&&(i="singleplan"),l.jsx("section",{children:l.jsx("div",{className:`gh-portal-section gh-portal-accountplans-main ${i}`,children:l.jsx(Wb,{showLabel:!1,plans:e,selectedPlan:t,onPlanSelect:n,onPlanCheckout:a})})})},G0=({plans:e,selectedPlan:t,confirmationPlan:n,confirmationType:a,showConfirmation:i=!1,pendingOffer:o,onPlanSelect:r,onPlanCheckout:s,onConfirm:c,onCancelSubscription:u,onAcceptRetentionOffer:d,onDeclineRetentionOffer:p})=>{const{member:m}=v.useContext(_);if(!Dt({member:m})||Pn({member:m}))return l.jsx(W0,{plans:e,selectedPlan:t,onPlanSelect:r,onPlanCheckout:s});if(!i)return l.jsx(B0,{plans:e,selectedPlan:t,onCancelSubscription:u,onPlanSelect:r});if(a==="offerRetention"&&o){const f=rt({member:m});if(f)return l.jsx(V0,{subscription:f,offer:o,onAcceptOffer:d,onDeclineOffer:p})}return l.jsx(L0,{plan:n,type:a,onConfirm:c})},ym=class ym extends Z.Component{constructor(t,n){super(t,n),this.onPlanSelect=(a,i)=>{a==null||a.preventDefault();const{member:o}=this.context;if(!Dt({member:o})||Pn({member:o}))this.timeoutId=setTimeout(()=>{this.setState(()=>({selectedPlan:i}))},5);else{const r=this.prices.find(u=>u.id===i),c=this.getActivePriceId({member:o})?"changePlan":"subscribe";i!==this.state.selectedPlan&&this.setState({confirmationPlan:r,confirmationType:c,showConfirmation:!0})}},this.state=this.getInitialState()}componentDidMount(){const{member:t}=this.context;if(!t){this.context.doAction("switchPage",{page:"signin"});return}this.handleCancelActionFromPageData()}componentDidUpdate(){this.handleCancelActionFromPageData()}componentWillUnmount(){clearTimeout(this.timeoutId)}getRetentionOfferSignature(t){var n;return t?[t.id,t.display_title||"",t.display_description||"",t.type||"",t.cadence||"",t.amount||0,t.duration||"",t.duration_in_months||0,t.currency||"",t.status||"",((n=t.tier)==null?void 0:n.id)||""].join("|"):""}handleCancelActionFromPageData(){const{member:t,pageData:n,offers:a}=this.context;if(!t||(n==null?void 0:n.action)!=="cancel"||!(n!=null&&n.subscriptionId))return;const i=(a||[]).find(c=>c.redemption_type==="retention")||null,o=this.getRetentionOfferSignature(i),r=this.getRetentionOfferSignature(this.state.pendingOffer);(this.state.targetSubscriptionId!==n.subscriptionId||this.state.confirmationType!=="offerRetention"||o!==r)&&this.onCancelSubscription({subscriptionId:n.subscriptionId}),n.action=null}getInitialState(){const{member:t,site:n}=this.context;this.prices=Ks({site:n});let a=Xn({member:t});a&&(this.prices=v1({prices:this.prices,currency:a.currency}));let i=a?this.prices.find(r=>r.id===a.id):null;return!Dt({member:t})&&this.prices.length>0&&(i=this.prices[0]),{selectedPlan:i?i.id:null,pendingOffer:null,targetSubscriptionId:null}}handleSignout(t){t.preventDefault(),this.context.doAction("signout")}onBack(){this.state.showConfirmation?this.cancelConfirmPage():this.context.doAction("back")}cancelConfirmPage(){this.setState({showConfirmation:!1,confirmationPlan:null,confirmationType:null,pendingOffer:null,targetSubscriptionId:null})}onPlanCheckout(t,n){const{doAction:a,member:i}=this.context;let{confirmationPlan:o,selectedPlan:r}=this.state;if(n&&(r=n),Dt({member:i})&&!Pn({member:i})){const s=rt({member:i}),c=s?s.id:"";c&&a("updateSubscription",{plan:o.name,planId:o.id,subscriptionId:c,cancelAtPeriodEnd:!1})}else a("checkoutPlan",{plan:r})}onCancelSubscription({subscriptionId:t}){const{member:n,offers:a}=this.context,i=x1({subscriptionId:t,member:n});if(!i)return;const o=Rs({subscription:i}),r=(a||[]).filter(s=>s.redemption_type==="retention");r.length>0?this.setState({showConfirmation:!0,confirmationPlan:o,confirmationType:"offerRetention",pendingOffer:r[0],targetSubscriptionId:t}):this.setState({showConfirmation:!0,confirmationPlan:o,confirmationType:"cancel",pendingOffer:null,targetSubscriptionId:t})}onAcceptRetentionOffer(){const{pendingOffer:t,targetSubscriptionId:n}=this.state;!n||!t||this.context.doAction("applyOffer",{subscriptionId:n,offerId:t.id})}onDeclineRetentionOffer(){this.setState({confirmationType:"cancel",pendingOffer:null})}onCancelSubscriptionConfirmation(t){const{targetSubscriptionId:n}=this.state;if(!n)return null;this.context.doAction("cancelSubscription",{subscriptionId:n,cancelAtPeriodEnd:!0,cancellationReason:t})}getActivePriceId({member:t}){const n=Xn({member:t});return n?n.id:null}onConfirm(t,n){const{confirmationType:a}=this.state;if(a==="cancel")return this.onCancelSubscriptionConfirmation(n);if(["changePlan","subscribe"].includes(a))return this.onPlanCheckout()}render(){const t=this.prices,{selectedPlan:n,showConfirmation:a,confirmationPlan:i,confirmationType:o,pendingOffer:r}=this.state,{lastPage:s}=this.context;return l.jsx(l.Fragment,{children:l.jsxs("div",{className:"gh-portal-content",children:[l.jsx(Qa,{onClick:c=>this.onBack(c),hidden:!s&&!a}),l.jsx(pe,{}),l.jsx(R0,{onBack:c=>this.onBack(c),confirmationType:o,pendingOffer:r,showConfirmation:a}),l.jsx(G0,{plans:t,selectedPlan:n,showConfirmation:a,confirmationPlan:i,confirmationType:o,pendingOffer:r,onConfirm:(...c)=>this.onConfirm(...c),onCancelSubscription:c=>this.onCancelSubscription(c),onAcceptRetentionOffer:()=>this.onAcceptRetentionOffer(),onDeclineRetentionOffer:()=>this.onDeclineRetentionOffer(),onPlanSelect:this.onPlanSelect,onPlanCheckout:(c,u)=>this.onPlanCheckout(c,u)})]})})}};ym.contextType=_;let Bd=ym;const K0=`
|
|
1332
1332
|
.gh-portal-input-section.hidden {
|
|
1333
1333
|
display: none;
|
|
1334
1334
|
}
|
|
@@ -1392,7 +1392,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1392
1392
|
.gh-portal-popup-container:not(.preview) .gh-portal-input:disabled::placeholder {
|
|
1393
1393
|
color: var(--grey9);
|
|
1394
1394
|
}
|
|
1395
|
-
`;function q1({message:e,style:t}){return e?l.jsx("p",{style:{...t||{}},children:e}):null}function J1({name:e,id:t,hidden:n,label:a,hideLabel:i,type:o,value:r,placeholder:s,disabled:c=!1,onChange:u=()=>{},onBlur:d=()=>{},onKeyDown:p=()=>{},tabIndex:m,maxLength:f,autoFocus:b,errorMessage:w}){const g=v.useRef(null);t=t||`input-${e}`;const y=n?"gh-portal-input-section hidden":"gh-portal-input-section",k=i?"gh-portal-input-label hidden":"gh-portal-input-label",C=w?"gh-portal-input error":"gh-portal-input";Zn()&&(c=!0),de(["preview"])&&(c=!0);let x="",T="",E="",N,z;switch(t){case"input-email":x="off",T="off",E="off";break;case"input-name":x="off",T="off";break;case"input-otc":x="one-time-code",T="off",E="off",N="numeric",z="[0-9]*",s??(s="• • • • • •");break}return v.useEffect(()=>{b&&g.current.focus()},[b]),l.jsxs("section",{className:y,children:[l.jsxs("div",{className:"gh-portal-input-labelcontainer",children:[l.jsxs("label",{htmlFor:t,className:k,children:[" ",a," "]}),l.jsx(q1,{message:w,name:e})]}),l.jsx("input",{"data-test-input":t,ref:g,id:t,className:C,type:o,name:e,value:r,placeholder:s,onChange:j=>u(j,e),onKeyDown:j=>p(j,e),onBlur:j=>d(j,e),disabled:c,tabIndex:m,maxLength:f,autoComplete:x,autoCorrect:T,autoCapitalize:E,"aria-label":a,inputMode:N,pattern:z})]})}const bm=class bm extends Z.Component{render(){return l.jsx(l.Fragment,{children:l.jsxs("button",{className:"gh-portal-btn gh-portal-btn-site-title-back",onClick:()=>{this.props.onBack?this.props.onBack():this.context.doAction("closePopup")},children:[l.jsx("span",{children:"← "})," ",h("Back")]})})}};bm.contextType=_;let Fo=bm;const Z1=e=>v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",...e},v.createElement("g",{transform:"matrix(0.6666666666666666,0,0,0.6666666666666666,0,0)"},v.createElement("path",{d:"M19.5,9.5h-.75V6.75a6.75,6.75,0,0,0-13.5,0V9.5H4.5a2,2,0,0,0-2,2V22a2,2,0,0,0,2,2h15a2,2,0,0,0,2-2V11.5A2,2,0,0,0,19.5,9.5Zm-7.5,9a2,2,0,1,1,2-2A2,2,0,0,1,12,18.5ZM16.25,9a.5.5,0,0,1-.5.5H8.25a.5.5,0,0,1-.5-.5V6.75a4.25,4.25,0,0,1,8.5,0Z",style:{fill:"#000000"}})));function X1({newsletter:e,subscribedNewsletters:t,setSubscribedNewsletters:n}){const a=t.some(i=>i.id===(e==null?void 0:e.id));return e.paid?l.jsxs("section",{className:"gh-portal-list-toggle-wrapper","data-testid":"toggle-wrapper",children:[l.jsxs("div",{className:"gh-portal-list-detail gh-portal-list-big",children:[l.jsx("h3",{children:e.name}),l.jsx("p",{children:e.description})]}),l.jsx("div",{className:"gh-portal-lock-icon-container",children:l.jsx(Z1,{className:"gh-portal-lock-icon",alt:"",title:h("Unlock access to all newsletters by becoming a paid subscriber.")})})]}):l.jsxs("section",{className:"gh-portal-list-toggle-wrapper","data-testid":"toggle-wrapper",children:[l.jsxs("div",{className:"gh-portal-list-detail gh-portal-list-big",children:[l.jsx("h3",{children:e.name}),l.jsx("p",{children:e.description})]}),l.jsx("div",{children:l.jsx(tl,{id:e.id,onToggle:(i,o)=>{let r=[];o?r=t.filter(s=>s.id!==e.id).concat(e):r=t.filter(s=>s.id!==e.id),n(r)},checked:a})})]})}function Q1({subscribedNewsletters:e,setSubscribedNewsletters:t}){const{site:n}=v.useContext(_);return ta({site:n}).map(i=>l.jsx(X1,{newsletter:i,subscribedNewsletters:e,setSubscribedNewsletters:t},i==null?void 0:i.id))}function Ud({pageData:e,onBack:t}){const{brandColor:n,site:a,doAction:i,action:o}=v.useContext(_),s=ta({site:a}).filter(b=>b.subscribe_on_signup);let c=!1;o==="signup:running"&&(c=!0);let u=h("Continue"),d=!1;o==="signup:failed"&&(u=h("Retry"),d=!0);const p=o==="signup:running",[m,f]=v.useState(s);return l.jsxs("div",{className:"gh-portal-content with-footer gh-portal-newsletter-selection",children:[l.jsx("p",{className:"gh-portal-text-center gh-portal-text-large",children:h("Choose your newsletters")}),l.jsx("div",{className:"gh-portal-section",children:l.jsx("div",{className:"gh-portal-list",children:l.jsx(Q1,{subscribedNewsletters:m,setSubscribedNewsletters:f})})}),l.jsx("footer",{className:"gh-portal-action-footer",children:l.jsxs("div",{style:{width:"100%"},children:[l.jsx("div",{style:{marginBottom:"20px"},children:l.jsx(me,{isRunning:c,retry:d,disabled:p,onClick:()=>{let b=m.map(x=>({id:x.id,name:x.name}));const{name:w,email:g,plan:y,phonenumber:k,offerId:C}=e;i("signup",{name:w,email:g,plan:y,phonenumber:k,newsletters:b,offerId:C})},brandColor:n,label:u,style:{width:"100%"}})}),Ja({site:a})?null:l.jsx("div",{children:l.jsx("button",{className:"gh-portal-btn gh-portal-btn-link gh-portal-btn-different-plan",onClick:()=>{t()},children:l.jsx("span",{children:h("Choose a different plan")})})})]})})]})}const eT=({field:e,onChange:t,onBlur:n=()=>{},onKeyDown:a=()=>{}})=>e?l.jsx(l.Fragment,{children:l.jsx(J1,{label:e.label,type:e.type,name:e.name,hidden:e.hidden,placeholder:e.placeholder,disabled:e.disabled,value:e.value,onKeyDown:a,onChange:i=>t(i,e),onBlur:i=>n(i,e),tabIndex:e.tabIndex,errorMessage:e.errorMessage,autoFocus:e.autoFocus},e.name)}):null;class ti extends v.Component{constructor(t){super(t),this.state={}}render(){const{fields:t,onChange:n,onBlur:a,onKeyDown:i}=this.props,o=t.map(r=>l.jsx(eT,{field:r,onChange:n,onBlur:a,onKeyDown:i},r.name));return l.jsx(l.Fragment,{children:o})}}const tT=e=>!!e&&/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(String(e).toLowerCase()),nT=({field:e})=>{if(e.required&&!e.value)switch(e.name){case"name":return h("Enter your name");case"email":return h("Enter your email address");default:return h("Please enter {fieldName}",{fieldName:e.name})}return e.type==="email"&&!tT(e.value)?h("Invalid email address"):null},Oo=({fields:e})=>{const t={};return e.forEach(n=>{const a=n.name,i=nT({field:n});t[a]=i}),t},Gb=e=>v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...e},v.createElement("defs",null,v.createElement("style",null,".inviteicon{fill: currentColor;}")),v.createElement("path",{className:"inviteicon",d:"M23.991 11.464l-.036-.146-.028-.068-.011-.027-.115-.114-.018-.021-.008-.005h-.001l-3.774-2.596v-7.987c0-.276-.224-.5-.5-.5h-15c-.276 0-.5.224-.5.5v7.987l-3.774 2.595-.003.002-.006.004-.015.016-.118.118-.011.027-.028.068-.036.146-.009.037v10.5c0 1.103.897 2 2 2h20c1.103 0 2-.897 2-2v-10.5l-.009-.036zm-1.383.03l-2.608 1.738v-3.531l2.608 1.793zm-18.608 1.738l-2.608-1.739 2.608-1.792v3.531zm18 9.768h-20c-.551 0-1-.449-1-1v-9.566l5.223 3.482c.085.057.181.084.276.084.162 0 .32-.078.417-.223.153-.23.091-.54-.139-.693l-1.777-1.185v-12.899h14v12.899l-1.777 1.185c-.23.153-.292.463-.139.693.096.145.255.223.416.223.095 0 .191-.027.277-.084l5.223-3.482v9.566c0 .551-.449 1-1 1zM15.812 16.109c-.088-.07-.198-.109-.312-.109h-7c-.114 0-.224.039-.312.109l-5 4c-.215.173-.25.487-.078.703.173.215.487.251.703.078l4.862-3.89h6.649l4.863 3.891c.093.073.203.109.313.109.147 0 .292-.065.391-.188.172-.216.137-.53-.078-.703l-5.001-4zM11.706 12.779c.087.064.191.096.294.096s.207-.032.294-.096c.482-.35 4.706-3.497 4.706-6.101 0-1.868-1.387-2.984-2.728-2.984-.772 0-1.674.379-2.272 1.368-.598-.988-1.5-1.368-2.272-1.368-1.341-.001-2.728 1.116-2.728 2.984 0 2.604 4.224 5.751 4.706 6.101zm-1.978-8.086c.844 0 1.511.681 1.786 1.822.108.45.864.45.973 0 .274-1.141.942-1.822 1.786-1.822.85 0 1.728.742 1.728 1.984 0 1.646-2.658 4.037-4 5.072-1.342-1.035-4-3.426-4-5.072-.001-1.241.877-1.984 1.727-1.984z"})),Kb=e=>{if(e.currentTarget.contains(e.target)){const t=e.target.closest("a");t&&(e.preventDefault(),window.open(t.href,"_blank"))}};/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */const{entries:qb,setPrototypeOf:Jb,isFrozen:aT,getPrototypeOf:iT,getOwnPropertyDescriptor:oT}=Object;let{freeze:Ve,seal:gt,create:Hd}=Object,{apply:Vd,construct:Wd}=typeof Reflect<"u"&&Reflect;Ve||(Ve=function(t){return t}),gt||(gt=function(t){return t}),Vd||(Vd=function(t,n){for(var a=arguments.length,i=new Array(a>2?a-2:0),o=2;o<a;o++)i[o-2]=arguments[o];return t.apply(n,i)}),Wd||(Wd=function(t){for(var n=arguments.length,a=new Array(n>1?n-1:0),i=1;i<n;i++)a[i-1]=arguments[i];return new t(...a)});const al=Ge(Array.prototype.forEach),rT=Ge(Array.prototype.lastIndexOf),Zb=Ge(Array.prototype.pop),_o=Ge(Array.prototype.push),sT=Ge(Array.prototype.splice),il=Ge(String.prototype.toLowerCase),Gd=Ge(String.prototype.toString),Kd=Ge(String.prototype.match),Ro=Ge(String.prototype.replace),lT=Ge(String.prototype.indexOf),cT=Ge(String.prototype.trim),Ct=Ge(Object.prototype.hasOwnProperty),We=Ge(RegExp.prototype.test),Yo=uT(TypeError);function Ge(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,a=new Array(n>1?n-1:0),i=1;i<n;i++)a[i-1]=arguments[i];return Vd(e,t,a)}}function uT(e){return function(){for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return Wd(e,n)}}function K(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:il;Jb&&Jb(e,null);let a=t.length;for(;a--;){let i=t[a];if(typeof i=="string"){const o=n(i);o!==i&&(aT(t)||(t[a]=o),i=o)}e[i]=!0}return e}function dT(e){for(let t=0;t<e.length;t++)Ct(e,t)||(e[t]=null);return e}function Ot(e){const t=Hd(null);for(const[n,a]of qb(e))Ct(e,n)&&(Array.isArray(a)?t[n]=dT(a):a&&typeof a=="object"&&a.constructor===Object?t[n]=Ot(a):t[n]=a);return t}function Lo(e,t){for(;e!==null;){const a=oT(e,t);if(a){if(a.get)return Ge(a.get);if(typeof a.value=="function")return Ge(a.value)}e=iT(e)}function n(){return null}return n}const Xb=Ve(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),qd=Ve(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Jd=Ve(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),mT=Ve(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Zd=Ve(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),pT=Ve(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Qb=Ve(["#text"]),ek=Ve(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Xd=Ve(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),tk=Ve(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ol=Ve(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),hT=gt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),fT=gt(/<%[\w\W]*|[\w\W]*%>/gm),gT=gt(/\$\{[\w\W]*/gm),yT=gt(/^data-[\-\w.\u00B7-\uFFFF]+$/),bT=gt(/^aria-[\-\w]+$/),nk=gt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),kT=gt(/^(?:\w+script|data):/i),vT=gt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ak=gt(/^html$/i),wT=gt(/^[a-z][.\w]*(-[.\w]+)+$/i);var ik=Object.freeze({__proto__:null,ARIA_ATTR:bT,ATTR_WHITESPACE:vT,CUSTOM_ELEMENT:wT,DATA_ATTR:yT,DOCTYPE_NAME:ak,ERB_EXPR:fT,IS_ALLOWED_URI:nk,IS_SCRIPT_OR_DATA:kT,MUSTACHE_EXPR:hT,TMPLIT_EXPR:gT});const Bo={element:1,text:3,progressingInstruction:7,comment:8,document:9},ST=function(){return typeof window>"u"?null:window},xT=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let a=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(a=n.getAttribute(i));const o="dompurify"+(a?"#"+a:"");try{return t.createPolicy(o,{createHTML(r){return r},createScriptURL(r){return r}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},ok=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function rk(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ST();const t=B=>rk(B);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Bo.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const a=n,i=a.currentScript,{DocumentFragment:o,HTMLTemplateElement:r,Node:s,Element:c,NodeFilter:u,NamedNodeMap:d=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:p,DOMParser:m,trustedTypes:f}=e,b=c.prototype,w=Lo(b,"cloneNode"),g=Lo(b,"remove"),y=Lo(b,"nextSibling"),k=Lo(b,"childNodes"),C=Lo(b,"parentNode");if(typeof r=="function"){const B=n.createElement("template");B.content&&B.content.ownerDocument&&(n=B.content.ownerDocument)}let x,T="";const{implementation:E,createNodeIterator:N,createDocumentFragment:z,getElementsByTagName:j}=n,{importNode:V}=a;let q=ok();t.isSupported=typeof qb=="function"&&typeof C=="function"&&E&&E.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:ce,ERB_EXPR:ae,TMPLIT_EXPR:_e,DATA_ATTR:Ie,ARIA_ATTR:Ke,IS_SCRIPT_OR_DATA:$,ATTR_WHITESPACE:I,CUSTOM_ELEMENT:F}=ik;let{IS_ALLOWED_URI:J}=ik,P=null;const O=K({},[...Xb,...qd,...Jd,...Zd,...Qb]);let D=null;const H=K({},[...ek,...Xd,...tk,...ol]);let L=Object.seal(Hd(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ye=null,Re=null;const et=Object.seal(Hd(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let st=!0,Vo=!0,Mk=!1,Dk=!0,li=!1,dl=!0,oa=!1,Pm=!1,zm=!1,ci=!1,ml=!1,pl=!1,Fk=!0,Ok=!1;const wz="user-content-";let Im=!0,Wo=!1,ui={},_t=null;const Nm=K({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let _k=null;const Rk=K({},["audio","video","img","source","image","track"]);let Am=null;const Yk=K({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),hl="http://www.w3.org/1998/Math/MathML",fl="http://www.w3.org/2000/svg",en="http://www.w3.org/1999/xhtml";let di=en,Mm=!1,Dm=null;const Sz=K({},[hl,fl,en],Gd);let gl=K({},["mi","mo","mn","ms","mtext"]),yl=K({},["annotation-xml"]);const xz=K({},["title","style","font","a","script"]);let Go=null;const Cz=["application/xhtml+xml","text/html"],Ez="text/html";let Se=null,mi=null;const $z=n.createElement("form"),Lk=function(S){return S instanceof RegExp||S instanceof Function},Fm=function(){let S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(mi&&mi===S)){if((!S||typeof S!="object")&&(S={}),S=Ot(S),Go=Cz.indexOf(S.PARSER_MEDIA_TYPE)===-1?Ez:S.PARSER_MEDIA_TYPE,Se=Go==="application/xhtml+xml"?Gd:il,P=Ct(S,"ALLOWED_TAGS")?K({},S.ALLOWED_TAGS,Se):O,D=Ct(S,"ALLOWED_ATTR")?K({},S.ALLOWED_ATTR,Se):H,Dm=Ct(S,"ALLOWED_NAMESPACES")?K({},S.ALLOWED_NAMESPACES,Gd):Sz,Am=Ct(S,"ADD_URI_SAFE_ATTR")?K(Ot(Yk),S.ADD_URI_SAFE_ATTR,Se):Yk,_k=Ct(S,"ADD_DATA_URI_TAGS")?K(Ot(Rk),S.ADD_DATA_URI_TAGS,Se):Rk,_t=Ct(S,"FORBID_CONTENTS")?K({},S.FORBID_CONTENTS,Se):Nm,ye=Ct(S,"FORBID_TAGS")?K({},S.FORBID_TAGS,Se):Ot({}),Re=Ct(S,"FORBID_ATTR")?K({},S.FORBID_ATTR,Se):Ot({}),ui=Ct(S,"USE_PROFILES")?S.USE_PROFILES:!1,st=S.ALLOW_ARIA_ATTR!==!1,Vo=S.ALLOW_DATA_ATTR!==!1,Mk=S.ALLOW_UNKNOWN_PROTOCOLS||!1,Dk=S.ALLOW_SELF_CLOSE_IN_ATTR!==!1,li=S.SAFE_FOR_TEMPLATES||!1,dl=S.SAFE_FOR_XML!==!1,oa=S.WHOLE_DOCUMENT||!1,ci=S.RETURN_DOM||!1,ml=S.RETURN_DOM_FRAGMENT||!1,pl=S.RETURN_TRUSTED_TYPE||!1,zm=S.FORCE_BODY||!1,Fk=S.SANITIZE_DOM!==!1,Ok=S.SANITIZE_NAMED_PROPS||!1,Im=S.KEEP_CONTENT!==!1,Wo=S.IN_PLACE||!1,J=S.ALLOWED_URI_REGEXP||nk,di=S.NAMESPACE||en,gl=S.MATHML_TEXT_INTEGRATION_POINTS||gl,yl=S.HTML_INTEGRATION_POINTS||yl,L=S.CUSTOM_ELEMENT_HANDLING||{},S.CUSTOM_ELEMENT_HANDLING&&Lk(S.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(L.tagNameCheck=S.CUSTOM_ELEMENT_HANDLING.tagNameCheck),S.CUSTOM_ELEMENT_HANDLING&&Lk(S.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(L.attributeNameCheck=S.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),S.CUSTOM_ELEMENT_HANDLING&&typeof S.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(L.allowCustomizedBuiltInElements=S.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),li&&(Vo=!1),ml&&(ci=!0),ui&&(P=K({},Qb),D=[],ui.html===!0&&(K(P,Xb),K(D,ek)),ui.svg===!0&&(K(P,qd),K(D,Xd),K(D,ol)),ui.svgFilters===!0&&(K(P,Jd),K(D,Xd),K(D,ol)),ui.mathMl===!0&&(K(P,Zd),K(D,tk),K(D,ol))),S.ADD_TAGS&&(typeof S.ADD_TAGS=="function"?et.tagCheck=S.ADD_TAGS:(P===O&&(P=Ot(P)),K(P,S.ADD_TAGS,Se))),S.ADD_ATTR&&(typeof S.ADD_ATTR=="function"?et.attributeCheck=S.ADD_ATTR:(D===H&&(D=Ot(D)),K(D,S.ADD_ATTR,Se))),S.ADD_URI_SAFE_ATTR&&K(Am,S.ADD_URI_SAFE_ATTR,Se),S.FORBID_CONTENTS&&(_t===Nm&&(_t=Ot(_t)),K(_t,S.FORBID_CONTENTS,Se)),S.ADD_FORBID_CONTENTS&&(_t===Nm&&(_t=Ot(_t)),K(_t,S.ADD_FORBID_CONTENTS,Se)),Im&&(P["#text"]=!0),oa&&K(P,["html","head","body"]),P.table&&(K(P,["tbody"]),delete ye.tbody),S.TRUSTED_TYPES_POLICY){if(typeof S.TRUSTED_TYPES_POLICY.createHTML!="function")throw Yo('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof S.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Yo('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');x=S.TRUSTED_TYPES_POLICY,T=x.createHTML("")}else x===void 0&&(x=xT(f,i)),x!==null&&typeof T=="string"&&(T=x.createHTML(""));Ve&&Ve(S),mi=S}},Bk=K({},[...qd,...Jd,...mT]),Uk=K({},[...Zd,...pT]),jz=function(S){let A=C(S);(!A||!A.tagName)&&(A={namespaceURI:di,tagName:"template"});const Y=il(S.tagName),he=il(A.tagName);return Dm[S.namespaceURI]?S.namespaceURI===fl?A.namespaceURI===en?Y==="svg":A.namespaceURI===hl?Y==="svg"&&(he==="annotation-xml"||gl[he]):!!Bk[Y]:S.namespaceURI===hl?A.namespaceURI===en?Y==="math":A.namespaceURI===fl?Y==="math"&&yl[he]:!!Uk[Y]:S.namespaceURI===en?A.namespaceURI===fl&&!yl[he]||A.namespaceURI===hl&&!gl[he]?!1:!Uk[Y]&&(xz[Y]||!Bk[Y]):!!(Go==="application/xhtml+xml"&&Dm[S.namespaceURI]):!1},Rt=function(S){_o(t.removed,{element:S});try{C(S).removeChild(S)}catch{g(S)}},ra=function(S,A){try{_o(t.removed,{attribute:A.getAttributeNode(S),from:A})}catch{_o(t.removed,{attribute:null,from:A})}if(A.removeAttribute(S),S==="is")if(ci||ml)try{Rt(A)}catch{}else try{A.setAttribute(S,"")}catch{}},Hk=function(S){let A=null,Y=null;if(zm)S="<remove></remove>"+S;else{const ve=Kd(S,/^[\r\n\t ]+/);Y=ve&&ve[0]}Go==="application/xhtml+xml"&&di===en&&(S='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+S+"</body></html>");const he=x?x.createHTML(S):S;if(di===en)try{A=new m().parseFromString(he,Go)}catch{}if(!A||!A.documentElement){A=E.createDocument(di,"template",null);try{A.documentElement.innerHTML=Mm?T:he}catch{}}const Ye=A.body||A.documentElement;return S&&Y&&Ye.insertBefore(n.createTextNode(Y),Ye.childNodes[0]||null),di===en?j.call(A,oa?"html":"body")[0]:oa?A.documentElement:Ye},Vk=function(S){return N.call(S.ownerDocument||S,S,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Om=function(S){return S instanceof p&&(typeof S.nodeName!="string"||typeof S.textContent!="string"||typeof S.removeChild!="function"||!(S.attributes instanceof d)||typeof S.removeAttribute!="function"||typeof S.setAttribute!="function"||typeof S.namespaceURI!="string"||typeof S.insertBefore!="function"||typeof S.hasChildNodes!="function")},Wk=function(S){return typeof s=="function"&&S instanceof s};function tn(B,S,A){al(B,Y=>{Y.call(t,S,A,mi)})}const Gk=function(S){let A=null;if(tn(q.beforeSanitizeElements,S,null),Om(S))return Rt(S),!0;const Y=Se(S.nodeName);if(tn(q.uponSanitizeElement,S,{tagName:Y,allowedTags:P}),dl&&S.hasChildNodes()&&!Wk(S.firstElementChild)&&We(/<[/\w!]/g,S.innerHTML)&&We(/<[/\w!]/g,S.textContent)||S.nodeType===Bo.progressingInstruction||dl&&S.nodeType===Bo.comment&&We(/<[/\w]/g,S.data))return Rt(S),!0;if(!(et.tagCheck instanceof Function&&et.tagCheck(Y))&&(!P[Y]||ye[Y])){if(!ye[Y]&&qk(Y)&&(L.tagNameCheck instanceof RegExp&&We(L.tagNameCheck,Y)||L.tagNameCheck instanceof Function&&L.tagNameCheck(Y)))return!1;if(Im&&!_t[Y]){const he=C(S)||S.parentNode,Ye=k(S)||S.childNodes;if(Ye&&he){const ve=Ye.length;for(let tt=ve-1;tt>=0;--tt){const nn=w(Ye[tt],!0);nn.__removalCount=(S.__removalCount||0)+1,he.insertBefore(nn,y(S))}}}return Rt(S),!0}return S instanceof c&&!jz(S)||(Y==="noscript"||Y==="noembed"||Y==="noframes")&&We(/<\/no(script|embed|frames)/i,S.innerHTML)?(Rt(S),!0):(li&&S.nodeType===Bo.text&&(A=S.textContent,al([ce,ae,_e],he=>{A=Ro(A,he," ")}),S.textContent!==A&&(_o(t.removed,{element:S.cloneNode()}),S.textContent=A)),tn(q.afterSanitizeElements,S,null),!1)},Kk=function(S,A,Y){if(Fk&&(A==="id"||A==="name")&&(Y in n||Y in $z))return!1;if(!(Vo&&!Re[A]&&We(Ie,A))){if(!(st&&We(Ke,A))){if(!(et.attributeCheck instanceof Function&&et.attributeCheck(A,S))){if(!D[A]||Re[A]){if(!(qk(S)&&(L.tagNameCheck instanceof RegExp&&We(L.tagNameCheck,S)||L.tagNameCheck instanceof Function&&L.tagNameCheck(S))&&(L.attributeNameCheck instanceof RegExp&&We(L.attributeNameCheck,A)||L.attributeNameCheck instanceof Function&&L.attributeNameCheck(A,S))||A==="is"&&L.allowCustomizedBuiltInElements&&(L.tagNameCheck instanceof RegExp&&We(L.tagNameCheck,Y)||L.tagNameCheck instanceof Function&&L.tagNameCheck(Y))))return!1}else if(!Am[A]){if(!We(J,Ro(Y,I,""))){if(!((A==="src"||A==="xlink:href"||A==="href")&&S!=="script"&&lT(Y,"data:")===0&&_k[S])){if(!(Mk&&!We($,Ro(Y,I,"")))){if(Y)return!1}}}}}}}return!0},qk=function(S){return S!=="annotation-xml"&&Kd(S,F)},Jk=function(S){tn(q.beforeSanitizeAttributes,S,null);const{attributes:A}=S;if(!A||Om(S))return;const Y={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:D,forceKeepAttr:void 0};let he=A.length;for(;he--;){const Ye=A[he],{name:ve,namespaceURI:tt,value:nn}=Ye,pi=Se(ve),_m=nn;let Ne=ve==="value"?_m:cT(_m);if(Y.attrName=pi,Y.attrValue=Ne,Y.keepAttr=!0,Y.forceKeepAttr=void 0,tn(q.uponSanitizeAttribute,S,Y),Ne=Y.attrValue,Ok&&(pi==="id"||pi==="name")&&(ra(ve,S),Ne=wz+Ne),dl&&We(/((--!?|])>)|<\/(style|title|textarea)/i,Ne)){ra(ve,S);continue}if(pi==="attributename"&&Kd(Ne,"href")){ra(ve,S);continue}if(Y.forceKeepAttr)continue;if(!Y.keepAttr){ra(ve,S);continue}if(!Dk&&We(/\/>/i,Ne)){ra(ve,S);continue}li&&al([ce,ae,_e],Xk=>{Ne=Ro(Ne,Xk," ")});const Zk=Se(S.nodeName);if(!Kk(Zk,pi,Ne)){ra(ve,S);continue}if(x&&typeof f=="object"&&typeof f.getAttributeType=="function"&&!tt)switch(f.getAttributeType(Zk,pi)){case"TrustedHTML":{Ne=x.createHTML(Ne);break}case"TrustedScriptURL":{Ne=x.createScriptURL(Ne);break}}if(Ne!==_m)try{tt?S.setAttributeNS(tt,ve,Ne):S.setAttribute(ve,Ne),Om(S)?Rt(S):Zb(t.removed)}catch{ra(ve,S)}}tn(q.afterSanitizeAttributes,S,null)},Tz=function B(S){let A=null;const Y=Vk(S);for(tn(q.beforeSanitizeShadowDOM,S,null);A=Y.nextNode();)tn(q.uponSanitizeShadowNode,A,null),Gk(A),Jk(A),A.content instanceof o&&B(A.content);tn(q.afterSanitizeShadowDOM,S,null)};return t.sanitize=function(B){let S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},A=null,Y=null,he=null,Ye=null;if(Mm=!B,Mm&&(B="<!-->"),typeof B!="string"&&!Wk(B))if(typeof B.toString=="function"){if(B=B.toString(),typeof B!="string")throw Yo("dirty is not a string, aborting")}else throw Yo("toString is not a function");if(!t.isSupported)return B;if(Pm||Fm(S),t.removed=[],typeof B=="string"&&(Wo=!1),Wo){if(B.nodeName){const nn=Se(B.nodeName);if(!P[nn]||ye[nn])throw Yo("root node is forbidden and cannot be sanitized in-place")}}else if(B instanceof s)A=Hk("<!---->"),Y=A.ownerDocument.importNode(B,!0),Y.nodeType===Bo.element&&Y.nodeName==="BODY"||Y.nodeName==="HTML"?A=Y:A.appendChild(Y);else{if(!ci&&!li&&!oa&&B.indexOf("<")===-1)return x&&pl?x.createHTML(B):B;if(A=Hk(B),!A)return ci?null:pl?T:""}A&&zm&&Rt(A.firstChild);const ve=Vk(Wo?B:A);for(;he=ve.nextNode();)Gk(he),Jk(he),he.content instanceof o&&Tz(he.content);if(Wo)return B;if(ci){if(ml)for(Ye=z.call(A.ownerDocument);A.firstChild;)Ye.appendChild(A.firstChild);else Ye=A;return(D.shadowroot||D.shadowrootmode)&&(Ye=V.call(a,Ye,!0)),Ye}let tt=oa?A.outerHTML:A.innerHTML;return oa&&P["!doctype"]&&A.ownerDocument&&A.ownerDocument.doctype&&A.ownerDocument.doctype.name&&We(ak,A.ownerDocument.doctype.name)&&(tt="<!DOCTYPE "+A.ownerDocument.doctype.name+`>
|
|
1395
|
+
`;function q0({message:e,style:t}){return e?l.jsx("p",{style:{...t||{}},children:e}):null}function J0({name:e,id:t,hidden:n,label:a,hideLabel:i,type:o,value:r,placeholder:s,disabled:c=!1,onChange:u=()=>{},onBlur:d=()=>{},onKeyDown:p=()=>{},tabIndex:m,maxLength:f,autoFocus:b,errorMessage:w}){const g=v.useRef(null);t=t||`input-${e}`;const y=n?"gh-portal-input-section hidden":"gh-portal-input-section",k=i?"gh-portal-input-label hidden":"gh-portal-input-label",C=w?"gh-portal-input error":"gh-portal-input";Zn()&&(c=!0),de(["preview"])&&(c=!0);let x="",T="",E="",N,z;switch(t){case"input-email":x="off",T="off",E="off";break;case"input-name":x="off",T="off";break;case"input-otc":x="one-time-code",T="off",E="off",N="numeric",z="[0-9]*",s??(s="• • • • • •");break}return v.useEffect(()=>{b&&g.current.focus()},[b]),l.jsxs("section",{className:y,children:[l.jsxs("div",{className:"gh-portal-input-labelcontainer",children:[l.jsxs("label",{htmlFor:t,className:k,children:[" ",a," "]}),l.jsx(q0,{message:w,name:e})]}),l.jsx("input",{"data-test-input":t,ref:g,id:t,className:C,type:o,name:e,value:r,placeholder:s,onChange:j=>u(j,e),onKeyDown:j=>p(j,e),onBlur:j=>d(j,e),disabled:c,tabIndex:m,maxLength:f,autoComplete:x,autoCorrect:T,autoCapitalize:E,"aria-label":a,inputMode:N,pattern:z})]})}const bm=class bm extends Z.Component{render(){return l.jsx(l.Fragment,{children:l.jsxs("button",{className:"gh-portal-btn gh-portal-btn-site-title-back",onClick:()=>{this.props.onBack?this.props.onBack():this.context.doAction("closePopup")},children:[l.jsx("span",{children:"← "})," ",h("Back")]})})}};bm.contextType=_;let Fo=bm;const Z0=e=>v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",...e},v.createElement("g",{transform:"matrix(0.6666666666666666,0,0,0.6666666666666666,0,0)"},v.createElement("path",{d:"M19.5,9.5h-.75V6.75a6.75,6.75,0,0,0-13.5,0V9.5H4.5a2,2,0,0,0-2,2V22a2,2,0,0,0,2,2h15a2,2,0,0,0,2-2V11.5A2,2,0,0,0,19.5,9.5Zm-7.5,9a2,2,0,1,1,2-2A2,2,0,0,1,12,18.5ZM16.25,9a.5.5,0,0,1-.5.5H8.25a.5.5,0,0,1-.5-.5V6.75a4.25,4.25,0,0,1,8.5,0Z",style:{fill:"#000000"}})));function X0({newsletter:e,subscribedNewsletters:t,setSubscribedNewsletters:n}){const a=t.some(i=>i.id===(e==null?void 0:e.id));return e.paid?l.jsxs("section",{className:"gh-portal-list-toggle-wrapper","data-testid":"toggle-wrapper",children:[l.jsxs("div",{className:"gh-portal-list-detail gh-portal-list-big",children:[l.jsx("h3",{children:e.name}),l.jsx("p",{children:e.description})]}),l.jsx("div",{className:"gh-portal-lock-icon-container",children:l.jsx(Z0,{className:"gh-portal-lock-icon",alt:"",title:h("Unlock access to all newsletters by becoming a paid subscriber.")})})]}):l.jsxs("section",{className:"gh-portal-list-toggle-wrapper","data-testid":"toggle-wrapper",children:[l.jsxs("div",{className:"gh-portal-list-detail gh-portal-list-big",children:[l.jsx("h3",{children:e.name}),l.jsx("p",{children:e.description})]}),l.jsx("div",{children:l.jsx(tl,{id:e.id,onToggle:(i,o)=>{let r=[];o?r=t.filter(s=>s.id!==e.id).concat(e):r=t.filter(s=>s.id!==e.id),n(r)},checked:a})})]})}function Q0({subscribedNewsletters:e,setSubscribedNewsletters:t}){const{site:n}=v.useContext(_);return ta({site:n}).map(i=>l.jsx(X0,{newsletter:i,subscribedNewsletters:e,setSubscribedNewsletters:t},i==null?void 0:i.id))}function Ud({pageData:e,onBack:t}){const{brandColor:n,site:a,doAction:i,action:o}=v.useContext(_),s=ta({site:a}).filter(b=>b.subscribe_on_signup);let c=!1;o==="signup:running"&&(c=!0);let u=h("Continue"),d=!1;o==="signup:failed"&&(u=h("Retry"),d=!0);const p=o==="signup:running",[m,f]=v.useState(s);return l.jsxs("div",{className:"gh-portal-content with-footer gh-portal-newsletter-selection",children:[l.jsx("p",{className:"gh-portal-text-center gh-portal-text-large",children:h("Choose your newsletters")}),l.jsx("div",{className:"gh-portal-section",children:l.jsx("div",{className:"gh-portal-list",children:l.jsx(Q0,{subscribedNewsletters:m,setSubscribedNewsletters:f})})}),l.jsx("footer",{className:"gh-portal-action-footer",children:l.jsxs("div",{style:{width:"100%"},children:[l.jsx("div",{style:{marginBottom:"20px"},children:l.jsx(me,{isRunning:c,retry:d,disabled:p,onClick:()=>{let b=m.map(x=>({id:x.id,name:x.name}));const{name:w,email:g,plan:y,phonenumber:k,offerId:C}=e;i("signup",{name:w,email:g,plan:y,phonenumber:k,newsletters:b,offerId:C})},brandColor:n,label:u,style:{width:"100%"}})}),Ja({site:a})?null:l.jsx("div",{children:l.jsx("button",{className:"gh-portal-btn gh-portal-btn-link gh-portal-btn-different-plan",onClick:()=>{t()},children:l.jsx("span",{children:h("Choose a different plan")})})})]})})]})}const eT=({field:e,onChange:t,onBlur:n=()=>{},onKeyDown:a=()=>{}})=>e?l.jsx(l.Fragment,{children:l.jsx(J0,{label:e.label,type:e.type,name:e.name,hidden:e.hidden,placeholder:e.placeholder,disabled:e.disabled,value:e.value,onKeyDown:a,onChange:i=>t(i,e),onBlur:i=>n(i,e),tabIndex:e.tabIndex,errorMessage:e.errorMessage,autoFocus:e.autoFocus},e.name)}):null;class ti extends v.Component{constructor(t){super(t),this.state={}}render(){const{fields:t,onChange:n,onBlur:a,onKeyDown:i}=this.props,o=t.map(r=>l.jsx(eT,{field:r,onChange:n,onBlur:a,onKeyDown:i},r.name));return l.jsx(l.Fragment,{children:o})}}const tT=e=>!!e&&/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(String(e).toLowerCase()),nT=({field:e})=>{if(e.required&&!e.value)switch(e.name){case"name":return h("Enter your name");case"email":return h("Enter your email address");default:return h("Please enter {fieldName}",{fieldName:e.name})}return e.type==="email"&&!tT(e.value)?h("Invalid email address"):null},Oo=({fields:e})=>{const t={};return e.forEach(n=>{const a=n.name,i=nT({field:n});t[a]=i}),t},Gb=e=>v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...e},v.createElement("defs",null,v.createElement("style",null,".inviteicon{fill: currentColor;}")),v.createElement("path",{className:"inviteicon",d:"M23.991 11.464l-.036-.146-.028-.068-.011-.027-.115-.114-.018-.021-.008-.005h-.001l-3.774-2.596v-7.987c0-.276-.224-.5-.5-.5h-15c-.276 0-.5.224-.5.5v7.987l-3.774 2.595-.003.002-.006.004-.015.016-.118.118-.011.027-.028.068-.036.146-.009.037v10.5c0 1.103.897 2 2 2h20c1.103 0 2-.897 2-2v-10.5l-.009-.036zm-1.383.03l-2.608 1.738v-3.531l2.608 1.793zm-18.608 1.738l-2.608-1.739 2.608-1.792v3.531zm18 9.768h-20c-.551 0-1-.449-1-1v-9.566l5.223 3.482c.085.057.181.084.276.084.162 0 .32-.078.417-.223.153-.23.091-.54-.139-.693l-1.777-1.185v-12.899h14v12.899l-1.777 1.185c-.23.153-.292.463-.139.693.096.145.255.223.416.223.095 0 .191-.027.277-.084l5.223-3.482v9.566c0 .551-.449 1-1 1zM15.812 16.109c-.088-.07-.198-.109-.312-.109h-7c-.114 0-.224.039-.312.109l-5 4c-.215.173-.25.487-.078.703.173.215.487.251.703.078l4.862-3.89h6.649l4.863 3.891c.093.073.203.109.313.109.147 0 .292-.065.391-.188.172-.216.137-.53-.078-.703l-5.001-4zM11.706 12.779c.087.064.191.096.294.096s.207-.032.294-.096c.482-.35 4.706-3.497 4.706-6.101 0-1.868-1.387-2.984-2.728-2.984-.772 0-1.674.379-2.272 1.368-.598-.988-1.5-1.368-2.272-1.368-1.341-.001-2.728 1.116-2.728 2.984 0 2.604 4.224 5.751 4.706 6.101zm-1.978-8.086c.844 0 1.511.681 1.786 1.822.108.45.864.45.973 0 .274-1.141.942-1.822 1.786-1.822.85 0 1.728.742 1.728 1.984 0 1.646-2.658 4.037-4 5.072-1.342-1.035-4-3.426-4-5.072-.001-1.241.877-1.984 1.727-1.984z"})),Kb=e=>{if(e.currentTarget.contains(e.target)){const t=e.target.closest("a");t&&(e.preventDefault(),window.open(t.href,"_blank"))}};/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */const{entries:qb,setPrototypeOf:Jb,isFrozen:aT,getPrototypeOf:iT,getOwnPropertyDescriptor:oT}=Object;let{freeze:Ve,seal:gt,create:Hd}=Object,{apply:Vd,construct:Wd}=typeof Reflect<"u"&&Reflect;Ve||(Ve=function(t){return t}),gt||(gt=function(t){return t}),Vd||(Vd=function(t,n){for(var a=arguments.length,i=new Array(a>2?a-2:0),o=2;o<a;o++)i[o-2]=arguments[o];return t.apply(n,i)}),Wd||(Wd=function(t){for(var n=arguments.length,a=new Array(n>1?n-1:0),i=1;i<n;i++)a[i-1]=arguments[i];return new t(...a)});const al=Ge(Array.prototype.forEach),rT=Ge(Array.prototype.lastIndexOf),Zb=Ge(Array.prototype.pop),_o=Ge(Array.prototype.push),sT=Ge(Array.prototype.splice),il=Ge(String.prototype.toLowerCase),Gd=Ge(String.prototype.toString),Kd=Ge(String.prototype.match),Ro=Ge(String.prototype.replace),lT=Ge(String.prototype.indexOf),cT=Ge(String.prototype.trim),Ct=Ge(Object.prototype.hasOwnProperty),We=Ge(RegExp.prototype.test),Yo=uT(TypeError);function Ge(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,a=new Array(n>1?n-1:0),i=1;i<n;i++)a[i-1]=arguments[i];return Vd(e,t,a)}}function uT(e){return function(){for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return Wd(e,n)}}function K(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:il;Jb&&Jb(e,null);let a=t.length;for(;a--;){let i=t[a];if(typeof i=="string"){const o=n(i);o!==i&&(aT(t)||(t[a]=o),i=o)}e[i]=!0}return e}function dT(e){for(let t=0;t<e.length;t++)Ct(e,t)||(e[t]=null);return e}function Ot(e){const t=Hd(null);for(const[n,a]of qb(e))Ct(e,n)&&(Array.isArray(a)?t[n]=dT(a):a&&typeof a=="object"&&a.constructor===Object?t[n]=Ot(a):t[n]=a);return t}function Lo(e,t){for(;e!==null;){const a=oT(e,t);if(a){if(a.get)return Ge(a.get);if(typeof a.value=="function")return Ge(a.value)}e=iT(e)}function n(){return null}return n}const Xb=Ve(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),qd=Ve(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Jd=Ve(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),mT=Ve(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Zd=Ve(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),pT=Ve(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Qb=Ve(["#text"]),ek=Ve(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Xd=Ve(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),tk=Ve(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ol=Ve(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),hT=gt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),fT=gt(/<%[\w\W]*|[\w\W]*%>/gm),gT=gt(/\$\{[\w\W]*/gm),yT=gt(/^data-[\-\w.\u00B7-\uFFFF]+$/),bT=gt(/^aria-[\-\w]+$/),nk=gt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),kT=gt(/^(?:\w+script|data):/i),vT=gt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ak=gt(/^html$/i),wT=gt(/^[a-z][.\w]*(-[.\w]+)+$/i);var ik=Object.freeze({__proto__:null,ARIA_ATTR:bT,ATTR_WHITESPACE:vT,CUSTOM_ELEMENT:wT,DATA_ATTR:yT,DOCTYPE_NAME:ak,ERB_EXPR:fT,IS_ALLOWED_URI:nk,IS_SCRIPT_OR_DATA:kT,MUSTACHE_EXPR:hT,TMPLIT_EXPR:gT});const Bo={element:1,text:3,progressingInstruction:7,comment:8,document:9},ST=function(){return typeof window>"u"?null:window},xT=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let a=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(a=n.getAttribute(i));const o="dompurify"+(a?"#"+a:"");try{return t.createPolicy(o,{createHTML(r){return r},createScriptURL(r){return r}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},ok=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function rk(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ST();const t=B=>rk(B);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Bo.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const a=n,i=a.currentScript,{DocumentFragment:o,HTMLTemplateElement:r,Node:s,Element:c,NodeFilter:u,NamedNodeMap:d=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:p,DOMParser:m,trustedTypes:f}=e,b=c.prototype,w=Lo(b,"cloneNode"),g=Lo(b,"remove"),y=Lo(b,"nextSibling"),k=Lo(b,"childNodes"),C=Lo(b,"parentNode");if(typeof r=="function"){const B=n.createElement("template");B.content&&B.content.ownerDocument&&(n=B.content.ownerDocument)}let x,T="";const{implementation:E,createNodeIterator:N,createDocumentFragment:z,getElementsByTagName:j}=n,{importNode:V}=a;let q=ok();t.isSupported=typeof qb=="function"&&typeof C=="function"&&E&&E.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:ce,ERB_EXPR:ae,TMPLIT_EXPR:_e,DATA_ATTR:Ie,ARIA_ATTR:Ke,IS_SCRIPT_OR_DATA:$,ATTR_WHITESPACE:I,CUSTOM_ELEMENT:F}=ik;let{IS_ALLOWED_URI:J}=ik,P=null;const O=K({},[...Xb,...qd,...Jd,...Zd,...Qb]);let D=null;const H=K({},[...ek,...Xd,...tk,...ol]);let L=Object.seal(Hd(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ye=null,Re=null;const et=Object.seal(Hd(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let st=!0,Vo=!0,Mk=!1,Dk=!0,li=!1,dl=!0,oa=!1,Pm=!1,zm=!1,ci=!1,ml=!1,pl=!1,Fk=!0,Ok=!1;const wz="user-content-";let Im=!0,Wo=!1,ui={},_t=null;const Nm=K({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let _k=null;const Rk=K({},["audio","video","img","source","image","track"]);let Am=null;const Yk=K({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),hl="http://www.w3.org/1998/Math/MathML",fl="http://www.w3.org/2000/svg",en="http://www.w3.org/1999/xhtml";let di=en,Mm=!1,Dm=null;const Sz=K({},[hl,fl,en],Gd);let gl=K({},["mi","mo","mn","ms","mtext"]),yl=K({},["annotation-xml"]);const xz=K({},["title","style","font","a","script"]);let Go=null;const Cz=["application/xhtml+xml","text/html"],Ez="text/html";let Se=null,mi=null;const $z=n.createElement("form"),Lk=function(S){return S instanceof RegExp||S instanceof Function},Fm=function(){let S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(mi&&mi===S)){if((!S||typeof S!="object")&&(S={}),S=Ot(S),Go=Cz.indexOf(S.PARSER_MEDIA_TYPE)===-1?Ez:S.PARSER_MEDIA_TYPE,Se=Go==="application/xhtml+xml"?Gd:il,P=Ct(S,"ALLOWED_TAGS")?K({},S.ALLOWED_TAGS,Se):O,D=Ct(S,"ALLOWED_ATTR")?K({},S.ALLOWED_ATTR,Se):H,Dm=Ct(S,"ALLOWED_NAMESPACES")?K({},S.ALLOWED_NAMESPACES,Gd):Sz,Am=Ct(S,"ADD_URI_SAFE_ATTR")?K(Ot(Yk),S.ADD_URI_SAFE_ATTR,Se):Yk,_k=Ct(S,"ADD_DATA_URI_TAGS")?K(Ot(Rk),S.ADD_DATA_URI_TAGS,Se):Rk,_t=Ct(S,"FORBID_CONTENTS")?K({},S.FORBID_CONTENTS,Se):Nm,ye=Ct(S,"FORBID_TAGS")?K({},S.FORBID_TAGS,Se):Ot({}),Re=Ct(S,"FORBID_ATTR")?K({},S.FORBID_ATTR,Se):Ot({}),ui=Ct(S,"USE_PROFILES")?S.USE_PROFILES:!1,st=S.ALLOW_ARIA_ATTR!==!1,Vo=S.ALLOW_DATA_ATTR!==!1,Mk=S.ALLOW_UNKNOWN_PROTOCOLS||!1,Dk=S.ALLOW_SELF_CLOSE_IN_ATTR!==!1,li=S.SAFE_FOR_TEMPLATES||!1,dl=S.SAFE_FOR_XML!==!1,oa=S.WHOLE_DOCUMENT||!1,ci=S.RETURN_DOM||!1,ml=S.RETURN_DOM_FRAGMENT||!1,pl=S.RETURN_TRUSTED_TYPE||!1,zm=S.FORCE_BODY||!1,Fk=S.SANITIZE_DOM!==!1,Ok=S.SANITIZE_NAMED_PROPS||!1,Im=S.KEEP_CONTENT!==!1,Wo=S.IN_PLACE||!1,J=S.ALLOWED_URI_REGEXP||nk,di=S.NAMESPACE||en,gl=S.MATHML_TEXT_INTEGRATION_POINTS||gl,yl=S.HTML_INTEGRATION_POINTS||yl,L=S.CUSTOM_ELEMENT_HANDLING||{},S.CUSTOM_ELEMENT_HANDLING&&Lk(S.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(L.tagNameCheck=S.CUSTOM_ELEMENT_HANDLING.tagNameCheck),S.CUSTOM_ELEMENT_HANDLING&&Lk(S.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(L.attributeNameCheck=S.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),S.CUSTOM_ELEMENT_HANDLING&&typeof S.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(L.allowCustomizedBuiltInElements=S.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),li&&(Vo=!1),ml&&(ci=!0),ui&&(P=K({},Qb),D=[],ui.html===!0&&(K(P,Xb),K(D,ek)),ui.svg===!0&&(K(P,qd),K(D,Xd),K(D,ol)),ui.svgFilters===!0&&(K(P,Jd),K(D,Xd),K(D,ol)),ui.mathMl===!0&&(K(P,Zd),K(D,tk),K(D,ol))),S.ADD_TAGS&&(typeof S.ADD_TAGS=="function"?et.tagCheck=S.ADD_TAGS:(P===O&&(P=Ot(P)),K(P,S.ADD_TAGS,Se))),S.ADD_ATTR&&(typeof S.ADD_ATTR=="function"?et.attributeCheck=S.ADD_ATTR:(D===H&&(D=Ot(D)),K(D,S.ADD_ATTR,Se))),S.ADD_URI_SAFE_ATTR&&K(Am,S.ADD_URI_SAFE_ATTR,Se),S.FORBID_CONTENTS&&(_t===Nm&&(_t=Ot(_t)),K(_t,S.FORBID_CONTENTS,Se)),S.ADD_FORBID_CONTENTS&&(_t===Nm&&(_t=Ot(_t)),K(_t,S.ADD_FORBID_CONTENTS,Se)),Im&&(P["#text"]=!0),oa&&K(P,["html","head","body"]),P.table&&(K(P,["tbody"]),delete ye.tbody),S.TRUSTED_TYPES_POLICY){if(typeof S.TRUSTED_TYPES_POLICY.createHTML!="function")throw Yo('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof S.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Yo('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');x=S.TRUSTED_TYPES_POLICY,T=x.createHTML("")}else x===void 0&&(x=xT(f,i)),x!==null&&typeof T=="string"&&(T=x.createHTML(""));Ve&&Ve(S),mi=S}},Bk=K({},[...qd,...Jd,...mT]),Uk=K({},[...Zd,...pT]),jz=function(S){let A=C(S);(!A||!A.tagName)&&(A={namespaceURI:di,tagName:"template"});const Y=il(S.tagName),he=il(A.tagName);return Dm[S.namespaceURI]?S.namespaceURI===fl?A.namespaceURI===en?Y==="svg":A.namespaceURI===hl?Y==="svg"&&(he==="annotation-xml"||gl[he]):!!Bk[Y]:S.namespaceURI===hl?A.namespaceURI===en?Y==="math":A.namespaceURI===fl?Y==="math"&&yl[he]:!!Uk[Y]:S.namespaceURI===en?A.namespaceURI===fl&&!yl[he]||A.namespaceURI===hl&&!gl[he]?!1:!Uk[Y]&&(xz[Y]||!Bk[Y]):!!(Go==="application/xhtml+xml"&&Dm[S.namespaceURI]):!1},Rt=function(S){_o(t.removed,{element:S});try{C(S).removeChild(S)}catch{g(S)}},ra=function(S,A){try{_o(t.removed,{attribute:A.getAttributeNode(S),from:A})}catch{_o(t.removed,{attribute:null,from:A})}if(A.removeAttribute(S),S==="is")if(ci||ml)try{Rt(A)}catch{}else try{A.setAttribute(S,"")}catch{}},Hk=function(S){let A=null,Y=null;if(zm)S="<remove></remove>"+S;else{const ve=Kd(S,/^[\r\n\t ]+/);Y=ve&&ve[0]}Go==="application/xhtml+xml"&&di===en&&(S='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+S+"</body></html>");const he=x?x.createHTML(S):S;if(di===en)try{A=new m().parseFromString(he,Go)}catch{}if(!A||!A.documentElement){A=E.createDocument(di,"template",null);try{A.documentElement.innerHTML=Mm?T:he}catch{}}const Ye=A.body||A.documentElement;return S&&Y&&Ye.insertBefore(n.createTextNode(Y),Ye.childNodes[0]||null),di===en?j.call(A,oa?"html":"body")[0]:oa?A.documentElement:Ye},Vk=function(S){return N.call(S.ownerDocument||S,S,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Om=function(S){return S instanceof p&&(typeof S.nodeName!="string"||typeof S.textContent!="string"||typeof S.removeChild!="function"||!(S.attributes instanceof d)||typeof S.removeAttribute!="function"||typeof S.setAttribute!="function"||typeof S.namespaceURI!="string"||typeof S.insertBefore!="function"||typeof S.hasChildNodes!="function")},Wk=function(S){return typeof s=="function"&&S instanceof s};function tn(B,S,A){al(B,Y=>{Y.call(t,S,A,mi)})}const Gk=function(S){let A=null;if(tn(q.beforeSanitizeElements,S,null),Om(S))return Rt(S),!0;const Y=Se(S.nodeName);if(tn(q.uponSanitizeElement,S,{tagName:Y,allowedTags:P}),dl&&S.hasChildNodes()&&!Wk(S.firstElementChild)&&We(/<[/\w!]/g,S.innerHTML)&&We(/<[/\w!]/g,S.textContent)||S.nodeType===Bo.progressingInstruction||dl&&S.nodeType===Bo.comment&&We(/<[/\w]/g,S.data))return Rt(S),!0;if(!(et.tagCheck instanceof Function&&et.tagCheck(Y))&&(!P[Y]||ye[Y])){if(!ye[Y]&&qk(Y)&&(L.tagNameCheck instanceof RegExp&&We(L.tagNameCheck,Y)||L.tagNameCheck instanceof Function&&L.tagNameCheck(Y)))return!1;if(Im&&!_t[Y]){const he=C(S)||S.parentNode,Ye=k(S)||S.childNodes;if(Ye&&he){const ve=Ye.length;for(let tt=ve-1;tt>=0;--tt){const nn=w(Ye[tt],!0);nn.__removalCount=(S.__removalCount||0)+1,he.insertBefore(nn,y(S))}}}return Rt(S),!0}return S instanceof c&&!jz(S)||(Y==="noscript"||Y==="noembed"||Y==="noframes")&&We(/<\/no(script|embed|frames)/i,S.innerHTML)?(Rt(S),!0):(li&&S.nodeType===Bo.text&&(A=S.textContent,al([ce,ae,_e],he=>{A=Ro(A,he," ")}),S.textContent!==A&&(_o(t.removed,{element:S.cloneNode()}),S.textContent=A)),tn(q.afterSanitizeElements,S,null),!1)},Kk=function(S,A,Y){if(Fk&&(A==="id"||A==="name")&&(Y in n||Y in $z))return!1;if(!(Vo&&!Re[A]&&We(Ie,A))){if(!(st&&We(Ke,A))){if(!(et.attributeCheck instanceof Function&&et.attributeCheck(A,S))){if(!D[A]||Re[A]){if(!(qk(S)&&(L.tagNameCheck instanceof RegExp&&We(L.tagNameCheck,S)||L.tagNameCheck instanceof Function&&L.tagNameCheck(S))&&(L.attributeNameCheck instanceof RegExp&&We(L.attributeNameCheck,A)||L.attributeNameCheck instanceof Function&&L.attributeNameCheck(A,S))||A==="is"&&L.allowCustomizedBuiltInElements&&(L.tagNameCheck instanceof RegExp&&We(L.tagNameCheck,Y)||L.tagNameCheck instanceof Function&&L.tagNameCheck(Y))))return!1}else if(!Am[A]){if(!We(J,Ro(Y,I,""))){if(!((A==="src"||A==="xlink:href"||A==="href")&&S!=="script"&&lT(Y,"data:")===0&&_k[S])){if(!(Mk&&!We($,Ro(Y,I,"")))){if(Y)return!1}}}}}}}return!0},qk=function(S){return S!=="annotation-xml"&&Kd(S,F)},Jk=function(S){tn(q.beforeSanitizeAttributes,S,null);const{attributes:A}=S;if(!A||Om(S))return;const Y={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:D,forceKeepAttr:void 0};let he=A.length;for(;he--;){const Ye=A[he],{name:ve,namespaceURI:tt,value:nn}=Ye,pi=Se(ve),_m=nn;let Ne=ve==="value"?_m:cT(_m);if(Y.attrName=pi,Y.attrValue=Ne,Y.keepAttr=!0,Y.forceKeepAttr=void 0,tn(q.uponSanitizeAttribute,S,Y),Ne=Y.attrValue,Ok&&(pi==="id"||pi==="name")&&(ra(ve,S),Ne=wz+Ne),dl&&We(/((--!?|])>)|<\/(style|title|textarea)/i,Ne)){ra(ve,S);continue}if(pi==="attributename"&&Kd(Ne,"href")){ra(ve,S);continue}if(Y.forceKeepAttr)continue;if(!Y.keepAttr){ra(ve,S);continue}if(!Dk&&We(/\/>/i,Ne)){ra(ve,S);continue}li&&al([ce,ae,_e],Xk=>{Ne=Ro(Ne,Xk," ")});const Zk=Se(S.nodeName);if(!Kk(Zk,pi,Ne)){ra(ve,S);continue}if(x&&typeof f=="object"&&typeof f.getAttributeType=="function"&&!tt)switch(f.getAttributeType(Zk,pi)){case"TrustedHTML":{Ne=x.createHTML(Ne);break}case"TrustedScriptURL":{Ne=x.createScriptURL(Ne);break}}if(Ne!==_m)try{tt?S.setAttributeNS(tt,ve,Ne):S.setAttribute(ve,Ne),Om(S)?Rt(S):Zb(t.removed)}catch{ra(ve,S)}}tn(q.afterSanitizeAttributes,S,null)},Tz=function B(S){let A=null;const Y=Vk(S);for(tn(q.beforeSanitizeShadowDOM,S,null);A=Y.nextNode();)tn(q.uponSanitizeShadowNode,A,null),Gk(A),Jk(A),A.content instanceof o&&B(A.content);tn(q.afterSanitizeShadowDOM,S,null)};return t.sanitize=function(B){let S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},A=null,Y=null,he=null,Ye=null;if(Mm=!B,Mm&&(B="<!-->"),typeof B!="string"&&!Wk(B))if(typeof B.toString=="function"){if(B=B.toString(),typeof B!="string")throw Yo("dirty is not a string, aborting")}else throw Yo("toString is not a function");if(!t.isSupported)return B;if(Pm||Fm(S),t.removed=[],typeof B=="string"&&(Wo=!1),Wo){if(B.nodeName){const nn=Se(B.nodeName);if(!P[nn]||ye[nn])throw Yo("root node is forbidden and cannot be sanitized in-place")}}else if(B instanceof s)A=Hk("<!---->"),Y=A.ownerDocument.importNode(B,!0),Y.nodeType===Bo.element&&Y.nodeName==="BODY"||Y.nodeName==="HTML"?A=Y:A.appendChild(Y);else{if(!ci&&!li&&!oa&&B.indexOf("<")===-1)return x&&pl?x.createHTML(B):B;if(A=Hk(B),!A)return ci?null:pl?T:""}A&&zm&&Rt(A.firstChild);const ve=Vk(Wo?B:A);for(;he=ve.nextNode();)Gk(he),Jk(he),he.content instanceof o&&Tz(he.content);if(Wo)return B;if(ci){if(ml)for(Ye=z.call(A.ownerDocument);A.firstChild;)Ye.appendChild(A.firstChild);else Ye=A;return(D.shadowroot||D.shadowrootmode)&&(Ye=V.call(a,Ye,!0)),Ye}let tt=oa?A.outerHTML:A.innerHTML;return oa&&P["!doctype"]&&A.ownerDocument&&A.ownerDocument.doctype&&A.ownerDocument.doctype.name&&We(ak,A.ownerDocument.doctype.name)&&(tt="<!DOCTYPE "+A.ownerDocument.doctype.name+`>
|
|
1396
1396
|
`+tt),li&&al([ce,ae,_e],nn=>{tt=Ro(tt,nn," ")}),x&&pl?x.createHTML(tt):tt},t.setConfig=function(){let B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Fm(B),Pm=!0},t.clearConfig=function(){mi=null,Pm=!1},t.isValidAttribute=function(B,S,A){mi||Fm({});const Y=Se(B),he=Se(S);return Kk(Y,he,A)},t.addHook=function(B,S){typeof S=="function"&&_o(q[B],S)},t.removeHook=function(B,S){if(S!==void 0){const A=rT(q[B],S);return A===-1?void 0:sT(q[B],A,1)[0]}return Zb(q[B])},t.removeHooks=function(B){q[B]=[]},t.removeAllHooks=function(){q=ok()},t}var CT=rk();function sk(e){return e?CT.sanitize(e,{ALLOWED_TAGS:["a","b","i","em","strong","p","br","ul","ol","li","span"],ALLOWED_ATTR:["href","target","rel","class"]}):""}function ET(e){return!e||typeof e!="string"||!/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{4}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/.test(e)?"":e}const $T=`
|
|
1397
1397
|
.gh-portal-back-sitetitle {
|
|
1398
1398
|
position: absolute;
|
|
@@ -1733,7 +1733,7 @@ html[dir=rtl] .gh-portal-signup-terms .checkbox:before {
|
|
|
1733
1733
|
transform: translateX(-50%);
|
|
1734
1734
|
}
|
|
1735
1735
|
}
|
|
1736
|
-
`,km=class km extends Z.Component{constructor(t){super(t),this.handleSelectPlan=(n,a)=>{n&&n.preventDefault(),this.timeoutId=setTimeout(()=>{this.setState(()=>({plan:a}))},5)},this.state={name:"",email:"",plan:"free",showNewsletterSelection:!1,termsCheckboxChecked:!1},this.termsRef=Z.createRef()}componentDidMount(){const{member:t}=this.context;t&&this.context.doAction("switchPage",{page:"accountHome"}),this.handleSelectedPlan()}componentDidUpdate(){this.handleSelectedPlan()}handleSelectedPlan(){const{site:t,pageQuery:n}=this.context,a=qs({site:t,pageQuery:n}),i=this.getSelectedPriceId(a,this.state.plan);i!==this.state.plan&&this.setState({plan:i})}componentWillUnmount(){clearTimeout(this.timeoutId)}getFormErrors(t){const a=this.context.site.portal_signup_checkbox_required&&this.context.site.portal_signup_terms_html&&!t.termsCheckboxChecked;return{...Oo({fields:this.getInputFields({state:t})}),checkbox:a}}doSignup(){this.setState(t=>({errors:this.getFormErrors(t)}),()=>{const{site:t,doAction:n}=this.context,{name:a,email:i,plan:o,phonenumber:r,token:s,errors:c}=this.state,u=c&&Object.values(c).filter(m=>!!m).length>0,d={...c};delete d.checkbox,(c==null?void 0:c.checkbox)&&Object.values(d).every(m=>!m)&&this.termsRef.current&&this.termsRef.current.scrollIntoView({behavior:"smooth",block:"center"}),u||(zo({site:t})?this.setState({showNewsletterSelection:!0,pageData:{name:a,email:i,plan:o,phonenumber:r,token:s},errors:{}}):(this.setState({errors:{}}),n("signup",{name:a,email:i,phonenumber:r,plan:o,token:s})))})}handleSignup(t){t.preventDefault(),this.doSignup()}handleChooseSignup(t,n){t.preventDefault(),this.setState({plan:n},()=>{this.doSignup()})}handleInputChange(t,n){const a=n.name,i=t.target.value;this.setState({[a]:i})}onKeyDown(t){t.keyCode===13&&this.handleSignup(t)}getSelectedPriceId(t=[],n){return!t||t.length===0||n==="free"?"free":t.some(i=>i.id===n)?n:t[0].id||"free"}getInputFields({state:t,fieldNames:n}){const{site:{portal_name:a}}=this.context,i=t.errors||{},o=[{type:"email",value:t.email,placeholder:h("jamie@example.com"),label:h("Email"),name:"email",required:!0,tabIndex:2,errorMessage:i.email||""},{type:"text",value:t.phonenumber,placeholder:h("+1 (123) 456-7890"),label:h("Phone number"),name:"phonenumber",required:!1,tabIndex:-1,autoComplete:"off",hidden:!0}];return a&&o.unshift({type:"text",value:t.name,placeholder:h("Jamie Larson"),label:h("Name"),name:"name",required:!0,tabIndex:1,errorMessage:i.name||""}),o[0].autoFocus=!0,n&&n.length>0?o.filter(r=>n.includes(r.name)):o}renderSignupTerms(){var s;const{site:t}=this.context;if(t.portal_signup_terms_html===null||t.portal_signup_terms_html==="")return null;const n=c=>{this.setState({termsCheckboxChecked:c.target.checked})},a=l.jsx("div",{className:"gh-portal-signup-terms-content",dangerouslySetInnerHTML:{__html:sk(t.portal_signup_terms_html)}}),i=t.portal_signup_checkbox_required?l.jsxs("label",{children:[l.jsx("input",{type:"checkbox",checked:!!this.state.termsCheckboxChecked,required:!0,onChange:n}),l.jsx("span",{className:"checkbox"}),a]}):a,r=`gh-portal-signup-terms ${(s=this.state.errors)!=null&&s.checkbox?"gh-portal-error":""}`;return l.jsx("div",{className:r,onClick:Kb,ref:this.termsRef,children:i})}renderSubmitButton(){const{action:t,site:n,brandColor:a,pageQuery:i}=this.context;if(Ft({site:n})||!Qt({site:n,pageQuery:i}))return null;let o=h("Continue");const r=i==="free"&&Sd({site:n});if(Ja({site:n})||r)o=h("Sign up");else return null;let s=!1;t==="signup:running"&&(o=h("Sending..."),s=!0);let c=!1;t==="signup:failed"&&(o=h("Retry"),c=!0);const u=t==="signup:running";return l.jsx(me,{style:{width:"100%"},retry:c,onClick:d=>this.handleSignup(d),disabled:u,brandColor:a,label:o,isRunning:s,tabIndex:3})}renderProducts(){const{site:t,pageQuery:n}=this.context,a=Vs({site:t,pageQuery:n}),i=this.state.errors||{},o={};return Object.keys(i).length>0&&this.state.plan&&(o[this.state.plan]=h("Please fill in required fields")),l.jsx(l.Fragment,{children:l.jsx(Vb,{handleChooseSignup:(...r)=>this.handleChooseSignup(...r),products:a,onPlanSelect:this.handleSelectPlan,errors:o})})}renderFreeTrialMessage(){const{site:t,pageQuery:n}=this.context;return Ws({site:t,pageQuery:n})&&!Ft({site:t})&&Qt({site:t,pageQuery:n})?l.jsx("p",{className:"gh-portal-free-trial-notification","data-testid":"free-trial-notification-text",children:h("After a free trial ends, you will be charged the regular price for the tier you've chosen. You can always cancel before then.")}):null}renderLoginMessage(){const{brandColor:t,doAction:n}=this.context;return l.jsxs("div",{children:[this.renderFreeTrialMessage(),l.jsxs("div",{className:"gh-portal-signup-message",children:[l.jsx("div",{children:h("Already a member?")}),l.jsx("button",{"data-test-button":"signin-switch","data-testid":"signin-switch",className:"gh-portal-btn gh-portal-btn-link",style:{color:t},onClick:()=>n("switchPage",{page:"signin"}),children:l.jsx("span",{children:h("Sign in")})})]})]})}renderForm(){const t=this.getInputFields({state:this.state}),{site:n,pageQuery:a}=this.context;if(this.state.showNewsletterSelection)return l.jsx(Ud,{pageData:this.state.pageData,onBack:()=>{this.setState({showNewsletterSelection:!1})}});if(Ft({site:n}))return this.renderInviteOnlyMessage();if($0({site:n})&&a==="free")return this.renderPaidMembersOnlyMessage();if(!Ls({site:n})||!Qt({site:n,pageQuery:a}))return zn({site:n})?this.renderInviteOnlyMessage():this.renderMembersDisabledMessage();const i=a==="free"&&Sd({site:n}),o=Ja({site:n})||i,r=this.renderSignupTerms();return l.jsx("section",{className:"gh-portal-signup",children:l.jsxs("div",{className:"gh-portal-section",children:[l.jsx("div",{className:"gh-portal-logged-out-form-container",children:l.jsx(ti,{fields:t,onChange:(s,c)=>this.handleInputChange(s,c),onKeyDown:s=>this.onKeyDown(s)})}),l.jsxs("div",{children:[o?l.jsxs(l.Fragment,{children:[this.renderProducts(),r&&l.jsx("div",{className:"gh-portal-signup-terms-wrapper free-only",children:r})]}):l.jsxs(l.Fragment,{children:[r&&l.jsx("div",{className:"gh-portal-signup-terms-wrapper",children:r}),this.renderProducts()]}),o?l.jsx("div",{className:"gh-portal-btn-container",children:l.jsxs("div",{className:"gh-portal-logged-out-form-container",children:[this.renderSubmitButton(),this.renderLoginMessage()]})}):this.renderLoginMessage()]})]})})}renderPaidMembersOnlyMessage(){return l.jsx("section",{children:l.jsxs("div",{className:"gh-portal-section",children:[l.jsx("p",{className:"gh-portal-paid-members-only-notification","data-testid":"paid-members-only-notification-text",children:h("This site only accepts paid members.")}),this.renderLoginMessage()]})})}renderInviteOnlyMessage(){return l.jsx("section",{children:l.jsxs("div",{className:"gh-portal-section",children:[l.jsx("p",{className:"gh-portal-invite-only-notification","data-testid":"invite-only-notification-text",children:h("This site is invite-only, contact the owner for access.")}),this.renderLoginMessage()]})})}renderMembersDisabledMessage(){return l.jsx("section",{children:l.jsx("div",{className:"gh-portal-section",children:l.jsx("p",{className:"gh-portal-members-disabled-notification","data-testid":"members-disabled-notification-text",children:h("Memberships unavailable, contact the owner for access.")})})})}renderSiteIcon(){const{site:t,pageQuery:n}=this.context,a=t.icon;return a?l.jsx("img",{className:"gh-portal-signup-logo",src:a,alt:t.title}):!Qt({site:t,pageQuery:n})||Ft({site:t})||!Ls({site:t})?l.jsx(Gb,{className:"gh-portal-icon gh-portal-icon-invitation"}):null}renderFormHeader(){const{site:t}=this.context,n=t.title||"";return l.jsxs("header",{className:"gh-portal-signup-header",children:[this.renderSiteIcon(),l.jsx("h1",{className:"gh-portal-main-title","data-testid":"site-title-text",children:n})]})}getClassNames(){const{site:t,pageQuery:n}=this.context,a=qs({site:t,pageQuery:n}),i=this.getInputFields({state:this.state});let o="",r="";return(a.length<=1||Ft({site:t}))&&(a.length===1&&a[0].type==="free"||Ft({site:t})?(o=I0({site:t})?"singleplan":"noplan",i.length===1&&(o="single-field"),Ft({site:t})&&(r="invite-only",o="invite-only")):o="singleplan"),{sectionClass:o,footerClass:r}}render(){let{sectionClass:t}=this.getClassNames();return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"gh-portal-back-sitetitle",children:l.jsx(Fo,{onBack:()=>{this.state.showNewsletterSelection?this.setState({showNewsletterSelection:!1}):this.context.doAction("closePopup")}})}),l.jsx(pe,{}),l.jsxs("div",{className:"gh-portal-content signup "+t,children:[this.renderFormHeader(),this.renderForm()]})]})}};km.contextType=_;let Qd=km;const em=e=>v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-mail-icon lucide-mail",...e},v.createElement("path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7"}),v.createElement("rect",{x:2,y:4,width:20,height:16,rx:2})),jT=e=>{var t;return typeof((t=e.userAgentData)==null?void 0:t.platform)=="string"?e.userAgentData.platform==="Android":/android/i.test(e.userAgent)},TT=e=>/chrome/i.test(e.userAgent),PT=e=>jT(e)&&TT(e),zT=(e,t)=>Object.hasOwn(e,t)?e[t]:void 0,IT=l.jsx("svg",{height:"24",width:"24",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 49.4 512 399.4200000000001",children:l.jsxs("g",{fill:"none",fillRule:"evenodd",children:[l.jsxs("g",{fillRule:"nonzero",children:[l.jsx("path",{d:"M34.91 448.818h81.454V251L0 163.727V413.91c0 19.287 15.622 34.91 34.91 34.91z",fill:"#4285f4"}),l.jsx("path",{d:"M395.636 448.818h81.455c19.287 0 34.909-15.622 34.909-34.909V163.727L395.636 251z",fill:"#34a853"}),l.jsx("path",{d:"M395.636 99.727V251L512 163.727v-46.545c0-43.142-49.25-67.782-83.782-41.891z",fill:"#fbbc04"})]}),l.jsx("path",{d:"M116.364 251V99.727L256 204.455 395.636 99.727V251L256 355.727z",fill:"#ea4335"}),l.jsx("path",{d:"M0 117.182v46.545L116.364 251V99.727L83.782 75.291C49.25 49.4 0 74.04 0 117.18z",fill:"#c5221f",fillRule:"nonzero"})]})}),NT=l.jsx("svg",{clipRule:"evenodd",fillRule:"evenodd",height:"2500",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 6876 6994",width:"2457",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("path",{d:"M0 779L4033 0l-14 6994L0 6160zm1430 3632c-305-357-390-918-244-1384 203-648 718-867 1149-717 246 86 465 293 582 610 56 152 86 326 88 503 4 318-106 692-324 953-335 400-903 441-1250 35zm314-339c-150-223-191-573-120-864 99-404 352-541 563-447 121 54 228 183 285 381 27 95 42 203 43 314 2 198-52 432-159 595-164 250-442 275-612 22zm2552-2598h2341c131 0 238 107 238 238v86L5035 3039c-24 16-83 62-132 93-72 47-77 38-153-5-117-65-319-203-455-297V1474zm2580 875v2504c0 200-164 365-365 365H4296V3366c133 88 310 204 419 271 88 54 104 79 202 22 45-26 89-60 119-80l1840-1229z",fill:"#0072c6"})}),AT=l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 3386.34 3010.5",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",imageRendering:"optimizeQuality",fillRule:"evenodd",clipRule:"evenodd",children:l.jsx("path",{d:"M0 732.88h645.84l376.07 962.1 380.96-962.1h628.76l-946.8 2277.62H451.98l259.19-603.53L.02 732.88zm2763.84 768.75h-704.26L2684.65 0l701.69.03-622.5 1501.6zm-519.78 143.72c216.09 0 391.25 175.17 391.25 391.22 0 216.06-175.16 391.23-391.25 391.23-216.06 0-391.19-175.17-391.19-391.23 0-216.05 175.16-391.22 391.19-391.22z",fill:"#5f01d1",fillRule:"nonzero"})}),MT=l.jsxs("svg",{viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",strokeLinejoin:"round",strokeMiterlimit:"2",children:[l.jsx("path",{d:"M22.86 13.464l.002.002-10.005 11.105L0 10.419V4.315a.827.827 0 011.356-.637l14.265 11.846a3.722 3.722 0 004.758 0l2.481-2.06z",fill:"url(#prefix___Linear1)",transform:"matrix(13.8889 0 0 13.8889 6 6)"}),l.jsx("path",{d:"M28.286 8.958l-5.426 4.506.002.002-7.184 6.345a3.31 3.31 0 01-4.308.065L0 10.42v18.142a3.724 3.724 0 003.724 3.724h24.562l2.571-11.664-2.571-11.664z",fill:"url(#prefix___Radial2)",fillRule:"nonzero",transform:"matrix(13.8889 0 0 13.8889 6 6)"}),l.jsx("path",{d:"M28.286 8.963v23.323h3.99A3.724 3.724 0 0036 28.562V4.315a.827.827 0 00-1.356-.637l-6.358 5.285z",fill:"url(#prefix___Linear3)",transform:"matrix(13.8889 0 0 13.8889 6 6)"}),l.jsxs("defs",{children:[l.jsxs("linearGradient",{id:"prefix___Linear1",x1:"0",y1:"0",x2:"1",y2:"0",gradientUnits:"userSpaceOnUse",gradientTransform:"scale(-43.6455) rotate(73.941 .222 -.49)",children:[l.jsx("stop",{offset:"0",stopColor:"#e3d9ff"}),l.jsx("stop",{offset:"1",stopColor:"#7341ff"})]}),l.jsxs("linearGradient",{id:"prefix___Linear3",x1:"0",y1:"0",x2:"1",y2:"0",gradientUnits:"userSpaceOnUse",gradientTransform:"scale(-66.0342) rotate(65.129 .243 -.95)",children:[l.jsx("stop",{offset:"0",stopColor:"#e3d9ff"}),l.jsx("stop",{offset:".27",stopColor:"#e3d9ff"}),l.jsx("stop",{offset:"1",stopColor:"#7341ff"})]}),l.jsxs("radialGradient",{id:"prefix___Radial2",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(35.9848 0 0 33.9185 30.723 11.814)",children:[l.jsx("stop",{offset:"0",stopColor:"#6d4aff"}),l.jsx("stop",{offset:".56",stopColor:"#6d4aff"}),l.jsx("stop",{offset:".99",stopColor:"#aa8eff"}),l.jsx("stop",{offset:"1",stopColor:"#aa8eff"})]})]})]}),DT=l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"2500",height:"2432",viewBox:"85.04 232.402 412.912 401.703",children:[l.jsx("path",{d:"M391.631 424.861l-4.477-1.119v-4.477c0-40.281-32.449-72.73-71.611-72.73-29.094 0-55.947 17.904-67.138 44.758l-3.355 7.834-5.595-5.596c-5.597-5.594-13.429-8.951-21.262-8.951a30.086 30.086 0 0 0-30.211 30.211l1.118 6.715-4.476 1.117c-21.26 6.715-35.807 25.736-35.807 46.996 0 26.854 22.38 49.234 49.234 49.234h185.745c25.734 0 48.113-21.262 48.113-48.115-1.114-22.379-16.78-41.401-40.278-45.877z",fill:"#333"}),l.jsx("path",{d:"M394.989 232.402H189.102c-58.185 0-104.062 46.996-104.062 104.062v193.578c0 58.186 46.995 104.062 104.062 104.062H393.87c58.187 0 104.062-46.996 104.062-104.062V337.583c1.118-58.185-45.877-105.181-102.943-105.181zm-11.19 298.76H198.054c-33.568 0-60.424-26.855-60.424-60.424 0-25.734 15.666-46.996 39.164-55.947 1.118-22.379 19.021-40.281 41.4-40.281 7.833 0 15.666 2.238 22.379 6.713 14.547-27.973 42.521-44.758 73.852-44.758 44.758 0 81.684 35.809 82.802 79.447 25.736 6.713 44.759 30.211 44.759 57.066-.001 31.328-25.737 58.184-58.187 58.184z",fill:"#333"}),l.jsx("path",{d:"M398.345 414.791c-2.237-44.758-38.044-79.445-82.802-79.445-31.33 0-60.424 17.904-73.852 44.76-6.714-4.477-14.546-6.715-22.379-6.715-22.379 0-40.282 17.902-41.401 40.281-23.498 8.951-39.163 31.33-39.163 55.947 0 33.568 26.855 60.424 60.424 60.424h185.746c32.448 0 59.304-26.854 59.304-59.305-2.237-25.737-20.14-49.233-45.877-55.947zm-14.546 105.181H198.054c-26.854 0-49.233-22.379-49.233-49.232 0-22.379 14.546-40.283 35.806-46.996l4.476-1.119-1.118-6.713c0-16.785 13.427-30.213 30.211-30.213 7.833 0 15.666 3.357 21.262 8.953l5.595 5.594 3.355-7.832c11.189-26.855 36.925-44.758 67.138-44.758 40.281 0 71.611 32.449 71.611 72.73v4.477l4.477 1.119c23.498 3.355 39.164 23.498 39.164 46.996-.003 25.734-21.264 46.994-46.999 46.994z",fill:"#e4e4e4"})]}),Uo=l.jsx(em,{className:"gh-portal-inbox-link-icon"}),FT={gmail:IT,outlook:NT,yahoo:AT,proton:MT,icloud:DT,hey:Uo,aol:Uo,mailru:Uo,feedbin:l.jsxs("svg",{className:"gh-portal-inbox-link-icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 183.436 170.826",children:[l.jsx("path",{d:"M183.432,89.959c-0.048-3.063-0.497-6.082-1.334-8.975c-0.901-3.114-2.23-6.177-3.96-9.13 c1.092-6.758,0.659-13.689-1.293-20.634c-1.09-3.878-2.657-7.671-4.658-11.274c-1.858-3.346-4.149-6.63-6.808-9.762 c-2.993-3.525-6.414-6.812-10.168-9.771c-3.486-2.747-7.374-5.301-11.558-7.591c-7.209-3.946-14.975-7.019-23.083-9.133 c-7.625-1.988-15.79-3.189-24.268-3.569C94.507,0.041,92.693,0,90.909,0c-5.665,0-11.351,0.411-16.901,1.223 c-4.65,0.68-9.204,1.621-13.534,2.798c-4.53,1.231-8.963,2.759-13.178,4.543c-4.808,2.035-9.322,4.378-13.417,6.965 c-4.412,2.787-8.502,5.96-12.158,9.43c-2.899,2.752-5.481,5.651-7.674,8.618c-2.396,3.241-4.419,6.682-6.011,10.228 C3.237,54.494,2.171,65.255,4.855,75.84c-1.278,2-2.296,3.965-3.088,5.95c-0.592,1.485-1.401,3.773-1.596,6.482 c-0.317,4.391-0.128,7.032,0.042,8.637c0.333,3.151,1.017,5.92,2.092,8.466c0.876,2.076,2.015,3.983,3.401,5.698 c-0.004,5.271,0.282,9.628,0.896,13.697c1.658,10.979,6.794,20.282,15.266,27.651c4.024,3.5,8.628,6.417,14.075,8.919 c5.796,2.662,12.181,4.704,19.522,6.243c8.669,1.818,17.734,2.833,27.715,3.104c3.439,0.093,6.638,0.139,9.78,0.139 c9.007,0,17.141-0.382,24.867-1.166c6.781-0.689,12.409-1.619,17.71-2.928c6.693-1.652,12.44-3.876,17.568-6.798 c8.917-5.081,15.441-12.349,19.391-21.602c2.111-4.945,3.553-10.188,4.41-16.029c0.666-4.539,0.908-9.172,0.735-14.094 c0.853-0.902,1.612-1.88,2.272-2.926c1.256-1.991,2.15-4.232,2.657-6.659C183.186,95.673,183.476,92.758,183.432,89.959z",fill:"#fff"}),l.jsx("path",{d:"M173.954,83.388c-0.899-3.108-2.287-5.99-4.047-8.692c-0.474-0.728-0.658-1.389-0.47-2.279 c1.343-6.341,0.995-12.63-0.755-18.853c-1.889-6.72-5.305-12.61-9.8-17.904c-5.448-6.416-12.031-11.427-19.381-15.45 C125.884,12.754,111.195,9.212,95.77,8.519c-6.929-0.311-13.839,0.017-20.718,1.023c-8.509,1.244-16.751,3.418-24.674,6.771 c-8.536,3.613-16.346,8.365-23.092,14.769c-4.932,4.682-9.028,9.992-11.824,16.221c-4.232,9.425-5.189,19.102-2.002,29.042 c0.265,0.827,0.092,1.412-0.395,2.077c-1.489,2.036-2.795,4.184-3.733,6.539c-0.515,1.291-0.927,2.607-1.027,4.003 c-0.172,2.389-0.234,4.781,0.018,7.165c0.455,4.306,1.817,8.219,5.054,11.288c0.181,0.171,0.324,0.381,0.485,0.573 c0,1.019,0.002,2.025,0,3.03c-0.008,4.218,0.171,8.417,0.803,12.603c1.374,9.101,5.583,16.602,12.502,22.62 c3.637,3.163,7.719,5.63,12.088,7.636c5.688,2.612,11.646,4.38,17.759,5.662c8.651,1.814,17.416,2.691,26.234,2.93 c11.207,0.304,22.41,0.147,33.582-0.988c5.579-0.567,11.112-1.384,16.558-2.728c5.396-1.332,10.595-3.186,15.444-5.95 c7.244-4.128,12.584-9.967,15.861-17.644c1.912-4.478,3.125-9.158,3.831-13.971c0.724-4.938,0.85-9.899,0.54-14.875 c-0.035-0.559-0.005-1.122-0.005-1.68c0.277-0.229,0.509-0.441,0.761-0.624c2.407-1.746,3.853-4.108,4.456-6.994 C175.228,92.451,175.26,87.905,173.954,83.388z M25.87,54.851c1.457-4.008,3.659-7.581,6.39-10.84 c3.801-4.534,8.35-8.186,13.371-11.271c6.978-4.287,14.527-7.192,22.458-9.141c9.052-2.223,18.25-3.033,27.545-2.583 c11.875,0.575,23.304,3.097,34.088,8.223c3.31,1.573,6.398,3.515,9.185,5.907c2.226,1.91,4.011,4.165,5.223,6.852 c1.557,3.45,1.801,7.067,1.137,10.724c-1.438,7.927-5.544,14.206-12.025,18.963c-3.062,2.247-6.396,4.006-9.876,5.495 c-1.966,0.841-3.965,1.606-5.939,2.43c-0.695,0.29-1.378,0.621-2.033,0.992c-0.374,0.212-0.722,0.507-1.007,0.831 c-0.41,0.466-0.342,1.172,0.2,1.477c0.59,0.332,1.246,0.592,1.906,0.742c2.236,0.508,4.515,0.413,6.773,0.244 c6.232-0.464,12.355-1.564,18.35-3.342c4.801-1.424,9.319-3.445,13.369-6.433c0.198-0.146,0.428-0.252,0.649-0.365 c0.036-0.018,0.103,0.026,0.284,0.079c-0.133,0.339-0.239,0.679-0.393,0.995c-1.517,3.097-3.65,5.717-6.226,7.99 c-3.044,2.685-6.469,4.784-10.111,6.547c-5.639,2.73-11.577,4.576-17.678,5.911c-6.961,1.522-14.013,2.365-21.128,2.782 c-7.055,0.413-14.101,0.37-21.142-0.129c-9.633-0.683-19.127-2.177-28.327-5.23c-4.191-1.391-8.239-3.11-12.056-5.342 c-2.673-1.563-5.169-3.365-7.393-5.528c-3.469-3.373-5.944-7.326-6.877-12.122C23.6,64.645,24.112,59.687,25.87,54.851z M157.755,121.076c-0.765,3.911-2.589,7.332-5.152,10.365c-2.382,2.819-5.246,5.059-8.41,6.934c-4.693,2.78-9.76,4.638-15.008,6.032 c-5.789,1.537-11.68,2.494-17.637,3.108c-7.902,0.814-15.822,1.131-23.76,1.008c-6.677-0.103-13.335-0.525-19.946-1.496 c-6.928-1.017-13.722-2.574-20.219-5.257c-4.268-1.763-8.291-3.954-11.869-6.9c-4.679-3.852-8.141-8.547-9.866-14.42 c-0.66-2.245-1.048-4.533-1.006-6.881c0.006-0.362,0.071-0.724,0.115-1.144c0.59,0,1.084-0.05,1.565,0.009 c2.26,0.276,4.527,0.297,6.789,0.133c5.883-0.428,11.207,1.103,16.057,4.416c2.92,1.995,5.599,4.282,8.158,6.709 c2.009,1.906,3.968,3.864,5.939,5.81c2.301,2.271,4.848,4.199,7.756,5.633c3.268,1.612,6.71,2.52,10.369,2.454 c3.388-0.061,6.585-0.933,9.625-2.413c2.448-1.192,4.668-2.727,6.753-4.468c0.724-0.604,1.448-1.214,2.21-1.769 c3.767-2.747,7.981-3.55,12.536-2.84c2.558,0.399,5.01,1.201,7.488,1.914c2.355,0.678,4.713,1.375,7.111,1.867 c2.544,0.522,5.123,0.509,7.676-0.147c2.614-0.671,4.531-2.18,5.556-4.674c0.595-1.447,0.998-2.974,1.466-4.472 c0.393-1.26,0.705-2.546,1.139-3.791c1.144-3.281,3.408-5.363,6.808-6.175c2.739-0.654,5.479-1.301,8.331-1.978 c0.091,0.39,0.214,0.678,0.218,0.967C158.601,113.455,158.495,117.295,157.755,121.076z",fill:"#000"})]}),"dev-mailpit":Uo},OT=e=>{switch(e){case"gmail":return h("Open Gmail");case"outlook":return h("Open Outlook");case"yahoo":return h("Open Yahoo Mail");case"proton":return h("Open Proton Mail");case"icloud":return h("Open iCloud Mail");case"hey":return h("Open Hey");case"aol":return h("Open AOL Mail");case"mailru":return h("Open Mail.ru");case"feedbin":return h("Open Feedbin");case"dev-mailpit":return"Open Mailpit (development only)";default:return h("Open email")}};function lk({inboxLinks:{android:e,desktop:t,provider:n}}){return l.jsxs("a",{href:PT(navigator)?e:t,target:"_blank",rel:"noreferrer noopener",className:"gh-portal-btn gh-portal-btn-inbox-link",children:[zT(FT,n)??Uo,l.jsx("span",{children:OT(n)})]})}const ck=e=>/iPad|iPhone|iPod/.test(e.userAgent)||e.platform==="MacIntel"&&e.maxTouchPoints>1,_T=`
|
|
1736
|
+
`,km=class km extends Z.Component{constructor(t){super(t),this.handleSelectPlan=(n,a)=>{n&&n.preventDefault(),this.timeoutId=setTimeout(()=>{this.setState(()=>({plan:a}))},5)},this.state={name:"",email:"",plan:"free",showNewsletterSelection:!1,termsCheckboxChecked:!1},this.termsRef=Z.createRef()}componentDidMount(){const{member:t}=this.context;t&&this.context.doAction("switchPage",{page:"accountHome"}),this.handleSelectedPlan()}componentDidUpdate(){this.handleSelectedPlan()}handleSelectedPlan(){const{site:t,pageQuery:n}=this.context,a=qs({site:t,pageQuery:n}),i=this.getSelectedPriceId(a,this.state.plan);i!==this.state.plan&&this.setState({plan:i})}componentWillUnmount(){clearTimeout(this.timeoutId)}getFormErrors(t){const a=this.context.site.portal_signup_checkbox_required&&this.context.site.portal_signup_terms_html&&!t.termsCheckboxChecked;return{...Oo({fields:this.getInputFields({state:t})}),checkbox:a}}doSignup(){this.setState(t=>({errors:this.getFormErrors(t)}),()=>{const{site:t,doAction:n}=this.context,{name:a,email:i,plan:o,phonenumber:r,token:s,errors:c}=this.state,u=c&&Object.values(c).filter(m=>!!m).length>0,d={...c};delete d.checkbox,(c==null?void 0:c.checkbox)&&Object.values(d).every(m=>!m)&&this.termsRef.current&&this.termsRef.current.scrollIntoView({behavior:"smooth",block:"center"}),u||(zo({site:t})?this.setState({showNewsletterSelection:!0,pageData:{name:a,email:i,plan:o,phonenumber:r,token:s},errors:{}}):(this.setState({errors:{}}),n("signup",{name:a,email:i,phonenumber:r,plan:o,token:s})))})}handleSignup(t){t.preventDefault(),this.doSignup()}handleChooseSignup(t,n){t.preventDefault(),this.setState({plan:n},()=>{this.doSignup()})}handleInputChange(t,n){const a=n.name,i=t.target.value;this.setState({[a]:i})}onKeyDown(t){t.keyCode===13&&this.handleSignup(t)}getSelectedPriceId(t=[],n){return!t||t.length===0||n==="free"?"free":t.some(i=>i.id===n)?n:t[0].id||"free"}getInputFields({state:t,fieldNames:n}){const{site:{portal_name:a}}=this.context,i=t.errors||{},o=[{type:"email",value:t.email,placeholder:h("jamie@example.com"),label:h("Email"),name:"email",required:!0,tabIndex:2,errorMessage:i.email||""},{type:"text",value:t.phonenumber,placeholder:h("+1 (123) 456-7890"),label:h("Phone number"),name:"phonenumber",required:!1,tabIndex:-1,autoComplete:"off",hidden:!0}];return a&&o.unshift({type:"text",value:t.name,placeholder:h("Jamie Larson"),label:h("Name"),name:"name",required:!0,tabIndex:1,errorMessage:i.name||""}),o[0].autoFocus=!0,n&&n.length>0?o.filter(r=>n.includes(r.name)):o}renderSignupTerms(){var s;const{site:t}=this.context;if(t.portal_signup_terms_html===null||t.portal_signup_terms_html==="")return null;const n=c=>{this.setState({termsCheckboxChecked:c.target.checked})},a=l.jsx("div",{className:"gh-portal-signup-terms-content",dangerouslySetInnerHTML:{__html:sk(t.portal_signup_terms_html)}}),i=t.portal_signup_checkbox_required?l.jsxs("label",{children:[l.jsx("input",{type:"checkbox",checked:!!this.state.termsCheckboxChecked,required:!0,onChange:n}),l.jsx("span",{className:"checkbox"}),a]}):a,r=`gh-portal-signup-terms ${(s=this.state.errors)!=null&&s.checkbox?"gh-portal-error":""}`;return l.jsx("div",{className:r,onClick:Kb,ref:this.termsRef,children:i})}renderSubmitButton(){const{action:t,site:n,brandColor:a,pageQuery:i}=this.context;if(Ft({site:n})||!Qt({site:n,pageQuery:i}))return null;let o=h("Continue");const r=i==="free"&&Sd({site:n});if(Ja({site:n})||r)o=h("Sign up");else return null;let s=!1;t==="signup:running"&&(o=h("Sending..."),s=!0);let c=!1;t==="signup:failed"&&(o=h("Retry"),c=!0);const u=t==="signup:running";return l.jsx(me,{style:{width:"100%"},retry:c,onClick:d=>this.handleSignup(d),disabled:u,brandColor:a,label:o,isRunning:s,tabIndex:3})}renderProducts(){const{site:t,pageQuery:n}=this.context,a=Vs({site:t,pageQuery:n}),i=this.state.errors||{},o={};return Object.keys(i).length>0&&this.state.plan&&(o[this.state.plan]=h("Please fill in required fields")),l.jsx(l.Fragment,{children:l.jsx(Vb,{handleChooseSignup:(...r)=>this.handleChooseSignup(...r),products:a,onPlanSelect:this.handleSelectPlan,errors:o})})}renderFreeTrialMessage(){const{site:t,pageQuery:n}=this.context;return Ws({site:t,pageQuery:n})&&!Ft({site:t})&&Qt({site:t,pageQuery:n})?l.jsx("p",{className:"gh-portal-free-trial-notification","data-testid":"free-trial-notification-text",children:h("After a free trial ends, you will be charged the regular price for the tier you've chosen. You can always cancel before then.")}):null}renderLoginMessage(){const{brandColor:t,doAction:n}=this.context;return l.jsxs("div",{children:[this.renderFreeTrialMessage(),l.jsxs("div",{className:"gh-portal-signup-message",children:[l.jsx("div",{children:h("Already a member?")}),l.jsx("button",{"data-test-button":"signin-switch","data-testid":"signin-switch",className:"gh-portal-btn gh-portal-btn-link",style:{color:t},onClick:()=>n("switchPage",{page:"signin"}),children:l.jsx("span",{children:h("Sign in")})})]})]})}renderForm(){const t=this.getInputFields({state:this.state}),{site:n,pageQuery:a}=this.context;if(this.state.showNewsletterSelection)return l.jsx(Ud,{pageData:this.state.pageData,onBack:()=>{this.setState({showNewsletterSelection:!1})}});if(Ft({site:n}))return this.renderInviteOnlyMessage();if($1({site:n})&&a==="free")return this.renderPaidMembersOnlyMessage();if(!Ls({site:n})||!Qt({site:n,pageQuery:a}))return zn({site:n})?this.renderInviteOnlyMessage():this.renderMembersDisabledMessage();const i=a==="free"&&Sd({site:n}),o=Ja({site:n})||i,r=this.renderSignupTerms();return l.jsx("section",{className:"gh-portal-signup",children:l.jsxs("div",{className:"gh-portal-section",children:[l.jsx("div",{className:"gh-portal-logged-out-form-container",children:l.jsx(ti,{fields:t,onChange:(s,c)=>this.handleInputChange(s,c),onKeyDown:s=>this.onKeyDown(s)})}),l.jsxs("div",{children:[o?l.jsxs(l.Fragment,{children:[this.renderProducts(),r&&l.jsx("div",{className:"gh-portal-signup-terms-wrapper free-only",children:r})]}):l.jsxs(l.Fragment,{children:[r&&l.jsx("div",{className:"gh-portal-signup-terms-wrapper",children:r}),this.renderProducts()]}),o?l.jsx("div",{className:"gh-portal-btn-container",children:l.jsxs("div",{className:"gh-portal-logged-out-form-container",children:[this.renderSubmitButton(),this.renderLoginMessage()]})}):this.renderLoginMessage()]})]})})}renderPaidMembersOnlyMessage(){return l.jsx("section",{children:l.jsxs("div",{className:"gh-portal-section",children:[l.jsx("p",{className:"gh-portal-paid-members-only-notification","data-testid":"paid-members-only-notification-text",children:h("This site only accepts paid members.")}),this.renderLoginMessage()]})})}renderInviteOnlyMessage(){return l.jsx("section",{children:l.jsxs("div",{className:"gh-portal-section",children:[l.jsx("p",{className:"gh-portal-invite-only-notification","data-testid":"invite-only-notification-text",children:h("This site is invite-only, contact the owner for access.")}),this.renderLoginMessage()]})})}renderMembersDisabledMessage(){return l.jsx("section",{children:l.jsx("div",{className:"gh-portal-section",children:l.jsx("p",{className:"gh-portal-members-disabled-notification","data-testid":"members-disabled-notification-text",children:h("Memberships unavailable, contact the owner for access.")})})})}renderSiteIcon(){const{site:t,pageQuery:n}=this.context,a=t.icon;return a?l.jsx("img",{className:"gh-portal-signup-logo",src:a,alt:t.title}):!Qt({site:t,pageQuery:n})||Ft({site:t})||!Ls({site:t})?l.jsx(Gb,{className:"gh-portal-icon gh-portal-icon-invitation"}):null}renderFormHeader(){const{site:t}=this.context,n=t.title||"";return l.jsxs("header",{className:"gh-portal-signup-header",children:[this.renderSiteIcon(),l.jsx("h1",{className:"gh-portal-main-title","data-testid":"site-title-text",children:n})]})}getClassNames(){const{site:t,pageQuery:n}=this.context,a=qs({site:t,pageQuery:n}),i=this.getInputFields({state:this.state});let o="",r="";return(a.length<=1||Ft({site:t}))&&(a.length===1&&a[0].type==="free"||Ft({site:t})?(o=I1({site:t})?"singleplan":"noplan",i.length===1&&(o="single-field"),Ft({site:t})&&(r="invite-only",o="invite-only")):o="singleplan"),{sectionClass:o,footerClass:r}}render(){let{sectionClass:t}=this.getClassNames();return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"gh-portal-back-sitetitle",children:l.jsx(Fo,{onBack:()=>{this.state.showNewsletterSelection?this.setState({showNewsletterSelection:!1}):this.context.doAction("closePopup")}})}),l.jsx(pe,{}),l.jsxs("div",{className:"gh-portal-content signup "+t,children:[this.renderFormHeader(),this.renderForm()]})]})}};km.contextType=_;let Qd=km;const em=e=>v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-mail-icon lucide-mail",...e},v.createElement("path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7"}),v.createElement("rect",{x:2,y:4,width:20,height:16,rx:2})),jT=e=>{var t;return typeof((t=e.userAgentData)==null?void 0:t.platform)=="string"?e.userAgentData.platform==="Android":/android/i.test(e.userAgent)},TT=e=>/chrome/i.test(e.userAgent),PT=e=>jT(e)&&TT(e),zT=(e,t)=>Object.hasOwn(e,t)?e[t]:void 0,IT=l.jsx("svg",{height:"24",width:"24",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 49.4 512 399.4200000000001",children:l.jsxs("g",{fill:"none",fillRule:"evenodd",children:[l.jsxs("g",{fillRule:"nonzero",children:[l.jsx("path",{d:"M34.91 448.818h81.454V251L0 163.727V413.91c0 19.287 15.622 34.91 34.91 34.91z",fill:"#4285f4"}),l.jsx("path",{d:"M395.636 448.818h81.455c19.287 0 34.909-15.622 34.909-34.909V163.727L395.636 251z",fill:"#34a853"}),l.jsx("path",{d:"M395.636 99.727V251L512 163.727v-46.545c0-43.142-49.25-67.782-83.782-41.891z",fill:"#fbbc04"})]}),l.jsx("path",{d:"M116.364 251V99.727L256 204.455 395.636 99.727V251L256 355.727z",fill:"#ea4335"}),l.jsx("path",{d:"M0 117.182v46.545L116.364 251V99.727L83.782 75.291C49.25 49.4 0 74.04 0 117.18z",fill:"#c5221f",fillRule:"nonzero"})]})}),NT=l.jsx("svg",{clipRule:"evenodd",fillRule:"evenodd",height:"2500",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 6876 6994",width:"2457",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("path",{d:"M0 779L4033 0l-14 6994L0 6160zm1430 3632c-305-357-390-918-244-1384 203-648 718-867 1149-717 246 86 465 293 582 610 56 152 86 326 88 503 4 318-106 692-324 953-335 400-903 441-1250 35zm314-339c-150-223-191-573-120-864 99-404 352-541 563-447 121 54 228 183 285 381 27 95 42 203 43 314 2 198-52 432-159 595-164 250-442 275-612 22zm2552-2598h2341c131 0 238 107 238 238v86L5035 3039c-24 16-83 62-132 93-72 47-77 38-153-5-117-65-319-203-455-297V1474zm2580 875v2504c0 200-164 365-365 365H4296V3366c133 88 310 204 419 271 88 54 104 79 202 22 45-26 89-60 119-80l1840-1229z",fill:"#0072c6"})}),AT=l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 3386.34 3010.5",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",imageRendering:"optimizeQuality",fillRule:"evenodd",clipRule:"evenodd",children:l.jsx("path",{d:"M0 732.88h645.84l376.07 962.1 380.96-962.1h628.76l-946.8 2277.62H451.98l259.19-603.53L.02 732.88zm2763.84 768.75h-704.26L2684.65 0l701.69.03-622.5 1501.6zm-519.78 143.72c216.09 0 391.25 175.17 391.25 391.22 0 216.06-175.16 391.23-391.25 391.23-216.06 0-391.19-175.17-391.19-391.23 0-216.05 175.16-391.22 391.19-391.22z",fill:"#5f01d1",fillRule:"nonzero"})}),MT=l.jsxs("svg",{viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",strokeLinejoin:"round",strokeMiterlimit:"2",children:[l.jsx("path",{d:"M22.86 13.464l.002.002-10.005 11.105L0 10.419V4.315a.827.827 0 011.356-.637l14.265 11.846a3.722 3.722 0 004.758 0l2.481-2.06z",fill:"url(#prefix___Linear1)",transform:"matrix(13.8889 0 0 13.8889 6 6)"}),l.jsx("path",{d:"M28.286 8.958l-5.426 4.506.002.002-7.184 6.345a3.31 3.31 0 01-4.308.065L0 10.42v18.142a3.724 3.724 0 003.724 3.724h24.562l2.571-11.664-2.571-11.664z",fill:"url(#prefix___Radial2)",fillRule:"nonzero",transform:"matrix(13.8889 0 0 13.8889 6 6)"}),l.jsx("path",{d:"M28.286 8.963v23.323h3.99A3.724 3.724 0 0036 28.562V4.315a.827.827 0 00-1.356-.637l-6.358 5.285z",fill:"url(#prefix___Linear3)",transform:"matrix(13.8889 0 0 13.8889 6 6)"}),l.jsxs("defs",{children:[l.jsxs("linearGradient",{id:"prefix___Linear1",x1:"0",y1:"0",x2:"1",y2:"0",gradientUnits:"userSpaceOnUse",gradientTransform:"scale(-43.6455) rotate(73.941 .222 -.49)",children:[l.jsx("stop",{offset:"0",stopColor:"#e3d9ff"}),l.jsx("stop",{offset:"1",stopColor:"#7341ff"})]}),l.jsxs("linearGradient",{id:"prefix___Linear3",x1:"0",y1:"0",x2:"1",y2:"0",gradientUnits:"userSpaceOnUse",gradientTransform:"scale(-66.0342) rotate(65.129 .243 -.95)",children:[l.jsx("stop",{offset:"0",stopColor:"#e3d9ff"}),l.jsx("stop",{offset:".27",stopColor:"#e3d9ff"}),l.jsx("stop",{offset:"1",stopColor:"#7341ff"})]}),l.jsxs("radialGradient",{id:"prefix___Radial2",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(35.9848 0 0 33.9185 30.723 11.814)",children:[l.jsx("stop",{offset:"0",stopColor:"#6d4aff"}),l.jsx("stop",{offset:".56",stopColor:"#6d4aff"}),l.jsx("stop",{offset:".99",stopColor:"#aa8eff"}),l.jsx("stop",{offset:"1",stopColor:"#aa8eff"})]})]})]}),DT=l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"2500",height:"2432",viewBox:"85.04 232.402 412.912 401.703",children:[l.jsx("path",{d:"M391.631 424.861l-4.477-1.119v-4.477c0-40.281-32.449-72.73-71.611-72.73-29.094 0-55.947 17.904-67.138 44.758l-3.355 7.834-5.595-5.596c-5.597-5.594-13.429-8.951-21.262-8.951a30.086 30.086 0 0 0-30.211 30.211l1.118 6.715-4.476 1.117c-21.26 6.715-35.807 25.736-35.807 46.996 0 26.854 22.38 49.234 49.234 49.234h185.745c25.734 0 48.113-21.262 48.113-48.115-1.114-22.379-16.78-41.401-40.278-45.877z",fill:"#333"}),l.jsx("path",{d:"M394.989 232.402H189.102c-58.185 0-104.062 46.996-104.062 104.062v193.578c0 58.186 46.995 104.062 104.062 104.062H393.87c58.187 0 104.062-46.996 104.062-104.062V337.583c1.118-58.185-45.877-105.181-102.943-105.181zm-11.19 298.76H198.054c-33.568 0-60.424-26.855-60.424-60.424 0-25.734 15.666-46.996 39.164-55.947 1.118-22.379 19.021-40.281 41.4-40.281 7.833 0 15.666 2.238 22.379 6.713 14.547-27.973 42.521-44.758 73.852-44.758 44.758 0 81.684 35.809 82.802 79.447 25.736 6.713 44.759 30.211 44.759 57.066-.001 31.328-25.737 58.184-58.187 58.184z",fill:"#333"}),l.jsx("path",{d:"M398.345 414.791c-2.237-44.758-38.044-79.445-82.802-79.445-31.33 0-60.424 17.904-73.852 44.76-6.714-4.477-14.546-6.715-22.379-6.715-22.379 0-40.282 17.902-41.401 40.281-23.498 8.951-39.163 31.33-39.163 55.947 0 33.568 26.855 60.424 60.424 60.424h185.746c32.448 0 59.304-26.854 59.304-59.305-2.237-25.737-20.14-49.233-45.877-55.947zm-14.546 105.181H198.054c-26.854 0-49.233-22.379-49.233-49.232 0-22.379 14.546-40.283 35.806-46.996l4.476-1.119-1.118-6.713c0-16.785 13.427-30.213 30.211-30.213 7.833 0 15.666 3.357 21.262 8.953l5.595 5.594 3.355-7.832c11.189-26.855 36.925-44.758 67.138-44.758 40.281 0 71.611 32.449 71.611 72.73v4.477l4.477 1.119c23.498 3.355 39.164 23.498 39.164 46.996-.003 25.734-21.264 46.994-46.999 46.994z",fill:"#e4e4e4"})]}),Uo=l.jsx(em,{className:"gh-portal-inbox-link-icon"}),FT={gmail:IT,outlook:NT,yahoo:AT,proton:MT,icloud:DT,hey:Uo,aol:Uo,mailru:Uo,feedbin:l.jsxs("svg",{className:"gh-portal-inbox-link-icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 183.436 170.826",children:[l.jsx("path",{d:"M183.432,89.959c-0.048-3.063-0.497-6.082-1.334-8.975c-0.901-3.114-2.23-6.177-3.96-9.13 c1.092-6.758,0.659-13.689-1.293-20.634c-1.09-3.878-2.657-7.671-4.658-11.274c-1.858-3.346-4.149-6.63-6.808-9.762 c-2.993-3.525-6.414-6.812-10.168-9.771c-3.486-2.747-7.374-5.301-11.558-7.591c-7.209-3.946-14.975-7.019-23.083-9.133 c-7.625-1.988-15.79-3.189-24.268-3.569C94.507,0.041,92.693,0,90.909,0c-5.665,0-11.351,0.411-16.901,1.223 c-4.65,0.68-9.204,1.621-13.534,2.798c-4.53,1.231-8.963,2.759-13.178,4.543c-4.808,2.035-9.322,4.378-13.417,6.965 c-4.412,2.787-8.502,5.96-12.158,9.43c-2.899,2.752-5.481,5.651-7.674,8.618c-2.396,3.241-4.419,6.682-6.011,10.228 C3.237,54.494,2.171,65.255,4.855,75.84c-1.278,2-2.296,3.965-3.088,5.95c-0.592,1.485-1.401,3.773-1.596,6.482 c-0.317,4.391-0.128,7.032,0.042,8.637c0.333,3.151,1.017,5.92,2.092,8.466c0.876,2.076,2.015,3.983,3.401,5.698 c-0.004,5.271,0.282,9.628,0.896,13.697c1.658,10.979,6.794,20.282,15.266,27.651c4.024,3.5,8.628,6.417,14.075,8.919 c5.796,2.662,12.181,4.704,19.522,6.243c8.669,1.818,17.734,2.833,27.715,3.104c3.439,0.093,6.638,0.139,9.78,0.139 c9.007,0,17.141-0.382,24.867-1.166c6.781-0.689,12.409-1.619,17.71-2.928c6.693-1.652,12.44-3.876,17.568-6.798 c8.917-5.081,15.441-12.349,19.391-21.602c2.111-4.945,3.553-10.188,4.41-16.029c0.666-4.539,0.908-9.172,0.735-14.094 c0.853-0.902,1.612-1.88,2.272-2.926c1.256-1.991,2.15-4.232,2.657-6.659C183.186,95.673,183.476,92.758,183.432,89.959z",fill:"#fff"}),l.jsx("path",{d:"M173.954,83.388c-0.899-3.108-2.287-5.99-4.047-8.692c-0.474-0.728-0.658-1.389-0.47-2.279 c1.343-6.341,0.995-12.63-0.755-18.853c-1.889-6.72-5.305-12.61-9.8-17.904c-5.448-6.416-12.031-11.427-19.381-15.45 C125.884,12.754,111.195,9.212,95.77,8.519c-6.929-0.311-13.839,0.017-20.718,1.023c-8.509,1.244-16.751,3.418-24.674,6.771 c-8.536,3.613-16.346,8.365-23.092,14.769c-4.932,4.682-9.028,9.992-11.824,16.221c-4.232,9.425-5.189,19.102-2.002,29.042 c0.265,0.827,0.092,1.412-0.395,2.077c-1.489,2.036-2.795,4.184-3.733,6.539c-0.515,1.291-0.927,2.607-1.027,4.003 c-0.172,2.389-0.234,4.781,0.018,7.165c0.455,4.306,1.817,8.219,5.054,11.288c0.181,0.171,0.324,0.381,0.485,0.573 c0,1.019,0.002,2.025,0,3.03c-0.008,4.218,0.171,8.417,0.803,12.603c1.374,9.101,5.583,16.602,12.502,22.62 c3.637,3.163,7.719,5.63,12.088,7.636c5.688,2.612,11.646,4.38,17.759,5.662c8.651,1.814,17.416,2.691,26.234,2.93 c11.207,0.304,22.41,0.147,33.582-0.988c5.579-0.567,11.112-1.384,16.558-2.728c5.396-1.332,10.595-3.186,15.444-5.95 c7.244-4.128,12.584-9.967,15.861-17.644c1.912-4.478,3.125-9.158,3.831-13.971c0.724-4.938,0.85-9.899,0.54-14.875 c-0.035-0.559-0.005-1.122-0.005-1.68c0.277-0.229,0.509-0.441,0.761-0.624c2.407-1.746,3.853-4.108,4.456-6.994 C175.228,92.451,175.26,87.905,173.954,83.388z M25.87,54.851c1.457-4.008,3.659-7.581,6.39-10.84 c3.801-4.534,8.35-8.186,13.371-11.271c6.978-4.287,14.527-7.192,22.458-9.141c9.052-2.223,18.25-3.033,27.545-2.583 c11.875,0.575,23.304,3.097,34.088,8.223c3.31,1.573,6.398,3.515,9.185,5.907c2.226,1.91,4.011,4.165,5.223,6.852 c1.557,3.45,1.801,7.067,1.137,10.724c-1.438,7.927-5.544,14.206-12.025,18.963c-3.062,2.247-6.396,4.006-9.876,5.495 c-1.966,0.841-3.965,1.606-5.939,2.43c-0.695,0.29-1.378,0.621-2.033,0.992c-0.374,0.212-0.722,0.507-1.007,0.831 c-0.41,0.466-0.342,1.172,0.2,1.477c0.59,0.332,1.246,0.592,1.906,0.742c2.236,0.508,4.515,0.413,6.773,0.244 c6.232-0.464,12.355-1.564,18.35-3.342c4.801-1.424,9.319-3.445,13.369-6.433c0.198-0.146,0.428-0.252,0.649-0.365 c0.036-0.018,0.103,0.026,0.284,0.079c-0.133,0.339-0.239,0.679-0.393,0.995c-1.517,3.097-3.65,5.717-6.226,7.99 c-3.044,2.685-6.469,4.784-10.111,6.547c-5.639,2.73-11.577,4.576-17.678,5.911c-6.961,1.522-14.013,2.365-21.128,2.782 c-7.055,0.413-14.101,0.37-21.142-0.129c-9.633-0.683-19.127-2.177-28.327-5.23c-4.191-1.391-8.239-3.11-12.056-5.342 c-2.673-1.563-5.169-3.365-7.393-5.528c-3.469-3.373-5.944-7.326-6.877-12.122C23.6,64.645,24.112,59.687,25.87,54.851z M157.755,121.076c-0.765,3.911-2.589,7.332-5.152,10.365c-2.382,2.819-5.246,5.059-8.41,6.934c-4.693,2.78-9.76,4.638-15.008,6.032 c-5.789,1.537-11.68,2.494-17.637,3.108c-7.902,0.814-15.822,1.131-23.76,1.008c-6.677-0.103-13.335-0.525-19.946-1.496 c-6.928-1.017-13.722-2.574-20.219-5.257c-4.268-1.763-8.291-3.954-11.869-6.9c-4.679-3.852-8.141-8.547-9.866-14.42 c-0.66-2.245-1.048-4.533-1.006-6.881c0.006-0.362,0.071-0.724,0.115-1.144c0.59,0,1.084-0.05,1.565,0.009 c2.26,0.276,4.527,0.297,6.789,0.133c5.883-0.428,11.207,1.103,16.057,4.416c2.92,1.995,5.599,4.282,8.158,6.709 c2.009,1.906,3.968,3.864,5.939,5.81c2.301,2.271,4.848,4.199,7.756,5.633c3.268,1.612,6.71,2.52,10.369,2.454 c3.388-0.061,6.585-0.933,9.625-2.413c2.448-1.192,4.668-2.727,6.753-4.468c0.724-0.604,1.448-1.214,2.21-1.769 c3.767-2.747,7.981-3.55,12.536-2.84c2.558,0.399,5.01,1.201,7.488,1.914c2.355,0.678,4.713,1.375,7.111,1.867 c2.544,0.522,5.123,0.509,7.676-0.147c2.614-0.671,4.531-2.18,5.556-4.674c0.595-1.447,0.998-2.974,1.466-4.472 c0.393-1.26,0.705-2.546,1.139-3.791c1.144-3.281,3.408-5.363,6.808-6.175c2.739-0.654,5.479-1.301,8.331-1.978 c0.091,0.39,0.214,0.678,0.218,0.967C158.601,113.455,158.495,117.295,157.755,121.076z",fill:"#000"})]}),"dev-mailpit":Uo},OT=e=>{switch(e){case"gmail":return h("Open Gmail");case"outlook":return h("Open Outlook");case"yahoo":return h("Open Yahoo Mail");case"proton":return h("Open Proton Mail");case"icloud":return h("Open iCloud Mail");case"hey":return h("Open Hey");case"aol":return h("Open AOL Mail");case"mailru":return h("Open Mail.ru");case"feedbin":return h("Open Feedbin");case"dev-mailpit":return"Open Mailpit (development only)";default:return h("Open email")}};function lk({inboxLinks:{android:e,desktop:t,provider:n}}){return l.jsxs("a",{href:PT(navigator)?e:t,target:"_blank",rel:"noreferrer noopener",className:"gh-portal-btn gh-portal-btn-inbox-link",children:[zT(FT,n)??Uo,l.jsx("span",{children:OT(n)})]})}const ck=e=>/iPad|iPhone|iPod/.test(e.userAgent)||e.platform==="MacIntel"&&e.maxTouchPoints>1,_T=`
|
|
1737
1737
|
.gh-portal-icon-envelope {
|
|
1738
1738
|
width: 44px;
|
|
1739
1739
|
margin: 12px 0 10px;
|
|
@@ -1951,7 +1951,7 @@ html[dir="rtl"] .gh-portal-offer-title h4 {
|
|
|
1951
1951
|
.gh-portal-offer .gh-portal-signup-terms.gh-portal-error {
|
|
1952
1952
|
margin: 0;
|
|
1953
1953
|
}
|
|
1954
|
-
`,Sm=class Sm extends Z.Component{constructor(t,n){var a,i;super(t,n),this.state={name:((a=n==null?void 0:n.member)==null?void 0:a.name)||"",email:((i=n==null?void 0:n.member)==null?void 0:i.email)||"",plan:"free",showNewsletterSelection:!1,termsCheckboxChecked:!1}}getFormErrors(t){const a=this.context.site.portal_signup_checkbox_required&&this.context.site.portal_signup_terms_html&&!t.termsCheckboxChecked;return{...Oo({fields:this.getInputFields({state:t})}),checkbox:a}}getInputFields({state:t,fieldNames:n}){const{portal_name:a}=this.context.site,{member:i}=this.context,o=t.errors||{},r=[{type:"email",value:(i==null?void 0:i.email)||t.email,placeholder:h("jamie@example.com"),label:h("Email"),name:"email",disabled:!!i,required:!0,tabIndex:2,errorMessage:o.email||""}];let s=!!a;return i&&!(i!=null&&i.name)&&(s=!1),s&&r.unshift({type:"text",value:(i==null?void 0:i.name)||t.name,placeholder:h("Jamie Larson"),label:h("Name"),name:"name",disabled:!!i,required:!0,tabIndex:1,errorMessage:o.name||""}),r[0].autoFocus=!0,n&&n.length>0?r.filter(c=>n.includes(c.name)):r}renderSignupTerms(){var s;const{site:t}=this.context;if(t.portal_signup_terms_html===null||t.portal_signup_terms_html==="")return null;const n=c=>{this.setState({termsCheckboxChecked:c.target.checked})},a=l.jsx("div",{className:"gh-portal-signup-terms-content",dangerouslySetInnerHTML:{__html:sk(t.portal_signup_terms_html)}}),i=t.portal_signup_checkbox_required?l.jsxs("label",{children:[l.jsx("input",{type:"checkbox",checked:!!this.state.termsCheckboxChecked,required:!0,onChange:n}),l.jsx("span",{className:"checkbox"}),a]}):a,r=`gh-portal-signup-terms ${(s=this.state.errors)!=null&&s.checkbox?"gh-portal-error":""}`;return l.jsx("div",{className:r,onClick:Kb,children:i})}onKeyDown(t){t.keyCode===13&&this.handleSignup(t)}handleSignup(t){t.preventDefault();const{pageData:n,site:a}=this.context;if(!n||!n.tier)return null;const i=ea({site:a,productId:n.tier.id}),o=n.cadence==="month"?i.monthlyPrice:i.yearlyPrice;this.setState(r=>({errors:this.getFormErrors(r)}),()=>{const{doAction:r}=this.context,{name:s,email:c,phonenumber:u,errors:d}=this.state;if(!(d&&Object.values(d).filter(m=>!!m).length>0)){const m={name:s,email:c,plan:o==null?void 0:o.id,offerId:n==null?void 0:n.id,phonenumber:u};zo({site:a})?this.setState({showNewsletterSelection:!0,pageData:m,errors:{}}):(r("signup",m),this.setState({errors:{}}))}})}handleInputChange(t,n){const a=n.name,i=t.target.value;this.setState({[a]:i})}renderSiteLogo(){const{site:t}=this.context,n=t.icon;return n?l.jsx("img",{className:"gh-portal-signup-logo",src:n,alt:t.title}):null}renderFormHeader(){const{site:t}=this.context,n=t.title||"";return l.jsxs("header",{className:"gh-portal-signup-header",children:[this.renderSiteLogo(),l.jsx("h2",{className:"gh-portal-main-title",children:n})]})}renderForm(){const t=this.getInputFields({state:this.state});return this.state.showNewsletterSelection?l.jsx(Ud,{pageData:this.state.pageData,onBack:()=>{this.setState({showNewsletterSelection:!1})}}):l.jsx("section",{children:l.jsx("div",{className:"gh-portal-section",children:l.jsx(ti,{fields:t,onChange:(n,a)=>this.handleInputChange(n,a),onKeyDown:n=>this.onKeyDown(n)})})})}renderSubmitButton(){const{action:t,brandColor:n}=this.context,{pageData:a}=this.context;let i=h("Continue");a.type==="trial"&&(i=h("Start {amount}-day free trial",{amount:a.amount}));let o=!1;t==="signup:running"&&(i=h("Sending..."),o=!0);let r=!1;t==="signup:failed"&&(i=h("Retry"),r=!0);const s=t==="signup:running";return l.jsx(me,{style:{width:"100%"},retry:r,onClick:c=>this.handleSignup(c),disabled:s,brandColor:n,label:i,isRunning:o,tabIndex:3,classes:"sticky bottom"})}renderLoginMessage(){const{member:t}=this.context;if(t)return null;const{brandColor:n,doAction:a}=this.context;return l.jsxs("div",{className:"gh-portal-signup-message",children:[l.jsx("div",{children:h("Already a member?")}),l.jsx("button",{className:"gh-portal-btn gh-portal-btn-link",style:{color:n},onClick:()=>a("switchPage",{page:"signin"}),children:l.jsx("span",{children:h("Sign in")})})]})}renderOfferTag(){const{pageData:t}=this.context;return t.amount<=0?l.jsx(l.Fragment,{}):t.type==="fixed"?l.jsx("h5",{className:"gh-portal-discount-label","data-testid":"offer-discount-label",children:h("{amount} off",{amount:`${ke(t.currency)}${t.amount/100}`})}):t.type==="trial"?l.jsx("h5",{className:"gh-portal-discount-label","data-testid":"offer-discount-label",children:h("{amount} days free",{amount:t.amount})}):l.jsx("h5",{className:"gh-portal-discount-label","data-testid":"offer-discount-label",children:h("{amount} off",{amount:t.amount+"%"})})}renderBenefits({product:t}){const n=t.benefits||[];if(!(n!=null&&n.length))return;const a=n.map((i,o)=>l.jsxs("div",{className:"gh-portal-product-benefit",children:[l.jsx(Do,{className:"gh-portal-benefit-checkmark"}),l.jsx("div",{className:"gh-portal-benefit-title",children:i.name})]},`${i.name}-${o}`));return l.jsx("div",{className:"gh-portal-product-benefits",children:a})}getOriginalPrice({offer:t,product:n}){const a=t.cadence==="month"?n.monthlyPrice:n.yearlyPrice,i=this.renderRoundedPrice(a.amount/100);return`${ke(a.currency)}${i}/${Za(t.cadence)}`}renderRoundedPrice(t){if(t%1!==0){const n=Math.round(t*100)/100;return Number(n).toFixed(2)}return t}getOffAmount({offer:t}){return t.type==="fixed"?`${ke(t.currency)}${t.amount/100}`:t.type==="percent"?`${t.amount}%`:t.type==="trial"?t.amount:""}renderOfferMessage({offer:t,product:n}){const a={forever:h("{amount} off forever.",{amount:this.getOffAmount({offer:t})}),firstPeriod:h("{amount} off for first {period}.",{amount:this.getOffAmount({offer:t}),period:Za(t.cadence)}),firstNMonths:h("{amount} off for first {number} months.",{amount:this.getOffAmount({offer:t}),number:t.duration_in_months||""})},i=this.getOriginalPrice({offer:t,product:n}),o=h("Renews at {price}.",{price:i,interpolation:{escapeValue:!1}});let r="",s=!1;const c=t.duration;return c==="once"?(r=a.firstPeriod,s=!0):c==="forever"?r=a.forever:c==="repeating"&&((t.duration_in_months||"")===1?r=a.firstPeriod:r=a.firstNMonths,s=!0),c==="trial"?l.jsxs("p",{className:"footnote","data-testid":"offer-message",children:[h("Try free for {amount} days, then {originalPrice}.",{amount:t.amount,originalPrice:i,interpolation:{escapeValue:!1}})," ",l.jsx("span",{className:"gh-portal-cancel",children:h("Cancel anytime.")})]}):l.jsxs("p",{className:"footnote","data-testid":"offer-message",children:[r," ",s?o:""]})}renderProductLabel({product:t,offer:n}){const{site:a}=this.context;return Bs({site:a})?l.jsxs("h4",{className:"gh-portal-plan-name",children:[t.name," - ",n.cadence==="month"?h("Monthly"):h("Yearly")]}):l.jsx("h4",{className:"gh-portal-plan-name",children:n.cadence==="month"?h("Monthly"):h("Yearly")})}renderUpdatedTierPrice({offer:t,currencyClass:n,updatedPrice:a,price:i}){return t.type==="trial"?l.jsx("div",{className:"gh-portal-product-card-pricecontainer offer-type-trial",children:l.jsxs("div",{className:"gh-portal-product-price","data-testid":"offer-updated-price",children:[l.jsx("span",{className:"currency-sign "+n,children:ke(i.currency)}),l.jsx("span",{className:"amount",children:aa(this.renderRoundedPrice(a))})]})}):l.jsx("div",{className:"gh-portal-product-card-pricecontainer",children:l.jsxs("div",{className:"gh-portal-product-price","data-testid":"offer-updated-price",children:[l.jsx("span",{className:"currency-sign "+n,children:ke(i.currency)}),l.jsx("span",{className:"amount",children:aa(this.renderRoundedPrice(a))})]})})}renderOldTierPrice({offer:t,price:n}){return t.type==="trial"?null:l.jsxs("div",{className:"gh-portal-offer-oldprice",children:[ke(n.currency)," ",aa(n.amount/100)]})}renderProductCard({product:t,offer:n,currencyClass:a,updatedPrice:i,price:o,benefits:r}){return this.state.showNewsletterSelection?null:l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"gh-portal-product-card top",children:l.jsxs("div",{className:"gh-portal-product-card-header",children:[l.jsxs("h4",{className:"gh-portal-product-name",children:[t.name," - ",n.cadence==="month"?h("Monthly"):h("Yearly")]}),this.renderOldTierPrice({offer:n,price:o}),this.renderUpdatedTierPrice({offer:n,currencyClass:a,updatedPrice:i,price:o}),this.renderOfferMessage({offer:n,product:t,price:o})]})}),l.jsxs("div",{children:[l.jsx("div",{className:"gh-portal-product-card bottom",children:l.jsxs("div",{className:"gh-portal-product-card-detaildata",children:[t.description?l.jsx("div",{className:"gh-portal-product-description",children:t.description}):"",r.length?this.renderBenefits({product:t}):""]})}),l.jsxs("div",{className:"gh-portal-btn-container sticky m32",children:[l.jsx("div",{className:"gh-portal-signup-terms-wrapper",children:this.renderSignupTerms()}),this.renderSubmitButton()]}),this.renderLoginMessage()]})]})}render(){const{pageData:t,site:n}=this.context;if(!t||!t.tier)return null;const a=ea({site:n,productId:t.tier.id});if(!a)return null;const i=t.cadence==="month"?a.monthlyPrice:a.yearlyPrice,o=Sb({offer:t,price:i}),r=a.benefits||[],s=ke(i.currency).length>1?"long":"";return l.jsx(l.Fragment,{children:l.jsxs("div",{className:"gh-portal-content gh-portal-offer",children:[l.jsx(pe,{}),this.renderFormHeader(),l.jsxs("div",{className:"gh-portal-offer-bar",children:[l.jsxs("div",{className:"gh-portal-offer-title",children:[t.display_title?l.jsx("h4",{"data-testid":"offer-title",children:t.display_title}):l.jsx("h4",{className:"placeholder","data-testid":"offer-title",children:h("Black Friday")}),this.renderOfferTag()]}),t.display_description?l.jsx("p",{children:t.display_description}):""]}),this.renderForm(),this.renderProductCard({product:a,offer:t,currencyClass:s,updatedPrice:o,price:i,benefits:r})]})})}};Sm.contextType=_;let am=Sm;const uk=e=>v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 48 48",...e},v.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M42 26.572h-6.2A3.43 3.43 0 0 0 33.024 28l-8.31 12.771a2.92 2.92 0 0 1-3.587.967 2.875 2.875 0 0 1-1.609-3.366l1.5-5.656a3.36 3.36 0 0 0-1.788-3.895 3.438 3.438 0 0 0-1.5-.348H9.397a3.388 3.388 0 0 1-3.251-4.367v-.02l3.24-10.815v-.029c1.32-4.248 3.585-7.146 8.044-7.146 10.682 0 10.072-1.231 22.544 5.073.679.338 1.354.682 2.027 1.03v18.1"})),dk=e=>v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 48 48",...e},v.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M6.002 21.429H12.2a3.432 3.432 0 0 0 2.777-1.43L23.29 7.23a2.916 2.916 0 0 1 3.586-.967A2.876 2.876 0 0 1 28.48 9.63l-1.497 5.652a3.36 3.36 0 0 0 1.787 3.897c.466.229.98.347 1.498.35h8.334a3.39 3.39 0 0 1 3.253 4.366v.02l-3.24 10.815v.027c-1.32 4.248-3.588 7.146-8.047 7.146-10.68 0-10.067 1.231-22.544-5.073-.675-.338-1.35-.684-2.025-1.026V18.002"})),UT=e=>v.createElement("svg",{width:96,height:56,viewBox:"0 0 96 56",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},v.createElement("path",{d:"M9.00004 34.973C9.66499 35.3085 10.3322 35.6418 11.0017 35.9729C23.3405 42.0995 22.7366 40.9062 33.3011 40.9062C37.7115 40.9062 39.954 38.0862 41.2567 33.9563V33.9296L44.4627 23.4164V23.3964C44.6151 22.9038 44.6477 22.3828 44.5578 21.8756C44.4679 21.3683 44.2581 20.8888 43.9453 20.4757C43.6324 20.0626 43.2253 19.7275 42.7565 19.4972C42.2878 19.2669 41.7706 19.1479 41.2466 19.1498H33.0026C32.489 19.1484 31.9825 19.0325 31.5211 18.8108C31.0598 18.5891 30.6558 18.2673 30.3394 17.8698C30.025 17.4718 29.8084 17.0078 29.7066 16.5141C29.6048 16.0203 29.6205 15.51 29.7525 15.0232L31.235 9.5266C31.3503 9.09972 31.3609 8.65208 31.2659 8.2204C31.171 7.78873 30.9732 7.38533 30.6888 7.0433C30.4078 6.70494 30.0511 6.43489 29.6465 6.2542C29.2418 6.07351 28.8002 5.98706 28.3559 6.00157C27.9117 6.01609 27.4769 6.13118 27.0854 6.33789C26.6938 6.5446 26.3562 6.83734 26.0987 7.19329L17.8784 19.6098C17.5652 20.0388 17.1527 20.3885 16.6749 20.6301C16.1971 20.8718 15.6678 20.9985 15.1304 20.9998H9.00004M9 17.6666L9 40.9997",stroke:"black",strokeWidth:2.85,strokeLinecap:"round",strokeLinejoin:"round"}),v.createElement("path",{d:"M86.2148 20.027C85.5499 19.6915 84.8826 19.3582 84.2132 19.0271C71.8743 12.9005 72.4782 14.0938 61.9137 14.0938C57.5034 14.0938 55.2609 16.9138 53.9581 21.0437V21.0704L50.7521 31.5836V31.6036C50.5997 32.0962 50.5672 32.6172 50.657 33.1244C50.7469 33.6317 50.9567 34.1112 51.2695 34.5243C51.5824 34.9374 51.9896 35.2725 52.4583 35.5028C52.927 35.7331 53.4442 35.8521 53.9683 35.8502H62.2123C62.7258 35.8516 63.2324 35.9675 63.6937 36.1892C64.155 36.4109 64.5591 36.7327 64.8754 37.1302C65.1899 37.5282 65.4064 37.9922 65.5082 38.4859C65.61 38.9797 65.5943 39.49 65.4624 39.9768L63.9798 45.4734C63.8646 45.9003 63.854 46.3479 63.9489 46.7796C64.0439 47.2113 64.2416 47.6147 64.526 47.9567C64.807 48.2951 65.1637 48.5651 65.5684 48.7458C65.973 48.9265 66.4147 49.0129 66.8589 48.9984C67.3031 48.9839 67.7379 48.8688 68.1295 48.6621C68.521 48.4554 68.8587 48.1627 69.1162 47.8067L77.3364 35.3902C77.6497 34.9612 78.0622 34.6115 78.5399 34.3699C79.0177 34.1282 79.547 34.0015 80.0844 34.0002H86.2148M86.2148 37.3334V14.0003",stroke:"black",strokeWidth:2.85,strokeLinecap:"round",strokeLinejoin:"round"}));function rl({siteUrl:e=window.location.origin,apiUrl:t,apiKey:n}){const a="members/api";function i({type:c,resource:u}){return`${e.replace(/\/$/,"")}/${a}/${u}/`}function o({resource:c,params:u={}}){if(t&&n){const d=new URLSearchParams({...u,key:n});return`${t.replace(/\/$/,"")}/${c}/?${d.toString()}`}return""}function r({url:c,method:u="GET",headers:d={},credentials:p=void 0,body:m=void 0}){return fetch(c,{method:u,headers:d,credentials:p,body:m})}const s={};return s.site={read(){const c=i({type:"members",resource:"site"});return r({url:c,method:"GET",headers:{"Content-Type":"application/json"}}).then(function(u){if(u.ok)return u.json();throw new Error("Failed to fetch site data")})},newsletters(){const c=o({resource:"newsletters",params:{limit:100}});return r({url:c,method:"GET",headers:{"Content-Type":"application/json"}}).then(function(u){if(u.ok)return u.json();throw new Error("Failed to fetch site data")})},tiers(){const c=o({resource:"tiers",params:{limit:100,include:"monthly_price,yearly_price,benefits"}});return r({url:c,method:"GET",headers:{"Content-Type":"application/json"}}).then(function(u){if(u.ok)return u.json();throw new Error("Failed to fetch site data")})},settings(){const c=o({resource:"settings"});return r({url:c,method:"GET",headers:{"Content-Type":"application/json"}}).then(function(u){if(u.ok)return u.json();throw new Error("Failed to fetch site data")})},offer({offerId:c}){const u=o({resource:`offers/${c}`});return r({url:u,method:"GET",headers:{"Content-Type":"application/json"}}).then(function(d){if(d.ok)return d.json();throw new Error("Failed to fetch offer data")})},recommendations({limit:c=100}={limit:100}){const u=o({resource:"recommendations",params:{limit:c}});return r({url:u,method:"GET",headers:{"Content-Type":"application/json"}}).then(function(d){if(d.ok)return d.json();throw new Error("Failed to fetch recommendations")})}},s.feedback={async add({uuid:c,key:u,postId:d,score:p}){let m=i({type:"members",resource:"feedback"});c&&u&&(m=m+`?uuid=${c}&key=${u}`);const b=await r({url:m,method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({feedback:[{post_id:d,score:p}]})});if(b.ok)return b.json();throw await xt.fromApiResponse(b)??new Error("Failed to save feedback")}},s.gift={async fetchRedemptionData({token:c}){const u=i({type:"members",resource:`gifts/${encodeURIComponent(c)}/redeem`}),d=await r({url:u,method:"GET",headers:{"Content-Type":"application/json"},credentials:"same-origin"});if(d.ok)return d.json();const p=await xt.fromApiResponse(d);throw p||new Error("Failed to load gift data")}},s.recommendations={trackClicked({recommendationId:c}){let u=i({type:"members",resource:"recommendations/"+c+"/clicked"});navigator.sendBeacon(u)},trackSubscribed({recommendationId:c}){let u=i({type:"members",resource:"recommendations/"+c+"/subscribed"});navigator.sendBeacon(u)}},s.member={identity(){const c=i({type:"members",resource:"session"});return r({url:c,credentials:"same-origin"}).then(function(u){return!u.ok||u.status===204?null:u.text()})},sessionData(){const c=i({type:"members",resource:"member"});return r({url:c,credentials:"same-origin"}).then(function(u){return!u.ok||u.status===204?null:u.json()})},update({name:c,subscribed:u,newsletters:d,enableCommentNotifications:p}){const m=i({type:"members",resource:"member"}),f={name:c,subscribed:u,newsletters:d};return p!==void 0&&(f.enable_comment_notifications=p),r({url:m,method:"PUT",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(f)}).then(function(b){return b.ok?b.json():null})},deleteSuppression(){const c=i({type:"members",resource:"member/suppression"});return r({url:c,method:"DELETE"}).then(function(u){if(!u.ok)throw new Error("Your email has failed to resubscribe, please try again");return!0})},async getIntegrityToken(){const c=i({type:"members",resource:"integrity-token"}),u=await r({url:c,method:"GET"});if(u.ok)return u.text();{const d=await xt.fromApiResponse(u);throw d||new Error("Failed to start a members session")}},async sendMagicLink({email:c,emailType:u,labels:d,name:p,oldEmail:m,newsletters:f,redirect:b,integrityToken:w,phonenumber:g,customUrlHistory:y,token:k,autoRedirect:C=!0,includeOTC:x}){const T=i({type:"members",resource:"send-magic-link"}),E={name:p,email:c,newsletters:f,oldEmail:m,emailType:u,labels:d,requestSrc:"portal",redirect:b,integrityToken:w,honeypot:g,token:k,autoRedirect:C,includeOTC:x},N=y??No();N&&(E.urlHistory=N);const z=await r({url:T,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(E)});if(z.ok){if((z.headers.get("content-type")||"").toLowerCase().includes("application/json"))try{return await z.json()}catch{}return{}}else{const j=await xt.fromApiResponse(z);throw j||new Error("Failed to send magic link email")}},async verifyOTC({otc:c,otcRef:u,redirect:d,integrityToken:p}){const m=i({type:"members",resource:"verify-otc"}),b=await r({url:m,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({otc:c,otcRef:u,redirect:d,integrityToken:p})});if(b.ok)return await b.json();{const w=await xt.fromApiResponse(b);throw w||new Error("Failed to verify code")}},signout(c=!1){const u=i({type:"members",resource:"session"});return r({url:u,method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:c})}).then(function(d){if(d.ok)return window.location.replace(e),"Success";throw new Error("Failed to signout")})},async newsletters({uuid:c,key:u}){let d=i({type:"members",resource:"member/newsletters"});return d=d+`?uuid=${c}&key=${u}`,r({url:d,credentials:"same-origin"}).then(function(p){return!p.ok||p.status===204?null:p.json()})},async updateNewsletters({uuid:c,newsletters:u,key:d,enableCommentNotifications:p}){let m=i({type:"members",resource:"member/newsletters"});m=m+`?uuid=${c}&key=${d}`;const f={newsletters:u};return p!==void 0&&(f.enable_comment_notifications=p),r({url:m,method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)}).then(function(b){if(b.ok)return b.json();throw new Error("Failed to update email preferences")})},async updateEmailAddress({email:c}){const u=await s.member.identity(),d=i({type:"members",resource:"member/email"});return r({url:d,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:c,identity:u})}).then(async function(m){var f,b;if(m.ok)return"Success";{const w=await m.json(),g=((b=(f=w==null?void 0:w.errors)==null?void 0:f[0])==null?void 0:b.message)||"Failed to send email address verification email";throw new Error(g)}})},async checkoutPlan({plan:c,tierId:u,cadence:d,cancelUrl:p,successUrl:m,email:f,name:b,offerId:w,newsletters:g,metadata:y={}}={}){var N,z;const k=new URL(e),C=await s.member.identity(),x=i({type:"members",resource:"create-stripe-checkout-session"});if(!p){const j=window.location.href.startsWith(k.href)?new URL(window.location.href):new URL(e);j.searchParams.set("stripe","cancel"),p=j.href}const T={name:b,newsletters:JSON.stringify(g),requestSrc:"portal",fp_tid:(z=(N=window.FPROM||window.$FPROM)==null?void 0:N.data)==null?void 0:z.tid,urlHistory:No(),...y},E={priceId:w?null:c,offerId:w,identity:C,metadata:T,successUrl:m,cancelUrl:p};return f&&(E.customerEmail=f),u&&d&&(delete E.priceId,E.tierId=w?null:u,E.cadence=w?null:d),r({url:x,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(E)}).then(async function(j){var V,q;if(!j.ok){const ce=await j.json(),ae=((q=(V=ce==null?void 0:ce.errors)==null?void 0:V[0])==null?void 0:q.message)||"Failed to signup, please try again.";throw new Error(ae)}return j.json()}).then(function(j){return j.url?window.location.assign(j.url):window.Stripe(j.publicKey).redirectToCheckout({sessionId:j.sessionId}).then(function(q){if(q.error)throw new Error(q.error.message)})})},async checkoutGift({tierId:c,cadence:u,email:d}={}){var g;const p=i({type:"members",resource:"create-stripe-checkout-session"});let m=null;try{m=await s.member.identity()}catch{}const b=await r({url:p,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:m,metadata:{requestSrc:"portal"},type:"gift",tierId:c,cadence:u,customerEmail:d})});let w={};try{w=await b.json()}catch{}if(!b.ok){const y=(g=w==null?void 0:w.errors)==null?void 0:g[0];throw y||new Error("Failed to process gift checkout, please try again.")}if(w.url)return window.location.assign(w.url);throw new Error("Failed to process gift checkout, please try again.")},async checkoutDonation({successUrl:c,cancelUrl:u,metadata:d={},personalNote:p=""}={}){var k,C,x;const m=await s.member.identity(),f=i({type:"members",resource:"create-stripe-checkout-session"}),b={fp_tid:(C=(k=window.FPROM||window.$FPROM)==null?void 0:k.data)==null?void 0:C.tid,urlHistory:No(),...d},g=await r({url:f,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:m,metadata:b,successUrl:c,cancelUrl:u,type:"donation",personalNote:p})}),y=await g.json();if(!g.ok){const T=(x=y==null?void 0:y.errors)==null?void 0:x[0];throw T||new Error("We're unable to process your payment right now. Please try again later.")}return y},async editBilling({successUrl:c,cancelUrl:u,subscriptionId:d}={}){const p=new URL(e),m=await s.member.identity(),f=i({type:"members",resource:"create-stripe-update-session"});if(!c){const b=new URL(e);b.searchParams.set("stripe","billing-update-success"),c=b.href}if(!u){const b=window.location.href.startsWith(p.href)?new URL(window.location.href):new URL(e);b.searchParams.set("stripe","billing-update-cancel"),u=b.href}return r({url:f,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:m,subscription_id:d,successUrl:c,cancelUrl:u})}).then(function(b){if(!b.ok)throw new Error("Unable to create stripe checkout session");return b.json()}).then(function(b){return window.Stripe(b.publicKey).redirectToCheckout({sessionId:b.sessionId})}).then(function(b){if(b.error)throw new Error(b.error.message)}).catch(function(b){throw b})},async manageBilling({returnUrl:c,subscriptionId:u}={}){const d=await s.member.identity(),p=i({type:"members",resource:"create-stripe-billing-portal-session"});if(!c){const m=new URL(e);m.searchParams.set("stripe","billing-portal-closed"),c=m.href}return r({url:p,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:d,subscription_id:u,returnUrl:c})}).then(function(m){if(!m.ok)throw new Error("Unable to create Stripe billing portal session");return m.json()}).then(function(m){return window.location.assign(m.url)}).catch(function(m){throw m})},async updateSubscription({subscriptionId:c,tierId:u,cadence:d,planId:p,smartCancel:m,cancelAtPeriodEnd:f,cancellationReason:b}){const w=await s.member.identity(),g=i({type:"members",resource:"subscriptions"})+c+"/",y={smart_cancel:m,cancel_at_period_end:f,cancellation_reason:b,identity:w,priceId:p};return u&&d&&(delete y.priceId,y.tierId=u,y.cadence=d),r({url:g,method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(y)})},async offers(){const c=await s.member.identity(),u=i({type:"members",resource:"member/offers"});return r({url:u,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:c})}).then(function(d){return d.ok?d.json():{offers:[]}}).catch(function(){return{offers:[]}})},async applyOffer({offerId:c,subscriptionId:u}){const d=await s.member.identity(),p=i({type:"members",resource:`subscriptions/${u}/apply-offer`}),m=await r({url:p,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:d,offer_id:c})});if(!m.ok){const f=await m.text();throw new Error(f||"Failed to apply offer")}return!0}},s.init=async()=>{let[c]=await Promise.all([s.member.sessionData()]),u={},d=[],p=[],m={},f=[];try{[{settings:m},{tiers:p},{newsletters:d}]=await Promise.all([s.site.settings(),s.site.tiers(),s.site.newsletters()]),u={...m,newsletters:d,tiers:V0({tiers:p})}}catch{}if(c&&c.paid)try{f=(await s.member.offers()).offers||[]}catch(b){console.warn("[Portal] Failed to load member offers:",b)}return u=T0({site:u}),{site:u,member:c,offers:f}},s}class ai extends Z.Component{render(){return l.jsx("div",{style:{display:"flex",flexDirection:"column",color:"#313131"},children:l.jsx("div",{style:{paddingLeft:"16px",paddingRight:"16px",paddingTop:"12px",height:"50px"},children:l.jsx(Xa,{className:"gh-portal-loadingicon dark","data-testid":"loaderIcon"})})})}}const HT=`
|
|
1954
|
+
`,Sm=class Sm extends Z.Component{constructor(t,n){var a,i;super(t,n),this.state={name:((a=n==null?void 0:n.member)==null?void 0:a.name)||"",email:((i=n==null?void 0:n.member)==null?void 0:i.email)||"",plan:"free",showNewsletterSelection:!1,termsCheckboxChecked:!1}}getFormErrors(t){const a=this.context.site.portal_signup_checkbox_required&&this.context.site.portal_signup_terms_html&&!t.termsCheckboxChecked;return{...Oo({fields:this.getInputFields({state:t})}),checkbox:a}}getInputFields({state:t,fieldNames:n}){const{portal_name:a}=this.context.site,{member:i}=this.context,o=t.errors||{},r=[{type:"email",value:(i==null?void 0:i.email)||t.email,placeholder:h("jamie@example.com"),label:h("Email"),name:"email",disabled:!!i,required:!0,tabIndex:2,errorMessage:o.email||""}];let s=!!a;return i&&!(i!=null&&i.name)&&(s=!1),s&&r.unshift({type:"text",value:(i==null?void 0:i.name)||t.name,placeholder:h("Jamie Larson"),label:h("Name"),name:"name",disabled:!!i,required:!0,tabIndex:1,errorMessage:o.name||""}),r[0].autoFocus=!0,n&&n.length>0?r.filter(c=>n.includes(c.name)):r}renderSignupTerms(){var s;const{site:t}=this.context;if(t.portal_signup_terms_html===null||t.portal_signup_terms_html==="")return null;const n=c=>{this.setState({termsCheckboxChecked:c.target.checked})},a=l.jsx("div",{className:"gh-portal-signup-terms-content",dangerouslySetInnerHTML:{__html:sk(t.portal_signup_terms_html)}}),i=t.portal_signup_checkbox_required?l.jsxs("label",{children:[l.jsx("input",{type:"checkbox",checked:!!this.state.termsCheckboxChecked,required:!0,onChange:n}),l.jsx("span",{className:"checkbox"}),a]}):a,r=`gh-portal-signup-terms ${(s=this.state.errors)!=null&&s.checkbox?"gh-portal-error":""}`;return l.jsx("div",{className:r,onClick:Kb,children:i})}onKeyDown(t){t.keyCode===13&&this.handleSignup(t)}handleSignup(t){t.preventDefault();const{pageData:n,site:a}=this.context;if(!n||!n.tier)return null;const i=ea({site:a,productId:n.tier.id}),o=n.cadence==="month"?i.monthlyPrice:i.yearlyPrice;this.setState(r=>({errors:this.getFormErrors(r)}),()=>{const{doAction:r}=this.context,{name:s,email:c,phonenumber:u,errors:d}=this.state;if(!(d&&Object.values(d).filter(m=>!!m).length>0)){const m={name:s,email:c,plan:o==null?void 0:o.id,offerId:n==null?void 0:n.id,phonenumber:u};zo({site:a})?this.setState({showNewsletterSelection:!0,pageData:m,errors:{}}):(r("signup",m),this.setState({errors:{}}))}})}handleInputChange(t,n){const a=n.name,i=t.target.value;this.setState({[a]:i})}renderSiteLogo(){const{site:t}=this.context,n=t.icon;return n?l.jsx("img",{className:"gh-portal-signup-logo",src:n,alt:t.title}):null}renderFormHeader(){const{site:t}=this.context,n=t.title||"";return l.jsxs("header",{className:"gh-portal-signup-header",children:[this.renderSiteLogo(),l.jsx("h2",{className:"gh-portal-main-title",children:n})]})}renderForm(){const t=this.getInputFields({state:this.state});return this.state.showNewsletterSelection?l.jsx(Ud,{pageData:this.state.pageData,onBack:()=>{this.setState({showNewsletterSelection:!1})}}):l.jsx("section",{children:l.jsx("div",{className:"gh-portal-section",children:l.jsx(ti,{fields:t,onChange:(n,a)=>this.handleInputChange(n,a),onKeyDown:n=>this.onKeyDown(n)})})})}renderSubmitButton(){const{action:t,brandColor:n}=this.context,{pageData:a}=this.context;let i=h("Continue");a.type==="trial"&&(i=h("Start {amount}-day free trial",{amount:a.amount}));let o=!1;t==="signup:running"&&(i=h("Sending..."),o=!0);let r=!1;t==="signup:failed"&&(i=h("Retry"),r=!0);const s=t==="signup:running";return l.jsx(me,{style:{width:"100%"},retry:r,onClick:c=>this.handleSignup(c),disabled:s,brandColor:n,label:i,isRunning:o,tabIndex:3,classes:"sticky bottom"})}renderLoginMessage(){const{member:t}=this.context;if(t)return null;const{brandColor:n,doAction:a}=this.context;return l.jsxs("div",{className:"gh-portal-signup-message",children:[l.jsx("div",{children:h("Already a member?")}),l.jsx("button",{className:"gh-portal-btn gh-portal-btn-link",style:{color:n},onClick:()=>a("switchPage",{page:"signin"}),children:l.jsx("span",{children:h("Sign in")})})]})}renderOfferTag(){const{pageData:t}=this.context;return t.amount<=0?l.jsx(l.Fragment,{}):t.type==="fixed"?l.jsx("h5",{className:"gh-portal-discount-label","data-testid":"offer-discount-label",children:h("{amount} off",{amount:`${ke(t.currency)}${t.amount/100}`})}):t.type==="trial"?l.jsx("h5",{className:"gh-portal-discount-label","data-testid":"offer-discount-label",children:h("{amount} days free",{amount:t.amount})}):l.jsx("h5",{className:"gh-portal-discount-label","data-testid":"offer-discount-label",children:h("{amount} off",{amount:t.amount+"%"})})}renderBenefits({product:t}){const n=t.benefits||[];if(!(n!=null&&n.length))return;const a=n.map((i,o)=>l.jsxs("div",{className:"gh-portal-product-benefit",children:[l.jsx(Do,{className:"gh-portal-benefit-checkmark"}),l.jsx("div",{className:"gh-portal-benefit-title",children:i.name})]},`${i.name}-${o}`));return l.jsx("div",{className:"gh-portal-product-benefits",children:a})}getOriginalPrice({offer:t,product:n}){const a=t.cadence==="month"?n.monthlyPrice:n.yearlyPrice,i=this.renderRoundedPrice(a.amount/100);return`${ke(a.currency)}${i}/${Za(t.cadence)}`}renderRoundedPrice(t){if(t%1!==0){const n=Math.round(t*100)/100;return Number(n).toFixed(2)}return t}getOffAmount({offer:t}){return t.type==="fixed"?`${ke(t.currency)}${t.amount/100}`:t.type==="percent"?`${t.amount}%`:t.type==="trial"?t.amount:""}renderOfferMessage({offer:t,product:n}){const a={forever:h("{amount} off forever.",{amount:this.getOffAmount({offer:t})}),firstPeriod:h("{amount} off for first {period}.",{amount:this.getOffAmount({offer:t}),period:Za(t.cadence)}),firstNMonths:h("{amount} off for first {number} months.",{amount:this.getOffAmount({offer:t}),number:t.duration_in_months||""})},i=this.getOriginalPrice({offer:t,product:n}),o=h("Renews at {price}.",{price:i,interpolation:{escapeValue:!1}});let r="",s=!1;const c=t.duration;return c==="once"?(r=a.firstPeriod,s=!0):c==="forever"?r=a.forever:c==="repeating"&&((t.duration_in_months||"")===1?r=a.firstPeriod:r=a.firstNMonths,s=!0),c==="trial"?l.jsxs("p",{className:"footnote","data-testid":"offer-message",children:[h("Try free for {amount} days, then {originalPrice}.",{amount:t.amount,originalPrice:i,interpolation:{escapeValue:!1}})," ",l.jsx("span",{className:"gh-portal-cancel",children:h("Cancel anytime.")})]}):l.jsxs("p",{className:"footnote","data-testid":"offer-message",children:[r," ",s?o:""]})}renderProductLabel({product:t,offer:n}){const{site:a}=this.context;return Bs({site:a})?l.jsxs("h4",{className:"gh-portal-plan-name",children:[t.name," - ",n.cadence==="month"?h("Monthly"):h("Yearly")]}):l.jsx("h4",{className:"gh-portal-plan-name",children:n.cadence==="month"?h("Monthly"):h("Yearly")})}renderUpdatedTierPrice({offer:t,currencyClass:n,updatedPrice:a,price:i}){return t.type==="trial"?l.jsx("div",{className:"gh-portal-product-card-pricecontainer offer-type-trial",children:l.jsxs("div",{className:"gh-portal-product-price","data-testid":"offer-updated-price",children:[l.jsx("span",{className:"currency-sign "+n,children:ke(i.currency)}),l.jsx("span",{className:"amount",children:aa(this.renderRoundedPrice(a))})]})}):l.jsx("div",{className:"gh-portal-product-card-pricecontainer",children:l.jsxs("div",{className:"gh-portal-product-price","data-testid":"offer-updated-price",children:[l.jsx("span",{className:"currency-sign "+n,children:ke(i.currency)}),l.jsx("span",{className:"amount",children:aa(this.renderRoundedPrice(a))})]})})}renderOldTierPrice({offer:t,price:n}){return t.type==="trial"?null:l.jsxs("div",{className:"gh-portal-offer-oldprice",children:[ke(n.currency)," ",aa(n.amount/100)]})}renderProductCard({product:t,offer:n,currencyClass:a,updatedPrice:i,price:o,benefits:r}){return this.state.showNewsletterSelection?null:l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"gh-portal-product-card top",children:l.jsxs("div",{className:"gh-portal-product-card-header",children:[l.jsxs("h4",{className:"gh-portal-product-name",children:[t.name," - ",n.cadence==="month"?h("Monthly"):h("Yearly")]}),this.renderOldTierPrice({offer:n,price:o}),this.renderUpdatedTierPrice({offer:n,currencyClass:a,updatedPrice:i,price:o}),this.renderOfferMessage({offer:n,product:t,price:o})]})}),l.jsxs("div",{children:[l.jsx("div",{className:"gh-portal-product-card bottom",children:l.jsxs("div",{className:"gh-portal-product-card-detaildata",children:[t.description?l.jsx("div",{className:"gh-portal-product-description",children:t.description}):"",r.length?this.renderBenefits({product:t}):""]})}),l.jsxs("div",{className:"gh-portal-btn-container sticky m32",children:[l.jsx("div",{className:"gh-portal-signup-terms-wrapper",children:this.renderSignupTerms()}),this.renderSubmitButton()]}),this.renderLoginMessage()]})]})}render(){const{pageData:t,site:n}=this.context;if(!t||!t.tier)return null;const a=ea({site:n,productId:t.tier.id});if(!a)return null;const i=t.cadence==="month"?a.monthlyPrice:a.yearlyPrice,o=Sb({offer:t,price:i}),r=a.benefits||[],s=ke(i.currency).length>1?"long":"";return l.jsx(l.Fragment,{children:l.jsxs("div",{className:"gh-portal-content gh-portal-offer",children:[l.jsx(pe,{}),this.renderFormHeader(),l.jsxs("div",{className:"gh-portal-offer-bar",children:[l.jsxs("div",{className:"gh-portal-offer-title",children:[t.display_title?l.jsx("h4",{"data-testid":"offer-title",children:t.display_title}):l.jsx("h4",{className:"placeholder","data-testid":"offer-title",children:h("Black Friday")}),this.renderOfferTag()]}),t.display_description?l.jsx("p",{children:t.display_description}):""]}),this.renderForm(),this.renderProductCard({product:a,offer:t,currencyClass:s,updatedPrice:o,price:i,benefits:r})]})})}};Sm.contextType=_;let am=Sm;const uk=e=>v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 48 48",...e},v.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M42 26.572h-6.2A3.43 3.43 0 0 0 33.024 28l-8.31 12.771a2.92 2.92 0 0 1-3.587.967 2.875 2.875 0 0 1-1.609-3.366l1.5-5.656a3.36 3.36 0 0 0-1.788-3.895 3.438 3.438 0 0 0-1.5-.348H9.397a3.388 3.388 0 0 1-3.251-4.367v-.02l3.24-10.815v-.029c1.32-4.248 3.585-7.146 8.044-7.146 10.682 0 10.072-1.231 22.544 5.073.679.338 1.354.682 2.027 1.03v18.1"})),dk=e=>v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 48 48",...e},v.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M6.002 21.429H12.2a3.432 3.432 0 0 0 2.777-1.43L23.29 7.23a2.916 2.916 0 0 1 3.586-.967A2.876 2.876 0 0 1 28.48 9.63l-1.497 5.652a3.36 3.36 0 0 0 1.787 3.897c.466.229.98.347 1.498.35h8.334a3.39 3.39 0 0 1 3.253 4.366v.02l-3.24 10.815v.027c-1.32 4.248-3.588 7.146-8.047 7.146-10.68 0-10.067 1.231-22.544-5.073-.675-.338-1.35-.684-2.025-1.026V18.002"})),UT=e=>v.createElement("svg",{width:96,height:56,viewBox:"0 0 96 56",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},v.createElement("path",{d:"M9.00004 34.973C9.66499 35.3085 10.3322 35.6418 11.0017 35.9729C23.3405 42.0995 22.7366 40.9062 33.3011 40.9062C37.7115 40.9062 39.954 38.0862 41.2567 33.9563V33.9296L44.4627 23.4164V23.3964C44.6151 22.9038 44.6477 22.3828 44.5578 21.8756C44.4679 21.3683 44.2581 20.8888 43.9453 20.4757C43.6324 20.0626 43.2253 19.7275 42.7565 19.4972C42.2878 19.2669 41.7706 19.1479 41.2466 19.1498H33.0026C32.489 19.1484 31.9825 19.0325 31.5211 18.8108C31.0598 18.5891 30.6558 18.2673 30.3394 17.8698C30.025 17.4718 29.8084 17.0078 29.7066 16.5141C29.6048 16.0203 29.6205 15.51 29.7525 15.0232L31.235 9.5266C31.3503 9.09972 31.3609 8.65208 31.2659 8.2204C31.171 7.78873 30.9732 7.38533 30.6888 7.0433C30.4078 6.70494 30.0511 6.43489 29.6465 6.2542C29.2418 6.07351 28.8002 5.98706 28.3559 6.00157C27.9117 6.01609 27.4769 6.13118 27.0854 6.33789C26.6938 6.5446 26.3562 6.83734 26.0987 7.19329L17.8784 19.6098C17.5652 20.0388 17.1527 20.3885 16.6749 20.6301C16.1971 20.8718 15.6678 20.9985 15.1304 20.9998H9.00004M9 17.6666L9 40.9997",stroke:"black",strokeWidth:2.85,strokeLinecap:"round",strokeLinejoin:"round"}),v.createElement("path",{d:"M86.2148 20.027C85.5499 19.6915 84.8826 19.3582 84.2132 19.0271C71.8743 12.9005 72.4782 14.0938 61.9137 14.0938C57.5034 14.0938 55.2609 16.9138 53.9581 21.0437V21.0704L50.7521 31.5836V31.6036C50.5997 32.0962 50.5672 32.6172 50.657 33.1244C50.7469 33.6317 50.9567 34.1112 51.2695 34.5243C51.5824 34.9374 51.9896 35.2725 52.4583 35.5028C52.927 35.7331 53.4442 35.8521 53.9683 35.8502H62.2123C62.7258 35.8516 63.2324 35.9675 63.6937 36.1892C64.155 36.4109 64.5591 36.7327 64.8754 37.1302C65.1899 37.5282 65.4064 37.9922 65.5082 38.4859C65.61 38.9797 65.5943 39.49 65.4624 39.9768L63.9798 45.4734C63.8646 45.9003 63.854 46.3479 63.9489 46.7796C64.0439 47.2113 64.2416 47.6147 64.526 47.9567C64.807 48.2951 65.1637 48.5651 65.5684 48.7458C65.973 48.9265 66.4147 49.0129 66.8589 48.9984C67.3031 48.9839 67.7379 48.8688 68.1295 48.6621C68.521 48.4554 68.8587 48.1627 69.1162 47.8067L77.3364 35.3902C77.6497 34.9612 78.0622 34.6115 78.5399 34.3699C79.0177 34.1282 79.547 34.0015 80.0844 34.0002H86.2148M86.2148 37.3334V14.0003",stroke:"black",strokeWidth:2.85,strokeLinecap:"round",strokeLinejoin:"round"}));function rl({siteUrl:e=window.location.origin,apiUrl:t,apiKey:n}){const a="members/api";function i({type:c,resource:u}){return`${e.replace(/\/$/,"")}/${a}/${u}/`}function o({resource:c,params:u={}}){if(t&&n){const d=new URLSearchParams({...u,key:n});return`${t.replace(/\/$/,"")}/${c}/?${d.toString()}`}return""}function r({url:c,method:u="GET",headers:d={},credentials:p=void 0,body:m=void 0}){return fetch(c,{method:u,headers:d,credentials:p,body:m})}const s={};return s.site={read(){const c=i({type:"members",resource:"site"});return r({url:c,method:"GET",headers:{"Content-Type":"application/json"}}).then(function(u){if(u.ok)return u.json();throw new Error("Failed to fetch site data")})},newsletters(){const c=o({resource:"newsletters",params:{limit:100}});return r({url:c,method:"GET",headers:{"Content-Type":"application/json"}}).then(function(u){if(u.ok)return u.json();throw new Error("Failed to fetch site data")})},tiers(){const c=o({resource:"tiers",params:{limit:100,include:"monthly_price,yearly_price,benefits"}});return r({url:c,method:"GET",headers:{"Content-Type":"application/json"}}).then(function(u){if(u.ok)return u.json();throw new Error("Failed to fetch site data")})},settings(){const c=o({resource:"settings"});return r({url:c,method:"GET",headers:{"Content-Type":"application/json"}}).then(function(u){if(u.ok)return u.json();throw new Error("Failed to fetch site data")})},offer({offerId:c}){const u=o({resource:`offers/${c}`});return r({url:u,method:"GET",headers:{"Content-Type":"application/json"}}).then(function(d){if(d.ok)return d.json();throw new Error("Failed to fetch offer data")})},recommendations({limit:c=100}={limit:100}){const u=o({resource:"recommendations",params:{limit:c}});return r({url:u,method:"GET",headers:{"Content-Type":"application/json"}}).then(function(d){if(d.ok)return d.json();throw new Error("Failed to fetch recommendations")})}},s.feedback={async add({uuid:c,key:u,postId:d,score:p}){let m=i({type:"members",resource:"feedback"});c&&u&&(m=m+`?uuid=${c}&key=${u}`);const b=await r({url:m,method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({feedback:[{post_id:d,score:p}]})});if(b.ok)return b.json();throw await xt.fromApiResponse(b)??new Error("Failed to save feedback")}},s.gift={async fetchRedemptionData({token:c}){const u=i({type:"members",resource:`gifts/${encodeURIComponent(c)}/redeem`}),d=await r({url:u,method:"GET",headers:{"Content-Type":"application/json"},credentials:"same-origin"});if(d.ok)return d.json();const p=await xt.fromApiResponse(d);throw p||new Error("Failed to load gift data")}},s.recommendations={trackClicked({recommendationId:c}){let u=i({type:"members",resource:"recommendations/"+c+"/clicked"});navigator.sendBeacon(u)},trackSubscribed({recommendationId:c}){let u=i({type:"members",resource:"recommendations/"+c+"/subscribed"});navigator.sendBeacon(u)}},s.member={identity(){const c=i({type:"members",resource:"session"});return r({url:c,credentials:"same-origin"}).then(function(u){return!u.ok||u.status===204?null:u.text()})},sessionData(){const c=i({type:"members",resource:"member"});return r({url:c,credentials:"same-origin"}).then(function(u){return!u.ok||u.status===204?null:u.json()})},update({name:c,subscribed:u,newsletters:d,enableCommentNotifications:p}){const m=i({type:"members",resource:"member"}),f={name:c,subscribed:u,newsletters:d};return p!==void 0&&(f.enable_comment_notifications=p),r({url:m,method:"PUT",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(f)}).then(function(b){return b.ok?b.json():null})},deleteSuppression(){const c=i({type:"members",resource:"member/suppression"});return r({url:c,method:"DELETE"}).then(function(u){if(!u.ok)throw new Error("Your email has failed to resubscribe, please try again");return!0})},async getIntegrityToken(){const c=i({type:"members",resource:"integrity-token"}),u=await r({url:c,method:"GET"});if(u.ok)return u.text();{const d=await xt.fromApiResponse(u);throw d||new Error("Failed to start a members session")}},async sendMagicLink({email:c,emailType:u,labels:d,name:p,oldEmail:m,newsletters:f,redirect:b,integrityToken:w,phonenumber:g,customUrlHistory:y,token:k,autoRedirect:C=!0,includeOTC:x}){const T=i({type:"members",resource:"send-magic-link"}),E={name:p,email:c,newsletters:f,oldEmail:m,emailType:u,labels:d,requestSrc:"portal",redirect:b,integrityToken:w,honeypot:g,token:k,autoRedirect:C,includeOTC:x},N=y??No();N&&(E.urlHistory=N);const z=await r({url:T,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(E)});if(z.ok){if((z.headers.get("content-type")||"").toLowerCase().includes("application/json"))try{return await z.json()}catch{}return{}}else{const j=await xt.fromApiResponse(z);throw j||new Error("Failed to send magic link email")}},async verifyOTC({otc:c,otcRef:u,redirect:d,integrityToken:p}){const m=i({type:"members",resource:"verify-otc"}),b=await r({url:m,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({otc:c,otcRef:u,redirect:d,integrityToken:p})});if(b.ok)return await b.json();{const w=await xt.fromApiResponse(b);throw w||new Error("Failed to verify code")}},signout(c=!1){const u=i({type:"members",resource:"session"});return r({url:u,method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:c})}).then(function(d){if(d.ok)return window.location.replace(e),"Success";throw new Error("Failed to signout")})},async newsletters({uuid:c,key:u}){let d=i({type:"members",resource:"member/newsletters"});return d=d+`?uuid=${c}&key=${u}`,r({url:d,credentials:"same-origin"}).then(function(p){return!p.ok||p.status===204?null:p.json()})},async updateNewsletters({uuid:c,newsletters:u,key:d,enableCommentNotifications:p}){let m=i({type:"members",resource:"member/newsletters"});m=m+`?uuid=${c}&key=${d}`;const f={newsletters:u};return p!==void 0&&(f.enable_comment_notifications=p),r({url:m,method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)}).then(function(b){if(b.ok)return b.json();throw new Error("Failed to update email preferences")})},async updateEmailAddress({email:c}){const u=await s.member.identity(),d=i({type:"members",resource:"member/email"});return r({url:d,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:c,identity:u})}).then(async function(m){var f,b;if(m.ok)return"Success";{const w=await m.json(),g=((b=(f=w==null?void 0:w.errors)==null?void 0:f[0])==null?void 0:b.message)||"Failed to send email address verification email";throw new Error(g)}})},async checkoutPlan({plan:c,tierId:u,cadence:d,cancelUrl:p,successUrl:m,email:f,name:b,offerId:w,newsletters:g,metadata:y={}}={}){var N,z;const k=new URL(e),C=await s.member.identity(),x=i({type:"members",resource:"create-stripe-checkout-session"});if(!p){const j=window.location.href.startsWith(k.href)?new URL(window.location.href):new URL(e);j.searchParams.set("stripe","cancel"),p=j.href}const T={name:b,newsletters:JSON.stringify(g),requestSrc:"portal",fp_tid:(z=(N=window.FPROM||window.$FPROM)==null?void 0:N.data)==null?void 0:z.tid,urlHistory:No(),...y},E={priceId:w?null:c,offerId:w,identity:C,metadata:T,successUrl:m,cancelUrl:p};return f&&(E.customerEmail=f),u&&d&&(delete E.priceId,E.tierId=w?null:u,E.cadence=w?null:d),r({url:x,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(E)}).then(async function(j){var V,q;if(!j.ok){const ce=await j.json(),ae=((q=(V=ce==null?void 0:ce.errors)==null?void 0:V[0])==null?void 0:q.message)||"Failed to signup, please try again.";throw new Error(ae)}return j.json()}).then(function(j){return j.url?window.location.assign(j.url):window.Stripe(j.publicKey).redirectToCheckout({sessionId:j.sessionId}).then(function(q){if(q.error)throw new Error(q.error.message)})})},async checkoutGift({tierId:c,cadence:u,email:d}={}){var g;const p=i({type:"members",resource:"create-stripe-checkout-session"});let m=null;try{m=await s.member.identity()}catch{}const b=await r({url:p,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:m,metadata:{requestSrc:"portal"},type:"gift",tierId:c,cadence:u,customerEmail:d})});let w={};try{w=await b.json()}catch{}if(!b.ok){const y=(g=w==null?void 0:w.errors)==null?void 0:g[0];throw y||new Error("Failed to process gift checkout, please try again.")}if(w.url)return window.location.assign(w.url);throw new Error("Failed to process gift checkout, please try again.")},async checkoutDonation({successUrl:c,cancelUrl:u,metadata:d={},personalNote:p=""}={}){var k,C,x;const m=await s.member.identity(),f=i({type:"members",resource:"create-stripe-checkout-session"}),b={fp_tid:(C=(k=window.FPROM||window.$FPROM)==null?void 0:k.data)==null?void 0:C.tid,urlHistory:No(),...d},g=await r({url:f,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:m,metadata:b,successUrl:c,cancelUrl:u,type:"donation",personalNote:p})}),y=await g.json();if(!g.ok){const T=(x=y==null?void 0:y.errors)==null?void 0:x[0];throw T||new Error("We're unable to process your payment right now. Please try again later.")}return y},async editBilling({successUrl:c,cancelUrl:u,subscriptionId:d}={}){const p=new URL(e),m=await s.member.identity(),f=i({type:"members",resource:"create-stripe-update-session"});if(!c){const b=new URL(e);b.searchParams.set("stripe","billing-update-success"),c=b.href}if(!u){const b=window.location.href.startsWith(p.href)?new URL(window.location.href):new URL(e);b.searchParams.set("stripe","billing-update-cancel"),u=b.href}return r({url:f,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:m,subscription_id:d,successUrl:c,cancelUrl:u})}).then(function(b){if(!b.ok)throw new Error("Unable to create stripe checkout session");return b.json()}).then(function(b){return window.Stripe(b.publicKey).redirectToCheckout({sessionId:b.sessionId})}).then(function(b){if(b.error)throw new Error(b.error.message)}).catch(function(b){throw b})},async manageBilling({returnUrl:c,subscriptionId:u}={}){const d=await s.member.identity(),p=i({type:"members",resource:"create-stripe-billing-portal-session"});if(!c){const m=new URL(e);m.searchParams.set("stripe","billing-portal-closed"),c=m.href}return r({url:p,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:d,subscription_id:u,returnUrl:c})}).then(function(m){if(!m.ok)throw new Error("Unable to create Stripe billing portal session");return m.json()}).then(function(m){return window.location.assign(m.url)}).catch(function(m){throw m})},async updateSubscription({subscriptionId:c,tierId:u,cadence:d,planId:p,smartCancel:m,cancelAtPeriodEnd:f,cancellationReason:b}){const w=await s.member.identity(),g=i({type:"members",resource:"subscriptions"})+c+"/",y={smart_cancel:m,cancel_at_period_end:f,cancellation_reason:b,identity:w,priceId:p};return u&&d&&(delete y.priceId,y.tierId=u,y.cadence=d),r({url:g,method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(y)})},async offers(){const c=await s.member.identity(),u=i({type:"members",resource:"member/offers"});return r({url:u,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:c})}).then(function(d){return d.ok?d.json():{offers:[]}}).catch(function(){return{offers:[]}})},async applyOffer({offerId:c,subscriptionId:u}){const d=await s.member.identity(),p=i({type:"members",resource:`subscriptions/${u}/apply-offer`}),m=await r({url:p,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:d,offer_id:c})});if(!m.ok){const f=await m.text();throw new Error(f||"Failed to apply offer")}return!0}},s.init=async()=>{let[c]=await Promise.all([s.member.sessionData()]),u={},d=[],p=[],m={},f=[];try{[{settings:m},{tiers:p},{newsletters:d}]=await Promise.all([s.site.settings(),s.site.tiers(),s.site.newsletters()]),u={...m,newsletters:d,tiers:V1({tiers:p})}}catch{}if(c&&c.paid)try{f=(await s.member.offers()).offers||[]}catch(b){console.warn("[Portal] Failed to load member offers:",b)}return u=T1({site:u}),{site:u,member:c,offers:f}},s}class ai extends Z.Component{render(){return l.jsx("div",{style:{display:"flex",flexDirection:"column",color:"#313131"},children:l.jsx("div",{style:{paddingLeft:"16px",paddingRight:"16px",paddingTop:"12px",height:"50px"},children:l.jsx(Xa,{className:"gh-portal-loadingicon dark","data-testid":"loaderIcon"})})})}}const HT=`
|
|
1955
1955
|
.gh-portal-feedback {
|
|
1956
1956
|
|
|
1957
1957
|
}
|
|
@@ -2322,7 +2322,7 @@ html[dir="rtl"] .gh-portal-offer-title h4 {
|
|
|
2322
2322
|
}
|
|
2323
2323
|
|
|
2324
2324
|
.gh-portal-gift-success .gh-gift-success-icon {
|
|
2325
|
-
margin:
|
|
2325
|
+
margin: 12px auto 0;
|
|
2326
2326
|
text-align: center;
|
|
2327
2327
|
color: var(--brandcolor);
|
|
2328
2328
|
width: 56px;
|
|
@@ -2336,27 +2336,27 @@ html[dir="rtl"] .gh-portal-offer-title h4 {
|
|
|
2336
2336
|
|
|
2337
2337
|
.gh-portal-gift-success h1.gh-portal-main-title {
|
|
2338
2338
|
font-size: 32px;
|
|
2339
|
-
margin-top:
|
|
2339
|
+
margin-top: 16px;
|
|
2340
2340
|
}
|
|
2341
2341
|
|
|
2342
|
-
.gh-portal-gift-success .gh-portal-
|
|
2343
|
-
|
|
2344
|
-
margin-top: 20px;
|
|
2342
|
+
.gh-portal-gift-success .gh-portal-main-subtitle {
|
|
2343
|
+
margin-top: 12px;
|
|
2345
2344
|
}
|
|
2346
2345
|
|
|
2347
2346
|
.gh-portal-gift-success .gh-gift-link-container {
|
|
2348
2347
|
display: flex;
|
|
2349
2348
|
align-items: center;
|
|
2350
|
-
|
|
2349
|
+
height: 48px;
|
|
2350
|
+
background-color: #f3f3f3;
|
|
2351
2351
|
border-radius: 8px;
|
|
2352
|
-
padding:
|
|
2353
|
-
margin:
|
|
2352
|
+
padding: 6px 6px 6px 12px;
|
|
2353
|
+
margin-top: 24px;
|
|
2354
2354
|
gap: 8px;
|
|
2355
2355
|
}
|
|
2356
2356
|
|
|
2357
2357
|
.gh-portal-gift-success .gh-gift-link-url {
|
|
2358
2358
|
flex: 1;
|
|
2359
|
-
font-size:
|
|
2359
|
+
font-size: 1.5rem;
|
|
2360
2360
|
color: var(--grey1);
|
|
2361
2361
|
overflow: hidden;
|
|
2362
2362
|
text-overflow: ellipsis;
|
|
@@ -2368,38 +2368,34 @@ html[dir="rtl"] .gh-portal-offer-title h4 {
|
|
|
2368
2368
|
.gh-portal-gift-success .gh-gift-copy-btn {
|
|
2369
2369
|
display: flex;
|
|
2370
2370
|
align-items: center;
|
|
2371
|
-
gap:
|
|
2371
|
+
gap: 4px;
|
|
2372
|
+
height: 36px;
|
|
2372
2373
|
background: var(--brandcolor);
|
|
2373
2374
|
color: #fff;
|
|
2374
2375
|
border: none;
|
|
2375
2376
|
border-radius: 6px;
|
|
2376
|
-
padding: 8px 16px;
|
|
2377
|
+
padding: 8px 16px 8px 14px;
|
|
2377
2378
|
font-size: 14px;
|
|
2378
|
-
font-weight:
|
|
2379
|
+
font-weight: 500;
|
|
2379
2380
|
cursor: pointer;
|
|
2380
2381
|
white-space: nowrap;
|
|
2381
2382
|
flex-shrink: 0;
|
|
2382
2383
|
transition: opacity 0.15s ease;
|
|
2384
|
+
will-change: opacity;
|
|
2383
2385
|
}
|
|
2384
2386
|
|
|
2385
2387
|
.gh-portal-gift-success .gh-gift-copy-btn:hover {
|
|
2386
2388
|
opacity: 0.9;
|
|
2387
2389
|
}
|
|
2388
2390
|
|
|
2389
|
-
.gh-portal-gift-success .gh-gift-copy-btn svg {
|
|
2390
|
-
width: 14px;
|
|
2391
|
-
height: 14px;
|
|
2392
|
-
}
|
|
2393
|
-
|
|
2394
2391
|
.gh-portal-gift-success .gh-gift-footer-text {
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
font-size: 13px;
|
|
2392
|
+
margin: 36px 0 0;
|
|
2393
|
+
font-size: 1.3rem;
|
|
2398
2394
|
color: var(--grey7);
|
|
2399
2395
|
text-align: center;
|
|
2400
2396
|
line-height: 1.5;
|
|
2401
2397
|
}
|
|
2402
|
-
`,cP=()=>l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),l.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),uP=()=>l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("polyline",{points:"20 6 9 17 4 12"})}),dP=()=>{const{site:e,pageData:t}=v.useContext(_),[n,a]=v.useState(!1),i=t==null?void 0:t.token,r=`${((e==null?void 0:e.url)||"").replace(/\/$/,"")}/#/portal/gift/redeem/${i}`,s=()=>{hk(r),a(!0),setTimeout(()=>a(!1),2e3)};return l.jsxs("div",{className:"gh-portal-content gh-portal-gift-success",children:[l.jsx(pe,{}),l.jsxs("div",{className:"gh-portal-signup-header",children:[l.jsx("div",{className:"gh-gift-success-icon",children:l.jsx(mk,{})}),l.jsx("h1",{className:"gh-portal-main-title",children:"Gift ready to share!"})
|
|
2398
|
+
`,cP=()=>l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",width:"14",height:"14",children:[l.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),l.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),uP=()=>l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{margin:"1px -1px 0 -2px"},width:"16",height:"16",children:l.jsx("polyline",{points:"20 6 9 17 4 12"})}),dP=()=>{const{site:e,pageData:t}=v.useContext(_),[n,a]=v.useState(!1),i=t==null?void 0:t.token,r=`${((e==null?void 0:e.url)||"").replace(/\/$/,"")}/#/portal/gift/redeem/${i}`,s=()=>{hk(r),a(!0),setTimeout(()=>a(!1),2e3)};return l.jsxs("div",{className:"gh-portal-content gh-portal-gift-success",children:[l.jsx(pe,{}),l.jsxs("div",{className:"gh-portal-signup-header",children:[l.jsx("div",{className:"gh-gift-success-icon",children:l.jsx(mk,{})}),l.jsx("h1",{className:"gh-portal-main-title",children:"Gift ready to share!"}),l.jsx("p",{className:"gh-portal-main-subtitle gh-portal-text-center",children:"Share this link with the recipient to let them redeem their gift membership."})]}),l.jsxs("div",{className:"gh-gift-link-container",children:[l.jsx("span",{className:"gh-gift-link-url",children:r}),l.jsxs("button",{className:"gh-gift-copy-btn",onClick:s,type:"button",children:[n?l.jsx(uP,{}):l.jsx(cP,{}),n?"Copied":"Copy"]})]}),l.jsxs("p",{className:"gh-gift-footer-text",children:["This link can be redeemed once and expires in 365 days.",l.jsx("br",{}),"We've also sent a confirmation to your email with this link."]})]})},mP=e=>v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},v.createElement("title",null,"warning-stroke"),v.createElement("path",{d:"M13.313 2.275a1.5 1.5 0 0 0-2.626 0l-9.75 18A1.5 1.5 0 0 0 2.25 22.5h19.5a1.5 1.5 0 0 0 1.313-2.225zM12 18a.375.375 0 0 1 .375.375m-.75 0A.375.375 0 0 1 12 18m0 .75a.375.375 0 0 1-.375-.375m.75 0a.375.375 0 0 1-.375.375M12 15V8.25",style:{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5px"}})),pP=`
|
|
2403
2399
|
.gh-portal-tips-and-donations .gh-tips-and-donations-icon-error {
|
|
2404
2400
|
padding: 10px 0;
|
|
2405
2401
|
text-align: center;
|
|
@@ -4128,7 +4124,7 @@ html[dir="rtl"] .gh-portal-list-toggle-wrapper .gh-portal-list-detail {
|
|
|
4128
4124
|
.gh-portal-hide {
|
|
4129
4125
|
display: none;
|
|
4130
4126
|
}
|
|
4131
|
-
`;function $P({site:e}){return vd+xP+x1+O1+K1+C1()+S1+b1+w1+db+_T+$T+BT()+Dd+RT+CP+EP+HT+ZT+XT+QT+tP+oP+pP+lP+gP+vP+wP}const xm=class xm extends Z.Component{constructor(t){super(t),this.state={email:"",token:void 0}}componentDidMount(){const{member:t}=this.context;t&&this.context.doAction("switchPage",{page:"accountHome"})}handleSignin(t){t.preventDefault(),this.doSignin()}doSignin(){this.setState(t=>({errors:Oo({fields:this.getInputFields({state:t})})}),async()=>{const{email:t,phonenumber:n,errors:a,token:i}=this.state,{redirect:o}=this.context.pageData??{};a&&Object.values(a).filter(s=>!!s).length>0||this.context.doAction("signin",{email:t,phonenumber:n,redirect:o,token:i})})}handleInputChange(t,n){const a=n.name;this.setState({[a]:t.target.value})}onKeyDown(t){t.keyCode===13&&this.handleSignin(t)}getInputFields({state:t}){const n=t.errors||{};return[{type:"email",value:t.email,placeholder:h("jamie@example.com"),label:h("Email"),name:"email",required:!0,errorMessage:n.email||"",autoFocus:!0},{type:"text",value:t.phonenumber,placeholder:"+1 (123) 456-7890",label:"Phone number",name:"phonenumber",required:!1,tabIndex:-1,autoComplete:"off",hidden:!0}]}renderSubmitButton(){const{action:t}=this.context;let n=!1;const a=t==="signin:running";let i=h(a?"Sending login link...":"Continue");const o=!!a;return t==="signin:failed"&&(i=h("Retry"),n=!0),l.jsx(me,{dataTestId:"signin",retry:n,style:{width:"100%"},onClick:r=>this.handleSignin(r),disabled:o,brandColor:this.context.brandColor,label:i,isRunning:a})}renderSignupMessage(){const{brandColor:t}=this.context;return l.jsxs("div",{className:"gh-portal-signup-message",children:[l.jsx("div",{children:h("Don't have an account?")}),l.jsx("button",{"data-test-button":"signup-switch",className:"gh-portal-btn gh-portal-btn-link",style:{color:t},onClick:()=>this.context.doAction("switchPage",{page:"signup"}),children:l.jsx("span",{children:h("Sign up")})})]})}renderForm(){const{site:t}=this.context,n=Ls({site:t})&&Qt({site:t});return zn({site:t})?l.jsxs("section",{children:[l.jsx("div",{className:"gh-portal-section",children:l.jsx(ti,{fields:this.getInputFields({state:this.state}),onChange:(a,i)=>this.handleInputChange(a,i),onKeyDown:(a,i)=>this.onKeyDown(a,i)})}),l.jsxs("footer",{className:"gh-portal-signin-footer",children:[this.renderSubmitButton(),n&&this.renderSignupMessage()]})]}):l.jsx("section",{children:l.jsx("div",{className:"gh-portal-section",children:l.jsx("p",{className:"gh-portal-members-disabled-notification","data-testid":"members-disabled-notification-text",children:h("Memberships unavailable, contact the owner for access.")})})})}renderSiteIcon(){const{site:t}=this.context,n=t.icon;return n?l.jsx("img",{className:"gh-portal-signup-logo",src:n,alt:this.context.site.title}):zn({site:t})?null:l.jsx(Gb,{className:"gh-portal-icon gh-portal-icon-invitation"})}renderSiteTitle(){const{site:t}=this.context,n=t.title;return zn({site:t})?l.jsx("h1",{className:"gh-portal-main-title",children:h("Sign in")}):l.jsx("h1",{className:"gh-portal-main-title",children:n})}renderFormHeader(){return l.jsxs("header",{className:"gh-portal-signin-header",children:[this.renderSiteIcon(),this.renderSiteTitle()]})}render(){return l.jsxs(l.Fragment,{children:[l.jsx(pe,{}),l.jsx("div",{className:"gh-portal-logged-out-form-container",children:l.jsxs("div",{className:"gh-portal-content signin",children:[this.renderFormHeader(),this.renderForm()]})})]})}};xm.contextType=_;let om=xm;const jP=({handleSignout:e,supportAddress:t=""})=>{const n=`mailto:${t}`;return l.jsxs("footer",{className:"gh-portal-account-footer",children:[l.jsx("ul",{className:"gh-portal-account-footermenu",children:l.jsx("li",{children:l.jsx("button",{"data-test-button":"footer-signout",className:"gh-portal-btn",name:"logout","aria-label":"logout",onClick:a=>e(a),children:h("Sign out")})})}),l.jsx("div",{className:"gh-portal-account-footerright",children:l.jsx("ul",{className:"gh-portal-account-footermenu",children:l.jsx("li",{children:l.jsx("a",{"data-test-link":"footer-support",className:"gh-portal-btn gh-portal-btn-branded",href:n,onClick:()=>{n&&window.open(n)},children:h("Contact support")})})})})]})},TP=()=>{const{member:e,brandColor:t}=v.useContext(_),n=e.avatar_image;return l.jsxs("header",{className:"gh-portal-account-header",children:[l.jsx(kd,{gravatar:n,style:{userIcon:{color:t,width:"56px",height:"56px",padding:"2px"}}}),l.jsx("h2",{className:"gh-portal-main-title",children:h("Your account")})]})},PP=()=>{const{site:e,action:t,brandColor:n,doAction:a}=v.useContext(_);if(!Ls({site:e})||!Qt({site:e}))return null;const i=["checkoutPlan:running"].includes(t),o=()=>{a("switchPage",{page:"accountPlan",lastPage:"accountHome"})};return l.jsx(me,{dataTestId:"view-plans",isRunning:i,label:h("View plans"),onClick:()=>o(),brandColor:n,style:{width:"100%"}})},zP=()=>{const{member:e,site:t}=v.useContext(_),{is_stripe_configured:n}=t;if(!n||Ja({site:t}))return null;const a=rt({member:e}),i=Pn({member:e});if(i&&!a)return null;if(a){const o=a==null?void 0:a.current_period_end;if(i&&wd({member:e})){const r=wd({member:e}),s=Xt(r);return l.jsx("div",{className:"gh-portal-section",children:l.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:h("Your subscription will expire on {expiryDate}",{expiryDate:s})})})}if(a!=null&&a.cancel_at_period_end||i)return null;if(xd({sub:a})){const r=Xt(a.trial_end_at);return l.jsx("div",{className:"gh-portal-section",children:l.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:h("Your subscription will start on {subscriptionStart}",{subscriptionStart:r})})})}return l.jsx("div",{className:"gh-portal-section",children:l.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:h("Your subscription will renew on {renewalDate}",{renewalDate:Xt(o)})})})}return l.jsxs("div",{className:"gh-portal-section",children:[l.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:h("You currently have a free membership, upgrade to a paid subscription for full access.")}),l.jsx(PP,{})]})},IP=()=>{const{member:e,doAction:t,action:n,brandColor:a}=v.useContext(_),i=rt({member:e});if(!i||!i.cancel_at_period_end)return null;const o=h("Resume subscription"),r=["continueSubscription:running"].includes(n),s=!!r,c=Xt(i.current_period_end);return l.jsx("div",{className:"gh-portal-cancelcontinue-container",children:l.jsxs("div",{className:"gh-portal-cancel-banner",children:[l.jsx("p",{children:l.jsx($e,{string:h("Your subscription has been canceled and will expire on {expiryDate}."),mapping:{expiryDate:l.jsx("strong",{children:c})}})}),l.jsx(me,{onClick:()=>{t("continueSubscription",{subscriptionId:i.id})},isRunning:r,disabled:s,isPrimary:!0,brandColor:a,label:o,style:{width:"100%"}})]})})},NP=e=>v.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},v.createElement("defs",null,v.createElement("style",null,".a{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.5px;}")),v.createElement("path",{d:"M22.939 2.56V8.817C22.9391 9.61244 22.6232 10.3754 22.061 10.938L10.5 22.5C10.2187 22.7812 9.83721 22.9392 9.43946 22.9392C9.04172 22.9392 8.66026 22.7812 8.37896 22.5L1.49997 15.62C1.21876 15.3387 1.06079 14.9572 1.06079 14.5595C1.06079 14.1618 1.21876 13.7803 1.49997 13.499L13.061 1.938C13.6236 1.37572 14.3865 1.0599 15.182 1.06H21.439C21.8368 1.06 22.2183 1.21803 22.4996 1.49934C22.7809 1.78064 22.939 2.16217 22.939 2.56V2.56Z",className:"a"}),v.createElement("path",{d:"M17.689 7.81C16.8605 7.81 16.189 7.13842 16.189 6.31C16.189 5.48157 16.8605 4.81 17.689 4.81C18.5174 4.81 19.189 5.48157 19.189 6.31C19.189 7.13842 18.5174 7.81 17.689 7.81Z",className:"a"})),AP=()=>{const{member:e,site:t,doAction:n}=v.useContext(_),a=()=>{const m=rt({member:e});n("manageBilling",{subscriptionId:m.id})},i=()=>{const{is_stripe_configured:m}=t;m&&n("switchPage",{page:"accountPlan",lastPage:"accountHome"})},o=({price:m,isComplimentary:f,subscription:b})=>{const{next_payment:w}=b||{};let g="";if(m){const{amount:E=0,currency:N,interval:z}=m;g=`${Intl.NumberFormat("en",{currency:N,style:"currency"}).format(E/100)}/${h(z)}`}const y=wd({member:e});f&&(y?g=`${h("Complimentary")} - ${h("Expires {expiryDate}",{expiryDate:y})}`:g=g?`${h("Complimentary")} (${g})`:h("Complimentary"));let k="";if(xd({sub:b}))return k="gh-portal-account-old-price",l.jsxs(l.Fragment,{children:[l.jsx("p",{className:k,children:g}),l.jsx(MP,{subscription:b})]});let x=DP({nextPayment:w});x&&(k="gh-portal-account-old-price");const T=()=>x?l.jsxs("p",{className:"gh-portal-account-discountcontainer","data-testid":"offer-label",children:[l.jsx(NP,{className:"gh-portal-account-tagicon"}),l.jsx("span",{children:x})]}):null;return l.jsxs(l.Fragment,{children:[l.jsx("p",{className:k,children:g}),l.jsx(T,{})]})},r=({isPaid:m})=>Ja({site:t})&&!m?null:l.jsx("button",{className:"gh-portal-btn gh-portal-btn-list",onClick:f=>i(),"data-test-button":"change-plan",children:h("Change")}),s=({defaultCardLast4:m})=>{if(m){const f=`**** **** **** ${m}`;return l.jsx("p",{children:f})}return null},c=({defaultCardLast4:m,isComplimentary:f})=>{const{action:b}=v.useContext(_),w=b==="manageBilling:running"?l.jsx(Xa,{className:"gh-portal-billing-button-loader"}):h("Update");return f?null:l.jsxs("section",{children:[l.jsxs("div",{className:"gh-portal-list-detail",children:[l.jsx("h3",{children:h("Billing info & receipts")}),l.jsx(s,{defaultCardLast4:m})]}),l.jsx("button",{className:"gh-portal-btn gh-portal-btn-list",onClick:g=>a(),"data-test-button":"manage-billing",children:w})]})},u=rt({member:e}),d=Pn({member:e}),p=Dt({member:e});if(u||d){const{price:m,default_payment_card_last4:f}=u||{};let b=h("Plan");return Bs({site:t})&&hb({member:e})&&(b=hb({member:e})),l.jsxs(l.Fragment,{children:[l.jsxs("section",{children:[l.jsxs("div",{className:"gh-portal-list-detail",children:[l.jsxs("h3",{children:[b,(u==null?void 0:u.cancel_at_period_end)&&l.jsx("span",{className:"gh-portal-canceled-badge",children:h("Canceled")})]}),l.jsx(o,{price:m,isComplimentary:d,subscription:u})]}),l.jsx(r,{isPaid:p})]}),l.jsx(c,{isComplimentary:d,defaultCardLast4:f})]})}return null};function MP({subscription:e}){if(xd({sub:e})){const t=Xt(e.trial_end_at);return l.jsx("p",{className:"gh-portal-account-discountcontainer",children:l.jsx("div",{children:l.jsx("span",{children:h("Free Trial – Ends {trialEnd}",{trialEnd:t})})})})}return null}function DP({nextPayment:e}){if(!e)return"";const t=e.discount;if(!t)return"";const n=t.end?h("Ends {offerEndDate}",{offerEndDate:Xt(t.end)}):h("Forever");return`${`${Intl.NumberFormat("en",{currency:e.currency,style:"currency"}).format(e.amount/100)}/${h(e.interval)}`}${n?` — ${n}`:""}`}function FP(){const{member:e,site:t,doAction:n}=v.useContext(_);let{newsletters:a}=e;const i=!!(a!=null&&a.length);let o=h(i?"Subscribed":"Unsubscribed");const r=s=>{var d;s.preventDefault();const c=ta({site:t}),u=(d=e==null?void 0:e.newsletters)!=null&&d.length?[]:c;n("updateNewsletterPreference",{newsletters:u})};return l.jsxs("section",{children:[l.jsxs("div",{className:"gh-portal-list-detail email-newsletter",children:[l.jsx("h3",{children:h("Email newsletter")}),l.jsxs("p",{children:[o," ",Cd({member:e})&&i&&l.jsx("button",{className:"gh-portal-btn-text gh-email-faq-page-button",onClick:()=>n("switchPage",{page:"emailReceivingFAQ",lastPage:"accountHome"}),children:h("Not receiving emails?")})]})]}),l.jsx("div",{children:l.jsx(tl,{dataTestId:"default-newsletter-toggle",id:"default-newsletter-toggle",onToggle:s=>{r(s)},checked:i})})]})}const bk=e=>v.createElement("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",...e},v.createElement("path",{d:"m12.79 12.376 4.08 4.079m-4.08 0 4.08-4.08",stroke:"red",strokeWidth:1.35,strokeLinecap:"round",strokeLinejoin:"round"}),v.createElement("path",{d:"m10.439 17.994-2.664-2.652-2.86 1.478.111-4.239m0 0L1.677 9.232a1.344 1.344 0 0 1-.366-1.222 1.369 1.369 0 0 1 .904-1.05l13.111-4.374a1.369 1.369 0 0 1 1.76 1.758L15 10m-9.974 2.581 11.67-9.727",stroke:"#A3A3A3",strokeWidth:1.35,strokeLinecap:"round",strokeLinejoin:"round"}));function OP(){return l.jsxs("p",{className:"gh-portal-email-notice",children:[l.jsx(bk,{className:"gh-portal-email-notice-icon"}),l.jsx("span",{className:"gh-mobile-only",children:h("You're not receiving emails")}),l.jsx("span",{className:"gh-desktop-only",children:h("You're currently not receiving emails")})]})}function _P(){const{doAction:e,member:t,site:n}=v.useContext(_),a=yb({member:t}),i=jo({site:n}),o=Us({site:n}),r=a?"emailSuppressed":"accountEmail",s=!i&&!o,c=()=>a||s?l.jsx(OP,{}):l.jsx("p",{children:h("Update your preferences")});return l.jsxs("section",{children:[l.jsxs("div",{className:"gh-portal-list-detail",children:[l.jsx("h3",{children:h("Emails")}),c()]}),l.jsx("button",{className:"gh-portal-btn gh-portal-btn-list",onClick:()=>{e("switchPage",{page:r,lastPage:"accountHome"})},"data-test-button":"manage-newsletters",children:h("Manage")})]})}const RP=()=>{const{member:e,site:t}=v.useContext(_),a=t.transistor_portal_settings||{enabled:t.transistor_portal_enabled===!0,heading:t.transistor_portal_heading,description:t.transistor_portal_description,button_text:t.transistor_portal_button_text,url_template:t.transistor_portal_url_template},i=(a==null?void 0:a.enabled)===!0,o=e==null?void 0:e.uuid,r=xb(),[s,c]=v.useState(r&&i);return v.useEffect(()=>{if(r){c(i);return}if(!i||!o){c(!1);return}c(!1);const u=new AbortController;return(async()=>{try{const p=await fetch(`https://partner.transistor.fm/ghost/member/${o}`,{signal:u.signal});if(p.ok){const m=await p.json();u.signal.aborted||c((m==null?void 0:m.member)===!0)}}catch(p){if(u.signal.aborted)return;console.warn("Error in Transistor request",p)}})(),()=>u.abort()},[i,o,r]),{transistor:{enabled:i,hasPodcasts:s,memberUuid:o,settings:a}}},YP=(e,t)=>zo({site:e})&&jo({site:e})||Us({site:e})||yb({member:t}),LP=e=>!zo({site:e})&&jo({site:e})&&!Us({site:e}),BP=()=>{const{member:e,doAction:t,site:n}=v.useContext(_),{name:a,email:i}=e,{transistor:o}=RP(),r=()=>{t("switchPage",{page:"accountProfile",lastPage:"accountHome"})},s=YP(n,e),c=LP(n);return l.jsx("div",{children:l.jsxs("div",{className:"gh-portal-list",children:[l.jsxs("section",{children:[l.jsxs("div",{className:"gh-portal-list-detail",children:[l.jsx("h3",{children:a||h("Account")}),l.jsx("p",{children:i})]}),l.jsx("button",{"data-test-button":"edit-profile",className:"gh-portal-btn gh-portal-btn-list",onClick:u=>r(),children:h("Edit")})]}),l.jsx(AP,{}),s&&l.jsx(_P,{}),c&&l.jsx(FP,{}),o.enabled&&l.jsx(SP,{hasPodcasts:o.hasPodcasts,memberUuid:o.memberUuid,settings:o.settings})]})})},UP=()=>l.jsxs("div",{className:"gh-portal-content gh-portal-account-main",children:[l.jsx(pe,{}),l.jsx(TP,{}),l.jsxs("section",{className:"gh-portal-account-data",children:[l.jsx(zP,{}),l.jsx(IP,{}),l.jsx(BP,{})]})]}),Cm=class Cm extends Z.Component{componentDidMount(){const{member:t,site:n}=this.context;zn({site:n})||this.context.doAction("signout"),t||this.context.doAction("switchPage",{page:"signin",pageData:{redirect:window.location.href}})}handleSignout(t){t.preventDefault(),this.context.doAction("signout")}render(){const{member:t,site:n}=this.context,a=Io({site:n});return!t||!zn({site:n})?null:l.jsxs("div",{className:"gh-portal-account-wrapper",children:[l.jsx(UP,{}),l.jsx(jP,{onClose:()=>this.context.doAction("closePopup"),handleSignout:i=>this.handleSignout(i),supportAddress:a})]})}};Cm.contextType=_;let rm=Cm;const Em=class Em extends Z.Component{constructor(t,n){super(t,n);const{name:a="",email:i=""}=n.member||{};this.state={name:a,email:i}}componentDidMount(){const{member:t}=this.context;t||this.context.doAction("switchPage",{page:"signin"})}handleSignout(t){t.preventDefault(),this.context.doAction("signout")}onBack(){this.context.doAction("back")}onProfileSave(t){t.preventDefault(),this.setState(n=>({errors:Oo({fields:this.getInputFields({state:n})})}),()=>{const{email:n,name:a,errors:i}=this.state;i&&Object.values(i).filter(r=>!!r).length>0||(this.context.doAction("clearPopupNotification"),this.context.doAction("updateProfile",{email:n,name:a}))})}renderSaveButton(){const t=this.context.action==="updateProfile:running";let n=h("Save");this.context.action==="updateProfile:failed"&&(n=h("Retry"));const a=!!t;return l.jsx(me,{dataTestId:"save-button",isRunning:t,onClick:i=>this.onProfileSave(i),disabled:a,brandColor:this.context.brandColor,label:n,style:{width:"100%"}})}renderDeleteAccountButton(){return l.jsx("div",{style:{cursor:"pointer",color:"red"},role:"button",children:h("Delete account")})}renderAccountFooter(){return l.jsx("footer",{className:"gh-portal-action-footer",children:this.renderSaveButton()})}renderHeader(){return l.jsxs("header",{className:"gh-portal-detail-header",children:[l.jsx(Qa,{brandColor:this.context.brandColor,hidden:!this.context.lastPage,onClick:t=>this.onBack(t)}),l.jsx("h3",{className:"gh-portal-main-title",children:h("Account settings")})]})}renderUserAvatar(){const t=this.context.member&&this.context.member.avatar_image,n={position:"relative",display:"flex",width:"64px",height:"64px",marginBottom:"6px",borderRadius:"100%",boxShadow:"0 0 0 3px #fff",border:"1px solid gray",overflow:"hidden",justifyContent:"center",alignItems:"center"};return l.jsx("div",{style:n,children:l.jsx(kd,{gravatar:t,style:{userIcon:{color:"black",width:"56px",height:"56px"}}})})}handleInputChange(t,n){const a=n.name;this.setState({[a]:t.target.value})}getInputFields({state:t,fieldNames:n}){const a=t.errors||{},i=[{type:"text",value:t.name,placeholder:h("Jamie Larson"),label:h("Name"),name:"name",required:!1,errorMessage:a.name||""},{type:"email",value:t.email,placeholder:h("jamie@example.com"),label:h("Email"),name:"email",required:!0,errorMessage:a.email||""}];return n&&n.length>0?i.filter(o=>n.includes(o.name)):i}onKeyDown(t){t.keyCode===13&&this.onProfileSave(t)}renderProfileData(){return l.jsx("div",{className:"gh-portal-section",children:l.jsx(ti,{fields:this.getInputFields({state:this.state}),onChange:(t,n)=>this.handleInputChange(t,n),onKeyDown:(t,n)=>this.onKeyDown(t,n)})})}render(){const{member:t}=this.context;return t?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"gh-portal-content with-footer",children:[l.jsx(pe,{}),this.renderHeader(),l.jsx("div",{className:"gh-portal-section",children:this.renderProfileData()})]}),this.renderAccountFooter()]}):null}};Em.contextType=_;let sm=Em;function HP(){const{brandColor:e,lastPage:t,doAction:n}=v.useContext(_);return l.jsxs("header",{className:"gh-portal-detail-header",children:[l.jsx(Qa,{brandColor:e,hidden:!t,onClick:()=>{n("back")}}),l.jsx("h3",{className:"gh-portal-main-title",children:h("Email preferences")})]})}function VP({newsletter:e,subscribedNewsletters:t,setSubscribedNewsletters:n}){const a=t.some(i=>i.id===(e==null?void 0:e.id));return l.jsxs("section",{className:"gh-portal-list-toggle-wrapper","data-testid":"newsletter-toggle",children:[l.jsxs("div",{className:"gh-portal-list-detail",children:[l.jsx("h3",{children:e.name}),l.jsx("p",{children:e==null?void 0:e.description})]}),l.jsx("div",{style:{display:"flex",alignItems:"center"},children:l.jsx(tl,{id:e.id,onToggle:(i,o)=>{let r=[];o?r=t.filter(s=>s.id!==e.id).concat(e):r=t.filter(s=>s.id!==e.id),n(r)},checked:a,dataTestId:"switch-input"})})]})}function WP({updateCommentNotifications:e,isCommentsEnabled:t,enableCommentNotifications:n}){const{doAction:a}=v.useContext(_),i=!!n;if(!t)return null;const o=async(r,s)=>{await e(s),a("showPopupNotification",{action:"updated:success",message:h("Comment preferences updated.")})};return l.jsxs("section",{className:"gh-portal-list-toggle-wrapper","data-testid":"comment-toggle",children:[l.jsxs("div",{className:"gh-portal-list-detail",children:[l.jsx("h3",{children:h("Comments")}),l.jsx("p",{children:h("Get notified when someone replies to your comment")})]}),l.jsx("div",{style:{display:"flex",alignItems:"center"},children:l.jsx(tl,{id:"comments",onToggle:o,checked:i,dataTestId:"switch-input"})})]})}function GP({subscribedNewsletters:e,setSubscribedNewsletters:t,hasNewslettersEnabled:n}){const{site:a}=v.useContext(_),i=ta({site:a});return n?i.map(o=>l.jsx(VP,{newsletter:o,subscribedNewsletters:e,setSubscribedNewsletters:t},o==null?void 0:o.id)):null}function KP({site:e,isPaid:t}){return t?l.jsx("p",{style:{textAlign:"center",marginTop:"12px",marginBottom:"0",color:"var(--grey6)"},children:h("Unsubscribing from emails will not cancel your paid subscription to {title}",{title:e==null?void 0:e.title})}):null}function kk({hasNewslettersEnabled:e,notification:t,subscribedNewsletters:n,updateSubscribedNewsletters:a,updateCommentNotifications:i,unsubscribeAll:o,isPaidMember:r,isCommentsEnabled:s,enableCommentNotifications:c}){const{brandColor:u,doAction:d,member:p,site:m}=v.useContext(_),f=!(n!=null&&n.length)&&(s&&!c||!s),w=t||(()=>null);return l.jsxs("div",{className:"gh-portal-content with-footer",children:[l.jsx(pe,{}),l.jsx(HP,{}),l.jsx(w,{}),l.jsx("div",{className:"gh-portal-section flex",children:l.jsxs("div",{className:"gh-portal-list",children:[l.jsx(GP,{hasNewslettersEnabled:e,subscribedNewsletters:n,setSubscribedNewsletters:g=>{let y=g.map(k=>({id:k.id}));a(y)}}),l.jsx(WP,{isCommentsEnabled:s,enableCommentNotifications:c,updateCommentNotifications:i})]})}),l.jsx("div",{className:"gh-portal-btn-product gh-portal-btn-unsubscribe",style:{marginTop:"-48px",marginBottom:0},children:l.jsx(me,{isRunning:!1,onClick:()=>{o()},disabled:f,brandColor:u,isPrimary:!1,label:h("Unsubscribe from all emails"),isDestructive:!0,style:{width:"100%",zIndex:900},dataTestId:"unsubscribe-from-all-emails"})}),l.jsxs("footer",{className:"gh-portal-action-footer"+(Cd({member:p})?" gh-feature-suppressions":""),children:[l.jsx("div",{style:{width:"100%"},children:l.jsx(KP,{isPaid:r,site:m,subscribedNewsletters:n})}),Cd({member:p})&&!f&&l.jsxs("div",{className:"gh-portal-footer-secondary",children:[l.jsx("span",{className:"gh-portal-footer-secondary-light",children:h("Not receiving emails?")}),l.jsxs("button",{className:"gh-portal-btn-text gh-email-faq-page-button",onClick:()=>d("switchPage",{page:"emailReceivingFAQ",pageData:{direct:!1}}),children:[h("Get help")," ",l.jsx("span",{className:"right-arrow",children:"→"})]})]})]})]})}function qP(){const{member:e,doAction:t,site:n,pageData:a}=v.useContext(_);let i,o;a&&(i=a.newsletterUuid,o=a.action);const[r,s]=v.useState(!0),c=ta({site:n}),u=jo({site:n});v.useEffect(()=>{e||t("switchPage",{page:"signin"})},[e,t]),v.useEffect(()=>{if(i&&o==="unsubscribe"){const g=e==null?void 0:e.newsletters.filter(y=>y.uuid!==i);f(g),s(!1),t("updateNewsletterPreference",{newsletters:g})}},[]);const d=()=>{if(a.comments&&b){const k=r?"gh-portal-hide":"";return l.jsx(l.Fragment,{children:l.jsx("p",{className:`gh-portal-text-center gh-portal-header-message ${k}`,children:l.jsx($e,{string:h("{memberEmail} will no longer receive emails when someone replies to your comments."),mapping:{memberEmail:l.jsx("strong",{children:e==null?void 0:e.email})}})})})}const g=c==null?void 0:c.find(k=>k.uuid===a.newsletterUuid);if(!g)return null;const y=r?"gh-portal-hide":"";return l.jsx(l.Fragment,{children:l.jsx("p",{className:`gh-portal-text-center gh-portal-header-message ${y}`,children:l.jsx($e,{string:h("{memberEmail} will no longer receive {newsletterName} newsletter."),mapping:{memberEmail:l.jsx("strong",{children:e==null?void 0:e.email}),newsletterName:l.jsx("strong",{children:g==null?void 0:g.name})}})})})},p=[...(e==null?void 0:e.newsletters)||[]],[m,f]=v.useState(p),{comments_enabled:b}=n,{enable_comment_notifications:w}=e||{};return v.useEffect(()=>{f((e==null?void 0:e.newsletters)||[])},[e==null?void 0:e.newsletters]),l.jsx(kk,{hasNewslettersEnabled:u,notification:i?d:null,subscribedNewsletters:m,updateSubscribedNewsletters:g=>{f(g),t("updateNewsletterPreference",{newsletters:g}),t("showPopupNotification",{action:"updated:success",message:h("Email preferences updated.")})},updateCommentNotifications:async g=>{t("updateNewsletterPreference",{enableCommentNotifications:g})},unsubscribeAll:()=>{f([]),t("showPopupNotification",{action:"updated:success",message:h("Unsubscribed from all emails.")});const g={newsletters:[]};b&&(g.enableCommentNotifications=!1),t("updateNewsletterPreference",g)},isPaidMember:Dt({member:e}),isCommentsEnabled:b!=="off",enableCommentNotifications:w})}function JP(){const{site:e}=v.useContext(_),t=e.icon;return t?l.jsx("img",{className:"gh-portal-unsubscribe-logo",src:t,alt:e.title}):null}function ZP(){const{site:e}=v.useContext(_),t=e.title||"";return l.jsxs("header",{className:"gh-portal-header",children:[l.jsx(JP,{}),l.jsx("h2",{className:"gh-portal-publication-title",children:t})]})}async function vk({api:e,memberUuid:t,key:n,newsletters:a,enableCommentNotifications:i}){try{return await e.member.updateNewsletters({uuid:t,key:n,newsletters:a,enableCommentNotifications:i})}catch{}}function XP(){const{site:e,api:t,pageData:n,member:a,doAction:i}=v.useContext(_),[o,r]=v.useState(),[s,c]=v.useState(!0),u=ta({site:e}),d=u.filter(z=>z.subscribe_on_signup),[p,m]=v.useState(!1),[f,b]=v.useState(d),[w,g]=v.useState(!1),{comments_enabled:y}=e,{enable_comment_notifications:k=!1}=o||{},C=jo({site:e}),x=async z=>{a?i("updateNewsletterPreference",{newsletters:z}):await vk({api:t,memberUuid:n.uuid,key:n.key,newsletters:z}),b(z);const j={action:"updated:success",message:h("Email preferences updated.")};i("showPopupNotification",j)},T=async z=>{let j;a?(await i("updateNewsletterPreference",{enableCommentNotifications:z}),j={...a,enable_comment_notifications:z}):j=await vk({api:t,memberUuid:n.uuid,key:n.key,enableCommentNotifications:z}),r(j),i("showPopupNotification",{action:"updated:success",message:h("Comment preferences updated.")})},E=async()=>{let z;a?(await i("updateNewsletterPreference",{newsletters:[],enableCommentNotifications:!1}),z={...a},z.newsletters=[],z.enable_comment_notifications=!1):z=await t.member.updateNewsletters({uuid:n.uuid,key:n.key,newsletters:[],enableCommentNotifications:!1}),b([]),r(z),i("showPopupNotification",{action:"updated:success",message:h("Unsubscribed from all emails.")})};if(v.useEffect(()=>{(async()=>{let z;try{z=await t.member.newsletters({uuid:n.uuid,key:n.key}),r(z??null),c(!1)}catch(V){console.error("[PORTAL] Error fetching member newsletters",V),r(null),c(!1);return}if(z===null)return;const j=(z==null?void 0:z.newsletters)||[];b(j),(u==null?void 0:u.length)===1&&!y&&!n.newsletterUuid?await x([]):n.newsletterUuid?await x(j==null?void 0:j.filter(V=>V.uuid!==n.newsletterUuid)):n.comments&&y&&await T(!1)})()},[y,n.uuid,n.newsletterUuid,n.comments,e.url,u==null?void 0:u.length]),s)return l.jsx(ai,{});if(!o)return l.jsxs("div",{className:"gh-portal-content gh-portal-feedback with-footer",children:[l.jsx(pe,{}),l.jsx("div",{className:"gh-feedback-icon gh-feedback-icon-error",children:l.jsx(Od,{})}),l.jsx("h1",{className:"gh-portal-main-title",children:h("That didn't go to plan")}),l.jsx("div",{children:l.jsx("p",{className:"gh-portal-text-center",children:h("We couldn't unsubscribe you as the email address was not found. Please contact the site owner.")})}),l.jsx(me,{style:{width:"100%"},retry:!1,onClick:()=>i("closePopup"),disabled:!1,brandColor:"#000000",label:h("Close"),isRunning:!1,tabIndex:3,classes:"sticky bottom"})]});if((u==null?void 0:u.length)===1&&!y&&!w)return l.jsxs("div",{className:"gh-portal-content gh-portal-unsubscribe with-footer",children:[l.jsx(pe,{}),l.jsx(ZP,{}),l.jsx("h1",{className:"gh-portal-main-title",children:h("Successfully unsubscribed")}),l.jsxs("div",{children:[l.jsx("p",{className:"gh-portal-text-center",children:l.jsx($e,{string:h("{memberEmail} will no longer receive this newsletter."),mapping:{memberEmail:l.jsx("strong",{children:o==null?void 0:o.email})}})}),l.jsx("p",{className:"gh-portal-text-center",children:l.jsx($e,{string:h("Didn't mean to do this? Manage your preferences <button>here</button>."),mapping:{button:l.jsx("button",{className:"gh-portal-btn-link gh-portal-btn-branded gh-portal-btn-inline",onClick:()=>{g(!0)}})}})})]})]});const N=()=>{if(n.comments&&y){const V=p?"gh-portal-hide":"";return l.jsx(l.Fragment,{children:l.jsx("p",{className:`gh-portal-text-center gh-portal-header-message ${V}`,children:l.jsx($e,{string:h("{memberEmail} will no longer receive emails when someone replies to your comments."),mapping:{memberEmail:l.jsx("strong",{children:o==null?void 0:o.email})}})})})}const z=u==null?void 0:u.find(V=>V.uuid===n.newsletterUuid);if(!z)return null;const j=p?"gh-portal-hide":"";return l.jsx(l.Fragment,{children:l.jsx("p",{className:`gh-portal-text-center gh-portal-header-message ${j}`,children:l.jsx($e,{string:h("{memberEmail} will no longer receive {newsletterName} newsletter."),mapping:{memberEmail:l.jsx("strong",{children:o==null?void 0:o.email}),newsletterName:l.jsx("strong",{children:z==null?void 0:z.name})}})})})};return l.jsx(kk,{hasNewslettersEnabled:C,notification:N,subscribedNewsletters:f,updateSubscribedNewsletters:async z=>{await x(z),m(!0)},updateCommentNotifications:T,unsubscribeAll:async()=>{await E(),m(!0)},isPaidMember:(o==null?void 0:o.status)!=="free",isCommentsEnabled:y!=="off",enableCommentNotifications:k})}function QP(){const{brandColor:e,lastPage:t,doAction:n,action:a,site:i}=v.useContext(_);v.useEffect(()=>{["removeEmailFromSuppressionList:success"].includes(a)&&n("refreshMemberData"),["removeEmailFromSuppressionList:failed","refreshMemberData:failed"].includes(a)&&n("back"),["refreshMemberData:success"].includes(a)&&(zo({site:i})||Us({site:i})?(n("switchPage",{page:"accountEmail",lastPage:"accountHome"}),n("showPopupNotification",{message:h("You have been successfully resubscribed")})):n("back"))},[a,n,i,h]);const o=["removeEmailFromSuppressionList:running","refreshMemberData:running"].includes(a),r=()=>{n("removeEmailFromSuppressionList")};return l.jsxs("div",{className:"gh-email-suppressed-page",children:[l.jsxs("header",{className:"gh-portal-detail-header",children:[l.jsx(Qa,{brandColor:e,hidden:!t,onClick:()=>{n("back")}}),l.jsx(pe,{})]}),l.jsx(bk,{className:"gh-email-suppressed-page-icon"}),l.jsxs("div",{className:"gh-email-suppressed-page-text",children:[l.jsx("h3",{className:"gh-portal-main-title gh-email-suppressed-page-title",children:h("Emails disabled")}),l.jsx("p",{children:h("You're not receiving emails because you either marked a recent message as spam, or because messages could not be delivered to your provided email address.")})]}),l.jsx(me,{dataTestId:"resubscribe-email",classes:"gh-portal-confirm-button",onClick:r,disabled:o,brandColor:e,label:h("Re-enable emails"),isRunning:o})]})}function e2(){const{brandColor:e,doAction:t,site:n,pageData:a}=v.useContext(_),i=`mailto:${Io({site:n})}`,o=a&&a.direct||!1;return l.jsxs("div",{className:"gh-email-suppression-faq",children:[!o&&l.jsxs("header",{className:"gh-portal-detail-header",children:[l.jsx(Qa,{brandColor:e,onClick:()=>{t("switchPage",{page:"emailSuppressed",lastPage:"accountHome"})}}),l.jsx(pe,{})]}),l.jsxs("div",{className:"gh-longform",children:[l.jsx("h3",{children:h("Why has my email been disabled?")}),l.jsx("p",{children:h("Newsletters can be disabled on your account for two reasons: A previous email was marked as spam, or attempting to send an email resulted in a permanent failure (bounce).")}),l.jsx("h4",{children:h("Spam complaints")}),l.jsx("p",{children:h("If a newsletter is flagged as spam, emails are automatically disabled for that address to make sure you no longer receive any unwanted messages.")}),l.jsx("p",{children:h("If the spam complaint was accidental, or you would like to begin receiving emails again, you can resubscribe to emails by clicking the button on the previous screen.")}),l.jsx("p",{children:h("Once resubscribed, if you still don't see emails in your inbox, check your spam folder. Some inbox providers keep a record of previous spam complaints and will continue to flag emails. If this happens, mark the latest newsletter as 'Not spam' to move it back to your primary inbox.")}),l.jsx("h4",{children:h("Permanent failure (bounce)")}),l.jsx("p",{children:h("When an inbox fails to accept an email it is commonly called a bounce. In many cases, this can be temporary. However, in some cases, a bounced email can be returned as a permanent failure when an email address is invalid or non-existent.")}),l.jsx("p",{children:h("In the event a permanent failure is received when attempting to send a newsletter, emails will be disabled on the account.")}),l.jsx("p",{children:h("If you would like to start receiving emails again, the best next steps are to check your email address on file for any issues and then click resubscribe on the previous screen.")}),l.jsx("p",{children:l.jsx("a",{className:"gh-portal-btn gh-portal-btn-branded no-margin-right",href:i,onClick:()=>{i&&window.open(i)},children:h("Need more help? Contact support")})})]})]})}function t2(){const{brandColor:e,doAction:t,site:n,lastPage:a,member:i,pageData:o}=v.useContext(_),r=Io({site:n}),s=`mailto:${r}`,c=_0({site:n}),u=o&&o.direct||!1;return l.jsxs("div",{className:"gh-email-receiving-faq",children:[l.jsxs("header",{className:"gh-portal-detail-header",children:[!u&&l.jsx(Qa,{brandColor:e,onClick:()=>{a?t("switchPage",{page:"accountHome"}):t("switchPage",{page:"accountEmail",lastPage:"accountHome"})}}),l.jsx(pe,{})]}),l.jsxs("div",{className:"gh-longform",children:[l.jsx("h3",{children:h("Help! I'm not receiving emails")}),l.jsx("p",{children:h("If you're not receiving the email newsletter you've subscribed to, here are a few things to check.")}),l.jsx("h4",{children:h("Verify your email address is correct")}),l.jsx("p",{children:l.jsx($e,{string:h("The email address we have for you is {memberEmail} — if that's not correct, you can update it in your <button>account settings area</button>."),mapping:{memberEmail:l.jsx("strong",{children:i.email}),button:l.jsx("button",{className:"gh-portal-btn-text",onClick:()=>t("switchPage",{lastPage:"emailReceivingFAQ",page:"accountProfile"})})}})}),l.jsx("h4",{children:h("Check spam & promotions folders")}),l.jsx("p",{children:h(`Make sure emails aren't accidentally ending up in the Spam or Promotions folders of your inbox. If they are, click on "Mark as not spam" and/or "Move to inbox".`)}),l.jsx("h4",{children:h("Create a new contact")}),l.jsx("p",{children:l.jsx($e,{string:h("In your email client add {senderEmail} to your contacts list. This signals to your mail provider that emails sent from this address should be trusted."),mapping:{senderEmail:l.jsx("strong",{children:c})}})}),l.jsx("h4",{children:h("Send an email and say hi!")}),l.jsx("p",{children:l.jsx($e,{string:h("Send an email to {senderEmail} and say hello. This can also help signal to your mail provider that emails to and from this address should be trusted."),mapping:{senderEmail:l.jsx("strong",{children:c})}})}),l.jsx("h4",{children:h("Check with your mail provider")}),l.jsx("p",{children:l.jsx($e,{string:h("If you have a corporate or government email account, reach out to your IT department and ask them to allow emails to be received from {senderEmail}"),mapping:{senderEmail:l.jsx("strong",{children:c})}})}),l.jsx("h4",{children:h("Get in touch for help")}),l.jsx("p",{children:l.jsx($e,{string:h("If you've completed all these checks and you're still not receiving emails, you can reach out to get support by contacting {supportAddress}."),mapping:{supportAddress:l.jsx("a",{href:s,onClick:()=>{s&&window.open(s)},children:r})}})})]})]})}const n2=()=>{const[e,t]=v.useState(!0),[n,a]=v.useState(null),[i,o]=v.useState(null),{member:r,site:s}=v.useContext(_);return v.useEffect(()=>{async function c(){const u=s.url,d=window.location.origin+window.location.pathname,p=r?`${d}?action=support&success=true`:`${d}#/portal/support/success`,m=d,f=rl({siteUrl:u});try{const b=await f.member.checkoutDonation({successUrl:p,cancelUrl:m,personalNote:h("Add a personal note")});b.url&&window.location.replace(b.url)}catch(b){b.type&&b.type==="DisabledFeatureError"?o(h("This site is not accepting payments at the moment.")):a(h("Something went wrong, please try again later.")),t(!1)}}s&&s.donations_enabled===!1?(o(h("This site is not accepting donations at the moment.")),t(!1)):c()},[]),e?l.jsx("div",{children:l.jsx(ai,{})}):n?l.jsx(im,{error:n}):i?l.jsx(im,{error:i}):null};function a2({product:e}){return!e.benefits||!e.benefits.length?null:l.jsx("div",{className:"gh-portal-product-benefits",children:e.benefits.map((t,n)=>{const a=(t==null?void 0:t.id)||`benefit-${n}`;return l.jsxs("div",{className:"gh-portal-product-benefit",children:[l.jsx(Do,{className:"gh-portal-benefit-checkmark",alt:""}),l.jsx("div",{className:"gh-portal-benefit-title",children:t.name})]},a)})})}function i2({product:e,selectedInterval:t}){const n=e.monthlyPrice,a=e.yearlyPrice;if(!n||!a)return null;const i=t==="month"?n:a,o=ke(i.currency),r=nl(n.amount,a.amount);return l.jsxs("div",{className:"gh-portal-product-card-pricecontainer",children:[l.jsxs("div",{className:"gh-portal-product-card-price-trial",children:[l.jsxs("div",{className:"gh-portal-product-price",children:[l.jsx("span",{className:"currency-sign"+(o.length>1?" long":""),children:o}),l.jsx("span",{className:"amount","data-testid":"product-amount",children:aa(Js(i.amount))})]}),t==="year"&&r>0&&l.jsxs("span",{className:"gh-portal-discount-label",children:[r,"% discount"]})]}),l.jsx("div",{className:"gh-portal-product-alternative-price",style:{display:"block"},children:"one-time payment"})]})}function o2({brandColor:e,product:t,selectedInterval:n,isDisabled:a,isPurchasing:i,onPurchase:o}){let r=t.description;return(!t.benefits||!t.benefits.length)&&!r&&(r="Full access"),l.jsxs("div",{className:"gh-portal-product-card","data-test-tier":"paid",children:[l.jsxs("div",{className:"gh-portal-product-card-header",children:[l.jsx("h4",{className:"gh-portal-product-name",children:t.name}),l.jsx(i2,{product:t,selectedInterval:n})]}),l.jsxs("div",{className:"gh-portal-product-card-details",children:[l.jsxs("div",{className:"gh-portal-product-card-detaildata",children:[r&&l.jsx("div",{className:"gh-portal-product-description","data-testid":"product-description",children:r}),l.jsx(a2,{product:t})]}),l.jsx("div",{className:"gh-portal-btn-product",children:l.jsx(me,{dataTestId:"purchase-gift",label:l.jsxs(l.Fragment,{children:[l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{marginRight:"6px",verticalAlign:"middle"},children:[l.jsx("rect",{x:"3",y:"8",width:"18",height:"4",rx:"1"}),l.jsx("path",{d:"M12 8v13"}),l.jsx("path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7"}),l.jsx("path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5"})]})," Gift this"]}),onClick:s=>o(s,t),disabled:a,isRunning:i,brandColor:e,style:{width:"100%"}})})]})]})}function r2({selectedInterval:e,setSelectedInterval:t,products:n}){const{site:a}=v.useContext(_),{portal_plans:i}=a,o=n.map(s=>{var c,u;return nl((c=s.monthlyPrice)==null?void 0:c.amount,(u=s.yearlyPrice)==null?void 0:u.amount)}),r=Math.max(...o);return!i.includes("monthly")||!i.includes("yearly")?null:l.jsx("div",{className:"gh-portal-logged-out-form-container",children:l.jsxs("div",{className:"gh-portal-products-pricetoggle"+(e==="month"?" left":""),children:[l.jsx("button",{"data-test-button":"switch-monthly",className:"gh-portal-btn"+(e==="month"?" active":""),onClick:()=>t("month"),children:"1 month"}),l.jsxs("button",{"data-test-button":"switch-yearly",className:"gh-portal-btn"+(e==="year"?" active":""),onClick:()=>t("year"),children:["1 year",r>0&&l.jsxs("span",{className:"gh-portal-maximum-discount",children:["(save ",r,"%)"]})]})]})})}const s2=()=>{const{site:e,member:t,brandColor:n,action:a,doAction:i}=v.useContext(_),[o,r]=v.useState((t==null?void 0:t.email)||""),[s,c]=v.useState(""),[u,d]=v.useState(null),[p,m]=v.useState(null);if(!e)return l.jsx(ai,{});const{portal_plans:f,portal_default_plan:b}=e,w=Zs({portalPlans:f,portalDefaultPlan:b,selectedInterval:u}),g=To({site:e}).filter(N=>N.type==="paid");if(g.length===0){const N=e.icon;return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"gh-portal-back-sitetitle",children:l.jsx(Fo,{})}),l.jsx(pe,{}),l.jsxs("div",{className:"gh-portal-content signup",children:[l.jsxs("header",{className:"gh-portal-signup-header",children:[N&&l.jsx("img",{className:"gh-portal-signup-logo",src:N,alt:e.title}),l.jsx("h1",{className:"gh-portal-main-title",children:e.title||""})]}),l.jsx("section",{children:l.jsx("div",{className:"gh-portal-section",children:l.jsx("p",{className:"gh-portal-invite-only-notification",children:"Gift subscriptions are not available right now."})})})]})]})}const y=e.icon,k=e.title||"",C=a==="checkoutGift:running",x=Zn()||C,T=[{type:"email",value:o,placeholder:"jamie@example.com",label:"Your email",name:"email",required:!0,tabIndex:1,autoFocus:!0,errorMessage:s}],E=(N,z)=>{N.preventDefault();const j=Oo({fields:T});if(j.email){c(j.email);return}c(""),m(z.id),i("checkoutGift",{tierId:z.id,cadence:w,email:o})};return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"gh-portal-back-sitetitle",children:l.jsx(Fo,{})}),l.jsx(pe,{}),l.jsxs("div",{className:"gh-portal-content signup",children:[l.jsxs("header",{className:"gh-portal-signup-header",children:[y&&l.jsx("img",{className:"gh-portal-signup-logo",src:y,alt:k}),l.jsx("h1",{className:"gh-portal-main-title",children:k}),l.jsx("p",{className:"gh-portal-main-subtitle",style:{fontSize:"1.7rem",marginTop:"8px"},children:"Give the gift of a membership"})]}),l.jsx("section",{className:"gh-portal-signup",children:l.jsxs("div",{className:"gh-portal-section",children:[l.jsx("div",{className:"gh-portal-logged-out-form-container",children:l.jsx(ti,{fields:T,onChange:N=>{r(N.target.value),s&&c("")}})}),l.jsxs("section",{className:"gh-portal-products",children:[l.jsx(r2,{selectedInterval:w,setSelectedInterval:d,products:g}),l.jsx("div",{className:"gh-portal-products-grid",children:g.map(N=>l.jsx(o2,{brandColor:n,product:N,selectedInterval:w,isDisabled:x,isPurchasing:C&&p===N.id,onPurchase:E},N.id))})]}),l.jsx("div",{className:"gh-portal-signup-message",children:l.jsx("div",{children:"Only redeemable by free or new members."})})]})})]})]})},l2=()=>{try{if(window.parent&&window.parent!==window&&window.parent.location.href)return window.parent}catch{}return window},Ho=(e,t)=>{const n=new URLSearchParams(t);return`${e}?${n.toString()}`},c2=({shareTitle:e,shareUrl:t})=>{const n=[e,t].filter(Boolean).join(`
|
|
4127
|
+
`;function $P({site:e}){return vd+xP+x0+O0+K0+C0()+S0+b0+w0+db+_T+$T+BT()+Dd+RT+CP+EP+HT+ZT+XT+QT+tP+oP+pP+lP+gP+vP+wP}const xm=class xm extends Z.Component{constructor(t){super(t),this.state={email:"",token:void 0}}componentDidMount(){const{member:t}=this.context;t&&this.context.doAction("switchPage",{page:"accountHome"})}handleSignin(t){t.preventDefault(),this.doSignin()}doSignin(){this.setState(t=>({errors:Oo({fields:this.getInputFields({state:t})})}),async()=>{const{email:t,phonenumber:n,errors:a,token:i}=this.state,{redirect:o}=this.context.pageData??{};a&&Object.values(a).filter(s=>!!s).length>0||this.context.doAction("signin",{email:t,phonenumber:n,redirect:o,token:i})})}handleInputChange(t,n){const a=n.name;this.setState({[a]:t.target.value})}onKeyDown(t){t.keyCode===13&&this.handleSignin(t)}getInputFields({state:t}){const n=t.errors||{};return[{type:"email",value:t.email,placeholder:h("jamie@example.com"),label:h("Email"),name:"email",required:!0,errorMessage:n.email||"",autoFocus:!0},{type:"text",value:t.phonenumber,placeholder:"+1 (123) 456-7890",label:"Phone number",name:"phonenumber",required:!1,tabIndex:-1,autoComplete:"off",hidden:!0}]}renderSubmitButton(){const{action:t}=this.context;let n=!1;const a=t==="signin:running";let i=h(a?"Sending login link...":"Continue");const o=!!a;return t==="signin:failed"&&(i=h("Retry"),n=!0),l.jsx(me,{dataTestId:"signin",retry:n,style:{width:"100%"},onClick:r=>this.handleSignin(r),disabled:o,brandColor:this.context.brandColor,label:i,isRunning:a})}renderSignupMessage(){const{brandColor:t}=this.context;return l.jsxs("div",{className:"gh-portal-signup-message",children:[l.jsx("div",{children:h("Don't have an account?")}),l.jsx("button",{"data-test-button":"signup-switch",className:"gh-portal-btn gh-portal-btn-link",style:{color:t},onClick:()=>this.context.doAction("switchPage",{page:"signup"}),children:l.jsx("span",{children:h("Sign up")})})]})}renderForm(){const{site:t}=this.context,n=Ls({site:t})&&Qt({site:t});return zn({site:t})?l.jsxs("section",{children:[l.jsx("div",{className:"gh-portal-section",children:l.jsx(ti,{fields:this.getInputFields({state:this.state}),onChange:(a,i)=>this.handleInputChange(a,i),onKeyDown:(a,i)=>this.onKeyDown(a,i)})}),l.jsxs("footer",{className:"gh-portal-signin-footer",children:[this.renderSubmitButton(),n&&this.renderSignupMessage()]})]}):l.jsx("section",{children:l.jsx("div",{className:"gh-portal-section",children:l.jsx("p",{className:"gh-portal-members-disabled-notification","data-testid":"members-disabled-notification-text",children:h("Memberships unavailable, contact the owner for access.")})})})}renderSiteIcon(){const{site:t}=this.context,n=t.icon;return n?l.jsx("img",{className:"gh-portal-signup-logo",src:n,alt:this.context.site.title}):zn({site:t})?null:l.jsx(Gb,{className:"gh-portal-icon gh-portal-icon-invitation"})}renderSiteTitle(){const{site:t}=this.context,n=t.title;return zn({site:t})?l.jsx("h1",{className:"gh-portal-main-title",children:h("Sign in")}):l.jsx("h1",{className:"gh-portal-main-title",children:n})}renderFormHeader(){return l.jsxs("header",{className:"gh-portal-signin-header",children:[this.renderSiteIcon(),this.renderSiteTitle()]})}render(){return l.jsxs(l.Fragment,{children:[l.jsx(pe,{}),l.jsx("div",{className:"gh-portal-logged-out-form-container",children:l.jsxs("div",{className:"gh-portal-content signin",children:[this.renderFormHeader(),this.renderForm()]})})]})}};xm.contextType=_;let om=xm;const jP=({handleSignout:e,supportAddress:t=""})=>{const n=`mailto:${t}`;return l.jsxs("footer",{className:"gh-portal-account-footer",children:[l.jsx("ul",{className:"gh-portal-account-footermenu",children:l.jsx("li",{children:l.jsx("button",{"data-test-button":"footer-signout",className:"gh-portal-btn",name:"logout","aria-label":"logout",onClick:a=>e(a),children:h("Sign out")})})}),l.jsx("div",{className:"gh-portal-account-footerright",children:l.jsx("ul",{className:"gh-portal-account-footermenu",children:l.jsx("li",{children:l.jsx("a",{"data-test-link":"footer-support",className:"gh-portal-btn gh-portal-btn-branded",href:n,onClick:()=>{n&&window.open(n)},children:h("Contact support")})})})})]})},TP=()=>{const{member:e,brandColor:t}=v.useContext(_),n=e.avatar_image;return l.jsxs("header",{className:"gh-portal-account-header",children:[l.jsx(kd,{gravatar:n,style:{userIcon:{color:t,width:"56px",height:"56px",padding:"2px"}}}),l.jsx("h2",{className:"gh-portal-main-title",children:h("Your account")})]})},PP=()=>{const{site:e,action:t,brandColor:n,doAction:a}=v.useContext(_);if(!Ls({site:e})||!Qt({site:e}))return null;const i=["checkoutPlan:running"].includes(t),o=()=>{a("switchPage",{page:"accountPlan",lastPage:"accountHome"})};return l.jsx(me,{dataTestId:"view-plans",isRunning:i,label:h("View plans"),onClick:()=>o(),brandColor:n,style:{width:"100%"}})},zP=()=>{const{member:e,site:t}=v.useContext(_),{is_stripe_configured:n}=t;if(!n||Ja({site:t}))return null;const a=rt({member:e}),i=Pn({member:e});if(i&&!a)return null;if(a){const o=a==null?void 0:a.current_period_end;if(i&&wd({member:e})){const r=wd({member:e}),s=Xt(r);return l.jsx("div",{className:"gh-portal-section",children:l.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:h("Your subscription will expire on {expiryDate}",{expiryDate:s})})})}if(a!=null&&a.cancel_at_period_end||i)return null;if(xd({sub:a})){const r=Xt(a.trial_end_at);return l.jsx("div",{className:"gh-portal-section",children:l.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:h("Your subscription will start on {subscriptionStart}",{subscriptionStart:r})})})}return l.jsx("div",{className:"gh-portal-section",children:l.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:h("Your subscription will renew on {renewalDate}",{renewalDate:Xt(o)})})})}return l.jsxs("div",{className:"gh-portal-section",children:[l.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:h("You currently have a free membership, upgrade to a paid subscription for full access.")}),l.jsx(PP,{})]})},IP=()=>{const{member:e,doAction:t,action:n,brandColor:a}=v.useContext(_),i=rt({member:e});if(!i||!i.cancel_at_period_end)return null;const o=h("Resume subscription"),r=["continueSubscription:running"].includes(n),s=!!r,c=Xt(i.current_period_end);return l.jsx("div",{className:"gh-portal-cancelcontinue-container",children:l.jsxs("div",{className:"gh-portal-cancel-banner",children:[l.jsx("p",{children:l.jsx($e,{string:h("Your subscription has been canceled and will expire on {expiryDate}."),mapping:{expiryDate:l.jsx("strong",{children:c})}})}),l.jsx(me,{onClick:()=>{t("continueSubscription",{subscriptionId:i.id})},isRunning:r,disabled:s,isPrimary:!0,brandColor:a,label:o,style:{width:"100%"}})]})})},NP=e=>v.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},v.createElement("defs",null,v.createElement("style",null,".a{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.5px;}")),v.createElement("path",{d:"M22.939 2.56V8.817C22.9391 9.61244 22.6232 10.3754 22.061 10.938L10.5 22.5C10.2187 22.7812 9.83721 22.9392 9.43946 22.9392C9.04172 22.9392 8.66026 22.7812 8.37896 22.5L1.49997 15.62C1.21876 15.3387 1.06079 14.9572 1.06079 14.5595C1.06079 14.1618 1.21876 13.7803 1.49997 13.499L13.061 1.938C13.6236 1.37572 14.3865 1.0599 15.182 1.06H21.439C21.8368 1.06 22.2183 1.21803 22.4996 1.49934C22.7809 1.78064 22.939 2.16217 22.939 2.56V2.56Z",className:"a"}),v.createElement("path",{d:"M17.689 7.81C16.8605 7.81 16.189 7.13842 16.189 6.31C16.189 5.48157 16.8605 4.81 17.689 4.81C18.5174 4.81 19.189 5.48157 19.189 6.31C19.189 7.13842 18.5174 7.81 17.689 7.81Z",className:"a"})),AP=()=>{const{member:e,site:t,doAction:n}=v.useContext(_),a=()=>{const m=rt({member:e});n("manageBilling",{subscriptionId:m.id})},i=()=>{const{is_stripe_configured:m}=t;m&&n("switchPage",{page:"accountPlan",lastPage:"accountHome"})},o=({price:m,isComplimentary:f,subscription:b})=>{const{next_payment:w}=b||{};let g="";if(m){const{amount:E=0,currency:N,interval:z}=m;g=`${Intl.NumberFormat("en",{currency:N,style:"currency"}).format(E/100)}/${h(z)}`}const y=wd({member:e});f&&(y?g=`${h("Complimentary")} - ${h("Expires {expiryDate}",{expiryDate:y})}`:g=g?`${h("Complimentary")} (${g})`:h("Complimentary"));let k="";if(xd({sub:b}))return k="gh-portal-account-old-price",l.jsxs(l.Fragment,{children:[l.jsx("p",{className:k,children:g}),l.jsx(MP,{subscription:b})]});let x=DP({nextPayment:w});x&&(k="gh-portal-account-old-price");const T=()=>x?l.jsxs("p",{className:"gh-portal-account-discountcontainer","data-testid":"offer-label",children:[l.jsx(NP,{className:"gh-portal-account-tagicon"}),l.jsx("span",{children:x})]}):null;return l.jsxs(l.Fragment,{children:[l.jsx("p",{className:k,children:g}),l.jsx(T,{})]})},r=({isPaid:m})=>Ja({site:t})&&!m?null:l.jsx("button",{className:"gh-portal-btn gh-portal-btn-list",onClick:f=>i(),"data-test-button":"change-plan",children:h("Change")}),s=({defaultCardLast4:m})=>{if(m){const f=`**** **** **** ${m}`;return l.jsx("p",{children:f})}return null},c=({defaultCardLast4:m,isComplimentary:f})=>{const{action:b}=v.useContext(_),w=b==="manageBilling:running"?l.jsx(Xa,{className:"gh-portal-billing-button-loader"}):h("Update");return f?null:l.jsxs("section",{children:[l.jsxs("div",{className:"gh-portal-list-detail",children:[l.jsx("h3",{children:h("Billing info & receipts")}),l.jsx(s,{defaultCardLast4:m})]}),l.jsx("button",{className:"gh-portal-btn gh-portal-btn-list",onClick:g=>a(),"data-test-button":"manage-billing",children:w})]})},u=rt({member:e}),d=Pn({member:e}),p=Dt({member:e});if(u||d){const{price:m,default_payment_card_last4:f}=u||{};let b=h("Plan");return Bs({site:t})&&hb({member:e})&&(b=hb({member:e})),l.jsxs(l.Fragment,{children:[l.jsxs("section",{children:[l.jsxs("div",{className:"gh-portal-list-detail",children:[l.jsxs("h3",{children:[b,(u==null?void 0:u.cancel_at_period_end)&&l.jsx("span",{className:"gh-portal-canceled-badge",children:h("Canceled")})]}),l.jsx(o,{price:m,isComplimentary:d,subscription:u})]}),l.jsx(r,{isPaid:p})]}),l.jsx(c,{isComplimentary:d,defaultCardLast4:f})]})}return null};function MP({subscription:e}){if(xd({sub:e})){const t=Xt(e.trial_end_at);return l.jsx("p",{className:"gh-portal-account-discountcontainer",children:l.jsx("div",{children:l.jsx("span",{children:h("Free Trial – Ends {trialEnd}",{trialEnd:t})})})})}return null}function DP({nextPayment:e}){if(!e)return"";const t=e.discount;if(!t)return"";const n=t.end?h("Ends {offerEndDate}",{offerEndDate:Xt(t.end)}):h("Forever");return`${`${Intl.NumberFormat("en",{currency:e.currency,style:"currency"}).format(e.amount/100)}/${h(e.interval)}`}${n?` — ${n}`:""}`}function FP(){const{member:e,site:t,doAction:n}=v.useContext(_);let{newsletters:a}=e;const i=!!(a!=null&&a.length);let o=h(i?"Subscribed":"Unsubscribed");const r=s=>{var d;s.preventDefault();const c=ta({site:t}),u=(d=e==null?void 0:e.newsletters)!=null&&d.length?[]:c;n("updateNewsletterPreference",{newsletters:u})};return l.jsxs("section",{children:[l.jsxs("div",{className:"gh-portal-list-detail email-newsletter",children:[l.jsx("h3",{children:h("Email newsletter")}),l.jsxs("p",{children:[o," ",Cd({member:e})&&i&&l.jsx("button",{className:"gh-portal-btn-text gh-email-faq-page-button",onClick:()=>n("switchPage",{page:"emailReceivingFAQ",lastPage:"accountHome"}),children:h("Not receiving emails?")})]})]}),l.jsx("div",{children:l.jsx(tl,{dataTestId:"default-newsletter-toggle",id:"default-newsletter-toggle",onToggle:s=>{r(s)},checked:i})})]})}const bk=e=>v.createElement("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",...e},v.createElement("path",{d:"m12.79 12.376 4.08 4.079m-4.08 0 4.08-4.08",stroke:"red",strokeWidth:1.35,strokeLinecap:"round",strokeLinejoin:"round"}),v.createElement("path",{d:"m10.439 17.994-2.664-2.652-2.86 1.478.111-4.239m0 0L1.677 9.232a1.344 1.344 0 0 1-.366-1.222 1.369 1.369 0 0 1 .904-1.05l13.111-4.374a1.369 1.369 0 0 1 1.76 1.758L15 10m-9.974 2.581 11.67-9.727",stroke:"#A3A3A3",strokeWidth:1.35,strokeLinecap:"round",strokeLinejoin:"round"}));function OP(){return l.jsxs("p",{className:"gh-portal-email-notice",children:[l.jsx(bk,{className:"gh-portal-email-notice-icon"}),l.jsx("span",{className:"gh-mobile-only",children:h("You're not receiving emails")}),l.jsx("span",{className:"gh-desktop-only",children:h("You're currently not receiving emails")})]})}function _P(){const{doAction:e,member:t,site:n}=v.useContext(_),a=yb({member:t}),i=jo({site:n}),o=Us({site:n}),r=a?"emailSuppressed":"accountEmail",s=!i&&!o,c=()=>a||s?l.jsx(OP,{}):l.jsx("p",{children:h("Update your preferences")});return l.jsxs("section",{children:[l.jsxs("div",{className:"gh-portal-list-detail",children:[l.jsx("h3",{children:h("Emails")}),c()]}),l.jsx("button",{className:"gh-portal-btn gh-portal-btn-list",onClick:()=>{e("switchPage",{page:r,lastPage:"accountHome"})},"data-test-button":"manage-newsletters",children:h("Manage")})]})}const RP=()=>{const{member:e,site:t}=v.useContext(_),a=t.transistor_portal_settings||{enabled:t.transistor_portal_enabled===!0,heading:t.transistor_portal_heading,description:t.transistor_portal_description,button_text:t.transistor_portal_button_text,url_template:t.transistor_portal_url_template},i=(a==null?void 0:a.enabled)===!0,o=e==null?void 0:e.uuid,r=xb(),[s,c]=v.useState(r&&i);return v.useEffect(()=>{if(r){c(i);return}if(!i||!o){c(!1);return}c(!1);const u=new AbortController;return(async()=>{try{const p=await fetch(`https://partner.transistor.fm/ghost/member/${o}`,{signal:u.signal});if(p.ok){const m=await p.json();u.signal.aborted||c((m==null?void 0:m.member)===!0)}}catch(p){if(u.signal.aborted)return;console.warn("Error in Transistor request",p)}})(),()=>u.abort()},[i,o,r]),{transistor:{enabled:i,hasPodcasts:s,memberUuid:o,settings:a}}},YP=(e,t)=>zo({site:e})&&jo({site:e})||Us({site:e})||yb({member:t}),LP=e=>!zo({site:e})&&jo({site:e})&&!Us({site:e}),BP=()=>{const{member:e,doAction:t,site:n}=v.useContext(_),{name:a,email:i}=e,{transistor:o}=RP(),r=()=>{t("switchPage",{page:"accountProfile",lastPage:"accountHome"})},s=YP(n,e),c=LP(n);return l.jsx("div",{children:l.jsxs("div",{className:"gh-portal-list",children:[l.jsxs("section",{children:[l.jsxs("div",{className:"gh-portal-list-detail",children:[l.jsx("h3",{children:a||h("Account")}),l.jsx("p",{children:i})]}),l.jsx("button",{"data-test-button":"edit-profile",className:"gh-portal-btn gh-portal-btn-list",onClick:u=>r(),children:h("Edit")})]}),l.jsx(AP,{}),s&&l.jsx(_P,{}),c&&l.jsx(FP,{}),o.enabled&&l.jsx(SP,{hasPodcasts:o.hasPodcasts,memberUuid:o.memberUuid,settings:o.settings})]})})},UP=()=>l.jsxs("div",{className:"gh-portal-content gh-portal-account-main",children:[l.jsx(pe,{}),l.jsx(TP,{}),l.jsxs("section",{className:"gh-portal-account-data",children:[l.jsx(zP,{}),l.jsx(IP,{}),l.jsx(BP,{})]})]}),Cm=class Cm extends Z.Component{componentDidMount(){const{member:t,site:n}=this.context;zn({site:n})||this.context.doAction("signout"),t||this.context.doAction("switchPage",{page:"signin",pageData:{redirect:window.location.href}})}handleSignout(t){t.preventDefault(),this.context.doAction("signout")}render(){const{member:t,site:n}=this.context,a=Io({site:n});return!t||!zn({site:n})?null:l.jsxs("div",{className:"gh-portal-account-wrapper",children:[l.jsx(UP,{}),l.jsx(jP,{onClose:()=>this.context.doAction("closePopup"),handleSignout:i=>this.handleSignout(i),supportAddress:a})]})}};Cm.contextType=_;let rm=Cm;const Em=class Em extends Z.Component{constructor(t,n){super(t,n);const{name:a="",email:i=""}=n.member||{};this.state={name:a,email:i}}componentDidMount(){const{member:t}=this.context;t||this.context.doAction("switchPage",{page:"signin"})}handleSignout(t){t.preventDefault(),this.context.doAction("signout")}onBack(){this.context.doAction("back")}onProfileSave(t){t.preventDefault(),this.setState(n=>({errors:Oo({fields:this.getInputFields({state:n})})}),()=>{const{email:n,name:a,errors:i}=this.state;i&&Object.values(i).filter(r=>!!r).length>0||(this.context.doAction("clearPopupNotification"),this.context.doAction("updateProfile",{email:n,name:a}))})}renderSaveButton(){const t=this.context.action==="updateProfile:running";let n=h("Save");this.context.action==="updateProfile:failed"&&(n=h("Retry"));const a=!!t;return l.jsx(me,{dataTestId:"save-button",isRunning:t,onClick:i=>this.onProfileSave(i),disabled:a,brandColor:this.context.brandColor,label:n,style:{width:"100%"}})}renderDeleteAccountButton(){return l.jsx("div",{style:{cursor:"pointer",color:"red"},role:"button",children:h("Delete account")})}renderAccountFooter(){return l.jsx("footer",{className:"gh-portal-action-footer",children:this.renderSaveButton()})}renderHeader(){return l.jsxs("header",{className:"gh-portal-detail-header",children:[l.jsx(Qa,{brandColor:this.context.brandColor,hidden:!this.context.lastPage,onClick:t=>this.onBack(t)}),l.jsx("h3",{className:"gh-portal-main-title",children:h("Account settings")})]})}renderUserAvatar(){const t=this.context.member&&this.context.member.avatar_image,n={position:"relative",display:"flex",width:"64px",height:"64px",marginBottom:"6px",borderRadius:"100%",boxShadow:"0 0 0 3px #fff",border:"1px solid gray",overflow:"hidden",justifyContent:"center",alignItems:"center"};return l.jsx("div",{style:n,children:l.jsx(kd,{gravatar:t,style:{userIcon:{color:"black",width:"56px",height:"56px"}}})})}handleInputChange(t,n){const a=n.name;this.setState({[a]:t.target.value})}getInputFields({state:t,fieldNames:n}){const a=t.errors||{},i=[{type:"text",value:t.name,placeholder:h("Jamie Larson"),label:h("Name"),name:"name",required:!1,errorMessage:a.name||""},{type:"email",value:t.email,placeholder:h("jamie@example.com"),label:h("Email"),name:"email",required:!0,errorMessage:a.email||""}];return n&&n.length>0?i.filter(o=>n.includes(o.name)):i}onKeyDown(t){t.keyCode===13&&this.onProfileSave(t)}renderProfileData(){return l.jsx("div",{className:"gh-portal-section",children:l.jsx(ti,{fields:this.getInputFields({state:this.state}),onChange:(t,n)=>this.handleInputChange(t,n),onKeyDown:(t,n)=>this.onKeyDown(t,n)})})}render(){const{member:t}=this.context;return t?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"gh-portal-content with-footer",children:[l.jsx(pe,{}),this.renderHeader(),l.jsx("div",{className:"gh-portal-section",children:this.renderProfileData()})]}),this.renderAccountFooter()]}):null}};Em.contextType=_;let sm=Em;function HP(){const{brandColor:e,lastPage:t,doAction:n}=v.useContext(_);return l.jsxs("header",{className:"gh-portal-detail-header",children:[l.jsx(Qa,{brandColor:e,hidden:!t,onClick:()=>{n("back")}}),l.jsx("h3",{className:"gh-portal-main-title",children:h("Email preferences")})]})}function VP({newsletter:e,subscribedNewsletters:t,setSubscribedNewsletters:n}){const a=t.some(i=>i.id===(e==null?void 0:e.id));return l.jsxs("section",{className:"gh-portal-list-toggle-wrapper","data-testid":"newsletter-toggle",children:[l.jsxs("div",{className:"gh-portal-list-detail",children:[l.jsx("h3",{children:e.name}),l.jsx("p",{children:e==null?void 0:e.description})]}),l.jsx("div",{style:{display:"flex",alignItems:"center"},children:l.jsx(tl,{id:e.id,onToggle:(i,o)=>{let r=[];o?r=t.filter(s=>s.id!==e.id).concat(e):r=t.filter(s=>s.id!==e.id),n(r)},checked:a,dataTestId:"switch-input"})})]})}function WP({updateCommentNotifications:e,isCommentsEnabled:t,enableCommentNotifications:n}){const{doAction:a}=v.useContext(_),i=!!n;if(!t)return null;const o=async(r,s)=>{await e(s),a("showPopupNotification",{action:"updated:success",message:h("Comment preferences updated.")})};return l.jsxs("section",{className:"gh-portal-list-toggle-wrapper","data-testid":"comment-toggle",children:[l.jsxs("div",{className:"gh-portal-list-detail",children:[l.jsx("h3",{children:h("Comments")}),l.jsx("p",{children:h("Get notified when someone replies to your comment")})]}),l.jsx("div",{style:{display:"flex",alignItems:"center"},children:l.jsx(tl,{id:"comments",onToggle:o,checked:i,dataTestId:"switch-input"})})]})}function GP({subscribedNewsletters:e,setSubscribedNewsletters:t,hasNewslettersEnabled:n}){const{site:a}=v.useContext(_),i=ta({site:a});return n?i.map(o=>l.jsx(VP,{newsletter:o,subscribedNewsletters:e,setSubscribedNewsletters:t},o==null?void 0:o.id)):null}function KP({site:e,isPaid:t}){return t?l.jsx("p",{style:{textAlign:"center",marginTop:"12px",marginBottom:"0",color:"var(--grey6)"},children:h("Unsubscribing from emails will not cancel your paid subscription to {title}",{title:e==null?void 0:e.title})}):null}function kk({hasNewslettersEnabled:e,notification:t,subscribedNewsletters:n,updateSubscribedNewsletters:a,updateCommentNotifications:i,unsubscribeAll:o,isPaidMember:r,isCommentsEnabled:s,enableCommentNotifications:c}){const{brandColor:u,doAction:d,member:p,site:m}=v.useContext(_),f=!(n!=null&&n.length)&&(s&&!c||!s),w=t||(()=>null);return l.jsxs("div",{className:"gh-portal-content with-footer",children:[l.jsx(pe,{}),l.jsx(HP,{}),l.jsx(w,{}),l.jsx("div",{className:"gh-portal-section flex",children:l.jsxs("div",{className:"gh-portal-list",children:[l.jsx(GP,{hasNewslettersEnabled:e,subscribedNewsletters:n,setSubscribedNewsletters:g=>{let y=g.map(k=>({id:k.id}));a(y)}}),l.jsx(WP,{isCommentsEnabled:s,enableCommentNotifications:c,updateCommentNotifications:i})]})}),l.jsx("div",{className:"gh-portal-btn-product gh-portal-btn-unsubscribe",style:{marginTop:"-48px",marginBottom:0},children:l.jsx(me,{isRunning:!1,onClick:()=>{o()},disabled:f,brandColor:u,isPrimary:!1,label:h("Unsubscribe from all emails"),isDestructive:!0,style:{width:"100%",zIndex:900},dataTestId:"unsubscribe-from-all-emails"})}),l.jsxs("footer",{className:"gh-portal-action-footer"+(Cd({member:p})?" gh-feature-suppressions":""),children:[l.jsx("div",{style:{width:"100%"},children:l.jsx(KP,{isPaid:r,site:m,subscribedNewsletters:n})}),Cd({member:p})&&!f&&l.jsxs("div",{className:"gh-portal-footer-secondary",children:[l.jsx("span",{className:"gh-portal-footer-secondary-light",children:h("Not receiving emails?")}),l.jsxs("button",{className:"gh-portal-btn-text gh-email-faq-page-button",onClick:()=>d("switchPage",{page:"emailReceivingFAQ",pageData:{direct:!1}}),children:[h("Get help")," ",l.jsx("span",{className:"right-arrow",children:"→"})]})]})]})]})}function qP(){const{member:e,doAction:t,site:n,pageData:a}=v.useContext(_);let i,o;a&&(i=a.newsletterUuid,o=a.action);const[r,s]=v.useState(!0),c=ta({site:n}),u=jo({site:n});v.useEffect(()=>{e||t("switchPage",{page:"signin"})},[e,t]),v.useEffect(()=>{if(i&&o==="unsubscribe"){const g=e==null?void 0:e.newsletters.filter(y=>y.uuid!==i);f(g),s(!1),t("updateNewsletterPreference",{newsletters:g})}},[]);const d=()=>{if(a.comments&&b){const k=r?"gh-portal-hide":"";return l.jsx(l.Fragment,{children:l.jsx("p",{className:`gh-portal-text-center gh-portal-header-message ${k}`,children:l.jsx($e,{string:h("{memberEmail} will no longer receive emails when someone replies to your comments."),mapping:{memberEmail:l.jsx("strong",{children:e==null?void 0:e.email})}})})})}const g=c==null?void 0:c.find(k=>k.uuid===a.newsletterUuid);if(!g)return null;const y=r?"gh-portal-hide":"";return l.jsx(l.Fragment,{children:l.jsx("p",{className:`gh-portal-text-center gh-portal-header-message ${y}`,children:l.jsx($e,{string:h("{memberEmail} will no longer receive {newsletterName} newsletter."),mapping:{memberEmail:l.jsx("strong",{children:e==null?void 0:e.email}),newsletterName:l.jsx("strong",{children:g==null?void 0:g.name})}})})})},p=[...(e==null?void 0:e.newsletters)||[]],[m,f]=v.useState(p),{comments_enabled:b}=n,{enable_comment_notifications:w}=e||{};return v.useEffect(()=>{f((e==null?void 0:e.newsletters)||[])},[e==null?void 0:e.newsletters]),l.jsx(kk,{hasNewslettersEnabled:u,notification:i?d:null,subscribedNewsletters:m,updateSubscribedNewsletters:g=>{f(g),t("updateNewsletterPreference",{newsletters:g}),t("showPopupNotification",{action:"updated:success",message:h("Email preferences updated.")})},updateCommentNotifications:async g=>{t("updateNewsletterPreference",{enableCommentNotifications:g})},unsubscribeAll:()=>{f([]),t("showPopupNotification",{action:"updated:success",message:h("Unsubscribed from all emails.")});const g={newsletters:[]};b&&(g.enableCommentNotifications=!1),t("updateNewsletterPreference",g)},isPaidMember:Dt({member:e}),isCommentsEnabled:b!=="off",enableCommentNotifications:w})}function JP(){const{site:e}=v.useContext(_),t=e.icon;return t?l.jsx("img",{className:"gh-portal-unsubscribe-logo",src:t,alt:e.title}):null}function ZP(){const{site:e}=v.useContext(_),t=e.title||"";return l.jsxs("header",{className:"gh-portal-header",children:[l.jsx(JP,{}),l.jsx("h2",{className:"gh-portal-publication-title",children:t})]})}async function vk({api:e,memberUuid:t,key:n,newsletters:a,enableCommentNotifications:i}){try{return await e.member.updateNewsletters({uuid:t,key:n,newsletters:a,enableCommentNotifications:i})}catch{}}function XP(){const{site:e,api:t,pageData:n,member:a,doAction:i}=v.useContext(_),[o,r]=v.useState(),[s,c]=v.useState(!0),u=ta({site:e}),d=u.filter(z=>z.subscribe_on_signup),[p,m]=v.useState(!1),[f,b]=v.useState(d),[w,g]=v.useState(!1),{comments_enabled:y}=e,{enable_comment_notifications:k=!1}=o||{},C=jo({site:e}),x=async z=>{a?i("updateNewsletterPreference",{newsletters:z}):await vk({api:t,memberUuid:n.uuid,key:n.key,newsletters:z}),b(z);const j={action:"updated:success",message:h("Email preferences updated.")};i("showPopupNotification",j)},T=async z=>{let j;a?(await i("updateNewsletterPreference",{enableCommentNotifications:z}),j={...a,enable_comment_notifications:z}):j=await vk({api:t,memberUuid:n.uuid,key:n.key,enableCommentNotifications:z}),r(j),i("showPopupNotification",{action:"updated:success",message:h("Comment preferences updated.")})},E=async()=>{let z;a?(await i("updateNewsletterPreference",{newsletters:[],enableCommentNotifications:!1}),z={...a},z.newsletters=[],z.enable_comment_notifications=!1):z=await t.member.updateNewsletters({uuid:n.uuid,key:n.key,newsletters:[],enableCommentNotifications:!1}),b([]),r(z),i("showPopupNotification",{action:"updated:success",message:h("Unsubscribed from all emails.")})};if(v.useEffect(()=>{(async()=>{let z;try{z=await t.member.newsletters({uuid:n.uuid,key:n.key}),r(z??null),c(!1)}catch(V){console.error("[PORTAL] Error fetching member newsletters",V),r(null),c(!1);return}if(z===null)return;const j=(z==null?void 0:z.newsletters)||[];b(j),(u==null?void 0:u.length)===1&&!y&&!n.newsletterUuid?await x([]):n.newsletterUuid?await x(j==null?void 0:j.filter(V=>V.uuid!==n.newsletterUuid)):n.comments&&y&&await T(!1)})()},[y,n.uuid,n.newsletterUuid,n.comments,e.url,u==null?void 0:u.length]),s)return l.jsx(ai,{});if(!o)return l.jsxs("div",{className:"gh-portal-content gh-portal-feedback with-footer",children:[l.jsx(pe,{}),l.jsx("div",{className:"gh-feedback-icon gh-feedback-icon-error",children:l.jsx(Od,{})}),l.jsx("h1",{className:"gh-portal-main-title",children:h("That didn't go to plan")}),l.jsx("div",{children:l.jsx("p",{className:"gh-portal-text-center",children:h("We couldn't unsubscribe you as the email address was not found. Please contact the site owner.")})}),l.jsx(me,{style:{width:"100%"},retry:!1,onClick:()=>i("closePopup"),disabled:!1,brandColor:"#000000",label:h("Close"),isRunning:!1,tabIndex:3,classes:"sticky bottom"})]});if((u==null?void 0:u.length)===1&&!y&&!w)return l.jsxs("div",{className:"gh-portal-content gh-portal-unsubscribe with-footer",children:[l.jsx(pe,{}),l.jsx(ZP,{}),l.jsx("h1",{className:"gh-portal-main-title",children:h("Successfully unsubscribed")}),l.jsxs("div",{children:[l.jsx("p",{className:"gh-portal-text-center",children:l.jsx($e,{string:h("{memberEmail} will no longer receive this newsletter."),mapping:{memberEmail:l.jsx("strong",{children:o==null?void 0:o.email})}})}),l.jsx("p",{className:"gh-portal-text-center",children:l.jsx($e,{string:h("Didn't mean to do this? Manage your preferences <button>here</button>."),mapping:{button:l.jsx("button",{className:"gh-portal-btn-link gh-portal-btn-branded gh-portal-btn-inline",onClick:()=>{g(!0)}})}})})]})]});const N=()=>{if(n.comments&&y){const V=p?"gh-portal-hide":"";return l.jsx(l.Fragment,{children:l.jsx("p",{className:`gh-portal-text-center gh-portal-header-message ${V}`,children:l.jsx($e,{string:h("{memberEmail} will no longer receive emails when someone replies to your comments."),mapping:{memberEmail:l.jsx("strong",{children:o==null?void 0:o.email})}})})})}const z=u==null?void 0:u.find(V=>V.uuid===n.newsletterUuid);if(!z)return null;const j=p?"gh-portal-hide":"";return l.jsx(l.Fragment,{children:l.jsx("p",{className:`gh-portal-text-center gh-portal-header-message ${j}`,children:l.jsx($e,{string:h("{memberEmail} will no longer receive {newsletterName} newsletter."),mapping:{memberEmail:l.jsx("strong",{children:o==null?void 0:o.email}),newsletterName:l.jsx("strong",{children:z==null?void 0:z.name})}})})})};return l.jsx(kk,{hasNewslettersEnabled:C,notification:N,subscribedNewsletters:f,updateSubscribedNewsletters:async z=>{await x(z),m(!0)},updateCommentNotifications:T,unsubscribeAll:async()=>{await E(),m(!0)},isPaidMember:(o==null?void 0:o.status)!=="free",isCommentsEnabled:y!=="off",enableCommentNotifications:k})}function QP(){const{brandColor:e,lastPage:t,doAction:n,action:a,site:i}=v.useContext(_);v.useEffect(()=>{["removeEmailFromSuppressionList:success"].includes(a)&&n("refreshMemberData"),["removeEmailFromSuppressionList:failed","refreshMemberData:failed"].includes(a)&&n("back"),["refreshMemberData:success"].includes(a)&&(zo({site:i})||Us({site:i})?(n("switchPage",{page:"accountEmail",lastPage:"accountHome"}),n("showPopupNotification",{message:h("You have been successfully resubscribed")})):n("back"))},[a,n,i,h]);const o=["removeEmailFromSuppressionList:running","refreshMemberData:running"].includes(a),r=()=>{n("removeEmailFromSuppressionList")};return l.jsxs("div",{className:"gh-email-suppressed-page",children:[l.jsxs("header",{className:"gh-portal-detail-header",children:[l.jsx(Qa,{brandColor:e,hidden:!t,onClick:()=>{n("back")}}),l.jsx(pe,{})]}),l.jsx(bk,{className:"gh-email-suppressed-page-icon"}),l.jsxs("div",{className:"gh-email-suppressed-page-text",children:[l.jsx("h3",{className:"gh-portal-main-title gh-email-suppressed-page-title",children:h("Emails disabled")}),l.jsx("p",{children:h("You're not receiving emails because you either marked a recent message as spam, or because messages could not be delivered to your provided email address.")})]}),l.jsx(me,{dataTestId:"resubscribe-email",classes:"gh-portal-confirm-button",onClick:r,disabled:o,brandColor:e,label:h("Re-enable emails"),isRunning:o})]})}function e2(){const{brandColor:e,doAction:t,site:n,pageData:a}=v.useContext(_),i=`mailto:${Io({site:n})}`,o=a&&a.direct||!1;return l.jsxs("div",{className:"gh-email-suppression-faq",children:[!o&&l.jsxs("header",{className:"gh-portal-detail-header",children:[l.jsx(Qa,{brandColor:e,onClick:()=>{t("switchPage",{page:"emailSuppressed",lastPage:"accountHome"})}}),l.jsx(pe,{})]}),l.jsxs("div",{className:"gh-longform",children:[l.jsx("h3",{children:h("Why has my email been disabled?")}),l.jsx("p",{children:h("Newsletters can be disabled on your account for two reasons: A previous email was marked as spam, or attempting to send an email resulted in a permanent failure (bounce).")}),l.jsx("h4",{children:h("Spam complaints")}),l.jsx("p",{children:h("If a newsletter is flagged as spam, emails are automatically disabled for that address to make sure you no longer receive any unwanted messages.")}),l.jsx("p",{children:h("If the spam complaint was accidental, or you would like to begin receiving emails again, you can resubscribe to emails by clicking the button on the previous screen.")}),l.jsx("p",{children:h("Once resubscribed, if you still don't see emails in your inbox, check your spam folder. Some inbox providers keep a record of previous spam complaints and will continue to flag emails. If this happens, mark the latest newsletter as 'Not spam' to move it back to your primary inbox.")}),l.jsx("h4",{children:h("Permanent failure (bounce)")}),l.jsx("p",{children:h("When an inbox fails to accept an email it is commonly called a bounce. In many cases, this can be temporary. However, in some cases, a bounced email can be returned as a permanent failure when an email address is invalid or non-existent.")}),l.jsx("p",{children:h("In the event a permanent failure is received when attempting to send a newsletter, emails will be disabled on the account.")}),l.jsx("p",{children:h("If you would like to start receiving emails again, the best next steps are to check your email address on file for any issues and then click resubscribe on the previous screen.")}),l.jsx("p",{children:l.jsx("a",{className:"gh-portal-btn gh-portal-btn-branded no-margin-right",href:i,onClick:()=>{i&&window.open(i)},children:h("Need more help? Contact support")})})]})]})}function t2(){const{brandColor:e,doAction:t,site:n,lastPage:a,member:i,pageData:o}=v.useContext(_),r=Io({site:n}),s=`mailto:${r}`,c=_1({site:n}),u=o&&o.direct||!1;return l.jsxs("div",{className:"gh-email-receiving-faq",children:[l.jsxs("header",{className:"gh-portal-detail-header",children:[!u&&l.jsx(Qa,{brandColor:e,onClick:()=>{a?t("switchPage",{page:"accountHome"}):t("switchPage",{page:"accountEmail",lastPage:"accountHome"})}}),l.jsx(pe,{})]}),l.jsxs("div",{className:"gh-longform",children:[l.jsx("h3",{children:h("Help! I'm not receiving emails")}),l.jsx("p",{children:h("If you're not receiving the email newsletter you've subscribed to, here are a few things to check.")}),l.jsx("h4",{children:h("Verify your email address is correct")}),l.jsx("p",{children:l.jsx($e,{string:h("The email address we have for you is {memberEmail} — if that's not correct, you can update it in your <button>account settings area</button>."),mapping:{memberEmail:l.jsx("strong",{children:i.email}),button:l.jsx("button",{className:"gh-portal-btn-text",onClick:()=>t("switchPage",{lastPage:"emailReceivingFAQ",page:"accountProfile"})})}})}),l.jsx("h4",{children:h("Check spam & promotions folders")}),l.jsx("p",{children:h(`Make sure emails aren't accidentally ending up in the Spam or Promotions folders of your inbox. If they are, click on "Mark as not spam" and/or "Move to inbox".`)}),l.jsx("h4",{children:h("Create a new contact")}),l.jsx("p",{children:l.jsx($e,{string:h("In your email client add {senderEmail} to your contacts list. This signals to your mail provider that emails sent from this address should be trusted."),mapping:{senderEmail:l.jsx("strong",{children:c})}})}),l.jsx("h4",{children:h("Send an email and say hi!")}),l.jsx("p",{children:l.jsx($e,{string:h("Send an email to {senderEmail} and say hello. This can also help signal to your mail provider that emails to and from this address should be trusted."),mapping:{senderEmail:l.jsx("strong",{children:c})}})}),l.jsx("h4",{children:h("Check with your mail provider")}),l.jsx("p",{children:l.jsx($e,{string:h("If you have a corporate or government email account, reach out to your IT department and ask them to allow emails to be received from {senderEmail}"),mapping:{senderEmail:l.jsx("strong",{children:c})}})}),l.jsx("h4",{children:h("Get in touch for help")}),l.jsx("p",{children:l.jsx($e,{string:h("If you've completed all these checks and you're still not receiving emails, you can reach out to get support by contacting {supportAddress}."),mapping:{supportAddress:l.jsx("a",{href:s,onClick:()=>{s&&window.open(s)},children:r})}})})]})]})}const n2=()=>{const[e,t]=v.useState(!0),[n,a]=v.useState(null),[i,o]=v.useState(null),{member:r,site:s}=v.useContext(_);return v.useEffect(()=>{async function c(){const u=s.url,d=window.location.origin+window.location.pathname,p=r?`${d}?action=support&success=true`:`${d}#/portal/support/success`,m=d,f=rl({siteUrl:u});try{const b=await f.member.checkoutDonation({successUrl:p,cancelUrl:m,personalNote:h("Add a personal note")});b.url&&window.location.replace(b.url)}catch(b){b.type&&b.type==="DisabledFeatureError"?o(h("This site is not accepting payments at the moment.")):a(h("Something went wrong, please try again later.")),t(!1)}}s&&s.donations_enabled===!1?(o(h("This site is not accepting donations at the moment.")),t(!1)):c()},[]),e?l.jsx("div",{children:l.jsx(ai,{})}):n?l.jsx(im,{error:n}):i?l.jsx(im,{error:i}):null};function a2({product:e}){return!e.benefits||!e.benefits.length?null:l.jsx("div",{className:"gh-portal-product-benefits",children:e.benefits.map((t,n)=>{const a=(t==null?void 0:t.id)||`benefit-${n}`;return l.jsxs("div",{className:"gh-portal-product-benefit",children:[l.jsx(Do,{className:"gh-portal-benefit-checkmark",alt:""}),l.jsx("div",{className:"gh-portal-benefit-title",children:t.name})]},a)})})}function i2({product:e,selectedInterval:t}){const n=e.monthlyPrice,a=e.yearlyPrice;if(!n||!a)return null;const i=t==="month"?n:a,o=ke(i.currency),r=nl(n.amount,a.amount);return l.jsxs("div",{className:"gh-portal-product-card-pricecontainer",children:[l.jsxs("div",{className:"gh-portal-product-card-price-trial",children:[l.jsxs("div",{className:"gh-portal-product-price",children:[l.jsx("span",{className:"currency-sign"+(o.length>1?" long":""),children:o}),l.jsx("span",{className:"amount","data-testid":"product-amount",children:aa(Js(i.amount))})]}),t==="year"&&r>0&&l.jsxs("span",{className:"gh-portal-discount-label",children:[r,"% discount"]})]}),l.jsx("span",{style:{display:"block",opacity:"0.5"},children:"one-time payment"})]})}function o2({brandColor:e,product:t,selectedInterval:n,isDisabled:a,isPurchasing:i,onPurchase:o}){let r=t.description;return(!t.benefits||!t.benefits.length)&&!r&&(r="Full access"),l.jsxs("div",{className:"gh-portal-product-card","data-test-tier":"paid",children:[l.jsxs("div",{className:"gh-portal-product-card-header",children:[l.jsx("h4",{className:"gh-portal-product-name",children:t.name}),l.jsx(i2,{product:t,selectedInterval:n})]}),l.jsxs("div",{className:"gh-portal-product-card-details",children:[l.jsxs("div",{className:"gh-portal-product-card-detaildata",children:[r&&l.jsx("div",{className:"gh-portal-product-description","data-testid":"product-description",children:r}),l.jsx(a2,{product:t})]}),l.jsx("div",{className:"gh-portal-btn-product",children:l.jsx(me,{dataTestId:"purchase-gift",label:l.jsxs(l.Fragment,{children:[l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{marginRight:"6px",verticalAlign:"middle"},children:[l.jsx("rect",{x:"3",y:"8",width:"18",height:"4",rx:"1"}),l.jsx("path",{d:"M12 8v13"}),l.jsx("path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7"}),l.jsx("path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5"})]})," Gift this"]}),onClick:s=>o(s,t),disabled:a,isRunning:i,brandColor:e,style:{width:"100%"}})})]})]})}function r2({selectedInterval:e,setSelectedInterval:t,products:n}){const{site:a}=v.useContext(_),{portal_plans:i}=a,o=n.map(s=>{var c,u;return nl((c=s.monthlyPrice)==null?void 0:c.amount,(u=s.yearlyPrice)==null?void 0:u.amount)}),r=Math.max(...o);return!i.includes("monthly")||!i.includes("yearly")?null:l.jsx("div",{className:"gh-portal-logged-out-form-container",children:l.jsxs("div",{className:"gh-portal-products-pricetoggle"+(e==="month"?" left":""),children:[l.jsx("button",{"data-test-button":"switch-monthly",className:"gh-portal-btn"+(e==="month"?" active":""),onClick:()=>t("month"),children:"1 month"}),l.jsxs("button",{"data-test-button":"switch-yearly",className:"gh-portal-btn"+(e==="year"?" active":""),onClick:()=>t("year"),children:["1 year",r>0&&l.jsxs("span",{className:"gh-portal-maximum-discount",children:["(save ",r,"%)"]})]})]})})}const s2=()=>{const{site:e,member:t,brandColor:n,action:a,doAction:i}=v.useContext(_),[o,r]=v.useState((t==null?void 0:t.email)||""),[s,c]=v.useState(""),[u,d]=v.useState(null),[p,m]=v.useState(null);if(!e)return l.jsx(ai,{});const{portal_plans:f,portal_default_plan:b}=e,w=Zs({portalPlans:f,portalDefaultPlan:b,selectedInterval:u}),g=To({site:e}).filter(N=>N.type==="paid");if(g.length===0){const N=e.icon;return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"gh-portal-back-sitetitle",children:l.jsx(Fo,{})}),l.jsx(pe,{}),l.jsxs("div",{className:"gh-portal-content signup",children:[l.jsxs("header",{className:"gh-portal-signup-header",children:[N&&l.jsx("img",{className:"gh-portal-signup-logo",src:N,alt:e.title}),l.jsx("h1",{className:"gh-portal-main-title",children:e.title||""})]}),l.jsx("section",{children:l.jsx("div",{className:"gh-portal-section",children:l.jsx("p",{className:"gh-portal-invite-only-notification",children:"Gift subscriptions are not available right now."})})})]})]})}const y=e.icon,k=e.title||"",C=a==="checkoutGift:running",x=Zn()||C,T=[{type:"email",value:o,placeholder:"jamie@example.com",label:"Your email",name:"email",required:!0,tabIndex:1,autoFocus:!0,errorMessage:s}],E=(N,z)=>{N.preventDefault();const j=Oo({fields:T});if(j.email){c(j.email);return}c(""),m(z.id),i("checkoutGift",{tierId:z.id,cadence:w,email:o})};return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"gh-portal-back-sitetitle",children:l.jsx(Fo,{})}),l.jsx(pe,{}),l.jsxs("div",{className:"gh-portal-content signup",children:[l.jsxs("header",{className:"gh-portal-signup-header",children:[y&&l.jsx("img",{className:"gh-portal-signup-logo",src:y,alt:k}),l.jsx("h1",{className:"gh-portal-main-title",children:k}),l.jsx("p",{className:"gh-portal-main-subtitle",style:{fontSize:"1.7rem",marginTop:"8px"},children:"Give the gift of a membership"})]}),l.jsx("section",{className:"gh-portal-signup",children:l.jsxs("div",{className:"gh-portal-section",children:[l.jsx("div",{className:"gh-portal-logged-out-form-container",children:l.jsx(ti,{fields:T,onChange:N=>{r(N.target.value),s&&c("")}})}),l.jsxs("section",{className:"gh-portal-products",children:[l.jsx(r2,{selectedInterval:w,setSelectedInterval:d,products:g}),l.jsx("div",{className:"gh-portal-products-grid",children:g.map(N=>l.jsx(o2,{brandColor:n,product:N,selectedInterval:w,isDisabled:x,isPurchasing:C&&p===N.id,onPurchase:E},N.id))})]}),l.jsx("div",{className:"gh-portal-signup-message",children:l.jsx("div",{children:"Only redeemable by free or new members."})})]})})]})]})},l2=()=>{try{if(window.parent&&window.parent!==window&&window.parent.location.href)return window.parent}catch{}return window},Ho=(e,t)=>{const n=new URLSearchParams(t);return`${e}?${n.toString()}`},c2=({shareTitle:e,shareUrl:t})=>{const n=[e,t].filter(Boolean).join(`
|
|
4132
4128
|
|
|
4133
|
-
`),a=[];return e&&a.push(`subject=${encodeURIComponent(e)}`),n&&a.push(`body=${encodeURIComponent(n)}`),`mailto:${a.length?`?${a.join("&")}`:""}`},u2=({shareTitle:e,shareUrl:t})=>Ho("https://www.linkedin.com/shareArticle",{mini:"true",url:t,title:e}),d2=()=>{const e=l2(),t=e.document,n=e.location,a=(b,w="content")=>{var g;return((g=t.querySelector(b))==null?void 0:g[w])||""},i=a('link[rel="canonical"]',"href")||n.origin+n.pathname+n.search,o=a('meta[property="og:title"]')||t.title||"",r=a('meta[property="og:description"]')||a('meta[name="description"]')||"",s=a('meta[property="og:image"]')||a('meta[name="twitter:image"]')||"",c=a('link[rel="icon"]',"href")||a('link[rel="shortcut icon"]',"href")||a('link[rel="apple-touch-icon"]',"href"),u=a('meta[name="author"]'),d=(u&&!/^https?:\/\//i.test(u)?u:"")||a('meta[name="twitter:creator"]')||"";let p=a('meta[property="og:site_name"]')||a('meta[name="application-name"]')||"";if(!p)try{p=new URL(i).hostname.replace(/^www\./,"")}catch{p=""}const m=[o,i].filter(Boolean).join(" ").trim(),f={twitter:Ho("https://twitter.com/intent/tweet",{url:i,text:o}),facebook:Ho("https://www.facebook.com/sharer/sharer.php",{u:i}),email:c2({shareTitle:o,shareUrl:i}),threads:Ho("https://www.threads.net/intent/post",{text:m}),linkedin:u2({shareTitle:o,shareUrl:i}),bluesky:Ho("https://bsky.app/intent/compose",{text:m})};return{shareUrl:i,shareTitle:o,shareExcerpt:r,shareImage:s,shareFavicon:c,shareSiteName:p,shareAuthor:d,socialLinks:f}},m2=()=>{const[e]=v.useState(d2);return e},p2=e=>v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 -3.268 64 68.414",width:2232,height:2500,...e},v.createElement("path",{fill:"#0085ff",d:"M13.873 3.805C21.21 9.332 29.103 20.537 32 26.55v15.882c0-.338-.13.044-.41.867-1.512 4.456-7.418 21.847-20.923 7.944-7.111-7.32-3.819-14.64 9.125-16.85-7.405 1.264-15.73-.825-18.014-9.015C1.12 23.022 0 8.51 0 6.55 0-3.268 8.579-.182 13.873 3.805zm36.254 0C42.79 9.332 34.897 20.537 32 26.55v15.882c0-.338.13.044.41.867 1.512 4.456 7.418 21.847 20.923 7.944 7.111-7.32 3.819-14.64-9.125-16.85 7.405 1.264 15.73-.825 18.014-9.015C62.88 23.022 64 8.51 64 6.55c0-9.818-8.578-6.732-13.873-2.745z"})),h2=e=>v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-ellipsis-icon lucide-ellipsis",...e},v.createElement("circle",{cx:12,cy:12,r:1}),v.createElement("circle",{cx:19,cy:12,r:1}),v.createElement("circle",{cx:5,cy:12,r:1})),f2=e=>v.createElement("svg",{id:"svg9",width:666.66669,height:666.66718,viewBox:"0 0 666.66668 666.66717",xmlns:"http://www.w3.org/2000/svg","xmlns:svg":"http://www.w3.org/2000/svg",...e},v.createElement("defs",{id:"defs13"},v.createElement("clipPath",{clipPathUnits:"userSpaceOnUse",id:"clipPath25"},v.createElement("path",{d:"M 0,700 H 700 V 0 H 0 Z",id:"path23"}))),v.createElement("g",{id:"g17",transform:"matrix(1.3333333,0,0,-1.3333333,-133.33333,799.99999)"},v.createElement("g",{id:"g19"},v.createElement("g",{id:"g21",clipPath:"url(#clipPath25)"},v.createElement("g",{id:"g27",transform:"translate(600,350)"},v.createElement("path",{d:"m 0,0 c 0,138.071 -111.929,250 -250,250 -138.071,0 -250,-111.929 -250,-250 0,-117.245 80.715,-215.622 189.606,-242.638 v 166.242 h -51.552 V 0 h 51.552 v 32.919 c 0,85.092 38.508,124.532 122.048,124.532 15.838,0 43.167,-3.105 54.347,-6.211 V 81.986 c -5.901,0.621 -16.149,0.932 -28.882,0.932 -40.993,0 -56.832,-15.528 -56.832,-55.9 V 0 h 81.659 l -14.028,-76.396 h -67.631 V -248.169 C -95.927,-233.218 0,-127.818 0,0",style:{fill:"#0866ff",fillOpacity:1,fillRule:"nonzero",stroke:"none"},id:"path29"})),v.createElement("g",{id:"g31",transform:"translate(447.9175,273.6036)"},v.createElement("path",{d:"M 0,0 14.029,76.396 H -67.63 v 27.019 c 0,40.372 15.838,55.899 56.831,55.899 12.733,0 22.981,-0.31 28.882,-0.931 v 69.253 c -11.18,3.106 -38.509,6.212 -54.347,6.212 -83.539,0 -122.048,-39.441 -122.048,-124.533 V 76.396 h -51.552 V 0 h 51.552 v -166.242 c 19.343,-4.798 39.568,-7.362 60.394,-7.362 10.254,0 20.358,0.632 30.288,1.831 L -67.63,0 Z",style:{fill:"#ffffff",fillOpacity:1,fillRule:"nonzero",stroke:"none"},id:"path33"})))))),g2=e=>v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-link-icon lucide-link",...e},v.createElement("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),v.createElement("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})),y2=e=>v.createElement("svg",{viewBox:"0 5 2490 2490.0000000000005",xmlns:"http://www.w3.org/2000/svg",width:2500,height:2495,...e},v.createElement("path",{d:"M185.2 313.1H2252V2291H185.2z",fill:"#fff"}),v.createElement("path",{d:"M0 183.4C0 84.9 82.4 5 184 5h2122c101.6 0 184 79.9 184 178.4v2133.3c0 98.5-82.4 178.3-184 178.3H184c-101.6 0-184-79.8-184-178.3z",fill:"#0a66c2"}),v.createElement("path",{d:"M756.7 2088.8v-1121H384.1v1121zm-186.2-1274c129.9 0 210.8-86.1 210.8-193.7-2.4-110-80.9-193.7-208.3-193.7-127.5 0-210.8 83.7-210.8 193.7 0 107.6 80.8 193.7 205.9 193.7zm392.4 1274h372.6v-626c0-33.5 2.4-67 12.3-90.9 26.9-67 88.2-136.3 191.2-136.3 134.8 0 188.7 102.8 188.7 253.5v599.6h372.6V1446c0-344.3-183.8-504.5-428.9-504.5-201 0-289.2 112.3-338.3 188.8h2.5V967.8H962.9c4.9 105.2 0 1121 0 1121z",fill:"#fff"})),b2=e=>v.createElement("svg",{width:18,height:18,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},v.createElement("g",{clipPath:"url(#clip0_351_18008)"},v.createElement("path",{d:"M13.0332 8.37917C12.96 8.34407 12.8856 8.3103 12.8103 8.27795C12.6791 5.86015 11.3579 4.47596 9.1396 4.4618C9.12955 4.46173 9.11955 4.46173 9.1095 4.46173C7.78265 4.46173 6.67913 5.0281 5.99992 6.05871L7.21993 6.89561C7.72733 6.12579 8.52364 5.96167 9.11008 5.96167C9.11686 5.96167 9.12366 5.96168 9.13036 5.96174C9.86078 5.96639 10.4119 6.17876 10.7687 6.59291C11.0283 6.89442 11.2019 7.31107 11.2879 7.8369C10.6403 7.72683 9.93993 7.69299 9.19122 7.73592C7.08214 7.8574 5.72624 9.08747 5.81731 10.7967C5.86352 11.6637 6.29544 12.4096 7.03346 12.8968C7.65745 13.3087 8.46111 13.5101 9.29635 13.4645C10.3994 13.4041 11.2647 12.9832 11.8684 12.2137C12.3268 11.6293 12.6168 10.872 12.7448 9.91782C13.2705 10.2351 13.6601 10.6525 13.8753 11.1544C14.2411 12.0075 14.2624 13.4094 13.1186 14.5523C12.1164 15.5535 10.9117 15.9866 9.09104 16C7.07147 15.9851 5.54409 15.3374 4.55103 14.0749C3.62111 12.8928 3.14053 11.1854 3.1226 9C3.14053 6.8146 3.62111 5.10714 4.55103 3.92503C5.54409 2.66262 7.07144 2.01495 9.09101 1.99994C11.1252 2.01506 12.6792 2.66585 13.7103 3.93435C14.2159 4.55641 14.597 5.3387 14.8483 6.25081L16.278 5.86936C15.9734 4.74665 15.4942 3.7792 14.842 2.97686C13.5201 1.35059 11.5869 0.517279 9.096 0.5H9.08603C6.60019 0.517219 4.68862 1.3537 3.40443 2.98619C2.26168 4.4389 1.67221 6.46024 1.65241 8.99402L1.65234 9L1.65241 9.00598C1.67221 11.5397 2.26168 13.5611 3.40443 15.0138C4.68862 16.6463 6.60019 17.4828 9.08603 17.5H9.096C11.306 17.4847 12.8638 16.9061 14.1472 15.6239C15.8262 13.9465 15.7756 11.8439 15.2222 10.5531C14.8252 9.62749 14.0683 8.8757 13.0332 8.37917ZM9.21739 11.9668C8.29301 12.0188 7.33268 11.6039 7.28533 10.7152C7.25023 10.0563 7.75426 9.32105 9.27412 9.23347C9.44817 9.22343 9.61897 9.21852 9.78676 9.21852C10.3388 9.21852 10.8553 9.27215 11.3248 9.3748C11.1497 11.562 10.1224 11.9171 9.21739 11.9668Z",fill:"black"})),v.createElement("defs",null,v.createElement("clipPath",{id:"clip0_351_18008"},v.createElement("rect",{width:17,height:17,fill:"white",transform:"translate(0.5 0.5)"})))),k2=e=>v.createElement("svg",{viewBox:"0 0 1200 1226.37",xmlns:"http://www.w3.org/2000/svg",width:2446,height:2500,...e},v.createElement("path",{d:"M714.163 519.284L1160.89 0h-105.86L667.137 450.887 357.328 0H0l468.492 681.821L0 1226.37h105.866l409.625-476.152 327.181 476.152H1200L714.137 519.284zM569.165 687.828l-47.468-67.894-377.686-540.24h162.604l304.797 435.991 47.468 67.894 396.2 566.721H892.476L569.165 687.854z"})),lm={signin:om,signup:Qd,accountHome:rm,accountPlan:Bd,accountProfile:sm,accountEmail:qP,signupNewsletter:Ud,unsubscribe:XP,magiclink:tm,loading:ai,offer:am,feedback:JT,emailSuppressed:QP,emailSuppressionFAQ:e2,emailReceivingFAQ:t2,support:n2,supportSuccess:nP,supportError:im,recommendations:kP,gift:s2,giftRedemption:sP,giftSuccess:dP,share:()=>{const[e,t]=v.useState(!1),[n,a]=v.useState(!1),i=v.useRef(),o=v.useRef(null),{shareUrl:r,shareTitle:s,shareExcerpt:c,shareImage:u,shareFavicon:d,shareSiteName:p,shareAuthor:m,socialLinks:f}=m2();v.useEffect(()=>()=>{clearTimeout(i.current)},[]),v.useEffect(()=>{if(!n)return;const y=C=>{o.current&&!o.current.contains(C.target)&&a(!1)},k=C=>{C.key==="Escape"&&a(!1)};return document.addEventListener("mousedown",y),document.addEventListener("keydown",k),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",k)}},[n]);const b=async()=>{await hk(r)&&(t(!0),clearTimeout(i.current),i.current=setTimeout(()=>{t(!1)},2e3))},w=()=>{a(y=>!y)},g=()=>{a(!1)};return l.jsxs("div",{className:"gh-portal-content gh-portal-share",children:[l.jsx(pe,{}),l.jsx("div",{className:"gh-portal-share-header",children:l.jsx("h1",{className:"gh-portal-main-title",children:h("Share")})}),l.jsxs("div",{className:"gh-portal-share-preview",children:[u&&l.jsx("img",{className:"gh-portal-share-preview-image",src:u,alt:"","data-testid":"share-preview-image"}),l.jsxs("div",{className:"gh-portal-share-preview-content",children:[s&&l.jsx("h2",{className:"gh-portal-share-preview-title",children:s}),c&&l.jsx("p",{className:"gh-portal-share-preview-excerpt",children:c}),(d||p||m)&&l.jsxs("div",{className:"gh-portal-share-preview-footer",children:[d&&l.jsx("img",{className:"gh-portal-share-preview-favicon",src:d,alt:"","data-testid":"share-preview-favicon"}),l.jsxs("div",{className:"gh-portal-share-preview-meta",children:[p&&l.jsx("span",{className:"gh-portal-share-preview-site",children:p}),m&&l.jsx("span",{className:"gh-portal-share-preview-author",children:p?`| ${m}`:m})]})]})]})]}),l.jsxs("div",{className:"gh-portal-share-actions",children:[l.jsxs("button",{className:"gh-portal-btn gh-portal-share-action copy",type:"button",onClick:b,"aria-label":h(e?"Copied":"Copy link"),title:h(e?"Copied":"Copy link"),children:[e?l.jsx("span",{className:"gh-portal-share-icon copied","aria-hidden":"true",children:l.jsx(Do,{})}):l.jsx("span",{className:"gh-portal-share-icon","aria-hidden":"true",children:l.jsx(g2,{})}),l.jsx("span",{className:"gh-portal-share-label",children:h(e?"Copied":"Copy link")})]}),l.jsx("a",{className:"gh-portal-btn gh-portal-share-action twitter",href:f.twitter,target:"_blank",rel:"noopener noreferrer","aria-label":h("X (Twitter)"),title:h("X (Twitter)"),children:l.jsx("span",{className:"gh-portal-share-icon x","aria-hidden":"true",children:l.jsx(k2,{})})}),l.jsx("a",{className:"gh-portal-btn gh-portal-share-action linkedin",href:f.linkedin,target:"_blank",rel:"noopener noreferrer","aria-label":h("LinkedIn"),title:h("LinkedIn"),children:l.jsx("span",{className:"gh-portal-share-icon","aria-hidden":"true",children:l.jsx(y2,{})})}),l.jsx("a",{className:"gh-portal-btn gh-portal-share-action email",href:f.email,target:"_blank",rel:"noopener noreferrer","aria-label":h("Email"),title:h("Email"),children:l.jsx("span",{className:"gh-portal-share-icon","aria-hidden":"true",children:l.jsx(em,{})})}),l.jsxs("div",{className:"gh-portal-share-more",ref:o,children:[l.jsx("button",{className:"gh-portal-btn gh-portal-share-action more",type:"button",onClick:w,"aria-label":h("More options"),title:h("More options"),"aria-haspopup":"menu","aria-expanded":n,children:l.jsx("span",{className:"gh-portal-share-icon","aria-hidden":"true",children:l.jsx(h2,{})})}),n&&l.jsxs("div",{className:"gh-portal-share-more-menu",role:"menu","aria-label":h("More options"),children:[l.jsxs("a",{className:"gh-portal-share-more-item",href:f.facebook,target:"_blank",rel:"noopener noreferrer",role:"menuitem",onClick:g,children:[l.jsx("span",{className:"gh-portal-share-more-item-icon","aria-hidden":"true",children:l.jsx(f2,{})}),l.jsx("span",{children:h("Facebook")})]}),l.jsxs("a",{className:"gh-portal-share-more-item",href:f.threads,target:"_blank",rel:"noopener noreferrer",role:"menuitem",onClick:g,children:[l.jsx("span",{className:"gh-portal-share-more-item-icon","aria-hidden":"true",children:l.jsx(b2,{})}),l.jsx("span",{children:h("Threads")})]}),l.jsxs("a",{className:"gh-portal-share-more-item",href:f.bluesky,target:"_blank",rel:"noopener noreferrer",role:"menuitem",onClick:g,children:[l.jsx("span",{className:"gh-portal-share-more-item-icon","aria-hidden":"true",children:l.jsx(p2,{})}),l.jsx("span",{children:h("Bluesky")})]})]})]})]})]})}},cm=function({page:e}){return Object.keys(lm).includes(e)?e:"signup"},wk=function({page:e}){return e.includes("account")},v2=function({page:e}){return e.includes("offer")},w2=e=>v.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},v.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M24 12C24 18.6274 18.6274 24 12 24C5.37258 24 0 18.6274 0 12C0 5.37258 5.37258 0 12 0C18.6274 0 24 5.37258 24 12ZM11.8326 2.33879C6.37785 2.95189 3.95901 5.20797 3.41126 9.74699C3.34896 10.2632 3.22642 10.7805 3.10443 11.2954C2.93277 12.02 2.76221 12.74 2.76221 13.4458C2.76221 17.9885 6.5856 21.556 11.1283 21.556C12.8959 21.556 14.4433 20.8144 15.8756 20.048C19.0536 18.3478 22.0328 16.2597 22.0328 12.5411C22.0328 9.91512 20.1051 7.56932 18.466 5.5747C18.3834 5.47416 18.3015 5.37451 18.2206 5.27577C17.3866 4.25742 14.4333 2.04643 11.8326 2.33879Z",fill:"#15171A"})),$m=class $m extends Z.Component{render(){return l.jsxs("a",{href:"https://ghost.org",target:"_blank",rel:"noopener noreferrer",onClick:()=>{window.open("https://ghost.org","_blank")},children:[l.jsx(w2,{}),"Powered by Ghost"]})}};$m.contextType=_;let sl=$m;const Sk=()=>({modalContainer:{zIndex:"3999999",position:"fixed",left:"0",top:"0",width:"100%",height:"100%",overflow:"hidden"},frame:{common:{margin:"auto",position:"relative",padding:"0",outline:"0",width:"100%",opacity:"1",overflow:"hidden",height:"100%"}},page:{links:{width:"600px"}}});function S2({message:e}){return Zn()?l.jsx("div",{className:"gh-portal-cookiebanner",children:e}):null}const jm=class jm extends Z.Component{componentDidMount(){this.node&&!de(["preview"])&&!this.props.isMobile&&(this.node.focus(),this.keyUphandler=t=>{t.key==="Escape"&&this.dismissPopup(t)},this.node.ownerDocument.removeEventListener("keyup",this.keyUphandler),this.node.ownerDocument.addEventListener("keyup",this.keyUphandler)),this.sendContainerHeightChangeEvent()}dismissPopup(t){var i;const n=t.target&&t.target.tagName;(n!=="INPUT"||n==="INPUT"&&!((i=t==null?void 0:t.target)!=null&&i.value))&&this.context.doAction("closePopup")}sendContainerHeightChangeEvent(){var t,n;this.node&&de(["preview"])&&((t=this.node)==null?void 0:t.clientHeight)!==this.lastContainerHeight&&(this.lastContainerHeight=(n=this.node)==null?void 0:n.clientHeight,window.document.body.style.overflow="hidden",window.document.body.style["scrollbar-width"]="none",window.parent.postMessage({type:"portal-preview-updated",payload:{height:this.lastContainerHeight}},"*"))}componentDidUpdate(){this.sendContainerHeightChangeEvent()}componentWillUnmount(){this.node&&this.node.ownerDocument.removeEventListener("keyup",this.keyUphandler)}handlePopupClose(t){const{page:n,otcRef:a}=this.context;de(["preview"])||a&&n==="magiclink"||t.target===t.currentTarget&&this.context.doAction("closePopup")}renderActivePage(){const{page:t}=this.context;cm({page:t});const n=lm[t];return l.jsx(n,{})}renderPopupNotification(){const{popupNotification:t}=this.context;return!t||!t.type?null:l.jsx(nm,{})}sendPortalPreviewReadyEvent(){window.self!==window.parent&&window.parent.postMessage({type:"portal-preview-ready",payload:{}},"*")}render(){const{page:t,pageQuery:n,site:a,customSiteUrl:i}=this.context,r=Vs({site:a,pageQuery:n}).length;cm({page:t});const c={...Sk().page[t]};let u="",d="regular",p="",m=t;switch(t){case"signup":p="Cookies must be enabled in your browser to sign up.";break;case"signin":p="Cookies must be enabled in your browser to sign in.";break;case"accountHome":m="account-home";break;case"accountProfile":m="account-profile";break;case"accountPlan":m="account-plan";break;default:p="Cookies must be enabled in your browser.",m=t;break}r>1&&!Ft({site:a})&&Qt({site:a,pageQuery:n})&&t==="signup"&&(m+=" full-size",d="full"),t==="gift"&&(m+=" full-size",d="full");const f=Po({site:a});(f&&r>2||!f&&r>1)&&t==="accountPlan"&&(m+=" full-size",d="full"),(t==="emailSuppressionFAQ"||t==="emailReceivingFAQ")&&(m+=" large-size");let b="gh-portal-popup-container";de(["preview"])&&(m+=" preview"),de(["preview"],{customSiteUrl:i})&&!a.disableBackground&&(b+=" preview"),de(["dev"])&&(b+=" dev");const w=`${b} ${u} ${m}`;return this.sendPortalPreviewReadyEvent(),l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"gh-portal-popup-wrapper "+m,onClick:g=>this.handlePopupClose(g),children:[this.renderPopupNotification(),l.jsxs("div",{className:w,style:c,ref:g=>this.node=g,tabIndex:-1,children:[l.jsx(S2,{message:p}),this.renderActivePage(),d==="full"?l.jsx("div",{className:"gh-portal-powered inside "+(de(["preview"])?"hidden ":"")+m,children:l.jsx(sl,{})}):""]})]}),t!=="share"&&l.jsx("div",{className:"gh-portal-powered outside "+(de(["preview"])?"hidden ":"")+m,children:l.jsx(sl,{})})]})}};jm.contextType=_;let um=jm;const Tm=class Tm extends Z.Component{constructor(t){super(t),this.state={height:null}}renderCurrentPage(t){const n=lm[t];return l.jsx(n,{})}onHeightChange(t){this.setState({height:t})}handlePopupClose(t){t.preventDefault(),t.target===t.currentTarget&&this.context.doAction("closePopup")}renderFrameStyles(){const{site:t,brandColor:n}=this.context,a=$P({site:t}),i=n?`:root { --brandcolor: ${n} }`+a:a;return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:i}}),l.jsx("meta",{name:"viewport",content:"width=device-width, initial-scale=1, maximum-scale=1"})]})}renderFrameContainer(){const{member:t,site:n,customSiteUrl:a}=this.context,i=Sk(),o=window.innerWidth<480,r={...i.frame.common};let s="gh-portal-popup-background";return de(["preview"])&&(i.modalContainer.zIndex="3999997"),de(["preview"],{customSiteUrl:a})&&!n.disableBackground&&(s+=" preview"),de(["dev"])&&(s+=" dev"),l.jsx("div",{style:i.modalContainer,children:l.jsxs(yd,{style:r,title:"portal-popup",head:this.renderFrameStyles(),dataTestId:"portal-popup-frame",dataDir:this.context.dir,children:[l.jsx("div",{className:s,onClick:c=>this.handlePopupClose(c)}),l.jsx(um,{isMobile:o})]})})}render(){const{showPopup:t}=this.context;return t?this.renderFrameContainer():null}};Tm.contextType=_;let dm=Tm;ll({products:mm({numOfProducts:1})});function Oe(){return(new Date().getTime()/1e3|0).toString(16)+"xxxxxxxxxxxxxxxx".replace(/[x]/g,function(){return(Math.random()*16|0).toString(16)}).toLowerCase()}function x2(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function ll({title:e="The Blueprint",description:t="Thoughts, stories and ideas.",logo:n="https://static.ghost.org/v4.0.0/images/ghost-orb-1.png",icon:a="https://static.ghost.org/v4.0.0/images/ghost-orb-1.png",url:i="https://portal.localhost",plans:o={monthly:5e3,yearly:15e4,currency:"USD"},products:r=mm({numOfProducts:1}),portalProducts:s=r.map(V=>V.id),accentColor:c="#45C32E",portalPlans:u=["free","monthly","yearly"],membersSignupAccess:d="all",freePriceName:p="Free",freePriceDescription:m="Free preview",isStripeConfigured:f=!0,portalButton:b=!0,portalName:w=!0,portalButtonIcon:g="icon-1",portalButtonSignupText:y="Subscribe now",portalButtonStyle:k="icon-and-text",membersSupportAddress:C="support@example.com",editorDefaultEmailRecipients:x="visibility",newsletters:T=[],posts:E=C2(),commentsEnabled:N,recommendations:z=[],recommendationsEnabled:j}={}){return{title:e,description:t,logo:n,icon:a,accent_color:c,url:i,plans:o,products:r,portal_products:s,members_signup_access:d,free_price_name:p,free_price_description:m,is_stripe_configured:f,portal_button:b,portal_name:w,portal_plans:u,portal_button_icon:g,portal_button_signup_text:y,portal_button_style:k,members_support_address:C,comments_enabled:N!=="off",newsletters:T,recommendations:z,recommendations_enabled:!!j,editor_default_email_recipients:x,posts:E}}function xk({name:e="Black Friday",code:t="black-friday",displayTitle:n="Black Friday Sale!",displayDescription:a="Special deal for Black Friday. Subscribe now for only $15 per month and get additional benefits like accessing our podcast.",type:i="percent",cadence:o="month",amount:r=50,duration:s="repeating",durationInMonths:c=null,currencyRestriction:u=!1,currency:d=null,status:p="active",tierId:m="",tierName:f="Basic",redemptionType:b="signup"}={}){return{id:`offer_${Oe()}`,name:e,code:t,display_title:n,display_description:a,type:i,cadence:o,amount:r,duration:s,duration_in_months:c,currency_restriction:u,currency:d,status:p,tier:{id:`${m}`,name:f},redemption_type:b}}function Et({name:e="Jamie Larson",email:t="jamie@example.com",firstname:n="Jamie",subscriptions:a=[],paid:i=!1,avatarImage:o="",subscribed:r=!0,email_suppression:s={suppressed:!1,info:null},newsletters:c=[]}={}){return{uuid:x2(),email:t,name:e,firstname:n,paid:i,subscribed:r,avatar_image:o,subscriptions:a,email_suppression:s,newsletters:c}}function C2({numOfPosts:e=3}={}){const t=[];for(let n=0;n<e;n++)t.push(E2({title:`Post ${n+1}`,slug:`post-${n+1}`}));return t.slice(0,e)}function E2({id:e=`post_${Oe()}`,title:t="Post",excerpt:n="Post excerpt",slug:a="post",featured:i=!1}={}){return{id:e,title:t,excerpt:n,slug:a,featured:i}}function mm({numOfProducts:e=3}={}){const n=[ii({name:"Bronze",description:"Access to all members articles",monthlyPrice:yt({interval:"month",amount:700}),yearlyPrice:yt({interval:"year",amount:7e3}),numOfBenefits:2}),ii({name:"Silver",description:"Access to all members articles and weekly podcast",monthlyPrice:yt({interval:"month",amount:1200}),yearlyPrice:yt({interval:"year",amount:12e3}),numOfBenefits:3}),ii({name:"Friends of the Blueprint",description:"Get access to everything and lock in early adopter pricing for life + listen to my podcast",monthlyPrice:yt({interval:"month",amount:18e3}),yearlyPrice:yt({interval:"year",amount:17e3}),numOfBenefits:4})].slice(0,e),a=Ck({});return[...n,a]}function ii({type:e="paid",name:t="Basic",description:n="",id:a=`product_${Oe()}`,monthlyPrice:i=yt(),yearlyPrice:o=yt({interval:"year"}),numOfBenefits:r=2,trialDays:s=null}){return{id:a,name:t,description:n,monthlyPrice:e==="free"?null:i,yearlyPrice:e==="free"?null:o,type:e,benefits:Ek({numOfBenefits:r}),trial_days:s}}function Ck({name:e="Free tier",description:t="Free tier description",id:n=`product_${Oe()}`,numOfBenefits:a=2}){return{id:n,name:e,type:"free",description:t,benefits:Ek({numOfBenefits:a})}}function Ek({numOfBenefits:e}){const t=Oe();return[cl({name:`Limited early adopter pricing #${t.substring(0,6)}`}),cl({name:`Latest gear reviews #${t.substring(6,12)}`}),cl({name:`Weekly email newsletter #${t.substring(12,18)}`}),cl({name:`Listen to my podcast #${t.substring(18)}`})].slice(0,e)}function cl({id:e=`benefit_${Oe()}`,name:t="Benefit"}){return{id:e,name:t}}function yt({interval:e="month",amount:t=e==="month"?500:5e3,nickname:n=e==="month"?"Monthly":"Yearly",description:a=null,currency:i="usd",active:o=!0,id:r=`price_${Oe()}`}={}){return{id:r,active:o,nickname:n,currency:i,amount:t,interval:e,description:a,stripe_price_id:`price_${Oe()}`,stripe_product_id:`prod_${Oe()}`,type:"recurring"}}function ia({id:e=`sub_${Oe()}`,status:t="active",currency:n="USD",interval:a="year",amount:i=a==="month"?500:5e3,nickname:o=a==="month"?"Monthly":"Yearly",cardLast4:r="4242",offer:s=j2,priceId:c=`price_${Oe()}`,startDate:u="2021-10-05T03:18:30.000Z",currentPeriodEnd:d="2022-10-05T03:18:30.000Z",cancelAtPeriodEnd:p=!1,trialEndAt:m=null,nextPayment:f=null,tier:b=null}={}){return{id:e,customer:{id:`cus_${Oe()}`,name:"Jamie",email:"jamie@example.com"},plan:{id:`price_${Oe()}`,nickname:o,amount:i,interval:a,currency:n},offer:s,status:t,start_date:u,default_payment_card_last4:r,cancel_at_period_end:p,cancellation_reason:null,current_period_end:d,trial_end_at:m,next_payment:f,tier:b,price:{id:`stripe_price_${Oe()}`,price_id:c,nickname:o,amount:i,interval:a,type:"recurring",currency:n,product:{id:`stripe_prod_${Oe()}`,product_id:`prod_${Oe()}`}}}}function $k(){const e=mm({numOfProducts:1}),t=e.map(a=>a.id);return ll({products:e,portalPlans:["free","monthly","yearly"],portalProducts:t})}$k();const $2=ll({products:[ii({numOfBenefits:2,type:"free"})]}),j2=xk({tierId:(Nk=$2.products[0])==null?void 0:Nk.id});Et(),Et({paid:!0,subscriptions:[ia()]}),Et({paid:!0,subscriptions:[]}),Et({paid:!0,subscriptions:[ia({amount:0})]}),Et({paid:!0,subscriptions:[ia({amount:1500,startDate:"2019-05-01T11:42:40.000Z",currentPeriodEnd:"2021-06-05T11:42:40.000Z"})]}),$k();const ul=[Ck({name:"Free",description:"Free tier description which is actually a pretty long description",numOfBenefits:2}),ii({name:"The Blueprint",description:"",monthlyPrice:yt({interval:"month",amount:500}),yearlyPrice:yt({interval:"year",amount:5e3}),numOfBenefits:3}),ii({name:"Friends of the Blueprint Silver",description:"Access to all members articles and weekly podcast",monthlyPrice:yt({interval:"month",amount:1200}),yearlyPrice:yt({interval:"year",amount:11e3}),numOfBenefits:4})],oi=ll({title:"The Blueprint",description:"Thoughts, stories and ideas.",logo:"https://static.ghost.org/v4.0.0/images/ghost-orb-1.png",icon:"https://static.ghost.org/v4.0.0/images/ghost-orb-1.png",accentColor:"#45C32E",url:"https://portal.localhost",plans:{monthly:5e3,yearly:15e4,currency:"USD"},products:ul,portalProducts:ul.map(e=>e.id),membersSignupAccess:"all",freePriceName:"Free",freePriceDescription:"Free preview",isStripeConfigured:!0,portalButton:!0,portalName:!0,portalPlans:["free","monthly","yearly"],portalButtonIcon:"icon-1",portalButtonSignupText:"Subscribe now",portalButtonStyle:"icon-and-text",membersSupportAddress:"support@example.com",commentsEnabled:!0,newsletters:[{id:"weekly",name:"Weekly Rundown",description:"Best of last week",subscribe_on_signup:!0,paid:!0},{id:"daily",name:"Daily Brief",description:"One email every day",subscribe_on_signup:!1,paid:!1}],posts:[{id:"post_66aacfe061c94e10eb6e4fc1",title:"Post 1",excerpt:"Post excerpt",slug:"post-1",featured:!1},{id:"post_66aacfe04f14b8dbb56c5721",title:"Post 2",excerpt:"Post excerpt",slug:"post-2",featured:!1},{id:"post_66aacfe03d609460819af18c",title:"Post 3",excerpt:"Post excerpt",slug:"post-3",featured:!1}]}),jk=xk({tierId:(Ak=oi.products[1])==null?void 0:Ak.id}),ri={free:Et({name:"Jamie Larson",email:"jamie@example.com",firstname:"Jamie",subscriptions:[],paid:!1,avatarImage:"",subscribed:!0}),paid:Et({paid:!0,subscriptions:[ia({status:"active",currency:"USD",interval:"year",amount:5e3,cardLast4:"4242",startDate:"2021-10-05T03:18:30.000Z",currentPeriodEnd:"2022-10-05T03:18:30.000Z",cancelAtPeriodEnd:!1})]}),complimentary:Et({paid:!0,subscriptions:[]}),complimentaryWithSubscription:Et({paid:!0,subscriptions:[ia({amount:0})]}),preview:Et({paid:!0,subscriptions:[ia({amount:1500,startDate:"2019-05-01T11:42:40.000Z",currentPeriodEnd:new Date().toISOString()})]})};function T2(){var n;if(!ul||!ul[1])return null;let e=(n=oi==null?void 0:oi.products)==null?void 0:n[1].monthlyPrice,t=Et({paid:!0,subscriptions:[ia({offer:null,priceId:e==null?void 0:e.id,status:"active",currency:e==null?void 0:e.currency,interval:e==null?void 0:e.interval,amount:e==null?void 0:e.amount,cardLast4:"4242",startDate:"2021-10-05T03:18:30.000Z",currentPeriodEnd:"2022-10-05T03:18:30.000Z",cancelAtPeriodEnd:!1})]});return{site:oi,member:t}}function P2(e){const t=e.getAttribute("href"),n=new URL(t,window.location.origin),a=["#/portal","#/share"],i=a.some(r=>n.hash.startsWith(r)),o=a.some(r=>t.startsWith(r));!n.hash||!i||o||n.origin===window.location.origin&&e.setAttribute("href",n.hash)}function z2({data:e,state:t}){return{page:e.page,popupNotification:null,lastPage:e.lastPage||null,pageData:e.pageData||t.pageData}}function I2({state:e}){return{showPopup:!e.showPopup}}function N2({data:e}){return{showPopup:!0,reloadOnPopupClose:!1,page:e.page,...e.pageQuery?{pageQuery:e.pageQuery}:{},...e.pageData?{pageData:e.pageData}:{}}}function A2({state:e}){return e.lastPage?{page:e.lastPage}:Tk({state:e})}function Tk({state:e}){return Tn(),{showPopup:!1,lastPage:null,pageQuery:"",popupNotification:null,page:e.page==="magiclink"?"":e.page}}function M2({data:e,state:t}){const{action:n="openNotification",status:a="success",autoHide:i=!0,closeable:o=!0,duration:r=2600,message:s=""}=e||{},c=vb({type:n,status:a,autoHide:i,closeable:o,duration:r,state:t,message:s});return{notification:c,notificationSequence:c.count}}function D2(){return{notification:null}}async function F2({api:e,state:t}){try{return await e.member.signout(),{action:"signout:success"}}catch{return{action:"signout:failed",popupNotification:re({type:"signout:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:h("Failed to log out, please try again")})}}}async function O2({data:e,api:t,state:n}){try{const a=await t.member.getIntegrityToken(),i={...e,emailType:"signin",integrityToken:a,includeOTC:!0},{otc_ref:o,inboxLinks:r}=await t.member.sendMagicLink(i);return{page:"magiclink",lastPage:"signin",...o?{otcRef:o}:{},inboxLinks:r,pageData:{...n.pageData||{},email:((e==null?void 0:e.email)||"").trim()}}}catch(a){return{action:"signin:failed",popupNotification:re({type:"signin:failed",autoHide:!1,closeable:!0,state:n,status:"error",message:Zt(a,h("Failed to log in, please try again"))})}}}function _2({data:e,state:t}){const n=((e==null?void 0:e.email)||"").trim(),a=e==null?void 0:e.otcRef,i=e==null?void 0:e.inboxLinks;return a?{showPopup:!0,page:"magiclink",lastPage:"signin",otcRef:a,inboxLinks:i,pageData:{...t.pageData||{},email:n},popupNotification:null}:{}}async function R2({data:e,api:t}){var a;const n=h("Failed to verify code, please try again");try{const i=await t.member.getIntegrityToken(),o=await t.member.verifyOTC({...e,integrityToken:i});return o.redirectUrl?window.location.assign(o.redirectUrl):{action:"verifyOTC:failed",actionErrorMessage:Zt((a=o.errors)==null?void 0:a[0],n)}}catch(i){return{action:"verifyOTC:failed",actionErrorMessage:Zt(i,n)}}}async function Y2({data:e,state:t,api:n}){try{let{plan:a,tierId:i,cadence:o,email:r,name:s,newsletters:c,offerId:u}=e;s=s==null?void 0:s.trim();let d;if(a.toLowerCase()==="free"){const p=await n.member.getIntegrityToken();({inboxLinks:d}=await n.member.sendMagicLink({emailType:"signup",integrityToken:p,...e,name:s}))}else return i&&o?await n.member.checkoutPlan({plan:a,tierId:i,cadence:o,email:r,name:s,newsletters:c,offerId:u}):({tierId:i,cadence:o}=na({site:t==null?void 0:t.site,priceId:a}),await n.member.checkoutPlan({plan:a,tierId:i,cadence:o,email:r,name:s,newsletters:c,offerId:u})),{page:"loading"};return{page:"magiclink",lastPage:"signup",inboxLinks:d,pageData:{...t.pageData||{},email:(r||"").trim()}}}catch(a){const i=Zt(a,h("Failed to sign up, please try again"));return{action:"signup:failed",popupNotification:re({type:"signup:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:i})}}}async function L2({data:e,state:t,api:n}){try{let{plan:a,offerId:i,tierId:o,cadence:r}=e;(!o||!r)&&({tierId:o,cadence:r}=na({site:t==null?void 0:t.site,priceId:a})),await n.member.checkoutPlan({plan:a,tierId:o,cadence:r,offerId:i,metadata:{checkoutType:"upgrade"}})}catch{return{action:"checkoutPlan:failed",popupNotification:re({type:"checkoutPlan:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:h("Failed to process checkout, please try again")})}}}async function B2({data:e,state:t,api:n}){try{const{tierId:a,cadence:i,email:o}=e;return await n.member.checkoutGift({tierId:a,cadence:i,email:o}),{action:"checkoutGift:success"}}catch{return{action:"checkoutGift:failed",popupNotification:re({type:"checkoutGift:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:h("Failed to process checkout, please try again")})}}}async function U2({data:e,state:t,api:n}){try{const{plan:a,planId:i,subscriptionId:o,cancelAtPeriodEnd:r}=e,{tierId:s,cadence:c}=na({site:t==null?void 0:t.site,priceId:i});await n.member.updateSubscription({planName:a,tierId:s,cadence:c,subscriptionId:o,cancelAtPeriodEnd:r,planId:i});const u=await n.member.sessionData(),d="updateSubscription:success";return{action:d,popupNotification:re({type:d,autoHide:!0,closeable:!0,state:t,status:"success",message:h("Subscription plan updated successfully")}),page:"accountHome",member:u}}catch{return{action:"updateSubscription:failed",popupNotification:re({type:"updateSubscription:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:h("Failed to update subscription, please try again")})}}}async function H2({data:e,state:t,api:n}){try{const{subscriptionId:a,cancellationReason:i}=e;return await n.member.updateSubscription({subscriptionId:a,smartCancel:!0,cancellationReason:i}),{action:"cancelSubscription:success",page:"accountHome",member:await n.member.sessionData(),reloadOnPopupClose:!0}}catch{return{action:"cancelSubscription:failed",popupNotification:re({type:"cancelSubscription:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:h("Failed to cancel subscription, please try again")})}}}async function V2({data:e,state:t,api:n}){try{const{subscriptionId:a}=e;return await n.member.updateSubscription({subscriptionId:a,cancelAtPeriodEnd:!1}),{action:"continueSubscription:success",page:"accountHome",member:await n.member.sessionData(),reloadOnPopupClose:!0}}catch{return{action:"continueSubscription:failed",popupNotification:re({type:"continueSubscription:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:h("Failed to cancel subscription, please try again")})}}}async function W2({data:e,state:t,api:n}){try{const{offerId:a,subscriptionId:i}=e;return await n.member.applyOffer({offerId:a,subscriptionId:i}),{action:"applyOffer:success",page:"accountHome",member:await n.member.sessionData(),offers:[],reloadOnPopupClose:!0,popupNotification:re({type:"applyOffer:success",autoHide:!0,closeable:!0,state:t,status:"success",message:"Offer applied successfully!"})}}catch{return{action:"applyOffer:failed",popupNotification:re({type:"applyOffer:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:"Failed to apply offer, please try again"})}}}async function G2({data:e,state:t,api:n}){try{await n.member.editBilling(e)}catch{return{action:"editBilling:failed",popupNotification:re({type:"editBilling:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:h("Failed to update billing information, please try again")})}}}async function K2({data:e,state:t,api:n}){try{await n.member.manageBilling(e)}catch{return{action:"manageBilling:failed",popupNotification:re({type:"manageBilling:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:h("Failed to open billing portal, please try again")})}}}async function q2(){return{popupNotification:null}}async function J2({data:e,state:t}){let{action:n,message:a=""}=e;return n=n||"showPopupNotification:success",{popupNotification:re({type:n,autoHide:!0,closeable:!0,state:t,status:"success",message:a})}}async function Z2({data:e,state:t,api:n}){try{const{newsletters:a,enableCommentNotifications:i}=e;if(!a&&i===void 0)return{};const o={};return a&&(o.newsletters=a),i!==void 0&&(o.enableCommentNotifications=i),{action:"updateNewsletterPref:success",member:await n.member.update(o)}}catch{return{action:"updateNewsletterPref:failed",popupNotification:re({type:"updateNewsletter:failed",autoHide:!0,closeable:!0,state:t,status:"error",message:h("Failed to update newsletter settings")})}}}async function X2({state:e,api:t}){try{return await t.member.deleteSuppression(),{action:"removeEmailFromSuppressionList:success",popupNotification:re({type:"removeEmailFromSuppressionList:success",autoHide:!0,closeable:!0,state:e,status:"success",message:h("You have been successfully resubscribed")})}}catch{return{action:"removeEmailFromSuppressionList:failed",popupNotification:re({type:"removeEmailFromSuppressionList:failed",autoHide:!0,closeable:!0,state:e,status:"error",message:h("Your email has failed to resubscribe, please try again")})}}}async function Q2({data:e,state:t,api:n}){try{const{subscribed:a}=e,i=await n.member.update({subscribed:a});if(!i)throw new Error("Failed to update newsletter");const o="updateNewsletter:success";return{action:o,member:i,popupNotification:re({type:o,autoHide:!0,closeable:!0,state:t,status:"success",message:h("Email newsletter settings updated")})}}catch{return{action:"updateNewsletter:failed",popupNotification:re({type:"updateNewsletter:failed",autoHide:!0,closeable:!0,state:t,status:"error",message:h("Failed to update newsletter settings")})}}}async function ez({data:e,state:t,api:n}){const{email:a}=e,i=D0({member:t.member});if(a!==i)try{return await n.member.updateEmailAddress({email:a}),{success:!0}}catch(o){return{success:!1,error:o}}return null}async function tz({data:e,state:t,api:n}){var o;const a=(o=e==null?void 0:e.name)==null?void 0:o.trim();if(O0({member:t.member})!==a)try{const r=await n.member.update({name:a});if(!r)throw new Error("Failed to update member");return{member:r,success:!0}}catch(r){return{success:!1,error:r}}return null}async function nz({state:e,api:t}){if(e.member)try{const n=await t.member.sessionData();return n?{member:n,success:!0,action:"refreshMemberData:success"}:null}catch(n){return{success:!1,error:n,action:"refreshMemberData:failed"}}return null}async function az({data:e,state:t,api:n}){const[a,i]=await Promise.all([tz({data:e,state:t,api:n}),ez({data:e,state:t,api:n})]);if(a&&i){if(i.success)return{action:"updateProfile:success",...a.success?{member:a.member}:{},page:"accountHome",popupNotification:re({type:"updateProfile:success",autoHide:!0,closeable:!0,status:"success",state:t,message:h("Check your inbox to verify email update")})};const o=a.success?h("Failed to send verification email"):h("Failed to update account data");return{action:"updateProfile:failed",...a.success?{member:a.member}:{},popupNotification:re({type:"updateProfile:failed",autoHide:!0,closeable:!0,status:"error",message:o,state:t})}}else if(a){const o=a.success?"updateProfile:success":"updateProfile:failed",r=a.success?"success":"error",s=a.success?h("Account details updated successfully"):h("Failed to update account details");return{action:o,...a.success?{member:a.member}:{},...a.success?{page:"accountHome"}:{},popupNotification:re({type:o,autoHide:a.success,closeable:!0,status:r,state:t,message:s})}}else if(i){const o=i.success?"updateProfile:success":"updateProfile:failed",r=i.success?"success":"error";let s="";return i.error?s=Zt(i.error,h("Failed to send verification email")):s=h("Check your inbox to verify email update"),{action:o,...i.success?{page:"accountHome"}:{},popupNotification:re({type:o,autoHide:i.success,closeable:!0,status:r,state:t,message:s})}}return{action:"updateProfile:success",page:"accountHome",popupNotification:re({type:"updateProfile:success",autoHide:!0,closeable:!0,status:"success",state:t,message:h("Account details updated successfully")})}}async function iz({data:{siteUrl:e},state:t}){const n=rl({siteUrl:e,apiUrl:"not-defined"}),{member:a}=t,i=window.location.href,o=fb(),r=await n.member.getIntegrityToken();return await n.member.sendMagicLink({emailType:"signup",name:a.name,email:a.email,autoRedirect:!1,integrityToken:r,customUrlHistory:t.site.outbound_link_tagging?[{time:Date.now(),referrerSource:o,referrerMedium:"Ghost Recommendations",referrerUrl:i}]:[]}),{}}function oz({data:{recommendationId:e},api:t}){try{const n=localStorage.getItem("ghost-recommendations-clicked"),a=n?JSON.parse(n):[];if(a.includes(e))return;a.push(e),localStorage.setItem("ghost-recommendations-clicked",JSON.stringify(a))}catch{}return t.recommendations.trackClicked({recommendationId:e}),{}}async function rz({data:{recommendationId:e},api:t}){return t.recommendations.trackSubscribed({recommendationId:e}),{}}const sz={togglePopup:I2,openPopup:N2,closePopup:Tk,switchPage:z2,openNotification:M2,closeNotification:D2,back:A2,signout:F2,signin:O2,startSigninOTCFromCustomForm:_2,verifyOTC:R2,signup:Y2,updateSubscription:U2,cancelSubscription:H2,continueSubscription:V2,applyOffer:W2,updateNewsletter:Q2,updateProfile:az,refreshMemberData:nz,clearPopupNotification:q2,editBilling:G2,manageBilling:K2,checkoutPlan:L2,checkoutGift:B2,updateNewsletterPreference:Z2,showPopupNotification:J2,removeEmailFromSuppressionList:X2,oneClickSubscribe:iz,trackRecommendationClicked:oz,trackRecommendationSubscribed:rz};async function lz({action:e,data:t,state:n,api:a}){const i=sz[e];return i?await i({data:t,state:n,api:a})||{}:{}}function Pk(e,t){e&&(e.innerText=t)}function cz(e,t,n){t.classList.add("error");const a=h("There was an error sending the email, please try again");Pk(n,Zt(e,a))}async function uz({event:e,form:t,errorEl:n,siteUrl:a,submitHandler:i,doAction:o,captureException:r}){var x,T;t.removeEventListener("submit",i),e.preventDefault(),n&&(n.innerText=""),t.classList.remove("success","invalid","error");let s=e.target.querySelector("input[data-members-email]"),c=e.target.querySelector("input[data-members-name]"),u=((x=t==null?void 0:t.dataset)==null?void 0:x.membersAutoredirect)||"true",d=s==null?void 0:s.value,p=((c==null?void 0:c.value)||"").trim()||void 0,m,f=[],b=[],w=e.target.querySelectorAll("input[data-members-label]")||[];for(let E=0;E<w.length;++E)f.push(w[E].value);let g=e.target.querySelectorAll("input[type=hidden][data-members-newsletter], input[type=checkbox][data-members-newsletter]:checked, input[type=radio][data-members-newsletter]:checked")||[];for(let E=0;E<g.length;++E)b.push({name:g[E].value});t.dataset.membersForm&&(m=t.dataset.membersForm);const y=m==="signin"&&((T=t==null?void 0:t.dataset)==null?void 0:T.membersOtc)==="true";t.classList.add("loading");const k=No(),C={email:d,emailType:m,labels:f,name:p,autoRedirect:u==="true"};y&&(C.includeOTC=!0),k&&(C.urlHistory=k),g.length>0?C.newsletters=b:(e.target.querySelectorAll("input[type=checkbox][data-members-newsletter]")||[]).length>0&&(C.newsletters=[]);try{const N=await(await fetch(`${a}/members/api/integrity-token/`,{method:"GET"})).text(),z=await fetch(`${a}/members/api/send-magic-link/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...C,integrityToken:N})});if(t.addEventListener("submit",i),t.classList.remove("loading"),z.ok){t.classList.add("success");let j;if(y)try{j=await z.clone().json()}catch{j=void 0}const V=j==null?void 0:j.otc_ref;if(V&&typeof o=="function")try{o("startSigninOTCFromCustomForm",{email:(d||"").trim(),otcRef:V,inboxLinks:j==null?void 0:j.inboxLinks})}catch(q){console.error(q),r==null||r(q)}}else{const j=await xt.fromApiResponse(z),V=Zt(j,h("Failed to send magic link email"));Pk(n,V),t.classList.add("error")}}catch(E){cz(E,t,n)}}function dz({event:e,el:t,errorEl:n,siteUrl:a,site:i,member:o,clickHandler:r}){t.removeEventListener("click",r),e.preventDefault();let s=t.dataset.membersPlan,c=C0(i,s.toLowerCase()),u=t.dataset.membersSuccess,d=t.dataset.membersCancel,p,m;u&&(p=new URL(u,window.location.href).href),d&&(m=new URL(d,window.location.href).href),n&&(n.innerText=""),t.classList.add("loading");const f=o?{checkoutType:"upgrade"}:{},b=No();return b&&(f.urlHistory=b),fetch(`${a}/members/api/session`,{credentials:"same-origin"}).then(function(w){return w.ok?w.text():null}).then(function(w){return fetch(`${a}/members/api/create-stripe-checkout-session/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...c,identity:w,successUrl:p,cancelUrl:m,metadata:f})}).then(function(g){if(!g.ok)throw new Error(h("Could not create Stripe checkout session"));return g.json()})}).then(function(w){return w.url?window.location.assign(w.url):window.Stripe(w.publicKey).redirectToCheckout({sessionId:w.sessionId}).then(function(y){if(y.error)throw new Error(y.error.message)})}).catch(function(w){console.error(w),t.addEventListener("click",r),t.classList.remove("loading"),n&&(n.innerText=w.message),t.classList.add("error")})}function mz({siteUrl:e,site:t={},member:n,offers:a=[],doAction:i,captureException:o}={}){if(!e)return;e=e.replace(/\/$/,""),Array.prototype.forEach.call(document.querySelectorAll("form[data-members-form]"),function(s){let c=s.querySelector("[data-members-error]");function u(d){uz({event:d,errorEl:c,form:s,siteUrl:e,submitHandler:u,doAction:i,captureException:o})}s.addEventListener("submit",u)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-plan]"),function(s){let c=s.querySelector("[data-members-error]");function u(d){dz({el:s,event:d,errorEl:c,member:n,site:t,siteUrl:e,clickHandler:u})}s.addEventListener("click",u)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-edit-billing]"),function(s){let c=s.querySelector("[data-members-error]"),u=s.dataset.membersSuccess,d=s.dataset.membersCancel,p,m;u&&(p=new URL(u,window.location.href).href),d&&(m=new URL(d,window.location.href).href);function f(b){s.removeEventListener("click",f),b.preventDefault(),c&&(c.innerText=""),s.classList.add("loading"),fetch(`${e}/members/api/session`,{credentials:"same-origin"}).then(function(w){return w.ok?w.text():null}).then(function(w){return fetch(`${e}/members/api/create-stripe-update-session/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:w,successUrl:p,cancelUrl:m})}).then(function(g){if(!g.ok)throw new Error(h("Could not create Stripe checkout session"));return g.json()})}).then(function(w){return window.Stripe(w.publicKey).redirectToCheckout({sessionId:w.sessionId})}).then(function(w){if(w.error)throw new Error(h(w.error.message))}).catch(function(w){console.error(w),s.addEventListener("click",f),s.classList.remove("loading"),c&&(c.innerText=w.message),s.classList.add("error")})}s.addEventListener("click",f)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-manage-billing]"),function(s){let c=s.querySelector("[data-members-error]"),u=s.dataset.membersReturn,d;u&&(d=new URL(u,window.location.href).href);function p(m){s.removeEventListener("click",p),m.preventDefault(),c&&(c.innerText=""),s.classList.add("loading"),fetch(`${e}/members/api/session`,{credentials:"same-origin"}).then(function(f){return f.ok?f.text():null}).then(function(f){return fetch(`${e}/members/api/create-stripe-billing-portal-session/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:f,returnUrl:d})}).then(function(b){if(!b.ok)throw new Error(h("Could not create Stripe billing portal session"));return b.json()})}).then(function(f){return window.location.assign(f.url)}).catch(function(f){console.error(f),s.addEventListener("click",p),s.classList.remove("loading"),c&&(c.innerText=f.message),s.classList.add("error")})}s.addEventListener("click",p)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-signout]"),function(s){function c(u){s.removeEventListener("click",c),u.preventDefault(),s.classList.remove("error"),s.classList.add("loading"),fetch(`${e}/members/api/session`,{method:"DELETE"}).then(function(d){d.ok?window.location.replace(e):(s.addEventListener("click",c),s.classList.remove("loading"),s.classList.add("error"))})}s.addEventListener("click",c)});const r=(a||[]).some(s=>s.redemption_type==="retention");Array.prototype.forEach.call(document.querySelectorAll("[data-members-cancel-subscription]"),function(s){let c=s.parentElement.querySelector("[data-members-error]");function u(d){d.preventDefault();let p=s.dataset.membersCancelSubscription;if(r){i("openPopup",{page:"accountPlan",pageData:{subscriptionId:p,action:"cancel"}});return}return s.removeEventListener("click",u),s.classList.remove("error"),s.classList.add("loading"),c&&(c.innerText=""),fetch(`${e}/members/api/session`,{credentials:"same-origin"}).then(function(m){return m.ok?m.text():null}).then(function(m){return fetch(`${e}/members/api/subscriptions/${p}/`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:m,smart_cancel:!0})})}).then(function(m){m.ok?window.location.reload():(s.addEventListener("click",u),s.classList.remove("loading"),s.classList.add("error"),c&&(c.innerText=h("There was an error cancelling your subscription, please try again.")))})}s.addEventListener("click",u)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-continue-subscription]"),function(s){let c=s.parentElement.querySelector("[data-members-error]");function u(d){s.removeEventListener("click",u),d.preventDefault(),s.classList.remove("error"),s.classList.add("loading");let p=s.dataset.membersContinueSubscription;return c&&(c.innerText=""),fetch(`${e}/members/api/session`,{credentials:"same-origin"}).then(function(m){return m.ok?m.text():null}).then(function(m){return fetch(`${e}/members/api/subscriptions/${p}/`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:m,cancel_at_period_end:!1})})}).then(function(m){m.ok?window.location.reload():(s.addEventListener("click",u),s.classList.remove("loading"),s.classList.add("error"),c&&(c.innerText=h("There was an error continuing your subscription, please try again.")))})}s.addEventListener("click",u)})}const zk=e=>{try{return decodeURIComponent(e)}catch{return null}},pz={staleGiftRedemptionRequest:!0},hz={showPopup:!0,site:oi,member:ri.free,page:"accountEmail",...T2(),pageData:jk};function fz({site:e,children:t}){const{portal_sentry:n}=e||{};return n&&n.dsn?l.jsx(rd,{children:t}):l.jsx(l.Fragment,{children:t})}class gz extends Z.Component{constructor(t){super(t),this.setupCustomTriggerButton(),this.state={site:null,member:null,offers:[],page:"loading",showPopup:!1,action:"init:running",actionErrorMessage:null,initStatus:"running",lastPage:null,notification:null,notificationSequence:-1,customSiteUrl:t.customSiteUrl,locale:t.locale,scrollbarWidth:0},this._redemptionRequestId=0,this.currentRedemptionToken=null}componentDidMount(){const t=this.getScrollbarWidth();this.setState({scrollbarWidth:t}),this.initSetup()}componentDidUpdate(t,n){var a,i,o;if(n.showPopup!==this.state.showPopup){this.handleCustomTriggerClassUpdate();try{this.state.showPopup?(this.bodyScroll=(o=(i=(a=window.document)==null?void 0:a.body)==null?void 0:i.style)==null?void 0:o.overflow,this.bodyMargin=window.getComputedStyle(document.body).getPropertyValue("margin-right"),window.document.body.style.overflow="hidden",this.state.scrollbarWidth&&(window.document.body.style.marginRight=`calc(${this.bodyMargin} + ${this.state.scrollbarWidth}px)`)):(window.document.body.style.overflow=this.bodyScroll||"",!this.bodyMargin||this.bodyMargin==="0px"?window.document.body.style.marginRight="":window.document.body.style.marginRight=this.bodyMargin,this.state.reloadOnPopupClose&&window.location.reload())}catch{}}if(this.state.initStatus==="success"&&n.initStatus!==this.state.initStatus){const{siteUrl:r}=this.props,s=this.getContextFromState();this.sendPortalReadyEvent(),mz({siteUrl:r,site:s.site,member:s.member,offers:s.offers,doAction:s.doAction,captureException:hs})}}componentWillUnmount(){clearTimeout(this.timeoutId),this.customTriggerButtons&&this.customTriggerButtons.forEach(t=>{t.removeEventListener("click",this.clickHandler)}),window.removeEventListener("hashchange",this.hashHandler,!1)}sendPortalReadyEvent(){window.self!==window.parent&&window.parent.postMessage({type:"portal-ready",payload:{}},"*")}getScrollbarWidth(){const t=document.createElement("div");t.style.visibility="hidden",t.style.overflow="scroll",document.body.appendChild(t),document.body.appendChild(t);const n=t.offsetWidth-t.clientWidth;return document.body.removeChild(t),n}setupCustomTriggerButton(){this.clickHandler=async a=>{a.preventDefault();const i=a.currentTarget,o=i&&i.dataset.portal,r=this.getPageFromLinkPath(o);if(!r)return;const{page:s,pageQuery:c,pageData:u}=r;if(this.state.initStatus==="success"){if(s==="gift"&&!Ys({site:this.state.site})){this.invalidateGiftRedemptionRequest(),Tn();return}if(s==="giftRedemption"&&(u!=null&&u.token)){const d=this.startGiftRedemptionRequest(u.token),p=await this.fetchGiftRedemptionData({site:this.state.site,token:u.token});if(!this.isCurrentGiftRedemptionRequest(d))return;this.setState(p);return}this.invalidateGiftRedemptionRequest(),c&&c!=="free"?this.handleSignupQuery({site:this.state.site,pageQuery:c}):this.dispatchAction("openPopup",{page:s,pageQuery:c,pageData:u})}};const t="[data-portal]",n="gh-portal-close";this.customTriggerButtons=document.querySelectorAll(t)||[],this.customTriggerButtons.forEach(a=>{a.classList.add(n),a.removeEventListener("click",this.clickHandler),a.addEventListener("click",this.clickHandler)})}handleCustomTriggerClassUpdate(){var a;const t="gh-portal-open",n="gh-portal-close";(a=this.customTriggerButtons)==null||a.forEach(i=>{const o=this.state.showPopup?t:n,r=this.state.showPopup?n:t;i.classList.add(o),i.classList.remove(r)})}startGiftRedemptionRequest(t){return this._redemptionRequestId+=1,this.currentRedemptionToken=t,{requestId:this._redemptionRequestId,token:t}}invalidateGiftRedemptionRequest(){this._redemptionRequestId+=1,this.currentRedemptionToken=null}isCurrentGiftRedemptionRequest({requestId:t,token:n}){return this._redemptionRequestId===t&&this.currentRedemptionToken===n}async initSetup(){try{const{site:t,member:n,offers:a,page:i,showPopup:o,popupNotification:r,notification:s,notificationSequence:c,lastPage:u,pageQuery:d,pageData:p}=await this.fetchData(),m=this.props.siteI18nEnabled&&(this.props.locale||t.locale)||"en";Os.changeLanguage(m);const f={site:t,member:n,offers:a,page:i,lastPage:u,pageQuery:d,showPopup:o,pageData:p,popupNotification:r,notification:s,notificationSequence:c,dir:Os.dir()||"ltr",action:"init:success",initStatus:"success",locale:m};if(this.handleSignupQuery({site:t,pageQuery:d,member:n}),this.setState(f),this.hashHandler=()=>{this.updateStateForPreviewLinks()},window.addEventListener("hashchange",this.hashHandler,!1),!n){const b=document.querySelectorAll("[data-lexical-signup-form]");b.length>0&&b.forEach(w=>{w.style.display=""})}this.setupRecommendationButtons(),this.transformPortalLinksToRelative()}catch(t){console.error("[Portal] Failed to initialize:",t),this.setState({action:"init:failed",initStatus:"failed"})}}async fetchData(){const{site:t,member:n,offers:a}=await this.fetchApiData(),{site:i,...o}=this.fetchDevData(),r=await this.fetchLinkData(t,n),{site:s,...c}=r!=null&&r.staleGiftRedemptionRequest?{}:r,{site:u,...d}=this.fetchPreviewData(),{site:p,...m}=this.fetchNotificationData();return{member:n,offers:a,page:"",site:{...t,...s,...u,...p,...i,plans:{...(i||{}).plans,...(t||{}).plans,...(u||{}).plans}},...o,...c,...m,...d}}fetchDevData(){return de(["dev"])&&!this.state.customSiteUrl?hz:de(["test"])?{showPopup:this.props.showPopup!==void 0?this.props.showPopup:!0}:{}}fetchOfferQueryStrData(t=""){var i,o,r;const n=new URLSearchParams(t),a={};for(let s of n.entries()){const c=s[0],u=decodeURIComponent(s[1]);c==="name"?a.name=u||"":c==="code"?a.code=u||"":c==="display_title"?a.display_title=u||"":c==="display_description"?a.display_description=u||"":c==="type"?a.type=u||"":c==="cadence"?a.cadence=u||"":c==="duration"?a.duration=u||"":c==="duration_in_months"&&!isNaN(Number(u))?a.duration_in_months=Number(u):c==="amount"&&!isNaN(Number(u))?a.amount=Number(u):c==="currency"?a.currency=u||"":c==="status"?a.status=u||"":c==="tier_id"?a.tier={id:u||jk.tier.id}:c==="redemption_type"&&(a.redemption_type=u||"signup")}if(a.redemption_type==="retention"){const s=(r=(o=(i=ri.preview)==null?void 0:i.subscriptions)==null?void 0:o[0])==null?void 0:r.id;return{page:"accountPlan",offers:[a],pageData:{action:"cancel",subscriptionId:s}}}return{page:"offer",pageData:a}}fetchQueryStrData(t=""){const n=new URLSearchParams(t),a={site:{plans:{}}},i=[];let o,r=null,s,c,u;for(let d of n.entries()){const p=d[0],m=decodeURIComponent(d[1]);if(p==="button")a.site.portal_button=JSON.parse(m);else if(p==="name")a.site.portal_name=JSON.parse(m);else if(p==="isFree"&&JSON.parse(m))i.push("free");else if(p==="isMonthly"&&JSON.parse(m))i.push("monthly");else if(p==="isYearly"&&JSON.parse(m))i.push("yearly");else if(p==="portalPrices")o=m?m.split(","):[];else if(p==="portalProducts")r=m?m.split(","):[];else if(p==="page"&&m)a.page=m;else if(p==="accentColor"&&(m===""||m))a.site.accent_color=m;else if(p==="buttonIcon"&&m)a.site.portal_button_icon=m;else if(p==="signupButtonText")a.site.portal_button_signup_text=m||"";else if(p==="signupTermsHtml")a.site.portal_signup_terms_html=m||"";else if(p==="signupCheckboxRequired")a.site.portal_signup_checkbox_required=JSON.parse(m);else if(p==="buttonStyle"&&m)a.site.portal_button_style=m;else if(p==="monthlyPrice"&&!isNaN(Number(m)))a.site.plans.monthly=Number(m),s=Number(m);else if(p==="yearlyPrice"&&!isNaN(Number(m)))a.site.plans.yearly=Number(m),c=Number(m);else if(p==="currency"&&m){const f=m.toUpperCase();a.site.plans.currency=f,a.site.plans.currency_symbol=ke(f),u=f}else p==="disableBackground"?a.site.disableBackground=JSON.parse(m):p==="membersSignupAccess"&&m?a.site.members_signup_access=m:p==="portalDefaultPlan"&&m?a.site.portal_default_plan=m:p==="transistorPortalSettings"&&m&&(a.site.transistor_portal_settings=JSON.parse(m))}return a.site.portal_plans=i,a.site.portal_products=r,o?a.site.portal_plans=o:s&&c&&u&&(a.site.prices=[{id:"monthly",stripe_price_id:"dummy_stripe_monthly",stripe_product_id:"dummy_stripe_product",active:1,nickname:"Monthly",currency:u,amount:s,type:"recurring",interval:"month"},{id:"yearly",stripe_price_id:"dummy_stripe_yearly",stripe_product_id:"dummy_stripe_product",active:1,nickname:"Yearly",currency:u,amount:c,type:"recurring",interval:"year"}]),a}fetchNotificationData(){const{type:t,status:n,duration:a,autoHide:i,closeable:o}=Yb({billingOnly:!0})||{};return["stripe:billing-update"].includes(t)?n==="success"?{showPopup:!0,popupNotification:re({type:t,status:n,duration:a,closeable:o,autoHide:i,state:this.state,message:n==="success"?"Billing info updated successfully":""})}:{showPopup:!0}:{}}async fetchGiftRedemptionData({site:t,token:n}){var a;if(!Ys({site:t}))return Tn(),{};try{const i=await this.GhostApi.gift.fetchRedemptionData({token:n});return{showPopup:!0,notification:null,page:"giftRedemption",pageData:{token:n,gift:((a=i==null?void 0:i.gifts)==null?void 0:a[0])||null}}}catch(i){Tn();const o=vb({type:"giftRedemption:failed",status:"error",autoHide:!1,closeable:!0,state:this.state,message:pk(i)});return{showPopup:!1,pageData:null,notification:o,notificationSequence:o.count}}}async fetchLinkData(t,n){this.invalidateGiftRedemptionRequest();const a=new URLSearchParams(window.location.search);if(a.get("stripe")==="gift-purchase-success"){const b=a.get("gift_token");if(el(["stripe","gift_token"]),b)return{showPopup:!0,page:"giftSuccess",pageData:{token:b}}}if(a.get("action")==="unsubscribe")return a.get("key")&&a.get("uuid")?{showPopup:!0,page:"unsubscribe",pageData:{uuid:a.get("uuid"),key:a.get("key"),newsletterUuid:a.get("newsletter"),comments:a.get("comments")}}:{showPopup:!0,page:"accountEmail",pageData:{newsletterUuid:a.get("newsletter"),action:"unsubscribe",redirect:t.url+"#/portal/account/newsletters"}};if(j0({site:t})&&a.get("action")==="signup"&&a.get("success")==="true")return{showPopup:!0,page:"recommendations",pageData:{signup:!0}};const[i,o]=window.location.hash.substr(1).split("?"),r=new URLSearchParams(o??""),s=/^(?:(\w+?))?\/monthly$/,c=/^(?:(\w+?))?\/yearly$/,u=/^offers\/(\w+?)\/?$/,d=/^\/portal\/gift\/redeem\/([^/?#]+)\/?$/,p=/^\/portal\/?(?:\/(\w+(?:\/\w+)*))?\/?$/,m=/^\/share\/?$/,f=/^\/feedback\/(\w+?)\/(\w+?)\/?$/;if(i&&f.test(i)){const[,b,w]=i.match(f),g=parseInt(w);if(g===1||g===0)return n||r.get("uuid")&&r.get("key")?{showPopup:!0,page:"feedback",pageData:{uuid:n?null:r.get("uuid"),key:n?null:r.get("key"),postId:b,score:g}}:{showPopup:!0,page:"signin",pageData:{redirect:t.url+`#/feedback/${b}/${g}/`}}}if(i&&d.test(i)){const[,b]=i.match(d),w=zk(b);if(!w)return{};const g=this.startGiftRedemptionRequest(w),y=await this.fetchGiftRedemptionData({site:t,token:w});return this.isCurrentGiftRedemptionRequest(g)?y:pz}if(i&&m.test(i))return{showPopup:!0,page:"share"};if(i&&p.test(i)){const[,b]=i.match(p),{page:w,pageQuery:g,pageData:y}=this.getPageFromLinkPath(b,t)||{};if(!n&&w&&wk({page:w}))return{showPopup:!0,page:"signin",pageData:{redirect:t.url+`#/portal/${b}/`}};if(w==="gift"&&!Ys({site:t}))return Tn(),{};const k=["accountPlan","accountProfile"].includes(w)?"accountHome":null;return{showPopup:!(["monthly","yearly"].includes(g)||s.test(g)||c.test(g)||u.test(g)),...w?{page:w}:{},...g?{pageQuery:g}:{},...y?{pageData:y}:{},...k?{lastPage:k}:{}}}return{}}fetchPreviewData(){const[,t]=window.location.hash.substr(1).split("?");if(de(["preview"])){let n={};return de(["offerPreview"])?n=this.fetchOfferQueryStrData(t):n=this.fetchQueryStrData(t),{...n,showPopup:!0}}return{}}getColorOverride(){const t=document.querySelector("script[data-ghost]");return t&&t.dataset.accentColor?t.dataset.accentColor:!1}async fetchApiData(){const{siteUrl:t,customSiteUrl:n,apiUrl:a,apiKey:i}=this.props;try{this.GhostApi=this.props.api||rl({siteUrl:t,apiUrl:a,apiKey:i});const{site:o,member:r,offers:s}=await this.GhostApi.init(),c=this.getColorOverride();return c&&(o.accent_color=c),this.setupFirstPromoter({site:o,member:r}),this.setupSentry({site:o}),{site:o,member:r,offers:s}}catch(o){if(de(["dev","test"],{customSiteUrl:n}))return{};throw o}}setupSentry({site:t}){if(de(["test"]))return null;const{portal_sentry:n,portal_version:a,version:i}=t,r=`portal@2.68.1|ghost@${i}`;n&&n.dsn&&ej({dsn:n.dsn,environment:n.env||"development",release:r,beforeSend:s=>y0({event:s})?s:null,allowUrls:[/https?:\/\/((www)\.)?unpkg\.com\/@tryghost\/portal/]})}setupFirstPromoter({site:t,member:n}){if(de(["test"]))return null;const a=F0({site:t});let i=Ed({site:t});if(i=i==null?void 0:i.replace(/^(\S*\.)?(\S*\.\S*)$/i,".$2"),a&&i){const o=document.createElement("script");o.type="text/javascript",o.async=!0,o.src="https://cdn.firstpromoter.com/fprom.js",o.onload=o.onreadystatechange=function(){let s=this.readyState;if(!s||s==="complete"||s==="loaded")try{if(window.$FPROM.init(a,i),G0({member:n})){const c=n.email,u=n.uuid;if(window.$FPROM)window.$FPROM.trackSignup({email:c,uid:u});else{const d=window._fprom||[];window._fprom=d,d.push(["event","signup"]),d.push(["email",c]),d.push(["uid",u])}}}catch{}};const r=document.getElementsByTagName("script")[0];r.parentNode.insertBefore(o,r)}}async dispatchAction(t,n){clearTimeout(this.timeoutId),this.setState({action:`${t}:running`,actionErrorMessage:null});try{const a=await lz({action:t,data:n,state:this.state,api:this.GhostApi});this.setState(a),a&&a.action&&!a.action.includes(":failed")&&(this.timeoutId=setTimeout(()=>{this.setState({action:""})},2e3))}catch(a){if(console.error(`[Portal] Failed to dispatch action: ${t}`,a),n&&n.throwErrors)throw a;const i=re({type:`${t}:failed`,autoHide:!0,closeable:!0,status:"error",state:this.state,meta:{error:a}});this.setState({action:`${t}:failed`,actionErrorMessage:Zt(a,h("An unexpected error occured. Please try again or <a>contact support</a> if the error persists.")),popupNotification:i})}}async updateStateForPreviewLinks(){const{site:t,...n}=this.fetchPreviewData(),a=await this.fetchLinkData(this.state.site,this.state.member);if(a!=null&&a.staleGiftRedemptionRequest)return;const{site:i,...o}=a,r={site:{...this.state.site,...i||{},...t||{},plans:{...this.state.site&&this.state.site.plans,...(i||{}).plans,...(t||{}).plans}},...o,...n};this.handleSignupQuery({site:r.site,pageQuery:r.pageQuery}),this.setState(r)}async handleOfferQuery({site:t,offerId:n,member:a=this.state.member}){const{portal_button:i}=t;if(Tn(),!Dt({member:a})||Pn({member:a}))try{const o=await this.GhostApi.site.offer({offerId:n}),r=o==null?void 0:o.offers[0];if(!r||!r.tier||Td({offer:r})||!L0({site:t,offer:r}))return;if(i)this.dispatchAction("openPopup",{page:"offer",pageData:o==null?void 0:o.offers[0]});else{const s=ea({site:t,productId:r.tier.id}),c=r.cadence==="month"?s.monthlyPrice:s.yearlyPrice;if(this.dispatchAction("openPopup",{page:"loading"}),a){const{tierId:u,cadence:d}=na({site:t,priceId:c.id});this.dispatchAction("checkoutPlan",{plan:c.id,offerId:n,tierId:u,cadence:d})}else{const{tierId:u,cadence:d}=na({site:t,priceId:c.id});this.dispatchAction("signup",{plan:c.id,offerId:n,tierId:u,cadence:d})}}}catch{}}handleSignupQuery({site:t,pageQuery:n,member:a}){const i=/^offers\/(\w+?)\/?$/;let o=n;if(i.test(n||"")){const[,s]=n.match(i);this.handleOfferQuery({site:t,offerId:s,member:a});return}wb({site:t,pageQuery:n})&&(o=wb({site:t,pageQuery:n}));const r=E0({site:t,priceId:o});if(n&&n!=="free"){Tn();const s=(r==null?void 0:r.id)||o;s!=="free"&&this.dispatchAction("openPopup",{page:"loading"});const{tierId:c,cadence:u}=na({site:t,priceId:s});this.dispatchAction("signup",{plan:s,tierId:c,cadence:u})}}getPageFromLinkPath(t){const n=/^signup\/?(?:\/(\w+?))?\/?$/,a=/^signup\/?(?:\/(\w+?))\/monthly\/?$/,i=/^signup\/?(?:\/(\w+?))\/yearly\/?$/,o=/^offers\/(\w+?)\/?$/,r=/^gift\/redeem\/([^/?#]+)\/?$/;if(t===void 0||t==="")return{page:"default"};if(r.test(t)){const[,s]=t.match(r),c=zk(s);return c?{page:"giftRedemption",pageData:{token:c}}:null}else{if(o.test(t))return{pageQuery:t};if(t==="signup")return{page:"signup"};if(a.test(t)){const[,s]=t.match(a);return{page:"signup",pageQuery:`${s}/monthly`}}else if(i.test(t)){const[,s]=t.match(i);return{page:"signup",pageQuery:`${s}/yearly`}}else if(n.test(t)){const[,s]=t.match(n);return{page:"signup",pageQuery:s}}else{if(t==="signup/free")return{page:"signup",pageQuery:"free"};if(t==="signup/monthly")return{page:"signup",pageQuery:"monthly"};if(t==="signup/yearly")return{page:"signup",pageQuery:"yearly"};if(t==="signin")return{page:"signin"};if(t==="account")return{page:"accountHome"};if(t==="account/plans")return{page:"accountPlan"};if(t==="account/profile")return{page:"accountProfile"};if(t==="account/newsletters")return{page:"accountEmail"};if(t==="support")return{page:"support"};if(t==="support/success")return{page:"supportSuccess"};if(t==="support/error")return{page:"supportError"};if(t==="recommendations")return{page:"recommendations",pageData:{signup:!1}};if(t==="gift")return{page:"gift"};if(t==="share")return{page:"share"};if(t==="account/newsletters/help")return{page:"emailReceivingFAQ",pageData:{direct:!0}};if(t==="account/newsletters/disabled")return{page:"emailSuppressionFAQ",pageData:{direct:!0}}}}return{page:"default"}}getAccentColor(){const{accent_color:t}=this.state.site||{};return ET(t)}getRetentionPreviewMember({site:t,offers:n}){var u,d,p;const a=(n||[]).find(m=>Td({offer:m})),i=(u=a==null?void 0:a.tier)==null?void 0:u.id,o=i?ea({site:t,productId:i}):null,r=o?a.cadence==="year"?o.yearlyPrice:o.monthlyPrice:null,s=ri.preview,c=(d=s==null?void 0:s.subscriptions)==null?void 0:d[0];return!c||!o||!r?s:{...s,subscriptions:[{...c,plan:{...c.plan,amount:r.amount,interval:r.interval,currency:r.currency.toUpperCase()},price:{...c.price,price_id:r.id,amount:r.amount,interval:r.interval,currency:r.currency,product:{...(p=c.price)==null?void 0:p.product,product_id:o.id}},tier:{id:o.id,name:o.name}}]}}getContextPage({site:t,page:n,member:a}){if(!n||n==="default"){const i=Ft({site:t})||!Qt({site:t})?"signin":"signup";n=a?"accountHome":i}return cm({page:n})}getContextMember({site:t,page:n,member:a,offers:i,pageData:o,customSiteUrl:r}){return de(["dev","preview"],{customSiteUrl:r})?wk({page:n})||v2({page:n})?de(["dev"],{customSiteUrl:r})?a||ri.free:de(["preview"])?n==="accountPlan"&&(o==null?void 0:o.action)==="cancel"?this.getRetentionPreviewMember({site:t,offers:i}):ri.preview:ri.paid:null:a}getContextFromState(){const{site:t,member:n,offers:a,action:i,actionErrorMessage:o,page:r,lastPage:s,showPopup:c,pageQuery:u,pageData:d,popupNotification:p,notification:m,customSiteUrl:f,dir:b,scrollbarWidth:w,otcRef:g,inboxLinks:y}=this.state,k=this.getContextPage({site:t,page:r,member:n}),C=this.getContextMember({site:t,page:k,member:n,offers:a,pageData:d,customSiteUrl:f});return{api:this.GhostApi,site:t,offers:a,action:i,actionErrorMessage:o,brandColor:this.getAccentColor(),page:k,pageQuery:u,pageData:d,member:C,lastPage:s,showPopup:c,popupNotification:p,notification:m,customSiteUrl:f,dir:b,scrollbarWidth:w,otcRef:g,inboxLinks:y,doAction:(x,T)=>this.dispatchAction(x,T)}}getRecommendationButtons(){return document.querySelectorAll("[data-recommendation]")||[]}setupRecommendationButtons(){const t=a=>{const i=a.currentTarget.dataset.recommendation;i?this.dispatchAction("trackRecommendationClicked",{recommendationId:i}).catch(console.error):console.warn("[Portal] Invalid usage of data-recommendation attribute")},n=this.getRecommendationButtons();for(const a of n)a.addEventListener("click",t,{passive:!0})}transformPortalLinksToRelative(){document.querySelectorAll('a[href*="#/portal"], a[href*="#/share"]').forEach(P2)}render(){return this.state.initStatus==="success"?l.jsx(fz,{site:this.state.site,children:l.jsxs(_.Provider,{value:this.getContextFromState(),children:[l.jsx(dm,{}),l.jsx(zd,{}),l.jsx(Rd,{})]})}):null}}const Ik="ghost-portal-root";function yz(){const e=document.createElement("div");e.id=Ik,e.setAttribute("data-testid","portal-root"),document.body.appendChild(e)}function bz(){const e=document.querySelector("script[data-ghost]");if(e){const t=e.dataset.i18n==="true",n=e.dataset.ghost,a=e.dataset.key,i=e.dataset.api,o=e.dataset.locale;return{siteUrl:n,apiKey:a,apiUrl:i,siteI18nEnabled:t,locale:o}}return{}}function kz(){const e=new URL(window.location.href);e.searchParams.get("token")&&(e.searchParams.delete("token"),window.history.replaceState({},document.title,e.href))}function vz(){const{siteUrl:e,apiKey:t,apiUrl:n,siteI18nEnabled:a,locale:i}=bz(),o=e||window.location.origin;yz(),kz(),cS.render(l.jsx(Z.StrictMode,{children:l.jsx(gz,{siteUrl:o,customSiteUrl:e,apiKey:t,apiUrl:n,siteI18nEnabled:a,locale:i})}),document.getElementById(Ik))}vz()});
|
|
4129
|
+
`),a=[];return e&&a.push(`subject=${encodeURIComponent(e)}`),n&&a.push(`body=${encodeURIComponent(n)}`),`mailto:${a.length?`?${a.join("&")}`:""}`},u2=({shareTitle:e,shareUrl:t})=>Ho("https://www.linkedin.com/shareArticle",{mini:"true",url:t,title:e}),d2=()=>{const e=l2(),t=e.document,n=e.location,a=(b,w="content")=>{var g;return((g=t.querySelector(b))==null?void 0:g[w])||""},i=a('link[rel="canonical"]',"href")||n.origin+n.pathname+n.search,o=a('meta[property="og:title"]')||t.title||"",r=a('meta[property="og:description"]')||a('meta[name="description"]')||"",s=a('meta[property="og:image"]')||a('meta[name="twitter:image"]')||"",c=a('link[rel="icon"]',"href")||a('link[rel="shortcut icon"]',"href")||a('link[rel="apple-touch-icon"]',"href"),u=a('meta[name="author"]'),d=(u&&!/^https?:\/\//i.test(u)?u:"")||a('meta[name="twitter:creator"]')||"";let p=a('meta[property="og:site_name"]')||a('meta[name="application-name"]')||"";if(!p)try{p=new URL(i).hostname.replace(/^www\./,"")}catch{p=""}const m=[o,i].filter(Boolean).join(" ").trim(),f={twitter:Ho("https://twitter.com/intent/tweet",{url:i,text:o}),facebook:Ho("https://www.facebook.com/sharer/sharer.php",{u:i}),email:c2({shareTitle:o,shareUrl:i}),threads:Ho("https://www.threads.net/intent/post",{text:m}),linkedin:u2({shareTitle:o,shareUrl:i}),bluesky:Ho("https://bsky.app/intent/compose",{text:m})};return{shareUrl:i,shareTitle:o,shareExcerpt:r,shareImage:s,shareFavicon:c,shareSiteName:p,shareAuthor:d,socialLinks:f}},m2=()=>{const[e]=v.useState(d2);return e},p2=e=>v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 -3.268 64 68.414",width:2232,height:2500,...e},v.createElement("path",{fill:"#0085ff",d:"M13.873 3.805C21.21 9.332 29.103 20.537 32 26.55v15.882c0-.338-.13.044-.41.867-1.512 4.456-7.418 21.847-20.923 7.944-7.111-7.32-3.819-14.64 9.125-16.85-7.405 1.264-15.73-.825-18.014-9.015C1.12 23.022 0 8.51 0 6.55 0-3.268 8.579-.182 13.873 3.805zm36.254 0C42.79 9.332 34.897 20.537 32 26.55v15.882c0-.338.13.044.41.867 1.512 4.456 7.418 21.847 20.923 7.944 7.111-7.32 3.819-14.64-9.125-16.85 7.405 1.264 15.73-.825 18.014-9.015C62.88 23.022 64 8.51 64 6.55c0-9.818-8.578-6.732-13.873-2.745z"})),h2=e=>v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-ellipsis-icon lucide-ellipsis",...e},v.createElement("circle",{cx:12,cy:12,r:1}),v.createElement("circle",{cx:19,cy:12,r:1}),v.createElement("circle",{cx:5,cy:12,r:1})),f2=e=>v.createElement("svg",{id:"svg9",width:666.66669,height:666.66718,viewBox:"0 0 666.66668 666.66717",xmlns:"http://www.w3.org/2000/svg","xmlns:svg":"http://www.w3.org/2000/svg",...e},v.createElement("defs",{id:"defs13"},v.createElement("clipPath",{clipPathUnits:"userSpaceOnUse",id:"clipPath25"},v.createElement("path",{d:"M 0,700 H 700 V 0 H 0 Z",id:"path23"}))),v.createElement("g",{id:"g17",transform:"matrix(1.3333333,0,0,-1.3333333,-133.33333,799.99999)"},v.createElement("g",{id:"g19"},v.createElement("g",{id:"g21",clipPath:"url(#clipPath25)"},v.createElement("g",{id:"g27",transform:"translate(600,350)"},v.createElement("path",{d:"m 0,0 c 0,138.071 -111.929,250 -250,250 -138.071,0 -250,-111.929 -250,-250 0,-117.245 80.715,-215.622 189.606,-242.638 v 166.242 h -51.552 V 0 h 51.552 v 32.919 c 0,85.092 38.508,124.532 122.048,124.532 15.838,0 43.167,-3.105 54.347,-6.211 V 81.986 c -5.901,0.621 -16.149,0.932 -28.882,0.932 -40.993,0 -56.832,-15.528 -56.832,-55.9 V 0 h 81.659 l -14.028,-76.396 h -67.631 V -248.169 C -95.927,-233.218 0,-127.818 0,0",style:{fill:"#0866ff",fillOpacity:1,fillRule:"nonzero",stroke:"none"},id:"path29"})),v.createElement("g",{id:"g31",transform:"translate(447.9175,273.6036)"},v.createElement("path",{d:"M 0,0 14.029,76.396 H -67.63 v 27.019 c 0,40.372 15.838,55.899 56.831,55.899 12.733,0 22.981,-0.31 28.882,-0.931 v 69.253 c -11.18,3.106 -38.509,6.212 -54.347,6.212 -83.539,0 -122.048,-39.441 -122.048,-124.533 V 76.396 h -51.552 V 0 h 51.552 v -166.242 c 19.343,-4.798 39.568,-7.362 60.394,-7.362 10.254,0 20.358,0.632 30.288,1.831 L -67.63,0 Z",style:{fill:"#ffffff",fillOpacity:1,fillRule:"nonzero",stroke:"none"},id:"path33"})))))),g2=e=>v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-link-icon lucide-link",...e},v.createElement("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),v.createElement("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})),y2=e=>v.createElement("svg",{viewBox:"0 5 2490 2490.0000000000005",xmlns:"http://www.w3.org/2000/svg",width:2500,height:2495,...e},v.createElement("path",{d:"M185.2 313.1H2252V2291H185.2z",fill:"#fff"}),v.createElement("path",{d:"M0 183.4C0 84.9 82.4 5 184 5h2122c101.6 0 184 79.9 184 178.4v2133.3c0 98.5-82.4 178.3-184 178.3H184c-101.6 0-184-79.8-184-178.3z",fill:"#0a66c2"}),v.createElement("path",{d:"M756.7 2088.8v-1121H384.1v1121zm-186.2-1274c129.9 0 210.8-86.1 210.8-193.7-2.4-110-80.9-193.7-208.3-193.7-127.5 0-210.8 83.7-210.8 193.7 0 107.6 80.8 193.7 205.9 193.7zm392.4 1274h372.6v-626c0-33.5 2.4-67 12.3-90.9 26.9-67 88.2-136.3 191.2-136.3 134.8 0 188.7 102.8 188.7 253.5v599.6h372.6V1446c0-344.3-183.8-504.5-428.9-504.5-201 0-289.2 112.3-338.3 188.8h2.5V967.8H962.9c4.9 105.2 0 1121 0 1121z",fill:"#fff"})),b2=e=>v.createElement("svg",{width:18,height:18,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},v.createElement("g",{clipPath:"url(#clip0_351_18008)"},v.createElement("path",{d:"M13.0332 8.37917C12.96 8.34407 12.8856 8.3103 12.8103 8.27795C12.6791 5.86015 11.3579 4.47596 9.1396 4.4618C9.12955 4.46173 9.11955 4.46173 9.1095 4.46173C7.78265 4.46173 6.67913 5.0281 5.99992 6.05871L7.21993 6.89561C7.72733 6.12579 8.52364 5.96167 9.11008 5.96167C9.11686 5.96167 9.12366 5.96168 9.13036 5.96174C9.86078 5.96639 10.4119 6.17876 10.7687 6.59291C11.0283 6.89442 11.2019 7.31107 11.2879 7.8369C10.6403 7.72683 9.93993 7.69299 9.19122 7.73592C7.08214 7.8574 5.72624 9.08747 5.81731 10.7967C5.86352 11.6637 6.29544 12.4096 7.03346 12.8968C7.65745 13.3087 8.46111 13.5101 9.29635 13.4645C10.3994 13.4041 11.2647 12.9832 11.8684 12.2137C12.3268 11.6293 12.6168 10.872 12.7448 9.91782C13.2705 10.2351 13.6601 10.6525 13.8753 11.1544C14.2411 12.0075 14.2624 13.4094 13.1186 14.5523C12.1164 15.5535 10.9117 15.9866 9.09104 16C7.07147 15.9851 5.54409 15.3374 4.55103 14.0749C3.62111 12.8928 3.14053 11.1854 3.1226 9C3.14053 6.8146 3.62111 5.10714 4.55103 3.92503C5.54409 2.66262 7.07144 2.01495 9.09101 1.99994C11.1252 2.01506 12.6792 2.66585 13.7103 3.93435C14.2159 4.55641 14.597 5.3387 14.8483 6.25081L16.278 5.86936C15.9734 4.74665 15.4942 3.7792 14.842 2.97686C13.5201 1.35059 11.5869 0.517279 9.096 0.5H9.08603C6.60019 0.517219 4.68862 1.3537 3.40443 2.98619C2.26168 4.4389 1.67221 6.46024 1.65241 8.99402L1.65234 9L1.65241 9.00598C1.67221 11.5397 2.26168 13.5611 3.40443 15.0138C4.68862 16.6463 6.60019 17.4828 9.08603 17.5H9.096C11.306 17.4847 12.8638 16.9061 14.1472 15.6239C15.8262 13.9465 15.7756 11.8439 15.2222 10.5531C14.8252 9.62749 14.0683 8.8757 13.0332 8.37917ZM9.21739 11.9668C8.29301 12.0188 7.33268 11.6039 7.28533 10.7152C7.25023 10.0563 7.75426 9.32105 9.27412 9.23347C9.44817 9.22343 9.61897 9.21852 9.78676 9.21852C10.3388 9.21852 10.8553 9.27215 11.3248 9.3748C11.1497 11.562 10.1224 11.9171 9.21739 11.9668Z",fill:"black"})),v.createElement("defs",null,v.createElement("clipPath",{id:"clip0_351_18008"},v.createElement("rect",{width:17,height:17,fill:"white",transform:"translate(0.5 0.5)"})))),k2=e=>v.createElement("svg",{viewBox:"0 0 1200 1226.37",xmlns:"http://www.w3.org/2000/svg",width:2446,height:2500,...e},v.createElement("path",{d:"M714.163 519.284L1160.89 0h-105.86L667.137 450.887 357.328 0H0l468.492 681.821L0 1226.37h105.866l409.625-476.152 327.181 476.152H1200L714.137 519.284zM569.165 687.828l-47.468-67.894-377.686-540.24h162.604l304.797 435.991 47.468 67.894 396.2 566.721H892.476L569.165 687.854z"})),lm={signin:om,signup:Qd,accountHome:rm,accountPlan:Bd,accountProfile:sm,accountEmail:qP,signupNewsletter:Ud,unsubscribe:XP,magiclink:tm,loading:ai,offer:am,feedback:JT,emailSuppressed:QP,emailSuppressionFAQ:e2,emailReceivingFAQ:t2,support:n2,supportSuccess:nP,supportError:im,recommendations:kP,gift:s2,giftRedemption:sP,giftSuccess:dP,share:()=>{const[e,t]=v.useState(!1),[n,a]=v.useState(!1),i=v.useRef(),o=v.useRef(null),{shareUrl:r,shareTitle:s,shareExcerpt:c,shareImage:u,shareFavicon:d,shareSiteName:p,shareAuthor:m,socialLinks:f}=m2();v.useEffect(()=>()=>{clearTimeout(i.current)},[]),v.useEffect(()=>{if(!n)return;const y=C=>{o.current&&!o.current.contains(C.target)&&a(!1)},k=C=>{C.key==="Escape"&&a(!1)};return document.addEventListener("mousedown",y),document.addEventListener("keydown",k),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",k)}},[n]);const b=async()=>{await hk(r)&&(t(!0),clearTimeout(i.current),i.current=setTimeout(()=>{t(!1)},2e3))},w=()=>{a(y=>!y)},g=()=>{a(!1)};return l.jsxs("div",{className:"gh-portal-content gh-portal-share",children:[l.jsx(pe,{}),l.jsx("div",{className:"gh-portal-share-header",children:l.jsx("h1",{className:"gh-portal-main-title",children:h("Share")})}),l.jsxs("div",{className:"gh-portal-share-preview",children:[u&&l.jsx("img",{className:"gh-portal-share-preview-image",src:u,alt:"","data-testid":"share-preview-image"}),l.jsxs("div",{className:"gh-portal-share-preview-content",children:[s&&l.jsx("h2",{className:"gh-portal-share-preview-title",children:s}),c&&l.jsx("p",{className:"gh-portal-share-preview-excerpt",children:c}),(d||p||m)&&l.jsxs("div",{className:"gh-portal-share-preview-footer",children:[d&&l.jsx("img",{className:"gh-portal-share-preview-favicon",src:d,alt:"","data-testid":"share-preview-favicon"}),l.jsxs("div",{className:"gh-portal-share-preview-meta",children:[p&&l.jsx("span",{className:"gh-portal-share-preview-site",children:p}),m&&l.jsx("span",{className:"gh-portal-share-preview-author",children:p?`| ${m}`:m})]})]})]})]}),l.jsxs("div",{className:"gh-portal-share-actions",children:[l.jsxs("button",{className:"gh-portal-btn gh-portal-share-action copy",type:"button",onClick:b,"aria-label":h(e?"Copied":"Copy link"),title:h(e?"Copied":"Copy link"),children:[e?l.jsx("span",{className:"gh-portal-share-icon copied","aria-hidden":"true",children:l.jsx(Do,{})}):l.jsx("span",{className:"gh-portal-share-icon","aria-hidden":"true",children:l.jsx(g2,{})}),l.jsx("span",{className:"gh-portal-share-label",children:h(e?"Copied":"Copy link")})]}),l.jsx("a",{className:"gh-portal-btn gh-portal-share-action twitter",href:f.twitter,target:"_blank",rel:"noopener noreferrer","aria-label":h("X (Twitter)"),title:h("X (Twitter)"),children:l.jsx("span",{className:"gh-portal-share-icon x","aria-hidden":"true",children:l.jsx(k2,{})})}),l.jsx("a",{className:"gh-portal-btn gh-portal-share-action linkedin",href:f.linkedin,target:"_blank",rel:"noopener noreferrer","aria-label":h("LinkedIn"),title:h("LinkedIn"),children:l.jsx("span",{className:"gh-portal-share-icon","aria-hidden":"true",children:l.jsx(y2,{})})}),l.jsx("a",{className:"gh-portal-btn gh-portal-share-action email",href:f.email,target:"_blank",rel:"noopener noreferrer","aria-label":h("Email"),title:h("Email"),children:l.jsx("span",{className:"gh-portal-share-icon","aria-hidden":"true",children:l.jsx(em,{})})}),l.jsxs("div",{className:"gh-portal-share-more",ref:o,children:[l.jsx("button",{className:"gh-portal-btn gh-portal-share-action more",type:"button",onClick:w,"aria-label":h("More options"),title:h("More options"),"aria-haspopup":"menu","aria-expanded":n,children:l.jsx("span",{className:"gh-portal-share-icon","aria-hidden":"true",children:l.jsx(h2,{})})}),n&&l.jsxs("div",{className:"gh-portal-share-more-menu",role:"menu","aria-label":h("More options"),children:[l.jsxs("a",{className:"gh-portal-share-more-item",href:f.facebook,target:"_blank",rel:"noopener noreferrer",role:"menuitem",onClick:g,children:[l.jsx("span",{className:"gh-portal-share-more-item-icon","aria-hidden":"true",children:l.jsx(f2,{})}),l.jsx("span",{children:h("Facebook")})]}),l.jsxs("a",{className:"gh-portal-share-more-item",href:f.threads,target:"_blank",rel:"noopener noreferrer",role:"menuitem",onClick:g,children:[l.jsx("span",{className:"gh-portal-share-more-item-icon","aria-hidden":"true",children:l.jsx(b2,{})}),l.jsx("span",{children:h("Threads")})]}),l.jsxs("a",{className:"gh-portal-share-more-item",href:f.bluesky,target:"_blank",rel:"noopener noreferrer",role:"menuitem",onClick:g,children:[l.jsx("span",{className:"gh-portal-share-more-item-icon","aria-hidden":"true",children:l.jsx(p2,{})}),l.jsx("span",{children:h("Bluesky")})]})]})]})]})]})}},cm=function({page:e}){return Object.keys(lm).includes(e)?e:"signup"},wk=function({page:e}){return e.includes("account")},v2=function({page:e}){return e.includes("offer")},w2=e=>v.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},v.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M24 12C24 18.6274 18.6274 24 12 24C5.37258 24 0 18.6274 0 12C0 5.37258 5.37258 0 12 0C18.6274 0 24 5.37258 24 12ZM11.8326 2.33879C6.37785 2.95189 3.95901 5.20797 3.41126 9.74699C3.34896 10.2632 3.22642 10.7805 3.10443 11.2954C2.93277 12.02 2.76221 12.74 2.76221 13.4458C2.76221 17.9885 6.5856 21.556 11.1283 21.556C12.8959 21.556 14.4433 20.8144 15.8756 20.048C19.0536 18.3478 22.0328 16.2597 22.0328 12.5411C22.0328 9.91512 20.1051 7.56932 18.466 5.5747C18.3834 5.47416 18.3015 5.37451 18.2206 5.27577C17.3866 4.25742 14.4333 2.04643 11.8326 2.33879Z",fill:"#15171A"})),$m=class $m extends Z.Component{render(){return l.jsxs("a",{href:"https://ghost.org",target:"_blank",rel:"noopener noreferrer",onClick:()=>{window.open("https://ghost.org","_blank")},children:[l.jsx(w2,{}),"Powered by Ghost"]})}};$m.contextType=_;let sl=$m;const Sk=()=>({modalContainer:{zIndex:"3999999",position:"fixed",left:"0",top:"0",width:"100%",height:"100%",overflow:"hidden"},frame:{common:{margin:"auto",position:"relative",padding:"0",outline:"0",width:"100%",opacity:"1",overflow:"hidden",height:"100%"}},page:{links:{width:"600px"}}});function S2({message:e}){return Zn()?l.jsx("div",{className:"gh-portal-cookiebanner",children:e}):null}const jm=class jm extends Z.Component{componentDidMount(){this.node&&!de(["preview"])&&!this.props.isMobile&&(this.node.focus(),this.keyUphandler=t=>{t.key==="Escape"&&this.dismissPopup(t)},this.node.ownerDocument.removeEventListener("keyup",this.keyUphandler),this.node.ownerDocument.addEventListener("keyup",this.keyUphandler)),this.sendContainerHeightChangeEvent()}dismissPopup(t){var i;const n=t.target&&t.target.tagName;(n!=="INPUT"||n==="INPUT"&&!((i=t==null?void 0:t.target)!=null&&i.value))&&this.context.doAction("closePopup")}sendContainerHeightChangeEvent(){var t,n;this.node&&de(["preview"])&&((t=this.node)==null?void 0:t.clientHeight)!==this.lastContainerHeight&&(this.lastContainerHeight=(n=this.node)==null?void 0:n.clientHeight,window.document.body.style.overflow="hidden",window.document.body.style["scrollbar-width"]="none",window.parent.postMessage({type:"portal-preview-updated",payload:{height:this.lastContainerHeight}},"*"))}componentDidUpdate(){this.sendContainerHeightChangeEvent()}componentWillUnmount(){this.node&&this.node.ownerDocument.removeEventListener("keyup",this.keyUphandler)}handlePopupClose(t){const{page:n,otcRef:a}=this.context;de(["preview"])||a&&n==="magiclink"||t.target===t.currentTarget&&this.context.doAction("closePopup")}renderActivePage(){const{page:t}=this.context;cm({page:t});const n=lm[t];return l.jsx(n,{})}renderPopupNotification(){const{popupNotification:t}=this.context;return!t||!t.type?null:l.jsx(nm,{})}sendPortalPreviewReadyEvent(){window.self!==window.parent&&window.parent.postMessage({type:"portal-preview-ready",payload:{}},"*")}render(){const{page:t,pageQuery:n,site:a,customSiteUrl:i}=this.context,r=Vs({site:a,pageQuery:n}).length;cm({page:t});const c={...Sk().page[t]};let u="",d="regular",p="",m=t;switch(t){case"signup":p="Cookies must be enabled in your browser to sign up.";break;case"signin":p="Cookies must be enabled in your browser to sign in.";break;case"accountHome":m="account-home";break;case"accountProfile":m="account-profile";break;case"accountPlan":m="account-plan";break;default:p="Cookies must be enabled in your browser.",m=t;break}r>1&&!Ft({site:a})&&Qt({site:a,pageQuery:n})&&t==="signup"&&(m+=" full-size",d="full"),t==="gift"&&(m+=" full-size",d="full");const f=Po({site:a});(f&&r>2||!f&&r>1)&&t==="accountPlan"&&(m+=" full-size",d="full"),(t==="emailSuppressionFAQ"||t==="emailReceivingFAQ")&&(m+=" large-size");let b="gh-portal-popup-container";de(["preview"])&&(m+=" preview"),de(["preview"],{customSiteUrl:i})&&!a.disableBackground&&(b+=" preview"),de(["dev"])&&(b+=" dev");const w=`${b} ${u} ${m}`;return this.sendPortalPreviewReadyEvent(),l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"gh-portal-popup-wrapper "+m,onClick:g=>this.handlePopupClose(g),children:[this.renderPopupNotification(),l.jsxs("div",{className:w,style:c,ref:g=>this.node=g,tabIndex:-1,children:[l.jsx(S2,{message:p}),this.renderActivePage(),d==="full"?l.jsx("div",{className:"gh-portal-powered inside "+(de(["preview"])?"hidden ":"")+m,children:l.jsx(sl,{})}):""]})]}),t!=="share"&&l.jsx("div",{className:"gh-portal-powered outside "+(de(["preview"])?"hidden ":"")+m,children:l.jsx(sl,{})})]})}};jm.contextType=_;let um=jm;const Tm=class Tm extends Z.Component{constructor(t){super(t),this.state={height:null}}renderCurrentPage(t){const n=lm[t];return l.jsx(n,{})}onHeightChange(t){this.setState({height:t})}handlePopupClose(t){t.preventDefault(),t.target===t.currentTarget&&this.context.doAction("closePopup")}renderFrameStyles(){const{site:t,brandColor:n}=this.context,a=$P({site:t}),i=n?`:root { --brandcolor: ${n} }`+a:a;return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:i}}),l.jsx("meta",{name:"viewport",content:"width=device-width, initial-scale=1, maximum-scale=1"})]})}renderFrameContainer(){const{member:t,site:n,customSiteUrl:a}=this.context,i=Sk(),o=window.innerWidth<480,r={...i.frame.common};let s="gh-portal-popup-background";return de(["preview"])&&(i.modalContainer.zIndex="3999997"),de(["preview"],{customSiteUrl:a})&&!n.disableBackground&&(s+=" preview"),de(["dev"])&&(s+=" dev"),l.jsx("div",{style:i.modalContainer,children:l.jsxs(yd,{style:r,title:"portal-popup",head:this.renderFrameStyles(),dataTestId:"portal-popup-frame",dataDir:this.context.dir,children:[l.jsx("div",{className:s,onClick:c=>this.handlePopupClose(c)}),l.jsx(um,{isMobile:o})]})})}render(){const{showPopup:t}=this.context;return t?this.renderFrameContainer():null}};Tm.contextType=_;let dm=Tm;ll({products:mm({numOfProducts:1})});function Oe(){return(new Date().getTime()/1e3|0).toString(16)+"xxxxxxxxxxxxxxxx".replace(/[x]/g,function(){return(Math.random()*16|0).toString(16)}).toLowerCase()}function x2(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function ll({title:e="The Blueprint",description:t="Thoughts, stories and ideas.",logo:n="https://static.ghost.org/v4.0.0/images/ghost-orb-1.png",icon:a="https://static.ghost.org/v4.0.0/images/ghost-orb-1.png",url:i="https://portal.localhost",plans:o={monthly:5e3,yearly:15e4,currency:"USD"},products:r=mm({numOfProducts:1}),portalProducts:s=r.map(V=>V.id),accentColor:c="#45C32E",portalPlans:u=["free","monthly","yearly"],membersSignupAccess:d="all",freePriceName:p="Free",freePriceDescription:m="Free preview",isStripeConfigured:f=!0,portalButton:b=!0,portalName:w=!0,portalButtonIcon:g="icon-1",portalButtonSignupText:y="Subscribe now",portalButtonStyle:k="icon-and-text",membersSupportAddress:C="support@example.com",editorDefaultEmailRecipients:x="visibility",newsletters:T=[],posts:E=C2(),commentsEnabled:N,recommendations:z=[],recommendationsEnabled:j}={}){return{title:e,description:t,logo:n,icon:a,accent_color:c,url:i,plans:o,products:r,portal_products:s,members_signup_access:d,free_price_name:p,free_price_description:m,is_stripe_configured:f,portal_button:b,portal_name:w,portal_plans:u,portal_button_icon:g,portal_button_signup_text:y,portal_button_style:k,members_support_address:C,comments_enabled:N!=="off",newsletters:T,recommendations:z,recommendations_enabled:!!j,editor_default_email_recipients:x,posts:E}}function xk({name:e="Black Friday",code:t="black-friday",displayTitle:n="Black Friday Sale!",displayDescription:a="Special deal for Black Friday. Subscribe now for only $15 per month and get additional benefits like accessing our podcast.",type:i="percent",cadence:o="month",amount:r=50,duration:s="repeating",durationInMonths:c=null,currencyRestriction:u=!1,currency:d=null,status:p="active",tierId:m="",tierName:f="Basic",redemptionType:b="signup"}={}){return{id:`offer_${Oe()}`,name:e,code:t,display_title:n,display_description:a,type:i,cadence:o,amount:r,duration:s,duration_in_months:c,currency_restriction:u,currency:d,status:p,tier:{id:`${m}`,name:f},redemption_type:b}}function Et({name:e="Jamie Larson",email:t="jamie@example.com",firstname:n="Jamie",subscriptions:a=[],paid:i=!1,avatarImage:o="",subscribed:r=!0,email_suppression:s={suppressed:!1,info:null},newsletters:c=[]}={}){return{uuid:x2(),email:t,name:e,firstname:n,paid:i,subscribed:r,avatar_image:o,subscriptions:a,email_suppression:s,newsletters:c}}function C2({numOfPosts:e=3}={}){const t=[];for(let n=0;n<e;n++)t.push(E2({title:`Post ${n+1}`,slug:`post-${n+1}`}));return t.slice(0,e)}function E2({id:e=`post_${Oe()}`,title:t="Post",excerpt:n="Post excerpt",slug:a="post",featured:i=!1}={}){return{id:e,title:t,excerpt:n,slug:a,featured:i}}function mm({numOfProducts:e=3}={}){const n=[ii({name:"Bronze",description:"Access to all members articles",monthlyPrice:yt({interval:"month",amount:700}),yearlyPrice:yt({interval:"year",amount:7e3}),numOfBenefits:2}),ii({name:"Silver",description:"Access to all members articles and weekly podcast",monthlyPrice:yt({interval:"month",amount:1200}),yearlyPrice:yt({interval:"year",amount:12e3}),numOfBenefits:3}),ii({name:"Friends of the Blueprint",description:"Get access to everything and lock in early adopter pricing for life + listen to my podcast",monthlyPrice:yt({interval:"month",amount:18e3}),yearlyPrice:yt({interval:"year",amount:17e3}),numOfBenefits:4})].slice(0,e),a=Ck({});return[...n,a]}function ii({type:e="paid",name:t="Basic",description:n="",id:a=`product_${Oe()}`,monthlyPrice:i=yt(),yearlyPrice:o=yt({interval:"year"}),numOfBenefits:r=2,trialDays:s=null}){return{id:a,name:t,description:n,monthlyPrice:e==="free"?null:i,yearlyPrice:e==="free"?null:o,type:e,benefits:Ek({numOfBenefits:r}),trial_days:s}}function Ck({name:e="Free tier",description:t="Free tier description",id:n=`product_${Oe()}`,numOfBenefits:a=2}){return{id:n,name:e,type:"free",description:t,benefits:Ek({numOfBenefits:a})}}function Ek({numOfBenefits:e}){const t=Oe();return[cl({name:`Limited early adopter pricing #${t.substring(0,6)}`}),cl({name:`Latest gear reviews #${t.substring(6,12)}`}),cl({name:`Weekly email newsletter #${t.substring(12,18)}`}),cl({name:`Listen to my podcast #${t.substring(18)}`})].slice(0,e)}function cl({id:e=`benefit_${Oe()}`,name:t="Benefit"}){return{id:e,name:t}}function yt({interval:e="month",amount:t=e==="month"?500:5e3,nickname:n=e==="month"?"Monthly":"Yearly",description:a=null,currency:i="usd",active:o=!0,id:r=`price_${Oe()}`}={}){return{id:r,active:o,nickname:n,currency:i,amount:t,interval:e,description:a,stripe_price_id:`price_${Oe()}`,stripe_product_id:`prod_${Oe()}`,type:"recurring"}}function ia({id:e=`sub_${Oe()}`,status:t="active",currency:n="USD",interval:a="year",amount:i=a==="month"?500:5e3,nickname:o=a==="month"?"Monthly":"Yearly",cardLast4:r="4242",offer:s=j2,priceId:c=`price_${Oe()}`,startDate:u="2021-10-05T03:18:30.000Z",currentPeriodEnd:d="2022-10-05T03:18:30.000Z",cancelAtPeriodEnd:p=!1,trialEndAt:m=null,nextPayment:f=null,tier:b=null}={}){return{id:e,customer:{id:`cus_${Oe()}`,name:"Jamie",email:"jamie@example.com"},plan:{id:`price_${Oe()}`,nickname:o,amount:i,interval:a,currency:n},offer:s,status:t,start_date:u,default_payment_card_last4:r,cancel_at_period_end:p,cancellation_reason:null,current_period_end:d,trial_end_at:m,next_payment:f,tier:b,price:{id:`stripe_price_${Oe()}`,price_id:c,nickname:o,amount:i,interval:a,type:"recurring",currency:n,product:{id:`stripe_prod_${Oe()}`,product_id:`prod_${Oe()}`}}}}function $k(){const e=mm({numOfProducts:1}),t=e.map(a=>a.id);return ll({products:e,portalPlans:["free","monthly","yearly"],portalProducts:t})}$k();const $2=ll({products:[ii({numOfBenefits:2,type:"free"})]}),j2=xk({tierId:(Nk=$2.products[0])==null?void 0:Nk.id});Et(),Et({paid:!0,subscriptions:[ia()]}),Et({paid:!0,subscriptions:[]}),Et({paid:!0,subscriptions:[ia({amount:0})]}),Et({paid:!0,subscriptions:[ia({amount:1500,startDate:"2019-05-01T11:42:40.000Z",currentPeriodEnd:"2021-06-05T11:42:40.000Z"})]}),$k();const ul=[Ck({name:"Free",description:"Free tier description which is actually a pretty long description",numOfBenefits:2}),ii({name:"The Blueprint",description:"",monthlyPrice:yt({interval:"month",amount:500}),yearlyPrice:yt({interval:"year",amount:5e3}),numOfBenefits:3}),ii({name:"Friends of the Blueprint Silver",description:"Access to all members articles and weekly podcast",monthlyPrice:yt({interval:"month",amount:1200}),yearlyPrice:yt({interval:"year",amount:11e3}),numOfBenefits:4})],oi=ll({title:"The Blueprint",description:"Thoughts, stories and ideas.",logo:"https://static.ghost.org/v4.0.0/images/ghost-orb-1.png",icon:"https://static.ghost.org/v4.0.0/images/ghost-orb-1.png",accentColor:"#45C32E",url:"https://portal.localhost",plans:{monthly:5e3,yearly:15e4,currency:"USD"},products:ul,portalProducts:ul.map(e=>e.id),membersSignupAccess:"all",freePriceName:"Free",freePriceDescription:"Free preview",isStripeConfigured:!0,portalButton:!0,portalName:!0,portalPlans:["free","monthly","yearly"],portalButtonIcon:"icon-1",portalButtonSignupText:"Subscribe now",portalButtonStyle:"icon-and-text",membersSupportAddress:"support@example.com",commentsEnabled:!0,newsletters:[{id:"weekly",name:"Weekly Rundown",description:"Best of last week",subscribe_on_signup:!0,paid:!0},{id:"daily",name:"Daily Brief",description:"One email every day",subscribe_on_signup:!1,paid:!1}],posts:[{id:"post_66aacfe061c94e10eb6e4fc1",title:"Post 1",excerpt:"Post excerpt",slug:"post-1",featured:!1},{id:"post_66aacfe04f14b8dbb56c5721",title:"Post 2",excerpt:"Post excerpt",slug:"post-2",featured:!1},{id:"post_66aacfe03d609460819af18c",title:"Post 3",excerpt:"Post excerpt",slug:"post-3",featured:!1}]}),jk=xk({tierId:(Ak=oi.products[1])==null?void 0:Ak.id}),ri={free:Et({name:"Jamie Larson",email:"jamie@example.com",firstname:"Jamie",subscriptions:[],paid:!1,avatarImage:"",subscribed:!0}),paid:Et({paid:!0,subscriptions:[ia({status:"active",currency:"USD",interval:"year",amount:5e3,cardLast4:"4242",startDate:"2021-10-05T03:18:30.000Z",currentPeriodEnd:"2022-10-05T03:18:30.000Z",cancelAtPeriodEnd:!1})]}),complimentary:Et({paid:!0,subscriptions:[]}),complimentaryWithSubscription:Et({paid:!0,subscriptions:[ia({amount:0})]}),preview:Et({paid:!0,subscriptions:[ia({amount:1500,startDate:"2019-05-01T11:42:40.000Z",currentPeriodEnd:new Date().toISOString()})]})};function T2(){var n;if(!ul||!ul[1])return null;let e=(n=oi==null?void 0:oi.products)==null?void 0:n[1].monthlyPrice,t=Et({paid:!0,subscriptions:[ia({offer:null,priceId:e==null?void 0:e.id,status:"active",currency:e==null?void 0:e.currency,interval:e==null?void 0:e.interval,amount:e==null?void 0:e.amount,cardLast4:"4242",startDate:"2021-10-05T03:18:30.000Z",currentPeriodEnd:"2022-10-05T03:18:30.000Z",cancelAtPeriodEnd:!1})]});return{site:oi,member:t}}function P2(e){const t=e.getAttribute("href"),n=new URL(t,window.location.origin),a=["#/portal","#/share"],i=a.some(r=>n.hash.startsWith(r)),o=a.some(r=>t.startsWith(r));!n.hash||!i||o||n.origin===window.location.origin&&e.setAttribute("href",n.hash)}function z2({data:e,state:t}){return{page:e.page,popupNotification:null,lastPage:e.lastPage||null,pageData:e.pageData||t.pageData}}function I2({state:e}){return{showPopup:!e.showPopup}}function N2({data:e}){return{showPopup:!0,reloadOnPopupClose:!1,page:e.page,...e.pageQuery?{pageQuery:e.pageQuery}:{},...e.pageData?{pageData:e.pageData}:{}}}function A2({state:e}){return e.lastPage?{page:e.lastPage}:Tk({state:e})}function Tk({state:e}){return Tn(),{showPopup:!1,lastPage:null,pageQuery:"",popupNotification:null,page:e.page==="magiclink"?"":e.page}}function M2({data:e,state:t}){const{action:n="openNotification",status:a="success",autoHide:i=!0,closeable:o=!0,duration:r=2600,message:s=""}=e||{},c=vb({type:n,status:a,autoHide:i,closeable:o,duration:r,state:t,message:s});return{notification:c,notificationSequence:c.count}}function D2(){return{notification:null}}async function F2({api:e,state:t}){try{return await e.member.signout(),{action:"signout:success"}}catch{return{action:"signout:failed",popupNotification:re({type:"signout:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:h("Failed to log out, please try again")})}}}async function O2({data:e,api:t,state:n}){try{const a=await t.member.getIntegrityToken(),i={...e,emailType:"signin",integrityToken:a,includeOTC:!0},{otc_ref:o,inboxLinks:r}=await t.member.sendMagicLink(i);return{page:"magiclink",lastPage:"signin",...o?{otcRef:o}:{},inboxLinks:r,pageData:{...n.pageData||{},email:((e==null?void 0:e.email)||"").trim()}}}catch(a){return{action:"signin:failed",popupNotification:re({type:"signin:failed",autoHide:!1,closeable:!0,state:n,status:"error",message:Zt(a,h("Failed to log in, please try again"))})}}}function _2({data:e,state:t}){const n=((e==null?void 0:e.email)||"").trim(),a=e==null?void 0:e.otcRef,i=e==null?void 0:e.inboxLinks;return a?{showPopup:!0,page:"magiclink",lastPage:"signin",otcRef:a,inboxLinks:i,pageData:{...t.pageData||{},email:n},popupNotification:null}:{}}async function R2({data:e,api:t}){var a;const n=h("Failed to verify code, please try again");try{const i=await t.member.getIntegrityToken(),o=await t.member.verifyOTC({...e,integrityToken:i});return o.redirectUrl?window.location.assign(o.redirectUrl):{action:"verifyOTC:failed",actionErrorMessage:Zt((a=o.errors)==null?void 0:a[0],n)}}catch(i){return{action:"verifyOTC:failed",actionErrorMessage:Zt(i,n)}}}async function Y2({data:e,state:t,api:n}){try{let{plan:a,tierId:i,cadence:o,email:r,name:s,newsletters:c,offerId:u}=e;s=s==null?void 0:s.trim();let d;if(a.toLowerCase()==="free"){const p=await n.member.getIntegrityToken();({inboxLinks:d}=await n.member.sendMagicLink({emailType:"signup",integrityToken:p,...e,name:s}))}else return i&&o?await n.member.checkoutPlan({plan:a,tierId:i,cadence:o,email:r,name:s,newsletters:c,offerId:u}):({tierId:i,cadence:o}=na({site:t==null?void 0:t.site,priceId:a}),await n.member.checkoutPlan({plan:a,tierId:i,cadence:o,email:r,name:s,newsletters:c,offerId:u})),{page:"loading"};return{page:"magiclink",lastPage:"signup",inboxLinks:d,pageData:{...t.pageData||{},email:(r||"").trim()}}}catch(a){const i=Zt(a,h("Failed to sign up, please try again"));return{action:"signup:failed",popupNotification:re({type:"signup:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:i})}}}async function L2({data:e,state:t,api:n}){try{let{plan:a,offerId:i,tierId:o,cadence:r}=e;(!o||!r)&&({tierId:o,cadence:r}=na({site:t==null?void 0:t.site,priceId:a})),await n.member.checkoutPlan({plan:a,tierId:o,cadence:r,offerId:i,metadata:{checkoutType:"upgrade"}})}catch{return{action:"checkoutPlan:failed",popupNotification:re({type:"checkoutPlan:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:h("Failed to process checkout, please try again")})}}}async function B2({data:e,state:t,api:n}){try{const{tierId:a,cadence:i,email:o}=e;return await n.member.checkoutGift({tierId:a,cadence:i,email:o}),{action:"checkoutGift:success"}}catch{return{action:"checkoutGift:failed",popupNotification:re({type:"checkoutGift:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:h("Failed to process checkout, please try again")})}}}async function U2({data:e,state:t,api:n}){try{const{plan:a,planId:i,subscriptionId:o,cancelAtPeriodEnd:r}=e,{tierId:s,cadence:c}=na({site:t==null?void 0:t.site,priceId:i});await n.member.updateSubscription({planName:a,tierId:s,cadence:c,subscriptionId:o,cancelAtPeriodEnd:r,planId:i});const u=await n.member.sessionData(),d="updateSubscription:success";return{action:d,popupNotification:re({type:d,autoHide:!0,closeable:!0,state:t,status:"success",message:h("Subscription plan updated successfully")}),page:"accountHome",member:u}}catch{return{action:"updateSubscription:failed",popupNotification:re({type:"updateSubscription:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:h("Failed to update subscription, please try again")})}}}async function H2({data:e,state:t,api:n}){try{const{subscriptionId:a,cancellationReason:i}=e;return await n.member.updateSubscription({subscriptionId:a,smartCancel:!0,cancellationReason:i}),{action:"cancelSubscription:success",page:"accountHome",member:await n.member.sessionData(),reloadOnPopupClose:!0}}catch{return{action:"cancelSubscription:failed",popupNotification:re({type:"cancelSubscription:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:h("Failed to cancel subscription, please try again")})}}}async function V2({data:e,state:t,api:n}){try{const{subscriptionId:a}=e;return await n.member.updateSubscription({subscriptionId:a,cancelAtPeriodEnd:!1}),{action:"continueSubscription:success",page:"accountHome",member:await n.member.sessionData(),reloadOnPopupClose:!0}}catch{return{action:"continueSubscription:failed",popupNotification:re({type:"continueSubscription:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:h("Failed to cancel subscription, please try again")})}}}async function W2({data:e,state:t,api:n}){try{const{offerId:a,subscriptionId:i}=e;return await n.member.applyOffer({offerId:a,subscriptionId:i}),{action:"applyOffer:success",page:"accountHome",member:await n.member.sessionData(),offers:[],reloadOnPopupClose:!0,popupNotification:re({type:"applyOffer:success",autoHide:!0,closeable:!0,state:t,status:"success",message:"Offer applied successfully!"})}}catch{return{action:"applyOffer:failed",popupNotification:re({type:"applyOffer:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:"Failed to apply offer, please try again"})}}}async function G2({data:e,state:t,api:n}){try{await n.member.editBilling(e)}catch{return{action:"editBilling:failed",popupNotification:re({type:"editBilling:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:h("Failed to update billing information, please try again")})}}}async function K2({data:e,state:t,api:n}){try{await n.member.manageBilling(e)}catch{return{action:"manageBilling:failed",popupNotification:re({type:"manageBilling:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:h("Failed to open billing portal, please try again")})}}}async function q2(){return{popupNotification:null}}async function J2({data:e,state:t}){let{action:n,message:a=""}=e;return n=n||"showPopupNotification:success",{popupNotification:re({type:n,autoHide:!0,closeable:!0,state:t,status:"success",message:a})}}async function Z2({data:e,state:t,api:n}){try{const{newsletters:a,enableCommentNotifications:i}=e;if(!a&&i===void 0)return{};const o={};return a&&(o.newsletters=a),i!==void 0&&(o.enableCommentNotifications=i),{action:"updateNewsletterPref:success",member:await n.member.update(o)}}catch{return{action:"updateNewsletterPref:failed",popupNotification:re({type:"updateNewsletter:failed",autoHide:!0,closeable:!0,state:t,status:"error",message:h("Failed to update newsletter settings")})}}}async function X2({state:e,api:t}){try{return await t.member.deleteSuppression(),{action:"removeEmailFromSuppressionList:success",popupNotification:re({type:"removeEmailFromSuppressionList:success",autoHide:!0,closeable:!0,state:e,status:"success",message:h("You have been successfully resubscribed")})}}catch{return{action:"removeEmailFromSuppressionList:failed",popupNotification:re({type:"removeEmailFromSuppressionList:failed",autoHide:!0,closeable:!0,state:e,status:"error",message:h("Your email has failed to resubscribe, please try again")})}}}async function Q2({data:e,state:t,api:n}){try{const{subscribed:a}=e,i=await n.member.update({subscribed:a});if(!i)throw new Error("Failed to update newsletter");const o="updateNewsletter:success";return{action:o,member:i,popupNotification:re({type:o,autoHide:!0,closeable:!0,state:t,status:"success",message:h("Email newsletter settings updated")})}}catch{return{action:"updateNewsletter:failed",popupNotification:re({type:"updateNewsletter:failed",autoHide:!0,closeable:!0,state:t,status:"error",message:h("Failed to update newsletter settings")})}}}async function ez({data:e,state:t,api:n}){const{email:a}=e,i=D1({member:t.member});if(a!==i)try{return await n.member.updateEmailAddress({email:a}),{success:!0}}catch(o){return{success:!1,error:o}}return null}async function tz({data:e,state:t,api:n}){var o;const a=(o=e==null?void 0:e.name)==null?void 0:o.trim();if(O1({member:t.member})!==a)try{const r=await n.member.update({name:a});if(!r)throw new Error("Failed to update member");return{member:r,success:!0}}catch(r){return{success:!1,error:r}}return null}async function nz({state:e,api:t}){if(e.member)try{const n=await t.member.sessionData();return n?{member:n,success:!0,action:"refreshMemberData:success"}:null}catch(n){return{success:!1,error:n,action:"refreshMemberData:failed"}}return null}async function az({data:e,state:t,api:n}){const[a,i]=await Promise.all([tz({data:e,state:t,api:n}),ez({data:e,state:t,api:n})]);if(a&&i){if(i.success)return{action:"updateProfile:success",...a.success?{member:a.member}:{},page:"accountHome",popupNotification:re({type:"updateProfile:success",autoHide:!0,closeable:!0,status:"success",state:t,message:h("Check your inbox to verify email update")})};const o=a.success?h("Failed to send verification email"):h("Failed to update account data");return{action:"updateProfile:failed",...a.success?{member:a.member}:{},popupNotification:re({type:"updateProfile:failed",autoHide:!0,closeable:!0,status:"error",message:o,state:t})}}else if(a){const o=a.success?"updateProfile:success":"updateProfile:failed",r=a.success?"success":"error",s=a.success?h("Account details updated successfully"):h("Failed to update account details");return{action:o,...a.success?{member:a.member}:{},...a.success?{page:"accountHome"}:{},popupNotification:re({type:o,autoHide:a.success,closeable:!0,status:r,state:t,message:s})}}else if(i){const o=i.success?"updateProfile:success":"updateProfile:failed",r=i.success?"success":"error";let s="";return i.error?s=Zt(i.error,h("Failed to send verification email")):s=h("Check your inbox to verify email update"),{action:o,...i.success?{page:"accountHome"}:{},popupNotification:re({type:o,autoHide:i.success,closeable:!0,status:r,state:t,message:s})}}return{action:"updateProfile:success",page:"accountHome",popupNotification:re({type:"updateProfile:success",autoHide:!0,closeable:!0,status:"success",state:t,message:h("Account details updated successfully")})}}async function iz({data:{siteUrl:e},state:t}){const n=rl({siteUrl:e,apiUrl:"not-defined"}),{member:a}=t,i=window.location.href,o=fb(),r=await n.member.getIntegrityToken();return await n.member.sendMagicLink({emailType:"signup",name:a.name,email:a.email,autoRedirect:!1,integrityToken:r,customUrlHistory:t.site.outbound_link_tagging?[{time:Date.now(),referrerSource:o,referrerMedium:"Ghost Recommendations",referrerUrl:i}]:[]}),{}}function oz({data:{recommendationId:e},api:t}){try{const n=localStorage.getItem("ghost-recommendations-clicked"),a=n?JSON.parse(n):[];if(a.includes(e))return;a.push(e),localStorage.setItem("ghost-recommendations-clicked",JSON.stringify(a))}catch{}return t.recommendations.trackClicked({recommendationId:e}),{}}async function rz({data:{recommendationId:e},api:t}){return t.recommendations.trackSubscribed({recommendationId:e}),{}}const sz={togglePopup:I2,openPopup:N2,closePopup:Tk,switchPage:z2,openNotification:M2,closeNotification:D2,back:A2,signout:F2,signin:O2,startSigninOTCFromCustomForm:_2,verifyOTC:R2,signup:Y2,updateSubscription:U2,cancelSubscription:H2,continueSubscription:V2,applyOffer:W2,updateNewsletter:Q2,updateProfile:az,refreshMemberData:nz,clearPopupNotification:q2,editBilling:G2,manageBilling:K2,checkoutPlan:L2,checkoutGift:B2,updateNewsletterPreference:Z2,showPopupNotification:J2,removeEmailFromSuppressionList:X2,oneClickSubscribe:iz,trackRecommendationClicked:oz,trackRecommendationSubscribed:rz};async function lz({action:e,data:t,state:n,api:a}){const i=sz[e];return i?await i({data:t,state:n,api:a})||{}:{}}function Pk(e,t){e&&(e.innerText=t)}function cz(e,t,n){t.classList.add("error");const a=h("There was an error sending the email, please try again");Pk(n,Zt(e,a))}async function uz({event:e,form:t,errorEl:n,siteUrl:a,submitHandler:i,doAction:o,captureException:r}){var x,T;t.removeEventListener("submit",i),e.preventDefault(),n&&(n.innerText=""),t.classList.remove("success","invalid","error");let s=e.target.querySelector("input[data-members-email]"),c=e.target.querySelector("input[data-members-name]"),u=((x=t==null?void 0:t.dataset)==null?void 0:x.membersAutoredirect)||"true",d=s==null?void 0:s.value,p=((c==null?void 0:c.value)||"").trim()||void 0,m,f=[],b=[],w=e.target.querySelectorAll("input[data-members-label]")||[];for(let E=0;E<w.length;++E)f.push(w[E].value);let g=e.target.querySelectorAll("input[type=hidden][data-members-newsletter], input[type=checkbox][data-members-newsletter]:checked, input[type=radio][data-members-newsletter]:checked")||[];for(let E=0;E<g.length;++E)b.push({name:g[E].value});t.dataset.membersForm&&(m=t.dataset.membersForm);const y=m==="signin"&&((T=t==null?void 0:t.dataset)==null?void 0:T.membersOtc)==="true";t.classList.add("loading");const k=No(),C={email:d,emailType:m,labels:f,name:p,autoRedirect:u==="true"};y&&(C.includeOTC=!0),k&&(C.urlHistory=k),g.length>0?C.newsletters=b:(e.target.querySelectorAll("input[type=checkbox][data-members-newsletter]")||[]).length>0&&(C.newsletters=[]);try{const N=await(await fetch(`${a}/members/api/integrity-token/`,{method:"GET"})).text(),z=await fetch(`${a}/members/api/send-magic-link/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...C,integrityToken:N})});if(t.addEventListener("submit",i),t.classList.remove("loading"),z.ok){t.classList.add("success");let j;if(y)try{j=await z.clone().json()}catch{j=void 0}const V=j==null?void 0:j.otc_ref;if(V&&typeof o=="function")try{o("startSigninOTCFromCustomForm",{email:(d||"").trim(),otcRef:V,inboxLinks:j==null?void 0:j.inboxLinks})}catch(q){console.error(q),r==null||r(q)}}else{const j=await xt.fromApiResponse(z),V=Zt(j,h("Failed to send magic link email"));Pk(n,V),t.classList.add("error")}}catch(E){cz(E,t,n)}}function dz({event:e,el:t,errorEl:n,siteUrl:a,site:i,member:o,clickHandler:r}){t.removeEventListener("click",r),e.preventDefault();let s=t.dataset.membersPlan,c=C1(i,s.toLowerCase()),u=t.dataset.membersSuccess,d=t.dataset.membersCancel,p,m;u&&(p=new URL(u,window.location.href).href),d&&(m=new URL(d,window.location.href).href),n&&(n.innerText=""),t.classList.add("loading");const f=o?{checkoutType:"upgrade"}:{},b=No();return b&&(f.urlHistory=b),fetch(`${a}/members/api/session`,{credentials:"same-origin"}).then(function(w){return w.ok?w.text():null}).then(function(w){return fetch(`${a}/members/api/create-stripe-checkout-session/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...c,identity:w,successUrl:p,cancelUrl:m,metadata:f})}).then(function(g){if(!g.ok)throw new Error(h("Could not create Stripe checkout session"));return g.json()})}).then(function(w){return w.url?window.location.assign(w.url):window.Stripe(w.publicKey).redirectToCheckout({sessionId:w.sessionId}).then(function(y){if(y.error)throw new Error(y.error.message)})}).catch(function(w){console.error(w),t.addEventListener("click",r),t.classList.remove("loading"),n&&(n.innerText=w.message),t.classList.add("error")})}function mz({siteUrl:e,site:t={},member:n,offers:a=[],doAction:i,captureException:o}={}){if(!e)return;e=e.replace(/\/$/,""),Array.prototype.forEach.call(document.querySelectorAll("form[data-members-form]"),function(s){let c=s.querySelector("[data-members-error]");function u(d){uz({event:d,errorEl:c,form:s,siteUrl:e,submitHandler:u,doAction:i,captureException:o})}s.addEventListener("submit",u)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-plan]"),function(s){let c=s.querySelector("[data-members-error]");function u(d){dz({el:s,event:d,errorEl:c,member:n,site:t,siteUrl:e,clickHandler:u})}s.addEventListener("click",u)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-edit-billing]"),function(s){let c=s.querySelector("[data-members-error]"),u=s.dataset.membersSuccess,d=s.dataset.membersCancel,p,m;u&&(p=new URL(u,window.location.href).href),d&&(m=new URL(d,window.location.href).href);function f(b){s.removeEventListener("click",f),b.preventDefault(),c&&(c.innerText=""),s.classList.add("loading"),fetch(`${e}/members/api/session`,{credentials:"same-origin"}).then(function(w){return w.ok?w.text():null}).then(function(w){return fetch(`${e}/members/api/create-stripe-update-session/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:w,successUrl:p,cancelUrl:m})}).then(function(g){if(!g.ok)throw new Error(h("Could not create Stripe checkout session"));return g.json()})}).then(function(w){return window.Stripe(w.publicKey).redirectToCheckout({sessionId:w.sessionId})}).then(function(w){if(w.error)throw new Error(h(w.error.message))}).catch(function(w){console.error(w),s.addEventListener("click",f),s.classList.remove("loading"),c&&(c.innerText=w.message),s.classList.add("error")})}s.addEventListener("click",f)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-manage-billing]"),function(s){let c=s.querySelector("[data-members-error]"),u=s.dataset.membersReturn,d;u&&(d=new URL(u,window.location.href).href);function p(m){s.removeEventListener("click",p),m.preventDefault(),c&&(c.innerText=""),s.classList.add("loading"),fetch(`${e}/members/api/session`,{credentials:"same-origin"}).then(function(f){return f.ok?f.text():null}).then(function(f){return fetch(`${e}/members/api/create-stripe-billing-portal-session/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:f,returnUrl:d})}).then(function(b){if(!b.ok)throw new Error(h("Could not create Stripe billing portal session"));return b.json()})}).then(function(f){return window.location.assign(f.url)}).catch(function(f){console.error(f),s.addEventListener("click",p),s.classList.remove("loading"),c&&(c.innerText=f.message),s.classList.add("error")})}s.addEventListener("click",p)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-signout]"),function(s){function c(u){s.removeEventListener("click",c),u.preventDefault(),s.classList.remove("error"),s.classList.add("loading"),fetch(`${e}/members/api/session`,{method:"DELETE"}).then(function(d){d.ok?window.location.replace(e):(s.addEventListener("click",c),s.classList.remove("loading"),s.classList.add("error"))})}s.addEventListener("click",c)});const r=(a||[]).some(s=>s.redemption_type==="retention");Array.prototype.forEach.call(document.querySelectorAll("[data-members-cancel-subscription]"),function(s){let c=s.parentElement.querySelector("[data-members-error]");function u(d){d.preventDefault();let p=s.dataset.membersCancelSubscription;if(r){i("openPopup",{page:"accountPlan",pageData:{subscriptionId:p,action:"cancel"}});return}return s.removeEventListener("click",u),s.classList.remove("error"),s.classList.add("loading"),c&&(c.innerText=""),fetch(`${e}/members/api/session`,{credentials:"same-origin"}).then(function(m){return m.ok?m.text():null}).then(function(m){return fetch(`${e}/members/api/subscriptions/${p}/`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:m,smart_cancel:!0})})}).then(function(m){m.ok?window.location.reload():(s.addEventListener("click",u),s.classList.remove("loading"),s.classList.add("error"),c&&(c.innerText=h("There was an error cancelling your subscription, please try again.")))})}s.addEventListener("click",u)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-continue-subscription]"),function(s){let c=s.parentElement.querySelector("[data-members-error]");function u(d){s.removeEventListener("click",u),d.preventDefault(),s.classList.remove("error"),s.classList.add("loading");let p=s.dataset.membersContinueSubscription;return c&&(c.innerText=""),fetch(`${e}/members/api/session`,{credentials:"same-origin"}).then(function(m){return m.ok?m.text():null}).then(function(m){return fetch(`${e}/members/api/subscriptions/${p}/`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:m,cancel_at_period_end:!1})})}).then(function(m){m.ok?window.location.reload():(s.addEventListener("click",u),s.classList.remove("loading"),s.classList.add("error"),c&&(c.innerText=h("There was an error continuing your subscription, please try again.")))})}s.addEventListener("click",u)})}const zk=e=>{try{return decodeURIComponent(e)}catch{return null}},pz={staleGiftRedemptionRequest:!0},hz={showPopup:!0,site:oi,member:ri.free,page:"accountEmail",...T2(),pageData:jk};function fz({site:e,children:t}){const{portal_sentry:n}=e||{};return n&&n.dsn?l.jsx(rd,{children:t}):l.jsx(l.Fragment,{children:t})}class gz extends Z.Component{constructor(t){super(t),this.setupCustomTriggerButton(),this.state={site:null,member:null,offers:[],page:"loading",showPopup:!1,action:"init:running",actionErrorMessage:null,initStatus:"running",lastPage:null,notification:null,notificationSequence:-1,customSiteUrl:t.customSiteUrl,locale:t.locale,scrollbarWidth:0},this._redemptionRequestId=0,this.currentRedemptionToken=null}componentDidMount(){const t=this.getScrollbarWidth();this.setState({scrollbarWidth:t}),this.initSetup()}componentDidUpdate(t,n){var a,i,o;if(n.showPopup!==this.state.showPopup){this.handleCustomTriggerClassUpdate();try{this.state.showPopup?(this.bodyScroll=(o=(i=(a=window.document)==null?void 0:a.body)==null?void 0:i.style)==null?void 0:o.overflow,this.bodyMargin=window.getComputedStyle(document.body).getPropertyValue("margin-right"),window.document.body.style.overflow="hidden",this.state.scrollbarWidth&&(window.document.body.style.marginRight=`calc(${this.bodyMargin} + ${this.state.scrollbarWidth}px)`)):(window.document.body.style.overflow=this.bodyScroll||"",!this.bodyMargin||this.bodyMargin==="0px"?window.document.body.style.marginRight="":window.document.body.style.marginRight=this.bodyMargin,this.state.reloadOnPopupClose&&window.location.reload())}catch{}}if(this.state.initStatus==="success"&&n.initStatus!==this.state.initStatus){const{siteUrl:r}=this.props,s=this.getContextFromState();this.sendPortalReadyEvent(),mz({siteUrl:r,site:s.site,member:s.member,offers:s.offers,doAction:s.doAction,captureException:hs})}}componentWillUnmount(){clearTimeout(this.timeoutId),this.customTriggerButtons&&this.customTriggerButtons.forEach(t=>{t.removeEventListener("click",this.clickHandler)}),window.removeEventListener("hashchange",this.hashHandler,!1)}sendPortalReadyEvent(){window.self!==window.parent&&window.parent.postMessage({type:"portal-ready",payload:{}},"*")}getScrollbarWidth(){const t=document.createElement("div");t.style.visibility="hidden",t.style.overflow="scroll",document.body.appendChild(t),document.body.appendChild(t);const n=t.offsetWidth-t.clientWidth;return document.body.removeChild(t),n}setupCustomTriggerButton(){this.clickHandler=async a=>{a.preventDefault();const i=a.currentTarget,o=i&&i.dataset.portal,r=this.getPageFromLinkPath(o);if(!r)return;const{page:s,pageQuery:c,pageData:u}=r;if(this.state.initStatus==="success"){if(s==="gift"&&!Ys({site:this.state.site})){this.invalidateGiftRedemptionRequest(),Tn();return}if(s==="giftRedemption"&&(u!=null&&u.token)){const d=this.startGiftRedemptionRequest(u.token),p=await this.fetchGiftRedemptionData({site:this.state.site,token:u.token});if(!this.isCurrentGiftRedemptionRequest(d))return;this.setState(p);return}this.invalidateGiftRedemptionRequest(),c&&c!=="free"?this.handleSignupQuery({site:this.state.site,pageQuery:c}):this.dispatchAction("openPopup",{page:s,pageQuery:c,pageData:u})}};const t="[data-portal]",n="gh-portal-close";this.customTriggerButtons=document.querySelectorAll(t)||[],this.customTriggerButtons.forEach(a=>{a.classList.add(n),a.removeEventListener("click",this.clickHandler),a.addEventListener("click",this.clickHandler)})}handleCustomTriggerClassUpdate(){var a;const t="gh-portal-open",n="gh-portal-close";(a=this.customTriggerButtons)==null||a.forEach(i=>{const o=this.state.showPopup?t:n,r=this.state.showPopup?n:t;i.classList.add(o),i.classList.remove(r)})}startGiftRedemptionRequest(t){return this._redemptionRequestId+=1,this.currentRedemptionToken=t,{requestId:this._redemptionRequestId,token:t}}invalidateGiftRedemptionRequest(){this._redemptionRequestId+=1,this.currentRedemptionToken=null}isCurrentGiftRedemptionRequest({requestId:t,token:n}){return this._redemptionRequestId===t&&this.currentRedemptionToken===n}async initSetup(){try{const{site:t,member:n,offers:a,page:i,showPopup:o,popupNotification:r,notification:s,notificationSequence:c,lastPage:u,pageQuery:d,pageData:p}=await this.fetchData(),m=this.props.siteI18nEnabled&&(this.props.locale||t.locale)||"en";Os.changeLanguage(m);const f={site:t,member:n,offers:a,page:i,lastPage:u,pageQuery:d,showPopup:o,pageData:p,popupNotification:r,notification:s,notificationSequence:c,dir:Os.dir()||"ltr",action:"init:success",initStatus:"success",locale:m};if(this.handleSignupQuery({site:t,pageQuery:d,member:n}),this.setState(f),this.hashHandler=()=>{this.updateStateForPreviewLinks()},window.addEventListener("hashchange",this.hashHandler,!1),!n){const b=document.querySelectorAll("[data-lexical-signup-form]");b.length>0&&b.forEach(w=>{w.style.display=""})}this.setupRecommendationButtons(),this.transformPortalLinksToRelative()}catch(t){console.error("[Portal] Failed to initialize:",t),this.setState({action:"init:failed",initStatus:"failed"})}}async fetchData(){const{site:t,member:n,offers:a}=await this.fetchApiData(),{site:i,...o}=this.fetchDevData(),r=await this.fetchLinkData(t,n),{site:s,...c}=r!=null&&r.staleGiftRedemptionRequest?{}:r,{site:u,...d}=this.fetchPreviewData(),{site:p,...m}=this.fetchNotificationData();return{member:n,offers:a,page:"",site:{...t,...s,...u,...p,...i,plans:{...(i||{}).plans,...(t||{}).plans,...(u||{}).plans}},...o,...c,...m,...d}}fetchDevData(){return de(["dev"])&&!this.state.customSiteUrl?hz:de(["test"])?{showPopup:this.props.showPopup!==void 0?this.props.showPopup:!0}:{}}fetchOfferQueryStrData(t=""){var i,o,r;const n=new URLSearchParams(t),a={};for(let s of n.entries()){const c=s[0],u=decodeURIComponent(s[1]);c==="name"?a.name=u||"":c==="code"?a.code=u||"":c==="display_title"?a.display_title=u||"":c==="display_description"?a.display_description=u||"":c==="type"?a.type=u||"":c==="cadence"?a.cadence=u||"":c==="duration"?a.duration=u||"":c==="duration_in_months"&&!isNaN(Number(u))?a.duration_in_months=Number(u):c==="amount"&&!isNaN(Number(u))?a.amount=Number(u):c==="currency"?a.currency=u||"":c==="status"?a.status=u||"":c==="tier_id"?a.tier={id:u||jk.tier.id}:c==="redemption_type"&&(a.redemption_type=u||"signup")}if(a.redemption_type==="retention"){const s=(r=(o=(i=ri.preview)==null?void 0:i.subscriptions)==null?void 0:o[0])==null?void 0:r.id;return{page:"accountPlan",offers:[a],pageData:{action:"cancel",subscriptionId:s}}}return{page:"offer",pageData:a}}fetchQueryStrData(t=""){const n=new URLSearchParams(t),a={site:{plans:{}}},i=[];let o,r=null,s,c,u;for(let d of n.entries()){const p=d[0],m=decodeURIComponent(d[1]);if(p==="button")a.site.portal_button=JSON.parse(m);else if(p==="name")a.site.portal_name=JSON.parse(m);else if(p==="isFree"&&JSON.parse(m))i.push("free");else if(p==="isMonthly"&&JSON.parse(m))i.push("monthly");else if(p==="isYearly"&&JSON.parse(m))i.push("yearly");else if(p==="portalPrices")o=m?m.split(","):[];else if(p==="portalProducts")r=m?m.split(","):[];else if(p==="page"&&m)a.page=m;else if(p==="accentColor"&&(m===""||m))a.site.accent_color=m;else if(p==="buttonIcon"&&m)a.site.portal_button_icon=m;else if(p==="signupButtonText")a.site.portal_button_signup_text=m||"";else if(p==="signupTermsHtml")a.site.portal_signup_terms_html=m||"";else if(p==="signupCheckboxRequired")a.site.portal_signup_checkbox_required=JSON.parse(m);else if(p==="buttonStyle"&&m)a.site.portal_button_style=m;else if(p==="monthlyPrice"&&!isNaN(Number(m)))a.site.plans.monthly=Number(m),s=Number(m);else if(p==="yearlyPrice"&&!isNaN(Number(m)))a.site.plans.yearly=Number(m),c=Number(m);else if(p==="currency"&&m){const f=m.toUpperCase();a.site.plans.currency=f,a.site.plans.currency_symbol=ke(f),u=f}else p==="disableBackground"?a.site.disableBackground=JSON.parse(m):p==="membersSignupAccess"&&m?a.site.members_signup_access=m:p==="portalDefaultPlan"&&m?a.site.portal_default_plan=m:p==="transistorPortalSettings"&&m&&(a.site.transistor_portal_settings=JSON.parse(m))}return a.site.portal_plans=i,a.site.portal_products=r,o?a.site.portal_plans=o:s&&c&&u&&(a.site.prices=[{id:"monthly",stripe_price_id:"dummy_stripe_monthly",stripe_product_id:"dummy_stripe_product",active:1,nickname:"Monthly",currency:u,amount:s,type:"recurring",interval:"month"},{id:"yearly",stripe_price_id:"dummy_stripe_yearly",stripe_product_id:"dummy_stripe_product",active:1,nickname:"Yearly",currency:u,amount:c,type:"recurring",interval:"year"}]),a}fetchNotificationData(){const{type:t,status:n,duration:a,autoHide:i,closeable:o}=Yb({billingOnly:!0})||{};return["stripe:billing-update"].includes(t)?n==="success"?{showPopup:!0,popupNotification:re({type:t,status:n,duration:a,closeable:o,autoHide:i,state:this.state,message:n==="success"?"Billing info updated successfully":""})}:{showPopup:!0}:{}}async fetchGiftRedemptionData({site:t,token:n}){var a;if(!Ys({site:t}))return Tn(),{};try{const i=await this.GhostApi.gift.fetchRedemptionData({token:n});return{showPopup:!0,notification:null,page:"giftRedemption",pageData:{token:n,gift:((a=i==null?void 0:i.gifts)==null?void 0:a[0])||null}}}catch(i){Tn();const o=vb({type:"giftRedemption:failed",status:"error",autoHide:!1,closeable:!0,state:this.state,message:pk(i)});return{showPopup:!1,pageData:null,notification:o,notificationSequence:o.count}}}async fetchLinkData(t,n){this.invalidateGiftRedemptionRequest();const a=new URLSearchParams(window.location.search);if(a.get("stripe")==="gift-purchase-success"){const b=a.get("gift_token");if(el(["stripe","gift_token"]),b)return{showPopup:!0,page:"giftSuccess",pageData:{token:b}}}if(a.get("action")==="unsubscribe")return a.get("key")&&a.get("uuid")?{showPopup:!0,page:"unsubscribe",pageData:{uuid:a.get("uuid"),key:a.get("key"),newsletterUuid:a.get("newsletter"),comments:a.get("comments")}}:{showPopup:!0,page:"accountEmail",pageData:{newsletterUuid:a.get("newsletter"),action:"unsubscribe",redirect:t.url+"#/portal/account/newsletters"}};if(j1({site:t})&&a.get("action")==="signup"&&a.get("success")==="true")return{showPopup:!0,page:"recommendations",pageData:{signup:!0}};const[i,o]=window.location.hash.substr(1).split("?"),r=new URLSearchParams(o??""),s=/^(?:(\w+?))?\/monthly$/,c=/^(?:(\w+?))?\/yearly$/,u=/^offers\/(\w+?)\/?$/,d=/^\/portal\/gift\/redeem\/([^/?#]+)\/?$/,p=/^\/portal\/?(?:\/(\w+(?:\/\w+)*))?\/?$/,m=/^\/share\/?$/,f=/^\/feedback\/(\w+?)\/(\w+?)\/?$/;if(i&&f.test(i)){const[,b,w]=i.match(f),g=parseInt(w);if(g===1||g===0)return n||r.get("uuid")&&r.get("key")?{showPopup:!0,page:"feedback",pageData:{uuid:n?null:r.get("uuid"),key:n?null:r.get("key"),postId:b,score:g}}:{showPopup:!0,page:"signin",pageData:{redirect:t.url+`#/feedback/${b}/${g}/`}}}if(i&&d.test(i)){const[,b]=i.match(d),w=zk(b);if(!w)return{};const g=this.startGiftRedemptionRequest(w),y=await this.fetchGiftRedemptionData({site:t,token:w});return this.isCurrentGiftRedemptionRequest(g)?y:pz}if(i&&m.test(i))return{showPopup:!0,page:"share"};if(i&&p.test(i)){const[,b]=i.match(p),{page:w,pageQuery:g,pageData:y}=this.getPageFromLinkPath(b,t)||{};if(!n&&w&&wk({page:w}))return{showPopup:!0,page:"signin",pageData:{redirect:t.url+`#/portal/${b}/`}};if(w==="gift"&&!Ys({site:t}))return Tn(),{};const k=["accountPlan","accountProfile"].includes(w)?"accountHome":null;return{showPopup:!(["monthly","yearly"].includes(g)||s.test(g)||c.test(g)||u.test(g)),...w?{page:w}:{},...g?{pageQuery:g}:{},...y?{pageData:y}:{},...k?{lastPage:k}:{}}}return{}}fetchPreviewData(){const[,t]=window.location.hash.substr(1).split("?");if(de(["preview"])){let n={};return de(["offerPreview"])?n=this.fetchOfferQueryStrData(t):n=this.fetchQueryStrData(t),{...n,showPopup:!0}}return{}}getColorOverride(){const t=document.querySelector("script[data-ghost]");return t&&t.dataset.accentColor?t.dataset.accentColor:!1}async fetchApiData(){const{siteUrl:t,customSiteUrl:n,apiUrl:a,apiKey:i}=this.props;try{this.GhostApi=this.props.api||rl({siteUrl:t,apiUrl:a,apiKey:i});const{site:o,member:r,offers:s}=await this.GhostApi.init(),c=this.getColorOverride();return c&&(o.accent_color=c),this.setupFirstPromoter({site:o,member:r}),this.setupSentry({site:o}),{site:o,member:r,offers:s}}catch(o){if(de(["dev","test"],{customSiteUrl:n}))return{};throw o}}setupSentry({site:t}){if(de(["test"]))return null;const{portal_sentry:n,portal_version:a,version:i}=t,r=`portal@2.68.2|ghost@${i}`;n&&n.dsn&&ej({dsn:n.dsn,environment:n.env||"development",release:r,beforeSend:s=>y1({event:s})?s:null,allowUrls:[/https?:\/\/((www)\.)?unpkg\.com\/@tryghost\/portal/]})}setupFirstPromoter({site:t,member:n}){if(de(["test"]))return null;const a=F1({site:t});let i=Ed({site:t});if(i=i==null?void 0:i.replace(/^(\S*\.)?(\S*\.\S*)$/i,".$2"),a&&i){const o=document.createElement("script");o.type="text/javascript",o.async=!0,o.src="https://cdn.firstpromoter.com/fprom.js",o.onload=o.onreadystatechange=function(){let s=this.readyState;if(!s||s==="complete"||s==="loaded")try{if(window.$FPROM.init(a,i),G1({member:n})){const c=n.email,u=n.uuid;if(window.$FPROM)window.$FPROM.trackSignup({email:c,uid:u});else{const d=window._fprom||[];window._fprom=d,d.push(["event","signup"]),d.push(["email",c]),d.push(["uid",u])}}}catch{}};const r=document.getElementsByTagName("script")[0];r.parentNode.insertBefore(o,r)}}async dispatchAction(t,n){clearTimeout(this.timeoutId),this.setState({action:`${t}:running`,actionErrorMessage:null});try{const a=await lz({action:t,data:n,state:this.state,api:this.GhostApi});this.setState(a),a&&a.action&&!a.action.includes(":failed")&&(this.timeoutId=setTimeout(()=>{this.setState({action:""})},2e3))}catch(a){if(console.error(`[Portal] Failed to dispatch action: ${t}`,a),n&&n.throwErrors)throw a;const i=re({type:`${t}:failed`,autoHide:!0,closeable:!0,status:"error",state:this.state,meta:{error:a}});this.setState({action:`${t}:failed`,actionErrorMessage:Zt(a,h("An unexpected error occured. Please try again or <a>contact support</a> if the error persists.")),popupNotification:i})}}async updateStateForPreviewLinks(){const{site:t,...n}=this.fetchPreviewData(),a=await this.fetchLinkData(this.state.site,this.state.member);if(a!=null&&a.staleGiftRedemptionRequest)return;const{site:i,...o}=a,r={site:{...this.state.site,...i||{},...t||{},plans:{...this.state.site&&this.state.site.plans,...(i||{}).plans,...(t||{}).plans}},...o,...n};this.handleSignupQuery({site:r.site,pageQuery:r.pageQuery}),this.setState(r)}async handleOfferQuery({site:t,offerId:n,member:a=this.state.member}){const{portal_button:i}=t;if(Tn(),!Dt({member:a})||Pn({member:a}))try{const o=await this.GhostApi.site.offer({offerId:n}),r=o==null?void 0:o.offers[0];if(!r||!r.tier||Td({offer:r})||!L1({site:t,offer:r}))return;if(i)this.dispatchAction("openPopup",{page:"offer",pageData:o==null?void 0:o.offers[0]});else{const s=ea({site:t,productId:r.tier.id}),c=r.cadence==="month"?s.monthlyPrice:s.yearlyPrice;if(this.dispatchAction("openPopup",{page:"loading"}),a){const{tierId:u,cadence:d}=na({site:t,priceId:c.id});this.dispatchAction("checkoutPlan",{plan:c.id,offerId:n,tierId:u,cadence:d})}else{const{tierId:u,cadence:d}=na({site:t,priceId:c.id});this.dispatchAction("signup",{plan:c.id,offerId:n,tierId:u,cadence:d})}}}catch{}}handleSignupQuery({site:t,pageQuery:n,member:a}){const i=/^offers\/(\w+?)\/?$/;let o=n;if(i.test(n||"")){const[,s]=n.match(i);this.handleOfferQuery({site:t,offerId:s,member:a});return}wb({site:t,pageQuery:n})&&(o=wb({site:t,pageQuery:n}));const r=E1({site:t,priceId:o});if(n&&n!=="free"){Tn();const s=(r==null?void 0:r.id)||o;s!=="free"&&this.dispatchAction("openPopup",{page:"loading"});const{tierId:c,cadence:u}=na({site:t,priceId:s});this.dispatchAction("signup",{plan:s,tierId:c,cadence:u})}}getPageFromLinkPath(t){const n=/^signup\/?(?:\/(\w+?))?\/?$/,a=/^signup\/?(?:\/(\w+?))\/monthly\/?$/,i=/^signup\/?(?:\/(\w+?))\/yearly\/?$/,o=/^offers\/(\w+?)\/?$/,r=/^gift\/redeem\/([^/?#]+)\/?$/;if(t===void 0||t==="")return{page:"default"};if(r.test(t)){const[,s]=t.match(r),c=zk(s);return c?{page:"giftRedemption",pageData:{token:c}}:null}else{if(o.test(t))return{pageQuery:t};if(t==="signup")return{page:"signup"};if(a.test(t)){const[,s]=t.match(a);return{page:"signup",pageQuery:`${s}/monthly`}}else if(i.test(t)){const[,s]=t.match(i);return{page:"signup",pageQuery:`${s}/yearly`}}else if(n.test(t)){const[,s]=t.match(n);return{page:"signup",pageQuery:s}}else{if(t==="signup/free")return{page:"signup",pageQuery:"free"};if(t==="signup/monthly")return{page:"signup",pageQuery:"monthly"};if(t==="signup/yearly")return{page:"signup",pageQuery:"yearly"};if(t==="signin")return{page:"signin"};if(t==="account")return{page:"accountHome"};if(t==="account/plans")return{page:"accountPlan"};if(t==="account/profile")return{page:"accountProfile"};if(t==="account/newsletters")return{page:"accountEmail"};if(t==="support")return{page:"support"};if(t==="support/success")return{page:"supportSuccess"};if(t==="support/error")return{page:"supportError"};if(t==="recommendations")return{page:"recommendations",pageData:{signup:!1}};if(t==="gift")return{page:"gift"};if(t==="share")return{page:"share"};if(t==="account/newsletters/help")return{page:"emailReceivingFAQ",pageData:{direct:!0}};if(t==="account/newsletters/disabled")return{page:"emailSuppressionFAQ",pageData:{direct:!0}}}}return{page:"default"}}getAccentColor(){const{accent_color:t}=this.state.site||{};return ET(t)}getRetentionPreviewMember({site:t,offers:n}){var u,d,p;const a=(n||[]).find(m=>Td({offer:m})),i=(u=a==null?void 0:a.tier)==null?void 0:u.id,o=i?ea({site:t,productId:i}):null,r=o?a.cadence==="year"?o.yearlyPrice:o.monthlyPrice:null,s=ri.preview,c=(d=s==null?void 0:s.subscriptions)==null?void 0:d[0];return!c||!o||!r?s:{...s,subscriptions:[{...c,plan:{...c.plan,amount:r.amount,interval:r.interval,currency:r.currency.toUpperCase()},price:{...c.price,price_id:r.id,amount:r.amount,interval:r.interval,currency:r.currency,product:{...(p=c.price)==null?void 0:p.product,product_id:o.id}},tier:{id:o.id,name:o.name}}]}}getContextPage({site:t,page:n,member:a}){if(!n||n==="default"){const i=Ft({site:t})||!Qt({site:t})?"signin":"signup";n=a?"accountHome":i}return cm({page:n})}getContextMember({site:t,page:n,member:a,offers:i,pageData:o,customSiteUrl:r}){return de(["dev","preview"],{customSiteUrl:r})?wk({page:n})||v2({page:n})?de(["dev"],{customSiteUrl:r})?a||ri.free:de(["preview"])?n==="accountPlan"&&(o==null?void 0:o.action)==="cancel"?this.getRetentionPreviewMember({site:t,offers:i}):ri.preview:ri.paid:null:a}getContextFromState(){const{site:t,member:n,offers:a,action:i,actionErrorMessage:o,page:r,lastPage:s,showPopup:c,pageQuery:u,pageData:d,popupNotification:p,notification:m,customSiteUrl:f,dir:b,scrollbarWidth:w,otcRef:g,inboxLinks:y}=this.state,k=this.getContextPage({site:t,page:r,member:n}),C=this.getContextMember({site:t,page:k,member:n,offers:a,pageData:d,customSiteUrl:f});return{api:this.GhostApi,site:t,offers:a,action:i,actionErrorMessage:o,brandColor:this.getAccentColor(),page:k,pageQuery:u,pageData:d,member:C,lastPage:s,showPopup:c,popupNotification:p,notification:m,customSiteUrl:f,dir:b,scrollbarWidth:w,otcRef:g,inboxLinks:y,doAction:(x,T)=>this.dispatchAction(x,T)}}getRecommendationButtons(){return document.querySelectorAll("[data-recommendation]")||[]}setupRecommendationButtons(){const t=a=>{const i=a.currentTarget.dataset.recommendation;i?this.dispatchAction("trackRecommendationClicked",{recommendationId:i}).catch(console.error):console.warn("[Portal] Invalid usage of data-recommendation attribute")},n=this.getRecommendationButtons();for(const a of n)a.addEventListener("click",t,{passive:!0})}transformPortalLinksToRelative(){document.querySelectorAll('a[href*="#/portal"], a[href*="#/share"]').forEach(P2)}render(){return this.state.initStatus==="success"?l.jsx(fz,{site:this.state.site,children:l.jsxs(_.Provider,{value:this.getContextFromState(),children:[l.jsx(dm,{}),l.jsx(zd,{}),l.jsx(Rd,{})]})}):null}}const Ik="ghost-portal-root";function yz(){const e=document.createElement("div");e.id=Ik,e.setAttribute("data-testid","portal-root"),document.body.appendChild(e)}function bz(){const e=document.querySelector("script[data-ghost]");if(e){const t=e.dataset.i18n==="true",n=e.dataset.ghost,a=e.dataset.key,i=e.dataset.api,o=e.dataset.locale;return{siteUrl:n,apiKey:a,apiUrl:i,siteI18nEnabled:t,locale:o}}return{}}function kz(){const e=new URL(window.location.href);e.searchParams.get("token")&&(e.searchParams.delete("token"),window.history.replaceState({},document.title,e.href))}function vz(){const{siteUrl:e,apiKey:t,apiUrl:n,siteI18nEnabled:a,locale:i}=bz(),o=e||window.location.origin;yz(),kz(),cS.render(l.jsx(Z.StrictMode,{children:l.jsx(gz,{siteUrl:o,customSiteUrl:e,apiKey:t,apiUrl:n,siteI18nEnabled:a,locale:i})}),document.getElementById(Ik))}vz()});
|
|
4134
4130
|
//# sourceMappingURL=portal.min.js.map
|