@tryghost/portal 2.45.1 → 2.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/umd/portal.min.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".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-right:16px}.gh-portal-account-footermenu li:last-of-type{margin-right: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-right:-3px;opacity:.6}.gh-portal-product-icon{width:52px;margin-right: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-right: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}}.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-left:4px}.emailReceivingFAQ .gh-portal-btn-back,.emailReceivingFAQ .gh-portal-btn-back:hover{left:calc(6vmin - 14px)}.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}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
1
+ (function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".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}}.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}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
2
  var cj=Object.defineProperty;var uj=(Ae,tt,Ge)=>tt in Ae?cj(Ae,tt,{enumerable:!0,configurable:!0,writable:!0,value:Ge}):Ae[tt]=Ge;var Z=(Ae,tt,Ge)=>(uj(Ae,typeof tt!="symbol"?tt+"":tt,Ge),Ge);(function(Ae){typeof define=="function"&&define.amd?define(Ae):Ae()})(function(){var vu,ay,iy;"use strict";function Ae(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var tt={exports:{}},Ge={};/*
3
3
  object-assign
4
4
  (c) Sindre Sorhus
@@ -64,7 +64,7 @@ Url: ${lo(e)}`),!0)}function jw(e,t){return e.type||!t||!t.length?!1:Iw(e).some(
64
64
  *
65
65
  * This source code is licensed under the MIT license found in the
66
66
  * LICENSE file in the root directory of this source tree.
67
- */var le=typeof Symbol=="function"&&Symbol.for,Rc=le?Symbol.for("react.element"):60103,Yc=le?Symbol.for("react.portal"):60106,po=le?Symbol.for("react.fragment"):60107,ho=le?Symbol.for("react.strict_mode"):60108,go=le?Symbol.for("react.profiler"):60114,fo=le?Symbol.for("react.provider"):60109,yo=le?Symbol.for("react.context"):60110,Uc=le?Symbol.for("react.async_mode"):60111,bo=le?Symbol.for("react.concurrent_mode"):60111,ko=le?Symbol.for("react.forward_ref"):60112,vo=le?Symbol.for("react.suspense"):60113,YS=le?Symbol.for("react.suspense_list"):60120,wo=le?Symbol.for("react.memo"):60115,xo=le?Symbol.for("react.lazy"):60116,US=le?Symbol.for("react.block"):60121,LS=le?Symbol.for("react.fundamental"):60117,OS=le?Symbol.for("react.responder"):60118,BS=le?Symbol.for("react.scope"):60119;function Me(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case Rc:switch(e=e.type,e){case Uc:case bo:case po:case go:case ho:case vo:return e;default:switch(e=e&&e.$$typeof,e){case yo:case ko:case xo:case wo:case fo:return e;default:return t}}case Yc:return t}}}function vg(e){return Me(e)===bo}O.AsyncMode=Uc,O.ConcurrentMode=bo,O.ContextConsumer=yo,O.ContextProvider=fo,O.Element=Rc,O.ForwardRef=ko,O.Fragment=po,O.Lazy=xo,O.Memo=wo,O.Portal=Yc,O.Profiler=go,O.StrictMode=ho,O.Suspense=vo,O.isAsyncMode=function(e){return vg(e)||Me(e)===Uc},O.isConcurrentMode=vg,O.isContextConsumer=function(e){return Me(e)===yo},O.isContextProvider=function(e){return Me(e)===fo},O.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===Rc},O.isForwardRef=function(e){return Me(e)===ko},O.isFragment=function(e){return Me(e)===po},O.isLazy=function(e){return Me(e)===xo},O.isMemo=function(e){return Me(e)===wo},O.isPortal=function(e){return Me(e)===Yc},O.isProfiler=function(e){return Me(e)===go},O.isStrictMode=function(e){return Me(e)===ho},O.isSuspense=function(e){return Me(e)===vo},O.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===po||e===bo||e===go||e===ho||e===vo||e===YS||typeof e=="object"&&e!==null&&(e.$$typeof===xo||e.$$typeof===wo||e.$$typeof===fo||e.$$typeof===yo||e.$$typeof===ko||e.$$typeof===LS||e.$$typeof===OS||e.$$typeof===BS||e.$$typeof===US)},O.typeOf=Me,kg.exports=O;var HS=kg.exports,wg=HS,VS={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},WS={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},xg={};xg[wg.ForwardRef]=VS,xg[wg.Memo]=WS;const KS=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function GS(e){const t=e.match(/^([^.]+)/);return t!==null&&parseInt(t[0])>=17}const Sg={componentStack:null,error:null,eventId:null};function qS(e,t){const n=new WeakMap;function a(i,r){if(!n.has(i)){if(i.cause)return n.set(i,!0),a(i.cause,r);i.cause=r}}a(e,t)}class Lc extends k.Component{constructor(t){super(t),Lc.prototype.__init.call(this),this.state=Sg,this._openFallbackReportDialog=!0;const n=Ee();n&&n.on&&t.showDialog&&(this._openFallbackReportDialog=!1,n.on("afterSendEvent",a=>{!a.type&&a.event_id===this._lastEventId&&gg({...t.dialogOptions,eventId:this._lastEventId})}))}componentDidCatch(t,{componentStack:n}){const{beforeCapture:a,onError:i,showDialog:r,dialogOptions:o}=this.props;fh(s=>{if(GS(k.version)&&oc(t)){const u=new Error(t.message);u.name=`React ErrorBoundary ${t.name}`,u.stack=n,qS(t,u)}a&&a(s,t,n);const l=Pc(t,{captureContext:{contexts:{react:{componentStack:n}}},mechanism:{handled:!!this.props.fallback}});i&&i(t,n,l),r&&(this._lastEventId=l,this._openFallbackReportDialog&&gg({...o,eventId:l})),this.setState({error:t,componentStack:n,eventId:l})})}componentDidMount(){const{onMount:t}=this.props;t&&t()}componentWillUnmount(){const{error:t,componentStack:n,eventId:a}=this.state,{onUnmount:i}=this.props;i&&i(t,n,a)}__init(){this.resetErrorBoundary=()=>{const{onReset:t}=this.props,{error:n,componentStack:a,eventId:i}=this.state;t&&t(n,a,i),this.setState(Sg)}}render(){const{fallback:t,children:n}=this.props,a=this.state;if(a.error){let i;return typeof t=="function"?i=t({error:a.error,componentStack:a.componentStack,resetError:this.resetErrorBoundary,eventId:a.eventId}):i=t,k.isValidElement(i)?i:(t&&KS&&A.warn("fallback did not produce a valid ReactElement"),null)}return typeof n=="function"?n():n}}class Oc extends k.Component{constructor(){super(...arguments);Z(this,"handleLoad",()=>{this.setupFrameBaseStyle()})}componentDidMount(){this.node.addEventListener("load",this.handleLoad)}componentWillUnmout(){this.node.removeEventListener("load",this.handleLoad)}setupFrameBaseStyle(){this.node.contentDocument&&(this.iframeHtml=this.node.contentDocument.documentElement,this.iframeHead=this.node.contentDocument.head,this.iframeRoot=this.node.contentDocument.body,this.forceUpdate())}render(){const{children:n,head:a,title:i="",style:r={},dataTestId:o="",...s}=this.props;return c.jsxs("iframe",{srcDoc:"<!DOCTYPE html>","data-testid":o,ref:l=>this.node=l,title:i,style:r,frameBorder:"0",...s,children:[this.iframeHead&&rc.createPortal(a,this.iframeHead),this.iframeRoot&&rc.createPortal(n,this.iframeRoot)]})}}const Bc=e=>k.createElement("svg",{id:"Regular",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},k.createElement("defs",null,k.createElement("style",null,".cls-1{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:0.8px;}")),k.createElement("circle",{className:"cls-1",cx:12,cy:9.75,r:5.25}),k.createElement("path",{className:"cls-1",d:"M18.913,20.876a9.746,9.746,0,0,0-13.826,0"}),k.createElement("circle",{className:"cls-1",cx:12,cy:12,r:11.25})),Eg=`
67
+ */var le=typeof Symbol=="function"&&Symbol.for,Rc=le?Symbol.for("react.element"):60103,Yc=le?Symbol.for("react.portal"):60106,po=le?Symbol.for("react.fragment"):60107,ho=le?Symbol.for("react.strict_mode"):60108,go=le?Symbol.for("react.profiler"):60114,fo=le?Symbol.for("react.provider"):60109,yo=le?Symbol.for("react.context"):60110,Uc=le?Symbol.for("react.async_mode"):60111,bo=le?Symbol.for("react.concurrent_mode"):60111,ko=le?Symbol.for("react.forward_ref"):60112,vo=le?Symbol.for("react.suspense"):60113,YS=le?Symbol.for("react.suspense_list"):60120,wo=le?Symbol.for("react.memo"):60115,xo=le?Symbol.for("react.lazy"):60116,US=le?Symbol.for("react.block"):60121,LS=le?Symbol.for("react.fundamental"):60117,OS=le?Symbol.for("react.responder"):60118,BS=le?Symbol.for("react.scope"):60119;function Me(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case Rc:switch(e=e.type,e){case Uc:case bo:case po:case go:case ho:case vo:return e;default:switch(e=e&&e.$$typeof,e){case yo:case ko:case xo:case wo:case fo:return e;default:return t}}case Yc:return t}}}function vg(e){return Me(e)===bo}O.AsyncMode=Uc,O.ConcurrentMode=bo,O.ContextConsumer=yo,O.ContextProvider=fo,O.Element=Rc,O.ForwardRef=ko,O.Fragment=po,O.Lazy=xo,O.Memo=wo,O.Portal=Yc,O.Profiler=go,O.StrictMode=ho,O.Suspense=vo,O.isAsyncMode=function(e){return vg(e)||Me(e)===Uc},O.isConcurrentMode=vg,O.isContextConsumer=function(e){return Me(e)===yo},O.isContextProvider=function(e){return Me(e)===fo},O.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===Rc},O.isForwardRef=function(e){return Me(e)===ko},O.isFragment=function(e){return Me(e)===po},O.isLazy=function(e){return Me(e)===xo},O.isMemo=function(e){return Me(e)===wo},O.isPortal=function(e){return Me(e)===Yc},O.isProfiler=function(e){return Me(e)===go},O.isStrictMode=function(e){return Me(e)===ho},O.isSuspense=function(e){return Me(e)===vo},O.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===po||e===bo||e===go||e===ho||e===vo||e===YS||typeof e=="object"&&e!==null&&(e.$$typeof===xo||e.$$typeof===wo||e.$$typeof===fo||e.$$typeof===yo||e.$$typeof===ko||e.$$typeof===LS||e.$$typeof===OS||e.$$typeof===BS||e.$$typeof===US)},O.typeOf=Me,kg.exports=O;var HS=kg.exports,wg=HS,VS={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},WS={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},xg={};xg[wg.ForwardRef]=VS,xg[wg.Memo]=WS;const KS=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function GS(e){const t=e.match(/^([^.]+)/);return t!==null&&parseInt(t[0])>=17}const Sg={componentStack:null,error:null,eventId:null};function qS(e,t){const n=new WeakMap;function a(i,r){if(!n.has(i)){if(i.cause)return n.set(i,!0),a(i.cause,r);i.cause=r}}a(e,t)}class Lc extends k.Component{constructor(t){super(t),Lc.prototype.__init.call(this),this.state=Sg,this._openFallbackReportDialog=!0;const n=Ee();n&&n.on&&t.showDialog&&(this._openFallbackReportDialog=!1,n.on("afterSendEvent",a=>{!a.type&&a.event_id===this._lastEventId&&gg({...t.dialogOptions,eventId:this._lastEventId})}))}componentDidCatch(t,{componentStack:n}){const{beforeCapture:a,onError:i,showDialog:r,dialogOptions:o}=this.props;fh(s=>{if(GS(k.version)&&oc(t)){const u=new Error(t.message);u.name=`React ErrorBoundary ${t.name}`,u.stack=n,qS(t,u)}a&&a(s,t,n);const l=Pc(t,{captureContext:{contexts:{react:{componentStack:n}}},mechanism:{handled:!!this.props.fallback}});i&&i(t,n,l),r&&(this._lastEventId=l,this._openFallbackReportDialog&&gg({...o,eventId:l})),this.setState({error:t,componentStack:n,eventId:l})})}componentDidMount(){const{onMount:t}=this.props;t&&t()}componentWillUnmount(){const{error:t,componentStack:n,eventId:a}=this.state,{onUnmount:i}=this.props;i&&i(t,n,a)}__init(){this.resetErrorBoundary=()=>{const{onReset:t}=this.props,{error:n,componentStack:a,eventId:i}=this.state;t&&t(n,a,i),this.setState(Sg)}}render(){const{fallback:t,children:n}=this.props,a=this.state;if(a.error){let i;return typeof t=="function"?i=t({error:a.error,componentStack:a.componentStack,resetError:this.resetErrorBoundary,eventId:a.eventId}):i=t,k.isValidElement(i)?i:(t&&KS&&A.warn("fallback did not produce a valid ReactElement"),null)}return typeof n=="function"?n():n}}class Oc extends k.Component{constructor(){super(...arguments);Z(this,"handleLoad",()=>{this.setupFrameBaseStyle()})}componentDidMount(){this.node.addEventListener("load",this.handleLoad)}componentWillUnmout(){this.node.removeEventListener("load",this.handleLoad)}setupFrameBaseStyle(){this.node.contentDocument&&(this.iframeHtml=this.node.contentDocument.documentElement,this.iframeHead=this.node.contentDocument.head,this.iframeRoot=this.node.contentDocument.body,this.iframeHtml.setAttribute("dir",this.props.dataDir),this.forceUpdate())}render(){const{children:n,head:a,title:i="",style:r={},dataTestId:o="",dataDir:s="ltr",...l}=this.props;return c.jsxs("iframe",{srcDoc:"<!DOCTYPE html>","data-testid":o,ref:u=>this.node=u,title:i,style:r,frameBorder:"0",dir:s,...l,children:[this.iframeHead&&rc.createPortal(a,this.iframeHead),this.iframeRoot&&rc.createPortal(n,this.iframeRoot)]})}}const Bc=e=>k.createElement("svg",{id:"Regular",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},k.createElement("defs",null,k.createElement("style",null,".cls-1{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:0.8px;}")),k.createElement("circle",{className:"cls-1",cx:12,cy:9.75,r:5.25}),k.createElement("path",{className:"cls-1",d:"M18.913,20.876a9.746,9.746,0,0,0-13.826,0"}),k.createElement("circle",{className:"cls-1",cx:12,cy:12,r:11.25})),Eg=`
68
68
  .gh-portal-avatar {
69
69
  position: relative;
70
70
  display: flex;
@@ -87,7 +87,7 @@ Url: ${lo(e)}`),!0)}function jw(e,t){return e.type||!t||!t.length?!1:Iw(e).some(
87
87
  opacity: 1;
88
88
  max-width: unset;
89
89
  }
90
- `,JS=({style:e={}})=>({avatarContainer:{...e.avatarContainer||{}},gravatar:{...e.avatarContainer||{}},userIcon:{width:"34px",height:"34px",color:"#fff",...e.userIcon||{}}});function Hc({gravatar:e,style:t}){let n=JS({style:t});return c.jsxs("figure",{className:"gh-portal-avatar",style:n.avatarContainer,children:[c.jsx(Bc,{style:n.userIcon}),e?c.jsx("img",{style:n.gravatar,src:e,alt:""}):null]})}const N=U.createContext({site:{},member:{},action:"",lastPage:"",brandColor:"",pageData:{},onAction:(e,t)=>({action:e,data:t}),t:()=>{}}),QS=e=>k.createElement("svg",{width:21,height:24,viewBox:"0 0 21 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},k.createElement("path",{d:"M10.533 11.267c2.835 0 5.134-2.299 5.134-5.134C15.667 3.298 13.368 1 10.533 1 7.698 1 5.4 3.298 5.4 6.133s2.298 5.134 5.133 5.134zM1 23c0-2.529 1.004-4.953 2.792-6.741 1.788-1.788 4.213-2.792 6.741-2.792 2.529 0 4.954 1.004 6.741 2.792 1.788 1.788 2.793 4.212 2.793 6.74",stroke:"#fff",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),ZS=e=>k.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...e},k.createElement("g",{fill:"none",fillRule:"evenodd"},k.createElement("path",{stroke:"#FFF",strokeWidth:1.5,strokeLinecap:"round",d:"M12.5 2v20M2 12.5h20"}))),XS=e=>k.createElement("svg",{width:25,height:24,viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},k.createElement("path",{d:"M23.5 6v14.25c0 .597-.237 1.169-.659 1.591-.422.422-.994.659-1.591.659s-1.169-.237-1.591-.659c-.422-.422-.659-.994-.659-1.591V3c0-.398-.158-.78-.44-1.06-.28-.282-.662-.44-1.06-.44h-15c-.398 0-.78.158-1.06.44C1.157 2.22 1 2.601 1 3v17.25c0 .597.237 1.169.659 1.591.422.422.994.659 1.591.659h18M4.75 15h10.5M4.75 18h6",stroke:"#fff",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),k.createElement("path",{d:"M14.5 5.25h-9c-.414 0-.75.336-.75.75v4.5c0 .414.336.75.75.75h9c.414 0 .75-.336.75-.75V6c0-.414-.336-.75-.75-.75z",stroke:"#fff",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),eE=e=>k.createElement("svg",{width:24,height:18,viewBox:"0 0 24 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},k.createElement("path",{d:"M21.75 1.5H2.25c-.828 0-1.5.672-1.5 1.5v12c0 .828.672 1.5 1.5 1.5h19.5c.828 0 1.5-.672 1.5-1.5V3c0-.828-.672-1.5-1.5-1.5zM15.687 6.975L19.5 10.5M8.313 6.975L4.5 10.5",stroke:"#fff",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),k.createElement("path",{d:"M22.88 2.014l-9.513 6.56C12.965 8.851 12.488 9 12 9s-.965-.149-1.367-.426L1.12 2.014",stroke:"#fff",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),tE=e=>k.createElement("svg",{width:26,height:26,viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},k.createElement("path",{d:"M17.903 12.016c-.332-1.665-1.491-3.032-3.031-3.654M11.037 8.4C9.252 9.163 8 10.935 8 13c0 .432.055.85.158 1.25M10.44 17.296c.748.447 1.624.704 2.56.704 1.71 0 3.22-.858 4.12-2.167M15.171 21.22c3.643-.96 6.329-4.276 6.329-8.22 0-1.084-.203-2.121-.573-3.075M18.611 6.615C17.114 5.3 15.151 4.5 13 4.5c-2.149 0-4.112.797-5.608 2.113M5.112 9.826c-.395.98-.612 2.052-.612 3.174 0 4.015 2.783 7.38 6.526 8.27",stroke:"#fff",strokeWidth:1.5,strokeLinecap:"round"}),k.createElement("path",{d:"M8.924 24.29c1.273.46 2.645.71 4.076.71 5.52 0 10.17-3.727 11.57-8.803M6.712 2.777C3.285 4.89 1 8.678 1 13c0 3.545 1.537 6.731 3.982 8.928M24.849 11.089C23.933 5.369 18.977 1 13 1c-.69 0-1.367.058-2.025.17",stroke:"#fff",strokeWidth:1.5,strokeLinecap:"round"})),Vc=`
90
+ `,JS=({style:e={}})=>({avatarContainer:{...e.avatarContainer||{}},gravatar:{...e.avatarContainer||{}},userIcon:{width:"34px",height:"34px",color:"#fff",...e.userIcon||{}}});function Hc({gravatar:e,style:t}){let n=JS({style:t});return c.jsxs("figure",{className:"gh-portal-avatar",style:n.avatarContainer,children:[c.jsx(Bc,{style:n.userIcon}),e?c.jsx("img",{style:n.gravatar,src:e,alt:""}):null]})}const N=U.createContext({site:{},member:{},action:"",lastPage:"",brandColor:"",pageData:{},onAction:(e,t)=>({action:e,data:t}),t:()=>{},dir:"ltr"}),QS=e=>k.createElement("svg",{width:21,height:24,viewBox:"0 0 21 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},k.createElement("path",{d:"M10.533 11.267c2.835 0 5.134-2.299 5.134-5.134C15.667 3.298 13.368 1 10.533 1 7.698 1 5.4 3.298 5.4 6.133s2.298 5.134 5.133 5.134zM1 23c0-2.529 1.004-4.953 2.792-6.741 1.788-1.788 4.213-2.792 6.741-2.792 2.529 0 4.954 1.004 6.741 2.792 1.788 1.788 2.793 4.212 2.793 6.74",stroke:"#fff",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),ZS=e=>k.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...e},k.createElement("g",{fill:"none",fillRule:"evenodd"},k.createElement("path",{stroke:"#FFF",strokeWidth:1.5,strokeLinecap:"round",d:"M12.5 2v20M2 12.5h20"}))),XS=e=>k.createElement("svg",{width:25,height:24,viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},k.createElement("path",{d:"M23.5 6v14.25c0 .597-.237 1.169-.659 1.591-.422.422-.994.659-1.591.659s-1.169-.237-1.591-.659c-.422-.422-.659-.994-.659-1.591V3c0-.398-.158-.78-.44-1.06-.28-.282-.662-.44-1.06-.44h-15c-.398 0-.78.158-1.06.44C1.157 2.22 1 2.601 1 3v17.25c0 .597.237 1.169.659 1.591.422.422.994.659 1.591.659h18M4.75 15h10.5M4.75 18h6",stroke:"#fff",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),k.createElement("path",{d:"M14.5 5.25h-9c-.414 0-.75.336-.75.75v4.5c0 .414.336.75.75.75h9c.414 0 .75-.336.75-.75V6c0-.414-.336-.75-.75-.75z",stroke:"#fff",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),eE=e=>k.createElement("svg",{width:24,height:18,viewBox:"0 0 24 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},k.createElement("path",{d:"M21.75 1.5H2.25c-.828 0-1.5.672-1.5 1.5v12c0 .828.672 1.5 1.5 1.5h19.5c.828 0 1.5-.672 1.5-1.5V3c0-.828-.672-1.5-1.5-1.5zM15.687 6.975L19.5 10.5M8.313 6.975L4.5 10.5",stroke:"#fff",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),k.createElement("path",{d:"M22.88 2.014l-9.513 6.56C12.965 8.851 12.488 9 12 9s-.965-.149-1.367-.426L1.12 2.014",stroke:"#fff",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),tE=e=>k.createElement("svg",{width:26,height:26,viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},k.createElement("path",{d:"M17.903 12.016c-.332-1.665-1.491-3.032-3.031-3.654M11.037 8.4C9.252 9.163 8 10.935 8 13c0 .432.055.85.158 1.25M10.44 17.296c.748.447 1.624.704 2.56.704 1.71 0 3.22-.858 4.12-2.167M15.171 21.22c3.643-.96 6.329-4.276 6.329-8.22 0-1.084-.203-2.121-.573-3.075M18.611 6.615C17.114 5.3 15.151 4.5 13 4.5c-2.149 0-4.112.797-5.608 2.113M5.112 9.826c-.395.98-.612 2.052-.612 3.174 0 4.015 2.783 7.38 6.526 8.27",stroke:"#fff",strokeWidth:1.5,strokeLinecap:"round"}),k.createElement("path",{d:"M8.924 24.29c1.273.46 2.645.71 4.076.71 5.52 0 10.17-3.727 11.57-8.803M6.712 2.777C3.285 4.89 1 8.678 1 13c0 3.545 1.537 6.731 3.982 8.928M24.849 11.089C23.933 5.369 18.977 1 13 1c-.69 0-1.367.058-2.025.17",stroke:"#fff",strokeWidth:1.5,strokeLinecap:"round"})),Vc=`
91
91
  /* Colors
92
92
  /* ----------------------------------------------------- */
93
93
  :root {
@@ -266,11 +266,11 @@ Url: ${lo(e)}`),!0)}function jw(e,t){return e.type||!t||!t.length?!1:Iw(e).some(
266
266
  .gh-longform .gh-portal-btn {
267
267
  width: calc(100% + 4vmin);
268
268
  margin-top: 4rem;
269
- margin-right: -4vmin;
269
+ margin-inline-end: -4vmin;
270
270
  }
271
271
 
272
272
  .gh-longform .gh-portal-btn.no-margin-right {
273
- margin-right: 0;
273
+ margin-inline-end: 0;
274
274
  width: 100%;
275
275
  }
276
276
 
@@ -342,6 +342,9 @@ Url: ${lo(e)}`),!0)}function jw(e,t){return e.type||!t||!t.length?!1:Iw(e).some(
342
342
  line-height: 1;
343
343
  padding: 10px 28px 0 17px;
344
344
  }
345
+ html[dir="rtl"] .gh-portal-triggerbtn-wrapper {
346
+ padding: 10px 17px 0 28px;
347
+ }
345
348
 
346
349
  .gh-portal-triggerbtn-wrapper span {
347
350
  margin-bottom: 1px;
@@ -388,6 +391,9 @@ Url: ${lo(e)}`),!0)}function jw(e,t){return e.type||!t||!t.length?!1:Iw(e).some(
388
391
  .gh-portal-triggerbtn-container.with-label {
389
392
  padding: 0 12px 0 16px;
390
393
  }
394
+ html[dir="rtl"] .gh-portal-triggerbtn-container.with-label {
395
+ padding: 0 16px 0 12px;
396
+ }
391
397
 
392
398
  .gh-portal-triggerbtn-label {
393
399
  padding: 8px;
@@ -436,6 +442,12 @@ Url: ${lo(e)}`),!0)}function jw(e,t){return e.type||!t||!t.length?!1:Iw(e).some(
436
442
  animation: notification-slidein 0.55s cubic-bezier(0.215, 0.610, 0.355, 1.000);
437
443
  }
438
444
 
445
+ html[dir="rtl"] .gh-portal-notification {
446
+ right: unset;
447
+ left: 12px;
448
+ padding: 14px 20px 18px 44px;
449
+ }
450
+
439
451
  .gh-portal-notification.slideout {
440
452
  animation: notification-slideout 0.4s cubic-bezier(0.550, 0.055, 0.675, 0.190);
441
453
  }
@@ -448,10 +460,11 @@ Url: ${lo(e)}`),!0)}function jw(e,t){return e.type||!t||!t.length?!1:Iw(e).some(
448
460
  flex-grow: 1;
449
461
  font-size: 1.4rem;
450
462
  line-height: 1.5em;
451
- text-align: left;
463
+ text-align: start;
452
464
  margin: 0;
453
- padding: 0 0 0 40px;
465
+ padding: 0;
454
466
  color: var(--grey13);
467
+ padding-inline-start: 40px;
455
468
  }
456
469
 
457
470
  .gh-portal-notification p strong {
@@ -476,6 +489,10 @@ Url: ${lo(e)}`),!0)}function jw(e,t){return e.type||!t||!t.length?!1:Iw(e).some(
476
489
  width: 28px;
477
490
  height: 28px;
478
491
  }
492
+ html[dir="rtl"] .gh-portal-notification-icon {
493
+ right: 17px;
494
+ left: unset;
495
+ }
479
496
 
480
497
  .gh-portal-notification-icon.success {
481
498
  color: var(--green);
@@ -533,6 +550,10 @@ Url: ${lo(e)}`),!0)}function jw(e,t){return e.type||!t||!t.length?!1:Iw(e).some(
533
550
  max-width: calc(100% - 24px);
534
551
  animation-name: notification-slidein-mobile;
535
552
  }
553
+ html[dir="rtl"] .gh-portal-notification {
554
+ right: 12px;
555
+ left: unset;
556
+ }
536
557
 
537
558
  .gh-portal-notification.slideout {
538
559
  animation-duration: 0.55s;
@@ -577,12 +598,16 @@ Url: ${lo(e)}`),!0)}function jw(e,t){return e.type||!t||!t.length?!1:Iw(e).some(
577
598
  border: none;
578
599
  box-shadow: none;
579
600
  }
601
+ html[dir="rtl"] .gh-portal-btn-text span.right-arrow {
602
+ transform: scale(-1, 1);
603
+ display: inline-flex;
604
+ }
580
605
 
581
606
  .gh-portal-loadingicon {
582
607
  position: absolute;
583
608
  left: 50%;
584
609
  display: inline-block;
585
- margin-left: -19px;
610
+ margin-inline-start: -19px;
586
611
  height: 31px;
587
612
  }
588
613
 
@@ -613,12 +638,19 @@ Url: ${lo(e)}`),!0)}function jw(e,t){return e.type||!t||!t.length?!1:Iw(e).some(
613
638
  border: none;
614
639
  z-index: 10000;
615
640
  }
616
-
641
+ html[dir="rtl"] .gh-portal-btn-back {
642
+ right: 20px;
643
+ left: unset;
644
+ }
617
645
  @media (max-width: 480px) {
618
646
  .gh-portal-btn-back,
619
647
  .gh-portal-btn-back:hover {
620
648
  left: 16px;
621
649
  }
650
+ html[dir="rtl"] .gh-portal-btn-back {
651
+ right: 16px;
652
+ left: unset;
653
+ }
622
654
  }
623
655
 
624
656
  .gh-portal-btn-back:hover {
@@ -630,7 +662,10 @@ Url: ${lo(e)}`),!0)}function jw(e,t){return e.type||!t||!t.length?!1:Iw(e).some(
630
662
  width: 17px;
631
663
  height: 17px;
632
664
  margin-top: 1px;
633
- margin-right: 2px;
665
+ margin-inline-end: 2px;
666
+ }
667
+ html[dir="rtl"] .gh-portal-btn-back svg {
668
+ transform: scaleX(-1);
634
669
  }
635
670
  `;function fa({label:e=null,hidden:t=!1,onClick:n}){const{t:a}=k.useContext(N);return t?null:(e===null&&(e=a("Back")),c.jsxs("button",{className:"gh-portal-btn gh-portal-btn-back",onClick:i=>n(i),children:[c.jsx(LE,{})," ",e]}))}const BE=`
636
671
  .gh-portal-for-switch label,
@@ -686,6 +721,10 @@ Url: ${lo(e)}`),!0)}function jw(e,t){return e.type||!t||!t.length?!1:Iw(e).some(
686
721
  transition: .3s;
687
722
  border-radius: 999px;
688
723
  }
724
+ html[dir="rtl"] .gh-portal-for-switch .input-toggle-component:before {
725
+ left: unset !important;
726
+ right: 3px !important;
727
+ }
689
728
 
690
729
  .gh-portal-for-switch input:checked + .input-toggle-component {
691
730
  background: var(--brandcolor);
@@ -696,12 +735,15 @@ Url: ${lo(e)}`),!0)}function jw(e,t){return e.type||!t||!t.length?!1:Iw(e).some(
696
735
  transform: translateX(18px);
697
736
  box-shadow: none;
698
737
  }
738
+ html[dir="rtl"] .gh-portal-for-switch input:checked + .input-toggle-component:before {
739
+ transform: translateX(-18px);
740
+ }
699
741
 
700
742
  .gh-portal-for-switch .container {
701
743
  width: 38px !important;
702
744
  height: 22px !important;
703
745
  }
704
- `;function zo({id:e,label:t="",onToggle:n,checked:a=!1,dataTestId:i="switch-input"}){const{action:r}=k.useContext(N),[o,s]=k.useState(a),l=["updateNewsletter:failed","updateNewsletter:success"].includes(r);return k.useEffect(()=>{s(a)},[a,l]),c.jsx("div",{className:"gh-portal-for-switch","data-test-switch":i,children:c.jsxs("label",{className:"switch",htmlFor:e,children:[c.jsx("input",{type:"checkbox",checked:o,id:e,onChange:()=>{},"aria-label":t}),c.jsx("span",{className:"input-toggle-component",onClick:u=>{s(!o),n(u,!o)},"data-testid":i})]})})}const HE=`.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-right:16px}.gh-portal-account-footermenu li:last-of-type{margin-right: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-right:-3px;opacity:.6}.gh-portal-product-icon{width:52px;margin-right: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-right: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}}
746
+ `;function zo({id:e,label:t="",onToggle:n,checked:a=!1,dataTestId:i="switch-input"}){const{action:r}=k.useContext(N),[o,s]=k.useState(a),l=["updateNewsletter:failed","updateNewsletter:success"].includes(r);return k.useEffect(()=>{s(a)},[a,l]),c.jsx("div",{className:"gh-portal-for-switch","data-test-switch":i,children:c.jsxs("label",{className:"switch",htmlFor:e,children:[c.jsx("input",{type:"checkbox",checked:o,id:e,onChange:()=>{},"aria-label":t}),c.jsx("span",{className:"input-toggle-component",onClick:u=>{s(!o),n(u,!o)},"data-testid":i})]})})}const HE=`.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}}
705
747
  `;let ie=(vu=class extends U.Component{constructor(){super(...arguments);Z(this,"closePopup",()=>{this.context.onAction("closePopup")})}render(){const{onClick:n}=this.props;return c.jsx("div",{className:"gh-portal-closeicon-container","data-test-button":"close-popup",children:c.jsx(tu,{className:"gh-portal-closeicon",alt:"Close",onClick:n||this.closePopup,"data-testid":"close-popup"})})}},Z(vu,"contextType",N),vu);const Vg=e=>k.createElement("svg",{width:15,height:14,viewBox:"0 0 15 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},k.createElement("path",{d:"M1 6.89286L6.10714 12L13.9643 1",stroke:"#222222",strokeWidth:2}));function Wg(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 Kg={exports:{}},VE="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",WE=VE,KE=WE;function Gg(){}function qg(){}qg.resetWarningCache=Gg;var GE=function(){function e(a,i,r,o,s,l){if(l!==KE){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:qg,resetWarningCache:Gg};return n.PropTypes=n,n};Kg.exports=GE();var qE=Kg.exports;const iu=Ae(qE);function Jg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function zi(e){"@babel/helpers - typeof";return zi=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},zi(e)}function JE(e,t){if(zi(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var a=n.call(e,t||"default");if(zi(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function QE(e){var t=JE(e,"string");return zi(t)=="symbol"?t:String(t)}function Qg(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,QE(a.key),a)}}function Zg(e,t,n){return t&&Qg(e.prototype,t),n&&Qg(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function ZE(e,t){if(e==null)return{};var n={},a=Object.keys(e),i,r;for(r=0;r<a.length;r++)i=a[r],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function XE(e,t){if(e==null)return{};var n=ZE(e,t),a,i;if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i<r.length;i++)a=r[i],!(t.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var Do="TOKEN_PLACEHOLDER",Di="TOKEN_OPEN_TAG",Fo="TOKEN_CLOSE_TAG",Mo="TOKEN_SELF_TAG",_o="TOKEN_TEXT",Xg="NODE_FRAGMENT",ef="NODE_TAG_ELEMENT",tf="NODE_VOID_ELEMENT",nf="NODE_PLACEHOLDER",af="NODE_TEXT",eC=["type","children"],Ce=function(){function e(t){var n=t.type,a=t.children,i=XE(t,eC);Jg(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 Zg(e,[{key:"appendChild",value:function(n){this.children.push(n)}},{key:"isLeaf",get:function(){return this.children.length===0}}]),e}();Ce.createTagNode=function(e,t){return new Ce({type:ef,children:t,name:e.name,token:e})},Ce.createFragmentNode=function(e){return new Ce({type:Xg,children:e})},Ce.createVoidNode=function(e){return new Ce({type:tf,name:e.name,token:e})},Ce.createTextNode=function(e){return new Ce({type:af,text:e.string,token:e})},Ce.createPlaceholderNode=function(e){return new Ce({type:nf,name:e.name,token:e})};var tC=[{type:Do,regex:/{\s*(\w+)\s*}/g},{type:Di,regex:/<(\w+)>/g},{type:Fo,regex:/<\/(\w+)>/g},{type:Mo,regex:/<(\w+)\s*\/>/g}],Ie=[{type:Do,regex:/{{\s*(\w+)\s*}}/g},{type:Di,regex:/<(\w+)>/g},{type:Fo,regex:/<\/(\w+)>/g},{type:Mo,regex:/<(\w+)\s*\/>/g}];function nC(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=aC(e))||t&&e&&typeof e.length=="number"){n&&(e=n);var a=0,i=function(){};return{s:i,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
706
748
  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 u=n.next();return r=u.done,u},e:function(u){o=!0,s=u},f:function(){try{!r&&n.return!=null&&n.return()}finally{if(o)throw s}}}}function aC(e,t){if(e){if(typeof e=="string")return rf(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 rf(e,t)}}function rf(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 iC(e,t){var n=[],a=nC(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(g){a.e(g)}finally{a.f()}n.sort(function(g,b){return g.start-b.start});var u=[],d=0;n.forEach(function(g){if(g.start===d){d=g.end;return}var b=g.start,v=e.substring(d,b);u.push({type:_o,string:v,text:v,start:d,end:b}),d=g.end});var p=e.substring(d);p!==""&&u.push({type:_o,string:p,start:d,end:e.length});var m=[].concat(u,n).sort(function(g,b){return g.start-b.start});return m}function rC(e,t){t||(t=tC);var n=iC(e,t),a=new oC(n);return a.parse()}var Fi="Syntax error. Please check if each open tag is closed correctly",of={type:"EPSILON"},oC=function(){function e(t){Jg(this,e),this.tokens=[].concat(t),this.tags=[]}return Zg(e,[{key:"parse",value:function(){var n=this.document();if(!this.predict(of.type))throw new Error(Fi);return n}},{key:"document",value:function(){var n=this.elementOrData();return Ce.createFragmentNode(n)}},{key:"element",value:function(){var n=this.openTag(),a=this.elementOrData();return this.endTag(),Ce.createTagNode(n,a)}},{key:"openTag",value:function(){if(!this.predict(Di))throw new Error(Fi);return this.pushTag(this.lookahead),this.match(Di)}},{key:"elementOrData",value:function(){var n=[];if(this.predict(Di)&&(n.push(this.element()),n=n.concat(this.elementOrData())),this.predict(Mo,_o,Do)){var a=this.match(this.lookahead.type),i;switch(a.type){case Mo:i=Ce.createVoidNode(a);break;case _o:i=Ce.createTextNode(a);break;case Do:i=Ce.createPlaceholderNode(a);break}n.push(i),n=n.concat(this.elementOrData())}return n}},{key:"endTag",value:function(){if(!this.predict(Fo))throw new Error(Fi);var n=this.tags.pop();if(n.name!==this.lookahead.name)throw new Error(Fi);this.match(Fo)}},{key:"lookahead",get:function(){return this.tokens.length===0?of: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(Fi);var a=this.tokens.shift();return a}},{key:"pushTag",value:function(n){this.tags.push(n)}}]),e}(),sC=function e(t,n,a){var i=t.children.map(function(l,u){return U.createElement(U.Fragment,{key:a+u},e(l,n,a))});switch(t.type){case af:return t.text;case Xg:return U.createElement(U.Fragment,null,i);case tf:{var r=n[t.name];return typeof r=="function"?r():r||U.createElement(t.name,null)}case ef:{var o=n[t.name];if(o===void 0)return U.createElement(t.name,null,i);if(typeof o=="function")return o(i);if(U.isValidElement(o)){if(U.Children.count(o.props.children)!==0)throw new Error("when passing an element as value, the element should not contains children");return U.cloneElement(o,{children:i})}throw new Error('Invalid mapping value for "'.concat(t.name,'". Only element or render function are accepted'))}case nf:{var s=n[t.name];return s===void 0?(console.warn('missing "'.concat(t.name,'" in mapping')),t.string):typeof s=="function"?s():s}default:return}};function $e(e){var t=e.string,n=e.syntax,a=e.mapping,i=a===void 0?{}:a,r=e.graceful,o=r===void 0?!0:r;try{var s=rC(t,n);return sC(s,i,t)}catch(l){if(o)return console.error(l),t;throw l}}$e.propTypes={string:iu.string.isRequired,mapping:iu.object,graceful:iu.bool};const lC=()=>`
