@tryghost/portal 2.50.4 → 2.50.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/umd/portal.min.js +2 -2
- package/umd/portal.min.js.map +1 -1
package/package.json
CHANGED
package/umd/portal.min.js
CHANGED
|
@@ -1683,7 +1683,7 @@ html[dir=rtl] .gh-portal-signup-terms .checkbox:before {
|
|
|
1683
1683
|
transform: translateX(-50%);
|
|
1684
1684
|
}
|
|
1685
1685
|
}
|
|
1686
|
-
`;class Mf extends _.Component{constructor(n){super(n);X(this,"handleSelectPlan",(n,a)=>{n&&n.preventDefault(),this.timeoutId=setTimeout(()=>{this.setState(()=>({plan:a}))},5)});this.state={name:"",email:"",plan:"free",showNewsletterSelection:!1,termsCheckboxChecked:!1},this.termsRef=_.createRef()}componentDidMount(){const{member:n}=this.context;n&&this.context.onAction("switchPage",{page:"accountHome"}),this.handleSelectedPlan()}componentDidUpdate(){this.handleSelectedPlan()}handleSelectedPlan(){const{site:n,pageQuery:a}=this.context,i=Vo({site:n,pageQuery:a}),r=this.getSelectedPriceId(i,this.state.plan);r!==this.state.plan&&this.setState({plan:r})}componentWillUnmount(){clearTimeout(this.timeoutId)}getFormErrors(n){const i=this.context.site.portal_signup_checkbox_required&&this.context.site.portal_signup_terms_html&&!n.termsCheckboxChecked;return{...Zo({fields:this.getInputFields({state:n}),t:this.context.t}),checkbox:i}}doSignup(){this.setState(n=>({errors:this.getFormErrors(n)}),()=>{const{site:n,onAction:a}=this.context,{name:i,email:r,plan:o,phonenumber:s,token:l,errors:c}=this.state,d=c&&Object.values(c).filter(h=>!!h).length>0,p={...c};delete p.checkbox,(c==null?void 0:c.checkbox)&&Object.values(p).every(h=>!h)&&this.termsRef.current&&this.termsRef.current.scrollIntoView({behavior:"smooth",block:"center"}),d||(Oi({site:n})?this.setState({showNewsletterSelection:!0,pageData:{name:i,email:r,plan:o,phonenumber:s,token:l},errors:{}}):(this.setState({errors:{}}),a("signup",{name:i,email:r,phonenumber:s,plan:o,token:l})))})}handleSignup(n){n.preventDefault(),this.doSignup()}handleChooseSignup(n,a){n.preventDefault(),this.setState({plan:a},()=>{this.doSignup()})}handleInputChange(n,a){const i=a.name,r=n.target.value;this.setState({[i]:r})}onKeyDown(n){n.keyCode===13&&this.handleSignup(n)}getSelectedPriceId(n=[],a){return!n||n.length===0?"free":n.some(r=>r.id===a)?a:n[0].id||"free"}getInputFields({state:n,fieldNames:a}){const{site:{portal_name:i},t:r}=this.context,o=n.errors||{},s=[{type:"email",value:n.email,placeholder:r("jamie@example.com"),label:r("Email"),name:"email",required:!0,tabindex:2,errorMessage:o.email||""},{type:"text",value:n.phonenumber,placeholder:r("+1 (123) 456-7890"),label:r("Phone number"),name:"phonenumber",required:!1,tabindex:-1,autocomplete:"off",hidden:!0}];return i&&s.unshift({type:"text",value:n.name,placeholder:r("Jamie Larson"),label:r("Name"),name:"name",required:!0,tabindex:1,errorMessage:o.name||""}),s[0].autoFocus=!0,a&&a.length>0?s.filter(l=>a.includes(l.name)):s}renderSignupTerms(){var l;const{site:n}=this.context;if(n.portal_signup_terms_html===null||n.portal_signup_terms_html==="")return null;const a=c=>{this.setState({termsCheckboxChecked:c.target.checked})},i=u.jsx("div",{className:"gh-portal-signup-terms-content",dangerouslySetInnerHTML:{__html:n.portal_signup_terms_html}}),r=n.portal_signup_checkbox_required?u.jsxs("label",{children:[u.jsx("input",{type:"checkbox",checked:!!this.state.termsCheckboxChecked,required:!0,onChange:a}),u.jsx("span",{className:"checkbox"}),i]}):i,s=`gh-portal-signup-terms ${(l=this.state.errors)!=null&&l.checkbox?"gh-portal-error":""}`;return u.jsx("div",{className:s,onClick:Df,ref:this.termsRef,children:r})}renderSubmitButton(){const{action:n,site:a,brandColor:i,pageQuery:r,t:o}=this.context;if(ft({site:a})||!At({site:a,pageQuery:r}))return null;let s=o("Continue");const l=r==="free"&&mc({site:a});if(va({site:a})||l)s=o("Sign up");else return null;let c=!1;n==="signup:running"&&(s=o("Sending..."),c=!0);let d=!1;n==="signup:failed"&&(s=o("Retry"),d=!0);const p=n==="signup:running";return u.jsx(ie,{style:{width:"100%"},retry:d,onClick:m=>this.handleSignup(m),disabled:p,brandColor:i,label:s,isRunning:c,tabIndex:"3"})}renderProducts(){const{site:n,pageQuery:a,t:i}=this.context,r=Uo({site:n,pageQuery:a}),o=this.state.errors||{},s={};return Object.keys(o).length>0&&this.state.plan&&(s[this.state.plan]=i("Please fill in required fields")),u.jsx(u.Fragment,{children:u.jsx(Pf,{handleChooseSignup:(...l)=>this.handleChooseSignup(...l),products:r,onPlanSelect:this.handleSelectPlan,errors:s})})}renderFreeTrialMessage(){const{site:n,t:a,pageQuery:i}=this.context;return Lo({site:n,pageQuery:i})&&!ft({site:n})&&At({site:n,pageQuery:i})?u.jsx("p",{className:"gh-portal-free-trial-notification","data-testid":"free-trial-notification-text",children:a("After a free trial ends, you will be charged the regular price for the tier you've chosen. You can always cancel before then.")}):null}renderLoginMessage(){const{brandColor:n,onAction:a,t:i}=this.context;return u.jsxs("div",{children:[this.renderFreeTrialMessage(),u.jsxs("div",{className:"gh-portal-signup-message",children:[u.jsx("div",{children:i("Already a member?")}),u.jsx("button",{"data-test-button":"signin-switch","data-testid":"signin-switch",className:"gh-portal-btn gh-portal-btn-link",style:{color:n},onClick:()=>a("switchPage",{page:"signin"}),children:u.jsx("span",{children:i("Sign in")})})]})]})}renderForm(){const n=this.getInputFields({state:this.state}),{site:a,pageQuery:i}=this.context;if(this.state.showNewsletterSelection)return u.jsx(Ec,{pageData:this.state.pageData,onBack:()=>{this.setState({showNewsletterSelection:!1})}});if(ft({site:a}))return this.renderInviteOnlyMessage();if(WE({site:a})&&i==="free")return this.renderPaidMembersOnlyMessage();if(!Mo({site:a})||!At({site:a,pageQuery:i}))return rn({site:a})?this.renderInviteOnlyMessage():this.renderMembersDisabledMessage();const r=i==="free"&&mc({site:a}),o=va({site:a})||r,s=this.renderSignupTerms();return u.jsx("section",{className:"gh-portal-signup",children:u.jsxs("div",{className:"gh-portal-section",children:[u.jsx("div",{className:"gh-portal-logged-out-form-container",children:u.jsx(Qo,{fields:n,onChange:(l,c)=>this.handleInputChange(l,c),onKeyDown:l=>this.onKeyDown(l)})}),u.jsxs("div",{children:[o?u.jsxs(u.Fragment,{children:[this.renderProducts(),s&&u.jsx("div",{className:"gh-portal-signup-terms-wrapper free-only",children:s})]}):u.jsxs(u.Fragment,{children:[s&&u.jsx("div",{className:"gh-portal-signup-terms-wrapper",children:s}),this.renderProducts()]}),o?u.jsx("div",{className:"gh-portal-btn-container",children:u.jsxs("div",{className:"gh-portal-logged-out-form-container",children:[this.renderSubmitButton(),this.renderLoginMessage()]})}):this.renderLoginMessage()]})]})})}renderPaidMembersOnlyMessage(){const{t:n}=this.context;return u.jsx("section",{children:u.jsxs("div",{className:"gh-portal-section",children:[u.jsx("p",{className:"gh-portal-paid-members-only-notification","data-testid":"paid-members-only-notification-text",children:n("This site only accepts paid members.")}),this.renderLoginMessage()]})})}renderInviteOnlyMessage(){const{t:n}=this.context;return u.jsx("section",{children:u.jsxs("div",{className:"gh-portal-section",children:[u.jsx("p",{className:"gh-portal-invite-only-notification","data-testid":"invite-only-notification-text",children:n("This site is invite-only, contact the owner for access.")}),this.renderLoginMessage()]})})}renderMembersDisabledMessage(){const{t:n}=this.context;return u.jsx("section",{children:u.jsx("div",{className:"gh-portal-section",children:u.jsx("p",{className:"gh-portal-members-disabled-notification","data-testid":"members-disabled-notification-text",children:n("Memberships unavailable, contact the owner for access.")})})})}renderSiteIcon(){const{site:n,pageQuery:a}=this.context,i=n.icon;return i?u.jsx("img",{className:"gh-portal-signup-logo",src:i,alt:n.title}):!At({site:n,pageQuery:a})||ft({site:n})||!Mo({site:n})?u.jsx(If,{className:"gh-portal-icon gh-portal-icon-invitation"}):null}renderFormHeader(){const{site:n}=this.context,a=n.title||"";return u.jsxs("header",{className:"gh-portal-signup-header",children:[this.renderSiteIcon(),u.jsx("h1",{className:"gh-portal-main-title","data-testid":"site-title-text",children:a})]})}getClassNames(){const{site:n,pageQuery:a}=this.context,i=Vo({site:n,pageQuery:a}),r=this.getInputFields({state:this.state});let o="",s="";return(i.length<=1||ft({site:n}))&&(i.length===1&&i[0].type==="free"||ft({site:n,pageQuery:a})?(o=QE({site:n})?"singleplan":"noplan",r.length===1&&(o="single-field"),ft({site:n})&&(s="invite-only",o="invite-only")):o="singleplan"),{sectionClass:o,footerClass:s}}render(){let{sectionClass:n}=this.getClassNames();return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"gh-portal-back-sitetitle",children:u.jsx(Af,{onBack:()=>{this.state.showNewsletterSelection?this.setState({showNewsletterSelection:!1}):this.context.onAction("closePopup")}})}),u.jsx(re,{}),u.jsxs("div",{className:"gh-portal-content signup "+n,children:[this.renderFormHeader(),this.renderForm()]})]})}}X(Mf,"contextType",P);const kj=e=>k.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},k.createElement("defs",null,k.createElement("style",null,".a{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1px;}")),k.createElement("rect",{className:"a",x:.75,y:4.5,width:22.5,height:15,rx:1.5,ry:1.5}),k.createElement("line",{className:"a",x1:15.687,y1:9.975,x2:19.5,y2:13.5}),k.createElement("line",{className:"a",x1:8.313,y1:9.975,x2:4.5,y2:13.5}),k.createElement("path",{className:"a",d:"M22.88,5.014l-9.513,6.56a2.406,2.406,0,0,1-2.734,0L1.12,5.014"})),vj=`
|
|
1686
|
+
`;class Mf extends _.Component{constructor(n){super(n);X(this,"handleSelectPlan",(n,a)=>{n&&n.preventDefault(),this.timeoutId=setTimeout(()=>{this.setState(()=>({plan:a}))},5)});this.state={name:"",email:"",plan:"free",showNewsletterSelection:!1,termsCheckboxChecked:!1},this.termsRef=_.createRef()}componentDidMount(){const{member:n}=this.context;n&&this.context.onAction("switchPage",{page:"accountHome"}),this.handleSelectedPlan()}componentDidUpdate(){this.handleSelectedPlan()}handleSelectedPlan(){const{site:n,pageQuery:a}=this.context,i=Vo({site:n,pageQuery:a}),r=this.getSelectedPriceId(i,this.state.plan);r!==this.state.plan&&this.setState({plan:r})}componentWillUnmount(){clearTimeout(this.timeoutId)}getFormErrors(n){const i=this.context.site.portal_signup_checkbox_required&&this.context.site.portal_signup_terms_html&&!n.termsCheckboxChecked;return{...Zo({fields:this.getInputFields({state:n}),t:this.context.t}),checkbox:i}}doSignup(){this.setState(n=>({errors:this.getFormErrors(n)}),()=>{const{site:n,onAction:a}=this.context,{name:i,email:r,plan:o,phonenumber:s,token:l,errors:c}=this.state,d=c&&Object.values(c).filter(h=>!!h).length>0,p={...c};delete p.checkbox,(c==null?void 0:c.checkbox)&&Object.values(p).every(h=>!h)&&this.termsRef.current&&this.termsRef.current.scrollIntoView({behavior:"smooth",block:"center"}),d||(Oi({site:n})?this.setState({showNewsletterSelection:!0,pageData:{name:i,email:r,plan:o,phonenumber:s,token:l},errors:{}}):(this.setState({errors:{}}),a("signup",{name:i,email:r,phonenumber:s,plan:o,token:l})))})}handleSignup(n){n.preventDefault(),this.doSignup()}handleChooseSignup(n,a){n.preventDefault(),this.setState({plan:a},()=>{this.doSignup()})}handleInputChange(n,a){const i=a.name,r=n.target.value;this.setState({[i]:r})}onKeyDown(n){n.keyCode===13&&this.handleSignup(n)}getSelectedPriceId(n=[],a){return!n||n.length===0||a==="free"?"free":n.some(r=>r.id===a)?a:n[0].id||"free"}getInputFields({state:n,fieldNames:a}){const{site:{portal_name:i},t:r}=this.context,o=n.errors||{},s=[{type:"email",value:n.email,placeholder:r("jamie@example.com"),label:r("Email"),name:"email",required:!0,tabindex:2,errorMessage:o.email||""},{type:"text",value:n.phonenumber,placeholder:r("+1 (123) 456-7890"),label:r("Phone number"),name:"phonenumber",required:!1,tabindex:-1,autocomplete:"off",hidden:!0}];return i&&s.unshift({type:"text",value:n.name,placeholder:r("Jamie Larson"),label:r("Name"),name:"name",required:!0,tabindex:1,errorMessage:o.name||""}),s[0].autoFocus=!0,a&&a.length>0?s.filter(l=>a.includes(l.name)):s}renderSignupTerms(){var l;const{site:n}=this.context;if(n.portal_signup_terms_html===null||n.portal_signup_terms_html==="")return null;const a=c=>{this.setState({termsCheckboxChecked:c.target.checked})},i=u.jsx("div",{className:"gh-portal-signup-terms-content",dangerouslySetInnerHTML:{__html:n.portal_signup_terms_html}}),r=n.portal_signup_checkbox_required?u.jsxs("label",{children:[u.jsx("input",{type:"checkbox",checked:!!this.state.termsCheckboxChecked,required:!0,onChange:a}),u.jsx("span",{className:"checkbox"}),i]}):i,s=`gh-portal-signup-terms ${(l=this.state.errors)!=null&&l.checkbox?"gh-portal-error":""}`;return u.jsx("div",{className:s,onClick:Df,ref:this.termsRef,children:r})}renderSubmitButton(){const{action:n,site:a,brandColor:i,pageQuery:r,t:o}=this.context;if(ft({site:a})||!At({site:a,pageQuery:r}))return null;let s=o("Continue");const l=r==="free"&&mc({site:a});if(va({site:a})||l)s=o("Sign up");else return null;let c=!1;n==="signup:running"&&(s=o("Sending..."),c=!0);let d=!1;n==="signup:failed"&&(s=o("Retry"),d=!0);const p=n==="signup:running";return u.jsx(ie,{style:{width:"100%"},retry:d,onClick:m=>this.handleSignup(m),disabled:p,brandColor:i,label:s,isRunning:c,tabIndex:"3"})}renderProducts(){const{site:n,pageQuery:a,t:i}=this.context,r=Uo({site:n,pageQuery:a}),o=this.state.errors||{},s={};return Object.keys(o).length>0&&this.state.plan&&(s[this.state.plan]=i("Please fill in required fields")),u.jsx(u.Fragment,{children:u.jsx(Pf,{handleChooseSignup:(...l)=>this.handleChooseSignup(...l),products:r,onPlanSelect:this.handleSelectPlan,errors:s})})}renderFreeTrialMessage(){const{site:n,t:a,pageQuery:i}=this.context;return Lo({site:n,pageQuery:i})&&!ft({site:n})&&At({site:n,pageQuery:i})?u.jsx("p",{className:"gh-portal-free-trial-notification","data-testid":"free-trial-notification-text",children:a("After a free trial ends, you will be charged the regular price for the tier you've chosen. You can always cancel before then.")}):null}renderLoginMessage(){const{brandColor:n,onAction:a,t:i}=this.context;return u.jsxs("div",{children:[this.renderFreeTrialMessage(),u.jsxs("div",{className:"gh-portal-signup-message",children:[u.jsx("div",{children:i("Already a member?")}),u.jsx("button",{"data-test-button":"signin-switch","data-testid":"signin-switch",className:"gh-portal-btn gh-portal-btn-link",style:{color:n},onClick:()=>a("switchPage",{page:"signin"}),children:u.jsx("span",{children:i("Sign in")})})]})]})}renderForm(){const n=this.getInputFields({state:this.state}),{site:a,pageQuery:i}=this.context;if(this.state.showNewsletterSelection)return u.jsx(Ec,{pageData:this.state.pageData,onBack:()=>{this.setState({showNewsletterSelection:!1})}});if(ft({site:a}))return this.renderInviteOnlyMessage();if(WE({site:a})&&i==="free")return this.renderPaidMembersOnlyMessage();if(!Mo({site:a})||!At({site:a,pageQuery:i}))return rn({site:a})?this.renderInviteOnlyMessage():this.renderMembersDisabledMessage();const r=i==="free"&&mc({site:a}),o=va({site:a})||r,s=this.renderSignupTerms();return u.jsx("section",{className:"gh-portal-signup",children:u.jsxs("div",{className:"gh-portal-section",children:[u.jsx("div",{className:"gh-portal-logged-out-form-container",children:u.jsx(Qo,{fields:n,onChange:(l,c)=>this.handleInputChange(l,c),onKeyDown:l=>this.onKeyDown(l)})}),u.jsxs("div",{children:[o?u.jsxs(u.Fragment,{children:[this.renderProducts(),s&&u.jsx("div",{className:"gh-portal-signup-terms-wrapper free-only",children:s})]}):u.jsxs(u.Fragment,{children:[s&&u.jsx("div",{className:"gh-portal-signup-terms-wrapper",children:s}),this.renderProducts()]}),o?u.jsx("div",{className:"gh-portal-btn-container",children:u.jsxs("div",{className:"gh-portal-logged-out-form-container",children:[this.renderSubmitButton(),this.renderLoginMessage()]})}):this.renderLoginMessage()]})]})})}renderPaidMembersOnlyMessage(){const{t:n}=this.context;return u.jsx("section",{children:u.jsxs("div",{className:"gh-portal-section",children:[u.jsx("p",{className:"gh-portal-paid-members-only-notification","data-testid":"paid-members-only-notification-text",children:n("This site only accepts paid members.")}),this.renderLoginMessage()]})})}renderInviteOnlyMessage(){const{t:n}=this.context;return u.jsx("section",{children:u.jsxs("div",{className:"gh-portal-section",children:[u.jsx("p",{className:"gh-portal-invite-only-notification","data-testid":"invite-only-notification-text",children:n("This site is invite-only, contact the owner for access.")}),this.renderLoginMessage()]})})}renderMembersDisabledMessage(){const{t:n}=this.context;return u.jsx("section",{children:u.jsx("div",{className:"gh-portal-section",children:u.jsx("p",{className:"gh-portal-members-disabled-notification","data-testid":"members-disabled-notification-text",children:n("Memberships unavailable, contact the owner for access.")})})})}renderSiteIcon(){const{site:n,pageQuery:a}=this.context,i=n.icon;return i?u.jsx("img",{className:"gh-portal-signup-logo",src:i,alt:n.title}):!At({site:n,pageQuery:a})||ft({site:n})||!Mo({site:n})?u.jsx(If,{className:"gh-portal-icon gh-portal-icon-invitation"}):null}renderFormHeader(){const{site:n}=this.context,a=n.title||"";return u.jsxs("header",{className:"gh-portal-signup-header",children:[this.renderSiteIcon(),u.jsx("h1",{className:"gh-portal-main-title","data-testid":"site-title-text",children:a})]})}getClassNames(){const{site:n,pageQuery:a}=this.context,i=Vo({site:n,pageQuery:a}),r=this.getInputFields({state:this.state});let o="",s="";return(i.length<=1||ft({site:n}))&&(i.length===1&&i[0].type==="free"||ft({site:n,pageQuery:a})?(o=QE({site:n})?"singleplan":"noplan",r.length===1&&(o="single-field"),ft({site:n})&&(s="invite-only",o="invite-only")):o="singleplan"),{sectionClass:o,footerClass:s}}render(){let{sectionClass:n}=this.getClassNames();return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"gh-portal-back-sitetitle",children:u.jsx(Af,{onBack:()=>{this.state.showNewsletterSelection?this.setState({showNewsletterSelection:!1}):this.context.onAction("closePopup")}})}),u.jsx(re,{}),u.jsxs("div",{className:"gh-portal-content signup "+n,children:[this.renderFormHeader(),this.renderForm()]})]})}}X(Mf,"contextType",P);const kj=e=>k.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},k.createElement("defs",null,k.createElement("style",null,".a{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1px;}")),k.createElement("rect",{className:"a",x:.75,y:4.5,width:22.5,height:15,rx:1.5,ry:1.5}),k.createElement("line",{className:"a",x1:15.687,y1:9.975,x2:19.5,y2:13.5}),k.createElement("line",{className:"a",x1:8.313,y1:9.975,x2:4.5,y2:13.5}),k.createElement("path",{className:"a",d:"M22.88,5.014l-9.513,6.56a2.406,2.406,0,0,1-2.734,0L1.12,5.014"})),vj=`
|
|
1687
1687
|
.gh-portal-icon-envelope {
|
|
1688
1688
|
width: 44px;
|
|
1689
1689
|
margin: 12px 0 10px;
|
|
@@ -3426,5 +3426,5 @@ html[dir="rtl"] .gh-portal-list-toggle-wrapper .gh-portal-list-detail {
|
|
|
3426
3426
|
:root {
|
|
3427
3427
|
--brandcolor: ${this.context.brandColor}
|
|
3428
3428
|
}
|
|
3429
|
-
`+n;return u.jsxs(u.Fragment,{children:[u.jsx("style",{dangerouslySetInnerHTML:{__html:a}}),u.jsx("meta",{name:"viewport",content:"width=device-width, initial-scale=1, maximum-scale=1"})]})}renderFrameContainer(){const{member:t,site:n,customSiteUrl:a}=this.context,i=ob(),r=window.innerWidth<480,o={...i.frame.common};let s="gh-portal-popup-background";return q(["preview"])&&(i.modalContainer.zIndex="3999997"),q(["preview"],{customSiteUrl:a})&&!n.disableBackground&&(s+=" preview"),q(["dev"])&&(s+=" dev"),u.jsx("div",{style:i.modalContainer,children:u.jsxs(rc,{style:o,title:"portal-popup",head:this.renderFrameStyles(),dataTestId:"portal-popup-frame",dataDir:this.context.dir,children:[u.jsx("div",{className:s,onClick:l=>this.handlePopupClose(l)}),u.jsx(sb,{isMobile:r})]})})}render(){const{showPopup:t}=this.context;return t?this.renderFrameContainer():null}}X(lb,"contextType",P),rs({products:Ac({numOfProducts:1})});function Se(){return(new Date().getTime()/1e3|0).toString(16)+"xxxxxxxxxxxxxxxx".replace(/[x]/g,function(){return(Math.random()*16|0).toString(16)}).toLowerCase()}function rs({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=Ac({numOfProducts:1}),portalProducts:s=o.map(oe=>oe.id),accentColor:l="#45C32E",portalPlans:c=["free","monthly","yearly"],membersSignupAccess:d="all",freePriceName:p="Free",freePriceDescription:m="Free preview",isStripeConfigured:h=!0,portalButton:b=!0,portalName:v=!0,portalButtonIcon:f="icon-1",portalButtonSignupText:g="Subscribe now",portalButtonStyle:y="icon-and-text",membersSupportAddress:x="support@example.com",editorDefaultEmailRecipients:w="visibility",newsletters:j=[],posts:S=l0(),commentsEnabled:E,recommendations:z=[],recommendationsEnabled:C,captchaEnabled:F=!1,captchaSitekey:B}={}){return{title:e,description:t,logo:n,icon:a,accent_color:l,url:i,plans:r,products:o,portal_products:s,members_signup_access:d,free_price_name:p,free_price_description:m,is_stripe_configured:h,portal_button:b,portal_name:v,portal_plans:c,portal_button_icon:f,portal_button_signup_text:g,portal_button_style:y,members_support_address:x,comments_enabled:E!=="off",newsletters:j,recommendations:z,recommendations_enabled:!!C,editor_default_email_recipients:w,posts:S,captcha_enabled:!!F,captcha_sitekey:B}}function ub({name:e="Black Friday",code:t="black-friday",displayTitle:n="Black Friday Sale!",displayDescription:a="Special deal for Black Friday. Subscribe now for only $15 per month and get additional benefits like accessing our podcast.",type:i="percent",cadence:r="month",amount:o=50,duration:s="repeating",durationInMonths:l=null,currencyRestriction:c=!1,currency:d=null,status:p="active",tierId:m="",tierName:h="Basic"}={}){return{id:`offer_${Se()}`,name:e,code:t,display_title:n,display_description:a,type:i,cadence:r,amount:o,duration:s,duration_in_months:l,currency_restriction:c,currency:d,status:p,tier:{id:`${m}`,name:h}}}function it({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_${Se()}`,email:t,name:e,firstname:n,paid:i,subscribed:o,avatar_image:r,subscriptions:a,email_suppression:s,newsletters:l}}function l0({numOfPosts:e=3}={}){const t=[];for(let n=0;n<e;n++)t.push(u0({title:`Post ${n+1}`,slug:`post-${n+1}`}));return t.slice(0,e)}function u0({id:e=`post_${Se()}`,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 Ac({numOfProducts:e=3}={}){const n=[Ta({name:"Bronze",description:"Access to all members articles",monthlyPrice:Ze({interval:"month",amount:700}),yearlyPrice:Ze({interval:"year",amount:7e3}),numOfBenefits:2}),Ta({name:"Silver",description:"Access to all members articles and weekly podcast",monthlyPrice:Ze({interval:"month",amount:1200}),yearlyPrice:Ze({interval:"year",amount:12e3}),numOfBenefits:3}),Ta({name:"Friends of the Blueprint",description:"Get access to everything and lock in early adopter pricing for life + listen to my podcast",monthlyPrice:Ze({interval:"month",amount:18e3}),yearlyPrice:Ze({interval:"year",amount:17e3}),numOfBenefits:4})].slice(0,e),a=cb({});return[...n,a]}function Ta({type:e="paid",name:t="Basic",description:n="",id:a=`product_${Se()}`,monthlyPrice:i=Ze(),yearlyPrice:r=Ze({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:db({numOfBenefits:o}),trial_days:s}}function cb({name:e="Free tier",description:t="Free tier description",id:n=`product_${Se()}`,numOfBenefits:a=2}){return{id:n,name:e,type:"free",description:t,benefits:db({numOfBenefits:a})}}function db({numOfBenefits:e}){const t=Date.now(),n=Math.floor(Math.random()*100);return[os({name:`Limited early adopter pricing #${n}-${t}`}),os({name:`Latest gear reviews #${n}-${t}`}),os({name:`Weekly email newsletter #${n}-${t}`}),os({name:`Listen to my podcast #$${n}-${t}`})].slice(0,e)}function os({id:e=`benefit_${Se()}`,name:t="Benefit"}){return{id:e,name:t}}function Ze({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_${Se()}`}={}){return{id:o,active:r,nickname:n,currency:i,amount:t,interval:e,description:a,stripe_price_id:`price_${Se()}`,stripe_product_id:`prod_${Se()}`,type:"recurring"}}function zn({id:e=`sub_${Se()}`,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=d0,priceId:l=`price_${Se()}`,startDate:c="2021-10-05T03:18:30.000Z",currentPeriodEnd:d="2022-10-05T03:18:30.000Z",cancelAtPeriodEnd:p=!1}={}){return{id:e,customer:{id:`cus_${Se()}`,name:"Jamie",email:"jamie@example.com"},plan:{id:`price_${Se()}`,nickname:r,amount:i,interval:a,currency:n},offer:s,status:t,start_date:c,default_payment_card_last4:o,cancel_at_period_end:p,cancellation_reason:null,current_period_end:d,price:{id:`stripe_price_${Se()}`,price_id:l,nickname:r,amount:i,interval:a,type:"recurring",currency:n,product:{id:`stripe_prod_${Se()}`,product_id:`prod_${Se()}`}}}}function mb(){const e=Ac({numOfProducts:1}),t=e.map(a=>a.id);return rs({products:e,portalPlans:["free","monthly","yearly"],portalProducts:t})}mb();const c0=rs({products:[Ta({numOfBenefits:2,type:"free"})]}),d0=ub({tierId:(Ib=c0.products[0])==null?void 0:Ib.id});it(),it({paid:!0,subscriptions:[zn()]}),it({paid:!0,subscriptions:[]}),it({paid:!0,subscriptions:[zn({amount:0})]}),it({paid:!0,subscriptions:[zn({amount:1500,startDate:"2019-05-01T11:42:40.000Z",currentPeriodEnd:"2021-06-05T11:42:40.000Z"})]}),mb();const ss=[cb({name:"Free",description:"Free tier description which is actually a pretty long description",numOfBenefits:2}),Ta({name:"The Blueprint",description:"",monthlyPrice:Ze({interval:"month",amount:500}),yearlyPrice:Ze({interval:"year",amount:5e3}),numOfBenefits:3}),Ta({name:"Friends of the Blueprint Silver",description:"Access to all members articles and weekly podcast",monthlyPrice:Ze({interval:"month",amount:1200}),yearlyPrice:Ze({interval:"year",amount:11e3}),numOfBenefits:4})],Pa=rs({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:ss,portalProducts:ss.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}]}),pb=ub({tierId:(Db=Pa.products[1])==null?void 0:Db.id}),ls={free:it({name:"Jamie Larson",email:"jamie@example.com",firstname:"Jamie",subscriptions:[],paid:!1,avatarImage:"",subscribed:!0}),paid:it({paid:!0,subscriptions:[zn({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:it({paid:!0,subscriptions:[]}),complimentaryWithSubscription:it({paid:!0,subscriptions:[zn({amount:0})]}),preview:it({paid:!0,subscriptions:[zn({amount:1500,startDate:"2019-05-01T11:42:40.000Z",currentPeriodEnd:"2021-06-05T11:42:40.000Z"})]})};function m0(){var n;if(!ss||!ss[1])return null;let e=(n=Pa==null?void 0:Pa.products)==null?void 0:n[1].monthlyPrice,t=it({paid:!0,subscriptions:[zn({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:Pa,member:t}}function p0(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 h0({data:e,state:t}){return{page:e.page,popupNotification:null,lastPage:e.lastPage||null,pageData:e.pageData||t.pageData}}function g0({state:e}){return{showPopup:!e.showPopup}}function f0({data:e}){return{showPopup:!0,page:e.page,...e.pageQuery?{pageQuery:e.pageQuery}:{},...e.pageData?{pageData:e.pageData}:{}}}function b0({state:e}){return e.lastPage?{page:e.lastPage}:hb({state:e})}function hb({state:e}){return uc(),{showPopup:!1,lastPage:null,pageQuery:"",popupNotification:null,page:e.page==="magiclink"?"":e.page}}function y0({data:e}){return{showNotification:!0,...e}}function k0(){return{showNotification:!1}}async function v0({api:e,state:t}){try{return await e.member.signout(),{action:"signout:success"}}catch{const{t:a}=t;return{action:"signout:failed",popupNotification:Z({type:"signout:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:a("Failed to log out, please try again")})}}}async function w0({data:e,api:t,state:n}){const{captchaRef:a,site:i,t:r}=n;try{if(Oo({site:i})){const{response:s}=await a.current.execute({async:!0});e.token=s}const o=await t.member.getIntegrityToken();return await t.member.sendMagicLink({...e,emailType:"signin",integrityToken:o}),{page:"magiclink",lastPage:"signin"}}catch(o){return{action:"signin:failed",popupNotification:Z({type:"signin:failed",autoHide:!1,closeable:!0,state:n,status:"error",message:ja(o,r("Failed to log in, please try again"),r)})}}}async function x0({data:e,state:t,api:n}){try{if(Oo({site:t.site})){const{captchaRef:d}=t,{response:p}=await d.current.execute({async:!0});e.token=p}let{plan:a,tierId:i,cadence:r,email:o,name:s,newsletters:l,offerId:c}=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:c}):({tierId:i,cadence:r}=Pn({site:t==null?void 0:t.site,priceId:a}),await n.member.checkoutPlan({plan:a,tierId:i,cadence:r,email:o,name:s,newsletters:l,offerId:c})),{page:"loading"};return{page:"magiclink",lastPage:"signup"}}catch(a){const{t:i}=t,r=ja(a,i("Failed to sign up, please try again"),i);return{action:"signup:failed",popupNotification:Z({type:"signup:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:r})}}}async function S0({data:e,state:t,api:n}){try{let{plan:a,offerId:i,tierId:r,cadence:o}=e;(!r||!o)&&({tierId:r,cadence:o}=Pn({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:Z({type:"checkoutPlan:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:i("Failed to process checkout, please try again")})}}}async function E0({data:e,state:t,api:n}){const{t:a}=t;try{const{plan:i,planId:r,subscriptionId:o,cancelAtPeriodEnd:s}=e,{tierId:l,cadence:c}=Pn({site:t==null?void 0:t.site,priceId:r});await n.member.updateSubscription({planName:i,tierId:l,cadence:c,subscriptionId:o,cancelAtPeriodEnd:s,planId:r});const d=await n.member.sessionData(),p="updateSubscription:success";return{action:p,popupNotification:Z({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:Z({type:"updateSubscription:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:a("Failed to update subscription, please try again")})}}}async function C0({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:Z({type:"cancelSubscription:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:i("Failed to cancel subscription, please try again")})}}}async function j0({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:Z({type:"continueSubscription:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:i("Failed to cancel subscription, please try again")})}}}async function $0({data:e,state:t,api:n}){try{await n.member.editBilling(e)}catch{const{t:i}=t;return{action:"editBilling:failed",popupNotification:Z({type:"editBilling:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:i("Failed to update billing information, please try again")})}}}async function T0(){return{popupNotification:null}}async function P0({data:e,state:t}){let{action:n,message:a=""}=e;return n=n||"showPopupNotification:success",{popupNotification:Z({type:n,autoHide:!0,closeable:!0,state:t,status:"success",message:a})}}async function N0({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:Z({type:"updateNewsletter:failed",autoHide:!0,closeable:!0,state:t,status:"error",message:i("Failed to update newsletter settings")})}}}async function z0({state:e,api:t}){const{t:n}=e;try{return await t.member.deleteSuppression(),{action:"removeEmailFromSuppressionList:success",popupNotification:Z({type:"removeEmailFromSuppressionList:success",autoHide:!0,closeable:!0,state:e,status:"success",message:n("You have been successfully resubscribed")})}}catch{return{action:"removeEmailFromSuppressionList:failed",popupNotification:Z({type:"removeEmailFromSuppressionList:failed",autoHide:!0,closeable:!0,state:e,status:"error",message:n("Your email has failed to resubscribe, please try again")})}}}async function A0({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:Z({type:o,autoHide:!0,closeable:!0,state:t,status:"success",message:a("Email newsletter settings updated")})}}catch{return{action:"updateNewsletter:failed",popupNotification:Z({type:"updateNewsletter:failed",autoHide:!0,closeable:!0,state:t,status:"error",message:a("Failed to update newsletter settings")})}}}async function I0({data:e,state:t,api:n}){const{email:a}=e,i=eC({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 D0({data:e,state:t,api:n}){const{name:a}=e;if(nC({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 M0({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 F0({data:e,state:t,api:n}){const{t:a}=t,[i,r]=await Promise.all([D0({data:e,state:t,api:n}),I0({data:e,state:t,api:n})]);if(i&&r){if(r.success)return{action:"updateProfile:success",...i.success?{member:i.member}:{},page:"accountHome",popupNotification:Z({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:Z({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:Z({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";let l="";return r.error?l=ja(r.error,a("Failed to send verification email"),a):l=a("Check your inbox to verify email update"),{action:o,...r.success?{page:"accountHome"}:{},popupNotification:Z({type:o,autoHide:r.success,closeable:!0,status:s,state:t,message:l})}}return{action:"updateProfile:success",page:"accountHome",popupNotification:Z({type:"updateProfile:success",autoHide:!0,closeable:!0,status:"success",state:t,message:a("Account details updated successfully")})}}async function _0({data:{siteUrl:e},state:t}){const n=es({siteUrl:e,apiUrl:"not-defined",contentApiKey:"not-defined"}),{member:a}=t,i=window.location.href,r=Hg(),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 R0({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 Y0({data:{recommendationId:e},api:t}){return t.recommendations.trackSubscribed({recommendationId:e}),{}}const U0={togglePopup:g0,openPopup:f0,closePopup:hb,switchPage:h0,openNotification:y0,closeNotification:k0,back:b0,signout:v0,signin:w0,signup:x0,updateSubscription:E0,cancelSubscription:C0,continueSubscription:j0,updateNewsletter:A0,updateProfile:F0,refreshMemberData:M0,clearPopupNotification:T0,editBilling:$0,checkoutPlan:S0,updateNewsletterPreference:N0,showPopupNotification:P0,removeEmailFromSuppressionList:z0,oneClickSubscribe:_0,trackRecommendationClicked:R0,trackRecommendationSubscribed:Y0};async function L0({action:e,data:t,state:n,api:a}){const i=U0[e];return i?await i({data:t,state:n,api:a})||{}:{}}const sZ="";var us={exports:{}};const M=e=>typeof e=="string",qi=()=>{let e,t;const n=new Promise((a,i)=>{e=a,t=i});return n.resolve=e,n.reject=t,n},gb=e=>e==null?"":""+e,O0=(e,t,n)=>{e.forEach(a=>{t[a]&&(n[a]=t[a])})},B0=/###/g,fb=e=>e&&e.indexOf("###")>-1?e.replace(B0,"."):e,bb=e=>!e||M(e),Ji=(e,t,n)=>{const a=M(t)?t.split("."):t;let i=0;for(;i<a.length-1;){if(bb(e))return{};const r=fb(a[i]);!e[r]&&n&&(e[r]=new n),Object.prototype.hasOwnProperty.call(e,r)?e=e[r]:e={},++i}return bb(e)?{}:{obj:e,k:fb(a[i])}},yb=(e,t,n)=>{const{obj:a,k:i}=Ji(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=Ji(e,o,Object);for(;s.obj===void 0&&o.length;)r=`${o[o.length-1]}.${r}`,o=o.slice(0,o.length-1),s=Ji(e,o,Object),s&&s.obj&&typeof s.obj[`${s.k}.${r}`]<"u"&&(s.obj=void 0);s.obj[`${s.k}.${r}`]=n},V0=(e,t,n,a)=>{const{obj:i,k:r}=Ji(e,t,Object);i[r]=i[r]||[],i[r].push(n)},cs=(e,t)=>{const{obj:n,k:a}=Ji(e,t);if(n)return n[a]},H0=(e,t,n)=>{const a=cs(e,n);return a!==void 0?a:cs(t,n)},kb=(e,t,n)=>{for(const a in t)a!=="__proto__"&&a!=="constructor"&&(a in e?M(e[a])||e[a]instanceof String||M(t[a])||t[a]instanceof String?n&&(e[a]=t[a]):kb(e[a],t[a],n):e[a]=t[a]);return e},Na=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var W0={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const K0=e=>M(e)?e.replace(/[&<>"'\/]/g,t=>W0[t]):e;class G0{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 q0=[" ",",","?","!",";"],J0=new G0(20),Q0=(e,t,n)=>{t=t||"",n=n||"";const a=q0.filter(o=>t.indexOf(o)<0&&n.indexOf(o)<0);if(a.length===0)return!0;const i=J0.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},Ic=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},ds=e=>e&&e.replace("_","-"),Z0={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 ms{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||Z0,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:(M(t[0])&&(t[0]=`${a}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new ms(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new ms(this.logger,t)}}var bt=new ms;class ps{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 c=0;c<l;c++)s(...a)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(o=>{let[s,l]=o;for(let c=0;c<l;c++)s.apply(s,[t,...a])})}}class vb extends ps{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):M(a)&&r?s.push(...a.split(r)):s.push(a)));const l=cs(this.data,s);return!l&&!n&&!a&&t.indexOf(".")>-1&&(t=s[0],n=s[1],a=s.slice(2).join(".")),l||!o||!M(a)?l:Ic(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),yb(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)(M(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=cs(this.data,s)||{};o.skipCopy||(a=JSON.parse(JSON.stringify(a))),i?kb(l,a,r):l={...l,...a},yb(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 wb={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 xb={};class hs extends ps{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),O0(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=bt.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&&!Q0(t,a,i);if(o&&!s){const l=t.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:t,namespaces:r};const c=t.split(a);(a!==i||a===i&&this.options.ns.indexOf(c[0])>-1)&&(r=c.shift()),t=c.join(i)}return M(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],c=n.lng||this.language,d=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(c&&c.toLowerCase()==="cimode"){if(d){const w=n.nsSeparator||this.options.nsSeparator;return i?{res:`${l}${w}${o}`,usedKey:o,exactUsedKey:o,usedLng:c,usedNS:l,usedParams:this.getUsedParamsDetails(n)}:`${l}${w}${o}`}return i?{res:o,usedKey:o,exactUsedKey:o,usedLng:c,usedNS:l,usedParams:this.getUsedParamsDetails(n)}:o}const p=this.resolve(t,n);let m=p&&p.res;const h=p&&p.usedKey||o,b=p&&p.exactUsedKey||o,v=Object.prototype.toString.apply(m),f=["[object Number]","[object Function]","[object RegExp]"],g=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject,x=!M(m)&&typeof m!="boolean"&&typeof m!="number";if(y&&m&&x&&f.indexOf(v)<0&&!(M(g)&&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 w=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,m,{...n,ns:s}):`key '${o} (${this.language})' returned an object instead of string.`;return i?(p.res=w,p.usedParams=this.getUsedParamsDetails(n),p):w}if(r){const w=Array.isArray(m),j=w?[]:{},S=w?b:h;for(const E in m)if(Object.prototype.hasOwnProperty.call(m,E)){const z=`${S}${r}${E}`;j[E]=this.translate(z,{...n,joinArrays:!1,ns:s}),j[E]===z&&(j[E]=m[E])}m=j}}else if(y&&M(g)&&Array.isArray(m))m=m.join(g),m&&(m=this.extendTranslation(m,t,n,a));else{let w=!1,j=!1;const S=n.count!==void 0&&!M(n.count),E=hs.hasDefaultValue(n),z=S?this.pluralResolver.getSuffix(c,n.count,n):"",C=n.ordinal&&S?this.pluralResolver.getSuffix(c,n.count,{ordinal:!1}):"",F=S&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),B=F&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${z}`]||n[`defaultValue${C}`]||n.defaultValue;!this.isValidLookup(m)&&E&&(w=!0,m=B),this.isValidLookup(m)||(j=!0,m=o);const ne=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&j?void 0:m,yt=E&&B!==m&&this.options.updateMissing;if(j||w||yt){if(this.logger.log(yt?"updateKey":"missingKey",c,l,o,yt?B:m),r){const fe=this.resolve(o,{...n,keySeparator:!1});fe&&fe.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 Oe=[];const kt=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&kt&&kt[0])for(let fe=0;fe<kt.length;fe++)Oe.push(kt[fe]);else this.options.saveMissingTo==="all"?Oe=this.languageUtils.toResolveHierarchy(n.lng||this.language):Oe.push(n.lng||this.language);const Aa=(fe,rt,An)=>{const T=E&&An!==m?An:ne;this.options.missingKeyHandler?this.options.missingKeyHandler(fe,l,rt,T,yt,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(fe,l,rt,T,yt,n),this.emit("missingKey",fe,l,rt,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&S?Oe.forEach(fe=>{const rt=this.pluralResolver.getSuffixes(fe,n);F&&n[`defaultValue${this.options.pluralSeparator}zero`]&&rt.indexOf(`${this.options.pluralSeparator}zero`)<0&&rt.push(`${this.options.pluralSeparator}zero`),rt.forEach(An=>{Aa([fe],o+An,n[`defaultValue${An}`]||B)})}):Aa(Oe,o,B))}m=this.extendTranslation(m,t,n,p,a),j&&m===o&&this.options.appendNamespaceToMissingKey&&(m=`${l}:${o}`),(j||w)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?m=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${o}`:o,w?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 c=M(t)&&(a&&a.interpolation&&a.interpolation.skipOnVariables!==void 0?a.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let d;if(c){const m=t.match(this.interpolator.nestingRegexp);d=m&&m.length}let p=a.replace&&!M(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),c){const m=t.match(this.interpolator.nestingRegexp),h=m&&m.length;d<h&&(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,h=new Array(m),b=0;b<m;b++)h[b]=arguments[b];return r&&r[0]===h[0]&&!a.context?(o.logger.warn(`It seems you are nesting recursively key: ${h[0]} in key: ${n[0]}`),null):o.translate(...h,n)},a)),a.interpolation&&this.interpolator.reset()}const s=a.postProcess||this.options.postProcess,l=M(s)?[s]:s;return t!=null&&l&&l.length&&a.applyPostProcessor!==!1&&(t=wb.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 M(t)&&(t=[t]),t.forEach(l=>{if(this.isValidLookup(a))return;const c=this.extractFromKey(l,n),d=c.key;i=d;let p=c.namespaces;this.options.fallbackNS&&(p=p.concat(this.options.fallbackNS));const m=n.count!==void 0&&!M(n.count),h=m&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),b=n.context!==void 0&&(M(n.context)||typeof n.context=="number")&&n.context!=="",v=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);p.forEach(f=>{this.isValidLookup(a)||(s=f,!xb[`${v[0]}-${f}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(s)&&(xb[`${v[0]}-${f}`]=!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(g=>{if(this.isValidLookup(a))return;o=g;const y=[d];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(y,d,g,f,n);else{let w;m&&(w=this.pluralResolver.getSuffix(g,n.count,n));const j=`${this.options.pluralSeparator}zero`,S=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(m&&(y.push(d+w),n.ordinal&&w.indexOf(S)===0&&y.push(d+w.replace(S,this.options.pluralSeparator)),h&&y.push(d+j)),b){const E=`${d}${this.options.contextSeparator}${n.context}`;y.push(E),m&&(y.push(E+w),n.ordinal&&w.indexOf(S)===0&&y.push(E+w.replace(S,this.options.pluralSeparator)),h&&y.push(E+j))}}let x;for(;x=y.pop();)this.isValidLookup(a)||(r=x,a=this.getResource(g,f,x,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&&!M(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 Dc=e=>e.charAt(0).toUpperCase()+e.slice(1);class Sb{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=bt.create("languageUtils")}getScriptPartFromCode(t){if(t=ds(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=ds(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(M(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]=Dc(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]=Dc(a[1].toLowerCase())),n.indexOf(a[2].toLowerCase())>-1&&(a[2]=Dc(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)),M(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 M(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))):M(t)&&r(this.formatLanguageCode(t)),a.forEach(o=>{i.indexOf(o)<0&&r(this.formatLanguageCode(o))}),i}}let X0=[{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}],e1={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 t1=["v1","v2","v3"],n1=["v4"],Eb={zero:0,one:1,two:2,few:3,many:4,other:5},a1=()=>{const e={};return X0.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:e1[t.fc]}})}),e};class i1{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=bt.create("pluralResolver"),(!this.options.compatibilityJSON||n1.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=a1(),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=ds(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)=>Eb[i]-Eb[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!t1.includes(this.options.compatibilityJSON)}}const Cb=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=H0(e,t,n);return!r&&i&&M(n)&&(r=Ic(e,n,a),r===void 0&&(r=Ic(t,n,a))),r},Mc=e=>e.replace(/\$/g,"$$$$");class r1{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=bt.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:c,unescapeSuffix:d,unescapePrefix:p,nestingPrefix:m,nestingPrefixEscaped:h,nestingSuffix:b,nestingSuffixEscaped:v,nestingOptionsSeparator:f,maxReplaces:g,alwaysFormat:y}=t.interpolation;this.escape=n!==void 0?n:K0,this.escapeValue=a!==void 0?a:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=r?Na(r):o||"{{",this.suffix=s?Na(s):l||"}}",this.formatSeparator=c||",",this.unescapePrefix=d?"":p||"-",this.unescapeSuffix=this.unescapePrefix?"":d||"",this.nestingPrefix=m?Na(m):h||Na("$t("),this.nestingSuffix=b?Na(b):v||Na(")"),this.nestingOptionsSeparator=f||",",this.maxReplaces=g||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||{},c=h=>{if(h.indexOf(this.formatSeparator)<0){const g=Cb(n,l,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(g,void 0,a,{...i,...n,interpolationkey:h}):g}const b=h.split(this.formatSeparator),v=b.shift().trim(),f=b.join(this.formatSeparator).trim();return this.format(Cb(n,l,v,this.options.keySeparator,this.options.ignoreJSONStructure),f,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:h=>Mc(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?Mc(this.escape(h)):Mc(h)}].forEach(h=>{for(s=0;r=h.regex.exec(t);){const b=r[1].trim();if(o=c(b),o===void 0)if(typeof d=="function"){const f=d(t,r,i);o=M(f)?f:""}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!M(o)&&!this.useRawValueToEscape&&(o=gb(o));const v=h.safeValue(o);if(t=t.replace(r[0],v),p?(h.regex.lastIndex+=o.length,h.regex.lastIndex-=r[0].length):h.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,c)=>{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 h=m.match(/'/g),b=m.match(/"/g);(h&&h.length%2===0&&!b||b.length%2!==0)&&(m=m.replace(/'/g,'"'));try{o=JSON.parse(m),c&&(o={...c,...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&&!M(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let c=!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,c=!0}if(r=n(s.call(this,i[1].trim(),o),o),r&&i[0]===t&&!M(r))return r;M(r)||(r=gb(r)),r||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${t}`),r=""),c&&(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 o1=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(":"),c=l.join(":").trim().replace(/^'+|'+$/g,""),d=s.trim();n[d]||(n[d]=c),c==="false"&&(n[d]=!1),c==="true"&&(n[d]=!0),isNaN(c)||(n[d]=parseInt(c,10))}})}return{formatName:t,formatOptions:n}},za=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(ds(a),i),t[o]=s),s(n)}};class s1{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=bt.create("formatter"),this.options=t,this.formats={number:za((n,a)=>i=>new Intl.NumberFormat(n,{...a}).format(i)),currency:za((n,a)=>i=>new Intl.NumberFormat(n,{...a,style:"currency"}).format(i)),datetime:za((n,a)=>i=>new Intl.DateTimeFormat(n,{...a}).format(i)),relativetime:za((n,a)=>i=>new Intl.RelativeTimeFormat(n,{...a}).format(i,a.range||"day")),list:za((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()]=za(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:c,formatOptions:d}=o1(l);if(this.formats[c]){let p=s;try{const m=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},h=m.locale||m.lng||i.locale||i.lng||a;p=this.formats[c](s,h,{...d,...i,...m})}catch(m){this.logger.warn(m)}return p}else this.logger.warn(`there was no format function for ${c}`);return s},t)}}const l1=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class u1 extends ps{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=bt.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(c=>{let d=!0;n.forEach(p=>{const m=`${c}|${p}`;!a.reload&&this.store.hasResourceBundle(c,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[c]=!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=>{V0(l.loaded,[r],o),l1(l,t),n&&l.errors.push(n),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(c=>{s[c]||(s[c]={});const d=l.loaded[c];d.length&&d.forEach(p=>{s[c][p]===void 0&&(s[c][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=(c,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(c&&d&&i<this.maxRetries){setTimeout(()=>{this.read.call(this,t,n,a,i+1,r*2,o)},r);return}o(c,d)},l=this.backend[a].bind(this.backend);if(l.length===2){try{const c=l(t,n);c&&typeof c.then=="function"?c.then(d=>s(null,d)).catch(s):s(null,c)}catch(c){s(c)}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();M(t)&&(t=this.languageUtils.toResolveHierarchy(t)),M(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},c=this.backend.create.bind(this.backend);if(c.length<6)try{let d;c.length===5?d=c(t,n,a,i,l):d=c(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 c(t,n,a,i,s,l)}!t||!t[0]||this.store.addResource(t[0],n,a,i)}}}const jb=()=>({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]),M(e[1])&&(t.defaultValue=e[1]),M(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}}),$b=e=>(M(e.ns)&&(e.ns=[e.ns]),M(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),M(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),gs=()=>{},c1=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class Qi extends ps{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=$b(t),this.services={},this.logger=bt,this.modules={external:[]},c1(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&&(M(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const i=jb();this.options={...i,...this.options,...$b(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?bt.init(r(this.modules.logger),this.options):bt.init(null,this.options);let d;this.modules.formatter?d=this.modules.formatter:typeof Intl<"u"&&(d=s1);const p=new Sb(this.options);this.store=new vb(this.options.resources,this.options);const m=this.services;m.logger=bt,m.resourceStore=this.store,m.languageUtils=p,m.pluralResolver=new i1(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 r1(this.options),m.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},m.backendConnector=new u1(r(this.modules.backend),m.resourceStore,m,this.options),m.backendConnector.on("*",function(h){for(var b=arguments.length,v=new Array(b>1?b-1:0),f=1;f<b;f++)v[f-1]=arguments[f];t.emit(h,...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 hs(this.services,this.options),this.translator.on("*",function(h){for(var b=arguments.length,v=new Array(b>1?b-1:0),f=1;f<b;f++)v[f-1]=arguments[f];t.emit(h,...v)}),this.modules.external.forEach(h=>{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,a||(a=gs),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=qi(),c=()=>{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?c():setTimeout(c,0),l}loadResources(t){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:gs;const i=M(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(c=>{c!=="cimode"&&r.indexOf(c)<0&&r.push(c)})};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=qi();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=gs),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"&&wb.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=qi();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,c)=>{c?(r(c),this.translator.changeLanguage(c),this.isLanguageChangingTo=void 0,this.emit("languageChanged",c),this.logger.log("languageChanged",c)):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 c=M(l)?l:this.services.languageUtils.getBestMatchFromCodes(l);c&&(this.language||r(c),this.translator.language||this.translator.changeLanguage(c),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(c)),this.loadResources(c,d=>{o(d,c)})};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 c=arguments.length,d=new Array(c>2?c-2:0),p=2;p<c;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 h;return l.keyPrefix&&Array.isArray(o)?h=o.map(b=>`${l.keyPrefix}${m}${b}`):h=l.keyPrefix?`${l.keyPrefix}${m}${o}`:o,i.t(h,l)};return M(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 c=this.services.backendConnector.state[`${s}|${l}`];return c===-1||c===0||c===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=qi();return this.options.ns?(M(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=qi();M(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 Sb(jb());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 Qi(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:gs;const a=t.forkResourceStore;a&&delete t.forkResourceStore;const i={...this.options,...t,isClone:!0},r=new Qi(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 vb(this.store.data,i),r.services.resourceStore=r.store),r.translator=new hs(r.services,i),r.translator.on("*",function(s){for(var l=arguments.length,c=new Array(l>1?l-1:0),d=1;d<l;d++)c[d-1]=arguments[d];r.emit(s,...c)}),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 Tb=Qi.createInstance();Tb.createInstance=Qi.createInstance;var d1=Tb;const m1=d1,Pb=["af","ar","bg","bn","bs","ca","cs","da","de","de-CH","el","en","eo","es","et","fa","fi","fr","gd","he","hi","hr","hu","id","is","it","ja","ko","kz","lt","lv","mk","mn","ms","ne","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"];function Nb(e,t){return e.reduce((n,a)=>{let i;try{i=Mg("/ghost/i18n/lib")(`../locales/${a}/${t}.json`)}catch{i=Mg("/ghost/i18n/lib")(`../locales/en/${t}.json`)}return n[a]={[t]:{...i,...i.default&&typeof i.default=="object"?i.default:{}}},n},{})}us.exports=(e="en",t="portal")=>{const n=m1.createInstance();let a={};t==="newsletter"&&(a={prefix:"{",suffix:"}"});let i=Nb(Pb,t);return n.init({lng:e,nsSeparator:!1,keySeparator:!1,returnEmptyString:!1,fallbackLng:!1,ns:t,defaultNS:t,interpolation:a,resources:i}),n},us.exports.SUPPORTED_LOCALES=Pb,us.exports.generateResources=Nb;var p1=us.exports,h1=p1;const Fc=Me(h1);function zb(e,t){e&&(e.innerText=t)}function g1(e,t,n,a){t.classList.add("error");const i=a("There was an error sending the email, please try again");zb(n,ja(e,i,a))}async function f1({event:e,form:t,errorEl:n,siteUrl:a,captchaId:i,submitHandler:r},o=s=>s){var x;t.removeEventListener("submit",r),e.preventDefault(),n&&(n.innerText=""),t.classList.remove("success","invalid","error");let s=e.target.querySelector("input[data-members-email]"),l=e.target.querySelector("input[data-members-name]"),c=((x=t==null?void 0:t.dataset)==null?void 0:x.membersAutoredirect)||"true",d=s==null?void 0:s.value,p=l&&l.value||void 0,m,h=[],b=[],v=e.target.querySelectorAll("input[data-members-label]")||[];for(let w=0;w<v.length;++w)h.push(v[w].value);let f=e.target.querySelectorAll("input[type=hidden][data-members-newsletter], input[type=checkbox][data-members-newsletter]:checked, input[type=radio][data-members-newsletter]:checked")||[];for(let w=0;w<f.length;++w)b.push({name:f[w].value});t.dataset.membersForm&&(m=t.dataset.membersForm),t.classList.add("loading");const g=Vi(),y={email:d,emailType:m,labels:h,name:p,autoRedirect:c==="true"};g&&(y.urlHistory=g),f.length>0?y.newsletters=b:(e.target.querySelectorAll("input[type=checkbox][data-members-newsletter]")||[]).length>0&&(y.newsletters=[]);try{const j=await(await fetch(`${a}/members/api/integrity-token/`,{method:"GET"})).text();if(i){const{response:E}=await window.hcaptcha.execute(i,{async:!0});y.token=E}const S=await fetch(`${a}/members/api/send-magic-link/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...y,integrityToken:j})});if(t.addEventListener("submit",r),t.classList.remove("loading"),S.ok)t.classList.add("success");else{const E=await on.fromApiResponse(S),z=ja(E,o("Failed to send magic link email"),o);zb(n,z),t.classList.add("error")}}catch(w){g1(w,t,n,o)}}function b1({event:e,el:t,errorEl:n,siteUrl:a,site:i,member:r,clickHandler:o}){const s=i.locale||"en",c=Fc(s,"portal").t;t.removeEventListener("click",o),e.preventDefault();let d=t.dataset.membersPlan,p=VE(i,d.toLowerCase()),m=t.dataset.membersSuccess,h=t.dataset.membersCancel,b,v;m&&(b=new URL(m,window.location.href).href),h&&(v=new URL(h,window.location.href).href),n&&(n.innerText=""),t.classList.add("loading");const f=r?{checkoutType:"upgrade"}:{},g=Vi();return g&&(f.urlHistory=g),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:f})}).then(function(x){if(!x.ok)throw new Error(c("Could not create stripe checkout session"));return x.json()})}).then(function(y){return y.url?window.location.assign(y.url):window.Stripe(y.publicKey).redirectToCheckout({sessionId:y.sessionId}).then(function(w){if(w.error)throw new Error(w.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 y1({siteUrl:e,site:t,member:n}){const a=t.locale||"en",r=Fc(a,"portal").t;e&&(e=e.replace(/\/$/,""),Array.prototype.forEach.call(document.querySelectorAll("form[data-members-form]"),function(o){let s;if(Oo({site:t})){const d=Kg({site:t}),p=document.createElement("div");o.appendChild(p),s=window.hcaptcha.render(p,{size:"invisible",sitekey:d})}let l=o.querySelector("[data-members-error]");function c(d){f1({event:d,errorEl:l,form:o,siteUrl:e,captchaId:s,submitHandler:c},r)}o.addEventListener("submit",c)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-plan]"),function(o){let s=o.querySelector("[data-members-error]");function l(c){b1({el:o,event:c,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,c=o.dataset.membersCancel,d,p;l&&(d=new URL(l,window.location.href).href),c&&(p=new URL(c,window.location.href).href);function m(h){o.removeEventListener("click",m),h.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(c){c.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(c){o.removeEventListener("click",l),c.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(c){o.removeEventListener("click",l),c.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 k1={showPopup:!0,site:Pa,member:ls.free,page:"accountEmail",...m0(),pageData:pb,captchaRef:_.createRef()};function v1({site:e,children:t}){const{portal_sentry:n}=e||{};return n&&n.dsn?u.jsx(ic,{children:t}):u.jsx(u.Fragment,{children:t})}class w1 extends _.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,locale:t.locale,scrollbarWidth:0,captchaRef:_.createRef()}}componentDidMount(){const t=this.getScrollbarWidth();this.setState({scrollbarWidth:t}),this.initSetup()}componentDidUpdate(t,n){var a,i,r;if(n.showPopup!==this.state.showPopup){this.handleCustomTriggerClassUpdate();try{this.state.showPopup?(this.bodyScroll=(r=(i=(a=window.document)==null?void 0:a.body)==null?void 0:i.style)==null?void 0:r.overflow,this.bodyMargin=window.getComputedStyle(document.body).getPropertyValue("margin-right"),window.document.body.style.overflow="hidden",this.state.scrollbarWidth&&(window.document.body.style.marginRight=`calc(${this.bodyMargin} + ${this.state.scrollbarWidth}px)`)):(window.document.body.style.overflow=this.bodyScroll||"",!this.bodyMargin||this.bodyMargin==="0px"?window.document.body.style.marginRight="":window.document.body.style.marginRight=this.bodyMargin)}catch{}}if(this.state.initStatus==="success"&&n.initStatus!==this.state.initStatus){const{siteUrl:o}=this.props,s=this.getContextFromState();this.sendPortalReadyEvent(),y1({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:{}},"*")}getScrollbarWidth(){const t=document.createElement("div");t.style.visibility="hidden",t.style.overflow="scroll",document.body.appendChild(t),document.body.appendChild(t);const n=t.offsetWidth-t.clientWidth;return document.body.removeChild(t),n}setupCustomTriggerButton(){this.clickHandler=a=>{a.preventDefault();const i=a.currentTarget,r=i&&i.dataset.portal,{page:o,pageQuery:s,pageData:l}=this.getPageFromLinkPath(r)||{};this.state.initStatus==="success"&&(s&&s!=="free"?this.handleSignupQuery({site:this.state.site,pageQuery:s}):this.dispatchAction("openPopup",{page:o,pageQuery:s,pageData:l}))};const t="[data-portal]",n="gh-portal-close";this.customTriggerButtons=document.querySelectorAll(t)||[],this.customTriggerButtons.forEach(a=>{a.classList.add(n),a.removeEventListener("click",this.clickHandler),a.addEventListener("click",this.clickHandler)})}handleCustomTriggerClassUpdate(){var a;const t="gh-portal-open",n="gh-portal-close";(a=this.customTriggerButtons)==null||a.forEach(i=>{const r=this.state.showPopup?t:n,o=this.state.showPopup?n:t;i.classList.add(r),i.classList.remove(o)})}async initSetup(){try{const{site:t,member:n,page:a,showPopup:i,popupNotification:r,lastPage:o,pageQuery:s,pageData:l}=await this.fetchData(),c=this.props.siteI18nEnabled&&(this.props.locale||t.locale)||"en",d=Fc(c,"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",locale:c};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(h=>{h.style.display=""})}this.setupRecommendationButtons(),this.transformPortalLinksToRelative()}catch(t){console.error("[Portal] Failed to initialize:",t),this.setState({action:"init:failed",initStatus:"failed"})}}async fetchData(){const{site:t,member:n}=await this.fetchApiData(),{site:a,...i}=this.fetchDevData(),{site:r,...o}=this.fetchLinkData(t,n),{site:s,...l}=this.fetchPreviewData(),{site:c,...d}=this.fetchNotificationData();return{member:n,page:"",site:{...t,...r,...s,...c,...a,plans:{...(a||{}).plans,...(t||{}).plans,...(s||{}).plans}},...i,...o,...d,...l}}fetchDevData(){return q(["dev"])&&!this.state.customSiteUrl?k1:q(["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||pb.tier.id})}return{page:"offer",pageData:a}}fetchQueryStrData(t=""){const n=new URLSearchParams(t),a={site:{plans:{}}},i=[];let r,o=null,s,l,c;for(let 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 h=m.toUpperCase();a.site.plans.currency=h,a.site.plans.currency_symbol=ge(h),c=h}else p==="disableBackground"?a.site.disableBackground=JSON.parse(m):p==="membersSignupAccess"&&m?a.site.members_signup_access=m:p==="portalDefaultPlan"&&m&&(a.site.portal_default_plan=m)}return a.site.portal_plans=i,a.site.portal_products=o,r?a.site.portal_plans=r:s&&l&&c&&(a.site.prices=[{id:"monthly",stripe_price_id:"dummy_stripe_monthly",stripe_product_id:"dummy_stripe_product",active:1,nickname:"Monthly",currency:c,amount:s,type:"recurring",interval:"month"},{id:"yearly",stripe_price_id:"dummy_stripe_yearly",stripe_product_id:"dummy_stripe_product",active:1,nickname:"Yearly",currency:c,amount:l,type:"recurring",interval:"year"}]),a}fetchNotificationData(){const{type:t,status:n,duration:a,autoHide:i,closeable:r}=sf({billingOnly:!0})||{};return["stripe:billing-update"].includes(t)?n==="success"?{showPopup:!0,popupNotification:Z({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(KE({site:t})&&a.get("action")==="signup"&&a.get("success")==="true")return{showPopup:!0,page:"recommendations",pageData:{signup:!0}};const[i,r]=window.location.hash.substr(1).split("?"),o=new URLSearchParams(r??""),s=/^(?:(\w+?))?\/monthly$/,l=/^(?:(\w+?))?\/yearly$/,c=/^offers\/(\w+?)\/?$/,d=/^\/portal\/?(?:\/(\w+(?:\/\w+)*))?\/?$/,p=/^\/feedback\/(\w+?)\/(\w+?)\/?$/;if(i&&p.test(i)){const[,m,h]=i.match(p),b=parseInt(h);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:h,pageQuery:b,pageData:v}=this.getPageFromLinkPath(m,t)||{},f=["accountPlan","accountProfile"].includes(h)?"accountHome":null;return{showPopup:!(["monthly","yearly"].includes(b)||s.test(b)||l.test(b)||c.test(b)),...h?{page:h}:{},...b?{pageQuery:b}:{},...v?{pageData:v}:{},...f?{lastPage:f}:{}}}return{}}fetchPreviewData(){const[,t]=window.location.hash.substr(1).split("?");if(q(["preview"])){let n={};return q(["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||es({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(q(["dev","test"],{customSiteUrl:n}))return{};throw r}}setupSentry({site:t}){if(q(["test"]))return null;const{portal_sentry:n,portal_version:a,version:i}=t,o=`portal@2.50.4|ghost@${i}`;n&&n.dsn&&bE({dsn:n.dsn,environment:n.env||"development",release:o,beforeSend:s=>_E({event:s})?s:null,allowUrls:[/https?:\/\/((www)\.)?unpkg\.com\/@tryghost\/portal/]})}setupFirstPromoter({site:t,member:n}){if(q(["test"]))return null;const a=tC({site:t});let i=gc({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),dC({member:n})){const l=n.email,c=n.uuid;if(window.$FPROM)window.$FPROM.trackSignup({email:l,uid:c});else{const d=window._fprom||[];window._fprom=d,d.push(["event","signup"]),d.push(["email",l]),d.push(["uid",c])}}}catch{}};const o=document.getElementsByTagName("script")[0];o.parentNode.insertBefore(r,o)}}async dispatchAction(t,n){clearTimeout(this.timeoutId),this.setState({action:`${t}:running`});try{const a=await L0({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=Z({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(uc(),!gt({member:a}))try{const r=await this.GhostApi.site.offer({offerId:n}),o=r==null?void 0:r.offers[0];if(oC({site:t,offer:o}))if(i)this.dispatchAction("openPopup",{page:"offer",pageData:r==null?void 0:r.offers[0]});else{const s=wa({site:t,productId:o.tier.id}),l=o.cadence==="month"?s.monthlyPrice:s.yearlyPrice;if(this.dispatchAction("openPopup",{page:"loading"}),a){const{tierId:c,cadence:d}=Pn({site:t,priceId:l.id});this.dispatchAction("checkoutPlan",{plan:l.id,offerId:n,tierId:c,cadence:d})}else{const{tierId:c,cadence:d}=Pn({site:t,priceId:l.id});this.dispatchAction("signup",{plan:l.id,offerId:n,tierId:c,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}Zg({site:t,pageQuery:n})&&(r=Zg({site:t,pageQuery:n}));const o=HE({site:t,priceId:r});if(n&&n!=="free"){uc();const s=(o==null?void 0:o.id)||r;s!=="free"&&this.dispatchAction("openPopup",{page:"loading"});const{tierId:l,cadence:c}=Pn({site:t,priceId:s});this.dispatchAction("signup",{plan:s,tierId:l,cadence:c})}}getPageFromLinkPath(t){const n=/^signup\/?(?:\/(\w+?))?\/?$/,a=/^signup\/?(?:\/(\w+?))\/monthly\/?$/,i=/^signup\/?(?:\/(\w+?))\/yearly\/?$/,r=/^offers\/(\w+?)\/?$/;if(t===void 0||t==="")return{page:"default"};if(r.test(t))return{pageQuery:t};if(t==="signup")return{page:"signup"};if(a.test(t)){const[,o]=t.match(a);return{page:"signup",pageQuery:`${o}/monthly`}}else if(i.test(t)){const[,o]=t.match(i);return{page:"signup",pageQuery:`${o}/yearly`}}else if(n.test(t)){const[,o]=t.match(n);return{page:"signup",pageQuery:o}}else{if(t==="signup/free")return{page:"signup",pageQuery:"free"};if(t==="signup/monthly")return{page:"signup",pageQuery:"monthly"};if(t==="signup/yearly")return{page:"signup",pageQuery:"yearly"};if(t==="signin")return{page:"signin"};if(t==="account")return{page:"accountHome"};if(t==="account/plans")return{page:"accountPlan"};if(t==="account/profile")return{page:"accountProfile"};if(t==="account/newsletters")return{page:"accountEmail"};if(t==="support")return{page:"support"};if(t==="support/success")return{page:"supportSuccess"};if(t==="support/error")return{page:"supportError"};if(t==="recommendations")return{page:"recommendations",pageData:{signup:!1}};if(t==="account/newsletters/help")return{page:"emailReceivingFAQ",pageData:{direct:!0}};if(t==="account/newsletters/disabled")return{page:"emailSuppressionFAQ",pageData:{direct:!0}}}return{page:"default"}}getAccentColor(){const{accent_color:t}=this.state.site||{};return t}getContextPage({site:t,page:n,member:a}){if(!n||n==="default"){const i=ft({site:t})||!At({site:t})?"signin":"signup";n=a?"accountHome":i}return n==="accountPlan"&&an({member:a})&&!Ui({member:a})&&(n="accountHome"),$c({page:n})}getContextMember({page:t,member:n,customSiteUrl:a}){return q(["dev","preview"],{customSiteUrl:a})?C$({page:t})||j$({page:t})?q(["dev"],{customSiteUrl:a})?n||ls.free:q(["preview"])?ls.preview:ls.paid:null:n}getContextFromState(){const{site:t,member:n,action:a,page:i,lastPage:r,showPopup:o,pageQuery:s,pageData:l,popupNotification:c,customSiteUrl:d,t:p,dir:m,scrollbarWidth:h,captchaRef:b}=this.state,v=this.getContextPage({site:t,page:i,member:n}),f=this.getContextMember({page:v,member:n,customSiteUrl:d});return{api:this.GhostApi,site:t,action:a,brandColor:this.getAccentColor(),page:v,pageQuery:s,pageData:l,member:f,lastPage:r,showPopup:o,popupNotification:c,customSiteUrl:d,t:p,dir:m,scrollbarWidth:h,captchaRef:b,onAction:(g,y)=>this.dispatchAction(g,y)}}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(p0)}render(){return this.state.initStatus==="success"?u.jsx(v1,{site:this.state.site,children:u.jsxs(P.Provider,{value:this.getContextFromState(),children:[u.jsx(lb,{}),u.jsx(af,{}),u.jsx(uf,{})]})}):null}}const Ab="ghost-portal-root";function x1(){const e=document.createElement("div");e.id=Ab,document.body.appendChild(e)}function S1(){const e=document.querySelector("script[data-ghost]");if(e){const t=e.dataset.i18n==="true",n=e.dataset.ghost,a=e.dataset.key,i=e.dataset.api,r=e.dataset.locale;return{siteUrl:n,apiKey:a,apiUrl:i,siteI18nEnabled:t,locale:r}}return{}}function E1(){const e=new URL(window.location.href);e.searchParams.get("token")&&(e.searchParams.delete("token"),window.history.replaceState({},document.title,e.href))}function C1(){x1(),E1()}function j1(){const{siteUrl:e,apiKey:t,apiUrl:n,siteI18nEnabled:a,locale:i}=S1(),r=e||window.location.origin;C1(),Vk.render(u.jsx(_.StrictMode,{children:u.jsx(w1,{siteUrl:r,customSiteUrl:e,apiKey:t,apiUrl:n,siteI18nEnabled:a,locale:i})}),document.getElementById(Ab))}j1()});
|
|
3429
|
+
`+n;return u.jsxs(u.Fragment,{children:[u.jsx("style",{dangerouslySetInnerHTML:{__html:a}}),u.jsx("meta",{name:"viewport",content:"width=device-width, initial-scale=1, maximum-scale=1"})]})}renderFrameContainer(){const{member:t,site:n,customSiteUrl:a}=this.context,i=ob(),r=window.innerWidth<480,o={...i.frame.common};let s="gh-portal-popup-background";return q(["preview"])&&(i.modalContainer.zIndex="3999997"),q(["preview"],{customSiteUrl:a})&&!n.disableBackground&&(s+=" preview"),q(["dev"])&&(s+=" dev"),u.jsx("div",{style:i.modalContainer,children:u.jsxs(rc,{style:o,title:"portal-popup",head:this.renderFrameStyles(),dataTestId:"portal-popup-frame",dataDir:this.context.dir,children:[u.jsx("div",{className:s,onClick:l=>this.handlePopupClose(l)}),u.jsx(sb,{isMobile:r})]})})}render(){const{showPopup:t}=this.context;return t?this.renderFrameContainer():null}}X(lb,"contextType",P),rs({products:Ac({numOfProducts:1})});function Se(){return(new Date().getTime()/1e3|0).toString(16)+"xxxxxxxxxxxxxxxx".replace(/[x]/g,function(){return(Math.random()*16|0).toString(16)}).toLowerCase()}function rs({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=Ac({numOfProducts:1}),portalProducts:s=o.map(oe=>oe.id),accentColor:l="#45C32E",portalPlans:c=["free","monthly","yearly"],membersSignupAccess:d="all",freePriceName:p="Free",freePriceDescription:m="Free preview",isStripeConfigured:h=!0,portalButton:b=!0,portalName:v=!0,portalButtonIcon:f="icon-1",portalButtonSignupText:g="Subscribe now",portalButtonStyle:y="icon-and-text",membersSupportAddress:x="support@example.com",editorDefaultEmailRecipients:w="visibility",newsletters:j=[],posts:S=l0(),commentsEnabled:E,recommendations:z=[],recommendationsEnabled:C,captchaEnabled:F=!1,captchaSitekey:B}={}){return{title:e,description:t,logo:n,icon:a,accent_color:l,url:i,plans:r,products:o,portal_products:s,members_signup_access:d,free_price_name:p,free_price_description:m,is_stripe_configured:h,portal_button:b,portal_name:v,portal_plans:c,portal_button_icon:f,portal_button_signup_text:g,portal_button_style:y,members_support_address:x,comments_enabled:E!=="off",newsletters:j,recommendations:z,recommendations_enabled:!!C,editor_default_email_recipients:w,posts:S,captcha_enabled:!!F,captcha_sitekey:B}}function ub({name:e="Black Friday",code:t="black-friday",displayTitle:n="Black Friday Sale!",displayDescription:a="Special deal for Black Friday. Subscribe now for only $15 per month and get additional benefits like accessing our podcast.",type:i="percent",cadence:r="month",amount:o=50,duration:s="repeating",durationInMonths:l=null,currencyRestriction:c=!1,currency:d=null,status:p="active",tierId:m="",tierName:h="Basic"}={}){return{id:`offer_${Se()}`,name:e,code:t,display_title:n,display_description:a,type:i,cadence:r,amount:o,duration:s,duration_in_months:l,currency_restriction:c,currency:d,status:p,tier:{id:`${m}`,name:h}}}function it({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_${Se()}`,email:t,name:e,firstname:n,paid:i,subscribed:o,avatar_image:r,subscriptions:a,email_suppression:s,newsletters:l}}function l0({numOfPosts:e=3}={}){const t=[];for(let n=0;n<e;n++)t.push(u0({title:`Post ${n+1}`,slug:`post-${n+1}`}));return t.slice(0,e)}function u0({id:e=`post_${Se()}`,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 Ac({numOfProducts:e=3}={}){const n=[Ta({name:"Bronze",description:"Access to all members articles",monthlyPrice:Ze({interval:"month",amount:700}),yearlyPrice:Ze({interval:"year",amount:7e3}),numOfBenefits:2}),Ta({name:"Silver",description:"Access to all members articles and weekly podcast",monthlyPrice:Ze({interval:"month",amount:1200}),yearlyPrice:Ze({interval:"year",amount:12e3}),numOfBenefits:3}),Ta({name:"Friends of the Blueprint",description:"Get access to everything and lock in early adopter pricing for life + listen to my podcast",monthlyPrice:Ze({interval:"month",amount:18e3}),yearlyPrice:Ze({interval:"year",amount:17e3}),numOfBenefits:4})].slice(0,e),a=cb({});return[...n,a]}function Ta({type:e="paid",name:t="Basic",description:n="",id:a=`product_${Se()}`,monthlyPrice:i=Ze(),yearlyPrice:r=Ze({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:db({numOfBenefits:o}),trial_days:s}}function cb({name:e="Free tier",description:t="Free tier description",id:n=`product_${Se()}`,numOfBenefits:a=2}){return{id:n,name:e,type:"free",description:t,benefits:db({numOfBenefits:a})}}function db({numOfBenefits:e}){const t=Date.now(),n=Math.floor(Math.random()*100);return[os({name:`Limited early adopter pricing #${n}-${t}`}),os({name:`Latest gear reviews #${n}-${t}`}),os({name:`Weekly email newsletter #${n}-${t}`}),os({name:`Listen to my podcast #$${n}-${t}`})].slice(0,e)}function os({id:e=`benefit_${Se()}`,name:t="Benefit"}){return{id:e,name:t}}function Ze({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_${Se()}`}={}){return{id:o,active:r,nickname:n,currency:i,amount:t,interval:e,description:a,stripe_price_id:`price_${Se()}`,stripe_product_id:`prod_${Se()}`,type:"recurring"}}function zn({id:e=`sub_${Se()}`,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=d0,priceId:l=`price_${Se()}`,startDate:c="2021-10-05T03:18:30.000Z",currentPeriodEnd:d="2022-10-05T03:18:30.000Z",cancelAtPeriodEnd:p=!1}={}){return{id:e,customer:{id:`cus_${Se()}`,name:"Jamie",email:"jamie@example.com"},plan:{id:`price_${Se()}`,nickname:r,amount:i,interval:a,currency:n},offer:s,status:t,start_date:c,default_payment_card_last4:o,cancel_at_period_end:p,cancellation_reason:null,current_period_end:d,price:{id:`stripe_price_${Se()}`,price_id:l,nickname:r,amount:i,interval:a,type:"recurring",currency:n,product:{id:`stripe_prod_${Se()}`,product_id:`prod_${Se()}`}}}}function mb(){const e=Ac({numOfProducts:1}),t=e.map(a=>a.id);return rs({products:e,portalPlans:["free","monthly","yearly"],portalProducts:t})}mb();const c0=rs({products:[Ta({numOfBenefits:2,type:"free"})]}),d0=ub({tierId:(Ib=c0.products[0])==null?void 0:Ib.id});it(),it({paid:!0,subscriptions:[zn()]}),it({paid:!0,subscriptions:[]}),it({paid:!0,subscriptions:[zn({amount:0})]}),it({paid:!0,subscriptions:[zn({amount:1500,startDate:"2019-05-01T11:42:40.000Z",currentPeriodEnd:"2021-06-05T11:42:40.000Z"})]}),mb();const ss=[cb({name:"Free",description:"Free tier description which is actually a pretty long description",numOfBenefits:2}),Ta({name:"The Blueprint",description:"",monthlyPrice:Ze({interval:"month",amount:500}),yearlyPrice:Ze({interval:"year",amount:5e3}),numOfBenefits:3}),Ta({name:"Friends of the Blueprint Silver",description:"Access to all members articles and weekly podcast",monthlyPrice:Ze({interval:"month",amount:1200}),yearlyPrice:Ze({interval:"year",amount:11e3}),numOfBenefits:4})],Pa=rs({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:ss,portalProducts:ss.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}]}),pb=ub({tierId:(Db=Pa.products[1])==null?void 0:Db.id}),ls={free:it({name:"Jamie Larson",email:"jamie@example.com",firstname:"Jamie",subscriptions:[],paid:!1,avatarImage:"",subscribed:!0}),paid:it({paid:!0,subscriptions:[zn({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:it({paid:!0,subscriptions:[]}),complimentaryWithSubscription:it({paid:!0,subscriptions:[zn({amount:0})]}),preview:it({paid:!0,subscriptions:[zn({amount:1500,startDate:"2019-05-01T11:42:40.000Z",currentPeriodEnd:"2021-06-05T11:42:40.000Z"})]})};function m0(){var n;if(!ss||!ss[1])return null;let e=(n=Pa==null?void 0:Pa.products)==null?void 0:n[1].monthlyPrice,t=it({paid:!0,subscriptions:[zn({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:Pa,member:t}}function p0(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 h0({data:e,state:t}){return{page:e.page,popupNotification:null,lastPage:e.lastPage||null,pageData:e.pageData||t.pageData}}function g0({state:e}){return{showPopup:!e.showPopup}}function f0({data:e}){return{showPopup:!0,page:e.page,...e.pageQuery?{pageQuery:e.pageQuery}:{},...e.pageData?{pageData:e.pageData}:{}}}function b0({state:e}){return e.lastPage?{page:e.lastPage}:hb({state:e})}function hb({state:e}){return uc(),{showPopup:!1,lastPage:null,pageQuery:"",popupNotification:null,page:e.page==="magiclink"?"":e.page}}function y0({data:e}){return{showNotification:!0,...e}}function k0(){return{showNotification:!1}}async function v0({api:e,state:t}){try{return await e.member.signout(),{action:"signout:success"}}catch{const{t:a}=t;return{action:"signout:failed",popupNotification:Z({type:"signout:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:a("Failed to log out, please try again")})}}}async function w0({data:e,api:t,state:n}){const{captchaRef:a,site:i,t:r}=n;try{if(Oo({site:i})){const{response:s}=await a.current.execute({async:!0});e.token=s}const o=await t.member.getIntegrityToken();return await t.member.sendMagicLink({...e,emailType:"signin",integrityToken:o}),{page:"magiclink",lastPage:"signin"}}catch(o){return{action:"signin:failed",popupNotification:Z({type:"signin:failed",autoHide:!1,closeable:!0,state:n,status:"error",message:ja(o,r("Failed to log in, please try again"),r)})}}}async function x0({data:e,state:t,api:n}){try{if(Oo({site:t.site})){const{captchaRef:d}=t,{response:p}=await d.current.execute({async:!0});e.token=p}let{plan:a,tierId:i,cadence:r,email:o,name:s,newsletters:l,offerId:c}=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:c}):({tierId:i,cadence:r}=Pn({site:t==null?void 0:t.site,priceId:a}),await n.member.checkoutPlan({plan:a,tierId:i,cadence:r,email:o,name:s,newsletters:l,offerId:c})),{page:"loading"};return{page:"magiclink",lastPage:"signup"}}catch(a){const{t:i}=t,r=ja(a,i("Failed to sign up, please try again"),i);return{action:"signup:failed",popupNotification:Z({type:"signup:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:r})}}}async function S0({data:e,state:t,api:n}){try{let{plan:a,offerId:i,tierId:r,cadence:o}=e;(!r||!o)&&({tierId:r,cadence:o}=Pn({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:Z({type:"checkoutPlan:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:i("Failed to process checkout, please try again")})}}}async function E0({data:e,state:t,api:n}){const{t:a}=t;try{const{plan:i,planId:r,subscriptionId:o,cancelAtPeriodEnd:s}=e,{tierId:l,cadence:c}=Pn({site:t==null?void 0:t.site,priceId:r});await n.member.updateSubscription({planName:i,tierId:l,cadence:c,subscriptionId:o,cancelAtPeriodEnd:s,planId:r});const d=await n.member.sessionData(),p="updateSubscription:success";return{action:p,popupNotification:Z({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:Z({type:"updateSubscription:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:a("Failed to update subscription, please try again")})}}}async function C0({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:Z({type:"cancelSubscription:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:i("Failed to cancel subscription, please try again")})}}}async function j0({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:Z({type:"continueSubscription:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:i("Failed to cancel subscription, please try again")})}}}async function $0({data:e,state:t,api:n}){try{await n.member.editBilling(e)}catch{const{t:i}=t;return{action:"editBilling:failed",popupNotification:Z({type:"editBilling:failed",autoHide:!1,closeable:!0,state:t,status:"error",message:i("Failed to update billing information, please try again")})}}}async function T0(){return{popupNotification:null}}async function P0({data:e,state:t}){let{action:n,message:a=""}=e;return n=n||"showPopupNotification:success",{popupNotification:Z({type:n,autoHide:!0,closeable:!0,state:t,status:"success",message:a})}}async function N0({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:Z({type:"updateNewsletter:failed",autoHide:!0,closeable:!0,state:t,status:"error",message:i("Failed to update newsletter settings")})}}}async function z0({state:e,api:t}){const{t:n}=e;try{return await t.member.deleteSuppression(),{action:"removeEmailFromSuppressionList:success",popupNotification:Z({type:"removeEmailFromSuppressionList:success",autoHide:!0,closeable:!0,state:e,status:"success",message:n("You have been successfully resubscribed")})}}catch{return{action:"removeEmailFromSuppressionList:failed",popupNotification:Z({type:"removeEmailFromSuppressionList:failed",autoHide:!0,closeable:!0,state:e,status:"error",message:n("Your email has failed to resubscribe, please try again")})}}}async function A0({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:Z({type:o,autoHide:!0,closeable:!0,state:t,status:"success",message:a("Email newsletter settings updated")})}}catch{return{action:"updateNewsletter:failed",popupNotification:Z({type:"updateNewsletter:failed",autoHide:!0,closeable:!0,state:t,status:"error",message:a("Failed to update newsletter settings")})}}}async function I0({data:e,state:t,api:n}){const{email:a}=e,i=eC({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 D0({data:e,state:t,api:n}){const{name:a}=e;if(nC({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 M0({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 F0({data:e,state:t,api:n}){const{t:a}=t,[i,r]=await Promise.all([D0({data:e,state:t,api:n}),I0({data:e,state:t,api:n})]);if(i&&r){if(r.success)return{action:"updateProfile:success",...i.success?{member:i.member}:{},page:"accountHome",popupNotification:Z({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:Z({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:Z({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";let l="";return r.error?l=ja(r.error,a("Failed to send verification email"),a):l=a("Check your inbox to verify email update"),{action:o,...r.success?{page:"accountHome"}:{},popupNotification:Z({type:o,autoHide:r.success,closeable:!0,status:s,state:t,message:l})}}return{action:"updateProfile:success",page:"accountHome",popupNotification:Z({type:"updateProfile:success",autoHide:!0,closeable:!0,status:"success",state:t,message:a("Account details updated successfully")})}}async function _0({data:{siteUrl:e},state:t}){const n=es({siteUrl:e,apiUrl:"not-defined",contentApiKey:"not-defined"}),{member:a}=t,i=window.location.href,r=Hg(),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 R0({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 Y0({data:{recommendationId:e},api:t}){return t.recommendations.trackSubscribed({recommendationId:e}),{}}const U0={togglePopup:g0,openPopup:f0,closePopup:hb,switchPage:h0,openNotification:y0,closeNotification:k0,back:b0,signout:v0,signin:w0,signup:x0,updateSubscription:E0,cancelSubscription:C0,continueSubscription:j0,updateNewsletter:A0,updateProfile:F0,refreshMemberData:M0,clearPopupNotification:T0,editBilling:$0,checkoutPlan:S0,updateNewsletterPreference:N0,showPopupNotification:P0,removeEmailFromSuppressionList:z0,oneClickSubscribe:_0,trackRecommendationClicked:R0,trackRecommendationSubscribed:Y0};async function L0({action:e,data:t,state:n,api:a}){const i=U0[e];return i?await i({data:t,state:n,api:a})||{}:{}}const sZ="";var us={exports:{}};const M=e=>typeof e=="string",qi=()=>{let e,t;const n=new Promise((a,i)=>{e=a,t=i});return n.resolve=e,n.reject=t,n},gb=e=>e==null?"":""+e,O0=(e,t,n)=>{e.forEach(a=>{t[a]&&(n[a]=t[a])})},B0=/###/g,fb=e=>e&&e.indexOf("###")>-1?e.replace(B0,"."):e,bb=e=>!e||M(e),Ji=(e,t,n)=>{const a=M(t)?t.split("."):t;let i=0;for(;i<a.length-1;){if(bb(e))return{};const r=fb(a[i]);!e[r]&&n&&(e[r]=new n),Object.prototype.hasOwnProperty.call(e,r)?e=e[r]:e={},++i}return bb(e)?{}:{obj:e,k:fb(a[i])}},yb=(e,t,n)=>{const{obj:a,k:i}=Ji(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=Ji(e,o,Object);for(;s.obj===void 0&&o.length;)r=`${o[o.length-1]}.${r}`,o=o.slice(0,o.length-1),s=Ji(e,o,Object),s&&s.obj&&typeof s.obj[`${s.k}.${r}`]<"u"&&(s.obj=void 0);s.obj[`${s.k}.${r}`]=n},V0=(e,t,n,a)=>{const{obj:i,k:r}=Ji(e,t,Object);i[r]=i[r]||[],i[r].push(n)},cs=(e,t)=>{const{obj:n,k:a}=Ji(e,t);if(n)return n[a]},H0=(e,t,n)=>{const a=cs(e,n);return a!==void 0?a:cs(t,n)},kb=(e,t,n)=>{for(const a in t)a!=="__proto__"&&a!=="constructor"&&(a in e?M(e[a])||e[a]instanceof String||M(t[a])||t[a]instanceof String?n&&(e[a]=t[a]):kb(e[a],t[a],n):e[a]=t[a]);return e},Na=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var W0={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const K0=e=>M(e)?e.replace(/[&<>"'\/]/g,t=>W0[t]):e;class G0{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 q0=[" ",",","?","!",";"],J0=new G0(20),Q0=(e,t,n)=>{t=t||"",n=n||"";const a=q0.filter(o=>t.indexOf(o)<0&&n.indexOf(o)<0);if(a.length===0)return!0;const i=J0.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},Ic=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},ds=e=>e&&e.replace("_","-"),Z0={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 ms{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||Z0,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:(M(t[0])&&(t[0]=`${a}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new ms(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new ms(this.logger,t)}}var bt=new ms;class ps{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 c=0;c<l;c++)s(...a)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(o=>{let[s,l]=o;for(let c=0;c<l;c++)s.apply(s,[t,...a])})}}class vb extends ps{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):M(a)&&r?s.push(...a.split(r)):s.push(a)));const l=cs(this.data,s);return!l&&!n&&!a&&t.indexOf(".")>-1&&(t=s[0],n=s[1],a=s.slice(2).join(".")),l||!o||!M(a)?l:Ic(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),yb(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)(M(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=cs(this.data,s)||{};o.skipCopy||(a=JSON.parse(JSON.stringify(a))),i?kb(l,a,r):l={...l,...a},yb(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 wb={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 xb={};class hs extends ps{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),O0(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=bt.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&&!Q0(t,a,i);if(o&&!s){const l=t.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:t,namespaces:r};const c=t.split(a);(a!==i||a===i&&this.options.ns.indexOf(c[0])>-1)&&(r=c.shift()),t=c.join(i)}return M(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],c=n.lng||this.language,d=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(c&&c.toLowerCase()==="cimode"){if(d){const w=n.nsSeparator||this.options.nsSeparator;return i?{res:`${l}${w}${o}`,usedKey:o,exactUsedKey:o,usedLng:c,usedNS:l,usedParams:this.getUsedParamsDetails(n)}:`${l}${w}${o}`}return i?{res:o,usedKey:o,exactUsedKey:o,usedLng:c,usedNS:l,usedParams:this.getUsedParamsDetails(n)}:o}const p=this.resolve(t,n);let m=p&&p.res;const h=p&&p.usedKey||o,b=p&&p.exactUsedKey||o,v=Object.prototype.toString.apply(m),f=["[object Number]","[object Function]","[object RegExp]"],g=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject,x=!M(m)&&typeof m!="boolean"&&typeof m!="number";if(y&&m&&x&&f.indexOf(v)<0&&!(M(g)&&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 w=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,m,{...n,ns:s}):`key '${o} (${this.language})' returned an object instead of string.`;return i?(p.res=w,p.usedParams=this.getUsedParamsDetails(n),p):w}if(r){const w=Array.isArray(m),j=w?[]:{},S=w?b:h;for(const E in m)if(Object.prototype.hasOwnProperty.call(m,E)){const z=`${S}${r}${E}`;j[E]=this.translate(z,{...n,joinArrays:!1,ns:s}),j[E]===z&&(j[E]=m[E])}m=j}}else if(y&&M(g)&&Array.isArray(m))m=m.join(g),m&&(m=this.extendTranslation(m,t,n,a));else{let w=!1,j=!1;const S=n.count!==void 0&&!M(n.count),E=hs.hasDefaultValue(n),z=S?this.pluralResolver.getSuffix(c,n.count,n):"",C=n.ordinal&&S?this.pluralResolver.getSuffix(c,n.count,{ordinal:!1}):"",F=S&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),B=F&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${z}`]||n[`defaultValue${C}`]||n.defaultValue;!this.isValidLookup(m)&&E&&(w=!0,m=B),this.isValidLookup(m)||(j=!0,m=o);const ne=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&j?void 0:m,yt=E&&B!==m&&this.options.updateMissing;if(j||w||yt){if(this.logger.log(yt?"updateKey":"missingKey",c,l,o,yt?B:m),r){const fe=this.resolve(o,{...n,keySeparator:!1});fe&&fe.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 Oe=[];const kt=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&kt&&kt[0])for(let fe=0;fe<kt.length;fe++)Oe.push(kt[fe]);else this.options.saveMissingTo==="all"?Oe=this.languageUtils.toResolveHierarchy(n.lng||this.language):Oe.push(n.lng||this.language);const Aa=(fe,rt,An)=>{const T=E&&An!==m?An:ne;this.options.missingKeyHandler?this.options.missingKeyHandler(fe,l,rt,T,yt,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(fe,l,rt,T,yt,n),this.emit("missingKey",fe,l,rt,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&S?Oe.forEach(fe=>{const rt=this.pluralResolver.getSuffixes(fe,n);F&&n[`defaultValue${this.options.pluralSeparator}zero`]&&rt.indexOf(`${this.options.pluralSeparator}zero`)<0&&rt.push(`${this.options.pluralSeparator}zero`),rt.forEach(An=>{Aa([fe],o+An,n[`defaultValue${An}`]||B)})}):Aa(Oe,o,B))}m=this.extendTranslation(m,t,n,p,a),j&&m===o&&this.options.appendNamespaceToMissingKey&&(m=`${l}:${o}`),(j||w)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?m=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${o}`:o,w?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 c=M(t)&&(a&&a.interpolation&&a.interpolation.skipOnVariables!==void 0?a.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let d;if(c){const m=t.match(this.interpolator.nestingRegexp);d=m&&m.length}let p=a.replace&&!M(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),c){const m=t.match(this.interpolator.nestingRegexp),h=m&&m.length;d<h&&(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,h=new Array(m),b=0;b<m;b++)h[b]=arguments[b];return r&&r[0]===h[0]&&!a.context?(o.logger.warn(`It seems you are nesting recursively key: ${h[0]} in key: ${n[0]}`),null):o.translate(...h,n)},a)),a.interpolation&&this.interpolator.reset()}const s=a.postProcess||this.options.postProcess,l=M(s)?[s]:s;return t!=null&&l&&l.length&&a.applyPostProcessor!==!1&&(t=wb.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 M(t)&&(t=[t]),t.forEach(l=>{if(this.isValidLookup(a))return;const c=this.extractFromKey(l,n),d=c.key;i=d;let p=c.namespaces;this.options.fallbackNS&&(p=p.concat(this.options.fallbackNS));const m=n.count!==void 0&&!M(n.count),h=m&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),b=n.context!==void 0&&(M(n.context)||typeof n.context=="number")&&n.context!=="",v=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);p.forEach(f=>{this.isValidLookup(a)||(s=f,!xb[`${v[0]}-${f}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(s)&&(xb[`${v[0]}-${f}`]=!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(g=>{if(this.isValidLookup(a))return;o=g;const y=[d];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(y,d,g,f,n);else{let w;m&&(w=this.pluralResolver.getSuffix(g,n.count,n));const j=`${this.options.pluralSeparator}zero`,S=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(m&&(y.push(d+w),n.ordinal&&w.indexOf(S)===0&&y.push(d+w.replace(S,this.options.pluralSeparator)),h&&y.push(d+j)),b){const E=`${d}${this.options.contextSeparator}${n.context}`;y.push(E),m&&(y.push(E+w),n.ordinal&&w.indexOf(S)===0&&y.push(E+w.replace(S,this.options.pluralSeparator)),h&&y.push(E+j))}}let x;for(;x=y.pop();)this.isValidLookup(a)||(r=x,a=this.getResource(g,f,x,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&&!M(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 Dc=e=>e.charAt(0).toUpperCase()+e.slice(1);class Sb{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=bt.create("languageUtils")}getScriptPartFromCode(t){if(t=ds(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=ds(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(M(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]=Dc(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]=Dc(a[1].toLowerCase())),n.indexOf(a[2].toLowerCase())>-1&&(a[2]=Dc(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)),M(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 M(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))):M(t)&&r(this.formatLanguageCode(t)),a.forEach(o=>{i.indexOf(o)<0&&r(this.formatLanguageCode(o))}),i}}let X0=[{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}],e1={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 t1=["v1","v2","v3"],n1=["v4"],Eb={zero:0,one:1,two:2,few:3,many:4,other:5},a1=()=>{const e={};return X0.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:e1[t.fc]}})}),e};class i1{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=bt.create("pluralResolver"),(!this.options.compatibilityJSON||n1.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=a1(),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=ds(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)=>Eb[i]-Eb[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!t1.includes(this.options.compatibilityJSON)}}const Cb=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=H0(e,t,n);return!r&&i&&M(n)&&(r=Ic(e,n,a),r===void 0&&(r=Ic(t,n,a))),r},Mc=e=>e.replace(/\$/g,"$$$$");class r1{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=bt.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:c,unescapeSuffix:d,unescapePrefix:p,nestingPrefix:m,nestingPrefixEscaped:h,nestingSuffix:b,nestingSuffixEscaped:v,nestingOptionsSeparator:f,maxReplaces:g,alwaysFormat:y}=t.interpolation;this.escape=n!==void 0?n:K0,this.escapeValue=a!==void 0?a:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=r?Na(r):o||"{{",this.suffix=s?Na(s):l||"}}",this.formatSeparator=c||",",this.unescapePrefix=d?"":p||"-",this.unescapeSuffix=this.unescapePrefix?"":d||"",this.nestingPrefix=m?Na(m):h||Na("$t("),this.nestingSuffix=b?Na(b):v||Na(")"),this.nestingOptionsSeparator=f||",",this.maxReplaces=g||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||{},c=h=>{if(h.indexOf(this.formatSeparator)<0){const g=Cb(n,l,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(g,void 0,a,{...i,...n,interpolationkey:h}):g}const b=h.split(this.formatSeparator),v=b.shift().trim(),f=b.join(this.formatSeparator).trim();return this.format(Cb(n,l,v,this.options.keySeparator,this.options.ignoreJSONStructure),f,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:h=>Mc(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?Mc(this.escape(h)):Mc(h)}].forEach(h=>{for(s=0;r=h.regex.exec(t);){const b=r[1].trim();if(o=c(b),o===void 0)if(typeof d=="function"){const f=d(t,r,i);o=M(f)?f:""}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!M(o)&&!this.useRawValueToEscape&&(o=gb(o));const v=h.safeValue(o);if(t=t.replace(r[0],v),p?(h.regex.lastIndex+=o.length,h.regex.lastIndex-=r[0].length):h.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,c)=>{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 h=m.match(/'/g),b=m.match(/"/g);(h&&h.length%2===0&&!b||b.length%2!==0)&&(m=m.replace(/'/g,'"'));try{o=JSON.parse(m),c&&(o={...c,...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&&!M(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let c=!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,c=!0}if(r=n(s.call(this,i[1].trim(),o),o),r&&i[0]===t&&!M(r))return r;M(r)||(r=gb(r)),r||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${t}`),r=""),c&&(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 o1=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(":"),c=l.join(":").trim().replace(/^'+|'+$/g,""),d=s.trim();n[d]||(n[d]=c),c==="false"&&(n[d]=!1),c==="true"&&(n[d]=!0),isNaN(c)||(n[d]=parseInt(c,10))}})}return{formatName:t,formatOptions:n}},za=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(ds(a),i),t[o]=s),s(n)}};class s1{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=bt.create("formatter"),this.options=t,this.formats={number:za((n,a)=>i=>new Intl.NumberFormat(n,{...a}).format(i)),currency:za((n,a)=>i=>new Intl.NumberFormat(n,{...a,style:"currency"}).format(i)),datetime:za((n,a)=>i=>new Intl.DateTimeFormat(n,{...a}).format(i)),relativetime:za((n,a)=>i=>new Intl.RelativeTimeFormat(n,{...a}).format(i,a.range||"day")),list:za((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()]=za(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:c,formatOptions:d}=o1(l);if(this.formats[c]){let p=s;try{const m=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},h=m.locale||m.lng||i.locale||i.lng||a;p=this.formats[c](s,h,{...d,...i,...m})}catch(m){this.logger.warn(m)}return p}else this.logger.warn(`there was no format function for ${c}`);return s},t)}}const l1=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class u1 extends ps{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=bt.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(c=>{let d=!0;n.forEach(p=>{const m=`${c}|${p}`;!a.reload&&this.store.hasResourceBundle(c,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[c]=!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=>{V0(l.loaded,[r],o),l1(l,t),n&&l.errors.push(n),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(c=>{s[c]||(s[c]={});const d=l.loaded[c];d.length&&d.forEach(p=>{s[c][p]===void 0&&(s[c][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=(c,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(c&&d&&i<this.maxRetries){setTimeout(()=>{this.read.call(this,t,n,a,i+1,r*2,o)},r);return}o(c,d)},l=this.backend[a].bind(this.backend);if(l.length===2){try{const c=l(t,n);c&&typeof c.then=="function"?c.then(d=>s(null,d)).catch(s):s(null,c)}catch(c){s(c)}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();M(t)&&(t=this.languageUtils.toResolveHierarchy(t)),M(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},c=this.backend.create.bind(this.backend);if(c.length<6)try{let d;c.length===5?d=c(t,n,a,i,l):d=c(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 c(t,n,a,i,s,l)}!t||!t[0]||this.store.addResource(t[0],n,a,i)}}}const jb=()=>({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]),M(e[1])&&(t.defaultValue=e[1]),M(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}}),$b=e=>(M(e.ns)&&(e.ns=[e.ns]),M(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),M(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),gs=()=>{},c1=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class Qi extends ps{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=$b(t),this.services={},this.logger=bt,this.modules={external:[]},c1(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&&(M(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const i=jb();this.options={...i,...this.options,...$b(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?bt.init(r(this.modules.logger),this.options):bt.init(null,this.options);let d;this.modules.formatter?d=this.modules.formatter:typeof Intl<"u"&&(d=s1);const p=new Sb(this.options);this.store=new vb(this.options.resources,this.options);const m=this.services;m.logger=bt,m.resourceStore=this.store,m.languageUtils=p,m.pluralResolver=new i1(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 r1(this.options),m.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},m.backendConnector=new u1(r(this.modules.backend),m.resourceStore,m,this.options),m.backendConnector.on("*",function(h){for(var b=arguments.length,v=new Array(b>1?b-1:0),f=1;f<b;f++)v[f-1]=arguments[f];t.emit(h,...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 hs(this.services,this.options),this.translator.on("*",function(h){for(var b=arguments.length,v=new Array(b>1?b-1:0),f=1;f<b;f++)v[f-1]=arguments[f];t.emit(h,...v)}),this.modules.external.forEach(h=>{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,a||(a=gs),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=qi(),c=()=>{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?c():setTimeout(c,0),l}loadResources(t){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:gs;const i=M(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(c=>{c!=="cimode"&&r.indexOf(c)<0&&r.push(c)})};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=qi();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=gs),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"&&wb.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=qi();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,c)=>{c?(r(c),this.translator.changeLanguage(c),this.isLanguageChangingTo=void 0,this.emit("languageChanged",c),this.logger.log("languageChanged",c)):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 c=M(l)?l:this.services.languageUtils.getBestMatchFromCodes(l);c&&(this.language||r(c),this.translator.language||this.translator.changeLanguage(c),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(c)),this.loadResources(c,d=>{o(d,c)})};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 c=arguments.length,d=new Array(c>2?c-2:0),p=2;p<c;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 h;return l.keyPrefix&&Array.isArray(o)?h=o.map(b=>`${l.keyPrefix}${m}${b}`):h=l.keyPrefix?`${l.keyPrefix}${m}${o}`:o,i.t(h,l)};return M(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 c=this.services.backendConnector.state[`${s}|${l}`];return c===-1||c===0||c===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=qi();return this.options.ns?(M(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=qi();M(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 Sb(jb());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 Qi(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:gs;const a=t.forkResourceStore;a&&delete t.forkResourceStore;const i={...this.options,...t,isClone:!0},r=new Qi(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 vb(this.store.data,i),r.services.resourceStore=r.store),r.translator=new hs(r.services,i),r.translator.on("*",function(s){for(var l=arguments.length,c=new Array(l>1?l-1:0),d=1;d<l;d++)c[d-1]=arguments[d];r.emit(s,...c)}),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 Tb=Qi.createInstance();Tb.createInstance=Qi.createInstance;var d1=Tb;const m1=d1,Pb=["af","ar","bg","bn","bs","ca","cs","da","de","de-CH","el","en","eo","es","et","fa","fi","fr","gd","he","hi","hr","hu","id","is","it","ja","ko","kz","lt","lv","mk","mn","ms","ne","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"];function Nb(e,t){return e.reduce((n,a)=>{let i;try{i=Mg("/ghost/i18n/lib")(`../locales/${a}/${t}.json`)}catch{i=Mg("/ghost/i18n/lib")(`../locales/en/${t}.json`)}return n[a]={[t]:{...i,...i.default&&typeof i.default=="object"?i.default:{}}},n},{})}us.exports=(e="en",t="portal")=>{const n=m1.createInstance();let a={};t==="newsletter"&&(a={prefix:"{",suffix:"}"});let i=Nb(Pb,t);return n.init({lng:e,nsSeparator:!1,keySeparator:!1,returnEmptyString:!1,fallbackLng:!1,ns:t,defaultNS:t,interpolation:a,resources:i}),n},us.exports.SUPPORTED_LOCALES=Pb,us.exports.generateResources=Nb;var p1=us.exports,h1=p1;const Fc=Me(h1);function zb(e,t){e&&(e.innerText=t)}function g1(e,t,n,a){t.classList.add("error");const i=a("There was an error sending the email, please try again");zb(n,ja(e,i,a))}async function f1({event:e,form:t,errorEl:n,siteUrl:a,captchaId:i,submitHandler:r},o=s=>s){var x;t.removeEventListener("submit",r),e.preventDefault(),n&&(n.innerText=""),t.classList.remove("success","invalid","error");let s=e.target.querySelector("input[data-members-email]"),l=e.target.querySelector("input[data-members-name]"),c=((x=t==null?void 0:t.dataset)==null?void 0:x.membersAutoredirect)||"true",d=s==null?void 0:s.value,p=l&&l.value||void 0,m,h=[],b=[],v=e.target.querySelectorAll("input[data-members-label]")||[];for(let w=0;w<v.length;++w)h.push(v[w].value);let f=e.target.querySelectorAll("input[type=hidden][data-members-newsletter], input[type=checkbox][data-members-newsletter]:checked, input[type=radio][data-members-newsletter]:checked")||[];for(let w=0;w<f.length;++w)b.push({name:f[w].value});t.dataset.membersForm&&(m=t.dataset.membersForm),t.classList.add("loading");const g=Vi(),y={email:d,emailType:m,labels:h,name:p,autoRedirect:c==="true"};g&&(y.urlHistory=g),f.length>0?y.newsletters=b:(e.target.querySelectorAll("input[type=checkbox][data-members-newsletter]")||[]).length>0&&(y.newsletters=[]);try{const j=await(await fetch(`${a}/members/api/integrity-token/`,{method:"GET"})).text();if(i){const{response:E}=await window.hcaptcha.execute(i,{async:!0});y.token=E}const S=await fetch(`${a}/members/api/send-magic-link/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...y,integrityToken:j})});if(t.addEventListener("submit",r),t.classList.remove("loading"),S.ok)t.classList.add("success");else{const E=await on.fromApiResponse(S),z=ja(E,o("Failed to send magic link email"),o);zb(n,z),t.classList.add("error")}}catch(w){g1(w,t,n,o)}}function b1({event:e,el:t,errorEl:n,siteUrl:a,site:i,member:r,clickHandler:o}){const s=i.locale||"en",c=Fc(s,"portal").t;t.removeEventListener("click",o),e.preventDefault();let d=t.dataset.membersPlan,p=VE(i,d.toLowerCase()),m=t.dataset.membersSuccess,h=t.dataset.membersCancel,b,v;m&&(b=new URL(m,window.location.href).href),h&&(v=new URL(h,window.location.href).href),n&&(n.innerText=""),t.classList.add("loading");const f=r?{checkoutType:"upgrade"}:{},g=Vi();return g&&(f.urlHistory=g),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:f})}).then(function(x){if(!x.ok)throw new Error(c("Could not create stripe checkout session"));return x.json()})}).then(function(y){return y.url?window.location.assign(y.url):window.Stripe(y.publicKey).redirectToCheckout({sessionId:y.sessionId}).then(function(w){if(w.error)throw new Error(w.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 y1({siteUrl:e,site:t,member:n}){const a=t.locale||"en",r=Fc(a,"portal").t;e&&(e=e.replace(/\/$/,""),Array.prototype.forEach.call(document.querySelectorAll("form[data-members-form]"),function(o){let s;if(Oo({site:t})){const d=Kg({site:t}),p=document.createElement("div");o.appendChild(p),s=window.hcaptcha.render(p,{size:"invisible",sitekey:d})}let l=o.querySelector("[data-members-error]");function c(d){f1({event:d,errorEl:l,form:o,siteUrl:e,captchaId:s,submitHandler:c},r)}o.addEventListener("submit",c)}),Array.prototype.forEach.call(document.querySelectorAll("[data-members-plan]"),function(o){let s=o.querySelector("[data-members-error]");function l(c){b1({el:o,event:c,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,c=o.dataset.membersCancel,d,p;l&&(d=new URL(l,window.location.href).href),c&&(p=new URL(c,window.location.href).href);function m(h){o.removeEventListener("click",m),h.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(c){c.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(c){o.removeEventListener("click",l),c.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(c){o.removeEventListener("click",l),c.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 k1={showPopup:!0,site:Pa,member:ls.free,page:"accountEmail",...m0(),pageData:pb,captchaRef:_.createRef()};function v1({site:e,children:t}){const{portal_sentry:n}=e||{};return n&&n.dsn?u.jsx(ic,{children:t}):u.jsx(u.Fragment,{children:t})}class w1 extends _.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,locale:t.locale,scrollbarWidth:0,captchaRef:_.createRef()}}componentDidMount(){const t=this.getScrollbarWidth();this.setState({scrollbarWidth:t}),this.initSetup()}componentDidUpdate(t,n){var a,i,r;if(n.showPopup!==this.state.showPopup){this.handleCustomTriggerClassUpdate();try{this.state.showPopup?(this.bodyScroll=(r=(i=(a=window.document)==null?void 0:a.body)==null?void 0:i.style)==null?void 0:r.overflow,this.bodyMargin=window.getComputedStyle(document.body).getPropertyValue("margin-right"),window.document.body.style.overflow="hidden",this.state.scrollbarWidth&&(window.document.body.style.marginRight=`calc(${this.bodyMargin} + ${this.state.scrollbarWidth}px)`)):(window.document.body.style.overflow=this.bodyScroll||"",!this.bodyMargin||this.bodyMargin==="0px"?window.document.body.style.marginRight="":window.document.body.style.marginRight=this.bodyMargin)}catch{}}if(this.state.initStatus==="success"&&n.initStatus!==this.state.initStatus){const{siteUrl:o}=this.props,s=this.getContextFromState();this.sendPortalReadyEvent(),y1({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:{}},"*")}getScrollbarWidth(){const t=document.createElement("div");t.style.visibility="hidden",t.style.overflow="scroll",document.body.appendChild(t),document.body.appendChild(t);const n=t.offsetWidth-t.clientWidth;return document.body.removeChild(t),n}setupCustomTriggerButton(){this.clickHandler=a=>{a.preventDefault();const i=a.currentTarget,r=i&&i.dataset.portal,{page:o,pageQuery:s,pageData:l}=this.getPageFromLinkPath(r)||{};this.state.initStatus==="success"&&(s&&s!=="free"?this.handleSignupQuery({site:this.state.site,pageQuery:s}):this.dispatchAction("openPopup",{page:o,pageQuery:s,pageData:l}))};const t="[data-portal]",n="gh-portal-close";this.customTriggerButtons=document.querySelectorAll(t)||[],this.customTriggerButtons.forEach(a=>{a.classList.add(n),a.removeEventListener("click",this.clickHandler),a.addEventListener("click",this.clickHandler)})}handleCustomTriggerClassUpdate(){var a;const t="gh-portal-open",n="gh-portal-close";(a=this.customTriggerButtons)==null||a.forEach(i=>{const r=this.state.showPopup?t:n,o=this.state.showPopup?n:t;i.classList.add(r),i.classList.remove(o)})}async initSetup(){try{const{site:t,member:n,page:a,showPopup:i,popupNotification:r,lastPage:o,pageQuery:s,pageData:l}=await this.fetchData(),c=this.props.siteI18nEnabled&&(this.props.locale||t.locale)||"en",d=Fc(c,"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",locale:c};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(h=>{h.style.display=""})}this.setupRecommendationButtons(),this.transformPortalLinksToRelative()}catch(t){console.error("[Portal] Failed to initialize:",t),this.setState({action:"init:failed",initStatus:"failed"})}}async fetchData(){const{site:t,member:n}=await this.fetchApiData(),{site:a,...i}=this.fetchDevData(),{site:r,...o}=this.fetchLinkData(t,n),{site:s,...l}=this.fetchPreviewData(),{site:c,...d}=this.fetchNotificationData();return{member:n,page:"",site:{...t,...r,...s,...c,...a,plans:{...(a||{}).plans,...(t||{}).plans,...(s||{}).plans}},...i,...o,...d,...l}}fetchDevData(){return q(["dev"])&&!this.state.customSiteUrl?k1:q(["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||pb.tier.id})}return{page:"offer",pageData:a}}fetchQueryStrData(t=""){const n=new URLSearchParams(t),a={site:{plans:{}}},i=[];let r,o=null,s,l,c;for(let 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 h=m.toUpperCase();a.site.plans.currency=h,a.site.plans.currency_symbol=ge(h),c=h}else p==="disableBackground"?a.site.disableBackground=JSON.parse(m):p==="membersSignupAccess"&&m?a.site.members_signup_access=m:p==="portalDefaultPlan"&&m&&(a.site.portal_default_plan=m)}return a.site.portal_plans=i,a.site.portal_products=o,r?a.site.portal_plans=r:s&&l&&c&&(a.site.prices=[{id:"monthly",stripe_price_id:"dummy_stripe_monthly",stripe_product_id:"dummy_stripe_product",active:1,nickname:"Monthly",currency:c,amount:s,type:"recurring",interval:"month"},{id:"yearly",stripe_price_id:"dummy_stripe_yearly",stripe_product_id:"dummy_stripe_product",active:1,nickname:"Yearly",currency:c,amount:l,type:"recurring",interval:"year"}]),a}fetchNotificationData(){const{type:t,status:n,duration:a,autoHide:i,closeable:r}=sf({billingOnly:!0})||{};return["stripe:billing-update"].includes(t)?n==="success"?{showPopup:!0,popupNotification:Z({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(KE({site:t})&&a.get("action")==="signup"&&a.get("success")==="true")return{showPopup:!0,page:"recommendations",pageData:{signup:!0}};const[i,r]=window.location.hash.substr(1).split("?"),o=new URLSearchParams(r??""),s=/^(?:(\w+?))?\/monthly$/,l=/^(?:(\w+?))?\/yearly$/,c=/^offers\/(\w+?)\/?$/,d=/^\/portal\/?(?:\/(\w+(?:\/\w+)*))?\/?$/,p=/^\/feedback\/(\w+?)\/(\w+?)\/?$/;if(i&&p.test(i)){const[,m,h]=i.match(p),b=parseInt(h);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:h,pageQuery:b,pageData:v}=this.getPageFromLinkPath(m,t)||{},f=["accountPlan","accountProfile"].includes(h)?"accountHome":null;return{showPopup:!(["monthly","yearly"].includes(b)||s.test(b)||l.test(b)||c.test(b)),...h?{page:h}:{},...b?{pageQuery:b}:{},...v?{pageData:v}:{},...f?{lastPage:f}:{}}}return{}}fetchPreviewData(){const[,t]=window.location.hash.substr(1).split("?");if(q(["preview"])){let n={};return q(["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||es({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(q(["dev","test"],{customSiteUrl:n}))return{};throw r}}setupSentry({site:t}){if(q(["test"]))return null;const{portal_sentry:n,portal_version:a,version:i}=t,o=`portal@2.50.5|ghost@${i}`;n&&n.dsn&&bE({dsn:n.dsn,environment:n.env||"development",release:o,beforeSend:s=>_E({event:s})?s:null,allowUrls:[/https?:\/\/((www)\.)?unpkg\.com\/@tryghost\/portal/]})}setupFirstPromoter({site:t,member:n}){if(q(["test"]))return null;const a=tC({site:t});let i=gc({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),dC({member:n})){const l=n.email,c=n.uuid;if(window.$FPROM)window.$FPROM.trackSignup({email:l,uid:c});else{const d=window._fprom||[];window._fprom=d,d.push(["event","signup"]),d.push(["email",l]),d.push(["uid",c])}}}catch{}};const o=document.getElementsByTagName("script")[0];o.parentNode.insertBefore(r,o)}}async dispatchAction(t,n){clearTimeout(this.timeoutId),this.setState({action:`${t}:running`});try{const a=await L0({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=Z({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(uc(),!gt({member:a}))try{const r=await this.GhostApi.site.offer({offerId:n}),o=r==null?void 0:r.offers[0];if(oC({site:t,offer:o}))if(i)this.dispatchAction("openPopup",{page:"offer",pageData:r==null?void 0:r.offers[0]});else{const s=wa({site:t,productId:o.tier.id}),l=o.cadence==="month"?s.monthlyPrice:s.yearlyPrice;if(this.dispatchAction("openPopup",{page:"loading"}),a){const{tierId:c,cadence:d}=Pn({site:t,priceId:l.id});this.dispatchAction("checkoutPlan",{plan:l.id,offerId:n,tierId:c,cadence:d})}else{const{tierId:c,cadence:d}=Pn({site:t,priceId:l.id});this.dispatchAction("signup",{plan:l.id,offerId:n,tierId:c,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}Zg({site:t,pageQuery:n})&&(r=Zg({site:t,pageQuery:n}));const o=HE({site:t,priceId:r});if(n&&n!=="free"){uc();const s=(o==null?void 0:o.id)||r;s!=="free"&&this.dispatchAction("openPopup",{page:"loading"});const{tierId:l,cadence:c}=Pn({site:t,priceId:s});this.dispatchAction("signup",{plan:s,tierId:l,cadence:c})}}getPageFromLinkPath(t){const n=/^signup\/?(?:\/(\w+?))?\/?$/,a=/^signup\/?(?:\/(\w+?))\/monthly\/?$/,i=/^signup\/?(?:\/(\w+?))\/yearly\/?$/,r=/^offers\/(\w+?)\/?$/;if(t===void 0||t==="")return{page:"default"};if(r.test(t))return{pageQuery:t};if(t==="signup")return{page:"signup"};if(a.test(t)){const[,o]=t.match(a);return{page:"signup",pageQuery:`${o}/monthly`}}else if(i.test(t)){const[,o]=t.match(i);return{page:"signup",pageQuery:`${o}/yearly`}}else if(n.test(t)){const[,o]=t.match(n);return{page:"signup",pageQuery:o}}else{if(t==="signup/free")return{page:"signup",pageQuery:"free"};if(t==="signup/monthly")return{page:"signup",pageQuery:"monthly"};if(t==="signup/yearly")return{page:"signup",pageQuery:"yearly"};if(t==="signin")return{page:"signin"};if(t==="account")return{page:"accountHome"};if(t==="account/plans")return{page:"accountPlan"};if(t==="account/profile")return{page:"accountProfile"};if(t==="account/newsletters")return{page:"accountEmail"};if(t==="support")return{page:"support"};if(t==="support/success")return{page:"supportSuccess"};if(t==="support/error")return{page:"supportError"};if(t==="recommendations")return{page:"recommendations",pageData:{signup:!1}};if(t==="account/newsletters/help")return{page:"emailReceivingFAQ",pageData:{direct:!0}};if(t==="account/newsletters/disabled")return{page:"emailSuppressionFAQ",pageData:{direct:!0}}}return{page:"default"}}getAccentColor(){const{accent_color:t}=this.state.site||{};return t}getContextPage({site:t,page:n,member:a}){if(!n||n==="default"){const i=ft({site:t})||!At({site:t})?"signin":"signup";n=a?"accountHome":i}return n==="accountPlan"&&an({member:a})&&!Ui({member:a})&&(n="accountHome"),$c({page:n})}getContextMember({page:t,member:n,customSiteUrl:a}){return q(["dev","preview"],{customSiteUrl:a})?C$({page:t})||j$({page:t})?q(["dev"],{customSiteUrl:a})?n||ls.free:q(["preview"])?ls.preview:ls.paid:null:n}getContextFromState(){const{site:t,member:n,action:a,page:i,lastPage:r,showPopup:o,pageQuery:s,pageData:l,popupNotification:c,customSiteUrl:d,t:p,dir:m,scrollbarWidth:h,captchaRef:b}=this.state,v=this.getContextPage({site:t,page:i,member:n}),f=this.getContextMember({page:v,member:n,customSiteUrl:d});return{api:this.GhostApi,site:t,action:a,brandColor:this.getAccentColor(),page:v,pageQuery:s,pageData:l,member:f,lastPage:r,showPopup:o,popupNotification:c,customSiteUrl:d,t:p,dir:m,scrollbarWidth:h,captchaRef:b,onAction:(g,y)=>this.dispatchAction(g,y)}}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(p0)}render(){return this.state.initStatus==="success"?u.jsx(v1,{site:this.state.site,children:u.jsxs(P.Provider,{value:this.getContextFromState(),children:[u.jsx(lb,{}),u.jsx(af,{}),u.jsx(uf,{})]})}):null}}const Ab="ghost-portal-root";function x1(){const e=document.createElement("div");e.id=Ab,document.body.appendChild(e)}function S1(){const e=document.querySelector("script[data-ghost]");if(e){const t=e.dataset.i18n==="true",n=e.dataset.ghost,a=e.dataset.key,i=e.dataset.api,r=e.dataset.locale;return{siteUrl:n,apiKey:a,apiUrl:i,siteI18nEnabled:t,locale:r}}return{}}function E1(){const e=new URL(window.location.href);e.searchParams.get("token")&&(e.searchParams.delete("token"),window.history.replaceState({},document.title,e.href))}function C1(){x1(),E1()}function j1(){const{siteUrl:e,apiKey:t,apiUrl:n,siteI18nEnabled:a,locale:i}=S1(),r=e||window.location.origin;C1(),Vk.render(u.jsx(_.StrictMode,{children:u.jsx(w1,{siteUrl:r,customSiteUrl:e,apiKey:t,apiUrl:n,siteI18nEnabled:a,locale:i})}),document.getElementById(Ab))}j1()});
|
|
3430
3430
|
//# sourceMappingURL=portal.min.js.map
|