@tryghost/portal 2.68.33 → 2.68.34
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 +4 -4
- package/umd/portal.min.js.map +1 -1
package/umd/portal.min.js
CHANGED
|
@@ -79,7 +79,7 @@ Url: ${Ns(e)}`),!0)}function QE(e,t){return e.type||!t||!t.length?!1:KE(e).some(
|
|
|
79
79
|
* @license MIT
|
|
80
80
|
*/function nk(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 Yo(e){return ln.Buffer&&typeof ln.Buffer.isBuffer=="function"?ln.Buffer.isBuffer(e):!!(e!=null&&e._isBuffer)}var Pt=tk,F0=Object.prototype.hasOwnProperty,ak=Array.prototype.slice,ik=function(){return(function(){}).name==="foo"}();function ok(e){return Object.prototype.toString.call(e)}function rk(e){return Yo(e)||typeof ln.ArrayBuffer!="function"?!1:typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e?!!(e instanceof DataView||e.buffer&&e.buffer instanceof ArrayBuffer):!1}var ie=Eb.exports=uk,N0=/\s*function\s+([^\(\s]*)\s*/;function sk(e){if(Pt.isFunction(e)){if(ik)return e.name;var t=e.toString(),n=t.match(N0);return n&&n[1]}}ie.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=O0(this),this.generatedMessage=!0);var n=t.stackStartFunction||it;if(Error.captureStackTrace)Error.captureStackTrace(this,n);else{var a=new Error;if(a.stack){var i=a.stack,o=sk(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}}},Pt.inherits(ie.AssertionError,Error);function lk(e,t){return typeof e=="string"?e.length<t?e:e.slice(0,t):e}function ck(e){if(ik||!Pt.isFunction(e))return Pt.inspect(e);var t=sk(e),n=t?": "+t:"";return"[Function"+n+"]"}function O0(e){return lk(ck(e.actual),128)+" "+e.operator+" "+lk(ck(e.expected),128)}function it(e,t,n,a,i){throw new ie.AssertionError({message:n,actual:e,expected:t,operator:a,stackStartFunction:i})}ie.fail=it;function uk(e,t){e||it(e,!0,t,"==",ie.ok)}ie.ok=uk,ie.equal=function(t,n,a){t!=n&&it(t,n,a,"==",ie.equal)},ie.notEqual=function(t,n,a){t==n&&it(t,n,a,"!=",ie.notEqual)},ie.deepEqual=function(t,n,a){ri(t,n,!1)||it(t,n,a,"deepEqual",ie.deepEqual)},ie.deepStrictEqual=function(t,n,a){ri(t,n,!0)||it(t,n,a,"deepStrictEqual",ie.deepStrictEqual)};function ri(e,t,n,a){if(e===t)return!0;if(Yo(e)&&Yo(t))return nk(e,t)===0;if(Pt.isDate(e)&&Pt.isDate(t))return e.getTime()===t.getTime();if(Pt.isRegExp(e)&&Pt.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(rk(e)&&rk(t)&&ok(e)===ok(t)&&!(e instanceof Float32Array||e instanceof Float64Array))return nk(new Uint8Array(e.buffer),new Uint8Array(t.buffer))===0;if(Yo(e)!==Yo(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),D0(e,t,n,a))}function dk(e){return Object.prototype.toString.call(e)=="[object Arguments]"}function D0(e,t,n,a){if(e==null||t===null||t===void 0)return!1;if(Pt.isPrimitive(e)||Pt.isPrimitive(t))return e===t;if(n&&Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;var i=dk(e),o=dk(t);if(i&&!o||!i&&o)return!1;if(i)return e=ak.call(e),t=ak.call(t),ri(e,t,n);var r=gk(e),s=gk(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],!ri(e[c],t[c],n,a))return!1;return!0}ie.notDeepEqual=function(t,n,a){ri(t,n,!1)&&it(t,n,a,"notDeepEqual",ie.notDeepEqual)},ie.notDeepStrictEqual=mk;function mk(e,t,n){ri(e,t,!0)&&it(e,t,n,"notDeepStrictEqual",mk)}ie.strictEqual=function(t,n,a){t!==n&&it(t,n,a,"===",ie.strictEqual)},ie.notStrictEqual=function(t,n,a){t===n&&it(t,n,a,"!==",ie.notStrictEqual)};function pk(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 M0(e){var t;try{e()}catch(n){t=n}return t}function hk(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=M0(t),a=(n&&n.name?" ("+n.name+").":".")+(a?" "+a:"."),e&&!i&&it(i,n,"Missing expected exception"+a);var o=typeof a=="string",r=!e&&Pt.isError(i),s=!e&&i&&!n;if((r&&o&&pk(i,n)||s)&&it(i,n,"Got unwanted exception"+a),e&&i&&n&&!pk(i,n)||!e&&i)throw i}ie.throws=function(e,t,n){hk(!0,e,t,n)},ie.doesNotThrow=function(e,t,n){hk(!1,e,t,n)},ie.ifError=function(e){if(e)throw e};function fk(e,t){e||it(e,!0,t,"==",fk)}ie.strict=I0(fk,ie,{equal:ie.strictEqual,deepEqual:ie.deepStrictEqual,notEqual:ie.notStrictEqual,notDeepEqual:ie.notDeepStrictEqual}),ie.strict.strict=ie.strict;var gk=Object.keys||function(e){var t=[];for(var n in e)F0.call(e,n)&&t.push(n);return t},R0=Eb.exports,H0=R0,B0=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++;H0(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 L0=ti,Y0=ti,yk=n1,U0=B0;Fd.getCallerRoot=function(){try{return yk(U0(2))}catch{return}},Fd.getProcessRoot=function(){let t=process.cwd();const n=Y0.join(t,"current");try{L0.statSync(n).isDirectory()&&(t=n)}catch{}try{return yk(t)}catch{return}};var V0=Fd,Gd={exports:{}},Jd,bk;function X0(){if(bk)return Jd;bk=1;var e=1e3,t=e*60,n=t*60,a=n*24,i=a*7,o=a*365.25;Jd=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]),h=(p[2]||"ms").toLowerCase();switch(h){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,h){var k=p>=m*1.5;return Math.round(d/m)+" "+h+(k?"s":"")}return Jd}function Q0(e){n.debug=n,n.default=n,n.coerce=c,n.disable=r,n.enable=i,n.enabled=s,n.humanize=X0(),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,h,k;function b(...f){if(!b.enabled)return;const y=b,v=Number(new Date),C=v-(p||v);y.diff=C,y.prev=p,y.curr=v,p=v,f[0]=n.coerce(f[0]),typeof f[0]!="string"&&f.unshift("%O");let x=0;f[0]=f[0].replace(/%([a-zA-Z%])/g,(E,F)=>{if(E==="%%")return"%";x++;const S=n.formatters[F];if(typeof S=="function"){const T=f[x];E=S.call(y,T),f.splice(x,1),x--}return E}),n.formatArgs.call(y,f),(y.log||n.log).apply(y,f)}return b.namespace=d,b.useColors=n.useColors(),b.color=n.selectColor(d),b.extend=a,b.destroy=n.destroy,Object.defineProperty(b,"enabled",{enumerable:!0,configurable:!1,get:()=>m!==null?m:(h!==n.namespaces&&(h=n.namespaces,k=n.enabled(d)),k),set:f=>{m=f}}),typeof n.init=="function"&&n.init(b),b}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,h=0,k=-1,b=0;for(;m<d.length;)if(h<p.length&&(p[h]===d[m]||p[h]==="*"))p[h]==="*"?(k=h,b=m,h++):(m++,h++);else if(k!==-1)h=k+1,b++,m=b;else return!1;for(;h<p.length&&p[h]==="*";)h++;return h===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 W0=Q0;(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=W0(t);const{formatters:s}=e.exports;s.j=function(c){try{return JSON.stringify(c)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}})(Gd,Gd.exports);var G0=Gd.exports;const J0=V0,kk=G0;Id.exports=function(t){const n=J0.getCallerRoot();let a;try{const i=ta("/node_modules/.pnpm/@tryghost+debug@2.1.0/node_modules/@tryghost/debug/lib")(n+"/package.json");i.alias?a=i.alias:a=i.name}catch{a="undefined"}return kk(a+":"+t)},Id.exports._base=kk;var K0=Id.exports,q0=K0;const $0=[{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"}],Z0=t1,vk=ti,Kd=ti,qd=q0("i18n"),Ak=$0,wk=Ak.map(e=>e.code);function xk(e,t){return e.reduce((n,a)=>{let i;try{i=ta("/ghost/i18n/lib")(`../locales/${a}/${t}.json`)}catch{i=ta("/ghost/i18n/lib")(`../locales/en/${t}.json`)}return n[a]={[t]:{...i,...i.default&&typeof i.default=="object"?i.default:{}}},n},{})}function _0(e,t){if(!t)return{[e]:{theme:{}}};let n=[];try{n=Kd.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=vk.join(t,`${o}.json`);if(Kd.existsSync(c))try{delete require.cache[ta("/ghost/i18n/lib").resolve(c)],r=ta("/ghost/i18n/lib")(c)}catch{qd(`Error loading theme locale file: ${o}`),s=!0}else s=!0;if(s)if(o!=="en")try{const u=vk.join(t,"en.json");Kd.existsSync(u)?(delete require.cache[ta("/ghost/i18n/lib").resolve(u)],r=ta("/ghost/i18n/lib")(u)):r={}}catch{r={}}else qd("Theme en.json file not found"),r={};return i[o]={theme:{...r,...r.default&&typeof r.default=="object"?r.default:{}}},i},{})}Oo.exports=(e="en",t="portal",n={})=>{const a=Z0.createInstance(),i={prefix:"{",suffix:"}"};t==="theme"&&(i.escapeValue=!1);let o;return t!=="theme"?o=xk(wk,t):(qd(`generateThemeResources: ${e}, ${n.themePath}`),o=_0(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},Oo.exports.SUPPORTED_LOCALES=wk,Oo.exports.LOCALE_DATA=Ak,Oo.exports.generateResources=xk;var eT=Oo.exports;const Uo=eT;Za.exports=Uo,Za.exports.default=Uo,Za.exports.LOCALE_DATA=Uo.LOCALE_DATA,Za.exports.SUPPORTED_LOCALES=Uo.SUPPORTED_LOCALES,Za.exports.generateResources=Uo.generateResources;var tT=Za.exports;const rl=ur(tT)("en","portal"),g=rl.t.bind(rl);class Tt extends Error{constructor(t,{code:n}={}){super(t),this.code=n??null}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 Tt(n.errors[0].message,{code:n.errors[0].code})}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 Tt(a.errors[0].message,{code:a.errors[0].code})}catch{return}}if(t.status===500)return new Tt("A server error occurred")}}const sl=[];function on(e,t){const n=(r,s=null)=>s?g(r,{number:s}):g(r),a=()=>{const r=s=>sl.push(s);sl.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=>(sl.length===0&&a(),!!sl.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 g("An error occurred");if(e instanceof Tt||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||g("An error occurred")+": "+e.toString()}class $d extends A.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&&Wu.createPortal(n,this.iframeHead),this.iframeRoot&&Wu.createPortal(t,this.iframeRoot)]})}}const Zd=e=>A.createElement("svg",{id:"Regular",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},A.createElement("defs",null,A.createElement("style",null,".cls-1{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:0.8px;}")),A.createElement("circle",{className:"cls-1",cx:12,cy:9.75,r:5.25}),A.createElement("path",{className:"cls-1",d:"M18.913,20.876a9.746,9.746,0,0,0-13.826,0"}),A.createElement("circle",{className:"cls-1",cx:12,cy:12,r:11.25})),Ck=`
|
|
82
|
+
`,r+1);i=i.substring(s+1)}this.stack=i}}},Pt.inherits(ie.AssertionError,Error);function lk(e,t){return typeof e=="string"?e.length<t?e:e.slice(0,t):e}function ck(e){if(ik||!Pt.isFunction(e))return Pt.inspect(e);var t=sk(e),n=t?": "+t:"";return"[Function"+n+"]"}function O0(e){return lk(ck(e.actual),128)+" "+e.operator+" "+lk(ck(e.expected),128)}function it(e,t,n,a,i){throw new ie.AssertionError({message:n,actual:e,expected:t,operator:a,stackStartFunction:i})}ie.fail=it;function uk(e,t){e||it(e,!0,t,"==",ie.ok)}ie.ok=uk,ie.equal=function(t,n,a){t!=n&&it(t,n,a,"==",ie.equal)},ie.notEqual=function(t,n,a){t==n&&it(t,n,a,"!=",ie.notEqual)},ie.deepEqual=function(t,n,a){ri(t,n,!1)||it(t,n,a,"deepEqual",ie.deepEqual)},ie.deepStrictEqual=function(t,n,a){ri(t,n,!0)||it(t,n,a,"deepStrictEqual",ie.deepStrictEqual)};function ri(e,t,n,a){if(e===t)return!0;if(Yo(e)&&Yo(t))return nk(e,t)===0;if(Pt.isDate(e)&&Pt.isDate(t))return e.getTime()===t.getTime();if(Pt.isRegExp(e)&&Pt.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(rk(e)&&rk(t)&&ok(e)===ok(t)&&!(e instanceof Float32Array||e instanceof Float64Array))return nk(new Uint8Array(e.buffer),new Uint8Array(t.buffer))===0;if(Yo(e)!==Yo(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),D0(e,t,n,a))}function dk(e){return Object.prototype.toString.call(e)=="[object Arguments]"}function D0(e,t,n,a){if(e==null||t===null||t===void 0)return!1;if(Pt.isPrimitive(e)||Pt.isPrimitive(t))return e===t;if(n&&Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;var i=dk(e),o=dk(t);if(i&&!o||!i&&o)return!1;if(i)return e=ak.call(e),t=ak.call(t),ri(e,t,n);var r=gk(e),s=gk(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],!ri(e[c],t[c],n,a))return!1;return!0}ie.notDeepEqual=function(t,n,a){ri(t,n,!1)&&it(t,n,a,"notDeepEqual",ie.notDeepEqual)},ie.notDeepStrictEqual=mk;function mk(e,t,n){ri(e,t,!0)&&it(e,t,n,"notDeepStrictEqual",mk)}ie.strictEqual=function(t,n,a){t!==n&&it(t,n,a,"===",ie.strictEqual)},ie.notStrictEqual=function(t,n,a){t===n&&it(t,n,a,"!==",ie.notStrictEqual)};function pk(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 M0(e){var t;try{e()}catch(n){t=n}return t}function hk(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=M0(t),a=(n&&n.name?" ("+n.name+").":".")+(a?" "+a:"."),e&&!i&&it(i,n,"Missing expected exception"+a);var o=typeof a=="string",r=!e&&Pt.isError(i),s=!e&&i&&!n;if((r&&o&&pk(i,n)||s)&&it(i,n,"Got unwanted exception"+a),e&&i&&n&&!pk(i,n)||!e&&i)throw i}ie.throws=function(e,t,n){hk(!0,e,t,n)},ie.doesNotThrow=function(e,t,n){hk(!1,e,t,n)},ie.ifError=function(e){if(e)throw e};function fk(e,t){e||it(e,!0,t,"==",fk)}ie.strict=I0(fk,ie,{equal:ie.strictEqual,deepEqual:ie.deepStrictEqual,notEqual:ie.notStrictEqual,notDeepEqual:ie.notDeepStrictEqual}),ie.strict.strict=ie.strict;var gk=Object.keys||function(e){var t=[];for(var n in e)F0.call(e,n)&&t.push(n);return t},R0=Eb.exports,H0=R0,B0=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++;H0(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 L0=ti,Y0=ti,yk=n1,U0=B0;Fd.getCallerRoot=function(){try{return yk(U0(2))}catch{return}},Fd.getProcessRoot=function(){let t=process.cwd();const n=Y0.join(t,"current");try{L0.statSync(n).isDirectory()&&(t=n)}catch{}try{return yk(t)}catch{return}};var V0=Fd,Gd={exports:{}},Jd,bk;function X0(){if(bk)return Jd;bk=1;var e=1e3,t=e*60,n=t*60,a=n*24,i=a*7,o=a*365.25;Jd=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]),h=(p[2]||"ms").toLowerCase();switch(h){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,h){var k=p>=m*1.5;return Math.round(d/m)+" "+h+(k?"s":"")}return Jd}function Q0(e){n.debug=n,n.default=n,n.coerce=c,n.disable=r,n.enable=i,n.enabled=s,n.humanize=X0(),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,h,k;function b(...f){if(!b.enabled)return;const y=b,v=Number(new Date),C=v-(p||v);y.diff=C,y.prev=p,y.curr=v,p=v,f[0]=n.coerce(f[0]),typeof f[0]!="string"&&f.unshift("%O");let x=0;f[0]=f[0].replace(/%([a-zA-Z%])/g,(E,F)=>{if(E==="%%")return"%";x++;const S=n.formatters[F];if(typeof S=="function"){const T=f[x];E=S.call(y,T),f.splice(x,1),x--}return E}),n.formatArgs.call(y,f),(y.log||n.log).apply(y,f)}return b.namespace=d,b.useColors=n.useColors(),b.color=n.selectColor(d),b.extend=a,b.destroy=n.destroy,Object.defineProperty(b,"enabled",{enumerable:!0,configurable:!1,get:()=>m!==null?m:(h!==n.namespaces&&(h=n.namespaces,k=n.enabled(d)),k),set:f=>{m=f}}),typeof n.init=="function"&&n.init(b),b}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,h=0,k=-1,b=0;for(;m<d.length;)if(h<p.length&&(p[h]===d[m]||p[h]==="*"))p[h]==="*"?(k=h,b=m,h++):(m++,h++);else if(k!==-1)h=k+1,b++,m=b;else return!1;for(;h<p.length&&p[h]==="*";)h++;return h===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 W0=Q0;(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=W0(t);const{formatters:s}=e.exports;s.j=function(c){try{return JSON.stringify(c)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}})(Gd,Gd.exports);var G0=Gd.exports;const J0=V0,kk=G0;Id.exports=function(t){const n=J0.getCallerRoot();let a;try{const i=ta("/node_modules/.pnpm/@tryghost+debug@2.1.0/node_modules/@tryghost/debug/lib")(n+"/package.json");i.alias?a=i.alias:a=i.name}catch{a="undefined"}return kk(a+":"+t)},Id.exports._base=kk;var K0=Id.exports,q0=K0;const $0=[{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"}],Z0=t1,vk=ti,Kd=ti,qd=q0("i18n"),Ak=$0,wk=Ak.map(e=>e.code);function xk(e,t){return e.reduce((n,a)=>{let i;try{i=ta("/ghost/i18n/lib")(`../locales/${a}/${t}.json`)}catch{i=ta("/ghost/i18n/lib")(`../locales/en/${t}.json`)}return n[a]={[t]:{...i,...i.default&&typeof i.default=="object"?i.default:{}}},n},{})}function _0(e,t){if(!t)return{[e]:{theme:{}}};let n=[];try{n=Kd.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=vk.join(t,`${o}.json`);if(Kd.existsSync(c))try{delete require.cache[ta("/ghost/i18n/lib").resolve(c)],r=ta("/ghost/i18n/lib")(c)}catch{qd(`Error loading theme locale file: ${o}`),s=!0}else s=!0;if(s)if(o!=="en")try{const u=vk.join(t,"en.json");Kd.existsSync(u)?(delete require.cache[ta("/ghost/i18n/lib").resolve(u)],r=ta("/ghost/i18n/lib")(u)):r={}}catch{r={}}else qd("Theme en.json file not found"),r={};return i[o]={theme:{...r,...r.default&&typeof r.default=="object"?r.default:{}}},i},{})}Oo.exports=(e="en",t="portal",n={})=>{const a=Z0.createInstance(),i={prefix:"{",suffix:"}"};(t==="theme"||t==="portal")&&(i.escapeValue=!1);let o;return t!=="theme"?o=xk(wk,t):(qd(`generateThemeResources: ${e}, ${n.themePath}`),o=_0(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},Oo.exports.SUPPORTED_LOCALES=wk,Oo.exports.LOCALE_DATA=Ak,Oo.exports.generateResources=xk;var eT=Oo.exports;const Uo=eT;Za.exports=Uo,Za.exports.default=Uo,Za.exports.LOCALE_DATA=Uo.LOCALE_DATA,Za.exports.SUPPORTED_LOCALES=Uo.SUPPORTED_LOCALES,Za.exports.generateResources=Uo.generateResources;var tT=Za.exports;const rl=ur(tT)("en","portal"),g=rl.t.bind(rl);class Tt extends Error{constructor(t,{code:n}={}){super(t),this.code=n??null}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 Tt(n.errors[0].message,{code:n.errors[0].code})}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 Tt(a.errors[0].message,{code:a.errors[0].code})}catch{return}}if(t.status===500)return new Tt("A server error occurred")}}const sl=[];function on(e,t){const n=(r,s=null)=>s?g(r,{number:s}):g(r),a=()=>{const r=s=>sl.push(s);sl.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=>(sl.length===0&&a(),!!sl.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 g("An error occurred");if(e instanceof Tt||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||g("An error occurred")+": "+e.toString()}class $d extends A.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&&Wu.createPortal(n,this.iframeHead),this.iframeRoot&&Wu.createPortal(t,this.iframeRoot)]})}}const Zd=e=>A.createElement("svg",{id:"Regular",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},A.createElement("defs",null,A.createElement("style",null,".cls-1{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:0.8px;}")),A.createElement("circle",{className:"cls-1",cx:12,cy:9.75,r:5.25}),A.createElement("path",{className:"cls-1",d:"M18.913,20.876a9.746,9.746,0,0,0-13.826,0"}),A.createElement("circle",{className:"cls-1",cx:12,cy:12,r:11.25})),Ck=`
|
|
83
83
|
.gh-portal-avatar {
|
|
84
84
|
position: relative;
|
|
85
85
|
display: flex;
|
|
@@ -2516,7 +2516,7 @@ html[dir="rtl"] .gh-portal-offer-title h4 {
|
|
|
2516
2516
|
.gh-portal-offer .gh-portal-signup-terms.gh-portal-error {
|
|
2517
2517
|
margin: 0;
|
|
2518
2518
|
}
|
|
2519
|
-
`,np=class np extends te.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{...Zo({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:g("jamie@example.com"),label:g("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:g("Jamie Larson"),label:g("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:jv(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:uv,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=Dn({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};Wo({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(Cm,{pageData:this.state.pageData,onBack:()=>{this.setState({showNewsletterSelection:!1})}}):l.jsx("section",{children:l.jsx("div",{className:"gh-portal-section",children:l.jsx($o,{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=g("Continue");a.type==="trial"&&(i=g("Start {amount}-day free trial",{amount:a.amount}));let o=!1;t==="signup:running"&&(i=g("Sending..."),o=!0);let r=!1;t==="signup:failed"&&(i=g("Retry"),r=!0);const s=t==="signup:running";return l.jsx(pe,{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:g("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:g("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:g("{amount} off",{amount:`${Ce(t.currency)}${t.amount/100}`})}):t.type==="trial"?l.jsx("h5",{className:"gh-portal-discount-label","data-testid":"offer-discount-label",children:g("{amount} days free",{amount:t.amount})}):l.jsx("h5",{className:"gh-portal-discount-label","data-testid":"offer-discount-label",children:g("{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(ca,{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`${Ce(a.currency)}${i}/${ui(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"?`${Ce(t.currency)}${t.amount/100}`:t.type==="percent"?`${t.amount}%`:t.type==="trial"?t.amount:""}renderOfferMessage({offer:t,product:n}){const a={forever:g("{amount} off forever.",{amount:this.getOffAmount({offer:t})}),firstPeriod:g("{amount} off for first {period}.",{amount:this.getOffAmount({offer:t}),period:ui(t.cadence)}),firstNMonths:g("{amount} off for first {number} months.",{amount:this.getOffAmount({offer:t}),number:t.duration_in_months||""})},i=this.getOriginalPrice({offer:t,product:n}),o=g("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:[g("Try free for {amount} days, then {originalPrice}.",{amount:t.amount,originalPrice:i,interpolation:{escapeValue:!1}})," ",l.jsx("span",{className:"gh-portal-cancel",children:g("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 ml({site:a})?l.jsxs("h4",{className:"gh-portal-plan-name",children:[t.name," - ",n.cadence==="month"?g("Monthly"):g("Yearly")]}):l.jsx("h4",{className:"gh-portal-plan-name",children:n.cadence==="month"?g("Monthly"):g("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:Ce(i.currency)}),l.jsx("span",{className:"amount",children:la(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:Ce(i.currency)}),l.jsx("span",{className:"amount",children:la(this.renderRoundedPrice(a))})]})})}renderOldTierPrice({offer:t,price:n}){return t.type==="trial"?null:l.jsxs("div",{className:"gh-portal-offer-oldprice",children:[Ce(n.currency)," ",la(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"?g("Monthly"):g("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=Dn({site:n,productId:t.tier.id});if(!a)return null;const i=t.cadence==="month"?a.monthlyPrice:a.yearlyPrice,o=Ok({offer:t,price:i}),r=a.benefits||[],s=Ce(i.currency).length>1?"long":"";return l.jsx(l.Fragment,{children:l.jsxs("div",{className:"gh-portal-content gh-portal-offer",children:[l.jsx(he,{}),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:g("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})]})})}};np.contextType=R;let Rm=np;const Iv=e=>A.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 48 48",...e},A.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"})),Fv=e=>A.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 48 48",...e},A.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"})),Qz=e=>A.createElement("svg",{width:96,height:56,viewBox:"0 0 96 56",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},A.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"}),A.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 Il({siteUrl:e=window.location.origin,apiUrl:t,apiKey:n}){const a="members/api";function i({type:u,resource:d}){return`${e.replace(/\/$/,"")}/${a}/${d}/`}function o({resource:u,params:d={}}){if(t&&n){const p=new URLSearchParams({...d,key:n});return`${t.replace(/\/$/,"")}/${u}/?${p.toString()}`}return""}function r({url:u,method:d="GET",headers:p={},credentials:m=void 0,body:h=void 0}){return fetch(u,{method:d,headers:p,credentials:m,body:h})}const s={};s.site={read(){const u=i({type:"members",resource:"site"});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 site data")})},newsletters(){const u=o({resource:"newsletters",params:{limit:100}});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 site data")})},tiers(){const u=o({resource:"tiers",params:{limit:100,include:"monthly_price,yearly_price,benefits"}});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 site data")})},settings(){const u=o({resource:"settings"});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 site data")})},offer({offerId:u}){const d=o({resource:`offers/${u}`});return r({url:d,method:"GET",headers:{"Content-Type":"application/json"}}).then(function(p){if(p.ok)return p.json();throw new Error("Failed to fetch offer data")})},recommendations({limit:u=100}={limit:100}){const d=o({resource:"recommendations",params:{limit:u}});return r({url:d,method:"GET",headers:{"Content-Type":"application/json"}}).then(function(p){if(p.ok)return p.json();throw new Error("Failed to fetch recommendations")})}},s.feedback={async add({uuid:u,key:d,postId:p,score:m}){let h=i({type:"members",resource:"feedback"});u&&d&&(h=h+`?uuid=${u}&key=${d}`);const b=await r({url:h,method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({feedback:[{post_id:p,score:m}]})});if(b.ok)return b.json();throw await Tt.fromApiResponse(b)??new Error("Failed to save feedback")}};const c=async(u,d)=>{if(u.ok)return u.json();const p=await Tt.fromApiResponse(u);throw p||new Error(d)};return s.gift={async fetchRedemptionData({token:u}){const d=i({type:"members",resource:`gifts/${encodeURIComponent(u)}/redeem`}),p=await r({url:d,method:"GET",headers:{"Content-Type":"application/json"},credentials:"same-origin"});return c(p,"Failed to load gift data")},async redeem({token:u}){const d=i({type:"members",resource:`gifts/${encodeURIComponent(u)}/redeem`}),p=await r({url:d,method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({})});return c(p,"Failed to redeem gift")}},s.recommendations={trackClicked({recommendationId:u}){let d=i({type:"members",resource:"recommendations/"+u+"/clicked"});navigator.sendBeacon(d)},trackSubscribed({recommendationId:u}){let d=i({type:"members",resource:"recommendations/"+u+"/subscribed"});navigator.sendBeacon(d)}},s.member={identity(){const u=i({type:"members",resource:"session"});return r({url:u,credentials:"same-origin"}).then(function(d){return!d.ok||d.status===204?null:d.text()})},sessionData(){const u=i({type:"members",resource:"member"});return r({url:u,credentials:"same-origin"}).then(function(d){return!d.ok||d.status===204?null:d.json()})},update({name:u,subscribed:d,newsletters:p,enableCommentNotifications:m}){const h=i({type:"members",resource:"member"}),k={name:u,subscribed:d,newsletters:p};return m!==void 0&&(k.enable_comment_notifications=m),r({url:h,method:"PUT",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(k)}).then(function(b){return b.ok?b.json():null})},deleteSuppression(){const u=i({type:"members",resource:"member/suppression"});return r({url:u,method:"DELETE"}).then(function(d){if(!d.ok)throw new Error("Your email has failed to resubscribe, please try again");return!0})},async getIntegrityToken(){const u=i({type:"members",resource:"integrity-token"}),d=await r({url:u,method:"GET"});if(d.ok)return d.text();{const p=await Tt.fromApiResponse(d);throw p||new Error("Failed to start a members session")}},async sendMagicLink({email:u,emailType:d,labels:p,name:m,oldEmail:h,newsletters:k,redirect:b,integrityToken:f,phonenumber:y,customUrlHistory:v,token:C,giftToken:x,autoRedirect:P=!0,includeOTC:E}){const F=i({type:"members",resource:"send-magic-link"}),S={name:m,email:u,newsletters:k,oldEmail:h,emailType:d,labels:p,requestSrc:"portal",redirect:b,integrityToken:f,honeypot:y,token:C,giftToken:x,autoRedirect:P,includeOTC:E},T=v??ci();T&&(S.urlHistory=T);const B=await r({url:F,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(S)});if(B.ok){if((B.headers.get("content-type")||"").toLowerCase().includes("application/json"))try{return await B.json()}catch{}return{}}else{const Q=await Tt.fromApiResponse(B);throw Q||new Error("Failed to send magic link email")}},async verifyOTC({otc:u,otcRef:d,redirect:p,integrityToken:m}){const h=i({type:"members",resource:"verify-otc"}),b=await r({url:h,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({otc:u,otcRef:d,redirect:p,integrityToken:m})});if(b.ok)return await b.json();{const f=await Tt.fromApiResponse(b);throw f||new Error("Failed to verify code")}},signout(u=!1){const d=i({type:"members",resource:"session"});return r({url:d,method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:u})}).then(function(p){if(p.ok)return window.location.replace(e),"Success";throw new Error("Failed to signout")})},async newsletters({uuid:u,key:d}){let p=i({type:"members",resource:"member/newsletters"});return p=p+`?uuid=${u}&key=${d}`,r({url:p,credentials:"same-origin"}).then(function(m){return!m.ok||m.status===204?null:m.json()})},async updateNewsletters({uuid:u,newsletters:d,key:p,enableCommentNotifications:m}){let h=i({type:"members",resource:"member/newsletters"});h=h+`?uuid=${u}&key=${p}`;const k={newsletters:d};return m!==void 0&&(k.enable_comment_notifications=m),r({url:h,method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(k)}).then(function(b){if(b.ok)return b.json();throw new Error("Failed to update email preferences")})},async updateEmailAddress({email:u}){const d=await s.member.identity(),p=i({type:"members",resource:"member/email"});return r({url:p,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:u,identity:d})}).then(async function(h){var k,b;if(h.ok)return"Success";{const f=await h.json(),y=((b=(k=f==null?void 0:f.errors)==null?void 0:k[0])==null?void 0:b.message)||"Failed to send email address verification email";throw new Error(y)}})},async checkoutPlan({plan:u,tierId:d,cadence:p,cancelUrl:m,successUrl:h,email:k,name:b,offerId:f,newsletters:y,metadata:v={}}={}){var S,T;const C=new URL(e),x=await s.member.identity(),P=i({type:"members",resource:"create-stripe-checkout-session"});if(!m){const B=window.location.href.startsWith(C.href)?new URL(window.location.href):new URL(e);B.searchParams.set("stripe","cancel"),m=B.href}const E={name:b,newsletters:JSON.stringify(y),requestSrc:"portal",fp_tid:(T=(S=window.FPROM||window.$FPROM)==null?void 0:S.data)==null?void 0:T.tid,urlHistory:ci(),...v},F={priceId:f?null:u,offerId:f,identity:x,metadata:E,successUrl:h,cancelUrl:m};return k&&(F.customerEmail=k),d&&p&&(delete F.priceId,F.tierId=f?null:d,F.cadence=f?null:p),r({url:P,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(F)}).then(async function(B){var Q,_;if(!B.ok){const $=await B.json(),q=((_=(Q=$==null?void 0:$.errors)==null?void 0:Q[0])==null?void 0:_.message)||"Failed to signup, please try again.";throw new Error(q)}return B.json()}).then(function(B){return B.url?window.location.assign(B.url):window.Stripe(B.publicKey).redirectToCheckout({sessionId:B.sessionId}).then(function(_){if(_.error)throw new Error(_.error.message)})})},async continueGiftCheckout(){const u=new URL(e),d=await s.member.identity(),p=i({type:"members",resource:"create-stripe-checkout-session"}),m=window.location.href.startsWith(u.href)?new URL(window.location.href):new URL(e);m.searchParams.set("stripe","success");const h=window.location.href.startsWith(u.href)?new URL(window.location.href):new URL(e);h.searchParams.set("stripe","cancel");const k={type:"subscription",continueFromGift:!0,identity:d,successUrl:m.href,cancelUrl:h.href,metadata:{checkoutType:"upgrade",requestSrc:"portal",urlHistory:ci()}};return r({url:p,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(k)}).then(async function(b){var f,y;if(!b.ok){const v=await b.json(),C=((y=(f=v==null?void 0:v.errors)==null?void 0:f[0])==null?void 0:y.message)||"Failed to continue gift subscription, please try again.";throw new Error(C)}return b.json()}).then(function(b){return b.url?window.location.assign(b.url):window.Stripe(b.publicKey).redirectToCheckout({sessionId:b.sessionId}).then(function(y){if(y.error)throw new Error(y.error.message)})})},async checkoutGift({tierId:u,cadence:d}={}){var f;const p=i({type:"members",resource:"create-stripe-checkout-session"});let m=null;try{m=await s.member.identity()}catch{}const k=await r({url:p,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:m,metadata:{requestSrc:"portal"},type:"gift",tierId:u,cadence:d})});let b={};try{b=await k.json()}catch{}if(!k.ok){const y=(f=b==null?void 0:b.errors)==null?void 0:f[0];throw y||new Error("Failed to process gift checkout, please try again.")}if(b.url)return window.location.assign(b.url);throw new Error("Failed to process gift checkout, please try again.")},async checkoutDonation({successUrl:u,cancelUrl:d,metadata:p={},personalNote:m=""}={}){var C,x,P;const h=await s.member.identity(),k=i({type:"members",resource:"create-stripe-checkout-session"}),b={fp_tid:(x=(C=window.FPROM||window.$FPROM)==null?void 0:C.data)==null?void 0:x.tid,urlHistory:ci(),...p},y=await r({url:k,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:h,metadata:b,successUrl:u,cancelUrl:d,type:"donation",personalNote:m})}),v=await y.json();if(!y.ok){const E=(P=v==null?void 0:v.errors)==null?void 0:P[0];throw E||new Error("We're unable to process your payment right now. Please try again later.")}return v},async editBilling({successUrl:u,cancelUrl:d,subscriptionId:p}={}){const m=new URL(e),h=await s.member.identity(),k=i({type:"members",resource:"create-stripe-update-session"});if(!u){const b=new URL(e);b.searchParams.set("stripe","billing-update-success"),u=b.href}if(!d){const b=window.location.href.startsWith(m.href)?new URL(window.location.href):new URL(e);b.searchParams.set("stripe","billing-update-cancel"),d=b.href}return r({url:k,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:h,subscription_id:p,successUrl:u,cancelUrl:d})}).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:u,subscriptionId:d}={}){const p=await s.member.identity(),m=i({type:"members",resource:"create-stripe-billing-portal-session"});if(!u){const h=new URL(e);h.searchParams.set("stripe","billing-portal-closed"),u=h.href}return r({url:m,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:p,subscription_id:d,returnUrl:u})}).then(function(h){if(!h.ok)throw new Error("Unable to create Stripe billing portal session");return h.json()}).then(function(h){return window.location.assign(h.url)}).catch(function(h){throw h})},async updateSubscription({subscriptionId:u,tierId:d,cadence:p,planId:m,smartCancel:h,cancelAtPeriodEnd:k,cancellationReason:b}){const f=await s.member.identity(),y=i({type:"members",resource:"subscriptions"})+u+"/",v={smart_cancel:h,cancel_at_period_end:k,cancellation_reason:b,identity:f,priceId:m};return d&&p&&(delete v.priceId,v.tierId=d,v.cadence=p),r({url:y,method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(v)})},async offers(){const u=await s.member.identity(),d=i({type:"members",resource:"member/offers"});return r({url:d,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:u})}).then(function(p){return p.ok?p.json():{offers:[]}}).catch(function(){return{offers:[]}})},async applyOffer({offerId:u,subscriptionId:d}){const p=await s.member.identity(),m=i({type:"members",resource:`subscriptions/${d}/apply-offer`}),h=await r({url:m,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:p,offer_id:u})});if(!h.ok){const k=await h.text();throw new Error(k||"Failed to apply offer")}return!0}},s.init=async()=>{let[u]=await Promise.all([s.member.sessionData()]),d={},p=[],m=[],h={},k=[];try{[{settings:h},{tiers:m},{newsletters:p}]=await Promise.all([s.site.settings(),s.site.tiers(),s.site.newsletters()]),d={...h,newsletters:p,tiers:RT({tiers:m})}}catch{}if(u&&u.paid)try{k=(await s.member.offers()).offers||[]}catch(b){console.warn("[Portal] Failed to load member offers:",b)}return d=vT({site:d}),{site:d,member:u,offers:k}},s}const Wz=`
|
|
2519
|
+
`,np=class np extends te.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{...Zo({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:g("jamie@example.com"),label:g("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:g("Jamie Larson"),label:g("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:jv(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:uv,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=Dn({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};Wo({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(Cm,{pageData:this.state.pageData,onBack:()=>{this.setState({showNewsletterSelection:!1})}}):l.jsx("section",{children:l.jsx("div",{className:"gh-portal-section",children:l.jsx($o,{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=g("Continue");a.type==="trial"&&(i=g("Start {amount}-day free trial",{amount:a.amount}));let o=!1;t==="signup:running"&&(i=g("Sending..."),o=!0);let r=!1;t==="signup:failed"&&(i=g("Retry"),r=!0);const s=t==="signup:running";return l.jsx(pe,{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:g("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:g("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:g("{amount} off",{amount:`${Ce(t.currency)}${t.amount/100}`})}):t.type==="trial"?l.jsx("h5",{className:"gh-portal-discount-label","data-testid":"offer-discount-label",children:g("{amount} days free",{amount:t.amount})}):l.jsx("h5",{className:"gh-portal-discount-label","data-testid":"offer-discount-label",children:g("{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(ca,{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`${Ce(a.currency)}${i}/${ui(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"?`${Ce(t.currency)}${t.amount/100}`:t.type==="percent"?`${t.amount}%`:t.type==="trial"?t.amount:""}renderOfferMessage({offer:t,product:n}){const a={forever:g("{amount} off forever.",{amount:this.getOffAmount({offer:t})}),firstPeriod:g("{amount} off for first {period}.",{amount:this.getOffAmount({offer:t}),period:ui(t.cadence)}),firstNMonths:g("{amount} off for first {number} months.",{amount:this.getOffAmount({offer:t}),number:t.duration_in_months||""})},i=this.getOriginalPrice({offer:t,product:n}),o=g("Renews at {price}.",{price:i});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:[g("Try free for {amount} days, then {originalPrice}.",{amount:t.amount,originalPrice:i})," ",l.jsx("span",{className:"gh-portal-cancel",children:g("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 ml({site:a})?l.jsxs("h4",{className:"gh-portal-plan-name",children:[t.name," - ",n.cadence==="month"?g("Monthly"):g("Yearly")]}):l.jsx("h4",{className:"gh-portal-plan-name",children:n.cadence==="month"?g("Monthly"):g("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:Ce(i.currency)}),l.jsx("span",{className:"amount",children:la(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:Ce(i.currency)}),l.jsx("span",{className:"amount",children:la(this.renderRoundedPrice(a))})]})})}renderOldTierPrice({offer:t,price:n}){return t.type==="trial"?null:l.jsxs("div",{className:"gh-portal-offer-oldprice",children:[Ce(n.currency)," ",la(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"?g("Monthly"):g("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=Dn({site:n,productId:t.tier.id});if(!a)return null;const i=t.cadence==="month"?a.monthlyPrice:a.yearlyPrice,o=Ok({offer:t,price:i}),r=a.benefits||[],s=Ce(i.currency).length>1?"long":"";return l.jsx(l.Fragment,{children:l.jsxs("div",{className:"gh-portal-content gh-portal-offer",children:[l.jsx(he,{}),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:g("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})]})})}};np.contextType=R;let Rm=np;const Iv=e=>A.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 48 48",...e},A.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"})),Fv=e=>A.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 48 48",...e},A.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"})),Qz=e=>A.createElement("svg",{width:96,height:56,viewBox:"0 0 96 56",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},A.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"}),A.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 Il({siteUrl:e=window.location.origin,apiUrl:t,apiKey:n}){const a="members/api";function i({type:u,resource:d}){return`${e.replace(/\/$/,"")}/${a}/${d}/`}function o({resource:u,params:d={}}){if(t&&n){const p=new URLSearchParams({...d,key:n});return`${t.replace(/\/$/,"")}/${u}/?${p.toString()}`}return""}function r({url:u,method:d="GET",headers:p={},credentials:m=void 0,body:h=void 0}){return fetch(u,{method:d,headers:p,credentials:m,body:h})}const s={};s.site={read(){const u=i({type:"members",resource:"site"});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 site data")})},newsletters(){const u=o({resource:"newsletters",params:{limit:100}});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 site data")})},tiers(){const u=o({resource:"tiers",params:{limit:100,include:"monthly_price,yearly_price,benefits"}});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 site data")})},settings(){const u=o({resource:"settings"});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 site data")})},offer({offerId:u}){const d=o({resource:`offers/${u}`});return r({url:d,method:"GET",headers:{"Content-Type":"application/json"}}).then(function(p){if(p.ok)return p.json();throw new Error("Failed to fetch offer data")})},recommendations({limit:u=100}={limit:100}){const d=o({resource:"recommendations",params:{limit:u}});return r({url:d,method:"GET",headers:{"Content-Type":"application/json"}}).then(function(p){if(p.ok)return p.json();throw new Error("Failed to fetch recommendations")})}},s.feedback={async add({uuid:u,key:d,postId:p,score:m}){let h=i({type:"members",resource:"feedback"});u&&d&&(h=h+`?uuid=${u}&key=${d}`);const b=await r({url:h,method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({feedback:[{post_id:p,score:m}]})});if(b.ok)return b.json();throw await Tt.fromApiResponse(b)??new Error("Failed to save feedback")}};const c=async(u,d)=>{if(u.ok)return u.json();const p=await Tt.fromApiResponse(u);throw p||new Error(d)};return s.gift={async fetchRedemptionData({token:u}){const d=i({type:"members",resource:`gifts/${encodeURIComponent(u)}/redeem`}),p=await r({url:d,method:"GET",headers:{"Content-Type":"application/json"},credentials:"same-origin"});return c(p,"Failed to load gift data")},async redeem({token:u}){const d=i({type:"members",resource:`gifts/${encodeURIComponent(u)}/redeem`}),p=await r({url:d,method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({})});return c(p,"Failed to redeem gift")}},s.recommendations={trackClicked({recommendationId:u}){let d=i({type:"members",resource:"recommendations/"+u+"/clicked"});navigator.sendBeacon(d)},trackSubscribed({recommendationId:u}){let d=i({type:"members",resource:"recommendations/"+u+"/subscribed"});navigator.sendBeacon(d)}},s.member={identity(){const u=i({type:"members",resource:"session"});return r({url:u,credentials:"same-origin"}).then(function(d){return!d.ok||d.status===204?null:d.text()})},sessionData(){const u=i({type:"members",resource:"member"});return r({url:u,credentials:"same-origin"}).then(function(d){return!d.ok||d.status===204?null:d.json()})},update({name:u,subscribed:d,newsletters:p,enableCommentNotifications:m}){const h=i({type:"members",resource:"member"}),k={name:u,subscribed:d,newsletters:p};return m!==void 0&&(k.enable_comment_notifications=m),r({url:h,method:"PUT",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(k)}).then(function(b){return b.ok?b.json():null})},deleteSuppression(){const u=i({type:"members",resource:"member/suppression"});return r({url:u,method:"DELETE"}).then(function(d){if(!d.ok)throw new Error("Your email has failed to resubscribe, please try again");return!0})},async getIntegrityToken(){const u=i({type:"members",resource:"integrity-token"}),d=await r({url:u,method:"GET"});if(d.ok)return d.text();{const p=await Tt.fromApiResponse(d);throw p||new Error("Failed to start a members session")}},async sendMagicLink({email:u,emailType:d,labels:p,name:m,oldEmail:h,newsletters:k,redirect:b,integrityToken:f,phonenumber:y,customUrlHistory:v,token:C,giftToken:x,autoRedirect:P=!0,includeOTC:E}){const F=i({type:"members",resource:"send-magic-link"}),S={name:m,email:u,newsletters:k,oldEmail:h,emailType:d,labels:p,requestSrc:"portal",redirect:b,integrityToken:f,honeypot:y,token:C,giftToken:x,autoRedirect:P,includeOTC:E},T=v??ci();T&&(S.urlHistory=T);const B=await r({url:F,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(S)});if(B.ok){if((B.headers.get("content-type")||"").toLowerCase().includes("application/json"))try{return await B.json()}catch{}return{}}else{const Q=await Tt.fromApiResponse(B);throw Q||new Error("Failed to send magic link email")}},async verifyOTC({otc:u,otcRef:d,redirect:p,integrityToken:m}){const h=i({type:"members",resource:"verify-otc"}),b=await r({url:h,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({otc:u,otcRef:d,redirect:p,integrityToken:m})});if(b.ok)return await b.json();{const f=await Tt.fromApiResponse(b);throw f||new Error("Failed to verify code")}},signout(u=!1){const d=i({type:"members",resource:"session"});return r({url:d,method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:u})}).then(function(p){if(p.ok)return window.location.replace(e),"Success";throw new Error("Failed to signout")})},async newsletters({uuid:u,key:d}){let p=i({type:"members",resource:"member/newsletters"});return p=p+`?uuid=${u}&key=${d}`,r({url:p,credentials:"same-origin"}).then(function(m){return!m.ok||m.status===204?null:m.json()})},async updateNewsletters({uuid:u,newsletters:d,key:p,enableCommentNotifications:m}){let h=i({type:"members",resource:"member/newsletters"});h=h+`?uuid=${u}&key=${p}`;const k={newsletters:d};return m!==void 0&&(k.enable_comment_notifications=m),r({url:h,method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(k)}).then(function(b){if(b.ok)return b.json();throw new Error("Failed to update email preferences")})},async updateEmailAddress({email:u}){const d=await s.member.identity(),p=i({type:"members",resource:"member/email"});return r({url:p,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:u,identity:d})}).then(async function(h){var k,b;if(h.ok)return"Success";{const f=await h.json(),y=((b=(k=f==null?void 0:f.errors)==null?void 0:k[0])==null?void 0:b.message)||"Failed to send email address verification email";throw new Error(y)}})},async checkoutPlan({plan:u,tierId:d,cadence:p,cancelUrl:m,successUrl:h,email:k,name:b,offerId:f,newsletters:y,metadata:v={}}={}){var S,T;const C=new URL(e),x=await s.member.identity(),P=i({type:"members",resource:"create-stripe-checkout-session"});if(!m){const B=window.location.href.startsWith(C.href)?new URL(window.location.href):new URL(e);B.searchParams.set("stripe","cancel"),m=B.href}const E={name:b,newsletters:JSON.stringify(y),requestSrc:"portal",fp_tid:(T=(S=window.FPROM||window.$FPROM)==null?void 0:S.data)==null?void 0:T.tid,urlHistory:ci(),...v},F={priceId:f?null:u,offerId:f,identity:x,metadata:E,successUrl:h,cancelUrl:m};return k&&(F.customerEmail=k),d&&p&&(delete F.priceId,F.tierId=f?null:d,F.cadence=f?null:p),r({url:P,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(F)}).then(async function(B){var Q,_;if(!B.ok){const $=await B.json(),q=((_=(Q=$==null?void 0:$.errors)==null?void 0:Q[0])==null?void 0:_.message)||"Failed to signup, please try again.";throw new Error(q)}return B.json()}).then(function(B){return B.url?window.location.assign(B.url):window.Stripe(B.publicKey).redirectToCheckout({sessionId:B.sessionId}).then(function(_){if(_.error)throw new Error(_.error.message)})})},async continueGiftCheckout(){const u=new URL(e),d=await s.member.identity(),p=i({type:"members",resource:"create-stripe-checkout-session"}),m=window.location.href.startsWith(u.href)?new URL(window.location.href):new URL(e);m.searchParams.set("stripe","success");const h=window.location.href.startsWith(u.href)?new URL(window.location.href):new URL(e);h.searchParams.set("stripe","cancel");const k={type:"subscription",continueFromGift:!0,identity:d,successUrl:m.href,cancelUrl:h.href,metadata:{checkoutType:"upgrade",requestSrc:"portal",urlHistory:ci()}};return r({url:p,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(k)}).then(async function(b){var f,y;if(!b.ok){const v=await b.json(),C=((y=(f=v==null?void 0:v.errors)==null?void 0:f[0])==null?void 0:y.message)||"Failed to continue gift subscription, please try again.";throw new Error(C)}return b.json()}).then(function(b){return b.url?window.location.assign(b.url):window.Stripe(b.publicKey).redirectToCheckout({sessionId:b.sessionId}).then(function(y){if(y.error)throw new Error(y.error.message)})})},async checkoutGift({tierId:u,cadence:d}={}){var f;const p=i({type:"members",resource:"create-stripe-checkout-session"});let m=null;try{m=await s.member.identity()}catch{}const k=await r({url:p,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:m,metadata:{requestSrc:"portal"},type:"gift",tierId:u,cadence:d})});let b={};try{b=await k.json()}catch{}if(!k.ok){const y=(f=b==null?void 0:b.errors)==null?void 0:f[0];throw y||new Error("Failed to process gift checkout, please try again.")}if(b.url)return window.location.assign(b.url);throw new Error("Failed to process gift checkout, please try again.")},async checkoutDonation({successUrl:u,cancelUrl:d,metadata:p={},personalNote:m=""}={}){var C,x,P;const h=await s.member.identity(),k=i({type:"members",resource:"create-stripe-checkout-session"}),b={fp_tid:(x=(C=window.FPROM||window.$FPROM)==null?void 0:C.data)==null?void 0:x.tid,urlHistory:ci(),...p},y=await r({url:k,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:h,metadata:b,successUrl:u,cancelUrl:d,type:"donation",personalNote:m})}),v=await y.json();if(!y.ok){const E=(P=v==null?void 0:v.errors)==null?void 0:P[0];throw E||new Error("We're unable to process your payment right now. Please try again later.")}return v},async editBilling({successUrl:u,cancelUrl:d,subscriptionId:p}={}){const m=new URL(e),h=await s.member.identity(),k=i({type:"members",resource:"create-stripe-update-session"});if(!u){const b=new URL(e);b.searchParams.set("stripe","billing-update-success"),u=b.href}if(!d){const b=window.location.href.startsWith(m.href)?new URL(window.location.href):new URL(e);b.searchParams.set("stripe","billing-update-cancel"),d=b.href}return r({url:k,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:h,subscription_id:p,successUrl:u,cancelUrl:d})}).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:u,subscriptionId:d}={}){const p=await s.member.identity(),m=i({type:"members",resource:"create-stripe-billing-portal-session"});if(!u){const h=new URL(e);h.searchParams.set("stripe","billing-portal-closed"),u=h.href}return r({url:m,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:p,subscription_id:d,returnUrl:u})}).then(function(h){if(!h.ok)throw new Error("Unable to create Stripe billing portal session");return h.json()}).then(function(h){return window.location.assign(h.url)}).catch(function(h){throw h})},async updateSubscription({subscriptionId:u,tierId:d,cadence:p,planId:m,smartCancel:h,cancelAtPeriodEnd:k,cancellationReason:b}){const f=await s.member.identity(),y=i({type:"members",resource:"subscriptions"})+u+"/",v={smart_cancel:h,cancel_at_period_end:k,cancellation_reason:b,identity:f,priceId:m};return d&&p&&(delete v.priceId,v.tierId=d,v.cadence=p),r({url:y,method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(v)})},async offers(){const u=await s.member.identity(),d=i({type:"members",resource:"member/offers"});return r({url:d,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:u})}).then(function(p){return p.ok?p.json():{offers:[]}}).catch(function(){return{offers:[]}})},async applyOffer({offerId:u,subscriptionId:d}){const p=await s.member.identity(),m=i({type:"members",resource:`subscriptions/${d}/apply-offer`}),h=await r({url:m,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:p,offer_id:u})});if(!h.ok){const k=await h.text();throw new Error(k||"Failed to apply offer")}return!0}},s.init=async()=>{let[u]=await Promise.all([s.member.sessionData()]),d={},p=[],m=[],h={},k=[];try{[{settings:h},{tiers:m},{newsletters:p}]=await Promise.all([s.site.settings(),s.site.tiers(),s.site.newsletters()]),d={...h,newsletters:p,tiers:RT({tiers:m})}}catch{}if(u&&u.paid)try{k=(await s.member.offers()).offers||[]}catch(b){console.warn("[Portal] Failed to load member offers:",b)}return d=vT({site:d}),{site:d,member:u,offers:k}},s}const Wz=`
|
|
2520
2520
|
.gh-portal-feedback {
|
|
2521
2521
|
|
|
2522
2522
|
}
|
|
@@ -2917,7 +2917,7 @@ html[dir="rtl"] .gh-portal-offer-title h4 {
|
|
|
2917
2917
|
color: var(--grey6);
|
|
2918
2918
|
font-weight: 400;
|
|
2919
2919
|
}
|
|
2920
|
-
`,Ov=e=>{let t=e.length,n;for(;t>0;)n=Math.floor(Math.random()*t),t-=1,[e[t],e[n]]=[e[n],e[t]];return e},kI=({title:e,favicon:t,featuredImage:n})=>{const[a,i]=A.useState(t||n),o=()=>{i(null)};return a?l.jsx("img",{className:"gh-portal-recommendation-item-favicon",src:a,alt:e,onError:o}):l.jsx("div",{className:"gh-portal-recommendation-item-favicon"})},Dv=e=>{const t=window.open(e,"_blank");t?t.focus():window.location.href=e},vI=e=>{const{doAction:t,member:n,site:a}=A.useContext(R),{title:i,url:o,description:r,favicon:s,one_click_subscribe:c,featured_image:u}=e,d=n&&c,[p,m]=A.useState(!1),[h,k]=A.useState(!1),[b,f]=A.useState(!1),y=a.outbound_link_tagging??!1,v=A.useMemo(()=>{if(!y)return o;try{const E=new URL(o);return E.searchParams.has("ref")||E.searchParams.has("utm_source")||E.searchParams.has("source")?o:(E.searchParams.set("ref",Pk()),E.toString())}catch{return o}},[o,y]),C=A.useCallback(()=>{Dv(v),h||(t("trackRecommendationClicked",{recommendationId:e.id}),k(!0))},[v,e.id,h]),x=A.useCallback(async()=>{try{f(!0),await t("oneClickSubscribe",{siteUrl:o,throwErrors:!0}),t("trackRecommendationSubscribed",{recommendationId:e.id}),m(!0)}catch{const F=new URL("#/portal/signup",v);Dv(F),h||(t("trackRecommendationClicked",{recommendationId:e.id}),k(!0))}f(!1)},[m,o,v,e.id,h]),P=A.useCallback(E=>{b||(d?x(E):C(E))},[b,d,x,C]);return l.jsxs("section",{className:"gh-portal-recommendation-item",children:[l.jsxs("div",{className:"gh-portal-list-detail gh-portal-list-big",onClick:C,children:[l.jsxs("div",{className:"gh-portal-recommendation-item-header",children:[l.jsx(kI,{title:i,favicon:s,featuredImage:u}),l.jsx("h3",{children:i}),l.jsx(gI,{className:"gh-portal-recommendation-arrow-icon"})]}),l.jsxs("div",{className:"gh-portal-recommendation-description-container",children:[p&&l.jsxs("div",{className:"gh-portal-recommendation-subscribed "+(r?"with-description":"without-description"),children:[l.jsx("span",{children:g("Verification link sent, check your inbox")}),l.jsx(yI,{className:"gh-portal-recommendation-checkmark-icon",alt:""})]}),r&&l.jsx("p",{className:p?"gh-portal-recommendation-description-hidden":"",children:r})]})]}),l.jsxs("div",{className:"gh-portal-recommendation-item-action",children:[!p&&b&&l.jsx("span",{className:"gh-portal-recommendations-loading-container",children:l.jsx(di,{className:"gh-portal-loadingicon dark"})}),!p&&!b&&d&&l.jsx("button",{type:"button",className:"gh-portal-btn gh-portal-btn-list",onClick:P,children:g("Subscribe")})]})]})},AI=()=>{const{api:e,site:t,pageData:n,doAction:a}=A.useContext(R),{title:i,icon:o}=t,{recommendations_enabled:r=!1}=t,[s,c]=A.useState(null);A.useEffect(()=>{e.site.recommendations({limit:100}).then(k=>{const b=k.recommendations.filter(y=>y.one_click_subscribe),f=k.recommendations.filter(y=>!y.one_click_subscribe);c([...Ov(b),...Ov(f)])}).catch(k=>{console.error(k)})},[]);const[u,d]=A.useState(5),p=()=>{d(s.length)};if(A.useEffect(()=>()=>{if(n.signup){const k=[];k.push("action","success"),Sl(k)}},[]),s===null)return l.jsx(yi,{});const m=n&&n.signup?g("Welcome to {siteTitle}",{siteTitle:i
|
|
2920
|
+
`,Ov=e=>{let t=e.length,n;for(;t>0;)n=Math.floor(Math.random()*t),t-=1,[e[t],e[n]]=[e[n],e[t]];return e},kI=({title:e,favicon:t,featuredImage:n})=>{const[a,i]=A.useState(t||n),o=()=>{i(null)};return a?l.jsx("img",{className:"gh-portal-recommendation-item-favicon",src:a,alt:e,onError:o}):l.jsx("div",{className:"gh-portal-recommendation-item-favicon"})},Dv=e=>{const t=window.open(e,"_blank");t?t.focus():window.location.href=e},vI=e=>{const{doAction:t,member:n,site:a}=A.useContext(R),{title:i,url:o,description:r,favicon:s,one_click_subscribe:c,featured_image:u}=e,d=n&&c,[p,m]=A.useState(!1),[h,k]=A.useState(!1),[b,f]=A.useState(!1),y=a.outbound_link_tagging??!1,v=A.useMemo(()=>{if(!y)return o;try{const E=new URL(o);return E.searchParams.has("ref")||E.searchParams.has("utm_source")||E.searchParams.has("source")?o:(E.searchParams.set("ref",Pk()),E.toString())}catch{return o}},[o,y]),C=A.useCallback(()=>{Dv(v),h||(t("trackRecommendationClicked",{recommendationId:e.id}),k(!0))},[v,e.id,h]),x=A.useCallback(async()=>{try{f(!0),await t("oneClickSubscribe",{siteUrl:o,throwErrors:!0}),t("trackRecommendationSubscribed",{recommendationId:e.id}),m(!0)}catch{const F=new URL("#/portal/signup",v);Dv(F),h||(t("trackRecommendationClicked",{recommendationId:e.id}),k(!0))}f(!1)},[m,o,v,e.id,h]),P=A.useCallback(E=>{b||(d?x(E):C(E))},[b,d,x,C]);return l.jsxs("section",{className:"gh-portal-recommendation-item",children:[l.jsxs("div",{className:"gh-portal-list-detail gh-portal-list-big",onClick:C,children:[l.jsxs("div",{className:"gh-portal-recommendation-item-header",children:[l.jsx(kI,{title:i,favicon:s,featuredImage:u}),l.jsx("h3",{children:i}),l.jsx(gI,{className:"gh-portal-recommendation-arrow-icon"})]}),l.jsxs("div",{className:"gh-portal-recommendation-description-container",children:[p&&l.jsxs("div",{className:"gh-portal-recommendation-subscribed "+(r?"with-description":"without-description"),children:[l.jsx("span",{children:g("Verification link sent, check your inbox")}),l.jsx(yI,{className:"gh-portal-recommendation-checkmark-icon",alt:""})]}),r&&l.jsx("p",{className:p?"gh-portal-recommendation-description-hidden":"",children:r})]})]}),l.jsxs("div",{className:"gh-portal-recommendation-item-action",children:[!p&&b&&l.jsx("span",{className:"gh-portal-recommendations-loading-container",children:l.jsx(di,{className:"gh-portal-loadingicon dark"})}),!p&&!b&&d&&l.jsx("button",{type:"button",className:"gh-portal-btn gh-portal-btn-list",onClick:P,children:g("Subscribe")})]})]})},AI=()=>{const{api:e,site:t,pageData:n,doAction:a}=A.useContext(R),{title:i,icon:o}=t,{recommendations_enabled:r=!1}=t,[s,c]=A.useState(null);A.useEffect(()=>{e.site.recommendations({limit:100}).then(k=>{const b=k.recommendations.filter(y=>y.one_click_subscribe),f=k.recommendations.filter(y=>!y.one_click_subscribe);c([...Ov(b),...Ov(f)])}).catch(k=>{console.error(k)})},[]);const[u,d]=A.useState(5),p=()=>{d(s.length)};if(A.useEffect(()=>()=>{if(n.signup){const k=[];k.push("action","success"),Sl(k)}},[]),s===null)return l.jsx(yi,{});const m=n&&n.signup?g("Welcome to {siteTitle}",{siteTitle:i}):g("Recommendations");let h;return r&&s&&s.length>0?n&&n.signup?h=g("Thank you for subscribing. Before you start reading, below are a few other sites you may enjoy."):h=g("Here are a few other sites you may enjoy."):h=g("Sorry, no recommendations are available right now."),l.jsxs("div",{className:"gh-portal-content with-footer",children:[l.jsx(he,{}),l.jsxs("div",{className:"gh-portal-recommendations-header",children:[o&&l.jsx("img",{className:"gh-portal-signup-logo",alt:i,src:o}),l.jsx("h1",{className:"gh-portal-main-title",children:m})]}),l.jsx("p",{className:"gh-portal-recommendations-description",children:h}),r?l.jsx("div",{className:"gh-portal-list",children:s.slice(0,u).map((k,b)=>l.jsx(vI,{...k},b))}):null,(u<s.length||n&&n.signup)&&l.jsxs("footer",{className:"gh-portal-action-footer",children:[u<s.length&&l.jsx("button",{className:"gh-portal-btn gh-portal-center",style:{width:"100%"},onClick:p,children:l.jsx("span",{children:g("Show all")})}),n&&n.signup&&l.jsx("button",{className:"gh-portal-btn gh-portal-center gh-portal-btn-link gh-portal-btn-recommendations-later",style:{width:"100%"},onClick:p,children:l.jsx("span",{onClick:()=>a("closePopup"),children:g("Maybe later")})})]})]})},wI=`
|
|
2921
2921
|
.gh-portal-popup-container.share {
|
|
2922
2922
|
width: 560px;
|
|
2923
2923
|
}
|
|
@@ -4507,5 +4507,5 @@ html[dir="rtl"] .gh-portal-list-toggle-wrapper .gh-portal-list-detail {
|
|
|
4507
4507
|
}
|
|
4508
4508
|
`;function PI({site:e}){return em+EI+g3+z3+Y3+y3()+f3+d3+h3+Ck+Lz+wz+Xz()+fm+Yz+SI+jI+Wz+_z+eI+tI+aI+oI+Dz+fI+lI+bI+wI+xI}const ap=class ap extends te.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:Zo({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:g("jamie@example.com"),label:g("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=g(a?"Sending login link...":"Continue");const o=!!a;return t==="signin:failed"&&(i=g("Retry"),n=!0),l.jsx(pe,{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:g("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:g("Sign up")})})]})}renderForm(){const{site:t}=this.context,n=dl({site:t})&&rn({site:t});return On({site:t})?l.jsxs("section",{children:[l.jsx("div",{className:"gh-portal-section",children:l.jsx($o,{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:g("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}):On({site:t})?null:l.jsx(cv,{className:"gh-portal-icon gh-portal-icon-invitation"})}renderSiteTitle(){const{site:t}=this.context,n=t.title;return On({site:t})?l.jsx("h1",{className:"gh-portal-main-title",children:g("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(he,{}),l.jsx("div",{className:"gh-portal-logged-out-form-container",children:l.jsxs("div",{className:"gh-portal-content signin",children:[this.renderFormHeader(),this.renderForm()]})})]})}};ap.contextType=R;let Bm=ap;const TI=({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:g("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:g("Contact support")})})})})]})},zI=()=>{const{member:e,brandColor:t}=A.useContext(R),n=e.avatar_image;return l.jsxs("header",{className:"gh-portal-account-header",children:[l.jsx(_d,{gravatar:n,style:{userIcon:{color:t,width:"56px",height:"56px",padding:"2px"}}}),l.jsx("h2",{className:"gh-portal-main-title",children:g("Your account")})]})},II=()=>{const{site:e,action:t,brandColor:n,doAction:a}=A.useContext(R);if(!dl({site:e})||!rn({site:e}))return null;const i=["checkoutPlan:running"].includes(t),o=()=>{a("switchPage",{page:"accountPlan",lastPage:"accountHome"})};return l.jsx(pe,{dataTestId:"view-plans",isRunning:i,label:g("View plans"),onClick:()=>o(),brandColor:n,style:{width:"100%"}})},FI=()=>{const{member:e,site:t}=A.useContext(R),{is_stripe_configured:n}=t;if(!n||si({site:t}))return null;const a=ot({member:e}),i=Nn({member:e});if(i&&!a)return null;if(a){const o=a==null?void 0:a.current_period_end,r=ll({member:e});if(Vo({member:e}))return r?l.jsx("div",{className:"gh-portal-section",style:{marginBottom:24},children:l.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:g("Your gift subscription will expire on {expiryDate}",{expiryDate:r})})}):null;if(i&&r)return l.jsx("div",{className:"gh-portal-section",children:l.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:g("Your subscription will expire on {expiryDate}",{expiryDate:r})})});if(a!=null&&a.cancel_at_period_end||i)return null;if(am({sub:a})){const s=Fn(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:g("Your subscription will start on {subscriptionStart}",{subscriptionStart:s})})})}return l.jsx("div",{className:"gh-portal-section",children:l.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:g("Your subscription will renew on {renewalDate}",{renewalDate:Fn(o)})})})}return l.jsxs("div",{className:"gh-portal-section",children:[l.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:g("You currently have a free membership, upgrade to a paid subscription for full access.")}),l.jsx(II,{})]})},NI=()=>{const{member:e,doAction:t,action:n,brandColor:a}=A.useContext(R),i=ot({member:e});if(!i||!i.cancel_at_period_end)return null;const o=g("Resume subscription"),r=["continueSubscription:running"].includes(n),s=!!r,c=Fn(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(Ne,{string:g("Your subscription has been canceled and will expire on {expiryDate}."),mapping:{expiryDate:l.jsx("strong",{children:c})}})}),l.jsx(pe,{onClick:()=>{t("continueSubscription",{subscriptionId:i.id})},isRunning:r,disabled:s,isPrimary:!0,brandColor:a,label:o,style:{width:"100%"}})]})})},OI=()=>{const{member:e,site:t,doAction:n,action:a,brandColor:i}=A.useContext(R);if(!Vo({member:e})||jk({member:e,site:t})||!ll({member:e}))return null;const r=a==="continueGiftSubscription:running";return l.jsx("div",{className:"gh-portal-cancelcontinue-container",children:l.jsxs("div",{className:"gh-portal-cancel-banner",children:[l.jsx("p",{style:{maxWidth:"none",margin:"0 0 16px",textAlign:"center",textWrap:"pretty"},children:"Continue with a paid subscription anytime. Your remaining gift period will be added as a free trial."}),l.jsx(pe,{onClick:()=>n("continueGiftSubscription"),isRunning:r,disabled:r,isPrimary:!0,brandColor:i,label:"Continue subscription",style:{width:"100%"}})]})})},DI=e=>A.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",...e},A.createElement("rect",{x:3,y:8,width:18,height:4,rx:1}),A.createElement("path",{d:"M12 8v13"}),A.createElement("path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7"}),A.createElement("path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5C9 3 12 8 12 8"}),A.createElement("path",{d:"M16.5 8a2.5 2.5 0 0 0 0-5C15 3 12 8 12 8"})),MI=e=>A.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},A.createElement("defs",null,A.createElement("style",null,".a{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.5px;}")),A.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"}),A.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"})),RI=()=>{const{member:e,site:t,doAction:n}=A.useContext(R),a=()=>{const h=ot({member:e});n("manageBilling",{subscriptionId:h.id})},i=()=>{const{is_stripe_configured:h}=t;h&&n("switchPage",{page:"accountPlan",lastPage:"accountHome"})},o=({price:h,isComplimentary:k,subscription:b})=>{const{next_payment:f}=b||{};let y="";if(h){const{amount:F=0,currency:S,interval:T}=h;y=`${Intl.NumberFormat("en",{currency:S,style:"currency"}).format(F/100)}/${g(T)}`}const v=ll({member:e});if(Vo({member:e})&&v)return l.jsxs("p",{className:"gh-portal-account-discountcontainer",children:[l.jsx(DI,{className:"gh-portal-account-tagicon"}),l.jsx("span",{children:g("Gift subscription")}),l.jsx("span",{className:"gh-portal-account-expiry-separator",children:"-"}),l.jsx("span",{className:"gh-portal-account-expiry",children:g("Expires {expiryDate}",{expiryDate:v})})]});k&&(v?y=`${g("Complimentary")} - ${g("Expires {expiryDate}",{expiryDate:v})}`:y=g("Complimentary"));let C="";if(am({sub:b}))return C="gh-portal-account-old-price",l.jsxs(l.Fragment,{children:[l.jsx("p",{className:C,children:y}),l.jsx(HI,{subscription:b})]});let P=BI({nextPayment:f});P&&(C="gh-portal-account-old-price");const E=()=>P?l.jsxs("p",{className:"gh-portal-account-discountcontainer","data-testid":"offer-label",children:[l.jsx(MI,{className:"gh-portal-account-tagicon"}),l.jsx("span",{children:P})]}):null;return l.jsxs(l.Fragment,{children:[l.jsx("p",{className:C,children:y}),l.jsx(E,{})]})},r=({isPaid:h})=>{const k=Vo({member:e}),b=k&&!jk({member:e,site:t});return si({site:t})&&(!h||k&&!b)?null:b?l.jsx("button",{className:"gh-portal-btn gh-portal-btn-list",onClick:()=>n("continueGiftSubscription"),"data-test-button":"continue-gift-subscription",children:g("Continue")}):l.jsx("button",{className:"gh-portal-btn gh-portal-btn-list",onClick:f=>i(),"data-test-button":"change-plan",children:g("Change")})},s=({defaultCardLast4:h})=>{if(h){const k=`**** **** **** ${h}`;return l.jsx("p",{children:k})}return null},c=({defaultCardLast4:h})=>{const{action:k}=A.useContext(R),b=k==="manageBilling:running"?l.jsx(di,{className:"gh-portal-billing-button-loader"}):g("Update");return l.jsxs("section",{children:[l.jsxs("div",{className:"gh-portal-list-detail",children:[l.jsx("h3",{children:g("Billing info & receipts")}),l.jsx(s,{defaultCardLast4:h})]}),l.jsx("button",{className:"gh-portal-btn gh-portal-btn-list",onClick:f=>a(),"data-test-button":"manage-billing",children:b})]})},u=ot({member:e}),d=Nn({member:e}),p=Vo({member:e}),m=Vt({member:e});if(u||d){const{price:h,default_payment_card_last4:k}=u||{};let b=g("Plan");return ml({site:t})&&tm({member:e})&&(b=tm({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:g("Canceled")})]}),l.jsx(o,{price:h,isComplimentary:d,subscription:u})]}),l.jsx(r,{isPaid:m})]}),!d&&!p&&l.jsx(c,{defaultCardLast4:k})]})}return null};function HI({subscription:e}){if(am({sub:e})){const t=Fn(e.trial_end_at);return l.jsx("p",{className:"gh-portal-account-discountcontainer",children:l.jsx("div",{children:l.jsx("span",{children:g("Free Trial – Ends {trialEnd}",{trialEnd:t})})})})}return null}function BI({nextPayment:e}){if(!e)return"";const t=e.discount;if(!t)return"";const n=t.end?g("Ends {offerEndDate}",{offerEndDate:Fn(t.end)}):g("Forever");return`${`${Intl.NumberFormat("en",{currency:e.currency,style:"currency"}).format(e.amount/100)}/${g(e.interval)}`}${n?` — ${n}`:""}`}function LI(){const{member:e,site:t,doAction:n}=A.useContext(R);let{newsletters:a}=e;const i=!!(a!=null&&a.length);let o=g(i?"Subscribed":"Unsubscribed");const r=s=>{var d;s.preventDefault();const c=ra({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:g("Email newsletter")}),l.jsxs("p",{children:[o," ",im({member:e})&&i&&l.jsx("button",{className:"gh-portal-btn-text gh-email-faq-page-button",onClick:()=>n("switchPage",{page:"emailReceivingFAQ",lastPage:"accountHome"}),children:g("Not receiving emails?")})]})]}),l.jsx("div",{children:l.jsx(jl,{dataTestId:"default-newsletter-toggle",id:"default-newsletter-toggle",onToggle:s=>{r(s)},checked:i})})]})}const Rv=e=>A.createElement("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",...e},A.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"}),A.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 YI(){return l.jsxs("p",{className:"gh-portal-email-notice",children:[l.jsx(Rv,{className:"gh-portal-email-notice-icon"}),l.jsx("span",{className:"gh-mobile-only",children:g("You're not receiving emails")}),l.jsx("span",{className:"gh-desktop-only",children:g("You're currently not receiving emails")})]})}function UI(){const{doAction:e,member:t,site:n}=A.useContext(R),a=zk({member:t}),i=Xo({site:n}),o=pl({site:n}),r=a?"emailSuppressed":"accountEmail",s=!i&&!o,c=()=>a||s?l.jsx(YI,{}):l.jsx("p",{children:g("Update your preferences")});return l.jsxs("section",{children:[l.jsxs("div",{className:"gh-portal-list-detail",children:[l.jsx("h3",{children:g("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:g("Manage")})]})}const VI=()=>{const{member:e,site:t}=A.useContext(R),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=Dk(),[s,c]=A.useState(r&&i);return A.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}}},XI=(e,t)=>Wo({site:e})&&Xo({site:e})||pl({site:e})||zk({member:t}),QI=e=>!Wo({site:e})&&Xo({site:e})&&!pl({site:e}),WI=()=>{const{member:e,doAction:t,site:n}=A.useContext(R),{name:a,email:i}=e,{transistor:o}=VI(),r=()=>{t("switchPage",{page:"accountProfile",lastPage:"accountHome"})},s=XI(n,e),c=QI(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||g("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:g("Edit")})]}),l.jsx(RI,{}),s&&l.jsx(UI,{}),c&&l.jsx(LI,{}),o.enabled&&l.jsx(CI,{hasPodcasts:o.hasPodcasts,memberUuid:o.memberUuid,settings:o.settings})]})})},GI=()=>l.jsxs("div",{className:"gh-portal-content gh-portal-account-main",children:[l.jsx(he,{}),l.jsx(zI,{}),l.jsxs("section",{className:"gh-portal-account-data",children:[l.jsx(FI,{}),l.jsx(OI,{}),l.jsx(NI,{}),l.jsx(WI,{})]})]}),ip=class ip extends te.Component{componentDidMount(){const{member:t,site:n}=this.context;On({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=Go({site:n});return!t||!On({site:n})?null:l.jsxs("div",{className:"gh-portal-account-wrapper",children:[l.jsx(GI,{}),l.jsx(TI,{onClose:()=>this.context.doAction("closePopup"),handleSignout:i=>this.handleSignout(i),supportAddress:a})]})}};ip.contextType=R;let Lm=ip;const op=class op extends te.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:Zo({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=g("Save");this.context.action==="updateProfile:failed"&&(n=g("Retry"));const a=!!t;return l.jsx(pe,{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:g("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(mi,{brandColor:this.context.brandColor,hidden:!this.context.lastPage,onClick:t=>this.onBack(t)}),l.jsx("h3",{className:"gh-portal-main-title",children:g("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(_d,{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:g("Jamie Larson"),label:g("Name"),name:"name",required:!1,errorMessage:a.name||""},{type:"email",value:t.email,placeholder:g("jamie@example.com"),label:g("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($o,{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(he,{}),this.renderHeader(),l.jsx("div",{className:"gh-portal-section",children:this.renderProfileData()})]}),this.renderAccountFooter()]}):null}};op.contextType=R;let Ym=op;function JI(){const{brandColor:e,lastPage:t,doAction:n}=A.useContext(R);return l.jsxs("header",{className:"gh-portal-detail-header",children:[l.jsx(mi,{brandColor:e,hidden:!t,onClick:()=>{n("back")}}),l.jsx("h3",{className:"gh-portal-main-title",children:g("Email preferences")})]})}function KI({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(jl,{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 qI({updateCommentNotifications:e,isCommentsEnabled:t,enableCommentNotifications:n}){const{doAction:a}=A.useContext(R),i=!!n;if(!t)return null;const o=async(r,s)=>{await e(s),a("showPopupNotification",{action:"updated:success",message:g("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:g("Comments")}),l.jsx("p",{children:g("Get notified when someone replies to your comment")})]}),l.jsx("div",{style:{display:"flex",alignItems:"center"},children:l.jsx(jl,{id:"comments",onToggle:o,checked:i,dataTestId:"switch-input"})})]})}function $I({subscribedNewsletters:e,setSubscribedNewsletters:t,hasNewslettersEnabled:n}){const{site:a}=A.useContext(R),i=ra({site:a});return n?i.map(o=>l.jsx(KI,{newsletter:o,subscribedNewsletters:e,setSubscribedNewsletters:t},o==null?void 0:o.id)):null}function ZI({site:e,isPaid:t}){return t?l.jsx("p",{style:{textAlign:"center",marginTop:"12px",marginBottom:"0",color:"var(--grey6)"},children:g("Unsubscribing from emails will not cancel your paid subscription to {title}",{title:e==null?void 0:e.title})}):null}function Hv({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}=A.useContext(R),h=!(n!=null&&n.length)&&(s&&!c||!s),b=t||(()=>null);return l.jsxs("div",{className:"gh-portal-content with-footer",children:[l.jsx(he,{}),l.jsx(JI,{}),l.jsx(b,{}),l.jsx("div",{className:"gh-portal-section flex",children:l.jsxs("div",{className:"gh-portal-list",children:[l.jsx($I,{hasNewslettersEnabled:e,subscribedNewsletters:n,setSubscribedNewsletters:f=>{let y=f.map(v=>({id:v.id}));a(y)}}),l.jsx(qI,{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(pe,{isRunning:!1,onClick:()=>{o()},disabled:h,brandColor:u,isPrimary:!1,label:g("Unsubscribe from all emails"),isDestructive:!0,style:{width:"100%",zIndex:900},dataTestId:"unsubscribe-from-all-emails"})}),l.jsxs("footer",{className:"gh-portal-action-footer"+(im({member:p})?" gh-feature-suppressions":""),children:[l.jsx("div",{style:{width:"100%"},children:l.jsx(ZI,{isPaid:r,site:m,subscribedNewsletters:n})}),im({member:p})&&!h&&l.jsxs("div",{className:"gh-portal-footer-secondary",children:[l.jsx("span",{className:"gh-portal-footer-secondary-light",children:g("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:[g("Get help")," ",l.jsx("span",{className:"right-arrow",children:"→"})]})]})]})]})}function _I(){const{member:e,doAction:t,site:n,pageData:a}=A.useContext(R);let i,o;a&&(i=a.newsletterUuid,o=a.action);const[r,s]=A.useState(!0),c=ra({site:n}),u=Xo({site:n});A.useEffect(()=>{e||t("switchPage",{page:"signin"})},[e,t]),A.useEffect(()=>{if(i&&o==="unsubscribe"){const f=e==null?void 0:e.newsletters.filter(y=>y.uuid!==i);h(f),s(!1),t("updateNewsletterPreference",{newsletters:f})}},[]);const d=()=>{if(a.comments&&k){const v=r?"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(Ne,{string:g("{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 f=c==null?void 0:c.find(v=>v.uuid===a.newsletterUuid);if(!f)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(Ne,{string:g("{memberEmail} will no longer receive {newsletterName} newsletter."),mapping:{memberEmail:l.jsx("strong",{children:e==null?void 0:e.email}),newsletterName:l.jsx("strong",{children:f==null?void 0:f.name})}})})})},p=[...(e==null?void 0:e.newsletters)||[]],[m,h]=A.useState(p),{comments_enabled:k}=n,{enable_comment_notifications:b}=e||{};return A.useEffect(()=>{h((e==null?void 0:e.newsletters)||[])},[e==null?void 0:e.newsletters]),l.jsx(Hv,{hasNewslettersEnabled:u,notification:i?d:null,subscribedNewsletters:m,updateSubscribedNewsletters:f=>{h(f),t("updateNewsletterPreference",{newsletters:f}),t("showPopupNotification",{action:"updated:success",message:g("Email preferences updated.")})},updateCommentNotifications:async f=>{t("updateNewsletterPreference",{enableCommentNotifications:f})},unsubscribeAll:()=>{h([]),t("showPopupNotification",{action:"updated:success",message:g("Unsubscribed from all emails.")});const f={newsletters:[]};k&&(f.enableCommentNotifications=!1),t("updateNewsletterPreference",f)},isPaidMember:Vt({member:e}),isCommentsEnabled:k!=="off",enableCommentNotifications:b})}function e2(){const{site:e}=A.useContext(R),t=e.icon;return t?l.jsx("img",{className:"gh-portal-unsubscribe-logo",src:t,alt:e.title}):null}function t2(){const{site:e}=A.useContext(R),t=e.title||"";return l.jsxs("header",{className:"gh-portal-header",children:[l.jsx(e2,{}),l.jsx("h2",{className:"gh-portal-publication-title",children:t})]})}async function Bv({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 n2(){const{site:e,api:t,pageData:n,member:a,doAction:i}=A.useContext(R),[o,r]=A.useState(),[s,c]=A.useState(!0),u=ra({site:e}),d=u.filter(S=>S.subscribe_on_signup),[p,m]=A.useState(!1),[h,k]=A.useState(d),[b,f]=A.useState(!1),{comments_enabled:y}=e,{enable_comment_notifications:v=!1}=o||{},C=Xo({site:e}),x=async S=>{a?i("updateNewsletterPreference",{newsletters:S}):await Bv({api:t,memberUuid:n.uuid,key:n.key,newsletters:S}),k(S);const T={action:"updated:success",message:g("Email preferences updated.")};i("showPopupNotification",T)},P=async S=>{let T;a?(await i("updateNewsletterPreference",{enableCommentNotifications:S}),T={...a,enable_comment_notifications:S}):T=await Bv({api:t,memberUuid:n.uuid,key:n.key,enableCommentNotifications:S}),r(T),i("showPopupNotification",{action:"updated:success",message:g("Comment preferences updated.")})},E=async()=>{let S;a?(await i("updateNewsletterPreference",{newsletters:[],enableCommentNotifications:!1}),S={...a},S.newsletters=[],S.enable_comment_notifications=!1):S=await t.member.updateNewsletters({uuid:n.uuid,key:n.key,newsletters:[],enableCommentNotifications:!1}),k([]),r(S),i("showPopupNotification",{action:"updated:success",message:g("Unsubscribed from all emails.")})};if(A.useEffect(()=>{(async()=>{let S;try{S=await t.member.newsletters({uuid:n.uuid,key:n.key}),r(S??null),c(!1)}catch(B){console.error("[PORTAL] Error fetching member newsletters",B),r(null),c(!1);return}if(S===null)return;const T=(S==null?void 0:S.newsletters)||[];k(T),(u==null?void 0:u.length)===1&&!y&&!n.newsletterUuid?await x([]):n.newsletterUuid?await x(T==null?void 0:T.filter(B=>B.uuid!==n.newsletterUuid)):n.comments&&y&&await P(!1)})()},[y,n.uuid,n.newsletterUuid,n.comments,e.url,u==null?void 0:u.length]),s)return l.jsx(yi,{});if(!o)return l.jsxs("div",{className:"gh-portal-content gh-portal-feedback with-footer",children:[l.jsx(he,{}),l.jsx("div",{className:"gh-feedback-icon gh-feedback-icon-error",children:l.jsx(ym,{})}),l.jsx("h1",{className:"gh-portal-main-title",children:g("That didn't go to plan")}),l.jsx("div",{children:l.jsx("p",{className:"gh-portal-text-center",children:g("We couldn't unsubscribe you as the email address was not found. Please contact the site owner.")})}),l.jsx(pe,{style:{width:"100%"},retry:!1,onClick:()=>i("closePopup"),disabled:!1,brandColor:"#000000",label:g("Close"),isRunning:!1,tabIndex:3,classes:"sticky bottom"})]});if((u==null?void 0:u.length)===1&&!y&&!b)return l.jsxs("div",{className:"gh-portal-content gh-portal-unsubscribe with-footer",children:[l.jsx(he,{}),l.jsx(t2,{}),l.jsx("h1",{className:"gh-portal-main-title",children:g("Successfully unsubscribed")}),l.jsxs("div",{children:[l.jsx("p",{className:"gh-portal-text-center",children:l.jsx(Ne,{string:g("{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(Ne,{string:g("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:()=>{f(!0)}})}})})]})]});const F=()=>{if(n.comments&&y){const B=p?"gh-portal-hide":"";return l.jsx(l.Fragment,{children:l.jsx("p",{className:`gh-portal-text-center gh-portal-header-message ${B}`,children:l.jsx(Ne,{string:g("{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 S=u==null?void 0:u.find(B=>B.uuid===n.newsletterUuid);if(!S)return null;const T=p?"gh-portal-hide":"";return l.jsx(l.Fragment,{children:l.jsx("p",{className:`gh-portal-text-center gh-portal-header-message ${T}`,children:l.jsx(Ne,{string:g("{memberEmail} will no longer receive {newsletterName} newsletter."),mapping:{memberEmail:l.jsx("strong",{children:o==null?void 0:o.email}),newsletterName:l.jsx("strong",{children:S==null?void 0:S.name})}})})})};return l.jsx(Hv,{hasNewslettersEnabled:C,notification:F,subscribedNewsletters:h,updateSubscribedNewsletters:async S=>{await x(S),m(!0)},updateCommentNotifications:P,unsubscribeAll:async()=>{await E(),m(!0)},isPaidMember:(o==null?void 0:o.status)!=="free",isCommentsEnabled:y!=="off",enableCommentNotifications:v})}function a2(){const{brandColor:e,lastPage:t,doAction:n,action:a,site:i}=A.useContext(R);A.useEffect(()=>{["removeEmailFromSuppressionList:success"].includes(a)&&n("refreshMemberData"),["removeEmailFromSuppressionList:failed","refreshMemberData:failed"].includes(a)&&n("back"),["refreshMemberData:success"].includes(a)&&(Wo({site:i})||pl({site:i})?(n("switchPage",{page:"accountEmail",lastPage:"accountHome"}),n("showPopupNotification",{message:g("You have been successfully resubscribed")})):n("back"))},[a,n,i,g]);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(mi,{brandColor:e,hidden:!t,onClick:()=>{n("back")}}),l.jsx(he,{})]}),l.jsx(Rv,{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:g("Emails disabled")}),l.jsx("p",{children:g("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(pe,{dataTestId:"resubscribe-email",classes:"gh-portal-confirm-button",onClick:r,disabled:o,brandColor:e,label:g("Re-enable emails"),isRunning:o})]})}function i2(){const{brandColor:e,doAction:t,site:n,pageData:a}=A.useContext(R),i=`mailto:${Go({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(mi,{brandColor:e,onClick:()=>{t("switchPage",{page:"emailSuppressed",lastPage:"accountHome"})}}),l.jsx(he,{})]}),l.jsxs("div",{className:"gh-longform",children:[l.jsx("h3",{children:g("Why has my email been disabled?")}),l.jsx("p",{children:g("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:g("Spam complaints")}),l.jsx("p",{children:g("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:g("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:g("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:g("Permanent failure (bounce)")}),l.jsx("p",{children:g("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:g("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:g("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:g("Need more help? Contact support")})})]})]})}function o2(){const{brandColor:e,doAction:t,site:n,lastPage:a,member:i,pageData:o}=A.useContext(R),r=Go({site:n}),s=`mailto:${r}`,c=zT({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(mi,{brandColor:e,onClick:()=>{a?t("switchPage",{page:"accountHome"}):t("switchPage",{page:"accountEmail",lastPage:"accountHome"})}}),l.jsx(he,{})]}),l.jsxs("div",{className:"gh-longform",children:[l.jsx("h3",{children:g("Help! I'm not receiving emails")}),l.jsx("p",{children:g("If you're not receiving the email newsletter you've subscribed to, here are a few things to check.")}),l.jsx("h4",{children:g("Verify your email address is correct")}),l.jsx("p",{children:l.jsx(Ne,{string:g("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:g("Check spam & promotions folders")}),l.jsx("p",{children:g(`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:g("Create a new contact")}),l.jsx("p",{children:l.jsx(Ne,{string:g("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:g("Send an email and say hi!")}),l.jsx("p",{children:l.jsx(Ne,{string:g("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:g("Check with your mail provider")}),l.jsx("p",{children:l.jsx(Ne,{string:g("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:g("Get in touch for help")}),l.jsx("p",{children:l.jsx(Ne,{string:g("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 r2=()=>{const[e,t]=A.useState(!0),[n,a]=A.useState(null),[i,o]=A.useState(null),{member:r,site:s}=A.useContext(R);return A.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,h=Il({siteUrl:u});try{const k=await h.member.checkoutDonation({successUrl:p,cancelUrl:m,personalNote:g("Add a personal note")});k.url&&window.location.replace(k.url)}catch(k){k.type&&k.type==="DisabledFeatureError"?o(g("This site is not accepting payments at the moment.")):a(g("Something went wrong, please try again later.")),t(!1)}}s&&s.donations_enabled===!1?(o(g("This site is not accepting donations at the moment.")),t(!1)):c()},[]),e?l.jsx("div",{children:l.jsx(yi,{})}):n?l.jsx(Hm,{error:n}):i?l.jsx(Hm,{error:i}):null},s2=()=>{try{if(window.parent&&window.parent!==window&&window.parent.location.href)return window.parent}catch{}return window},or=(e,t)=>{const n=new URLSearchParams(t);return`${e}?${n.toString()}`},l2=({shareTitle:e,shareUrl:t})=>{const n=[e,t].filter(Boolean).join(`
|
|
4509
4509
|
|
|
4510
|
-
`),a=[];return e&&a.push(`subject=${encodeURIComponent(e)}`),n&&a.push(`body=${encodeURIComponent(n)}`),`mailto:${a.length?`?${a.join("&")}`:""}`},c2=({shareTitle:e,shareUrl:t})=>or("https://www.linkedin.com/shareArticle",{mini:"true",url:t,title:e}),u2=()=>{const e=s2(),t=e.document,n=e.location,a=(k,b="content")=>{var f;return((f=t.querySelector(k))==null?void 0:f[b])||""},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(),h={twitter:or("https://twitter.com/intent/tweet",{url:i,text:o}),facebook:or("https://www.facebook.com/sharer/sharer.php",{u:i}),email:l2({shareTitle:o,shareUrl:i}),threads:or("https://www.threads.net/intent/post",{text:m}),linkedin:c2({shareTitle:o,shareUrl:i}),bluesky:or("https://bsky.app/intent/compose",{text:m})};return{shareUrl:i,shareTitle:o,shareExcerpt:r,shareImage:s,shareFavicon:c,shareSiteName:p,shareAuthor:d,socialLinks:h}},d2=()=>{const[e]=A.useState(u2);return e},m2=e=>A.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 -3.268 64 68.414",width:2232,height:2500,...e},A.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"})),p2=e=>A.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},A.createElement("circle",{cx:12,cy:12,r:1}),A.createElement("circle",{cx:19,cy:12,r:1}),A.createElement("circle",{cx:5,cy:12,r:1})),h2=e=>A.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},A.createElement("defs",{id:"defs13"},A.createElement("clipPath",{clipPathUnits:"userSpaceOnUse",id:"clipPath25"},A.createElement("path",{d:"M 0,700 H 700 V 0 H 0 Z",id:"path23"}))),A.createElement("g",{id:"g17",transform:"matrix(1.3333333,0,0,-1.3333333,-133.33333,799.99999)"},A.createElement("g",{id:"g19"},A.createElement("g",{id:"g21",clipPath:"url(#clipPath25)"},A.createElement("g",{id:"g27",transform:"translate(600,350)"},A.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"})),A.createElement("g",{id:"g31",transform:"translate(447.9175,273.6036)"},A.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"})))))),f2=e=>A.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},A.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"}),A.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"})),g2=e=>A.createElement("svg",{viewBox:"0 5 2490 2490.0000000000005",xmlns:"http://www.w3.org/2000/svg",width:2500,height:2495,...e},A.createElement("path",{d:"M185.2 313.1H2252V2291H185.2z",fill:"#fff"}),A.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"}),A.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"})),y2=e=>A.createElement("svg",{width:18,height:18,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},A.createElement("g",{clipPath:"url(#clip0_351_18008)"},A.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"})),A.createElement("defs",null,A.createElement("clipPath",{id:"clip0_351_18008"},A.createElement("rect",{width:17,height:17,fill:"white",transform:"translate(0.5 0.5)"})))),b2=e=>A.createElement("svg",{viewBox:"0 0 1200 1226.37",xmlns:"http://www.w3.org/2000/svg",width:2446,height:2500,...e},A.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"})),Um={signin:Bm,signup:Fm,accountHome:Lm,accountPlan:wm,accountProfile:Ym,accountEmail:_I,signupNewsletter:Cm,unsubscribe:n2,magiclink:Dm,loading:yi,offer:Rm,feedback:Zz,emailSuppressed:a2,emailSuppressionFAQ:i2,emailReceivingFAQ:o2,support:r2,supportSuccess:iI,supportError:Hm,recommendations:AI,gift:Hz,giftRedemption:sI,giftSuccess:pI,share:()=>{const[e,t]=A.useState(!1),[n,a]=A.useState(!1),i=A.useRef(),o=A.useRef(null),{shareUrl:r,shareTitle:s,shareExcerpt:c,shareImage:u,shareFavicon:d,shareSiteName:p,shareAuthor:m,socialLinks:h}=d2();A.useEffect(()=>()=>{clearTimeout(i.current)},[]),A.useEffect(()=>{var x;if(!n)return;const y=((x=o.current)==null?void 0:x.ownerDocument)||document,v=P=>{o.current&&!o.current.contains(P.target)&&(P.stopPropagation(),P.preventDefault(),a(!1))},C=P=>{P.key==="Escape"&&a(!1)};return y.addEventListener("click",v,!0),y.addEventListener("keydown",C),()=>{y.removeEventListener("click",v,!0),y.removeEventListener("keydown",C)}},[n]);const k=async()=>{await Nv(r)&&(t(!0),clearTimeout(i.current),i.current=setTimeout(()=>{t(!1)},2e3))},b=()=>{a(y=>!y)},f=()=>{a(!1)};return l.jsxs("div",{className:"gh-portal-content gh-portal-share",children:[l.jsx(he,{}),l.jsx("div",{className:"gh-portal-share-header",children:l.jsx("h1",{className:"gh-portal-main-title",children:g("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}),p&&m&&l.jsx("span",{className:"gh-portal-share-preview-separator","aria-hidden":"true",children:"|"}),m&&l.jsx("span",{className:"gh-portal-share-preview-author",children: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:k,"aria-label":g(e?"Copied":"Copy link"),title:g(e?"Copied":"Copy link"),children:[e?l.jsx("span",{className:"gh-portal-share-icon copied","aria-hidden":"true",children:l.jsx(ca,{})}):l.jsx("span",{className:"gh-portal-share-icon","aria-hidden":"true",children:l.jsx(f2,{})}),l.jsx("span",{className:"gh-portal-share-label",children:g(e?"Copied":"Copy link")})]}),l.jsx("a",{className:"gh-portal-btn gh-portal-share-action twitter",href:h.twitter,target:"_blank",rel:"noopener noreferrer","aria-label":g("X (Twitter)"),title:g("X (Twitter)"),children:l.jsx("span",{className:"gh-portal-share-icon x","aria-hidden":"true",children:l.jsx(b2,{})})}),l.jsx("a",{className:"gh-portal-btn gh-portal-share-action linkedin",href:h.linkedin,target:"_blank",rel:"noopener noreferrer","aria-label":g("LinkedIn"),title:g("LinkedIn"),children:l.jsx("span",{className:"gh-portal-share-icon","aria-hidden":"true",children:l.jsx(g2,{})})}),l.jsx("a",{className:"gh-portal-btn gh-portal-share-action email",href:h.email,target:"_blank",rel:"noopener noreferrer","aria-label":g("Email"),title:g("Email"),children:l.jsx("span",{className:"gh-portal-share-icon","aria-hidden":"true",children:l.jsx(Nm,{})})}),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:b,"aria-label":g("More options"),title:g("More options"),"aria-haspopup":"menu","aria-expanded":n,children:l.jsx("span",{className:"gh-portal-share-icon","aria-hidden":"true",children:l.jsx(p2,{})})}),n&&l.jsxs("div",{className:"gh-portal-share-more-menu",role:"menu","aria-label":g("More options"),children:[l.jsxs("a",{className:"gh-portal-share-more-item",href:h.facebook,target:"_blank",rel:"noopener noreferrer",role:"menuitem",onClick:f,children:[l.jsx("span",{className:"gh-portal-share-more-item-icon","aria-hidden":"true",children:l.jsx(h2,{})}),l.jsx("span",{children:g("Facebook")})]}),l.jsxs("a",{className:"gh-portal-share-more-item",href:h.threads,target:"_blank",rel:"noopener noreferrer",role:"menuitem",onClick:f,children:[l.jsx("span",{className:"gh-portal-share-more-item-icon","aria-hidden":"true",children:l.jsx(y2,{})}),l.jsx("span",{children:g("Threads")})]}),l.jsxs("a",{className:"gh-portal-share-more-item",href:h.bluesky,target:"_blank",rel:"noopener noreferrer",role:"menuitem",onClick:f,children:[l.jsx("span",{className:"gh-portal-share-more-item-icon","aria-hidden":"true",children:l.jsx(m2,{})}),l.jsx("span",{children:g("Bluesky")})]})]})]})]})]})}},Vm=function({page:e}){return Object.keys(Um).includes(e)?e:"signup"},Lv=function({page:e}){return e.includes("account")},k2=function({page:e}){return e.includes("offer")},v2=e=>A.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},A.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"})),rp=class rp extends te.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(v2,{}),"Powered by Ghost"]})}};rp.contextType=R;let Fl=rp;const Yv=()=>({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 A2({message:e}){return aa()?l.jsx("div",{className:"gh-portal-cookiebanner",children:e}):null}const sp=class sp extends te.Component{componentDidMount(){this.node&&!ge(["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&&ge(["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;ge(["preview"])||a&&n==="magiclink"||n==="giftRedemption"||n==="giftSuccess"||t.target===t.currentTarget&&this.context.doAction("closePopup")}renderActivePage(){const{page:t}=this.context;Vm({page:t});const n=Um[t];return l.jsx(n,{})}renderPopupNotification(){const{popupNotification:t}=this.context;return!t||!t.type?null:l.jsx(Mm,{})}sendPortalPreviewReadyEvent(){window.self!==window.parent&&window.parent.postMessage({type:"portal-preview-ready",payload:{}},"*")}render(){const{page:t,pageQuery:n,site:a,customSiteUrl:i,lastPage:o}=this.context,s=fl({site:a,pageQuery:n}).length;Vm({page:t});const u={...Yv().page[t]};let d="",p="regular",m="",h=t;switch(t){case"signup":m="Cookies must be enabled in your browser to sign up.";break;case"signin":m="Cookies must be enabled in your browser to sign in.";break;case"accountHome":h="account-home";break;case"accountProfile":h="account-profile";break;case"accountPlan":h="account-plan";break;default:m="Cookies must be enabled in your browser.",h=t;break}s>1&&!Xt({site:a})&&rn({site:a,pageQuery:n})&&t==="signup"&&(h+=" full-size",p="full"),(t==="gift"||t==="giftSuccess"||t==="giftRedemption")&&(h+=" full-size",p="full"),t==="magiclink"&&o==="gift"&&(h+=" full-size giftRedemption",p="full");const k=Qo({site:a});(k&&s>2||!k&&s>1)&&t==="accountPlan"&&(h+=" full-size",p="full"),(t==="emailSuppressionFAQ"||t==="emailReceivingFAQ")&&(h+=" large-size");let b="gh-portal-popup-container";ge(["preview"])&&(h+=" preview"),ge(["preview"],{customSiteUrl:i})&&!a.disableBackground&&(b+=" preview"),ge(["dev"])&&(b+=" dev");const f=`${b} ${d} ${h}`,y=t==="gift"||t==="giftSuccess"||t==="giftRedemption"||t==="magiclink"&&o==="gift";return this.sendPortalPreviewReadyEvent(),l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"gh-portal-popup-wrapper "+h,onClick:v=>this.handlePopupClose(v),children:[this.renderPopupNotification(),l.jsxs("div",{className:f,style:u,ref:v=>this.node=v,tabIndex:-1,children:[l.jsx(A2,{message:m}),this.renderActivePage(),p==="full"&&!y?l.jsx("div",{className:"gh-portal-powered inside "+(ge(["preview"])?"hidden ":"")+h,children:l.jsx(Fl,{})}):""]})]}),t!=="share"&&!y&&l.jsx("div",{className:"gh-portal-powered outside "+(ge(["preview"])?"hidden ":"")+h,children:l.jsx(Fl,{})})]})}};sp.contextType=R;let Xm=sp;const lp=class lp extends te.Component{constructor(t){super(t),this.state={height:null}}renderCurrentPage(t){const n=Um[t];return l.jsx(n,{})}onHeightChange(t){this.setState({height:t})}handlePopupClose(t){t.preventDefault();const{page:n}=this.context;n==="giftRedemption"||n==="giftSuccess"||t.target===t.currentTarget&&this.context.doAction("closePopup")}renderFrameStyles(){const{site:t,brandColor:n}=this.context,a=PI({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=Yv(),o=window.innerWidth<480,r={...i.frame.common};let s="gh-portal-popup-background";return ge(["preview"])&&(i.modalContainer.zIndex="3999997"),ge(["preview"],{customSiteUrl:a})&&!n.disableBackground&&(s+=" preview"),ge(["dev"])&&(s+=" dev"),l.jsx("div",{style:i.modalContainer,children:l.jsxs($d,{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(Xm,{isMobile:o})]})})}render(){const{showPopup:t}=this.context;return t?this.renderFrameContainer():null}};lp.contextType=R;let Qm=lp;Nl({products:Wm({numOfProducts:1})});function Qe(){return(new Date().getTime()/1e3|0).toString(16)+"xxxxxxxxxxxxxxxx".replace(/[x]/g,function(){return(Math.random()*16|0).toString(16)}).toLowerCase()}function w2(){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 Nl({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=Wm({numOfProducts:1}),portalProducts:s=r.map(B=>B.id),accentColor:c="#45C32E",portalPlans:u=["free","monthly","yearly"],membersSignupAccess:d="all",freePriceName:p="Free",freePriceDescription:m="Free preview",isStripeConfigured:h=!0,portalButton:k=!0,portalName:b=!0,portalButtonIcon:f="icon-1",portalButtonSignupText:y="Subscribe now",portalButtonStyle:v="icon-and-text",membersSupportAddress:C="support@example.com",editorDefaultEmailRecipients:x="visibility",newsletters:P=[],posts:E=x2(),commentsEnabled:F,recommendations:S=[],recommendationsEnabled:T}={}){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:h,portal_button:k,portal_name:b,portal_plans:u,portal_button_icon:f,portal_button_signup_text:y,portal_button_style:v,members_support_address:C,comments_enabled:F!=="off",newsletters:P,recommendations:S,recommendations_enabled:!!T,editor_default_email_recipients:x,posts:E}}function Uv({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:h="Basic",redemptionType:k="signup"}={}){return{id:`offer_${Qe()}`,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:h},redemption_type:k}}function zt({name:e="Jamie Larson",email:t="jamie@example.com",firstname:n="Jamie",subscriptions:a=[],paid:i=!1,status:o,avatarImage:r="",subscribed:s=!0,email_suppression:c={suppressed:!1,info:null},newsletters:u=[]}={}){const d={uuid:w2(),email:t,name:e,firstname:n,paid:i,subscribed:s,avatar_image:r,subscriptions:a,email_suppression:c,newsletters:u};return o!==void 0?d.status=o:i?d.status="paid":d.status="free",d}function x2({numOfPosts:e=3}={}){const t=[];for(let n=0;n<e;n++)t.push(C2({title:`Post ${n+1}`,slug:`post-${n+1}`}));return t.slice(0,e)}function C2({id:e=`post_${Qe()}`,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 Wm({numOfProducts:e=3}={}){const n=[ki({name:"Bronze",description:"Access to all members articles",monthlyPrice:wt({interval:"month",amount:700}),yearlyPrice:wt({interval:"year",amount:7e3}),numOfBenefits:2}),ki({name:"Silver",description:"Access to all members articles and weekly podcast",monthlyPrice:wt({interval:"month",amount:1200}),yearlyPrice:wt({interval:"year",amount:12e3}),numOfBenefits:3}),ki({name:"Friends of the Blueprint",description:"Get access to everything and lock in early adopter pricing for life + listen to my podcast",monthlyPrice:wt({interval:"month",amount:18e3}),yearlyPrice:wt({interval:"year",amount:17e3}),numOfBenefits:4})].slice(0,e),a=Vv({});return[...n,a]}function ki({type:e="paid",name:t="Basic",description:n="",id:a=`product_${Qe()}`,monthlyPrice:i=wt(),yearlyPrice:o=wt({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:Xv({numOfBenefits:r}),trial_days:s}}function Vv({name:e="Free tier",description:t="Free tier description",id:n=`product_${Qe()}`,numOfBenefits:a=2}){return{id:n,name:e,type:"free",description:t,benefits:Xv({numOfBenefits:a})}}function Xv({numOfBenefits:e}){const t=Qe();return[Ol({name:`Limited early adopter pricing #${t.substring(0,6)}`}),Ol({name:`Latest gear reviews #${t.substring(6,12)}`}),Ol({name:`Weekly email newsletter #${t.substring(12,18)}`}),Ol({name:`Listen to my podcast #${t.substring(18)}`})].slice(0,e)}function Ol({id:e=`benefit_${Qe()}`,name:t="Benefit"}){return{id:e,name:t}}function wt({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_${Qe()}`}={}){return{id:r,active:o,nickname:n,currency:i,amount:t,interval:e,description:a,stripe_price_id:`price_${Qe()}`,stripe_product_id:`prod_${Qe()}`,type:"recurring"}}function ua({id:e=`sub_${Qe()}`,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=S2,priceId:c=`price_${Qe()}`,startDate:u="2021-10-05T03:18:30.000Z",currentPeriodEnd:d="2022-10-05T03:18:30.000Z",cancelAtPeriodEnd:p=!1,trialEndAt:m=null,nextPayment:h=null,tier:k=null}={}){return{id:e,customer:{id:`cus_${Qe()}`,name:"Jamie",email:"jamie@example.com"},plan:{id:`price_${Qe()}`,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:h,tier:k,price:{id:`stripe_price_${Qe()}`,price_id:c,nickname:o,amount:i,interval:a,type:"recurring",currency:n,product:{id:`stripe_prod_${Qe()}`,product_id:`prod_${Qe()}`}}}}function Qv(){const e=Wm({numOfProducts:1}),t=e.map(a=>a.id);return Nl({products:e,portalPlans:["free","monthly","yearly"],portalProducts:t})}Qv();const E2=Nl({products:[ki({numOfBenefits:2,type:"free"})]}),S2=Uv({tierId:($v=E2.products[0])==null?void 0:$v.id});zt({status:"free"}),zt({status:"paid",paid:!0,subscriptions:[ua()]}),zt({status:"comped",paid:!0,subscriptions:[]}),zt({status:"comped",paid:!0,subscriptions:[ua({amount:0})]}),zt({status:"paid",paid:!0,subscriptions:[ua({amount:1500,startDate:"2019-05-01T11:42:40.000Z",currentPeriodEnd:"2021-06-05T11:42:40.000Z"})]}),Qv();const Dl=[Vv({name:"Free",description:"Free tier description which is actually a pretty long description",numOfBenefits:2}),ki({name:"The Blueprint",description:"",monthlyPrice:wt({interval:"month",amount:500}),yearlyPrice:wt({interval:"year",amount:5e3}),numOfBenefits:3}),ki({name:"Friends of the Blueprint Silver",description:"Access to all members articles and weekly podcast",monthlyPrice:wt({interval:"month",amount:1200}),yearlyPrice:wt({interval:"year",amount:11e3}),numOfBenefits:4})],vi=Nl({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:Dl,portalProducts:Dl.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}]}),Wv=Uv({tierId:(Zv=vi.products[1])==null?void 0:Zv.id}),Ai={free:zt({name:"Jamie Larson",email:"jamie@example.com",firstname:"Jamie",subscriptions:[],paid:!1,status:"free",avatarImage:"",subscribed:!0}),paid:zt({paid:!0,status:"paid",subscriptions:[ua({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:zt({paid:!0,status:"comped",subscriptions:[]}),complimentaryWithSubscription:zt({paid:!0,status:"comped",subscriptions:[ua({amount:0})]}),preview:zt({paid:!0,status:"paid",subscriptions:[ua({amount:1500,startDate:"2019-05-01T11:42:40.000Z",currentPeriodEnd:new Date().toISOString()})]})};function j2(){var n;if(!Dl||!Dl[1])return null;let e=(n=vi==null?void 0:vi.products)==null?void 0:n[1].monthlyPrice,t=zt({paid:!0,status:"paid",subscriptions:[ua({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:vi,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 T2({data:e,state:t}){return{page:e.page,popupNotification:null,lastPage:e.lastPage||null,pageData:e.pageData||t.pageData}}function z2({state:e}){return{showPopup:!e.showPopup}}function I2({data:e}){return{showPopup:!0,reloadOnPopupClose:!1,page:e.page,...e.pageQuery?{pageQuery:e.pageQuery}:{},...e.pageData?{pageData:e.pageData}:{}}}function F2({state:e}){return e.lastPage?{page:e.lastPage}:Gv({state:e})}function Gv({state:e}){return Ut(),{showPopup:!1,lastPage:null,pageQuery:"",popupNotification:null,page:e.page==="magiclink"?"":e.page}}function N2({data:e,state:t}){const{action:n="openNotification",status:a="success",autoHide:i=!0,closeable:o=!0,duration:r=2600,message:s=""}=e||{},c=Al({type:n,status:a,autoHide:i,closeable:o,duration:r,state:t,message:s});return{notification:c,notificationSequence:c.count}}function O2(){return{notification:null}}async function D2({api:e,state:t}){try{return await e.member.signout(),{action:"signout:success"}}catch{return{action:"signout:failed",popupNotification:le({type:"signout:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:g("Failed to log out, please try again")})}}}async function M2({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:le({type:"signin:failed",autoHide:!1,closeable:!0,state:n,status:"error",message:on(a,g("Failed to log in, please try again"))})}}}function R2({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 H2({data:e,api:t}){var a;const n=g("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:on((a=o.errors)==null?void 0:a[0],n)}}catch(i){return{action:"verifyOTC:failed",actionErrorMessage:on(i,n)}}}async function B2({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}=sa({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=on(a,g("Failed to sign up, please try again"));return{action:"signup:failed",popupNotification:le({type:"signup:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:i})}}}async function L2({data:e,state:t,api:n}){var a;try{let{email:i,name:o,giftToken:r}=e;if(o=o==null?void 0:o.trim(),t.member){await n.gift.redeem({token:r});const p=await n.member.sessionData(),m=Al({type:"giftRedeem",status:"success",autoHide:!0,closeable:!0,state:t,message:_k({member:p})});return Ut(),{action:"redeemGift:success",member:p,showPopup:!1,lastPage:null,pageQuery:"",popupNotification:null,notification:m,notificationSequence:m.count}}const s=await n.member.getIntegrityToken(),c=new URL(((a=t==null?void 0:t.site)==null?void 0:a.url)||window.location.href);c.search=new URLSearchParams({giftRedemption:"true"}).toString(),c.hash="";const{otc_ref:u,inboxLinks:d}=await n.member.sendMagicLink({email:(i||"").trim(),emailType:"subscribe",integrityToken:s,includeOTC:!0,redirect:c.href,giftToken:r,...o?{name:o}:{}});return{page:"magiclink",lastPage:"gift",...u?{otcRef:u}:{},inboxLinks:d,pageData:{...t.pageData||{},email:(i||"").trim(),redirect:c.href}}}catch(i){const o=Al({type:"giftRedeem",status:"error",autoHide:!1,closeable:!0,state:t,message:El(i)});return Ut(),{action:"redeemGift:failed",showPopup:!1,lastPage:null,pageQuery:"",popupNotification:null,notification:o,notificationSequence:o.count}}}async function Y2({data:e,state:t,api:n}){try{let{plan:a,offerId:i,tierId:o,cadence:r}=e;(!o||!r)&&({tierId:o,cadence:r}=sa({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:le({type:"checkoutPlan:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:g("Failed to process checkout, please try again")})}}}async function U2({state:e,api:t}){try{await t.member.continueGiftCheckout()}catch{return{action:"continueGiftSubscription:failed",popupNotification:le({type:"continueGiftSubscription:failed",autoHide:!1,closeable:!0,state:e,status:"error",message:g("Failed to process checkout, please try again")})}}}async function V2({data:e,state:t,api:n}){try{const{tierId:a,cadence:i}=e;return await n.member.checkoutGift({tierId:a,cadence:i}),{action:"checkoutGift:success"}}catch{return{action:"checkoutGift:failed",popupNotification:le({type:"checkoutGift:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:g("Failed to process checkout, please try again")})}}}async function X2({data:e,state:t,api:n}){try{const{plan:a,planId:i,subscriptionId:o,cancelAtPeriodEnd:r}=e,{tierId:s,cadence:c}=sa({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:le({type:d,autoHide:!0,closeable:!0,state:t,status:"success",message:g("Subscription plan updated successfully")}),page:"accountHome",member:u}}catch{return{action:"updateSubscription:failed",popupNotification:le({type:"updateSubscription:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:g("Failed to update subscription, please try again")})}}}async function Q2({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:le({type:"cancelSubscription:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:g("Failed to cancel subscription, please try again")})}}}async function W2({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:le({type:"continueSubscription:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:g("Failed to cancel subscription, please try again")})}}}async function G2({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:le({type:"applyOffer:success",autoHide:!0,closeable:!0,state:t,status:"success",message:"Offer applied successfully!"})}}catch{return{action:"applyOffer:failed",popupNotification:le({type:"applyOffer:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:"Failed to apply offer, please try again"})}}}async function J2({data:e,state:t,api:n}){try{await n.member.editBilling(e)}catch{return{action:"editBilling:failed",popupNotification:le({type:"editBilling:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:g("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:le({type:"manageBilling:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:g("Failed to open billing portal, please try again")})}}}async function q2(){return{popupNotification:null}}async function $2({data:e,state:t}){let{action:n,message:a=""}=e;return n=n||"showPopupNotification:success",{popupNotification:le({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:le({type:"updateNewsletter:failed",autoHide:!0,closeable:!0,state:t,status:"error",message:g("Failed to update newsletter settings")})}}}async function _2({state:e,api:t}){try{return await t.member.deleteSuppression(),{action:"removeEmailFromSuppressionList:success",popupNotification:le({type:"removeEmailFromSuppressionList:success",autoHide:!0,closeable:!0,state:e,status:"success",message:g("You have been successfully resubscribed")})}}catch{return{action:"removeEmailFromSuppressionList:failed",popupNotification:le({type:"removeEmailFromSuppressionList:failed",autoHide:!0,closeable:!0,state:e,status:"error",message:g("Your email has failed to resubscribe, please try again")})}}}async function e4({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:le({type:o,autoHide:!0,closeable:!0,state:t,status:"success",message:g("Email newsletter settings updated")})}}catch{return{action:"updateNewsletter:failed",popupNotification:le({type:"updateNewsletter:failed",autoHide:!0,closeable:!0,state:t,status:"error",message:g("Failed to update newsletter settings")})}}}async function t4({data:e,state:t,api:n}){const{email:a}=e,i=jT({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 n4({data:e,state:t,api:n}){var o;const a=(o=e==null?void 0:e.name)==null?void 0:o.trim();if(TT({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 a4({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 i4({data:e,state:t,api:n}){const[a,i]=await Promise.all([n4({data:e,state:t,api:n}),t4({data:e,state:t,api:n})]);if(a&&i){if(i.success)return{action:"updateProfile:success",...a.success?{member:a.member}:{},page:"accountHome",popupNotification:le({type:"updateProfile:success",autoHide:!0,closeable:!0,status:"success",state:t,message:g("Check your inbox to verify email update")})};const o=a.success?g("Failed to send verification email"):g("Failed to update account data");return{action:"updateProfile:failed",...a.success?{member:a.member}:{},popupNotification:le({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?g("Account details updated successfully"):g("Failed to update account details");return{action:o,...a.success?{member:a.member}:{},...a.success?{page:"accountHome"}:{},popupNotification:le({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=on(i.error,g("Failed to send verification email")):s=g("Check your inbox to verify email update"),{action:o,...i.success?{page:"accountHome"}:{},popupNotification:le({type:o,autoHide:i.success,closeable:!0,status:r,state:t,message:s})}}return{action:"updateProfile:success",page:"accountHome",popupNotification:le({type:"updateProfile:success",autoHide:!0,closeable:!0,status:"success",state:t,message:g("Account details updated successfully")})}}async function o4({data:{siteUrl:e},state:t}){const n=Il({siteUrl:e,apiUrl:"not-defined"}),{member:a}=t,i=window.location.href,o=Pk(),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 r4({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 s4({data:{recommendationId:e},api:t}){return t.recommendations.trackSubscribed({recommendationId:e}),{}}const l4={togglePopup:z2,openPopup:I2,closePopup:Gv,switchPage:T2,openNotification:N2,closeNotification:O2,back:F2,signout:D2,signin:M2,startSigninOTCFromCustomForm:R2,verifyOTC:H2,signup:B2,redeemGift:L2,updateSubscription:X2,cancelSubscription:Q2,continueSubscription:W2,applyOffer:G2,updateNewsletter:e4,updateProfile:i4,refreshMemberData:a4,clearPopupNotification:q2,editBilling:J2,manageBilling:K2,checkoutPlan:Y2,continueGiftSubscription:U2,checkoutGift:V2,updateNewsletterPreference:Z2,showPopupNotification:$2,removeEmailFromSuppressionList:_2,oneClickSubscribe:o4,trackRecommendationClicked:r4,trackRecommendationSubscribed:s4};async function c4({action:e,data:t,state:n,api:a}){const i=l4[e];return i?await i({data:t,state:n,api:a})||{}:{}}function Jv(e,t){e&&(e.innerText=t)}function u4(e,t,n){t.classList.add("error");const a=g("There was an error sending the email, please try again");Jv(n,on(e,a))}async function d4({event:e,form:t,errorEl:n,siteUrl:a,submitHandler:i,doAction:o,captureException:r}){var x,P;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,h=[],k=[],b=e.target.querySelectorAll("input[data-members-label]")||[];for(let E=0;E<b.length;++E)h.push(b[E].value);let f=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<f.length;++E)k.push({name:f[E].value});t.dataset.membersForm&&(m=t.dataset.membersForm);const y=m==="signin"&&((P=t==null?void 0:t.dataset)==null?void 0:P.membersOtc)==="true";t.classList.add("loading");const v=ci(),C={email:d,emailType:m,labels:h,name:p,autoRedirect:u==="true"};y&&(C.includeOTC=!0),v&&(C.urlHistory=v),f.length>0?C.newsletters=k:(e.target.querySelectorAll("input[type=checkbox][data-members-newsletter]")||[]).length>0&&(C.newsletters=[]);try{const F=await(await fetch(`${a}/members/api/integrity-token/`,{method:"GET"})).text(),S=await fetch(`${a}/members/api/send-magic-link/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...C,integrityToken:F})});if(t.addEventListener("submit",i),t.classList.remove("loading"),S.ok){t.classList.add("success");let T;if(y)try{T=await S.clone().json()}catch{T=void 0}const B=T==null?void 0:T.otc_ref;if(B&&typeof o=="function")try{o("startSigninOTCFromCustomForm",{email:(d||"").trim(),otcRef:B,inboxLinks:T==null?void 0:T.inboxLinks})}catch(Q){console.error(Q),r==null||r(Q)}}else{const T=await Tt.fromApiResponse(S),B=on(T,g("Failed to send magic link email"));Jv(n,B),t.classList.add("error")}}catch(E){u4(E,t,n)}}function m4({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=gT(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 h=o?{checkoutType:"upgrade"}:{},k=ci();return k&&(h.urlHistory=k),fetch(`${a}/members/api/session`,{credentials:"same-origin"}).then(function(b){return b.ok?b.text():null}).then(function(b){return fetch(`${a}/members/api/create-stripe-checkout-session/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...c,identity:b,successUrl:p,cancelUrl:m,metadata:h})}).then(function(f){if(!f.ok)throw new Error(g("Could not create Stripe checkout session"));return f.json()})}).then(function(b){return b.url?window.location.assign(b.url):window.Stripe(b.publicKey).redirectToCheckout({sessionId:b.sessionId}).then(function(y){if(y.error)throw new Error(y.error.message)})}).catch(function(b){console.error(b),t.addEventListener("click",r),t.classList.remove("loading"),n&&(n.innerText=b.message),t.classList.add("error")})}function p4({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){d4({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){m4({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 h(k){s.removeEventListener("click",h),k.preventDefault(),c&&(c.innerText=""),s.classList.add("loading"),fetch(`${e}/members/api/session`,{credentials:"same-origin"}).then(function(b){return b.ok?b.text():null}).then(function(b){return fetch(`${e}/members/api/create-stripe-update-session/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:b,successUrl:p,cancelUrl:m})}).then(function(f){if(!f.ok)throw new Error(g("Could not create Stripe checkout session"));return f.json()})}).then(function(b){return window.Stripe(b.publicKey).redirectToCheckout({sessionId:b.sessionId})}).then(function(b){if(b.error)throw new Error(g(b.error.message))}).catch(function(b){console.error(b),s.addEventListener("click",h),s.classList.remove("loading"),c&&(c.innerText=b.message),s.classList.add("error")})}s.addEventListener("click",h)}),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(h){return h.ok?h.text():null}).then(function(h){return fetch(`${e}/members/api/create-stripe-billing-portal-session/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:h,returnUrl:d})}).then(function(k){if(!k.ok)throw new Error(g("Could not create Stripe billing portal session"));return k.json()})}).then(function(h){return window.location.assign(h.url)}).catch(function(h){console.error(h),s.addEventListener("click",p),s.classList.remove("loading"),c&&(c.innerText=h.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=g("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=g("There was an error continuing your subscription, please try again.")))})}s.addEventListener("click",u)})}const Kv=e=>{try{return decodeURIComponent(e)}catch{return null}},h4={staleGiftRedemptionRequest:!0},f4={showPopup:!0,site:vi,member:Ai.free,page:"accountEmail",...j2(),pageData:Wv};function g4({site:e,children:t}){const{portal_sentry:n}=e||{};return n&&n.dsn?l.jsx(jd,{children:t}):l.jsx(l.Fragment,{children:t})}class y4 extends te.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(),p4({siteUrl:r,site:s.site,member:s.member,offers:s.offers,doAction:s.doAction,captureException:zs})}}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"&&!ul({site:this.state.site})){this.invalidateGiftRedemptionRequest(),Ut();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";rl.changeLanguage(m);const h={site:t,member:n,offers:a,page:i,lastPage:u,pageQuery:d,showPopup:o,pageData:p,popupNotification:r,notification:s,notificationSequence:c,dir:rl.dir()||"ltr",action:"init:success",initStatus:"success",locale:m};if(this.handleSignupQuery({site:t,pageQuery:d,member:n}),this.setState(h),this.hashHandler=()=>{this.updateStateForPreviewLinks()},window.addEventListener("hashchange",this.hashHandler,!1),!n){const k=document.querySelectorAll("[data-lexical-signup-form]");k.length>0&&k.forEach(b=>{b.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 ge(["dev"])&&!this.state.customSiteUrl?f4:ge(["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||Wv.tier.id}:c==="redemption_type"&&(a.redemption_type=u||"signup")}if(a.redemption_type==="retention"){const s=(r=(o=(i=Ai.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 h=m.toUpperCase();a.site.plans.currency=h,a.site.plans.currency_symbol=Ce(h),u=h}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}=tv({billingOnly:!0})||{};return["stripe:billing-update"].includes(t)?n==="success"?{showPopup:!0,popupNotification:le({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(!ul({site:t}))return Ut(),{};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){Ut();const o=Al({type:"giftRedemption:failed",status:"error",autoHide:!1,closeable:!0,state:this.state,message:El(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 k=a.get("gift_token"),b=a.get("gift_tier"),f=a.get("gift_cadence");if(Sl(["stripe","gift_token","gift_tier","gift_cadence"]),k)return{showPopup:!0,page:"giftSuccess",pageData:{token:k,tierId:b,cadence:f}}}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(kT({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\/?$/,h=/^\/feedback\/(\w+?)\/(\w+?)\/?$/;if(i&&h.test(i)){const[,k,b]=i.match(h),f=parseInt(b);if(f===1||f===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:k,score:f}}:{showPopup:!0,page:"signin",pageData:{redirect:t.url+`#/feedback/${k}/${f}/`}}}if(i&&d.test(i)){const[,k]=i.match(d),b=Kv(k);if(!b)return{};const f=this.startGiftRedemptionRequest(b),y=await this.fetchGiftRedemptionData({site:t,token:b});return this.isCurrentGiftRedemptionRequest(f)?y:h4}if(i&&m.test(i))return{showPopup:!0,page:"share"};if(i&&p.test(i)){const[,k]=i.match(p),{page:b,pageQuery:f,pageData:y}=this.getPageFromLinkPath(k,t)||{};if(!n&&b&&Lv({page:b}))return{showPopup:!0,page:"signin",pageData:{redirect:t.url+`#/portal/${k}/`}};if(b==="gift"&&!ul({site:t}))return Ut(),{};const v=["accountPlan","accountProfile"].includes(b)?"accountHome":null;return{showPopup:!(["monthly","yearly"].includes(f)||s.test(f)||c.test(f)||u.test(f)),...b?{page:b}:{},...f?{pageQuery:f}:{},...y?{pageData:y}:{},...v?{lastPage:v}:{}}}return{}}fetchPreviewData(){const[,t]=window.location.hash.substr(1).split("?");if(ge(["preview"])){let n={};return ge(["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||Il({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(ge(["dev","test"],{customSiteUrl:n}))return{};throw o}}setupSentry({site:t}){if(ge(["test"]))return null;const{portal_sentry:n,portal_version:a,version:i}=t,r=`portal@2.68.33|ghost@${i}`;n&&n.dsn&&vP({dsn:n.dsn,environment:n.env||"development",release:r,beforeSend:s=>cT({event:s})?s:null,allowUrls:[/https?:\/\/((www)\.)?unpkg\.com\/@tryghost\/portal/]})}setupFirstPromoter({site:t,member:n}){if(ge(["test"]))return null;const a=PT({site:t});let i=om({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),BT({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 c4({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=le({type:`${t}:failed`,autoHide:!0,closeable:!0,status:"error",state:this.state,meta:{error:a}});this.setState({action:`${t}:failed`,actionErrorMessage:on(a,g("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(Ut(),!Vt({member:a})||Nn({member:a}))try{const o=await this.GhostApi.site.offer({offerId:n}),r=o==null?void 0:o.offers[0];if(!r||!r.tier||lm({offer:r})||!NT({site:t,offer:r}))return;if(i)this.dispatchAction("openPopup",{page:"offer",pageData:o==null?void 0:o.offers[0]});else{const s=Dn({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}=sa({site:t,priceId:c.id});this.dispatchAction("checkoutPlan",{plan:c.id,offerId:n,tierId:u,cadence:d})}else{const{tierId:u,cadence:d}=sa({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}Nk({site:t,pageQuery:n})&&(o=Nk({site:t,pageQuery:n}));const r=yT({site:t,priceId:o});if(n&&n!=="free"){Ut();const s=(r==null?void 0:r.id)||o;s!=="free"&&this.dispatchAction("openPopup",{page:"loading"});const{tierId:c,cadence:u}=sa({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=Kv(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 Az(t)}getRetentionPreviewMember({site:t,offers:n}){var u,d,p;const a=(n||[]).find(m=>lm({offer:m})),i=(u=a==null?void 0:a.tier)==null?void 0:u.id,o=i?Dn({site:t,productId:i}):null,r=o?a.cadence==="year"?o.yearlyPrice:o.monthlyPrice:null,s=Ai.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=Xt({site:t})||!rn({site:t})?"signin":"signup";n=a?"accountHome":i}return Vm({page:n})}getContextMember({site:t,page:n,member:a,offers:i,pageData:o,customSiteUrl:r}){return ge(["dev","preview"],{customSiteUrl:r})?Lv({page:n})||k2({page:n})?ge(["dev"],{customSiteUrl:r})?a||Ai.free:ge(["preview"])?n==="accountPlan"&&(o==null?void 0:o.action)==="cancel"?this.getRetentionPreviewMember({site:t,offers:i}):Ai.preview:Ai.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:h,dir:k,scrollbarWidth:b,otcRef:f,inboxLinks:y}=this.state,v=this.getContextPage({site:t,page:r,member:n}),C=this.getContextMember({site:t,page:v,member:n,offers:a,pageData:d,customSiteUrl:h});return{api:this.GhostApi,site:t,offers:a,action:i,actionErrorMessage:o,brandColor:this.getAccentColor(),page:v,pageQuery:u,pageData:d,member:C,lastPage:s,showPopup:c,popupNotification:p,notification:m,customSiteUrl:h,dir:k,scrollbarWidth:b,otcRef:f,inboxLinks:y,doAction:(x,P)=>this.dispatchAction(x,P)}}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(g4,{site:this.state.site,children:l.jsxs(R.Provider,{value:this.getContextFromState(),children:[l.jsx(Qm,{}),l.jsx(um,{}),l.jsx(km,{})]})}):null}}const qv="ghost-portal-root";function b4(){const e=document.createElement("div");e.id=qv,e.setAttribute("data-testid","portal-root"),document.body.appendChild(e)}function k4(){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 v4(){const e=new URL(window.location.href);e.searchParams.get("token")&&(e.searchParams.delete("token"),window.history.replaceState({},document.title,e.href))}function A4(){const{siteUrl:e,apiKey:t,apiUrl:n,siteI18nEnabled:a,locale:i}=k4(),o=e||window.location.origin;b4(),v4(),Tx.render(l.jsx(te.StrictMode,{children:l.jsx(y4,{siteUrl:o,customSiteUrl:e,apiKey:t,apiUrl:n,siteI18nEnabled:a,locale:i})}),document.getElementById(qv))}A4()});
|
|
4510
|
+
`),a=[];return e&&a.push(`subject=${encodeURIComponent(e)}`),n&&a.push(`body=${encodeURIComponent(n)}`),`mailto:${a.length?`?${a.join("&")}`:""}`},c2=({shareTitle:e,shareUrl:t})=>or("https://www.linkedin.com/shareArticle",{mini:"true",url:t,title:e}),u2=()=>{const e=s2(),t=e.document,n=e.location,a=(k,b="content")=>{var f;return((f=t.querySelector(k))==null?void 0:f[b])||""},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(),h={twitter:or("https://twitter.com/intent/tweet",{url:i,text:o}),facebook:or("https://www.facebook.com/sharer/sharer.php",{u:i}),email:l2({shareTitle:o,shareUrl:i}),threads:or("https://www.threads.net/intent/post",{text:m}),linkedin:c2({shareTitle:o,shareUrl:i}),bluesky:or("https://bsky.app/intent/compose",{text:m})};return{shareUrl:i,shareTitle:o,shareExcerpt:r,shareImage:s,shareFavicon:c,shareSiteName:p,shareAuthor:d,socialLinks:h}},d2=()=>{const[e]=A.useState(u2);return e},m2=e=>A.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 -3.268 64 68.414",width:2232,height:2500,...e},A.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"})),p2=e=>A.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},A.createElement("circle",{cx:12,cy:12,r:1}),A.createElement("circle",{cx:19,cy:12,r:1}),A.createElement("circle",{cx:5,cy:12,r:1})),h2=e=>A.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},A.createElement("defs",{id:"defs13"},A.createElement("clipPath",{clipPathUnits:"userSpaceOnUse",id:"clipPath25"},A.createElement("path",{d:"M 0,700 H 700 V 0 H 0 Z",id:"path23"}))),A.createElement("g",{id:"g17",transform:"matrix(1.3333333,0,0,-1.3333333,-133.33333,799.99999)"},A.createElement("g",{id:"g19"},A.createElement("g",{id:"g21",clipPath:"url(#clipPath25)"},A.createElement("g",{id:"g27",transform:"translate(600,350)"},A.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"})),A.createElement("g",{id:"g31",transform:"translate(447.9175,273.6036)"},A.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"})))))),f2=e=>A.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},A.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"}),A.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"})),g2=e=>A.createElement("svg",{viewBox:"0 5 2490 2490.0000000000005",xmlns:"http://www.w3.org/2000/svg",width:2500,height:2495,...e},A.createElement("path",{d:"M185.2 313.1H2252V2291H185.2z",fill:"#fff"}),A.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"}),A.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"})),y2=e=>A.createElement("svg",{width:18,height:18,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},A.createElement("g",{clipPath:"url(#clip0_351_18008)"},A.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"})),A.createElement("defs",null,A.createElement("clipPath",{id:"clip0_351_18008"},A.createElement("rect",{width:17,height:17,fill:"white",transform:"translate(0.5 0.5)"})))),b2=e=>A.createElement("svg",{viewBox:"0 0 1200 1226.37",xmlns:"http://www.w3.org/2000/svg",width:2446,height:2500,...e},A.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"})),Um={signin:Bm,signup:Fm,accountHome:Lm,accountPlan:wm,accountProfile:Ym,accountEmail:_I,signupNewsletter:Cm,unsubscribe:n2,magiclink:Dm,loading:yi,offer:Rm,feedback:Zz,emailSuppressed:a2,emailSuppressionFAQ:i2,emailReceivingFAQ:o2,support:r2,supportSuccess:iI,supportError:Hm,recommendations:AI,gift:Hz,giftRedemption:sI,giftSuccess:pI,share:()=>{const[e,t]=A.useState(!1),[n,a]=A.useState(!1),i=A.useRef(),o=A.useRef(null),{shareUrl:r,shareTitle:s,shareExcerpt:c,shareImage:u,shareFavicon:d,shareSiteName:p,shareAuthor:m,socialLinks:h}=d2();A.useEffect(()=>()=>{clearTimeout(i.current)},[]),A.useEffect(()=>{var x;if(!n)return;const y=((x=o.current)==null?void 0:x.ownerDocument)||document,v=P=>{o.current&&!o.current.contains(P.target)&&(P.stopPropagation(),P.preventDefault(),a(!1))},C=P=>{P.key==="Escape"&&a(!1)};return y.addEventListener("click",v,!0),y.addEventListener("keydown",C),()=>{y.removeEventListener("click",v,!0),y.removeEventListener("keydown",C)}},[n]);const k=async()=>{await Nv(r)&&(t(!0),clearTimeout(i.current),i.current=setTimeout(()=>{t(!1)},2e3))},b=()=>{a(y=>!y)},f=()=>{a(!1)};return l.jsxs("div",{className:"gh-portal-content gh-portal-share",children:[l.jsx(he,{}),l.jsx("div",{className:"gh-portal-share-header",children:l.jsx("h1",{className:"gh-portal-main-title",children:g("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}),p&&m&&l.jsx("span",{className:"gh-portal-share-preview-separator","aria-hidden":"true",children:"|"}),m&&l.jsx("span",{className:"gh-portal-share-preview-author",children: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:k,"aria-label":g(e?"Copied":"Copy link"),title:g(e?"Copied":"Copy link"),children:[e?l.jsx("span",{className:"gh-portal-share-icon copied","aria-hidden":"true",children:l.jsx(ca,{})}):l.jsx("span",{className:"gh-portal-share-icon","aria-hidden":"true",children:l.jsx(f2,{})}),l.jsx("span",{className:"gh-portal-share-label",children:g(e?"Copied":"Copy link")})]}),l.jsx("a",{className:"gh-portal-btn gh-portal-share-action twitter",href:h.twitter,target:"_blank",rel:"noopener noreferrer","aria-label":g("X (Twitter)"),title:g("X (Twitter)"),children:l.jsx("span",{className:"gh-portal-share-icon x","aria-hidden":"true",children:l.jsx(b2,{})})}),l.jsx("a",{className:"gh-portal-btn gh-portal-share-action linkedin",href:h.linkedin,target:"_blank",rel:"noopener noreferrer","aria-label":g("LinkedIn"),title:g("LinkedIn"),children:l.jsx("span",{className:"gh-portal-share-icon","aria-hidden":"true",children:l.jsx(g2,{})})}),l.jsx("a",{className:"gh-portal-btn gh-portal-share-action email",href:h.email,target:"_blank",rel:"noopener noreferrer","aria-label":g("Email"),title:g("Email"),children:l.jsx("span",{className:"gh-portal-share-icon","aria-hidden":"true",children:l.jsx(Nm,{})})}),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:b,"aria-label":g("More options"),title:g("More options"),"aria-haspopup":"menu","aria-expanded":n,children:l.jsx("span",{className:"gh-portal-share-icon","aria-hidden":"true",children:l.jsx(p2,{})})}),n&&l.jsxs("div",{className:"gh-portal-share-more-menu",role:"menu","aria-label":g("More options"),children:[l.jsxs("a",{className:"gh-portal-share-more-item",href:h.facebook,target:"_blank",rel:"noopener noreferrer",role:"menuitem",onClick:f,children:[l.jsx("span",{className:"gh-portal-share-more-item-icon","aria-hidden":"true",children:l.jsx(h2,{})}),l.jsx("span",{children:g("Facebook")})]}),l.jsxs("a",{className:"gh-portal-share-more-item",href:h.threads,target:"_blank",rel:"noopener noreferrer",role:"menuitem",onClick:f,children:[l.jsx("span",{className:"gh-portal-share-more-item-icon","aria-hidden":"true",children:l.jsx(y2,{})}),l.jsx("span",{children:g("Threads")})]}),l.jsxs("a",{className:"gh-portal-share-more-item",href:h.bluesky,target:"_blank",rel:"noopener noreferrer",role:"menuitem",onClick:f,children:[l.jsx("span",{className:"gh-portal-share-more-item-icon","aria-hidden":"true",children:l.jsx(m2,{})}),l.jsx("span",{children:g("Bluesky")})]})]})]})]})]})}},Vm=function({page:e}){return Object.keys(Um).includes(e)?e:"signup"},Lv=function({page:e}){return e.includes("account")},k2=function({page:e}){return e.includes("offer")},v2=e=>A.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},A.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"})),rp=class rp extends te.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(v2,{}),"Powered by Ghost"]})}};rp.contextType=R;let Fl=rp;const Yv=()=>({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 A2({message:e}){return aa()?l.jsx("div",{className:"gh-portal-cookiebanner",children:e}):null}const sp=class sp extends te.Component{componentDidMount(){this.node&&!ge(["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&&ge(["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;ge(["preview"])||a&&n==="magiclink"||n==="giftRedemption"||n==="giftSuccess"||t.target===t.currentTarget&&this.context.doAction("closePopup")}renderActivePage(){const{page:t}=this.context;Vm({page:t});const n=Um[t];return l.jsx(n,{})}renderPopupNotification(){const{popupNotification:t}=this.context;return!t||!t.type?null:l.jsx(Mm,{})}sendPortalPreviewReadyEvent(){window.self!==window.parent&&window.parent.postMessage({type:"portal-preview-ready",payload:{}},"*")}render(){const{page:t,pageQuery:n,site:a,customSiteUrl:i,lastPage:o}=this.context,s=fl({site:a,pageQuery:n}).length;Vm({page:t});const u={...Yv().page[t]};let d="",p="regular",m="",h=t;switch(t){case"signup":m="Cookies must be enabled in your browser to sign up.";break;case"signin":m="Cookies must be enabled in your browser to sign in.";break;case"accountHome":h="account-home";break;case"accountProfile":h="account-profile";break;case"accountPlan":h="account-plan";break;default:m="Cookies must be enabled in your browser.",h=t;break}s>1&&!Xt({site:a})&&rn({site:a,pageQuery:n})&&t==="signup"&&(h+=" full-size",p="full"),(t==="gift"||t==="giftSuccess"||t==="giftRedemption")&&(h+=" full-size",p="full"),t==="magiclink"&&o==="gift"&&(h+=" full-size giftRedemption",p="full");const k=Qo({site:a});(k&&s>2||!k&&s>1)&&t==="accountPlan"&&(h+=" full-size",p="full"),(t==="emailSuppressionFAQ"||t==="emailReceivingFAQ")&&(h+=" large-size");let b="gh-portal-popup-container";ge(["preview"])&&(h+=" preview"),ge(["preview"],{customSiteUrl:i})&&!a.disableBackground&&(b+=" preview"),ge(["dev"])&&(b+=" dev");const f=`${b} ${d} ${h}`,y=t==="gift"||t==="giftSuccess"||t==="giftRedemption"||t==="magiclink"&&o==="gift";return this.sendPortalPreviewReadyEvent(),l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"gh-portal-popup-wrapper "+h,onClick:v=>this.handlePopupClose(v),children:[this.renderPopupNotification(),l.jsxs("div",{className:f,style:u,ref:v=>this.node=v,tabIndex:-1,children:[l.jsx(A2,{message:m}),this.renderActivePage(),p==="full"&&!y?l.jsx("div",{className:"gh-portal-powered inside "+(ge(["preview"])?"hidden ":"")+h,children:l.jsx(Fl,{})}):""]})]}),t!=="share"&&!y&&l.jsx("div",{className:"gh-portal-powered outside "+(ge(["preview"])?"hidden ":"")+h,children:l.jsx(Fl,{})})]})}};sp.contextType=R;let Xm=sp;const lp=class lp extends te.Component{constructor(t){super(t),this.state={height:null}}renderCurrentPage(t){const n=Um[t];return l.jsx(n,{})}onHeightChange(t){this.setState({height:t})}handlePopupClose(t){t.preventDefault();const{page:n}=this.context;n==="giftRedemption"||n==="giftSuccess"||t.target===t.currentTarget&&this.context.doAction("closePopup")}renderFrameStyles(){const{site:t,brandColor:n}=this.context,a=PI({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=Yv(),o=window.innerWidth<480,r={...i.frame.common};let s="gh-portal-popup-background";return ge(["preview"])&&(i.modalContainer.zIndex="3999997"),ge(["preview"],{customSiteUrl:a})&&!n.disableBackground&&(s+=" preview"),ge(["dev"])&&(s+=" dev"),l.jsx("div",{style:i.modalContainer,children:l.jsxs($d,{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(Xm,{isMobile:o})]})})}render(){const{showPopup:t}=this.context;return t?this.renderFrameContainer():null}};lp.contextType=R;let Qm=lp;Nl({products:Wm({numOfProducts:1})});function Qe(){return(new Date().getTime()/1e3|0).toString(16)+"xxxxxxxxxxxxxxxx".replace(/[x]/g,function(){return(Math.random()*16|0).toString(16)}).toLowerCase()}function w2(){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 Nl({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=Wm({numOfProducts:1}),portalProducts:s=r.map(B=>B.id),accentColor:c="#45C32E",portalPlans:u=["free","monthly","yearly"],membersSignupAccess:d="all",freePriceName:p="Free",freePriceDescription:m="Free preview",isStripeConfigured:h=!0,portalButton:k=!0,portalName:b=!0,portalButtonIcon:f="icon-1",portalButtonSignupText:y="Subscribe now",portalButtonStyle:v="icon-and-text",membersSupportAddress:C="support@example.com",editorDefaultEmailRecipients:x="visibility",newsletters:P=[],posts:E=x2(),commentsEnabled:F,recommendations:S=[],recommendationsEnabled:T}={}){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:h,portal_button:k,portal_name:b,portal_plans:u,portal_button_icon:f,portal_button_signup_text:y,portal_button_style:v,members_support_address:C,comments_enabled:F!=="off",newsletters:P,recommendations:S,recommendations_enabled:!!T,editor_default_email_recipients:x,posts:E}}function Uv({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:h="Basic",redemptionType:k="signup"}={}){return{id:`offer_${Qe()}`,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:h},redemption_type:k}}function zt({name:e="Jamie Larson",email:t="jamie@example.com",firstname:n="Jamie",subscriptions:a=[],paid:i=!1,status:o,avatarImage:r="",subscribed:s=!0,email_suppression:c={suppressed:!1,info:null},newsletters:u=[]}={}){const d={uuid:w2(),email:t,name:e,firstname:n,paid:i,subscribed:s,avatar_image:r,subscriptions:a,email_suppression:c,newsletters:u};return o!==void 0?d.status=o:i?d.status="paid":d.status="free",d}function x2({numOfPosts:e=3}={}){const t=[];for(let n=0;n<e;n++)t.push(C2({title:`Post ${n+1}`,slug:`post-${n+1}`}));return t.slice(0,e)}function C2({id:e=`post_${Qe()}`,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 Wm({numOfProducts:e=3}={}){const n=[ki({name:"Bronze",description:"Access to all members articles",monthlyPrice:wt({interval:"month",amount:700}),yearlyPrice:wt({interval:"year",amount:7e3}),numOfBenefits:2}),ki({name:"Silver",description:"Access to all members articles and weekly podcast",monthlyPrice:wt({interval:"month",amount:1200}),yearlyPrice:wt({interval:"year",amount:12e3}),numOfBenefits:3}),ki({name:"Friends of the Blueprint",description:"Get access to everything and lock in early adopter pricing for life + listen to my podcast",monthlyPrice:wt({interval:"month",amount:18e3}),yearlyPrice:wt({interval:"year",amount:17e3}),numOfBenefits:4})].slice(0,e),a=Vv({});return[...n,a]}function ki({type:e="paid",name:t="Basic",description:n="",id:a=`product_${Qe()}`,monthlyPrice:i=wt(),yearlyPrice:o=wt({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:Xv({numOfBenefits:r}),trial_days:s}}function Vv({name:e="Free tier",description:t="Free tier description",id:n=`product_${Qe()}`,numOfBenefits:a=2}){return{id:n,name:e,type:"free",description:t,benefits:Xv({numOfBenefits:a})}}function Xv({numOfBenefits:e}){const t=Qe();return[Ol({name:`Limited early adopter pricing #${t.substring(0,6)}`}),Ol({name:`Latest gear reviews #${t.substring(6,12)}`}),Ol({name:`Weekly email newsletter #${t.substring(12,18)}`}),Ol({name:`Listen to my podcast #${t.substring(18)}`})].slice(0,e)}function Ol({id:e=`benefit_${Qe()}`,name:t="Benefit"}){return{id:e,name:t}}function wt({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_${Qe()}`}={}){return{id:r,active:o,nickname:n,currency:i,amount:t,interval:e,description:a,stripe_price_id:`price_${Qe()}`,stripe_product_id:`prod_${Qe()}`,type:"recurring"}}function ua({id:e=`sub_${Qe()}`,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=S2,priceId:c=`price_${Qe()}`,startDate:u="2021-10-05T03:18:30.000Z",currentPeriodEnd:d="2022-10-05T03:18:30.000Z",cancelAtPeriodEnd:p=!1,trialEndAt:m=null,nextPayment:h=null,tier:k=null}={}){return{id:e,customer:{id:`cus_${Qe()}`,name:"Jamie",email:"jamie@example.com"},plan:{id:`price_${Qe()}`,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:h,tier:k,price:{id:`stripe_price_${Qe()}`,price_id:c,nickname:o,amount:i,interval:a,type:"recurring",currency:n,product:{id:`stripe_prod_${Qe()}`,product_id:`prod_${Qe()}`}}}}function Qv(){const e=Wm({numOfProducts:1}),t=e.map(a=>a.id);return Nl({products:e,portalPlans:["free","monthly","yearly"],portalProducts:t})}Qv();const E2=Nl({products:[ki({numOfBenefits:2,type:"free"})]}),S2=Uv({tierId:($v=E2.products[0])==null?void 0:$v.id});zt({status:"free"}),zt({status:"paid",paid:!0,subscriptions:[ua()]}),zt({status:"comped",paid:!0,subscriptions:[]}),zt({status:"comped",paid:!0,subscriptions:[ua({amount:0})]}),zt({status:"paid",paid:!0,subscriptions:[ua({amount:1500,startDate:"2019-05-01T11:42:40.000Z",currentPeriodEnd:"2021-06-05T11:42:40.000Z"})]}),Qv();const Dl=[Vv({name:"Free",description:"Free tier description which is actually a pretty long description",numOfBenefits:2}),ki({name:"The Blueprint",description:"",monthlyPrice:wt({interval:"month",amount:500}),yearlyPrice:wt({interval:"year",amount:5e3}),numOfBenefits:3}),ki({name:"Friends of the Blueprint Silver",description:"Access to all members articles and weekly podcast",monthlyPrice:wt({interval:"month",amount:1200}),yearlyPrice:wt({interval:"year",amount:11e3}),numOfBenefits:4})],vi=Nl({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:Dl,portalProducts:Dl.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}]}),Wv=Uv({tierId:(Zv=vi.products[1])==null?void 0:Zv.id}),Ai={free:zt({name:"Jamie Larson",email:"jamie@example.com",firstname:"Jamie",subscriptions:[],paid:!1,status:"free",avatarImage:"",subscribed:!0}),paid:zt({paid:!0,status:"paid",subscriptions:[ua({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:zt({paid:!0,status:"comped",subscriptions:[]}),complimentaryWithSubscription:zt({paid:!0,status:"comped",subscriptions:[ua({amount:0})]}),preview:zt({paid:!0,status:"paid",subscriptions:[ua({amount:1500,startDate:"2019-05-01T11:42:40.000Z",currentPeriodEnd:new Date().toISOString()})]})};function j2(){var n;if(!Dl||!Dl[1])return null;let e=(n=vi==null?void 0:vi.products)==null?void 0:n[1].monthlyPrice,t=zt({paid:!0,status:"paid",subscriptions:[ua({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:vi,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 T2({data:e,state:t}){return{page:e.page,popupNotification:null,lastPage:e.lastPage||null,pageData:e.pageData||t.pageData}}function z2({state:e}){return{showPopup:!e.showPopup}}function I2({data:e}){return{showPopup:!0,reloadOnPopupClose:!1,page:e.page,...e.pageQuery?{pageQuery:e.pageQuery}:{},...e.pageData?{pageData:e.pageData}:{}}}function F2({state:e}){return e.lastPage?{page:e.lastPage}:Gv({state:e})}function Gv({state:e}){return Ut(),{showPopup:!1,lastPage:null,pageQuery:"",popupNotification:null,page:e.page==="magiclink"?"":e.page}}function N2({data:e,state:t}){const{action:n="openNotification",status:a="success",autoHide:i=!0,closeable:o=!0,duration:r=2600,message:s=""}=e||{},c=Al({type:n,status:a,autoHide:i,closeable:o,duration:r,state:t,message:s});return{notification:c,notificationSequence:c.count}}function O2(){return{notification:null}}async function D2({api:e,state:t}){try{return await e.member.signout(),{action:"signout:success"}}catch{return{action:"signout:failed",popupNotification:le({type:"signout:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:g("Failed to log out, please try again")})}}}async function M2({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:le({type:"signin:failed",autoHide:!1,closeable:!0,state:n,status:"error",message:on(a,g("Failed to log in, please try again"))})}}}function R2({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 H2({data:e,api:t}){var a;const n=g("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:on((a=o.errors)==null?void 0:a[0],n)}}catch(i){return{action:"verifyOTC:failed",actionErrorMessage:on(i,n)}}}async function B2({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}=sa({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=on(a,g("Failed to sign up, please try again"));return{action:"signup:failed",popupNotification:le({type:"signup:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:i})}}}async function L2({data:e,state:t,api:n}){var a;try{let{email:i,name:o,giftToken:r}=e;if(o=o==null?void 0:o.trim(),t.member){await n.gift.redeem({token:r});const p=await n.member.sessionData(),m=Al({type:"giftRedeem",status:"success",autoHide:!0,closeable:!0,state:t,message:_k({member:p})});return Ut(),{action:"redeemGift:success",member:p,showPopup:!1,lastPage:null,pageQuery:"",popupNotification:null,notification:m,notificationSequence:m.count}}const s=await n.member.getIntegrityToken(),c=new URL(((a=t==null?void 0:t.site)==null?void 0:a.url)||window.location.href);c.search=new URLSearchParams({giftRedemption:"true"}).toString(),c.hash="";const{otc_ref:u,inboxLinks:d}=await n.member.sendMagicLink({email:(i||"").trim(),emailType:"subscribe",integrityToken:s,includeOTC:!0,redirect:c.href,giftToken:r,...o?{name:o}:{}});return{page:"magiclink",lastPage:"gift",...u?{otcRef:u}:{},inboxLinks:d,pageData:{...t.pageData||{},email:(i||"").trim(),redirect:c.href}}}catch(i){const o=Al({type:"giftRedeem",status:"error",autoHide:!1,closeable:!0,state:t,message:El(i)});return Ut(),{action:"redeemGift:failed",showPopup:!1,lastPage:null,pageQuery:"",popupNotification:null,notification:o,notificationSequence:o.count}}}async function Y2({data:e,state:t,api:n}){try{let{plan:a,offerId:i,tierId:o,cadence:r}=e;(!o||!r)&&({tierId:o,cadence:r}=sa({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:le({type:"checkoutPlan:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:g("Failed to process checkout, please try again")})}}}async function U2({state:e,api:t}){try{await t.member.continueGiftCheckout()}catch{return{action:"continueGiftSubscription:failed",popupNotification:le({type:"continueGiftSubscription:failed",autoHide:!1,closeable:!0,state:e,status:"error",message:g("Failed to process checkout, please try again")})}}}async function V2({data:e,state:t,api:n}){try{const{tierId:a,cadence:i}=e;return await n.member.checkoutGift({tierId:a,cadence:i}),{action:"checkoutGift:success"}}catch{return{action:"checkoutGift:failed",popupNotification:le({type:"checkoutGift:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:g("Failed to process checkout, please try again")})}}}async function X2({data:e,state:t,api:n}){try{const{plan:a,planId:i,subscriptionId:o,cancelAtPeriodEnd:r}=e,{tierId:s,cadence:c}=sa({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:le({type:d,autoHide:!0,closeable:!0,state:t,status:"success",message:g("Subscription plan updated successfully")}),page:"accountHome",member:u}}catch{return{action:"updateSubscription:failed",popupNotification:le({type:"updateSubscription:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:g("Failed to update subscription, please try again")})}}}async function Q2({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:le({type:"cancelSubscription:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:g("Failed to cancel subscription, please try again")})}}}async function W2({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:le({type:"continueSubscription:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:g("Failed to cancel subscription, please try again")})}}}async function G2({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:le({type:"applyOffer:success",autoHide:!0,closeable:!0,state:t,status:"success",message:"Offer applied successfully!"})}}catch{return{action:"applyOffer:failed",popupNotification:le({type:"applyOffer:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:"Failed to apply offer, please try again"})}}}async function J2({data:e,state:t,api:n}){try{await n.member.editBilling(e)}catch{return{action:"editBilling:failed",popupNotification:le({type:"editBilling:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:g("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:le({type:"manageBilling:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:g("Failed to open billing portal, please try again")})}}}async function q2(){return{popupNotification:null}}async function $2({data:e,state:t}){let{action:n,message:a=""}=e;return n=n||"showPopupNotification:success",{popupNotification:le({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:le({type:"updateNewsletter:failed",autoHide:!0,closeable:!0,state:t,status:"error",message:g("Failed to update newsletter settings")})}}}async function _2({state:e,api:t}){try{return await t.member.deleteSuppression(),{action:"removeEmailFromSuppressionList:success",popupNotification:le({type:"removeEmailFromSuppressionList:success",autoHide:!0,closeable:!0,state:e,status:"success",message:g("You have been successfully resubscribed")})}}catch{return{action:"removeEmailFromSuppressionList:failed",popupNotification:le({type:"removeEmailFromSuppressionList:failed",autoHide:!0,closeable:!0,state:e,status:"error",message:g("Your email has failed to resubscribe, please try again")})}}}async function e4({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:le({type:o,autoHide:!0,closeable:!0,state:t,status:"success",message:g("Email newsletter settings updated")})}}catch{return{action:"updateNewsletter:failed",popupNotification:le({type:"updateNewsletter:failed",autoHide:!0,closeable:!0,state:t,status:"error",message:g("Failed to update newsletter settings")})}}}async function t4({data:e,state:t,api:n}){const{email:a}=e,i=jT({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 n4({data:e,state:t,api:n}){var o;const a=(o=e==null?void 0:e.name)==null?void 0:o.trim();if(TT({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 a4({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 i4({data:e,state:t,api:n}){const[a,i]=await Promise.all([n4({data:e,state:t,api:n}),t4({data:e,state:t,api:n})]);if(a&&i){if(i.success)return{action:"updateProfile:success",...a.success?{member:a.member}:{},page:"accountHome",popupNotification:le({type:"updateProfile:success",autoHide:!0,closeable:!0,status:"success",state:t,message:g("Check your inbox to verify email update")})};const o=a.success?g("Failed to send verification email"):g("Failed to update account data");return{action:"updateProfile:failed",...a.success?{member:a.member}:{},popupNotification:le({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?g("Account details updated successfully"):g("Failed to update account details");return{action:o,...a.success?{member:a.member}:{},...a.success?{page:"accountHome"}:{},popupNotification:le({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=on(i.error,g("Failed to send verification email")):s=g("Check your inbox to verify email update"),{action:o,...i.success?{page:"accountHome"}:{},popupNotification:le({type:o,autoHide:i.success,closeable:!0,status:r,state:t,message:s})}}return{action:"updateProfile:success",page:"accountHome",popupNotification:le({type:"updateProfile:success",autoHide:!0,closeable:!0,status:"success",state:t,message:g("Account details updated successfully")})}}async function o4({data:{siteUrl:e},state:t}){const n=Il({siteUrl:e,apiUrl:"not-defined"}),{member:a}=t,i=window.location.href,o=Pk(),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 r4({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 s4({data:{recommendationId:e},api:t}){return t.recommendations.trackSubscribed({recommendationId:e}),{}}const l4={togglePopup:z2,openPopup:I2,closePopup:Gv,switchPage:T2,openNotification:N2,closeNotification:O2,back:F2,signout:D2,signin:M2,startSigninOTCFromCustomForm:R2,verifyOTC:H2,signup:B2,redeemGift:L2,updateSubscription:X2,cancelSubscription:Q2,continueSubscription:W2,applyOffer:G2,updateNewsletter:e4,updateProfile:i4,refreshMemberData:a4,clearPopupNotification:q2,editBilling:J2,manageBilling:K2,checkoutPlan:Y2,continueGiftSubscription:U2,checkoutGift:V2,updateNewsletterPreference:Z2,showPopupNotification:$2,removeEmailFromSuppressionList:_2,oneClickSubscribe:o4,trackRecommendationClicked:r4,trackRecommendationSubscribed:s4};async function c4({action:e,data:t,state:n,api:a}){const i=l4[e];return i?await i({data:t,state:n,api:a})||{}:{}}function Jv(e,t){e&&(e.innerText=t)}function u4(e,t,n){t.classList.add("error");const a=g("There was an error sending the email, please try again");Jv(n,on(e,a))}async function d4({event:e,form:t,errorEl:n,siteUrl:a,submitHandler:i,doAction:o,captureException:r}){var x,P;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,h=[],k=[],b=e.target.querySelectorAll("input[data-members-label]")||[];for(let E=0;E<b.length;++E)h.push(b[E].value);let f=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<f.length;++E)k.push({name:f[E].value});t.dataset.membersForm&&(m=t.dataset.membersForm);const y=m==="signin"&&((P=t==null?void 0:t.dataset)==null?void 0:P.membersOtc)==="true";t.classList.add("loading");const v=ci(),C={email:d,emailType:m,labels:h,name:p,autoRedirect:u==="true"};y&&(C.includeOTC=!0),v&&(C.urlHistory=v),f.length>0?C.newsletters=k:(e.target.querySelectorAll("input[type=checkbox][data-members-newsletter]")||[]).length>0&&(C.newsletters=[]);try{const F=await(await fetch(`${a}/members/api/integrity-token/`,{method:"GET"})).text(),S=await fetch(`${a}/members/api/send-magic-link/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...C,integrityToken:F})});if(t.addEventListener("submit",i),t.classList.remove("loading"),S.ok){t.classList.add("success");let T;if(y)try{T=await S.clone().json()}catch{T=void 0}const B=T==null?void 0:T.otc_ref;if(B&&typeof o=="function")try{o("startSigninOTCFromCustomForm",{email:(d||"").trim(),otcRef:B,inboxLinks:T==null?void 0:T.inboxLinks})}catch(Q){console.error(Q),r==null||r(Q)}}else{const T=await Tt.fromApiResponse(S),B=on(T,g("Failed to send magic link email"));Jv(n,B),t.classList.add("error")}}catch(E){u4(E,t,n)}}function m4({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=gT(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 h=o?{checkoutType:"upgrade"}:{},k=ci();return k&&(h.urlHistory=k),fetch(`${a}/members/api/session`,{credentials:"same-origin"}).then(function(b){return b.ok?b.text():null}).then(function(b){return fetch(`${a}/members/api/create-stripe-checkout-session/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...c,identity:b,successUrl:p,cancelUrl:m,metadata:h})}).then(function(f){if(!f.ok)throw new Error(g("Could not create Stripe checkout session"));return f.json()})}).then(function(b){return b.url?window.location.assign(b.url):window.Stripe(b.publicKey).redirectToCheckout({sessionId:b.sessionId}).then(function(y){if(y.error)throw new Error(y.error.message)})}).catch(function(b){console.error(b),t.addEventListener("click",r),t.classList.remove("loading"),n&&(n.innerText=b.message),t.classList.add("error")})}function p4({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){d4({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){m4({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 h(k){s.removeEventListener("click",h),k.preventDefault(),c&&(c.innerText=""),s.classList.add("loading"),fetch(`${e}/members/api/session`,{credentials:"same-origin"}).then(function(b){return b.ok?b.text():null}).then(function(b){return fetch(`${e}/members/api/create-stripe-update-session/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:b,successUrl:p,cancelUrl:m})}).then(function(f){if(!f.ok)throw new Error(g("Could not create Stripe checkout session"));return f.json()})}).then(function(b){return window.Stripe(b.publicKey).redirectToCheckout({sessionId:b.sessionId})}).then(function(b){if(b.error)throw new Error(g(b.error.message))}).catch(function(b){console.error(b),s.addEventListener("click",h),s.classList.remove("loading"),c&&(c.innerText=b.message),s.classList.add("error")})}s.addEventListener("click",h)}),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(h){return h.ok?h.text():null}).then(function(h){return fetch(`${e}/members/api/create-stripe-billing-portal-session/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:h,returnUrl:d})}).then(function(k){if(!k.ok)throw new Error(g("Could not create Stripe billing portal session"));return k.json()})}).then(function(h){return window.location.assign(h.url)}).catch(function(h){console.error(h),s.addEventListener("click",p),s.classList.remove("loading"),c&&(c.innerText=h.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=g("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=g("There was an error continuing your subscription, please try again.")))})}s.addEventListener("click",u)})}const Kv=e=>{try{return decodeURIComponent(e)}catch{return null}},h4={staleGiftRedemptionRequest:!0},f4={showPopup:!0,site:vi,member:Ai.free,page:"accountEmail",...j2(),pageData:Wv};function g4({site:e,children:t}){const{portal_sentry:n}=e||{};return n&&n.dsn?l.jsx(jd,{children:t}):l.jsx(l.Fragment,{children:t})}class y4 extends te.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(),p4({siteUrl:r,site:s.site,member:s.member,offers:s.offers,doAction:s.doAction,captureException:zs})}}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"&&!ul({site:this.state.site})){this.invalidateGiftRedemptionRequest(),Ut();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";rl.changeLanguage(m);const h={site:t,member:n,offers:a,page:i,lastPage:u,pageQuery:d,showPopup:o,pageData:p,popupNotification:r,notification:s,notificationSequence:c,dir:rl.dir()||"ltr",action:"init:success",initStatus:"success",locale:m};if(this.handleSignupQuery({site:t,pageQuery:d,member:n}),this.setState(h),this.hashHandler=()=>{this.updateStateForPreviewLinks()},window.addEventListener("hashchange",this.hashHandler,!1),!n){const k=document.querySelectorAll("[data-lexical-signup-form]");k.length>0&&k.forEach(b=>{b.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 ge(["dev"])&&!this.state.customSiteUrl?f4:ge(["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||Wv.tier.id}:c==="redemption_type"&&(a.redemption_type=u||"signup")}if(a.redemption_type==="retention"){const s=(r=(o=(i=Ai.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 h=m.toUpperCase();a.site.plans.currency=h,a.site.plans.currency_symbol=Ce(h),u=h}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}=tv({billingOnly:!0})||{};return["stripe:billing-update"].includes(t)?n==="success"?{showPopup:!0,popupNotification:le({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(!ul({site:t}))return Ut(),{};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){Ut();const o=Al({type:"giftRedemption:failed",status:"error",autoHide:!1,closeable:!0,state:this.state,message:El(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 k=a.get("gift_token"),b=a.get("gift_tier"),f=a.get("gift_cadence");if(Sl(["stripe","gift_token","gift_tier","gift_cadence"]),k)return{showPopup:!0,page:"giftSuccess",pageData:{token:k,tierId:b,cadence:f}}}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(kT({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\/?$/,h=/^\/feedback\/(\w+?)\/(\w+?)\/?$/;if(i&&h.test(i)){const[,k,b]=i.match(h),f=parseInt(b);if(f===1||f===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:k,score:f}}:{showPopup:!0,page:"signin",pageData:{redirect:t.url+`#/feedback/${k}/${f}/`}}}if(i&&d.test(i)){const[,k]=i.match(d),b=Kv(k);if(!b)return{};const f=this.startGiftRedemptionRequest(b),y=await this.fetchGiftRedemptionData({site:t,token:b});return this.isCurrentGiftRedemptionRequest(f)?y:h4}if(i&&m.test(i))return{showPopup:!0,page:"share"};if(i&&p.test(i)){const[,k]=i.match(p),{page:b,pageQuery:f,pageData:y}=this.getPageFromLinkPath(k,t)||{};if(!n&&b&&Lv({page:b}))return{showPopup:!0,page:"signin",pageData:{redirect:t.url+`#/portal/${k}/`}};if(b==="gift"&&!ul({site:t}))return Ut(),{};const v=["accountPlan","accountProfile"].includes(b)?"accountHome":null;return{showPopup:!(["monthly","yearly"].includes(f)||s.test(f)||c.test(f)||u.test(f)),...b?{page:b}:{},...f?{pageQuery:f}:{},...y?{pageData:y}:{},...v?{lastPage:v}:{}}}return{}}fetchPreviewData(){const[,t]=window.location.hash.substr(1).split("?");if(ge(["preview"])){let n={};return ge(["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||Il({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(ge(["dev","test"],{customSiteUrl:n}))return{};throw o}}setupSentry({site:t}){if(ge(["test"]))return null;const{portal_sentry:n,portal_version:a,version:i}=t,r=`portal@2.68.34|ghost@${i}`;n&&n.dsn&&vP({dsn:n.dsn,environment:n.env||"development",release:r,beforeSend:s=>cT({event:s})?s:null,allowUrls:[/https?:\/\/((www)\.)?unpkg\.com\/@tryghost\/portal/]})}setupFirstPromoter({site:t,member:n}){if(ge(["test"]))return null;const a=PT({site:t});let i=om({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),BT({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 c4({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=le({type:`${t}:failed`,autoHide:!0,closeable:!0,status:"error",state:this.state,meta:{error:a}});this.setState({action:`${t}:failed`,actionErrorMessage:on(a,g("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(Ut(),!Vt({member:a})||Nn({member:a}))try{const o=await this.GhostApi.site.offer({offerId:n}),r=o==null?void 0:o.offers[0];if(!r||!r.tier||lm({offer:r})||!NT({site:t,offer:r}))return;if(i)this.dispatchAction("openPopup",{page:"offer",pageData:o==null?void 0:o.offers[0]});else{const s=Dn({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}=sa({site:t,priceId:c.id});this.dispatchAction("checkoutPlan",{plan:c.id,offerId:n,tierId:u,cadence:d})}else{const{tierId:u,cadence:d}=sa({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}Nk({site:t,pageQuery:n})&&(o=Nk({site:t,pageQuery:n}));const r=yT({site:t,priceId:o});if(n&&n!=="free"){Ut();const s=(r==null?void 0:r.id)||o;s!=="free"&&this.dispatchAction("openPopup",{page:"loading"});const{tierId:c,cadence:u}=sa({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=Kv(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 Az(t)}getRetentionPreviewMember({site:t,offers:n}){var u,d,p;const a=(n||[]).find(m=>lm({offer:m})),i=(u=a==null?void 0:a.tier)==null?void 0:u.id,o=i?Dn({site:t,productId:i}):null,r=o?a.cadence==="year"?o.yearlyPrice:o.monthlyPrice:null,s=Ai.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=Xt({site:t})||!rn({site:t})?"signin":"signup";n=a?"accountHome":i}return Vm({page:n})}getContextMember({site:t,page:n,member:a,offers:i,pageData:o,customSiteUrl:r}){return ge(["dev","preview"],{customSiteUrl:r})?Lv({page:n})||k2({page:n})?ge(["dev"],{customSiteUrl:r})?a||Ai.free:ge(["preview"])?n==="accountPlan"&&(o==null?void 0:o.action)==="cancel"?this.getRetentionPreviewMember({site:t,offers:i}):Ai.preview:Ai.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:h,dir:k,scrollbarWidth:b,otcRef:f,inboxLinks:y}=this.state,v=this.getContextPage({site:t,page:r,member:n}),C=this.getContextMember({site:t,page:v,member:n,offers:a,pageData:d,customSiteUrl:h});return{api:this.GhostApi,site:t,offers:a,action:i,actionErrorMessage:o,brandColor:this.getAccentColor(),page:v,pageQuery:u,pageData:d,member:C,lastPage:s,showPopup:c,popupNotification:p,notification:m,customSiteUrl:h,dir:k,scrollbarWidth:b,otcRef:f,inboxLinks:y,doAction:(x,P)=>this.dispatchAction(x,P)}}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(g4,{site:this.state.site,children:l.jsxs(R.Provider,{value:this.getContextFromState(),children:[l.jsx(Qm,{}),l.jsx(um,{}),l.jsx(km,{})]})}):null}}const qv="ghost-portal-root";function b4(){const e=document.createElement("div");e.id=qv,e.setAttribute("data-testid","portal-root"),document.body.appendChild(e)}function k4(){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 v4(){const e=new URL(window.location.href);e.searchParams.get("token")&&(e.searchParams.delete("token"),window.history.replaceState({},document.title,e.href))}function A4(){const{siteUrl:e,apiKey:t,apiUrl:n,siteI18nEnabled:a,locale:i}=k4(),o=e||window.location.origin;b4(),v4(),Tx.render(l.jsx(te.StrictMode,{children:l.jsx(y4,{siteUrl:o,customSiteUrl:e,apiKey:t,apiUrl:n,siteI18nEnabled:a,locale:i})}),document.getElementById(qv))}A4()});
|
|
4511
4511
|
//# sourceMappingURL=portal.min.js.map
|