@tryghost/portal 2.64.14 → 2.64.15

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/umd/portal.min.js CHANGED
@@ -47,7 +47,7 @@ ${JSON.stringify(s)}
47
47
  `),typeof l=="string"||l instanceof Uint8Array)r(l);else{let c;try{c=JSON.stringify(l)}catch{c=JSON.stringify($n(l))}r(c)}}return typeof i=="string"?i:ox(i)}function ox(e){const t=e.reduce((i,r)=>i+r.length,0),n=new Uint8Array(t);let a=0;for(const i of e)n.set(i,a),a+=i.length;return n}function sx(e,t){const n=typeof e.data=="string"?Fc(e.data,t):e.data;return[Gt({type:"attachment",length:n.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType}),n]}const lx={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",statsd:"metric_bucket"};function wf(e){return lx[e]}function Sf(e){if(!e||!e.sdk)return;const{name:t,version:n}=e.sdk;return{name:t,version:n}}function ux(e,t,n,a){const i=e.sdkProcessingMetadata&&e.sdkProcessingMetadata.dynamicSamplingContext;return{event_id:e.event_id,sent_at:new Date().toISOString(),...t&&{sdk:t},...!!n&&a&&{dsn:_a(a)},...i&&{trace:Gt({...i})}}}function cx(e,t,n){const a=[{type:"client_report"},{timestamp:cr(),discarded_events:e}];return Ya(t?{dsn:t}:{},[a])}const dx=60*1e3;function mx(e,t=Date.now()){const n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;const a=Date.parse(`${e}`);return isNaN(a)?dx:a-t}function px(e,t){return e[t]||e.all||0}function hx(e,t,n=Date.now()){return px(e,t)>n}function gx(e,{statusCode:t,headers:n},a=Date.now()){const i={...e},r=n&&n["x-sentry-rate-limits"],o=n&&n["retry-after"];if(r)for(const s of r.trim().split(",")){const[l,c,,,m]=s.split(":",5),p=parseInt(l,10),d=(isNaN(p)?60:p)*1e3;if(!c)i.all=a+d;else for(const h of c.split(";"))h==="metric_bucket"?(!m||m.split(";").includes("custom"))&&(i[h]=a+d):i[h]=a+d}else o?i.all=a+mx(o,a):t===429&&(i.all=a+60*1e3);return i}const re=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,rs="production";function Oc(){return qg("globalEventProcessors",()=>[])}function fx(e){Oc().push(e)}function os(e,t,n,a=0){return new it((i,r)=>{const o=e[a];if(t===null||typeof o!="function")i(t);else{const s=o({...t},n);re&&o.id&&s===null&&B.log(`Event processor "${o.id}" dropped event`),qo(s)?s.then(l=>os(e,l,n,a+1).then(i)).then(null,r):os(e,s,n,a+1).then(i).then(null,r)}})}function xf(e){const t=kf(),n={sid:ht(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>bx(n)};return e&&Kn(n,e),n}function Kn(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),!e.did&&!t.did&&(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||kf(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=t.sid.length===32?t.sid:ht()),t.init!==void 0&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),typeof t.started=="number"&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if(typeof t.duration=="number")e.duration=t.duration;else{const n=e.timestamp-e.started;e.duration=n>=0?n:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),typeof t.errors=="number"&&(e.errors=t.errors),t.status&&(e.status=t.status)}function Ef(e,t){let n={};e.status==="ok"&&(n={status:"exited"}),Kn(e,n)}function bx(e){return Gt({sid:`${e.sid}`,init:e.init,started:new Date(e.started*1e3).toISOString(),timestamp:new Date(e.timestamp*1e3).toISOString(),status:e.status,errors:e.errors,did:typeof e.did=="number"||typeof e.did=="string"?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}})}const yx=1;function kx(e){const{spanId:t,traceId:n}=e.spanContext(),{data:a,op:i,parent_span_id:r,status:o,tags:s,origin:l}=dr(e);return Gt({data:a,op:i,parent_span_id:r,span_id:t,status:o,tags:s,trace_id:n,origin:l})}function dr(e){return vx(e)?e.getSpanJSON():typeof e.toJSON=="function"?e.toJSON():{}}function vx(e){return typeof e.getSpanJSON=="function"}function wx(e){const{traceFlags:t}=e.spanContext();return!!(t&yx)}function Sx(e,t,n,a,i,r){const{normalizeDepth:o=3,normalizeMaxBreadth:s=1e3}=e,l={...t,event_id:t.event_id||n.event_id||ht(),timestamp:t.timestamp||cr()},c=n.integrations||e.integrations.map(g=>g.name);xx(l,e),jx(l,c),t.type===void 0&&Ex(l,e.stackParser);const m=Tx(a,n.captureContext);n.mechanism&&sr(l,n.mechanism);const p=i&&i.getEventProcessors?i.getEventProcessors():[],d=Lx().getScopeData();if(r){const g=r.getScopeData();Df(d,g)}if(m){const g=m.getScopeData();Df(d,g)}const h=[...n.attachments||[],...d.attachments];h.length&&(n.attachments=h),Mf(l,d);const y=[...p,...Oc(),...d.eventProcessors];return os(y,l,n).then(g=>(g&&Cx(g),typeof o=="number"&&o>0?$x(g,o,s):g))}function xx(e,t){const{environment:n,release:a,dist:i,maxValueLength:r=250}=t;"environment"in e||(e.environment="environment"in t?n:rs),e.release===void 0&&a!==void 0&&(e.release=a),e.dist===void 0&&i!==void 0&&(e.dist=i),e.message&&(e.message=Oa(e.message,r));const o=e.exception&&e.exception.values&&e.exception.values[0];o&&o.value&&(o.value=Oa(o.value,r));const s=e.request;s&&s.url&&(s.url=Oa(s.url,r))}const Cf=new WeakMap;function Ex(e,t){const n=te._sentryDebugIds;if(!n)return;let a;const i=Cf.get(t);i?a=i:(a=new Map,Cf.set(t,a));const r=Object.keys(n).reduce((o,s)=>{let l;const c=a.get(s);c?l=c:(l=t(s),a.set(s,l));for(let m=l.length-1;m>=0;m--){const p=l[m];if(p.filename){o[p.filename]=n[s];break}}return o},{});try{e.exception.values.forEach(o=>{o.stacktrace.frames.forEach(s=>{s.filename&&(s.debug_id=r[s.filename])})})}catch{}}function Cx(e){const t={};try{e.exception.values.forEach(a=>{a.stacktrace.frames.forEach(i=>{i.debug_id&&(i.abs_path?t[i.abs_path]=i.debug_id:i.filename&&(t[i.filename]=i.debug_id),delete i.debug_id)})})}catch{}if(Object.keys(t).length===0)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];const n=e.debug_meta.images;Object.keys(t).forEach(a=>{n.push({type:"sourcemap",code_file:a,debug_id:t[a]})})}function jx(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function $x(e,t,n){if(!e)return null;const a={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(i=>({...i,...i.data&&{data:$n(i.data,t,n)}}))},...e.user&&{user:$n(e.user,t,n)},...e.contexts&&{contexts:$n(e.contexts,t,n)},...e.extra&&{extra:$n(e.extra,t,n)}};return e.contexts&&e.contexts.trace&&a.contexts&&(a.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(a.contexts.trace.data=$n(e.contexts.trace.data,t,n))),e.spans&&(a.spans=e.spans.map(i=>{const r=dr(i).data;return r&&(i.data=$n(r,t,n)),i})),a}function Tx(e,t){if(!t)return e;const n=e?e.clone():new qt;return n.update(t),n}function Px(e){if(e)return zx(e)?{captureContext:e}:Ax(e)?{captureContext:e}:e}function zx(e){return e instanceof qt||typeof e=="function"}const Nx=["user","level","extra","contexts","tags","fingerprint","requestSession","propagationContext"];function Ax(e){return Object.keys(e).some(t=>Nx.includes(t))}function ss(e,t){return At().captureException(e,Px(t))}function jf(e,t){return At().captureEvent(e,t)}function qn(e,t){At().addBreadcrumb(e,t)}function $f(...e){const t=At();if(e.length===2){const[n,a]=e;return n?t.withScope(()=>(t.getStackTop().scope=n,a(n))):t.withScope(a)}return t.withScope(e[0])}function Ue(){return At().getClient()}function mr(){return At().getScope()}function Tf(e){const t=Ue(),n=us(),a=mr(),{release:i,environment:r=rs}=t&&t.getOptions()||{},{userAgent:o}=te.navigator||{},s=xf({release:i,environment:r,user:a.getUser()||n.getUser(),...o&&{userAgent:o},...e}),l=n.getSession();return l&&l.status==="ok"&&Kn(l,{status:"exited"}),Pf(),n.setSession(s),a.setSession(s),s}function Pf(){const e=us(),t=mr(),n=t.getSession()||e.getSession();n&&Ef(n),zf(),e.setSession(),t.setSession()}function zf(){const e=us(),t=mr(),n=Ue(),a=t.getSession()||e.getSession();a&&n&&n.captureSession&&n.captureSession(a)}function Nf(e=!1){if(e){Pf();return}zf()}function Af(e){return e.transaction}function If(e,t,n){const a=t.getOptions(),{publicKey:i}=t.getDsn()||{},{segment:r}=n&&n.getUser()||{},o=Gt({environment:a.environment||rs,release:a.release,user_segment:r,public_key:i,trace_id:e});return t.emit&&t.emit("createDsc",o),o}function Ix(e){const t=Ue();if(!t)return{};const n=If(dr(e).trace_id||"",t,mr()),a=Af(e);if(!a)return n;const i=a&&a._frozenDynamicSamplingContext;if(i)return i;const{sampleRate:r,source:o}=a.metadata;r!=null&&(n.sample_rate=`${r}`);const s=dr(a);return o&&o!=="url"&&(n.transaction=s.description),n.sampled=String(wx(a)),t.emit&&t.emit("createDsc",n),n}function Mf(e,t){const{fingerprint:n,span:a,breadcrumbs:i,sdkProcessingMetadata:r}=t;Mx(e,t),a&&Ox(e,a),_x(e,n),Dx(e,i),Fx(e,r)}function Df(e,t){const{extra:n,tags:a,user:i,contexts:r,level:o,sdkProcessingMetadata:s,breadcrumbs:l,fingerprint:c,eventProcessors:m,attachments:p,propagationContext:d,transactionName:h,span:y}=t;pr(e,"extra",n),pr(e,"tags",a),pr(e,"user",i),pr(e,"contexts",r),pr(e,"sdkProcessingMetadata",s),o&&(e.level=o),h&&(e.transactionName=h),y&&(e.span=y),l.length&&(e.breadcrumbs=[...e.breadcrumbs,...l]),c.length&&(e.fingerprint=[...e.fingerprint,...c]),m.length&&(e.eventProcessors=[...e.eventProcessors,...m]),p.length&&(e.attachments=[...e.attachments,...p]),e.propagationContext={...e.propagationContext,...d}}function pr(e,t,n){if(n&&Object.keys(n).length){e[t]={...e[t]};for(const a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[t][a]=n[a])}}function Mx(e,t){const{extra:n,tags:a,user:i,contexts:r,level:o,transactionName:s}=t,l=Gt(n);l&&Object.keys(l).length&&(e.extra={...l,...e.extra});const c=Gt(a);c&&Object.keys(c).length&&(e.tags={...c,...e.tags});const m=Gt(i);m&&Object.keys(m).length&&(e.user={...m,...e.user});const p=Gt(r);p&&Object.keys(p).length&&(e.contexts={...p,...e.contexts}),o&&(e.level=o),s&&(e.transaction=s)}function Dx(e,t){const n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function Fx(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function Ox(e,t){e.contexts={trace:kx(t),...e.contexts};const n=Af(t);if(n){e.sdkProcessingMetadata={dynamicSamplingContext:Ix(t),...e.sdkProcessingMetadata};const a=dr(n).description;a&&(e.tags={transaction:a,...e.tags})}}function _x(e,t){e.fingerprint=e.fingerprint?df(e.fingerprint):[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint&&!e.fingerprint.length&&delete e.fingerprint}const Rx=100;let _c;class qt{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext=Ff()}static clone(t){return t?t.clone():new qt}clone(){const t=new qt;return t._breadcrumbs=[...this._breadcrumbs],t._tags={...this._tags},t._extra={...this._extra},t._contexts={...this._contexts},t._user=this._user,t._level=this._level,t._span=this._span,t._session=this._session,t._transactionName=this._transactionName,t._fingerprint=this._fingerprint,t._eventProcessors=[...this._eventProcessors],t._requestSession=this._requestSession,t._attachments=[...this._attachments],t._sdkProcessingMetadata={...this._sdkProcessingMetadata},t._propagationContext={...this._propagationContext},t._client=this._client,t}setClient(t){this._client=t}getClient(){return this._client}addScopeListener(t){this._scopeListeners.push(t)}addEventProcessor(t){return this._eventProcessors.push(t),this}setUser(t){return this._user=t||{email:void 0,id:void 0,ip_address:void 0,segment:void 0,username:void 0},this._session&&Kn(this._session,{user:t}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(t){return this._requestSession=t,this}setTags(t){return this._tags={...this._tags,...t},this._notifyScopeListeners(),this}setTag(t,n){return this._tags={...this._tags,[t]:n},this._notifyScopeListeners(),this}setExtras(t){return this._extra={...this._extra,...t},this._notifyScopeListeners(),this}setExtra(t,n){return this._extra={...this._extra,[t]:n},this._notifyScopeListeners(),this}setFingerprint(t){return this._fingerprint=t,this._notifyScopeListeners(),this}setLevel(t){return this._level=t,this._notifyScopeListeners(),this}setTransactionName(t){return this._transactionName=t,this._notifyScopeListeners(),this}setContext(t,n){return n===null?delete this._contexts[t]:this._contexts[t]=n,this._notifyScopeListeners(),this}setSpan(t){return this._span=t,this._notifyScopeListeners(),this}getSpan(){return this._span}getTransaction(){const t=this._span;return t&&t.transaction}setSession(t){return t?this._session=t:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;const n=typeof t=="function"?t(this):t;if(n instanceof qt){const a=n.getScopeData();this._tags={...this._tags,...a.tags},this._extra={...this._extra,...a.extra},this._contexts={...this._contexts,...a.contexts},a.user&&Object.keys(a.user).length&&(this._user=a.user),a.level&&(this._level=a.level),a.fingerprint.length&&(this._fingerprint=a.fingerprint),n.getRequestSession()&&(this._requestSession=n.getRequestSession()),a.propagationContext&&(this._propagationContext=a.propagationContext)}else if(Fa(n)){const a=t;this._tags={...this._tags,...a.tags},this._extra={...this._extra,...a.extra},this._contexts={...this._contexts,...a.contexts},a.user&&(this._user=a.user),a.level&&(this._level=a.level),a.fingerprint&&(this._fingerprint=a.fingerprint),a.requestSession&&(this._requestSession=a.requestSession),a.propagationContext&&(this._propagationContext=a.propagationContext)}return this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._span=void 0,this._session=void 0,this._notifyScopeListeners(),this._attachments=[],this._propagationContext=Ff(),this}addBreadcrumb(t,n){const a=typeof n=="number"?n:Rx;if(a<=0)return this;const i={timestamp:cr(),...t},r=this._breadcrumbs;return r.push(i),this._breadcrumbs=r.length>a?r.slice(-a):r,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(t){return this._attachments.push(t),this}getAttachments(){return this.getScopeData().attachments}clearAttachments(){return this._attachments=[],this}getScopeData(){const{_breadcrumbs:t,_attachments:n,_contexts:a,_tags:i,_extra:r,_user:o,_level:s,_fingerprint:l,_eventProcessors:c,_propagationContext:m,_sdkProcessingMetadata:p,_transactionName:d,_span:h}=this;return{breadcrumbs:t,attachments:n,contexts:a,tags:i,extra:r,user:o,level:s,fingerprint:l||[],eventProcessors:c,propagationContext:m,sdkProcessingMetadata:p,transactionName:d,span:h}}applyToEvent(t,n={},a=[]){Mf(t,this.getScopeData());const i=[...a,...Oc(),...this._eventProcessors];return os(i,t,n)}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata={...this._sdkProcessingMetadata,...t},this}setPropagationContext(t){return this._propagationContext=t,this}getPropagationContext(){return this._propagationContext}captureException(t,n){const a=n&&n.event_id?n.event_id:ht();if(!this._client)return B.warn("No client configured on scope - will not capture exception!"),a;const i=new Error("Sentry syntheticException");return this._client.captureException(t,{originalException:t,syntheticException:i,...n,event_id:a},this),a}captureMessage(t,n,a){const i=a&&a.event_id?a.event_id:ht();if(!this._client)return B.warn("No client configured on scope - will not capture message!"),i;const r=new Error(t);return this._client.captureMessage(t,n,{originalException:t,syntheticException:r,...a,event_id:i},this),i}captureEvent(t,n){const a=n&&n.event_id?n.event_id:ht();return this._client?(this._client.captureEvent(t,{...n,event_id:a},this),a):(B.warn("No client configured on scope - will not capture event!"),a)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(t=>{t(this)}),this._notifyingListeners=!1)}}function Lx(){return _c||(_c=new qt),_c}function Ff(){return{traceId:ht(),spanId:ht().substring(16)}}const Rc="7.120.4",Of=parseFloat(Rc),Yx=100;class _f{constructor(t,n,a,i=Of){this._version=i;let r;n?r=n:(r=new qt,r.setClient(t));let o;a?o=a:(o=new qt,o.setClient(t)),this._stack=[{scope:r}],t&&this.bindClient(t),this._isolationScope=o}isOlderThan(t){return this._version<t}bindClient(t){const n=this.getStackTop();n.client=t,n.scope.setClient(t),t&&t.setupIntegrations&&t.setupIntegrations()}pushScope(){const t=this.getScope().clone();return this.getStack().push({client:this.getClient(),scope:t}),t}popScope(){return this.getStack().length<=1?!1:!!this.getStack().pop()}withScope(t){const n=this.pushScope();let a;try{a=t(n)}catch(i){throw this.popScope(),i}return qo(a)?a.then(i=>(this.popScope(),i),i=>{throw this.popScope(),i}):(this.popScope(),a)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStack(){return this._stack}getStackTop(){return this._stack[this._stack.length-1]}captureException(t,n){const a=this._lastEventId=n&&n.event_id?n.event_id:ht(),i=new Error("Sentry syntheticException");return this.getScope().captureException(t,{originalException:t,syntheticException:i,...n,event_id:a}),a}captureMessage(t,n,a){const i=this._lastEventId=a&&a.event_id?a.event_id:ht(),r=new Error(t);return this.getScope().captureMessage(t,n,{originalException:t,syntheticException:r,...a,event_id:i}),i}captureEvent(t,n){const a=n&&n.event_id?n.event_id:ht();return t.type||(this._lastEventId=a),this.getScope().captureEvent(t,{...n,event_id:a}),a}lastEventId(){return this._lastEventId}addBreadcrumb(t,n){const{scope:a,client:i}=this.getStackTop();if(!i)return;const{beforeBreadcrumb:r=null,maxBreadcrumbs:o=Yx}=i.getOptions&&i.getOptions()||{};if(o<=0)return;const l={timestamp:cr(),...t},c=r?Xo(()=>r(l,n)):l;c!==null&&(i.emit&&i.emit("beforeAddBreadcrumb",c,n),a.addBreadcrumb(c,o))}setUser(t){this.getScope().setUser(t),this.getIsolationScope().setUser(t)}setTags(t){this.getScope().setTags(t),this.getIsolationScope().setTags(t)}setExtras(t){this.getScope().setExtras(t),this.getIsolationScope().setExtras(t)}setTag(t,n){this.getScope().setTag(t,n),this.getIsolationScope().setTag(t,n)}setExtra(t,n){this.getScope().setExtra(t,n),this.getIsolationScope().setExtra(t,n)}setContext(t,n){this.getScope().setContext(t,n),this.getIsolationScope().setContext(t,n)}configureScope(t){const{scope:n,client:a}=this.getStackTop();a&&t(n)}run(t){const n=Rf(this);try{t(this)}finally{Rf(n)}}getIntegration(t){const n=this.getClient();if(!n)return null;try{return n.getIntegration(t)}catch{return re&&B.warn(`Cannot retrieve integration ${t.id} from the current Hub`),null}}startTransaction(t,n){const a=this._callExtensionMethod("startTransaction",t,n);return re&&!a&&(this.getClient()?B.warn(`Tracing extension 'startTransaction' has not been added. Call 'addTracingExtensions' before calling 'init':
48
48
  Sentry.addTracingExtensions();
49
49
  Sentry.init({...});
50
- `):B.warn("Tracing extension 'startTransaction' is missing. You should 'init' the SDK before calling 'startTransaction'")),a}traceHeaders(){return this._callExtensionMethod("traceHeaders")}captureSession(t=!1){if(t)return this.endSession();this._sendSessionUpdate()}endSession(){const n=this.getStackTop().scope,a=n.getSession();a&&Ef(a),this._sendSessionUpdate(),n.setSession()}startSession(t){const{scope:n,client:a}=this.getStackTop(),{release:i,environment:r=rs}=a&&a.getOptions()||{},{userAgent:o}=te.navigator||{},s=xf({release:i,environment:r,user:n.getUser(),...o&&{userAgent:o},...t}),l=n.getSession&&n.getSession();return l&&l.status==="ok"&&Kn(l,{status:"exited"}),this.endSession(),n.setSession(s),s}shouldSendDefaultPii(){const t=this.getClient(),n=t&&t.getOptions();return!!(n&&n.sendDefaultPii)}_sendSessionUpdate(){const{scope:t,client:n}=this.getStackTop(),a=t.getSession();a&&n&&n.captureSession&&n.captureSession(a)}_callExtensionMethod(t,...n){const i=ls().__SENTRY__;if(i&&i.extensions&&typeof i.extensions[t]=="function")return i.extensions[t].apply(this,n);re&&B.warn(`Extension method ${t} couldn't be found, doing nothing.`)}}function ls(){return te.__SENTRY__=te.__SENTRY__||{extensions:{},hub:void 0},te}function Rf(e){const t=ls(),n=Lc(t);return Lf(t,e),n}function At(){const e=ls();if(e.__SENTRY__&&e.__SENTRY__.acs){const t=e.__SENTRY__.acs.getCurrentHub();if(t)return t}return Ux(e)}function us(){return At().getIsolationScope()}function Ux(e=ls()){return(!Bx(e)||Lc(e).isOlderThan(Of))&&Lf(e,new _f),Lc(e)}function Bx(e){return!!(e&&e.__SENTRY__&&e.__SENTRY__.hub)}function Lc(e){return qg("hub",()=>new _f,e)}function Lf(e,t){if(!e)return!1;const n=e.__SENTRY__=e.__SENTRY__||{};return n.hub=t,!0}function Vx(e,t){return t&&(e.sdk=e.sdk||{},e.sdk.name=e.sdk.name||t.name,e.sdk.version=e.sdk.version||t.version,e.sdk.integrations=[...e.sdk.integrations||[],...t.integrations||[]],e.sdk.packages=[...e.sdk.packages||[],...t.packages||[]]),e}function Hx(e,t,n,a){const i=Sf(n),r={sent_at:new Date().toISOString(),...i&&{sdk:i},...!!a&&t&&{dsn:_a(t)}},o="aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()];return Ya(r,[o])}function Wx(e,t,n,a){const i=Sf(n),r=e.type&&e.type!=="replay_event"?e.type:"event";Vx(e,n&&n.sdk);const o=ux(e,i,a,t);return delete e.sdkProcessingMetadata,Ya(o,[[{type:r},e]])}const Gx="7";function Yf(e){const t=e.protocol?`${e.protocol}:`:"",n=e.port?`:${e.port}`:"";return`${t}//${e.host}${n}${e.path?`/${e.path}`:""}/api/`}function Kx(e){return`${Yf(e)}${e.projectId}/envelope/`}function qx(e,t){return wS({sentry_key:e.publicKey,sentry_version:Gx,...t&&{sentry_client:`${t.name}/${t.version}`}})}function Jx(e,t={}){const n=typeof t=="string"?t:t.tunnel,a=typeof t=="string"||!t._metadata?void 0:t._metadata.sdk;return n||`${Kx(e)}?${qx(e,a)}`}function Zx(e,t){const n=Qg(e);if(!n)return"";const a=`${Yf(n)}embed/error-page/`;let i=`dsn=${_a(n)}`;for(const r in t)if(r!=="dsn"&&r!=="onClose")if(r==="user"){const o=t.user;if(!o)continue;o.name&&(i+=`&name=${encodeURIComponent(o.name)}`),o.email&&(i+=`&email=${encodeURIComponent(o.email)}`)}else i+=`&${encodeURIComponent(r)}=${encodeURIComponent(t[r])}`;return`${a}?${i}`}const Uf=[];function Qx(e){const t={};return e.forEach(n=>{const{name:a}=n,i=t[a];i&&!i.isDefaultInstance&&n.isDefaultInstance||(t[a]=n)}),Object.keys(t).map(n=>t[n])}function Xx(e){const t=e.defaultIntegrations||[],n=e.integrations;t.forEach(o=>{o.isDefaultInstance=!0});let a;Array.isArray(n)?a=[...t,...n]:typeof n=="function"?a=df(n(t)):a=t;const i=Qx(a),r=tE(i,o=>o.name==="Debug");if(r!==-1){const[o]=i.splice(r,1);i.push(o)}return i}function eE(e,t){const n={};return t.forEach(a=>{a&&Vf(e,a,n)}),n}function Bf(e,t){for(const n of t)n&&n.afterAllSetup&&n.afterAllSetup(e)}function Vf(e,t,n){if(n[t.name]){re&&B.log(`Integration skipped because it was already installed: ${t.name}`);return}if(n[t.name]=t,Uf.indexOf(t.name)===-1&&(t.setupOnce(fx,At),Uf.push(t.name)),t.setup&&typeof t.setup=="function"&&t.setup(e),e.on&&typeof t.preprocessEvent=="function"){const a=t.preprocessEvent.bind(t);e.on("preprocessEvent",(i,r)=>a(i,r,e))}if(e.addEventProcessor&&typeof t.processEvent=="function"){const a=t.processEvent.bind(t),i=(r,o)=>a(r,o,e);i.id=t.name,e.addEventProcessor(i)}re&&B.log(`Integration installed: ${t.name}`)}function tE(e,t){for(let n=0;n<e.length;n++)if(t(e[n])===!0)return n;return-1}function Uz(e){return e}function nE(e){let t="";for(const n of e){const a=Object.entries(n.tags),i=a.length>0?`|#${a.map(([r,o])=>`${r}:${o}`).join(",")}`:"";t+=`${n.name}@${n.unit}:${n.metric}|${n.metricType}${i}|T${n.timestamp}
50
+ `):B.warn("Tracing extension 'startTransaction' is missing. You should 'init' the SDK before calling 'startTransaction'")),a}traceHeaders(){return this._callExtensionMethod("traceHeaders")}captureSession(t=!1){if(t)return this.endSession();this._sendSessionUpdate()}endSession(){const n=this.getStackTop().scope,a=n.getSession();a&&Ef(a),this._sendSessionUpdate(),n.setSession()}startSession(t){const{scope:n,client:a}=this.getStackTop(),{release:i,environment:r=rs}=a&&a.getOptions()||{},{userAgent:o}=te.navigator||{},s=xf({release:i,environment:r,user:n.getUser(),...o&&{userAgent:o},...t}),l=n.getSession&&n.getSession();return l&&l.status==="ok"&&Kn(l,{status:"exited"}),this.endSession(),n.setSession(s),s}shouldSendDefaultPii(){const t=this.getClient(),n=t&&t.getOptions();return!!(n&&n.sendDefaultPii)}_sendSessionUpdate(){const{scope:t,client:n}=this.getStackTop(),a=t.getSession();a&&n&&n.captureSession&&n.captureSession(a)}_callExtensionMethod(t,...n){const i=ls().__SENTRY__;if(i&&i.extensions&&typeof i.extensions[t]=="function")return i.extensions[t].apply(this,n);re&&B.warn(`Extension method ${t} couldn't be found, doing nothing.`)}}function ls(){return te.__SENTRY__=te.__SENTRY__||{extensions:{},hub:void 0},te}function Rf(e){const t=ls(),n=Lc(t);return Lf(t,e),n}function At(){const e=ls();if(e.__SENTRY__&&e.__SENTRY__.acs){const t=e.__SENTRY__.acs.getCurrentHub();if(t)return t}return Ux(e)}function us(){return At().getIsolationScope()}function Ux(e=ls()){return(!Bx(e)||Lc(e).isOlderThan(Of))&&Lf(e,new _f),Lc(e)}function Bx(e){return!!(e&&e.__SENTRY__&&e.__SENTRY__.hub)}function Lc(e){return qg("hub",()=>new _f,e)}function Lf(e,t){if(!e)return!1;const n=e.__SENTRY__=e.__SENTRY__||{};return n.hub=t,!0}function Vx(e,t){return t&&(e.sdk=e.sdk||{},e.sdk.name=e.sdk.name||t.name,e.sdk.version=e.sdk.version||t.version,e.sdk.integrations=[...e.sdk.integrations||[],...t.integrations||[]],e.sdk.packages=[...e.sdk.packages||[],...t.packages||[]]),e}function Hx(e,t,n,a){const i=Sf(n),r={sent_at:new Date().toISOString(),...i&&{sdk:i},...!!a&&t&&{dsn:_a(t)}},o="aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()];return Ya(r,[o])}function Wx(e,t,n,a){const i=Sf(n),r=e.type&&e.type!=="replay_event"?e.type:"event";Vx(e,n&&n.sdk);const o=ux(e,i,a,t);return delete e.sdkProcessingMetadata,Ya(o,[[{type:r},e]])}const Gx="7";function Yf(e){const t=e.protocol?`${e.protocol}:`:"",n=e.port?`:${e.port}`:"";return`${t}//${e.host}${n}${e.path?`/${e.path}`:""}/api/`}function Kx(e){return`${Yf(e)}${e.projectId}/envelope/`}function qx(e,t){return wS({sentry_key:e.publicKey,sentry_version:Gx,...t&&{sentry_client:`${t.name}/${t.version}`}})}function Jx(e,t={}){const n=typeof t=="string"?t:t.tunnel,a=typeof t=="string"||!t._metadata?void 0:t._metadata.sdk;return n||`${Kx(e)}?${qx(e,a)}`}function Zx(e,t){const n=Qg(e);if(!n)return"";const a=`${Yf(n)}embed/error-page/`;let i=`dsn=${_a(n)}`;for(const r in t)if(r!=="dsn"&&r!=="onClose")if(r==="user"){const o=t.user;if(!o)continue;o.name&&(i+=`&name=${encodeURIComponent(o.name)}`),o.email&&(i+=`&email=${encodeURIComponent(o.email)}`)}else i+=`&${encodeURIComponent(r)}=${encodeURIComponent(t[r])}`;return`${a}?${i}`}const Uf=[];function Qx(e){const t={};return e.forEach(n=>{const{name:a}=n,i=t[a];i&&!i.isDefaultInstance&&n.isDefaultInstance||(t[a]=n)}),Object.keys(t).map(n=>t[n])}function Xx(e){const t=e.defaultIntegrations||[],n=e.integrations;t.forEach(o=>{o.isDefaultInstance=!0});let a;Array.isArray(n)?a=[...t,...n]:typeof n=="function"?a=df(n(t)):a=t;const i=Qx(a),r=tE(i,o=>o.name==="Debug");if(r!==-1){const[o]=i.splice(r,1);i.push(o)}return i}function eE(e,t){const n={};return t.forEach(a=>{a&&Vf(e,a,n)}),n}function Bf(e,t){for(const n of t)n&&n.afterAllSetup&&n.afterAllSetup(e)}function Vf(e,t,n){if(n[t.name]){re&&B.log(`Integration skipped because it was already installed: ${t.name}`);return}if(n[t.name]=t,Uf.indexOf(t.name)===-1&&(t.setupOnce(fx,At),Uf.push(t.name)),t.setup&&typeof t.setup=="function"&&t.setup(e),e.on&&typeof t.preprocessEvent=="function"){const a=t.preprocessEvent.bind(t);e.on("preprocessEvent",(i,r)=>a(i,r,e))}if(e.addEventProcessor&&typeof t.processEvent=="function"){const a=t.processEvent.bind(t),i=(r,o)=>a(r,o,e);i.id=t.name,e.addEventProcessor(i)}re&&B.log(`Integration installed: ${t.name}`)}function tE(e,t){for(let n=0;n<e.length;n++)if(t(e[n])===!0)return n;return-1}function Bz(e){return e}function nE(e){let t="";for(const n of e){const a=Object.entries(n.tags),i=a.length>0?`|#${a.map(([r,o])=>`${r}:${o}`).join(",")}`:"";t+=`${n.name}@${n.unit}:${n.metric}|${n.metricType}${i}|T${n.timestamp}
51
51
  `}return t}function aE(e,t,n,a){const i={sent_at:new Date().toISOString()};n&&n.sdk&&(i.sdk={name:n.sdk.name,version:n.sdk.version}),a&&t&&(i.dsn=_a(t));const r=iE(e);return Ya(i,[r])}function iE(e){const t=nE(e);return[{type:"statsd",length:t.length},t]}const Hf="Not capturing exception because it's already been captured.";class rE{constructor(t){if(this._options=t,this._integrations={},this._integrationsInitialized=!1,this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],t.dsn?this._dsn=Qg(t.dsn):re&&B.warn("No DSN provided, client will not send events."),this._dsn){const n=Jx(this._dsn,t);this._transport=t.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...t.transportOptions,url:n})}}captureException(t,n,a){if(cf(t)){re&&B.log(Hf);return}let i=n&&n.event_id;return this._process(this.eventFromException(t,n).then(r=>this._captureEvent(r,n,a)).then(r=>{i=r})),i}captureMessage(t,n,a,i){let r=a&&a.event_id;const o=yc(t)?t:String(t),s=kc(t)?this.eventFromMessage(o,n,a):this.eventFromException(t,a);return this._process(s.then(l=>this._captureEvent(l,a,i)).then(l=>{r=l})),r}captureEvent(t,n,a){if(n&&n.originalException&&cf(n.originalException)){re&&B.log(Hf);return}let i=n&&n.event_id;const o=(t.sdkProcessingMetadata||{}).capturedSpanScope;return this._process(this._captureEvent(t,n,o||a).then(s=>{i=s})),i}captureSession(t){typeof t.release!="string"?re&&B.warn("Discarded session because of missing or non-string release"):(this.sendSession(t),Kn(t,{init:!1}))}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(t){const n=this._transport;return n?(this.metricsAggregator&&this.metricsAggregator.flush(),this._isClientDoneProcessing(t).then(a=>n.flush(t).then(i=>a&&i))):La(!0)}close(t){return this.flush(t).then(n=>(this.getOptions().enabled=!1,this.metricsAggregator&&this.metricsAggregator.close(),n))}getEventProcessors(){return this._eventProcessors}addEventProcessor(t){this._eventProcessors.push(t)}setupIntegrations(t){(t&&!this._integrationsInitialized||this._isEnabled()&&!this._integrationsInitialized)&&this._setupIntegrations()}init(){this._isEnabled()&&this._setupIntegrations()}getIntegrationById(t){return this.getIntegrationByName(t)}getIntegrationByName(t){return this._integrations[t]}getIntegration(t){try{return this._integrations[t.id]||null}catch{return re&&B.warn(`Cannot retrieve integration ${t.id} from the current Client`),null}}addIntegration(t){const n=this._integrations[t.name];Vf(this,t,this._integrations),n||Bf(this,[t])}sendEvent(t,n={}){this.emit("beforeSendEvent",t,n);let a=Wx(t,this._dsn,this._options._metadata,this._options.tunnel);for(const r of n.attachments||[])a=ix(a,sx(r,this._options.transportOptions&&this._options.transportOptions.textEncoder));const i=this._sendEnvelope(a);i&&i.then(r=>this.emit("afterSendEvent",t,r),null)}sendSession(t){const n=Hx(t,this._dsn,this._options._metadata,this._options.tunnel);this._sendEnvelope(n)}recordDroppedEvent(t,n,a){if(this._options.sendClientReports){const i=typeof a=="number"?a:1,r=`${t}:${n}`;re&&B.log(`Recording outcome: "${r}"${i>1?` (${i} times)`:""}`),this._outcomes[r]=(this._outcomes[r]||0)+i}}captureAggregateMetrics(t){re&&B.log(`Flushing aggregated metrics, number of metrics: ${t.length}`);const n=aE(t,this._dsn,this._options._metadata,this._options.tunnel);this._sendEnvelope(n)}on(t,n){this._hooks[t]||(this._hooks[t]=[]),this._hooks[t].push(n)}emit(t,...n){this._hooks[t]&&this._hooks[t].forEach(a=>a(...n))}_setupIntegrations(){const{integrations:t}=this._options;this._integrations=eE(this,t),Bf(this,t),this._integrationsInitialized=!0}_updateSessionFromEvent(t,n){let a=!1,i=!1;const r=n.exception&&n.exception.values;if(r){i=!0;for(const l of r){const c=l.mechanism;if(c&&c.handled===!1){a=!0;break}}}const o=t.status==="ok";(o&&t.errors===0||o&&a)&&(Kn(t,{...a&&{status:"crashed"},errors:t.errors||Number(i||a)}),this.captureSession(t))}_isClientDoneProcessing(t){return new it(n=>{let a=0;const i=1,r=setInterval(()=>{this._numProcessing==0?(clearInterval(r),n(!0)):(a+=i,t&&a>=t&&(clearInterval(r),n(!1)))},i)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(t,n,a,i=us()){const r=this.getOptions(),o=Object.keys(this._integrations);return!n.integrations&&o.length>0&&(n.integrations=o),this.emit("preprocessEvent",t,n),Sx(r,t,n,a,this,i).then(s=>{if(s===null)return s;const l={...i.getPropagationContext(),...a?a.getPropagationContext():void 0};if(!(s.contexts&&s.contexts.trace)&&l){const{traceId:m,spanId:p,parentSpanId:d,dsc:h}=l;s.contexts={trace:{trace_id:m,span_id:p,parent_span_id:d},...s.contexts};const y=h||If(m,this,a);s.sdkProcessingMetadata={dynamicSamplingContext:y,...s.sdkProcessingMetadata}}return s})}_captureEvent(t,n={},a){return this._processEvent(t,n,a).then(i=>i.event_id,i=>{if(re){const r=i;r.logLevel==="log"?B.log(r.message):B.warn(r)}})}_processEvent(t,n,a){const i=this.getOptions(),{sampleRate:r}=i,o=Gf(t),s=Wf(t),l=t.type||"error",c=`before send for type \`${l}\``;if(s&&typeof r=="number"&&Math.random()>r)return this.recordDroppedEvent("sample_rate","error",t),Mc(new Nt(`Discarding event because it's not included in the random sample (sampling rate = ${r})`,"log"));const m=l==="replay_event"?"replay":l,d=(t.sdkProcessingMetadata||{}).capturedSpanIsolationScope;return this._prepareEvent(t,n,a,d).then(h=>{if(h===null)throw this.recordDroppedEvent("event_processor",m,t),new Nt("An event processor returned `null`, will not send event.","log");if(n.data&&n.data.__sentry__===!0)return h;const v=sE(i,h,n);return oE(v,c)}).then(h=>{if(h===null){if(this.recordDroppedEvent("before_send",m,t),o){const b=1+(t.spans||[]).length;this.recordDroppedEvent("before_send","span",b)}throw new Nt(`${c} returned \`null\`, will not send event.`,"log")}const y=a&&a.getSession();if(!o&&y&&this._updateSessionFromEvent(y,h),o){const g=h.sdkProcessingMetadata&&h.sdkProcessingMetadata.spanCountBeforeProcessing||0,b=h.spans?h.spans.length:0,k=g-b;k>0&&this.recordDroppedEvent("before_send","span",k)}const v=h.transaction_info;if(o&&v&&h.transaction!==t.transaction){const g="custom";h.transaction_info={...v,source:g}}return this.sendEvent(h,n),h}).then(null,h=>{throw h instanceof Nt?h:(this.captureException(h,{data:{__sentry__:!0},originalException:h}),new Nt(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
52
52
  Reason: ${h}`))})}_process(t){this._numProcessing++,t.then(n=>(this._numProcessing--,n),n=>(this._numProcessing--,n))}_sendEnvelope(t){if(this.emit("beforeEnvelope",t),this._isEnabled()&&this._transport)return this._transport.send(t).then(null,n=>{re&&B.error("Error while sending event:",n)});re&&B.error("Transport disabled")}_clearOutcomes(){const t=this._outcomes;return this._outcomes={},Object.keys(t).map(n=>{const[a,i]=n.split(":");return{reason:a,category:i,quantity:t[n]}})}}function oE(e,t){const n=`${t} must return \`null\` or a valid event.`;if(qo(e))return e.then(a=>{if(!Fa(a)&&a!==null)throw new Nt(n);return a},a=>{throw new Nt(`${t} rejected with ${a}`)});if(!Fa(e)&&e!==null)throw new Nt(n);return e}function sE(e,t,n){const{beforeSend:a,beforeSendTransaction:i}=e;if(Wf(t)&&a)return a(t,n);if(Gf(t)&&i){if(t.spans){const r=t.spans.length;t.sdkProcessingMetadata={...t.sdkProcessingMetadata,spanCountBeforeProcessing:r}}return i(t,n)}return t}function Wf(e){return e.type===void 0}function Gf(e){return e.type==="transaction"}function lE(e,t){t.debug===!0&&(re?B.enable():Xo(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),mr().update(t.initialScope);const a=new e(t);uE(a),cE(a)}function uE(e){const n=At().getStackTop();n.client=e,n.scope.setClient(e)}function cE(e){e.init?e.init():e.setupIntegrations&&e.setupIntegrations()}const dE=30;function Kf(e,t,n=ex(e.bufferSize||dE)){let a={};const i=o=>n.drain(o);function r(o){const s=[];if(vf(o,(p,d)=>{const h=wf(d);if(hx(a,h)){const y=qf(p,d);e.recordDroppedEvent("ratelimit_backoff",h,y)}else s.push(p)}),s.length===0)return La();const l=Ya(o[0],s),c=p=>{vf(l,(d,h)=>{const y=qf(d,h);e.recordDroppedEvent(p,wf(h),y)})},m=()=>t({body:rx(l,e.textEncoder)}).then(p=>(p.statusCode!==void 0&&(p.statusCode<200||p.statusCode>=300)&&re&&B.warn(`Sentry responded with status code ${p.statusCode} to sent event.`),a=gx(a,p),p),p=>{throw c("network_error"),p});return n.add(m).then(p=>p,p=>{if(p instanceof Nt)return re&&B.error("Skipped sending event because buffer is full."),c("queue_overflow"),La();throw p})}return r.__sentry__baseTransport__=!0,{send:r,flush:i}}function qf(e,t){if(!(t!=="event"&&t!=="transaction"))return Array.isArray(e)?e[1]:void 0}function Jf(e,t,n=[t],a="npm"){const i=e._metadata||{};i.sdk||(i.sdk={name:`sentry.javascript.${t}`,packages:n.map(r=>({name:`${a}:@sentry/${r}`,version:Rc})),version:Rc}),e._metadata=i}const mE=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/],pE=[/^.*\/healthcheck$/,/^.*\/healthy$/,/^.*\/live$/,/^.*\/ready$/,/^.*\/heartbeat$/,/^.*\/health$/,/^.*\/healthz$/],hE="InboundFilters",gE=(e={})=>({name:hE,setupOnce(){},processEvent(t,n,a){const i=a.getOptions(),r=fE(e,i);return bE(t,r)?null:t}});function fE(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:mE],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[],...e.disableTransactionDefaults?[]:pE],ignoreInternal:e.ignoreInternal!==void 0?e.ignoreInternal:!0}}function bE(e,t){return t.ignoreInternal&&xE(e)?(re&&B.warn(`Event dropped due to being internal Sentry Error.
53
53
  Event: ${jn(e)}`),!0):yE(e,t.ignoreErrors)?(re&&B.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
@@ -425,7 +425,7 @@ Url: ${cs(e)}`),!0)}function yE(e,t){return e.type||!t||!t.length?!1:SE(e).some(
425
425
  width: 60px;
426
426
  height: 60px;
427
427
  }
428
- `+iy,Qt=e=>{if(!e)return"";const t=new Date(e),n={year:"numeric",month:"short",day:"numeric"};return t.toLocaleDateString("en-GB",n)};function dd(){const[e]=window.location.hash.substr(1).split("?");e&&/^\/portal\/?(?:\/(\w+(?:\/\w+)*))?\/?$/.test(e)&&window.history.pushState("",document.title,window.location.pathname+window.location.search)}function u0({page:e}){const t={signin:"#/portal/signin",signup:"#/portal/signup"};return Object.keys(t).includes(e)?t[e]:t.default}function oy({page:e,siteUrl:t}){const n=t||`${window.location.protocol}//${window.location.host}${window.location.pathname}`,a=u0({page:e});return`${n}${a}`}function Ka(){return!(navigator&&navigator.cookieEnabled)}function c0({event:e}){var i,r,o,s;const n=(((s=(o=(r=(i=e==null?void 0:e.exception)==null?void 0:i.values)==null?void 0:r[0])==null?void 0:o.stacktrace)==null?void 0:s.frames)||[]).map(l=>l.filename).filter(l=>!!l);return(n[n.length-1]||"").includes("@tryghost/portal")}function ot({member:e={}}){if(Mt({member:e})){const n=(e.subscriptions||[]).find(a=>["active","trialing","unpaid","past_due"].includes(a.status));return!(n!=null&&n.price)&&(n!=null&&n.plan)&&(n.price=n.plan),n}return null}function Tn({member:e={}}){if(!e)return!1;const t=ot({member:e});if(t){const{price:n}=t;return n&&n.amount===0}else if(!t&&e.paid)return!0;return!1}function Mt({member:e={}}){return e&&e.paid}function d0({product:e}){return e!=null&&e.monthlyPrice?e.monthlyPrice.currency:null}function wr({site:e}){return(e==null?void 0:e.editor_default_email_recipients)!=="disabled"}function md({member:e}){var n;const t=ot({member:e});return(n=t==null?void 0:t.tier)!=null&&n.expiry_at?Qt(t.tier.expiry_at):""}function m0({site:e,member:t}){const n=Zn({member:t}),a=n==null?void 0:n.currency,i=Ds({site:e});return n!=null&&n.id?i.filter(r=>kd(d0({product:r}),a)):i}function p0({prices:e,currency:t}){return e.filter(n=>kd(n.currency||"",t||""))}function pd({subscription:e}){var t,n;return e&&e.price?{...e.price,stripe_price_id:e.price.id,id:e.price.price_id,price:e.price.amount/100,name:e.price.nickname,tierId:(t=e.tier)==null?void 0:t.id,cadence:((n=e.price)==null?void 0:n.interval)==="month"?"month":"year",currency:e.price.currency.toLowerCase(),currency_symbol:ve(e.price.currency)}:null}function Zn({member:e}){const t=ot({member:e});return pd({subscription:t})}function sy({member:e,site:t}){const n=ot({member:e}),a=pd({subscription:n});return Fs({site:t}).find(r=>r.id===(a==null?void 0:a.product.product_id))}function h0({priceId:e,site:t,member:n}){const a=Zn({member:n}),{tierId:i,cadence:r}=ta({site:t,priceId:e});return(a==null?void 0:a.tierId)===i&&(a==null?void 0:a.cadence)===r}function g0({member:e,subscriptionId:t}){return Mt({member:e})?(e.subscriptions||[]).find(a=>a.id===t):null}function ly({member:e}){var n;const t=ot({member:e});return((n=t==null?void 0:t.tier)==null?void 0:n.name)||""}function qa({plans:e,site:t={}}){return e=e||Ys({site:t}),!e||e.length===0||e.length===1&&e[0].type==="free"}function f0(e,t){const a=Ds({site:e}).find(i=>i.type==="paid");return t==="monthly"?{cadence:"month",tierId:a.id}:t==="yearly"?{cadence:"year",tierId:a.id}:{priceId:t}}function b0({site:e={},priceId:t}){const n=Ls({site:e});if(t==="free")return!n||n.length===0||n.find(a=>a.type==="free");if(n&&n.length>0&&t==="monthly"){const a=n.find(r=>r.name==="Monthly"),i=n.find(r=>r.interval==="month");return a||i}else if(n&&n.length>0&&t==="yearly"){const a=n.find(r=>r.name==="Yearly"),i=n.find(r=>r.interval==="year");return a||i}else if(n&&n.length>0&&t)return n.find(a=>a.id===t);return null}function y0({site:e}){return(e==null?void 0:e.members_signup_access)==="paid"}function Dt({site:e={}}){return(e==null?void 0:e.members_signup_access)==="invite"}function Xt({site:e={},pageQuery:t=""}){return Ys({site:e,pageQuery:t}).length>0}function k0({site:e}){return(e==null?void 0:e.recommendations_enabled)===!0}function Pn({site:e}){return(e==null?void 0:e.members_signup_access)!=="none"}function As({site:e}){const t=(e==null?void 0:e.members_signup_access)==="all"||(e==null?void 0:e.members_signup_access)==="paid",n=(e==null?void 0:e.is_stripe_configured)||qa({site:e});return t&&n}function hd({site:e}){return(e==null?void 0:e.members_signup_access)==="all"}function uy(){return window.location.hostname.replace(/^www\./,"")}function Is({site:e}){const{portal_products:t}=e||{};return!!t}function Ms({site:e}){return(e==null?void 0:e.comments_enabled)&&(e==null?void 0:e.comments_enabled)!=="off"}function v0({site:e}){var t,n,a,i,r;try{if(!e)return null;if(e.tiers&&(e.products=e.tiers),e.products=(t=e.products)==null?void 0:t.map(o=>({...o,monthlyPrice:o.monthly_price,yearlyPrice:o.yearly_price})),e.is_stripe_configured=!!e.paid_members_enabled,(a=(n=e.products)==null?void 0:n[0])!=null&&a.visibility){e.portal_products=e.products.filter(s=>s.visibility!=="none"&&s.type==="paid").map(s=>s.id);const o=e.products.find(s=>s.type==="free");o&&(e.portal_plans=(i=e.portal_plans)==null?void 0:i.filter(s=>s!=="free"),(o==null?void 0:o.visibility)==="public"&&((r=e.portal_plans)==null||r.push("free")))}return e}catch(o){console.warn("[Portal] Failed to read site data:",o)}}function Ds({site:e}){const{portal_products:t,products:n=[],portal_plans:a=[]}=e||{};return!a.includes("monthly")&&!a.includes("yearly")?[]:n.filter(i=>!!i).filter(i=>e.is_stripe_configured?!0:i.type!=="paid").filter(i=>!!(i.monthlyPrice&&i.yearlyPrice)).filter(i=>Object.keys(i.monthlyPrice).length>0&&Object.keys(i.yearlyPrice).length>0).filter(i=>t&&n.length>1?t.includes(i.id):!0).sort((i,r)=>{var o,s;return((o=i==null?void 0:i.monthlyPrice)==null?void 0:o.amount)-((s=r==null?void 0:r.monthlyPrice)==null?void 0:s.amount)}).map(i=>(i.monthlyPrice={...i.monthlyPrice,currency_symbol:ve(i.monthlyPrice.currency)},i.yearlyPrice={...i.yearlyPrice,currency_symbol:ve(i.yearlyPrice.currency)},i))}function Qn({site:e}){const{products:t=[]}=e||{};return t.find(n=>n.type==="free")}function Fs({site:e}){const{products:t=[],portal_plans:n=[]}=e||{};return!n.includes("monthly")&&!n.includes("yearly")?[]:t.filter(a=>!!a).filter(a=>!!(a.monthlyPrice&&a.yearlyPrice)).filter(a=>Object.keys(a.monthlyPrice).length>0&&Object.keys(a.yearlyPrice).length>0).sort((a,i)=>{var r,o;return((r=a==null?void 0:a.monthlyPrice)==null?void 0:r.amount)-((o=i==null?void 0:i.monthlyPrice)==null?void 0:o.amount)}).map(a=>(a.monthlyPrice={...a.monthlyPrice,currency_symbol:ve(a.monthlyPrice.currency)},a.yearlyPrice={...a.yearlyPrice,currency_symbol:ve(a.yearlyPrice.currency)},a))}function Os({site:e,pageQuery:t}){const n=Ds({site:e});return t==="free"?[]:(Sr({site:e})&&n.unshift({id:"free",type:"free"}),n)}function _s({site:e,pageQuery:t}){return Os({site:e,pageQuery:t}).some(a=>!!(a!=null&&a.trial_days))}function w0({site:e}){const t=Qn({site:e});return(t==null?void 0:t.benefits)||[]}function cy({site:e}){const t=Qn({site:e});return(t==null?void 0:t.name)||"Free"}function S0({site:e}){const t=Qn({site:e});return t==null?void 0:t.description}function x0({site:e}){var n;const t=Qn({site:e});return!!(t!=null&&t.description||(n=t==null?void 0:t.benefits)!=null&&n.length)}function Xn({site:e,productId:t}){return Fs({site:e}).find(a=>a.id===t)}function E0({site:e=null,products:t=null}){return!e&&!t?[]:(t||Ds({site:e})).reduce((i,r)=>(r.monthlyPrice&&r.yearlyPrice&&(i.push(r.monthlyPrice),i.push(r.yearlyPrice)),i),[])}function Sr({site:e}){const{portal_plans:t}=e||{};return hd({site:e})&&t.includes("free")}function ea({site:e}){const{newsletters:t=[]}=e||{};return t==null||t.sort((n,a)=>n.sort_order-a.sort_order),t}function xr({site:e}){const{newsletters:t}=e||{};return(t==null?void 0:t.length)>1}function dy({member:e}){var t;return(t=e==null?void 0:e.email_suppression)==null?void 0:t.suppressed}function my({site:e}){return Os({site:e}).length===1&&Sr({site:e})}function gd({sub:e}={}){var a;return(!(e!=null&&e.offer)||((a=e==null?void 0:e.offer)==null?void 0:a.type)==="trial")&&(e==null?void 0:e.trial_end_at)&&!C0(new Date(e==null?void 0:e.trial_end_at))}function Rs(e){return(e==null?void 0:e.type)==="percent"&&(e==null?void 0:e.amount)===100&&(e==null?void 0:e.duration)==="repeating"&&(e==null?void 0:e.redemption_type)==="retention"}function C0(e){return e<new Date}function py({site:e,priceId:t}){return t==="free"?Qn({site:e}):Fs({site:e}).find(a=>{var i,r;return((i=a==null?void 0:a.monthlyPrice)==null?void 0:i.id)===t||((r=a==null?void 0:a.yearlyPrice)==null?void 0:r.id)===t})}function ta({site:e,priceId:t}){var r;if(t==="free")return Qn({site:e});const a=Fs({site:e}).find(o=>{var s,l;return((s=o==null?void 0:o.monthlyPrice)==null?void 0:s.id)===t||((l=o==null?void 0:o.yearlyPrice)==null?void 0:l.id)===t});let i="month";return((r=a==null?void 0:a.yearlyPrice)==null?void 0:r.id)===t&&(i="year"),{tierId:a==null?void 0:a.id,cadence:i}}function Ls({site:e,products:t=null}){const{portal_plans:n=[],is_stripe_configured:a}=e||{};return a?E0({site:e,products:t}).filter(r=>!!(r&&r.id)).map(r=>({...r,price_id:r.id,price:r.amount/100,name:r.nickname,currency_symbol:ve(r.currency)})).filter(r=>r.amount!==0&&r.type==="recurring").filter(r=>r.interval==="month"?n.includes("monthly"):r.interval==="year"?n.includes("yearly"):!1).sort((r,o)=>r.amount-o.amount).sort((r,o)=>!r.currency||!o.currency?0:r.currency.localeCompare(o.currency,void 0,{ignorePunctuation:!0})):[]}function j0({site:e}){const t=Ls({site:e});let n={currency:"usd",currency_symbol:"$"};return(t==null?void 0:t.length)>0&&(n.currency=t[0].currency,n.currency_symbol=t[0].currency_symbol),n}function Ys({site:e={},pageQuery:t=""}={}){const n=[];if(Sr({site:e})){const i=j0({site:e});n.push({id:"free",type:"free",price:0,amount:0,name:cy({site:e}),...i})}return t==="free"&&Sr({site:e})||Ls({site:e}).forEach(r=>{n.push(r)}),n}const $0=({member:e})=>e?e.email:"",fd=({member:e})=>e?e.email_suppression:"",T0=({site:e})=>e&&e.firstpromoter_account,P0=({member:e})=>e?e.name:"",Er=({site:e})=>{var a;const{members_support_address:t,support_email_address:n}=e||{};if(n)return n;if((t==null?void 0:t.indexOf("@"))<0){const i=bd({site:e}),r=(i==null?void 0:i.replace(/^(www)\.(?=[^/]*\..{2,5})/,""))||"";return`${t}@${r}`}if(((a=t==null?void 0:t.split("@"))==null?void 0:a.length)>1){const[i,r]=t.split("@"),o=(r==null?void 0:r.replace(/^(www)\.(?=[^/]*\..{2,5})/,""))||"";return`${i}@${o}`}return t||""},z0=({site:e})=>{const{default_email_address:t}=e||{},n=t||`noreply@${bd({site:e})}`,a=ea({site:e}),i=a==null?void 0:a[0];return i&&i.sender_email?i.sender_email:n},bd=({site:e})=>{try{return new URL(e.url).origin.replace(/^http(s?):\/\//,"").replace(/\/$/,"")}catch{return e.url.replace(/^http(s?):\/\//,"").replace(/\/$/,"")}},ve=e=>Intl.NumberFormat("en",{currency:e,style:"currency"}).format(0).replace(/[\d\s.]/g,""),yd=e=>isNaN(e)?0:e/100,N0=(e={})=>{const t=ve(e.currency),n=yd(e.amount);return`${t}${n}/${e.interval}`},zn=e=>e==null?"":e.toLocaleString(),le=({type:e,status:t,autoHide:n,duration:a=2600,closeable:i,state:r,message:o,meta:s={}})=>{let l=0;return r&&r.popupNotification&&(l=(r.popupNotification.count||0)+1),{type:e,status:t,autoHide:n,closeable:i,duration:a,meta:s,message:o,count:l}};function kd(e,t){return(e==null?void 0:e.toLowerCase())===(t==null?void 0:t.toLowerCase())}function hy({site:e,pageQuery:t}){var i,r;const n=/^(?:(\S+?))?\/monthly$/,a=/^(?:(\S+?))?\/yearly$/;if(n.test(t||"")){const[,o]=t.match(n),s=Xn({site:e,productId:o});return(i=s==null?void 0:s.monthlyPrice)==null?void 0:i.id}else if(a.test(t||"")){const[,o]=t.match(a),s=Xn({site:e,productId:o});return(r=s==null?void 0:s.yearlyPrice)==null?void 0:r.id}return null}const A0=({offer:e})=>{if(Rs(e)){const t=e.duration_in_months;return`${t===1?"1 month":`${t} months`}`}else{if(e.type==="fixed")return`${ve(e.currency)}${e.amount/100}`;if(e.type==="percent")return`${e.amount}%`}return""},gy=({offer:e,price:t,useFormatted:n=!1})=>{const a=t.amount;let i=a;if(e.type==="fixed"&&kd(e.currency,t.currency))i=Math.max(0,a-e.amount);else if(e.type==="percent"){const o=Math.round(a*(e.amount/100));i=Math.max(0,a-o)}const r=i/100;return n?Intl.NumberFormat("en",{currency:t==null?void 0:t.currency,style:"currency"}).format(r):r},fy=({offer:e})=>e.redemption_type==="retention",I0=({site:e,offer:t})=>(t==null?void 0:t.status)!=="active"?!1:t.tier?!!Xn({site:e,productId:t.tier.id}):fy({offer:t});function M0({tier:e,priceId:t}){return e!=null&&e.monthly_price?{id:`price-${t}`,active:!0,type:"recurring",nickname:"Monthly",currency:e.currency,amount:e.monthly_price,interval:"month"}:null}function D0({tier:e,priceId:t}){return e!=null&&e.yearly_price?{id:`price-${t}`,active:!0,type:"recurring",nickname:"Yearly",currency:e.currency,amount:e.yearly_price,interval:"year"}:null}function F0({tier:e}){var t;return(t=e==null?void 0:e.benefits)==null?void 0:t.map(n=>({name:n}))}const O0=({tiers:e})=>{let t=0;return e.map(n=>{let a=M0({tier:n,priceId:t});t+=1;let i=D0({tier:n,priceId:t});t+=1;let r=F0({tier:n});return{...n,benefits:r,monthly_price:a,yearly_price:i}})};function Cr(){const e="ghost-history";try{const t=sessionStorage.getItem(e);if(t){const n=JSON.parse(t);if(Array.isArray(n))return n}}catch(t){console.warn("[Portal] Failed to load member URL history:",t)}}function _0({member:e}){if(!(e!=null&&e.created_at))return!1;const t=new Date,n=new Date(e.created_at),a=t.getTime()-n.getTime();return Math.round(a/(1e3*60*60))<24}const by=function(){return R0()||yy()},R0=function(){const[e]=window.location.hash.substr(1).split("?");return e==="/portal/preview"},yy=function(){const[e]=window.location.hash.substr(1).split("?");return e==="/portal/preview/offer"},L0={preview:by,offerPreview:yy,dev:function({customSiteUrl:e=""}={}){return!1},test:function(){return!1}},de=(e=[],t={})=>e.some(n=>{const a=L0[n];return!!(a&&a(t))}),ky={"icon-1":i0,"icon-2":r0,"icon-3":o0,"icon-4":s0,"icon-5":l0},vy=({hasText:e})=>({frame:{zIndex:"3999998",position:"fixed",bottom:"0",right:"0",width:"500px",maxWidth:"500px",height:"98px",animation:"250ms ease 0s 1 normal none running animation-bhegco",transition:"opacity 0.3s ease 0s",overflow:"hidden",...{...e?{}:{width:"105px"},...de(["preview"])?{opacity:1}:{}}},userIcon:{width:"34px",height:"34px",color:"#fff"},buttonIcon:{width:"24px",height:"24px",color:"#fff"},closeIcon:{width:"20px",height:"20px",color:"#fff"}}),om=class om extends Z.Component{constructor(t){super(t),this.state={},this.container=Z.createRef(),this.height=null,this.width=null}updateHeight(t){this.props.updateHeight&&this.props.updateHeight(t)}updateWidth(t){this.props.updateWidth&&this.props.updateWidth(t)}componentDidMount(){this.container&&(this.height=this.container.current&&this.container.current.offsetHeight,this.width=this.container.current&&this.container.current.offsetWidth,this.updateHeight(this.height),this.updateWidth(this.width))}componentDidUpdate(){if(this.container){const t=this.container.current&&this.container.current.offsetHeight;let n=this.container.current&&this.container.current.offsetWidth;t!==this.height&&(this.height=t,this.updateHeight(this.height)),n!==this.width&&(this.width=n,this.updateWidth(this.width))}}renderTriggerIcon(){const{portal_button_icon:t="",portal_button_style:n=""}=this.context.site||{},a=vy({brandColor:this.context.brandColor}),i=this.context.member&&this.context.member.avatar_image;if(!n.includes("icon")&&!this.context.member)return null;if(i)return u.jsx(ud,{gravatar:i});if(this.context.member)return u.jsx(ld,{style:a.userIcon});if(Object.keys(ky).includes(t)){const r=ky[t];return u.jsx(r,{style:a.buttonIcon})}else return t?u.jsx("img",{style:{width:"26px",height:"26px"},src:t,alt:""}):(this.hasText()&&(a.userIcon.width="26px",a.userIcon.height="26px"),u.jsx(ld,{style:a.userIcon}))}hasText(){const{portal_button_signup_text:t,portal_button_style:n}=this.context.site;return["icon-and-text","text-only"].includes(n)&&!this.context.member&&t}renderText(){const{portal_button_signup_text:t}=this.context.site;return this.hasText()?u.jsxs("span",{className:"gh-portal-triggerbtn-label",children:[" ",t," "]}):null}onToggle(){const{showPopup:t,member:n,site:a}=this.context;if(t){this.context.doAction("closePopup");return}if(n){this.context.doAction("openPopup",{page:"accountHome"});return}if(Pn({site:a})){const i=Dt({site:a})||!Xt({site:a})?"signin":"signup";this.context.doAction("openPopup",{page:i});return}}render(){const t=this.hasText(),{member:n}=this.context,a=n?"halo":"";return t?u.jsx("div",{className:"gh-portal-triggerbtn-wrapper",ref:this.container,children:u.jsxs("div",{className:"gh-portal-triggerbtn-container with-label",onClick:i=>this.onToggle(i),"data-testid":"portal-trigger-button",children:[this.renderTriggerIcon(),t?this.renderText():""]})}):u.jsx("div",{className:"gh-portal-triggerbtn-wrapper",children:u.jsx("div",{className:"gh-portal-triggerbtn-container "+a,onClick:i=>this.onToggle(i),"data-testid":"portal-trigger-button",children:this.renderTriggerIcon()})})}};om.contextType=_;let vd=om;const sm=class sm extends Z.Component{constructor(t){super(t),this.state={width:null,isMobile:window.innerWidth<640},this.buttonRef=Z.createRef(),this.handleResize=this.handleResize.bind(this)}componentDidMount(){window.addEventListener("resize",this.handleResize),this.handleResize(),setTimeout(()=>{if(this.buttonRef.current){const t=this.buttonRef.current.node;t&&(this.buttonMargin=window.getComputedStyle(t).getPropertyValue("margin-right"))}},0)}componentWillUnmount(){window.removeEventListener("resize",this.handleResize)}handleResize(){this.setState({isMobile:window.innerWidth<640})}onWidthChange(t){this.setState({width:t})}hasText(){const{portal_button_signup_text:t,portal_button_style:n}=this.context.site;return["icon-and-text","text-only"].includes(n)&&!this.context.member&&t}renderFrameStyles(){const{brandColor:t}=this.context,n=t?`:root { --brandcolor: ${t} }`+ry:ry;return u.jsx("style",{dangerouslySetInnerHTML:{__html:n}})}render(){const t=this.context.site,{portal_button:n}=t,{showPopup:a,scrollbarWidth:i}=this.context;if(this.state.isMobile||!n||!Pn({site:t})||de(["offerPreview"]))return null;const r=this.hasText(),s={...vy({brandColor:this.context.brandColor,hasText:r}).frame};if(this.state.width){const l=this.state.width+2;s.width=`${l}px`}return i&&a&&(s.marginRight=`calc(${i}px + ${this.buttonMargin})`),u.jsx(sd,{ref:this.buttonRef,dataTestId:"portal-trigger-frame",className:"gh-portal-triggerbtn-iframe",style:s,title:"portal-trigger",head:this.renderFrameStyles(),children:u.jsx(vd,{isPopupOpen:a,updateWidth:l=>this.onWidthChange(l)})})}};sm.contextType=_;let wd=sm;const Sd=cd+`
428
+ `+iy,Qt=e=>{if(!e)return"";const t=new Date(e),n={year:"numeric",month:"short",day:"numeric"};return t.toLocaleDateString("en-GB",n)};function dd(){const[e]=window.location.hash.substr(1).split("?");e&&/^\/portal\/?(?:\/(\w+(?:\/\w+)*))?\/?$/.test(e)&&window.history.pushState("",document.title,window.location.pathname+window.location.search)}function u0({page:e}){const t={signin:"#/portal/signin",signup:"#/portal/signup"};return Object.keys(t).includes(e)?t[e]:t.default}function oy({page:e,siteUrl:t}){const n=t||`${window.location.protocol}//${window.location.host}${window.location.pathname}`,a=u0({page:e});return`${n}${a}`}function Ka(){return!(navigator&&navigator.cookieEnabled)}function c0({event:e}){var i,r,o,s;const n=(((s=(o=(r=(i=e==null?void 0:e.exception)==null?void 0:i.values)==null?void 0:r[0])==null?void 0:o.stacktrace)==null?void 0:s.frames)||[]).map(l=>l.filename).filter(l=>!!l);return(n[n.length-1]||"").includes("@tryghost/portal")}function ot({member:e={}}){if(Mt({member:e})){const n=(e.subscriptions||[]).find(a=>["active","trialing","unpaid","past_due"].includes(a.status));return!(n!=null&&n.price)&&(n!=null&&n.plan)&&(n.price=n.plan),n}return null}function Tn({member:e={}}){if(!e)return!1;const t=ot({member:e});if(t){const{price:n}=t;return n&&n.amount===0}else if(!t&&e.paid)return!0;return!1}function Mt({member:e={}}){return e&&e.paid}function d0({product:e}){return e!=null&&e.monthlyPrice?e.monthlyPrice.currency:null}function wr({site:e}){return(e==null?void 0:e.editor_default_email_recipients)!=="disabled"}function md({member:e}){var n;const t=ot({member:e});return(n=t==null?void 0:t.tier)!=null&&n.expiry_at?Qt(t.tier.expiry_at):""}function m0({site:e,member:t}){const n=Zn({member:t}),a=n==null?void 0:n.currency,i=Ds({site:e});return n!=null&&n.id?i.filter(r=>kd(d0({product:r}),a)):i}function p0({prices:e,currency:t}){return e.filter(n=>kd(n.currency||"",t||""))}function pd({subscription:e}){var t,n;return e&&e.price?{...e.price,stripe_price_id:e.price.id,id:e.price.price_id,price:e.price.amount/100,name:e.price.nickname,tierId:(t=e.tier)==null?void 0:t.id,cadence:((n=e.price)==null?void 0:n.interval)==="month"?"month":"year",currency:e.price.currency.toLowerCase(),currency_symbol:ve(e.price.currency)}:null}function Zn({member:e}){const t=ot({member:e});return pd({subscription:t})}function sy({member:e,site:t}){const n=ot({member:e}),a=pd({subscription:n});return Fs({site:t}).find(r=>r.id===(a==null?void 0:a.product.product_id))}function h0({priceId:e,site:t,member:n}){const a=Zn({member:n}),{tierId:i,cadence:r}=ta({site:t,priceId:e});return(a==null?void 0:a.tierId)===i&&(a==null?void 0:a.cadence)===r}function g0({member:e,subscriptionId:t}){return Mt({member:e})?(e.subscriptions||[]).find(a=>a.id===t):null}function ly({member:e}){var n;const t=ot({member:e});return((n=t==null?void 0:t.tier)==null?void 0:n.name)||""}function qa({plans:e,site:t={}}){return e=e||Ys({site:t}),!e||e.length===0||e.length===1&&e[0].type==="free"}function f0(e,t){const a=Ds({site:e}).find(i=>i.type==="paid");return t==="monthly"?{cadence:"month",tierId:a.id}:t==="yearly"?{cadence:"year",tierId:a.id}:{priceId:t}}function b0({site:e={},priceId:t}){const n=Ls({site:e});if(t==="free")return!n||n.length===0||n.find(a=>a.type==="free");if(n&&n.length>0&&t==="monthly"){const a=n.find(r=>r.name==="Monthly"),i=n.find(r=>r.interval==="month");return a||i}else if(n&&n.length>0&&t==="yearly"){const a=n.find(r=>r.name==="Yearly"),i=n.find(r=>r.interval==="year");return a||i}else if(n&&n.length>0&&t)return n.find(a=>a.id===t);return null}function y0({site:e}){return(e==null?void 0:e.members_signup_access)==="paid"}function Dt({site:e={}}){return(e==null?void 0:e.members_signup_access)==="invite"}function Xt({site:e={},pageQuery:t=""}){return Ys({site:e,pageQuery:t}).length>0}function k0({site:e}){return(e==null?void 0:e.recommendations_enabled)===!0}function Pn({site:e}){return(e==null?void 0:e.members_signup_access)!=="none"}function As({site:e}){const t=(e==null?void 0:e.members_signup_access)==="all"||(e==null?void 0:e.members_signup_access)==="paid",n=(e==null?void 0:e.is_stripe_configured)||qa({site:e});return t&&n}function hd({site:e}){return(e==null?void 0:e.members_signup_access)==="all"}function uy(){return window.location.hostname.replace(/^www\./,"")}function Is({site:e}){const{portal_products:t}=e||{};return!!t}function Ms({site:e}){return(e==null?void 0:e.comments_enabled)&&(e==null?void 0:e.comments_enabled)!=="off"}function v0({site:e}){var t,n,a,i,r;try{if(!e)return null;if(e.tiers&&(e.products=e.tiers),e.products=(t=e.products)==null?void 0:t.map(o=>({...o,monthlyPrice:o.monthly_price,yearlyPrice:o.yearly_price})),e.is_stripe_configured=!!e.paid_members_enabled,(a=(n=e.products)==null?void 0:n[0])!=null&&a.visibility){e.portal_products=e.products.filter(s=>s.visibility!=="none"&&s.type==="paid").map(s=>s.id);const o=e.products.find(s=>s.type==="free");o&&(e.portal_plans=(i=e.portal_plans)==null?void 0:i.filter(s=>s!=="free"),(o==null?void 0:o.visibility)==="public"&&((r=e.portal_plans)==null||r.push("free")))}return e}catch(o){console.warn("[Portal] Failed to read site data:",o)}}function Ds({site:e}){const{portal_products:t,products:n=[],portal_plans:a=[]}=e||{};return!a.includes("monthly")&&!a.includes("yearly")?[]:n.filter(i=>!!i).filter(i=>e.is_stripe_configured?!0:i.type!=="paid").filter(i=>!!(i.monthlyPrice&&i.yearlyPrice)).filter(i=>Object.keys(i.monthlyPrice).length>0&&Object.keys(i.yearlyPrice).length>0).filter(i=>t&&n.length>1?t.includes(i.id):!0).sort((i,r)=>{var o,s;return((o=i==null?void 0:i.monthlyPrice)==null?void 0:o.amount)-((s=r==null?void 0:r.monthlyPrice)==null?void 0:s.amount)}).map(i=>(i.monthlyPrice={...i.monthlyPrice,currency_symbol:ve(i.monthlyPrice.currency)},i.yearlyPrice={...i.yearlyPrice,currency_symbol:ve(i.yearlyPrice.currency)},i))}function Qn({site:e}){const{products:t=[]}=e||{};return t.find(n=>n.type==="free")}function Fs({site:e}){const{products:t=[],portal_plans:n=[]}=e||{};return!n.includes("monthly")&&!n.includes("yearly")?[]:t.filter(a=>!!a).filter(a=>!!(a.monthlyPrice&&a.yearlyPrice)).filter(a=>Object.keys(a.monthlyPrice).length>0&&Object.keys(a.yearlyPrice).length>0).sort((a,i)=>{var r,o;return((r=a==null?void 0:a.monthlyPrice)==null?void 0:r.amount)-((o=i==null?void 0:i.monthlyPrice)==null?void 0:o.amount)}).map(a=>(a.monthlyPrice={...a.monthlyPrice,currency_symbol:ve(a.monthlyPrice.currency)},a.yearlyPrice={...a.yearlyPrice,currency_symbol:ve(a.yearlyPrice.currency)},a))}function Os({site:e,pageQuery:t}){const n=Ds({site:e});return t==="free"?[]:(Sr({site:e})&&n.unshift({id:"free",type:"free"}),n)}function _s({site:e,pageQuery:t}){return Os({site:e,pageQuery:t}).some(a=>!!(a!=null&&a.trial_days))}function w0({site:e}){const t=Qn({site:e});return(t==null?void 0:t.benefits)||[]}function cy({site:e}){const t=Qn({site:e});return(t==null?void 0:t.name)||"Free"}function S0({site:e}){const t=Qn({site:e});return t==null?void 0:t.description}function x0({site:e}){var n;const t=Qn({site:e});return!!(t!=null&&t.description||(n=t==null?void 0:t.benefits)!=null&&n.length)}function Xn({site:e,productId:t}){return Fs({site:e}).find(a=>a.id===t)}function E0({site:e=null,products:t=null}){return!e&&!t?[]:(t||Ds({site:e})).reduce((i,r)=>(r.monthlyPrice&&r.yearlyPrice&&(i.push(r.monthlyPrice),i.push(r.yearlyPrice)),i),[])}function Sr({site:e}){const{portal_plans:t}=e||{};return hd({site:e})&&t.includes("free")}function ea({site:e}){const{newsletters:t=[]}=e||{};return t==null||t.sort((n,a)=>n.sort_order-a.sort_order),t}function xr({site:e}){const{newsletters:t}=e||{};return(t==null?void 0:t.length)>1}function dy({member:e}){var t;return(t=e==null?void 0:e.email_suppression)==null?void 0:t.suppressed}function my({site:e}){return Os({site:e}).length===1&&Sr({site:e})}function gd({sub:e}={}){var a;return(!(e!=null&&e.offer)||((a=e==null?void 0:e.offer)==null?void 0:a.type)==="trial")&&(e==null?void 0:e.trial_end_at)&&!C0(new Date(e==null?void 0:e.trial_end_at))}function Rs(e){return(e==null?void 0:e.type)==="percent"&&(e==null?void 0:e.amount)===100&&(e==null?void 0:e.duration)==="repeating"&&(e==null?void 0:e.redemption_type)==="retention"}function C0(e){return e<new Date}function py({site:e,priceId:t}){return t==="free"?Qn({site:e}):Fs({site:e}).find(a=>{var i,r;return((i=a==null?void 0:a.monthlyPrice)==null?void 0:i.id)===t||((r=a==null?void 0:a.yearlyPrice)==null?void 0:r.id)===t})}function ta({site:e,priceId:t}){var r;if(t==="free")return Qn({site:e});const a=Fs({site:e}).find(o=>{var s,l;return((s=o==null?void 0:o.monthlyPrice)==null?void 0:s.id)===t||((l=o==null?void 0:o.yearlyPrice)==null?void 0:l.id)===t});let i="month";return((r=a==null?void 0:a.yearlyPrice)==null?void 0:r.id)===t&&(i="year"),{tierId:a==null?void 0:a.id,cadence:i}}function Ls({site:e,products:t=null}){const{portal_plans:n=[],is_stripe_configured:a}=e||{};return a?E0({site:e,products:t}).filter(r=>!!(r&&r.id)).map(r=>({...r,price_id:r.id,price:r.amount/100,name:r.nickname,currency_symbol:ve(r.currency)})).filter(r=>r.amount!==0&&r.type==="recurring").filter(r=>r.interval==="month"?n.includes("monthly"):r.interval==="year"?n.includes("yearly"):!1).sort((r,o)=>r.amount-o.amount).sort((r,o)=>!r.currency||!o.currency?0:r.currency.localeCompare(o.currency,void 0,{ignorePunctuation:!0})):[]}function j0({site:e}){const t=Ls({site:e});let n={currency:"usd",currency_symbol:"$"};return(t==null?void 0:t.length)>0&&(n.currency=t[0].currency,n.currency_symbol=t[0].currency_symbol),n}function Ys({site:e={},pageQuery:t=""}={}){const n=[];if(Sr({site:e})){const i=j0({site:e});n.push({id:"free",type:"free",price:0,amount:0,name:cy({site:e}),...i})}return t==="free"&&Sr({site:e})||Ls({site:e}).forEach(r=>{n.push(r)}),n}const $0=({member:e})=>e?e.email:"",fd=({member:e})=>e?e.email_suppression:"",T0=({site:e})=>e&&e.firstpromoter_account,P0=({member:e})=>e?e.name:"",Er=({site:e})=>{var a;const{members_support_address:t,support_email_address:n}=e||{};if(n)return n;if((t==null?void 0:t.indexOf("@"))<0){const i=bd({site:e}),r=(i==null?void 0:i.replace(/^(www)\.(?=[^/]*\..{2,5})/,""))||"";return`${t}@${r}`}if(((a=t==null?void 0:t.split("@"))==null?void 0:a.length)>1){const[i,r]=t.split("@"),o=(r==null?void 0:r.replace(/^(www)\.(?=[^/]*\..{2,5})/,""))||"";return`${i}@${o}`}return t||""},z0=({site:e})=>{const{default_email_address:t}=e||{},n=t||`noreply@${bd({site:e})}`,a=ea({site:e}),i=a==null?void 0:a[0];return i&&i.sender_email?i.sender_email:n},bd=({site:e})=>{try{return new URL(e.url).origin.replace(/^http(s?):\/\//,"").replace(/\/$/,"")}catch{return e.url.replace(/^http(s?):\/\//,"").replace(/\/$/,"")}},ve=e=>Intl.NumberFormat("en",{currency:e,style:"currency"}).format(0).replace(/[\d\s.]/g,""),yd=e=>isNaN(e)?0:e/100,N0=(e={})=>{const t=ve(e.currency),n=yd(e.amount);return`${t}${n}/${e.interval}`},zn=e=>e==null?"":e.toLocaleString(),le=({type:e,status:t,autoHide:n,duration:a=2600,closeable:i,state:r,message:o,meta:s={}})=>{let l=0;return r&&r.popupNotification&&(l=(r.popupNotification.count||0)+1),{type:e,status:t,autoHide:n,closeable:i,duration:a,meta:s,message:o,count:l}};function kd(e,t){return(e==null?void 0:e.toLowerCase())===(t==null?void 0:t.toLowerCase())}function hy({site:e,pageQuery:t}){var i,r;const n=/^(?:(\S+?))?\/monthly$/,a=/^(?:(\S+?))?\/yearly$/;if(n.test(t||"")){const[,o]=t.match(n),s=Xn({site:e,productId:o});return(i=s==null?void 0:s.monthlyPrice)==null?void 0:i.id}else if(a.test(t||"")){const[,o]=t.match(a),s=Xn({site:e,productId:o});return(r=s==null?void 0:s.yearlyPrice)==null?void 0:r.id}return null}const A0=({offer:e})=>{if(Rs(e)){const t=e.duration_in_months;return`${t===1?"1 month":`${t} months`}`}else{if(e.type==="fixed")return`${ve(e.currency)}${e.amount/100}`;if(e.type==="percent")return`${e.amount}%`}return""},gy=({offer:e,price:t,useFormatted:n=!1})=>{const a=t.amount;let i=a;if(e.type==="fixed"&&kd(e.currency,t.currency))i=Math.max(0,a-e.amount);else if(e.type==="percent"){const o=Math.round(a*(e.amount/100));i=Math.max(0,a-o)}const r=i/100;return n?Intl.NumberFormat("en",{currency:t==null?void 0:t.currency,style:"currency"}).format(r):r},fy=({offer:e})=>e.redemption_type==="retention",I0=({site:e,offer:t})=>(t==null?void 0:t.status)!=="active"?!1:t.tier?!!Xn({site:e,productId:t.tier.id}):fy({offer:t});function M0({tier:e,priceId:t}){return e!=null&&e.monthly_price?{id:`price-${t}`,active:!0,type:"recurring",nickname:"Monthly",currency:e.currency,amount:e.monthly_price,interval:"month"}:null}function D0({tier:e,priceId:t}){return e!=null&&e.yearly_price?{id:`price-${t}`,active:!0,type:"recurring",nickname:"Yearly",currency:e.currency,amount:e.yearly_price,interval:"year"}:null}function F0({tier:e}){var t;return(t=e==null?void 0:e.benefits)==null?void 0:t.map(n=>({name:n}))}const O0=({tiers:e})=>{let t=0;return e.map(n=>{let a=M0({tier:n,priceId:t});t+=1;let i=D0({tier:n,priceId:t});t+=1;let r=F0({tier:n});return{...n,benefits:r,monthly_price:a,yearly_price:i}})};function Cr(){const e="ghost-history";try{const t=sessionStorage.getItem(e);if(t){const n=JSON.parse(t);if(Array.isArray(n))return n}}catch(t){console.warn("[Portal] Failed to load member URL history:",t)}}function _0(e,t=1){const n=new Date(e);if(isNaN(n.getTime()))return null;const a=n.getUTCDate();let i=n.getUTCMonth()+t,r=n.getUTCFullYear()+Math.floor(i/12);i=i%12;const o=new Date(Date.UTC(r,i+1,0)).getUTCDate();return new Date(Date.UTC(r,i,Math.min(a,o)))}function R0({member:e}){if(!(e!=null&&e.created_at))return!1;const t=new Date,n=new Date(e.created_at),a=t.getTime()-n.getTime();return Math.round(a/(1e3*60*60))<24}const by=function(){return L0()||yy()},L0=function(){const[e]=window.location.hash.substr(1).split("?");return e==="/portal/preview"},yy=function(){const[e]=window.location.hash.substr(1).split("?");return e==="/portal/preview/offer"},Y0={preview:by,offerPreview:yy,dev:function({customSiteUrl:e=""}={}){return!1},test:function(){return!1}},de=(e=[],t={})=>e.some(n=>{const a=Y0[n];return!!(a&&a(t))}),ky={"icon-1":i0,"icon-2":r0,"icon-3":o0,"icon-4":s0,"icon-5":l0},vy=({hasText:e})=>({frame:{zIndex:"3999998",position:"fixed",bottom:"0",right:"0",width:"500px",maxWidth:"500px",height:"98px",animation:"250ms ease 0s 1 normal none running animation-bhegco",transition:"opacity 0.3s ease 0s",overflow:"hidden",...{...e?{}:{width:"105px"},...de(["preview"])?{opacity:1}:{}}},userIcon:{width:"34px",height:"34px",color:"#fff"},buttonIcon:{width:"24px",height:"24px",color:"#fff"},closeIcon:{width:"20px",height:"20px",color:"#fff"}}),om=class om extends Z.Component{constructor(t){super(t),this.state={},this.container=Z.createRef(),this.height=null,this.width=null}updateHeight(t){this.props.updateHeight&&this.props.updateHeight(t)}updateWidth(t){this.props.updateWidth&&this.props.updateWidth(t)}componentDidMount(){this.container&&(this.height=this.container.current&&this.container.current.offsetHeight,this.width=this.container.current&&this.container.current.offsetWidth,this.updateHeight(this.height),this.updateWidth(this.width))}componentDidUpdate(){if(this.container){const t=this.container.current&&this.container.current.offsetHeight;let n=this.container.current&&this.container.current.offsetWidth;t!==this.height&&(this.height=t,this.updateHeight(this.height)),n!==this.width&&(this.width=n,this.updateWidth(this.width))}}renderTriggerIcon(){const{portal_button_icon:t="",portal_button_style:n=""}=this.context.site||{},a=vy({brandColor:this.context.brandColor}),i=this.context.member&&this.context.member.avatar_image;if(!n.includes("icon")&&!this.context.member)return null;if(i)return u.jsx(ud,{gravatar:i});if(this.context.member)return u.jsx(ld,{style:a.userIcon});if(Object.keys(ky).includes(t)){const r=ky[t];return u.jsx(r,{style:a.buttonIcon})}else return t?u.jsx("img",{style:{width:"26px",height:"26px"},src:t,alt:""}):(this.hasText()&&(a.userIcon.width="26px",a.userIcon.height="26px"),u.jsx(ld,{style:a.userIcon}))}hasText(){const{portal_button_signup_text:t,portal_button_style:n}=this.context.site;return["icon-and-text","text-only"].includes(n)&&!this.context.member&&t}renderText(){const{portal_button_signup_text:t}=this.context.site;return this.hasText()?u.jsxs("span",{className:"gh-portal-triggerbtn-label",children:[" ",t," "]}):null}onToggle(){const{showPopup:t,member:n,site:a}=this.context;if(t){this.context.doAction("closePopup");return}if(n){this.context.doAction("openPopup",{page:"accountHome"});return}if(Pn({site:a})){const i=Dt({site:a})||!Xt({site:a})?"signin":"signup";this.context.doAction("openPopup",{page:i});return}}render(){const t=this.hasText(),{member:n}=this.context,a=n?"halo":"";return t?u.jsx("div",{className:"gh-portal-triggerbtn-wrapper",ref:this.container,children:u.jsxs("div",{className:"gh-portal-triggerbtn-container with-label",onClick:i=>this.onToggle(i),"data-testid":"portal-trigger-button",children:[this.renderTriggerIcon(),t?this.renderText():""]})}):u.jsx("div",{className:"gh-portal-triggerbtn-wrapper",children:u.jsx("div",{className:"gh-portal-triggerbtn-container "+a,onClick:i=>this.onToggle(i),"data-testid":"portal-trigger-button",children:this.renderTriggerIcon()})})}};om.contextType=_;let vd=om;const sm=class sm extends Z.Component{constructor(t){super(t),this.state={width:null,isMobile:window.innerWidth<640},this.buttonRef=Z.createRef(),this.handleResize=this.handleResize.bind(this)}componentDidMount(){window.addEventListener("resize",this.handleResize),this.handleResize(),setTimeout(()=>{if(this.buttonRef.current){const t=this.buttonRef.current.node;t&&(this.buttonMargin=window.getComputedStyle(t).getPropertyValue("margin-right"))}},0)}componentWillUnmount(){window.removeEventListener("resize",this.handleResize)}handleResize(){this.setState({isMobile:window.innerWidth<640})}onWidthChange(t){this.setState({width:t})}hasText(){const{portal_button_signup_text:t,portal_button_style:n}=this.context.site;return["icon-and-text","text-only"].includes(n)&&!this.context.member&&t}renderFrameStyles(){const{brandColor:t}=this.context,n=t?`:root { --brandcolor: ${t} }`+ry:ry;return u.jsx("style",{dangerouslySetInnerHTML:{__html:n}})}render(){const t=this.context.site,{portal_button:n}=t,{showPopup:a,scrollbarWidth:i}=this.context;if(this.state.isMobile||!n||!Pn({site:t})||de(["offerPreview"]))return null;const r=this.hasText(),s={...vy({brandColor:this.context.brandColor,hasText:r}).frame};if(this.state.width){const l=this.state.width+2;s.width=`${l}px`}return i&&a&&(s.marginRight=`calc(${i}px + ${this.buttonMargin})`),u.jsx(sd,{ref:this.buttonRef,dataTestId:"portal-trigger-frame",className:"gh-portal-triggerbtn-iframe",style:s,title:"portal-trigger",head:this.renderFrameStyles(),children:u.jsx(vd,{isPopupOpen:a,updateWidth:l=>this.onWidthChange(l)})})}};sm.contextType=_;let wd=sm;const Sd=cd+`
429
429
  .gh-portal-notification-wrapper {
430
430
  position: relative;
431
431
  overflow: hidden;
@@ -570,7 +570,7 @@ Url: ${cs(e)}`),!0)}function yE(e,t){return e.type||!t||!t.length?!1:SE(e).some(
570
570
  animation-name: notification-slideout-mobile;
571
571
  }
572
572
  }
573
- `,xd=e=>w.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},w.createElement("defs",null,w.createElement("style",null,".a{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.2px !important;}")),w.createElement("path",{className:"a",d:"M.75 23.249l22.5-22.5M23.25 23.249L.75.749"})),wy=e=>w.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},w.createElement("defs",null,w.createElement("style",null,".checkmark-icon-fill{fill:currentColor;}")),w.createElement("path",{className:"checkmark-icon-fill",d:"M12,0A12,12,0,1,0,24,12,12.014,12.014,0,0,0,12,0Zm6.927,8.2-6.845,9.289a1.011,1.011,0,0,1-1.43.188L5.764,13.769a1,1,0,1,1,1.25-1.562l4.076,3.261,6.227-8.451A1,1,0,1,1,18.927,8.2Z"})),Ed=e=>w.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},w.createElement("defs",null,w.createElement("style",null,".warning-icon-fill{fill:currentColor;}")),w.createElement("path",{className:"warning-icon-fill",d:"M23.25,23.235a.75.75,0,0,0,.661-1.105l-11.25-21a.782.782,0,0,0-1.322,0l-11.25,21A.75.75,0,0,0,.75,23.235ZM12,20.485a1.5,1.5,0,1,1,1.5-1.5A1.5,1.5,0,0,1,12,20.485Zm0-12.25a1,1,0,0,1,1,1V14.7a1,1,0,0,1-2,0V9.235A1,1,0,0,1,12,8.235Z"})),Y0=({action:e,status:t})=>{if(t&&["true","false"].includes(t)){const n=JSON.parse(t);return{type:e,status:n?"success":"error",duration:3e3,autoHide:!!n}}return{}},U0=({status:e,billingOnly:t})=>{if(!t&&["success"].includes(e))return{type:"stripe:checkout",status:["success"].includes(e)?"success":"warning",duration:3e3,autoHide:!0};if(t&&["billing-portal-closed","billing-update-success","billing-update-cancel"].includes(e))return{type:"stripe:billing-update",status:e==="billing-update-cancel"?"warning":"success",duration:3e3,autoHide:!0,closeable:!0}},Cd=(e=[])=>{const t=window.location.search||"",n=new URLSearchParams(t);e.forEach(i=>{n.delete(i)});const a=n.toString()?`?${n}`:"";window.history.replaceState({},"",`${window.location.pathname}${a}`)};function Sy({billingOnly:e=!1}={}){const t=window.location.search;if(!t)return null;const n=new URLSearchParams(t),a=n.get("action"),i=n.get("success"),r=n.get("stripe");let o=null;return r?U0({status:r,billingOnly:e}):a&&i&&!e?Y0({action:a,status:i}):o}const B0=()=>({frame:{zIndex:"4000000",position:"fixed",top:"0",right:"0",maxWidth:"481px",width:"100%",height:"220px",animation:"250ms ease 0s 1 normal none running animation-bhegco",transition:"opacity 0.3s ease 0s",overflow:"hidden"}}),V0=({type:e,status:t,context:n})=>{const a=oy({page:"signin",siteUrl:n.site.url}),i=oy({page:"signup",siteUrl:n.site.url});if(e==="signin"&&t==="success"&&n.member){const r=n.member.firstname||"";return u.jsxs("p",{children:[u.jsx("strong",{children:r?f("Welcome back, {name}!",{name:r}):f("Welcome back!")}),u.jsx("br",{}),f("You've successfully signed in.")]})}else{if(e==="signin"&&t==="error")return u.jsxs("p",{children:[f("Could not sign in. Login link expired.")," ",u.jsx("br",{}),u.jsx("a",{href:a,target:"_parent",children:f("Click here to retry")})]});if(e==="signup"&&t==="success")return u.jsxs("p",{children:[f("You've successfully subscribed to")," ",u.jsx("br",{}),u.jsx("strong",{children:n.site.title})]});if(e==="signup-paid"&&t==="success")return u.jsxs("p",{children:[f("You've successfully subscribed to")," ",u.jsx("br",{}),u.jsx("strong",{children:n.site.title})]});if(e==="updateEmail"&&t==="success")return u.jsx("p",{children:f("Success! Your email is updated.")});if(e==="updateEmail"&&t==="error")return u.jsx("p",{children:f("Could not update email! Invalid link.")});if(e==="signup"&&t==="error")return u.jsxs("p",{children:[f("Signup error: Invalid link"),u.jsx("br",{}),u.jsx("a",{href:i,target:"_parent",children:f("Click here to retry")})]});if(e==="signup-paid"&&t==="error")return u.jsxs("p",{children:[f("Signup error: Invalid link"),u.jsx("br",{}),u.jsx("a",{href:i,target:"_parent",children:f("Click here to retry")})]});if(e==="stripe:checkout"&&t==="success")return n.member?u.jsx("p",{children:f("Success! Your account is fully activated, you now have access to all content.")}):u.jsx("p",{children:f("Success! Check your email for magic link to sign-in.")});if(e==="stripe:checkout"&&t==="warning")return n.member?u.jsx("p",{children:f("Plan upgrade was cancelled.")}):u.jsx("p",{children:f("Plan checkout was cancelled.")});if(e==="support"&&t==="success")return u.jsx("p",{children:f("Thank you for your support!")})}return u.jsx("p",{children:f(t==="success"?"Success":"Error")})},lm=class lm extends Z.Component{constructor(){super(),this.state={className:""}}componentWillUnmount(){clearTimeout(this.timeoutId)}onNotificationClose(){this.props.onHideNotification()}componentDidUpdate(){const{showPopup:t}=this.context;!this.state.className&&t&&this.setState({className:"slideout"})}componentDidMount(){const{autoHide:t,duration:n=2400}=this.props,{showPopup:a}=this.context;a?this.setState({className:"slideout"}):t&&(this.timeoutId=setTimeout(()=>{this.setState({className:"slideout"})},n))}onAnimationEnd(t){(t.animationName==="notification-slideout"||t.animationName==="notification-slideout-mobile")&&this.props.onHideNotification(t)}render(){const{type:t,status:n}=this.props,{className:a=""}=this.state,i=n?` ${n}`:" neutral",r=a?` ${a}`:"";return u.jsx("div",{className:"gh-portal-notification-wrapper",children:u.jsxs("div",{className:`gh-portal-notification${i}${r}`,onAnimationEnd:o=>this.onAnimationEnd(o),children:[n==="error"?u.jsx(Ed,{className:"gh-portal-notification-icon error",alt:""}):u.jsx(wy,{className:"gh-portal-notification-icon success",alt:""}),u.jsx(V0,{type:t,status:n,context:this.context}),u.jsx(xd,{className:"gh-portal-notification-closeicon",alt:"Close",onClick:o=>this.onNotificationClose(o)})]})})}};lm.contextType=_;let jd=lm;const um=class um extends Z.Component{constructor(){super();const{type:t,status:n,autoHide:a,duration:i}=Sy()||{};this.state={active:!0,type:t,status:n,autoHide:a,duration:i,className:""}}componentDidMount(){const{showPopup:t}=this.context;t&&this.setState({active:!1})}onHideNotification(){const t=this.state.type,n=[];["signin","signup"].includes(t)?n.push("action","success"):["stripe:checkout"].includes(t)&&n.push("stripe"),Cd(n),this.context.doAction("refreshMemberData"),this.setState({active:!1})}renderFrameStyles(){const{brandColor:t}=this.context,n=t?`:root { --brandcolor: ${t} }`+Sd:Sd;return u.jsx("style",{dangerouslySetInnerHTML:{__html:n}})}render(){const n={...B0({brandColor:this.context.brandColor}).frame};if(!this.state.active)return null;const{type:a,status:i,autoHide:r,duration:o}=this.state;return a&&i?u.jsx(sd,{style:n,title:"portal-notification",head:this.renderFrameStyles(),className:"gh-portal-notification-iframe","data-testid":"portal-notification-frame",children:u.jsx(jd,{type:a,status:i,autoHide:r,duration:o,onHideNotification:s=>this.onHideNotification(s)})}):null}};um.contextType=_;let $d=um;const Ja=e=>w.createElement("svg",{id:"loader-1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",width:"40px",height:"40px",viewBox:"0 0 40 40",enableBackground:"new 0 0 40 40",xmlSpace:"preserve",...e},w.createElement("path",{opacity:.2,fill:"#000",d:"M20.201,5.169c-8.254,0-14.946,6.692-14.946,14.946c0,8.255,6.692,14.946,14.946,14.946 s14.946-6.691,14.946-14.946C35.146,11.861,28.455,5.169,20.201,5.169z M20.201,31.749c-6.425,0-11.634-5.208-11.634-11.634 c0-6.425,5.209-11.634,11.634-11.634c6.425,0,11.633,5.209,11.633,11.634C31.834,26.541,26.626,31.749,20.201,31.749z"}),w.createElement("path",{fill:"#000",d:"M26.013,10.047l1.654-2.866c-2.198-1.272-4.743-2.012-7.466-2.012h0v3.312h0 C22.32,8.481,24.301,9.057,26.013,10.047z"},w.createElement("animateTransform",{attributeType:"xml",attributeName:"transform",type:"rotate",from:"0 20 20",to:"360 20 20",dur:"0.5s",repeatCount:"indefinite"}))),H0=`
573
+ `,xd=e=>w.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},w.createElement("defs",null,w.createElement("style",null,".a{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.2px !important;}")),w.createElement("path",{className:"a",d:"M.75 23.249l22.5-22.5M23.25 23.249L.75.749"})),wy=e=>w.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},w.createElement("defs",null,w.createElement("style",null,".checkmark-icon-fill{fill:currentColor;}")),w.createElement("path",{className:"checkmark-icon-fill",d:"M12,0A12,12,0,1,0,24,12,12.014,12.014,0,0,0,12,0Zm6.927,8.2-6.845,9.289a1.011,1.011,0,0,1-1.43.188L5.764,13.769a1,1,0,1,1,1.25-1.562l4.076,3.261,6.227-8.451A1,1,0,1,1,18.927,8.2Z"})),Ed=e=>w.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},w.createElement("defs",null,w.createElement("style",null,".warning-icon-fill{fill:currentColor;}")),w.createElement("path",{className:"warning-icon-fill",d:"M23.25,23.235a.75.75,0,0,0,.661-1.105l-11.25-21a.782.782,0,0,0-1.322,0l-11.25,21A.75.75,0,0,0,.75,23.235ZM12,20.485a1.5,1.5,0,1,1,1.5-1.5A1.5,1.5,0,0,1,12,20.485Zm0-12.25a1,1,0,0,1,1,1V14.7a1,1,0,0,1-2,0V9.235A1,1,0,0,1,12,8.235Z"})),U0=({action:e,status:t})=>{if(t&&["true","false"].includes(t)){const n=JSON.parse(t);return{type:e,status:n?"success":"error",duration:3e3,autoHide:!!n}}return{}},B0=({status:e,billingOnly:t})=>{if(!t&&["success"].includes(e))return{type:"stripe:checkout",status:["success"].includes(e)?"success":"warning",duration:3e3,autoHide:!0};if(t&&["billing-portal-closed","billing-update-success","billing-update-cancel"].includes(e))return{type:"stripe:billing-update",status:e==="billing-update-cancel"?"warning":"success",duration:3e3,autoHide:!0,closeable:!0}},Cd=(e=[])=>{const t=window.location.search||"",n=new URLSearchParams(t);e.forEach(i=>{n.delete(i)});const a=n.toString()?`?${n}`:"";window.history.replaceState({},"",`${window.location.pathname}${a}`)};function Sy({billingOnly:e=!1}={}){const t=window.location.search;if(!t)return null;const n=new URLSearchParams(t),a=n.get("action"),i=n.get("success"),r=n.get("stripe");let o=null;return r?B0({status:r,billingOnly:e}):a&&i&&!e?U0({action:a,status:i}):o}const V0=()=>({frame:{zIndex:"4000000",position:"fixed",top:"0",right:"0",maxWidth:"481px",width:"100%",height:"220px",animation:"250ms ease 0s 1 normal none running animation-bhegco",transition:"opacity 0.3s ease 0s",overflow:"hidden"}}),H0=({type:e,status:t,context:n})=>{const a=oy({page:"signin",siteUrl:n.site.url}),i=oy({page:"signup",siteUrl:n.site.url});if(e==="signin"&&t==="success"&&n.member){const r=n.member.firstname||"";return u.jsxs("p",{children:[u.jsx("strong",{children:r?f("Welcome back, {name}!",{name:r}):f("Welcome back!")}),u.jsx("br",{}),f("You've successfully signed in.")]})}else{if(e==="signin"&&t==="error")return u.jsxs("p",{children:[f("Could not sign in. Login link expired.")," ",u.jsx("br",{}),u.jsx("a",{href:a,target:"_parent",children:f("Click here to retry")})]});if(e==="signup"&&t==="success")return u.jsxs("p",{children:[f("You've successfully subscribed to")," ",u.jsx("br",{}),u.jsx("strong",{children:n.site.title})]});if(e==="signup-paid"&&t==="success")return u.jsxs("p",{children:[f("You've successfully subscribed to")," ",u.jsx("br",{}),u.jsx("strong",{children:n.site.title})]});if(e==="updateEmail"&&t==="success")return u.jsx("p",{children:f("Success! Your email is updated.")});if(e==="updateEmail"&&t==="error")return u.jsx("p",{children:f("Could not update email! Invalid link.")});if(e==="signup"&&t==="error")return u.jsxs("p",{children:[f("Signup error: Invalid link"),u.jsx("br",{}),u.jsx("a",{href:i,target:"_parent",children:f("Click here to retry")})]});if(e==="signup-paid"&&t==="error")return u.jsxs("p",{children:[f("Signup error: Invalid link"),u.jsx("br",{}),u.jsx("a",{href:i,target:"_parent",children:f("Click here to retry")})]});if(e==="stripe:checkout"&&t==="success")return n.member?u.jsx("p",{children:f("Success! Your account is fully activated, you now have access to all content.")}):u.jsx("p",{children:f("Success! Check your email for magic link to sign-in.")});if(e==="stripe:checkout"&&t==="warning")return n.member?u.jsx("p",{children:f("Plan upgrade was cancelled.")}):u.jsx("p",{children:f("Plan checkout was cancelled.")});if(e==="support"&&t==="success")return u.jsx("p",{children:f("Thank you for your support!")})}return u.jsx("p",{children:f(t==="success"?"Success":"Error")})},lm=class lm extends Z.Component{constructor(){super(),this.state={className:""}}componentWillUnmount(){clearTimeout(this.timeoutId)}onNotificationClose(){this.props.onHideNotification()}componentDidUpdate(){const{showPopup:t}=this.context;!this.state.className&&t&&this.setState({className:"slideout"})}componentDidMount(){const{autoHide:t,duration:n=2400}=this.props,{showPopup:a}=this.context;a?this.setState({className:"slideout"}):t&&(this.timeoutId=setTimeout(()=>{this.setState({className:"slideout"})},n))}onAnimationEnd(t){(t.animationName==="notification-slideout"||t.animationName==="notification-slideout-mobile")&&this.props.onHideNotification(t)}render(){const{type:t,status:n}=this.props,{className:a=""}=this.state,i=n?` ${n}`:" neutral",r=a?` ${a}`:"";return u.jsx("div",{className:"gh-portal-notification-wrapper",children:u.jsxs("div",{className:`gh-portal-notification${i}${r}`,onAnimationEnd:o=>this.onAnimationEnd(o),children:[n==="error"?u.jsx(Ed,{className:"gh-portal-notification-icon error",alt:""}):u.jsx(wy,{className:"gh-portal-notification-icon success",alt:""}),u.jsx(H0,{type:t,status:n,context:this.context}),u.jsx(xd,{className:"gh-portal-notification-closeicon",alt:"Close",onClick:o=>this.onNotificationClose(o)})]})})}};lm.contextType=_;let jd=lm;const um=class um extends Z.Component{constructor(){super();const{type:t,status:n,autoHide:a,duration:i}=Sy()||{};this.state={active:!0,type:t,status:n,autoHide:a,duration:i,className:""}}componentDidMount(){const{showPopup:t}=this.context;t&&this.setState({active:!1})}onHideNotification(){const t=this.state.type,n=[];["signin","signup"].includes(t)?n.push("action","success"):["stripe:checkout"].includes(t)&&n.push("stripe"),Cd(n),this.context.doAction("refreshMemberData"),this.setState({active:!1})}renderFrameStyles(){const{brandColor:t}=this.context,n=t?`:root { --brandcolor: ${t} }`+Sd:Sd;return u.jsx("style",{dangerouslySetInnerHTML:{__html:n}})}render(){const n={...V0({brandColor:this.context.brandColor}).frame};if(!this.state.active)return null;const{type:a,status:i,autoHide:r,duration:o}=this.state;return a&&i?u.jsx(sd,{style:n,title:"portal-notification",head:this.renderFrameStyles(),className:"gh-portal-notification-iframe","data-testid":"portal-notification-frame",children:u.jsx(jd,{type:a,status:i,autoHide:r,duration:o,onHideNotification:s=>this.onHideNotification(s)})}):null}};um.contextType=_;let $d=um;const Ja=e=>w.createElement("svg",{id:"loader-1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",width:"40px",height:"40px",viewBox:"0 0 40 40",enableBackground:"new 0 0 40 40",xmlSpace:"preserve",...e},w.createElement("path",{opacity:.2,fill:"#000",d:"M20.201,5.169c-8.254,0-14.946,6.692-14.946,14.946c0,8.255,6.692,14.946,14.946,14.946 s14.946-6.691,14.946-14.946C35.146,11.861,28.455,5.169,20.201,5.169z M20.201,31.749c-6.425,0-11.634-5.208-11.634-11.634 c0-6.425,5.209-11.634,11.634-11.634c6.425,0,11.633,5.209,11.633,11.634C31.834,26.541,26.626,31.749,20.201,31.749z"}),w.createElement("path",{fill:"#000",d:"M26.013,10.047l1.654-2.866c-2.198-1.272-4.743-2.012-7.466-2.012h0v3.312h0 C22.32,8.481,24.301,9.057,26.013,10.047z"},w.createElement("animateTransform",{attributeType:"xml",attributeName:"transform",type:"rotate",from:"0 20 20",to:"360 20 20",dur:"0.5s",repeatCount:"indefinite"}))),W0=`
574
574
  .gh-portal-btn-main {
575
575
  box-shadow: none;
576
576
  position: relative;
@@ -630,7 +630,7 @@ Url: ${cs(e)}`),!0)}function yE(e,t){return e.type||!t||!t.length?!1:SE(e).some(
630
630
  .gh-portal-loadingicon.dark rect {
631
631
  fill: var(--grey0);
632
632
  }
633
- `,W0=({brandColor:e,disabled:t,style:n={},isPrimary:a})=>{let i=e||"#3eb0ef",r="1.0",o="auto";return t&&(r="0.5",o="none"),{button:{...a?{backgroundColor:i}:{},opacity:r,pointerEvents:o,...n||{}}}};function ge({label:e,onClick:t,disabled:n=!1,retry:a=!1,brandColor:i,isRunning:r,isPrimary:o=!0,isDestructive:s=!1,classes:l="",style:c={},tabIndex:m=void 0,dataTestId:p}){let d=W0({disabled:n,brandColor:i,style:c,isPrimary:o}),h="gh-portal-btn";o&&(h+=" gh-portal-btn-main gh-portal-btn-primary"),s&&(h+=" gh-portal-btn-destructive"),l&&(h+=" "+l),Ka()&&(n=!0);const y=o?"gh-portal-loadingicon":"gh-portal-loadingicon dark";return u.jsx("button",{className:h,style:d.button,onClick:v=>t(v),disabled:n,type:"submit",tabIndex:m,"data-test-button":p,children:r?u.jsx(Ja,{className:y}):e})}const G0=e=>w.createElement("svg",{id:"Regular",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},w.createElement("defs",null,w.createElement("style",null,".cls-1{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.5px;fill-rule:evenodd;}")),w.createElement("path",{className:"cls-1",d:"M16.25,23.25,5.53,12.53a.749.749,0,0,1,0-1.06L16.25.75"})),K0=`
633
+ `,G0=({brandColor:e,disabled:t,style:n={},isPrimary:a})=>{let i=e||"#3eb0ef",r="1.0",o="auto";return t&&(r="0.5",o="none"),{button:{...a?{backgroundColor:i}:{},opacity:r,pointerEvents:o,...n||{}}}};function ge({label:e,onClick:t,disabled:n=!1,retry:a=!1,brandColor:i,isRunning:r,isPrimary:o=!0,isDestructive:s=!1,classes:l="",style:c={},tabIndex:m=void 0,dataTestId:p}){let d=G0({disabled:n,brandColor:i,style:c,isPrimary:o}),h="gh-portal-btn";o&&(h+=" gh-portal-btn-main gh-portal-btn-primary"),s&&(h+=" gh-portal-btn-destructive"),l&&(h+=" "+l),Ka()&&(n=!0);const y=o?"gh-portal-loadingicon":"gh-portal-loadingicon dark";return u.jsx("button",{className:h,style:d.button,onClick:v=>t(v),disabled:n,type:"submit",tabIndex:m,"data-test-button":p,children:r?u.jsx(Ja,{className:y}):e})}const K0=e=>w.createElement("svg",{id:"Regular",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},w.createElement("defs",null,w.createElement("style",null,".cls-1{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.5px;fill-rule:evenodd;}")),w.createElement("path",{className:"cls-1",d:"M16.25,23.25,5.53,12.53a.749.749,0,0,1,0-1.06L16.25.75"})),q0=`
634
634
  .gh-portal-btn-back,
635
635
  .gh-portal-btn-back:hover {
636
636
  box-shadow: none;
@@ -677,7 +677,7 @@ Url: ${cs(e)}`),!0)}function yE(e,t){return e.type||!t||!t.length?!1:SE(e).some(
677
677
  html[dir="rtl"] .gh-portal-btn-back svg {
678
678
  transform: scaleX(-1);
679
679
  }
680
- `;function Za({label:e=null,hidden:t=!1,onClick:n}){return t?null:(e===null&&(e=f("Back")),u.jsxs("button",{className:"gh-portal-btn gh-portal-btn-back",onClick:a=>n(a),children:[u.jsx(G0,{})," ",e]}))}const q0=`
680
+ `;function Za({label:e=null,hidden:t=!1,onClick:n}){return t?null:(e===null&&(e=f("Back")),u.jsxs("button",{className:"gh-portal-btn gh-portal-btn-back",onClick:a=>n(a),children:[u.jsx(K0,{})," ",e]}))}const J0=`
681
681
  .gh-portal-for-switch label,
682
682
  .gh-portal-for-switch .container {
683
683
  position: relative;
@@ -753,8 +753,8 @@ Url: ${cs(e)}`),!0)}function yE(e,t){return e.type||!t||!t.length?!1:SE(e).some(
753
753
  width: 38px !important;
754
754
  height: 22px !important;
755
755
  }
756
- `;function Us({id:e,label:t="",onToggle:n,checked:a=!1,dataTestId:i="switch-input"}){const[r,o]=w.useState(a);w.useEffect(()=>{o(a)},[a]);const s=w.useRef(null);return w.useEffect(()=>{s.current&&s.current.checked!==r&&(s.current.checked=r)},[r,e]),u.jsx("div",{className:"gh-portal-for-switch","data-test-switch":i,children:u.jsxs("label",{className:"switch",htmlFor:e,children:[u.jsx("input",{ref:s,type:"checkbox",checked:r,id:e,onChange:()=>{},"aria-label":t}),u.jsx("span",{className:"input-toggle-component",onClick:l=>{o(!r),n(l,!r)},"data-testid":i})]})})}const J0=".gh-portal-account-header{display:flex;flex-direction:column;align-items:center;margin:0 0 32px}.gh-portal-account-header .gh-portal-avatar{margin:6px 0 8px!important}.gh-portal-account-data{margin-bottom:40px}footer.gh-portal-account-footer{display:flex}.gh-portal-account-footer.paid{margin-top:12px}.gh-portal-account-footermenu{display:flex;align-items:center;list-style:none;padding:0;margin:0}.gh-portal-account-footerright{display:flex;flex-grow:1;align-items:center;justify-content:flex-end}.gh-portal-account-footermenu li{margin-inline-end:16px}.gh-portal-account-footermenu li:last-of-type{margin-inline-end:0}.gh-portal-freeaccount-newsletter{display:flex;align-items:center;justify-content:space-between;margin-top:24px}.gh-portal-freeaccount-newsletter .label{display:flex;flex-direction:column;flex-grow:1}.gh-portal-free-ctatext{margin-top:-12px}.gh-portal-cancelcontinue-container{margin:24px 0 32px}.gh-portal-list-detail .gh-portal-email-notice{display:flex;align-items:center;gap:5px;margin-top:6px;color:var(--red);font-weight:500;font-size:1.25rem;letter-spacing:.2px}.gh-portal-email-notice-icon{width:20px;height:20px}.gh-portal-billing-button-loader{width:32px;height:32px;margin-inline-end:-3px;opacity:.6}.gh-portal-product-icon{width:52px;margin-inline-end:12px;border-radius:2px}.gh-portal-account-discountcontainer{position:relative;display:flex;align-items:center}.gh-portal-account-old-price{text-decoration:line-through;color:var(--grey9)!important}.gh-portal-account-tagicon{width:16px;height:16px;color:var(--brandcolor);margin-inline-end:5px;z-index:999}@media (max-width: 390px){.gh-portal-account-footer{padding:0!important}}@media (max-width: 340px){.gh-portal-account-footer{padding:0!important;flex-wrap:wrap;gap:12px}.gh-portal-account-footer .gh-portal-account-footerright{justify-content:flex-start}}";let we=(ni=class extends Z.Component{constructor(){super(...arguments),this.closePopup=()=>{this.context.doAction("closePopup")}}render(){const{onClick:t}=this.props;return u.jsx("div",{className:"gh-portal-closeicon-container","data-test-button":"close-popup",children:u.jsx(xd,{className:"gh-portal-closeicon",alt:"Close",onClick:t||this.closePopup,"data-testid":"close-popup"})})}},ni.contextType=_,ni);const xy=e=>w.createElement("svg",{width:15,height:14,viewBox:"0 0 15 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},w.createElement("path",{d:"M1 6.89286L6.10714 12L13.9643 1",stroke:"#222222",strokeWidth:2}));function Ey(e,t){if(isNaN(e)||isNaN(t))return 0;const n=e?100-Math.floor(t/12*100/e):0;return n>=1&&n<100?n:0}var Cy={exports:{}},Z0="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Q0=Z0,X0=Q0;function jy(){}function $y(){}$y.resetWarningCache=jy;var eT=function(){function e(a,i,r,o,s,l){if(l!==X0){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:$y,resetWarningCache:jy};return n.PropTypes=n,n};Cy.exports=eT();var tT=Cy.exports;const Td=Lr(tT);function Ty(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function jr(e){"@babel/helpers - typeof";return jr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jr(e)}function nT(e,t){if(jr(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var a=n.call(e,t);if(jr(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function aT(e){var t=nT(e,"string");return jr(t)=="symbol"?t:t+""}function iT(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,aT(a.key),a)}}function Py(e,t,n){return t&&iT(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function rT(e,t){if(e==null)return{};var n={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(t.includes(a))continue;n[a]=e[a]}return n}function oT(e,t){if(e==null)return{};var n,a,i=rT(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var Pd="TOKEN_PLACEHOLDER",Bs="TOKEN_OPEN_TAG",zd="TOKEN_CLOSE_TAG",Nd="TOKEN_SELF_TAG",Vs="TOKEN_TEXT",zy="NODE_FRAGMENT",Ny="NODE_TAG_ELEMENT",Ay="NODE_VOID_ELEMENT",Iy="NODE_PLACEHOLDER",My="NODE_TEXT",sT=["type","children"],Be=function(){function e(t){var n=t.type,a=t.children,i=oT(t,sT);Ty(this,e),this.type=n,this.children=a||[];for(var r in i)this[r]=i[r];i.token&&(this.string=i.token.string)}return Py(e,[{key:"appendChild",value:function(n){this.children.push(n)}},{key:"isLeaf",get:function(){return this.children.length===0}}]),e}();Be.createTagNode=function(e,t){return new Be({type:Ny,children:t,name:e.name,token:e})},Be.createFragmentNode=function(e){return new Be({type:zy,children:e})},Be.createVoidNode=function(e){return new Be({type:Ay,name:e.name,token:e})},Be.createTextNode=function(e){return new Be({type:My,text:e.string,token:e})},Be.createPlaceholderNode=function(e){return new Be({type:Iy,name:e.name,token:e})};var lT=[{type:Pd,regex:/{\s*(\w+)\s*}/g},{type:Bs,regex:/<(\w+)>/g},{type:zd,regex:/<\/(\w+)>/g},{type:Nd,regex:/<(\w+)\s*\/>/g}];function uT(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=cT(e))||t){n&&(e=n);var a=0,i=function(){};return{s:i,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(c){throw c},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
757
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var r=!0,o=!1,s;return{s:function(){n=n.call(e)},n:function(){var c=n.next();return r=c.done,c},e:function(c){o=!0,s=c},f:function(){try{!r&&n.return!=null&&n.return()}finally{if(o)throw s}}}}function cT(e,t){if(e){if(typeof e=="string")return Dy(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Dy(e,t)}}function Dy(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function dT(e,t){var n=[],a=uT(t),i;try{for(a.s();!(i=a.n()).done;)for(var r=i.value,o=r.type,s=r.regex,l;(l=s.exec(e))!==null;)n.push({type:o,string:l[0],name:l[1],start:l.index,end:l.index+l[0].length})}catch(h){a.e(h)}finally{a.f()}n.sort(function(h,y){return h.start-y.start});var c=[],m=0;n.forEach(function(h){if(h.start===m){m=h.end;return}var y=h.start,v=e.substring(m,y);c.push({type:Vs,string:v,text:v,start:m,end:y}),m=h.end});var p=e.substring(m);p!==""&&c.push({type:Vs,string:p,start:m,end:e.length});var d=[].concat(c,n).sort(function(h,y){return h.start-y.start});return d}function mT(e,t){t||(t=lT);var n=dT(e,t),a=new pT(n);return a.parse()}var $r="Syntax error. Please check if each open tag is closed correctly",Fy={type:"EPSILON"},pT=function(){function e(t){Ty(this,e),this.tokens=[].concat(t),this.tags=[]}return Py(e,[{key:"parse",value:function(){var n=this.document();if(!this.predict(Fy.type))throw new Error($r);return n}},{key:"document",value:function(){var n=this.elementOrData();return Be.createFragmentNode(n)}},{key:"element",value:function(){var n=this.openTag(),a=this.elementOrData();return this.endTag(),Be.createTagNode(n,a)}},{key:"openTag",value:function(){if(!this.predict(Bs))throw new Error($r);return this.pushTag(this.lookahead),this.match(Bs)}},{key:"elementOrData",value:function(){var n=[];if(this.predict(Bs)&&(n.push(this.element()),n=n.concat(this.elementOrData())),this.predict(Nd,Vs,Pd)){var a=this.match(this.lookahead.type),i;switch(a.type){case Nd:i=Be.createVoidNode(a);break;case Vs:i=Be.createTextNode(a);break;case Pd:i=Be.createPlaceholderNode(a);break}n.push(i),n=n.concat(this.elementOrData())}return n}},{key:"endTag",value:function(){if(!this.predict(zd))throw new Error($r);var n=this.tags.pop();if(n.name!==this.lookahead.name)throw new Error($r);this.match(zd)}},{key:"lookahead",get:function(){return this.tokens.length===0?Fy:this.tokens[0]}},{key:"predict",value:function(){for(var n=arguments.length,a=new Array(n),i=0;i<n;i++)a[i]=arguments[i];return a.includes(this.lookahead.type)}},{key:"match",value:function(n){if(!this.predict(n))throw new Error($r);var a=this.tokens.shift();return a}},{key:"pushTag",value:function(n){this.tags.push(n)}}]),e}(),hT=function e(t,n,a){var i=t.children.map(function(l,c){return Z.createElement(Z.Fragment,{key:a+c},e(l,n,a))});switch(t.type){case My:return t.text;case zy:return Z.createElement(Z.Fragment,null,i);case Ay:{var r=n[t.name];return typeof r=="function"?r():r||Z.createElement(t.name,null)}case Ny:{var o=n[t.name];if(o===void 0)return Z.createElement(t.name,null,i);if(typeof o=="function")return o(i);if(Z.isValidElement(o)){if(Z.Children.count(o.props.children)!==0)throw new Error("when passing an element as value, the element should not contains children");return Z.cloneElement(o,{children:i})}throw new Error('Invalid mapping value for "'.concat(t.name,'". Only element or render function are accepted'))}case Iy:{var s=n[t.name];return s===void 0?(console.warn('missing "'.concat(t.name,'" in mapping')),t.string):typeof s=="function"?s():s}default:return}};function Ve(e){var t=e.string,n=e.syntax,a=e.mapping,i=a===void 0?{}:a,r=e.graceful,o=r===void 0?!0:r;try{var s=mT(t,n);return hT(s,i,t)}catch(l){if(o)return console.error(l),t;throw l}}Ve.propTypes={string:Td.string.isRequired,mapping:Td.object,graceful:Td.bool};const gT=()=>`
756
+ `;function Us({id:e,label:t="",onToggle:n,checked:a=!1,dataTestId:i="switch-input"}){const[r,o]=w.useState(a);w.useEffect(()=>{o(a)},[a]);const s=w.useRef(null);return w.useEffect(()=>{s.current&&s.current.checked!==r&&(s.current.checked=r)},[r,e]),u.jsx("div",{className:"gh-portal-for-switch","data-test-switch":i,children:u.jsxs("label",{className:"switch",htmlFor:e,children:[u.jsx("input",{ref:s,type:"checkbox",checked:r,id:e,onChange:()=>{},"aria-label":t}),u.jsx("span",{className:"input-toggle-component",onClick:l=>{o(!r),n(l,!r)},"data-testid":i})]})})}const Z0=".gh-portal-account-header{display:flex;flex-direction:column;align-items:center;margin:0 0 32px}.gh-portal-account-header .gh-portal-avatar{margin:6px 0 8px!important}.gh-portal-account-data{margin-bottom:40px}footer.gh-portal-account-footer{display:flex}.gh-portal-account-footer.paid{margin-top:12px}.gh-portal-account-footermenu{display:flex;align-items:center;list-style:none;padding:0;margin:0}.gh-portal-account-footerright{display:flex;flex-grow:1;align-items:center;justify-content:flex-end}.gh-portal-account-footermenu li{margin-inline-end:16px}.gh-portal-account-footermenu li:last-of-type{margin-inline-end:0}.gh-portal-freeaccount-newsletter{display:flex;align-items:center;justify-content:space-between;margin-top:24px}.gh-portal-freeaccount-newsletter .label{display:flex;flex-direction:column;flex-grow:1}.gh-portal-free-ctatext{margin-top:-12px}.gh-portal-cancelcontinue-container{margin:24px 0 32px}.gh-portal-list-detail .gh-portal-email-notice{display:flex;align-items:center;gap:5px;margin-top:6px;color:var(--red);font-weight:500;font-size:1.25rem;letter-spacing:.2px}.gh-portal-email-notice-icon{width:20px;height:20px}.gh-portal-billing-button-loader{width:32px;height:32px;margin-inline-end:-3px;opacity:.6}.gh-portal-product-icon{width:52px;margin-inline-end:12px;border-radius:2px}.gh-portal-account-discountcontainer{position:relative;display:flex;align-items:center}.gh-portal-account-old-price{text-decoration:line-through;color:var(--grey9)!important}.gh-portal-account-tagicon{width:16px;height:16px;color:var(--brandcolor);margin-inline-end:5px;z-index:999}@media (max-width: 390px){.gh-portal-account-footer{padding:0!important}}@media (max-width: 340px){.gh-portal-account-footer{padding:0!important;flex-wrap:wrap;gap:12px}.gh-portal-account-footer .gh-portal-account-footerright{justify-content:flex-start}}";let we=(ni=class extends Z.Component{constructor(){super(...arguments),this.closePopup=()=>{this.context.doAction("closePopup")}}render(){const{onClick:t}=this.props;return u.jsx("div",{className:"gh-portal-closeicon-container","data-test-button":"close-popup",children:u.jsx(xd,{className:"gh-portal-closeicon",alt:"Close",onClick:t||this.closePopup,"data-testid":"close-popup"})})}},ni.contextType=_,ni);const xy=e=>w.createElement("svg",{width:15,height:14,viewBox:"0 0 15 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},w.createElement("path",{d:"M1 6.89286L6.10714 12L13.9643 1",stroke:"#222222",strokeWidth:2}));function Ey(e,t){if(isNaN(e)||isNaN(t))return 0;const n=e?100-Math.floor(t/12*100/e):0;return n>=1&&n<100?n:0}var Cy={exports:{}},Q0="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",X0=Q0,eT=X0;function jy(){}function $y(){}$y.resetWarningCache=jy;var tT=function(){function e(a,i,r,o,s,l){if(l!==eT){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:$y,resetWarningCache:jy};return n.PropTypes=n,n};Cy.exports=tT();var nT=Cy.exports;const Td=Lr(nT);function Ty(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function jr(e){"@babel/helpers - typeof";return jr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jr(e)}function aT(e,t){if(jr(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var a=n.call(e,t);if(jr(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function iT(e){var t=aT(e,"string");return jr(t)=="symbol"?t:t+""}function rT(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,iT(a.key),a)}}function Py(e,t,n){return t&&rT(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function oT(e,t){if(e==null)return{};var n={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(t.includes(a))continue;n[a]=e[a]}return n}function sT(e,t){if(e==null)return{};var n,a,i=oT(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var Pd="TOKEN_PLACEHOLDER",Bs="TOKEN_OPEN_TAG",zd="TOKEN_CLOSE_TAG",Nd="TOKEN_SELF_TAG",Vs="TOKEN_TEXT",zy="NODE_FRAGMENT",Ny="NODE_TAG_ELEMENT",Ay="NODE_VOID_ELEMENT",Iy="NODE_PLACEHOLDER",My="NODE_TEXT",lT=["type","children"],Be=function(){function e(t){var n=t.type,a=t.children,i=sT(t,lT);Ty(this,e),this.type=n,this.children=a||[];for(var r in i)this[r]=i[r];i.token&&(this.string=i.token.string)}return Py(e,[{key:"appendChild",value:function(n){this.children.push(n)}},{key:"isLeaf",get:function(){return this.children.length===0}}]),e}();Be.createTagNode=function(e,t){return new Be({type:Ny,children:t,name:e.name,token:e})},Be.createFragmentNode=function(e){return new Be({type:zy,children:e})},Be.createVoidNode=function(e){return new Be({type:Ay,name:e.name,token:e})},Be.createTextNode=function(e){return new Be({type:My,text:e.string,token:e})},Be.createPlaceholderNode=function(e){return new Be({type:Iy,name:e.name,token:e})};var uT=[{type:Pd,regex:/{\s*(\w+)\s*}/g},{type:Bs,regex:/<(\w+)>/g},{type:zd,regex:/<\/(\w+)>/g},{type:Nd,regex:/<(\w+)\s*\/>/g}];function cT(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=dT(e))||t){n&&(e=n);var a=0,i=function(){};return{s:i,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(c){throw c},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
757
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var r=!0,o=!1,s;return{s:function(){n=n.call(e)},n:function(){var c=n.next();return r=c.done,c},e:function(c){o=!0,s=c},f:function(){try{!r&&n.return!=null&&n.return()}finally{if(o)throw s}}}}function dT(e,t){if(e){if(typeof e=="string")return Dy(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Dy(e,t)}}function Dy(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function mT(e,t){var n=[],a=cT(t),i;try{for(a.s();!(i=a.n()).done;)for(var r=i.value,o=r.type,s=r.regex,l;(l=s.exec(e))!==null;)n.push({type:o,string:l[0],name:l[1],start:l.index,end:l.index+l[0].length})}catch(h){a.e(h)}finally{a.f()}n.sort(function(h,y){return h.start-y.start});var c=[],m=0;n.forEach(function(h){if(h.start===m){m=h.end;return}var y=h.start,v=e.substring(m,y);c.push({type:Vs,string:v,text:v,start:m,end:y}),m=h.end});var p=e.substring(m);p!==""&&c.push({type:Vs,string:p,start:m,end:e.length});var d=[].concat(c,n).sort(function(h,y){return h.start-y.start});return d}function pT(e,t){t||(t=uT);var n=mT(e,t),a=new hT(n);return a.parse()}var $r="Syntax error. Please check if each open tag is closed correctly",Fy={type:"EPSILON"},hT=function(){function e(t){Ty(this,e),this.tokens=[].concat(t),this.tags=[]}return Py(e,[{key:"parse",value:function(){var n=this.document();if(!this.predict(Fy.type))throw new Error($r);return n}},{key:"document",value:function(){var n=this.elementOrData();return Be.createFragmentNode(n)}},{key:"element",value:function(){var n=this.openTag(),a=this.elementOrData();return this.endTag(),Be.createTagNode(n,a)}},{key:"openTag",value:function(){if(!this.predict(Bs))throw new Error($r);return this.pushTag(this.lookahead),this.match(Bs)}},{key:"elementOrData",value:function(){var n=[];if(this.predict(Bs)&&(n.push(this.element()),n=n.concat(this.elementOrData())),this.predict(Nd,Vs,Pd)){var a=this.match(this.lookahead.type),i;switch(a.type){case Nd:i=Be.createVoidNode(a);break;case Vs:i=Be.createTextNode(a);break;case Pd:i=Be.createPlaceholderNode(a);break}n.push(i),n=n.concat(this.elementOrData())}return n}},{key:"endTag",value:function(){if(!this.predict(zd))throw new Error($r);var n=this.tags.pop();if(n.name!==this.lookahead.name)throw new Error($r);this.match(zd)}},{key:"lookahead",get:function(){return this.tokens.length===0?Fy:this.tokens[0]}},{key:"predict",value:function(){for(var n=arguments.length,a=new Array(n),i=0;i<n;i++)a[i]=arguments[i];return a.includes(this.lookahead.type)}},{key:"match",value:function(n){if(!this.predict(n))throw new Error($r);var a=this.tokens.shift();return a}},{key:"pushTag",value:function(n){this.tags.push(n)}}]),e}(),gT=function e(t,n,a){var i=t.children.map(function(l,c){return Z.createElement(Z.Fragment,{key:a+c},e(l,n,a))});switch(t.type){case My:return t.text;case zy:return Z.createElement(Z.Fragment,null,i);case Ay:{var r=n[t.name];return typeof r=="function"?r():r||Z.createElement(t.name,null)}case Ny:{var o=n[t.name];if(o===void 0)return Z.createElement(t.name,null,i);if(typeof o=="function")return o(i);if(Z.isValidElement(o)){if(Z.Children.count(o.props.children)!==0)throw new Error("when passing an element as value, the element should not contains children");return Z.cloneElement(o,{children:i})}throw new Error('Invalid mapping value for "'.concat(t.name,'". Only element or render function are accepted'))}case Iy:{var s=n[t.name];return s===void 0?(console.warn('missing "'.concat(t.name,'" in mapping')),t.string):typeof s=="function"?s():s}default:return}};function Ve(e){var t=e.string,n=e.syntax,a=e.mapping,i=a===void 0?{}:a,r=e.graceful,o=r===void 0?!0:r;try{var s=pT(t,n);return gT(s,i,t)}catch(l){if(o)return console.error(l),t;throw l}}Ve.propTypes={string:Td.string.isRequired,mapping:Td.object,graceful:Td.bool};const fT=()=>`
758
758
  .gh-portal-products {
759
759
  display: flex;
760
760
  flex-direction: column;
@@ -1271,7 +1271,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1271
1271
  min-height: unset;
1272
1272
  }
1273
1273
  }
1274
- `,Qa=Z.createContext({selectedInterval:"month",selectedProduct:"free",selectedPlan:null,setSelectedProduct:null});function fT({product:e}){return!e.benefits||!e.benefits.length?null:e.benefits.map((t,n)=>{const a=(t==null?void 0:t.id)||`benefit-${n}`;return u.jsxs("div",{className:"gh-portal-product-benefit",children:[u.jsx(xy,{className:"gh-portal-benefit-checkmark",alt:""}),u.jsx("div",{className:"gh-portal-benefit-title",children:t.name})]},a)})}function Ad({product:e,hide:t=!1}){return!e.benefits||!e.benefits.length||t?null:u.jsx("div",{className:"gh-portal-product-benefits",children:u.jsx(fT,{product:e})})}function Oy({price:e}){const{site:t}=w.useContext(_),{portal_plans:n}=t;return!n.includes("monthly")||!n.includes("yearly")?u.jsx("div",{className:"gh-portal-product-alternative-price"}):u.jsx("div",{className:"gh-portal-product-alternative-price",children:N0(e)})}function bT({trialDays:e,discount:t,selectedInterval:n}){const{site:a}=w.useContext(_);return _s({site:a})?e?u.jsx("span",{className:"gh-portal-discount-label",children:f("{trialDays} days free",{trialDays:e})}):null:n==="year"?u.jsx("span",{className:"gh-portal-discount-label",children:f("{discount}% discount",{discount:t})}):null}function _y({product:e}){const{selectedInterval:t}=w.useContext(Qa),{site:n}=w.useContext(_),a=e.monthlyPrice,i=e.yearlyPrice,r=e.trial_days,o=t==="month"?a:i,s=t==="month"?i:a,l=o.interval==="year"?f("year"):f("month");if(!a||!i)return null;const c=Ey(e.monthlyPrice.amount,e.yearlyPrice.amount),m=ve(o.currency);return _s({site:n})?u.jsx(u.Fragment,{children:u.jsxs("div",{className:"gh-portal-product-card-pricecontainer",children:[u.jsxs("div",{className:"gh-portal-product-card-price-trial",children:[u.jsxs("div",{className:"gh-portal-product-price",children:[u.jsx("span",{className:"currency-sign"+(m.length>1?" long":""),children:m}),u.jsx("span",{className:"amount","data-testid":"product-amount",children:zn(yd(o.amount))}),u.jsxs("span",{className:"billing-period",children:["/",l]})]}),u.jsx(bT,{trialDays:r,discount:c,selectedInterval:t})]}),t==="year"?u.jsx(Ry,{discount:c,trialDays:r}):"",u.jsx(Oy,{price:s})]})}):u.jsxs("div",{className:"gh-portal-product-card-pricecontainer",children:[u.jsxs("div",{className:"gh-portal-product-card-price-trial",children:[u.jsxs("div",{className:"gh-portal-product-price",children:[u.jsx("span",{className:"currency-sign"+(m.length>1?" long":""),children:m}),u.jsx("span",{className:"amount","data-testid":"product-amount",children:zn(yd(o.amount))}),u.jsxs("span",{className:"billing-period",children:["/",l]})]}),t==="year"?u.jsx(Ry,{discount:c}):""]}),u.jsx(Oy,{price:s})]})}function yT({products:e,handleChooseSignup:t,error:n}){const{site:a,action:i}=w.useContext(_),{selectedProduct:r,setSelectedProduct:o}=w.useContext(Qa);let s=r==="free"?"gh-portal-product-card free checked":"gh-portal-product-card free";const l=Qn({site:a});let c=S0({site:a}),m=i==="signup:running";Ka()&&(m=!0);let p="$";e&&e[1]?p=ve(e[1].monthlyPrice.currency):p="$";const d=my({site:a}),h=w0({site:a});if(d){if(!c&&!h.length)return null;s+=" only-free"}return!c&&!h.length&&(c="Free preview"),u.jsx(u.Fragment,{children:u.jsxs("div",{className:s,onClick:y=>{y.stopPropagation(),o("free")},"data-test-tier":"free",children:[u.jsxs("div",{className:"gh-portal-product-card-header",children:[u.jsx("h4",{className:"gh-portal-product-name",children:cy({site:a})}),d?"":u.jsx("div",{className:"gh-portal-product-card-pricecontainer free-trial-disabled",children:u.jsxs("div",{className:"gh-portal-product-price",children:[u.jsx("span",{className:"currency-sign"+(p.length>1?" long":""),children:p}),u.jsx("span",{className:"amount","data-testid":"product-amount",children:"0"})]})})]}),u.jsxs("div",{className:"gh-portal-product-card-details",children:[u.jsxs("div",{className:"gh-portal-product-card-detaildata",children:[c?u.jsx("div",{className:"gh-portal-product-description","data-testid":"product-description",children:c}):"",u.jsx(Ad,{product:l})]}),d?"":u.jsxs("div",{className:"gh-portal-btn-product",children:[u.jsx("button",{"data-test-button":"select-tier",className:"gh-portal-btn",disabled:m,onClick:y=>{t(y,"free")},children:r==="free"&&m?u.jsx(Ja,{className:"gh-portal-loadingicon"}):f("Choose")}),n&&u.jsx("div",{className:"gh-portal-error-message",children:n})]})]})]})})}function kT({selectedProduct:e,product:t,disabled:n,noOfProducts:a,trialDays:i}){return e===t.id&&n?u.jsx(Ja,{className:"gh-portal-loadingicon"}):i>0?u.jsx(Ve,{string:f("Start {amount}-day free trial"),mapping:{amount:i}}):a>1?f("Choose"):f("Continue")}function vT({product:e,products:t,selectedInterval:n,handleChooseSignup:a,error:i}){var h;const{selectedProduct:r,setSelectedProduct:o}=w.useContext(Qa),{action:s}=w.useContext(_),l=e.trial_days,c=r===e.id?"gh-portal-product-card checked":"gh-portal-product-card",m=(h=t==null?void 0:t.filter(y=>y.type==="paid"))==null?void 0:h.length;let p=!!["signup:running","checkoutPlan:running"].includes(s);Ka()&&(p=!0);let d=e.description;return(!e.benefits||!e.benefits.length)&&!d&&(d="Full access"),u.jsx(u.Fragment,{children:u.jsxs("div",{className:c,onClick:y=>{y.stopPropagation(),o(e.id)},"data-test-tier":"paid",children:[u.jsxs("div",{className:"gh-portal-product-card-header",children:[u.jsx("h4",{className:"gh-portal-product-name",children:e.name}),u.jsx(_y,{product:e})]}),u.jsxs("div",{className:"gh-portal-product-card-details",children:[u.jsxs("div",{className:"gh-portal-product-card-detaildata",children:[u.jsx("div",{className:"gh-portal-product-description","data-testid":"product-description",children:d}),u.jsx(Ad,{product:e})]}),u.jsxs("div",{className:"gh-portal-btn-product",children:[u.jsx("button",{"data-test-button":"select-tier",disabled:p,className:"gh-portal-btn",onClick:y=>{const v=Id({products:t,selectedInterval:n,selectedProduct:e.id});a(y,v.id)},children:u.jsx(kT,{selectedProduct:r,product:e,disabled:p,noOfProducts:m,trialDays:l})}),i&&u.jsx("div",{className:"gh-portal-error-message",children:i})]})]})]},e.id)})}function wT({product:e,products:t,selectedInterval:n,errors:a}){const i=Id({products:t,selectedInterval:n,selectedProduct:e.id});return i&&i.id&&a&&a[i.id]?a[i.id]:null}function ST({products:e,selectedInterval:t,handleChooseSignup:n,errors:a}){return e.map(i=>{const r=wT({product:i,products:e,selectedInterval:t,errors:a});return i.id==="free"?u.jsx(yT,{products:e,handleChooseSignup:n,error:r},i.id):u.jsx(vT,{products:e,product:i,selectedInterval:t,handleChooseSignup:n,error:r},i.id)})}function Ry({discount:e}){const{site:t}=w.useContext(_),{portal_plans:n}=t;return e===0||!n.includes("monthly")?null:_s({site:t})?u.jsx(u.Fragment,{children:u.jsx("span",{className:"gh-portal-discount-label-trial",children:f("{discount}% discount",{discount:e})})}):u.jsx(u.Fragment,{children:u.jsx("span",{className:"gh-portal-discount-label",children:f("{discount}% discount",{discount:e})})})}function Ly({selectedInterval:e,setSelectedInterval:t,products:n}){const{site:a}=w.useContext(_),{portal_plans:i}=a,o=n.filter(l=>l.type!=="free").map(l=>{var c,m;return Ey((c=l.monthlyPrice)==null?void 0:c.amount,(m=l.yearlyPrice)==null?void 0:m.amount)}),s=Math.max(...o);return!i.includes("monthly")||!i.includes("yearly")?null:u.jsx("div",{className:"gh-portal-logged-out-form-container",children:u.jsxs("div",{className:"gh-portal-products-pricetoggle"+(e==="month"?" left":""),children:[u.jsx("button",{"data-test-button":"switch-monthly","data-testid":"monthly-switch",className:"gh-portal-btn"+(e==="month"?" active":""),onClick:()=>{t("month")},children:f("Monthly")}),u.jsxs("button",{"data-test-button":"switch-yearly","data-testid":"yearly-switch",className:"gh-portal-btn"+(e==="year"?" active":""),onClick:()=>{t("year")},children:[f("Yearly"),s>0&&u.jsx("span",{className:"gh-portal-maximum-discount",children:f("(save {highestYearlyDiscount}%)",{highestYearlyDiscount:s})})]})]})})}function Id({products:e,selectedProduct:t,selectedInterval:n}){let a=null;if(t==="free")a={id:"free"};else{let i=e.find(r=>r.id===t);i||(i=e.find(r=>r.type==="paid")),a=n==="month"?i==null?void 0:i.monthlyPrice:i==null?void 0:i.yearlyPrice}return a}function Md({portalPlans:e,portalDefaultPlan:t,selectedInterval:n}){if(n==="month"&&e.includes("monthly"))return"month";if(n==="year"&&e.includes("yearly"))return"year";if(t&&t==="monthly"&&e.includes("monthly"))return"month";if(e.includes("yearly"))return"year";if(e.includes("monthly"))return"month"}function Yy({onPlanSelect:e,products:t,type:n=null,handleChooseSignup:a,errors:i}){var x,z;const{site:r,member:o}=w.useContext(_),{portal_plans:s,portal_default_plan:l}=r,c=t.length>0?t[0].id:"free",[m,p]=w.useState(null),[d,h]=w.useState(c),y=Id({products:t,selectedInterval:m,selectedProduct:d}),v=Md({portalPlans:s,portalDefaultPlan:l,selectedInterval:m}),g=Tn({member:o}),b=my({site:r});if(w.useEffect(()=>{h(c)},[c]),w.useEffect(()=>{e(null,y.id)},[y.id,e]),t.length===0)if(g){const C=Er({site:r});return u.jsx("p",{style:{textAlign:"center"},children:f("Please contact {supportAddress} to adjust your complimentary subscription.",{supportAddress:C})})}else return null;let k="gh-portal-products";n==="upgrade"&&(k+=" gh-portal-upgrade-product");let E=((x=t.find(C=>C.id===d))==null?void 0:x.id)||((z=t.find(C=>C.type==="paid"))==null?void 0:z.id);return u.jsx(Qa.Provider,{value:{selectedInterval:v,selectedProduct:E,setSelectedProduct:h},children:u.jsxs("section",{className:k,children:[b?"":u.jsx(Ly,{products:t,selectedInterval:v,setSelectedInterval:p}),u.jsx("div",{className:"gh-portal-products-grid",children:u.jsx(ST,{products:t,selectedInterval:v,handleChooseSignup:a,errors:i})})]})})}function xT({onPlanSelect:e,selectedPlan:t,products:n,type:a=null}){var b;const{site:i,member:r}=w.useContext(_),{portal_plans:o}=i,s=Zn({member:r}),l=py({site:i,priceId:s.id}),c=Md({portalPlans:o,selectedInterval:s.interval}),m=(l==null?void 0:l.id)||((b=n==null?void 0:n[0])==null?void 0:b.id),[p,d]=w.useState(c),[h,y]=w.useState(m),v=Md({portalPlans:o,selectedInterval:p});if(w.useEffect(()=>{y(m)},[m]),!o.includes("monthly")&&!o.includes("yearly")||n.length===0)return null;let g="gh-portal-products";return a==="upgrade"&&(g+=" gh-portal-upgrade-product"),a==="changePlan"&&(g+=" gh-portal-upgrade-product gh-portal-change-plan"),u.jsx(Qa.Provider,{value:{selectedInterval:v,selectedProduct:h,selectedPlan:t,setSelectedProduct:y},children:u.jsxs("section",{className:g,children:[u.jsx(Ly,{selectedInterval:v,setSelectedInterval:d,products:n}),u.jsx("div",{className:"gh-portal-products-grid",children:u.jsx(jT,{products:n,onPlanSelect:e})})]})})}function ET({product:e}){return e!=null&&e.description?u.jsx("div",{className:"gh-portal-product-description","data-testid":"product-description",children:e.description}):null}function CT({product:e,onPlanSelect:t}){const{member:n,site:a}=w.useContext(_),{selectedProduct:i,setSelectedProduct:r,selectedInterval:o}=w.useContext(Qa),s=i===e.id?"gh-portal-product-card checked":"gh-portal-product-card",l=e.monthlyPrice,c=e.yearlyPrice,m=Zn({member:n}),p=o==="month"?l:c,d=h0({member:n,site:a,priceId:p.id});return u.jsxs("div",{className:s+(d?" disabled":""),onClick:h=>{h.stopPropagation(),r(e.id)},"data-test-tier":"paid",children:[u.jsxs("div",{className:"gh-portal-product-card-header",children:[u.jsx("h4",{className:"gh-portal-product-name",children:e.name}),u.jsx(_y,{product:e})]}),u.jsxs("div",{className:"gh-portal-product-card-details",children:[u.jsxs("div",{className:"gh-portal-product-card-detaildata",children:[e.description?u.jsx(ET,{product:e,selectedPrice:p,activePrice:m}):"",u.jsx(Ad,{product:e})]}),d?u.jsx("div",{className:"gh-portal-btn-product",children:u.jsx("span",{className:"gh-portal-current-plan",children:u.jsx("span",{children:f("Current plan")})})}):u.jsx("div",{className:"gh-portal-btn-product",children:u.jsx("button",{"data-test-button":"select-tier",className:"gh-portal-btn",onClick:()=>{t(null,p==null?void 0:p.id)},children:f("Choose")})})]})]},e.id)}function jT({products:e,onPlanSelect:t}){return e.map(n=>!n||n.id==="free"?null:u.jsx(CT,{product:n,onPlanSelect:t},n.id))}function $T({products:e,selectedPlan:t,onPlanSelect:n,onPlanCheckout:a,changePlan:i=!1}){return Ka()&&(n=()=>{}),i?u.jsx("section",{className:"gh-portal-plans",children:u.jsx("div",{children:u.jsx(xT,{type:"changePlan",products:e,selectedPlan:t,onPlanSelect:n})})}):u.jsx("section",{className:"gh-portal-plans",children:u.jsx("div",{children:u.jsx(Yy,{type:"upgrade",products:e,onPlanSelect:n,handleChooseSignup:(...o)=>{a(...o)}})})})}const TT=`
1274
+ `,Qa=Z.createContext({selectedInterval:"month",selectedProduct:"free",selectedPlan:null,setSelectedProduct:null});function bT({product:e}){return!e.benefits||!e.benefits.length?null:e.benefits.map((t,n)=>{const a=(t==null?void 0:t.id)||`benefit-${n}`;return u.jsxs("div",{className:"gh-portal-product-benefit",children:[u.jsx(xy,{className:"gh-portal-benefit-checkmark",alt:""}),u.jsx("div",{className:"gh-portal-benefit-title",children:t.name})]},a)})}function Ad({product:e,hide:t=!1}){return!e.benefits||!e.benefits.length||t?null:u.jsx("div",{className:"gh-portal-product-benefits",children:u.jsx(bT,{product:e})})}function Oy({price:e}){const{site:t}=w.useContext(_),{portal_plans:n}=t;return!n.includes("monthly")||!n.includes("yearly")?u.jsx("div",{className:"gh-portal-product-alternative-price"}):u.jsx("div",{className:"gh-portal-product-alternative-price",children:N0(e)})}function yT({trialDays:e,discount:t,selectedInterval:n}){const{site:a}=w.useContext(_);return _s({site:a})?e?u.jsx("span",{className:"gh-portal-discount-label",children:f("{trialDays} days free",{trialDays:e})}):null:n==="year"?u.jsx("span",{className:"gh-portal-discount-label",children:f("{discount}% discount",{discount:t})}):null}function _y({product:e}){const{selectedInterval:t}=w.useContext(Qa),{site:n}=w.useContext(_),a=e.monthlyPrice,i=e.yearlyPrice,r=e.trial_days,o=t==="month"?a:i,s=t==="month"?i:a,l=o.interval==="year"?f("year"):f("month");if(!a||!i)return null;const c=Ey(e.monthlyPrice.amount,e.yearlyPrice.amount),m=ve(o.currency);return _s({site:n})?u.jsx(u.Fragment,{children:u.jsxs("div",{className:"gh-portal-product-card-pricecontainer",children:[u.jsxs("div",{className:"gh-portal-product-card-price-trial",children:[u.jsxs("div",{className:"gh-portal-product-price",children:[u.jsx("span",{className:"currency-sign"+(m.length>1?" long":""),children:m}),u.jsx("span",{className:"amount","data-testid":"product-amount",children:zn(yd(o.amount))}),u.jsxs("span",{className:"billing-period",children:["/",l]})]}),u.jsx(yT,{trialDays:r,discount:c,selectedInterval:t})]}),t==="year"?u.jsx(Ry,{discount:c,trialDays:r}):"",u.jsx(Oy,{price:s})]})}):u.jsxs("div",{className:"gh-portal-product-card-pricecontainer",children:[u.jsxs("div",{className:"gh-portal-product-card-price-trial",children:[u.jsxs("div",{className:"gh-portal-product-price",children:[u.jsx("span",{className:"currency-sign"+(m.length>1?" long":""),children:m}),u.jsx("span",{className:"amount","data-testid":"product-amount",children:zn(yd(o.amount))}),u.jsxs("span",{className:"billing-period",children:["/",l]})]}),t==="year"?u.jsx(Ry,{discount:c}):""]}),u.jsx(Oy,{price:s})]})}function kT({products:e,handleChooseSignup:t,error:n}){const{site:a,action:i}=w.useContext(_),{selectedProduct:r,setSelectedProduct:o}=w.useContext(Qa);let s=r==="free"?"gh-portal-product-card free checked":"gh-portal-product-card free";const l=Qn({site:a});let c=S0({site:a}),m=i==="signup:running";Ka()&&(m=!0);let p="$";e&&e[1]?p=ve(e[1].monthlyPrice.currency):p="$";const d=my({site:a}),h=w0({site:a});if(d){if(!c&&!h.length)return null;s+=" only-free"}return!c&&!h.length&&(c="Free preview"),u.jsx(u.Fragment,{children:u.jsxs("div",{className:s,onClick:y=>{y.stopPropagation(),o("free")},"data-test-tier":"free",children:[u.jsxs("div",{className:"gh-portal-product-card-header",children:[u.jsx("h4",{className:"gh-portal-product-name",children:cy({site:a})}),d?"":u.jsx("div",{className:"gh-portal-product-card-pricecontainer free-trial-disabled",children:u.jsxs("div",{className:"gh-portal-product-price",children:[u.jsx("span",{className:"currency-sign"+(p.length>1?" long":""),children:p}),u.jsx("span",{className:"amount","data-testid":"product-amount",children:"0"})]})})]}),u.jsxs("div",{className:"gh-portal-product-card-details",children:[u.jsxs("div",{className:"gh-portal-product-card-detaildata",children:[c?u.jsx("div",{className:"gh-portal-product-description","data-testid":"product-description",children:c}):"",u.jsx(Ad,{product:l})]}),d?"":u.jsxs("div",{className:"gh-portal-btn-product",children:[u.jsx("button",{"data-test-button":"select-tier",className:"gh-portal-btn",disabled:m,onClick:y=>{t(y,"free")},children:r==="free"&&m?u.jsx(Ja,{className:"gh-portal-loadingicon"}):f("Choose")}),n&&u.jsx("div",{className:"gh-portal-error-message",children:n})]})]})]})})}function vT({selectedProduct:e,product:t,disabled:n,noOfProducts:a,trialDays:i}){return e===t.id&&n?u.jsx(Ja,{className:"gh-portal-loadingicon"}):i>0?u.jsx(Ve,{string:f("Start {amount}-day free trial"),mapping:{amount:i}}):a>1?f("Choose"):f("Continue")}function wT({product:e,products:t,selectedInterval:n,handleChooseSignup:a,error:i}){var h;const{selectedProduct:r,setSelectedProduct:o}=w.useContext(Qa),{action:s}=w.useContext(_),l=e.trial_days,c=r===e.id?"gh-portal-product-card checked":"gh-portal-product-card",m=(h=t==null?void 0:t.filter(y=>y.type==="paid"))==null?void 0:h.length;let p=!!["signup:running","checkoutPlan:running"].includes(s);Ka()&&(p=!0);let d=e.description;return(!e.benefits||!e.benefits.length)&&!d&&(d="Full access"),u.jsx(u.Fragment,{children:u.jsxs("div",{className:c,onClick:y=>{y.stopPropagation(),o(e.id)},"data-test-tier":"paid",children:[u.jsxs("div",{className:"gh-portal-product-card-header",children:[u.jsx("h4",{className:"gh-portal-product-name",children:e.name}),u.jsx(_y,{product:e})]}),u.jsxs("div",{className:"gh-portal-product-card-details",children:[u.jsxs("div",{className:"gh-portal-product-card-detaildata",children:[u.jsx("div",{className:"gh-portal-product-description","data-testid":"product-description",children:d}),u.jsx(Ad,{product:e})]}),u.jsxs("div",{className:"gh-portal-btn-product",children:[u.jsx("button",{"data-test-button":"select-tier",disabled:p,className:"gh-portal-btn",onClick:y=>{const v=Id({products:t,selectedInterval:n,selectedProduct:e.id});a(y,v.id)},children:u.jsx(vT,{selectedProduct:r,product:e,disabled:p,noOfProducts:m,trialDays:l})}),i&&u.jsx("div",{className:"gh-portal-error-message",children:i})]})]})]},e.id)})}function ST({product:e,products:t,selectedInterval:n,errors:a}){const i=Id({products:t,selectedInterval:n,selectedProduct:e.id});return i&&i.id&&a&&a[i.id]?a[i.id]:null}function xT({products:e,selectedInterval:t,handleChooseSignup:n,errors:a}){return e.map(i=>{const r=ST({product:i,products:e,selectedInterval:t,errors:a});return i.id==="free"?u.jsx(kT,{products:e,handleChooseSignup:n,error:r},i.id):u.jsx(wT,{products:e,product:i,selectedInterval:t,handleChooseSignup:n,error:r},i.id)})}function Ry({discount:e}){const{site:t}=w.useContext(_),{portal_plans:n}=t;return e===0||!n.includes("monthly")?null:_s({site:t})?u.jsx(u.Fragment,{children:u.jsx("span",{className:"gh-portal-discount-label-trial",children:f("{discount}% discount",{discount:e})})}):u.jsx(u.Fragment,{children:u.jsx("span",{className:"gh-portal-discount-label",children:f("{discount}% discount",{discount:e})})})}function Ly({selectedInterval:e,setSelectedInterval:t,products:n}){const{site:a}=w.useContext(_),{portal_plans:i}=a,o=n.filter(l=>l.type!=="free").map(l=>{var c,m;return Ey((c=l.monthlyPrice)==null?void 0:c.amount,(m=l.yearlyPrice)==null?void 0:m.amount)}),s=Math.max(...o);return!i.includes("monthly")||!i.includes("yearly")?null:u.jsx("div",{className:"gh-portal-logged-out-form-container",children:u.jsxs("div",{className:"gh-portal-products-pricetoggle"+(e==="month"?" left":""),children:[u.jsx("button",{"data-test-button":"switch-monthly","data-testid":"monthly-switch",className:"gh-portal-btn"+(e==="month"?" active":""),onClick:()=>{t("month")},children:f("Monthly")}),u.jsxs("button",{"data-test-button":"switch-yearly","data-testid":"yearly-switch",className:"gh-portal-btn"+(e==="year"?" active":""),onClick:()=>{t("year")},children:[f("Yearly"),s>0&&u.jsx("span",{className:"gh-portal-maximum-discount",children:f("(save {highestYearlyDiscount}%)",{highestYearlyDiscount:s})})]})]})})}function Id({products:e,selectedProduct:t,selectedInterval:n}){let a=null;if(t==="free")a={id:"free"};else{let i=e.find(r=>r.id===t);i||(i=e.find(r=>r.type==="paid")),a=n==="month"?i==null?void 0:i.monthlyPrice:i==null?void 0:i.yearlyPrice}return a}function Md({portalPlans:e,portalDefaultPlan:t,selectedInterval:n}){if(n==="month"&&e.includes("monthly"))return"month";if(n==="year"&&e.includes("yearly"))return"year";if(t&&t==="monthly"&&e.includes("monthly"))return"month";if(e.includes("yearly"))return"year";if(e.includes("monthly"))return"month"}function Yy({onPlanSelect:e,products:t,type:n=null,handleChooseSignup:a,errors:i}){var x,z;const{site:r,member:o}=w.useContext(_),{portal_plans:s,portal_default_plan:l}=r,c=t.length>0?t[0].id:"free",[m,p]=w.useState(null),[d,h]=w.useState(c),y=Id({products:t,selectedInterval:m,selectedProduct:d}),v=Md({portalPlans:s,portalDefaultPlan:l,selectedInterval:m}),g=Tn({member:o}),b=my({site:r});if(w.useEffect(()=>{h(c)},[c]),w.useEffect(()=>{e(null,y.id)},[y.id,e]),t.length===0)if(g){const C=Er({site:r});return u.jsx("p",{style:{textAlign:"center"},children:f("Please contact {supportAddress} to adjust your complimentary subscription.",{supportAddress:C})})}else return null;let k="gh-portal-products";n==="upgrade"&&(k+=" gh-portal-upgrade-product");let E=((x=t.find(C=>C.id===d))==null?void 0:x.id)||((z=t.find(C=>C.type==="paid"))==null?void 0:z.id);return u.jsx(Qa.Provider,{value:{selectedInterval:v,selectedProduct:E,setSelectedProduct:h},children:u.jsxs("section",{className:k,children:[b?"":u.jsx(Ly,{products:t,selectedInterval:v,setSelectedInterval:p}),u.jsx("div",{className:"gh-portal-products-grid",children:u.jsx(xT,{products:t,selectedInterval:v,handleChooseSignup:a,errors:i})})]})})}function ET({onPlanSelect:e,selectedPlan:t,products:n,type:a=null}){var b;const{site:i,member:r}=w.useContext(_),{portal_plans:o}=i,s=Zn({member:r}),l=py({site:i,priceId:s.id}),c=Md({portalPlans:o,selectedInterval:s.interval}),m=(l==null?void 0:l.id)||((b=n==null?void 0:n[0])==null?void 0:b.id),[p,d]=w.useState(c),[h,y]=w.useState(m),v=Md({portalPlans:o,selectedInterval:p});if(w.useEffect(()=>{y(m)},[m]),!o.includes("monthly")&&!o.includes("yearly")||n.length===0)return null;let g="gh-portal-products";return a==="upgrade"&&(g+=" gh-portal-upgrade-product"),a==="changePlan"&&(g+=" gh-portal-upgrade-product gh-portal-change-plan"),u.jsx(Qa.Provider,{value:{selectedInterval:v,selectedProduct:h,selectedPlan:t,setSelectedProduct:y},children:u.jsxs("section",{className:g,children:[u.jsx(Ly,{selectedInterval:v,setSelectedInterval:d,products:n}),u.jsx("div",{className:"gh-portal-products-grid",children:u.jsx($T,{products:n,onPlanSelect:e})})]})})}function CT({product:e}){return e!=null&&e.description?u.jsx("div",{className:"gh-portal-product-description","data-testid":"product-description",children:e.description}):null}function jT({product:e,onPlanSelect:t}){const{member:n,site:a}=w.useContext(_),{selectedProduct:i,setSelectedProduct:r,selectedInterval:o}=w.useContext(Qa),s=i===e.id?"gh-portal-product-card checked":"gh-portal-product-card",l=e.monthlyPrice,c=e.yearlyPrice,m=Zn({member:n}),p=o==="month"?l:c,d=h0({member:n,site:a,priceId:p.id});return u.jsxs("div",{className:s+(d?" disabled":""),onClick:h=>{h.stopPropagation(),r(e.id)},"data-test-tier":"paid",children:[u.jsxs("div",{className:"gh-portal-product-card-header",children:[u.jsx("h4",{className:"gh-portal-product-name",children:e.name}),u.jsx(_y,{product:e})]}),u.jsxs("div",{className:"gh-portal-product-card-details",children:[u.jsxs("div",{className:"gh-portal-product-card-detaildata",children:[e.description?u.jsx(CT,{product:e,selectedPrice:p,activePrice:m}):"",u.jsx(Ad,{product:e})]}),d?u.jsx("div",{className:"gh-portal-btn-product",children:u.jsx("span",{className:"gh-portal-current-plan",children:u.jsx("span",{children:f("Current plan")})})}):u.jsx("div",{className:"gh-portal-btn-product",children:u.jsx("button",{"data-test-button":"select-tier",className:"gh-portal-btn",onClick:()=>{t(null,p==null?void 0:p.id)},children:f("Choose")})})]})]},e.id)}function $T({products:e,onPlanSelect:t}){return e.map(n=>!n||n.id==="free"?null:u.jsx(jT,{product:n,onPlanSelect:t},n.id))}function TT({products:e,selectedPlan:t,onPlanSelect:n,onPlanCheckout:a,changePlan:i=!1}){return Ka()&&(n=()=>{}),i?u.jsx("section",{className:"gh-portal-plans",children:u.jsx("div",{children:u.jsx(ET,{type:"changePlan",products:e,selectedPlan:t,onPlanSelect:n})})}):u.jsx("section",{className:"gh-portal-plans",children:u.jsx("div",{children:u.jsx(Yy,{type:"upgrade",products:e,onPlanSelect:n,handleChooseSignup:(...o)=>{a(...o)}})})})}const PT=`
1275
1275
  .account-plan.full-size .gh-portal-main-title {
1276
1276
  font-size: 3.2rem;
1277
1277
  margin-top: 44px;
@@ -1320,7 +1320,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1320
1320
  .gh-portal-retention-offer-price .gh-portal-offer-oldprice {
1321
1321
  margin: 4px 0 0;
1322
1322
  }
1323
- `;function PT({confirmationType:e,pendingOffer:t}){if(e==="changePlan")return f("Confirm subscription");if(e==="cancel")return f("Cancel subscription");if(e==="subscribe")return f("Subscribe");if(e==="offerRetention")return(t==null?void 0:t.display_title)||"Before you go"}const zT=({showConfirmation:e,confirmationType:t,pendingOffer:n})=>{const{member:a}=w.useContext(_);let i=Mt({member:a})?f("Change plan"):f("Choose a plan");return e&&(i=PT({confirmationType:t,pendingOffer:n})),u.jsx("header",{className:"gh-portal-detail-header",children:u.jsx("h3",{className:"gh-portal-main-title",children:i})})},NT=({member:e,onCancelSubscription:t,action:n,brandColor:a})=>{const{site:i}=w.useContext(_);if(!e.paid)return null;const r=ot({member:e});if(!r||r.cancel_at_period_end)return null;const o=f("Cancel subscription"),s=["cancelSubscription:running"].includes(n),l=!!s,c=!!r.cancel_at_period_end,m=!r.cancelAtPeriodEnd;return u.jsx("div",{className:"gh-portal-expire-container",children:u.jsx(ge,{dataTestId:"cancel-subscription",onClick:()=>{t({subscriptionId:r.id,cancelAtPeriodEnd:!0})},isRunning:s,disabled:l,isPrimary:c,isDestructive:m,classes:Is({site:i})?"gh-portal-btn-text mt2 mb4":"",brandColor:a,label:o,style:{width:"100%"}})})},AT=({plan:e,type:t,onConfirm:n})=>{const{site:a,action:i,member:r,brandColor:o}=w.useContext(_),[s,l]=w.useState(""),c=ot({member:r}),m=["updateSubscription:running","checkoutPlan:running","cancelSubscription:running"].includes(i),p=f("Confirm"),d=Qt(c.current_period_end),h=Zn({member:r});let y=f("Starting {startDate}",{startDate:d});h.id!==e.id&&(y=f("Starting today"));const v=zn(e.price),g=`${e.currency_symbol}${v}/${f(e.interval)} – ${y}`,b=py({site:a,priceId:e==null?void 0:e.id}),k=Is({site:a})?b==null?void 0:b.name:f("Price");return t==="changePlan"?u.jsxs("div",{className:"gh-portal-logged-out-form-container",children:[u.jsxs("div",{className:"gh-portal-list mb6",children:[u.jsx("section",{children:u.jsxs("div",{className:"gh-portal-list-detail",children:[u.jsx("h3",{children:f("Account")}),u.jsx("p",{children:r.email})]})}),u.jsx("section",{children:u.jsxs("div",{className:"gh-portal-list-detail",children:[u.jsx("h3",{children:k}),u.jsx("p",{children:g})]})})]}),u.jsx(ge,{dataTestId:"confirm-action",onClick:E=>n(E,e),isRunning:m,isPrimary:!0,brandColor:o,label:p,style:{width:"100%",height:"40px"}})]}):u.jsxs("div",{className:"gh-portal-logged-out-form-container gh-portal-cancellation-form",children:[u.jsx("p",{children:u.jsx(Ve,{string:f("If you cancel your subscription now, you will continue to have access until {periodEnd}."),mapping:{periodEnd:u.jsx("strong",{children:Qt(c.current_period_end)})}})}),u.jsxs("section",{className:"gh-portal-input-section",children:[u.jsx("div",{className:"gh-portal-input-labelcontainer",children:u.jsx("label",{className:"gh-portal-input-label",children:f("Cancellation reason")})}),u.jsx("textarea",{"data-test-input":"cancellation-reason",className:"gh-portal-input",label:"Cancellation reason",type:"text",name:"cancellation_reason",placeholder:"",value:s,onChange:E=>l(E.target.value),rows:"2",maxLength:"500"},"cancellation_reason")]}),u.jsx(ge,{dataTestId:"confirm-cancel-subscription",onClick:E=>n(E,s),isRunning:m,isPrimary:!0,brandColor:o,label:f("Confirm cancellation"),style:{width:"100%",height:"40px"}})]})},IT=({plans:e,selectedPlan:t,onPlanSelect:n,onCancelSubscription:a})=>{const{member:i,action:r,brandColor:o}=w.useContext(_);return u.jsxs("section",{children:[u.jsx("div",{className:"gh-portal-section gh-portal-accountplans-main",children:u.jsx(Uy,{showLabel:!1,plans:e,selectedPlan:t,onPlanSelect:n,changePlan:!0})}),u.jsx(NT,{member:i,onCancelSubscription:a,action:r,brandColor:o})]})};function Uy({selectedPlan:e,onPlanSelect:t,onPlanCheckout:n,changePlan:a=!1}){const{site:i,member:r}=w.useContext(_),o=m0({site:i,member:r}),s=Tn({member:r}),l=sy({member:r,site:i});return u.jsx($T,{products:o.length>0||s||!l?o:[l],selectedPlan:e,changePlan:a,onPlanSelect:t,onPlanCheckout:n})}function MT(e,t,n,a,i){if(Rs(e)){const r=e.duration_in_months,o=r===1?"1 free month":`${r} free months`;if(i!=null&&i.current_period_end){const s=new Date(i.current_period_end),l=s.getUTCDate();let c=s.getUTCMonth()+r,m=s.getUTCFullYear()+Math.floor(c/12);c=c%12;const p=new Date(Date.UTC(m,c+1,0)).getUTCDate(),h=new Date(Date.UTC(m,c,Math.min(l,p))).toLocaleDateString("en-GB",{year:"numeric",month:"short",day:"numeric",timeZone:"UTC"});return`Enjoy ${o} on us. You won't be charged until ${h}.`}return`Enjoy ${o} on us.`}return e.duration==="forever"?`Enjoy ${a} off forever.`:e.duration==="once"?`Save ${a} on your next billing cycle. Then ${n}${t}/${e.cadence}.`:e.duration==="repeating"&&e.duration_in_months===1?`Save ${a} on your next billing cycle. Then ${n}${t}/${e.cadence}.`:e.duration==="repeating"&&e.duration_in_months>1?`Save ${a} on your next ${e.duration_in_months} billing cycles. Then ${n}${t}/${e.cadence}.`:""}const DT=({offer:e,product:t,price:n,onAcceptOffer:a,onDeclineOffer:i})=>{const{brandColor:r,action:o,member:s}=w.useContext(_),l=o==="applyOffer:running",c=ot({member:s}),m=zn(n.amount/100),p=ve(n.currency),d=zn(gy({offer:e,price:n})),h=A0({offer:e}),y=Rs(e)?`${h} free`:`${h} off`,v=e.cadence==="month"?"Monthly":"Yearly",g=`${t.name} - ${v}`,b=e.display_description||"We'd hate to see you leave. How about a special offer to stay?",k=MT(e,m,p,h,c);return u.jsxs("div",{className:"gh-portal-logged-out-form-container gh-portal-offer gh-portal-retention-offer",children:[u.jsx("p",{className:"gh-portal-text-center",children:b}),u.jsxs("div",{className:"gh-portal-offer-bar",children:[u.jsxs("div",{className:"gh-portal-offer-title",children:[u.jsx("h4",{children:g}),u.jsx("h5",{className:"gh-portal-discount-label",children:y})]}),u.jsxs("div",{className:"gh-portal-offer-details",children:[u.jsx("div",{className:"gh-portal-retention-offer-price",children:!Rs(e)&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"gh-portal-product-price",children:[u.jsx("span",{className:"currency-sign",children:p}),u.jsx("span",{className:"amount",children:d})]}),u.jsxs("div",{className:"gh-portal-offer-oldprice",children:[p,m]})]})}),u.jsx("p",{className:"footnote",children:k})]}),u.jsx(ge,{dataTestId:"accept-retention-offer",onClick:a,isRunning:l,disabled:l,isPrimary:!0,brandColor:r,label:"Continue subscription",style:{width:"100%",height:"40px",marginTop:"28px"}})]}),u.jsx(ge,{dataTestId:"decline-retention-offer",onClick:i,isPrimary:!1,isDestructive:!0,classes:"gh-portal-btn-text",brandColor:r,label:"No thanks, I want to cancel",style:{width:"100%",marginTop:"32px",marginBottom:"24px"}})]})},FT=({plans:e,selectedPlan:t,onPlanSelect:n,onPlanCheckout:a})=>{let i="";return e.length===1&&(i="singleplan"),u.jsx("section",{children:u.jsx("div",{className:`gh-portal-section gh-portal-accountplans-main ${i}`,children:u.jsx(Uy,{showLabel:!1,plans:e,selectedPlan:t,onPlanSelect:n,onPlanCheckout:a})})})},OT=({plans:e,selectedPlan:t,confirmationPlan:n,confirmationType:a,showConfirmation:i=!1,pendingOffer:r,onPlanSelect:o,onPlanCheckout:s,onConfirm:l,onCancelSubscription:c,onAcceptRetentionOffer:m,onDeclineRetentionOffer:p})=>{const{member:d,site:h}=w.useContext(_);if(!Mt({member:d})||Tn({member:d}))return u.jsx(FT,{plans:e,selectedPlan:t,onPlanSelect:o,onPlanCheckout:s});if(!i)return u.jsx(IT,{plans:e,selectedPlan:t,onCancelSubscription:c,onPlanSelect:o});if(a==="offerRetention"&&r){const y=r.tier?Xn({site:h,productId:r.tier.id}):sy({member:d,site:h}),v=r.cadence==="month"?y==null?void 0:y.monthlyPrice:y==null?void 0:y.yearlyPrice;if(y&&v)return u.jsx(DT,{offer:r,product:y,price:v,onAcceptOffer:m,onDeclineOffer:p})}return u.jsx(AT,{plan:n,type:a,onConfirm:l})},cm=class cm extends Z.Component{constructor(t,n){super(t,n),this.onPlanSelect=(a,i)=>{a==null||a.preventDefault();const{member:r}=this.context;if(!Mt({member:r})||Tn({member:r}))this.timeoutId=setTimeout(()=>{this.setState(()=>({selectedPlan:i}))},5);else{const o=this.prices.find(c=>c.id===i),l=this.getActivePriceId({member:r})?"changePlan":"subscribe";i!==this.state.selectedPlan&&this.setState({confirmationPlan:o,confirmationType:l,showConfirmation:!0})}},this.state=this.getInitialState()}componentDidMount(){const{member:t}=this.context;if(!t){this.context.doAction("switchPage",{page:"signin"});return}this.handleCancelActionFromPageData()}componentDidUpdate(){this.handleCancelActionFromPageData()}componentWillUnmount(){clearTimeout(this.timeoutId)}getRetentionOfferSignature(t){var n;return t?[t.id,t.display_title||"",t.display_description||"",t.type||"",t.cadence||"",t.amount||0,t.duration||"",t.duration_in_months||0,t.currency||"",t.status||"",((n=t.tier)==null?void 0:n.id)||""].join("|"):""}handleCancelActionFromPageData(){const{member:t,pageData:n,offers:a}=this.context;if(!t||(n==null?void 0:n.action)!=="cancel"||!(n!=null&&n.subscriptionId))return;const i=(a||[]).find(l=>l.redemption_type==="retention")||null,r=this.getRetentionOfferSignature(i),o=this.getRetentionOfferSignature(this.state.pendingOffer);(this.state.targetSubscriptionId!==n.subscriptionId||this.state.confirmationType!=="offerRetention"||r!==o)&&this.onCancelSubscription({subscriptionId:n.subscriptionId}),n.action=null}getInitialState(){const{member:t,site:n}=this.context;this.prices=Ls({site:n});let a=Zn({member:t});a&&(this.prices=p0({prices:this.prices,currency:a.currency}));let i=a?this.prices.find(o=>o.id===a.id):null;return!Mt({member:t})&&this.prices.length>0&&(i=this.prices[0]),{selectedPlan:i?i.id:null,pendingOffer:null,targetSubscriptionId:null}}handleSignout(t){t.preventDefault(),this.context.doAction("signout")}onBack(){this.state.showConfirmation?this.cancelConfirmPage():this.context.doAction("back")}cancelConfirmPage(){this.setState({showConfirmation:!1,confirmationPlan:null,confirmationType:null,pendingOffer:null,targetSubscriptionId:null})}onPlanCheckout(t,n){const{doAction:a,member:i}=this.context;let{confirmationPlan:r,selectedPlan:o}=this.state;if(n&&(o=n),Mt({member:i})&&!Tn({member:i})){const s=ot({member:i}),l=s?s.id:"";l&&a("updateSubscription",{plan:r.name,planId:r.id,subscriptionId:l,cancelAtPeriodEnd:!1})}else a("checkoutPlan",{plan:o})}onCancelSubscription({subscriptionId:t}){const{member:n,offers:a}=this.context,i=g0({subscriptionId:t,member:n});if(!i)return;const r=pd({subscription:i}),o=(a||[]).filter(s=>s.redemption_type==="retention");o.length>0?this.setState({showConfirmation:!0,confirmationPlan:r,confirmationType:"offerRetention",pendingOffer:o[0],targetSubscriptionId:t}):this.setState({showConfirmation:!0,confirmationPlan:r,confirmationType:"cancel",pendingOffer:null,targetSubscriptionId:t})}onAcceptRetentionOffer(){const{pendingOffer:t,targetSubscriptionId:n}=this.state;!n||!t||this.context.doAction("applyOffer",{subscriptionId:n,offerId:t.id})}onDeclineRetentionOffer(){this.setState({confirmationType:"cancel",pendingOffer:null})}onCancelSubscriptionConfirmation(t){const{targetSubscriptionId:n}=this.state;if(!n)return null;this.context.doAction("cancelSubscription",{subscriptionId:n,cancelAtPeriodEnd:!0,cancellationReason:t})}getActivePriceId({member:t}){const n=Zn({member:t});return n?n.id:null}onConfirm(t,n){const{confirmationType:a}=this.state;if(a==="cancel")return this.onCancelSubscriptionConfirmation(n);if(["changePlan","subscribe"].includes(a))return this.onPlanCheckout()}render(){const t=this.prices,{selectedPlan:n,showConfirmation:a,confirmationPlan:i,confirmationType:r,pendingOffer:o}=this.state,{lastPage:s}=this.context;return u.jsx(u.Fragment,{children:u.jsxs("div",{className:"gh-portal-content",children:[u.jsx(Za,{onClick:l=>this.onBack(l),hidden:!s&&!a}),u.jsx(we,{}),u.jsx(zT,{onBack:l=>this.onBack(l),confirmationType:r,pendingOffer:o,showConfirmation:a}),u.jsx(OT,{plans:t,selectedPlan:n,showConfirmation:a,confirmationPlan:i,confirmationType:r,pendingOffer:o,onConfirm:(...l)=>this.onConfirm(...l),onCancelSubscription:l=>this.onCancelSubscription(l),onAcceptRetentionOffer:()=>this.onAcceptRetentionOffer(),onDeclineRetentionOffer:()=>this.onDeclineRetentionOffer(),onPlanSelect:this.onPlanSelect,onPlanCheckout:(l,c)=>this.onPlanCheckout(l,c)})]})})}};cm.contextType=_;let Dd=cm;const _T=`
1323
+ `;function zT({confirmationType:e,pendingOffer:t}){if(e==="changePlan")return f("Confirm subscription");if(e==="cancel")return f("Cancel subscription");if(e==="subscribe")return f("Subscribe");if(e==="offerRetention")return(t==null?void 0:t.display_title)||"Before you go"}const NT=({showConfirmation:e,confirmationType:t,pendingOffer:n})=>{const{member:a}=w.useContext(_);let i=Mt({member:a})?f("Change plan"):f("Choose a plan");return e&&(i=zT({confirmationType:t,pendingOffer:n})),u.jsx("header",{className:"gh-portal-detail-header",children:u.jsx("h3",{className:"gh-portal-main-title",children:i})})},AT=({member:e,onCancelSubscription:t,action:n,brandColor:a})=>{const{site:i}=w.useContext(_);if(!e.paid)return null;const r=ot({member:e});if(!r||r.cancel_at_period_end)return null;const o=f("Cancel subscription"),s=["cancelSubscription:running"].includes(n),l=!!s,c=!!r.cancel_at_period_end,m=!r.cancelAtPeriodEnd;return u.jsx("div",{className:"gh-portal-expire-container",children:u.jsx(ge,{dataTestId:"cancel-subscription",onClick:()=>{t({subscriptionId:r.id,cancelAtPeriodEnd:!0})},isRunning:s,disabled:l,isPrimary:c,isDestructive:m,classes:Is({site:i})?"gh-portal-btn-text mt2 mb4":"",brandColor:a,label:o,style:{width:"100%"}})})},IT=({plan:e,type:t,onConfirm:n})=>{const{site:a,action:i,member:r,brandColor:o}=w.useContext(_),[s,l]=w.useState(""),c=ot({member:r}),m=["updateSubscription:running","checkoutPlan:running","cancelSubscription:running"].includes(i),p=f("Confirm"),d=Qt(c.current_period_end),h=Zn({member:r});let y=f("Starting {startDate}",{startDate:d});h.id!==e.id&&(y=f("Starting today"));const v=zn(e.price),g=`${e.currency_symbol}${v}/${f(e.interval)} – ${y}`,b=py({site:a,priceId:e==null?void 0:e.id}),k=Is({site:a})?b==null?void 0:b.name:f("Price");return t==="changePlan"?u.jsxs("div",{className:"gh-portal-logged-out-form-container",children:[u.jsxs("div",{className:"gh-portal-list mb6",children:[u.jsx("section",{children:u.jsxs("div",{className:"gh-portal-list-detail",children:[u.jsx("h3",{children:f("Account")}),u.jsx("p",{children:r.email})]})}),u.jsx("section",{children:u.jsxs("div",{className:"gh-portal-list-detail",children:[u.jsx("h3",{children:k}),u.jsx("p",{children:g})]})})]}),u.jsx(ge,{dataTestId:"confirm-action",onClick:E=>n(E,e),isRunning:m,isPrimary:!0,brandColor:o,label:p,style:{width:"100%",height:"40px"}})]}):u.jsxs("div",{className:"gh-portal-logged-out-form-container gh-portal-cancellation-form",children:[u.jsx("p",{children:u.jsx(Ve,{string:f("If you cancel your subscription now, you will continue to have access until {periodEnd}."),mapping:{periodEnd:u.jsx("strong",{children:Qt(c.current_period_end)})}})}),u.jsxs("section",{className:"gh-portal-input-section",children:[u.jsx("div",{className:"gh-portal-input-labelcontainer",children:u.jsx("label",{className:"gh-portal-input-label",children:f("Cancellation reason")})}),u.jsx("textarea",{"data-test-input":"cancellation-reason",className:"gh-portal-input",label:"Cancellation reason",type:"text",name:"cancellation_reason",placeholder:"",value:s,onChange:E=>l(E.target.value),rows:"2",maxLength:"500"},"cancellation_reason")]}),u.jsx(ge,{dataTestId:"confirm-cancel-subscription",onClick:E=>n(E,s),isRunning:m,isPrimary:!0,brandColor:o,label:f("Confirm cancellation"),style:{width:"100%",height:"40px"}})]})},MT=({plans:e,selectedPlan:t,onPlanSelect:n,onCancelSubscription:a})=>{const{member:i,action:r,brandColor:o}=w.useContext(_);return u.jsxs("section",{children:[u.jsx("div",{className:"gh-portal-section gh-portal-accountplans-main",children:u.jsx(Uy,{showLabel:!1,plans:e,selectedPlan:t,onPlanSelect:n,changePlan:!0})}),u.jsx(AT,{member:i,onCancelSubscription:a,action:r,brandColor:o})]})};function Uy({selectedPlan:e,onPlanSelect:t,onPlanCheckout:n,changePlan:a=!1}){const{site:i,member:r}=w.useContext(_),o=m0({site:i,member:r}),s=Tn({member:r}),l=sy({member:r,site:i});return u.jsx(TT,{products:o.length>0||s||!l?o:[l],selectedPlan:e,changePlan:a,onPlanSelect:t,onPlanCheckout:n})}function DT(e,t,n,a,i){if(Rs(e)){const r=e.duration_in_months,o=r===1?"1 free month":`${r} free months`,s=_0(i.current_period_end,r),l=s?s.toLocaleDateString("en-GB",{year:"numeric",month:"short",day:"numeric",timeZone:"UTC"}):null;return l?`Enjoy ${o} on us. You won't be charged until ${l}.`:`Enjoy ${o} on us.`}return e.duration==="forever"?`Enjoy ${a} off forever.`:e.duration==="once"?`Save ${a} on your next billing cycle. Then ${n}${t}/${e.cadence}.`:e.duration==="repeating"&&e.duration_in_months===1?`Save ${a} on your next billing cycle. Then ${n}${t}/${e.cadence}.`:e.duration==="repeating"&&e.duration_in_months>1?`Save ${a} on your next ${e.duration_in_months} billing cycles. Then ${n}${t}/${e.cadence}.`:""}const FT=({offer:e,product:t,price:n,onAcceptOffer:a,onDeclineOffer:i})=>{const{brandColor:r,action:o,member:s}=w.useContext(_),l=o==="applyOffer:running",c=ot({member:s}),m=zn(n.amount/100),p=ve(n.currency),d=zn(gy({offer:e,price:n})),h=A0({offer:e}),y=Rs(e)?`${h} free`:`${h} off`,v=e.cadence==="month"?"Monthly":"Yearly",g=`${t.name} - ${v}`,b=e.display_description||"We'd hate to see you leave. How about a special offer to stay?",k=DT(e,m,p,h,c);return u.jsxs("div",{className:"gh-portal-logged-out-form-container gh-portal-offer gh-portal-retention-offer",children:[u.jsx("p",{className:"gh-portal-text-center",children:b}),u.jsxs("div",{className:"gh-portal-offer-bar",children:[u.jsxs("div",{className:"gh-portal-offer-title",children:[u.jsx("h4",{children:g}),u.jsx("h5",{className:"gh-portal-discount-label",children:y})]}),u.jsxs("div",{className:"gh-portal-offer-details",children:[u.jsx("div",{className:"gh-portal-retention-offer-price",children:!Rs(e)&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"gh-portal-product-price",children:[u.jsx("span",{className:"currency-sign",children:p}),u.jsx("span",{className:"amount",children:d})]}),u.jsxs("div",{className:"gh-portal-offer-oldprice",children:[p,m]})]})}),u.jsx("p",{className:"footnote",children:k})]}),u.jsx(ge,{dataTestId:"accept-retention-offer",onClick:a,isRunning:l,disabled:l,isPrimary:!0,brandColor:r,label:"Continue subscription",style:{width:"100%",height:"40px",marginTop:"28px"}})]}),u.jsx(ge,{dataTestId:"decline-retention-offer",onClick:i,isPrimary:!1,isDestructive:!0,classes:"gh-portal-btn-text",brandColor:r,label:"No thanks, I want to cancel",style:{width:"100%",marginTop:"32px",marginBottom:"24px"}})]})},OT=({plans:e,selectedPlan:t,onPlanSelect:n,onPlanCheckout:a})=>{let i="";return e.length===1&&(i="singleplan"),u.jsx("section",{children:u.jsx("div",{className:`gh-portal-section gh-portal-accountplans-main ${i}`,children:u.jsx(Uy,{showLabel:!1,plans:e,selectedPlan:t,onPlanSelect:n,onPlanCheckout:a})})})},_T=({plans:e,selectedPlan:t,confirmationPlan:n,confirmationType:a,showConfirmation:i=!1,pendingOffer:r,onPlanSelect:o,onPlanCheckout:s,onConfirm:l,onCancelSubscription:c,onAcceptRetentionOffer:m,onDeclineRetentionOffer:p})=>{const{member:d,site:h}=w.useContext(_);if(!Mt({member:d})||Tn({member:d}))return u.jsx(OT,{plans:e,selectedPlan:t,onPlanSelect:o,onPlanCheckout:s});if(!i)return u.jsx(MT,{plans:e,selectedPlan:t,onCancelSubscription:c,onPlanSelect:o});if(a==="offerRetention"&&r){const y=r.tier?Xn({site:h,productId:r.tier.id}):sy({member:d,site:h}),v=r.cadence==="month"?y==null?void 0:y.monthlyPrice:y==null?void 0:y.yearlyPrice;if(y&&v)return u.jsx(FT,{offer:r,product:y,price:v,onAcceptOffer:m,onDeclineOffer:p})}return u.jsx(IT,{plan:n,type:a,onConfirm:l})},cm=class cm extends Z.Component{constructor(t,n){super(t,n),this.onPlanSelect=(a,i)=>{a==null||a.preventDefault();const{member:r}=this.context;if(!Mt({member:r})||Tn({member:r}))this.timeoutId=setTimeout(()=>{this.setState(()=>({selectedPlan:i}))},5);else{const o=this.prices.find(c=>c.id===i),l=this.getActivePriceId({member:r})?"changePlan":"subscribe";i!==this.state.selectedPlan&&this.setState({confirmationPlan:o,confirmationType:l,showConfirmation:!0})}},this.state=this.getInitialState()}componentDidMount(){const{member:t}=this.context;if(!t){this.context.doAction("switchPage",{page:"signin"});return}this.handleCancelActionFromPageData()}componentDidUpdate(){this.handleCancelActionFromPageData()}componentWillUnmount(){clearTimeout(this.timeoutId)}getRetentionOfferSignature(t){var n;return t?[t.id,t.display_title||"",t.display_description||"",t.type||"",t.cadence||"",t.amount||0,t.duration||"",t.duration_in_months||0,t.currency||"",t.status||"",((n=t.tier)==null?void 0:n.id)||""].join("|"):""}handleCancelActionFromPageData(){const{member:t,pageData:n,offers:a}=this.context;if(!t||(n==null?void 0:n.action)!=="cancel"||!(n!=null&&n.subscriptionId))return;const i=(a||[]).find(l=>l.redemption_type==="retention")||null,r=this.getRetentionOfferSignature(i),o=this.getRetentionOfferSignature(this.state.pendingOffer);(this.state.targetSubscriptionId!==n.subscriptionId||this.state.confirmationType!=="offerRetention"||r!==o)&&this.onCancelSubscription({subscriptionId:n.subscriptionId}),n.action=null}getInitialState(){const{member:t,site:n}=this.context;this.prices=Ls({site:n});let a=Zn({member:t});a&&(this.prices=p0({prices:this.prices,currency:a.currency}));let i=a?this.prices.find(o=>o.id===a.id):null;return!Mt({member:t})&&this.prices.length>0&&(i=this.prices[0]),{selectedPlan:i?i.id:null,pendingOffer:null,targetSubscriptionId:null}}handleSignout(t){t.preventDefault(),this.context.doAction("signout")}onBack(){this.state.showConfirmation?this.cancelConfirmPage():this.context.doAction("back")}cancelConfirmPage(){this.setState({showConfirmation:!1,confirmationPlan:null,confirmationType:null,pendingOffer:null,targetSubscriptionId:null})}onPlanCheckout(t,n){const{doAction:a,member:i}=this.context;let{confirmationPlan:r,selectedPlan:o}=this.state;if(n&&(o=n),Mt({member:i})&&!Tn({member:i})){const s=ot({member:i}),l=s?s.id:"";l&&a("updateSubscription",{plan:r.name,planId:r.id,subscriptionId:l,cancelAtPeriodEnd:!1})}else a("checkoutPlan",{plan:o})}onCancelSubscription({subscriptionId:t}){const{member:n,offers:a}=this.context,i=g0({subscriptionId:t,member:n});if(!i)return;const r=pd({subscription:i}),o=(a||[]).filter(s=>s.redemption_type==="retention");o.length>0?this.setState({showConfirmation:!0,confirmationPlan:r,confirmationType:"offerRetention",pendingOffer:o[0],targetSubscriptionId:t}):this.setState({showConfirmation:!0,confirmationPlan:r,confirmationType:"cancel",pendingOffer:null,targetSubscriptionId:t})}onAcceptRetentionOffer(){const{pendingOffer:t,targetSubscriptionId:n}=this.state;!n||!t||this.context.doAction("applyOffer",{subscriptionId:n,offerId:t.id})}onDeclineRetentionOffer(){this.setState({confirmationType:"cancel",pendingOffer:null})}onCancelSubscriptionConfirmation(t){const{targetSubscriptionId:n}=this.state;if(!n)return null;this.context.doAction("cancelSubscription",{subscriptionId:n,cancelAtPeriodEnd:!0,cancellationReason:t})}getActivePriceId({member:t}){const n=Zn({member:t});return n?n.id:null}onConfirm(t,n){const{confirmationType:a}=this.state;if(a==="cancel")return this.onCancelSubscriptionConfirmation(n);if(["changePlan","subscribe"].includes(a))return this.onPlanCheckout()}render(){const t=this.prices,{selectedPlan:n,showConfirmation:a,confirmationPlan:i,confirmationType:r,pendingOffer:o}=this.state,{lastPage:s}=this.context;return u.jsx(u.Fragment,{children:u.jsxs("div",{className:"gh-portal-content",children:[u.jsx(Za,{onClick:l=>this.onBack(l),hidden:!s&&!a}),u.jsx(we,{}),u.jsx(NT,{onBack:l=>this.onBack(l),confirmationType:r,pendingOffer:o,showConfirmation:a}),u.jsx(_T,{plans:t,selectedPlan:n,showConfirmation:a,confirmationPlan:i,confirmationType:r,pendingOffer:o,onConfirm:(...l)=>this.onConfirm(...l),onCancelSubscription:l=>this.onCancelSubscription(l),onAcceptRetentionOffer:()=>this.onAcceptRetentionOffer(),onDeclineRetentionOffer:()=>this.onDeclineRetentionOffer(),onPlanSelect:this.onPlanSelect,onPlanCheckout:(l,c)=>this.onPlanCheckout(l,c)})]})})}};cm.contextType=_;let Dd=cm;const RT=`
1324
1324
  .gh-portal-input-section.hidden {
1325
1325
  display: none;
1326
1326
  }
@@ -1384,8 +1384,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1384
1384
  .gh-portal-popup-container:not(.preview) .gh-portal-input:disabled::placeholder {
1385
1385
  color: var(--grey9);
1386
1386
  }
1387
- `;function RT({message:e,style:t}){return e?u.jsx("p",{style:{...t||{}},children:e}):null}function LT({name:e,id:t,hidden:n,label:a,hideLabel:i,type:r,value:o,placeholder:s,disabled:l=!1,onChange:c=()=>{},onBlur:m=()=>{},onKeyDown:p=()=>{},tabIndex:d,maxLength:h,autoFocus:y,errorMessage:v}){const g=w.useRef(null);t=t||`input-${e}`;const b=n?"gh-portal-input-section hidden":"gh-portal-input-section",k=i?"gh-portal-input-label hidden":"gh-portal-input-label",E=v?"gh-portal-input error":"gh-portal-input";Ka()&&(l=!0),de(["preview"])&&(l=!0);let x="",z="",C="",A,N;switch(t){case"input-email":x="off",z="off",C="off";break;case"input-name":x="off",z="off";break;case"input-otc":x="one-time-code",z="off",C="off",A="numeric",N="[0-9]*",s??(s="• • • • • •");break}return w.useEffect(()=>{y&&g.current.focus()},[y]),u.jsxs("section",{className:b,children:[u.jsxs("div",{className:"gh-portal-input-labelcontainer",children:[u.jsxs("label",{htmlFor:t,className:k,children:[" ",a," "]}),u.jsx(RT,{message:v,name:e})]}),u.jsx("input",{"data-test-input":t,ref:g,id:t,className:E,type:r,name:e,value:o,placeholder:s,onChange:$=>c($,e),onKeyDown:$=>p($,e),onBlur:$=>m($,e),disabled:l,tabIndex:d,maxLength:h,autoComplete:x,autoCorrect:z,autoCapitalize:C,"aria-label":a,inputMode:A,pattern:N})]})}const dm=class dm extends Z.Component{render(){return u.jsx(u.Fragment,{children:u.jsxs("button",{className:"gh-portal-btn gh-portal-btn-site-title-back",onClick:()=>{this.props.onBack?this.props.onBack():this.context.doAction("closePopup")},children:[u.jsx("span",{children:"← "})," ",f("Back")]})})}};dm.contextType=_;let Fd=dm;const YT=e=>w.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",...e},w.createElement("g",{transform:"matrix(0.6666666666666666,0,0,0.6666666666666666,0,0)"},w.createElement("path",{d:"M19.5,9.5h-.75V6.75a6.75,6.75,0,0,0-13.5,0V9.5H4.5a2,2,0,0,0-2,2V22a2,2,0,0,0,2,2h15a2,2,0,0,0,2-2V11.5A2,2,0,0,0,19.5,9.5Zm-7.5,9a2,2,0,1,1,2-2A2,2,0,0,1,12,18.5ZM16.25,9a.5.5,0,0,1-.5.5H8.25a.5.5,0,0,1-.5-.5V6.75a4.25,4.25,0,0,1,8.5,0Z",style:{fill:"#000000"}})));function UT({newsletter:e,subscribedNewsletters:t,setSubscribedNewsletters:n}){const a=t.some(i=>i.id===(e==null?void 0:e.id));return e.paid?u.jsxs("section",{className:"gh-portal-list-toggle-wrapper","data-testid":"toggle-wrapper",children:[u.jsxs("div",{className:"gh-portal-list-detail gh-portal-list-big",children:[u.jsx("h3",{children:e.name}),u.jsx("p",{children:e.description})]}),u.jsx("div",{className:"gh-portal-lock-icon-container",children:u.jsx(YT,{className:"gh-portal-lock-icon",alt:"",title:f("Unlock access to all newsletters by becoming a paid subscriber.")})})]}):u.jsxs("section",{className:"gh-portal-list-toggle-wrapper","data-testid":"toggle-wrapper",children:[u.jsxs("div",{className:"gh-portal-list-detail gh-portal-list-big",children:[u.jsx("h3",{children:e.name}),u.jsx("p",{children:e.description})]}),u.jsx("div",{children:u.jsx(Us,{id:e.id,onToggle:(i,r)=>{let o=[];r?o=t.filter(s=>s.id!==e.id).concat(e):o=t.filter(s=>s.id!==e.id),n(o)},checked:a})})]})}function BT({subscribedNewsletters:e,setSubscribedNewsletters:t}){const{site:n}=w.useContext(_);return ea({site:n}).map(i=>u.jsx(UT,{newsletter:i,subscribedNewsletters:e,setSubscribedNewsletters:t},i==null?void 0:i.id))}function Od({pageData:e,onBack:t}){const{brandColor:n,site:a,doAction:i,action:r}=w.useContext(_),s=ea({site:a}).filter(y=>y.subscribe_on_signup);let l=!1;r==="signup:running"&&(l=!0);let c=f("Continue"),m=!1;r==="signup:failed"&&(c=f("Retry"),m=!0);const p=r==="signup:running",[d,h]=w.useState(s);return u.jsxs("div",{className:"gh-portal-content with-footer gh-portal-newsletter-selection",children:[u.jsx("p",{className:"gh-portal-text-center gh-portal-text-large",children:f("Choose your newsletters")}),u.jsx("div",{className:"gh-portal-section",children:u.jsx("div",{className:"gh-portal-list",children:u.jsx(BT,{subscribedNewsletters:d,setSubscribedNewsletters:h})})}),u.jsx("footer",{className:"gh-portal-action-footer",children:u.jsxs("div",{style:{width:"100%"},children:[u.jsx("div",{style:{marginBottom:"20px"},children:u.jsx(ge,{isRunning:l,retry:m,disabled:p,onClick:()=>{let y=d.map(x=>({id:x.id,name:x.name}));const{name:v,email:g,plan:b,phonenumber:k,offerId:E}=e;i("signup",{name:v,email:g,plan:b,phonenumber:k,newsletters:y,offerId:E})},brandColor:n,label:c,style:{width:"100%"}})}),qa({site:a})?null:u.jsx("div",{children:u.jsx("button",{className:"gh-portal-btn gh-portal-btn-link gh-portal-btn-different-plan",onClick:()=>{t()},children:u.jsx("span",{children:f("Choose a different plan")})})})]})})]})}const VT=({field:e,onChange:t,onBlur:n=()=>{},onKeyDown:a=()=>{}})=>e?u.jsx(u.Fragment,{children:u.jsx(LT,{label:e.label,type:e.type,name:e.name,hidden:e.hidden,placeholder:e.placeholder,disabled:e.disabled,value:e.value,onKeyDown:a,onChange:i=>t(i,e),onBlur:i=>n(i,e),tabIndex:e.tabIndex,errorMessage:e.errorMessage,autoFocus:e.autoFocus},e.name)}):null;class Hs extends w.Component{constructor(t){super(t),this.state={}}render(){const{fields:t,onChange:n,onBlur:a,onKeyDown:i}=this.props,r=t.map(o=>u.jsx(VT,{field:o,onChange:n,onBlur:a,onKeyDown:i},o.name));return u.jsx(u.Fragment,{children:r})}}const HT=e=>!!e&&/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(String(e).toLowerCase()),WT=({field:e})=>{if(e.required&&!e.value)switch(e.name){case"name":return f("Enter your name");case"email":return f("Enter your email address");default:return f("Please enter {fieldName}",{fieldName:e.name})}return e.type==="email"&&!HT(e.value)?f("Invalid email address"):null},Ws=({fields:e})=>{const t={};return e.forEach(n=>{const a=n.name,i=WT({field:n});t[a]=i}),t},By=e=>w.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...e},w.createElement("defs",null,w.createElement("style",null,".inviteicon{fill: currentColor;}")),w.createElement("path",{className:"inviteicon",d:"M23.991 11.464l-.036-.146-.028-.068-.011-.027-.115-.114-.018-.021-.008-.005h-.001l-3.774-2.596v-7.987c0-.276-.224-.5-.5-.5h-15c-.276 0-.5.224-.5.5v7.987l-3.774 2.595-.003.002-.006.004-.015.016-.118.118-.011.027-.028.068-.036.146-.009.037v10.5c0 1.103.897 2 2 2h20c1.103 0 2-.897 2-2v-10.5l-.009-.036zm-1.383.03l-2.608 1.738v-3.531l2.608 1.793zm-18.608 1.738l-2.608-1.739 2.608-1.792v3.531zm18 9.768h-20c-.551 0-1-.449-1-1v-9.566l5.223 3.482c.085.057.181.084.276.084.162 0 .32-.078.417-.223.153-.23.091-.54-.139-.693l-1.777-1.185v-12.899h14v12.899l-1.777 1.185c-.23.153-.292.463-.139.693.096.145.255.223.416.223.095 0 .191-.027.277-.084l5.223-3.482v9.566c0 .551-.449 1-1 1zM15.812 16.109c-.088-.07-.198-.109-.312-.109h-7c-.114 0-.224.039-.312.109l-5 4c-.215.173-.25.487-.078.703.173.215.487.251.703.078l4.862-3.89h6.649l4.863 3.891c.093.073.203.109.313.109.147 0 .292-.065.391-.188.172-.216.137-.53-.078-.703l-5.001-4zM11.706 12.779c.087.064.191.096.294.096s.207-.032.294-.096c.482-.35 4.706-3.497 4.706-6.101 0-1.868-1.387-2.984-2.728-2.984-.772 0-1.674.379-2.272 1.368-.598-.988-1.5-1.368-2.272-1.368-1.341-.001-2.728 1.116-2.728 2.984 0 2.604 4.224 5.751 4.706 6.101zm-1.978-8.086c.844 0 1.511.681 1.786 1.822.108.45.864.45.973 0 .274-1.141.942-1.822 1.786-1.822.85 0 1.728.742 1.728 1.984 0 1.646-2.658 4.037-4 5.072-1.342-1.035-4-3.426-4-5.072-.001-1.241.877-1.984 1.727-1.984z"})),Vy=e=>{if(e.currentTarget.contains(e.target)){const t=e.target.closest("a");t&&(e.preventDefault(),window.open(t.href,"_blank"))}};/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */const{entries:Hy,setPrototypeOf:Wy,isFrozen:GT,getPrototypeOf:KT,getOwnPropertyDescriptor:qT}=Object;let{freeze:He,seal:ft,create:_d}=Object,{apply:Rd,construct:Ld}=typeof Reflect<"u"&&Reflect;He||(He=function(t){return t}),ft||(ft=function(t){return t}),Rd||(Rd=function(t,n){for(var a=arguments.length,i=new Array(a>2?a-2:0),r=2;r<a;r++)i[r-2]=arguments[r];return t.apply(n,i)}),Ld||(Ld=function(t){for(var n=arguments.length,a=new Array(n>1?n-1:0),i=1;i<n;i++)a[i-1]=arguments[i];return new t(...a)});const Gs=Ge(Array.prototype.forEach),JT=Ge(Array.prototype.lastIndexOf),Gy=Ge(Array.prototype.pop),Tr=Ge(Array.prototype.push),ZT=Ge(Array.prototype.splice),Ks=Ge(String.prototype.toLowerCase),Yd=Ge(String.prototype.toString),Ud=Ge(String.prototype.match),Pr=Ge(String.prototype.replace),QT=Ge(String.prototype.indexOf),XT=Ge(String.prototype.trim),xt=Ge(Object.prototype.hasOwnProperty),We=Ge(RegExp.prototype.test),zr=e1(TypeError);function Ge(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,a=new Array(n>1?n-1:0),i=1;i<n;i++)a[i-1]=arguments[i];return Rd(e,t,a)}}function e1(e){return function(){for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return Ld(e,n)}}function K(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ks;Wy&&Wy(e,null);let a=t.length;for(;a--;){let i=t[a];if(typeof i=="string"){const r=n(i);r!==i&&(GT(t)||(t[a]=r),i=r)}e[i]=!0}return e}function t1(e){for(let t=0;t<e.length;t++)xt(e,t)||(e[t]=null);return e}function Ft(e){const t=_d(null);for(const[n,a]of Hy(e))xt(e,n)&&(Array.isArray(a)?t[n]=t1(a):a&&typeof a=="object"&&a.constructor===Object?t[n]=Ft(a):t[n]=a);return t}function Nr(e,t){for(;e!==null;){const a=qT(e,t);if(a){if(a.get)return Ge(a.get);if(typeof a.value=="function")return Ge(a.value)}e=KT(e)}function n(){return null}return n}const Ky=He(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Bd=He(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Vd=He(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),n1=He(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Hd=He(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),a1=He(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),qy=He(["#text"]),Jy=He(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Wd=He(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Zy=He(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),qs=He(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),i1=ft(/\{\{[\w\W]*|[\w\W]*\}\}/gm),r1=ft(/<%[\w\W]*|[\w\W]*%>/gm),o1=ft(/\$\{[\w\W]*/gm),s1=ft(/^data-[\-\w.\u00B7-\uFFFF]+$/),l1=ft(/^aria-[\-\w]+$/),Qy=ft(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),u1=ft(/^(?:\w+script|data):/i),c1=ft(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Xy=ft(/^html$/i),d1=ft(/^[a-z][.\w]*(-[.\w]+)+$/i);var ek=Object.freeze({__proto__:null,ARIA_ATTR:l1,ATTR_WHITESPACE:c1,CUSTOM_ELEMENT:d1,DATA_ATTR:s1,DOCTYPE_NAME:Xy,ERB_EXPR:r1,IS_ALLOWED_URI:Qy,IS_SCRIPT_OR_DATA:u1,MUSTACHE_EXPR:i1,TMPLIT_EXPR:o1});const Ar={element:1,text:3,progressingInstruction:7,comment:8,document:9},m1=function(){return typeof window>"u"?null:window},p1=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let a=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(a=n.getAttribute(i));const r="dompurify"+(a?"#"+a:"");try{return t.createPolicy(r,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+r+" could not be created."),null}},tk=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function nk(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m1();const t=U=>nk(U);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Ar.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const a=n,i=a.currentScript,{DocumentFragment:r,HTMLTemplateElement:o,Node:s,Element:l,NodeFilter:c,NamedNodeMap:m=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:p,DOMParser:d,trustedTypes:h}=e,y=l.prototype,v=Nr(y,"cloneNode"),g=Nr(y,"remove"),b=Nr(y,"nextSibling"),k=Nr(y,"childNodes"),E=Nr(y,"parentNode");if(typeof o=="function"){const U=n.createElement("template");U.content&&U.content.ownerDocument&&(n=U.content.ownerDocument)}let x,z="";const{implementation:C,createNodeIterator:A,createDocumentFragment:N,getElementsByTagName:$}=n,{importNode:H}=a;let q=tk();t.isSupported=typeof Hy=="function"&&typeof E=="function"&&C&&C.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:ue,ERB_EXPR:ae,TMPLIT_EXPR:Oe,DATA_ATTR:ze,ARIA_ATTR:Ke,IS_SCRIPT_OR_DATA:j,ATTR_WHITESPACE:P,CUSTOM_ELEMENT:F}=ek;let{IS_ALLOWED_URI:J}=ek,T=null;const O=K({},[...Ky,...Bd,...Vd,...Hd,...qy]);let D=null;const V=K({},[...Jy,...Wd,...Zy,...qs]);let Y=Object.seal(_d(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),fe=null,_e=null;const et=Object.seal(_d(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let st=!0,Or=!0,$k=!1,Tk=!0,ai=!1,tl=!0,aa=!1,Sm=!1,xm=!1,ii=!1,nl=!1,al=!1,Pk=!0,zk=!1;const Mz="user-content-";let Em=!0,_r=!1,ri={},Ot=null;const Cm=K({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Nk=null;const Ak=K({},["audio","video","img","source","image","track"]);let jm=null;const Ik=K({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),il="http://www.w3.org/1998/Math/MathML",rl="http://www.w3.org/2000/svg",en="http://www.w3.org/1999/xhtml";let oi=en,$m=!1,Tm=null;const Dz=K({},[il,rl,en],Yd);let ol=K({},["mi","mo","mn","ms","mtext"]),sl=K({},["annotation-xml"]);const Fz=K({},["title","style","font","a","script"]);let Rr=null;const Oz=["application/xhtml+xml","text/html"],_z="text/html";let Se=null,si=null;const Rz=n.createElement("form"),Mk=function(S){return S instanceof RegExp||S instanceof Function},Pm=function(){let S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(si&&si===S)){if((!S||typeof S!="object")&&(S={}),S=Ft(S),Rr=Oz.indexOf(S.PARSER_MEDIA_TYPE)===-1?_z:S.PARSER_MEDIA_TYPE,Se=Rr==="application/xhtml+xml"?Yd:Ks,T=xt(S,"ALLOWED_TAGS")?K({},S.ALLOWED_TAGS,Se):O,D=xt(S,"ALLOWED_ATTR")?K({},S.ALLOWED_ATTR,Se):V,Tm=xt(S,"ALLOWED_NAMESPACES")?K({},S.ALLOWED_NAMESPACES,Yd):Dz,jm=xt(S,"ADD_URI_SAFE_ATTR")?K(Ft(Ik),S.ADD_URI_SAFE_ATTR,Se):Ik,Nk=xt(S,"ADD_DATA_URI_TAGS")?K(Ft(Ak),S.ADD_DATA_URI_TAGS,Se):Ak,Ot=xt(S,"FORBID_CONTENTS")?K({},S.FORBID_CONTENTS,Se):Cm,fe=xt(S,"FORBID_TAGS")?K({},S.FORBID_TAGS,Se):Ft({}),_e=xt(S,"FORBID_ATTR")?K({},S.FORBID_ATTR,Se):Ft({}),ri=xt(S,"USE_PROFILES")?S.USE_PROFILES:!1,st=S.ALLOW_ARIA_ATTR!==!1,Or=S.ALLOW_DATA_ATTR!==!1,$k=S.ALLOW_UNKNOWN_PROTOCOLS||!1,Tk=S.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ai=S.SAFE_FOR_TEMPLATES||!1,tl=S.SAFE_FOR_XML!==!1,aa=S.WHOLE_DOCUMENT||!1,ii=S.RETURN_DOM||!1,nl=S.RETURN_DOM_FRAGMENT||!1,al=S.RETURN_TRUSTED_TYPE||!1,xm=S.FORCE_BODY||!1,Pk=S.SANITIZE_DOM!==!1,zk=S.SANITIZE_NAMED_PROPS||!1,Em=S.KEEP_CONTENT!==!1,_r=S.IN_PLACE||!1,J=S.ALLOWED_URI_REGEXP||Qy,oi=S.NAMESPACE||en,ol=S.MATHML_TEXT_INTEGRATION_POINTS||ol,sl=S.HTML_INTEGRATION_POINTS||sl,Y=S.CUSTOM_ELEMENT_HANDLING||{},S.CUSTOM_ELEMENT_HANDLING&&Mk(S.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Y.tagNameCheck=S.CUSTOM_ELEMENT_HANDLING.tagNameCheck),S.CUSTOM_ELEMENT_HANDLING&&Mk(S.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Y.attributeNameCheck=S.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),S.CUSTOM_ELEMENT_HANDLING&&typeof S.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Y.allowCustomizedBuiltInElements=S.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ai&&(Or=!1),nl&&(ii=!0),ri&&(T=K({},qy),D=[],ri.html===!0&&(K(T,Ky),K(D,Jy)),ri.svg===!0&&(K(T,Bd),K(D,Wd),K(D,qs)),ri.svgFilters===!0&&(K(T,Vd),K(D,Wd),K(D,qs)),ri.mathMl===!0&&(K(T,Hd),K(D,Zy),K(D,qs))),S.ADD_TAGS&&(typeof S.ADD_TAGS=="function"?et.tagCheck=S.ADD_TAGS:(T===O&&(T=Ft(T)),K(T,S.ADD_TAGS,Se))),S.ADD_ATTR&&(typeof S.ADD_ATTR=="function"?et.attributeCheck=S.ADD_ATTR:(D===V&&(D=Ft(D)),K(D,S.ADD_ATTR,Se))),S.ADD_URI_SAFE_ATTR&&K(jm,S.ADD_URI_SAFE_ATTR,Se),S.FORBID_CONTENTS&&(Ot===Cm&&(Ot=Ft(Ot)),K(Ot,S.FORBID_CONTENTS,Se)),S.ADD_FORBID_CONTENTS&&(Ot===Cm&&(Ot=Ft(Ot)),K(Ot,S.ADD_FORBID_CONTENTS,Se)),Em&&(T["#text"]=!0),aa&&K(T,["html","head","body"]),T.table&&(K(T,["tbody"]),delete fe.tbody),S.TRUSTED_TYPES_POLICY){if(typeof S.TRUSTED_TYPES_POLICY.createHTML!="function")throw zr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof S.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw zr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');x=S.TRUSTED_TYPES_POLICY,z=x.createHTML("")}else x===void 0&&(x=p1(h,i)),x!==null&&typeof z=="string"&&(z=x.createHTML(""));He&&He(S),si=S}},Dk=K({},[...Bd,...Vd,...n1]),Fk=K({},[...Hd,...a1]),Lz=function(S){let I=E(S);(!I||!I.tagName)&&(I={namespaceURI:oi,tagName:"template"});const L=Ks(S.tagName),me=Ks(I.tagName);return Tm[S.namespaceURI]?S.namespaceURI===rl?I.namespaceURI===en?L==="svg":I.namespaceURI===il?L==="svg"&&(me==="annotation-xml"||ol[me]):!!Dk[L]:S.namespaceURI===il?I.namespaceURI===en?L==="math":I.namespaceURI===rl?L==="math"&&sl[me]:!!Fk[L]:S.namespaceURI===en?I.namespaceURI===rl&&!sl[me]||I.namespaceURI===il&&!ol[me]?!1:!Fk[L]&&(Fz[L]||!Dk[L]):!!(Rr==="application/xhtml+xml"&&Tm[S.namespaceURI]):!1},_t=function(S){Tr(t.removed,{element:S});try{E(S).removeChild(S)}catch{g(S)}},ia=function(S,I){try{Tr(t.removed,{attribute:I.getAttributeNode(S),from:I})}catch{Tr(t.removed,{attribute:null,from:I})}if(I.removeAttribute(S),S==="is")if(ii||nl)try{_t(I)}catch{}else try{I.setAttribute(S,"")}catch{}},Ok=function(S){let I=null,L=null;if(xm)S="<remove></remove>"+S;else{const ye=Ud(S,/^[\r\n\t ]+/);L=ye&&ye[0]}Rr==="application/xhtml+xml"&&oi===en&&(S='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+S+"</body></html>");const me=x?x.createHTML(S):S;if(oi===en)try{I=new d().parseFromString(me,Rr)}catch{}if(!I||!I.documentElement){I=C.createDocument(oi,"template",null);try{I.documentElement.innerHTML=$m?z:me}catch{}}const Re=I.body||I.documentElement;return S&&L&&Re.insertBefore(n.createTextNode(L),Re.childNodes[0]||null),oi===en?$.call(I,aa?"html":"body")[0]:aa?I.documentElement:Re},_k=function(S){return A.call(S.ownerDocument||S,S,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},zm=function(S){return S instanceof p&&(typeof S.nodeName!="string"||typeof S.textContent!="string"||typeof S.removeChild!="function"||!(S.attributes instanceof m)||typeof S.removeAttribute!="function"||typeof S.setAttribute!="function"||typeof S.namespaceURI!="string"||typeof S.insertBefore!="function"||typeof S.hasChildNodes!="function")},Rk=function(S){return typeof s=="function"&&S instanceof s};function tn(U,S,I){Gs(U,L=>{L.call(t,S,I,si)})}const Lk=function(S){let I=null;if(tn(q.beforeSanitizeElements,S,null),zm(S))return _t(S),!0;const L=Se(S.nodeName);if(tn(q.uponSanitizeElement,S,{tagName:L,allowedTags:T}),tl&&S.hasChildNodes()&&!Rk(S.firstElementChild)&&We(/<[/\w!]/g,S.innerHTML)&&We(/<[/\w!]/g,S.textContent)||S.nodeType===Ar.progressingInstruction||tl&&S.nodeType===Ar.comment&&We(/<[/\w]/g,S.data))return _t(S),!0;if(!(et.tagCheck instanceof Function&&et.tagCheck(L))&&(!T[L]||fe[L])){if(!fe[L]&&Uk(L)&&(Y.tagNameCheck instanceof RegExp&&We(Y.tagNameCheck,L)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(L)))return!1;if(Em&&!Ot[L]){const me=E(S)||S.parentNode,Re=k(S)||S.childNodes;if(Re&&me){const ye=Re.length;for(let tt=ye-1;tt>=0;--tt){const nn=v(Re[tt],!0);nn.__removalCount=(S.__removalCount||0)+1,me.insertBefore(nn,b(S))}}}return _t(S),!0}return S instanceof l&&!Lz(S)||(L==="noscript"||L==="noembed"||L==="noframes")&&We(/<\/no(script|embed|frames)/i,S.innerHTML)?(_t(S),!0):(ai&&S.nodeType===Ar.text&&(I=S.textContent,Gs([ue,ae,Oe],me=>{I=Pr(I,me," ")}),S.textContent!==I&&(Tr(t.removed,{element:S.cloneNode()}),S.textContent=I)),tn(q.afterSanitizeElements,S,null),!1)},Yk=function(S,I,L){if(Pk&&(I==="id"||I==="name")&&(L in n||L in Rz))return!1;if(!(Or&&!_e[I]&&We(ze,I))){if(!(st&&We(Ke,I))){if(!(et.attributeCheck instanceof Function&&et.attributeCheck(I,S))){if(!D[I]||_e[I]){if(!(Uk(S)&&(Y.tagNameCheck instanceof RegExp&&We(Y.tagNameCheck,S)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(S))&&(Y.attributeNameCheck instanceof RegExp&&We(Y.attributeNameCheck,I)||Y.attributeNameCheck instanceof Function&&Y.attributeNameCheck(I,S))||I==="is"&&Y.allowCustomizedBuiltInElements&&(Y.tagNameCheck instanceof RegExp&&We(Y.tagNameCheck,L)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(L))))return!1}else if(!jm[I]){if(!We(J,Pr(L,P,""))){if(!((I==="src"||I==="xlink:href"||I==="href")&&S!=="script"&&QT(L,"data:")===0&&Nk[S])){if(!($k&&!We(j,Pr(L,P,"")))){if(L)return!1}}}}}}}return!0},Uk=function(S){return S!=="annotation-xml"&&Ud(S,F)},Bk=function(S){tn(q.beforeSanitizeAttributes,S,null);const{attributes:I}=S;if(!I||zm(S))return;const L={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:D,forceKeepAttr:void 0};let me=I.length;for(;me--;){const Re=I[me],{name:ye,namespaceURI:tt,value:nn}=Re,li=Se(ye),Nm=nn;let Ne=ye==="value"?Nm:XT(Nm);if(L.attrName=li,L.attrValue=Ne,L.keepAttr=!0,L.forceKeepAttr=void 0,tn(q.uponSanitizeAttribute,S,L),Ne=L.attrValue,zk&&(li==="id"||li==="name")&&(ia(ye,S),Ne=Mz+Ne),tl&&We(/((--!?|])>)|<\/(style|title|textarea)/i,Ne)){ia(ye,S);continue}if(li==="attributename"&&Ud(Ne,"href")){ia(ye,S);continue}if(L.forceKeepAttr)continue;if(!L.keepAttr){ia(ye,S);continue}if(!Tk&&We(/\/>/i,Ne)){ia(ye,S);continue}ai&&Gs([ue,ae,Oe],Hk=>{Ne=Pr(Ne,Hk," ")});const Vk=Se(S.nodeName);if(!Yk(Vk,li,Ne)){ia(ye,S);continue}if(x&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!tt)switch(h.getAttributeType(Vk,li)){case"TrustedHTML":{Ne=x.createHTML(Ne);break}case"TrustedScriptURL":{Ne=x.createScriptURL(Ne);break}}if(Ne!==Nm)try{tt?S.setAttributeNS(tt,ye,Ne):S.setAttribute(ye,Ne),zm(S)?_t(S):Gy(t.removed)}catch{ia(ye,S)}}tn(q.afterSanitizeAttributes,S,null)},Yz=function U(S){let I=null;const L=_k(S);for(tn(q.beforeSanitizeShadowDOM,S,null);I=L.nextNode();)tn(q.uponSanitizeShadowNode,I,null),Lk(I),Bk(I),I.content instanceof r&&U(I.content);tn(q.afterSanitizeShadowDOM,S,null)};return t.sanitize=function(U){let S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},I=null,L=null,me=null,Re=null;if($m=!U,$m&&(U="<!-->"),typeof U!="string"&&!Rk(U))if(typeof U.toString=="function"){if(U=U.toString(),typeof U!="string")throw zr("dirty is not a string, aborting")}else throw zr("toString is not a function");if(!t.isSupported)return U;if(Sm||Pm(S),t.removed=[],typeof U=="string"&&(_r=!1),_r){if(U.nodeName){const nn=Se(U.nodeName);if(!T[nn]||fe[nn])throw zr("root node is forbidden and cannot be sanitized in-place")}}else if(U instanceof s)I=Ok("<!---->"),L=I.ownerDocument.importNode(U,!0),L.nodeType===Ar.element&&L.nodeName==="BODY"||L.nodeName==="HTML"?I=L:I.appendChild(L);else{if(!ii&&!ai&&!aa&&U.indexOf("<")===-1)return x&&al?x.createHTML(U):U;if(I=Ok(U),!I)return ii?null:al?z:""}I&&xm&&_t(I.firstChild);const ye=_k(_r?U:I);for(;me=ye.nextNode();)Lk(me),Bk(me),me.content instanceof r&&Yz(me.content);if(_r)return U;if(ii){if(nl)for(Re=N.call(I.ownerDocument);I.firstChild;)Re.appendChild(I.firstChild);else Re=I;return(D.shadowroot||D.shadowrootmode)&&(Re=H.call(a,Re,!0)),Re}let tt=aa?I.outerHTML:I.innerHTML;return aa&&T["!doctype"]&&I.ownerDocument&&I.ownerDocument.doctype&&I.ownerDocument.doctype.name&&We(Xy,I.ownerDocument.doctype.name)&&(tt="<!DOCTYPE "+I.ownerDocument.doctype.name+`>
1388
- `+tt),ai&&Gs([ue,ae,Oe],nn=>{tt=Pr(tt,nn," ")}),x&&al?x.createHTML(tt):tt},t.setConfig=function(){let U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Pm(U),Sm=!0},t.clearConfig=function(){si=null,Sm=!1},t.isValidAttribute=function(U,S,I){si||Pm({});const L=Se(U),me=Se(S);return Yk(L,me,I)},t.addHook=function(U,S){typeof S=="function"&&Tr(q[U],S)},t.removeHook=function(U,S){if(S!==void 0){const I=JT(q[U],S);return I===-1?void 0:ZT(q[U],I,1)[0]}return Gy(q[U])},t.removeHooks=function(U){q[U]=[]},t.removeAllHooks=function(){q=tk()},t}var h1=nk();function ak(e){return e?h1.sanitize(e,{ALLOWED_TAGS:["a","b","i","em","strong","p","br","ul","ol","li","span"],ALLOWED_ATTR:["href","target","rel","class"]}):""}function g1(e){return!e||typeof e!="string"||!/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{4}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/.test(e)?"":e}const f1=`
1387
+ `;function LT({message:e,style:t}){return e?u.jsx("p",{style:{...t||{}},children:e}):null}function YT({name:e,id:t,hidden:n,label:a,hideLabel:i,type:r,value:o,placeholder:s,disabled:l=!1,onChange:c=()=>{},onBlur:m=()=>{},onKeyDown:p=()=>{},tabIndex:d,maxLength:h,autoFocus:y,errorMessage:v}){const g=w.useRef(null);t=t||`input-${e}`;const b=n?"gh-portal-input-section hidden":"gh-portal-input-section",k=i?"gh-portal-input-label hidden":"gh-portal-input-label",E=v?"gh-portal-input error":"gh-portal-input";Ka()&&(l=!0),de(["preview"])&&(l=!0);let x="",z="",C="",A,N;switch(t){case"input-email":x="off",z="off",C="off";break;case"input-name":x="off",z="off";break;case"input-otc":x="one-time-code",z="off",C="off",A="numeric",N="[0-9]*",s??(s="• • • • • •");break}return w.useEffect(()=>{y&&g.current.focus()},[y]),u.jsxs("section",{className:b,children:[u.jsxs("div",{className:"gh-portal-input-labelcontainer",children:[u.jsxs("label",{htmlFor:t,className:k,children:[" ",a," "]}),u.jsx(LT,{message:v,name:e})]}),u.jsx("input",{"data-test-input":t,ref:g,id:t,className:E,type:r,name:e,value:o,placeholder:s,onChange:$=>c($,e),onKeyDown:$=>p($,e),onBlur:$=>m($,e),disabled:l,tabIndex:d,maxLength:h,autoComplete:x,autoCorrect:z,autoCapitalize:C,"aria-label":a,inputMode:A,pattern:N})]})}const dm=class dm extends Z.Component{render(){return u.jsx(u.Fragment,{children:u.jsxs("button",{className:"gh-portal-btn gh-portal-btn-site-title-back",onClick:()=>{this.props.onBack?this.props.onBack():this.context.doAction("closePopup")},children:[u.jsx("span",{children:"← "})," ",f("Back")]})})}};dm.contextType=_;let Fd=dm;const UT=e=>w.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",...e},w.createElement("g",{transform:"matrix(0.6666666666666666,0,0,0.6666666666666666,0,0)"},w.createElement("path",{d:"M19.5,9.5h-.75V6.75a6.75,6.75,0,0,0-13.5,0V9.5H4.5a2,2,0,0,0-2,2V22a2,2,0,0,0,2,2h15a2,2,0,0,0,2-2V11.5A2,2,0,0,0,19.5,9.5Zm-7.5,9a2,2,0,1,1,2-2A2,2,0,0,1,12,18.5ZM16.25,9a.5.5,0,0,1-.5.5H8.25a.5.5,0,0,1-.5-.5V6.75a4.25,4.25,0,0,1,8.5,0Z",style:{fill:"#000000"}})));function BT({newsletter:e,subscribedNewsletters:t,setSubscribedNewsletters:n}){const a=t.some(i=>i.id===(e==null?void 0:e.id));return e.paid?u.jsxs("section",{className:"gh-portal-list-toggle-wrapper","data-testid":"toggle-wrapper",children:[u.jsxs("div",{className:"gh-portal-list-detail gh-portal-list-big",children:[u.jsx("h3",{children:e.name}),u.jsx("p",{children:e.description})]}),u.jsx("div",{className:"gh-portal-lock-icon-container",children:u.jsx(UT,{className:"gh-portal-lock-icon",alt:"",title:f("Unlock access to all newsletters by becoming a paid subscriber.")})})]}):u.jsxs("section",{className:"gh-portal-list-toggle-wrapper","data-testid":"toggle-wrapper",children:[u.jsxs("div",{className:"gh-portal-list-detail gh-portal-list-big",children:[u.jsx("h3",{children:e.name}),u.jsx("p",{children:e.description})]}),u.jsx("div",{children:u.jsx(Us,{id:e.id,onToggle:(i,r)=>{let o=[];r?o=t.filter(s=>s.id!==e.id).concat(e):o=t.filter(s=>s.id!==e.id),n(o)},checked:a})})]})}function VT({subscribedNewsletters:e,setSubscribedNewsletters:t}){const{site:n}=w.useContext(_);return ea({site:n}).map(i=>u.jsx(BT,{newsletter:i,subscribedNewsletters:e,setSubscribedNewsletters:t},i==null?void 0:i.id))}function Od({pageData:e,onBack:t}){const{brandColor:n,site:a,doAction:i,action:r}=w.useContext(_),s=ea({site:a}).filter(y=>y.subscribe_on_signup);let l=!1;r==="signup:running"&&(l=!0);let c=f("Continue"),m=!1;r==="signup:failed"&&(c=f("Retry"),m=!0);const p=r==="signup:running",[d,h]=w.useState(s);return u.jsxs("div",{className:"gh-portal-content with-footer gh-portal-newsletter-selection",children:[u.jsx("p",{className:"gh-portal-text-center gh-portal-text-large",children:f("Choose your newsletters")}),u.jsx("div",{className:"gh-portal-section",children:u.jsx("div",{className:"gh-portal-list",children:u.jsx(VT,{subscribedNewsletters:d,setSubscribedNewsletters:h})})}),u.jsx("footer",{className:"gh-portal-action-footer",children:u.jsxs("div",{style:{width:"100%"},children:[u.jsx("div",{style:{marginBottom:"20px"},children:u.jsx(ge,{isRunning:l,retry:m,disabled:p,onClick:()=>{let y=d.map(x=>({id:x.id,name:x.name}));const{name:v,email:g,plan:b,phonenumber:k,offerId:E}=e;i("signup",{name:v,email:g,plan:b,phonenumber:k,newsletters:y,offerId:E})},brandColor:n,label:c,style:{width:"100%"}})}),qa({site:a})?null:u.jsx("div",{children:u.jsx("button",{className:"gh-portal-btn gh-portal-btn-link gh-portal-btn-different-plan",onClick:()=>{t()},children:u.jsx("span",{children:f("Choose a different plan")})})})]})})]})}const HT=({field:e,onChange:t,onBlur:n=()=>{},onKeyDown:a=()=>{}})=>e?u.jsx(u.Fragment,{children:u.jsx(YT,{label:e.label,type:e.type,name:e.name,hidden:e.hidden,placeholder:e.placeholder,disabled:e.disabled,value:e.value,onKeyDown:a,onChange:i=>t(i,e),onBlur:i=>n(i,e),tabIndex:e.tabIndex,errorMessage:e.errorMessage,autoFocus:e.autoFocus},e.name)}):null;class Hs extends w.Component{constructor(t){super(t),this.state={}}render(){const{fields:t,onChange:n,onBlur:a,onKeyDown:i}=this.props,r=t.map(o=>u.jsx(HT,{field:o,onChange:n,onBlur:a,onKeyDown:i},o.name));return u.jsx(u.Fragment,{children:r})}}const WT=e=>!!e&&/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(String(e).toLowerCase()),GT=({field:e})=>{if(e.required&&!e.value)switch(e.name){case"name":return f("Enter your name");case"email":return f("Enter your email address");default:return f("Please enter {fieldName}",{fieldName:e.name})}return e.type==="email"&&!WT(e.value)?f("Invalid email address"):null},Ws=({fields:e})=>{const t={};return e.forEach(n=>{const a=n.name,i=GT({field:n});t[a]=i}),t},By=e=>w.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...e},w.createElement("defs",null,w.createElement("style",null,".inviteicon{fill: currentColor;}")),w.createElement("path",{className:"inviteicon",d:"M23.991 11.464l-.036-.146-.028-.068-.011-.027-.115-.114-.018-.021-.008-.005h-.001l-3.774-2.596v-7.987c0-.276-.224-.5-.5-.5h-15c-.276 0-.5.224-.5.5v7.987l-3.774 2.595-.003.002-.006.004-.015.016-.118.118-.011.027-.028.068-.036.146-.009.037v10.5c0 1.103.897 2 2 2h20c1.103 0 2-.897 2-2v-10.5l-.009-.036zm-1.383.03l-2.608 1.738v-3.531l2.608 1.793zm-18.608 1.738l-2.608-1.739 2.608-1.792v3.531zm18 9.768h-20c-.551 0-1-.449-1-1v-9.566l5.223 3.482c.085.057.181.084.276.084.162 0 .32-.078.417-.223.153-.23.091-.54-.139-.693l-1.777-1.185v-12.899h14v12.899l-1.777 1.185c-.23.153-.292.463-.139.693.096.145.255.223.416.223.095 0 .191-.027.277-.084l5.223-3.482v9.566c0 .551-.449 1-1 1zM15.812 16.109c-.088-.07-.198-.109-.312-.109h-7c-.114 0-.224.039-.312.109l-5 4c-.215.173-.25.487-.078.703.173.215.487.251.703.078l4.862-3.89h6.649l4.863 3.891c.093.073.203.109.313.109.147 0 .292-.065.391-.188.172-.216.137-.53-.078-.703l-5.001-4zM11.706 12.779c.087.064.191.096.294.096s.207-.032.294-.096c.482-.35 4.706-3.497 4.706-6.101 0-1.868-1.387-2.984-2.728-2.984-.772 0-1.674.379-2.272 1.368-.598-.988-1.5-1.368-2.272-1.368-1.341-.001-2.728 1.116-2.728 2.984 0 2.604 4.224 5.751 4.706 6.101zm-1.978-8.086c.844 0 1.511.681 1.786 1.822.108.45.864.45.973 0 .274-1.141.942-1.822 1.786-1.822.85 0 1.728.742 1.728 1.984 0 1.646-2.658 4.037-4 5.072-1.342-1.035-4-3.426-4-5.072-.001-1.241.877-1.984 1.727-1.984z"})),Vy=e=>{if(e.currentTarget.contains(e.target)){const t=e.target.closest("a");t&&(e.preventDefault(),window.open(t.href,"_blank"))}};/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */const{entries:Hy,setPrototypeOf:Wy,isFrozen:KT,getPrototypeOf:qT,getOwnPropertyDescriptor:JT}=Object;let{freeze:He,seal:ft,create:_d}=Object,{apply:Rd,construct:Ld}=typeof Reflect<"u"&&Reflect;He||(He=function(t){return t}),ft||(ft=function(t){return t}),Rd||(Rd=function(t,n){for(var a=arguments.length,i=new Array(a>2?a-2:0),r=2;r<a;r++)i[r-2]=arguments[r];return t.apply(n,i)}),Ld||(Ld=function(t){for(var n=arguments.length,a=new Array(n>1?n-1:0),i=1;i<n;i++)a[i-1]=arguments[i];return new t(...a)});const Gs=Ge(Array.prototype.forEach),ZT=Ge(Array.prototype.lastIndexOf),Gy=Ge(Array.prototype.pop),Tr=Ge(Array.prototype.push),QT=Ge(Array.prototype.splice),Ks=Ge(String.prototype.toLowerCase),Yd=Ge(String.prototype.toString),Ud=Ge(String.prototype.match),Pr=Ge(String.prototype.replace),XT=Ge(String.prototype.indexOf),e1=Ge(String.prototype.trim),xt=Ge(Object.prototype.hasOwnProperty),We=Ge(RegExp.prototype.test),zr=t1(TypeError);function Ge(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,a=new Array(n>1?n-1:0),i=1;i<n;i++)a[i-1]=arguments[i];return Rd(e,t,a)}}function t1(e){return function(){for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return Ld(e,n)}}function K(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ks;Wy&&Wy(e,null);let a=t.length;for(;a--;){let i=t[a];if(typeof i=="string"){const r=n(i);r!==i&&(KT(t)||(t[a]=r),i=r)}e[i]=!0}return e}function n1(e){for(let t=0;t<e.length;t++)xt(e,t)||(e[t]=null);return e}function Ft(e){const t=_d(null);for(const[n,a]of Hy(e))xt(e,n)&&(Array.isArray(a)?t[n]=n1(a):a&&typeof a=="object"&&a.constructor===Object?t[n]=Ft(a):t[n]=a);return t}function Nr(e,t){for(;e!==null;){const a=JT(e,t);if(a){if(a.get)return Ge(a.get);if(typeof a.value=="function")return Ge(a.value)}e=qT(e)}function n(){return null}return n}const Ky=He(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Bd=He(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Vd=He(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),a1=He(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Hd=He(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),i1=He(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),qy=He(["#text"]),Jy=He(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Wd=He(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Zy=He(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),qs=He(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),r1=ft(/\{\{[\w\W]*|[\w\W]*\}\}/gm),o1=ft(/<%[\w\W]*|[\w\W]*%>/gm),s1=ft(/\$\{[\w\W]*/gm),l1=ft(/^data-[\-\w.\u00B7-\uFFFF]+$/),u1=ft(/^aria-[\-\w]+$/),Qy=ft(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),c1=ft(/^(?:\w+script|data):/i),d1=ft(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Xy=ft(/^html$/i),m1=ft(/^[a-z][.\w]*(-[.\w]+)+$/i);var ek=Object.freeze({__proto__:null,ARIA_ATTR:u1,ATTR_WHITESPACE:d1,CUSTOM_ELEMENT:m1,DATA_ATTR:l1,DOCTYPE_NAME:Xy,ERB_EXPR:o1,IS_ALLOWED_URI:Qy,IS_SCRIPT_OR_DATA:c1,MUSTACHE_EXPR:r1,TMPLIT_EXPR:s1});const Ar={element:1,text:3,progressingInstruction:7,comment:8,document:9},p1=function(){return typeof window>"u"?null:window},h1=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let a=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(a=n.getAttribute(i));const r="dompurify"+(a?"#"+a:"");try{return t.createPolicy(r,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+r+" could not be created."),null}},tk=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function nk(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p1();const t=U=>nk(U);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Ar.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const a=n,i=a.currentScript,{DocumentFragment:r,HTMLTemplateElement:o,Node:s,Element:l,NodeFilter:c,NamedNodeMap:m=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:p,DOMParser:d,trustedTypes:h}=e,y=l.prototype,v=Nr(y,"cloneNode"),g=Nr(y,"remove"),b=Nr(y,"nextSibling"),k=Nr(y,"childNodes"),E=Nr(y,"parentNode");if(typeof o=="function"){const U=n.createElement("template");U.content&&U.content.ownerDocument&&(n=U.content.ownerDocument)}let x,z="";const{implementation:C,createNodeIterator:A,createDocumentFragment:N,getElementsByTagName:$}=n,{importNode:H}=a;let q=tk();t.isSupported=typeof Hy=="function"&&typeof E=="function"&&C&&C.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:ue,ERB_EXPR:ae,TMPLIT_EXPR:Oe,DATA_ATTR:ze,ARIA_ATTR:Ke,IS_SCRIPT_OR_DATA:j,ATTR_WHITESPACE:P,CUSTOM_ELEMENT:F}=ek;let{IS_ALLOWED_URI:J}=ek,T=null;const O=K({},[...Ky,...Bd,...Vd,...Hd,...qy]);let D=null;const V=K({},[...Jy,...Wd,...Zy,...qs]);let Y=Object.seal(_d(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),fe=null,_e=null;const et=Object.seal(_d(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let st=!0,Or=!0,$k=!1,Tk=!0,ai=!1,tl=!0,aa=!1,Sm=!1,xm=!1,ii=!1,nl=!1,al=!1,Pk=!0,zk=!1;const Dz="user-content-";let Em=!0,_r=!1,ri={},Ot=null;const Cm=K({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Nk=null;const Ak=K({},["audio","video","img","source","image","track"]);let jm=null;const Ik=K({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),il="http://www.w3.org/1998/Math/MathML",rl="http://www.w3.org/2000/svg",en="http://www.w3.org/1999/xhtml";let oi=en,$m=!1,Tm=null;const Fz=K({},[il,rl,en],Yd);let ol=K({},["mi","mo","mn","ms","mtext"]),sl=K({},["annotation-xml"]);const Oz=K({},["title","style","font","a","script"]);let Rr=null;const _z=["application/xhtml+xml","text/html"],Rz="text/html";let Se=null,si=null;const Lz=n.createElement("form"),Mk=function(S){return S instanceof RegExp||S instanceof Function},Pm=function(){let S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(si&&si===S)){if((!S||typeof S!="object")&&(S={}),S=Ft(S),Rr=_z.indexOf(S.PARSER_MEDIA_TYPE)===-1?Rz:S.PARSER_MEDIA_TYPE,Se=Rr==="application/xhtml+xml"?Yd:Ks,T=xt(S,"ALLOWED_TAGS")?K({},S.ALLOWED_TAGS,Se):O,D=xt(S,"ALLOWED_ATTR")?K({},S.ALLOWED_ATTR,Se):V,Tm=xt(S,"ALLOWED_NAMESPACES")?K({},S.ALLOWED_NAMESPACES,Yd):Fz,jm=xt(S,"ADD_URI_SAFE_ATTR")?K(Ft(Ik),S.ADD_URI_SAFE_ATTR,Se):Ik,Nk=xt(S,"ADD_DATA_URI_TAGS")?K(Ft(Ak),S.ADD_DATA_URI_TAGS,Se):Ak,Ot=xt(S,"FORBID_CONTENTS")?K({},S.FORBID_CONTENTS,Se):Cm,fe=xt(S,"FORBID_TAGS")?K({},S.FORBID_TAGS,Se):Ft({}),_e=xt(S,"FORBID_ATTR")?K({},S.FORBID_ATTR,Se):Ft({}),ri=xt(S,"USE_PROFILES")?S.USE_PROFILES:!1,st=S.ALLOW_ARIA_ATTR!==!1,Or=S.ALLOW_DATA_ATTR!==!1,$k=S.ALLOW_UNKNOWN_PROTOCOLS||!1,Tk=S.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ai=S.SAFE_FOR_TEMPLATES||!1,tl=S.SAFE_FOR_XML!==!1,aa=S.WHOLE_DOCUMENT||!1,ii=S.RETURN_DOM||!1,nl=S.RETURN_DOM_FRAGMENT||!1,al=S.RETURN_TRUSTED_TYPE||!1,xm=S.FORCE_BODY||!1,Pk=S.SANITIZE_DOM!==!1,zk=S.SANITIZE_NAMED_PROPS||!1,Em=S.KEEP_CONTENT!==!1,_r=S.IN_PLACE||!1,J=S.ALLOWED_URI_REGEXP||Qy,oi=S.NAMESPACE||en,ol=S.MATHML_TEXT_INTEGRATION_POINTS||ol,sl=S.HTML_INTEGRATION_POINTS||sl,Y=S.CUSTOM_ELEMENT_HANDLING||{},S.CUSTOM_ELEMENT_HANDLING&&Mk(S.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Y.tagNameCheck=S.CUSTOM_ELEMENT_HANDLING.tagNameCheck),S.CUSTOM_ELEMENT_HANDLING&&Mk(S.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Y.attributeNameCheck=S.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),S.CUSTOM_ELEMENT_HANDLING&&typeof S.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Y.allowCustomizedBuiltInElements=S.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ai&&(Or=!1),nl&&(ii=!0),ri&&(T=K({},qy),D=[],ri.html===!0&&(K(T,Ky),K(D,Jy)),ri.svg===!0&&(K(T,Bd),K(D,Wd),K(D,qs)),ri.svgFilters===!0&&(K(T,Vd),K(D,Wd),K(D,qs)),ri.mathMl===!0&&(K(T,Hd),K(D,Zy),K(D,qs))),S.ADD_TAGS&&(typeof S.ADD_TAGS=="function"?et.tagCheck=S.ADD_TAGS:(T===O&&(T=Ft(T)),K(T,S.ADD_TAGS,Se))),S.ADD_ATTR&&(typeof S.ADD_ATTR=="function"?et.attributeCheck=S.ADD_ATTR:(D===V&&(D=Ft(D)),K(D,S.ADD_ATTR,Se))),S.ADD_URI_SAFE_ATTR&&K(jm,S.ADD_URI_SAFE_ATTR,Se),S.FORBID_CONTENTS&&(Ot===Cm&&(Ot=Ft(Ot)),K(Ot,S.FORBID_CONTENTS,Se)),S.ADD_FORBID_CONTENTS&&(Ot===Cm&&(Ot=Ft(Ot)),K(Ot,S.ADD_FORBID_CONTENTS,Se)),Em&&(T["#text"]=!0),aa&&K(T,["html","head","body"]),T.table&&(K(T,["tbody"]),delete fe.tbody),S.TRUSTED_TYPES_POLICY){if(typeof S.TRUSTED_TYPES_POLICY.createHTML!="function")throw zr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof S.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw zr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');x=S.TRUSTED_TYPES_POLICY,z=x.createHTML("")}else x===void 0&&(x=h1(h,i)),x!==null&&typeof z=="string"&&(z=x.createHTML(""));He&&He(S),si=S}},Dk=K({},[...Bd,...Vd,...a1]),Fk=K({},[...Hd,...i1]),Yz=function(S){let I=E(S);(!I||!I.tagName)&&(I={namespaceURI:oi,tagName:"template"});const L=Ks(S.tagName),me=Ks(I.tagName);return Tm[S.namespaceURI]?S.namespaceURI===rl?I.namespaceURI===en?L==="svg":I.namespaceURI===il?L==="svg"&&(me==="annotation-xml"||ol[me]):!!Dk[L]:S.namespaceURI===il?I.namespaceURI===en?L==="math":I.namespaceURI===rl?L==="math"&&sl[me]:!!Fk[L]:S.namespaceURI===en?I.namespaceURI===rl&&!sl[me]||I.namespaceURI===il&&!ol[me]?!1:!Fk[L]&&(Oz[L]||!Dk[L]):!!(Rr==="application/xhtml+xml"&&Tm[S.namespaceURI]):!1},_t=function(S){Tr(t.removed,{element:S});try{E(S).removeChild(S)}catch{g(S)}},ia=function(S,I){try{Tr(t.removed,{attribute:I.getAttributeNode(S),from:I})}catch{Tr(t.removed,{attribute:null,from:I})}if(I.removeAttribute(S),S==="is")if(ii||nl)try{_t(I)}catch{}else try{I.setAttribute(S,"")}catch{}},Ok=function(S){let I=null,L=null;if(xm)S="<remove></remove>"+S;else{const ye=Ud(S,/^[\r\n\t ]+/);L=ye&&ye[0]}Rr==="application/xhtml+xml"&&oi===en&&(S='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+S+"</body></html>");const me=x?x.createHTML(S):S;if(oi===en)try{I=new d().parseFromString(me,Rr)}catch{}if(!I||!I.documentElement){I=C.createDocument(oi,"template",null);try{I.documentElement.innerHTML=$m?z:me}catch{}}const Re=I.body||I.documentElement;return S&&L&&Re.insertBefore(n.createTextNode(L),Re.childNodes[0]||null),oi===en?$.call(I,aa?"html":"body")[0]:aa?I.documentElement:Re},_k=function(S){return A.call(S.ownerDocument||S,S,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},zm=function(S){return S instanceof p&&(typeof S.nodeName!="string"||typeof S.textContent!="string"||typeof S.removeChild!="function"||!(S.attributes instanceof m)||typeof S.removeAttribute!="function"||typeof S.setAttribute!="function"||typeof S.namespaceURI!="string"||typeof S.insertBefore!="function"||typeof S.hasChildNodes!="function")},Rk=function(S){return typeof s=="function"&&S instanceof s};function tn(U,S,I){Gs(U,L=>{L.call(t,S,I,si)})}const Lk=function(S){let I=null;if(tn(q.beforeSanitizeElements,S,null),zm(S))return _t(S),!0;const L=Se(S.nodeName);if(tn(q.uponSanitizeElement,S,{tagName:L,allowedTags:T}),tl&&S.hasChildNodes()&&!Rk(S.firstElementChild)&&We(/<[/\w!]/g,S.innerHTML)&&We(/<[/\w!]/g,S.textContent)||S.nodeType===Ar.progressingInstruction||tl&&S.nodeType===Ar.comment&&We(/<[/\w]/g,S.data))return _t(S),!0;if(!(et.tagCheck instanceof Function&&et.tagCheck(L))&&(!T[L]||fe[L])){if(!fe[L]&&Uk(L)&&(Y.tagNameCheck instanceof RegExp&&We(Y.tagNameCheck,L)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(L)))return!1;if(Em&&!Ot[L]){const me=E(S)||S.parentNode,Re=k(S)||S.childNodes;if(Re&&me){const ye=Re.length;for(let tt=ye-1;tt>=0;--tt){const nn=v(Re[tt],!0);nn.__removalCount=(S.__removalCount||0)+1,me.insertBefore(nn,b(S))}}}return _t(S),!0}return S instanceof l&&!Yz(S)||(L==="noscript"||L==="noembed"||L==="noframes")&&We(/<\/no(script|embed|frames)/i,S.innerHTML)?(_t(S),!0):(ai&&S.nodeType===Ar.text&&(I=S.textContent,Gs([ue,ae,Oe],me=>{I=Pr(I,me," ")}),S.textContent!==I&&(Tr(t.removed,{element:S.cloneNode()}),S.textContent=I)),tn(q.afterSanitizeElements,S,null),!1)},Yk=function(S,I,L){if(Pk&&(I==="id"||I==="name")&&(L in n||L in Lz))return!1;if(!(Or&&!_e[I]&&We(ze,I))){if(!(st&&We(Ke,I))){if(!(et.attributeCheck instanceof Function&&et.attributeCheck(I,S))){if(!D[I]||_e[I]){if(!(Uk(S)&&(Y.tagNameCheck instanceof RegExp&&We(Y.tagNameCheck,S)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(S))&&(Y.attributeNameCheck instanceof RegExp&&We(Y.attributeNameCheck,I)||Y.attributeNameCheck instanceof Function&&Y.attributeNameCheck(I,S))||I==="is"&&Y.allowCustomizedBuiltInElements&&(Y.tagNameCheck instanceof RegExp&&We(Y.tagNameCheck,L)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(L))))return!1}else if(!jm[I]){if(!We(J,Pr(L,P,""))){if(!((I==="src"||I==="xlink:href"||I==="href")&&S!=="script"&&XT(L,"data:")===0&&Nk[S])){if(!($k&&!We(j,Pr(L,P,"")))){if(L)return!1}}}}}}}return!0},Uk=function(S){return S!=="annotation-xml"&&Ud(S,F)},Bk=function(S){tn(q.beforeSanitizeAttributes,S,null);const{attributes:I}=S;if(!I||zm(S))return;const L={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:D,forceKeepAttr:void 0};let me=I.length;for(;me--;){const Re=I[me],{name:ye,namespaceURI:tt,value:nn}=Re,li=Se(ye),Nm=nn;let Ne=ye==="value"?Nm:e1(Nm);if(L.attrName=li,L.attrValue=Ne,L.keepAttr=!0,L.forceKeepAttr=void 0,tn(q.uponSanitizeAttribute,S,L),Ne=L.attrValue,zk&&(li==="id"||li==="name")&&(ia(ye,S),Ne=Dz+Ne),tl&&We(/((--!?|])>)|<\/(style|title|textarea)/i,Ne)){ia(ye,S);continue}if(li==="attributename"&&Ud(Ne,"href")){ia(ye,S);continue}if(L.forceKeepAttr)continue;if(!L.keepAttr){ia(ye,S);continue}if(!Tk&&We(/\/>/i,Ne)){ia(ye,S);continue}ai&&Gs([ue,ae,Oe],Hk=>{Ne=Pr(Ne,Hk," ")});const Vk=Se(S.nodeName);if(!Yk(Vk,li,Ne)){ia(ye,S);continue}if(x&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!tt)switch(h.getAttributeType(Vk,li)){case"TrustedHTML":{Ne=x.createHTML(Ne);break}case"TrustedScriptURL":{Ne=x.createScriptURL(Ne);break}}if(Ne!==Nm)try{tt?S.setAttributeNS(tt,ye,Ne):S.setAttribute(ye,Ne),zm(S)?_t(S):Gy(t.removed)}catch{ia(ye,S)}}tn(q.afterSanitizeAttributes,S,null)},Uz=function U(S){let I=null;const L=_k(S);for(tn(q.beforeSanitizeShadowDOM,S,null);I=L.nextNode();)tn(q.uponSanitizeShadowNode,I,null),Lk(I),Bk(I),I.content instanceof r&&U(I.content);tn(q.afterSanitizeShadowDOM,S,null)};return t.sanitize=function(U){let S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},I=null,L=null,me=null,Re=null;if($m=!U,$m&&(U="<!-->"),typeof U!="string"&&!Rk(U))if(typeof U.toString=="function"){if(U=U.toString(),typeof U!="string")throw zr("dirty is not a string, aborting")}else throw zr("toString is not a function");if(!t.isSupported)return U;if(Sm||Pm(S),t.removed=[],typeof U=="string"&&(_r=!1),_r){if(U.nodeName){const nn=Se(U.nodeName);if(!T[nn]||fe[nn])throw zr("root node is forbidden and cannot be sanitized in-place")}}else if(U instanceof s)I=Ok("<!---->"),L=I.ownerDocument.importNode(U,!0),L.nodeType===Ar.element&&L.nodeName==="BODY"||L.nodeName==="HTML"?I=L:I.appendChild(L);else{if(!ii&&!ai&&!aa&&U.indexOf("<")===-1)return x&&al?x.createHTML(U):U;if(I=Ok(U),!I)return ii?null:al?z:""}I&&xm&&_t(I.firstChild);const ye=_k(_r?U:I);for(;me=ye.nextNode();)Lk(me),Bk(me),me.content instanceof r&&Uz(me.content);if(_r)return U;if(ii){if(nl)for(Re=N.call(I.ownerDocument);I.firstChild;)Re.appendChild(I.firstChild);else Re=I;return(D.shadowroot||D.shadowrootmode)&&(Re=H.call(a,Re,!0)),Re}let tt=aa?I.outerHTML:I.innerHTML;return aa&&T["!doctype"]&&I.ownerDocument&&I.ownerDocument.doctype&&I.ownerDocument.doctype.name&&We(Xy,I.ownerDocument.doctype.name)&&(tt="<!DOCTYPE "+I.ownerDocument.doctype.name+`>
1388
+ `+tt),ai&&Gs([ue,ae,Oe],nn=>{tt=Pr(tt,nn," ")}),x&&al?x.createHTML(tt):tt},t.setConfig=function(){let U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Pm(U),Sm=!0},t.clearConfig=function(){si=null,Sm=!1},t.isValidAttribute=function(U,S,I){si||Pm({});const L=Se(U),me=Se(S);return Yk(L,me,I)},t.addHook=function(U,S){typeof S=="function"&&Tr(q[U],S)},t.removeHook=function(U,S){if(S!==void 0){const I=ZT(q[U],S);return I===-1?void 0:QT(q[U],I,1)[0]}return Gy(q[U])},t.removeHooks=function(U){q[U]=[]},t.removeAllHooks=function(){q=tk()},t}var g1=nk();function ak(e){return e?g1.sanitize(e,{ALLOWED_TAGS:["a","b","i","em","strong","p","br","ul","ol","li","span"],ALLOWED_ATTR:["href","target","rel","class"]}):""}function f1(e){return!e||typeof e!="string"||!/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{4}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/.test(e)?"":e}const b1=`
1389
1389
  .gh-portal-back-sitetitle {
1390
1390
  position: absolute;
1391
1391
  top: 35px;
@@ -1725,7 +1725,7 @@ html[dir=rtl] .gh-portal-signup-terms .checkbox:before {
1725
1725
  transform: translateX(-50%);
1726
1726
  }
1727
1727
  }
1728
- `,mm=class mm extends Z.Component{constructor(t){super(t),this.handleSelectPlan=(n,a)=>{n&&n.preventDefault(),this.timeoutId=setTimeout(()=>{this.setState(()=>({plan:a}))},5)},this.state={name:"",email:"",plan:"free",showNewsletterSelection:!1,termsCheckboxChecked:!1},this.termsRef=Z.createRef()}componentDidMount(){const{member:t}=this.context;t&&this.context.doAction("switchPage",{page:"accountHome"}),this.handleSelectedPlan()}componentDidUpdate(){this.handleSelectedPlan()}handleSelectedPlan(){const{site:t,pageQuery:n}=this.context,a=Ys({site:t,pageQuery:n}),i=this.getSelectedPriceId(a,this.state.plan);i!==this.state.plan&&this.setState({plan:i})}componentWillUnmount(){clearTimeout(this.timeoutId)}getFormErrors(t){const a=this.context.site.portal_signup_checkbox_required&&this.context.site.portal_signup_terms_html&&!t.termsCheckboxChecked;return{...Ws({fields:this.getInputFields({state:t})}),checkbox:a}}doSignup(){this.setState(t=>({errors:this.getFormErrors(t)}),()=>{const{site:t,doAction:n}=this.context,{name:a,email:i,plan:r,phonenumber:o,token:s,errors:l}=this.state,c=l&&Object.values(l).filter(d=>!!d).length>0,m={...l};delete m.checkbox,(l==null?void 0:l.checkbox)&&Object.values(m).every(d=>!d)&&this.termsRef.current&&this.termsRef.current.scrollIntoView({behavior:"smooth",block:"center"}),c||(xr({site:t})?this.setState({showNewsletterSelection:!0,pageData:{name:a,email:i,plan:r,phonenumber:o,token:s},errors:{}}):(this.setState({errors:{}}),n("signup",{name:a,email:i,phonenumber:o,plan:r,token:s})))})}handleSignup(t){t.preventDefault(),this.doSignup()}handleChooseSignup(t,n){t.preventDefault(),this.setState({plan:n},()=>{this.doSignup()})}handleInputChange(t,n){const a=n.name,i=t.target.value;this.setState({[a]:i})}onKeyDown(t){t.keyCode===13&&this.handleSignup(t)}getSelectedPriceId(t=[],n){return!t||t.length===0||n==="free"?"free":t.some(i=>i.id===n)?n:t[0].id||"free"}getInputFields({state:t,fieldNames:n}){const{site:{portal_name:a}}=this.context,i=t.errors||{},r=[{type:"email",value:t.email,placeholder:f("jamie@example.com"),label:f("Email"),name:"email",required:!0,tabIndex:2,errorMessage:i.email||""},{type:"text",value:t.phonenumber,placeholder:f("+1 (123) 456-7890"),label:f("Phone number"),name:"phonenumber",required:!1,tabIndex:-1,autoComplete:"off",hidden:!0}];return a&&r.unshift({type:"text",value:t.name,placeholder:f("Jamie Larson"),label:f("Name"),name:"name",required:!0,tabIndex:1,errorMessage:i.name||""}),r[0].autoFocus=!0,n&&n.length>0?r.filter(o=>n.includes(o.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=l=>{this.setState({termsCheckboxChecked:l.target.checked})},a=u.jsx("div",{className:"gh-portal-signup-terms-content",dangerouslySetInnerHTML:{__html:ak(t.portal_signup_terms_html)}}),i=t.portal_signup_checkbox_required?u.jsxs("label",{children:[u.jsx("input",{type:"checkbox",checked:!!this.state.termsCheckboxChecked,required:!0,onChange:n}),u.jsx("span",{className:"checkbox"}),a]}):a,o=`gh-portal-signup-terms ${(s=this.state.errors)!=null&&s.checkbox?"gh-portal-error":""}`;return u.jsx("div",{className:o,onClick:Vy,ref:this.termsRef,children:i})}renderSubmitButton(){const{action:t,site:n,brandColor:a,pageQuery:i}=this.context;if(Dt({site:n})||!Xt({site:n,pageQuery:i}))return null;let r=f("Continue");const o=i==="free"&&hd({site:n});if(qa({site:n})||o)r=f("Sign up");else return null;let s=!1;t==="signup:running"&&(r=f("Sending..."),s=!0);let l=!1;t==="signup:failed"&&(r=f("Retry"),l=!0);const c=t==="signup:running";return u.jsx(ge,{style:{width:"100%"},retry:l,onClick:m=>this.handleSignup(m),disabled:c,brandColor:a,label:r,isRunning:s,tabIndex:3})}renderProducts(){const{site:t,pageQuery:n}=this.context,a=Os({site:t,pageQuery:n}),i=this.state.errors||{},r={};return Object.keys(i).length>0&&this.state.plan&&(r[this.state.plan]=f("Please fill in required fields")),u.jsx(u.Fragment,{children:u.jsx(Yy,{handleChooseSignup:(...o)=>this.handleChooseSignup(...o),products:a,onPlanSelect:this.handleSelectPlan,errors:r})})}renderFreeTrialMessage(){const{site:t,pageQuery:n}=this.context;return _s({site:t,pageQuery:n})&&!Dt({site:t})&&Xt({site:t,pageQuery:n})?u.jsx("p",{className:"gh-portal-free-trial-notification","data-testid":"free-trial-notification-text",children:f("After a free trial ends, you will be charged the regular price for the tier you've chosen. You can always cancel before then.")}):null}renderLoginMessage(){const{brandColor:t,doAction:n}=this.context;return u.jsxs("div",{children:[this.renderFreeTrialMessage(),u.jsxs("div",{className:"gh-portal-signup-message",children:[u.jsx("div",{children:f("Already a member?")}),u.jsx("button",{"data-test-button":"signin-switch","data-testid":"signin-switch",className:"gh-portal-btn gh-portal-btn-link",style:{color:t},onClick:()=>n("switchPage",{page:"signin"}),children:u.jsx("span",{children:f("Sign in")})})]})]})}renderForm(){const t=this.getInputFields({state:this.state}),{site:n,pageQuery:a}=this.context;if(this.state.showNewsletterSelection)return u.jsx(Od,{pageData:this.state.pageData,onBack:()=>{this.setState({showNewsletterSelection:!1})}});if(Dt({site:n}))return this.renderInviteOnlyMessage();if(y0({site:n})&&a==="free")return this.renderPaidMembersOnlyMessage();if(!As({site:n})||!Xt({site:n,pageQuery:a}))return Pn({site:n})?this.renderInviteOnlyMessage():this.renderMembersDisabledMessage();const i=a==="free"&&hd({site:n}),r=qa({site:n})||i,o=this.renderSignupTerms();return u.jsx("section",{className:"gh-portal-signup",children:u.jsxs("div",{className:"gh-portal-section",children:[u.jsx("div",{className:"gh-portal-logged-out-form-container",children:u.jsx(Hs,{fields:t,onChange:(s,l)=>this.handleInputChange(s,l),onKeyDown:s=>this.onKeyDown(s)})}),u.jsxs("div",{children:[r?u.jsxs(u.Fragment,{children:[this.renderProducts(),o&&u.jsx("div",{className:"gh-portal-signup-terms-wrapper free-only",children:o})]}):u.jsxs(u.Fragment,{children:[o&&u.jsx("div",{className:"gh-portal-signup-terms-wrapper",children:o}),this.renderProducts()]}),r?u.jsx("div",{className:"gh-portal-btn-container",children:u.jsxs("div",{className:"gh-portal-logged-out-form-container",children:[this.renderSubmitButton(),this.renderLoginMessage()]})}):this.renderLoginMessage()]})]})})}renderPaidMembersOnlyMessage(){return u.jsx("section",{children:u.jsxs("div",{className:"gh-portal-section",children:[u.jsx("p",{className:"gh-portal-paid-members-only-notification","data-testid":"paid-members-only-notification-text",children:f("This site only accepts paid members.")}),this.renderLoginMessage()]})})}renderInviteOnlyMessage(){return u.jsx("section",{children:u.jsxs("div",{className:"gh-portal-section",children:[u.jsx("p",{className:"gh-portal-invite-only-notification","data-testid":"invite-only-notification-text",children:f("This site is invite-only, contact the owner for access.")}),this.renderLoginMessage()]})})}renderMembersDisabledMessage(){return u.jsx("section",{children:u.jsx("div",{className:"gh-portal-section",children:u.jsx("p",{className:"gh-portal-members-disabled-notification","data-testid":"members-disabled-notification-text",children:f("Memberships unavailable, contact the owner for access.")})})})}renderSiteIcon(){const{site:t,pageQuery:n}=this.context,a=t.icon;return a?u.jsx("img",{className:"gh-portal-signup-logo",src:a,alt:t.title}):!Xt({site:t,pageQuery:n})||Dt({site:t})||!As({site:t})?u.jsx(By,{className:"gh-portal-icon gh-portal-icon-invitation"}):null}renderFormHeader(){const{site:t}=this.context,n=t.title||"";return u.jsxs("header",{className:"gh-portal-signup-header",children:[this.renderSiteIcon(),u.jsx("h1",{className:"gh-portal-main-title","data-testid":"site-title-text",children:n})]})}getClassNames(){const{site:t,pageQuery:n}=this.context,a=Ys({site:t,pageQuery:n}),i=this.getInputFields({state:this.state});let r="",o="";return(a.length<=1||Dt({site:t}))&&(a.length===1&&a[0].type==="free"||Dt({site:t})?(r=x0({site:t})?"singleplan":"noplan",i.length===1&&(r="single-field"),Dt({site:t})&&(o="invite-only",r="invite-only")):r="singleplan"),{sectionClass:r,footerClass:o}}render(){let{sectionClass:t}=this.getClassNames();return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"gh-portal-back-sitetitle",children:u.jsx(Fd,{onBack:()=>{this.state.showNewsletterSelection?this.setState({showNewsletterSelection:!1}):this.context.doAction("closePopup")}})}),u.jsx(we,{}),u.jsxs("div",{className:"gh-portal-content signup "+t,children:[this.renderFormHeader(),this.renderForm()]})]})}};mm.contextType=_;let Gd=mm;const ik=e=>w.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},w.createElement("defs",null,w.createElement("style",null,".a{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1px;}")),w.createElement("rect",{className:"a",x:.75,y:4.5,width:22.5,height:15,rx:1.5,ry:1.5}),w.createElement("line",{className:"a",x1:15.687,y1:9.975,x2:19.5,y2:13.5}),w.createElement("line",{className:"a",x1:8.313,y1:9.975,x2:4.5,y2:13.5}),w.createElement("path",{className:"a",d:"M22.88,5.014l-9.513,6.56a2.406,2.406,0,0,1-2.734,0L1.12,5.014"})),b1=e=>{var t;return typeof((t=e.userAgentData)==null?void 0:t.platform)=="string"?e.userAgentData.platform==="Android":/android/i.test(e.userAgent)},y1=e=>/chrome/i.test(e.userAgent),k1=e=>b1(e)&&y1(e),rk=(e,t)=>Object.hasOwn(e,t)?e[t]:void 0,v1=u.jsx("svg",{height:"24",width:"24",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 49.4 512 399.4200000000001",children:u.jsxs("g",{fill:"none",fillRule:"evenodd",children:[u.jsxs("g",{fillRule:"nonzero",children:[u.jsx("path",{d:"M34.91 448.818h81.454V251L0 163.727V413.91c0 19.287 15.622 34.91 34.91 34.91z",fill:"#4285f4"}),u.jsx("path",{d:"M395.636 448.818h81.455c19.287 0 34.909-15.622 34.909-34.909V163.727L395.636 251z",fill:"#34a853"}),u.jsx("path",{d:"M395.636 99.727V251L512 163.727v-46.545c0-43.142-49.25-67.782-83.782-41.891z",fill:"#fbbc04"})]}),u.jsx("path",{d:"M116.364 251V99.727L256 204.455 395.636 99.727V251L256 355.727z",fill:"#ea4335"}),u.jsx("path",{d:"M0 117.182v46.545L116.364 251V99.727L83.782 75.291C49.25 49.4 0 74.04 0 117.18z",fill:"#c5221f",fillRule:"nonzero"})]})}),w1=u.jsx("svg",{clipRule:"evenodd",fillRule:"evenodd",height:"2500",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 6876 6994",width:"2457",xmlns:"http://www.w3.org/2000/svg",children:u.jsx("path",{d:"M0 779L4033 0l-14 6994L0 6160zm1430 3632c-305-357-390-918-244-1384 203-648 718-867 1149-717 246 86 465 293 582 610 56 152 86 326 88 503 4 318-106 692-324 953-335 400-903 441-1250 35zm314-339c-150-223-191-573-120-864 99-404 352-541 563-447 121 54 228 183 285 381 27 95 42 203 43 314 2 198-52 432-159 595-164 250-442 275-612 22zm2552-2598h2341c131 0 238 107 238 238v86L5035 3039c-24 16-83 62-132 93-72 47-77 38-153-5-117-65-319-203-455-297V1474zm2580 875v2504c0 200-164 365-365 365H4296V3366c133 88 310 204 419 271 88 54 104 79 202 22 45-26 89-60 119-80l1840-1229z",fill:"#0072c6"})}),S1=u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 3386.34 3010.5",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",imageRendering:"optimizeQuality",fillRule:"evenodd",clipRule:"evenodd",children:u.jsx("path",{d:"M0 732.88h645.84l376.07 962.1 380.96-962.1h628.76l-946.8 2277.62H451.98l259.19-603.53L.02 732.88zm2763.84 768.75h-704.26L2684.65 0l701.69.03-622.5 1501.6zm-519.78 143.72c216.09 0 391.25 175.17 391.25 391.22 0 216.06-175.16 391.23-391.25 391.23-216.06 0-391.19-175.17-391.19-391.23 0-216.05 175.16-391.22 391.19-391.22z",fill:"#5f01d1",fillRule:"nonzero"})}),x1=u.jsxs("svg",{viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",strokeLinejoin:"round",strokeMiterlimit:"2",children:[u.jsx("path",{d:"M22.86 13.464l.002.002-10.005 11.105L0 10.419V4.315a.827.827 0 011.356-.637l14.265 11.846a3.722 3.722 0 004.758 0l2.481-2.06z",fill:"url(#prefix___Linear1)",transform:"matrix(13.8889 0 0 13.8889 6 6)"}),u.jsx("path",{d:"M28.286 8.958l-5.426 4.506.002.002-7.184 6.345a3.31 3.31 0 01-4.308.065L0 10.42v18.142a3.724 3.724 0 003.724 3.724h24.562l2.571-11.664-2.571-11.664z",fill:"url(#prefix___Radial2)",fillRule:"nonzero",transform:"matrix(13.8889 0 0 13.8889 6 6)"}),u.jsx("path",{d:"M28.286 8.963v23.323h3.99A3.724 3.724 0 0036 28.562V4.315a.827.827 0 00-1.356-.637l-6.358 5.285z",fill:"url(#prefix___Linear3)",transform:"matrix(13.8889 0 0 13.8889 6 6)"}),u.jsxs("defs",{children:[u.jsxs("linearGradient",{id:"prefix___Linear1",x1:"0",y1:"0",x2:"1",y2:"0",gradientUnits:"userSpaceOnUse",gradientTransform:"scale(-43.6455) rotate(73.941 .222 -.49)",children:[u.jsx("stop",{offset:"0",stopColor:"#e3d9ff"}),u.jsx("stop",{offset:"1",stopColor:"#7341ff"})]}),u.jsxs("linearGradient",{id:"prefix___Linear3",x1:"0",y1:"0",x2:"1",y2:"0",gradientUnits:"userSpaceOnUse",gradientTransform:"scale(-66.0342) rotate(65.129 .243 -.95)",children:[u.jsx("stop",{offset:"0",stopColor:"#e3d9ff"}),u.jsx("stop",{offset:".27",stopColor:"#e3d9ff"}),u.jsx("stop",{offset:"1",stopColor:"#7341ff"})]}),u.jsxs("radialGradient",{id:"prefix___Radial2",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(35.9848 0 0 33.9185 30.723 11.814)",children:[u.jsx("stop",{offset:"0",stopColor:"#6d4aff"}),u.jsx("stop",{offset:".56",stopColor:"#6d4aff"}),u.jsx("stop",{offset:".99",stopColor:"#aa8eff"}),u.jsx("stop",{offset:"1",stopColor:"#aa8eff"})]})]})]}),E1=u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"2500",height:"2432",viewBox:"85.04 232.402 412.912 401.703",children:[u.jsx("path",{d:"M391.631 424.861l-4.477-1.119v-4.477c0-40.281-32.449-72.73-71.611-72.73-29.094 0-55.947 17.904-67.138 44.758l-3.355 7.834-5.595-5.596c-5.597-5.594-13.429-8.951-21.262-8.951a30.086 30.086 0 0 0-30.211 30.211l1.118 6.715-4.476 1.117c-21.26 6.715-35.807 25.736-35.807 46.996 0 26.854 22.38 49.234 49.234 49.234h185.745c25.734 0 48.113-21.262 48.113-48.115-1.114-22.379-16.78-41.401-40.278-45.877z",fill:"#333"}),u.jsx("path",{d:"M394.989 232.402H189.102c-58.185 0-104.062 46.996-104.062 104.062v193.578c0 58.186 46.995 104.062 104.062 104.062H393.87c58.187 0 104.062-46.996 104.062-104.062V337.583c1.118-58.185-45.877-105.181-102.943-105.181zm-11.19 298.76H198.054c-33.568 0-60.424-26.855-60.424-60.424 0-25.734 15.666-46.996 39.164-55.947 1.118-22.379 19.021-40.281 41.4-40.281 7.833 0 15.666 2.238 22.379 6.713 14.547-27.973 42.521-44.758 73.852-44.758 44.758 0 81.684 35.809 82.802 79.447 25.736 6.713 44.759 30.211 44.759 57.066-.001 31.328-25.737 58.184-58.187 58.184z",fill:"#333"}),u.jsx("path",{d:"M398.345 414.791c-2.237-44.758-38.044-79.445-82.802-79.445-31.33 0-60.424 17.904-73.852 44.76-6.714-4.477-14.546-6.715-22.379-6.715-22.379 0-40.282 17.902-41.401 40.281-23.498 8.951-39.163 31.33-39.163 55.947 0 33.568 26.855 60.424 60.424 60.424h185.746c32.448 0 59.304-26.854 59.304-59.305-2.237-25.737-20.14-49.233-45.877-55.947zm-14.546 105.181H198.054c-26.854 0-49.233-22.379-49.233-49.232 0-22.379 14.546-40.283 35.806-46.996l4.476-1.119-1.118-6.713c0-16.785 13.427-30.213 30.211-30.213 7.833 0 15.666 3.357 21.262 8.953l5.595 5.594 3.355-7.832c11.189-26.855 36.925-44.758 67.138-44.758 40.281 0 71.611 32.449 71.611 72.73v4.477l4.477 1.119c23.498 3.355 39.164 23.498 39.164 46.996-.003 25.734-21.264 46.994-46.999 46.994z",fill:"#e4e4e4"})]}),Ir=u.jsx(ik,{className:"gh-portal-inbox-link-icon"}),C1={gmail:v1,outlook:w1,yahoo:S1,proton:x1,icloud:E1,hey:Ir,aol:Ir,mailru:Ir,"dev-mailpit":Ir},j1={gmail:f("Open Gmail"),outlook:f("Open Outlook"),yahoo:f("Open Yahoo Mail"),proton:f("Open Proton Mail"),icloud:f("Open iCloud Mail"),hey:f("Open Hey"),aol:f("Open AOL Mail"),mailru:f("Open Mail.ru"),"dev-mailpit":"Open Mailpit (development only)"};function ok({inboxLinks:{android:e,desktop:t,provider:n}}){return u.jsxs("a",{href:k1(navigator)?e:t,target:"_blank",rel:"noreferrer noopener",className:"gh-portal-btn gh-portal-btn-inbox-link",children:[rk(C1,n)??Ir,u.jsx("span",{children:rk(j1,n)??f("Open email")})]})}const sk=e=>/iPad|iPhone|iPod/.test(e.userAgent)||e.platform==="MacIntel"&&e.maxTouchPoints>1,$1=`
1728
+ `,mm=class mm extends Z.Component{constructor(t){super(t),this.handleSelectPlan=(n,a)=>{n&&n.preventDefault(),this.timeoutId=setTimeout(()=>{this.setState(()=>({plan:a}))},5)},this.state={name:"",email:"",plan:"free",showNewsletterSelection:!1,termsCheckboxChecked:!1},this.termsRef=Z.createRef()}componentDidMount(){const{member:t}=this.context;t&&this.context.doAction("switchPage",{page:"accountHome"}),this.handleSelectedPlan()}componentDidUpdate(){this.handleSelectedPlan()}handleSelectedPlan(){const{site:t,pageQuery:n}=this.context,a=Ys({site:t,pageQuery:n}),i=this.getSelectedPriceId(a,this.state.plan);i!==this.state.plan&&this.setState({plan:i})}componentWillUnmount(){clearTimeout(this.timeoutId)}getFormErrors(t){const a=this.context.site.portal_signup_checkbox_required&&this.context.site.portal_signup_terms_html&&!t.termsCheckboxChecked;return{...Ws({fields:this.getInputFields({state:t})}),checkbox:a}}doSignup(){this.setState(t=>({errors:this.getFormErrors(t)}),()=>{const{site:t,doAction:n}=this.context,{name:a,email:i,plan:r,phonenumber:o,token:s,errors:l}=this.state,c=l&&Object.values(l).filter(d=>!!d).length>0,m={...l};delete m.checkbox,(l==null?void 0:l.checkbox)&&Object.values(m).every(d=>!d)&&this.termsRef.current&&this.termsRef.current.scrollIntoView({behavior:"smooth",block:"center"}),c||(xr({site:t})?this.setState({showNewsletterSelection:!0,pageData:{name:a,email:i,plan:r,phonenumber:o,token:s},errors:{}}):(this.setState({errors:{}}),n("signup",{name:a,email:i,phonenumber:o,plan:r,token:s})))})}handleSignup(t){t.preventDefault(),this.doSignup()}handleChooseSignup(t,n){t.preventDefault(),this.setState({plan:n},()=>{this.doSignup()})}handleInputChange(t,n){const a=n.name,i=t.target.value;this.setState({[a]:i})}onKeyDown(t){t.keyCode===13&&this.handleSignup(t)}getSelectedPriceId(t=[],n){return!t||t.length===0||n==="free"?"free":t.some(i=>i.id===n)?n:t[0].id||"free"}getInputFields({state:t,fieldNames:n}){const{site:{portal_name:a}}=this.context,i=t.errors||{},r=[{type:"email",value:t.email,placeholder:f("jamie@example.com"),label:f("Email"),name:"email",required:!0,tabIndex:2,errorMessage:i.email||""},{type:"text",value:t.phonenumber,placeholder:f("+1 (123) 456-7890"),label:f("Phone number"),name:"phonenumber",required:!1,tabIndex:-1,autoComplete:"off",hidden:!0}];return a&&r.unshift({type:"text",value:t.name,placeholder:f("Jamie Larson"),label:f("Name"),name:"name",required:!0,tabIndex:1,errorMessage:i.name||""}),r[0].autoFocus=!0,n&&n.length>0?r.filter(o=>n.includes(o.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=l=>{this.setState({termsCheckboxChecked:l.target.checked})},a=u.jsx("div",{className:"gh-portal-signup-terms-content",dangerouslySetInnerHTML:{__html:ak(t.portal_signup_terms_html)}}),i=t.portal_signup_checkbox_required?u.jsxs("label",{children:[u.jsx("input",{type:"checkbox",checked:!!this.state.termsCheckboxChecked,required:!0,onChange:n}),u.jsx("span",{className:"checkbox"}),a]}):a,o=`gh-portal-signup-terms ${(s=this.state.errors)!=null&&s.checkbox?"gh-portal-error":""}`;return u.jsx("div",{className:o,onClick:Vy,ref:this.termsRef,children:i})}renderSubmitButton(){const{action:t,site:n,brandColor:a,pageQuery:i}=this.context;if(Dt({site:n})||!Xt({site:n,pageQuery:i}))return null;let r=f("Continue");const o=i==="free"&&hd({site:n});if(qa({site:n})||o)r=f("Sign up");else return null;let s=!1;t==="signup:running"&&(r=f("Sending..."),s=!0);let l=!1;t==="signup:failed"&&(r=f("Retry"),l=!0);const c=t==="signup:running";return u.jsx(ge,{style:{width:"100%"},retry:l,onClick:m=>this.handleSignup(m),disabled:c,brandColor:a,label:r,isRunning:s,tabIndex:3})}renderProducts(){const{site:t,pageQuery:n}=this.context,a=Os({site:t,pageQuery:n}),i=this.state.errors||{},r={};return Object.keys(i).length>0&&this.state.plan&&(r[this.state.plan]=f("Please fill in required fields")),u.jsx(u.Fragment,{children:u.jsx(Yy,{handleChooseSignup:(...o)=>this.handleChooseSignup(...o),products:a,onPlanSelect:this.handleSelectPlan,errors:r})})}renderFreeTrialMessage(){const{site:t,pageQuery:n}=this.context;return _s({site:t,pageQuery:n})&&!Dt({site:t})&&Xt({site:t,pageQuery:n})?u.jsx("p",{className:"gh-portal-free-trial-notification","data-testid":"free-trial-notification-text",children:f("After a free trial ends, you will be charged the regular price for the tier you've chosen. You can always cancel before then.")}):null}renderLoginMessage(){const{brandColor:t,doAction:n}=this.context;return u.jsxs("div",{children:[this.renderFreeTrialMessage(),u.jsxs("div",{className:"gh-portal-signup-message",children:[u.jsx("div",{children:f("Already a member?")}),u.jsx("button",{"data-test-button":"signin-switch","data-testid":"signin-switch",className:"gh-portal-btn gh-portal-btn-link",style:{color:t},onClick:()=>n("switchPage",{page:"signin"}),children:u.jsx("span",{children:f("Sign in")})})]})]})}renderForm(){const t=this.getInputFields({state:this.state}),{site:n,pageQuery:a}=this.context;if(this.state.showNewsletterSelection)return u.jsx(Od,{pageData:this.state.pageData,onBack:()=>{this.setState({showNewsletterSelection:!1})}});if(Dt({site:n}))return this.renderInviteOnlyMessage();if(y0({site:n})&&a==="free")return this.renderPaidMembersOnlyMessage();if(!As({site:n})||!Xt({site:n,pageQuery:a}))return Pn({site:n})?this.renderInviteOnlyMessage():this.renderMembersDisabledMessage();const i=a==="free"&&hd({site:n}),r=qa({site:n})||i,o=this.renderSignupTerms();return u.jsx("section",{className:"gh-portal-signup",children:u.jsxs("div",{className:"gh-portal-section",children:[u.jsx("div",{className:"gh-portal-logged-out-form-container",children:u.jsx(Hs,{fields:t,onChange:(s,l)=>this.handleInputChange(s,l),onKeyDown:s=>this.onKeyDown(s)})}),u.jsxs("div",{children:[r?u.jsxs(u.Fragment,{children:[this.renderProducts(),o&&u.jsx("div",{className:"gh-portal-signup-terms-wrapper free-only",children:o})]}):u.jsxs(u.Fragment,{children:[o&&u.jsx("div",{className:"gh-portal-signup-terms-wrapper",children:o}),this.renderProducts()]}),r?u.jsx("div",{className:"gh-portal-btn-container",children:u.jsxs("div",{className:"gh-portal-logged-out-form-container",children:[this.renderSubmitButton(),this.renderLoginMessage()]})}):this.renderLoginMessage()]})]})})}renderPaidMembersOnlyMessage(){return u.jsx("section",{children:u.jsxs("div",{className:"gh-portal-section",children:[u.jsx("p",{className:"gh-portal-paid-members-only-notification","data-testid":"paid-members-only-notification-text",children:f("This site only accepts paid members.")}),this.renderLoginMessage()]})})}renderInviteOnlyMessage(){return u.jsx("section",{children:u.jsxs("div",{className:"gh-portal-section",children:[u.jsx("p",{className:"gh-portal-invite-only-notification","data-testid":"invite-only-notification-text",children:f("This site is invite-only, contact the owner for access.")}),this.renderLoginMessage()]})})}renderMembersDisabledMessage(){return u.jsx("section",{children:u.jsx("div",{className:"gh-portal-section",children:u.jsx("p",{className:"gh-portal-members-disabled-notification","data-testid":"members-disabled-notification-text",children:f("Memberships unavailable, contact the owner for access.")})})})}renderSiteIcon(){const{site:t,pageQuery:n}=this.context,a=t.icon;return a?u.jsx("img",{className:"gh-portal-signup-logo",src:a,alt:t.title}):!Xt({site:t,pageQuery:n})||Dt({site:t})||!As({site:t})?u.jsx(By,{className:"gh-portal-icon gh-portal-icon-invitation"}):null}renderFormHeader(){const{site:t}=this.context,n=t.title||"";return u.jsxs("header",{className:"gh-portal-signup-header",children:[this.renderSiteIcon(),u.jsx("h1",{className:"gh-portal-main-title","data-testid":"site-title-text",children:n})]})}getClassNames(){const{site:t,pageQuery:n}=this.context,a=Ys({site:t,pageQuery:n}),i=this.getInputFields({state:this.state});let r="",o="";return(a.length<=1||Dt({site:t}))&&(a.length===1&&a[0].type==="free"||Dt({site:t})?(r=x0({site:t})?"singleplan":"noplan",i.length===1&&(r="single-field"),Dt({site:t})&&(o="invite-only",r="invite-only")):r="singleplan"),{sectionClass:r,footerClass:o}}render(){let{sectionClass:t}=this.getClassNames();return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"gh-portal-back-sitetitle",children:u.jsx(Fd,{onBack:()=>{this.state.showNewsletterSelection?this.setState({showNewsletterSelection:!1}):this.context.doAction("closePopup")}})}),u.jsx(we,{}),u.jsxs("div",{className:"gh-portal-content signup "+t,children:[this.renderFormHeader(),this.renderForm()]})]})}};mm.contextType=_;let Gd=mm;const ik=e=>w.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},w.createElement("defs",null,w.createElement("style",null,".a{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1px;}")),w.createElement("rect",{className:"a",x:.75,y:4.5,width:22.5,height:15,rx:1.5,ry:1.5}),w.createElement("line",{className:"a",x1:15.687,y1:9.975,x2:19.5,y2:13.5}),w.createElement("line",{className:"a",x1:8.313,y1:9.975,x2:4.5,y2:13.5}),w.createElement("path",{className:"a",d:"M22.88,5.014l-9.513,6.56a2.406,2.406,0,0,1-2.734,0L1.12,5.014"})),y1=e=>{var t;return typeof((t=e.userAgentData)==null?void 0:t.platform)=="string"?e.userAgentData.platform==="Android":/android/i.test(e.userAgent)},k1=e=>/chrome/i.test(e.userAgent),v1=e=>y1(e)&&k1(e),rk=(e,t)=>Object.hasOwn(e,t)?e[t]:void 0,w1=u.jsx("svg",{height:"24",width:"24",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 49.4 512 399.4200000000001",children:u.jsxs("g",{fill:"none",fillRule:"evenodd",children:[u.jsxs("g",{fillRule:"nonzero",children:[u.jsx("path",{d:"M34.91 448.818h81.454V251L0 163.727V413.91c0 19.287 15.622 34.91 34.91 34.91z",fill:"#4285f4"}),u.jsx("path",{d:"M395.636 448.818h81.455c19.287 0 34.909-15.622 34.909-34.909V163.727L395.636 251z",fill:"#34a853"}),u.jsx("path",{d:"M395.636 99.727V251L512 163.727v-46.545c0-43.142-49.25-67.782-83.782-41.891z",fill:"#fbbc04"})]}),u.jsx("path",{d:"M116.364 251V99.727L256 204.455 395.636 99.727V251L256 355.727z",fill:"#ea4335"}),u.jsx("path",{d:"M0 117.182v46.545L116.364 251V99.727L83.782 75.291C49.25 49.4 0 74.04 0 117.18z",fill:"#c5221f",fillRule:"nonzero"})]})}),S1=u.jsx("svg",{clipRule:"evenodd",fillRule:"evenodd",height:"2500",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 6876 6994",width:"2457",xmlns:"http://www.w3.org/2000/svg",children:u.jsx("path",{d:"M0 779L4033 0l-14 6994L0 6160zm1430 3632c-305-357-390-918-244-1384 203-648 718-867 1149-717 246 86 465 293 582 610 56 152 86 326 88 503 4 318-106 692-324 953-335 400-903 441-1250 35zm314-339c-150-223-191-573-120-864 99-404 352-541 563-447 121 54 228 183 285 381 27 95 42 203 43 314 2 198-52 432-159 595-164 250-442 275-612 22zm2552-2598h2341c131 0 238 107 238 238v86L5035 3039c-24 16-83 62-132 93-72 47-77 38-153-5-117-65-319-203-455-297V1474zm2580 875v2504c0 200-164 365-365 365H4296V3366c133 88 310 204 419 271 88 54 104 79 202 22 45-26 89-60 119-80l1840-1229z",fill:"#0072c6"})}),x1=u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 3386.34 3010.5",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",imageRendering:"optimizeQuality",fillRule:"evenodd",clipRule:"evenodd",children:u.jsx("path",{d:"M0 732.88h645.84l376.07 962.1 380.96-962.1h628.76l-946.8 2277.62H451.98l259.19-603.53L.02 732.88zm2763.84 768.75h-704.26L2684.65 0l701.69.03-622.5 1501.6zm-519.78 143.72c216.09 0 391.25 175.17 391.25 391.22 0 216.06-175.16 391.23-391.25 391.23-216.06 0-391.19-175.17-391.19-391.23 0-216.05 175.16-391.22 391.19-391.22z",fill:"#5f01d1",fillRule:"nonzero"})}),E1=u.jsxs("svg",{viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",strokeLinejoin:"round",strokeMiterlimit:"2",children:[u.jsx("path",{d:"M22.86 13.464l.002.002-10.005 11.105L0 10.419V4.315a.827.827 0 011.356-.637l14.265 11.846a3.722 3.722 0 004.758 0l2.481-2.06z",fill:"url(#prefix___Linear1)",transform:"matrix(13.8889 0 0 13.8889 6 6)"}),u.jsx("path",{d:"M28.286 8.958l-5.426 4.506.002.002-7.184 6.345a3.31 3.31 0 01-4.308.065L0 10.42v18.142a3.724 3.724 0 003.724 3.724h24.562l2.571-11.664-2.571-11.664z",fill:"url(#prefix___Radial2)",fillRule:"nonzero",transform:"matrix(13.8889 0 0 13.8889 6 6)"}),u.jsx("path",{d:"M28.286 8.963v23.323h3.99A3.724 3.724 0 0036 28.562V4.315a.827.827 0 00-1.356-.637l-6.358 5.285z",fill:"url(#prefix___Linear3)",transform:"matrix(13.8889 0 0 13.8889 6 6)"}),u.jsxs("defs",{children:[u.jsxs("linearGradient",{id:"prefix___Linear1",x1:"0",y1:"0",x2:"1",y2:"0",gradientUnits:"userSpaceOnUse",gradientTransform:"scale(-43.6455) rotate(73.941 .222 -.49)",children:[u.jsx("stop",{offset:"0",stopColor:"#e3d9ff"}),u.jsx("stop",{offset:"1",stopColor:"#7341ff"})]}),u.jsxs("linearGradient",{id:"prefix___Linear3",x1:"0",y1:"0",x2:"1",y2:"0",gradientUnits:"userSpaceOnUse",gradientTransform:"scale(-66.0342) rotate(65.129 .243 -.95)",children:[u.jsx("stop",{offset:"0",stopColor:"#e3d9ff"}),u.jsx("stop",{offset:".27",stopColor:"#e3d9ff"}),u.jsx("stop",{offset:"1",stopColor:"#7341ff"})]}),u.jsxs("radialGradient",{id:"prefix___Radial2",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(35.9848 0 0 33.9185 30.723 11.814)",children:[u.jsx("stop",{offset:"0",stopColor:"#6d4aff"}),u.jsx("stop",{offset:".56",stopColor:"#6d4aff"}),u.jsx("stop",{offset:".99",stopColor:"#aa8eff"}),u.jsx("stop",{offset:"1",stopColor:"#aa8eff"})]})]})]}),C1=u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"2500",height:"2432",viewBox:"85.04 232.402 412.912 401.703",children:[u.jsx("path",{d:"M391.631 424.861l-4.477-1.119v-4.477c0-40.281-32.449-72.73-71.611-72.73-29.094 0-55.947 17.904-67.138 44.758l-3.355 7.834-5.595-5.596c-5.597-5.594-13.429-8.951-21.262-8.951a30.086 30.086 0 0 0-30.211 30.211l1.118 6.715-4.476 1.117c-21.26 6.715-35.807 25.736-35.807 46.996 0 26.854 22.38 49.234 49.234 49.234h185.745c25.734 0 48.113-21.262 48.113-48.115-1.114-22.379-16.78-41.401-40.278-45.877z",fill:"#333"}),u.jsx("path",{d:"M394.989 232.402H189.102c-58.185 0-104.062 46.996-104.062 104.062v193.578c0 58.186 46.995 104.062 104.062 104.062H393.87c58.187 0 104.062-46.996 104.062-104.062V337.583c1.118-58.185-45.877-105.181-102.943-105.181zm-11.19 298.76H198.054c-33.568 0-60.424-26.855-60.424-60.424 0-25.734 15.666-46.996 39.164-55.947 1.118-22.379 19.021-40.281 41.4-40.281 7.833 0 15.666 2.238 22.379 6.713 14.547-27.973 42.521-44.758 73.852-44.758 44.758 0 81.684 35.809 82.802 79.447 25.736 6.713 44.759 30.211 44.759 57.066-.001 31.328-25.737 58.184-58.187 58.184z",fill:"#333"}),u.jsx("path",{d:"M398.345 414.791c-2.237-44.758-38.044-79.445-82.802-79.445-31.33 0-60.424 17.904-73.852 44.76-6.714-4.477-14.546-6.715-22.379-6.715-22.379 0-40.282 17.902-41.401 40.281-23.498 8.951-39.163 31.33-39.163 55.947 0 33.568 26.855 60.424 60.424 60.424h185.746c32.448 0 59.304-26.854 59.304-59.305-2.237-25.737-20.14-49.233-45.877-55.947zm-14.546 105.181H198.054c-26.854 0-49.233-22.379-49.233-49.232 0-22.379 14.546-40.283 35.806-46.996l4.476-1.119-1.118-6.713c0-16.785 13.427-30.213 30.211-30.213 7.833 0 15.666 3.357 21.262 8.953l5.595 5.594 3.355-7.832c11.189-26.855 36.925-44.758 67.138-44.758 40.281 0 71.611 32.449 71.611 72.73v4.477l4.477 1.119c23.498 3.355 39.164 23.498 39.164 46.996-.003 25.734-21.264 46.994-46.999 46.994z",fill:"#e4e4e4"})]}),Ir=u.jsx(ik,{className:"gh-portal-inbox-link-icon"}),j1={gmail:w1,outlook:S1,yahoo:x1,proton:E1,icloud:C1,hey:Ir,aol:Ir,mailru:Ir,"dev-mailpit":Ir},$1={gmail:f("Open Gmail"),outlook:f("Open Outlook"),yahoo:f("Open Yahoo Mail"),proton:f("Open Proton Mail"),icloud:f("Open iCloud Mail"),hey:f("Open Hey"),aol:f("Open AOL Mail"),mailru:f("Open Mail.ru"),"dev-mailpit":"Open Mailpit (development only)"};function ok({inboxLinks:{android:e,desktop:t,provider:n}}){return u.jsxs("a",{href:v1(navigator)?e:t,target:"_blank",rel:"noreferrer noopener",className:"gh-portal-btn gh-portal-btn-inbox-link",children:[rk(j1,n)??Ir,u.jsx("span",{children:rk($1,n)??f("Open email")})]})}const sk=e=>/iPad|iPhone|iPod/.test(e.userAgent)||e.platform==="MacIntel"&&e.maxTouchPoints>1,T1=`
1729
1729
  .gh-portal-icon-envelope {
1730
1730
  width: 44px;
1731
1731
  margin: 12px 0 10px;
@@ -1791,7 +1791,7 @@ html[dir=rtl] .gh-portal-signup-terms .checkbox:before {
1791
1791
  line-height: 1.6em;
1792
1792
  margin-bottom: 0;
1793
1793
  }
1794
- `,Xa="otc",pm=class pm extends Z.Component{constructor(t){super(t),this.state={[Xa]:"",errors:{},isFocused:!1}}getDescriptionConfig(t){return{signin:{withOTC:f("An email has been sent to {submittedEmailOrInbox}. Click the link inside or enter your code below.",{submittedEmailOrInbox:t}),withoutOTC:f("A login link has been sent to your inbox. If it doesn't arrive in 3 minutes, be sure to check your spam folder.")},signup:f("To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!")}}getTranslatedDescription({lastPage:t,otcRef:n,submittedEmailOrInbox:a}){const i=this.getDescriptionConfig(a);return(t==="signup"||t==="signin"?t:"signin")==="signup"?i.signup:n?i.signin.withOTC:i.signin.withoutOTC}renderFormHeader(){const{otcRef:t,pageData:n,lastPage:a}=this.context,i=n!=null&&n.email?n.email:f("your inbox"),r=f("Now check your email!"),o=this.getTranslatedDescription({lastPage:a,otcRef:t,submittedEmailOrInbox:i});return u.jsxs("section",{className:"gh-portal-inbox-notification",children:[u.jsxs("header",{className:"gh-portal-header",children:[u.jsx(ik,{className:"gh-portal-icon gh-portal-icon-envelope"}),u.jsx("h2",{className:"gh-portal-main-title",children:r})]}),u.jsx("p",{children:o})]})}renderLoginMessage(){return u.jsx(u.Fragment,{children:u.jsx("div",{style:{color:"#1d1d1d",fontWeight:"bold",cursor:"pointer"},onClick:()=>this.context.doAction("switchPage",{page:"signin"}),children:f("Back to Log in")})})}handleClose(){this.context.doAction("closePopup")}renderCloseButton(){const{inboxLinks:t}=this.context;return t&&!sk(navigator)?u.jsx(ok,{inboxLinks:t}):u.jsx(ge,{style:{width:"100%"},onClick:n=>this.handleClose(n),brandColor:this.context.brandColor,label:f("Close")})}handleSubmit(t){t.preventDefault();const{action:n}=this.context;n==="verifyOTC:running"||this.doVerifyOTC()}doVerifyOTC(){const t=f("Enter code above");this.setState(n=>{const a=(n.otc||"").trim();return{errors:{[Xa]:a?"":t}}},()=>{const{otc:n,errors:a}=this.state,{otcRef:i}=this.context,{redirect:r}=this.context.pageData??{};!(a&&Object.values(a).filter(s=>!!s).length>0)&&i&&this.context.doAction("verifyOTC",{otc:n,otcRef:i,redirect:r})})}handleInputChange(t,n){const a=n.name,i=t.target.value;if(a===Xa){const r=i.replace(/[^0-9]/g,"");this.setState({[a]:r},()=>{r.length===6&&this.doVerifyOTC()})}else this.setState({[a]:i})}renderOTCForm(){const{action:t,actionErrorMessage:n,otcRef:a,inboxLinks:i}=this.context,r=this.state.errors||{};if(!a)return null;const o=t==="verifyOTC:running",s=t==="verifyOTC:failed",l=s&&n?n:r.otc;return u.jsxs("form",{onSubmit:c=>this.handleSubmit(c),children:[u.jsxs("section",{className:"gh-portal-section gh-portal-otp",children:[u.jsx("div",{className:`gh-portal-otp-container ${this.state.isFocused&&"focused"} ${l&&"error"}`,children:u.jsx("input",{id:`input-${Xa}`,className:`gh-portal-input ${this.state.otc&&"entry"} ${l&&"error"}`,placeholder:"––––––",name:Xa,type:"text",value:this.state.otc,inputMode:"numeric",maxLength:6,pattern:"[0-9]*",autoComplete:"one-time-code",autoCorrect:"off",autoCapitalize:"off",autoFocus:!0,"aria-label":f("Code"),onChange:c=>this.handleInputChange(c,{name:Xa}),onFocus:()=>this.setState({isFocused:!0}),onBlur:()=>this.setState({isFocused:!1})})}),l&&u.jsx("div",{className:"gh-portal-otp-error",children:l})]}),u.jsx("footer",{className:"gh-portal-signin-footer gh-button-row",children:i&&!sk(navigator)&&!this.state.otc?u.jsx(ok,{inboxLinks:i}):u.jsx(ge,{style:{width:"100%"},onClick:c=>this.handleSubmit(c),brandColor:this.context.brandColor,label:f(o?"Verifying...":"Continue"),isRunning:o,retry:s,disabled:o})})]})}render(){const{otcRef:t}=this.context,n=!!t;return u.jsxs("div",{className:"gh-portal-content",children:[u.jsx(we,{}),this.renderFormHeader(),n?this.renderOTCForm():this.renderCloseButton()]})}};pm.contextType=_;let Kd=pm;const T1=`
1794
+ `,Xa="otc",pm=class pm extends Z.Component{constructor(t){super(t),this.state={[Xa]:"",errors:{},isFocused:!1}}getDescriptionConfig(t){return{signin:{withOTC:f("An email has been sent to {submittedEmailOrInbox}. Click the link inside or enter your code below.",{submittedEmailOrInbox:t}),withoutOTC:f("A login link has been sent to your inbox. If it doesn't arrive in 3 minutes, be sure to check your spam folder.")},signup:f("To complete signup, click the confirmation link in your inbox. If it doesn't arrive within 3 minutes, check your spam folder!")}}getTranslatedDescription({lastPage:t,otcRef:n,submittedEmailOrInbox:a}){const i=this.getDescriptionConfig(a);return(t==="signup"||t==="signin"?t:"signin")==="signup"?i.signup:n?i.signin.withOTC:i.signin.withoutOTC}renderFormHeader(){const{otcRef:t,pageData:n,lastPage:a}=this.context,i=n!=null&&n.email?n.email:f("your inbox"),r=f("Now check your email!"),o=this.getTranslatedDescription({lastPage:a,otcRef:t,submittedEmailOrInbox:i});return u.jsxs("section",{className:"gh-portal-inbox-notification",children:[u.jsxs("header",{className:"gh-portal-header",children:[u.jsx(ik,{className:"gh-portal-icon gh-portal-icon-envelope"}),u.jsx("h2",{className:"gh-portal-main-title",children:r})]}),u.jsx("p",{children:o})]})}renderLoginMessage(){return u.jsx(u.Fragment,{children:u.jsx("div",{style:{color:"#1d1d1d",fontWeight:"bold",cursor:"pointer"},onClick:()=>this.context.doAction("switchPage",{page:"signin"}),children:f("Back to Log in")})})}handleClose(){this.context.doAction("closePopup")}renderCloseButton(){const{inboxLinks:t}=this.context;return t&&!sk(navigator)?u.jsx(ok,{inboxLinks:t}):u.jsx(ge,{style:{width:"100%"},onClick:n=>this.handleClose(n),brandColor:this.context.brandColor,label:f("Close")})}handleSubmit(t){t.preventDefault();const{action:n}=this.context;n==="verifyOTC:running"||this.doVerifyOTC()}doVerifyOTC(){const t=f("Enter code above");this.setState(n=>{const a=(n.otc||"").trim();return{errors:{[Xa]:a?"":t}}},()=>{const{otc:n,errors:a}=this.state,{otcRef:i}=this.context,{redirect:r}=this.context.pageData??{};!(a&&Object.values(a).filter(s=>!!s).length>0)&&i&&this.context.doAction("verifyOTC",{otc:n,otcRef:i,redirect:r})})}handleInputChange(t,n){const a=n.name,i=t.target.value;if(a===Xa){const r=i.replace(/[^0-9]/g,"");this.setState({[a]:r},()=>{r.length===6&&this.doVerifyOTC()})}else this.setState({[a]:i})}renderOTCForm(){const{action:t,actionErrorMessage:n,otcRef:a,inboxLinks:i}=this.context,r=this.state.errors||{};if(!a)return null;const o=t==="verifyOTC:running",s=t==="verifyOTC:failed",l=s&&n?n:r.otc;return u.jsxs("form",{onSubmit:c=>this.handleSubmit(c),children:[u.jsxs("section",{className:"gh-portal-section gh-portal-otp",children:[u.jsx("div",{className:`gh-portal-otp-container ${this.state.isFocused&&"focused"} ${l&&"error"}`,children:u.jsx("input",{id:`input-${Xa}`,className:`gh-portal-input ${this.state.otc&&"entry"} ${l&&"error"}`,placeholder:"––––––",name:Xa,type:"text",value:this.state.otc,inputMode:"numeric",maxLength:6,pattern:"[0-9]*",autoComplete:"one-time-code",autoCorrect:"off",autoCapitalize:"off",autoFocus:!0,"aria-label":f("Code"),onChange:c=>this.handleInputChange(c,{name:Xa}),onFocus:()=>this.setState({isFocused:!0}),onBlur:()=>this.setState({isFocused:!1})})}),l&&u.jsx("div",{className:"gh-portal-otp-error",children:l})]}),u.jsx("footer",{className:"gh-portal-signin-footer gh-button-row",children:i&&!sk(navigator)&&!this.state.otc?u.jsx(ok,{inboxLinks:i}):u.jsx(ge,{style:{width:"100%"},onClick:c=>this.handleSubmit(c),brandColor:this.context.brandColor,label:f(o?"Verifying...":"Continue"),isRunning:o,retry:s,disabled:o})})]})}render(){const{otcRef:t}=this.context,n=!!t;return u.jsxs("div",{className:"gh-portal-content",children:[u.jsx(we,{}),this.renderFormHeader(),n?this.renderOTCForm():this.renderCloseButton()]})}};pm.contextType=_;let Kd=pm;const P1=`
1795
1795
  .gh-portal-popupnotification {
1796
1796
  right: 42px;
1797
1797
  }
@@ -1806,7 +1806,7 @@ html[dir=rtl] .gh-portal-signup-terms .checkbox:before {
1806
1806
  max-width: calc(100% - 54px);
1807
1807
  }
1808
1808
  }
1809
- `,P1=({hide:e=!1,onClose:t})=>e?null:u.jsx(xd,{className:"gh-portal-notification-closeicon",alt:"Close",onClick:t}),z1=({message:e,site:t})=>{const a=`mailto:${Er({site:t})}`;return e?u.jsx("p",{children:e}):u.jsx("p",{children:u.jsx(Ve,{string:f("An unexpected error occured. Please try again or <a>contact support</a> if the error persists."),mapping:{a:u.jsx("a",{href:a,onClick:()=>{a&&window.open(a)}})}})})},hm=class hm extends Z.Component{constructor(){super(),this.state={className:""}}onAnimationEnd(t){const{popupNotification:n}=this.context,{type:a}=n||{};(t.animationName==="notification-slideout"||t.animationName==="notification-slideout-mobile")&&(a==="stripe:billing-update"&&Cd(["stripe"]),this.context.doAction("clearPopupNotification"))}closeNotification(){this.context.doAction("clearPopupNotification")}componentDidUpdate(){const{popupNotification:t}=this.context;t.count!==this.state.notificationCount&&(clearTimeout(this.timeoutId),this.handlePopupNotification({popupNotification:t}))}handlePopupNotification({popupNotification:t}){if(this.setState({notificationCount:t.count}),t.autoHide){const{duration:n=2600}=t;this.timeoutId=setTimeout(()=>{this.setState(a=>a.className!=="slideout"?{className:"slideout",notificationCount:t.count}:{})},n)}}componentDidMount(){const{popupNotification:t}=this.context;this.handlePopupNotification({popupNotification:t})}componentWillUnmount(){clearTimeout(this.timeoutId)}render(){const{popupNotification:t,site:n}=this.context,{className:a}=this.state,{type:i,status:r,closeable:o,message:s}=t,l=r?` ${r}`:"",c=a?` ${a}`:"";return u.jsxs("div",{className:`gh-portal-notification gh-portal-popupnotification ${l}${c}`,onAnimationEnd:m=>this.onAnimationEnd(m),children:[r==="error"?u.jsx(Ed,{className:"gh-portal-notification-icon error",alt:""}):u.jsx(wy,{className:"gh-portal-notification-icon success",alt:""}),u.jsx(z1,{type:i,status:r,message:s,site:n}),u.jsx(P1,{hide:!o,onClose:m=>this.closeNotification(m)})]})}};hm.contextType=_;let qd=hm;const N1=()=>`
1809
+ `,z1=({hide:e=!1,onClose:t})=>e?null:u.jsx(xd,{className:"gh-portal-notification-closeicon",alt:"Close",onClick:t}),N1=({message:e,site:t})=>{const a=`mailto:${Er({site:t})}`;return e?u.jsx("p",{children:e}):u.jsx("p",{children:u.jsx(Ve,{string:f("An unexpected error occured. Please try again or <a>contact support</a> if the error persists."),mapping:{a:u.jsx("a",{href:a,onClick:()=>{a&&window.open(a)}})}})})},hm=class hm extends Z.Component{constructor(){super(),this.state={className:""}}onAnimationEnd(t){const{popupNotification:n}=this.context,{type:a}=n||{};(t.animationName==="notification-slideout"||t.animationName==="notification-slideout-mobile")&&(a==="stripe:billing-update"&&Cd(["stripe"]),this.context.doAction("clearPopupNotification"))}closeNotification(){this.context.doAction("clearPopupNotification")}componentDidUpdate(){const{popupNotification:t}=this.context;t.count!==this.state.notificationCount&&(clearTimeout(this.timeoutId),this.handlePopupNotification({popupNotification:t}))}handlePopupNotification({popupNotification:t}){if(this.setState({notificationCount:t.count}),t.autoHide){const{duration:n=2600}=t;this.timeoutId=setTimeout(()=>{this.setState(a=>a.className!=="slideout"?{className:"slideout",notificationCount:t.count}:{})},n)}}componentDidMount(){const{popupNotification:t}=this.context;this.handlePopupNotification({popupNotification:t})}componentWillUnmount(){clearTimeout(this.timeoutId)}render(){const{popupNotification:t,site:n}=this.context,{className:a}=this.state,{type:i,status:r,closeable:o,message:s}=t,l=r?` ${r}`:"",c=a?` ${a}`:"";return u.jsxs("div",{className:`gh-portal-notification gh-portal-popupnotification ${l}${c}`,onAnimationEnd:m=>this.onAnimationEnd(m),children:[r==="error"?u.jsx(Ed,{className:"gh-portal-notification-icon error",alt:""}):u.jsx(wy,{className:"gh-portal-notification-icon success",alt:""}),u.jsx(N1,{type:i,status:r,message:s,site:n}),u.jsx(z1,{hide:!o,onClose:m=>this.closeNotification(m)})]})}};hm.contextType=_;let qd=hm;const A1=()=>`
1810
1810
  .gh-portal-offer {
1811
1811
  padding-bottom: 0;
1812
1812
  overflow: unset;
@@ -1943,7 +1943,7 @@ html[dir="rtl"] .gh-portal-offer-title h4 {
1943
1943
  .gh-portal-offer .gh-portal-signup-terms.gh-portal-error {
1944
1944
  margin: 0;
1945
1945
  }
1946
- `,gm=class gm extends Z.Component{constructor(t,n){var a,i;super(t,n),this.state={name:((a=n==null?void 0:n.member)==null?void 0:a.name)||"",email:((i=n==null?void 0:n.member)==null?void 0:i.email)||"",plan:"free",showNewsletterSelection:!1,termsCheckboxChecked:!1}}getFormErrors(t){const a=this.context.site.portal_signup_checkbox_required&&this.context.site.portal_signup_terms_html&&!t.termsCheckboxChecked;return{...Ws({fields:this.getInputFields({state:t})}),checkbox:a}}getInputFields({state:t,fieldNames:n}){const{portal_name:a}=this.context.site,{member:i}=this.context,r=t.errors||{},o=[{type:"email",value:(i==null?void 0:i.email)||t.email,placeholder:f("jamie@example.com"),label:f("Email"),name:"email",disabled:!!i,required:!0,tabIndex:2,errorMessage:r.email||""}];let s=!!a;return i&&!(i!=null&&i.name)&&(s=!1),s&&o.unshift({type:"text",value:(i==null?void 0:i.name)||t.name,placeholder:f("Jamie Larson"),label:f("Name"),name:"name",disabled:!!i,required:!0,tabIndex:1,errorMessage:r.name||""}),o[0].autoFocus=!0,n&&n.length>0?o.filter(l=>n.includes(l.name)):o}renderSignupTerms(){var s;const{site:t}=this.context;if(t.portal_signup_terms_html===null||t.portal_signup_terms_html==="")return null;const n=l=>{this.setState({termsCheckboxChecked:l.target.checked})},a=u.jsx("div",{className:"gh-portal-signup-terms-content",dangerouslySetInnerHTML:{__html:ak(t.portal_signup_terms_html)}}),i=t.portal_signup_checkbox_required?u.jsxs("label",{children:[u.jsx("input",{type:"checkbox",checked:!!this.state.termsCheckboxChecked,required:!0,onChange:n}),u.jsx("span",{className:"checkbox"}),a]}):a,o=`gh-portal-signup-terms ${(s=this.state.errors)!=null&&s.checkbox?"gh-portal-error":""}`;return u.jsx("div",{className:o,onClick:Vy,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=Xn({site:a,productId:n.tier.id}),r=n.cadence==="month"?i.monthlyPrice:i.yearlyPrice;this.setState(o=>({errors:this.getFormErrors(o)}),()=>{const{doAction:o}=this.context,{name:s,email:l,phonenumber:c,errors:m}=this.state;if(!(m&&Object.values(m).filter(d=>!!d).length>0)){const d={name:s,email:l,plan:r==null?void 0:r.id,offerId:n==null?void 0:n.id,phonenumber:c};xr({site:a})?this.setState({showNewsletterSelection:!0,pageData:d,errors:{}}):(o("signup",d),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?u.jsx("img",{className:"gh-portal-signup-logo",src:n,alt:t.title}):null}renderFormHeader(){const{site:t}=this.context,n=t.title||"";return u.jsxs("header",{className:"gh-portal-signup-header",children:[this.renderSiteLogo(),u.jsx("h2",{className:"gh-portal-main-title",children:n})]})}renderForm(){const t=this.getInputFields({state:this.state});return this.state.showNewsletterSelection?u.jsx(Od,{pageData:this.state.pageData,onBack:()=>{this.setState({showNewsletterSelection:!1})}}):u.jsx("section",{children:u.jsx("div",{className:"gh-portal-section",children:u.jsx(Hs,{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=f("Continue");a.type==="trial"&&(i=f("Start {amount}-day free trial",{amount:a.amount}));let r=!1;t==="signup:running"&&(i=f("Sending..."),r=!0);let o=!1;t==="signup:failed"&&(i=f("Retry"),o=!0);const s=t==="signup:running";return u.jsx(ge,{style:{width:"100%"},retry:o,onClick:l=>this.handleSignup(l),disabled:s,brandColor:n,label:i,isRunning:r,tabIndex:3,classes:"sticky bottom"})}renderLoginMessage(){const{member:t}=this.context;if(t)return null;const{brandColor:n,doAction:a}=this.context;return u.jsxs("div",{className:"gh-portal-signup-message",children:[u.jsx("div",{children:f("Already a member?")}),u.jsx("button",{className:"gh-portal-btn gh-portal-btn-link",style:{color:n},onClick:()=>a("switchPage",{page:"signin"}),children:u.jsx("span",{children:f("Sign in")})})]})}renderOfferTag(){const{pageData:t}=this.context;return t.amount<=0?u.jsx(u.Fragment,{}):t.type==="fixed"?u.jsx("h5",{className:"gh-portal-discount-label",children:f("{amount} off",{amount:`${ve(t.currency)}${t.amount/100}`})}):t.type==="trial"?u.jsx("h5",{className:"gh-portal-discount-label",children:f("{amount} days free",{amount:t.amount})}):u.jsx("h5",{className:"gh-portal-discount-label",children:f("{amount} off",{amount:t.amount+"%"})})}renderBenefits({product:t}){const n=t.benefits||[];if(!(n!=null&&n.length))return;const a=n.map((i,r)=>u.jsxs("div",{className:"gh-portal-product-benefit",children:[u.jsx(xy,{className:"gh-portal-benefit-checkmark"}),u.jsx("div",{className:"gh-portal-benefit-title",children:i.name})]},`${i.name}-${r}`));return u.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`${ve(a.currency)}${i}/${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"?`${ve(t.currency)}${t.amount/100}`:t.type==="percent"?`${t.amount}%`:t.type==="trial"?t.amount:""}renderOfferMessage({offer:t,product:n}){const a={forever:f("{amount} off forever.",{amount:this.getOffAmount({offer:t})}),firstPeriod:f("{amount} off for first {period}.",{amount:this.getOffAmount({offer:t}),period:t.cadence}),firstNMonths:f("{amount} off for first {number} months.",{amount:this.getOffAmount({offer:t}),number:t.duration_in_months||""})},i=this.getOriginalPrice({offer:t,product:n}),r=f("Renews at {price}.",{price:i,interpolation:{escapeValue:!1}});let o="",s=!1;const l=t.duration;return l==="once"?(o=a.firstPeriod,s=!0):l==="forever"?o=a.forever:l==="repeating"&&((t.duration_in_months||"")===1?o=a.firstPeriod:o=a.firstNMonths,s=!0),l==="trial"?u.jsxs("p",{className:"footnote",children:[f("Try free for {amount} days, then {originalPrice}.",{amount:t.amount,originalPrice:i,interpolation:{escapeValue:!1}})," ",u.jsx("span",{className:"gh-portal-cancel",children:f("Cancel anytime.")})]}):u.jsxs("p",{className:"footnote",children:[o," ",s?r:""]})}renderProductLabel({product:t,offer:n}){const{site:a}=this.context;return Is({site:a})?u.jsxs("h4",{className:"gh-portal-plan-name",children:[t.name," - ",n.cadence==="month"?f("Monthly"):f("Yearly")]}):u.jsx("h4",{className:"gh-portal-plan-name",children:n.cadence==="month"?f("Monthly"):f("Yearly")})}renderUpdatedTierPrice({offer:t,currencyClass:n,updatedPrice:a,price:i}){return t.type==="trial"?u.jsx("div",{className:"gh-portal-product-card-pricecontainer offer-type-trial",children:u.jsxs("div",{className:"gh-portal-product-price",children:[u.jsx("span",{className:"currency-sign "+n,children:ve(i.currency)}),u.jsx("span",{className:"amount",children:zn(this.renderRoundedPrice(a))})]})}):u.jsx("div",{className:"gh-portal-product-card-pricecontainer",children:u.jsxs("div",{className:"gh-portal-product-price",children:[u.jsx("span",{className:"currency-sign "+n,children:ve(i.currency)}),u.jsx("span",{className:"amount",children:zn(this.renderRoundedPrice(a))})]})})}renderOldTierPrice({offer:t,price:n}){return t.type==="trial"?null:u.jsxs("div",{className:"gh-portal-offer-oldprice",children:[ve(n.currency)," ",zn(n.amount/100)]})}renderProductCard({product:t,offer:n,currencyClass:a,updatedPrice:i,price:r,benefits:o}){return this.state.showNewsletterSelection?null:u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"gh-portal-product-card top",children:u.jsxs("div",{className:"gh-portal-product-card-header",children:[u.jsxs("h4",{className:"gh-portal-product-name",children:[t.name," - ",n.cadence==="month"?f("Monthly"):f("Yearly")]}),this.renderOldTierPrice({offer:n,price:r}),this.renderUpdatedTierPrice({offer:n,currencyClass:a,updatedPrice:i,price:r}),this.renderOfferMessage({offer:n,product:t,price:r})]})}),u.jsxs("div",{children:[u.jsx("div",{className:"gh-portal-product-card bottom",children:u.jsxs("div",{className:"gh-portal-product-card-detaildata",children:[t.description?u.jsx("div",{className:"gh-portal-product-description",children:t.description}):"",o.length?this.renderBenefits({product:t}):""]})}),u.jsxs("div",{className:"gh-portal-btn-container sticky m32",children:[u.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=Xn({site:n,productId:t.tier.id});if(!a)return null;const i=t.cadence==="month"?a.monthlyPrice:a.yearlyPrice,r=gy({offer:t,price:i}),o=a.benefits||[],s=ve(i.currency).length>1?"long":"";return u.jsx(u.Fragment,{children:u.jsxs("div",{className:"gh-portal-content gh-portal-offer",children:[u.jsx(we,{}),this.renderFormHeader(),u.jsxs("div",{className:"gh-portal-offer-bar",children:[u.jsxs("div",{className:"gh-portal-offer-title",children:[t.display_title?u.jsx("h4",{children:t.display_title}):u.jsx("h4",{className:"placeholder",children:f("Black Friday")}),this.renderOfferTag()]}),t.display_description?u.jsx("p",{children:t.display_description}):""]}),this.renderForm(),this.renderProductCard({product:a,offer:t,currencyClass:s,updatedPrice:r,price:i,benefits:o})]})})}};gm.contextType=_;let Jd=gm;const lk=e=>w.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 48 48",...e},w.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"})),uk=e=>w.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 48 48",...e},w.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"})),A1=e=>w.createElement("svg",{width:96,height:56,viewBox:"0 0 96 56",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},w.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"}),w.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 Js({siteUrl:e=window.location.origin,apiUrl:t,apiKey:n}){const a="members/api";function i({type:l,resource:c}){return`${e.replace(/\/$/,"")}/${a}/${c}/`}function r({resource:l,params:c={}}){if(t&&n){const m=new URLSearchParams({...c,key:n});return`${t.replace(/\/$/,"")}/${l}/?${m.toString()}`}return""}function o({url:l,method:c="GET",headers:m={},credentials:p=void 0,body:d=void 0}){return fetch(l,{method:c,headers:m,credentials:p,body:d})}const s={};return s.site={read(){const l=i({type:"members",resource:"site"});return o({url:l,method:"GET",headers:{"Content-Type":"application/json"}}).then(function(c){if(c.ok)return c.json();throw new Error("Failed to fetch site data")})},newsletters(){const l=r({resource:"newsletters",params:{limit:100}});return o({url:l,method:"GET",headers:{"Content-Type":"application/json"}}).then(function(c){if(c.ok)return c.json();throw new Error("Failed to fetch site data")})},tiers(){const l=r({resource:"tiers",params:{limit:100,include:"monthly_price,yearly_price,benefits"}});return o({url:l,method:"GET",headers:{"Content-Type":"application/json"}}).then(function(c){if(c.ok)return c.json();throw new Error("Failed to fetch site data")})},settings(){const l=r({resource:"settings"});return o({url:l,method:"GET",headers:{"Content-Type":"application/json"}}).then(function(c){if(c.ok)return c.json();throw new Error("Failed to fetch site data")})},offer({offerId:l}){const c=r({resource:`offers/${l}`});return o({url:c,method:"GET",headers:{"Content-Type":"application/json"}}).then(function(m){if(m.ok)return m.json();throw new Error("Failed to fetch offer data")})},recommendations({limit:l=100}={limit:100}){const c=r({resource:"recommendations",params:{limit:l}});return o({url:c,method:"GET",headers:{"Content-Type":"application/json"}}).then(function(m){if(m.ok)return m.json();throw new Error("Failed to fetch recommendations")})}},s.feedback={async add({uuid:l,key:c,postId:m,score:p}){let d=i({type:"members",resource:"feedback"});l&&c&&(d=d+`?uuid=${l}&key=${c}`);const y=await o({url:d,method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({feedback:[{post_id:m,score:p}]})});if(y.ok)return y.json();throw await Jt.fromApiResponse(y)??new Error("Failed to save feedback")}},s.recommendations={trackClicked({recommendationId:l}){let c=i({type:"members",resource:"recommendations/"+l+"/clicked"});navigator.sendBeacon(c)},trackSubscribed({recommendationId:l}){let c=i({type:"members",resource:"recommendations/"+l+"/subscribed"});navigator.sendBeacon(c)}},s.member={identity(){const l=i({type:"members",resource:"session"});return o({url:l,credentials:"same-origin"}).then(function(c){return!c.ok||c.status===204?null:c.text()})},sessionData(){const l=i({type:"members",resource:"member"});return o({url:l,credentials:"same-origin"}).then(function(c){return!c.ok||c.status===204?null:c.json()})},update({name:l,subscribed:c,newsletters:m,enableCommentNotifications:p}){const d=i({type:"members",resource:"member"}),h={name:l,subscribed:c,newsletters:m};return p!==void 0&&(h.enable_comment_notifications=p),o({url:d,method:"PUT",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(h)}).then(function(y){return y.ok?y.json():null})},deleteSuppression(){const l=i({type:"members",resource:"member/suppression"});return o({url:l,method:"DELETE"}).then(function(c){if(!c.ok)throw new Error("Your email has failed to resubscribe, please try again");return!0})},async getIntegrityToken(){const l=i({type:"members",resource:"integrity-token"}),c=await o({url:l,method:"GET"});if(c.ok)return c.text();{const m=await Jt.fromApiResponse(c);throw m||new Error("Failed to start a members session")}},async sendMagicLink({email:l,emailType:c,labels:m,name:p,oldEmail:d,newsletters:h,redirect:y,integrityToken:v,phonenumber:g,customUrlHistory:b,token:k,autoRedirect:E=!0,includeOTC:x}){const z=i({type:"members",resource:"send-magic-link"}),C={name:p,email:l,newsletters:h,oldEmail:d,emailType:c,labels:m,requestSrc:"portal",redirect:y,integrityToken:v,honeypot:g,token:k,autoRedirect:E,includeOTC:x},A=b??Cr();A&&(C.urlHistory=A);const N=await o({url:z,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(C)});if(N.ok){if((N.headers.get("content-type")||"").toLowerCase().includes("application/json"))try{return await N.json()}catch{}return{}}else{const $=await Jt.fromApiResponse(N);throw $||new Error("Failed to send magic link email")}},async verifyOTC({otc:l,otcRef:c,redirect:m,integrityToken:p}){const d=i({type:"members",resource:"verify-otc"}),y=await o({url:d,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({otc:l,otcRef:c,redirect:m,integrityToken:p})});if(y.ok)return await y.json();{const v=await Jt.fromApiResponse(y);throw v||new Error("Failed to verify code")}},signout(l=!1){const c=i({type:"members",resource:"session"});return o({url:c,method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:l})}).then(function(m){if(m.ok)return window.location.replace(e),"Success";throw new Error("Failed to signout")})},async newsletters({uuid:l,key:c}){let m=i({type:"members",resource:"member/newsletters"});return m=m+`?uuid=${l}&key=${c}`,o({url:m,credentials:"same-origin"}).then(function(p){return!p.ok||p.status===204?null:p.json()})},async updateNewsletters({uuid:l,newsletters:c,key:m,enableCommentNotifications:p}){let d=i({type:"members",resource:"member/newsletters"});d=d+`?uuid=${l}&key=${m}`;const h={newsletters:c};return p!==void 0&&(h.enable_comment_notifications=p),o({url:d,method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(h)}).then(function(y){if(y.ok)return y.json();throw new Error("Failed to update email preferences")})},async updateEmailAddress({email:l}){const c=await s.member.identity(),m=i({type:"members",resource:"member/email"});return o({url:m,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:l,identity:c})}).then(async function(d){var h,y;if(d.ok)return"Success";{const v=await d.json(),g=((y=(h=v==null?void 0:v.errors)==null?void 0:h[0])==null?void 0:y.message)||"Failed to send email address verification email";throw new Error(g)}})},async checkoutPlan({plan:l,tierId:c,cadence:m,cancelUrl:p,successUrl:d,email:h,name:y,offerId:v,newsletters:g,metadata:b={}}={}){var A,N;const k=new URL(e),E=await s.member.identity(),x=i({type:"members",resource:"create-stripe-checkout-session"});if(!p){const $=window.location.href.startsWith(k.href)?new URL(window.location.href):new URL(e);$.searchParams.set("stripe","cancel"),p=$.href}const z={name:y,newsletters:JSON.stringify(g),requestSrc:"portal",fp_tid:(N=(A=window.FPROM||window.$FPROM)==null?void 0:A.data)==null?void 0:N.tid,urlHistory:Cr(),...b},C={priceId:v?null:l,offerId:v,identity:E,metadata:z,successUrl:d,cancelUrl:p};return h&&(C.customerEmail=h),c&&m&&(delete C.priceId,C.tierId=v?null:c,C.cadence=v?null:m),o({url:x,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(C)}).then(async function($){var H,q;if(!$.ok){const ue=await $.json(),ae=((q=(H=ue==null?void 0:ue.errors)==null?void 0:H[0])==null?void 0:q.message)||"Failed to signup, please try again.";throw new Error(ae)}return $.json()}).then(function($){return $.url?window.location.assign($.url):window.Stripe($.publicKey).redirectToCheckout({sessionId:$.sessionId}).then(function(q){if(q.error)throw new Error(q.error.message)})})},async checkoutDonation({successUrl:l,cancelUrl:c,metadata:m={},personalNote:p=""}={}){var k,E,x;const d=await s.member.identity(),h=i({type:"members",resource:"create-stripe-checkout-session"}),y={fp_tid:(E=(k=window.FPROM||window.$FPROM)==null?void 0:k.data)==null?void 0:E.tid,urlHistory:Cr(),...m},g=await o({url:h,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:d,metadata:y,successUrl:l,cancelUrl:c,type:"donation",personalNote:p})}),b=await g.json();if(!g.ok){const z=(x=b==null?void 0:b.errors)==null?void 0:x[0];throw z||new Error("We're unable to process your payment right now. Please try again later.")}return b},async editBilling({successUrl:l,cancelUrl:c,subscriptionId:m}={}){const p=new URL(e),d=await s.member.identity(),h=i({type:"members",resource:"create-stripe-update-session"});if(!l){const y=new URL(e);y.searchParams.set("stripe","billing-update-success"),l=y.href}if(!c){const y=window.location.href.startsWith(p.href)?new URL(window.location.href):new URL(e);y.searchParams.set("stripe","billing-update-cancel"),c=y.href}return o({url:h,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:d,subscription_id:m,successUrl:l,cancelUrl:c})}).then(function(y){if(!y.ok)throw new Error("Unable to create stripe checkout session");return y.json()}).then(function(y){return window.Stripe(y.publicKey).redirectToCheckout({sessionId:y.sessionId})}).then(function(y){if(y.error)throw new Error(y.error.message)}).catch(function(y){throw y})},async manageBilling({returnUrl:l,subscriptionId:c}={}){const m=await s.member.identity(),p=i({type:"members",resource:"create-stripe-billing-portal-session"});if(!l){const d=new URL(e);d.searchParams.set("stripe","billing-portal-closed"),l=d.href}return o({url:p,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:m,subscription_id:c,returnUrl:l})}).then(function(d){if(!d.ok)throw new Error("Unable to create Stripe billing portal session");return d.json()}).then(function(d){return window.location.assign(d.url)}).catch(function(d){throw d})},async updateSubscription({subscriptionId:l,tierId:c,cadence:m,planId:p,smartCancel:d,cancelAtPeriodEnd:h,cancellationReason:y}){const v=await s.member.identity(),g=i({type:"members",resource:"subscriptions"})+l+"/",b={smart_cancel:d,cancel_at_period_end:h,cancellation_reason:y,identity:v,priceId:p};return c&&m&&(delete b.priceId,b.tierId=c,b.cadence=m),o({url:g,method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)})},async offers(){const l=await s.member.identity(),c=i({type:"members",resource:"member/offers"});return o({url:c,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:l})}).then(function(m){return m.ok?m.json():{offers:[]}}).catch(function(){return{offers:[]}})},async applyOffer({offerId:l,subscriptionId:c}){const m=await s.member.identity(),p=i({type:"members",resource:`subscriptions/${c}/apply-offer`}),d=await o({url:p,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:m,offer_id:l})});if(!d.ok){const h=await d.text();throw new Error(h||"Failed to apply offer")}return!0}},s.init=async()=>{let[l]=await Promise.all([s.member.sessionData()]),c={},m=[],p=[],d={},h=[];try{[{settings:d},{tiers:p},{newsletters:m}]=await Promise.all([s.site.settings(),s.site.tiers(),s.site.newsletters()]),c={...d,newsletters:m,tiers:O0({tiers:p})}}catch{}if(l&&l.paid)try{h=(await s.member.offers()).offers||[]}catch(y){console.warn("[Portal] Failed to load member offers:",y)}return c=v0({site:c}),{site:c,member:l,offers:h}},s}class Mr extends Z.Component{render(){return u.jsx("div",{style:{display:"flex",flexDirection:"column",color:"#313131"},children:u.jsx("div",{style:{paddingLeft:"16px",paddingRight:"16px",paddingTop:"12px",height:"50px"},children:u.jsx(Ja,{className:"gh-portal-loadingicon dark","data-testid":"loaderIcon"})})})}}const I1=`
1946
+ `,gm=class gm extends Z.Component{constructor(t,n){var a,i;super(t,n),this.state={name:((a=n==null?void 0:n.member)==null?void 0:a.name)||"",email:((i=n==null?void 0:n.member)==null?void 0:i.email)||"",plan:"free",showNewsletterSelection:!1,termsCheckboxChecked:!1}}getFormErrors(t){const a=this.context.site.portal_signup_checkbox_required&&this.context.site.portal_signup_terms_html&&!t.termsCheckboxChecked;return{...Ws({fields:this.getInputFields({state:t})}),checkbox:a}}getInputFields({state:t,fieldNames:n}){const{portal_name:a}=this.context.site,{member:i}=this.context,r=t.errors||{},o=[{type:"email",value:(i==null?void 0:i.email)||t.email,placeholder:f("jamie@example.com"),label:f("Email"),name:"email",disabled:!!i,required:!0,tabIndex:2,errorMessage:r.email||""}];let s=!!a;return i&&!(i!=null&&i.name)&&(s=!1),s&&o.unshift({type:"text",value:(i==null?void 0:i.name)||t.name,placeholder:f("Jamie Larson"),label:f("Name"),name:"name",disabled:!!i,required:!0,tabIndex:1,errorMessage:r.name||""}),o[0].autoFocus=!0,n&&n.length>0?o.filter(l=>n.includes(l.name)):o}renderSignupTerms(){var s;const{site:t}=this.context;if(t.portal_signup_terms_html===null||t.portal_signup_terms_html==="")return null;const n=l=>{this.setState({termsCheckboxChecked:l.target.checked})},a=u.jsx("div",{className:"gh-portal-signup-terms-content",dangerouslySetInnerHTML:{__html:ak(t.portal_signup_terms_html)}}),i=t.portal_signup_checkbox_required?u.jsxs("label",{children:[u.jsx("input",{type:"checkbox",checked:!!this.state.termsCheckboxChecked,required:!0,onChange:n}),u.jsx("span",{className:"checkbox"}),a]}):a,o=`gh-portal-signup-terms ${(s=this.state.errors)!=null&&s.checkbox?"gh-portal-error":""}`;return u.jsx("div",{className:o,onClick:Vy,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=Xn({site:a,productId:n.tier.id}),r=n.cadence==="month"?i.monthlyPrice:i.yearlyPrice;this.setState(o=>({errors:this.getFormErrors(o)}),()=>{const{doAction:o}=this.context,{name:s,email:l,phonenumber:c,errors:m}=this.state;if(!(m&&Object.values(m).filter(d=>!!d).length>0)){const d={name:s,email:l,plan:r==null?void 0:r.id,offerId:n==null?void 0:n.id,phonenumber:c};xr({site:a})?this.setState({showNewsletterSelection:!0,pageData:d,errors:{}}):(o("signup",d),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?u.jsx("img",{className:"gh-portal-signup-logo",src:n,alt:t.title}):null}renderFormHeader(){const{site:t}=this.context,n=t.title||"";return u.jsxs("header",{className:"gh-portal-signup-header",children:[this.renderSiteLogo(),u.jsx("h2",{className:"gh-portal-main-title",children:n})]})}renderForm(){const t=this.getInputFields({state:this.state});return this.state.showNewsletterSelection?u.jsx(Od,{pageData:this.state.pageData,onBack:()=>{this.setState({showNewsletterSelection:!1})}}):u.jsx("section",{children:u.jsx("div",{className:"gh-portal-section",children:u.jsx(Hs,{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=f("Continue");a.type==="trial"&&(i=f("Start {amount}-day free trial",{amount:a.amount}));let r=!1;t==="signup:running"&&(i=f("Sending..."),r=!0);let o=!1;t==="signup:failed"&&(i=f("Retry"),o=!0);const s=t==="signup:running";return u.jsx(ge,{style:{width:"100%"},retry:o,onClick:l=>this.handleSignup(l),disabled:s,brandColor:n,label:i,isRunning:r,tabIndex:3,classes:"sticky bottom"})}renderLoginMessage(){const{member:t}=this.context;if(t)return null;const{brandColor:n,doAction:a}=this.context;return u.jsxs("div",{className:"gh-portal-signup-message",children:[u.jsx("div",{children:f("Already a member?")}),u.jsx("button",{className:"gh-portal-btn gh-portal-btn-link",style:{color:n},onClick:()=>a("switchPage",{page:"signin"}),children:u.jsx("span",{children:f("Sign in")})})]})}renderOfferTag(){const{pageData:t}=this.context;return t.amount<=0?u.jsx(u.Fragment,{}):t.type==="fixed"?u.jsx("h5",{className:"gh-portal-discount-label",children:f("{amount} off",{amount:`${ve(t.currency)}${t.amount/100}`})}):t.type==="trial"?u.jsx("h5",{className:"gh-portal-discount-label",children:f("{amount} days free",{amount:t.amount})}):u.jsx("h5",{className:"gh-portal-discount-label",children:f("{amount} off",{amount:t.amount+"%"})})}renderBenefits({product:t}){const n=t.benefits||[];if(!(n!=null&&n.length))return;const a=n.map((i,r)=>u.jsxs("div",{className:"gh-portal-product-benefit",children:[u.jsx(xy,{className:"gh-portal-benefit-checkmark"}),u.jsx("div",{className:"gh-portal-benefit-title",children:i.name})]},`${i.name}-${r}`));return u.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`${ve(a.currency)}${i}/${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"?`${ve(t.currency)}${t.amount/100}`:t.type==="percent"?`${t.amount}%`:t.type==="trial"?t.amount:""}renderOfferMessage({offer:t,product:n}){const a={forever:f("{amount} off forever.",{amount:this.getOffAmount({offer:t})}),firstPeriod:f("{amount} off for first {period}.",{amount:this.getOffAmount({offer:t}),period:t.cadence}),firstNMonths:f("{amount} off for first {number} months.",{amount:this.getOffAmount({offer:t}),number:t.duration_in_months||""})},i=this.getOriginalPrice({offer:t,product:n}),r=f("Renews at {price}.",{price:i,interpolation:{escapeValue:!1}});let o="",s=!1;const l=t.duration;return l==="once"?(o=a.firstPeriod,s=!0):l==="forever"?o=a.forever:l==="repeating"&&((t.duration_in_months||"")===1?o=a.firstPeriod:o=a.firstNMonths,s=!0),l==="trial"?u.jsxs("p",{className:"footnote",children:[f("Try free for {amount} days, then {originalPrice}.",{amount:t.amount,originalPrice:i,interpolation:{escapeValue:!1}})," ",u.jsx("span",{className:"gh-portal-cancel",children:f("Cancel anytime.")})]}):u.jsxs("p",{className:"footnote",children:[o," ",s?r:""]})}renderProductLabel({product:t,offer:n}){const{site:a}=this.context;return Is({site:a})?u.jsxs("h4",{className:"gh-portal-plan-name",children:[t.name," - ",n.cadence==="month"?f("Monthly"):f("Yearly")]}):u.jsx("h4",{className:"gh-portal-plan-name",children:n.cadence==="month"?f("Monthly"):f("Yearly")})}renderUpdatedTierPrice({offer:t,currencyClass:n,updatedPrice:a,price:i}){return t.type==="trial"?u.jsx("div",{className:"gh-portal-product-card-pricecontainer offer-type-trial",children:u.jsxs("div",{className:"gh-portal-product-price",children:[u.jsx("span",{className:"currency-sign "+n,children:ve(i.currency)}),u.jsx("span",{className:"amount",children:zn(this.renderRoundedPrice(a))})]})}):u.jsx("div",{className:"gh-portal-product-card-pricecontainer",children:u.jsxs("div",{className:"gh-portal-product-price",children:[u.jsx("span",{className:"currency-sign "+n,children:ve(i.currency)}),u.jsx("span",{className:"amount",children:zn(this.renderRoundedPrice(a))})]})})}renderOldTierPrice({offer:t,price:n}){return t.type==="trial"?null:u.jsxs("div",{className:"gh-portal-offer-oldprice",children:[ve(n.currency)," ",zn(n.amount/100)]})}renderProductCard({product:t,offer:n,currencyClass:a,updatedPrice:i,price:r,benefits:o}){return this.state.showNewsletterSelection?null:u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"gh-portal-product-card top",children:u.jsxs("div",{className:"gh-portal-product-card-header",children:[u.jsxs("h4",{className:"gh-portal-product-name",children:[t.name," - ",n.cadence==="month"?f("Monthly"):f("Yearly")]}),this.renderOldTierPrice({offer:n,price:r}),this.renderUpdatedTierPrice({offer:n,currencyClass:a,updatedPrice:i,price:r}),this.renderOfferMessage({offer:n,product:t,price:r})]})}),u.jsxs("div",{children:[u.jsx("div",{className:"gh-portal-product-card bottom",children:u.jsxs("div",{className:"gh-portal-product-card-detaildata",children:[t.description?u.jsx("div",{className:"gh-portal-product-description",children:t.description}):"",o.length?this.renderBenefits({product:t}):""]})}),u.jsxs("div",{className:"gh-portal-btn-container sticky m32",children:[u.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=Xn({site:n,productId:t.tier.id});if(!a)return null;const i=t.cadence==="month"?a.monthlyPrice:a.yearlyPrice,r=gy({offer:t,price:i}),o=a.benefits||[],s=ve(i.currency).length>1?"long":"";return u.jsx(u.Fragment,{children:u.jsxs("div",{className:"gh-portal-content gh-portal-offer",children:[u.jsx(we,{}),this.renderFormHeader(),u.jsxs("div",{className:"gh-portal-offer-bar",children:[u.jsxs("div",{className:"gh-portal-offer-title",children:[t.display_title?u.jsx("h4",{children:t.display_title}):u.jsx("h4",{className:"placeholder",children:f("Black Friday")}),this.renderOfferTag()]}),t.display_description?u.jsx("p",{children:t.display_description}):""]}),this.renderForm(),this.renderProductCard({product:a,offer:t,currencyClass:s,updatedPrice:r,price:i,benefits:o})]})})}};gm.contextType=_;let Jd=gm;const lk=e=>w.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 48 48",...e},w.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"})),uk=e=>w.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 48 48",...e},w.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"})),I1=e=>w.createElement("svg",{width:96,height:56,viewBox:"0 0 96 56",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},w.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"}),w.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 Js({siteUrl:e=window.location.origin,apiUrl:t,apiKey:n}){const a="members/api";function i({type:l,resource:c}){return`${e.replace(/\/$/,"")}/${a}/${c}/`}function r({resource:l,params:c={}}){if(t&&n){const m=new URLSearchParams({...c,key:n});return`${t.replace(/\/$/,"")}/${l}/?${m.toString()}`}return""}function o({url:l,method:c="GET",headers:m={},credentials:p=void 0,body:d=void 0}){return fetch(l,{method:c,headers:m,credentials:p,body:d})}const s={};return s.site={read(){const l=i({type:"members",resource:"site"});return o({url:l,method:"GET",headers:{"Content-Type":"application/json"}}).then(function(c){if(c.ok)return c.json();throw new Error("Failed to fetch site data")})},newsletters(){const l=r({resource:"newsletters",params:{limit:100}});return o({url:l,method:"GET",headers:{"Content-Type":"application/json"}}).then(function(c){if(c.ok)return c.json();throw new Error("Failed to fetch site data")})},tiers(){const l=r({resource:"tiers",params:{limit:100,include:"monthly_price,yearly_price,benefits"}});return o({url:l,method:"GET",headers:{"Content-Type":"application/json"}}).then(function(c){if(c.ok)return c.json();throw new Error("Failed to fetch site data")})},settings(){const l=r({resource:"settings"});return o({url:l,method:"GET",headers:{"Content-Type":"application/json"}}).then(function(c){if(c.ok)return c.json();throw new Error("Failed to fetch site data")})},offer({offerId:l}){const c=r({resource:`offers/${l}`});return o({url:c,method:"GET",headers:{"Content-Type":"application/json"}}).then(function(m){if(m.ok)return m.json();throw new Error("Failed to fetch offer data")})},recommendations({limit:l=100}={limit:100}){const c=r({resource:"recommendations",params:{limit:l}});return o({url:c,method:"GET",headers:{"Content-Type":"application/json"}}).then(function(m){if(m.ok)return m.json();throw new Error("Failed to fetch recommendations")})}},s.feedback={async add({uuid:l,key:c,postId:m,score:p}){let d=i({type:"members",resource:"feedback"});l&&c&&(d=d+`?uuid=${l}&key=${c}`);const y=await o({url:d,method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({feedback:[{post_id:m,score:p}]})});if(y.ok)return y.json();throw await Jt.fromApiResponse(y)??new Error("Failed to save feedback")}},s.recommendations={trackClicked({recommendationId:l}){let c=i({type:"members",resource:"recommendations/"+l+"/clicked"});navigator.sendBeacon(c)},trackSubscribed({recommendationId:l}){let c=i({type:"members",resource:"recommendations/"+l+"/subscribed"});navigator.sendBeacon(c)}},s.member={identity(){const l=i({type:"members",resource:"session"});return o({url:l,credentials:"same-origin"}).then(function(c){return!c.ok||c.status===204?null:c.text()})},sessionData(){const l=i({type:"members",resource:"member"});return o({url:l,credentials:"same-origin"}).then(function(c){return!c.ok||c.status===204?null:c.json()})},update({name:l,subscribed:c,newsletters:m,enableCommentNotifications:p}){const d=i({type:"members",resource:"member"}),h={name:l,subscribed:c,newsletters:m};return p!==void 0&&(h.enable_comment_notifications=p),o({url:d,method:"PUT",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(h)}).then(function(y){return y.ok?y.json():null})},deleteSuppression(){const l=i({type:"members",resource:"member/suppression"});return o({url:l,method:"DELETE"}).then(function(c){if(!c.ok)throw new Error("Your email has failed to resubscribe, please try again");return!0})},async getIntegrityToken(){const l=i({type:"members",resource:"integrity-token"}),c=await o({url:l,method:"GET"});if(c.ok)return c.text();{const m=await Jt.fromApiResponse(c);throw m||new Error("Failed to start a members session")}},async sendMagicLink({email:l,emailType:c,labels:m,name:p,oldEmail:d,newsletters:h,redirect:y,integrityToken:v,phonenumber:g,customUrlHistory:b,token:k,autoRedirect:E=!0,includeOTC:x}){const z=i({type:"members",resource:"send-magic-link"}),C={name:p,email:l,newsletters:h,oldEmail:d,emailType:c,labels:m,requestSrc:"portal",redirect:y,integrityToken:v,honeypot:g,token:k,autoRedirect:E,includeOTC:x},A=b??Cr();A&&(C.urlHistory=A);const N=await o({url:z,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(C)});if(N.ok){if((N.headers.get("content-type")||"").toLowerCase().includes("application/json"))try{return await N.json()}catch{}return{}}else{const $=await Jt.fromApiResponse(N);throw $||new Error("Failed to send magic link email")}},async verifyOTC({otc:l,otcRef:c,redirect:m,integrityToken:p}){const d=i({type:"members",resource:"verify-otc"}),y=await o({url:d,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({otc:l,otcRef:c,redirect:m,integrityToken:p})});if(y.ok)return await y.json();{const v=await Jt.fromApiResponse(y);throw v||new Error("Failed to verify code")}},signout(l=!1){const c=i({type:"members",resource:"session"});return o({url:c,method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:l})}).then(function(m){if(m.ok)return window.location.replace(e),"Success";throw new Error("Failed to signout")})},async newsletters({uuid:l,key:c}){let m=i({type:"members",resource:"member/newsletters"});return m=m+`?uuid=${l}&key=${c}`,o({url:m,credentials:"same-origin"}).then(function(p){return!p.ok||p.status===204?null:p.json()})},async updateNewsletters({uuid:l,newsletters:c,key:m,enableCommentNotifications:p}){let d=i({type:"members",resource:"member/newsletters"});d=d+`?uuid=${l}&key=${m}`;const h={newsletters:c};return p!==void 0&&(h.enable_comment_notifications=p),o({url:d,method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(h)}).then(function(y){if(y.ok)return y.json();throw new Error("Failed to update email preferences")})},async updateEmailAddress({email:l}){const c=await s.member.identity(),m=i({type:"members",resource:"member/email"});return o({url:m,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:l,identity:c})}).then(async function(d){var h,y;if(d.ok)return"Success";{const v=await d.json(),g=((y=(h=v==null?void 0:v.errors)==null?void 0:h[0])==null?void 0:y.message)||"Failed to send email address verification email";throw new Error(g)}})},async checkoutPlan({plan:l,tierId:c,cadence:m,cancelUrl:p,successUrl:d,email:h,name:y,offerId:v,newsletters:g,metadata:b={}}={}){var A,N;const k=new URL(e),E=await s.member.identity(),x=i({type:"members",resource:"create-stripe-checkout-session"});if(!p){const $=window.location.href.startsWith(k.href)?new URL(window.location.href):new URL(e);$.searchParams.set("stripe","cancel"),p=$.href}const z={name:y,newsletters:JSON.stringify(g),requestSrc:"portal",fp_tid:(N=(A=window.FPROM||window.$FPROM)==null?void 0:A.data)==null?void 0:N.tid,urlHistory:Cr(),...b},C={priceId:v?null:l,offerId:v,identity:E,metadata:z,successUrl:d,cancelUrl:p};return h&&(C.customerEmail=h),c&&m&&(delete C.priceId,C.tierId=v?null:c,C.cadence=v?null:m),o({url:x,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(C)}).then(async function($){var H,q;if(!$.ok){const ue=await $.json(),ae=((q=(H=ue==null?void 0:ue.errors)==null?void 0:H[0])==null?void 0:q.message)||"Failed to signup, please try again.";throw new Error(ae)}return $.json()}).then(function($){return $.url?window.location.assign($.url):window.Stripe($.publicKey).redirectToCheckout({sessionId:$.sessionId}).then(function(q){if(q.error)throw new Error(q.error.message)})})},async checkoutDonation({successUrl:l,cancelUrl:c,metadata:m={},personalNote:p=""}={}){var k,E,x;const d=await s.member.identity(),h=i({type:"members",resource:"create-stripe-checkout-session"}),y={fp_tid:(E=(k=window.FPROM||window.$FPROM)==null?void 0:k.data)==null?void 0:E.tid,urlHistory:Cr(),...m},g=await o({url:h,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:d,metadata:y,successUrl:l,cancelUrl:c,type:"donation",personalNote:p})}),b=await g.json();if(!g.ok){const z=(x=b==null?void 0:b.errors)==null?void 0:x[0];throw z||new Error("We're unable to process your payment right now. Please try again later.")}return b},async editBilling({successUrl:l,cancelUrl:c,subscriptionId:m}={}){const p=new URL(e),d=await s.member.identity(),h=i({type:"members",resource:"create-stripe-update-session"});if(!l){const y=new URL(e);y.searchParams.set("stripe","billing-update-success"),l=y.href}if(!c){const y=window.location.href.startsWith(p.href)?new URL(window.location.href):new URL(e);y.searchParams.set("stripe","billing-update-cancel"),c=y.href}return o({url:h,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:d,subscription_id:m,successUrl:l,cancelUrl:c})}).then(function(y){if(!y.ok)throw new Error("Unable to create stripe checkout session");return y.json()}).then(function(y){return window.Stripe(y.publicKey).redirectToCheckout({sessionId:y.sessionId})}).then(function(y){if(y.error)throw new Error(y.error.message)}).catch(function(y){throw y})},async manageBilling({returnUrl:l,subscriptionId:c}={}){const m=await s.member.identity(),p=i({type:"members",resource:"create-stripe-billing-portal-session"});if(!l){const d=new URL(e);d.searchParams.set("stripe","billing-portal-closed"),l=d.href}return o({url:p,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:m,subscription_id:c,returnUrl:l})}).then(function(d){if(!d.ok)throw new Error("Unable to create Stripe billing portal session");return d.json()}).then(function(d){return window.location.assign(d.url)}).catch(function(d){throw d})},async updateSubscription({subscriptionId:l,tierId:c,cadence:m,planId:p,smartCancel:d,cancelAtPeriodEnd:h,cancellationReason:y}){const v=await s.member.identity(),g=i({type:"members",resource:"subscriptions"})+l+"/",b={smart_cancel:d,cancel_at_period_end:h,cancellation_reason:y,identity:v,priceId:p};return c&&m&&(delete b.priceId,b.tierId=c,b.cadence=m),o({url:g,method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)})},async offers(){const l=await s.member.identity(),c=i({type:"members",resource:"member/offers"});return o({url:c,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:l})}).then(function(m){return m.ok?m.json():{offers:[]}}).catch(function(){return{offers:[]}})},async applyOffer({offerId:l,subscriptionId:c}){const m=await s.member.identity(),p=i({type:"members",resource:`subscriptions/${c}/apply-offer`}),d=await o({url:p,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:m,offer_id:l})});if(!d.ok){const h=await d.text();throw new Error(h||"Failed to apply offer")}return!0}},s.init=async()=>{let[l]=await Promise.all([s.member.sessionData()]),c={},m=[],p=[],d={},h=[];try{[{settings:d},{tiers:p},{newsletters:m}]=await Promise.all([s.site.settings(),s.site.tiers(),s.site.newsletters()]),c={...d,newsletters:m,tiers:O0({tiers:p})}}catch{}if(l&&l.paid)try{h=(await s.member.offers()).offers||[]}catch(y){console.warn("[Portal] Failed to load member offers:",y)}return c=v0({site:c}),{site:c,member:l,offers:h}},s}class Mr extends Z.Component{render(){return u.jsx("div",{style:{display:"flex",flexDirection:"column",color:"#313131"},children:u.jsx("div",{style:{paddingLeft:"16px",paddingRight:"16px",paddingTop:"12px",height:"50px"},children:u.jsx(Ja,{className:"gh-portal-loadingicon dark","data-testid":"loaderIcon"})})})}}const M1=`
1947
1947
  .gh-portal-feedback {
1948
1948
 
1949
1949
  }
@@ -2101,9 +2101,9 @@ html[dir="rtl"] .gh-portal-offer-title h4 {
2101
2101
  }
2102
2102
  }
2103
2103
  }
2104
- `;function M1({error:e}){const{doAction:t}=w.useContext(_);return u.jsxs("div",{className:"gh-portal-content gh-portal-feedback with-footer",children:[u.jsx(we,{}),u.jsx("div",{className:"gh-feedback-icon gh-feedback-icon-error",children:u.jsx(A1,{})}),u.jsx("h1",{className:"gh-portal-main-title",children:f("Sorry, that didn’t work.")}),u.jsx("div",{children:u.jsx("p",{className:"gh-portal-text-center",children:e})}),u.jsx(ge,{style:{width:"100%"},retry:!1,onClick:()=>t("closePopup"),disabled:!1,brandColor:"#000000",label:f("Close"),isRunning:!1,tabIndex:3,classes:"sticky bottom"})]})}const D1=({onConfirm:e,loading:t,initialScore:n})=>{const{doAction:a,brandColor:i}=w.useContext(_),[r,o]=w.useState(n),s=d=>{d.stopPropagation()},l=()=>{a("closePopup")},c=async d=>{d.stopPropagation(),await e(r)},m=d=>{const h="gh-feedback-button";return d===r?`${h} gh-feedback-button-selected`:h},p=d=>d===r?{color:i}:{};return u.jsxs("div",{className:"gh-portal-confirm-dialog",onMouseDown:s,children:[u.jsx("h1",{className:"gh-portal-confirm-title",children:f("Give feedback on this post")}),u.jsxs("div",{className:"gh-feedback-buttons-group",children:[u.jsxs("button",{className:m(1),style:p(1),onClick:()=>o(1),children:[u.jsx(uk,{}),f("More like this")]}),u.jsxs("button",{className:m(0),style:p(0),onClick:()=>o(0),children:[u.jsx(lk,{}),f("Less like this")]})]}),u.jsx(ge,{classes:"gh-portal-confirm-button",retry:!1,onClick:c,disabled:!1,brandColor:i,label:f("Submit feedback"),isRunning:t,tabIndex:3}),u.jsx(we,{close:()=>l()})]})};async function F1({siteUrl:e,uuid:t,key:n,postId:a,score:i},r){await(r||Js({siteUrl:e})).feedback.add({uuid:t,postId:a,key:n,score:i})}const O1=({action:e,score:t})=>(w.useEffect(()=>{e(t)}),u.jsx(Mr,{})),_1=({positive:e})=>{const{doAction:t,brandColor:n}=w.useContext(_),a=e?u.jsx(uk,{}):u.jsx(lk,{});return u.jsxs("div",{className:"gh-portal-content gh-portal-feedback",children:[u.jsx(we,{}),u.jsx("div",{className:"gh-feedback-icon",children:a}),u.jsx("h1",{className:"gh-portal-main-title",children:f("Thanks for the feedback!")}),u.jsx("p",{className:"gh-portal-text-center",children:f("Your input helps shape what gets published.")}),u.jsx(ge,{style:{width:"100%"},retry:!1,onClick:()=>t("closePopup"),disabled:!1,brandColor:n,label:f("Close"),isRunning:!1,tabIndex:3,classes:"sticky bottom"})]})};function R1(){const{site:e,pageData:t,member:n,api:a}=w.useContext(_),{uuid:i,key:r,postId:o,score:s}=t,[l,c]=w.useState(s),m=l===1,p=!!n,[d,h]=w.useState(p),[y,v]=w.useState(p),[g,b]=w.useState(null),k=async x=>{v(!0);try{await F1({siteUrl:e.url,uuid:i,key:r,postId:o,score:x},a),c(x)}catch(z){const C=Zt(z,f("There was a problem submitting your feedback. Please try again a little later."));b(C)}v(!1)},E=async x=>{await k(x),h(!0)};if(g)return u.jsx(M1,{error:g});if(d){if(y)return u.jsx(O1,{action:k,score:l})}else return u.jsx(D1,{onConfirm:E,loading:y,initialScore:l});return u.jsx(_1,{positive:m})}const L1=".gh-email-suppressed-page-title{margin-bottom:14px}.gh-email-suppressed-page-icon{display:block;width:38px;height:38px;margin:0 auto 18px}.gh-email-suppressed-page-text{padding:0 14px;text-align:center;color:var(--grey6)}.gh-email-faq-footer-text{color:var(--grey8)}.gh-portal-list-detail.email-newsletter .gh-email-faq-page-button{display:block;margin-top:3px}.gh-portal-action-footer .gh-email-faq-page-button{margin-inline-start:4px}.emailReceivingFAQ .gh-portal-btn-back,.emailReceivingFAQ .gh-portal-btn-back:hover{left:calc(6vmin - 14px)}html[dir=rtl] .emailReceivingFAQ .gh-portal-btn-back,html[dir=rtl] .emailReceivingFAQ .gh-portal-btn-back:hover{right:calc(6vmin - 14px);left:unset}.emailReceivingFAQ .gh-portal-closeicon-container{right:calc(6vmin - 20px)}@media (max-width: 480px){.emailReceivingFAQ .gh-portal-btn-back,.emailReceivingFAQ .gh-portal-btn-back:hover{left:16px}.emailReceivingFAQ .gh-portal-closeicon-container{right:24px}}.gh-email-faq-page-button{color:var(--brandcolor);cursor:pointer;background:none;transition:color linear .1s;font-size:1.45rem}html[dir=rtl] .gh-email-faq-page-button span{transform:scaleX(-1);display:inline-flex}",Y1="",U1="",B1=e=>w.createElement("svg",{id:"Regular",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},w.createElement("title",null,"confetti"),w.createElement("defs",null,w.createElement("style",null,`
2104
+ `;function D1({error:e}){const{doAction:t}=w.useContext(_);return u.jsxs("div",{className:"gh-portal-content gh-portal-feedback with-footer",children:[u.jsx(we,{}),u.jsx("div",{className:"gh-feedback-icon gh-feedback-icon-error",children:u.jsx(I1,{})}),u.jsx("h1",{className:"gh-portal-main-title",children:f("Sorry, that didn’t work.")}),u.jsx("div",{children:u.jsx("p",{className:"gh-portal-text-center",children:e})}),u.jsx(ge,{style:{width:"100%"},retry:!1,onClick:()=>t("closePopup"),disabled:!1,brandColor:"#000000",label:f("Close"),isRunning:!1,tabIndex:3,classes:"sticky bottom"})]})}const F1=({onConfirm:e,loading:t,initialScore:n})=>{const{doAction:a,brandColor:i}=w.useContext(_),[r,o]=w.useState(n),s=d=>{d.stopPropagation()},l=()=>{a("closePopup")},c=async d=>{d.stopPropagation(),await e(r)},m=d=>{const h="gh-feedback-button";return d===r?`${h} gh-feedback-button-selected`:h},p=d=>d===r?{color:i}:{};return u.jsxs("div",{className:"gh-portal-confirm-dialog",onMouseDown:s,children:[u.jsx("h1",{className:"gh-portal-confirm-title",children:f("Give feedback on this post")}),u.jsxs("div",{className:"gh-feedback-buttons-group",children:[u.jsxs("button",{className:m(1),style:p(1),onClick:()=>o(1),children:[u.jsx(uk,{}),f("More like this")]}),u.jsxs("button",{className:m(0),style:p(0),onClick:()=>o(0),children:[u.jsx(lk,{}),f("Less like this")]})]}),u.jsx(ge,{classes:"gh-portal-confirm-button",retry:!1,onClick:c,disabled:!1,brandColor:i,label:f("Submit feedback"),isRunning:t,tabIndex:3}),u.jsx(we,{close:()=>l()})]})};async function O1({siteUrl:e,uuid:t,key:n,postId:a,score:i},r){await(r||Js({siteUrl:e})).feedback.add({uuid:t,postId:a,key:n,score:i})}const _1=({action:e,score:t})=>(w.useEffect(()=>{e(t)}),u.jsx(Mr,{})),R1=({positive:e})=>{const{doAction:t,brandColor:n}=w.useContext(_),a=e?u.jsx(uk,{}):u.jsx(lk,{});return u.jsxs("div",{className:"gh-portal-content gh-portal-feedback",children:[u.jsx(we,{}),u.jsx("div",{className:"gh-feedback-icon",children:a}),u.jsx("h1",{className:"gh-portal-main-title",children:f("Thanks for the feedback!")}),u.jsx("p",{className:"gh-portal-text-center",children:f("Your input helps shape what gets published.")}),u.jsx(ge,{style:{width:"100%"},retry:!1,onClick:()=>t("closePopup"),disabled:!1,brandColor:n,label:f("Close"),isRunning:!1,tabIndex:3,classes:"sticky bottom"})]})};function L1(){const{site:e,pageData:t,member:n,api:a}=w.useContext(_),{uuid:i,key:r,postId:o,score:s}=t,[l,c]=w.useState(s),m=l===1,p=!!n,[d,h]=w.useState(p),[y,v]=w.useState(p),[g,b]=w.useState(null),k=async x=>{v(!0);try{await O1({siteUrl:e.url,uuid:i,key:r,postId:o,score:x},a),c(x)}catch(z){const C=Zt(z,f("There was a problem submitting your feedback. Please try again a little later."));b(C)}v(!1)},E=async x=>{await k(x),h(!0)};if(g)return u.jsx(D1,{error:g});if(d){if(y)return u.jsx(_1,{action:k,score:l})}else return u.jsx(F1,{onConfirm:E,loading:y,initialScore:l});return u.jsx(R1,{positive:m})}const Y1=".gh-email-suppressed-page-title{margin-bottom:14px}.gh-email-suppressed-page-icon{display:block;width:38px;height:38px;margin:0 auto 18px}.gh-email-suppressed-page-text{padding:0 14px;text-align:center;color:var(--grey6)}.gh-email-faq-footer-text{color:var(--grey8)}.gh-portal-list-detail.email-newsletter .gh-email-faq-page-button{display:block;margin-top:3px}.gh-portal-action-footer .gh-email-faq-page-button{margin-inline-start:4px}.emailReceivingFAQ .gh-portal-btn-back,.emailReceivingFAQ .gh-portal-btn-back:hover{left:calc(6vmin - 14px)}html[dir=rtl] .emailReceivingFAQ .gh-portal-btn-back,html[dir=rtl] .emailReceivingFAQ .gh-portal-btn-back:hover{right:calc(6vmin - 14px);left:unset}.emailReceivingFAQ .gh-portal-closeicon-container{right:calc(6vmin - 20px)}@media (max-width: 480px){.emailReceivingFAQ .gh-portal-btn-back,.emailReceivingFAQ .gh-portal-btn-back:hover{left:16px}.emailReceivingFAQ .gh-portal-closeicon-container{right:24px}}.gh-email-faq-page-button{color:var(--brandcolor);cursor:pointer;background:none;transition:color linear .1s;font-size:1.45rem}html[dir=rtl] .gh-email-faq-page-button span{transform:scaleX(-1);display:inline-flex}",U1="",B1="",V1=e=>w.createElement("svg",{id:"Regular",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},w.createElement("title",null,"confetti"),w.createElement("defs",null,w.createElement("style",null,`
2105
2105
  .cls-1{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.5px}
2106
- `)),w.createElement("ellipse",{className:"cls-1",cx:11.531,cy:12.469,rx:2.625,ry:5.25,transform:"rotate(-45 11.531 12.47)"}),w.createElement("path",{className:"cls-1",d:"M7.4 9.7.888 21.121a1.5 1.5 0 0 0 1.991 1.991L14.3 16.605M15.773 7.7a.375.375 0 0 1 0 .531m-.53-.531a.375.375 0 0 1 .53 0m-.53.527a.377.377 0 0 1 0-.531m.53.531a.375.375 0 0 1-.53 0m4.773-4.773a.374.374 0 0 1 0 .53m-.53-.53a.374.374 0 0 1 .53 0m-.53.53a.374.374 0 0 1 0-.53m.53.53a.375.375 0 0 1-.53 0m.53 10.076a.375.375 0 0 1 0 .531m-.53-.531a.375.375 0 0 1 .53 0m-.53.531a.375.375 0 0 1 0-.531m.53.531a.375.375 0 0 1-.53 0M8.349 4.514a.377.377 0 0 1 0 .531m-.53-.531a.375.375 0 0 1 .53 0m-.53.531a.375.375 0 0 1 0-.531m.53.531a.375.375 0 0 1-.53 0M12.857.75a13.836 13.836 0 0 1-.531 5.62m4.243-4.242-.53 2.651m7.211 6.364a13.836 13.836 0 0 0-5.62.531m4.242-4.243-2.651.53"})),V1=`
2106
+ `)),w.createElement("ellipse",{className:"cls-1",cx:11.531,cy:12.469,rx:2.625,ry:5.25,transform:"rotate(-45 11.531 12.47)"}),w.createElement("path",{className:"cls-1",d:"M7.4 9.7.888 21.121a1.5 1.5 0 0 0 1.991 1.991L14.3 16.605M15.773 7.7a.375.375 0 0 1 0 .531m-.53-.531a.375.375 0 0 1 .53 0m-.53.527a.377.377 0 0 1 0-.531m.53.531a.375.375 0 0 1-.53 0m4.773-4.773a.374.374 0 0 1 0 .53m-.53-.53a.374.374 0 0 1 .53 0m-.53.53a.374.374 0 0 1 0-.53m.53.53a.375.375 0 0 1-.53 0m.53 10.076a.375.375 0 0 1 0 .531m-.53-.531a.375.375 0 0 1 .53 0m-.53.531a.375.375 0 0 1 0-.531m.53.531a.375.375 0 0 1-.53 0M8.349 4.514a.377.377 0 0 1 0 .531m-.53-.531a.375.375 0 0 1 .53 0m-.53.531a.375.375 0 0 1 0-.531m.53.531a.375.375 0 0 1-.53 0M12.857.75a13.836 13.836 0 0 1-.531 5.62m4.243-4.242-.53 2.651m7.211 6.364a13.836 13.836 0 0 0-5.62.531m4.242-4.243-2.651.53"})),H1=`
2107
2107
  .gh-portal-tips-and-donations .gh-portal-signup-header {
2108
2108
  margin-bottom: 12px;
2109
2109
  padding: 0;
@@ -2129,7 +2129,7 @@ html[dir="rtl"] .gh-portal-offer-title h4 {
2129
2129
  .gh-portal-tips-and-donations .gh-portal-text-center {
2130
2130
  padding: 16px 32px 12px;
2131
2131
  }
2132
- `,H1=()=>{const{doAction:e,brandColor:t,site:n}=w.useContext(_),a=f("Thank you for your support"),i=f("To continue to stay up to date, subscribe to {publication} below.",{publication:n==null?void 0:n.title}),r=f("Sign up");return u.jsxs("div",{className:"gh-portal-content gh-portal-tips-and-donations",children:[u.jsx(we,{}),u.jsxs("div",{className:"gh-portal-signup-header",children:[n.icon?u.jsx("img",{className:"gh-portal-signup-logo",src:n.icon,alt:n.title}):u.jsx("div",{className:"gh-tips-and-donations-icon-success",children:u.jsx(B1,{})}),u.jsx("h1",{className:"gh-portal-main-title",children:a})]}),u.jsx("p",{className:"gh-portal-text-center",children:i}),u.jsx(ge,{style:{width:"100%"},retry:!1,onClick:()=>e("switchPage",{page:"signup"}),disabled:!1,brandColor:t,label:r,isRunning:!1,tabIndex:3,classes:"sticky bottom"}),u.jsxs("div",{className:"gh-portal-signup-message",children:[u.jsx("div",{children:f("Already a member?")}),u.jsx("button",{"data-test-button":"signin-switch","data-testid":"signin-switch",className:"gh-portal-btn gh-portal-btn-link",style:{color:t},onClick:()=>e("switchPage",{page:"signin"}),children:u.jsx("span",{children:f("Sign in")})})]})]})},W1=e=>w.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},w.createElement("title",null,"warning-stroke"),w.createElement("path",{d:"M13.313 2.275a1.5 1.5 0 0 0-2.626 0l-9.75 18A1.5 1.5 0 0 0 2.25 22.5h19.5a1.5 1.5 0 0 0 1.313-2.225zM12 18a.375.375 0 0 1 .375.375m-.75 0A.375.375 0 0 1 12 18m0 .75a.375.375 0 0 1-.375-.375m.75 0a.375.375 0 0 1-.375.375M12 15V8.25",style:{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5px"}})),G1=`
2132
+ `,W1=()=>{const{doAction:e,brandColor:t,site:n}=w.useContext(_),a=f("Thank you for your support"),i=f("To continue to stay up to date, subscribe to {publication} below.",{publication:n==null?void 0:n.title}),r=f("Sign up");return u.jsxs("div",{className:"gh-portal-content gh-portal-tips-and-donations",children:[u.jsx(we,{}),u.jsxs("div",{className:"gh-portal-signup-header",children:[n.icon?u.jsx("img",{className:"gh-portal-signup-logo",src:n.icon,alt:n.title}):u.jsx("div",{className:"gh-tips-and-donations-icon-success",children:u.jsx(V1,{})}),u.jsx("h1",{className:"gh-portal-main-title",children:a})]}),u.jsx("p",{className:"gh-portal-text-center",children:i}),u.jsx(ge,{style:{width:"100%"},retry:!1,onClick:()=>e("switchPage",{page:"signup"}),disabled:!1,brandColor:t,label:r,isRunning:!1,tabIndex:3,classes:"sticky bottom"}),u.jsxs("div",{className:"gh-portal-signup-message",children:[u.jsx("div",{children:f("Already a member?")}),u.jsx("button",{"data-test-button":"signin-switch","data-testid":"signin-switch",className:"gh-portal-btn gh-portal-btn-link",style:{color:t},onClick:()=>e("switchPage",{page:"signin"}),children:u.jsx("span",{children:f("Sign in")})})]})]})},G1=e=>w.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},w.createElement("title",null,"warning-stroke"),w.createElement("path",{d:"M13.313 2.275a1.5 1.5 0 0 0-2.626 0l-9.75 18A1.5 1.5 0 0 0 2.25 22.5h19.5a1.5 1.5 0 0 0 1.313-2.225zM12 18a.375.375 0 0 1 .375.375m-.75 0A.375.375 0 0 1 12 18m0 .75a.375.375 0 0 1-.375-.375m.75 0a.375.375 0 0 1-.375.375M12 15V8.25",style:{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5px"}})),K1=`
2133
2133
  .gh-portal-tips-and-donations .gh-tips-and-donations-icon-error {
2134
2134
  padding: 10px 0;
2135
2135
  text-align: center;
@@ -2146,8 +2146,8 @@ html[dir="rtl"] .gh-portal-offer-title h4 {
2146
2146
  .gh-portal-tips-and-donations .gh-portal-text-center {
2147
2147
  padding: 16px 32px 12px;
2148
2148
  }
2149
- `,Zd=({error:e})=>{const{doAction:t}=w.useContext(_),n=f("Sorry, that didn’t work."),a=e||f("There was an error processing your payment. Please try again."),i=f("Close");return e&&ss(e),u.jsxs("div",{className:"gh-portal-content gh-portal-tips-and-donations",children:[u.jsx(we,{}),u.jsx("div",{className:"gh-tips-and-donations-icon-error",children:u.jsx(W1,{})}),u.jsx("h1",{className:"gh-portal-main-title",children:n}),u.jsx("p",{className:"gh-portal-text-center",children:a}),u.jsx(ge,{style:{width:"100%"},retry:!0,onClick:()=>t("closePopup"),disabled:!1,brandColor:"#000000",label:i,isDestructive:!0,isRunning:!1,tabIndex:3,classes:"sticky bottom"})]})},K1=e=>w.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},w.createElement("path",{d:"M3.84 20.25L19.75 4.34",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),w.createElement("path",{d:"M19.75 19.3398V4.33984H4.75",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),q1=e=>w.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},w.createElement("defs",null,w.createElement("style",null,`.a{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.5px!important;}
2150
- `)),w.createElement("title",null,"check-circle-1"),w.createElement("path",{className:"a",d:"M6,13.223,8.45,16.7a1.049,1.049,0,0,0,1.707.051L18,6.828"}),w.createElement("circle",{className:"a",cx:12,cy:11.999,r:11.25})),J1=`
2149
+ `,Zd=({error:e})=>{const{doAction:t}=w.useContext(_),n=f("Sorry, that didn’t work."),a=e||f("There was an error processing your payment. Please try again."),i=f("Close");return e&&ss(e),u.jsxs("div",{className:"gh-portal-content gh-portal-tips-and-donations",children:[u.jsx(we,{}),u.jsx("div",{className:"gh-tips-and-donations-icon-error",children:u.jsx(G1,{})}),u.jsx("h1",{className:"gh-portal-main-title",children:n}),u.jsx("p",{className:"gh-portal-text-center",children:a}),u.jsx(ge,{style:{width:"100%"},retry:!0,onClick:()=>t("closePopup"),disabled:!1,brandColor:"#000000",label:i,isDestructive:!0,isRunning:!1,tabIndex:3,classes:"sticky bottom"})]})},q1=e=>w.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},w.createElement("path",{d:"M3.84 20.25L19.75 4.34",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),w.createElement("path",{d:"M19.75 19.3398V4.33984H4.75",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),J1=e=>w.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},w.createElement("defs",null,w.createElement("style",null,`.a{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.5px!important;}
2150
+ `)),w.createElement("title",null,"check-circle-1"),w.createElement("path",{className:"a",d:"M6,13.223,8.45,16.7a1.049,1.049,0,0,0,1.707.051L18,6.828"}),w.createElement("circle",{className:"a",cx:12,cy:11.999,r:11.25})),Z1=`
2151
2151
  .gh-portal-recommendations-header .gh-portal-main-title {
2152
2152
  padding: 0 32px;
2153
2153
  text-wrap: balance;
@@ -2280,7 +2280,7 @@ html[dir="rtl"] .gh-portal-offer-title h4 {
2280
2280
  color: var(--grey6);
2281
2281
  font-weight: 400;
2282
2282
  }
2283
- `,ck=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},Z1=({title:e,favicon:t,featuredImage:n})=>{const[a,i]=w.useState(t||n),r=()=>{i(null)};return a?u.jsx("img",{className:"gh-portal-recommendation-item-favicon",src:a,alt:e,onError:r}):u.jsx("div",{className:"gh-portal-recommendation-item-favicon"})},dk=e=>{const t=window.open(e,"_blank");t?t.focus():window.location.href=e},Q1=e=>{const{doAction:t,member:n,site:a}=w.useContext(_),{title:i,url:r,description:o,favicon:s,one_click_subscribe:l,featured_image:c}=e,m=n&&l,[p,d]=w.useState(!1),[h,y]=w.useState(!1),[v,g]=w.useState(!1),b=a.outbound_link_tagging??!1,k=w.useMemo(()=>{if(!b)return r;try{const C=new URL(r);return C.searchParams.has("ref")||C.searchParams.has("utm_source")||C.searchParams.has("source")?r:(C.searchParams.set("ref",uy()),C.toString())}catch{return r}},[r,b]),E=w.useCallback(()=>{dk(k),h||(t("trackRecommendationClicked",{recommendationId:e.id}),y(!0))},[k,e.id,h]),x=w.useCallback(async()=>{try{g(!0),await t("oneClickSubscribe",{siteUrl:r,throwErrors:!0}),t("trackRecommendationSubscribed",{recommendationId:e.id}),d(!0)}catch{const A=new URL("#/portal/signup",k);dk(A),h||(t("trackRecommendationClicked",{recommendationId:e.id}),y(!0))}g(!1)},[d,r,k,e.id,h]),z=w.useCallback(C=>{v||(m?x(C):E(C))},[v,m,x,E]);return u.jsxs("section",{className:"gh-portal-recommendation-item",children:[u.jsxs("div",{className:"gh-portal-list-detail gh-portal-list-big",onClick:E,children:[u.jsxs("div",{className:"gh-portal-recommendation-item-header",children:[u.jsx(Z1,{title:i,favicon:s,featuredImage:c}),u.jsx("h3",{children:i}),u.jsx(K1,{className:"gh-portal-recommendation-arrow-icon"})]}),u.jsxs("div",{className:"gh-portal-recommendation-description-container",children:[p&&u.jsxs("div",{className:"gh-portal-recommendation-subscribed "+(o?"with-description":"without-description"),children:[u.jsx("span",{children:f("Verification link sent, check your inbox")}),u.jsx(q1,{className:"gh-portal-recommendation-checkmark-icon",alt:""})]}),o&&u.jsx("p",{className:p?"gh-portal-recommendation-description-hidden":"",children:o})]})]}),u.jsxs("div",{className:"gh-portal-recommendation-item-action",children:[!p&&v&&u.jsx("span",{className:"gh-portal-recommendations-loading-container",children:u.jsx(Ja,{className:"gh-portal-loadingicon dark"})}),!p&&!v&&m&&u.jsx("button",{type:"button",className:"gh-portal-btn gh-portal-btn-list",onClick:z,children:f("Subscribe")})]})]})},X1=()=>{const{api:e,site:t,pageData:n,doAction:a}=w.useContext(_),{title:i,icon:r}=t,{recommendations_enabled:o=!1}=t,[s,l]=w.useState(null);w.useEffect(()=>{e.site.recommendations({limit:100}).then(y=>{const v=y.recommendations.filter(b=>b.one_click_subscribe),g=y.recommendations.filter(b=>!b.one_click_subscribe);l([...ck(v),...ck(g)])}).catch(y=>{console.error(y)})},[]);const[c,m]=w.useState(5),p=()=>{m(s.length)};if(w.useEffect(()=>()=>{if(n.signup){const y=[];y.push("action","success"),Cd(y)}},[]),s===null)return u.jsx(Mr,{});const d=n&&n.signup?f("Welcome to {siteTitle}",{siteTitle:i,interpolation:{escapeValue:!1}}):f("Recommendations");let h;return o&&s&&s.length>0?n&&n.signup?h=f("Thank you for subscribing. Before you start reading, below are a few other sites you may enjoy."):h=f("Here are a few other sites you may enjoy."):h=f("Sorry, no recommendations are available right now."),u.jsxs("div",{className:"gh-portal-content with-footer",children:[u.jsx(we,{}),u.jsxs("div",{className:"gh-portal-recommendations-header",children:[r&&u.jsx("img",{className:"gh-portal-signup-logo",alt:i,src:r}),u.jsx("h1",{className:"gh-portal-main-title",children:d})]}),u.jsx("p",{className:"gh-portal-recommendations-description",children:h}),o?u.jsx("div",{className:"gh-portal-list",children:s.slice(0,c).map((y,v)=>u.jsx(Q1,{...y},v))}):null,(c<s.length||n&&n.signup)&&u.jsxs("footer",{className:"gh-portal-action-footer",children:[c<s.length&&u.jsx("button",{className:"gh-portal-btn gh-portal-center",style:{width:"100%"},onClick:p,children:u.jsx("span",{children:f("Show all")})}),n&&n.signup&&u.jsx("button",{className:"gh-portal-btn gh-portal-center gh-portal-btn-link gh-portal-btn-recommendations-later",style:{width:"100%"},onClick:p,children:u.jsx("span",{onClick:()=>a("closePopup"),children:f("Maybe later")})})]})]})},eP=`
2283
+ `,ck=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},Q1=({title:e,favicon:t,featuredImage:n})=>{const[a,i]=w.useState(t||n),r=()=>{i(null)};return a?u.jsx("img",{className:"gh-portal-recommendation-item-favicon",src:a,alt:e,onError:r}):u.jsx("div",{className:"gh-portal-recommendation-item-favicon"})},dk=e=>{const t=window.open(e,"_blank");t?t.focus():window.location.href=e},X1=e=>{const{doAction:t,member:n,site:a}=w.useContext(_),{title:i,url:r,description:o,favicon:s,one_click_subscribe:l,featured_image:c}=e,m=n&&l,[p,d]=w.useState(!1),[h,y]=w.useState(!1),[v,g]=w.useState(!1),b=a.outbound_link_tagging??!1,k=w.useMemo(()=>{if(!b)return r;try{const C=new URL(r);return C.searchParams.has("ref")||C.searchParams.has("utm_source")||C.searchParams.has("source")?r:(C.searchParams.set("ref",uy()),C.toString())}catch{return r}},[r,b]),E=w.useCallback(()=>{dk(k),h||(t("trackRecommendationClicked",{recommendationId:e.id}),y(!0))},[k,e.id,h]),x=w.useCallback(async()=>{try{g(!0),await t("oneClickSubscribe",{siteUrl:r,throwErrors:!0}),t("trackRecommendationSubscribed",{recommendationId:e.id}),d(!0)}catch{const A=new URL("#/portal/signup",k);dk(A),h||(t("trackRecommendationClicked",{recommendationId:e.id}),y(!0))}g(!1)},[d,r,k,e.id,h]),z=w.useCallback(C=>{v||(m?x(C):E(C))},[v,m,x,E]);return u.jsxs("section",{className:"gh-portal-recommendation-item",children:[u.jsxs("div",{className:"gh-portal-list-detail gh-portal-list-big",onClick:E,children:[u.jsxs("div",{className:"gh-portal-recommendation-item-header",children:[u.jsx(Q1,{title:i,favicon:s,featuredImage:c}),u.jsx("h3",{children:i}),u.jsx(q1,{className:"gh-portal-recommendation-arrow-icon"})]}),u.jsxs("div",{className:"gh-portal-recommendation-description-container",children:[p&&u.jsxs("div",{className:"gh-portal-recommendation-subscribed "+(o?"with-description":"without-description"),children:[u.jsx("span",{children:f("Verification link sent, check your inbox")}),u.jsx(J1,{className:"gh-portal-recommendation-checkmark-icon",alt:""})]}),o&&u.jsx("p",{className:p?"gh-portal-recommendation-description-hidden":"",children:o})]})]}),u.jsxs("div",{className:"gh-portal-recommendation-item-action",children:[!p&&v&&u.jsx("span",{className:"gh-portal-recommendations-loading-container",children:u.jsx(Ja,{className:"gh-portal-loadingicon dark"})}),!p&&!v&&m&&u.jsx("button",{type:"button",className:"gh-portal-btn gh-portal-btn-list",onClick:z,children:f("Subscribe")})]})]})},eP=()=>{const{api:e,site:t,pageData:n,doAction:a}=w.useContext(_),{title:i,icon:r}=t,{recommendations_enabled:o=!1}=t,[s,l]=w.useState(null);w.useEffect(()=>{e.site.recommendations({limit:100}).then(y=>{const v=y.recommendations.filter(b=>b.one_click_subscribe),g=y.recommendations.filter(b=>!b.one_click_subscribe);l([...ck(v),...ck(g)])}).catch(y=>{console.error(y)})},[]);const[c,m]=w.useState(5),p=()=>{m(s.length)};if(w.useEffect(()=>()=>{if(n.signup){const y=[];y.push("action","success"),Cd(y)}},[]),s===null)return u.jsx(Mr,{});const d=n&&n.signup?f("Welcome to {siteTitle}",{siteTitle:i,interpolation:{escapeValue:!1}}):f("Recommendations");let h;return o&&s&&s.length>0?n&&n.signup?h=f("Thank you for subscribing. Before you start reading, below are a few other sites you may enjoy."):h=f("Here are a few other sites you may enjoy."):h=f("Sorry, no recommendations are available right now."),u.jsxs("div",{className:"gh-portal-content with-footer",children:[u.jsx(we,{}),u.jsxs("div",{className:"gh-portal-recommendations-header",children:[r&&u.jsx("img",{className:"gh-portal-signup-logo",alt:i,src:r}),u.jsx("h1",{className:"gh-portal-main-title",children:d})]}),u.jsx("p",{className:"gh-portal-recommendations-description",children:h}),o?u.jsx("div",{className:"gh-portal-list",children:s.slice(0,c).map((y,v)=>u.jsx(X1,{...y},v))}):null,(c<s.length||n&&n.signup)&&u.jsxs("footer",{className:"gh-portal-action-footer",children:[c<s.length&&u.jsx("button",{className:"gh-portal-btn gh-portal-center",style:{width:"100%"},onClick:p,children:u.jsx("span",{children:f("Show all")})}),n&&n.signup&&u.jsx("button",{className:"gh-portal-btn gh-portal-center gh-portal-btn-link gh-portal-btn-recommendations-later",style:{width:"100%"},onClick:p,children:u.jsx("span",{onClick:()=>a("closePopup"),children:f("Maybe later")})})]})]})},tP=`
2284
2284
  .gh-portal-action-transistor {
2285
2285
  animation: fadeIn 0.3s ease-in-out;
2286
2286
  }
@@ -2297,7 +2297,7 @@ html[dir="rtl"] .gh-portal-offer-title h4 {
2297
2297
  .gh-portal-action-transistor .gh-portal-list-detail p {
2298
2298
  word-break: break-word;
2299
2299
  }
2300
- `,Dr={heading:"Podcasts",description:"Access private podcast feed",button_text:"View",url_template:"https://partner.transistor.fm/ghost/{memberUuid}"},tP=({hasPodcasts:e,memberUuid:t,settings:n={}})=>{const a=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t);if(!e||!t||!a)return null;const i=(m,p)=>m===Dr[p]?f(m):m,r=i(n.heading,"heading")||f(Dr.heading),o=i(n.description,"description")||f(Dr.description),s=i(n.button_text,"button_text")||f(Dr.button_text),c=(n.url_template||Dr.url_template).replace("{memberUuid}",t);return u.jsxs("section",{className:"gh-portal-action-transistor",children:[u.jsxs("div",{className:"gh-portal-list-detail",children:[u.jsx("h3",{children:r}),u.jsx("p",{children:o})]}),u.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"gh-portal-btn gh-portal-btn-list",children:s})]})},nP=`
2300
+ `,Dr={heading:"Podcasts",description:"Access private podcast feed",button_text:"View",url_template:"https://partner.transistor.fm/ghost/{memberUuid}"},nP=({hasPodcasts:e,memberUuid:t,settings:n={}})=>{const a=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t);if(!e||!t||!a)return null;const i=(m,p)=>m===Dr[p]?f(m):m,r=i(n.heading,"heading")||f(Dr.heading),o=i(n.description,"description")||f(Dr.description),s=i(n.button_text,"button_text")||f(Dr.button_text),c=(n.url_template||Dr.url_template).replace("{memberUuid}",t);return u.jsxs("section",{className:"gh-portal-action-transistor",children:[u.jsxs("div",{className:"gh-portal-list-detail",children:[u.jsx("h3",{children:r}),u.jsx("p",{children:o})]}),u.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"gh-portal-btn gh-portal-btn-list",children:s})]})},aP=`
2301
2301
  .gh-portal-main-title {
2302
2302
  text-align: center;
2303
2303
  color: var(--grey0);
@@ -3150,7 +3150,7 @@ html[dir="rtl"] .gh-portal-list-toggle-wrapper .gh-portal-list-detail {
3150
3150
  .pl10 { padding-inline-start: 40px; }
3151
3151
 
3152
3152
  .hidden { display: none !important; }
3153
- `,aP=`
3153
+ `,iP=`
3154
3154
  @media (max-width: 1440px) {
3155
3155
  .gh-portal-popup-container:not(.full-size):not(.large-size):not(.preview) {
3156
3156
  width: 480px;
@@ -3350,7 +3350,7 @@ html[dir="rtl"] .gh-portal-list-toggle-wrapper .gh-portal-list-detail {
3350
3350
  font-size: 16px !important;
3351
3351
  }
3352
3352
  }
3353
- `,iP=`
3353
+ `,rP=`
3354
3354
  .gh-portal-popup-wrapper.multiple-products .gh-portal-input-section {
3355
3355
  max-width: 420px;
3356
3356
  margin: 0 auto;
@@ -3550,5 +3550,5 @@ html[dir="rtl"] .gh-portal-list-toggle-wrapper .gh-portal-list-detail {
3550
3550
  .gh-portal-hide {
3551
3551
  display: none;
3552
3552
  }
3553
- `;function rP({site:e}){return cd+nP+J0+TT+_T+gT()+q0+H0+K0+iy+$1+f1+N1()+Sd+T1+aP+iP+I1+L1+Y1+U1+V1+G1+J1+eP}const fm=class fm extends Z.Component{constructor(t){super(t),this.state={email:"",token:void 0}}componentDidMount(){const{member:t}=this.context;t&&this.context.doAction("switchPage",{page:"accountHome"})}handleSignin(t){t.preventDefault(),this.doSignin()}doSignin(){this.setState(t=>({errors:Ws({fields:this.getInputFields({state:t})})}),async()=>{const{email:t,phonenumber:n,errors:a,token:i}=this.state,{redirect:r}=this.context.pageData??{};a&&Object.values(a).filter(s=>!!s).length>0||this.context.doAction("signin",{email:t,phonenumber:n,redirect:r,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:f("jamie@example.com"),label:f("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=f(a?"Sending login link...":"Continue");const r=!!a;return t==="signin:failed"&&(i=f("Retry"),n=!0),u.jsx(ge,{dataTestId:"signin",retry:n,style:{width:"100%"},onClick:o=>this.handleSignin(o),disabled:r,brandColor:this.context.brandColor,label:i,isRunning:a})}renderSignupMessage(){const{brandColor:t}=this.context;return u.jsxs("div",{className:"gh-portal-signup-message",children:[u.jsx("div",{children:f("Don't have an account?")}),u.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:u.jsx("span",{children:f("Sign up")})})]})}renderForm(){const{site:t}=this.context,n=As({site:t})&&Xt({site:t});return Pn({site:t})?u.jsxs("section",{children:[u.jsx("div",{className:"gh-portal-section",children:u.jsx(Hs,{fields:this.getInputFields({state:this.state}),onChange:(a,i)=>this.handleInputChange(a,i),onKeyDown:(a,i)=>this.onKeyDown(a,i)})}),u.jsxs("footer",{className:"gh-portal-signin-footer",children:[this.renderSubmitButton(),n&&this.renderSignupMessage()]})]}):u.jsx("section",{children:u.jsx("div",{className:"gh-portal-section",children:u.jsx("p",{className:"gh-portal-members-disabled-notification","data-testid":"members-disabled-notification-text",children:f("Memberships unavailable, contact the owner for access.")})})})}renderSiteIcon(){const{site:t}=this.context,n=t.icon;return n?u.jsx("img",{className:"gh-portal-signup-logo",src:n,alt:this.context.site.title}):Pn({site:t})?null:u.jsx(By,{className:"gh-portal-icon gh-portal-icon-invitation"})}renderSiteTitle(){const{site:t}=this.context,n=t.title;return Pn({site:t})?u.jsx("h1",{className:"gh-portal-main-title",children:f("Sign in")}):u.jsx("h1",{className:"gh-portal-main-title",children:n})}renderFormHeader(){return u.jsxs("header",{className:"gh-portal-signin-header",children:[this.renderSiteIcon(),this.renderSiteTitle()]})}render(){return u.jsxs(u.Fragment,{children:[u.jsx(we,{}),u.jsx("div",{className:"gh-portal-logged-out-form-container",children:u.jsxs("div",{className:"gh-portal-content signin",children:[this.renderFormHeader(),this.renderForm()]})})]})}};fm.contextType=_;let Qd=fm;const oP=({handleSignout:e,supportAddress:t=""})=>{const n=`mailto:${t}`;return u.jsxs("footer",{className:"gh-portal-account-footer",children:[u.jsx("ul",{className:"gh-portal-account-footermenu",children:u.jsx("li",{children:u.jsx("button",{"data-test-button":"footer-signout",className:"gh-portal-btn",name:"logout","aria-label":"logout",onClick:a=>e(a),children:f("Sign out")})})}),u.jsx("div",{className:"gh-portal-account-footerright",children:u.jsx("ul",{className:"gh-portal-account-footermenu",children:u.jsx("li",{children:u.jsx("a",{"data-test-link":"footer-support",className:"gh-portal-btn gh-portal-btn-branded",href:n,onClick:()=>{n&&window.open(n)},children:f("Contact support")})})})})]})},sP=()=>{const{member:e,brandColor:t}=w.useContext(_),n=e.avatar_image;return u.jsxs("header",{className:"gh-portal-account-header",children:[u.jsx(ud,{gravatar:n,style:{userIcon:{color:t,width:"56px",height:"56px",padding:"2px"}}}),u.jsx("h2",{className:"gh-portal-main-title",children:f("Your account")})]})},lP=()=>{const{site:e,action:t,brandColor:n,doAction:a}=w.useContext(_);if(!As({site:e})||!Xt({site:e}))return null;const i=["checkoutPlan:running"].includes(t),r=()=>{a("switchPage",{page:"accountPlan",lastPage:"accountHome"})};return u.jsx(ge,{dataTestId:"view-plans",isRunning:i,label:f("View plans"),onClick:()=>r(),brandColor:n,style:{width:"100%"}})},uP=()=>{const{member:e,site:t}=w.useContext(_),{is_stripe_configured:n}=t;if(!n||qa({site:t}))return null;const a=ot({member:e}),i=Tn({member:e});if(i&&!a)return null;if(a){const r=a==null?void 0:a.current_period_end;if(i&&md({member:e})){const o=md({member:e}),s=Qt(o);return u.jsx("div",{className:"gh-portal-section",children:u.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:f("Your subscription will expire on {expiryDate}",{expiryDate:s})})})}if(a!=null&&a.cancel_at_period_end||i)return null;if(gd({sub:a})){const o=Qt(a.trial_end_at);return u.jsx("div",{className:"gh-portal-section",children:u.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:f("Your subscription will start on {subscriptionStart}",{subscriptionStart:o})})})}return u.jsx("div",{className:"gh-portal-section",children:u.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:f("Your subscription will renew on {renewalDate}",{renewalDate:Qt(r)})})})}return u.jsxs("div",{className:"gh-portal-section",children:[u.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:f("You currently have a free membership, upgrade to a paid subscription for full access.")}),u.jsx(lP,{})]})},cP=()=>{const{member:e,doAction:t,action:n,brandColor:a}=w.useContext(_),i=ot({member:e});if(!i||!i.cancel_at_period_end)return null;const r=i.cancel_at_period_end?f("Continue subscription"):f("Cancel subscription"),o=["cancelSubscription:running"].includes(n),s=!!o,l=!!i.cancel_at_period_end,c=()=>{if(!i.cancel_at_period_end)return null;const m=i.current_period_end;return u.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:f("Your subscription will expire on {expiryDate}",{expiryDate:Qt(m)})})};return u.jsxs("div",{className:"gh-portal-cancelcontinue-container",children:[u.jsx(c,{}),u.jsx(ge,{onClick:()=>{t("continueSubscription",{subscriptionId:i.id})},isRunning:o,disabled:s,isPrimary:l,brandColor:a,label:r,style:{width:"100%"}})]})},dP=e=>w.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},w.createElement("defs",null,w.createElement("style",null,".a{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.5px;}")),w.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"}),w.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"})),mP=()=>{const{member:e,site:t,doAction:n}=w.useContext(_),a=()=>{const d=ot({member:e});n("manageBilling",{subscriptionId:d.id})},i=()=>{const{is_stripe_configured:d}=t;d&&n("switchPage",{page:"accountPlan",lastPage:"accountHome"})},r=({price:d,isComplimentary:h,subscription:y})=>{const{next_payment:v}=y||{};let g="";if(d){const{amount:C=0,currency:A,interval:N}=d;g=`${Intl.NumberFormat("en",{currency:A,style:"currency"}).format(C/100)}/${f(N)}`}const b=md({member:e});h&&(b?g=`${f("Complimentary")} - ${f("Expires {expiryDate}",{expiryDate:b})}`:g=g?`${f("Complimentary")} (${g})`:f("Complimentary"));let k="";if(gd({sub:y}))return k="gh-portal-account-old-price",u.jsxs(u.Fragment,{children:[u.jsx("p",{className:k,children:g}),u.jsx(pP,{subscription:y})]});let x=hP({nextPayment:v});x&&(k="gh-portal-account-old-price");const z=()=>x?u.jsxs("p",{className:"gh-portal-account-discountcontainer","data-testid":"offer-label",children:[u.jsx(dP,{className:"gh-portal-account-tagicon"}),u.jsx("span",{children:x})]}):null;return u.jsxs(u.Fragment,{children:[u.jsx("p",{className:k,children:g}),u.jsx(z,{})]})},o=({isPaid:d})=>qa({site:t})&&!d?null:u.jsx("button",{className:"gh-portal-btn gh-portal-btn-list",onClick:h=>i(),"data-test-button":"change-plan",children:f("Change")}),s=({defaultCardLast4:d})=>{if(d){const h=`**** **** **** ${d}`;return u.jsx("p",{children:h})}return null},l=({defaultCardLast4:d,isComplimentary:h})=>{const{action:y}=w.useContext(_),v=y==="manageBilling:running"?u.jsx(Ja,{className:"gh-portal-billing-button-loader"}):f("Update");return h?null:u.jsxs("section",{children:[u.jsxs("div",{className:"gh-portal-list-detail",children:[u.jsx("h3",{children:f("Billing info & receipts")}),u.jsx(s,{defaultCardLast4:d})]}),u.jsx("button",{className:"gh-portal-btn gh-portal-btn-list",onClick:g=>a(),"data-test-button":"manage-billing",children:v})]})},c=ot({member:e}),m=Tn({member:e}),p=Mt({member:e});if(c||m){const{price:d,default_payment_card_last4:h}=c||{};let y=f("Plan");return Is({site:t})&&ly({member:e})&&(y=ly({member:e})),u.jsxs(u.Fragment,{children:[u.jsxs("section",{children:[u.jsxs("div",{className:"gh-portal-list-detail",children:[u.jsx("h3",{children:y}),u.jsx(r,{price:d,isComplimentary:m,subscription:c})]}),u.jsx(o,{isPaid:p})]}),u.jsx(l,{isComplimentary:m,defaultCardLast4:h})]})}return null};function pP({subscription:e}){if(gd({sub:e})){const t=Qt(e.trial_end_at);return u.jsx("p",{className:"gh-portal-account-discountcontainer",children:u.jsx("div",{children:u.jsx("span",{children:f("Free Trial – Ends {trialEnd}",{trialEnd:t})})})})}return null}function hP({nextPayment:e}){if(!e)return"";const t=e.discount;if(!t)return"";let n="";t.duration==="forever"?n=f("Forever"):t.duration==="once"?n=f("Next payment"):t.duration==="repeating"&&t.end&&(n=f("Ends {offerEndDate}",{offerEndDate:Qt(t.end)}));const a=Intl.NumberFormat("en",{currency:e.currency,style:"currency"}).format(e.amount/100);let i="";return t.duration==="once"?i=a:i=`${a}/${e.interval}`,`${i}${n?` — ${n}`:""}`}function gP(){const{member:e,site:t,doAction:n}=w.useContext(_);let{newsletters:a}=e;const i=!!(a!=null&&a.length);let r=f(i?"Subscribed":"Unsubscribed");const o=s=>{var m;s.preventDefault();const l=ea({site:t}),c=(m=e==null?void 0:e.newsletters)!=null&&m.length?[]:l;n("updateNewsletterPreference",{newsletters:c})};return u.jsxs("section",{children:[u.jsxs("div",{className:"gh-portal-list-detail email-newsletter",children:[u.jsx("h3",{children:f("Email newsletter")}),u.jsxs("p",{children:[r," ",fd({member:e})&&i&&u.jsx("button",{className:"gh-portal-btn-text gh-email-faq-page-button",onClick:()=>n("switchPage",{page:"emailReceivingFAQ",lastPage:"accountHome"}),children:f("Not receiving emails?")})]})]}),u.jsx("div",{children:u.jsx(Us,{dataTestId:"default-newsletter-toggle",id:"default-newsletter-toggle",onToggle:s=>{o(s)},checked:i})})]})}const mk=e=>w.createElement("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",...e},w.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"}),w.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 fP(){return u.jsxs("p",{className:"gh-portal-email-notice",children:[u.jsx(mk,{className:"gh-portal-email-notice-icon"}),u.jsx("span",{className:"gh-mobile-only",children:f("You're not receiving emails")}),u.jsx("span",{className:"gh-desktop-only",children:f("You're currently not receiving emails")})]})}function bP(){const{doAction:e,member:t,site:n}=w.useContext(_),a=dy({member:t}),i=wr({site:n}),r=Ms({site:n}),o=a?"emailSuppressed":"accountEmail",s=!i&&!r,l=()=>a||s?u.jsx(fP,{}):u.jsx("p",{children:f("Update your preferences")});return u.jsxs("section",{children:[u.jsxs("div",{className:"gh-portal-list-detail",children:[u.jsx("h3",{children:f("Emails")}),l()]}),u.jsx("button",{className:"gh-portal-btn gh-portal-btn-list",onClick:()=>{e("switchPage",{page:o,lastPage:"accountHome"})},"data-test-button":"manage-newsletters",children:f("Manage")})]})}const yP=()=>{const{member:e,site:t}=w.useContext(_),a=t.transistor_portal_settings||{enabled:t.transistor_portal_enabled===!0,heading:t.transistor_portal_heading,description:t.transistor_portal_description,button_text:t.transistor_portal_button_text,url_template:t.transistor_portal_url_template},i=(a==null?void 0:a.enabled)===!0,r=e==null?void 0:e.uuid,o=by(),[s,l]=w.useState(o&&i);return w.useEffect(()=>{if(o){l(i);return}if(!i||!r){l(!1);return}l(!1);const c=new AbortController;return(async()=>{try{const p=await fetch(`https://partner.transistor.fm/ghost/member/${r}`,{signal:c.signal});if(p.ok){const d=await p.json();c.signal.aborted||l((d==null?void 0:d.member)===!0)}}catch(p){if(c.signal.aborted)return;console.warn("Error in Transistor request",p)}})(),()=>c.abort()},[i,r,o]),{transistor:{enabled:i,hasPodcasts:s,memberUuid:r,settings:a}}},kP=(e,t)=>xr({site:e})&&wr({site:e})||Ms({site:e})||dy({member:t}),vP=e=>!xr({site:e})&&wr({site:e})&&!Ms({site:e}),wP=()=>{const{member:e,doAction:t,site:n}=w.useContext(_),{name:a,email:i}=e,{transistor:r}=yP(),o=()=>{t("switchPage",{page:"accountProfile",lastPage:"accountHome"})},s=kP(n,e),l=vP(n);return u.jsx("div",{children:u.jsxs("div",{className:"gh-portal-list",children:[u.jsxs("section",{children:[u.jsxs("div",{className:"gh-portal-list-detail",children:[u.jsx("h3",{children:a||f("Account")}),u.jsx("p",{children:i})]}),u.jsx("button",{"data-test-button":"edit-profile",className:"gh-portal-btn gh-portal-btn-list",onClick:c=>o(),children:f("Edit")})]}),u.jsx(mP,{}),s&&u.jsx(bP,{}),l&&u.jsx(gP,{}),r.enabled&&u.jsx(tP,{hasPodcasts:r.hasPodcasts,memberUuid:r.memberUuid,settings:r.settings})]})})},SP=()=>u.jsxs("div",{className:"gh-portal-content gh-portal-account-main",children:[u.jsx(we,{}),u.jsx(sP,{}),u.jsxs("section",{className:"gh-portal-account-data",children:[u.jsx(uP,{}),u.jsx(cP,{}),u.jsx(wP,{})]})]}),bm=class bm extends Z.Component{componentDidMount(){const{member:t,site:n}=this.context;Pn({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=Er({site:n});return!t||!Pn({site:n})?null:u.jsxs("div",{className:"gh-portal-account-wrapper",children:[u.jsx(SP,{}),u.jsx(oP,{onClose:()=>this.context.doAction("closePopup"),handleSignout:i=>this.handleSignout(i),supportAddress:a})]})}};bm.contextType=_;let Xd=bm;const ym=class ym extends Z.Component{constructor(t,n){super(t,n);const{name:a="",email:i=""}=n.member||{};this.state={name:a,email:i}}componentDidMount(){const{member:t}=this.context;t||this.context.doAction("switchPage",{page:"signin"})}handleSignout(t){t.preventDefault(),this.context.doAction("signout")}onBack(){this.context.doAction("back")}onProfileSave(t){t.preventDefault(),this.setState(n=>({errors:Ws({fields:this.getInputFields({state:n})})}),()=>{const{email:n,name:a,errors:i}=this.state;i&&Object.values(i).filter(o=>!!o).length>0||(this.context.doAction("clearPopupNotification"),this.context.doAction("updateProfile",{email:n,name:a}))})}renderSaveButton(){const t=this.context.action==="updateProfile:running";let n=f("Save");this.context.action==="updateProfile:failed"&&(n=f("Retry"));const a=!!t;return u.jsx(ge,{dataTestId:"save-button",isRunning:t,onClick:i=>this.onProfileSave(i),disabled:a,brandColor:this.context.brandColor,label:n,style:{width:"100%"}})}renderDeleteAccountButton(){return u.jsx("div",{style:{cursor:"pointer",color:"red"},role:"button",children:f("Delete account")})}renderAccountFooter(){return u.jsx("footer",{className:"gh-portal-action-footer",children:this.renderSaveButton()})}renderHeader(){return u.jsxs("header",{className:"gh-portal-detail-header",children:[u.jsx(Za,{brandColor:this.context.brandColor,hidden:!this.context.lastPage,onClick:t=>this.onBack(t)}),u.jsx("h3",{className:"gh-portal-main-title",children:f("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 u.jsx("div",{style:n,children:u.jsx(ud,{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:f("Jamie Larson"),label:f("Name"),name:"name",required:!1,errorMessage:a.name||""},{type:"email",value:t.email,placeholder:f("jamie@example.com"),label:f("Email"),name:"email",required:!0,errorMessage:a.email||""}];return n&&n.length>0?i.filter(r=>n.includes(r.name)):i}onKeyDown(t){t.keyCode===13&&this.onProfileSave(t)}renderProfileData(){return u.jsx("div",{className:"gh-portal-section",children:u.jsx(Hs,{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?u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"gh-portal-content with-footer",children:[u.jsx(we,{}),this.renderHeader(),u.jsx("div",{className:"gh-portal-section",children:this.renderProfileData()})]}),this.renderAccountFooter()]}):null}};ym.contextType=_;let em=ym;function xP(){const{brandColor:e,lastPage:t,doAction:n}=w.useContext(_);return u.jsxs("header",{className:"gh-portal-detail-header",children:[u.jsx(Za,{brandColor:e,hidden:!t,onClick:()=>{n("back")}}),u.jsx("h3",{className:"gh-portal-main-title",children:f("Email preferences")})]})}function EP({newsletter:e,subscribedNewsletters:t,setSubscribedNewsletters:n}){const a=t.some(i=>i.id===(e==null?void 0:e.id));return u.jsxs("section",{className:"gh-portal-list-toggle-wrapper","data-testid":"toggle-wrapper",children:[u.jsxs("div",{className:"gh-portal-list-detail",children:[u.jsx("h3",{children:e.name}),u.jsx("p",{children:e==null?void 0:e.description})]}),u.jsx("div",{style:{display:"flex",alignItems:"center"},children:u.jsx(Us,{id:e.id,onToggle:(i,r)=>{let o=[];r?o=t.filter(s=>s.id!==e.id).concat(e):o=t.filter(s=>s.id!==e.id),n(o)},checked:a,dataTestId:"switch-input"})})]})}function CP({updateCommentNotifications:e,isCommentsEnabled:t,enableCommentNotifications:n}){const{doAction:a}=w.useContext(_),i=!!n;if(!t)return null;const r=async(o,s)=>{await e(s),a("showPopupNotification",{action:"updated:success",message:f("Comment preferences updated.")})};return u.jsxs("section",{className:"gh-portal-list-toggle-wrapper","data-testid":"toggle-wrapper",children:[u.jsxs("div",{className:"gh-portal-list-detail",children:[u.jsx("h3",{children:f("Comments")}),u.jsx("p",{children:f("Get notified when someone replies to your comment")})]}),u.jsx("div",{style:{display:"flex",alignItems:"center"},children:u.jsx(Us,{id:"comments",onToggle:r,checked:i,dataTestId:"switch-input"})})]})}function jP({subscribedNewsletters:e,setSubscribedNewsletters:t,hasNewslettersEnabled:n}){const{site:a}=w.useContext(_),i=ea({site:a});return n?i.map(r=>u.jsx(EP,{newsletter:r,subscribedNewsletters:e,setSubscribedNewsletters:t},r==null?void 0:r.id)):null}function $P({site:e,isPaid:t}){return t?u.jsx("p",{style:{textAlign:"center",marginTop:"12px",marginBottom:"0",color:"var(--grey6)"},children:f("Unsubscribing from emails will not cancel your paid subscription to {title}",{title:e==null?void 0:e.title})}):null}function pk({hasNewslettersEnabled:e,notification:t,subscribedNewsletters:n,updateSubscribedNewsletters:a,updateCommentNotifications:i,unsubscribeAll:r,isPaidMember:o,isCommentsEnabled:s,enableCommentNotifications:l}){const{brandColor:c,doAction:m,member:p,site:d}=w.useContext(_),h=!(n!=null&&n.length)&&(s&&!l||!s),v=t||(()=>null);return u.jsxs("div",{className:"gh-portal-content with-footer",children:[u.jsx(we,{}),u.jsx(xP,{}),u.jsx(v,{}),u.jsx("div",{className:"gh-portal-section flex",children:u.jsxs("div",{className:"gh-portal-list",children:[u.jsx(jP,{hasNewslettersEnabled:e,subscribedNewsletters:n,setSubscribedNewsletters:g=>{let b=g.map(k=>({id:k.id}));a(b)}}),u.jsx(CP,{isCommentsEnabled:s,enableCommentNotifications:l,updateCommentNotifications:i})]})}),u.jsx("div",{className:"gh-portal-btn-product gh-portal-btn-unsubscribe",style:{marginTop:"-48px",marginBottom:0},children:u.jsx(ge,{isRunning:!1,onClick:()=>{r()},disabled:h,brandColor:c,isPrimary:!1,label:f("Unsubscribe from all emails"),isDestructive:!0,style:{width:"100%",zIndex:900},dataTestId:"unsubscribe-from-all-emails"})}),u.jsxs("footer",{className:"gh-portal-action-footer"+(fd({member:p})?" gh-feature-suppressions":""),children:[u.jsx("div",{style:{width:"100%"},children:u.jsx($P,{isPaid:o,site:d,subscribedNewsletters:n})}),fd({member:p})&&!h&&u.jsxs("div",{className:"gh-portal-footer-secondary",children:[u.jsx("span",{className:"gh-portal-footer-secondary-light",children:f("Not receiving emails?")}),u.jsxs("button",{className:"gh-portal-btn-text gh-email-faq-page-button",onClick:()=>m("switchPage",{page:"emailReceivingFAQ",pageData:{direct:!1}}),children:[f("Get help")," ",u.jsx("span",{className:"right-arrow",children:"→"})]})]})]})]})}function TP(){const{member:e,doAction:t,site:n,pageData:a}=w.useContext(_);let i,r;a&&(i=a.newsletterUuid,r=a.action);const[o,s]=w.useState(!0),l=ea({site:n}),c=wr({site:n});w.useEffect(()=>{e||t("switchPage",{page:"signin"})},[e,t]),w.useEffect(()=>{if(i&&r==="unsubscribe"){const g=e==null?void 0:e.newsletters.filter(b=>b.uuid!==i);h(g),s(!1),t("updateNewsletterPreference",{newsletters:g})}},[]);const m=()=>{if(a.comments&&y){const k=o?"gh-portal-hide":"";return u.jsx(u.Fragment,{children:u.jsx("p",{className:`gh-portal-text-center gh-portal-header-message ${k}`,children:u.jsx(Ve,{string:f("{memberEmail} will no longer receive emails when someone replies to your comments."),mapping:{memberEmail:u.jsx("strong",{children:e==null?void 0:e.email})}})})})}const g=l==null?void 0:l.find(k=>k.uuid===a.newsletterUuid);if(!g)return null;const b=o?"gh-portal-hide":"";return u.jsx(u.Fragment,{children:u.jsx("p",{className:`gh-portal-text-center gh-portal-header-message ${b}`,children:u.jsx(Ve,{string:f("{memberEmail} will no longer receive {newsletterName} newsletter."),mapping:{memberEmail:u.jsx("strong",{children:e==null?void 0:e.email}),newsletterName:u.jsx("strong",{children:g==null?void 0:g.name})}})})})},p=[...(e==null?void 0:e.newsletters)||[]],[d,h]=w.useState(p),{comments_enabled:y}=n,{enable_comment_notifications:v}=e||{};return w.useEffect(()=>{h((e==null?void 0:e.newsletters)||[])},[e==null?void 0:e.newsletters]),u.jsx(pk,{hasNewslettersEnabled:c,notification:i?m:null,subscribedNewsletters:d,updateSubscribedNewsletters:g=>{h(g),t("updateNewsletterPreference",{newsletters:g}),t("showPopupNotification",{action:"updated:success",message:f("Email preferences updated.")})},updateCommentNotifications:async g=>{t("updateNewsletterPreference",{enableCommentNotifications:g})},unsubscribeAll:()=>{h([]),t("showPopupNotification",{action:"updated:success",message:f("Unsubscribed from all emails.")});const g={newsletters:[]};y&&(g.enableCommentNotifications=!1),t("updateNewsletterPreference",g)},isPaidMember:Mt({member:e}),isCommentsEnabled:y!=="off",enableCommentNotifications:v})}function PP(){const{site:e}=w.useContext(_),t=e.icon;return t?u.jsx("img",{className:"gh-portal-unsubscribe-logo",src:t,alt:e.title}):null}function zP(){const{site:e}=w.useContext(_),t=e.title||"";return u.jsxs("header",{className:"gh-portal-header",children:[u.jsx(PP,{}),u.jsx("h2",{className:"gh-portal-publication-title",children:t})]})}async function hk({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 NP(){const{site:e,api:t,pageData:n,member:a,doAction:i}=w.useContext(_),[r,o]=w.useState(),[s,l]=w.useState(!0),c=ea({site:e}),m=c.filter(N=>N.subscribe_on_signup),[p,d]=w.useState(!1),[h,y]=w.useState(m),[v,g]=w.useState(!1),{comments_enabled:b}=e,{enable_comment_notifications:k=!1}=r||{},E=wr({site:e}),x=async N=>{a?i("updateNewsletterPreference",{newsletters:N}):await hk({api:t,memberUuid:n.uuid,key:n.key,newsletters:N}),y(N);const $={action:"updated:success",message:f("Email preferences updated.")};i("showPopupNotification",$)},z=async N=>{let $;a?(await i("updateNewsletterPreference",{enableCommentNotifications:N}),$={...a,enable_comment_notifications:N}):$=await hk({api:t,memberUuid:n.uuid,key:n.key,enableCommentNotifications:N}),o($),i("showPopupNotification",{action:"updated:success",message:f("Comment preferences updated.")})},C=async()=>{let N;a?(await i("updateNewsletterPreference",{newsletters:[],enableCommentNotifications:!1}),N={...a},N.newsletters=[],N.enable_comment_notifications=!1):N=await t.member.updateNewsletters({uuid:n.uuid,key:n.key,newsletters:[],enableCommentNotifications:!1}),y([]),o(N),i("showPopupNotification",{action:"updated:success",message:f("Unsubscribed from all emails.")})};if(w.useEffect(()=>{(async()=>{let N;try{N=await t.member.newsletters({uuid:n.uuid,key:n.key}),o(N??null),l(!1)}catch(H){console.error("[PORTAL] Error fetching member newsletters",H),o(null),l(!1);return}if(N===null)return;const $=(N==null?void 0:N.newsletters)||[];y($),(c==null?void 0:c.length)===1&&!b&&!n.newsletterUuid?await x([]):n.newsletterUuid?await x($==null?void 0:$.filter(H=>H.uuid!==n.newsletterUuid)):n.comments&&b&&await z(!1)})()},[b,n.uuid,n.newsletterUuid,n.comments,e.url,c==null?void 0:c.length]),s)return u.jsx(Mr,{});if(!r)return u.jsxs("div",{className:"gh-portal-content gh-portal-feedback with-footer",children:[u.jsx(we,{}),u.jsx("div",{className:"gh-feedback-icon gh-feedback-icon-error",children:u.jsx(Ed,{})}),u.jsx("h1",{className:"gh-portal-main-title",children:f("That didn't go to plan")}),u.jsx("div",{children:u.jsx("p",{className:"gh-portal-text-center",children:f("We couldn't unsubscribe you as the email address was not found. Please contact the site owner.")})}),u.jsx(ge,{style:{width:"100%"},retry:!1,onClick:()=>i("closePopup"),disabled:!1,brandColor:"#000000",label:f("Close"),isRunning:!1,tabIndex:3,classes:"sticky bottom"})]});if((c==null?void 0:c.length)===1&&!b&&!v)return u.jsxs("div",{className:"gh-portal-content gh-portal-unsubscribe with-footer",children:[u.jsx(we,{}),u.jsx(zP,{}),u.jsx("h1",{className:"gh-portal-main-title",children:f("Successfully unsubscribed")}),u.jsxs("div",{children:[u.jsx("p",{className:"gh-portal-text-center",children:u.jsx(Ve,{string:f("{memberEmail} will no longer receive this newsletter."),mapping:{memberEmail:u.jsx("strong",{children:r==null?void 0:r.email})}})}),u.jsx("p",{className:"gh-portal-text-center",children:u.jsx(Ve,{string:f("Didn't mean to do this? Manage your preferences <button>here</button>."),mapping:{button:u.jsx("button",{className:"gh-portal-btn-link gh-portal-btn-branded gh-portal-btn-inline",onClick:()=>{g(!0)}})}})})]})]});const A=()=>{if(n.comments&&b){const H=p?"gh-portal-hide":"";return u.jsx(u.Fragment,{children:u.jsx("p",{className:`gh-portal-text-center gh-portal-header-message ${H}`,children:u.jsx(Ve,{string:f("{memberEmail} will no longer receive emails when someone replies to your comments."),mapping:{memberEmail:u.jsx("strong",{children:r==null?void 0:r.email})}})})})}const N=c==null?void 0:c.find(H=>H.uuid===n.newsletterUuid);if(!N)return null;const $=p?"gh-portal-hide":"";return u.jsx(u.Fragment,{children:u.jsx("p",{className:`gh-portal-text-center gh-portal-header-message ${$}`,children:u.jsx(Ve,{string:f("{memberEmail} will no longer receive {newsletterName} newsletter."),mapping:{memberEmail:u.jsx("strong",{children:r==null?void 0:r.email}),newsletterName:u.jsx("strong",{children:N==null?void 0:N.name})}})})})};return u.jsx(pk,{hasNewslettersEnabled:E,notification:A,subscribedNewsletters:h,updateSubscribedNewsletters:async N=>{await x(N),d(!0)},updateCommentNotifications:z,unsubscribeAll:async()=>{await C(),d(!0)},isPaidMember:(r==null?void 0:r.status)!=="free",isCommentsEnabled:b!=="off",enableCommentNotifications:k})}function AP(){const{brandColor:e,lastPage:t,doAction:n,action:a,site:i}=w.useContext(_);w.useEffect(()=>{["removeEmailFromSuppressionList:success"].includes(a)&&n("refreshMemberData"),["removeEmailFromSuppressionList:failed","refreshMemberData:failed"].includes(a)&&n("back"),["refreshMemberData:success"].includes(a)&&(xr({site:i})||Ms({site:i})?(n("switchPage",{page:"accountEmail",lastPage:"accountHome"}),n("showPopupNotification",{message:f("You have been successfully resubscribed")})):n("back"))},[a,n,i,f]);const r=["removeEmailFromSuppressionList:running","refreshMemberData:running"].includes(a),o=()=>{n("removeEmailFromSuppressionList")};return u.jsxs("div",{className:"gh-email-suppressed-page",children:[u.jsxs("header",{className:"gh-portal-detail-header",children:[u.jsx(Za,{brandColor:e,hidden:!t,onClick:()=>{n("back")}}),u.jsx(we,{})]}),u.jsx(mk,{className:"gh-email-suppressed-page-icon"}),u.jsxs("div",{className:"gh-email-suppressed-page-text",children:[u.jsx("h3",{className:"gh-portal-main-title gh-email-suppressed-page-title",children:f("Emails disabled")}),u.jsx("p",{children:f("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.")})]}),u.jsx(ge,{dataTestId:"resubscribe-email",classes:"gh-portal-confirm-button",onClick:o,disabled:r,brandColor:e,label:f("Re-enable emails"),isRunning:r})]})}function IP(){const{brandColor:e,doAction:t,site:n,pageData:a}=w.useContext(_),i=`mailto:${Er({site:n})}`,r=a&&a.direct||!1;return u.jsxs("div",{className:"gh-email-suppression-faq",children:[!r&&u.jsxs("header",{className:"gh-portal-detail-header",children:[u.jsx(Za,{brandColor:e,onClick:()=>{t("switchPage",{page:"emailSuppressed",lastPage:"accountHome"})}}),u.jsx(we,{})]}),u.jsxs("div",{className:"gh-longform",children:[u.jsx("h3",{children:f("Why has my email been disabled?")}),u.jsx("p",{children:f("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).")}),u.jsx("h4",{children:f("Spam complaints")}),u.jsx("p",{children:f("If a newsletter is flagged as spam, emails are automatically disabled for that address to make sure you no longer receive any unwanted messages.")}),u.jsx("p",{children:f("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.")}),u.jsx("p",{children:f("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.")}),u.jsx("h4",{children:f("Permanent failure (bounce)")}),u.jsx("p",{children:f("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.")}),u.jsx("p",{children:f("In the event a permanent failure is received when attempting to send a newsletter, emails will be disabled on the account.")}),u.jsx("p",{children:f("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.")}),u.jsx("p",{children:u.jsx("a",{className:"gh-portal-btn gh-portal-btn-branded no-margin-right",href:i,onClick:()=>{i&&window.open(i)},children:f("Need more help? Contact support")})})]})]})}function MP(){const{brandColor:e,doAction:t,site:n,lastPage:a,member:i,pageData:r}=w.useContext(_),o=Er({site:n}),s=`mailto:${o}`,l=z0({site:n}),c=r&&r.direct||!1;return u.jsxs("div",{className:"gh-email-receiving-faq",children:[u.jsxs("header",{className:"gh-portal-detail-header",children:[!c&&u.jsx(Za,{brandColor:e,onClick:()=>{a?t("switchPage",{page:"accountHome"}):t("switchPage",{page:"accountEmail",lastPage:"accountHome"})}}),u.jsx(we,{})]}),u.jsxs("div",{className:"gh-longform",children:[u.jsx("h3",{children:f("Help! I'm not receiving emails")}),u.jsx("p",{children:f("If you're not receiving the email newsletter you've subscribed to, here are a few things to check.")}),u.jsx("h4",{children:f("Verify your email address is correct")}),u.jsx("p",{children:u.jsx(Ve,{string:f("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:u.jsx("strong",{children:i.email}),button:u.jsx("button",{className:"gh-portal-btn-text",onClick:()=>t("switchPage",{lastPage:"emailReceivingFAQ",page:"accountProfile"})})}})}),u.jsx("h4",{children:f("Check spam & promotions folders")}),u.jsx("p",{children:f(`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".`)}),u.jsx("h4",{children:f("Create a new contact")}),u.jsx("p",{children:u.jsx(Ve,{string:f("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:u.jsx("strong",{children:l})}})}),u.jsx("h4",{children:f("Send an email and say hi!")}),u.jsx("p",{children:u.jsx(Ve,{string:f("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:u.jsx("strong",{children:l})}})}),u.jsx("h4",{children:f("Check with your mail provider")}),u.jsx("p",{children:u.jsx(Ve,{string:f("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:u.jsx("strong",{children:l})}})}),u.jsx("h4",{children:f("Get in touch for help")}),u.jsx("p",{children:u.jsx(Ve,{string:f("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:u.jsx("a",{href:s,onClick:()=>{s&&window.open(s)},children:o})}})})]})]})}const tm={signin:Qd,signup:Gd,accountHome:Xd,accountPlan:Dd,accountProfile:em,accountEmail:TP,signupNewsletter:Od,unsubscribe:NP,magiclink:Kd,loading:Mr,offer:Jd,feedback:R1,emailSuppressed:AP,emailSuppressionFAQ:IP,emailReceivingFAQ:MP,support:()=>{const[e,t]=w.useState(!0),[n,a]=w.useState(null),[i,r]=w.useState(null),{member:o,site:s}=w.useContext(_);return w.useEffect(()=>{async function l(){const c=s.url,m=window.location.origin+window.location.pathname,p=o?`${m}?action=support&success=true`:`${m}#/portal/support/success`,d=m,h=Js({siteUrl:c});try{const y=await h.member.checkoutDonation({successUrl:p,cancelUrl:d,personalNote:f("Add a personal note")});y.url&&window.location.replace(y.url)}catch(y){y.type&&y.type==="DisabledFeatureError"?r(f("This site is not accepting payments at the moment.")):a(f("Something went wrong, please try again later.")),t(!1)}}s&&s.donations_enabled===!1?(r(f("This site is not accepting donations at the moment.")),t(!1)):l()},[]),e?u.jsx("div",{children:u.jsx(Mr,{})}):n?u.jsx(Zd,{error:n}):i?u.jsx(Zd,{error:i}):null},supportSuccess:H1,supportError:Zd,recommendations:X1},nm=function({page:e}){return Object.keys(tm).includes(e)?e:"signup"},gk=function({page:e}){return e.includes("account")},DP=function({page:e}){return e.includes("offer")},FP=e=>w.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},w.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"})),km=class km extends Z.Component{render(){return u.jsxs("a",{href:"https://ghost.org",target:"_blank",rel:"noopener noreferrer",onClick:()=>{window.open("https://ghost.org","_blank")},children:[u.jsx(FP,{}),"Powered by Ghost"]})}};km.contextType=_;let Zs=km;const fk=()=>({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 OP({message:e}){return Ka()?u.jsx("div",{className:"gh-portal-cookiebanner",children:e}):null}const vm=class vm extends Z.Component{componentDidMount(){this.node&&!de(["preview"])&&!this.props.isMobile&&(this.node.focus(),this.keyUphandler=t=>{t.key==="Escape"&&this.dismissPopup(t)},this.node.ownerDocument.removeEventListener("keyup",this.keyUphandler),this.node.ownerDocument.addEventListener("keyup",this.keyUphandler)),this.sendContainerHeightChangeEvent()}dismissPopup(t){var i;const n=t.target&&t.target.tagName;(n!=="INPUT"||n==="INPUT"&&!((i=t==null?void 0:t.target)!=null&&i.value))&&this.context.doAction("closePopup")}sendContainerHeightChangeEvent(){var t,n;this.node&&de(["preview"])&&((t=this.node)==null?void 0:t.clientHeight)!==this.lastContainerHeight&&(this.lastContainerHeight=(n=this.node)==null?void 0:n.clientHeight,window.document.body.style.overflow="hidden",window.document.body.style["scrollbar-width"]="none",window.parent.postMessage({type:"portal-preview-updated",payload:{height:this.lastContainerHeight}},"*"))}componentDidUpdate(){this.sendContainerHeightChangeEvent()}componentWillUnmount(){this.node&&this.node.ownerDocument.removeEventListener("keyup",this.keyUphandler)}handlePopupClose(t){const{page:n,otcRef:a}=this.context;de(["preview"])||a&&n==="magiclink"||t.target===t.currentTarget&&this.context.doAction("closePopup")}renderActivePage(){const{page:t}=this.context;nm({page:t});const n=tm[t];return u.jsx(n,{})}renderPopupNotification(){const{popupNotification:t}=this.context;return!t||!t.type?null:u.jsx(qd,{})}sendPortalPreviewReadyEvent(){window.self!==window.parent&&window.parent.postMessage({type:"portal-preview-ready",payload:{}},"*")}render(){const{page:t,pageQuery:n,site:a,customSiteUrl:i}=this.context,o=Os({site:a,pageQuery:n}).length;nm({page:t});const l={...fk().page[t]};let c="",m="regular",p="",d=t;switch(t){case"signup":p="Cookies must be enabled in your browser to sign up.";break;case"signin":p="Cookies must be enabled in your browser to sign in.";break;case"accountHome":d="account-home";break;case"accountProfile":d="account-profile";break;case"accountPlan":d="account-plan";break;default:p="Cookies must be enabled in your browser.",d=t;break}o>1&&!Dt({site:a})&&Xt({site:a,pageQuery:n})&&t==="signup"&&(d+=" full-size",m="full");const h=Sr({site:a});(h&&o>2||!h&&o>1)&&t==="accountPlan"&&(d+=" full-size",m="full"),(t==="emailSuppressionFAQ"||t==="emailReceivingFAQ")&&(d+=" large-size");let y="gh-portal-popup-container";de(["preview"])&&(d+=" preview"),de(["preview"],{customSiteUrl:i})&&!a.disableBackground&&(y+=" preview"),de(["dev"])&&(y+=" dev");const v=`${y} ${c} ${d}`;return this.sendPortalPreviewReadyEvent(),u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"gh-portal-popup-wrapper "+d,onClick:g=>this.handlePopupClose(g),children:[this.renderPopupNotification(),u.jsxs("div",{className:v,style:l,ref:g=>this.node=g,tabIndex:-1,children:[u.jsx(OP,{message:p}),this.renderActivePage(),m==="full"?u.jsx("div",{className:"gh-portal-powered inside "+(de(["preview"])?"hidden ":"")+d,children:u.jsx(Zs,{})}):""]})]}),u.jsx("div",{className:"gh-portal-powered outside "+(de(["preview"])?"hidden ":"")+d,children:u.jsx(Zs,{})})]})}};vm.contextType=_;let am=vm;const wm=class wm extends Z.Component{constructor(t){super(t),this.state={height:null}}renderCurrentPage(t){const n=tm[t];return u.jsx(n,{})}onHeightChange(t){this.setState({height:t})}handlePopupClose(t){t.preventDefault(),t.target===t.currentTarget&&this.context.doAction("closePopup")}renderFrameStyles(){const{site:t,brandColor:n}=this.context,a=rP({site:t}),i=n?`:root { --brandcolor: ${n} }`+a:a;return u.jsxs(u.Fragment,{children:[u.jsx("style",{dangerouslySetInnerHTML:{__html:i}}),u.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=fk(),r=window.innerWidth<480,o={...i.frame.common};let s="gh-portal-popup-background";return de(["preview"])&&(i.modalContainer.zIndex="3999997"),de(["preview"],{customSiteUrl:a})&&!n.disableBackground&&(s+=" preview"),de(["dev"])&&(s+=" dev"),u.jsx("div",{style:i.modalContainer,children:u.jsxs(sd,{style:o,title:"portal-popup",head:this.renderFrameStyles(),dataTestId:"portal-popup-frame",dataDir:this.context.dir,children:[u.jsx("div",{className:s,onClick:l=>this.handlePopupClose(l)}),u.jsx(am,{isMobile:r})]})})}render(){const{showPopup:t}=this.context;return t?this.renderFrameContainer():null}};wm.contextType=_;let im=wm;Qs({products:rm({numOfProducts:1})});function Fe(){return(new Date().getTime()/1e3|0).toString(16)+"xxxxxxxxxxxxxxxx".replace(/[x]/g,function(){return(Math.random()*16|0).toString(16)}).toLowerCase()}function _P(){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 Qs({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:r={monthly:5e3,yearly:15e4,currency:"USD"},products:o=rm({numOfProducts:1}),portalProducts:s=o.map(H=>H.id),accentColor:l="#45C32E",portalPlans:c=["free","monthly","yearly"],membersSignupAccess:m="all",freePriceName:p="Free",freePriceDescription:d="Free preview",isStripeConfigured:h=!0,portalButton:y=!0,portalName:v=!0,portalButtonIcon:g="icon-1",portalButtonSignupText:b="Subscribe now",portalButtonStyle:k="icon-and-text",membersSupportAddress:E="support@example.com",editorDefaultEmailRecipients:x="visibility",newsletters:z=[],posts:C=RP(),commentsEnabled:A,recommendations:N=[],recommendationsEnabled:$}={}){return{title:e,description:t,logo:n,icon:a,accent_color:l,url:i,plans:r,products:o,portal_products:s,members_signup_access:m,free_price_name:p,free_price_description:d,is_stripe_configured:h,portal_button:y,portal_name:v,portal_plans:c,portal_button_icon:g,portal_button_signup_text:b,portal_button_style:k,members_support_address:E,comments_enabled:A!=="off",newsletters:z,recommendations:N,recommendations_enabled:!!$,editor_default_email_recipients:x,posts:C}}function bk({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:r="month",amount:o=50,duration:s="repeating",durationInMonths:l=null,currencyRestriction:c=!1,currency:m=null,status:p="active",tierId:d="",tierName:h="Basic",redemptionType:y="signup"}={}){return{id:`offer_${Fe()}`,name:e,code:t,display_title:n,display_description:a,type:i,cadence:r,amount:o,duration:s,duration_in_months:l,currency_restriction:c,currency:m,status:p,tier:{id:`${d}`,name:h},redemption_type:y}}function Et({name:e="Jamie Larson",email:t="jamie@example.com",firstname:n="Jamie",subscriptions:a=[],paid:i=!1,avatarImage:r="",subscribed:o=!0,email_suppression:s={suppressed:!1,info:null},newsletters:l=[]}={}){return{uuid:_P(),email:t,name:e,firstname:n,paid:i,subscribed:o,avatar_image:r,subscriptions:a,email_suppression:s,newsletters:l}}function RP({numOfPosts:e=3}={}){const t=[];for(let n=0;n<e;n++)t.push(LP({title:`Post ${n+1}`,slug:`post-${n+1}`}));return t.slice(0,e)}function LP({id:e=`post_${Fe()}`,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 rm({numOfProducts:e=3}={}){const n=[ei({name:"Bronze",description:"Access to all members articles",monthlyPrice:bt({interval:"month",amount:700}),yearlyPrice:bt({interval:"year",amount:7e3}),numOfBenefits:2}),ei({name:"Silver",description:"Access to all members articles and weekly podcast",monthlyPrice:bt({interval:"month",amount:1200}),yearlyPrice:bt({interval:"year",amount:12e3}),numOfBenefits:3}),ei({name:"Friends of the Blueprint",description:"Get access to everything and lock in early adopter pricing for life + listen to my podcast",monthlyPrice:bt({interval:"month",amount:18e3}),yearlyPrice:bt({interval:"year",amount:17e3}),numOfBenefits:4})].slice(0,e),a=yk({});return[...n,a]}function ei({type:e="paid",name:t="Basic",description:n="",id:a=`product_${Fe()}`,monthlyPrice:i=bt(),yearlyPrice:r=bt({interval:"year"}),numOfBenefits:o=2,trialDays:s=null}){return{id:a,name:t,description:n,monthlyPrice:e==="free"?null:i,yearlyPrice:e==="free"?null:r,type:e,benefits:kk({numOfBenefits:o}),trial_days:s}}function yk({name:e="Free tier",description:t="Free tier description",id:n=`product_${Fe()}`,numOfBenefits:a=2}){return{id:n,name:e,type:"free",description:t,benefits:kk({numOfBenefits:a})}}function kk({numOfBenefits:e}){const t=Fe();return[Xs({name:`Limited early adopter pricing #${t.substring(0,6)}`}),Xs({name:`Latest gear reviews #${t.substring(6,12)}`}),Xs({name:`Weekly email newsletter #${t.substring(12,18)}`}),Xs({name:`Listen to my podcast #${t.substring(18)}`})].slice(0,e)}function Xs({id:e=`benefit_${Fe()}`,name:t="Benefit"}){return{id:e,name:t}}function bt({interval:e="month",amount:t=e==="month"?500:5e3,nickname:n=e==="month"?"Monthly":"Yearly",description:a=null,currency:i="usd",active:r=!0,id:o=`price_${Fe()}`}={}){return{id:o,active:r,nickname:n,currency:i,amount:t,interval:e,description:a,stripe_price_id:`price_${Fe()}`,stripe_product_id:`prod_${Fe()}`,type:"recurring"}}function na({id:e=`sub_${Fe()}`,status:t="active",currency:n="USD",interval:a="year",amount:i=a==="month"?500:5e3,nickname:r=a==="month"?"Monthly":"Yearly",cardLast4:o="4242",offer:s=UP,priceId:l=`price_${Fe()}`,startDate:c="2021-10-05T03:18:30.000Z",currentPeriodEnd:m="2022-10-05T03:18:30.000Z",cancelAtPeriodEnd:p=!1,trialEndAt:d=null,nextPayment:h=null,tier:y=null}={}){return{id:e,customer:{id:`cus_${Fe()}`,name:"Jamie",email:"jamie@example.com"},plan:{id:`price_${Fe()}`,nickname:r,amount:i,interval:a,currency:n},offer:s,status:t,start_date:c,default_payment_card_last4:o,cancel_at_period_end:p,cancellation_reason:null,current_period_end:m,trial_end_at:d,next_payment:h,tier:y,price:{id:`stripe_price_${Fe()}`,price_id:l,nickname:r,amount:i,interval:a,type:"recurring",currency:n,product:{id:`stripe_prod_${Fe()}`,product_id:`prod_${Fe()}`}}}}function vk(){const e=rm({numOfProducts:1}),t=e.map(a=>a.id);return Qs({products:e,portalPlans:["free","monthly","yearly"],portalProducts:t})}vk();const YP=Qs({products:[ei({numOfBenefits:2,type:"free"})]}),UP=bk({tierId:(Ck=YP.products[0])==null?void 0:Ck.id});Et(),Et({paid:!0,subscriptions:[na()]}),Et({paid:!0,subscriptions:[]}),Et({paid:!0,subscriptions:[na({amount:0})]}),Et({paid:!0,subscriptions:[na({amount:1500,startDate:"2019-05-01T11:42:40.000Z",currentPeriodEnd:"2021-06-05T11:42:40.000Z"})]}),vk();const el=[yk({name:"Free",description:"Free tier description which is actually a pretty long description",numOfBenefits:2}),ei({name:"The Blueprint",description:"",monthlyPrice:bt({interval:"month",amount:500}),yearlyPrice:bt({interval:"year",amount:5e3}),numOfBenefits:3}),ei({name:"Friends of the Blueprint Silver",description:"Access to all members articles and weekly podcast",monthlyPrice:bt({interval:"month",amount:1200}),yearlyPrice:bt({interval:"year",amount:11e3}),numOfBenefits:4})],ti=Qs({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:el,portalProducts:el.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}]}),wk=bk({tierId:(jk=ti.products[1])==null?void 0:jk.id}),Fr={free:Et({name:"Jamie Larson",email:"jamie@example.com",firstname:"Jamie",subscriptions:[],paid:!1,avatarImage:"",subscribed:!0}),paid:Et({paid:!0,subscriptions:[na({status:"active",currency:"USD",interval:"year",amount:5e3,cardLast4:"4242",startDate:"2021-10-05T03:18:30.000Z",currentPeriodEnd:"2022-10-05T03:18:30.000Z",cancelAtPeriodEnd:!1})]}),complimentary:Et({paid:!0,subscriptions:[]}),complimentaryWithSubscription:Et({paid:!0,subscriptions:[na({amount:0})]}),preview:Et({paid:!0,subscriptions:[na({amount:1500,startDate:"2019-05-01T11:42:40.000Z",currentPeriodEnd:new Date().toISOString()})]})};function BP(){var n;if(!el||!el[1])return null;let e=(n=ti==null?void 0:ti.products)==null?void 0:n[1].monthlyPrice,t=Et({paid:!0,subscriptions:[na({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:ti,member:t}}function VP(e){const t=e.getAttribute("href"),n=new URL(t,window.location.origin);!n.hash||!n.hash.startsWith("#/portal")||t.startsWith("#/portal")||n.origin===window.location.origin&&e.setAttribute("href",n.hash)}function HP({data:e,state:t}){return{page:e.page,popupNotification:null,lastPage:e.lastPage||null,pageData:e.pageData||t.pageData}}function WP({state:e}){return{showPopup:!e.showPopup}}function GP({data:e}){return{showPopup:!0,page:e.page,...e.pageQuery?{pageQuery:e.pageQuery}:{},...e.pageData?{pageData:e.pageData}:{}}}function KP({state:e}){return e.lastPage?{page:e.lastPage}:Sk({state:e})}function Sk({state:e}){return dd(),{showPopup:!1,lastPage:null,pageQuery:"",popupNotification:null,page:e.page==="magiclink"?"":e.page}}function qP({data:e}){return{showNotification:!0,...e}}function JP(){return{showNotification:!1}}async function ZP({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:f("Failed to log out, please try again")})}}}async function QP({data:e,api:t,state:n}){try{const a=await t.member.getIntegrityToken(),i={...e,emailType:"signin",integrityToken:a,includeOTC:!0},{otc_ref:r,inboxLinks:o}=await t.member.sendMagicLink(i);return{page:"magiclink",lastPage:"signin",...r?{otcRef:r}:{},inboxLinks:o,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:Zt(a,f("Failed to log in, please try again"))})}}}function XP({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 ez({data:e,api:t}){var a;const n=f("Failed to verify code, please try again");try{const i=await t.member.getIntegrityToken(),r=await t.member.verifyOTC({...e,integrityToken:i});return r.redirectUrl?window.location.assign(r.redirectUrl):{action:"verifyOTC:failed",actionErrorMessage:Zt((a=r.errors)==null?void 0:a[0],n)}}catch(i){return{action:"verifyOTC:failed",actionErrorMessage:Zt(i,n)}}}async function tz({data:e,state:t,api:n}){try{let{plan:a,tierId:i,cadence:r,email:o,name:s,newsletters:l,offerId:c}=e;s=s==null?void 0:s.trim();let m;if(a.toLowerCase()==="free"){const p=await n.member.getIntegrityToken();({inboxLinks:m}=await n.member.sendMagicLink({emailType:"signup",integrityToken:p,...e,name:s}))}else return i&&r?await n.member.checkoutPlan({plan:a,tierId:i,cadence:r,email:o,name:s,newsletters:l,offerId:c}):({tierId:i,cadence:r}=ta({site:t==null?void 0:t.site,priceId:a}),await n.member.checkoutPlan({plan:a,tierId:i,cadence:r,email:o,name:s,newsletters:l,offerId:c})),{page:"loading"};return{page:"magiclink",lastPage:"signup",inboxLinks:m,pageData:{...t.pageData||{},email:(o||"").trim()}}}catch(a){const i=Zt(a,f("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 nz({data:e,state:t,api:n}){try{let{plan:a,offerId:i,tierId:r,cadence:o}=e;(!r||!o)&&({tierId:r,cadence:o}=ta({site:t==null?void 0:t.site,priceId:a})),await n.member.checkoutPlan({plan:a,tierId:r,cadence:o,offerId:i,metadata:{checkoutType:"upgrade"}})}catch{return{action:"checkoutPlan:failed",popupNotification:le({type:"checkoutPlan:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:f("Failed to process checkout, please try again")})}}}async function az({data:e,state:t,api:n}){try{const{plan:a,planId:i,subscriptionId:r,cancelAtPeriodEnd:o}=e,{tierId:s,cadence:l}=ta({site:t==null?void 0:t.site,priceId:i});await n.member.updateSubscription({planName:a,tierId:s,cadence:l,subscriptionId:r,cancelAtPeriodEnd:o,planId:i});const c=await n.member.sessionData(),m="updateSubscription:success";return{action:m,popupNotification:le({type:m,autoHide:!0,closeable:!0,state:t,status:"success",message:f("Subscription plan updated successfully")}),page:"accountHome",member:c}}catch{return{action:"updateSubscription:failed",popupNotification:le({type:"updateSubscription:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:f("Failed to update subscription, please try again")})}}}async function iz({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()}}catch{return{action:"cancelSubscription:failed",popupNotification:le({type:"cancelSubscription:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:f("Failed to cancel subscription, please try again")})}}}async function rz({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()}}catch{return{action:"continueSubscription:failed",popupNotification:le({type:"continueSubscription:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:f("Failed to cancel subscription, please try again")})}}}async function oz({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:[],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 sz({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:f("Failed to update billing information, please try again")})}}}async function lz({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:f("Failed to open billing portal, please try again")})}}}async function uz(){return{popupNotification:null}}async function cz({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 dz({data:e,state:t,api:n}){try{const{newsletters:a,enableCommentNotifications:i}=e;if(!a&&i===void 0)return{};const r={};return a&&(r.newsletters=a),i!==void 0&&(r.enableCommentNotifications=i),{action:"updateNewsletterPref:success",member:await n.member.update(r)}}catch{return{action:"updateNewsletterPref:failed",popupNotification:le({type:"updateNewsletter:failed",autoHide:!0,closeable:!0,state:t,status:"error",message:f("Failed to update newsletter settings")})}}}async function mz({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:f("You have been successfully resubscribed")})}}catch{return{action:"removeEmailFromSuppressionList:failed",popupNotification:le({type:"removeEmailFromSuppressionList:failed",autoHide:!0,closeable:!0,state:e,status:"error",message:f("Your email has failed to resubscribe, please try again")})}}}async function pz({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 r="updateNewsletter:success";return{action:r,member:i,popupNotification:le({type:r,autoHide:!0,closeable:!0,state:t,status:"success",message:f("Email newsletter settings updated")})}}catch{return{action:"updateNewsletter:failed",popupNotification:le({type:"updateNewsletter:failed",autoHide:!0,closeable:!0,state:t,status:"error",message:f("Failed to update newsletter settings")})}}}async function hz({data:e,state:t,api:n}){const{email:a}=e,i=$0({member:t.member});if(a!==i)try{return await n.member.updateEmailAddress({email:a}),{success:!0}}catch(r){return{success:!1,error:r}}return null}async function gz({data:e,state:t,api:n}){var r;const a=(r=e==null?void 0:e.name)==null?void 0:r.trim();if(P0({member:t.member})!==a)try{const o=await n.member.update({name:a});if(!o)throw new Error("Failed to update member");return{member:o,success:!0}}catch(o){return{success:!1,error:o}}return null}async function fz({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 bz({data:e,state:t,api:n}){const[a,i]=await Promise.all([gz({data:e,state:t,api:n}),hz({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:f("Check your inbox to verify email update")})};const r=a.success?f("Failed to send verification email"):f("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:r,state:t})}}else if(a){const r=a.success?"updateProfile:success":"updateProfile:failed",o=a.success?"success":"error",s=a.success?f("Account details updated successfully"):f("Failed to update account details");return{action:r,...a.success?{member:a.member}:{},...a.success?{page:"accountHome"}:{},popupNotification:le({type:r,autoHide:a.success,closeable:!0,status:o,state:t,message:s})}}else if(i){const r=i.success?"updateProfile:success":"updateProfile:failed",o=i.success?"success":"error";let s="";return i.error?s=Zt(i.error,f("Failed to send verification email")):s=f("Check your inbox to verify email update"),{action:r,...i.success?{page:"accountHome"}:{},popupNotification:le({type:r,autoHide:i.success,closeable:!0,status:o,state:t,message:s})}}return{action:"updateProfile:success",page:"accountHome",popupNotification:le({type:"updateProfile:success",autoHide:!0,closeable:!0,status:"success",state:t,message:f("Account details updated successfully")})}}async function yz({data:{siteUrl:e},state:t}){const n=Js({siteUrl:e,apiUrl:"not-defined"}),{member:a}=t,i=window.location.href,r=uy(),o=await n.member.getIntegrityToken();return await n.member.sendMagicLink({emailType:"signup",name:a.name,email:a.email,autoRedirect:!1,integrityToken:o,customUrlHistory:t.site.outbound_link_tagging?[{time:Date.now(),referrerSource:r,referrerMedium:"Ghost Recommendations",referrerUrl:i}]:[]}),{}}function kz({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 vz({data:{recommendationId:e},api:t}){return t.recommendations.trackSubscribed({recommendationId:e}),{}}const wz={togglePopup:WP,openPopup:GP,closePopup:Sk,switchPage:HP,openNotification:qP,closeNotification:JP,back:KP,signout:ZP,signin:QP,startSigninOTCFromCustomForm:XP,verifyOTC:ez,signup:tz,updateSubscription:az,cancelSubscription:iz,continueSubscription:rz,applyOffer:oz,updateNewsletter:pz,updateProfile:bz,refreshMemberData:fz,clearPopupNotification:uz,editBilling:sz,manageBilling:lz,checkoutPlan:nz,updateNewsletterPreference:dz,showPopupNotification:cz,removeEmailFromSuppressionList:mz,oneClickSubscribe:yz,trackRecommendationClicked:kz,trackRecommendationSubscribed:vz};async function Sz({action:e,data:t,state:n,api:a}){const i=wz[e];return i?await i({data:t,state:n,api:a})||{}:{}}function xk(e,t){e&&(e.innerText=t)}function xz(e,t,n){t.classList.add("error");const a=f("There was an error sending the email, please try again");xk(n,Zt(e,a))}async function Ez({event:e,form:t,errorEl:n,siteUrl:a,submitHandler:i,doAction:r,captureException:o}){var x,z;t.removeEventListener("submit",i),e.preventDefault(),n&&(n.innerText=""),t.classList.remove("success","invalid","error");let s=e.target.querySelector("input[data-members-email]"),l=e.target.querySelector("input[data-members-name]"),c=((x=t==null?void 0:t.dataset)==null?void 0:x.membersAutoredirect)||"true",m=s==null?void 0:s.value,p=((l==null?void 0:l.value)||"").trim()||void 0,d,h=[],y=[],v=e.target.querySelectorAll("input[data-members-label]")||[];for(let C=0;C<v.length;++C)h.push(v[C].value);let g=e.target.querySelectorAll("input[type=hidden][data-members-newsletter], input[type=checkbox][data-members-newsletter]:checked, input[type=radio][data-members-newsletter]:checked")||[];for(let C=0;C<g.length;++C)y.push({name:g[C].value});t.dataset.membersForm&&(d=t.dataset.membersForm);const b=d==="signin"&&((z=t==null?void 0:t.dataset)==null?void 0:z.membersOtc)==="true";t.classList.add("loading");const k=Cr(),E={email:m,emailType:d,labels:h,name:p,autoRedirect:c==="true"};b&&(E.includeOTC=!0),k&&(E.urlHistory=k),g.length>0?E.newsletters=y:(e.target.querySelectorAll("input[type=checkbox][data-members-newsletter]")||[]).length>0&&(E.newsletters=[]);try{const A=await(await fetch(`${a}/members/api/integrity-token/`,{method:"GET"})).text(),N=await fetch(`${a}/members/api/send-magic-link/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...E,integrityToken:A})});if(t.addEventListener("submit",i),t.classList.remove("loading"),N.ok){t.classList.add("success");let $;if(b)try{$=await N.clone().json()}catch{$=void 0}const H=$==null?void 0:$.otc_ref;if(H&&typeof r=="function")try{r("startSigninOTCFromCustomForm",{email:(m||"").trim(),otcRef:H,inboxLinks:$==null?void 0:$.inboxLinks})}catch(q){console.error(q),o==null||o(q)}}else{const $=await Jt.fromApiResponse(N),H=Zt($,f("Failed to send magic link email"));xk(n,H),t.classList.add("error")}}catch(C){xz(C,t,n)}}function Cz({event:e,el:t,errorEl:n,siteUrl:a,site:i,member:r,clickHandler:o}){t.removeEventListener("click",o),e.preventDefault();let s=t.dataset.membersPlan,l=f0(i,s.toLowerCase()),c=t.dataset.membersSuccess,m=t.dataset.membersCancel,p,d;c&&(p=new URL(c,window.location.href).href),m&&(d=new URL(m,window.location.href).href),n&&(n.innerText=""),t.classList.add("loading");const h=r?{checkoutType:"upgrade"}:{},y=Cr();return y&&(h.urlHistory=y),fetch(`${a}/members/api/session`,{credentials:"same-origin"}).then(function(v){return v.ok?v.text():null}).then(function(v){return fetch(`${a}/members/api/create-stripe-checkout-session/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...l,identity:v,successUrl:p,cancelUrl:d,metadata:h})}).then(function(g){if(!g.ok)throw new Error(f("Could not create Stripe checkout session"));return g.json()})}).then(function(v){return v.url?window.location.assign(v.url):window.Stripe(v.publicKey).redirectToCheckout({sessionId:v.sessionId}).then(function(b){if(b.error)throw new Error(b.error.message)})}).catch(function(v){console.error(v),t.addEventListener("click",o),t.classList.remove("loading"),n&&(n.innerText=v.message),t.classList.add("error")})}function jz({siteUrl:e,site:t={},member:n,offers:a=[],doAction:i,captureException:r}={}){if(!e)return;e=e.replace(/\/$/,""),Array.prototype.forEach.call(document.querySelectorAll("form[data-members-form]"),function(s){let l=s.querySelector("[data-members-error]");function c(m){Ez({event:m,errorEl:l,form:s,siteUrl:e,submitHandler:c,doAction:i,captureException:r})}s.addEventListener("submit",c)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-plan]"),function(s){let l=s.querySelector("[data-members-error]");function c(m){Cz({el:s,event:m,errorEl:l,member:n,site:t,siteUrl:e,clickHandler:c})}s.addEventListener("click",c)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-edit-billing]"),function(s){let l=s.querySelector("[data-members-error]"),c=s.dataset.membersSuccess,m=s.dataset.membersCancel,p,d;c&&(p=new URL(c,window.location.href).href),m&&(d=new URL(m,window.location.href).href);function h(y){s.removeEventListener("click",h),y.preventDefault(),l&&(l.innerText=""),s.classList.add("loading"),fetch(`${e}/members/api/session`,{credentials:"same-origin"}).then(function(v){return v.ok?v.text():null}).then(function(v){return fetch(`${e}/members/api/create-stripe-update-session/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:v,successUrl:p,cancelUrl:d})}).then(function(g){if(!g.ok)throw new Error(f("Could not create Stripe checkout session"));return g.json()})}).then(function(v){return window.Stripe(v.publicKey).redirectToCheckout({sessionId:v.sessionId})}).then(function(v){if(v.error)throw new Error(f(v.error.message))}).catch(function(v){console.error(v),s.addEventListener("click",h),s.classList.remove("loading"),l&&(l.innerText=v.message),s.classList.add("error")})}s.addEventListener("click",h)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-manage-billing]"),function(s){let l=s.querySelector("[data-members-error]"),c=s.dataset.membersReturn,m;c&&(m=new URL(c,window.location.href).href);function p(d){s.removeEventListener("click",p),d.preventDefault(),l&&(l.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:m})}).then(function(y){if(!y.ok)throw new Error(f("Could not create Stripe billing portal session"));return y.json()})}).then(function(h){return window.location.assign(h.url)}).catch(function(h){console.error(h),s.addEventListener("click",p),s.classList.remove("loading"),l&&(l.innerText=h.message),s.classList.add("error")})}s.addEventListener("click",p)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-signout]"),function(s){function l(c){s.removeEventListener("click",l),c.preventDefault(),s.classList.remove("error"),s.classList.add("loading"),fetch(`${e}/members/api/session`,{method:"DELETE"}).then(function(m){m.ok?window.location.replace(e):(s.addEventListener("click",l),s.classList.remove("loading"),s.classList.add("error"))})}s.addEventListener("click",l)});const o=(a||[]).some(s=>s.redemption_type==="retention");Array.prototype.forEach.call(document.querySelectorAll("[data-members-cancel-subscription]"),function(s){let l=s.parentElement.querySelector("[data-members-error]");function c(m){m.preventDefault();let p=s.dataset.membersCancelSubscription;if(o){i("openPopup",{page:"accountPlan",pageData:{subscriptionId:p,action:"cancel"}});return}return s.removeEventListener("click",c),s.classList.remove("error"),s.classList.add("loading"),l&&(l.innerText=""),fetch(`${e}/members/api/session`,{credentials:"same-origin"}).then(function(d){return d.ok?d.text():null}).then(function(d){return fetch(`${e}/members/api/subscriptions/${p}/`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:d,smart_cancel:!0})})}).then(function(d){d.ok?window.location.reload():(s.addEventListener("click",c),s.classList.remove("loading"),s.classList.add("error"),l&&(l.innerText=f("There was an error cancelling your subscription, please try again.")))})}s.addEventListener("click",c)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-continue-subscription]"),function(s){let l=s.parentElement.querySelector("[data-members-error]");function c(m){s.removeEventListener("click",c),m.preventDefault(),s.classList.remove("error"),s.classList.add("loading");let p=s.dataset.membersContinueSubscription;return l&&(l.innerText=""),fetch(`${e}/members/api/session`,{credentials:"same-origin"}).then(function(d){return d.ok?d.text():null}).then(function(d){return fetch(`${e}/members/api/subscriptions/${p}/`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:d,cancel_at_period_end:!1})})}).then(function(d){d.ok?window.location.reload():(s.addEventListener("click",c),s.classList.remove("loading"),s.classList.add("error"),l&&(l.innerText=f("There was an error continuing your subscription, please try again.")))})}s.addEventListener("click",c)})}const $z={showPopup:!0,site:ti,member:Fr.free,page:"accountEmail",...BP(),pageData:wk};function Tz({site:e,children:t}){const{portal_sentry:n}=e||{};return n&&n.dsn?u.jsx(Jc,{children:t}):u.jsx(u.Fragment,{children:t})}class Pz extends Z.Component{constructor(t){super(t),this.setupCustomTriggerButton(),this.state={site:null,member:null,offers:[],page:"loading",showPopup:!1,action:"init:running",actionErrorMessage:null,initStatus:"running",lastPage:null,customSiteUrl:t.customSiteUrl,locale:t.locale,scrollbarWidth:0}}componentDidMount(){const t=this.getScrollbarWidth();this.setState({scrollbarWidth:t}),this.initSetup()}componentDidUpdate(t,n){var a,i,r;if(n.showPopup!==this.state.showPopup){this.handleCustomTriggerClassUpdate();try{this.state.showPopup?(this.bodyScroll=(r=(i=(a=window.document)==null?void 0:a.body)==null?void 0:i.style)==null?void 0:r.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)}catch{}}if(this.state.initStatus==="success"&&n.initStatus!==this.state.initStatus){const{siteUrl:o}=this.props,s=this.getContextFromState();this.sendPortalReadyEvent(),jz({siteUrl:o,site:s.site,member:s.member,offers:s.offers,doAction:s.doAction,captureException:ss})}}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=a=>{a.preventDefault();const i=a.currentTarget,r=i&&i.dataset.portal,{page:o,pageQuery:s,pageData:l}=this.getPageFromLinkPath(r)||{};this.state.initStatus==="success"&&(s&&s!=="free"?this.handleSignupQuery({site:this.state.site,pageQuery:s}):this.dispatchAction("openPopup",{page:o,pageQuery:s,pageData:l}))};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 r=this.state.showPopup?t:n,o=this.state.showPopup?n:t;i.classList.add(r),i.classList.remove(o)})}async initSetup(){try{const{site:t,member:n,offers:a,page:i,showPopup:r,popupNotification:o,lastPage:s,pageQuery:l,pageData:c}=await this.fetchData(),m=this.props.siteI18nEnabled&&(this.props.locale||t.locale)||"en";zs.changeLanguage(m);const p={site:t,member:n,offers:a,page:i,lastPage:s,pageQuery:l,showPopup:r,pageData:c,popupNotification:o,dir:zs.dir()||"ltr",action:"init:success",initStatus:"success",locale:m};if(this.handleSignupQuery({site:t,pageQuery:l,member:n}),this.setState(p),this.hashHandler=()=>{this.updateStateForPreviewLinks()},window.addEventListener("hashchange",this.hashHandler,!1),!n){const d=document.querySelectorAll("[data-lexical-signup-form]");d.length>0&&d.forEach(h=>{h.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,...r}=this.fetchDevData(),{site:o,...s}=this.fetchLinkData(t,n),{site:l,...c}=this.fetchPreviewData(),{site:m,...p}=this.fetchNotificationData();return{member:n,offers:a,page:"",site:{...t,...o,...l,...m,...i,plans:{...(i||{}).plans,...(t||{}).plans,...(l||{}).plans}},...r,...s,...p,...c}}fetchDevData(){return de(["dev"])&&!this.state.customSiteUrl?$z:de(["test"])?{showPopup:this.props.showPopup!==void 0?this.props.showPopup:!0}:{}}fetchOfferQueryStrData(t=""){var i,r,o;const n=new URLSearchParams(t),a={};for(let s of n.entries()){const l=s[0],c=decodeURIComponent(s[1]);l==="name"?a.name=c||"":l==="code"?a.code=c||"":l==="display_title"?a.display_title=c||"":l==="display_description"?a.display_description=c||"":l==="type"?a.type=c||"":l==="cadence"?a.cadence=c||"":l==="duration"?a.duration=c||"":l==="duration_in_months"&&!isNaN(Number(c))?a.duration_in_months=Number(c):l==="amount"&&!isNaN(Number(c))?a.amount=Number(c):l==="currency"?a.currency=c||"":l==="status"?a.status=c||"":l==="tier_id"?a.tier={id:c||wk.tier.id}:l==="redemption_type"&&(a.redemption_type=c||"signup")}if(a.redemption_type==="retention"){const s=(o=(r=(i=Fr.preview)==null?void 0:i.subscriptions)==null?void 0:r[0])==null?void 0:o.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 r,o=null,s,l,c;for(let m of n.entries()){const p=m[0],d=decodeURIComponent(m[1]);if(p==="button")a.site.portal_button=JSON.parse(d);else if(p==="name")a.site.portal_name=JSON.parse(d);else if(p==="isFree"&&JSON.parse(d))i.push("free");else if(p==="isMonthly"&&JSON.parse(d))i.push("monthly");else if(p==="isYearly"&&JSON.parse(d))i.push("yearly");else if(p==="portalPrices")r=d?d.split(","):[];else if(p==="portalProducts")o=d?d.split(","):[];else if(p==="page"&&d)a.page=d;else if(p==="accentColor"&&(d===""||d))a.site.accent_color=d;else if(p==="buttonIcon"&&d)a.site.portal_button_icon=d;else if(p==="signupButtonText")a.site.portal_button_signup_text=d||"";else if(p==="signupTermsHtml")a.site.portal_signup_terms_html=d||"";else if(p==="signupCheckboxRequired")a.site.portal_signup_checkbox_required=JSON.parse(d);else if(p==="buttonStyle"&&d)a.site.portal_button_style=d;else if(p==="monthlyPrice"&&!isNaN(Number(d)))a.site.plans.monthly=Number(d),s=Number(d);else if(p==="yearlyPrice"&&!isNaN(Number(d)))a.site.plans.yearly=Number(d),l=Number(d);else if(p==="currency"&&d){const h=d.toUpperCase();a.site.plans.currency=h,a.site.plans.currency_symbol=ve(h),c=h}else p==="disableBackground"?a.site.disableBackground=JSON.parse(d):p==="membersSignupAccess"&&d?a.site.members_signup_access=d:p==="portalDefaultPlan"&&d?a.site.portal_default_plan=d:p==="transistorPortalSettings"&&d&&(a.site.transistor_portal_settings=JSON.parse(d))}return a.site.portal_plans=i,a.site.portal_products=o,r?a.site.portal_plans=r:s&&l&&c&&(a.site.prices=[{id:"monthly",stripe_price_id:"dummy_stripe_monthly",stripe_product_id:"dummy_stripe_product",active:1,nickname:"Monthly",currency:c,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:c,amount:l,type:"recurring",interval:"year"}]),a}fetchNotificationData(){const{type:t,status:n,duration:a,autoHide:i,closeable:r}=Sy({billingOnly:!0})||{};return["stripe:billing-update"].includes(t)?n==="success"?{showPopup:!0,popupNotification:le({type:t,status:n,duration:a,closeable:r,autoHide:i,state:this.state,message:n==="success"?"Billing info updated successfully":""})}:{showPopup:!0}:{}}fetchLinkData(t,n){const a=new URLSearchParams(window.location.search);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(k0({site:t})&&a.get("action")==="signup"&&a.get("success")==="true")return{showPopup:!0,page:"recommendations",pageData:{signup:!0}};const[i,r]=window.location.hash.substr(1).split("?"),o=new URLSearchParams(r??""),s=/^(?:(\w+?))?\/monthly$/,l=/^(?:(\w+?))?\/yearly$/,c=/^offers\/(\w+?)\/?$/,m=/^\/portal\/?(?:\/(\w+(?:\/\w+)*))?\/?$/,p=/^\/feedback\/(\w+?)\/(\w+?)\/?$/;if(i&&p.test(i)){const[,d,h]=i.match(p),y=parseInt(h);if(y===1||y===0)return n||o.get("uuid")&&o.get("key")?{showPopup:!0,page:"feedback",pageData:{uuid:n?null:o.get("uuid"),key:n?null:o.get("key"),postId:d,score:y}}:{showPopup:!0,page:"signin",pageData:{redirect:t.url+`#/feedback/${d}/${y}/`}}}if(i&&m.test(i)){const[,d]=i.match(m),{page:h,pageQuery:y,pageData:v}=this.getPageFromLinkPath(d,t)||{};if(!n&&h&&gk({page:h}))return{showPopup:!0,page:"signin",pageData:{redirect:t.url+`#/portal/${d}/`}};const g=["accountPlan","accountProfile"].includes(h)?"accountHome":null;return{showPopup:!(["monthly","yearly"].includes(y)||s.test(y)||l.test(y)||c.test(y)),...h?{page:h}:{},...y?{pageQuery:y}:{},...v?{pageData:v}:{},...g?{lastPage:g}:{}}}return{}}fetchPreviewData(){const[,t]=window.location.hash.substr(1).split("?");if(de(["preview"])){let n={};return de(["offerPreview"])?n=this.fetchOfferQueryStrData(t):n=this.fetchQueryStrData(t),{...n,showPopup:!0}}return{}}getColorOverride(){const t=document.querySelector("script[data-ghost]");return t&&t.dataset.accentColor?t.dataset.accentColor:!1}async fetchApiData(){const{siteUrl:t,customSiteUrl:n,apiUrl:a,apiKey:i}=this.props;try{this.GhostApi=this.props.api||Js({siteUrl:t,apiUrl:a,apiKey:i});const{site:r,member:o,offers:s}=await this.GhostApi.init(),l=this.getColorOverride();return l&&(r.accent_color=l),this.setupFirstPromoter({site:r,member:o}),this.setupSentry({site:r}),{site:r,member:o,offers:s}}catch(r){if(de(["dev","test"],{customSiteUrl:n}))return{};throw r}}setupSentry({site:t}){if(de(["test"]))return null;const{portal_sentry:n,portal_version:a,version:i}=t,o=`portal@2.64.14|ghost@${i}`;n&&n.dsn&&Gj({dsn:n.dsn,environment:n.env||"development",release:o,beforeSend:s=>c0({event:s})?s:null,allowUrls:[/https?:\/\/((www)\.)?unpkg\.com\/@tryghost\/portal/]})}setupFirstPromoter({site:t,member:n}){if(de(["test"]))return null;const a=T0({site:t});let i=bd({site:t});if(i=i==null?void 0:i.replace(/^(\S*\.)?(\S*\.\S*)$/i,".$2"),a&&i){const r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src="https://cdn.firstpromoter.com/fprom.js",r.onload=r.onreadystatechange=function(){let s=this.readyState;if(!s||s==="complete"||s==="loaded")try{if(window.$FPROM.init(a,i),_0({member:n})){const l=n.email,c=n.uuid;if(window.$FPROM)window.$FPROM.trackSignup({email:l,uid:c});else{const m=window._fprom||[];window._fprom=m,m.push(["event","signup"]),m.push(["email",l]),m.push(["uid",c])}}}catch{}};const o=document.getElementsByTagName("script")[0];o.parentNode.insertBefore(r,o)}}async dispatchAction(t,n){clearTimeout(this.timeoutId),this.setState({action:`${t}:running`,actionErrorMessage:null});try{const a=await Sz({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:Zt(a,f("An unexpected error occured. Please try again or <a>contact support</a> if the error persists.")),popupNotification:i})}}updateStateForPreviewLinks(){const{site:t,...n}=this.fetchPreviewData(),{site:a,...i}=this.fetchLinkData(this.state.site,this.state.member),r={site:{...this.state.site,...a||{},...t||{},plans:{...this.state.site&&this.state.site.plans,...(a||{}).plans,...(t||{}).plans}},...i,...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(dd(),!Mt({member:a})||Tn({member:a}))try{const r=await this.GhostApi.site.offer({offerId:n}),o=r==null?void 0:r.offers[0];if(!o||!o.tier||fy({offer:o})||!I0({site:t,offer:o}))return;if(i)this.dispatchAction("openPopup",{page:"offer",pageData:r==null?void 0:r.offers[0]});else{const s=Xn({site:t,productId:o.tier.id}),l=o.cadence==="month"?s.monthlyPrice:s.yearlyPrice;if(this.dispatchAction("openPopup",{page:"loading"}),a){const{tierId:c,cadence:m}=ta({site:t,priceId:l.id});this.dispatchAction("checkoutPlan",{plan:l.id,offerId:n,tierId:c,cadence:m})}else{const{tierId:c,cadence:m}=ta({site:t,priceId:l.id});this.dispatchAction("signup",{plan:l.id,offerId:n,tierId:c,cadence:m})}}}catch{}}handleSignupQuery({site:t,pageQuery:n,member:a}){const i=/^offers\/(\w+?)\/?$/;let r=n;if(i.test(n||"")){const[,s]=n.match(i);this.handleOfferQuery({site:t,offerId:s,member:a});return}hy({site:t,pageQuery:n})&&(r=hy({site:t,pageQuery:n}));const o=b0({site:t,priceId:r});if(n&&n!=="free"){dd();const s=(o==null?void 0:o.id)||r;s!=="free"&&this.dispatchAction("openPopup",{page:"loading"});const{tierId:l,cadence:c}=ta({site:t,priceId:s});this.dispatchAction("signup",{plan:s,tierId:l,cadence:c})}}getPageFromLinkPath(t){const n=/^signup\/?(?:\/(\w+?))?\/?$/,a=/^signup\/?(?:\/(\w+?))\/monthly\/?$/,i=/^signup\/?(?:\/(\w+?))\/yearly\/?$/,r=/^offers\/(\w+?)\/?$/;if(t===void 0||t==="")return{page:"default"};if(r.test(t))return{pageQuery:t};if(t==="signup")return{page:"signup"};if(a.test(t)){const[,o]=t.match(a);return{page:"signup",pageQuery:`${o}/monthly`}}else if(i.test(t)){const[,o]=t.match(i);return{page:"signup",pageQuery:`${o}/yearly`}}else if(n.test(t)){const[,o]=t.match(n);return{page:"signup",pageQuery:o}}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==="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 g1(t)}getContextPage({site:t,page:n,member:a}){if(!n||n==="default"){const i=Dt({site:t})||!Xt({site:t})?"signin":"signup";n=a?"accountHome":i}return nm({page:n})}getContextMember({page:t,member:n,customSiteUrl:a}){return de(["dev","preview"],{customSiteUrl:a})?gk({page:t})||DP({page:t})?de(["dev"],{customSiteUrl:a})?n||Fr.free:de(["preview"])?Fr.preview:Fr.paid:null:n}getContextFromState(){const{site:t,member:n,offers:a,action:i,actionErrorMessage:r,page:o,lastPage:s,showPopup:l,pageQuery:c,pageData:m,popupNotification:p,customSiteUrl:d,dir:h,scrollbarWidth:y,otcRef:v,inboxLinks:g}=this.state,b=this.getContextPage({site:t,page:o,member:n}),k=this.getContextMember({page:b,member:n,customSiteUrl:d});return{api:this.GhostApi,site:t,offers:a,action:i,actionErrorMessage:r,brandColor:this.getAccentColor(),page:b,pageQuery:c,pageData:m,member:k,lastPage:s,showPopup:l,popupNotification:p,customSiteUrl:d,dir:h,scrollbarWidth:y,otcRef:v,inboxLinks:g,doAction:(E,x)=>this.dispatchAction(E,x)}}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"]').forEach(VP)}render(){return this.state.initStatus==="success"?u.jsx(Tz,{site:this.state.site,children:u.jsxs(_.Provider,{value:this.getContextFromState(),children:[u.jsx(im,{}),u.jsx(wd,{}),u.jsx($d,{})]})}):null}}const Ek="ghost-portal-root";function zz(){const e=document.createElement("div");e.id=Ek,e.setAttribute("data-testid","portal-root"),document.body.appendChild(e)}function Nz(){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,r=e.dataset.locale;return{siteUrl:n,apiKey:a,apiUrl:i,siteI18nEnabled:t,locale:r}}return{}}function Az(){const e=new URL(window.location.href);e.searchParams.get("token")&&(e.searchParams.delete("token"),window.history.replaceState({},document.title,e.href))}function Iz(){const{siteUrl:e,apiKey:t,apiUrl:n,siteI18nEnabled:a,locale:i}=Nz(),r=e||window.location.origin;zz(),Az(),nS.render(u.jsx(Z.StrictMode,{children:u.jsx(Pz,{siteUrl:r,customSiteUrl:e,apiKey:t,apiUrl:n,siteI18nEnabled:a,locale:i})}),document.getElementById(Ek))}Iz()});
3553
+ `;function oP({site:e}){return cd+aP+Z0+PT+RT+fT()+J0+W0+q0+iy+T1+b1+A1()+Sd+P1+iP+rP+M1+Y1+U1+B1+H1+K1+Z1+tP}const fm=class fm extends Z.Component{constructor(t){super(t),this.state={email:"",token:void 0}}componentDidMount(){const{member:t}=this.context;t&&this.context.doAction("switchPage",{page:"accountHome"})}handleSignin(t){t.preventDefault(),this.doSignin()}doSignin(){this.setState(t=>({errors:Ws({fields:this.getInputFields({state:t})})}),async()=>{const{email:t,phonenumber:n,errors:a,token:i}=this.state,{redirect:r}=this.context.pageData??{};a&&Object.values(a).filter(s=>!!s).length>0||this.context.doAction("signin",{email:t,phonenumber:n,redirect:r,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:f("jamie@example.com"),label:f("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=f(a?"Sending login link...":"Continue");const r=!!a;return t==="signin:failed"&&(i=f("Retry"),n=!0),u.jsx(ge,{dataTestId:"signin",retry:n,style:{width:"100%"},onClick:o=>this.handleSignin(o),disabled:r,brandColor:this.context.brandColor,label:i,isRunning:a})}renderSignupMessage(){const{brandColor:t}=this.context;return u.jsxs("div",{className:"gh-portal-signup-message",children:[u.jsx("div",{children:f("Don't have an account?")}),u.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:u.jsx("span",{children:f("Sign up")})})]})}renderForm(){const{site:t}=this.context,n=As({site:t})&&Xt({site:t});return Pn({site:t})?u.jsxs("section",{children:[u.jsx("div",{className:"gh-portal-section",children:u.jsx(Hs,{fields:this.getInputFields({state:this.state}),onChange:(a,i)=>this.handleInputChange(a,i),onKeyDown:(a,i)=>this.onKeyDown(a,i)})}),u.jsxs("footer",{className:"gh-portal-signin-footer",children:[this.renderSubmitButton(),n&&this.renderSignupMessage()]})]}):u.jsx("section",{children:u.jsx("div",{className:"gh-portal-section",children:u.jsx("p",{className:"gh-portal-members-disabled-notification","data-testid":"members-disabled-notification-text",children:f("Memberships unavailable, contact the owner for access.")})})})}renderSiteIcon(){const{site:t}=this.context,n=t.icon;return n?u.jsx("img",{className:"gh-portal-signup-logo",src:n,alt:this.context.site.title}):Pn({site:t})?null:u.jsx(By,{className:"gh-portal-icon gh-portal-icon-invitation"})}renderSiteTitle(){const{site:t}=this.context,n=t.title;return Pn({site:t})?u.jsx("h1",{className:"gh-portal-main-title",children:f("Sign in")}):u.jsx("h1",{className:"gh-portal-main-title",children:n})}renderFormHeader(){return u.jsxs("header",{className:"gh-portal-signin-header",children:[this.renderSiteIcon(),this.renderSiteTitle()]})}render(){return u.jsxs(u.Fragment,{children:[u.jsx(we,{}),u.jsx("div",{className:"gh-portal-logged-out-form-container",children:u.jsxs("div",{className:"gh-portal-content signin",children:[this.renderFormHeader(),this.renderForm()]})})]})}};fm.contextType=_;let Qd=fm;const sP=({handleSignout:e,supportAddress:t=""})=>{const n=`mailto:${t}`;return u.jsxs("footer",{className:"gh-portal-account-footer",children:[u.jsx("ul",{className:"gh-portal-account-footermenu",children:u.jsx("li",{children:u.jsx("button",{"data-test-button":"footer-signout",className:"gh-portal-btn",name:"logout","aria-label":"logout",onClick:a=>e(a),children:f("Sign out")})})}),u.jsx("div",{className:"gh-portal-account-footerright",children:u.jsx("ul",{className:"gh-portal-account-footermenu",children:u.jsx("li",{children:u.jsx("a",{"data-test-link":"footer-support",className:"gh-portal-btn gh-portal-btn-branded",href:n,onClick:()=>{n&&window.open(n)},children:f("Contact support")})})})})]})},lP=()=>{const{member:e,brandColor:t}=w.useContext(_),n=e.avatar_image;return u.jsxs("header",{className:"gh-portal-account-header",children:[u.jsx(ud,{gravatar:n,style:{userIcon:{color:t,width:"56px",height:"56px",padding:"2px"}}}),u.jsx("h2",{className:"gh-portal-main-title",children:f("Your account")})]})},uP=()=>{const{site:e,action:t,brandColor:n,doAction:a}=w.useContext(_);if(!As({site:e})||!Xt({site:e}))return null;const i=["checkoutPlan:running"].includes(t),r=()=>{a("switchPage",{page:"accountPlan",lastPage:"accountHome"})};return u.jsx(ge,{dataTestId:"view-plans",isRunning:i,label:f("View plans"),onClick:()=>r(),brandColor:n,style:{width:"100%"}})},cP=()=>{const{member:e,site:t}=w.useContext(_),{is_stripe_configured:n}=t;if(!n||qa({site:t}))return null;const a=ot({member:e}),i=Tn({member:e});if(i&&!a)return null;if(a){const r=a==null?void 0:a.current_period_end;if(i&&md({member:e})){const o=md({member:e}),s=Qt(o);return u.jsx("div",{className:"gh-portal-section",children:u.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:f("Your subscription will expire on {expiryDate}",{expiryDate:s})})})}if(a!=null&&a.cancel_at_period_end||i)return null;if(gd({sub:a})){const o=Qt(a.trial_end_at);return u.jsx("div",{className:"gh-portal-section",children:u.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:f("Your subscription will start on {subscriptionStart}",{subscriptionStart:o})})})}return u.jsx("div",{className:"gh-portal-section",children:u.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:f("Your subscription will renew on {renewalDate}",{renewalDate:Qt(r)})})})}return u.jsxs("div",{className:"gh-portal-section",children:[u.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:f("You currently have a free membership, upgrade to a paid subscription for full access.")}),u.jsx(uP,{})]})},dP=()=>{const{member:e,doAction:t,action:n,brandColor:a}=w.useContext(_),i=ot({member:e});if(!i||!i.cancel_at_period_end)return null;const r=i.cancel_at_period_end?f("Continue subscription"):f("Cancel subscription"),o=["cancelSubscription:running"].includes(n),s=!!o,l=!!i.cancel_at_period_end,c=()=>{if(!i.cancel_at_period_end)return null;const m=i.current_period_end;return u.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:f("Your subscription will expire on {expiryDate}",{expiryDate:Qt(m)})})};return u.jsxs("div",{className:"gh-portal-cancelcontinue-container",children:[u.jsx(c,{}),u.jsx(ge,{onClick:()=>{t("continueSubscription",{subscriptionId:i.id})},isRunning:o,disabled:s,isPrimary:l,brandColor:a,label:r,style:{width:"100%"}})]})},mP=e=>w.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},w.createElement("defs",null,w.createElement("style",null,".a{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.5px;}")),w.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"}),w.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"})),pP=()=>{const{member:e,site:t,doAction:n}=w.useContext(_),a=()=>{const d=ot({member:e});n("manageBilling",{subscriptionId:d.id})},i=()=>{const{is_stripe_configured:d}=t;d&&n("switchPage",{page:"accountPlan",lastPage:"accountHome"})},r=({price:d,isComplimentary:h,subscription:y})=>{const{next_payment:v}=y||{};let g="";if(d){const{amount:C=0,currency:A,interval:N}=d;g=`${Intl.NumberFormat("en",{currency:A,style:"currency"}).format(C/100)}/${f(N)}`}const b=md({member:e});h&&(b?g=`${f("Complimentary")} - ${f("Expires {expiryDate}",{expiryDate:b})}`:g=g?`${f("Complimentary")} (${g})`:f("Complimentary"));let k="";if(gd({sub:y}))return k="gh-portal-account-old-price",u.jsxs(u.Fragment,{children:[u.jsx("p",{className:k,children:g}),u.jsx(hP,{subscription:y})]});let x=gP({nextPayment:v});x&&(k="gh-portal-account-old-price");const z=()=>x?u.jsxs("p",{className:"gh-portal-account-discountcontainer","data-testid":"offer-label",children:[u.jsx(mP,{className:"gh-portal-account-tagicon"}),u.jsx("span",{children:x})]}):null;return u.jsxs(u.Fragment,{children:[u.jsx("p",{className:k,children:g}),u.jsx(z,{})]})},o=({isPaid:d})=>qa({site:t})&&!d?null:u.jsx("button",{className:"gh-portal-btn gh-portal-btn-list",onClick:h=>i(),"data-test-button":"change-plan",children:f("Change")}),s=({defaultCardLast4:d})=>{if(d){const h=`**** **** **** ${d}`;return u.jsx("p",{children:h})}return null},l=({defaultCardLast4:d,isComplimentary:h})=>{const{action:y}=w.useContext(_),v=y==="manageBilling:running"?u.jsx(Ja,{className:"gh-portal-billing-button-loader"}):f("Update");return h?null:u.jsxs("section",{children:[u.jsxs("div",{className:"gh-portal-list-detail",children:[u.jsx("h3",{children:f("Billing info & receipts")}),u.jsx(s,{defaultCardLast4:d})]}),u.jsx("button",{className:"gh-portal-btn gh-portal-btn-list",onClick:g=>a(),"data-test-button":"manage-billing",children:v})]})},c=ot({member:e}),m=Tn({member:e}),p=Mt({member:e});if(c||m){const{price:d,default_payment_card_last4:h}=c||{};let y=f("Plan");return Is({site:t})&&ly({member:e})&&(y=ly({member:e})),u.jsxs(u.Fragment,{children:[u.jsxs("section",{children:[u.jsxs("div",{className:"gh-portal-list-detail",children:[u.jsx("h3",{children:y}),u.jsx(r,{price:d,isComplimentary:m,subscription:c})]}),u.jsx(o,{isPaid:p})]}),u.jsx(l,{isComplimentary:m,defaultCardLast4:h})]})}return null};function hP({subscription:e}){if(gd({sub:e})){const t=Qt(e.trial_end_at);return u.jsx("p",{className:"gh-portal-account-discountcontainer",children:u.jsx("div",{children:u.jsx("span",{children:f("Free Trial – Ends {trialEnd}",{trialEnd:t})})})})}return null}function gP({nextPayment:e}){if(!e)return"";const t=e.discount;if(!t)return"";let n="";t.duration==="forever"?n=f("Forever"):t.duration==="once"?n=f("Next payment"):t.duration==="repeating"&&t.end&&(n=f("Ends {offerEndDate}",{offerEndDate:Qt(t.end)}));const a=Intl.NumberFormat("en",{currency:e.currency,style:"currency"}).format(e.amount/100);let i="";return t.duration==="once"?i=a:i=`${a}/${e.interval}`,`${i}${n?` — ${n}`:""}`}function fP(){const{member:e,site:t,doAction:n}=w.useContext(_);let{newsletters:a}=e;const i=!!(a!=null&&a.length);let r=f(i?"Subscribed":"Unsubscribed");const o=s=>{var m;s.preventDefault();const l=ea({site:t}),c=(m=e==null?void 0:e.newsletters)!=null&&m.length?[]:l;n("updateNewsletterPreference",{newsletters:c})};return u.jsxs("section",{children:[u.jsxs("div",{className:"gh-portal-list-detail email-newsletter",children:[u.jsx("h3",{children:f("Email newsletter")}),u.jsxs("p",{children:[r," ",fd({member:e})&&i&&u.jsx("button",{className:"gh-portal-btn-text gh-email-faq-page-button",onClick:()=>n("switchPage",{page:"emailReceivingFAQ",lastPage:"accountHome"}),children:f("Not receiving emails?")})]})]}),u.jsx("div",{children:u.jsx(Us,{dataTestId:"default-newsletter-toggle",id:"default-newsletter-toggle",onToggle:s=>{o(s)},checked:i})})]})}const mk=e=>w.createElement("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",...e},w.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"}),w.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 bP(){return u.jsxs("p",{className:"gh-portal-email-notice",children:[u.jsx(mk,{className:"gh-portal-email-notice-icon"}),u.jsx("span",{className:"gh-mobile-only",children:f("You're not receiving emails")}),u.jsx("span",{className:"gh-desktop-only",children:f("You're currently not receiving emails")})]})}function yP(){const{doAction:e,member:t,site:n}=w.useContext(_),a=dy({member:t}),i=wr({site:n}),r=Ms({site:n}),o=a?"emailSuppressed":"accountEmail",s=!i&&!r,l=()=>a||s?u.jsx(bP,{}):u.jsx("p",{children:f("Update your preferences")});return u.jsxs("section",{children:[u.jsxs("div",{className:"gh-portal-list-detail",children:[u.jsx("h3",{children:f("Emails")}),l()]}),u.jsx("button",{className:"gh-portal-btn gh-portal-btn-list",onClick:()=>{e("switchPage",{page:o,lastPage:"accountHome"})},"data-test-button":"manage-newsletters",children:f("Manage")})]})}const kP=()=>{const{member:e,site:t}=w.useContext(_),a=t.transistor_portal_settings||{enabled:t.transistor_portal_enabled===!0,heading:t.transistor_portal_heading,description:t.transistor_portal_description,button_text:t.transistor_portal_button_text,url_template:t.transistor_portal_url_template},i=(a==null?void 0:a.enabled)===!0,r=e==null?void 0:e.uuid,o=by(),[s,l]=w.useState(o&&i);return w.useEffect(()=>{if(o){l(i);return}if(!i||!r){l(!1);return}l(!1);const c=new AbortController;return(async()=>{try{const p=await fetch(`https://partner.transistor.fm/ghost/member/${r}`,{signal:c.signal});if(p.ok){const d=await p.json();c.signal.aborted||l((d==null?void 0:d.member)===!0)}}catch(p){if(c.signal.aborted)return;console.warn("Error in Transistor request",p)}})(),()=>c.abort()},[i,r,o]),{transistor:{enabled:i,hasPodcasts:s,memberUuid:r,settings:a}}},vP=(e,t)=>xr({site:e})&&wr({site:e})||Ms({site:e})||dy({member:t}),wP=e=>!xr({site:e})&&wr({site:e})&&!Ms({site:e}),SP=()=>{const{member:e,doAction:t,site:n}=w.useContext(_),{name:a,email:i}=e,{transistor:r}=kP(),o=()=>{t("switchPage",{page:"accountProfile",lastPage:"accountHome"})},s=vP(n,e),l=wP(n);return u.jsx("div",{children:u.jsxs("div",{className:"gh-portal-list",children:[u.jsxs("section",{children:[u.jsxs("div",{className:"gh-portal-list-detail",children:[u.jsx("h3",{children:a||f("Account")}),u.jsx("p",{children:i})]}),u.jsx("button",{"data-test-button":"edit-profile",className:"gh-portal-btn gh-portal-btn-list",onClick:c=>o(),children:f("Edit")})]}),u.jsx(pP,{}),s&&u.jsx(yP,{}),l&&u.jsx(fP,{}),r.enabled&&u.jsx(nP,{hasPodcasts:r.hasPodcasts,memberUuid:r.memberUuid,settings:r.settings})]})})},xP=()=>u.jsxs("div",{className:"gh-portal-content gh-portal-account-main",children:[u.jsx(we,{}),u.jsx(lP,{}),u.jsxs("section",{className:"gh-portal-account-data",children:[u.jsx(cP,{}),u.jsx(dP,{}),u.jsx(SP,{})]})]}),bm=class bm extends Z.Component{componentDidMount(){const{member:t,site:n}=this.context;Pn({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=Er({site:n});return!t||!Pn({site:n})?null:u.jsxs("div",{className:"gh-portal-account-wrapper",children:[u.jsx(xP,{}),u.jsx(sP,{onClose:()=>this.context.doAction("closePopup"),handleSignout:i=>this.handleSignout(i),supportAddress:a})]})}};bm.contextType=_;let Xd=bm;const ym=class ym extends Z.Component{constructor(t,n){super(t,n);const{name:a="",email:i=""}=n.member||{};this.state={name:a,email:i}}componentDidMount(){const{member:t}=this.context;t||this.context.doAction("switchPage",{page:"signin"})}handleSignout(t){t.preventDefault(),this.context.doAction("signout")}onBack(){this.context.doAction("back")}onProfileSave(t){t.preventDefault(),this.setState(n=>({errors:Ws({fields:this.getInputFields({state:n})})}),()=>{const{email:n,name:a,errors:i}=this.state;i&&Object.values(i).filter(o=>!!o).length>0||(this.context.doAction("clearPopupNotification"),this.context.doAction("updateProfile",{email:n,name:a}))})}renderSaveButton(){const t=this.context.action==="updateProfile:running";let n=f("Save");this.context.action==="updateProfile:failed"&&(n=f("Retry"));const a=!!t;return u.jsx(ge,{dataTestId:"save-button",isRunning:t,onClick:i=>this.onProfileSave(i),disabled:a,brandColor:this.context.brandColor,label:n,style:{width:"100%"}})}renderDeleteAccountButton(){return u.jsx("div",{style:{cursor:"pointer",color:"red"},role:"button",children:f("Delete account")})}renderAccountFooter(){return u.jsx("footer",{className:"gh-portal-action-footer",children:this.renderSaveButton()})}renderHeader(){return u.jsxs("header",{className:"gh-portal-detail-header",children:[u.jsx(Za,{brandColor:this.context.brandColor,hidden:!this.context.lastPage,onClick:t=>this.onBack(t)}),u.jsx("h3",{className:"gh-portal-main-title",children:f("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 u.jsx("div",{style:n,children:u.jsx(ud,{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:f("Jamie Larson"),label:f("Name"),name:"name",required:!1,errorMessage:a.name||""},{type:"email",value:t.email,placeholder:f("jamie@example.com"),label:f("Email"),name:"email",required:!0,errorMessage:a.email||""}];return n&&n.length>0?i.filter(r=>n.includes(r.name)):i}onKeyDown(t){t.keyCode===13&&this.onProfileSave(t)}renderProfileData(){return u.jsx("div",{className:"gh-portal-section",children:u.jsx(Hs,{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?u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"gh-portal-content with-footer",children:[u.jsx(we,{}),this.renderHeader(),u.jsx("div",{className:"gh-portal-section",children:this.renderProfileData()})]}),this.renderAccountFooter()]}):null}};ym.contextType=_;let em=ym;function EP(){const{brandColor:e,lastPage:t,doAction:n}=w.useContext(_);return u.jsxs("header",{className:"gh-portal-detail-header",children:[u.jsx(Za,{brandColor:e,hidden:!t,onClick:()=>{n("back")}}),u.jsx("h3",{className:"gh-portal-main-title",children:f("Email preferences")})]})}function CP({newsletter:e,subscribedNewsletters:t,setSubscribedNewsletters:n}){const a=t.some(i=>i.id===(e==null?void 0:e.id));return u.jsxs("section",{className:"gh-portal-list-toggle-wrapper","data-testid":"toggle-wrapper",children:[u.jsxs("div",{className:"gh-portal-list-detail",children:[u.jsx("h3",{children:e.name}),u.jsx("p",{children:e==null?void 0:e.description})]}),u.jsx("div",{style:{display:"flex",alignItems:"center"},children:u.jsx(Us,{id:e.id,onToggle:(i,r)=>{let o=[];r?o=t.filter(s=>s.id!==e.id).concat(e):o=t.filter(s=>s.id!==e.id),n(o)},checked:a,dataTestId:"switch-input"})})]})}function jP({updateCommentNotifications:e,isCommentsEnabled:t,enableCommentNotifications:n}){const{doAction:a}=w.useContext(_),i=!!n;if(!t)return null;const r=async(o,s)=>{await e(s),a("showPopupNotification",{action:"updated:success",message:f("Comment preferences updated.")})};return u.jsxs("section",{className:"gh-portal-list-toggle-wrapper","data-testid":"toggle-wrapper",children:[u.jsxs("div",{className:"gh-portal-list-detail",children:[u.jsx("h3",{children:f("Comments")}),u.jsx("p",{children:f("Get notified when someone replies to your comment")})]}),u.jsx("div",{style:{display:"flex",alignItems:"center"},children:u.jsx(Us,{id:"comments",onToggle:r,checked:i,dataTestId:"switch-input"})})]})}function $P({subscribedNewsletters:e,setSubscribedNewsletters:t,hasNewslettersEnabled:n}){const{site:a}=w.useContext(_),i=ea({site:a});return n?i.map(r=>u.jsx(CP,{newsletter:r,subscribedNewsletters:e,setSubscribedNewsletters:t},r==null?void 0:r.id)):null}function TP({site:e,isPaid:t}){return t?u.jsx("p",{style:{textAlign:"center",marginTop:"12px",marginBottom:"0",color:"var(--grey6)"},children:f("Unsubscribing from emails will not cancel your paid subscription to {title}",{title:e==null?void 0:e.title})}):null}function pk({hasNewslettersEnabled:e,notification:t,subscribedNewsletters:n,updateSubscribedNewsletters:a,updateCommentNotifications:i,unsubscribeAll:r,isPaidMember:o,isCommentsEnabled:s,enableCommentNotifications:l}){const{brandColor:c,doAction:m,member:p,site:d}=w.useContext(_),h=!(n!=null&&n.length)&&(s&&!l||!s),v=t||(()=>null);return u.jsxs("div",{className:"gh-portal-content with-footer",children:[u.jsx(we,{}),u.jsx(EP,{}),u.jsx(v,{}),u.jsx("div",{className:"gh-portal-section flex",children:u.jsxs("div",{className:"gh-portal-list",children:[u.jsx($P,{hasNewslettersEnabled:e,subscribedNewsletters:n,setSubscribedNewsletters:g=>{let b=g.map(k=>({id:k.id}));a(b)}}),u.jsx(jP,{isCommentsEnabled:s,enableCommentNotifications:l,updateCommentNotifications:i})]})}),u.jsx("div",{className:"gh-portal-btn-product gh-portal-btn-unsubscribe",style:{marginTop:"-48px",marginBottom:0},children:u.jsx(ge,{isRunning:!1,onClick:()=>{r()},disabled:h,brandColor:c,isPrimary:!1,label:f("Unsubscribe from all emails"),isDestructive:!0,style:{width:"100%",zIndex:900},dataTestId:"unsubscribe-from-all-emails"})}),u.jsxs("footer",{className:"gh-portal-action-footer"+(fd({member:p})?" gh-feature-suppressions":""),children:[u.jsx("div",{style:{width:"100%"},children:u.jsx(TP,{isPaid:o,site:d,subscribedNewsletters:n})}),fd({member:p})&&!h&&u.jsxs("div",{className:"gh-portal-footer-secondary",children:[u.jsx("span",{className:"gh-portal-footer-secondary-light",children:f("Not receiving emails?")}),u.jsxs("button",{className:"gh-portal-btn-text gh-email-faq-page-button",onClick:()=>m("switchPage",{page:"emailReceivingFAQ",pageData:{direct:!1}}),children:[f("Get help")," ",u.jsx("span",{className:"right-arrow",children:"→"})]})]})]})]})}function PP(){const{member:e,doAction:t,site:n,pageData:a}=w.useContext(_);let i,r;a&&(i=a.newsletterUuid,r=a.action);const[o,s]=w.useState(!0),l=ea({site:n}),c=wr({site:n});w.useEffect(()=>{e||t("switchPage",{page:"signin"})},[e,t]),w.useEffect(()=>{if(i&&r==="unsubscribe"){const g=e==null?void 0:e.newsletters.filter(b=>b.uuid!==i);h(g),s(!1),t("updateNewsletterPreference",{newsletters:g})}},[]);const m=()=>{if(a.comments&&y){const k=o?"gh-portal-hide":"";return u.jsx(u.Fragment,{children:u.jsx("p",{className:`gh-portal-text-center gh-portal-header-message ${k}`,children:u.jsx(Ve,{string:f("{memberEmail} will no longer receive emails when someone replies to your comments."),mapping:{memberEmail:u.jsx("strong",{children:e==null?void 0:e.email})}})})})}const g=l==null?void 0:l.find(k=>k.uuid===a.newsletterUuid);if(!g)return null;const b=o?"gh-portal-hide":"";return u.jsx(u.Fragment,{children:u.jsx("p",{className:`gh-portal-text-center gh-portal-header-message ${b}`,children:u.jsx(Ve,{string:f("{memberEmail} will no longer receive {newsletterName} newsletter."),mapping:{memberEmail:u.jsx("strong",{children:e==null?void 0:e.email}),newsletterName:u.jsx("strong",{children:g==null?void 0:g.name})}})})})},p=[...(e==null?void 0:e.newsletters)||[]],[d,h]=w.useState(p),{comments_enabled:y}=n,{enable_comment_notifications:v}=e||{};return w.useEffect(()=>{h((e==null?void 0:e.newsletters)||[])},[e==null?void 0:e.newsletters]),u.jsx(pk,{hasNewslettersEnabled:c,notification:i?m:null,subscribedNewsletters:d,updateSubscribedNewsletters:g=>{h(g),t("updateNewsletterPreference",{newsletters:g}),t("showPopupNotification",{action:"updated:success",message:f("Email preferences updated.")})},updateCommentNotifications:async g=>{t("updateNewsletterPreference",{enableCommentNotifications:g})},unsubscribeAll:()=>{h([]),t("showPopupNotification",{action:"updated:success",message:f("Unsubscribed from all emails.")});const g={newsletters:[]};y&&(g.enableCommentNotifications=!1),t("updateNewsletterPreference",g)},isPaidMember:Mt({member:e}),isCommentsEnabled:y!=="off",enableCommentNotifications:v})}function zP(){const{site:e}=w.useContext(_),t=e.icon;return t?u.jsx("img",{className:"gh-portal-unsubscribe-logo",src:t,alt:e.title}):null}function NP(){const{site:e}=w.useContext(_),t=e.title||"";return u.jsxs("header",{className:"gh-portal-header",children:[u.jsx(zP,{}),u.jsx("h2",{className:"gh-portal-publication-title",children:t})]})}async function hk({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 AP(){const{site:e,api:t,pageData:n,member:a,doAction:i}=w.useContext(_),[r,o]=w.useState(),[s,l]=w.useState(!0),c=ea({site:e}),m=c.filter(N=>N.subscribe_on_signup),[p,d]=w.useState(!1),[h,y]=w.useState(m),[v,g]=w.useState(!1),{comments_enabled:b}=e,{enable_comment_notifications:k=!1}=r||{},E=wr({site:e}),x=async N=>{a?i("updateNewsletterPreference",{newsletters:N}):await hk({api:t,memberUuid:n.uuid,key:n.key,newsletters:N}),y(N);const $={action:"updated:success",message:f("Email preferences updated.")};i("showPopupNotification",$)},z=async N=>{let $;a?(await i("updateNewsletterPreference",{enableCommentNotifications:N}),$={...a,enable_comment_notifications:N}):$=await hk({api:t,memberUuid:n.uuid,key:n.key,enableCommentNotifications:N}),o($),i("showPopupNotification",{action:"updated:success",message:f("Comment preferences updated.")})},C=async()=>{let N;a?(await i("updateNewsletterPreference",{newsletters:[],enableCommentNotifications:!1}),N={...a},N.newsletters=[],N.enable_comment_notifications=!1):N=await t.member.updateNewsletters({uuid:n.uuid,key:n.key,newsletters:[],enableCommentNotifications:!1}),y([]),o(N),i("showPopupNotification",{action:"updated:success",message:f("Unsubscribed from all emails.")})};if(w.useEffect(()=>{(async()=>{let N;try{N=await t.member.newsletters({uuid:n.uuid,key:n.key}),o(N??null),l(!1)}catch(H){console.error("[PORTAL] Error fetching member newsletters",H),o(null),l(!1);return}if(N===null)return;const $=(N==null?void 0:N.newsletters)||[];y($),(c==null?void 0:c.length)===1&&!b&&!n.newsletterUuid?await x([]):n.newsletterUuid?await x($==null?void 0:$.filter(H=>H.uuid!==n.newsletterUuid)):n.comments&&b&&await z(!1)})()},[b,n.uuid,n.newsletterUuid,n.comments,e.url,c==null?void 0:c.length]),s)return u.jsx(Mr,{});if(!r)return u.jsxs("div",{className:"gh-portal-content gh-portal-feedback with-footer",children:[u.jsx(we,{}),u.jsx("div",{className:"gh-feedback-icon gh-feedback-icon-error",children:u.jsx(Ed,{})}),u.jsx("h1",{className:"gh-portal-main-title",children:f("That didn't go to plan")}),u.jsx("div",{children:u.jsx("p",{className:"gh-portal-text-center",children:f("We couldn't unsubscribe you as the email address was not found. Please contact the site owner.")})}),u.jsx(ge,{style:{width:"100%"},retry:!1,onClick:()=>i("closePopup"),disabled:!1,brandColor:"#000000",label:f("Close"),isRunning:!1,tabIndex:3,classes:"sticky bottom"})]});if((c==null?void 0:c.length)===1&&!b&&!v)return u.jsxs("div",{className:"gh-portal-content gh-portal-unsubscribe with-footer",children:[u.jsx(we,{}),u.jsx(NP,{}),u.jsx("h1",{className:"gh-portal-main-title",children:f("Successfully unsubscribed")}),u.jsxs("div",{children:[u.jsx("p",{className:"gh-portal-text-center",children:u.jsx(Ve,{string:f("{memberEmail} will no longer receive this newsletter."),mapping:{memberEmail:u.jsx("strong",{children:r==null?void 0:r.email})}})}),u.jsx("p",{className:"gh-portal-text-center",children:u.jsx(Ve,{string:f("Didn't mean to do this? Manage your preferences <button>here</button>."),mapping:{button:u.jsx("button",{className:"gh-portal-btn-link gh-portal-btn-branded gh-portal-btn-inline",onClick:()=>{g(!0)}})}})})]})]});const A=()=>{if(n.comments&&b){const H=p?"gh-portal-hide":"";return u.jsx(u.Fragment,{children:u.jsx("p",{className:`gh-portal-text-center gh-portal-header-message ${H}`,children:u.jsx(Ve,{string:f("{memberEmail} will no longer receive emails when someone replies to your comments."),mapping:{memberEmail:u.jsx("strong",{children:r==null?void 0:r.email})}})})})}const N=c==null?void 0:c.find(H=>H.uuid===n.newsletterUuid);if(!N)return null;const $=p?"gh-portal-hide":"";return u.jsx(u.Fragment,{children:u.jsx("p",{className:`gh-portal-text-center gh-portal-header-message ${$}`,children:u.jsx(Ve,{string:f("{memberEmail} will no longer receive {newsletterName} newsletter."),mapping:{memberEmail:u.jsx("strong",{children:r==null?void 0:r.email}),newsletterName:u.jsx("strong",{children:N==null?void 0:N.name})}})})})};return u.jsx(pk,{hasNewslettersEnabled:E,notification:A,subscribedNewsletters:h,updateSubscribedNewsletters:async N=>{await x(N),d(!0)},updateCommentNotifications:z,unsubscribeAll:async()=>{await C(),d(!0)},isPaidMember:(r==null?void 0:r.status)!=="free",isCommentsEnabled:b!=="off",enableCommentNotifications:k})}function IP(){const{brandColor:e,lastPage:t,doAction:n,action:a,site:i}=w.useContext(_);w.useEffect(()=>{["removeEmailFromSuppressionList:success"].includes(a)&&n("refreshMemberData"),["removeEmailFromSuppressionList:failed","refreshMemberData:failed"].includes(a)&&n("back"),["refreshMemberData:success"].includes(a)&&(xr({site:i})||Ms({site:i})?(n("switchPage",{page:"accountEmail",lastPage:"accountHome"}),n("showPopupNotification",{message:f("You have been successfully resubscribed")})):n("back"))},[a,n,i,f]);const r=["removeEmailFromSuppressionList:running","refreshMemberData:running"].includes(a),o=()=>{n("removeEmailFromSuppressionList")};return u.jsxs("div",{className:"gh-email-suppressed-page",children:[u.jsxs("header",{className:"gh-portal-detail-header",children:[u.jsx(Za,{brandColor:e,hidden:!t,onClick:()=>{n("back")}}),u.jsx(we,{})]}),u.jsx(mk,{className:"gh-email-suppressed-page-icon"}),u.jsxs("div",{className:"gh-email-suppressed-page-text",children:[u.jsx("h3",{className:"gh-portal-main-title gh-email-suppressed-page-title",children:f("Emails disabled")}),u.jsx("p",{children:f("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.")})]}),u.jsx(ge,{dataTestId:"resubscribe-email",classes:"gh-portal-confirm-button",onClick:o,disabled:r,brandColor:e,label:f("Re-enable emails"),isRunning:r})]})}function MP(){const{brandColor:e,doAction:t,site:n,pageData:a}=w.useContext(_),i=`mailto:${Er({site:n})}`,r=a&&a.direct||!1;return u.jsxs("div",{className:"gh-email-suppression-faq",children:[!r&&u.jsxs("header",{className:"gh-portal-detail-header",children:[u.jsx(Za,{brandColor:e,onClick:()=>{t("switchPage",{page:"emailSuppressed",lastPage:"accountHome"})}}),u.jsx(we,{})]}),u.jsxs("div",{className:"gh-longform",children:[u.jsx("h3",{children:f("Why has my email been disabled?")}),u.jsx("p",{children:f("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).")}),u.jsx("h4",{children:f("Spam complaints")}),u.jsx("p",{children:f("If a newsletter is flagged as spam, emails are automatically disabled for that address to make sure you no longer receive any unwanted messages.")}),u.jsx("p",{children:f("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.")}),u.jsx("p",{children:f("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.")}),u.jsx("h4",{children:f("Permanent failure (bounce)")}),u.jsx("p",{children:f("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.")}),u.jsx("p",{children:f("In the event a permanent failure is received when attempting to send a newsletter, emails will be disabled on the account.")}),u.jsx("p",{children:f("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.")}),u.jsx("p",{children:u.jsx("a",{className:"gh-portal-btn gh-portal-btn-branded no-margin-right",href:i,onClick:()=>{i&&window.open(i)},children:f("Need more help? Contact support")})})]})]})}function DP(){const{brandColor:e,doAction:t,site:n,lastPage:a,member:i,pageData:r}=w.useContext(_),o=Er({site:n}),s=`mailto:${o}`,l=z0({site:n}),c=r&&r.direct||!1;return u.jsxs("div",{className:"gh-email-receiving-faq",children:[u.jsxs("header",{className:"gh-portal-detail-header",children:[!c&&u.jsx(Za,{brandColor:e,onClick:()=>{a?t("switchPage",{page:"accountHome"}):t("switchPage",{page:"accountEmail",lastPage:"accountHome"})}}),u.jsx(we,{})]}),u.jsxs("div",{className:"gh-longform",children:[u.jsx("h3",{children:f("Help! I'm not receiving emails")}),u.jsx("p",{children:f("If you're not receiving the email newsletter you've subscribed to, here are a few things to check.")}),u.jsx("h4",{children:f("Verify your email address is correct")}),u.jsx("p",{children:u.jsx(Ve,{string:f("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:u.jsx("strong",{children:i.email}),button:u.jsx("button",{className:"gh-portal-btn-text",onClick:()=>t("switchPage",{lastPage:"emailReceivingFAQ",page:"accountProfile"})})}})}),u.jsx("h4",{children:f("Check spam & promotions folders")}),u.jsx("p",{children:f(`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".`)}),u.jsx("h4",{children:f("Create a new contact")}),u.jsx("p",{children:u.jsx(Ve,{string:f("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:u.jsx("strong",{children:l})}})}),u.jsx("h4",{children:f("Send an email and say hi!")}),u.jsx("p",{children:u.jsx(Ve,{string:f("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:u.jsx("strong",{children:l})}})}),u.jsx("h4",{children:f("Check with your mail provider")}),u.jsx("p",{children:u.jsx(Ve,{string:f("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:u.jsx("strong",{children:l})}})}),u.jsx("h4",{children:f("Get in touch for help")}),u.jsx("p",{children:u.jsx(Ve,{string:f("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:u.jsx("a",{href:s,onClick:()=>{s&&window.open(s)},children:o})}})})]})]})}const tm={signin:Qd,signup:Gd,accountHome:Xd,accountPlan:Dd,accountProfile:em,accountEmail:PP,signupNewsletter:Od,unsubscribe:AP,magiclink:Kd,loading:Mr,offer:Jd,feedback:L1,emailSuppressed:IP,emailSuppressionFAQ:MP,emailReceivingFAQ:DP,support:()=>{const[e,t]=w.useState(!0),[n,a]=w.useState(null),[i,r]=w.useState(null),{member:o,site:s}=w.useContext(_);return w.useEffect(()=>{async function l(){const c=s.url,m=window.location.origin+window.location.pathname,p=o?`${m}?action=support&success=true`:`${m}#/portal/support/success`,d=m,h=Js({siteUrl:c});try{const y=await h.member.checkoutDonation({successUrl:p,cancelUrl:d,personalNote:f("Add a personal note")});y.url&&window.location.replace(y.url)}catch(y){y.type&&y.type==="DisabledFeatureError"?r(f("This site is not accepting payments at the moment.")):a(f("Something went wrong, please try again later.")),t(!1)}}s&&s.donations_enabled===!1?(r(f("This site is not accepting donations at the moment.")),t(!1)):l()},[]),e?u.jsx("div",{children:u.jsx(Mr,{})}):n?u.jsx(Zd,{error:n}):i?u.jsx(Zd,{error:i}):null},supportSuccess:W1,supportError:Zd,recommendations:eP},nm=function({page:e}){return Object.keys(tm).includes(e)?e:"signup"},gk=function({page:e}){return e.includes("account")},FP=function({page:e}){return e.includes("offer")},OP=e=>w.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},w.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"})),km=class km extends Z.Component{render(){return u.jsxs("a",{href:"https://ghost.org",target:"_blank",rel:"noopener noreferrer",onClick:()=>{window.open("https://ghost.org","_blank")},children:[u.jsx(OP,{}),"Powered by Ghost"]})}};km.contextType=_;let Zs=km;const fk=()=>({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 _P({message:e}){return Ka()?u.jsx("div",{className:"gh-portal-cookiebanner",children:e}):null}const vm=class vm extends Z.Component{componentDidMount(){this.node&&!de(["preview"])&&!this.props.isMobile&&(this.node.focus(),this.keyUphandler=t=>{t.key==="Escape"&&this.dismissPopup(t)},this.node.ownerDocument.removeEventListener("keyup",this.keyUphandler),this.node.ownerDocument.addEventListener("keyup",this.keyUphandler)),this.sendContainerHeightChangeEvent()}dismissPopup(t){var i;const n=t.target&&t.target.tagName;(n!=="INPUT"||n==="INPUT"&&!((i=t==null?void 0:t.target)!=null&&i.value))&&this.context.doAction("closePopup")}sendContainerHeightChangeEvent(){var t,n;this.node&&de(["preview"])&&((t=this.node)==null?void 0:t.clientHeight)!==this.lastContainerHeight&&(this.lastContainerHeight=(n=this.node)==null?void 0:n.clientHeight,window.document.body.style.overflow="hidden",window.document.body.style["scrollbar-width"]="none",window.parent.postMessage({type:"portal-preview-updated",payload:{height:this.lastContainerHeight}},"*"))}componentDidUpdate(){this.sendContainerHeightChangeEvent()}componentWillUnmount(){this.node&&this.node.ownerDocument.removeEventListener("keyup",this.keyUphandler)}handlePopupClose(t){const{page:n,otcRef:a}=this.context;de(["preview"])||a&&n==="magiclink"||t.target===t.currentTarget&&this.context.doAction("closePopup")}renderActivePage(){const{page:t}=this.context;nm({page:t});const n=tm[t];return u.jsx(n,{})}renderPopupNotification(){const{popupNotification:t}=this.context;return!t||!t.type?null:u.jsx(qd,{})}sendPortalPreviewReadyEvent(){window.self!==window.parent&&window.parent.postMessage({type:"portal-preview-ready",payload:{}},"*")}render(){const{page:t,pageQuery:n,site:a,customSiteUrl:i}=this.context,o=Os({site:a,pageQuery:n}).length;nm({page:t});const l={...fk().page[t]};let c="",m="regular",p="",d=t;switch(t){case"signup":p="Cookies must be enabled in your browser to sign up.";break;case"signin":p="Cookies must be enabled in your browser to sign in.";break;case"accountHome":d="account-home";break;case"accountProfile":d="account-profile";break;case"accountPlan":d="account-plan";break;default:p="Cookies must be enabled in your browser.",d=t;break}o>1&&!Dt({site:a})&&Xt({site:a,pageQuery:n})&&t==="signup"&&(d+=" full-size",m="full");const h=Sr({site:a});(h&&o>2||!h&&o>1)&&t==="accountPlan"&&(d+=" full-size",m="full"),(t==="emailSuppressionFAQ"||t==="emailReceivingFAQ")&&(d+=" large-size");let y="gh-portal-popup-container";de(["preview"])&&(d+=" preview"),de(["preview"],{customSiteUrl:i})&&!a.disableBackground&&(y+=" preview"),de(["dev"])&&(y+=" dev");const v=`${y} ${c} ${d}`;return this.sendPortalPreviewReadyEvent(),u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"gh-portal-popup-wrapper "+d,onClick:g=>this.handlePopupClose(g),children:[this.renderPopupNotification(),u.jsxs("div",{className:v,style:l,ref:g=>this.node=g,tabIndex:-1,children:[u.jsx(_P,{message:p}),this.renderActivePage(),m==="full"?u.jsx("div",{className:"gh-portal-powered inside "+(de(["preview"])?"hidden ":"")+d,children:u.jsx(Zs,{})}):""]})]}),u.jsx("div",{className:"gh-portal-powered outside "+(de(["preview"])?"hidden ":"")+d,children:u.jsx(Zs,{})})]})}};vm.contextType=_;let am=vm;const wm=class wm extends Z.Component{constructor(t){super(t),this.state={height:null}}renderCurrentPage(t){const n=tm[t];return u.jsx(n,{})}onHeightChange(t){this.setState({height:t})}handlePopupClose(t){t.preventDefault(),t.target===t.currentTarget&&this.context.doAction("closePopup")}renderFrameStyles(){const{site:t,brandColor:n}=this.context,a=oP({site:t}),i=n?`:root { --brandcolor: ${n} }`+a:a;return u.jsxs(u.Fragment,{children:[u.jsx("style",{dangerouslySetInnerHTML:{__html:i}}),u.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=fk(),r=window.innerWidth<480,o={...i.frame.common};let s="gh-portal-popup-background";return de(["preview"])&&(i.modalContainer.zIndex="3999997"),de(["preview"],{customSiteUrl:a})&&!n.disableBackground&&(s+=" preview"),de(["dev"])&&(s+=" dev"),u.jsx("div",{style:i.modalContainer,children:u.jsxs(sd,{style:o,title:"portal-popup",head:this.renderFrameStyles(),dataTestId:"portal-popup-frame",dataDir:this.context.dir,children:[u.jsx("div",{className:s,onClick:l=>this.handlePopupClose(l)}),u.jsx(am,{isMobile:r})]})})}render(){const{showPopup:t}=this.context;return t?this.renderFrameContainer():null}};wm.contextType=_;let im=wm;Qs({products:rm({numOfProducts:1})});function Fe(){return(new Date().getTime()/1e3|0).toString(16)+"xxxxxxxxxxxxxxxx".replace(/[x]/g,function(){return(Math.random()*16|0).toString(16)}).toLowerCase()}function RP(){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 Qs({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:r={monthly:5e3,yearly:15e4,currency:"USD"},products:o=rm({numOfProducts:1}),portalProducts:s=o.map(H=>H.id),accentColor:l="#45C32E",portalPlans:c=["free","monthly","yearly"],membersSignupAccess:m="all",freePriceName:p="Free",freePriceDescription:d="Free preview",isStripeConfigured:h=!0,portalButton:y=!0,portalName:v=!0,portalButtonIcon:g="icon-1",portalButtonSignupText:b="Subscribe now",portalButtonStyle:k="icon-and-text",membersSupportAddress:E="support@example.com",editorDefaultEmailRecipients:x="visibility",newsletters:z=[],posts:C=LP(),commentsEnabled:A,recommendations:N=[],recommendationsEnabled:$}={}){return{title:e,description:t,logo:n,icon:a,accent_color:l,url:i,plans:r,products:o,portal_products:s,members_signup_access:m,free_price_name:p,free_price_description:d,is_stripe_configured:h,portal_button:y,portal_name:v,portal_plans:c,portal_button_icon:g,portal_button_signup_text:b,portal_button_style:k,members_support_address:E,comments_enabled:A!=="off",newsletters:z,recommendations:N,recommendations_enabled:!!$,editor_default_email_recipients:x,posts:C}}function bk({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:r="month",amount:o=50,duration:s="repeating",durationInMonths:l=null,currencyRestriction:c=!1,currency:m=null,status:p="active",tierId:d="",tierName:h="Basic",redemptionType:y="signup"}={}){return{id:`offer_${Fe()}`,name:e,code:t,display_title:n,display_description:a,type:i,cadence:r,amount:o,duration:s,duration_in_months:l,currency_restriction:c,currency:m,status:p,tier:{id:`${d}`,name:h},redemption_type:y}}function Et({name:e="Jamie Larson",email:t="jamie@example.com",firstname:n="Jamie",subscriptions:a=[],paid:i=!1,avatarImage:r="",subscribed:o=!0,email_suppression:s={suppressed:!1,info:null},newsletters:l=[]}={}){return{uuid:RP(),email:t,name:e,firstname:n,paid:i,subscribed:o,avatar_image:r,subscriptions:a,email_suppression:s,newsletters:l}}function LP({numOfPosts:e=3}={}){const t=[];for(let n=0;n<e;n++)t.push(YP({title:`Post ${n+1}`,slug:`post-${n+1}`}));return t.slice(0,e)}function YP({id:e=`post_${Fe()}`,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 rm({numOfProducts:e=3}={}){const n=[ei({name:"Bronze",description:"Access to all members articles",monthlyPrice:bt({interval:"month",amount:700}),yearlyPrice:bt({interval:"year",amount:7e3}),numOfBenefits:2}),ei({name:"Silver",description:"Access to all members articles and weekly podcast",monthlyPrice:bt({interval:"month",amount:1200}),yearlyPrice:bt({interval:"year",amount:12e3}),numOfBenefits:3}),ei({name:"Friends of the Blueprint",description:"Get access to everything and lock in early adopter pricing for life + listen to my podcast",monthlyPrice:bt({interval:"month",amount:18e3}),yearlyPrice:bt({interval:"year",amount:17e3}),numOfBenefits:4})].slice(0,e),a=yk({});return[...n,a]}function ei({type:e="paid",name:t="Basic",description:n="",id:a=`product_${Fe()}`,monthlyPrice:i=bt(),yearlyPrice:r=bt({interval:"year"}),numOfBenefits:o=2,trialDays:s=null}){return{id:a,name:t,description:n,monthlyPrice:e==="free"?null:i,yearlyPrice:e==="free"?null:r,type:e,benefits:kk({numOfBenefits:o}),trial_days:s}}function yk({name:e="Free tier",description:t="Free tier description",id:n=`product_${Fe()}`,numOfBenefits:a=2}){return{id:n,name:e,type:"free",description:t,benefits:kk({numOfBenefits:a})}}function kk({numOfBenefits:e}){const t=Fe();return[Xs({name:`Limited early adopter pricing #${t.substring(0,6)}`}),Xs({name:`Latest gear reviews #${t.substring(6,12)}`}),Xs({name:`Weekly email newsletter #${t.substring(12,18)}`}),Xs({name:`Listen to my podcast #${t.substring(18)}`})].slice(0,e)}function Xs({id:e=`benefit_${Fe()}`,name:t="Benefit"}){return{id:e,name:t}}function bt({interval:e="month",amount:t=e==="month"?500:5e3,nickname:n=e==="month"?"Monthly":"Yearly",description:a=null,currency:i="usd",active:r=!0,id:o=`price_${Fe()}`}={}){return{id:o,active:r,nickname:n,currency:i,amount:t,interval:e,description:a,stripe_price_id:`price_${Fe()}`,stripe_product_id:`prod_${Fe()}`,type:"recurring"}}function na({id:e=`sub_${Fe()}`,status:t="active",currency:n="USD",interval:a="year",amount:i=a==="month"?500:5e3,nickname:r=a==="month"?"Monthly":"Yearly",cardLast4:o="4242",offer:s=BP,priceId:l=`price_${Fe()}`,startDate:c="2021-10-05T03:18:30.000Z",currentPeriodEnd:m="2022-10-05T03:18:30.000Z",cancelAtPeriodEnd:p=!1,trialEndAt:d=null,nextPayment:h=null,tier:y=null}={}){return{id:e,customer:{id:`cus_${Fe()}`,name:"Jamie",email:"jamie@example.com"},plan:{id:`price_${Fe()}`,nickname:r,amount:i,interval:a,currency:n},offer:s,status:t,start_date:c,default_payment_card_last4:o,cancel_at_period_end:p,cancellation_reason:null,current_period_end:m,trial_end_at:d,next_payment:h,tier:y,price:{id:`stripe_price_${Fe()}`,price_id:l,nickname:r,amount:i,interval:a,type:"recurring",currency:n,product:{id:`stripe_prod_${Fe()}`,product_id:`prod_${Fe()}`}}}}function vk(){const e=rm({numOfProducts:1}),t=e.map(a=>a.id);return Qs({products:e,portalPlans:["free","monthly","yearly"],portalProducts:t})}vk();const UP=Qs({products:[ei({numOfBenefits:2,type:"free"})]}),BP=bk({tierId:(Ck=UP.products[0])==null?void 0:Ck.id});Et(),Et({paid:!0,subscriptions:[na()]}),Et({paid:!0,subscriptions:[]}),Et({paid:!0,subscriptions:[na({amount:0})]}),Et({paid:!0,subscriptions:[na({amount:1500,startDate:"2019-05-01T11:42:40.000Z",currentPeriodEnd:"2021-06-05T11:42:40.000Z"})]}),vk();const el=[yk({name:"Free",description:"Free tier description which is actually a pretty long description",numOfBenefits:2}),ei({name:"The Blueprint",description:"",monthlyPrice:bt({interval:"month",amount:500}),yearlyPrice:bt({interval:"year",amount:5e3}),numOfBenefits:3}),ei({name:"Friends of the Blueprint Silver",description:"Access to all members articles and weekly podcast",monthlyPrice:bt({interval:"month",amount:1200}),yearlyPrice:bt({interval:"year",amount:11e3}),numOfBenefits:4})],ti=Qs({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:el,portalProducts:el.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}]}),wk=bk({tierId:(jk=ti.products[1])==null?void 0:jk.id}),Fr={free:Et({name:"Jamie Larson",email:"jamie@example.com",firstname:"Jamie",subscriptions:[],paid:!1,avatarImage:"",subscribed:!0}),paid:Et({paid:!0,subscriptions:[na({status:"active",currency:"USD",interval:"year",amount:5e3,cardLast4:"4242",startDate:"2021-10-05T03:18:30.000Z",currentPeriodEnd:"2022-10-05T03:18:30.000Z",cancelAtPeriodEnd:!1})]}),complimentary:Et({paid:!0,subscriptions:[]}),complimentaryWithSubscription:Et({paid:!0,subscriptions:[na({amount:0})]}),preview:Et({paid:!0,subscriptions:[na({amount:1500,startDate:"2019-05-01T11:42:40.000Z",currentPeriodEnd:new Date().toISOString()})]})};function VP(){var n;if(!el||!el[1])return null;let e=(n=ti==null?void 0:ti.products)==null?void 0:n[1].monthlyPrice,t=Et({paid:!0,subscriptions:[na({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:ti,member:t}}function HP(e){const t=e.getAttribute("href"),n=new URL(t,window.location.origin);!n.hash||!n.hash.startsWith("#/portal")||t.startsWith("#/portal")||n.origin===window.location.origin&&e.setAttribute("href",n.hash)}function WP({data:e,state:t}){return{page:e.page,popupNotification:null,lastPage:e.lastPage||null,pageData:e.pageData||t.pageData}}function GP({state:e}){return{showPopup:!e.showPopup}}function KP({data:e}){return{showPopup:!0,page:e.page,...e.pageQuery?{pageQuery:e.pageQuery}:{},...e.pageData?{pageData:e.pageData}:{}}}function qP({state:e}){return e.lastPage?{page:e.lastPage}:Sk({state:e})}function Sk({state:e}){return dd(),{showPopup:!1,lastPage:null,pageQuery:"",popupNotification:null,page:e.page==="magiclink"?"":e.page}}function JP({data:e}){return{showNotification:!0,...e}}function ZP(){return{showNotification:!1}}async function QP({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:f("Failed to log out, please try again")})}}}async function XP({data:e,api:t,state:n}){try{const a=await t.member.getIntegrityToken(),i={...e,emailType:"signin",integrityToken:a,includeOTC:!0},{otc_ref:r,inboxLinks:o}=await t.member.sendMagicLink(i);return{page:"magiclink",lastPage:"signin",...r?{otcRef:r}:{},inboxLinks:o,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:Zt(a,f("Failed to log in, please try again"))})}}}function ez({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 tz({data:e,api:t}){var a;const n=f("Failed to verify code, please try again");try{const i=await t.member.getIntegrityToken(),r=await t.member.verifyOTC({...e,integrityToken:i});return r.redirectUrl?window.location.assign(r.redirectUrl):{action:"verifyOTC:failed",actionErrorMessage:Zt((a=r.errors)==null?void 0:a[0],n)}}catch(i){return{action:"verifyOTC:failed",actionErrorMessage:Zt(i,n)}}}async function nz({data:e,state:t,api:n}){try{let{plan:a,tierId:i,cadence:r,email:o,name:s,newsletters:l,offerId:c}=e;s=s==null?void 0:s.trim();let m;if(a.toLowerCase()==="free"){const p=await n.member.getIntegrityToken();({inboxLinks:m}=await n.member.sendMagicLink({emailType:"signup",integrityToken:p,...e,name:s}))}else return i&&r?await n.member.checkoutPlan({plan:a,tierId:i,cadence:r,email:o,name:s,newsletters:l,offerId:c}):({tierId:i,cadence:r}=ta({site:t==null?void 0:t.site,priceId:a}),await n.member.checkoutPlan({plan:a,tierId:i,cadence:r,email:o,name:s,newsletters:l,offerId:c})),{page:"loading"};return{page:"magiclink",lastPage:"signup",inboxLinks:m,pageData:{...t.pageData||{},email:(o||"").trim()}}}catch(a){const i=Zt(a,f("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 az({data:e,state:t,api:n}){try{let{plan:a,offerId:i,tierId:r,cadence:o}=e;(!r||!o)&&({tierId:r,cadence:o}=ta({site:t==null?void 0:t.site,priceId:a})),await n.member.checkoutPlan({plan:a,tierId:r,cadence:o,offerId:i,metadata:{checkoutType:"upgrade"}})}catch{return{action:"checkoutPlan:failed",popupNotification:le({type:"checkoutPlan:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:f("Failed to process checkout, please try again")})}}}async function iz({data:e,state:t,api:n}){try{const{plan:a,planId:i,subscriptionId:r,cancelAtPeriodEnd:o}=e,{tierId:s,cadence:l}=ta({site:t==null?void 0:t.site,priceId:i});await n.member.updateSubscription({planName:a,tierId:s,cadence:l,subscriptionId:r,cancelAtPeriodEnd:o,planId:i});const c=await n.member.sessionData(),m="updateSubscription:success";return{action:m,popupNotification:le({type:m,autoHide:!0,closeable:!0,state:t,status:"success",message:f("Subscription plan updated successfully")}),page:"accountHome",member:c}}catch{return{action:"updateSubscription:failed",popupNotification:le({type:"updateSubscription:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:f("Failed to update subscription, please try again")})}}}async function rz({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()}}catch{return{action:"cancelSubscription:failed",popupNotification:le({type:"cancelSubscription:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:f("Failed to cancel subscription, please try again")})}}}async function oz({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()}}catch{return{action:"continueSubscription:failed",popupNotification:le({type:"continueSubscription:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:f("Failed to cancel subscription, please try again")})}}}async function sz({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:[],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 lz({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:f("Failed to update billing information, please try again")})}}}async function uz({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:f("Failed to open billing portal, please try again")})}}}async function cz(){return{popupNotification:null}}async function dz({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 mz({data:e,state:t,api:n}){try{const{newsletters:a,enableCommentNotifications:i}=e;if(!a&&i===void 0)return{};const r={};return a&&(r.newsletters=a),i!==void 0&&(r.enableCommentNotifications=i),{action:"updateNewsletterPref:success",member:await n.member.update(r)}}catch{return{action:"updateNewsletterPref:failed",popupNotification:le({type:"updateNewsletter:failed",autoHide:!0,closeable:!0,state:t,status:"error",message:f("Failed to update newsletter settings")})}}}async function pz({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:f("You have been successfully resubscribed")})}}catch{return{action:"removeEmailFromSuppressionList:failed",popupNotification:le({type:"removeEmailFromSuppressionList:failed",autoHide:!0,closeable:!0,state:e,status:"error",message:f("Your email has failed to resubscribe, please try again")})}}}async function hz({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 r="updateNewsletter:success";return{action:r,member:i,popupNotification:le({type:r,autoHide:!0,closeable:!0,state:t,status:"success",message:f("Email newsletter settings updated")})}}catch{return{action:"updateNewsletter:failed",popupNotification:le({type:"updateNewsletter:failed",autoHide:!0,closeable:!0,state:t,status:"error",message:f("Failed to update newsletter settings")})}}}async function gz({data:e,state:t,api:n}){const{email:a}=e,i=$0({member:t.member});if(a!==i)try{return await n.member.updateEmailAddress({email:a}),{success:!0}}catch(r){return{success:!1,error:r}}return null}async function fz({data:e,state:t,api:n}){var r;const a=(r=e==null?void 0:e.name)==null?void 0:r.trim();if(P0({member:t.member})!==a)try{const o=await n.member.update({name:a});if(!o)throw new Error("Failed to update member");return{member:o,success:!0}}catch(o){return{success:!1,error:o}}return null}async function bz({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 yz({data:e,state:t,api:n}){const[a,i]=await Promise.all([fz({data:e,state:t,api:n}),gz({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:f("Check your inbox to verify email update")})};const r=a.success?f("Failed to send verification email"):f("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:r,state:t})}}else if(a){const r=a.success?"updateProfile:success":"updateProfile:failed",o=a.success?"success":"error",s=a.success?f("Account details updated successfully"):f("Failed to update account details");return{action:r,...a.success?{member:a.member}:{},...a.success?{page:"accountHome"}:{},popupNotification:le({type:r,autoHide:a.success,closeable:!0,status:o,state:t,message:s})}}else if(i){const r=i.success?"updateProfile:success":"updateProfile:failed",o=i.success?"success":"error";let s="";return i.error?s=Zt(i.error,f("Failed to send verification email")):s=f("Check your inbox to verify email update"),{action:r,...i.success?{page:"accountHome"}:{},popupNotification:le({type:r,autoHide:i.success,closeable:!0,status:o,state:t,message:s})}}return{action:"updateProfile:success",page:"accountHome",popupNotification:le({type:"updateProfile:success",autoHide:!0,closeable:!0,status:"success",state:t,message:f("Account details updated successfully")})}}async function kz({data:{siteUrl:e},state:t}){const n=Js({siteUrl:e,apiUrl:"not-defined"}),{member:a}=t,i=window.location.href,r=uy(),o=await n.member.getIntegrityToken();return await n.member.sendMagicLink({emailType:"signup",name:a.name,email:a.email,autoRedirect:!1,integrityToken:o,customUrlHistory:t.site.outbound_link_tagging?[{time:Date.now(),referrerSource:r,referrerMedium:"Ghost Recommendations",referrerUrl:i}]:[]}),{}}function vz({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 wz({data:{recommendationId:e},api:t}){return t.recommendations.trackSubscribed({recommendationId:e}),{}}const Sz={togglePopup:GP,openPopup:KP,closePopup:Sk,switchPage:WP,openNotification:JP,closeNotification:ZP,back:qP,signout:QP,signin:XP,startSigninOTCFromCustomForm:ez,verifyOTC:tz,signup:nz,updateSubscription:iz,cancelSubscription:rz,continueSubscription:oz,applyOffer:sz,updateNewsletter:hz,updateProfile:yz,refreshMemberData:bz,clearPopupNotification:cz,editBilling:lz,manageBilling:uz,checkoutPlan:az,updateNewsletterPreference:mz,showPopupNotification:dz,removeEmailFromSuppressionList:pz,oneClickSubscribe:kz,trackRecommendationClicked:vz,trackRecommendationSubscribed:wz};async function xz({action:e,data:t,state:n,api:a}){const i=Sz[e];return i?await i({data:t,state:n,api:a})||{}:{}}function xk(e,t){e&&(e.innerText=t)}function Ez(e,t,n){t.classList.add("error");const a=f("There was an error sending the email, please try again");xk(n,Zt(e,a))}async function Cz({event:e,form:t,errorEl:n,siteUrl:a,submitHandler:i,doAction:r,captureException:o}){var x,z;t.removeEventListener("submit",i),e.preventDefault(),n&&(n.innerText=""),t.classList.remove("success","invalid","error");let s=e.target.querySelector("input[data-members-email]"),l=e.target.querySelector("input[data-members-name]"),c=((x=t==null?void 0:t.dataset)==null?void 0:x.membersAutoredirect)||"true",m=s==null?void 0:s.value,p=((l==null?void 0:l.value)||"").trim()||void 0,d,h=[],y=[],v=e.target.querySelectorAll("input[data-members-label]")||[];for(let C=0;C<v.length;++C)h.push(v[C].value);let g=e.target.querySelectorAll("input[type=hidden][data-members-newsletter], input[type=checkbox][data-members-newsletter]:checked, input[type=radio][data-members-newsletter]:checked")||[];for(let C=0;C<g.length;++C)y.push({name:g[C].value});t.dataset.membersForm&&(d=t.dataset.membersForm);const b=d==="signin"&&((z=t==null?void 0:t.dataset)==null?void 0:z.membersOtc)==="true";t.classList.add("loading");const k=Cr(),E={email:m,emailType:d,labels:h,name:p,autoRedirect:c==="true"};b&&(E.includeOTC=!0),k&&(E.urlHistory=k),g.length>0?E.newsletters=y:(e.target.querySelectorAll("input[type=checkbox][data-members-newsletter]")||[]).length>0&&(E.newsletters=[]);try{const A=await(await fetch(`${a}/members/api/integrity-token/`,{method:"GET"})).text(),N=await fetch(`${a}/members/api/send-magic-link/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...E,integrityToken:A})});if(t.addEventListener("submit",i),t.classList.remove("loading"),N.ok){t.classList.add("success");let $;if(b)try{$=await N.clone().json()}catch{$=void 0}const H=$==null?void 0:$.otc_ref;if(H&&typeof r=="function")try{r("startSigninOTCFromCustomForm",{email:(m||"").trim(),otcRef:H,inboxLinks:$==null?void 0:$.inboxLinks})}catch(q){console.error(q),o==null||o(q)}}else{const $=await Jt.fromApiResponse(N),H=Zt($,f("Failed to send magic link email"));xk(n,H),t.classList.add("error")}}catch(C){Ez(C,t,n)}}function jz({event:e,el:t,errorEl:n,siteUrl:a,site:i,member:r,clickHandler:o}){t.removeEventListener("click",o),e.preventDefault();let s=t.dataset.membersPlan,l=f0(i,s.toLowerCase()),c=t.dataset.membersSuccess,m=t.dataset.membersCancel,p,d;c&&(p=new URL(c,window.location.href).href),m&&(d=new URL(m,window.location.href).href),n&&(n.innerText=""),t.classList.add("loading");const h=r?{checkoutType:"upgrade"}:{},y=Cr();return y&&(h.urlHistory=y),fetch(`${a}/members/api/session`,{credentials:"same-origin"}).then(function(v){return v.ok?v.text():null}).then(function(v){return fetch(`${a}/members/api/create-stripe-checkout-session/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...l,identity:v,successUrl:p,cancelUrl:d,metadata:h})}).then(function(g){if(!g.ok)throw new Error(f("Could not create Stripe checkout session"));return g.json()})}).then(function(v){return v.url?window.location.assign(v.url):window.Stripe(v.publicKey).redirectToCheckout({sessionId:v.sessionId}).then(function(b){if(b.error)throw new Error(b.error.message)})}).catch(function(v){console.error(v),t.addEventListener("click",o),t.classList.remove("loading"),n&&(n.innerText=v.message),t.classList.add("error")})}function $z({siteUrl:e,site:t={},member:n,offers:a=[],doAction:i,captureException:r}={}){if(!e)return;e=e.replace(/\/$/,""),Array.prototype.forEach.call(document.querySelectorAll("form[data-members-form]"),function(s){let l=s.querySelector("[data-members-error]");function c(m){Cz({event:m,errorEl:l,form:s,siteUrl:e,submitHandler:c,doAction:i,captureException:r})}s.addEventListener("submit",c)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-plan]"),function(s){let l=s.querySelector("[data-members-error]");function c(m){jz({el:s,event:m,errorEl:l,member:n,site:t,siteUrl:e,clickHandler:c})}s.addEventListener("click",c)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-edit-billing]"),function(s){let l=s.querySelector("[data-members-error]"),c=s.dataset.membersSuccess,m=s.dataset.membersCancel,p,d;c&&(p=new URL(c,window.location.href).href),m&&(d=new URL(m,window.location.href).href);function h(y){s.removeEventListener("click",h),y.preventDefault(),l&&(l.innerText=""),s.classList.add("loading"),fetch(`${e}/members/api/session`,{credentials:"same-origin"}).then(function(v){return v.ok?v.text():null}).then(function(v){return fetch(`${e}/members/api/create-stripe-update-session/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:v,successUrl:p,cancelUrl:d})}).then(function(g){if(!g.ok)throw new Error(f("Could not create Stripe checkout session"));return g.json()})}).then(function(v){return window.Stripe(v.publicKey).redirectToCheckout({sessionId:v.sessionId})}).then(function(v){if(v.error)throw new Error(f(v.error.message))}).catch(function(v){console.error(v),s.addEventListener("click",h),s.classList.remove("loading"),l&&(l.innerText=v.message),s.classList.add("error")})}s.addEventListener("click",h)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-manage-billing]"),function(s){let l=s.querySelector("[data-members-error]"),c=s.dataset.membersReturn,m;c&&(m=new URL(c,window.location.href).href);function p(d){s.removeEventListener("click",p),d.preventDefault(),l&&(l.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:m})}).then(function(y){if(!y.ok)throw new Error(f("Could not create Stripe billing portal session"));return y.json()})}).then(function(h){return window.location.assign(h.url)}).catch(function(h){console.error(h),s.addEventListener("click",p),s.classList.remove("loading"),l&&(l.innerText=h.message),s.classList.add("error")})}s.addEventListener("click",p)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-signout]"),function(s){function l(c){s.removeEventListener("click",l),c.preventDefault(),s.classList.remove("error"),s.classList.add("loading"),fetch(`${e}/members/api/session`,{method:"DELETE"}).then(function(m){m.ok?window.location.replace(e):(s.addEventListener("click",l),s.classList.remove("loading"),s.classList.add("error"))})}s.addEventListener("click",l)});const o=(a||[]).some(s=>s.redemption_type==="retention");Array.prototype.forEach.call(document.querySelectorAll("[data-members-cancel-subscription]"),function(s){let l=s.parentElement.querySelector("[data-members-error]");function c(m){m.preventDefault();let p=s.dataset.membersCancelSubscription;if(o){i("openPopup",{page:"accountPlan",pageData:{subscriptionId:p,action:"cancel"}});return}return s.removeEventListener("click",c),s.classList.remove("error"),s.classList.add("loading"),l&&(l.innerText=""),fetch(`${e}/members/api/session`,{credentials:"same-origin"}).then(function(d){return d.ok?d.text():null}).then(function(d){return fetch(`${e}/members/api/subscriptions/${p}/`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:d,smart_cancel:!0})})}).then(function(d){d.ok?window.location.reload():(s.addEventListener("click",c),s.classList.remove("loading"),s.classList.add("error"),l&&(l.innerText=f("There was an error cancelling your subscription, please try again.")))})}s.addEventListener("click",c)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-continue-subscription]"),function(s){let l=s.parentElement.querySelector("[data-members-error]");function c(m){s.removeEventListener("click",c),m.preventDefault(),s.classList.remove("error"),s.classList.add("loading");let p=s.dataset.membersContinueSubscription;return l&&(l.innerText=""),fetch(`${e}/members/api/session`,{credentials:"same-origin"}).then(function(d){return d.ok?d.text():null}).then(function(d){return fetch(`${e}/members/api/subscriptions/${p}/`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:d,cancel_at_period_end:!1})})}).then(function(d){d.ok?window.location.reload():(s.addEventListener("click",c),s.classList.remove("loading"),s.classList.add("error"),l&&(l.innerText=f("There was an error continuing your subscription, please try again.")))})}s.addEventListener("click",c)})}const Tz={showPopup:!0,site:ti,member:Fr.free,page:"accountEmail",...VP(),pageData:wk};function Pz({site:e,children:t}){const{portal_sentry:n}=e||{};return n&&n.dsn?u.jsx(Jc,{children:t}):u.jsx(u.Fragment,{children:t})}class zz extends Z.Component{constructor(t){super(t),this.setupCustomTriggerButton(),this.state={site:null,member:null,offers:[],page:"loading",showPopup:!1,action:"init:running",actionErrorMessage:null,initStatus:"running",lastPage:null,customSiteUrl:t.customSiteUrl,locale:t.locale,scrollbarWidth:0}}componentDidMount(){const t=this.getScrollbarWidth();this.setState({scrollbarWidth:t}),this.initSetup()}componentDidUpdate(t,n){var a,i,r;if(n.showPopup!==this.state.showPopup){this.handleCustomTriggerClassUpdate();try{this.state.showPopup?(this.bodyScroll=(r=(i=(a=window.document)==null?void 0:a.body)==null?void 0:i.style)==null?void 0:r.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)}catch{}}if(this.state.initStatus==="success"&&n.initStatus!==this.state.initStatus){const{siteUrl:o}=this.props,s=this.getContextFromState();this.sendPortalReadyEvent(),$z({siteUrl:o,site:s.site,member:s.member,offers:s.offers,doAction:s.doAction,captureException:ss})}}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=a=>{a.preventDefault();const i=a.currentTarget,r=i&&i.dataset.portal,{page:o,pageQuery:s,pageData:l}=this.getPageFromLinkPath(r)||{};this.state.initStatus==="success"&&(s&&s!=="free"?this.handleSignupQuery({site:this.state.site,pageQuery:s}):this.dispatchAction("openPopup",{page:o,pageQuery:s,pageData:l}))};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 r=this.state.showPopup?t:n,o=this.state.showPopup?n:t;i.classList.add(r),i.classList.remove(o)})}async initSetup(){try{const{site:t,member:n,offers:a,page:i,showPopup:r,popupNotification:o,lastPage:s,pageQuery:l,pageData:c}=await this.fetchData(),m=this.props.siteI18nEnabled&&(this.props.locale||t.locale)||"en";zs.changeLanguage(m);const p={site:t,member:n,offers:a,page:i,lastPage:s,pageQuery:l,showPopup:r,pageData:c,popupNotification:o,dir:zs.dir()||"ltr",action:"init:success",initStatus:"success",locale:m};if(this.handleSignupQuery({site:t,pageQuery:l,member:n}),this.setState(p),this.hashHandler=()=>{this.updateStateForPreviewLinks()},window.addEventListener("hashchange",this.hashHandler,!1),!n){const d=document.querySelectorAll("[data-lexical-signup-form]");d.length>0&&d.forEach(h=>{h.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,...r}=this.fetchDevData(),{site:o,...s}=this.fetchLinkData(t,n),{site:l,...c}=this.fetchPreviewData(),{site:m,...p}=this.fetchNotificationData();return{member:n,offers:a,page:"",site:{...t,...o,...l,...m,...i,plans:{...(i||{}).plans,...(t||{}).plans,...(l||{}).plans}},...r,...s,...p,...c}}fetchDevData(){return de(["dev"])&&!this.state.customSiteUrl?Tz:de(["test"])?{showPopup:this.props.showPopup!==void 0?this.props.showPopup:!0}:{}}fetchOfferQueryStrData(t=""){var i,r,o;const n=new URLSearchParams(t),a={};for(let s of n.entries()){const l=s[0],c=decodeURIComponent(s[1]);l==="name"?a.name=c||"":l==="code"?a.code=c||"":l==="display_title"?a.display_title=c||"":l==="display_description"?a.display_description=c||"":l==="type"?a.type=c||"":l==="cadence"?a.cadence=c||"":l==="duration"?a.duration=c||"":l==="duration_in_months"&&!isNaN(Number(c))?a.duration_in_months=Number(c):l==="amount"&&!isNaN(Number(c))?a.amount=Number(c):l==="currency"?a.currency=c||"":l==="status"?a.status=c||"":l==="tier_id"?a.tier={id:c||wk.tier.id}:l==="redemption_type"&&(a.redemption_type=c||"signup")}if(a.redemption_type==="retention"){const s=(o=(r=(i=Fr.preview)==null?void 0:i.subscriptions)==null?void 0:r[0])==null?void 0:o.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 r,o=null,s,l,c;for(let m of n.entries()){const p=m[0],d=decodeURIComponent(m[1]);if(p==="button")a.site.portal_button=JSON.parse(d);else if(p==="name")a.site.portal_name=JSON.parse(d);else if(p==="isFree"&&JSON.parse(d))i.push("free");else if(p==="isMonthly"&&JSON.parse(d))i.push("monthly");else if(p==="isYearly"&&JSON.parse(d))i.push("yearly");else if(p==="portalPrices")r=d?d.split(","):[];else if(p==="portalProducts")o=d?d.split(","):[];else if(p==="page"&&d)a.page=d;else if(p==="accentColor"&&(d===""||d))a.site.accent_color=d;else if(p==="buttonIcon"&&d)a.site.portal_button_icon=d;else if(p==="signupButtonText")a.site.portal_button_signup_text=d||"";else if(p==="signupTermsHtml")a.site.portal_signup_terms_html=d||"";else if(p==="signupCheckboxRequired")a.site.portal_signup_checkbox_required=JSON.parse(d);else if(p==="buttonStyle"&&d)a.site.portal_button_style=d;else if(p==="monthlyPrice"&&!isNaN(Number(d)))a.site.plans.monthly=Number(d),s=Number(d);else if(p==="yearlyPrice"&&!isNaN(Number(d)))a.site.plans.yearly=Number(d),l=Number(d);else if(p==="currency"&&d){const h=d.toUpperCase();a.site.plans.currency=h,a.site.plans.currency_symbol=ve(h),c=h}else p==="disableBackground"?a.site.disableBackground=JSON.parse(d):p==="membersSignupAccess"&&d?a.site.members_signup_access=d:p==="portalDefaultPlan"&&d?a.site.portal_default_plan=d:p==="transistorPortalSettings"&&d&&(a.site.transistor_portal_settings=JSON.parse(d))}return a.site.portal_plans=i,a.site.portal_products=o,r?a.site.portal_plans=r:s&&l&&c&&(a.site.prices=[{id:"monthly",stripe_price_id:"dummy_stripe_monthly",stripe_product_id:"dummy_stripe_product",active:1,nickname:"Monthly",currency:c,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:c,amount:l,type:"recurring",interval:"year"}]),a}fetchNotificationData(){const{type:t,status:n,duration:a,autoHide:i,closeable:r}=Sy({billingOnly:!0})||{};return["stripe:billing-update"].includes(t)?n==="success"?{showPopup:!0,popupNotification:le({type:t,status:n,duration:a,closeable:r,autoHide:i,state:this.state,message:n==="success"?"Billing info updated successfully":""})}:{showPopup:!0}:{}}fetchLinkData(t,n){const a=new URLSearchParams(window.location.search);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(k0({site:t})&&a.get("action")==="signup"&&a.get("success")==="true")return{showPopup:!0,page:"recommendations",pageData:{signup:!0}};const[i,r]=window.location.hash.substr(1).split("?"),o=new URLSearchParams(r??""),s=/^(?:(\w+?))?\/monthly$/,l=/^(?:(\w+?))?\/yearly$/,c=/^offers\/(\w+?)\/?$/,m=/^\/portal\/?(?:\/(\w+(?:\/\w+)*))?\/?$/,p=/^\/feedback\/(\w+?)\/(\w+?)\/?$/;if(i&&p.test(i)){const[,d,h]=i.match(p),y=parseInt(h);if(y===1||y===0)return n||o.get("uuid")&&o.get("key")?{showPopup:!0,page:"feedback",pageData:{uuid:n?null:o.get("uuid"),key:n?null:o.get("key"),postId:d,score:y}}:{showPopup:!0,page:"signin",pageData:{redirect:t.url+`#/feedback/${d}/${y}/`}}}if(i&&m.test(i)){const[,d]=i.match(m),{page:h,pageQuery:y,pageData:v}=this.getPageFromLinkPath(d,t)||{};if(!n&&h&&gk({page:h}))return{showPopup:!0,page:"signin",pageData:{redirect:t.url+`#/portal/${d}/`}};const g=["accountPlan","accountProfile"].includes(h)?"accountHome":null;return{showPopup:!(["monthly","yearly"].includes(y)||s.test(y)||l.test(y)||c.test(y)),...h?{page:h}:{},...y?{pageQuery:y}:{},...v?{pageData:v}:{},...g?{lastPage:g}:{}}}return{}}fetchPreviewData(){const[,t]=window.location.hash.substr(1).split("?");if(de(["preview"])){let n={};return de(["offerPreview"])?n=this.fetchOfferQueryStrData(t):n=this.fetchQueryStrData(t),{...n,showPopup:!0}}return{}}getColorOverride(){const t=document.querySelector("script[data-ghost]");return t&&t.dataset.accentColor?t.dataset.accentColor:!1}async fetchApiData(){const{siteUrl:t,customSiteUrl:n,apiUrl:a,apiKey:i}=this.props;try{this.GhostApi=this.props.api||Js({siteUrl:t,apiUrl:a,apiKey:i});const{site:r,member:o,offers:s}=await this.GhostApi.init(),l=this.getColorOverride();return l&&(r.accent_color=l),this.setupFirstPromoter({site:r,member:o}),this.setupSentry({site:r}),{site:r,member:o,offers:s}}catch(r){if(de(["dev","test"],{customSiteUrl:n}))return{};throw r}}setupSentry({site:t}){if(de(["test"]))return null;const{portal_sentry:n,portal_version:a,version:i}=t,o=`portal@2.64.15|ghost@${i}`;n&&n.dsn&&Gj({dsn:n.dsn,environment:n.env||"development",release:o,beforeSend:s=>c0({event:s})?s:null,allowUrls:[/https?:\/\/((www)\.)?unpkg\.com\/@tryghost\/portal/]})}setupFirstPromoter({site:t,member:n}){if(de(["test"]))return null;const a=T0({site:t});let i=bd({site:t});if(i=i==null?void 0:i.replace(/^(\S*\.)?(\S*\.\S*)$/i,".$2"),a&&i){const r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src="https://cdn.firstpromoter.com/fprom.js",r.onload=r.onreadystatechange=function(){let s=this.readyState;if(!s||s==="complete"||s==="loaded")try{if(window.$FPROM.init(a,i),R0({member:n})){const l=n.email,c=n.uuid;if(window.$FPROM)window.$FPROM.trackSignup({email:l,uid:c});else{const m=window._fprom||[];window._fprom=m,m.push(["event","signup"]),m.push(["email",l]),m.push(["uid",c])}}}catch{}};const o=document.getElementsByTagName("script")[0];o.parentNode.insertBefore(r,o)}}async dispatchAction(t,n){clearTimeout(this.timeoutId),this.setState({action:`${t}:running`,actionErrorMessage:null});try{const a=await xz({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:Zt(a,f("An unexpected error occured. Please try again or <a>contact support</a> if the error persists.")),popupNotification:i})}}updateStateForPreviewLinks(){const{site:t,...n}=this.fetchPreviewData(),{site:a,...i}=this.fetchLinkData(this.state.site,this.state.member),r={site:{...this.state.site,...a||{},...t||{},plans:{...this.state.site&&this.state.site.plans,...(a||{}).plans,...(t||{}).plans}},...i,...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(dd(),!Mt({member:a})||Tn({member:a}))try{const r=await this.GhostApi.site.offer({offerId:n}),o=r==null?void 0:r.offers[0];if(!o||!o.tier||fy({offer:o})||!I0({site:t,offer:o}))return;if(i)this.dispatchAction("openPopup",{page:"offer",pageData:r==null?void 0:r.offers[0]});else{const s=Xn({site:t,productId:o.tier.id}),l=o.cadence==="month"?s.monthlyPrice:s.yearlyPrice;if(this.dispatchAction("openPopup",{page:"loading"}),a){const{tierId:c,cadence:m}=ta({site:t,priceId:l.id});this.dispatchAction("checkoutPlan",{plan:l.id,offerId:n,tierId:c,cadence:m})}else{const{tierId:c,cadence:m}=ta({site:t,priceId:l.id});this.dispatchAction("signup",{plan:l.id,offerId:n,tierId:c,cadence:m})}}}catch{}}handleSignupQuery({site:t,pageQuery:n,member:a}){const i=/^offers\/(\w+?)\/?$/;let r=n;if(i.test(n||"")){const[,s]=n.match(i);this.handleOfferQuery({site:t,offerId:s,member:a});return}hy({site:t,pageQuery:n})&&(r=hy({site:t,pageQuery:n}));const o=b0({site:t,priceId:r});if(n&&n!=="free"){dd();const s=(o==null?void 0:o.id)||r;s!=="free"&&this.dispatchAction("openPopup",{page:"loading"});const{tierId:l,cadence:c}=ta({site:t,priceId:s});this.dispatchAction("signup",{plan:s,tierId:l,cadence:c})}}getPageFromLinkPath(t){const n=/^signup\/?(?:\/(\w+?))?\/?$/,a=/^signup\/?(?:\/(\w+?))\/monthly\/?$/,i=/^signup\/?(?:\/(\w+?))\/yearly\/?$/,r=/^offers\/(\w+?)\/?$/;if(t===void 0||t==="")return{page:"default"};if(r.test(t))return{pageQuery:t};if(t==="signup")return{page:"signup"};if(a.test(t)){const[,o]=t.match(a);return{page:"signup",pageQuery:`${o}/monthly`}}else if(i.test(t)){const[,o]=t.match(i);return{page:"signup",pageQuery:`${o}/yearly`}}else if(n.test(t)){const[,o]=t.match(n);return{page:"signup",pageQuery:o}}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==="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 f1(t)}getContextPage({site:t,page:n,member:a}){if(!n||n==="default"){const i=Dt({site:t})||!Xt({site:t})?"signin":"signup";n=a?"accountHome":i}return nm({page:n})}getContextMember({page:t,member:n,customSiteUrl:a}){return de(["dev","preview"],{customSiteUrl:a})?gk({page:t})||FP({page:t})?de(["dev"],{customSiteUrl:a})?n||Fr.free:de(["preview"])?Fr.preview:Fr.paid:null:n}getContextFromState(){const{site:t,member:n,offers:a,action:i,actionErrorMessage:r,page:o,lastPage:s,showPopup:l,pageQuery:c,pageData:m,popupNotification:p,customSiteUrl:d,dir:h,scrollbarWidth:y,otcRef:v,inboxLinks:g}=this.state,b=this.getContextPage({site:t,page:o,member:n}),k=this.getContextMember({page:b,member:n,customSiteUrl:d});return{api:this.GhostApi,site:t,offers:a,action:i,actionErrorMessage:r,brandColor:this.getAccentColor(),page:b,pageQuery:c,pageData:m,member:k,lastPage:s,showPopup:l,popupNotification:p,customSiteUrl:d,dir:h,scrollbarWidth:y,otcRef:v,inboxLinks:g,doAction:(E,x)=>this.dispatchAction(E,x)}}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"]').forEach(HP)}render(){return this.state.initStatus==="success"?u.jsx(Pz,{site:this.state.site,children:u.jsxs(_.Provider,{value:this.getContextFromState(),children:[u.jsx(im,{}),u.jsx(wd,{}),u.jsx($d,{})]})}):null}}const Ek="ghost-portal-root";function Nz(){const e=document.createElement("div");e.id=Ek,e.setAttribute("data-testid","portal-root"),document.body.appendChild(e)}function Az(){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,r=e.dataset.locale;return{siteUrl:n,apiKey:a,apiUrl:i,siteI18nEnabled:t,locale:r}}return{}}function Iz(){const e=new URL(window.location.href);e.searchParams.get("token")&&(e.searchParams.delete("token"),window.history.replaceState({},document.title,e.href))}function Mz(){const{siteUrl:e,apiKey:t,apiUrl:n,siteI18nEnabled:a,locale:i}=Az(),r=e||window.location.origin;Nz(),Iz(),nS.render(u.jsx(Z.StrictMode,{children:u.jsx(zz,{siteUrl:r,customSiteUrl:e,apiKey:t,apiUrl:n,siteI18nEnabled:a,locale:i})}),document.getElementById(Ek))}Mz()});
3554
3554
  //# sourceMappingURL=portal.min.js.map