707
749
  .gh-portal-products {
@@ -734,10 +776,17 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
734
776
  border-radius: 999px;
735
777
  transition: all 0.15s ease-in-out;
736
778
  }
779
+ html[dir="rtl"] .gh-portal-products-pricetoggle:before {
780
+ left: 4px;
781
+ right: unset;
782
+ }
737
783
 
738
784
  .gh-portal-products-pricetoggle.left:before {
739
785
  transform: translateX(calc(-100% + 8px));
740
786
  }
787
+ html[dir="rtl"] .gh-portal-products-pricetoggle.left:before {
788
+ transform: translateX(calc(100% - 8px));
789
+ }
741
790
 
742
791
  .gh-portal-products-pricetoggle .gh-portal-btn {
743
792
  border: 0;
@@ -773,7 +822,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
773
822
 
774
823
  .gh-portal-maximum-discount {
775
824
  font-weight: 400;
776
- margin-left: 4px;
825
+ margin-inline-start: 4px;
777
826
  opacity: 0.5;
778
827
  }
779
828
 
@@ -886,7 +935,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
886
935
  text-align: center;
887
936
  white-space: nowrap;
888
937
  border-radius: 999px;
889
- margin-right: -4px;
938
+ margin-inline-end: -4px;
890
939
  max-height: 24.5px;
891
940
  }
892
941
 
@@ -936,7 +985,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
936
985
  }
937
986
 
938
987
  .gh-portal-product-price .currency-sign.long {
939
- margin-right: 5px;
988
+ margin-inline-end: 5px;
940
989
  }
941
990
 
942
991
  .gh-portal-product-price .amount {
@@ -957,7 +1006,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
957
1006
  line-height: 1.6em;
958
1007
  color: var(--grey5);
959
1008
  letter-spacing: 0.3px;
960
- margin-left: 5px;
1009
+ margin-inline-start: 5px;
961
1010
  }
962
1011
 
963
1012
  .gh-portal-product-alternative-price {
@@ -1009,6 +1058,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1009
1058
  margin: 3px 10px 0 0;
1010
1059
  overflow: visible;
1011
1060
  }
1061
+ html[dir="rtl"] .gh-portal-benefit-checkmark {
1062
+ margin: 3px 0 0 10px;
1063
+ }
1012
1064
 
1013
1065
  .gh-portal-benefit-checkmark polyline,
1014
1066
  .gh-portal-benefit-checkmark g {
@@ -1259,7 +1311,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1259
1311
  width: 100%;
1260
1312
  height: 44px;
1261
1313
  padding: 0 12px;
1262
- margin-bottom: 18px;
1314
+ margin-bottom: 16px;
1263
1315
  letter-spacing: 0.2px;
1264
1316
  transition: border-color 0.25s ease-in-out;
1265
1317
  }
@@ -1309,6 +1361,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1309
1361
  top: 35px;
1310
1362
  left: 32px;
1311
1363
  }
1364
+ html[dir="rtl"] .gh-portal-back-sitetitle {
1365
+ left: unset;
1366
+ right: 32px;
1367
+ }
1312
1368
 
1313
1369
  .gh-portal-back-sitetitle .gh-portal-btn {
1314
1370
  padding: 0;
@@ -1401,7 +1457,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1401
1457
  .gh-portal-signup-message button {
1402
1458
  font-size: 1.4rem;
1403
1459
  font-weight: 600;
1404
- margin-left: 4px !important;
1460
+ margin-inline-start: 4px !important;
1405
1461
  margin-bottom: -1px;
1406
1462
  }
1407
1463
 
@@ -1508,11 +1564,11 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
1508
1564
  }
1509
1565
 
1510
1566
  .gh-portal-signup-terms {
1511
- margin: -16px 0 36px;
1567
+ margin: 0 0 36px;
1512
1568
  }
1513
1569
 
1514
1570
  .gh-portal-signup-terms-wrapper.free-only .gh-portal-signup-terms {
1515
- margin: -16px 0 24px;
1571
+ margin: 0 0 24px;
1516
1572
  }
1517
1573
 
1518
1574
  .gh-portal-products:has(.gh-portal-product-card) + .gh-portal-signup-terms-wrapper.free-only {
@@ -1536,7 +1592,7 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
1536
1592
 
1537
1593
  .gh-portal-signup-terms .checkbox {
1538
1594
  position: relative;
1539
- top: 1px;
1595
+ top: -1px;
1540
1596
  flex-shrink: 0;
1541
1597
  display: inline-block;
1542
1598
  float: left;
@@ -1548,6 +1604,9 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
1548
1604
  border-radius: 4px;
1549
1605
  transition: background 0.15s ease-in-out, border-color 0.15s ease-in-out;
1550
1606
  }
1607
+ html[dir=rtl] .gh-portal-signup-terms .checkbox {
1608
+ float: right;
1609
+ }
1551
1610
 
1552
1611
  .gh-portal-signup-terms label:hover input:not(:checked) + .checkbox {
1553
1612
  border-color: var(--grey9);
@@ -1567,6 +1626,10 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
1567
1626
  transition: opacity 0.15s ease-in-out;
1568
1627
  transform: rotate(-45deg);
1569
1628
  }
1629
+ html[dir=rtl] .gh-portal-signup-terms .checkbox:before {
1630
+ left: unset;
1631
+ right: 3px;
1632
+ }
1570
1633
 
1571
1634
  .gh-portal-signup-terms input:checked + .checkbox {
1572
1635
  border-color: var(--black);
@@ -1587,14 +1650,11 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
1587
1650
  box-shadow: none;
1588
1651
  }
1589
1652
 
1590
- .gh-portal-signup-terms-content {
1591
- color: var(--grey4);
1592
- font-size: 1.5rem;
1593
- line-height: 1.5em;
1594
- }
1595
-
1596
1653
  .gh-portal-signup-terms-content p {
1597
1654
  margin-bottom: 0;
1655
+ color: var(--grey4);
1656
+ font-size: 1.4rem;
1657
+ line-height: 1.25em;
1598
1658
  }
1599
1659
 
1600
1660
  .gh-portal-error .gh-portal-signup-terms-content {
@@ -1684,6 +1744,10 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
1684
1744
  width: 20px;
1685
1745
  height: 20px;
1686
1746
  }
1747
+ html[dir="rtl"] .gh-portal-popupnotification-icon {
1748
+ left: unset;
1749
+ right: 12px;
1750
+ }
1687
1751
 
1688
1752
  .gh-portal-popupnotification-icon.success {
1689
1753
  color: var(--green);
@@ -1706,6 +1770,10 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
1706
1770
  transition: all 0.15s ease-in-out forwards;
1707
1771
  opacity: 0.8;
1708
1772
  }
1773
+ html[dir="rtl"] .gh-portal-popupnotification .closeicon {
1774
+ right: unset;
1775
+ left: 3px;
1776
+ }
1709
1777
 
1710
1778
  .gh-portal-popupnotification .closeicon:hover {
1711
1779
  opacity: 1.0;
@@ -1777,6 +1845,9 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
1777
1845
  margin: 0 110px 0 0;
1778
1846
  width: 100%;
1779
1847
  }
1848
+ html[dir="rtl"] .gh-portal-offer-title h4 {
1849
+ margin: 0 0 0 110px;
1850
+ }
1780
1851
 
1781
1852
  .gh-portal-offer-title h4.placeholder {
1782
1853
  opacity: 0.4;
@@ -1799,7 +1870,7 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
1799
1870
 
1800
1871
  .gh-portal-offer-details .gh-portal-plan-name,
1801
1872
  .gh-portal-offer-details p {
1802
- margin-right: 8px;
1873
+ margin-inline-end: 8px;
1803
1874
  }
1804
1875
 
1805
1876
  .gh-portal-offer .footnote {
@@ -1941,6 +2012,10 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
1941
2012
  background: currentColor;
1942
2013
  opacity: 0.10;
1943
2014
  }
2015
+ html[dir="rtl"] .gh-feedback-button::before {
2016
+ right: 0;
2017
+ left: unset;
2018
+ }
1944
2019
 
1945
2020
  .gh-feedback-button-selected {
1946
2021
  box-shadow: inset 0 0 0 2px currentColor;
@@ -1970,8 +2045,8 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
1970
2045
  }
1971
2046
 
1972
2047
  .gh-portal-feedback .gh-portal-text-center {
1973
- padding-left: 8px;
1974
- padding-right: 8px;
2048
+ padding-inline-start: 8px;
2049
+ padding-inline-end: 8px;
1975
2050
  }
1976
2051
 
1977
2052
  .gh-portal-popup-wrapper.feedback {
@@ -1979,7 +2054,7 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
1979
2054
  position: relative;
1980
2055
  width: 100%;
1981
2056
  background: none;
1982
- padding-right: 0 !important;
2057
+ padding-inline-end: 0 !important;
1983
2058
  overflow: hidden;
1984
2059
  overflow-y: hidden !important;
1985
2060
  animation: none;
@@ -2022,7 +2097,7 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
2022
2097
  }
2023
2098
  }
2024
2099
  }
2025
- `;function KC({error:e}){const{onAction:t,t:n}=k.useContext(N);return c.jsxs("div",{className:"gh-portal-content gh-portal-feedback with-footer",children:[c.jsx(ie,{}),c.jsx("div",{className:"gh-feedback-icon gh-feedback-icon-error",children:c.jsx(VC,{})}),c.jsx("h1",{className:"gh-portal-main-title",children:n("Sorry, that didn’t work.")}),c.jsx("div",{children:c.jsx("p",{className:"gh-portal-text-center",children:e})}),c.jsx(ae,{style:{width:"100%"},retry:!1,onClick:()=>t("closePopup"),disabled:!1,brandColor:"#000000",label:n("Close"),isRunning:!1,tabindex:"3",classes:"sticky bottom"})]})}const GC=({onConfirm:e,loading:t,initialScore:n})=>{const{onAction:a,brandColor:i,t:r}=k.useContext(N),[o,s]=k.useState(n),l=g=>{g.stopPropagation()},u=()=>{a("closePopup")},d=async g=>{g.stopPropagation(),await e(o)},p=g=>{const b="gh-feedback-button";return g===o?`${b} gh-feedback-button-selected`:b},m=g=>g===o?{color:i}:{};return c.jsxs("div",{className:"gh-portal-confirm-dialog",onMouseDown:l,children:[c.jsx("h1",{className:"gh-portal-confirm-title",children:r("Give feedback on this post")}),c.jsxs("div",{className:"gh-feedback-buttons-group",children:[c.jsxs("button",{className:p(1),style:m(1),onClick:()=>s(1),children:[c.jsx(wf,{}),r("More like this")]}),c.jsxs("button",{className:p(0),style:m(0),onClick:()=>s(0),children:[c.jsx(vf,{}),r("Less like this")]})]}),c.jsx(ae,{classes:"gh-portal-confirm-button",retry:!1,onClick:d,disabled:!1,brandColor:i,label:r("Submit feedback"),isRunning:t,tabindex:"3"}),c.jsx(ie,{close:()=>u()})]})};async function qC({siteUrl:e,uuid:t,key:n,postId:a,score:i},r){await(r||Oo({siteUrl:e})).feedback.add({uuid:t,postId:a,key:n,score:i})}const JC=({action:e,score:t})=>(k.useEffect(()=>{e(t)}),c.jsx(Mi,{})),QC=({positive:e})=>{const{onAction:t,brandColor:n,t:a}=k.useContext(N),i=e?c.jsx(wf,{}):c.jsx(vf,{});return c.jsxs("div",{className:"gh-portal-content gh-portal-feedback",children:[c.jsx(ie,{}),c.jsx("div",{className:"gh-feedback-icon",children:i}),c.jsx("h1",{className:"gh-portal-main-title",children:a("Thanks for the feedback!")}),c.jsx("p",{className:"gh-portal-text-center",children:a("Your input helps shape what gets published.")}),c.jsx(ae,{style:{width:"100%"},retry:!1,onClick:()=>t("closePopup"),disabled:!1,brandColor:n,label:a("Close"),isRunning:!1,tabindex:"3",classes:"sticky bottom"})]})};function ZC(){const{site:e,pageData:t,member:n,t:a,api:i}=k.useContext(N),{uuid:r,key:o,postId:s,score:l}=t,[u,d]=k.useState(l),p=u===1,m=!!n,[g,b]=k.useState(m),[v,h]=k.useState(m),[f,y]=k.useState(null),w=async C=>{h(!0);try{await qC({siteUrl:e.url,uuid:r,key:o,postId:s,score:C},i),d(C)}catch(S){const E=Lo(S,a("There was a problem submitting your feedback. Please try again a little later."),a);y(E)}h(!1)},x=async C=>{await w(C),b(!0)};if(f)return c.jsx(KC,{error:f});if(g){if(v)return c.jsx(JC,{action:w,score:u})}else return c.jsx(GC,{onConfirm:x,loading:v,initialScore:u});return c.jsx(QC,{positive:p})}const XC=`.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-left:4px}.emailReceivingFAQ .gh-portal-btn-back,.emailReceivingFAQ .gh-portal-btn-back:hover{left:calc(6vmin - 14px)}.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}
2100
+ `;function KC({error:e}){const{onAction:t,t:n}=k.useContext(N);return c.jsxs("div",{className:"gh-portal-content gh-portal-feedback with-footer",children:[c.jsx(ie,{}),c.jsx("div",{className:"gh-feedback-icon gh-feedback-icon-error",children:c.jsx(VC,{})}),c.jsx("h1",{className:"gh-portal-main-title",children:n("Sorry, that didn’t work.")}),c.jsx("div",{children:c.jsx("p",{className:"gh-portal-text-center",children:e})}),c.jsx(ae,{style:{width:"100%"},retry:!1,onClick:()=>t("closePopup"),disabled:!1,brandColor:"#000000",label:n("Close"),isRunning:!1,tabindex:"3",classes:"sticky bottom"})]})}const GC=({onConfirm:e,loading:t,initialScore:n})=>{const{onAction:a,brandColor:i,t:r}=k.useContext(N),[o,s]=k.useState(n),l=g=>{g.stopPropagation()},u=()=>{a("closePopup")},d=async g=>{g.stopPropagation(),await e(o)},p=g=>{const b="gh-feedback-button";return g===o?`${b} gh-feedback-button-selected`:b},m=g=>g===o?{color:i}:{};return c.jsxs("div",{className:"gh-portal-confirm-dialog",onMouseDown:l,children:[c.jsx("h1",{className:"gh-portal-confirm-title",children:r("Give feedback on this post")}),c.jsxs("div",{className:"gh-feedback-buttons-group",children:[c.jsxs("button",{className:p(1),style:m(1),onClick:()=>s(1),children:[c.jsx(wf,{}),r("More like this")]}),c.jsxs("button",{className:p(0),style:m(0),onClick:()=>s(0),children:[c.jsx(vf,{}),r("Less like this")]})]}),c.jsx(ae,{classes:"gh-portal-confirm-button",retry:!1,onClick:d,disabled:!1,brandColor:i,label:r("Submit feedback"),isRunning:t,tabindex:"3"}),c.jsx(ie,{close:()=>u()})]})};async function qC({siteUrl:e,uuid:t,key:n,postId:a,score:i},r){await(r||Oo({siteUrl:e})).feedback.add({uuid:t,postId:a,key:n,score:i})}const JC=({action:e,score:t})=>(k.useEffect(()=>{e(t)}),c.jsx(Mi,{})),QC=({positive:e})=>{const{onAction:t,brandColor:n,t:a}=k.useContext(N),i=e?c.jsx(wf,{}):c.jsx(vf,{});return c.jsxs("div",{className:"gh-portal-content gh-portal-feedback",children:[c.jsx(ie,{}),c.jsx("div",{className:"gh-feedback-icon",children:i}),c.jsx("h1",{className:"gh-portal-main-title",children:a("Thanks for the feedback!")}),c.jsx("p",{className:"gh-portal-text-center",children:a("Your input helps shape what gets published.")}),c.jsx(ae,{style:{width:"100%"},retry:!1,onClick:()=>t("closePopup"),disabled:!1,brandColor:n,label:a("Close"),isRunning:!1,tabindex:"3",classes:"sticky bottom"})]})};function ZC(){const{site:e,pageData:t,member:n,t:a,api:i}=k.useContext(N),{uuid:r,key:o,postId:s,score:l}=t,[u,d]=k.useState(l),p=u===1,m=!!n,[g,b]=k.useState(m),[v,h]=k.useState(m),[f,y]=k.useState(null),w=async C=>{h(!0);try{await qC({siteUrl:e.url,uuid:r,key:o,postId:s,score:C},i),d(C)}catch(S){const E=Lo(S,a("There was a problem submitting your feedback. Please try again a little later."),a);y(E)}h(!1)},x=async C=>{await w(C),b(!0)};if(f)return c.jsx(KC,{error:f});if(g){if(v)return c.jsx(JC,{action:w,score:u})}else return c.jsx(GC,{onConfirm:x,loading:v,initialScore:u});return c.jsx(QC,{positive:p})}const XC=`.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}
2026
2101
  `,e0="",t0="",n0=e=>k.createElement("svg",{id:"Regular",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},k.createElement("title",null,"confetti"),k.createElement("defs",null,k.createElement("style",null,`
2027
2102
  .cls-1{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.5px}
2028
2103
  `)),k.createElement("ellipse",{className:"cls-1",cx:11.531,cy:12.469,rx:2.625,ry:5.25,transform:"rotate(-45 11.531 12.47)"}),k.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"})),a0=`
@@ -2082,12 +2157,15 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
2082
2157
  .gh-portal-recommendation-item .gh-portal-list-detail {
2083
2158
  padding: 4px 24px 4px 0px;
2084
2159
  }
2160
+ html[dir="rtl"] .gh-portal-recommendation-item .gh-portal-list-detail {
2161
+ padding: 4px 0px 4px 24px;
2162
+ }
2085
2163
 
2086
2164
  .gh-portal-recommendation-item-header {
2087
- display: flex;
2088
- align-items: center;
2089
- gap: 10px;
2090
- cursor: pointer;
2165
+ display: flex;
2166
+ align-items: center;
2167
+ gap: 10px;
2168
+ cursor: pointer;
2091
2169
  }
2092
2170
 
2093
2171
  .gh-portal-recommendation-item-favicon {
@@ -2113,7 +2191,7 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
2113
2191
 
2114
2192
  .gh-portal-recommendation-item .gh-portal-recommendation-description-container p {
2115
2193
  font-size: 1.35rem;
2116
- padding-left: 30px;
2194
+ padding-inline-start: 30px;
2117
2195
  font-weight: 400;
2118
2196
  letter-spacing: 0.1px;
2119
2197
  margin-top: 4px;
@@ -2135,7 +2213,7 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
2135
2213
  .gh-portal-recommendation-arrow-icon {
2136
2214
  height: 12px;
2137
2215
  opacity: 0;
2138
- margin-left: -6px;
2216
+ margin-inline-start: -6px;
2139
2217
  transition: 0.2s ease-in opacity;
2140
2218
  }
2141
2219
 
@@ -2154,7 +2232,7 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
2154
2232
 
2155
2233
  .gh-portal-recommendation-subscribed {
2156
2234
  display: flex;
2157
- padding-left: 30px;
2235
+ padding-inline-start: 30px;
2158
2236
  align-items: center;
2159
2237
  gap: 4px;
2160
2238
  font-size: 1.35rem;
@@ -2310,7 +2388,7 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
2310
2388
  .gh-portal-btn-icon svg {
2311
2389
  width: 16px;
2312
2390
  height: 16px;
2313
- margin-right: 4px;
2391
+ margin-inline-end: 4px;
2314
2392
  stroke: currentColor;
2315
2393
  }
2316
2394
 
@@ -2368,6 +2446,11 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
2368
2446
  box-shadow: none;
2369
2447
  }
2370
2448
 
2449
+ html[dir="rtl"] .gh-portal-btn-logout {
2450
+ left: unset;
2451
+ right: 24px;
2452
+ }
2453
+
2371
2454
  .gh-portal-btn-logout .label {
2372
2455
  opacity: 0;
2373
2456
  transform: translateX(-6px);
@@ -2394,10 +2477,13 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
2394
2477
  }
2395
2478
 
2396
2479
  .gh-portal-btn-site-title-back span {
2397
- margin-right: 4px;
2480
+ margin-inline-end: 4px;
2398
2481
  transition: transform 0.4s cubic-bezier(0.1, 0.7, 0.1, 1);
2399
2482
  }
2400
-
2483
+ html[dir="rtl"] .gh-portal-btn-site-title-back span {
2484
+ transform: scaleX(-1);
2485
+ -webkit-transform: scaleX(-1);
2486
+ }
2401
2487
 
2402
2488
  .gh-portal-btn-site-title-back:hover span {
2403
2489
  transform: translateX(-3px);
@@ -2472,8 +2558,8 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
2472
2558
 
2473
2559
  /* Hiding scrollbars */
2474
2560
  .gh-portal-popup-wrapper {
2475
- padding-right: 30px !important;
2476
- margin-right: -30px !important;
2561
+ padding-inline-end: 30px !important;
2562
+ margin-inline-end: -30px !important;
2477
2563
  -ms-overflow-style: none;
2478
2564
  scrollbar-width: none;
2479
2565
  }
@@ -2495,7 +2581,7 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
2495
2581
  flex-direction: column;
2496
2582
  justify-content: flex-start;
2497
2583
  font-size: 1.5rem;
2498
- text-align: left;
2584
+ text-align: start;
2499
2585
  letter-spacing: 0;
2500
2586
  text-rendering: optimizeLegibility;
2501
2587
  background: var(--white);
@@ -2591,6 +2677,10 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
2591
2677
  left: 24px;
2592
2678
  z-index: 9999;
2593
2679
  }
2680
+ html[dir="rtl"] .gh-portal-powered {
2681
+ left: unset;
2682
+ right: 24px;
2683
+ }
2594
2684
 
2595
2685
  .gh-portal-powered a {
2596
2686
  border: none;
@@ -2610,6 +2700,9 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
2610
2700
  height: 28px;
2611
2701
  line-height: 28px;
2612
2702
  }
2703
+ html[dir="rtl"] .gh-portal-powered a {
2704
+ padding: 6px 7px 6px 8px;
2705
+ }
2613
2706
 
2614
2707
  .gh-portal-powered a:hover {
2615
2708
  color: #15171A;
@@ -2631,7 +2724,8 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
2631
2724
  .gh-portal-powered a svg {
2632
2725
  height: 16px;
2633
2726
  width: 16px;
2634
- margin: 0 6px 0 0;
2727
+ margin: 0;
2728
+ margin-inline-end: 6px;
2635
2729
  }
2636
2730
 
2637
2731
  .gh-portal-powered.outside.full-size {
@@ -2662,6 +2756,10 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
2662
2756
  right: 24px;
2663
2757
  z-index: 10000;
2664
2758
  }
2759
+ html[dir="rtl"] .gh-portal-closeicon-container {
2760
+ right: unset;
2761
+ left: 24px;
2762
+ }
2665
2763
 
2666
2764
  .gh-portal-closeicon {
2667
2765
  color: var(--grey10);
@@ -2681,6 +2779,11 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
2681
2779
  top: 20px;
2682
2780
  right: 20px;
2683
2781
  }
2782
+ html[dir="rtl"] .gh-portal-popup-wrapper.full-size .gh-portal-closeicon-container,
2783
+ html[dir="rtl"] .gh-portal-popup-container.full-size .gh-portal-closeicon-container {
2784
+ right: unset;
2785
+ left: 20px;
2786
+ }
2684
2787
 
2685
2788
  .gh-portal-popup-wrapper.full-size .gh-portal-closeicon,
2686
2789
  .gh-portal-popup-container.full-size .gh-portal-closeicon {
@@ -2695,6 +2798,11 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
2695
2798
  left: 8px;
2696
2799
  }
2697
2800
 
2801
+ html[dir="rtl"] .gh-portal-logout-container {
2802
+ left: unset;
2803
+ right: 8px;
2804
+ }
2805
+
2698
2806
  .gh-portal-header {
2699
2807
  display: flex;
2700
2808
  flex-direction: column;
@@ -2843,6 +2951,9 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
2843
2951
  color: var(--grey6);
2844
2952
  word-break: break-word;
2845
2953
  }
2954
+ html[dir="rtl"] .gh-portal-list-detail p {
2955
+ margin: 5px 0 0 8px;
2956
+ }
2846
2957
 
2847
2958
  .gh-portal-list-detail.gh-portal-list-big p {
2848
2959
  font-size: 1.5rem;
@@ -2856,6 +2967,9 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
2856
2967
  .gh-portal-list-toggle-wrapper .gh-portal-list-detail {
2857
2968
  padding: 4px 24px 4px 0px;
2858
2969
  }
2970
+ html[dir="rtl"] .gh-portal-list-toggle-wrapper .gh-portal-list-detail {
2971
+ padding: 4px 0px 4px 24px;
2972
+ }
2859
2973
 
2860
2974
  .gh-portal-list-detail .old-price {
2861
2975
  text-decoration: line-through;
@@ -2870,7 +2984,7 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
2870
2984
  width: 17px;
2871
2985
  height: 17px;
2872
2986
  margin-top: 1px;
2873
- margin-right: -6px;
2987
+ margin-inline-end: -6px;
2874
2988
  }
2875
2989
 
2876
2990
  .gh-portal-expire-warning {
@@ -2922,16 +3036,16 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
2922
3036
  .mt9 { margin-top: 36px; }
2923
3037
  .mt10 { margin-top: 40px; }
2924
3038
 
2925
- .mr1 { margin-right: 4px; }
2926
- .mr2 { margin-right: 8px; }
2927
- .mr3 { margin-right: 12px; }
2928
- .mr4 { margin-right: 16px; }
2929
- .mr5 { margin-right: 20px; }
2930
- .mr6 { margin-right: 24px; }
2931
- .mr7 { margin-right: 28px; }
2932
- .mr8 { margin-right: 32px; }
2933
- .mr9 { margin-right: 36px; }
2934
- .mr10 { margin-right: 40px; }
3039
+ .mr1 { margin-inline-end: 4px; }
3040
+ .mr2 { margin-inline-end: 8px; }
3041
+ .mr3 { margin-inline-end: 12px; }
3042
+ .mr4 { margin-inline-end: 16px; }
3043
+ .mr5 { margin-inline-end: 20px; }
3044
+ .mr6 { margin-inline-end: 24px; }
3045
+ .mr7 { margin-inline-end: 28px; }
3046
+ .mr8 { margin-inline-end: 32px; }
3047
+ .mr9 { margin-inline-end: 36px; }
3048
+ .mr10 { margin-inline-end: 40px; }
2935
3049
 
2936
3050
  .mb1 { margin-bottom: 4px; }
2937
3051
  .mb2 { margin-bottom: 8px; }
@@ -2944,16 +3058,16 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
2944
3058
  .mb9 { margin-bottom: 36px; }
2945
3059
  .mb10 { margin-bottom: 40px; }
2946
3060
 
2947
- .ml1 { margin-left: 4px; }
2948
- .ml2 { margin-left: 8px; }
2949
- .ml3 { margin-left: 12px; }
2950
- .ml4 { margin-left: 16px; }
2951
- .ml5 { margin-left: 20px; }
2952
- .ml6 { margin-left: 24px; }
2953
- .ml7 { margin-left: 28px; }
2954
- .ml8 { margin-left: 32px; }
2955
- .ml9 { margin-left: 36px; }
2956
- .ml10 { margin-left: 40px; }
3061
+ .ml1 { margin-inline-start: 4px; }
3062
+ .ml2 { margin-inline-start: 8px; }
3063
+ .ml3 { margin-inline-start: 12px; }
3064
+ .ml4 { margin-inline-start: 16px; }
3065
+ .ml5 { margin-inline-start: 20px; }
3066
+ .ml6 { margin-inline-start: 24px; }
3067
+ .ml7 { margin-inline-start: 28px; }
3068
+ .ml8 { margin-inline-start: 32px; }
3069
+ .ml9 { margin-inline-start: 36px; }
3070
+ .ml10 { margin-inline-start: 40px; }
2957
3071
 
2958
3072
  .pt1 { padding-top: 4px; }
2959
3073
  .pt2 { padding-top: 8px; }
@@ -2966,16 +3080,16 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
2966
3080
  .pt9 { padding-top: 36px; }
2967
3081
  .pt10 { padding-top: 40px; }
2968
3082
 
2969
- .pr1 { padding-right: 4px; }
2970
- .pr2 { padding-right: 8px; }
2971
- .pr3 { padding-right: 12px; }
2972
- .pr4 { padding-right: 16px; }
2973
- .pr5 { padding-right: 20px; }
2974
- .pr6 { padding-right: 24px; }
2975
- .pr7 { padding-right: 28px; }
2976
- .pr8 { padding-right: 32px; }
2977
- .pr9 { padding-right: 36px; }
2978
- .pr10 { padding-right: 40px; }
3083
+ .pr1 { padding-inline-end: 4px; }
3084
+ .pr2 { padding-inline-end: 8px; }
3085
+ .pr3 { padding-inline-end: 12px; }
3086
+ .pr4 { padding-inline-end: 16px; }
3087
+ .pr5 { padding-inline-end: 20px; }
3088
+ .pr6 { padding-inline-end: 24px; }
3089
+ .pr7 { padding-inline-end: 28px; }
3090
+ .pr8 { padding-inline-end: 32px; }
3091
+ .pr9 { padding-inline-end: 36px; }
3092
+ .pr10 { padding-inline-end: 40px; }
2979
3093
 
2980
3094
  .pb1 { padding-bottom: 4px; }
2981
3095
  .pb2 { padding-bottom: 8px; }
@@ -2988,16 +3102,16 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
2988
3102
  .pb9 { padding-bottom: 36px; }
2989
3103
  .pb10 { padding-bottom: 40px; }
2990
3104
 
2991
- .pl1 { padding-left: 4px; }
2992
- .pl2 { padding-left: 8px; }
2993
- .pl3 { padding-left: 12px; }
2994
- .pl4 { padding-left: 16px; }
2995
- .pl5 { padding-left: 20px; }
2996
- .pl6 { padding-left: 24px; }
2997
- .pl7 { padding-left: 28px; }
2998
- .pl8 { padding-left: 32px; }
2999
- .pl9 { padding-left: 36px; }
3000
- .pl10 { padding-left: 40px; }
3105
+ .pl1 { padding-inline-start: 4px; }
3106
+ .pl2 { padding-inline-start: 8px; }
3107
+ .pl3 { padding-inline-start: 12px; }
3108
+ .pl4 { padding-inline-start: 16px; }
3109
+ .pl5 { padding-inline-start: 20px; }
3110
+ .pl6 { padding-inline-start: 24px; }
3111
+ .pl7 { padding-inline-start: 28px; }
3112
+ .pl8 { padding-inline-start: 32px; }
3113
+ .pl9 { padding-inline-start: 36px; }
3114
+ .pl10 { padding-inline-start: 40px; }
3001
3115
 
3002
3116
  .hidden { display: none !important; }
3003
3117
  `,p0=`
@@ -3212,7 +3326,7 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
3212
3326
  overflow-y: scroll;
3213
3327
  overflow-x: clip;
3214
3328
  margin: 32px auto !important;
3215
- padding-right: 0 !important; /* Override scrollbar hiding */
3329
+ padding-inline-end: 0 !important; /* Override scrollbar hiding */
3216
3330
  }
3217
3331
 
3218
3332
  .gh-portal-popup-wrapper.multiple-products.signin {
@@ -3330,7 +3444,7 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
3330
3444
 
3331
3445
  .gh-portal-btn-inline {
3332
3446
  display: inline-block;
3333
- margin-left: 4px;
3447
+ margin-inline-start: 4px;
3334
3448
  font-size: 1.5rem;
3335
3449
  font-weight: 600;
3336
3450
  cursor: pointer;
@@ -3344,7 +3458,7 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
3344
3458
  .gh-portal-checkmark-container {
3345
3459
  display: flex;
3346
3460
  opacity: 0;
3347
- margin-right: 8px;
3461
+ margin-inline-end: 8px;
3348
3462
  transition: opacity ease 0.4s 0.2s;
3349
3463
  }
3350
3464
 
@@ -3392,9 +3506,9 @@ footer.gh-portal-signup-footer.invite-only .gh-portal-signup-message {
3392
3506
  .gh-portal-hide {
3393
3507
  display: none;
3394
3508
  }
3395
- `;function g0({site:e}){return Vc+m0+HE+wC+TC+lC()+BE+YE+OE+Eg+UC+RC+HC()+LC+p0+h0+WC+XC+e0+t0+a0+o0+l0}class Cf extends U.Component{constructor(t){super(t),this.state={email:""}}componentDidMount(){const{member:t}=this.context;t&&this.context.onAction("switchPage",{page:"accountHome"})}handleSignin(t){t.preventDefault(),this.setState(n=>({errors:Yo({fields:this.getInputFields({state:n}),t:this.context.t})}),async()=>{const{email:n,phonenumber:a,errors:i}=this.state,{redirect:r}=this.context.pageData??{};i&&Object.values(i).filter(s=>!!s).length>0||this.context.onAction("signin",{email:n,phonenumber:a,redirect:r})})}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{t:n}=this.context,a=t.errors||{};return[{type:"email",value:t.email,placeholder:"jamie@example.com",label:n("Email"),name:"email",required:!0,errorMessage:a.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,t:n}=this.context;let a=!1;const i=t==="signin:running";let r=n(i?"Sending login link...":"Continue");const o=!!i;return t==="signin:failed"&&(r=n("Retry"),a=!0),c.jsx(ae,{dataTestId:"signin",retry:a,style:{width:"100%"},onClick:s=>this.handleSignin(s),disabled:o,brandColor:this.context.brandColor,label:r,isRunning:i})}renderSignupMessage(){const{brandColor:t,t:n}=this.context;return c.jsxs("div",{className:"gh-portal-signup-message",children:[c.jsx("div",{children:n("Don't have an account?")}),c.jsx("button",{"data-test-button":"signup-switch",className:"gh-portal-btn gh-portal-btn-link",style:{color:t},onClick:()=>this.context.onAction("switchPage",{page:"signup"}),children:c.jsx("span",{children:n("Sign up")})})]})}renderForm(){const{site:t,t:n}=this.context;return kn({site:t})?c.jsxs("section",{children:[c.jsx("div",{className:"gh-portal-section",children:c.jsx(Ro,{fields:this.getInputFields({state:this.state}),onChange:(a,i)=>this.handleInputChange(a,i),onKeyDown:(a,i)=>this.onKeyDown(a,i)})}),c.jsxs("footer",{className:"gh-portal-signin-footer",children:[this.renderSubmitButton(),this.renderSignupMessage()]})]}):c.jsx("section",{children:c.jsx("div",{className:"gh-portal-section",children:c.jsx("p",{className:"gh-portal-members-disabled-notification","data-testid":"members-disabled-notification-text",children:n("Memberships unavailable, contact the owner for access.")})})})}renderSiteIcon(){const{site:t}=this.context,n=t.icon;return n?c.jsx("img",{className:"gh-portal-signup-logo",src:n,alt:this.context.site.title}):kn({site:t})?null:c.jsx(cu,{className:"gh-portal-icon gh-portal-icon-invitation"})}renderSiteTitle(){const{site:t,t:n}=this.context,a=t.title;return kn({site:t})?c.jsx("h1",{className:"gh-portal-main-title",children:n("Sign in")}):c.jsx("h1",{className:"gh-portal-main-title",children:a})}renderFormHeader(){return c.jsxs("header",{className:"gh-portal-signin-header",children:[this.renderSiteIcon(),this.renderSiteTitle()]})}render(){return c.jsxs(c.Fragment,{children:[c.jsx(ie,{}),c.jsx("div",{className:"gh-portal-logged-out-form-container",children:c.jsxs("div",{className:"gh-portal-content signin",children:[this.renderFormHeader(),this.renderForm()]})})]})}}Z(Cf,"contextType",N);const f0=({handleSignout:e,supportAddress:t="",t:n})=>{const a=`mailto:${t}`;return c.jsxs("footer",{className:"gh-portal-account-footer",children:[c.jsx("ul",{className:"gh-portal-account-footermenu",children:c.jsx("li",{children:c.jsx("button",{"data-test-button":"footer-signout",className:"gh-portal-btn",name:"logout","aria-label":"logout",onClick:i=>e(i),children:n("Sign out")})})}),c.jsx("div",{className:"gh-portal-account-footerright",children:c.jsx("ul",{className:"gh-portal-account-footermenu",children:c.jsx("li",{children:c.jsx("a",{"data-test-link":"footer-support",className:"gh-portal-btn gh-portal-btn-branded",href:a,onClick:()=>{a&&window.open(a)},children:n("Contact support")})})})})]})},y0=()=>{const{member:e,brandColor:t,t:n}=k.useContext(N),a=e.avatar_image;return c.jsxs("header",{className:"gh-portal-account-header",children:[c.jsx(Hc,{gravatar:a,style:{userIcon:{color:t,width:"56px",height:"56px",padding:"2px"}}}),c.jsx("h2",{className:"gh-portal-main-title",children:n("Your account")})]})},b0=()=>{const{site:e,action:t,brandColor:n,onAction:a,t:i}=k.useContext(N);if(!qc({site:e}))return null;const r=["checkoutPlan:running"].includes(t),o=()=>{a("switchPage",{page:"accountPlan",lastPage:"accountHome"})};return c.jsx(ae,{dataTestId:"view-plans",isRunning:r,label:i("View plans"),onClick:()=>o(),brandColor:n,style:{width:"100%"}})},k0=()=>{const{member:e,site:t,t:n}=k.useContext(N),{is_stripe_configured:a}=t;if(!a||Ni({site:t}))return null;const i=_e({member:e}),r=Qt({member:e});if(r&&!i)return null;if(i){const o=i==null?void 0:i.current_period_end;if(r&&Kc({member:e})){const s=Kc({member:e}),l=$t(s);return c.jsx("div",{className:"gh-portal-section",children:c.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:n("Your subscription will expire on {{expiryDate}}",{expiryDate:l})})})}if(i!=null&&i.cancel_at_period_end||r)return null;if(Qc({sub:i})){const s=$t(i.trial_end_at);return c.jsx("div",{className:"gh-portal-section",children:c.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:n("Your subscription will start on {{subscriptionStart}}",{subscriptionStart:s})})})}return c.jsx("div",{className:"gh-portal-section",children:c.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:n("Your subscription will renew on {{renewalDate}}",{renewalDate:$t(o)})})})}return c.jsxs("div",{className:"gh-portal-section",children:[c.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:n("You currently have a free membership, upgrade to a paid subscription for full access.")}),c.jsx(b0,{})]})},v0=()=>{const{member:e,onAction:t,action:n,brandColor:a,t:i}=k.useContext(N),r=_e({member:e});if(!r||!r.cancel_at_period_end)return null;const o=r.cancel_at_period_end?i("Continue subscription"):i("Cancel subscription"),s=["cancelSubscription:running"].includes(n),l=!!s,u=!!r.cancel_at_period_end,d=()=>{if(!r.cancel_at_period_end)return null;const p=r.current_period_end;return c.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:i("Your subscription will expire on {{expiryDate}}",{expiryDate:$t(p)})})};return c.jsxs("div",{className:"gh-portal-cancelcontinue-container",children:[c.jsx(d,{}),c.jsx(ae,{onClick:()=>{t("continueSubscription",{subscriptionId:r.id})},isRunning:s,disabled:l,isPrimary:u,brandColor:a,label:o,style:{width:"100%"}})]})},w0=e=>k.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},k.createElement("defs",null,k.createElement("style",null,".a{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.5px;}")),k.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"}),k.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"})),x0=()=>{const{member:e,site:t,onAction:n,t:a}=k.useContext(N),i=()=>{const b=_e({member:e});n("editBilling",{subscriptionId:b.id})},r=()=>{const{is_stripe_configured:b}=t;b&&n("switchPage",{page:"accountPlan",lastPage:"accountHome"})},o=({price:b,isComplimentary:v,subscription:h})=>{const{offer:f,start_date:y}=h||{};let w="";if(b){const{amount:P=0,currency:_,interval:re}=b;w=`${Intl.NumberFormat("en",{currency:_,style:"currency"}).format(P/100)}/${a(re)}`}let x=E0({price:b,offer:f,subscriptionStartDate:y,t:a});const C=Kc({member:e});v&&(C?w=`${a("Complimentary")} - ${a("Expires {{expiryDate}}",{expiryDate:C})}`:w=w?`${a("Complimentary")} (${w})`:a("Complimentary"));let S="";x&&(S="gh-portal-account-old-price");const E=()=>x?c.jsxs("p",{className:"gh-portal-account-discountcontainer",children:[c.jsx(w0,{className:"gh-portal-account-tagicon"}),c.jsx("span",{children:x})]}):null,$=Qc({sub:h});return $&&(S="gh-portal-account-old-price"),$?c.jsxs(c.Fragment,{children:[c.jsx("p",{className:S,children:w}),c.jsx(S0,{subscription:h,t:a})]}):c.jsxs(c.Fragment,{children:[c.jsx("p",{className:S,children:w}),c.jsx(E,{})]})},s=({isComplimentary:b,isPaid:v})=>(Ti({member:e})?!1:b)||Ni({site:t})&&!v?null:c.jsx("button",{className:"gh-portal-btn gh-portal-btn-list",onClick:f=>r(),"data-test-button":"change-plan",children:a("Change")}),l=({defaultCardLast4:b})=>{if(b){const v=`**** **** **** ${b}`;return c.jsx("p",{children:v})}return null},u=({defaultCardLast4:b,isComplimentary:v})=>{const{action:h}=k.useContext(N),f=h==="editBilling:running"?c.jsx(ga,{className:"gh-portal-billing-button-loader"}):a("Update");return v?null:c.jsxs("section",{children:[c.jsxs("div",{className:"gh-portal-list-detail",children:[c.jsx("h3",{children:a("Billing info")}),c.jsx(l,{defaultCardLast4:b})]}),c.jsx("button",{className:"gh-portal-btn gh-portal-btn-list",onClick:y=>i(),"data-test-button":"update-billing",children:f})]})},d=_e({member:e}),p=Qt({member:e}),m=ut({member:e}),g=d==null?void 0:d.cancel_at_period_end;if(d||p){const{price:b,default_payment_card_last4:v}=d||{};let h=a("Plan");return So({site:t})&&$g({member:e})&&(h=$g({member:e})),c.jsxs(c.Fragment,{children:[c.jsxs("section",{children:[c.jsxs("div",{className:"gh-portal-list-detail",children:[c.jsx("h3",{children:h}),c.jsx(o,{price:b,isComplimentary:p,subscription:d})]}),c.jsx(s,{isComplimentary:p,isPaid:m,isCancelled:g})]}),c.jsx(u,{isComplimentary:p,defaultCardLast4:v})]})}return null};function S0({subscription:e,t}){if(Qc({sub:e})){const n=$t(e.trial_end_at);return c.jsx("p",{className:"gh-portal-account-discountcontainer",children:c.jsx("div",{children:c.jsx("span",{children:t("Free Trial – Ends {{trialEnd}}",{trialEnd:n})})})})}return null}function E0({offer:e,price:t,subscriptionStartDate:n,t:a}){let i="";if((e==null?void 0:e.type)==="trial"||(e==null?void 0:e.duration)==="once")return"";if(e){const r=e.duration;let o="";if(r==="forever")o=a("Forever");else if(r==="repeating"){const s=e.duration_in_months||0;let l=new Date(n),u=new Date(l.setMonth(l.getMonth()+s));if(zg(u))return"";o=a("Ends {{offerEndDate}}",{offerEndDate:$t(u)})}i=`${EE({offer:e,price:t,useFormatted:!0})}/${t.interval}${o?` — ${o}`:""}`}return i}function C0(){const{member:e,site:t,onAction:n,t:a}=k.useContext(N);let{newsletters:i}=e;const r=!!(i!=null&&i.length);let o=a(r?"Subscribed":"Unsubscribed");const s=l=>{var p;l.preventDefault();const u=wn({site:t}),d=(p=e==null?void 0:e.newsletters)!=null&&p.length?[]:u;n("updateNewsletterPreference",{newsletters:d})};return c.jsxs("section",{children:[c.jsxs("div",{className:"gh-portal-list-detail email-newsletter",children:[c.jsx("h3",{children:a("Email newsletter")}),c.jsxs("p",{children:[o," ",Zc({member:e})&&r&&c.jsx("button",{className:"gh-portal-btn-text gh-email-faq-page-button",onClick:()=>n("switchPage",{page:"emailReceivingFAQ",lastPage:"accountHome"}),children:a("Not receiving emails?")})]})]}),c.jsx("div",{children:c.jsx(zo,{dataTestId:"default-newsletter-toggle",id:"default-newsletter-toggle",onToggle:l=>{s(l)},checked:r})})]})}const $f=e=>k.createElement("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",...e},k.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"}),k.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 $0(){const{onAction:e,member:t,t:n}=k.useContext(N),a=Ag({member:t}),i=a?"emailSuppressed":"accountEmail";return c.jsxs("section",{children:[c.jsxs("div",{className:"gh-portal-list-detail",children:[c.jsx("h3",{children:n("Emails")}),a?c.jsxs("p",{className:"gh-portal-email-notice",children:[c.jsx($f,{className:"gh-portal-email-notice-icon"}),c.jsx("span",{className:"gh-mobile-only",children:n("You're not receiving emails")}),c.jsx("span",{className:"gh-desktop-only",children:n("You're currently not receiving emails")})]}):c.jsx("p",{children:n("Update your preferences")})]}),c.jsx("button",{className:"gh-portal-btn gh-portal-btn-list",onClick:()=>{e("switchPage",{page:i,lastPage:"accountHome"})},"data-test-button":"manage-newsletters",children:n("Manage")})]})}const j0=()=>{const{member:e,onAction:t,site:n,t:a}=k.useContext(N),{name:i,email:r}=e,o=()=>{t("switchPage",{page:"accountProfile",lastPage:"accountHome"})},s=To({site:n})||Pg({site:n})||Ag({member:e}),l=oE({site:n});return c.jsx("div",{children:c.jsxs("div",{className:"gh-portal-list",children:[c.jsxs("section",{children:[c.jsxs("div",{className:"gh-portal-list-detail",children:[c.jsx("h3",{children:i||a("Account")}),c.jsx("p",{children:r})]}),c.jsx("button",{"data-test-button":"edit-profile",className:"gh-portal-btn gh-portal-btn-list",onClick:u=>o(),children:a("Edit")})]}),c.jsx(x0,{}),s?c.jsx($0,{}):c.jsx(c.Fragment,{}),l&&!s?c.jsx(C0,{}):c.jsx(c.Fragment,{})]})})},P0=()=>c.jsxs("div",{className:"gh-portal-content gh-portal-account-main",children:[c.jsx(ie,{}),c.jsx(y0,{}),c.jsxs("section",{className:"gh-portal-account-data",children:[c.jsx(k0,{}),c.jsx(v0,{}),c.jsx(j0,{})]})]});class jf extends U.Component{componentDidMount(){const{member:t,site:n}=this.context;kn({site:n})||this.context.onAction("signout"),t||this.context.onAction("switchPage",{page:"signin",pageData:{redirect:window.location.href}})}handleSignout(t){t.preventDefault(),this.context.onAction("signout")}render(){const{member:t,site:n,t:a}=this.context,i=Ii({site:n});return!t||!kn({site:n})?null:c.jsxs("div",{className:"gh-portal-account-wrapper",children:[c.jsx(P0,{}),c.jsx(f0,{onClose:()=>this.context.onAction("closePopup"),handleSignout:r=>this.handleSignout(r),supportAddress:i,t:a})]})}}Z(jf,"contextType",N);class Pf extends U.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.onAction("switchPage",{page:"signin"})}handleSignout(t){t.preventDefault(),this.context.onAction("signout")}onBack(){this.context.onAction("back")}onProfileSave(t){t.preventDefault(),this.setState(n=>({errors:Yo({fields:this.getInputFields({state:n}),t:this.context.t})}),()=>{const{email:n,name:a,errors:i}=this.state;i&&Object.values(i).filter(o=>!!o).length>0||(this.context.onAction("clearPopupNotification"),this.context.onAction("updateProfile",{email:n,name:a}))})}renderSaveButton(){const{t}=this.context,n=this.context.action==="updateProfile:running";let a=t("Save");this.context.action==="updateProfile:failed"&&(a=t("Retry"));const i=!!n;return c.jsx(ae,{dataTestId:"save-button",isRunning:n,onClick:r=>this.onProfileSave(r),disabled:i,brandColor:this.context.brandColor,label:a,style:{width:"100%"}})}renderDeleteAccountButton(){const{t}=this.context;return c.jsx("div",{style:{cursor:"pointer",color:"red"},role:"button",children:t("Delete account")})}renderAccountFooter(){return c.jsx("footer",{className:"gh-portal-action-footer",children:this.renderSaveButton()})}renderHeader(){const{t}=this.context;return c.jsxs("header",{className:"gh-portal-detail-header",children:[c.jsx(fa,{brandColor:this.context.brandColor,hidden:!this.context.lastPage,onClick:n=>this.onBack(n)}),c.jsx("h3",{className:"gh-portal-main-title",children:t("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 c.jsx("div",{style:n,children:c.jsx(Hc,{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{t:a}=this.context,i=t.errors||{},r=[{type:"text",value:t.name,placeholder:a("Jamie Larson"),label:a("Name"),name:"name",required:!0,errorMessage:i.name||""},{type:"email",value:t.email,placeholder:a("jamie@example.com"),label:a("Email"),name:"email",required:!0,errorMessage:i.email||""}];return n&&n.length>0?r.filter(o=>n.includes(o.name)):r}onKeyDown(t){t.keyCode===13&&this.onProfileSave(t)}renderProfileData(){return c.jsx("div",{className:"gh-portal-section",children:c.jsx(Ro,{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?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"gh-portal-content with-footer",children:[c.jsx(ie,{}),this.renderHeader(),c.jsx("div",{className:"gh-portal-section",children:this.renderProfileData()})]}),this.renderAccountFooter()]}):null}}Z(Pf,"contextType",N);function T0(){const{brandColor:e,lastPage:t,onAction:n,t:a}=k.useContext(N);return c.jsxs("header",{className:"gh-portal-detail-header",children:[c.jsx(fa,{brandColor:e,hidden:!t,onClick:()=>{n("back")}}),c.jsx("h3",{className:"gh-portal-main-title",children:a("Email preferences")})]})}function Tf({show:e,checked:t}){let n=[];return e&&n.push("gh-portal-checkmark-show"),t&&n.push("gh-portal-toggle-checked"),n.push("gh-portal-checkmark-container"),c.jsx("div",{className:n.join(" "),"data-testid":"checkmark-container",children:c.jsx(xf,{className:"gh-portal-checkmark-icon",alt:""})})}function N0({newsletter:e,subscribedNewsletters:t,setSubscribedNewsletters:n}){const a=t.some(l=>l.id===(e==null?void 0:e.id)),[i,r]=k.useState(!1),[o,s]=k.useState(null);return c.jsxs("section",{className:"gh-portal-list-toggle-wrapper","data-testid":"toggle-wrapper",children:[c.jsxs("div",{className:"gh-portal-list-detail",children:[c.jsx("h3",{children:e.name}),c.jsx("p",{children:e==null?void 0:e.description})]}),c.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[c.jsx(Tf,{show:i,checked:a}),c.jsx(zo,{id:e.id,onToggle:(l,u)=>{let d=[];if(u){d=t.filter(m=>m.id!==e.id).concat(e),r(!0),clearTimeout(o);let p=setTimeout(()=>{r(!1)},2e3);s(p)}else{d=t.filter(m=>m.id!==e.id),r(!0),clearTimeout(o);let p=setTimeout(()=>{r(!1)},2e3);s(p)}n(d)},checked:a})]})]})}function I0({updateCommentNotifications:e,isCommentsEnabled:t,enableCommentNotifications:n}){const{t:a}=k.useContext(N),i=!!n,[r,o]=k.useState(!1),[s,l]=k.useState(null);return t?c.jsxs("section",{className:"gh-portal-list-toggle-wrapper","data-testid":"toggle-wrapper",children:[c.jsxs("div",{className:"gh-portal-list-detail",children:[c.jsx("h3",{children:a("Comments")}),c.jsx("p",{children:a("Get notified when someone replies to your comment")})]}),c.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[c.jsx(Tf,{show:r,checked:i}),c.jsx(zo,{id:"comments",onToggle:(u,d)=>{o(!0),clearTimeout(s);let p=setTimeout(()=>{o(!1)},2e3);l(p),e(d)},checked:i})]})]}):null}function A0({subscribedNewsletters:e,setSubscribedNewsletters:t}){const{site:n}=k.useContext(N);return wn({site:n}).map(i=>c.jsx(N0,{newsletter:i,subscribedNewsletters:e,setSubscribedNewsletters:t},i==null?void 0:i.id))}function z0({site:e,isPaid:t}){const{t:n}=k.useContext(N);return t?c.jsx("p",{style:{textAlign:"center",marginTop:"12px",marginBottom:"0",color:"var(--grey6)"},children:n("Unsubscribing from emails will not cancel your paid subscription to {{title}}",{title:e==null?void 0:e.title})}):null}function Nf({notification:e,subscribedNewsletters:t,updateSubscribedNewsletters:n,updateCommentNotifications:a,unsubscribeAll:i,isPaidMember:r,isCommentsEnabled:o,enableCommentNotifications:s}){const{brandColor:l,onAction:u,member:d,site:p,t:m}=k.useContext(N),g=!(t!=null&&t.length)&&(o&&!s||!o),v=e||(()=>null);return c.jsxs("div",{className:"gh-portal-content with-footer",children:[c.jsx(ie,{}),c.jsx(T0,{}),c.jsx(v,{}),c.jsx("div",{className:"gh-portal-section flex",children:c.jsxs("div",{className:"gh-portal-list",children:[c.jsx(A0,{subscribedNewsletters:t,setSubscribedNewsletters:h=>{let f=h.map(y=>({id:y.id}));n(f)}}),c.jsx(I0,{isCommentsEnabled:o,enableCommentNotifications:s,updateCommentNotifications:a})]})}),c.jsx("div",{className:"gh-portal-btn-product gh-portal-btn-unsubscribe",style:{marginTop:"-48px",marginBottom:0},children:c.jsx(ae,{isRunning:!1,onClick:()=>{i()},disabled:g,brandColor:l,isPrimary:!1,label:m("Unsubscribe from all emails"),isDestructive:!0,style:{width:"100%",zIndex:900},dataTestId:"unsubscribe-from-all-emails"})}),c.jsxs("footer",{className:"gh-portal-action-footer"+(Zc({member:d})?" gh-feature-suppressions":""),children:[c.jsx("div",{style:{width:"100%"},children:c.jsx(z0,{isPaid:r,site:p})}),Zc({member:d})&&!g&&c.jsxs("div",{className:"gh-portal-footer-secondary",children:[c.jsx("span",{className:"gh-portal-footer-secondary-light",children:m("Not receiving emails?")}),c.jsxs("button",{className:"gh-portal-btn-text gh-email-faq-page-button",onClick:()=>u("switchPage",{page:"emailReceivingFAQ",pageData:{direct:!1}}),children:[m("Get help")," →"]})]})]})]})}function D0(){const{member:e,onAction:t,site:n,t:a,pageData:i}=k.useContext(N);let r,o;i&&(r=i.newsletterUuid,o=i.action);const[s,l]=k.useState(!0),u=wn({site:n});k.useEffect(()=>{e||t("switchPage",{page:"signin"})},[e,t]),k.useEffect(()=>{if(r&&o==="unsubscribe"){const h=e==null?void 0:e.newsletters.filter(f=>f.uuid!==r);g(h),l(!1),t("updateNewsletterPreference",{newsletters:h})}},[]);const d=()=>{if(i.comments&&b){const y=s?"gh-portal-hide":"";return c.jsx(c.Fragment,{children:c.jsx("p",{className:`gh-portal-text-center gh-portal-header-message ${y}`,children:c.jsx($e,{syntax:Ie,string:a("{{memberEmail}} will no longer receive emails when someone replies to your comments."),mapping:{memberEmail:c.jsx("strong",{children:e==null?void 0:e.email})}})})})}const h=u==null?void 0:u.find(y=>y.uuid===i.newsletterUuid);if(!h)return null;const f=s?"gh-portal-hide":"";return c.jsx(c.Fragment,{children:c.jsx("p",{className:`gh-portal-text-center gh-portal-header-message ${f}`,children:c.jsx($e,{syntax:Ie,string:a("{{memberEmail}} will no longer receive {{newsletterName}} newsletter."),mapping:{memberEmail:c.jsx("strong",{children:e==null?void 0:e.email}),newsletterName:c.jsx("strong",{children:h==null?void 0:h.name})}})})})},p=[...(e==null?void 0:e.newsletters)||[]],[m,g]=k.useState(p),{comments_enabled:b}=n,{enable_comment_notifications:v}=e||{};return k.useEffect(()=>{g((e==null?void 0:e.newsletters)||[])},[e==null?void 0:e.newsletters]),c.jsx(Nf,{notification:r?d:null,subscribedNewsletters:m,updateSubscribedNewsletters:h=>{g(h),t("updateNewsletterPreference",{newsletters:h})},updateCommentNotifications:async h=>{t("updateNewsletterPreference",{enableCommentNotifications:h})},unsubscribeAll:()=>{g([]),t("showPopupNotification",{action:"updated:success",message:a("Unsubscribed from all emails.")});const h={newsletters:[]};b&&(h.enableCommentNotifications=!1),t("updateNewsletterPreference",h)},isPaidMember:ut({member:e}),isCommentsEnabled:b!=="off",enableCommentNotifications:v})}function F0(){const{site:e}=k.useContext(N),t=e.icon;return t?c.jsx("img",{className:"gh-portal-unsubscribe-logo",src:t,alt:e.title}):null}function M0(){const{site:e}=k.useContext(N),t=e.title||"";return c.jsxs("header",{className:"gh-portal-header",children:[c.jsx(F0,{}),c.jsx("h2",{className:"gh-portal-publication-title",children:t})]})}async function If({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 _0(){const{site:e,api:t,pageData:n,member:a,onAction:i,t:r}=k.useContext(N),[o,s]=k.useState(),[l,u]=k.useState(!0),d=wn({site:e}),p=d.filter($=>$.subscribe_on_signup),[m,g]=k.useState(!1),[b,v]=k.useState(p),[h,f]=k.useState(!1),{comments_enabled:y}=e,{enable_comment_notifications:w=!1}=o||{},x=async $=>{a?i("updateNewsletterPreference",{newsletters:$}):await If({api:t,memberUuid:n.uuid,key:n.key,newsletters:$}),v($)},C=async $=>{let P;a?(await i("updateNewsletterPreference",{enableCommentNotifications:$}),P={...a,enable_comment_notifications:$}):P=await If({api:t,memberUuid:n.uuid,key:n.key,enableCommentNotifications:$}),s(P)},S=async()=>{let $;a?(await i("updateNewsletterPreference",{newsletters:[],enableCommentNotifications:!1}),$={...a},$.newsletters=[],$.enable_comment_notifications=!1):$=await t.member.updateNewsletters({uuid:n.uuid,newsletters:[],enableCommentNotifications:!1}),v([]),s($),i("showPopupNotification",{action:"updated:success",message:r("Unsubscribed from all emails.")})};if(k.useEffect(()=>{(async()=>{let $;try{$=await t.member.newsletters({uuid:n.uuid,key:n.key}),s($??null),u(!1)}catch(_){console.error("[PORTAL] Error fetching member newsletters",_),s(null),u(!1);return}if($===null)return;const P=($==null?void 0:$.newsletters)||[];v(P),(d==null?void 0:d.length)===1&&!y&&!n.newsletterUuid?await x([]):n.newsletterUuid?await x(P==null?void 0:P.filter(_=>_.uuid!==n.newsletterUuid)):n.comments&&y&&await C(!1)})()},[y,n.uuid,n.newsletterUuid,n.comments,e.url,d==null?void 0:d.length]),l)return c.jsx(Mi,{});if(!o)return c.jsxs("div",{className:"gh-portal-content gh-portal-feedback with-footer",children:[c.jsx(ie,{}),c.jsx("div",{className:"gh-feedback-icon gh-feedback-icon-error",children:c.jsx(nu,{})}),c.jsx("h1",{className:"gh-portal-main-title",children:r("That didn't go to plan")}),c.jsx("div",{children:c.jsx("p",{className:"gh-portal-text-center",children:r("We couldn't unsubscribe you as the email address was not found. Please contact the site owner.")})}),c.jsx(ae,{style:{width:"100%"},retry:!1,onClick:()=>i("closePopup"),disabled:!1,brandColor:"#000000",label:r("Close"),isRunning:!1,tabindex:"3",classes:"sticky bottom"})]});if((d==null?void 0:d.length)===1&&!y&&!h)return c.jsxs("div",{className:"gh-portal-content gh-portal-unsubscribe with-footer",children:[c.jsx(ie,{}),c.jsx(M0,{}),c.jsx("h1",{className:"gh-portal-main-title",children:r("Successfully unsubscribed")}),c.jsxs("div",{children:[c.jsx("p",{className:"gh-portal-text-center",children:c.jsx($e,{syntax:Ie,string:r("{{memberEmail}} will no longer receive this newsletter."),mapping:{memberEmail:c.jsx("strong",{children:o==null?void 0:o.email})}})}),c.jsx("p",{className:"gh-portal-text-center",children:c.jsx($e,{syntax:Ie,string:r("Didn't mean to do this? Manage your preferences <button>here</button>."),mapping:{button:c.jsx("button",{className:"gh-portal-btn-link gh-portal-btn-branded gh-portal-btn-inline",onClick:()=>{f(!0)}})}})})]})]});const E=()=>{if(n.comments&&y){const _=m?"gh-portal-hide":"";return c.jsx(c.Fragment,{children:c.jsx("p",{className:`gh-portal-text-center gh-portal-header-message ${_}`,children:c.jsx($e,{syntax:Ie,string:r("{{memberEmail}} will no longer receive emails when someone replies to your comments."),mapping:{memberEmail:c.jsx("strong",{children:o==null?void 0:o.email})}})})})}const $=d==null?void 0:d.find(_=>_.uuid===n.newsletterUuid);if(!$)return null;const P=m?"gh-portal-hide":"";return c.jsx(c.Fragment,{children:c.jsx("p",{className:`gh-portal-text-center gh-portal-header-message ${P}`,children:c.jsx($e,{syntax:Ie,string:r("{{memberEmail}} will no longer receive {{newsletterName}} newsletter."),mapping:{memberEmail:c.jsx("strong",{children:o==null?void 0:o.email}),newsletterName:c.jsx("strong",{children:$==null?void 0:$.name})}})})})};return c.jsx(Nf,{notification:E,subscribedNewsletters:b,updateSubscribedNewsletters:async $=>{await x($),g(!0)},updateCommentNotifications:C,unsubscribeAll:async()=>{await S(),g(!0)},isPaidMember:(o==null?void 0:o.status)!=="free",isCommentsEnabled:y!=="off",enableCommentNotifications:w})}function R0(){const{brandColor:e,lastPage:t,onAction:n,action:a,site:i,t:r}=k.useContext(N);k.useEffect(()=>{["removeEmailFromSuppressionList:success"].includes(a)&&n("refreshMemberData"),["removeEmailFromSuppressionList:failed","refreshMemberData:failed"].includes(a)&&n("back"),["refreshMemberData:success"].includes(a)&&(To({site:i})||Pg({site:i})?(n("switchPage",{page:"accountEmail",lastPage:"accountHome"}),n("showPopupNotification",{message:r("You have been successfully resubscribed")})):n("back"))},[a,n,i,r]);const o=["removeEmailFromSuppressionList:running","refreshMemberData:running"].includes(a),s=()=>{n("removeEmailFromSuppressionList")};return c.jsxs("div",{className:"gh-email-suppressed-page",children:[c.jsxs("header",{className:"gh-portal-detail-header",children:[c.jsx(fa,{brandColor:e,hidden:!t,onClick:()=>{n("back")}}),c.jsx(ie,{})]}),c.jsx($f,{className:"gh-email-suppressed-page-icon"}),c.jsxs("div",{className:"gh-email-suppressed-page-text",children:[c.jsx("h3",{className:"gh-portal-main-title gh-email-suppressed-page-title",children:r("Emails disabled")}),c.jsx("p",{children:r("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.")})]}),c.jsx(ae,{dataTestId:"resubscribe-email",classes:"gh-portal-confirm-button",onClick:s,disabled:o,brandColor:e,label:r("Re-enable emails"),isRunning:o})]})}function Y0(){const{brandColor:e,onAction:t,site:n,t:a,pageData:i}=k.useContext(N),r=`mailto:${Ii({site:n})}`,o=i&&i.direct||!1;return c.jsxs("div",{className:"gh-email-suppression-faq",children:[!o&&c.jsxs("header",{className:"gh-portal-detail-header",children:[c.jsx(fa,{brandColor:e,onClick:()=>{t("switchPage",{page:"emailSuppressed",lastPage:"accountHome"})}}),c.jsx(ie,{})]}),c.jsxs("div",{className:"gh-longform",children:[c.jsx("h3",{children:a("Why has my email been disabled?")}),c.jsx("p",{children:a("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).")}),c.jsx("h4",{children:a("Spam complaints")}),c.jsx("p",{children:a("If a newsletter is flagged as spam, emails are automatically disabled for that address to make sure you no longer receive any unwanted messages.")}),c.jsx("p",{children:a("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.")}),c.jsx("p",{children:a("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.")}),c.jsx("h4",{children:a("Permanent failure (bounce)")}),c.jsx("p",{children:a("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.")}),c.jsx("p",{children:a("In the event a permanent failure is received when attempting to send a newsletter, emails will be disabled on the account.")}),c.jsx("p",{children:a("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.")}),c.jsx("p",{children:c.jsx("a",{className:"gh-portal-btn gh-portal-btn-branded no-margin-right",href:r,onClick:()=>{r&&window.open(r)},children:a("Need more help? Contact support")})})]})]})}function U0(){const{brandColor:e,onAction:t,site:n,lastPage:a,member:i,t:r,pageData:o}=k.useContext(N),s=Ii({site:n}),l=`mailto:${s}`,u=xE({site:n}),d=o&&o.direct||!1;return c.jsxs("div",{className:"gh-email-receiving-faq",children:[c.jsxs("header",{className:"gh-portal-detail-header",children:[!d&&c.jsx(fa,{brandColor:e,onClick:()=>{a?t("switchPage",{page:"accountHome"}):t("switchPage",{page:"accountEmail",lastPage:"accountHome"})}}),c.jsx(ie,{})]}),c.jsxs("div",{className:"gh-longform",children:[c.jsx("h3",{children:r("Help! I'm not receiving emails")}),c.jsx("p",{children:r("If you're not receiving the email newsletter you've subscribed to, here are a few things to check.")}),c.jsx("h4",{children:r("Verify your email address is correct")}),c.jsx("p",{children:c.jsx($e,{syntax:Ie,string:r("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:c.jsx("strong",{children:i.email}),button:c.jsx("button",{className:"gh-portal-btn-text",onClick:()=>t("switchPage",{lastPage:"emailReceivingFAQ",page:"accountProfile"})})}})}),c.jsx("h4",{children:r("Check spam & promotions folders")}),c.jsx("p",{children:r(`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".`)}),c.jsx("h4",{children:r("Create a new contact")}),c.jsx("p",{children:c.jsx($e,{syntax:Ie,string:r("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:c.jsx("strong",{children:u})}})}),c.jsx("h4",{children:r("Send an email and say hi!")}),c.jsx("p",{children:c.jsx($e,{syntax:Ie,string:r("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:c.jsx("strong",{children:u})}})}),c.jsx("h4",{children:r("Check with your mail provider")}),c.jsx("p",{children:c.jsx($e,{syntax:Ie,string:r("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:c.jsx("strong",{children:u})}})}),c.jsx("h4",{children:r("Get in touch for help")}),c.jsx("p",{children:c.jsx($e,{syntax:Ie,string:r("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:c.jsx("a",{href:l,onClick:()=>{l&&window.open(l)},children:s})}})})]})]})}const du={signin:Cf,signup:ff,accountHome:jf,accountPlan:pf,accountProfile:Pf,accountEmail:D0,signupNewsletter:lu,unsubscribe:_0,magiclink:yf,loading:Mi,offer:kf,feedback:ZC,emailSuppressed:R0,emailSuppressionFAQ:Y0,emailReceivingFAQ:U0,support:()=>{const[e,t]=k.useState(!0),[n,a]=k.useState(null),[i,r]=k.useState(null),{member:o,t:s,site:l}=k.useContext(N);return k.useEffect(()=>{async function u(){const d=l.url,p=window.location.origin+window.location.pathname,m=o?`${p}?action=support&success=true`:`${p}#/portal/support/success`,g=p,b=Oo({siteUrl:d});try{const v=await b.member.checkoutDonation({successUrl:m,cancelUrl:g});v.url&&window.location.replace(v.url)}catch(v){v.type&&v.type==="DisabledFeatureError"?r(s("This site is not accepting payments at the moment.")):a(s("Something went wrong, please try again later.")),t(!1)}}u()},[]),e?c.jsx("div",{children:c.jsx(Mi,{})}):n?c.jsx(uu,{error:n}):i?c.jsx(uu,{error:i}):null},supportSuccess:i0,supportError:uu,recommendations:d0},mu=function({page:e}){return Object.keys(du).includes(e)?e:"signup"},L0=function({page:e}){return e.includes("account")},O0=function({page:e}){return e.includes("offer")},B0=e=>k.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},k.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"}));class pu extends U.Component{render(){return c.jsxs("a",{href:"https://ghost.org",target:"_blank",rel:"noopener noreferrer",onClick:()=>{window.open("https://ghost.org","_blank")},children:[c.jsx(B0,{}),"Powered by Ghost"]})}}Z(pu,"contextType",N);const Af=()=>({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 H0({message:e}){return ma()?c.jsx("div",{className:"gh-portal-cookiebanner",children:e}):null}class zf extends U.Component{componentDidMount(){this.node&&!G(["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.onAction("closePopup")}sendContainerHeightChangeEvent(){var t,n;this.node&&G(["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){G(["preview"])||t.target===t.currentTarget&&this.context.onAction("closePopup")}renderActivePage(){const{page:t}=this.context;mu({page:t});const n=du[t];return c.jsx(n,{})}renderPopupNotification(){const{popupNotification:t}=this.context;return!t||!t.type?null:c.jsx(bf,{})}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=$o({site:a}).length;mu({page:t});const l={...Af().page[t]};let u="",d="regular",p="",m=t;switch(t){case"signup":p="Cookies must be enabled in your browser to sign up.";break;case"signin":p="Cookies must be enabled in your browser to sign in.";break;case"accountHome":m="account-home";break;case"accountProfile":m="account-profile";break;case"accountPlan":m="account-plan";break;default:p="Cookies must be enabled in your browser.",m=t;break}o>1&&!dt({site:a,pageQuery:n})&&t==="signup"&&(m+=" full-size",d="full");const g=Po({site:a});(g&&o>2||!g&&o>1)&&t==="accountPlan"&&(m+=" full-size",d="full"),(t==="emailSuppressionFAQ"||t==="emailReceivingFAQ")&&(m+=" large-size");let b="gh-portal-popup-container";G(["preview"])&&(m+=" preview"),G(["preview"],{customSiteUrl:i})&&!a.disableBackground&&(b+=" preview"),G(["dev"])&&(b+=" dev");const v=`${b} ${u} ${m}`;return this.sendPortalPreviewReadyEvent(),c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"gh-portal-popup-wrapper "+m,onClick:h=>this.handlePopupClose(h),children:c.jsxs("div",{className:v,style:l,ref:h=>this.node=h,tabIndex:-1,children:[c.jsx(H0,{message:p}),this.renderPopupNotification(),this.renderActivePage(),d==="full"?c.jsx("div",{className:"gh-portal-powered inside "+(G(["preview"])?"hidden ":"")+m,children:c.jsx(pu,{})}):""]})}),c.jsx("div",{className:"gh-portal-powered outside "+(G(["preview"])?"hidden ":"")+m,children:c.jsx(pu,{})})]})}}Z(zf,"contextType",N);class Df extends U.Component{constructor(t){super(t),this.state={height:null}}renderCurrentPage(t){const n=du[t];return c.jsx(n,{})}onHeightChange(t){this.setState({height:t})}handlePopupClose(t){t.preventDefault(),t.target===t.currentTarget&&this.context.onAction("closePopup")}renderFrameStyles(){const{site:t}=this.context,n=g0({site:t}),a=`
3509
+ `;function g0({site:e}){return Vc+m0+HE+wC+TC+lC()+BE+YE+OE+Eg+UC+RC+HC()+LC+p0+h0+WC+XC+e0+t0+a0+o0+l0}class Cf extends U.Component{constructor(t){super(t),this.state={email:""}}componentDidMount(){const{member:t}=this.context;t&&this.context.onAction("switchPage",{page:"accountHome"})}handleSignin(t){t.preventDefault(),this.setState(n=>({errors:Yo({fields:this.getInputFields({state:n}),t:this.context.t})}),async()=>{const{email:n,phonenumber:a,errors:i}=this.state,{redirect:r}=this.context.pageData??{};i&&Object.values(i).filter(s=>!!s).length>0||this.context.onAction("signin",{email:n,phonenumber:a,redirect:r})})}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{t:n}=this.context,a=t.errors||{};return[{type:"email",value:t.email,placeholder:"jamie@example.com",label:n("Email"),name:"email",required:!0,errorMessage:a.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,t:n}=this.context;let a=!1;const i=t==="signin:running";let r=n(i?"Sending login link...":"Continue");const o=!!i;return t==="signin:failed"&&(r=n("Retry"),a=!0),c.jsx(ae,{dataTestId:"signin",retry:a,style:{width:"100%"},onClick:s=>this.handleSignin(s),disabled:o,brandColor:this.context.brandColor,label:r,isRunning:i})}renderSignupMessage(){const{brandColor:t,t:n}=this.context;return c.jsxs("div",{className:"gh-portal-signup-message",children:[c.jsx("div",{children:n("Don't have an account?")}),c.jsx("button",{"data-test-button":"signup-switch",className:"gh-portal-btn gh-portal-btn-link",style:{color:t},onClick:()=>this.context.onAction("switchPage",{page:"signup"}),children:c.jsx("span",{children:n("Sign up")})})]})}renderForm(){const{site:t,t:n}=this.context;return kn({site:t})?c.jsxs("section",{children:[c.jsx("div",{className:"gh-portal-section",children:c.jsx(Ro,{fields:this.getInputFields({state:this.state}),onChange:(a,i)=>this.handleInputChange(a,i),onKeyDown:(a,i)=>this.onKeyDown(a,i)})}),c.jsxs("footer",{className:"gh-portal-signin-footer",children:[this.renderSubmitButton(),this.renderSignupMessage()]})]}):c.jsx("section",{children:c.jsx("div",{className:"gh-portal-section",children:c.jsx("p",{className:"gh-portal-members-disabled-notification","data-testid":"members-disabled-notification-text",children:n("Memberships unavailable, contact the owner for access.")})})})}renderSiteIcon(){const{site:t}=this.context,n=t.icon;return n?c.jsx("img",{className:"gh-portal-signup-logo",src:n,alt:this.context.site.title}):kn({site:t})?null:c.jsx(cu,{className:"gh-portal-icon gh-portal-icon-invitation"})}renderSiteTitle(){const{site:t,t:n}=this.context,a=t.title;return kn({site:t})?c.jsx("h1",{className:"gh-portal-main-title",children:n("Sign in")}):c.jsx("h1",{className:"gh-portal-main-title",children:a})}renderFormHeader(){return c.jsxs("header",{className:"gh-portal-signin-header",children:[this.renderSiteIcon(),this.renderSiteTitle()]})}render(){return c.jsxs(c.Fragment,{children:[c.jsx(ie,{}),c.jsx("div",{className:"gh-portal-logged-out-form-container",children:c.jsxs("div",{className:"gh-portal-content signin",children:[this.renderFormHeader(),this.renderForm()]})})]})}}Z(Cf,"contextType",N);const f0=({handleSignout:e,supportAddress:t="",t:n})=>{const a=`mailto:${t}`;return c.jsxs("footer",{className:"gh-portal-account-footer",children:[c.jsx("ul",{className:"gh-portal-account-footermenu",children:c.jsx("li",{children:c.jsx("button",{"data-test-button":"footer-signout",className:"gh-portal-btn",name:"logout","aria-label":"logout",onClick:i=>e(i),children:n("Sign out")})})}),c.jsx("div",{className:"gh-portal-account-footerright",children:c.jsx("ul",{className:"gh-portal-account-footermenu",children:c.jsx("li",{children:c.jsx("a",{"data-test-link":"footer-support",className:"gh-portal-btn gh-portal-btn-branded",href:a,onClick:()=>{a&&window.open(a)},children:n("Contact support")})})})})]})},y0=()=>{const{member:e,brandColor:t,t:n}=k.useContext(N),a=e.avatar_image;return c.jsxs("header",{className:"gh-portal-account-header",children:[c.jsx(Hc,{gravatar:a,style:{userIcon:{color:t,width:"56px",height:"56px",padding:"2px"}}}),c.jsx("h2",{className:"gh-portal-main-title",children:n("Your account")})]})},b0=()=>{const{site:e,action:t,brandColor:n,onAction:a,t:i}=k.useContext(N);if(!qc({site:e}))return null;const r=["checkoutPlan:running"].includes(t),o=()=>{a("switchPage",{page:"accountPlan",lastPage:"accountHome"})};return c.jsx(ae,{dataTestId:"view-plans",isRunning:r,label:i("View plans"),onClick:()=>o(),brandColor:n,style:{width:"100%"}})},k0=()=>{const{member:e,site:t,t:n}=k.useContext(N),{is_stripe_configured:a}=t;if(!a||Ni({site:t}))return null;const i=_e({member:e}),r=Qt({member:e});if(r&&!i)return null;if(i){const o=i==null?void 0:i.current_period_end;if(r&&Kc({member:e})){const s=Kc({member:e}),l=$t(s);return c.jsx("div",{className:"gh-portal-section",children:c.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:n("Your subscription will expire on {{expiryDate}}",{expiryDate:l})})})}if(i!=null&&i.cancel_at_period_end||r)return null;if(Qc({sub:i})){const s=$t(i.trial_end_at);return c.jsx("div",{className:"gh-portal-section",children:c.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:n("Your subscription will start on {{subscriptionStart}}",{subscriptionStart:s})})})}return c.jsx("div",{className:"gh-portal-section",children:c.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:n("Your subscription will renew on {{renewalDate}}",{renewalDate:$t(o)})})})}return c.jsxs("div",{className:"gh-portal-section",children:[c.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:n("You currently have a free membership, upgrade to a paid subscription for full access.")}),c.jsx(b0,{})]})},v0=()=>{const{member:e,onAction:t,action:n,brandColor:a,t:i}=k.useContext(N),r=_e({member:e});if(!r||!r.cancel_at_period_end)return null;const o=r.cancel_at_period_end?i("Continue subscription"):i("Cancel subscription"),s=["cancelSubscription:running"].includes(n),l=!!s,u=!!r.cancel_at_period_end,d=()=>{if(!r.cancel_at_period_end)return null;const p=r.current_period_end;return c.jsx("p",{className:"gh-portal-text-center gh-portal-free-ctatext",children:i("Your subscription will expire on {{expiryDate}}",{expiryDate:$t(p)})})};return c.jsxs("div",{className:"gh-portal-cancelcontinue-container",children:[c.jsx(d,{}),c.jsx(ae,{onClick:()=>{t("continueSubscription",{subscriptionId:r.id})},isRunning:s,disabled:l,isPrimary:u,brandColor:a,label:o,style:{width:"100%"}})]})},w0=e=>k.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},k.createElement("defs",null,k.createElement("style",null,".a{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.5px;}")),k.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"}),k.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"})),x0=()=>{const{member:e,site:t,onAction:n,t:a}=k.useContext(N),i=()=>{const b=_e({member:e});n("editBilling",{subscriptionId:b.id})},r=()=>{const{is_stripe_configured:b}=t;b&&n("switchPage",{page:"accountPlan",lastPage:"accountHome"})},o=({price:b,isComplimentary:v,subscription:h})=>{const{offer:f,start_date:y}=h||{};let w="";if(b){const{amount:P=0,currency:_,interval:re}=b;w=`${Intl.NumberFormat("en",{currency:_,style:"currency"}).format(P/100)}/${a(re)}`}let x=E0({price:b,offer:f,subscriptionStartDate:y,t:a});const C=Kc({member:e});v&&(C?w=`${a("Complimentary")} - ${a("Expires {{expiryDate}}",{expiryDate:C})}`:w=w?`${a("Complimentary")} (${w})`:a("Complimentary"));let S="";x&&(S="gh-portal-account-old-price");const E=()=>x?c.jsxs("p",{className:"gh-portal-account-discountcontainer",children:[c.jsx(w0,{className:"gh-portal-account-tagicon"}),c.jsx("span",{children:x})]}):null,$=Qc({sub:h});return $&&(S="gh-portal-account-old-price"),$?c.jsxs(c.Fragment,{children:[c.jsx("p",{className:S,children:w}),c.jsx(S0,{subscription:h,t:a})]}):c.jsxs(c.Fragment,{children:[c.jsx("p",{className:S,children:w}),c.jsx(E,{})]})},s=({isComplimentary:b,isPaid:v})=>(Ti({member:e})?!1:b)||Ni({site:t})&&!v?null:c.jsx("button",{className:"gh-portal-btn gh-portal-btn-list",onClick:f=>r(),"data-test-button":"change-plan",children:a("Change")}),l=({defaultCardLast4:b})=>{if(b){const v=`**** **** **** ${b}`;return c.jsx("p",{children:v})}return null},u=({defaultCardLast4:b,isComplimentary:v})=>{const{action:h}=k.useContext(N),f=h==="editBilling:running"?c.jsx(ga,{className:"gh-portal-billing-button-loader"}):a("Update");return v?null:c.jsxs("section",{children:[c.jsxs("div",{className:"gh-portal-list-detail",children:[c.jsx("h3",{children:a("Billing info")}),c.jsx(l,{defaultCardLast4:b})]}),c.jsx("button",{className:"gh-portal-btn gh-portal-btn-list",onClick:y=>i(),"data-test-button":"update-billing",children:f})]})},d=_e({member:e}),p=Qt({member:e}),m=ut({member:e}),g=d==null?void 0:d.cancel_at_period_end;if(d||p){const{price:b,default_payment_card_last4:v}=d||{};let h=a("Plan");return So({site:t})&&$g({member:e})&&(h=$g({member:e})),c.jsxs(c.Fragment,{children:[c.jsxs("section",{children:[c.jsxs("div",{className:"gh-portal-list-detail",children:[c.jsx("h3",{children:h}),c.jsx(o,{price:b,isComplimentary:p,subscription:d})]}),c.jsx(s,{isComplimentary:p,isPaid:m,isCancelled:g})]}),c.jsx(u,{isComplimentary:p,defaultCardLast4:v})]})}return null};function S0({subscription:e,t}){if(Qc({sub:e})){const n=$t(e.trial_end_at);return c.jsx("p",{className:"gh-portal-account-discountcontainer",children:c.jsx("div",{children:c.jsx("span",{children:t("Free Trial – Ends {{trialEnd}}",{trialEnd:n})})})})}return null}function E0({offer:e,price:t,subscriptionStartDate:n,t:a}){let i="";if((e==null?void 0:e.type)==="trial"||(e==null?void 0:e.duration)==="once")return"";if(e){const r=e.duration;let o="";if(r==="forever")o=a("Forever");else if(r==="repeating"){const s=e.duration_in_months||0;let l=new Date(n),u=new Date(l.setMonth(l.getMonth()+s));if(zg(u))return"";o=a("Ends {{offerEndDate}}",{offerEndDate:$t(u)})}i=`${EE({offer:e,price:t,useFormatted:!0})}/${t.interval}${o?` — ${o}`:""}`}return i}function C0(){const{member:e,site:t,onAction:n,t:a}=k.useContext(N);let{newsletters:i}=e;const r=!!(i!=null&&i.length);let o=a(r?"Subscribed":"Unsubscribed");const s=l=>{var p;l.preventDefault();const u=wn({site:t}),d=(p=e==null?void 0:e.newsletters)!=null&&p.length?[]:u;n("updateNewsletterPreference",{newsletters:d})};return c.jsxs("section",{children:[c.jsxs("div",{className:"gh-portal-list-detail email-newsletter",children:[c.jsx("h3",{children:a("Email newsletter")}),c.jsxs("p",{children:[o," ",Zc({member:e})&&r&&c.jsx("button",{className:"gh-portal-btn-text gh-email-faq-page-button",onClick:()=>n("switchPage",{page:"emailReceivingFAQ",lastPage:"accountHome"}),children:a("Not receiving emails?")})]})]}),c.jsx("div",{children:c.jsx(zo,{dataTestId:"default-newsletter-toggle",id:"default-newsletter-toggle",onToggle:l=>{s(l)},checked:r})})]})}const $f=e=>k.createElement("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",...e},k.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"}),k.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 $0(){const{onAction:e,member:t,t:n}=k.useContext(N),a=Ag({member:t}),i=a?"emailSuppressed":"accountEmail";return c.jsxs("section",{children:[c.jsxs("div",{className:"gh-portal-list-detail",children:[c.jsx("h3",{children:n("Emails")}),a?c.jsxs("p",{className:"gh-portal-email-notice",children:[c.jsx($f,{className:"gh-portal-email-notice-icon"}),c.jsx("span",{className:"gh-mobile-only",children:n("You're not receiving emails")}),c.jsx("span",{className:"gh-desktop-only",children:n("You're currently not receiving emails")})]}):c.jsx("p",{children:n("Update your preferences")})]}),c.jsx("button",{className:"gh-portal-btn gh-portal-btn-list",onClick:()=>{e("switchPage",{page:i,lastPage:"accountHome"})},"data-test-button":"manage-newsletters",children:n("Manage")})]})}const j0=()=>{const{member:e,onAction:t,site:n,t:a}=k.useContext(N),{name:i,email:r}=e,o=()=>{t("switchPage",{page:"accountProfile",lastPage:"accountHome"})},s=To({site:n})||Pg({site:n})||Ag({member:e}),l=oE({site:n});return c.jsx("div",{children:c.jsxs("div",{className:"gh-portal-list",children:[c.jsxs("section",{children:[c.jsxs("div",{className:"gh-portal-list-detail",children:[c.jsx("h3",{children:i||a("Account")}),c.jsx("p",{children:r})]}),c.jsx("button",{"data-test-button":"edit-profile",className:"gh-portal-btn gh-portal-btn-list",onClick:u=>o(),children:a("Edit")})]}),c.jsx(x0,{}),s?c.jsx($0,{}):c.jsx(c.Fragment,{}),l&&!s?c.jsx(C0,{}):c.jsx(c.Fragment,{})]})})},P0=()=>c.jsxs("div",{className:"gh-portal-content gh-portal-account-main",children:[c.jsx(ie,{}),c.jsx(y0,{}),c.jsxs("section",{className:"gh-portal-account-data",children:[c.jsx(k0,{}),c.jsx(v0,{}),c.jsx(j0,{})]})]});class jf extends U.Component{componentDidMount(){const{member:t,site:n}=this.context;kn({site:n})||this.context.onAction("signout"),t||this.context.onAction("switchPage",{page:"signin",pageData:{redirect:window.location.href}})}handleSignout(t){t.preventDefault(),this.context.onAction("signout")}render(){const{member:t,site:n,t:a}=this.context,i=Ii({site:n});return!t||!kn({site:n})?null:c.jsxs("div",{className:"gh-portal-account-wrapper",children:[c.jsx(P0,{}),c.jsx(f0,{onClose:()=>this.context.onAction("closePopup"),handleSignout:r=>this.handleSignout(r),supportAddress:i,t:a})]})}}Z(jf,"contextType",N);class Pf extends U.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.onAction("switchPage",{page:"signin"})}handleSignout(t){t.preventDefault(),this.context.onAction("signout")}onBack(){this.context.onAction("back")}onProfileSave(t){t.preventDefault(),this.setState(n=>({errors:Yo({fields:this.getInputFields({state:n}),t:this.context.t})}),()=>{const{email:n,name:a,errors:i}=this.state;i&&Object.values(i).filter(o=>!!o).length>0||(this.context.onAction("clearPopupNotification"),this.context.onAction("updateProfile",{email:n,name:a}))})}renderSaveButton(){const{t}=this.context,n=this.context.action==="updateProfile:running";let a=t("Save");this.context.action==="updateProfile:failed"&&(a=t("Retry"));const i=!!n;return c.jsx(ae,{dataTestId:"save-button",isRunning:n,onClick:r=>this.onProfileSave(r),disabled:i,brandColor:this.context.brandColor,label:a,style:{width:"100%"}})}renderDeleteAccountButton(){const{t}=this.context;return c.jsx("div",{style:{cursor:"pointer",color:"red"},role:"button",children:t("Delete account")})}renderAccountFooter(){return c.jsx("footer",{className:"gh-portal-action-footer",children:this.renderSaveButton()})}renderHeader(){const{t}=this.context;return c.jsxs("header",{className:"gh-portal-detail-header",children:[c.jsx(fa,{brandColor:this.context.brandColor,hidden:!this.context.lastPage,onClick:n=>this.onBack(n)}),c.jsx("h3",{className:"gh-portal-main-title",children:t("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 c.jsx("div",{style:n,children:c.jsx(Hc,{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{t:a}=this.context,i=t.errors||{},r=[{type:"text",value:t.name,placeholder:a("Jamie Larson"),label:a("Name"),name:"name",required:!0,errorMessage:i.name||""},{type:"email",value:t.email,placeholder:a("jamie@example.com"),label:a("Email"),name:"email",required:!0,errorMessage:i.email||""}];return n&&n.length>0?r.filter(o=>n.includes(o.name)):r}onKeyDown(t){t.keyCode===13&&this.onProfileSave(t)}renderProfileData(){return c.jsx("div",{className:"gh-portal-section",children:c.jsx(Ro,{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?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"gh-portal-content with-footer",children:[c.jsx(ie,{}),this.renderHeader(),c.jsx("div",{className:"gh-portal-section",children:this.renderProfileData()})]}),this.renderAccountFooter()]}):null}}Z(Pf,"contextType",N);function T0(){const{brandColor:e,lastPage:t,onAction:n,t:a}=k.useContext(N);return c.jsxs("header",{className:"gh-portal-detail-header",children:[c.jsx(fa,{brandColor:e,hidden:!t,onClick:()=>{n("back")}}),c.jsx("h3",{className:"gh-portal-main-title",children:a("Email preferences")})]})}function Tf({show:e,checked:t}){let n=[];return e&&n.push("gh-portal-checkmark-show"),t&&n.push("gh-portal-toggle-checked"),n.push("gh-portal-checkmark-container"),c.jsx("div",{className:n.join(" "),"data-testid":"checkmark-container",children:c.jsx(xf,{className:"gh-portal-checkmark-icon",alt:""})})}function N0({newsletter:e,subscribedNewsletters:t,setSubscribedNewsletters:n}){const a=t.some(l=>l.id===(e==null?void 0:e.id)),[i,r]=k.useState(!1),[o,s]=k.useState(null);return c.jsxs("section",{className:"gh-portal-list-toggle-wrapper","data-testid":"toggle-wrapper",children:[c.jsxs("div",{className:"gh-portal-list-detail",children:[c.jsx("h3",{children:e.name}),c.jsx("p",{children:e==null?void 0:e.description})]}),c.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[c.jsx(Tf,{show:i,checked:a}),c.jsx(zo,{id:e.id,onToggle:(l,u)=>{let d=[];if(u){d=t.filter(m=>m.id!==e.id).concat(e),r(!0),clearTimeout(o);let p=setTimeout(()=>{r(!1)},2e3);s(p)}else{d=t.filter(m=>m.id!==e.id),r(!0),clearTimeout(o);let p=setTimeout(()=>{r(!1)},2e3);s(p)}n(d)},checked:a})]})]})}function I0({updateCommentNotifications:e,isCommentsEnabled:t,enableCommentNotifications:n}){const{t:a}=k.useContext(N),i=!!n,[r,o]=k.useState(!1),[s,l]=k.useState(null);return t?c.jsxs("section",{className:"gh-portal-list-toggle-wrapper","data-testid":"toggle-wrapper",children:[c.jsxs("div",{className:"gh-portal-list-detail",children:[c.jsx("h3",{children:a("Comments")}),c.jsx("p",{children:a("Get notified when someone replies to your comment")})]}),c.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[c.jsx(Tf,{show:r,checked:i}),c.jsx(zo,{id:"comments",onToggle:(u,d)=>{o(!0),clearTimeout(s);let p=setTimeout(()=>{o(!1)},2e3);l(p),e(d)},checked:i})]})]}):null}function A0({subscribedNewsletters:e,setSubscribedNewsletters:t}){const{site:n}=k.useContext(N);return wn({site:n}).map(i=>c.jsx(N0,{newsletter:i,subscribedNewsletters:e,setSubscribedNewsletters:t},i==null?void 0:i.id))}function z0({site:e,isPaid:t}){const{t:n}=k.useContext(N);return t?c.jsx("p",{style:{textAlign:"center",marginTop:"12px",marginBottom:"0",color:"var(--grey6)"},children:n("Unsubscribing from emails will not cancel your paid subscription to {{title}}",{title:e==null?void 0:e.title})}):null}function Nf({notification:e,subscribedNewsletters:t,updateSubscribedNewsletters:n,updateCommentNotifications:a,unsubscribeAll:i,isPaidMember:r,isCommentsEnabled:o,enableCommentNotifications:s}){const{brandColor:l,onAction:u,member:d,site:p,t:m}=k.useContext(N),g=!(t!=null&&t.length)&&(o&&!s||!o),v=e||(()=>null);return c.jsxs("div",{className:"gh-portal-content with-footer",children:[c.jsx(ie,{}),c.jsx(T0,{}),c.jsx(v,{}),c.jsx("div",{className:"gh-portal-section flex",children:c.jsxs("div",{className:"gh-portal-list",children:[c.jsx(A0,{subscribedNewsletters:t,setSubscribedNewsletters:h=>{let f=h.map(y=>({id:y.id}));n(f)}}),c.jsx(I0,{isCommentsEnabled:o,enableCommentNotifications:s,updateCommentNotifications:a})]})}),c.jsx("div",{className:"gh-portal-btn-product gh-portal-btn-unsubscribe",style:{marginTop:"-48px",marginBottom:0},children:c.jsx(ae,{isRunning:!1,onClick:()=>{i()},disabled:g,brandColor:l,isPrimary:!1,label:m("Unsubscribe from all emails"),isDestructive:!0,style:{width:"100%",zIndex:900},dataTestId:"unsubscribe-from-all-emails"})}),c.jsxs("footer",{className:"gh-portal-action-footer"+(Zc({member:d})?" gh-feature-suppressions":""),children:[c.jsx("div",{style:{width:"100%"},children:c.jsx(z0,{isPaid:r,site:p})}),Zc({member:d})&&!g&&c.jsxs("div",{className:"gh-portal-footer-secondary",children:[c.jsx("span",{className:"gh-portal-footer-secondary-light",children:m("Not receiving emails?")}),c.jsxs("button",{className:"gh-portal-btn-text gh-email-faq-page-button",onClick:()=>u("switchPage",{page:"emailReceivingFAQ",pageData:{direct:!1}}),children:[m("Get help")," ",c.jsx("span",{className:"right-arrow",children:"→"})]})]})]})]})}function D0(){const{member:e,onAction:t,site:n,t:a,pageData:i}=k.useContext(N);let r,o;i&&(r=i.newsletterUuid,o=i.action);const[s,l]=k.useState(!0),u=wn({site:n});k.useEffect(()=>{e||t("switchPage",{page:"signin"})},[e,t]),k.useEffect(()=>{if(r&&o==="unsubscribe"){const h=e==null?void 0:e.newsletters.filter(f=>f.uuid!==r);g(h),l(!1),t("updateNewsletterPreference",{newsletters:h})}},[]);const d=()=>{if(i.comments&&b){const y=s?"gh-portal-hide":"";return c.jsx(c.Fragment,{children:c.jsx("p",{className:`gh-portal-text-center gh-portal-header-message ${y}`,children:c.jsx($e,{syntax:Ie,string:a("{{memberEmail}} will no longer receive emails when someone replies to your comments."),mapping:{memberEmail:c.jsx("strong",{children:e==null?void 0:e.email})}})})})}const h=u==null?void 0:u.find(y=>y.uuid===i.newsletterUuid);if(!h)return null;const f=s?"gh-portal-hide":"";return c.jsx(c.Fragment,{children:c.jsx("p",{className:`gh-portal-text-center gh-portal-header-message ${f}`,children:c.jsx($e,{syntax:Ie,string:a("{{memberEmail}} will no longer receive {{newsletterName}} newsletter."),mapping:{memberEmail:c.jsx("strong",{children:e==null?void 0:e.email}),newsletterName:c.jsx("strong",{children:h==null?void 0:h.name})}})})})},p=[...(e==null?void 0:e.newsletters)||[]],[m,g]=k.useState(p),{comments_enabled:b}=n,{enable_comment_notifications:v}=e||{};return k.useEffect(()=>{g((e==null?void 0:e.newsletters)||[])},[e==null?void 0:e.newsletters]),c.jsx(Nf,{notification:r?d:null,subscribedNewsletters:m,updateSubscribedNewsletters:h=>{g(h),t("updateNewsletterPreference",{newsletters:h})},updateCommentNotifications:async h=>{t("updateNewsletterPreference",{enableCommentNotifications:h})},unsubscribeAll:()=>{g([]),t("showPopupNotification",{action:"updated:success",message:a("Unsubscribed from all emails.")});const h={newsletters:[]};b&&(h.enableCommentNotifications=!1),t("updateNewsletterPreference",h)},isPaidMember:ut({member:e}),isCommentsEnabled:b!=="off",enableCommentNotifications:v})}function F0(){const{site:e}=k.useContext(N),t=e.icon;return t?c.jsx("img",{className:"gh-portal-unsubscribe-logo",src:t,alt:e.title}):null}function M0(){const{site:e}=k.useContext(N),t=e.title||"";return c.jsxs("header",{className:"gh-portal-header",children:[c.jsx(F0,{}),c.jsx("h2",{className:"gh-portal-publication-title",children:t})]})}async function If({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 _0(){const{site:e,api:t,pageData:n,member:a,onAction:i,t:r}=k.useContext(N),[o,s]=k.useState(),[l,u]=k.useState(!0),d=wn({site:e}),p=d.filter($=>$.subscribe_on_signup),[m,g]=k.useState(!1),[b,v]=k.useState(p),[h,f]=k.useState(!1),{comments_enabled:y}=e,{enable_comment_notifications:w=!1}=o||{},x=async $=>{a?i("updateNewsletterPreference",{newsletters:$}):await If({api:t,memberUuid:n.uuid,key:n.key,newsletters:$}),v($)},C=async $=>{let P;a?(await i("updateNewsletterPreference",{enableCommentNotifications:$}),P={...a,enable_comment_notifications:$}):P=await If({api:t,memberUuid:n.uuid,key:n.key,enableCommentNotifications:$}),s(P)},S=async()=>{let $;a?(await i("updateNewsletterPreference",{newsletters:[],enableCommentNotifications:!1}),$={...a},$.newsletters=[],$.enable_comment_notifications=!1):$=await t.member.updateNewsletters({uuid:n.uuid,newsletters:[],enableCommentNotifications:!1}),v([]),s($),i("showPopupNotification",{action:"updated:success",message:r("Unsubscribed from all emails.")})};if(k.useEffect(()=>{(async()=>{let $;try{$=await t.member.newsletters({uuid:n.uuid,key:n.key}),s($??null),u(!1)}catch(_){console.error("[PORTAL] Error fetching member newsletters",_),s(null),u(!1);return}if($===null)return;const P=($==null?void 0:$.newsletters)||[];v(P),(d==null?void 0:d.length)===1&&!y&&!n.newsletterUuid?await x([]):n.newsletterUuid?await x(P==null?void 0:P.filter(_=>_.uuid!==n.newsletterUuid)):n.comments&&y&&await C(!1)})()},[y,n.uuid,n.newsletterUuid,n.comments,e.url,d==null?void 0:d.length]),l)return c.jsx(Mi,{});if(!o)return c.jsxs("div",{className:"gh-portal-content gh-portal-feedback with-footer",children:[c.jsx(ie,{}),c.jsx("div",{className:"gh-feedback-icon gh-feedback-icon-error",children:c.jsx(nu,{})}),c.jsx("h1",{className:"gh-portal-main-title",children:r("That didn't go to plan")}),c.jsx("div",{children:c.jsx("p",{className:"gh-portal-text-center",children:r("We couldn't unsubscribe you as the email address was not found. Please contact the site owner.")})}),c.jsx(ae,{style:{width:"100%"},retry:!1,onClick:()=>i("closePopup"),disabled:!1,brandColor:"#000000",label:r("Close"),isRunning:!1,tabindex:"3",classes:"sticky bottom"})]});if((d==null?void 0:d.length)===1&&!y&&!h)return c.jsxs("div",{className:"gh-portal-content gh-portal-unsubscribe with-footer",children:[c.jsx(ie,{}),c.jsx(M0,{}),c.jsx("h1",{className:"gh-portal-main-title",children:r("Successfully unsubscribed")}),c.jsxs("div",{children:[c.jsx("p",{className:"gh-portal-text-center",children:c.jsx($e,{syntax:Ie,string:r("{{memberEmail}} will no longer receive this newsletter."),mapping:{memberEmail:c.jsx("strong",{children:o==null?void 0:o.email})}})}),c.jsx("p",{className:"gh-portal-text-center",children:c.jsx($e,{syntax:Ie,string:r("Didn't mean to do this? Manage your preferences <button>here</button>."),mapping:{button:c.jsx("button",{className:"gh-portal-btn-link gh-portal-btn-branded gh-portal-btn-inline",onClick:()=>{f(!0)}})}})})]})]});const E=()=>{if(n.comments&&y){const _=m?"gh-portal-hide":"";return c.jsx(c.Fragment,{children:c.jsx("p",{className:`gh-portal-text-center gh-portal-header-message ${_}`,children:c.jsx($e,{syntax:Ie,string:r("{{memberEmail}} will no longer receive emails when someone replies to your comments."),mapping:{memberEmail:c.jsx("strong",{children:o==null?void 0:o.email})}})})})}const $=d==null?void 0:d.find(_=>_.uuid===n.newsletterUuid);if(!$)return null;const P=m?"gh-portal-hide":"";return c.jsx(c.Fragment,{children:c.jsx("p",{className:`gh-portal-text-center gh-portal-header-message ${P}`,children:c.jsx($e,{syntax:Ie,string:r("{{memberEmail}} will no longer receive {{newsletterName}} newsletter."),mapping:{memberEmail:c.jsx("strong",{children:o==null?void 0:o.email}),newsletterName:c.jsx("strong",{children:$==null?void 0:$.name})}})})})};return c.jsx(Nf,{notification:E,subscribedNewsletters:b,updateSubscribedNewsletters:async $=>{await x($),g(!0)},updateCommentNotifications:C,unsubscribeAll:async()=>{await S(),g(!0)},isPaidMember:(o==null?void 0:o.status)!=="free",isCommentsEnabled:y!=="off",enableCommentNotifications:w})}function R0(){const{brandColor:e,lastPage:t,onAction:n,action:a,site:i,t:r}=k.useContext(N);k.useEffect(()=>{["removeEmailFromSuppressionList:success"].includes(a)&&n("refreshMemberData"),["removeEmailFromSuppressionList:failed","refreshMemberData:failed"].includes(a)&&n("back"),["refreshMemberData:success"].includes(a)&&(To({site:i})||Pg({site:i})?(n("switchPage",{page:"accountEmail",lastPage:"accountHome"}),n("showPopupNotification",{message:r("You have been successfully resubscribed")})):n("back"))},[a,n,i,r]);const o=["removeEmailFromSuppressionList:running","refreshMemberData:running"].includes(a),s=()=>{n("removeEmailFromSuppressionList")};return c.jsxs("div",{className:"gh-email-suppressed-page",children:[c.jsxs("header",{className:"gh-portal-detail-header",children:[c.jsx(fa,{brandColor:e,hidden:!t,onClick:()=>{n("back")}}),c.jsx(ie,{})]}),c.jsx($f,{className:"gh-email-suppressed-page-icon"}),c.jsxs("div",{className:"gh-email-suppressed-page-text",children:[c.jsx("h3",{className:"gh-portal-main-title gh-email-suppressed-page-title",children:r("Emails disabled")}),c.jsx("p",{children:r("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.")})]}),c.jsx(ae,{dataTestId:"resubscribe-email",classes:"gh-portal-confirm-button",onClick:s,disabled:o,brandColor:e,label:r("Re-enable emails"),isRunning:o})]})}function Y0(){const{brandColor:e,onAction:t,site:n,t:a,pageData:i}=k.useContext(N),r=`mailto:${Ii({site:n})}`,o=i&&i.direct||!1;return c.jsxs("div",{className:"gh-email-suppression-faq",children:[!o&&c.jsxs("header",{className:"gh-portal-detail-header",children:[c.jsx(fa,{brandColor:e,onClick:()=>{t("switchPage",{page:"emailSuppressed",lastPage:"accountHome"})}}),c.jsx(ie,{})]}),c.jsxs("div",{className:"gh-longform",children:[c.jsx("h3",{children:a("Why has my email been disabled?")}),c.jsx("p",{children:a("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).")}),c.jsx("h4",{children:a("Spam complaints")}),c.jsx("p",{children:a("If a newsletter is flagged as spam, emails are automatically disabled for that address to make sure you no longer receive any unwanted messages.")}),c.jsx("p",{children:a("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.")}),c.jsx("p",{children:a("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.")}),c.jsx("h4",{children:a("Permanent failure (bounce)")}),c.jsx("p",{children:a("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.")}),c.jsx("p",{children:a("In the event a permanent failure is received when attempting to send a newsletter, emails will be disabled on the account.")}),c.jsx("p",{children:a("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.")}),c.jsx("p",{children:c.jsx("a",{className:"gh-portal-btn gh-portal-btn-branded no-margin-right",href:r,onClick:()=>{r&&window.open(r)},children:a("Need more help? Contact support")})})]})]})}function U0(){const{brandColor:e,onAction:t,site:n,lastPage:a,member:i,t:r,pageData:o}=k.useContext(N),s=Ii({site:n}),l=`mailto:${s}`,u=xE({site:n}),d=o&&o.direct||!1;return c.jsxs("div",{className:"gh-email-receiving-faq",children:[c.jsxs("header",{className:"gh-portal-detail-header",children:[!d&&c.jsx(fa,{brandColor:e,onClick:()=>{a?t("switchPage",{page:"accountHome"}):t("switchPage",{page:"accountEmail",lastPage:"accountHome"})}}),c.jsx(ie,{})]}),c.jsxs("div",{className:"gh-longform",children:[c.jsx("h3",{children:r("Help! I'm not receiving emails")}),c.jsx("p",{children:r("If you're not receiving the email newsletter you've subscribed to, here are a few things to check.")}),c.jsx("h4",{children:r("Verify your email address is correct")}),c.jsx("p",{children:c.jsx($e,{syntax:Ie,string:r("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:c.jsx("strong",{children:i.email}),button:c.jsx("button",{className:"gh-portal-btn-text",onClick:()=>t("switchPage",{lastPage:"emailReceivingFAQ",page:"accountProfile"})})}})}),c.jsx("h4",{children:r("Check spam & promotions folders")}),c.jsx("p",{children:r(`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".`)}),c.jsx("h4",{children:r("Create a new contact")}),c.jsx("p",{children:c.jsx($e,{syntax:Ie,string:r("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:c.jsx("strong",{children:u})}})}),c.jsx("h4",{children:r("Send an email and say hi!")}),c.jsx("p",{children:c.jsx($e,{syntax:Ie,string:r("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:c.jsx("strong",{children:u})}})}),c.jsx("h4",{children:r("Check with your mail provider")}),c.jsx("p",{children:c.jsx($e,{syntax:Ie,string:r("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:c.jsx("strong",{children:u})}})}),c.jsx("h4",{children:r("Get in touch for help")}),c.jsx("p",{children:c.jsx($e,{syntax:Ie,string:r("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:c.jsx("a",{href:l,onClick:()=>{l&&window.open(l)},children:s})}})})]})]})}const du={signin:Cf,signup:ff,accountHome:jf,accountPlan:pf,accountProfile:Pf,accountEmail:D0,signupNewsletter:lu,unsubscribe:_0,magiclink:yf,loading:Mi,offer:kf,feedback:ZC,emailSuppressed:R0,emailSuppressionFAQ:Y0,emailReceivingFAQ:U0,support:()=>{const[e,t]=k.useState(!0),[n,a]=k.useState(null),[i,r]=k.useState(null),{member:o,t:s,site:l}=k.useContext(N);return k.useEffect(()=>{async function u(){const d=l.url,p=window.location.origin+window.location.pathname,m=o?`${p}?action=support&success=true`:`${p}#/portal/support/success`,g=p,b=Oo({siteUrl:d});try{const v=await b.member.checkoutDonation({successUrl:m,cancelUrl:g});v.url&&window.location.replace(v.url)}catch(v){v.type&&v.type==="DisabledFeatureError"?r(s("This site is not accepting payments at the moment.")):a(s("Something went wrong, please try again later.")),t(!1)}}u()},[]),e?c.jsx("div",{children:c.jsx(Mi,{})}):n?c.jsx(uu,{error:n}):i?c.jsx(uu,{error:i}):null},supportSuccess:i0,supportError:uu,recommendations:d0},mu=function({page:e}){return Object.keys(du).includes(e)?e:"signup"},L0=function({page:e}){return e.includes("account")},O0=function({page:e}){return e.includes("offer")},B0=e=>k.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},k.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"}));class pu extends U.Component{render(){return c.jsxs("a",{href:"https://ghost.org",target:"_blank",rel:"noopener noreferrer",onClick:()=>{window.open("https://ghost.org","_blank")},children:[c.jsx(B0,{}),"Powered by Ghost"]})}}Z(pu,"contextType",N);const Af=()=>({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 H0({message:e}){return ma()?c.jsx("div",{className:"gh-portal-cookiebanner",children:e}):null}class zf extends U.Component{componentDidMount(){this.node&&!G(["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.onAction("closePopup")}sendContainerHeightChangeEvent(){var t,n;this.node&&G(["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){G(["preview"])||t.target===t.currentTarget&&this.context.onAction("closePopup")}renderActivePage(){const{page:t}=this.context;mu({page:t});const n=du[t];return c.jsx(n,{})}renderPopupNotification(){const{popupNotification:t}=this.context;return!t||!t.type?null:c.jsx(bf,{})}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=$o({site:a}).length;mu({page:t});const l={...Af().page[t]};let u="",d="regular",p="",m=t;switch(t){case"signup":p="Cookies must be enabled in your browser to sign up.";break;case"signin":p="Cookies must be enabled in your browser to sign in.";break;case"accountHome":m="account-home";break;case"accountProfile":m="account-profile";break;case"accountPlan":m="account-plan";break;default:p="Cookies must be enabled in your browser.",m=t;break}o>1&&!dt({site:a,pageQuery:n})&&t==="signup"&&(m+=" full-size",d="full");const g=Po({site:a});(g&&o>2||!g&&o>1)&&t==="accountPlan"&&(m+=" full-size",d="full"),(t==="emailSuppressionFAQ"||t==="emailReceivingFAQ")&&(m+=" large-size");let b="gh-portal-popup-container";G(["preview"])&&(m+=" preview"),G(["preview"],{customSiteUrl:i})&&!a.disableBackground&&(b+=" preview"),G(["dev"])&&(b+=" dev");const v=`${b} ${u} ${m}`;return this.sendPortalPreviewReadyEvent(),c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"gh-portal-popup-wrapper "+m,onClick:h=>this.handlePopupClose(h),children:c.jsxs("div",{className:v,style:l,ref:h=>this.node=h,tabIndex:-1,children:[c.jsx(H0,{message:p}),this.renderPopupNotification(),this.renderActivePage(),d==="full"?c.jsx("div",{className:"gh-portal-powered inside "+(G(["preview"])?"hidden ":"")+m,children:c.jsx(pu,{})}):""]})}),c.jsx("div",{className:"gh-portal-powered outside "+(G(["preview"])?"hidden ":"")+m,children:c.jsx(pu,{})})]})}}Z(zf,"contextType",N);class Df extends U.Component{constructor(t){super(t),this.state={height:null}}renderCurrentPage(t){const n=du[t];return c.jsx(n,{})}onHeightChange(t){this.setState({height:t})}handlePopupClose(t){t.preventDefault(),t.target===t.currentTarget&&this.context.onAction("closePopup")}renderFrameStyles(){const{site:t}=this.context,n=g0({site:t}),a=`
3396
3510
  :root {
3397
3511
  --brandcolor: ${this.context.brandColor}
3398
3512
  }
3399
- `+n;return c.jsxs(c.Fragment,{children:[c.jsx("style",{dangerouslySetInnerHTML:{__html:a}}),c.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=Af(),r=window.innerWidth<480,o={...i.frame.common};let s="gh-portal-popup-background";return G(["preview"])&&(i.modalContainer.zIndex="3999997"),G(["preview"],{customSiteUrl:a})&&!n.disableBackground&&(s+=" preview"),G(["dev"])&&(s+=" dev"),c.jsx("div",{style:i.modalContainer,children:c.jsxs(Oc,{style:o,title:"portal-popup",head:this.renderFrameStyles(),dataTestId:"portal-popup-frame",children:[c.jsx("div",{className:s,onClick:l=>this.handlePopupClose(l)}),c.jsx(zf,{isMobile:r})]})})}render(){const{showPopup:t}=this.context;return t?this.renderFrameContainer():null}}Z(Df,"contextType",N),Bo({products:hu({numOfProducts:1})});function we(){return(new Date().getTime()/1e3|0).toString(16)+"xxxxxxxxxxxxxxxx".replace(/[x]/g,function(){return(Math.random()*16|0).toString(16)}).toLowerCase()}function Bo({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=hu({numOfProducts:1}),portalProducts:s=o.map(re=>re.id),accentColor:l="#45C32E",portalPlans:u=["free","monthly","yearly"],allowSelfSignup:d=!0,membersSignupAccess:p="all",freePriceName:m="Free",freePriceDescription:g="Free preview",isStripeConfigured:b=!0,portalButton:v=!0,portalName:h=!0,portalButtonIcon:f="icon-1",portalButtonSignupText:y="Subscribe now",portalButtonStyle:w="icon-and-text",membersSupportAddress:x="support@example.com",editorDefaultEmailRecipients:C="visibility",newsletters:S=[],posts:E=V0(),commentsEnabled:$,recommendations:P=[],recommendationsEnabled:_}={}){return{title:e,description:t,logo:n,icon:a,accent_color:l,url:i,plans:r,products:o,portal_products:s,allow_self_signup:d,members_signup_access:p,free_price_name:m,free_price_description:g,is_stripe_configured:b,portal_button:v,portal_name:h,portal_plans:u,portal_button_icon:f,portal_button_signup_text:y,portal_button_style:w,members_support_address:x,comments_enabled:$!=="off",newsletters:S,recommendations:P,recommendations_enabled:!!_,editor_default_email_recipients:C,posts:E}}function Ff({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:u=!1,currency:d=null,status:p="active",tierId:m="",tierName:g="Basic"}={}){return{id:`offer_${we()}`,name:e,code:t,display_title:n,display_description:a,type:i,cadence:r,amount:o,duration:s,duration_in_months:l,currency_restriction:u,currency:d,status:p,tier:{id:`${m}`,name:g}}}function Xe({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:`member_${we()}`,email:t,name:e,firstname:n,paid:i,subscribed:o,avatar_image:r,subscriptions:a,email_suppression:s,newsletters:l}}function V0({numOfPosts:e=3}={}){const t=[];for(let n=0;n<e;n++)t.push(W0({title:`Post ${n+1}`,slug:`post-${n+1}`}));return t.slice(0,e)}function W0({id:e=`post_${we()}`,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 hu({numOfProducts:e=3}={}){const n=[ba({name:"Bronze",description:"Access to all members articles",monthlyPrice:Ke({interval:"month",amount:700}),yearlyPrice:Ke({interval:"year",amount:7e3}),numOfBenefits:2}),ba({name:"Silver",description:"Access to all members articles and weekly podcast",monthlyPrice:Ke({interval:"month",amount:1200}),yearlyPrice:Ke({interval:"year",amount:12e3}),numOfBenefits:3}),ba({name:"Friends of the Blueprint",description:"Get access to everything and lock in early adopter pricing for life + listen to my podcast",monthlyPrice:Ke({interval:"month",amount:18e3}),yearlyPrice:Ke({interval:"year",amount:17e3}),numOfBenefits:4})].slice(0,e),a=Mf({});return[...n,a]}function ba({type:e="paid",name:t="Basic",description:n="",id:a=`product_${we()}`,monthlyPrice:i=Ke(),yearlyPrice:r=Ke({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:_f({numOfBenefits:o}),trial_days:s}}function Mf({name:e="Free tier",description:t="Free tier description",id:n=`product_${we()}`,numOfBenefits:a=2}){return{id:n,name:e,type:"free",description:t,benefits:_f({numOfBenefits:a})}}function _f({numOfBenefits:e}){const t=Date.now(),n=Math.floor(Math.random()*100);return[Ho({name:`Limited early adopter pricing #${n}-${t}`}),Ho({name:`Latest gear reviews #${n}-${t}`}),Ho({name:`Weekly email newsletter #${n}-${t}`}),Ho({name:`Listen to my podcast #$${n}-${t}`})].slice(0,e)}function Ho({id:e=`benefit_${we()}`,name:t="Benefit"}){return{id:e,name:t}}function Ke({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_${we()}`}={}){return{id:o,active:r,nickname:n,currency:i,amount:t,interval:e,description:a,stripe_price_id:`price_${we()}`,stripe_product_id:`prod_${we()}`,type:"recurring"}}function En({id:e=`sub_${we()}`,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=G0,priceId:l=`price_${we()}`,startDate:u="2021-10-05T03:18:30.000Z",currentPeriodEnd:d="2022-10-05T03:18:30.000Z",cancelAtPeriodEnd:p=!1}={}){return{id:e,customer:{id:`cus_${we()}`,name:"Jamie",email:"jamie@example.com"},plan:{id:`price_${we()}`,nickname:r,amount:i,interval:a,currency:n},offer:s,status:t,start_date:u,default_payment_card_last4:o,cancel_at_period_end:p,cancellation_reason:null,current_period_end:d,price:{id:`stripe_price_${we()}`,price_id:l,nickname:r,amount:i,interval:a,type:"recurring",currency:n,product:{id:`stripe_prod_${we()}`,product_id:`prod_${we()}`}}}}function Rf(){const e=hu({numOfProducts:1}),t=e.map(a=>a.id);return Bo({products:e,portalPlans:["free","monthly","yearly"],portalProducts:t})}Rf();const K0=Bo({products:[ba({numOfBenefits:2,type:"free"})]}),G0=Ff({tierId:(ay=K0.products[0])==null?void 0:ay.id});Xe(),Xe({paid:!0,subscriptions:[En()]}),Xe({paid:!0,subscriptions:[]}),Xe({paid:!0,subscriptions:[En({amount:0})]}),Xe({paid:!0,subscriptions:[En({amount:1500,startDate:"2019-05-01T11:42:40.000Z",currentPeriodEnd:"2021-06-05T11:42:40.000Z"})]}),Rf();const Vo=[Mf({name:"Free",description:"Free tier description which is actually a pretty long description",numOfBenefits:2}),ba({name:"The Blueprint",description:"",monthlyPrice:Ke({interval:"month",amount:500}),yearlyPrice:Ke({interval:"year",amount:5e3}),numOfBenefits:3}),ba({name:"Friends of the Blueprint Silver",description:"Access to all members articles and weekly podcast",monthlyPrice:Ke({interval:"month",amount:1200}),yearlyPrice:Ke({interval:"year",amount:11e3}),numOfBenefits:4})],ka=Bo({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:Vo,portalProducts:Vo.map(e=>e.id),allowSelfSignup:!0,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}]}),Yf=Ff({tierId:(iy=ka.products[1])==null?void 0:iy.id}),Wo={free:Xe({name:"Jamie Larson",email:"jamie@example.com",firstname:"Jamie",subscriptions:[],paid:!1,avatarImage:"",subscribed:!0}),paid:Xe({paid:!0,subscriptions:[En({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:Xe({paid:!0,subscriptions:[]}),complimentaryWithSubscription:Xe({paid:!0,subscriptions:[En({amount:0})]}),preview:Xe({paid:!0,subscriptions:[En({amount:1500,startDate:"2019-05-01T11:42:40.000Z",currentPeriodEnd:"2021-06-05T11:42:40.000Z"})]})};function q0(){var n;if(!Vo||!Vo[1])return null;let e=(n=ka==null?void 0:ka.products)==null?void 0:n[1].monthlyPrice,t=Xe({paid:!0,subscriptions:[En({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:ka,member:t}}function J0(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 Q0({data:e,state:t}){return{page:e.page,popupNotification:null,lastPage:e.lastPage||null,pageData:e.pageData||t.pageData}}function Z0({state:e}){return{showPopup:!e.showPopup}}function X0({data:e}){return{showPopup:!0,page:e.page,...e.pageQuery?{pageQuery:e.pageQuery}:{},...e.pageData?{pageData:e.pageData}:{}}}function e$({state:e}){return e.lastPage?{page:e.lastPage}:Uf({state:e})}function Uf({state:e}){return Wc(),{showPopup:!1,lastPage:null,pageQuery:"",popupNotification:null,page:e.page==="magiclink"?"":e.page}}function t$({data:e}){return{showNotification:!0,...e}}function n$(){return{showNotification:!1}}async function a$({api:e,state:t}){try{return await e.member.signout(),{action:"signout:success"}}catch{const{t:a}=t;return{action:"signout:failed",popupNotification:Q({type:"signout:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:a("Failed to log out, please try again")})}}}async function i$({data:e,api:t,state:n}){const{t:a}=n;try{const i=await t.member.getIntegrityToken();return await t.member.sendMagicLink({...e,emailType:"signin",integrityToken:i}),{page:"magiclink",lastPage:"signin"}}catch(i){return{action:"signin:failed",popupNotification:Q({type:"signin:failed",autoHide:!1,closeable:!0,state:n,status:"error",message:Lo(i,a("Failed to log in, please try again"),a)})}}}async function r$({data:e,state:t,api:n}){try{let{plan:a,tierId:i,cadence:r,email:o,name:s,newsletters:l,offerId:u}=e;if(a.toLowerCase()==="free"){const d=await n.member.getIntegrityToken();await n.member.sendMagicLink({emailType:"signup",integrityToken:d,...e})}else return i&&r?await n.member.checkoutPlan({plan:a,tierId:i,cadence:r,email:o,name:s,newsletters:l,offerId:u}):({tierId:i,cadence:r}=xn({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:u})),{page:"loading"};return{page:"magiclink",lastPage:"signup"}}catch(a){const{t:i}=t,r=Lo(a,i("Failed to sign up, please try again"),i);return{action:"signup:failed",popupNotification:Q({type:"signup:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:r})}}}async function o$({data:e,state:t,api:n}){try{let{plan:a,offerId:i,tierId:r,cadence:o}=e;(!r||!o)&&({tierId:r,cadence:o}=xn({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{const{t:i}=t;return{action:"checkoutPlan:failed",popupNotification:Q({type:"checkoutPlan:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:i("Failed to process checkout, please try again")})}}}async function s$({data:e,state:t,api:n}){const{t:a}=t;try{const{plan:i,planId:r,subscriptionId:o,cancelAtPeriodEnd:s}=e,{tierId:l,cadence:u}=xn({site:t==null?void 0:t.site,priceId:r});await n.member.updateSubscription({planName:i,tierId:l,cadence:u,subscriptionId:o,cancelAtPeriodEnd:s,planId:r});const d=await n.member.sessionData(),p="updateSubscription:success";return{action:p,popupNotification:Q({type:p,autoHide:!0,closeable:!0,state:t,status:"success",message:a("Subscription plan updated successfully")}),page:"accountHome",member:d}}catch{return{action:"updateSubscription:failed",popupNotification:Q({type:"updateSubscription:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:a("Failed to update subscription, please try again")})}}}async function l$({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{const{t:i}=t;return{action:"cancelSubscription:failed",popupNotification:Q({type:"cancelSubscription:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:i("Failed to cancel subscription, please try again")})}}}async function c$({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{const{t:i}=t;return{action:"continueSubscription:failed",popupNotification:Q({type:"continueSubscription:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:i("Failed to cancel subscription, please try again")})}}}async function u$({data:e,state:t,api:n}){try{await n.member.editBilling(e)}catch{const{t:i}=t;return{action:"editBilling:failed",popupNotification:Q({type:"editBilling:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:i("Failed to update billing information, please try again")})}}}async function d$(){return{popupNotification:null}}async function m$({data:e,state:t}){let{action:n,message:a=""}=e;return n=n||"showPopupNotification:success",{popupNotification:Q({type:n,autoHide:!0,closeable:!0,state:t,status:"success",message:a})}}async function p$({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{const{t:i}=t;return{action:"updateNewsletterPref:failed",popupNotification:Q({type:"updateNewsletter:failed",autoHide:!0,closeable:!0,state:t,status:"error",message:i("Failed to update newsletter settings")})}}}async function h$({state:e,api:t}){const{t:n}=e;try{return await t.member.deleteSuppression(),{action:"removeEmailFromSuppressionList:success",popupNotification:Q({type:"removeEmailFromSuppressionList:success",autoHide:!0,closeable:!0,state:e,status:"success",message:n("You have been successfully resubscribed")})}}catch{return{action:"removeEmailFromSuppressionList:failed",popupNotification:Q({type:"removeEmailFromSuppressionList:failed",autoHide:!0,closeable:!0,state:e,status:"error",message:n("Your email has failed to resubscribe, please try again")})}}}async function g$({data:e,state:t,api:n}){const{t:a}=t;try{const{subscribed:i}=e,r=await n.member.update({subscribed:i});if(!r)throw new Error("Failed to update newsletter");const o="updateNewsletter:success";return{action:o,member:r,popupNotification:Q({type:o,autoHide:!0,closeable:!0,state:t,status:"success",message:a("Email newsletter settings updated")})}}catch{return{action:"updateNewsletter:failed",popupNotification:Q({type:"updateNewsletter:failed",autoHide:!0,closeable:!0,state:t,status:"error",message:a("Failed to update newsletter settings")})}}}async function f$({data:e,state:t,api:n}){const{email:a}=e,i=kE({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 y$({data:e,state:t,api:n}){const{name:a}=e;if(wE({member:t.member})!==a)try{const r=await n.member.update({name:a});if(!r)throw new Error("Failed to update member");return{member:r,success:!0}}catch(r){return{success:!1,error:r}}return null}async function b$({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 k$({data:e,state:t,api:n}){const{t:a}=t,[i,r]=await Promise.all([y$({data:e,state:t,api:n}),f$({data:e,state:t,api:n})]);if(i&&r){if(r.success)return{action:"updateProfile:success",...i.success?{member:i.member}:{},page:"accountHome",popupNotification:Q({type:"updateProfile:success",autoHide:!0,closeable:!0,status:"success",state:t,message:a("Check your inbox to verify email update")})};const o=i.success?a("Failed to send verification email"):a("Failed to update account data");return{action:"updateProfile:failed",...i.success?{member:i.member}:{},popupNotification:Q({type:"updateProfile:failed",autoHide:!0,closeable:!0,status:"error",message:o,state:t})}}else if(i){const o=i.success?"updateProfile:success":"updateProfile:failed",s=i.success?"success":"error",l=i.success?a("Account details updated successfully"):a("Failed to update account details");return{action:o,...i.success?{member:i.member}:{},...i.success?{page:"accountHome"}:{},popupNotification:Q({type:o,autoHide:i.success,closeable:!0,status:s,state:t,message:l})}}else if(r){const o=r.success?"updateProfile:success":"updateProfile:failed",s=r.success?"success":"error",l=r.success?a("Check your inbox to verify email update"):a("Failed to send verification email");return{action:o,...r.success?{page:"accountHome"}:{},popupNotification:Q({type:o,autoHide:r.success,closeable:!0,status:s,state:t,message:l})}}return{action:"updateProfile:success",page:"accountHome",popupNotification:Q({type:"updateProfile:success",autoHide:!0,closeable:!0,status:"success",state:t,message:a("Account details updated successfully")})}}async function v$({data:{siteUrl:e},state:t}){const n=Oo({siteUrl:e,apiUrl:"not-defined",contentApiKey:"not-defined"}),{member:a}=t,i=window.location.href,r=jg(),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 w$({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 x$({data:{recommendationId:e},api:t}){return t.recommendations.trackSubscribed({recommendationId:e}),{}}const S$={togglePopup:Z0,openPopup:X0,closePopup:Uf,switchPage:Q0,openNotification:t$,closeNotification:n$,back:e$,signout:a$,signin:i$,signup:r$,updateSubscription:s$,cancelSubscription:l$,continueSubscription:c$,updateNewsletter:g$,updateProfile:k$,refreshMemberData:b$,clearPopupNotification:d$,editBilling:u$,checkoutPlan:o$,updateNewsletterPreference:p$,showPopupNotification:m$,removeEmailFromSuppressionList:h$,oneClickSubscribe:v$,trackRecommendationClicked:w$,trackRecommendationSubscribed:x$};async function E$({action:e,data:t,state:n,api:a}){const i=S$[e];return i?await i({data:t,state:n,api:a})||{}:{}}const uq="";var gu={exports:{}};const F=e=>typeof e=="string",_i=()=>{let e,t;const n=new Promise((a,i)=>{e=a,t=i});return n.resolve=e,n.reject=t,n},Lf=e=>e==null?"":""+e,C$=(e,t,n)=>{e.forEach(a=>{t[a]&&(n[a]=t[a])})},$$=/###/g,Of=e=>e&&e.indexOf("###")>-1?e.replace($$,"."):e,Bf=e=>!e||F(e),Ri=(e,t,n)=>{const a=F(t)?t.split("."):t;let i=0;for(;i<a.length-1;){if(Bf(e))return{};const r=Of(a[i]);!e[r]&&n&&(e[r]=new n),Object.prototype.hasOwnProperty.call(e,r)?e=e[r]:e={},++i}return Bf(e)?{}:{obj:e,k:Of(a[i])}},Hf=(e,t,n)=>{const{obj:a,k:i}=Ri(e,t,Object);if(a!==void 0||t.length===1){a[i]=n;return}let r=t[t.length-1],o=t.slice(0,t.length-1),s=Ri(e,o,Object);for(;s.obj===void 0&&o.length;)r=`${o[o.length-1]}.${r}`,o=o.slice(0,o.length-1),s=Ri(e,o,Object),s&&s.obj&&typeof s.obj[`${s.k}.${r}`]<"u"&&(s.obj=void 0);s.obj[`${s.k}.${r}`]=n},j$=(e,t,n,a)=>{const{obj:i,k:r}=Ri(e,t,Object);i[r]=i[r]||[],i[r].push(n)},Ko=(e,t)=>{const{obj:n,k:a}=Ri(e,t);if(n)return n[a]},P$=(e,t,n)=>{const a=Ko(e,n);return a!==void 0?a:Ko(t,n)},Vf=(e,t,n)=>{for(const a in t)a!=="__proto__"&&a!=="constructor"&&(a in e?F(e[a])||e[a]instanceof String||F(t[a])||t[a]instanceof String?n&&(e[a]=t[a]):Vf(e[a],t[a],n):e[a]=t[a]);return e},va=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var T$={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const N$=e=>F(e)?e.replace(/[&<>"'\/]/g,t=>T$[t]):e;class I${constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const n=this.regExpMap.get(t);if(n!==void 0)return n;const a=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,a),this.regExpQueue.push(t),a}}const A$=[" ",",","?","!",";"],z$=new I$(20),D$=(e,t,n)=>{t=t||"",n=n||"";const a=A$.filter(o=>t.indexOf(o)<0&&n.indexOf(o)<0);if(a.length===0)return!0;const i=z$.getRegExp(`(${a.map(o=>o==="?"?"\\?":o).join("|")})`);let r=!i.test(e);if(!r){const o=e.indexOf(n);o>0&&!i.test(e.substring(0,o))&&(r=!0)}return r},fu=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!e)return;if(e[t])return e[t];const a=t.split(n);let i=e;for(let r=0;r<a.length;){if(!i||typeof i!="object")return;let o,s="";for(let l=r;l<a.length;++l)if(l!==r&&(s+=n),s+=a[l],o=i[s],o!==void 0){if(["string","number","boolean"].indexOf(typeof o)>-1&&l<a.length-1)continue;r+=l-r+1;break}i=o}return i},Go=e=>e&&e.replace("_","-"),F$={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console&&console[e]&&console[e].apply(console,t)}};class qo{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(t,n)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=t||F$,this.options=n,this.debug=n.debug}log(){for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return this.forward(n,"log","",!0)}warn(){for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return this.forward(n,"warn","",!0)}error(){for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return this.forward(n,"error","")}deprecate(){for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return this.forward(n,"warn","WARNING DEPRECATED: ",!0)}forward(t,n,a,i){return i&&!this.debug?null:(F(t[0])&&(t[0]=`${a}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new qo(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new qo(this.logger,t)}}var mt=new qo;class Jo{constructor(){this.observers={}}on(t,n){return t.split(" ").forEach(a=>{this.observers[a]||(this.observers[a]=new Map);const i=this.observers[a].get(n)||0;this.observers[a].set(n,i+1)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t].delete(n)}}emit(t){for(var n=arguments.length,a=new Array(n>1?n-1:0),i=1;i<n;i++)a[i-1]=arguments[i];this.observers[t]&&Array.from(this.observers[t].entries()).forEach(o=>{let[s,l]=o;for(let u=0;u<l;u++)s(...a)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(o=>{let[s,l]=o;for(let u=0;u<l;u++)s.apply(s,[t,...a])})}}class Wf extends Jo{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,a){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const r=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,o=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let s;t.indexOf(".")>-1?s=t.split("."):(s=[t,n],a&&(Array.isArray(a)?s.push(...a):F(a)&&r?s.push(...a.split(r)):s.push(a)));const l=Ko(this.data,s);return!l&&!n&&!a&&t.indexOf(".")>-1&&(t=s[0],n=s[1],a=s.slice(2).join(".")),l||!o||!F(a)?l:fu(this.data&&this.data[t]&&this.data[t][n],a,r)}addResource(t,n,a,i){let r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const o=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator;let s=[t,n];a&&(s=s.concat(o?a.split(o):a)),t.indexOf(".")>-1&&(s=t.split("."),i=n,n=s[1]),this.addNamespaces(n),Hf(this.data,s,i),r.silent||this.emit("added",t,n,a,i)}addResources(t,n,a){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const r in a)(F(a[r])||Array.isArray(a[r]))&&this.addResource(t,n,r,a[r],{silent:!0});i.silent||this.emit("added",t,n,a)}addResourceBundle(t,n,a,i,r){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},s=[t,n];t.indexOf(".")>-1&&(s=t.split("."),i=a,a=n,n=s[1]),this.addNamespaces(n);let l=Ko(this.data,s)||{};o.skipCopy||(a=JSON.parse(JSON.stringify(a))),i?Vf(l,a,r):l={...l,...a},Hf(this.data,s,l),o.silent||this.emit("added",t,n,a)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(t,n)}:this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(i=>n[i]&&Object.keys(n[i]).length>0)}toJSON(){return this.data}}var Kf={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,a,i){return e.forEach(r=>{this.processors[r]&&(t=this.processors[r].process(t,n,a,i))}),t}};const Gf={};class Qo extends Jo{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),C$(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=mt.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(t==null)return!1;const a=this.resolve(t,n);return a&&a.res!==void 0}extractFromKey(t,n){let a=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;a===void 0&&(a=":");const i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let r=n.ns||this.options.defaultNS||[];const o=a&&t.indexOf(a)>-1,s=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!D$(t,a,i);if(o&&!s){const l=t.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:t,namespaces:r};const u=t.split(a);(a!==i||a===i&&this.options.ns.indexOf(u[0])>-1)&&(r=u.shift()),t=u.join(i)}return F(r)&&(r=[r]),{key:t,namespaces:r}}translate(t,n,a){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const i=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,r=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:o,namespaces:s}=this.extractFromKey(t[t.length-1],n),l=s[s.length-1],u=n.lng||this.language,d=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&u.toLowerCase()==="cimode"){if(d){const x=n.nsSeparator||this.options.nsSeparator;return i?{res:`${l}${x}${o}`,usedKey:o,exactUsedKey:o,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(n)}:`${l}${x}${o}`}return i?{res:o,usedKey:o,exactUsedKey:o,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(n)}:o}const p=this.resolve(t,n);let m=p&&p.res;const g=p&&p.usedKey||o,b=p&&p.exactUsedKey||o,v=Object.prototype.toString.apply(m),h=["[object Number]","[object Function]","[object RegExp]"],f=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject,w=!F(m)&&typeof m!="boolean"&&typeof m!="number";if(y&&m&&w&&h.indexOf(v)<0&&!(F(f)&&Array.isArray(m))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const x=this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,m,{...n,ns:s}):`key '${o} (${this.language})' returned an object instead of string.`;return i?(p.res=x,p.usedParams=this.getUsedParamsDetails(n),p):x}if(r){const x=Array.isArray(m),C=x?[]:{},S=x?b:g;for(const E in m)if(Object.prototype.hasOwnProperty.call(m,E)){const $=`${S}${r}${E}`;C[E]=this.translate($,{...n,joinArrays:!1,ns:s}),C[E]===$&&(C[E]=m[E])}m=C}}else if(y&&F(f)&&Array.isArray(m))m=m.join(f),m&&(m=this.extendTranslation(m,t,n,a));else{let x=!1,C=!1;const S=n.count!==void 0&&!F(n.count),E=Qo.hasDefaultValue(n),$=S?this.pluralResolver.getSuffix(u,n.count,n):"",P=n.ordinal&&S?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",_=S&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),re=_&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${$}`]||n[`defaultValue${P}`]||n.defaultValue;!this.isValidLookup(m)&&E&&(x=!0,m=re),this.isValidLookup(m)||(C=!0,m=o);const te=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&C?void 0:m,pt=E&&re!==m&&this.options.updateMissing;if(C||x||pt){if(this.logger.log(pt?"updateKey":"missingKey",u,l,o,pt?re:m),r){const ge=this.resolve(o,{...n,keySeparator:!1});ge&&ge.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let Re=[];const ht=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ht&&ht[0])for(let ge=0;ge<ht.length;ge++)Re.push(ht[ge]);else this.options.saveMissingTo==="all"?Re=this.languageUtils.toResolveHierarchy(n.lng||this.language):Re.push(n.lng||this.language);const xa=(ge,et,Cn)=>{const T=E&&Cn!==m?Cn:te;this.options.missingKeyHandler?this.options.missingKeyHandler(ge,l,et,T,pt,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(ge,l,et,T,pt,n),this.emit("missingKey",ge,l,et,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&S?Re.forEach(ge=>{const et=this.pluralResolver.getSuffixes(ge,n);_&&n[`defaultValue${this.options.pluralSeparator}zero`]&&et.indexOf(`${this.options.pluralSeparator}zero`)<0&&et.push(`${this.options.pluralSeparator}zero`),et.forEach(Cn=>{xa([ge],o+Cn,n[`defaultValue${Cn}`]||re)})}):xa(Re,o,re))}m=this.extendTranslation(m,t,n,p,a),C&&m===o&&this.options.appendNamespaceToMissingKey&&(m=`${l}:${o}`),(C||x)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?m=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${o}`:o,x?m:void 0):m=this.options.parseMissingKeyHandler(m))}return i?(p.res=m,p.usedParams=this.getUsedParamsDetails(n),p):m}extendTranslation(t,n,a,i,r){var o=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...a},a.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!a.skipInterpolation){a.interpolation&&this.interpolator.init({...a,interpolation:{...this.options.interpolation,...a.interpolation}});const u=F(t)&&(a&&a.interpolation&&a.interpolation.skipOnVariables!==void 0?a.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let d;if(u){const m=t.match(this.interpolator.nestingRegexp);d=m&&m.length}let p=a.replace&&!F(a.replace)?a.replace:a;if(this.options.interpolation.defaultVariables&&(p={...this.options.interpolation.defaultVariables,...p}),t=this.interpolator.interpolate(t,p,a.lng||this.language||i.usedLng,a),u){const m=t.match(this.interpolator.nestingRegexp),g=m&&m.length;d<g&&(a.nest=!1)}!a.lng&&this.options.compatibilityAPI!=="v1"&&i&&i.res&&(a.lng=this.language||i.usedLng),a.nest!==!1&&(t=this.interpolator.nest(t,function(){for(var m=arguments.length,g=new Array(m),b=0;b<m;b++)g[b]=arguments[b];return r&&r[0]===g[0]&&!a.context?(o.logger.warn(`It seems you are nesting recursively key: ${g[0]} in key: ${n[0]}`),null):o.translate(...g,n)},a)),a.interpolation&&this.interpolator.reset()}const s=a.postProcess||this.options.postProcess,l=F(s)?[s]:s;return t!=null&&l&&l.length&&a.applyPostProcessor!==!1&&(t=Kf.handle(l,t,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(a)},...a}:a,this)),t}resolve(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a,i,r,o,s;return F(t)&&(t=[t]),t.forEach(l=>{if(this.isValidLookup(a))return;const u=this.extractFromKey(l,n),d=u.key;i=d;let p=u.namespaces;this.options.fallbackNS&&(p=p.concat(this.options.fallbackNS));const m=n.count!==void 0&&!F(n.count),g=m&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),b=n.context!==void 0&&(F(n.context)||typeof n.context=="number")&&n.context!=="",v=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);p.forEach(h=>{this.isValidLookup(a)||(s=h,!Gf[`${v[0]}-${h}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(s)&&(Gf[`${v[0]}-${h}`]=!0,this.logger.warn(`key "${i}" for languages "${v.join(", ")}" won't get resolved as namespace "${s}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),v.forEach(f=>{if(this.isValidLookup(a))return;o=f;const y=[d];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(y,d,f,h,n);else{let x;m&&(x=this.pluralResolver.getSuffix(f,n.count,n));const C=`${this.options.pluralSeparator}zero`,S=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(m&&(y.push(d+x),n.ordinal&&x.indexOf(S)===0&&y.push(d+x.replace(S,this.options.pluralSeparator)),g&&y.push(d+C)),b){const E=`${d}${this.options.contextSeparator}${n.context}`;y.push(E),m&&(y.push(E+x),n.ordinal&&x.indexOf(S)===0&&y.push(E+x.replace(S,this.options.pluralSeparator)),g&&y.push(E+C))}}let w;for(;w=y.pop();)this.isValidLookup(a)||(r=w,a=this.getResource(f,h,w,n))}))})}),{res:a,usedKey:i,exactUsedKey:r,usedLng:o,usedNS:s}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,a){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,n,a,i):this.resourceStore.getResource(t,n,a,i)}getUsedParamsDetails(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],a=t.replace&&!F(t.replace);let i=a?t.replace:t;if(a&&typeof t.count<"u"&&(i.count=t.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!a){i={...i};for(const r of n)delete i[r]}return i}static hasDefaultValue(t){const n="defaultValue";for(const a in t)if(Object.prototype.hasOwnProperty.call(t,a)&&n===a.substring(0,n.length)&&t[a]!==void 0)return!0;return!1}}const yu=e=>e.charAt(0).toUpperCase()+e.slice(1);class qf{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=mt.create("languageUtils")}getScriptPartFromCode(t){if(t=Go(t),!t||t.indexOf("-")<0)return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=Go(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(F(t)&&t.indexOf("-")>-1){if(typeof Intl<"u"&&typeof Intl.getCanonicalLocales<"u")try{let i=Intl.getCanonicalLocales(t)[0];if(i&&this.options.lowerCaseLng&&(i=i.toLowerCase()),i)return i}catch{}const n=["hans","hant","latn","cyrl","cans","mong","arab"];let a=t.split("-");return this.options.lowerCaseLng?a=a.map(i=>i.toLowerCase()):a.length===2?(a[0]=a[0].toLowerCase(),a[1]=a[1].toUpperCase(),n.indexOf(a[1].toLowerCase())>-1&&(a[1]=yu(a[1].toLowerCase()))):a.length===3&&(a[0]=a[0].toLowerCase(),a[1].length===2&&(a[1]=a[1].toUpperCase()),a[0]!=="sgn"&&a[2].length===2&&(a[2]=a[2].toUpperCase()),n.indexOf(a[1].toLowerCase())>-1&&(a[1]=yu(a[1].toLowerCase())),n.indexOf(a[2].toLowerCase())>-1&&(a[2]=yu(a[2].toLowerCase()))),a.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(a=>{if(n)return;const i=this.formatLanguageCode(a);(!this.options.supportedLngs||this.isSupportedCode(i))&&(n=i)}),!n&&this.options.supportedLngs&&t.forEach(a=>{if(n)return;const i=this.getLanguagePartFromCode(a);if(this.isSupportedCode(i))return n=i;n=this.options.supportedLngs.find(r=>{if(r===i)return r;if(!(r.indexOf("-")<0&&i.indexOf("-")<0)&&(r.indexOf("-")>0&&i.indexOf("-")<0&&r.substring(0,r.indexOf("-"))===i||r.indexOf(i)===0&&i.length>1))return r})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),F(t)&&(t=[t]),Array.isArray(t))return t;if(!n)return t.default||[];let a=t[n];return a||(a=t[this.getScriptPartFromCode(n)]),a||(a=t[this.formatLanguageCode(n)]),a||(a=t[this.getLanguagePartFromCode(n)]),a||(a=t.default),a||[]}toResolveHierarchy(t,n){const a=this.getFallbackCodes(n||this.options.fallbackLng||[],t),i=[],r=o=>{o&&(this.isSupportedCode(o)?i.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return F(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&r(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&r(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&r(this.getLanguagePartFromCode(t))):F(t)&&r(this.formatLanguageCode(t)),a.forEach(o=>{i.indexOf(o)<0&&r(this.formatLanguageCode(o))}),i}}let M$=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],_$={1:e=>+(e>1),2:e=>+(e!=1),3:e=>0,4:e=>e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2,5:e=>e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5,6:e=>e==1?0:e>=2&&e<=4?1:2,7:e=>e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2,8:e=>e==1?0:e==2?1:e!=8&&e!=11?2:3,9:e=>+(e>=2),10:e=>e==1?0:e==2?1:e<7?2:e<11?3:4,11:e=>e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3,12:e=>+(e%10!=1||e%100==11),13:e=>+(e!==0),14:e=>e==1?0:e==2?1:e==3?2:3,15:e=>e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2,16:e=>e%10==1&&e%100!=11?0:e!==0?1:2,17:e=>e==1||e%10==1&&e%100!=11?0:1,18:e=>e==0?0:e==1?1:2,19:e=>e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3,20:e=>e==1?0:e==0||e%100>0&&e%100<20?1:2,21:e=>e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0,22:e=>e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3};const R$=["v1","v2","v3"],Y$=["v4"],Jf={zero:0,one:1,two:2,few:3,many:4,other:5},U$=()=>{const e={};return M$.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:_$[t.fc]}})}),e};class L${constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=mt.create("pluralResolver"),(!this.options.compatibilityJSON||Y$.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=U$(),this.pluralRulesCache={}}addRule(t,n){this.rules[t]=n}clearCache(){this.pluralRulesCache={}}getRule(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{const a=Go(t==="dev"?"en":t),i=n.ordinal?"ordinal":"cardinal",r=JSON.stringify({cleanedCode:a,type:i});if(r in this.pluralRulesCache)return this.pluralRulesCache[r];const o=new Intl.PluralRules(a,{type:i});return this.pluralRulesCache[r]=o,o}catch{return}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}needsPlural(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const a=this.getRule(t,n);return this.shouldUseIntlApi()?a&&a.resolvedOptions().pluralCategories.length>1:a&&a.numbers.length>1}getPluralFormsOfKey(t,n){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,a).map(i=>`${n}${i}`)}getSuffixes(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const a=this.getRule(t,n);return a?this.shouldUseIntlApi()?a.resolvedOptions().pluralCategories.sort((i,r)=>Jf[i]-Jf[r]).map(i=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i}`):a.numbers.map(i=>this.getSuffix(t,i,n)):[]}getSuffix(t,n){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const i=this.getRule(t,a);return i?this.shouldUseIntlApi()?`${this.options.prepend}${a.ordinal?`ordinal${this.options.prepend}`:""}${i.select(n)}`:this.getSuffixRetroCompatible(i,n):(this.logger.warn(`no plural rule found for: ${t}`),"")}getSuffixRetroCompatible(t,n){const a=t.noAbs?t.plurals(n):t.plurals(Math.abs(n));let i=t.numbers[a];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(i===2?i="plural":i===1&&(i=""));const r=()=>this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString();return this.options.compatibilityJSON==="v1"?i===1?"":typeof i=="number"?`_plural_${i.toString()}`:r():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?r():this.options.prepend&&a.toString()?this.options.prepend+a.toString():a.toString()}shouldUseIntlApi(){return!R$.includes(this.options.compatibilityJSON)}}const Qf=function(e,t,n){let a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,r=P$(e,t,n);return!r&&i&&F(n)&&(r=fu(e,n,a),r===void 0&&(r=fu(t,n,a))),r},bu=e=>e.replace(/\$/g,"$$$$");class O${constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=mt.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||(n=>n),this.init(t)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});const{escape:n,escapeValue:a,useRawValueToEscape:i,prefix:r,prefixEscaped:o,suffix:s,suffixEscaped:l,formatSeparator:u,unescapeSuffix:d,unescapePrefix:p,nestingPrefix:m,nestingPrefixEscaped:g,nestingSuffix:b,nestingSuffixEscaped:v,nestingOptionsSeparator:h,maxReplaces:f,alwaysFormat:y}=t.interpolation;this.escape=n!==void 0?n:N$,this.escapeValue=a!==void 0?a:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=r?va(r):o||"{{",this.suffix=s?va(s):l||"}}",this.formatSeparator=u||",",this.unescapePrefix=d?"":p||"-",this.unescapeSuffix=this.unescapePrefix?"":d||"",this.nestingPrefix=m?va(m):g||va("$t("),this.nestingSuffix=b?va(b):v||va(")"),this.nestingOptionsSeparator=h||",",this.maxReplaces=f||1e3,this.alwaysFormat=y!==void 0?y:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(n,a)=>n&&n.source===a?(n.lastIndex=0,n):new RegExp(a,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(t,n,a,i){let r,o,s;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=g=>{if(g.indexOf(this.formatSeparator)<0){const f=Qf(n,l,g,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(f,void 0,a,{...i,...n,interpolationkey:g}):f}const b=g.split(this.formatSeparator),v=b.shift().trim(),h=b.join(this.formatSeparator).trim();return this.format(Qf(n,l,v,this.options.keySeparator,this.options.ignoreJSONStructure),h,a,{...i,...n,interpolationkey:v})};this.resetRegExp();const d=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,p=i&&i.interpolation&&i.interpolation.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:g=>bu(g)},{regex:this.regexp,safeValue:g=>this.escapeValue?bu(this.escape(g)):bu(g)}].forEach(g=>{for(s=0;r=g.regex.exec(t);){const b=r[1].trim();if(o=u(b),o===void 0)if(typeof d=="function"){const h=d(t,r,i);o=F(h)?h:""}else if(i&&Object.prototype.hasOwnProperty.call(i,b))o="";else if(p){o=r[0];continue}else this.logger.warn(`missed to pass in variable ${b} for interpolating ${t}`),o="";else!F(o)&&!this.useRawValueToEscape&&(o=Lf(o));const v=g.safeValue(o);if(t=t.replace(r[0],v),p?(g.regex.lastIndex+=o.length,g.regex.lastIndex-=r[0].length):g.regex.lastIndex=0,s++,s>=this.maxReplaces)break}}),t}nest(t,n){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,r,o;const s=(l,u)=>{const d=this.nestingOptionsSeparator;if(l.indexOf(d)<0)return l;const p=l.split(new RegExp(`${d}[ ]*{`));let m=`{${p[1]}`;l=p[0],m=this.interpolate(m,o);const g=m.match(/'/g),b=m.match(/"/g);(g&&g.length%2===0&&!b||b.length%2!==0)&&(m=m.replace(/'/g,'"'));try{o=JSON.parse(m),u&&(o={...u,...o})}catch(v){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,v),`${l}${d}${m}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,l};for(;i=this.nestingRegexp.exec(t);){let l=[];o={...a},o=o.replace&&!F(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let u=!1;if(i[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(i[1])){const d=i[1].split(this.formatSeparator).map(p=>p.trim());i[1]=d.shift(),l=d,u=!0}if(r=n(s.call(this,i[1].trim(),o),o),r&&i[0]===t&&!F(r))return r;F(r)||(r=Lf(r)),r||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${t}`),r=""),u&&(r=l.reduce((d,p)=>this.format(d,p,a.lng,{...a,interpolationkey:i[1].trim()}),r.trim())),t=t.replace(i[0],r),this.regexp.lastIndex=0}return t}}const B$=e=>{let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const a=e.split("(");t=a[0].toLowerCase().trim();const i=a[1].substring(0,a[1].length-1);t==="currency"&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):t==="relativetime"&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach(o=>{if(o){const[s,...l]=o.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,""),d=s.trim();n[d]||(n[d]=u),u==="false"&&(n[d]=!1),u==="true"&&(n[d]=!0),isNaN(u)||(n[d]=parseInt(u,10))}})}return{formatName:t,formatOptions:n}},wa=e=>{const t={};return(n,a,i)=>{let r=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(r={...r,[i.interpolationkey]:void 0});const o=a+JSON.stringify(r);let s=t[o];return s||(s=e(Go(a),i),t[o]=s),s(n)}};class H${constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=mt.create("formatter"),this.options=t,this.formats={number:wa((n,a)=>i=>new Intl.NumberFormat(n,{...a}).format(i)),currency:wa((n,a)=>i=>new Intl.NumberFormat(n,{...a,style:"currency"}).format(i)),datetime:wa((n,a)=>i=>new Intl.DateTimeFormat(n,{...a}).format(i)),relativetime:wa((n,a)=>i=>new Intl.RelativeTimeFormat(n,{...a}).format(i,a.range||"day")),list:wa((n,a)=>i=>new Intl.ListFormat(n,{...a}).format(i))},this.init(t)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};this.formatSeparator=n.interpolation.formatSeparator||","}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=wa(n)}format(t,n,a){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const r=n.split(this.formatSeparator);if(r.length>1&&r[0].indexOf("(")>1&&r[0].indexOf(")")<0&&r.find(s=>s.indexOf(")")>-1)){const s=r.findIndex(l=>l.indexOf(")")>-1);r[0]=[r[0],...r.splice(1,s)].join(this.formatSeparator)}return r.reduce((s,l)=>{const{formatName:u,formatOptions:d}=B$(l);if(this.formats[u]){let p=s;try{const m=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},g=m.locale||m.lng||i.locale||i.lng||a;p=this.formats[u](s,g,{...d,...i,...m})}catch(m){this.logger.warn(m)}return p}else this.logger.warn(`there was no format function for ${u}`);return s},t)}}const V$=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class W$ extends Jo{constructor(t,n,a){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=t,this.store=n,this.services=a,this.languageUtils=a.languageUtils,this.options=i,this.logger=mt.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(a,i.backend,i)}queueLoad(t,n,a,i){const r={},o={},s={},l={};return t.forEach(u=>{let d=!0;n.forEach(p=>{const m=`${u}|${p}`;!a.reload&&this.store.hasResourceBundle(u,p)?this.state[m]=2:this.state[m]<0||(this.state[m]===1?o[m]===void 0&&(o[m]=!0):(this.state[m]=1,d=!1,o[m]===void 0&&(o[m]=!0),r[m]===void 0&&(r[m]=!0),l[p]===void 0&&(l[p]=!0)))}),d||(s[u]=!0)}),(Object.keys(r).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(r),pending:Object.keys(o),toLoadLanguages:Object.keys(s),toLoadNamespaces:Object.keys(l)}}loaded(t,n,a){const i=t.split("|"),r=i[0],o=i[1];n&&this.emit("failedLoading",r,o,n),!n&&a&&this.store.addResourceBundle(r,o,a,void 0,void 0,{skipCopy:!0}),this.state[t]=n?-1:2,n&&a&&(this.state[t]=0);const s={};this.queue.forEach(l=>{j$(l.loaded,[r],o),V$(l,t),n&&l.errors.push(n),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{s[u]||(s[u]={});const d=l.loaded[u];d.length&&d.forEach(p=>{s[u][p]===void 0&&(s[u][p]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",s),this.queue=this.queue.filter(l=>!l.done)}read(t,n,a){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,o=arguments.length>5?arguments[5]:void 0;if(!t.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:a,tried:i,wait:r,callback:o});return}this.readingCalls++;const s=(u,d)=>{if(this.readingCalls--,this.waitingReads.length>0){const p=this.waitingReads.shift();this.read(p.lng,p.ns,p.fcName,p.tried,p.wait,p.callback)}if(u&&d&&i<this.maxRetries){setTimeout(()=>{this.read.call(this,t,n,a,i+1,r*2,o)},r);return}o(u,d)},l=this.backend[a].bind(this.backend);if(l.length===2){try{const u=l(t,n);u&&typeof u.then=="function"?u.then(d=>s(null,d)).catch(s):s(null,u)}catch(u){s(u)}return}return l(t,n,s)}prepareLoading(t,n){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();F(t)&&(t=this.languageUtils.toResolveHierarchy(t)),F(n)&&(n=[n]);const r=this.queueLoad(t,n,a,i);if(!r.toLoad.length)return r.pending.length||i(),null;r.toLoad.forEach(o=>{this.loadOne(o)})}load(t,n,a){this.prepareLoading(t,n,{},a)}reload(t,n,a){this.prepareLoading(t,n,{reload:!0},a)}loadOne(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const a=t.split("|"),i=a[0],r=a[1];this.read(i,r,"read",void 0,void 0,(o,s)=>{o&&this.logger.warn(`${n}loading namespace ${r} for language ${i} failed`,o),!o&&s&&this.logger.log(`${n}loaded namespace ${r} for language ${i}`,s),this.loaded(t,o,s)})}saveMissing(t,n,a,i,r){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${a}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(a==null||a==="")){if(this.backend&&this.backend.create){const l={...o,isUpdate:r},u=this.backend.create.bind(this.backend);if(u.length<6)try{let d;u.length===5?d=u(t,n,a,i,l):d=u(t,n,a,i),d&&typeof d.then=="function"?d.then(p=>s(null,p)).catch(s):s(null,d)}catch(d){s(d)}else u(t,n,a,i,s,l)}!t||!t[0]||this.store.addResource(t[0],n,a,i)}}}const Zf=()=>({debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),F(e[1])&&(t.defaultValue=e[1]),F(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const n=e[3]||e[2];Object.keys(n).forEach(a=>{t[a]=n[a]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),Xf=e=>(F(e.ns)&&(e.ns=[e.ns]),F(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),F(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),Zo=()=>{},K$=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class Yi extends Jo{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=Xf(t),this.services={},this.logger=mt,this.modules={external:[]},K$(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initImmediate)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(){var t=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},a=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof n=="function"&&(a=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(F(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const i=Zf();this.options={...i,...this.options,...Xf(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...i.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);const r=d=>d?typeof d=="function"?new d:d:null;if(!this.options.isClone){this.modules.logger?mt.init(r(this.modules.logger),this.options):mt.init(null,this.options);let d;this.modules.formatter?d=this.modules.formatter:typeof Intl<"u"&&(d=H$);const p=new qf(this.options);this.store=new Wf(this.options.resources,this.options);const m=this.services;m.logger=mt,m.resourceStore=this.store,m.languageUtils=p,m.pluralResolver=new L$(p,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),d&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(m.formatter=r(d),m.formatter.init(m,this.options),this.options.interpolation.format=m.formatter.format.bind(m.formatter)),m.interpolator=new O$(this.options),m.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},m.backendConnector=new W$(r(this.modules.backend),m.resourceStore,m,this.options),m.backendConnector.on("*",function(g){for(var b=arguments.length,v=new Array(b>1?b-1:0),h=1;h<b;h++)v[h-1]=arguments[h];t.emit(g,...v)}),this.modules.languageDetector&&(m.languageDetector=r(this.modules.languageDetector),m.languageDetector.init&&m.languageDetector.init(m,this.options.detection,this.options)),this.modules.i18nFormat&&(m.i18nFormat=r(this.modules.i18nFormat),m.i18nFormat.init&&m.i18nFormat.init(this)),this.translator=new Qo(this.services,this.options),this.translator.on("*",function(g){for(var b=arguments.length,v=new Array(b>1?b-1:0),h=1;h<b;h++)v[h-1]=arguments[h];t.emit(g,...v)}),this.modules.external.forEach(g=>{g.init&&g.init(this)})}if(this.format=this.options.interpolation.format,a||(a=Zo),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const d=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);d.length>0&&d[0]!=="dev"&&(this.options.lng=d[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(d=>{this[d]=function(){return t.store[d](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(d=>{this[d]=function(){return t.store[d](...arguments),t}});const l=_i(),u=()=>{const d=(p,m)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(m),a(p,m)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return d(null,this.t.bind(this));this.changeLanguage(this.options.lng,d)};return this.options.resources||!this.options.initImmediate?u():setTimeout(u,0),l}loadResources(t){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Zo;const i=F(t)?t:this.language;if(typeof t=="function"&&(a=t),!this.options.resources||this.options.partialBundledLanguages){if(i&&i.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return a();const r=[],o=s=>{if(!s||s==="cimode")return;this.services.languageUtils.toResolveHierarchy(s).forEach(u=>{u!=="cimode"&&r.indexOf(u)<0&&r.push(u)})};i?o(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>o(l)),this.options.preload&&this.options.preload.forEach(s=>o(s)),this.services.backendConnector.load(r,this.options.ns,s=>{!s&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),a(s)})}else a(null)}reloadResources(t,n,a){const i=_i();return typeof t=="function"&&(a=t,t=void 0),typeof n=="function"&&(a=n,n=void 0),t||(t=this.languages),n||(n=this.options.ns),a||(a=Zo),this.services.backendConnector.reload(t,n,r=>{i.resolve(),a(r)}),i}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&Kf.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1))for(let n=0;n<this.languages.length;n++){const a=this.languages[n];if(!(["cimode","dev"].indexOf(a)>-1)&&this.store.hasLanguageSomeTranslations(a)){this.resolvedLanguage=a;break}}}changeLanguage(t,n){var a=this;this.isLanguageChangingTo=t;const i=_i();this.emit("languageChanging",t);const r=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},o=(l,u)=>{u?(r(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,i.resolve(function(){return a.t(...arguments)}),n&&n(l,function(){return a.t(...arguments)})},s=l=>{!t&&!l&&this.services.languageDetector&&(l=[]);const u=F(l)?l:this.services.languageUtils.getBestMatchFromCodes(l);u&&(this.language||r(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(u)),this.loadResources(u,d=>{o(d,u)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?s(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(s):this.services.languageDetector.detect(s):s(t),i}getFixedT(t,n,a){var i=this;const r=function(o,s){let l;if(typeof s!="object"){for(var u=arguments.length,d=new Array(u>2?u-2:0),p=2;p<u;p++)d[p-2]=arguments[p];l=i.options.overloadTranslationOptionHandler([o,s].concat(d))}else l={...s};l.lng=l.lng||r.lng,l.lngs=l.lngs||r.lngs,l.ns=l.ns||r.ns,l.keyPrefix!==""&&(l.keyPrefix=l.keyPrefix||a||r.keyPrefix);const m=i.options.keySeparator||".";let g;return l.keyPrefix&&Array.isArray(o)?g=o.map(b=>`${l.keyPrefix}${m}${b}`):g=l.keyPrefix?`${l.keyPrefix}${m}${o}`:o,i.t(g,l)};return F(t)?r.lng=t:r.lngs=t,r.ns=n,r.keyPrefix=a,r}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const a=n.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,r=this.languages[this.languages.length-1];if(a.toLowerCase()==="cimode")return!0;const o=(s,l)=>{const u=this.services.backendConnector.state[`${s}|${l}`];return u===-1||u===0||u===2};if(n.precheck){const s=n.precheck(this,o);if(s!==void 0)return s}return!!(this.hasResourceBundle(a,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(a,t)&&(!i||o(r,t)))}loadNamespaces(t,n){const a=_i();return this.options.ns?(F(t)&&(t=[t]),t.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{a.resolve(),n&&n(i)}),a):(n&&n(),Promise.resolve())}loadLanguages(t,n){const a=_i();F(t)&&(t=[t]);const i=this.options.preload||[],r=t.filter(o=>i.indexOf(o)<0&&this.services.languageUtils.isSupportedCode(o));return r.length?(this.options.preload=i.concat(r),this.loadResources(o=>{a.resolve(),n&&n(o)}),a):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!t)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],a=this.services&&this.services.languageUtils||new qf(Zf());return n.indexOf(a.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new Yi(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Zo;const a=t.forkResourceStore;a&&delete t.forkResourceStore;const i={...this.options,...t,isClone:!0},r=new Yi(i);return(t.debug!==void 0||t.prefix!==void 0)&&(r.logger=r.logger.clone(t)),["store","services","language"].forEach(s=>{r[s]=this[s]}),r.services={...this.services},r.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},a&&(r.store=new Wf(this.store.data,i),r.services.resourceStore=r.store),r.translator=new Qo(r.services,i),r.translator.on("*",function(s){for(var l=arguments.length,u=new Array(l>1?l-1:0),d=1;d<l;d++)u[d-1]=arguments[d];r.emit(s,...u)}),r.init(i,n),r.translator.options=i,r.translator.backendConnector.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},r}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const ey=Yi.createInstance();ey.createInstance=Yi.createInstance;var G$=ey;const q$=G$,ty=["af","ar","bg","bn","bs","ca","cs","da","de","de-CH","el","en","eo","es","et","fa","fi","fr","gd","hi","hr","hu","id","is","it","ja","ko","kz","lt","mk","mn","ms","nl","nn","no","pl","pt","pt-BR","ro","ru","si","sk","sl","sq","sr","sr-Cyrl","sv","th","tr","uk","ur","uz","vi","zh","zh-Hant","sw","ta"];gu.exports=(e="en",t="portal")=>{const n=q$.createInstance();return n.init({lng:e,nsSeparator:!1,keySeparator:!1,returnEmptyString:!1,fallbackLng:!1,ns:t,defaultNS:t,resources:ty.reduce((a,i)=>{const r=MS("/ghost/i18n/lib")(`../locales/${i}/${t}.json`);return a[i]={[t]:{...r,...r.default&&typeof r.default=="object"?r.default:{}}},a},{})}),n},gu.exports.SUPPORTED_LOCALES=ty;var J$=gu.exports,Q$=J$;const ku=Ae(Q$);function Z$({event:e,form:t,errorEl:n,siteUrl:a,submitHandler:i},r=o=>o){var y;t.removeEventListener("submit",i),e.preventDefault(),n&&(n.innerText=""),t.classList.remove("success","invalid","error");let o=e.target.querySelector("input[data-members-email]"),s=e.target.querySelector("input[data-members-name]"),l=((y=t==null?void 0:t.dataset)==null?void 0:y.membersAutoredirect)||"true",u=o==null?void 0:o.value,d=s&&s.value||void 0,p,m=[],g=[],b=e.target.querySelectorAll("input[data-members-label]")||[];for(let w=0;w<b.length;++w)m.push(b[w].value);let v=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 w=0;w<v.length;++w)g.push({name:v[w].value});t.dataset.membersForm&&(p=t.dataset.membersForm),t.classList.add("loading");const h=Ai(),f={email:u,emailType:p,labels:m,name:d,autoRedirect:l==="true"};return h&&(f.urlHistory=h),v.length>0?f.newsletters=g:(e.target.querySelectorAll("input[type=checkbox][data-members-newsletter]")||[]).length>0&&(f.newsletters=[]),fetch(`${a}/members/api/integrity-token/`,{method:"GET"}).then(w=>w.text()).then(w=>fetch(`${a}/members/api/send-magic-link/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...f,integrityToken:w})})).then(function(w){if(t.addEventListener("submit",i),t.classList.remove("loading"),w.ok)t.classList.add("success");else return Sn.fromApiResponse(w).then(x=>{throw x})}).catch(w=>{n&&(n.innerText=Lo(w,r("There was an error sending the email, please try again"),r)),t.classList.add("error")})}function X$({event:e,el:t,errorEl:n,siteUrl:a,site:i,member:r,clickHandler:o}){const s=i.locale|"en",u=ku(s,"portal").t;t.removeEventListener("click",o),e.preventDefault();let d=t.dataset.membersPlan,p=mE(i,d.toLowerCase()),m=t.dataset.membersSuccess,g=t.dataset.membersCancel,b,v;m&&(b=new URL(m,window.location.href).href),g&&(v=new URL(g,window.location.href).href),n&&(n.innerText=""),t.classList.add("loading");const h=r?{checkoutType:"upgrade"}:{},f=Ai();return f&&(h.urlHistory=f),fetch(`${a}/members/api/session`,{credentials:"same-origin"}).then(function(y){return y.ok?y.text():null}).then(function(y){return fetch(`${a}/members/api/create-stripe-checkout-session/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...p,identity:y,successUrl:b,cancelUrl:v,metadata:h})}).then(function(w){if(!w.ok)throw new Error(u("Could not create stripe checkout session"));return w.json()})}).then(function(y){return y.url?window.location.assign(y.url):window.Stripe(y.publicKey).redirectToCheckout({sessionId:y.sessionId}).then(function(x){if(x.error)throw new Error(x.error.message)})}).catch(function(y){console.error(y),t.addEventListener("click",o),t.classList.remove("loading"),n&&(n.innerText=y.message),t.classList.add("error")})}function ej({siteUrl:e,site:t,member:n}){const a=t.locale|"en",r=ku(a,"portal").t;e&&(e=e.replace(/\/$/,""),Array.prototype.forEach.call(document.querySelectorAll("form[data-members-form]"),function(o){let s=o.querySelector("[data-members-error]");function l(u){Z$({event:u,errorEl:s,form:o,siteUrl:e,submitHandler:l},r)}o.addEventListener("submit",l)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-plan]"),function(o){let s=o.querySelector("[data-members-error]");function l(u){X$({el:o,event:u,errorEl:s,member:n,site:t,siteUrl:e,clickHandler:l})}o.addEventListener("click",l)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-edit-billing]"),function(o){let s=o.querySelector("[data-members-error]"),l=o.dataset.membersSuccess,u=o.dataset.membersCancel,d,p;l&&(d=new URL(l,window.location.href).href),u&&(p=new URL(u,window.location.href).href);function m(g){o.removeEventListener("click",m),g.preventDefault(),s&&(s.innerText=""),o.classList.add("loading"),fetch(`${e}/members/api/session`,{credentials:"same-origin"}).then(function(b){return b.ok?b.text():null}).then(function(b){return fetch(`${e}/members/api/create-stripe-update-session/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:b,successUrl:d,cancelUrl:p})}).then(function(v){if(!v.ok)throw new Error(r("Could not create stripe checkout session"));return v.json()})}).then(function(b){return window.Stripe(b.publicKey).redirectToCheckout({sessionId:b.sessionId})}).then(function(b){if(b.error)throw new Error(r(b.error.message))}).catch(function(b){console.error(b),o.addEventListener("click",m),o.classList.remove("loading"),s&&(s.innerText=b.message),o.classList.add("error")})}o.addEventListener("click",m)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-signout]"),function(o){function s(l){o.removeEventListener("click",s),l.preventDefault(),o.classList.remove("error"),o.classList.add("loading"),fetch(`${e}/members/api/session`,{method:"DELETE"}).then(function(u){u.ok?window.location.replace(e):(o.addEventListener("click",s),o.classList.remove("loading"),o.classList.add("error"))})}o.addEventListener("click",s)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-cancel-subscription]"),function(o){let s=o.parentElement.querySelector("[data-members-error]");function l(u){o.removeEventListener("click",l),u.preventDefault(),o.classList.remove("error"),o.classList.add("loading");let d=o.dataset.membersCancelSubscription;return s&&(s.innerText=""),fetch(`${e}/members/api/session`,{credentials:"same-origin"}).then(function(p){return p.ok?p.text():null}).then(function(p){return fetch(`${e}/members/api/subscriptions/${d}/`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:p,smart_cancel:!0})})}).then(function(p){p.ok?window.location.reload():(o.addEventListener("click",l),o.classList.remove("loading"),o.classList.add("error"),s&&(s.innerText=r("There was an error cancelling your subscription, please try again.")))})}o.addEventListener("click",l)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-continue-subscription]"),function(o){let s=o.parentElement.querySelector("[data-members-error]");function l(u){o.removeEventListener("click",l),u.preventDefault(),o.classList.remove("error"),o.classList.add("loading");let d=o.dataset.membersContinueSubscription;return s&&(s.innerText=""),fetch(`${e}/members/api/session`,{credentials:"same-origin"}).then(function(p){return p.ok?p.text():null}).then(function(p){return fetch(`${e}/members/api/subscriptions/${d}/`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:p,cancel_at_period_end:!1})})}).then(function(p){p.ok?window.location.reload():(o.addEventListener("click",l),o.classList.remove("loading"),o.classList.add("error"),s&&(s.innerText=r("There was an error continuing your subscription, please try again.")))})}o.addEventListener("click",l)}))}const tj={showPopup:!0,site:ka,member:Wo.free,page:"accountEmail",...q0(),pageData:Yf};function nj({site:e,children:t}){const{portal_sentry:n}=e||{};return n&&n.dsn?c.jsx(Lc,{children:t}):c.jsx(c.Fragment,{children:t})}class aj extends U.Component{constructor(t){super(t),this.setupCustomTriggerButton(t),this.state={site:null,member:null,page:"loading",showPopup:!1,action:"init:running",initStatus:"running",lastPage:null,customSiteUrl:t.customSiteUrl}}componentDidMount(){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,window.document.body.style.overflow="hidden"):window.document.body.style.overflow=this.bodyScroll||""}catch{}}if(this.state.initStatus==="success"&&n.initStatus!==this.state.initStatus){const{siteUrl:o}=this.props,s=this.getContextFromState();this.sendPortalReadyEvent(),ej({siteUrl:o,site:s.site,member:s.member})}}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:{}},"*")}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,page:a,showPopup:i,popupNotification:r,lastPage:o,pageQuery:s,pageData:l}=await this.fetchData(),u=this.props.siteI18nEnabled?t.locale:"en",d=ku(u,"portal"),p={site:t,member:n,page:a,lastPage:o,pageQuery:s,showPopup:i,pageData:l,popupNotification:r,t:d.t,action:"init:success",initStatus:"success"};if(this.handleSignupQuery({site:t,pageQuery:s,member:n}),this.setState(p),this.hashHandler=()=>{this.updateStateForPreviewLinks()},window.addEventListener("hashchange",this.hashHandler,!1),!n){const m=document.querySelectorAll("[data-lexical-signup-form]");m.length>0&&m.forEach(g=>{g.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}=await this.fetchApiData(),{site:a,...i}=this.fetchDevData(),{site:r,...o}=this.fetchLinkData(t,n),{site:s,...l}=this.fetchPreviewData(),{site:u,...d}=this.fetchNotificationData();return{member:n,page:"",site:{...t,...r,...s,...u,...a,plans:{...(a||{}).plans,...(t||{}).plans,...(s||{}).plans}},...i,...o,...d,...l}}fetchDevData(){return G(["dev"])&&!this.state.customSiteUrl?tj:G(["test"])?{showPopup:this.props.showPopup!==void 0?this.props.showPopup:!0}:{}}fetchOfferQueryStrData(t=""){const n=new URLSearchParams(t),a={};for(let i of n.entries()){const r=i[0],o=decodeURIComponent(i[1]);r==="name"?a.name=o||"":r==="code"?a.code=o||"":r==="display_title"?a.display_title=o||"":r==="display_description"?a.display_description=o||"":r==="type"?a.type=o||"":r==="cadence"?a.cadence=o||"":r==="duration"?a.duration=o||"":r==="duration_in_months"&&!isNaN(Number(o))?a.duration_in_months=Number(o):r==="amount"&&!isNaN(Number(o))?a.amount=Number(o):r==="currency"?a.currency=o||"":r==="status"?a.status=o||"":r==="tier_id"&&(a.tier={id:o||Yf.tier.id})}return{page:"offer",pageData:a}}fetchQueryStrData(t=""){const n=new URLSearchParams(t),a={site:{plans:{}}},i=[];let r,o=null,s,l,u;for(let d of n.entries()){const p=d[0],m=decodeURIComponent(d[1]);if(p==="button")a.site.portal_button=JSON.parse(m);else if(p==="name")a.site.portal_name=JSON.parse(m);else if(p==="isFree"&&JSON.parse(m))i.push("free");else if(p==="isMonthly"&&JSON.parse(m))i.push("monthly");else if(p==="isYearly"&&JSON.parse(m))i.push("yearly");else if(p==="portalPrices")r=m?m.split(","):[];else if(p==="portalProducts")o=m?m.split(","):[];else if(p==="page"&&m)a.page=m;else if(p==="accentColor"&&(m===""||m))a.site.accent_color=m;else if(p==="buttonIcon"&&m)a.site.portal_button_icon=m;else if(p==="signupButtonText")a.site.portal_button_signup_text=m||"";else if(p==="signupTermsHtml")a.site.portal_signup_terms_html=m||"";else if(p==="signupCheckboxRequired")a.site.portal_signup_checkbox_required=JSON.parse(m);else if(p==="buttonStyle"&&m)a.site.portal_button_style=m;else if(p==="monthlyPrice"&&!isNaN(Number(m)))a.site.plans.monthly=Number(m),s=Number(m);else if(p==="yearlyPrice"&&!isNaN(Number(m)))a.site.plans.yearly=Number(m),l=Number(m);else if(p==="currency"&&m){const g=m.toUpperCase();a.site.plans.currency=g,a.site.plans.currency_symbol=pe(g),u=g}else p==="disableBackground"?a.site.disableBackground=JSON.parse(m):p==="allowSelfSignup"?a.site.allow_self_signup=JSON.parse(m):p==="membersSignupAccess"&&m?a.site.members_signup_access=m:p==="portalDefaultPlan"&&m&&(a.site.portal_default_plan=m)}return a.site.portal_plans=i,a.site.portal_products=o,r?a.site.portal_plans=r:s&&l&&u&&(a.site.prices=[{id:"monthly",stripe_price_id:"dummy_stripe_monthly",stripe_product_id:"dummy_stripe_product",active:1,nickname:"Monthly",currency:u,amount:s,type:"recurring",interval:"month"},{id:"yearly",stripe_price_id:"dummy_stripe_yearly",stripe_product_id:"dummy_stripe_product",active:1,nickname:"Yearly",currency:u,amount:l,type:"recurring",interval:"year"}]),a}fetchNotificationData(){const{type:t,status:n,duration:a,autoHide:i,closeable:r}=Og({billingOnly:!0})||{};return["stripe:billing-update"].includes(t)?n==="success"?{showPopup:!0,popupNotification:Q({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(hE({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$/,u=/^offers\/(\w+?)\/?$/,d=/^\/portal\/?(?:\/(\w+(?:\/\w+)*))?\/?$/,p=/^\/feedback\/(\w+?)\/(\w+?)\/?$/;if(i&&p.test(i)){const[,m,g]=i.match(p),b=parseInt(g);if(b===1||b===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:m,score:b}}:{showPopup:!0,page:"signin",pageData:{redirect:t.url+`#/feedback/${m}/${b}/`}}}if(i&&d.test(i)){const[,m]=i.match(d),{page:g,pageQuery:b,pageData:v}=this.getPageFromLinkPath(m,t)||{},h=["accountPlan","accountProfile"].includes(g)?"accountHome":null;return{showPopup:!(["monthly","yearly"].includes(b)||s.test(b)||l.test(b)||u.test(b)),...g?{page:g}:{},...b?{pageQuery:b}:{},...v?{pageData:v}:{},...h?{lastPage:h}:{}}}return{}}fetchPreviewData(){const[,t]=window.location.hash.substr(1).split("?");if(G(["preview"])){let n={};return G(["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||Oo({siteUrl:t,apiUrl:a,apiKey:i});const{site:r,member:o}=await this.GhostApi.init(),s=this.getColorOverride();return s&&(r.accent_color=s),this.setupFirstPromoter({site:r,member:o}),this.setupSentry({site:r}),{site:r,member:o}}catch(r){if(G(["dev","test"],{customSiteUrl:n}))return{};throw r}}setupSentry({site:t}){if(G(["test"]))return null;const{portal_sentry:n,portal_version:a,version:i}=t,o=`portal@2.45.1|ghost@${i}`;n&&n.dsn&&RS({dsn:n.dsn,environment:n.env||"development",release:o,beforeSend:s=>iE({event:s})?s:null,allowUrls:[/https?:\/\/((www)\.)?unpkg\.com\/@tryghost\/portal/]})}setupFirstPromoter({site:t,member:n}){if(G(["test"]))return null;const a=vE({site:t});let i=Xc({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),NE({member:n})){const l=n.email,u=n.uuid;if(window.$FPROM)window.$FPROM.trackSignup({email:l,uid:u});else{const d=window._fprom||[];window._fprom=d,d.push(["event","signup"]),d.push(["email",l]),d.push(["uid",u])}}}catch{}};const o=document.getElementsByTagName("script")[0];o.parentNode.insertBefore(r,o)}}async dispatchAction(t,n){clearTimeout(this.timeoutId),this.setState({action:`${t}:running`});try{const a=await E$({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=Q({type:`${t}:failed`,autoHide:!0,closeable:!0,status:"error",state:this.state,meta:{error:a}});this.setState({action:`${t}:failed`,popupNotification:i})}}updateStateForPreviewLinks(){const{site:t,...n}=this.fetchPreviewData(),{site:a,...i}=this.fetchLinkData(),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(Wc(),!ut({member:a}))try{const r=await this.GhostApi.site.offer({offerId:n}),o=r==null?void 0:r.offers[0];if(CE({site:t,offer:o}))if(i)this.dispatchAction("openPopup",{page:"offer",pageData:r==null?void 0:r.offers[0]});else{const s=pa({site:t,productId:o.tier.id}),l=o.cadence==="month"?s.monthlyPrice:s.yearlyPrice;if(this.dispatchAction("openPopup",{page:"loading"}),a){const{tierId:u,cadence:d}=xn({site:t,priceId:l.id});this.dispatchAction("checkoutPlan",{plan:l.id,offerId:n,tierId:u,cadence:d})}else{const{tierId:u,cadence:d}=xn({site:t,priceId:l.id});this.dispatchAction("signup",{plan:l.id,offerId:n,tierId:u,cadence:d})}}}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}Fg({site:t,pageQuery:n})&&(r=Fg({site:t,pageQuery:n}));const o=pE({site:t,priceId:r});if(n&&n!=="free"){Wc();const s=(o==null?void 0:o.id)||r;s!=="free"&&this.dispatchAction("openPopup",{page:"loading"});const{tierId:l,cadence:u}=xn({site:t,priceId:s});this.dispatchAction("signup",{plan:s,tierId:l,cadence:u})}}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 t}getContextPage({site:t,page:n,member:a}){if(!n||n==="default"){const i=dt({site:t})?"signin":"signup";n=a?"accountHome":i}return n==="accountPlan"&&Qt({member:a})&&!Ti({member:a})&&(n="accountHome"),mu({page:n})}getContextMember({page:t,member:n,customSiteUrl:a}){return G(["dev","preview"],{customSiteUrl:a})?L0({page:t})||O0({page:t})?G(["dev"],{customSiteUrl:a})?n||Wo.free:G(["preview"])?Wo.preview:Wo.paid:null:n}getContextFromState(){const{site:t,member:n,action:a,page:i,lastPage:r,showPopup:o,pageQuery:s,pageData:l,popupNotification:u,customSiteUrl:d,t:p}=this.state,m=this.getContextPage({site:t,page:i,member:n}),g=this.getContextMember({page:m,member:n,customSiteUrl:d});return{api:this.GhostApi,site:t,action:a,brandColor:this.getAccentColor(),page:m,pageQuery:s,pageData:l,member:g,lastPage:r,showPopup:o,popupNotification:u,customSiteUrl:d,t:p,onAction:(b,v)=>this.dispatchAction(b,v)}}getRecommendationButtons(){const t="[data-recommendation]";return document.querySelectorAll(t)||[]}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(J0)}render(){return this.state.initStatus==="success"?c.jsx(nj,{site:this.state.site,children:c.jsxs(N.Provider,{value:this.getContextFromState(),children:[c.jsx(Df,{}),c.jsx(Ug,{}),c.jsx(Hg,{})]})}):null}}const ny="ghost-portal-root";function ij(){const e=document.createElement("div");e.id=ny,document.body.appendChild(e)}function rj(){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;return{siteUrl:n,apiKey:a,apiUrl:i,siteI18nEnabled:t}}return{}}function oj(){const e=new URL(window.location.href);e.searchParams.get("token")&&(e.searchParams.delete("token"),window.history.replaceState({},document.title,e.href))}function sj(){ij(),oj()}function lj(){const{siteUrl:e,apiKey:t,apiUrl:n,siteI18nEnabled:a}=rj(),i=e||window.location.origin;sj(),pk.render(c.jsx(U.StrictMode,{children:c.jsx(aj,{siteUrl:i,customSiteUrl:e,apiKey:t,apiUrl:n,siteI18nEnabled:a})}),document.getElementById(ny))}lj()});
3513
+ `+n;return c.jsxs(c.Fragment,{children:[c.jsx("style",{dangerouslySetInnerHTML:{__html:a}}),c.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=Af(),r=window.innerWidth<480,o={...i.frame.common};let s="gh-portal-popup-background";return G(["preview"])&&(i.modalContainer.zIndex="3999997"),G(["preview"],{customSiteUrl:a})&&!n.disableBackground&&(s+=" preview"),G(["dev"])&&(s+=" dev"),c.jsx("div",{style:i.modalContainer,children:c.jsxs(Oc,{style:o,title:"portal-popup",head:this.renderFrameStyles(),dataTestId:"portal-popup-frame",dataDir:this.context.dir,children:[c.jsx("div",{className:s,onClick:l=>this.handlePopupClose(l)}),c.jsx(zf,{isMobile:r})]})})}render(){const{showPopup:t}=this.context;return t?this.renderFrameContainer():null}}Z(Df,"contextType",N),Bo({products:hu({numOfProducts:1})});function we(){return(new Date().getTime()/1e3|0).toString(16)+"xxxxxxxxxxxxxxxx".replace(/[x]/g,function(){return(Math.random()*16|0).toString(16)}).toLowerCase()}function Bo({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=hu({numOfProducts:1}),portalProducts:s=o.map(re=>re.id),accentColor:l="#45C32E",portalPlans:u=["free","monthly","yearly"],allowSelfSignup:d=!0,membersSignupAccess:p="all",freePriceName:m="Free",freePriceDescription:g="Free preview",isStripeConfigured:b=!0,portalButton:v=!0,portalName:h=!0,portalButtonIcon:f="icon-1",portalButtonSignupText:y="Subscribe now",portalButtonStyle:w="icon-and-text",membersSupportAddress:x="support@example.com",editorDefaultEmailRecipients:C="visibility",newsletters:S=[],posts:E=V0(),commentsEnabled:$,recommendations:P=[],recommendationsEnabled:_}={}){return{title:e,description:t,logo:n,icon:a,accent_color:l,url:i,plans:r,products:o,portal_products:s,allow_self_signup:d,members_signup_access:p,free_price_name:m,free_price_description:g,is_stripe_configured:b,portal_button:v,portal_name:h,portal_plans:u,portal_button_icon:f,portal_button_signup_text:y,portal_button_style:w,members_support_address:x,comments_enabled:$!=="off",newsletters:S,recommendations:P,recommendations_enabled:!!_,editor_default_email_recipients:C,posts:E}}function Ff({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:u=!1,currency:d=null,status:p="active",tierId:m="",tierName:g="Basic"}={}){return{id:`offer_${we()}`,name:e,code:t,display_title:n,display_description:a,type:i,cadence:r,amount:o,duration:s,duration_in_months:l,currency_restriction:u,currency:d,status:p,tier:{id:`${m}`,name:g}}}function Xe({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:`member_${we()}`,email:t,name:e,firstname:n,paid:i,subscribed:o,avatar_image:r,subscriptions:a,email_suppression:s,newsletters:l}}function V0({numOfPosts:e=3}={}){const t=[];for(let n=0;n<e;n++)t.push(W0({title:`Post ${n+1}`,slug:`post-${n+1}`}));return t.slice(0,e)}function W0({id:e=`post_${we()}`,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 hu({numOfProducts:e=3}={}){const n=[ba({name:"Bronze",description:"Access to all members articles",monthlyPrice:Ke({interval:"month",amount:700}),yearlyPrice:Ke({interval:"year",amount:7e3}),numOfBenefits:2}),ba({name:"Silver",description:"Access to all members articles and weekly podcast",monthlyPrice:Ke({interval:"month",amount:1200}),yearlyPrice:Ke({interval:"year",amount:12e3}),numOfBenefits:3}),ba({name:"Friends of the Blueprint",description:"Get access to everything and lock in early adopter pricing for life + listen to my podcast",monthlyPrice:Ke({interval:"month",amount:18e3}),yearlyPrice:Ke({interval:"year",amount:17e3}),numOfBenefits:4})].slice(0,e),a=Mf({});return[...n,a]}function ba({type:e="paid",name:t="Basic",description:n="",id:a=`product_${we()}`,monthlyPrice:i=Ke(),yearlyPrice:r=Ke({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:_f({numOfBenefits:o}),trial_days:s}}function Mf({name:e="Free tier",description:t="Free tier description",id:n=`product_${we()}`,numOfBenefits:a=2}){return{id:n,name:e,type:"free",description:t,benefits:_f({numOfBenefits:a})}}function _f({numOfBenefits:e}){const t=Date.now(),n=Math.floor(Math.random()*100);return[Ho({name:`Limited early adopter pricing #${n}-${t}`}),Ho({name:`Latest gear reviews #${n}-${t}`}),Ho({name:`Weekly email newsletter #${n}-${t}`}),Ho({name:`Listen to my podcast #$${n}-${t}`})].slice(0,e)}function Ho({id:e=`benefit_${we()}`,name:t="Benefit"}){return{id:e,name:t}}function Ke({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_${we()}`}={}){return{id:o,active:r,nickname:n,currency:i,amount:t,interval:e,description:a,stripe_price_id:`price_${we()}`,stripe_product_id:`prod_${we()}`,type:"recurring"}}function En({id:e=`sub_${we()}`,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=G0,priceId:l=`price_${we()}`,startDate:u="2021-10-05T03:18:30.000Z",currentPeriodEnd:d="2022-10-05T03:18:30.000Z",cancelAtPeriodEnd:p=!1}={}){return{id:e,customer:{id:`cus_${we()}`,name:"Jamie",email:"jamie@example.com"},plan:{id:`price_${we()}`,nickname:r,amount:i,interval:a,currency:n},offer:s,status:t,start_date:u,default_payment_card_last4:o,cancel_at_period_end:p,cancellation_reason:null,current_period_end:d,price:{id:`stripe_price_${we()}`,price_id:l,nickname:r,amount:i,interval:a,type:"recurring",currency:n,product:{id:`stripe_prod_${we()}`,product_id:`prod_${we()}`}}}}function Rf(){const e=hu({numOfProducts:1}),t=e.map(a=>a.id);return Bo({products:e,portalPlans:["free","monthly","yearly"],portalProducts:t})}Rf();const K0=Bo({products:[ba({numOfBenefits:2,type:"free"})]}),G0=Ff({tierId:(ay=K0.products[0])==null?void 0:ay.id});Xe(),Xe({paid:!0,subscriptions:[En()]}),Xe({paid:!0,subscriptions:[]}),Xe({paid:!0,subscriptions:[En({amount:0})]}),Xe({paid:!0,subscriptions:[En({amount:1500,startDate:"2019-05-01T11:42:40.000Z",currentPeriodEnd:"2021-06-05T11:42:40.000Z"})]}),Rf();const Vo=[Mf({name:"Free",description:"Free tier description which is actually a pretty long description",numOfBenefits:2}),ba({name:"The Blueprint",description:"",monthlyPrice:Ke({interval:"month",amount:500}),yearlyPrice:Ke({interval:"year",amount:5e3}),numOfBenefits:3}),ba({name:"Friends of the Blueprint Silver",description:"Access to all members articles and weekly podcast",monthlyPrice:Ke({interval:"month",amount:1200}),yearlyPrice:Ke({interval:"year",amount:11e3}),numOfBenefits:4})],ka=Bo({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:Vo,portalProducts:Vo.map(e=>e.id),allowSelfSignup:!0,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}]}),Yf=Ff({tierId:(iy=ka.products[1])==null?void 0:iy.id}),Wo={free:Xe({name:"Jamie Larson",email:"jamie@example.com",firstname:"Jamie",subscriptions:[],paid:!1,avatarImage:"",subscribed:!0}),paid:Xe({paid:!0,subscriptions:[En({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:Xe({paid:!0,subscriptions:[]}),complimentaryWithSubscription:Xe({paid:!0,subscriptions:[En({amount:0})]}),preview:Xe({paid:!0,subscriptions:[En({amount:1500,startDate:"2019-05-01T11:42:40.000Z",currentPeriodEnd:"2021-06-05T11:42:40.000Z"})]})};function q0(){var n;if(!Vo||!Vo[1])return null;let e=(n=ka==null?void 0:ka.products)==null?void 0:n[1].monthlyPrice,t=Xe({paid:!0,subscriptions:[En({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:ka,member:t}}function J0(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 Q0({data:e,state:t}){return{page:e.page,popupNotification:null,lastPage:e.lastPage||null,pageData:e.pageData||t.pageData}}function Z0({state:e}){return{showPopup:!e.showPopup}}function X0({data:e}){return{showPopup:!0,page:e.page,...e.pageQuery?{pageQuery:e.pageQuery}:{},...e.pageData?{pageData:e.pageData}:{}}}function e$({state:e}){return e.lastPage?{page:e.lastPage}:Uf({state:e})}function Uf({state:e}){return Wc(),{showPopup:!1,lastPage:null,pageQuery:"",popupNotification:null,page:e.page==="magiclink"?"":e.page}}function t$({data:e}){return{showNotification:!0,...e}}function n$(){return{showNotification:!1}}async function a$({api:e,state:t}){try{return await e.member.signout(),{action:"signout:success"}}catch{const{t:a}=t;return{action:"signout:failed",popupNotification:Q({type:"signout:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:a("Failed to log out, please try again")})}}}async function i$({data:e,api:t,state:n}){const{t:a}=n;try{const i=await t.member.getIntegrityToken();return await t.member.sendMagicLink({...e,emailType:"signin",integrityToken:i}),{page:"magiclink",lastPage:"signin"}}catch(i){return{action:"signin:failed",popupNotification:Q({type:"signin:failed",autoHide:!1,closeable:!0,state:n,status:"error",message:Lo(i,a("Failed to log in, please try again"),a)})}}}async function r$({data:e,state:t,api:n}){try{let{plan:a,tierId:i,cadence:r,email:o,name:s,newsletters:l,offerId:u}=e;if(a.toLowerCase()==="free"){const d=await n.member.getIntegrityToken();await n.member.sendMagicLink({emailType:"signup",integrityToken:d,...e})}else return i&&r?await n.member.checkoutPlan({plan:a,tierId:i,cadence:r,email:o,name:s,newsletters:l,offerId:u}):({tierId:i,cadence:r}=xn({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:u})),{page:"loading"};return{page:"magiclink",lastPage:"signup"}}catch(a){const{t:i}=t,r=Lo(a,i("Failed to sign up, please try again"),i);return{action:"signup:failed",popupNotification:Q({type:"signup:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:r})}}}async function o$({data:e,state:t,api:n}){try{let{plan:a,offerId:i,tierId:r,cadence:o}=e;(!r||!o)&&({tierId:r,cadence:o}=xn({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{const{t:i}=t;return{action:"checkoutPlan:failed",popupNotification:Q({type:"checkoutPlan:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:i("Failed to process checkout, please try again")})}}}async function s$({data:e,state:t,api:n}){const{t:a}=t;try{const{plan:i,planId:r,subscriptionId:o,cancelAtPeriodEnd:s}=e,{tierId:l,cadence:u}=xn({site:t==null?void 0:t.site,priceId:r});await n.member.updateSubscription({planName:i,tierId:l,cadence:u,subscriptionId:o,cancelAtPeriodEnd:s,planId:r});const d=await n.member.sessionData(),p="updateSubscription:success";return{action:p,popupNotification:Q({type:p,autoHide:!0,closeable:!0,state:t,status:"success",message:a("Subscription plan updated successfully")}),page:"accountHome",member:d}}catch{return{action:"updateSubscription:failed",popupNotification:Q({type:"updateSubscription:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:a("Failed to update subscription, please try again")})}}}async function l$({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{const{t:i}=t;return{action:"cancelSubscription:failed",popupNotification:Q({type:"cancelSubscription:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:i("Failed to cancel subscription, please try again")})}}}async function c$({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{const{t:i}=t;return{action:"continueSubscription:failed",popupNotification:Q({type:"continueSubscription:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:i("Failed to cancel subscription, please try again")})}}}async function u$({data:e,state:t,api:n}){try{await n.member.editBilling(e)}catch{const{t:i}=t;return{action:"editBilling:failed",popupNotification:Q({type:"editBilling:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:i("Failed to update billing information, please try again")})}}}async function d$(){return{popupNotification:null}}async function m$({data:e,state:t}){let{action:n,message:a=""}=e;return n=n||"showPopupNotification:success",{popupNotification:Q({type:n,autoHide:!0,closeable:!0,state:t,status:"success",message:a})}}async function p$({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{const{t:i}=t;return{action:"updateNewsletterPref:failed",popupNotification:Q({type:"updateNewsletter:failed",autoHide:!0,closeable:!0,state:t,status:"error",message:i("Failed to update newsletter settings")})}}}async function h$({state:e,api:t}){const{t:n}=e;try{return await t.member.deleteSuppression(),{action:"removeEmailFromSuppressionList:success",popupNotification:Q({type:"removeEmailFromSuppressionList:success",autoHide:!0,closeable:!0,state:e,status:"success",message:n("You have been successfully resubscribed")})}}catch{return{action:"removeEmailFromSuppressionList:failed",popupNotification:Q({type:"removeEmailFromSuppressionList:failed",autoHide:!0,closeable:!0,state:e,status:"error",message:n("Your email has failed to resubscribe, please try again")})}}}async function g$({data:e,state:t,api:n}){const{t:a}=t;try{const{subscribed:i}=e,r=await n.member.update({subscribed:i});if(!r)throw new Error("Failed to update newsletter");const o="updateNewsletter:success";return{action:o,member:r,popupNotification:Q({type:o,autoHide:!0,closeable:!0,state:t,status:"success",message:a("Email newsletter settings updated")})}}catch{return{action:"updateNewsletter:failed",popupNotification:Q({type:"updateNewsletter:failed",autoHide:!0,closeable:!0,state:t,status:"error",message:a("Failed to update newsletter settings")})}}}async function f$({data:e,state:t,api:n}){const{email:a}=e,i=kE({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 y$({data:e,state:t,api:n}){const{name:a}=e;if(wE({member:t.member})!==a)try{const r=await n.member.update({name:a});if(!r)throw new Error("Failed to update member");return{member:r,success:!0}}catch(r){return{success:!1,error:r}}return null}async function b$({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 k$({data:e,state:t,api:n}){const{t:a}=t,[i,r]=await Promise.all([y$({data:e,state:t,api:n}),f$({data:e,state:t,api:n})]);if(i&&r){if(r.success)return{action:"updateProfile:success",...i.success?{member:i.member}:{},page:"accountHome",popupNotification:Q({type:"updateProfile:success",autoHide:!0,closeable:!0,status:"success",state:t,message:a("Check your inbox to verify email update")})};const o=i.success?a("Failed to send verification email"):a("Failed to update account data");return{action:"updateProfile:failed",...i.success?{member:i.member}:{},popupNotification:Q({type:"updateProfile:failed",autoHide:!0,closeable:!0,status:"error",message:o,state:t})}}else if(i){const o=i.success?"updateProfile:success":"updateProfile:failed",s=i.success?"success":"error",l=i.success?a("Account details updated successfully"):a("Failed to update account details");return{action:o,...i.success?{member:i.member}:{},...i.success?{page:"accountHome"}:{},popupNotification:Q({type:o,autoHide:i.success,closeable:!0,status:s,state:t,message:l})}}else if(r){const o=r.success?"updateProfile:success":"updateProfile:failed",s=r.success?"success":"error",l=r.success?a("Check your inbox to verify email update"):a("Failed to send verification email");return{action:o,...r.success?{page:"accountHome"}:{},popupNotification:Q({type:o,autoHide:r.success,closeable:!0,status:s,state:t,message:l})}}return{action:"updateProfile:success",page:"accountHome",popupNotification:Q({type:"updateProfile:success",autoHide:!0,closeable:!0,status:"success",state:t,message:a("Account details updated successfully")})}}async function v$({data:{siteUrl:e},state:t}){const n=Oo({siteUrl:e,apiUrl:"not-defined",contentApiKey:"not-defined"}),{member:a}=t,i=window.location.href,r=jg(),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 w$({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 x$({data:{recommendationId:e},api:t}){return t.recommendations.trackSubscribed({recommendationId:e}),{}}const S$={togglePopup:Z0,openPopup:X0,closePopup:Uf,switchPage:Q0,openNotification:t$,closeNotification:n$,back:e$,signout:a$,signin:i$,signup:r$,updateSubscription:s$,cancelSubscription:l$,continueSubscription:c$,updateNewsletter:g$,updateProfile:k$,refreshMemberData:b$,clearPopupNotification:d$,editBilling:u$,checkoutPlan:o$,updateNewsletterPreference:p$,showPopupNotification:m$,removeEmailFromSuppressionList:h$,oneClickSubscribe:v$,trackRecommendationClicked:w$,trackRecommendationSubscribed:x$};async function E$({action:e,data:t,state:n,api:a}){const i=S$[e];return i?await i({data:t,state:n,api:a})||{}:{}}const uq="";var gu={exports:{}};const F=e=>typeof e=="string",_i=()=>{let e,t;const n=new Promise((a,i)=>{e=a,t=i});return n.resolve=e,n.reject=t,n},Lf=e=>e==null?"":""+e,C$=(e,t,n)=>{e.forEach(a=>{t[a]&&(n[a]=t[a])})},$$=/###/g,Of=e=>e&&e.indexOf("###")>-1?e.replace($$,"."):e,Bf=e=>!e||F(e),Ri=(e,t,n)=>{const a=F(t)?t.split("."):t;let i=0;for(;i<a.length-1;){if(Bf(e))return{};const r=Of(a[i]);!e[r]&&n&&(e[r]=new n),Object.prototype.hasOwnProperty.call(e,r)?e=e[r]:e={},++i}return Bf(e)?{}:{obj:e,k:Of(a[i])}},Hf=(e,t,n)=>{const{obj:a,k:i}=Ri(e,t,Object);if(a!==void 0||t.length===1){a[i]=n;return}let r=t[t.length-1],o=t.slice(0,t.length-1),s=Ri(e,o,Object);for(;s.obj===void 0&&o.length;)r=`${o[o.length-1]}.${r}`,o=o.slice(0,o.length-1),s=Ri(e,o,Object),s&&s.obj&&typeof s.obj[`${s.k}.${r}`]<"u"&&(s.obj=void 0);s.obj[`${s.k}.${r}`]=n},j$=(e,t,n,a)=>{const{obj:i,k:r}=Ri(e,t,Object);i[r]=i[r]||[],i[r].push(n)},Ko=(e,t)=>{const{obj:n,k:a}=Ri(e,t);if(n)return n[a]},P$=(e,t,n)=>{const a=Ko(e,n);return a!==void 0?a:Ko(t,n)},Vf=(e,t,n)=>{for(const a in t)a!=="__proto__"&&a!=="constructor"&&(a in e?F(e[a])||e[a]instanceof String||F(t[a])||t[a]instanceof String?n&&(e[a]=t[a]):Vf(e[a],t[a],n):e[a]=t[a]);return e},va=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var T$={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const N$=e=>F(e)?e.replace(/[&<>"'\/]/g,t=>T$[t]):e;class I${constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const n=this.regExpMap.get(t);if(n!==void 0)return n;const a=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,a),this.regExpQueue.push(t),a}}const A$=[" ",",","?","!",";"],z$=new I$(20),D$=(e,t,n)=>{t=t||"",n=n||"";const a=A$.filter(o=>t.indexOf(o)<0&&n.indexOf(o)<0);if(a.length===0)return!0;const i=z$.getRegExp(`(${a.map(o=>o==="?"?"\\?":o).join("|")})`);let r=!i.test(e);if(!r){const o=e.indexOf(n);o>0&&!i.test(e.substring(0,o))&&(r=!0)}return r},fu=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!e)return;if(e[t])return e[t];const a=t.split(n);let i=e;for(let r=0;r<a.length;){if(!i||typeof i!="object")return;let o,s="";for(let l=r;l<a.length;++l)if(l!==r&&(s+=n),s+=a[l],o=i[s],o!==void 0){if(["string","number","boolean"].indexOf(typeof o)>-1&&l<a.length-1)continue;r+=l-r+1;break}i=o}return i},Go=e=>e&&e.replace("_","-"),F$={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console&&console[e]&&console[e].apply(console,t)}};class qo{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(t,n)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=t||F$,this.options=n,this.debug=n.debug}log(){for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return this.forward(n,"log","",!0)}warn(){for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return this.forward(n,"warn","",!0)}error(){for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return this.forward(n,"error","")}deprecate(){for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return this.forward(n,"warn","WARNING DEPRECATED: ",!0)}forward(t,n,a,i){return i&&!this.debug?null:(F(t[0])&&(t[0]=`${a}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new qo(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new qo(this.logger,t)}}var mt=new qo;class Jo{constructor(){this.observers={}}on(t,n){return t.split(" ").forEach(a=>{this.observers[a]||(this.observers[a]=new Map);const i=this.observers[a].get(n)||0;this.observers[a].set(n,i+1)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t].delete(n)}}emit(t){for(var n=arguments.length,a=new Array(n>1?n-1:0),i=1;i<n;i++)a[i-1]=arguments[i];this.observers[t]&&Array.from(this.observers[t].entries()).forEach(o=>{let[s,l]=o;for(let u=0;u<l;u++)s(...a)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(o=>{let[s,l]=o;for(let u=0;u<l;u++)s.apply(s,[t,...a])})}}class Wf extends Jo{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,a){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const r=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,o=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let s;t.indexOf(".")>-1?s=t.split("."):(s=[t,n],a&&(Array.isArray(a)?s.push(...a):F(a)&&r?s.push(...a.split(r)):s.push(a)));const l=Ko(this.data,s);return!l&&!n&&!a&&t.indexOf(".")>-1&&(t=s[0],n=s[1],a=s.slice(2).join(".")),l||!o||!F(a)?l:fu(this.data&&this.data[t]&&this.data[t][n],a,r)}addResource(t,n,a,i){let r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const o=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator;let s=[t,n];a&&(s=s.concat(o?a.split(o):a)),t.indexOf(".")>-1&&(s=t.split("."),i=n,n=s[1]),this.addNamespaces(n),Hf(this.data,s,i),r.silent||this.emit("added",t,n,a,i)}addResources(t,n,a){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const r in a)(F(a[r])||Array.isArray(a[r]))&&this.addResource(t,n,r,a[r],{silent:!0});i.silent||this.emit("added",t,n,a)}addResourceBundle(t,n,a,i,r){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},s=[t,n];t.indexOf(".")>-1&&(s=t.split("."),i=a,a=n,n=s[1]),this.addNamespaces(n);let l=Ko(this.data,s)||{};o.skipCopy||(a=JSON.parse(JSON.stringify(a))),i?Vf(l,a,r):l={...l,...a},Hf(this.data,s,l),o.silent||this.emit("added",t,n,a)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(t,n)}:this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(i=>n[i]&&Object.keys(n[i]).length>0)}toJSON(){return this.data}}var Kf={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,a,i){return e.forEach(r=>{this.processors[r]&&(t=this.processors[r].process(t,n,a,i))}),t}};const Gf={};class Qo extends Jo{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),C$(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=mt.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(t==null)return!1;const a=this.resolve(t,n);return a&&a.res!==void 0}extractFromKey(t,n){let a=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;a===void 0&&(a=":");const i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let r=n.ns||this.options.defaultNS||[];const o=a&&t.indexOf(a)>-1,s=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!D$(t,a,i);if(o&&!s){const l=t.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:t,namespaces:r};const u=t.split(a);(a!==i||a===i&&this.options.ns.indexOf(u[0])>-1)&&(r=u.shift()),t=u.join(i)}return F(r)&&(r=[r]),{key:t,namespaces:r}}translate(t,n,a){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const i=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,r=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:o,namespaces:s}=this.extractFromKey(t[t.length-1],n),l=s[s.length-1],u=n.lng||this.language,d=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&u.toLowerCase()==="cimode"){if(d){const x=n.nsSeparator||this.options.nsSeparator;return i?{res:`${l}${x}${o}`,usedKey:o,exactUsedKey:o,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(n)}:`${l}${x}${o}`}return i?{res:o,usedKey:o,exactUsedKey:o,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(n)}:o}const p=this.resolve(t,n);let m=p&&p.res;const g=p&&p.usedKey||o,b=p&&p.exactUsedKey||o,v=Object.prototype.toString.apply(m),h=["[object Number]","[object Function]","[object RegExp]"],f=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject,w=!F(m)&&typeof m!="boolean"&&typeof m!="number";if(y&&m&&w&&h.indexOf(v)<0&&!(F(f)&&Array.isArray(m))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const x=this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,m,{...n,ns:s}):`key '${o} (${this.language})' returned an object instead of string.`;return i?(p.res=x,p.usedParams=this.getUsedParamsDetails(n),p):x}if(r){const x=Array.isArray(m),C=x?[]:{},S=x?b:g;for(const E in m)if(Object.prototype.hasOwnProperty.call(m,E)){const $=`${S}${r}${E}`;C[E]=this.translate($,{...n,joinArrays:!1,ns:s}),C[E]===$&&(C[E]=m[E])}m=C}}else if(y&&F(f)&&Array.isArray(m))m=m.join(f),m&&(m=this.extendTranslation(m,t,n,a));else{let x=!1,C=!1;const S=n.count!==void 0&&!F(n.count),E=Qo.hasDefaultValue(n),$=S?this.pluralResolver.getSuffix(u,n.count,n):"",P=n.ordinal&&S?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",_=S&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),re=_&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${$}`]||n[`defaultValue${P}`]||n.defaultValue;!this.isValidLookup(m)&&E&&(x=!0,m=re),this.isValidLookup(m)||(C=!0,m=o);const te=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&C?void 0:m,pt=E&&re!==m&&this.options.updateMissing;if(C||x||pt){if(this.logger.log(pt?"updateKey":"missingKey",u,l,o,pt?re:m),r){const ge=this.resolve(o,{...n,keySeparator:!1});ge&&ge.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let Re=[];const ht=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ht&&ht[0])for(let ge=0;ge<ht.length;ge++)Re.push(ht[ge]);else this.options.saveMissingTo==="all"?Re=this.languageUtils.toResolveHierarchy(n.lng||this.language):Re.push(n.lng||this.language);const xa=(ge,et,Cn)=>{const T=E&&Cn!==m?Cn:te;this.options.missingKeyHandler?this.options.missingKeyHandler(ge,l,et,T,pt,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(ge,l,et,T,pt,n),this.emit("missingKey",ge,l,et,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&S?Re.forEach(ge=>{const et=this.pluralResolver.getSuffixes(ge,n);_&&n[`defaultValue${this.options.pluralSeparator}zero`]&&et.indexOf(`${this.options.pluralSeparator}zero`)<0&&et.push(`${this.options.pluralSeparator}zero`),et.forEach(Cn=>{xa([ge],o+Cn,n[`defaultValue${Cn}`]||re)})}):xa(Re,o,re))}m=this.extendTranslation(m,t,n,p,a),C&&m===o&&this.options.appendNamespaceToMissingKey&&(m=`${l}:${o}`),(C||x)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?m=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${o}`:o,x?m:void 0):m=this.options.parseMissingKeyHandler(m))}return i?(p.res=m,p.usedParams=this.getUsedParamsDetails(n),p):m}extendTranslation(t,n,a,i,r){var o=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...a},a.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!a.skipInterpolation){a.interpolation&&this.interpolator.init({...a,interpolation:{...this.options.interpolation,...a.interpolation}});const u=F(t)&&(a&&a.interpolation&&a.interpolation.skipOnVariables!==void 0?a.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let d;if(u){const m=t.match(this.interpolator.nestingRegexp);d=m&&m.length}let p=a.replace&&!F(a.replace)?a.replace:a;if(this.options.interpolation.defaultVariables&&(p={...this.options.interpolation.defaultVariables,...p}),t=this.interpolator.interpolate(t,p,a.lng||this.language||i.usedLng,a),u){const m=t.match(this.interpolator.nestingRegexp),g=m&&m.length;d<g&&(a.nest=!1)}!a.lng&&this.options.compatibilityAPI!=="v1"&&i&&i.res&&(a.lng=this.language||i.usedLng),a.nest!==!1&&(t=this.interpolator.nest(t,function(){for(var m=arguments.length,g=new Array(m),b=0;b<m;b++)g[b]=arguments[b];return r&&r[0]===g[0]&&!a.context?(o.logger.warn(`It seems you are nesting recursively key: ${g[0]} in key: ${n[0]}`),null):o.translate(...g,n)},a)),a.interpolation&&this.interpolator.reset()}const s=a.postProcess||this.options.postProcess,l=F(s)?[s]:s;return t!=null&&l&&l.length&&a.applyPostProcessor!==!1&&(t=Kf.handle(l,t,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(a)},...a}:a,this)),t}resolve(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a,i,r,o,s;return F(t)&&(t=[t]),t.forEach(l=>{if(this.isValidLookup(a))return;const u=this.extractFromKey(l,n),d=u.key;i=d;let p=u.namespaces;this.options.fallbackNS&&(p=p.concat(this.options.fallbackNS));const m=n.count!==void 0&&!F(n.count),g=m&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),b=n.context!==void 0&&(F(n.context)||typeof n.context=="number")&&n.context!=="",v=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);p.forEach(h=>{this.isValidLookup(a)||(s=h,!Gf[`${v[0]}-${h}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(s)&&(Gf[`${v[0]}-${h}`]=!0,this.logger.warn(`key "${i}" for languages "${v.join(", ")}" won't get resolved as namespace "${s}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),v.forEach(f=>{if(this.isValidLookup(a))return;o=f;const y=[d];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(y,d,f,h,n);else{let x;m&&(x=this.pluralResolver.getSuffix(f,n.count,n));const C=`${this.options.pluralSeparator}zero`,S=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(m&&(y.push(d+x),n.ordinal&&x.indexOf(S)===0&&y.push(d+x.replace(S,this.options.pluralSeparator)),g&&y.push(d+C)),b){const E=`${d}${this.options.contextSeparator}${n.context}`;y.push(E),m&&(y.push(E+x),n.ordinal&&x.indexOf(S)===0&&y.push(E+x.replace(S,this.options.pluralSeparator)),g&&y.push(E+C))}}let w;for(;w=y.pop();)this.isValidLookup(a)||(r=w,a=this.getResource(f,h,w,n))}))})}),{res:a,usedKey:i,exactUsedKey:r,usedLng:o,usedNS:s}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,a){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,n,a,i):this.resourceStore.getResource(t,n,a,i)}getUsedParamsDetails(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],a=t.replace&&!F(t.replace);let i=a?t.replace:t;if(a&&typeof t.count<"u"&&(i.count=t.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!a){i={...i};for(const r of n)delete i[r]}return i}static hasDefaultValue(t){const n="defaultValue";for(const a in t)if(Object.prototype.hasOwnProperty.call(t,a)&&n===a.substring(0,n.length)&&t[a]!==void 0)return!0;return!1}}const yu=e=>e.charAt(0).toUpperCase()+e.slice(1);class qf{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=mt.create("languageUtils")}getScriptPartFromCode(t){if(t=Go(t),!t||t.indexOf("-")<0)return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=Go(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(F(t)&&t.indexOf("-")>-1){if(typeof Intl<"u"&&typeof Intl.getCanonicalLocales<"u")try{let i=Intl.getCanonicalLocales(t)[0];if(i&&this.options.lowerCaseLng&&(i=i.toLowerCase()),i)return i}catch{}const n=["hans","hant","latn","cyrl","cans","mong","arab"];let a=t.split("-");return this.options.lowerCaseLng?a=a.map(i=>i.toLowerCase()):a.length===2?(a[0]=a[0].toLowerCase(),a[1]=a[1].toUpperCase(),n.indexOf(a[1].toLowerCase())>-1&&(a[1]=yu(a[1].toLowerCase()))):a.length===3&&(a[0]=a[0].toLowerCase(),a[1].length===2&&(a[1]=a[1].toUpperCase()),a[0]!=="sgn"&&a[2].length===2&&(a[2]=a[2].toUpperCase()),n.indexOf(a[1].toLowerCase())>-1&&(a[1]=yu(a[1].toLowerCase())),n.indexOf(a[2].toLowerCase())>-1&&(a[2]=yu(a[2].toLowerCase()))),a.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(a=>{if(n)return;const i=this.formatLanguageCode(a);(!this.options.supportedLngs||this.isSupportedCode(i))&&(n=i)}),!n&&this.options.supportedLngs&&t.forEach(a=>{if(n)return;const i=this.getLanguagePartFromCode(a);if(this.isSupportedCode(i))return n=i;n=this.options.supportedLngs.find(r=>{if(r===i)return r;if(!(r.indexOf("-")<0&&i.indexOf("-")<0)&&(r.indexOf("-")>0&&i.indexOf("-")<0&&r.substring(0,r.indexOf("-"))===i||r.indexOf(i)===0&&i.length>1))return r})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),F(t)&&(t=[t]),Array.isArray(t))return t;if(!n)return t.default||[];let a=t[n];return a||(a=t[this.getScriptPartFromCode(n)]),a||(a=t[this.formatLanguageCode(n)]),a||(a=t[this.getLanguagePartFromCode(n)]),a||(a=t.default),a||[]}toResolveHierarchy(t,n){const a=this.getFallbackCodes(n||this.options.fallbackLng||[],t),i=[],r=o=>{o&&(this.isSupportedCode(o)?i.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return F(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&r(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&r(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&r(this.getLanguagePartFromCode(t))):F(t)&&r(this.formatLanguageCode(t)),a.forEach(o=>{i.indexOf(o)<0&&r(this.formatLanguageCode(o))}),i}}let M$=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],_$={1:e=>+(e>1),2:e=>+(e!=1),3:e=>0,4:e=>e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2,5:e=>e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5,6:e=>e==1?0:e>=2&&e<=4?1:2,7:e=>e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2,8:e=>e==1?0:e==2?1:e!=8&&e!=11?2:3,9:e=>+(e>=2),10:e=>e==1?0:e==2?1:e<7?2:e<11?3:4,11:e=>e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3,12:e=>+(e%10!=1||e%100==11),13:e=>+(e!==0),14:e=>e==1?0:e==2?1:e==3?2:3,15:e=>e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2,16:e=>e%10==1&&e%100!=11?0:e!==0?1:2,17:e=>e==1||e%10==1&&e%100!=11?0:1,18:e=>e==0?0:e==1?1:2,19:e=>e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3,20:e=>e==1?0:e==0||e%100>0&&e%100<20?1:2,21:e=>e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0,22:e=>e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3};const R$=["v1","v2","v3"],Y$=["v4"],Jf={zero:0,one:1,two:2,few:3,many:4,other:5},U$=()=>{const e={};return M$.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:_$[t.fc]}})}),e};class L${constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=mt.create("pluralResolver"),(!this.options.compatibilityJSON||Y$.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=U$(),this.pluralRulesCache={}}addRule(t,n){this.rules[t]=n}clearCache(){this.pluralRulesCache={}}getRule(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{const a=Go(t==="dev"?"en":t),i=n.ordinal?"ordinal":"cardinal",r=JSON.stringify({cleanedCode:a,type:i});if(r in this.pluralRulesCache)return this.pluralRulesCache[r];const o=new Intl.PluralRules(a,{type:i});return this.pluralRulesCache[r]=o,o}catch{return}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}needsPlural(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const a=this.getRule(t,n);return this.shouldUseIntlApi()?a&&a.resolvedOptions().pluralCategories.length>1:a&&a.numbers.length>1}getPluralFormsOfKey(t,n){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,a).map(i=>`${n}${i}`)}getSuffixes(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const a=this.getRule(t,n);return a?this.shouldUseIntlApi()?a.resolvedOptions().pluralCategories.sort((i,r)=>Jf[i]-Jf[r]).map(i=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i}`):a.numbers.map(i=>this.getSuffix(t,i,n)):[]}getSuffix(t,n){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const i=this.getRule(t,a);return i?this.shouldUseIntlApi()?`${this.options.prepend}${a.ordinal?`ordinal${this.options.prepend}`:""}${i.select(n)}`:this.getSuffixRetroCompatible(i,n):(this.logger.warn(`no plural rule found for: ${t}`),"")}getSuffixRetroCompatible(t,n){const a=t.noAbs?t.plurals(n):t.plurals(Math.abs(n));let i=t.numbers[a];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(i===2?i="plural":i===1&&(i=""));const r=()=>this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString();return this.options.compatibilityJSON==="v1"?i===1?"":typeof i=="number"?`_plural_${i.toString()}`:r():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?r():this.options.prepend&&a.toString()?this.options.prepend+a.toString():a.toString()}shouldUseIntlApi(){return!R$.includes(this.options.compatibilityJSON)}}const Qf=function(e,t,n){let a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,r=P$(e,t,n);return!r&&i&&F(n)&&(r=fu(e,n,a),r===void 0&&(r=fu(t,n,a))),r},bu=e=>e.replace(/\$/g,"$$$$");class O${constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=mt.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||(n=>n),this.init(t)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});const{escape:n,escapeValue:a,useRawValueToEscape:i,prefix:r,prefixEscaped:o,suffix:s,suffixEscaped:l,formatSeparator:u,unescapeSuffix:d,unescapePrefix:p,nestingPrefix:m,nestingPrefixEscaped:g,nestingSuffix:b,nestingSuffixEscaped:v,nestingOptionsSeparator:h,maxReplaces:f,alwaysFormat:y}=t.interpolation;this.escape=n!==void 0?n:N$,this.escapeValue=a!==void 0?a:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=r?va(r):o||"{{",this.suffix=s?va(s):l||"}}",this.formatSeparator=u||",",this.unescapePrefix=d?"":p||"-",this.unescapeSuffix=this.unescapePrefix?"":d||"",this.nestingPrefix=m?va(m):g||va("$t("),this.nestingSuffix=b?va(b):v||va(")"),this.nestingOptionsSeparator=h||",",this.maxReplaces=f||1e3,this.alwaysFormat=y!==void 0?y:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(n,a)=>n&&n.source===a?(n.lastIndex=0,n):new RegExp(a,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(t,n,a,i){let r,o,s;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=g=>{if(g.indexOf(this.formatSeparator)<0){const f=Qf(n,l,g,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(f,void 0,a,{...i,...n,interpolationkey:g}):f}const b=g.split(this.formatSeparator),v=b.shift().trim(),h=b.join(this.formatSeparator).trim();return this.format(Qf(n,l,v,this.options.keySeparator,this.options.ignoreJSONStructure),h,a,{...i,...n,interpolationkey:v})};this.resetRegExp();const d=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,p=i&&i.interpolation&&i.interpolation.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:g=>bu(g)},{regex:this.regexp,safeValue:g=>this.escapeValue?bu(this.escape(g)):bu(g)}].forEach(g=>{for(s=0;r=g.regex.exec(t);){const b=r[1].trim();if(o=u(b),o===void 0)if(typeof d=="function"){const h=d(t,r,i);o=F(h)?h:""}else if(i&&Object.prototype.hasOwnProperty.call(i,b))o="";else if(p){o=r[0];continue}else this.logger.warn(`missed to pass in variable ${b} for interpolating ${t}`),o="";else!F(o)&&!this.useRawValueToEscape&&(o=Lf(o));const v=g.safeValue(o);if(t=t.replace(r[0],v),p?(g.regex.lastIndex+=o.length,g.regex.lastIndex-=r[0].length):g.regex.lastIndex=0,s++,s>=this.maxReplaces)break}}),t}nest(t,n){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,r,o;const s=(l,u)=>{const d=this.nestingOptionsSeparator;if(l.indexOf(d)<0)return l;const p=l.split(new RegExp(`${d}[ ]*{`));let m=`{${p[1]}`;l=p[0],m=this.interpolate(m,o);const g=m.match(/'/g),b=m.match(/"/g);(g&&g.length%2===0&&!b||b.length%2!==0)&&(m=m.replace(/'/g,'"'));try{o=JSON.parse(m),u&&(o={...u,...o})}catch(v){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,v),`${l}${d}${m}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,l};for(;i=this.nestingRegexp.exec(t);){let l=[];o={...a},o=o.replace&&!F(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let u=!1;if(i[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(i[1])){const d=i[1].split(this.formatSeparator).map(p=>p.trim());i[1]=d.shift(),l=d,u=!0}if(r=n(s.call(this,i[1].trim(),o),o),r&&i[0]===t&&!F(r))return r;F(r)||(r=Lf(r)),r||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${t}`),r=""),u&&(r=l.reduce((d,p)=>this.format(d,p,a.lng,{...a,interpolationkey:i[1].trim()}),r.trim())),t=t.replace(i[0],r),this.regexp.lastIndex=0}return t}}const B$=e=>{let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const a=e.split("(");t=a[0].toLowerCase().trim();const i=a[1].substring(0,a[1].length-1);t==="currency"&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):t==="relativetime"&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach(o=>{if(o){const[s,...l]=o.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,""),d=s.trim();n[d]||(n[d]=u),u==="false"&&(n[d]=!1),u==="true"&&(n[d]=!0),isNaN(u)||(n[d]=parseInt(u,10))}})}return{formatName:t,formatOptions:n}},wa=e=>{const t={};return(n,a,i)=>{let r=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(r={...r,[i.interpolationkey]:void 0});const o=a+JSON.stringify(r);let s=t[o];return s||(s=e(Go(a),i),t[o]=s),s(n)}};class H${constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=mt.create("formatter"),this.options=t,this.formats={number:wa((n,a)=>i=>new Intl.NumberFormat(n,{...a}).format(i)),currency:wa((n,a)=>i=>new Intl.NumberFormat(n,{...a,style:"currency"}).format(i)),datetime:wa((n,a)=>i=>new Intl.DateTimeFormat(n,{...a}).format(i)),relativetime:wa((n,a)=>i=>new Intl.RelativeTimeFormat(n,{...a}).format(i,a.range||"day")),list:wa((n,a)=>i=>new Intl.ListFormat(n,{...a}).format(i))},this.init(t)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};this.formatSeparator=n.interpolation.formatSeparator||","}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=wa(n)}format(t,n,a){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const r=n.split(this.formatSeparator);if(r.length>1&&r[0].indexOf("(")>1&&r[0].indexOf(")")<0&&r.find(s=>s.indexOf(")")>-1)){const s=r.findIndex(l=>l.indexOf(")")>-1);r[0]=[r[0],...r.splice(1,s)].join(this.formatSeparator)}return r.reduce((s,l)=>{const{formatName:u,formatOptions:d}=B$(l);if(this.formats[u]){let p=s;try{const m=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},g=m.locale||m.lng||i.locale||i.lng||a;p=this.formats[u](s,g,{...d,...i,...m})}catch(m){this.logger.warn(m)}return p}else this.logger.warn(`there was no format function for ${u}`);return s},t)}}const V$=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class W$ extends Jo{constructor(t,n,a){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=t,this.store=n,this.services=a,this.languageUtils=a.languageUtils,this.options=i,this.logger=mt.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(a,i.backend,i)}queueLoad(t,n,a,i){const r={},o={},s={},l={};return t.forEach(u=>{let d=!0;n.forEach(p=>{const m=`${u}|${p}`;!a.reload&&this.store.hasResourceBundle(u,p)?this.state[m]=2:this.state[m]<0||(this.state[m]===1?o[m]===void 0&&(o[m]=!0):(this.state[m]=1,d=!1,o[m]===void 0&&(o[m]=!0),r[m]===void 0&&(r[m]=!0),l[p]===void 0&&(l[p]=!0)))}),d||(s[u]=!0)}),(Object.keys(r).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(r),pending:Object.keys(o),toLoadLanguages:Object.keys(s),toLoadNamespaces:Object.keys(l)}}loaded(t,n,a){const i=t.split("|"),r=i[0],o=i[1];n&&this.emit("failedLoading",r,o,n),!n&&a&&this.store.addResourceBundle(r,o,a,void 0,void 0,{skipCopy:!0}),this.state[t]=n?-1:2,n&&a&&(this.state[t]=0);const s={};this.queue.forEach(l=>{j$(l.loaded,[r],o),V$(l,t),n&&l.errors.push(n),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{s[u]||(s[u]={});const d=l.loaded[u];d.length&&d.forEach(p=>{s[u][p]===void 0&&(s[u][p]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",s),this.queue=this.queue.filter(l=>!l.done)}read(t,n,a){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,o=arguments.length>5?arguments[5]:void 0;if(!t.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:a,tried:i,wait:r,callback:o});return}this.readingCalls++;const s=(u,d)=>{if(this.readingCalls--,this.waitingReads.length>0){const p=this.waitingReads.shift();this.read(p.lng,p.ns,p.fcName,p.tried,p.wait,p.callback)}if(u&&d&&i<this.maxRetries){setTimeout(()=>{this.read.call(this,t,n,a,i+1,r*2,o)},r);return}o(u,d)},l=this.backend[a].bind(this.backend);if(l.length===2){try{const u=l(t,n);u&&typeof u.then=="function"?u.then(d=>s(null,d)).catch(s):s(null,u)}catch(u){s(u)}return}return l(t,n,s)}prepareLoading(t,n){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();F(t)&&(t=this.languageUtils.toResolveHierarchy(t)),F(n)&&(n=[n]);const r=this.queueLoad(t,n,a,i);if(!r.toLoad.length)return r.pending.length||i(),null;r.toLoad.forEach(o=>{this.loadOne(o)})}load(t,n,a){this.prepareLoading(t,n,{},a)}reload(t,n,a){this.prepareLoading(t,n,{reload:!0},a)}loadOne(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const a=t.split("|"),i=a[0],r=a[1];this.read(i,r,"read",void 0,void 0,(o,s)=>{o&&this.logger.warn(`${n}loading namespace ${r} for language ${i} failed`,o),!o&&s&&this.logger.log(`${n}loaded namespace ${r} for language ${i}`,s),this.loaded(t,o,s)})}saveMissing(t,n,a,i,r){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${a}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(a==null||a==="")){if(this.backend&&this.backend.create){const l={...o,isUpdate:r},u=this.backend.create.bind(this.backend);if(u.length<6)try{let d;u.length===5?d=u(t,n,a,i,l):d=u(t,n,a,i),d&&typeof d.then=="function"?d.then(p=>s(null,p)).catch(s):s(null,d)}catch(d){s(d)}else u(t,n,a,i,s,l)}!t||!t[0]||this.store.addResource(t[0],n,a,i)}}}const Zf=()=>({debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),F(e[1])&&(t.defaultValue=e[1]),F(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const n=e[3]||e[2];Object.keys(n).forEach(a=>{t[a]=n[a]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),Xf=e=>(F(e.ns)&&(e.ns=[e.ns]),F(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),F(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),Zo=()=>{},K$=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class Yi extends Jo{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=Xf(t),this.services={},this.logger=mt,this.modules={external:[]},K$(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initImmediate)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(){var t=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},a=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof n=="function"&&(a=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(F(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const i=Zf();this.options={...i,...this.options,...Xf(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...i.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);const r=d=>d?typeof d=="function"?new d:d:null;if(!this.options.isClone){this.modules.logger?mt.init(r(this.modules.logger),this.options):mt.init(null,this.options);let d;this.modules.formatter?d=this.modules.formatter:typeof Intl<"u"&&(d=H$);const p=new qf(this.options);this.store=new Wf(this.options.resources,this.options);const m=this.services;m.logger=mt,m.resourceStore=this.store,m.languageUtils=p,m.pluralResolver=new L$(p,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),d&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(m.formatter=r(d),m.formatter.init(m,this.options),this.options.interpolation.format=m.formatter.format.bind(m.formatter)),m.interpolator=new O$(this.options),m.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},m.backendConnector=new W$(r(this.modules.backend),m.resourceStore,m,this.options),m.backendConnector.on("*",function(g){for(var b=arguments.length,v=new Array(b>1?b-1:0),h=1;h<b;h++)v[h-1]=arguments[h];t.emit(g,...v)}),this.modules.languageDetector&&(m.languageDetector=r(this.modules.languageDetector),m.languageDetector.init&&m.languageDetector.init(m,this.options.detection,this.options)),this.modules.i18nFormat&&(m.i18nFormat=r(this.modules.i18nFormat),m.i18nFormat.init&&m.i18nFormat.init(this)),this.translator=new Qo(this.services,this.options),this.translator.on("*",function(g){for(var b=arguments.length,v=new Array(b>1?b-1:0),h=1;h<b;h++)v[h-1]=arguments[h];t.emit(g,...v)}),this.modules.external.forEach(g=>{g.init&&g.init(this)})}if(this.format=this.options.interpolation.format,a||(a=Zo),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const d=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);d.length>0&&d[0]!=="dev"&&(this.options.lng=d[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(d=>{this[d]=function(){return t.store[d](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(d=>{this[d]=function(){return t.store[d](...arguments),t}});const l=_i(),u=()=>{const d=(p,m)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(m),a(p,m)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return d(null,this.t.bind(this));this.changeLanguage(this.options.lng,d)};return this.options.resources||!this.options.initImmediate?u():setTimeout(u,0),l}loadResources(t){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Zo;const i=F(t)?t:this.language;if(typeof t=="function"&&(a=t),!this.options.resources||this.options.partialBundledLanguages){if(i&&i.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return a();const r=[],o=s=>{if(!s||s==="cimode")return;this.services.languageUtils.toResolveHierarchy(s).forEach(u=>{u!=="cimode"&&r.indexOf(u)<0&&r.push(u)})};i?o(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>o(l)),this.options.preload&&this.options.preload.forEach(s=>o(s)),this.services.backendConnector.load(r,this.options.ns,s=>{!s&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),a(s)})}else a(null)}reloadResources(t,n,a){const i=_i();return typeof t=="function"&&(a=t,t=void 0),typeof n=="function"&&(a=n,n=void 0),t||(t=this.languages),n||(n=this.options.ns),a||(a=Zo),this.services.backendConnector.reload(t,n,r=>{i.resolve(),a(r)}),i}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&Kf.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1))for(let n=0;n<this.languages.length;n++){const a=this.languages[n];if(!(["cimode","dev"].indexOf(a)>-1)&&this.store.hasLanguageSomeTranslations(a)){this.resolvedLanguage=a;break}}}changeLanguage(t,n){var a=this;this.isLanguageChangingTo=t;const i=_i();this.emit("languageChanging",t);const r=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},o=(l,u)=>{u?(r(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,i.resolve(function(){return a.t(...arguments)}),n&&n(l,function(){return a.t(...arguments)})},s=l=>{!t&&!l&&this.services.languageDetector&&(l=[]);const u=F(l)?l:this.services.languageUtils.getBestMatchFromCodes(l);u&&(this.language||r(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(u)),this.loadResources(u,d=>{o(d,u)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?s(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(s):this.services.languageDetector.detect(s):s(t),i}getFixedT(t,n,a){var i=this;const r=function(o,s){let l;if(typeof s!="object"){for(var u=arguments.length,d=new Array(u>2?u-2:0),p=2;p<u;p++)d[p-2]=arguments[p];l=i.options.overloadTranslationOptionHandler([o,s].concat(d))}else l={...s};l.lng=l.lng||r.lng,l.lngs=l.lngs||r.lngs,l.ns=l.ns||r.ns,l.keyPrefix!==""&&(l.keyPrefix=l.keyPrefix||a||r.keyPrefix);const m=i.options.keySeparator||".";let g;return l.keyPrefix&&Array.isArray(o)?g=o.map(b=>`${l.keyPrefix}${m}${b}`):g=l.keyPrefix?`${l.keyPrefix}${m}${o}`:o,i.t(g,l)};return F(t)?r.lng=t:r.lngs=t,r.ns=n,r.keyPrefix=a,r}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const a=n.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,r=this.languages[this.languages.length-1];if(a.toLowerCase()==="cimode")return!0;const o=(s,l)=>{const u=this.services.backendConnector.state[`${s}|${l}`];return u===-1||u===0||u===2};if(n.precheck){const s=n.precheck(this,o);if(s!==void 0)return s}return!!(this.hasResourceBundle(a,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(a,t)&&(!i||o(r,t)))}loadNamespaces(t,n){const a=_i();return this.options.ns?(F(t)&&(t=[t]),t.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{a.resolve(),n&&n(i)}),a):(n&&n(),Promise.resolve())}loadLanguages(t,n){const a=_i();F(t)&&(t=[t]);const i=this.options.preload||[],r=t.filter(o=>i.indexOf(o)<0&&this.services.languageUtils.isSupportedCode(o));return r.length?(this.options.preload=i.concat(r),this.loadResources(o=>{a.resolve(),n&&n(o)}),a):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!t)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],a=this.services&&this.services.languageUtils||new qf(Zf());return n.indexOf(a.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new Yi(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Zo;const a=t.forkResourceStore;a&&delete t.forkResourceStore;const i={...this.options,...t,isClone:!0},r=new Yi(i);return(t.debug!==void 0||t.prefix!==void 0)&&(r.logger=r.logger.clone(t)),["store","services","language"].forEach(s=>{r[s]=this[s]}),r.services={...this.services},r.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},a&&(r.store=new Wf(this.store.data,i),r.services.resourceStore=r.store),r.translator=new Qo(r.services,i),r.translator.on("*",function(s){for(var l=arguments.length,u=new Array(l>1?l-1:0),d=1;d<l;d++)u[d-1]=arguments[d];r.emit(s,...u)}),r.init(i,n),r.translator.options=i,r.translator.backendConnector.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},r}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const ey=Yi.createInstance();ey.createInstance=Yi.createInstance;var G$=ey;const q$=G$,ty=["af","ar","bg","bn","bs","ca","cs","da","de","de-CH","el","en","eo","es","et","fa","fi","fr","gd","hi","hr","hu","id","is","it","ja","ko","kz","lt","mk","mn","ms","nl","nn","no","pl","pt","pt-BR","ro","ru","si","sk","sl","sq","sr","sr-Cyrl","sv","th","tr","uk","ur","uz","vi","zh","zh-Hant","sw","ta"];gu.exports=(e="en",t="portal")=>{const n=q$.createInstance();return n.init({lng:e,nsSeparator:!1,keySeparator:!1,returnEmptyString:!1,fallbackLng:!1,ns:t,defaultNS:t,resources:ty.reduce((a,i)=>{const r=MS("/ghost/i18n/lib")(`../locales/${i}/${t}.json`);return a[i]={[t]:{...r,...r.default&&typeof r.default=="object"?r.default:{}}},a},{})}),n},gu.exports.SUPPORTED_LOCALES=ty;var J$=gu.exports,Q$=J$;const ku=Ae(Q$);function Z$({event:e,form:t,errorEl:n,siteUrl:a,submitHandler:i},r=o=>o){var y;t.removeEventListener("submit",i),e.preventDefault(),n&&(n.innerText=""),t.classList.remove("success","invalid","error");let o=e.target.querySelector("input[data-members-email]"),s=e.target.querySelector("input[data-members-name]"),l=((y=t==null?void 0:t.dataset)==null?void 0:y.membersAutoredirect)||"true",u=o==null?void 0:o.value,d=s&&s.value||void 0,p,m=[],g=[],b=e.target.querySelectorAll("input[data-members-label]")||[];for(let w=0;w<b.length;++w)m.push(b[w].value);let v=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 w=0;w<v.length;++w)g.push({name:v[w].value});t.dataset.membersForm&&(p=t.dataset.membersForm),t.classList.add("loading");const h=Ai(),f={email:u,emailType:p,labels:m,name:d,autoRedirect:l==="true"};return h&&(f.urlHistory=h),v.length>0?f.newsletters=g:(e.target.querySelectorAll("input[type=checkbox][data-members-newsletter]")||[]).length>0&&(f.newsletters=[]),fetch(`${a}/members/api/integrity-token/`,{method:"GET"}).then(w=>w.text()).then(w=>fetch(`${a}/members/api/send-magic-link/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...f,integrityToken:w})})).then(function(w){if(t.addEventListener("submit",i),t.classList.remove("loading"),w.ok)t.classList.add("success");else return Sn.fromApiResponse(w).then(x=>{throw x})}).catch(w=>{n&&(n.innerText=Lo(w,r("There was an error sending the email, please try again"),r)),t.classList.add("error")})}function X$({event:e,el:t,errorEl:n,siteUrl:a,site:i,member:r,clickHandler:o}){const s=i.locale|"en",u=ku(s,"portal").t;t.removeEventListener("click",o),e.preventDefault();let d=t.dataset.membersPlan,p=mE(i,d.toLowerCase()),m=t.dataset.membersSuccess,g=t.dataset.membersCancel,b,v;m&&(b=new URL(m,window.location.href).href),g&&(v=new URL(g,window.location.href).href),n&&(n.innerText=""),t.classList.add("loading");const h=r?{checkoutType:"upgrade"}:{},f=Ai();return f&&(h.urlHistory=f),fetch(`${a}/members/api/session`,{credentials:"same-origin"}).then(function(y){return y.ok?y.text():null}).then(function(y){return fetch(`${a}/members/api/create-stripe-checkout-session/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...p,identity:y,successUrl:b,cancelUrl:v,metadata:h})}).then(function(w){if(!w.ok)throw new Error(u("Could not create stripe checkout session"));return w.json()})}).then(function(y){return y.url?window.location.assign(y.url):window.Stripe(y.publicKey).redirectToCheckout({sessionId:y.sessionId}).then(function(x){if(x.error)throw new Error(x.error.message)})}).catch(function(y){console.error(y),t.addEventListener("click",o),t.classList.remove("loading"),n&&(n.innerText=y.message),t.classList.add("error")})}function ej({siteUrl:e,site:t,member:n}){const a=t.locale|"en",r=ku(a,"portal").t;e&&(e=e.replace(/\/$/,""),Array.prototype.forEach.call(document.querySelectorAll("form[data-members-form]"),function(o){let s=o.querySelector("[data-members-error]");function l(u){Z$({event:u,errorEl:s,form:o,siteUrl:e,submitHandler:l},r)}o.addEventListener("submit",l)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-plan]"),function(o){let s=o.querySelector("[data-members-error]");function l(u){X$({el:o,event:u,errorEl:s,member:n,site:t,siteUrl:e,clickHandler:l})}o.addEventListener("click",l)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-edit-billing]"),function(o){let s=o.querySelector("[data-members-error]"),l=o.dataset.membersSuccess,u=o.dataset.membersCancel,d,p;l&&(d=new URL(l,window.location.href).href),u&&(p=new URL(u,window.location.href).href);function m(g){o.removeEventListener("click",m),g.preventDefault(),s&&(s.innerText=""),o.classList.add("loading"),fetch(`${e}/members/api/session`,{credentials:"same-origin"}).then(function(b){return b.ok?b.text():null}).then(function(b){return fetch(`${e}/members/api/create-stripe-update-session/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:b,successUrl:d,cancelUrl:p})}).then(function(v){if(!v.ok)throw new Error(r("Could not create stripe checkout session"));return v.json()})}).then(function(b){return window.Stripe(b.publicKey).redirectToCheckout({sessionId:b.sessionId})}).then(function(b){if(b.error)throw new Error(r(b.error.message))}).catch(function(b){console.error(b),o.addEventListener("click",m),o.classList.remove("loading"),s&&(s.innerText=b.message),o.classList.add("error")})}o.addEventListener("click",m)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-signout]"),function(o){function s(l){o.removeEventListener("click",s),l.preventDefault(),o.classList.remove("error"),o.classList.add("loading"),fetch(`${e}/members/api/session`,{method:"DELETE"}).then(function(u){u.ok?window.location.replace(e):(o.addEventListener("click",s),o.classList.remove("loading"),o.classList.add("error"))})}o.addEventListener("click",s)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-cancel-subscription]"),function(o){let s=o.parentElement.querySelector("[data-members-error]");function l(u){o.removeEventListener("click",l),u.preventDefault(),o.classList.remove("error"),o.classList.add("loading");let d=o.dataset.membersCancelSubscription;return s&&(s.innerText=""),fetch(`${e}/members/api/session`,{credentials:"same-origin"}).then(function(p){return p.ok?p.text():null}).then(function(p){return fetch(`${e}/members/api/subscriptions/${d}/`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:p,smart_cancel:!0})})}).then(function(p){p.ok?window.location.reload():(o.addEventListener("click",l),o.classList.remove("loading"),o.classList.add("error"),s&&(s.innerText=r("There was an error cancelling your subscription, please try again.")))})}o.addEventListener("click",l)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-continue-subscription]"),function(o){let s=o.parentElement.querySelector("[data-members-error]");function l(u){o.removeEventListener("click",l),u.preventDefault(),o.classList.remove("error"),o.classList.add("loading");let d=o.dataset.membersContinueSubscription;return s&&(s.innerText=""),fetch(`${e}/members/api/session`,{credentials:"same-origin"}).then(function(p){return p.ok?p.text():null}).then(function(p){return fetch(`${e}/members/api/subscriptions/${d}/`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({identity:p,cancel_at_period_end:!1})})}).then(function(p){p.ok?window.location.reload():(o.addEventListener("click",l),o.classList.remove("loading"),o.classList.add("error"),s&&(s.innerText=r("There was an error continuing your subscription, please try again.")))})}o.addEventListener("click",l)}))}const tj={showPopup:!0,site:ka,member:Wo.free,page:"accountEmail",...q0(),pageData:Yf};function nj({site:e,children:t}){const{portal_sentry:n}=e||{};return n&&n.dsn?c.jsx(Lc,{children:t}):c.jsx(c.Fragment,{children:t})}class aj extends U.Component{constructor(t){super(t),this.setupCustomTriggerButton(t),this.state={site:null,member:null,page:"loading",showPopup:!1,action:"init:running",initStatus:"running",lastPage:null,customSiteUrl:t.customSiteUrl}}componentDidMount(){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,window.document.body.style.overflow="hidden"):window.document.body.style.overflow=this.bodyScroll||""}catch{}}if(this.state.initStatus==="success"&&n.initStatus!==this.state.initStatus){const{siteUrl:o}=this.props,s=this.getContextFromState();this.sendPortalReadyEvent(),ej({siteUrl:o,site:s.site,member:s.member})}}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:{}},"*")}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,page:a,showPopup:i,popupNotification:r,lastPage:o,pageQuery:s,pageData:l}=await this.fetchData(),u=this.props.siteI18nEnabled?t.locale:"en",d=ku(u,"portal"),p={site:t,member:n,page:a,lastPage:o,pageQuery:s,showPopup:i,pageData:l,popupNotification:r,t:d.t,dir:d.dir()||"ltr",action:"init:success",initStatus:"success"};if(this.handleSignupQuery({site:t,pageQuery:s,member:n}),this.setState(p),this.hashHandler=()=>{this.updateStateForPreviewLinks()},window.addEventListener("hashchange",this.hashHandler,!1),!n){const m=document.querySelectorAll("[data-lexical-signup-form]");m.length>0&&m.forEach(g=>{g.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}=await this.fetchApiData(),{site:a,...i}=this.fetchDevData(),{site:r,...o}=this.fetchLinkData(t,n),{site:s,...l}=this.fetchPreviewData(),{site:u,...d}=this.fetchNotificationData();return{member:n,page:"",site:{...t,...r,...s,...u,...a,plans:{...(a||{}).plans,...(t||{}).plans,...(s||{}).plans}},...i,...o,...d,...l}}fetchDevData(){return G(["dev"])&&!this.state.customSiteUrl?tj:G(["test"])?{showPopup:this.props.showPopup!==void 0?this.props.showPopup:!0}:{}}fetchOfferQueryStrData(t=""){const n=new URLSearchParams(t),a={};for(let i of n.entries()){const r=i[0],o=decodeURIComponent(i[1]);r==="name"?a.name=o||"":r==="code"?a.code=o||"":r==="display_title"?a.display_title=o||"":r==="display_description"?a.display_description=o||"":r==="type"?a.type=o||"":r==="cadence"?a.cadence=o||"":r==="duration"?a.duration=o||"":r==="duration_in_months"&&!isNaN(Number(o))?a.duration_in_months=Number(o):r==="amount"&&!isNaN(Number(o))?a.amount=Number(o):r==="currency"?a.currency=o||"":r==="status"?a.status=o||"":r==="tier_id"&&(a.tier={id:o||Yf.tier.id})}return{page:"offer",pageData:a}}fetchQueryStrData(t=""){const n=new URLSearchParams(t),a={site:{plans:{}}},i=[];let r,o=null,s,l,u;for(let d of n.entries()){const p=d[0],m=decodeURIComponent(d[1]);if(p==="button")a.site.portal_button=JSON.parse(m);else if(p==="name")a.site.portal_name=JSON.parse(m);else if(p==="isFree"&&JSON.parse(m))i.push("free");else if(p==="isMonthly"&&JSON.parse(m))i.push("monthly");else if(p==="isYearly"&&JSON.parse(m))i.push("yearly");else if(p==="portalPrices")r=m?m.split(","):[];else if(p==="portalProducts")o=m?m.split(","):[];else if(p==="page"&&m)a.page=m;else if(p==="accentColor"&&(m===""||m))a.site.accent_color=m;else if(p==="buttonIcon"&&m)a.site.portal_button_icon=m;else if(p==="signupButtonText")a.site.portal_button_signup_text=m||"";else if(p==="signupTermsHtml")a.site.portal_signup_terms_html=m||"";else if(p==="signupCheckboxRequired")a.site.portal_signup_checkbox_required=JSON.parse(m);else if(p==="buttonStyle"&&m)a.site.portal_button_style=m;else if(p==="monthlyPrice"&&!isNaN(Number(m)))a.site.plans.monthly=Number(m),s=Number(m);else if(p==="yearlyPrice"&&!isNaN(Number(m)))a.site.plans.yearly=Number(m),l=Number(m);else if(p==="currency"&&m){const g=m.toUpperCase();a.site.plans.currency=g,a.site.plans.currency_symbol=pe(g),u=g}else p==="disableBackground"?a.site.disableBackground=JSON.parse(m):p==="allowSelfSignup"?a.site.allow_self_signup=JSON.parse(m):p==="membersSignupAccess"&&m?a.site.members_signup_access=m:p==="portalDefaultPlan"&&m&&(a.site.portal_default_plan=m)}return a.site.portal_plans=i,a.site.portal_products=o,r?a.site.portal_plans=r:s&&l&&u&&(a.site.prices=[{id:"monthly",stripe_price_id:"dummy_stripe_monthly",stripe_product_id:"dummy_stripe_product",active:1,nickname:"Monthly",currency:u,amount:s,type:"recurring",interval:"month"},{id:"yearly",stripe_price_id:"dummy_stripe_yearly",stripe_product_id:"dummy_stripe_product",active:1,nickname:"Yearly",currency:u,amount:l,type:"recurring",interval:"year"}]),a}fetchNotificationData(){const{type:t,status:n,duration:a,autoHide:i,closeable:r}=Og({billingOnly:!0})||{};return["stripe:billing-update"].includes(t)?n==="success"?{showPopup:!0,popupNotification:Q({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(hE({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$/,u=/^offers\/(\w+?)\/?$/,d=/^\/portal\/?(?:\/(\w+(?:\/\w+)*))?\/?$/,p=/^\/feedback\/(\w+?)\/(\w+?)\/?$/;if(i&&p.test(i)){const[,m,g]=i.match(p),b=parseInt(g);if(b===1||b===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:m,score:b}}:{showPopup:!0,page:"signin",pageData:{redirect:t.url+`#/feedback/${m}/${b}/`}}}if(i&&d.test(i)){const[,m]=i.match(d),{page:g,pageQuery:b,pageData:v}=this.getPageFromLinkPath(m,t)||{},h=["accountPlan","accountProfile"].includes(g)?"accountHome":null;return{showPopup:!(["monthly","yearly"].includes(b)||s.test(b)||l.test(b)||u.test(b)),...g?{page:g}:{},...b?{pageQuery:b}:{},...v?{pageData:v}:{},...h?{lastPage:h}:{}}}return{}}fetchPreviewData(){const[,t]=window.location.hash.substr(1).split("?");if(G(["preview"])){let n={};return G(["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||Oo({siteUrl:t,apiUrl:a,apiKey:i});const{site:r,member:o}=await this.GhostApi.init(),s=this.getColorOverride();return s&&(r.accent_color=s),this.setupFirstPromoter({site:r,member:o}),this.setupSentry({site:r}),{site:r,member:o}}catch(r){if(G(["dev","test"],{customSiteUrl:n}))return{};throw r}}setupSentry({site:t}){if(G(["test"]))return null;const{portal_sentry:n,portal_version:a,version:i}=t,o=`portal@2.46.0|ghost@${i}`;n&&n.dsn&&RS({dsn:n.dsn,environment:n.env||"development",release:o,beforeSend:s=>iE({event:s})?s:null,allowUrls:[/https?:\/\/((www)\.)?unpkg\.com\/@tryghost\/portal/]})}setupFirstPromoter({site:t,member:n}){if(G(["test"]))return null;const a=vE({site:t});let i=Xc({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),NE({member:n})){const l=n.email,u=n.uuid;if(window.$FPROM)window.$FPROM.trackSignup({email:l,uid:u});else{const d=window._fprom||[];window._fprom=d,d.push(["event","signup"]),d.push(["email",l]),d.push(["uid",u])}}}catch{}};const o=document.getElementsByTagName("script")[0];o.parentNode.insertBefore(r,o)}}async dispatchAction(t,n){clearTimeout(this.timeoutId),this.setState({action:`${t}:running`});try{const a=await E$({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=Q({type:`${t}:failed`,autoHide:!0,closeable:!0,status:"error",state:this.state,meta:{error:a}});this.setState({action:`${t}:failed`,popupNotification:i})}}updateStateForPreviewLinks(){const{site:t,...n}=this.fetchPreviewData(),{site:a,...i}=this.fetchLinkData(),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(Wc(),!ut({member:a}))try{const r=await this.GhostApi.site.offer({offerId:n}),o=r==null?void 0:r.offers[0];if(CE({site:t,offer:o}))if(i)this.dispatchAction("openPopup",{page:"offer",pageData:r==null?void 0:r.offers[0]});else{const s=pa({site:t,productId:o.tier.id}),l=o.cadence==="month"?s.monthlyPrice:s.yearlyPrice;if(this.dispatchAction("openPopup",{page:"loading"}),a){const{tierId:u,cadence:d}=xn({site:t,priceId:l.id});this.dispatchAction("checkoutPlan",{plan:l.id,offerId:n,tierId:u,cadence:d})}else{const{tierId:u,cadence:d}=xn({site:t,priceId:l.id});this.dispatchAction("signup",{plan:l.id,offerId:n,tierId:u,cadence:d})}}}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}Fg({site:t,pageQuery:n})&&(r=Fg({site:t,pageQuery:n}));const o=pE({site:t,priceId:r});if(n&&n!=="free"){Wc();const s=(o==null?void 0:o.id)||r;s!=="free"&&this.dispatchAction("openPopup",{page:"loading"});const{tierId:l,cadence:u}=xn({site:t,priceId:s});this.dispatchAction("signup",{plan:s,tierId:l,cadence:u})}}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 t}getContextPage({site:t,page:n,member:a}){if(!n||n==="default"){const i=dt({site:t})?"signin":"signup";n=a?"accountHome":i}return n==="accountPlan"&&Qt({member:a})&&!Ti({member:a})&&(n="accountHome"),mu({page:n})}getContextMember({page:t,member:n,customSiteUrl:a}){return G(["dev","preview"],{customSiteUrl:a})?L0({page:t})||O0({page:t})?G(["dev"],{customSiteUrl:a})?n||Wo.free:G(["preview"])?Wo.preview:Wo.paid:null:n}getContextFromState(){const{site:t,member:n,action:a,page:i,lastPage:r,showPopup:o,pageQuery:s,pageData:l,popupNotification:u,customSiteUrl:d,t:p,dir:m}=this.state,g=this.getContextPage({site:t,page:i,member:n}),b=this.getContextMember({page:g,member:n,customSiteUrl:d});return{api:this.GhostApi,site:t,action:a,brandColor:this.getAccentColor(),page:g,pageQuery:s,pageData:l,member:b,lastPage:r,showPopup:o,popupNotification:u,customSiteUrl:d,t:p,dir:m,onAction:(v,h)=>this.dispatchAction(v,h)}}getRecommendationButtons(){const t="[data-recommendation]";return document.querySelectorAll(t)||[]}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(J0)}render(){return this.state.initStatus==="success"?c.jsx(nj,{site:this.state.site,children:c.jsxs(N.Provider,{value:this.getContextFromState(),children:[c.jsx(Df,{}),c.jsx(Ug,{}),c.jsx(Hg,{})]})}):null}}const ny="ghost-portal-root";function ij(){const e=document.createElement("div");e.id=ny,document.body.appendChild(e)}function rj(){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;return{siteUrl:n,apiKey:a,apiUrl:i,siteI18nEnabled:t}}return{}}function oj(){const e=new URL(window.location.href);e.searchParams.get("token")&&(e.searchParams.delete("token"),window.history.replaceState({},document.title,e.href))}function sj(){ij(),oj()}function lj(){const{siteUrl:e,apiKey:t,apiUrl:n,siteI18nEnabled:a}=rj(),i=e||window.location.origin;sj(),pk.render(c.jsx(U.StrictMode,{children:c.jsx(aj,{siteUrl:i,customSiteUrl:e,apiKey:t,apiUrl:n,siteI18nEnabled:a})}),document.getElementById(ny))}lj()});
3400
3514
  //# sourceMappingURL=portal.min.js.map