import{l as u,k as _,ah as l,ai as g,Q as a}from"./index-v0a5IAKM.js";import{D as c}from"./DonationVoice-TsoE19Cw.js";import{g as h}from"./getVotesFormat-CTrf3mHq.js";class A{constructor(t){this._login="",this._username="",this._avatar="",this._title="",this._branding="",this._successDescription="",this._rules="",this._isWallEnabled=!1,this._minAmountWall="0",this._isTTSEnable=!1,this._voiceLimit=0,this._activities=new Map,this._actions=new Map,this._quizCategories=[],this._buttonText="",this._telegram="",this._youtube="",this._twitch="",this._vk="",this._firstVariant="",this._secondVariant="",this._firstVariantDescription="",this._secondVariantDescription="",this._votePrice="",this._firstVariantCountRub=0,this._secondVariantCountRub=0,this._voices=[],this._donationOnAir=null,this._ai=null,this._safe=null,this._wonder=null,this._isTgButton=!1,this._isAddedCreditCard=!1,this._isEmailConfirmation=!1,this._isPhoneConfirmation=!1,this._isAddedPhone=!1,this._isPro=!1,this._isLoading=!0,u(this),this.setFromApi(t)}get isLoading(){return this._isLoading}get avatar(){return this._avatar?_(this._avatar):""}get login(){return this._login}get username(){return this._username}get title(){return this._title}get branding(){return this._branding?l(this._branding,1024):""}get successDescription(){return this._successDescription}get buttonText(){return this._buttonText}get rules(){return this._rules}get isWallEnabled(){return this._isWallEnabled}get minAmountWall(){return this._minAmountWall}get telegram(){return this._telegram}get youtube(){return this._youtube}get twitch(){return this._twitch}get vk(){return this._vk}get isSuperDonate(){return!1}get votePrice(){return this._votePrice}get firstVariant(){return this._firstVariant}get secondVariant(){return this._secondVariant}get firstVariantDescription(){return this._firstVariantDescription}get secondVariantDescription(){return this._secondVariantDescription}get firstVariantCollectedVotes(){return this.calcVotes(this._firstVariantCountRub)}get secondVariantCollectedVotes(){return this.calcVotes(this._secondVariantCountRub)}get firstVariantCollectedVotesFormatted(){return h(this.firstVariantCollectedVotes)}get secondVariantCollectedVotesFormatted(){return h(this.secondVariantCollectedVotes)}get donationOnAir(){return this._donationOnAir}get voices(){return this._voices}get isTTSEnable(){return this._isTTSEnable}get isAIEnable(){var t;return((t=this._ai)==null?void 0:t.isEnabled)??!1}get isSafeEnable(){var t;return((t=this._safe)==null?void 0:t.isEnable)??!1}get isWonderEnable(){var t;return((t=this._wonder)==null?void 0:t.isEnable)??!1}get ttsMinAmount(){return this._voiceLimit}get aiMinAmount(){return this._ai?Number(this._ai.minAmount):0}get safeMinAmount(){return this._safe?Number(this._safe.minAmount):0}get wonderMinAmount(){return this._wonder?Number(this._wonder.minAmount):0}get actions(){const t=[];return this._actions.forEach(i=>t.push(i)),t}get activities(){const t=[];return this._activities.forEach(i=>t.push(i)),t}get quizCategories(){return this._quizCategories}get isTgButton(){return this._isTgButton}get ai(){return this._ai}get safe(){return this._safe}get wonder(){return this._wonder}get isAddedCreditCard(){return this._isAddedCreditCard}get isEmailConfirmation(){return this._isEmailConfirmation}get isPhoneConfirmation(){return this._isPhoneConfirmation}get isAddedPhone(){return this._isAddedPhone}get isAvailable(){return this.isAddedCreditCard&&this.isPhoneConfirmation}get isPro(){return this._isPro}setLoading(t){this._isLoading=t}getActivityNameById(t){const i=this._activities.get(t);return i&&i.name?i.name:g[t]}setFromApi(t){var i,e,s,n,r,o;t&&(this._login=t.pageSettings.login,this._username=t.username,this._avatar=t.pageSettings.avatar,this._title=t.pageSettings.title,this._branding=t.pageSettings.branding,this._successDescription=t.pageSettings.successDescription,this._buttonText=t.pageSettings.buttonText,this._rules=t.pageSettings.rules,this._isWallEnabled=((i=t.wall)==null?void 0:i.isEnabled)??t.pageSettings.isWallEnabled??!1,this._minAmountWall=((e=t.wall)==null?void 0:e.minAmount)??((s=t.wall)==null?void 0:s.minDonationAmount)??t.pageSettings.minAmountWall??"0",this._telegram=t.pageSettings.socials.telegram||"",this._youtube=t.pageSettings.socials.youtube||"",this._twitch=t.pageSettings.socials.twitch||"",this._vk=t.pageSettings.socials.vk||"",this.setActivities(t),this.setActions(t),this.setSounds(t),this._firstVariant=t.iHaveTo.firstVariant||"",this._secondVariant=t.iHaveTo.secondVariant||"",this._firstVariantDescription=t.iHaveTo.firstVariantDescription||"",this._secondVariantDescription=t.iHaveTo.secondVariantDescription||"",this._votePrice=t.iHaveTo.votePrice||"",this._firstVariantCountRub=((n=t.iHaveTo.votingResult)==null?void 0:n.firstVariantCount)??0,this._secondVariantCountRub=((r=t.iHaveTo.votingResult)==null?void 0:r.secondVariantCount)??0,this._isAddedCreditCard=t.isAddedCreditCard||!1,this._isEmailConfirmation=t.isEmailConfirmation||!1,this._isPhoneConfirmation=t.isPhoneConfirmation||!1,this._isAddedPhone=t.isPhone||!1,this._isPro=t.isPro||!1,Array.isArray(t.quizCategories)&&(this._quizCategories=t.quizCategories),t.onAir&&(this._donationOnAir=t.onAir),(o=t.pageSettings.partnerFunctions)!=null&&o.isTgButton&&(this._isTgButton=!0),t.donationSettings.voiceLimit&&(this._voiceLimit=t.donationSettings.voiceLimit),t.AI&&(this._ai=t.AI),t.safe&&(this._safe=t.safe),t.wonder&&(this._wonder=t.wonder))}setActivities(t){this._activities.clear(),t.activitiesList.forEach(i=>{i.typeId===a.QuestionAnswer||i.isActive&&i.typeId>=a.Quiz&&this._activities.set(i.typeId,i)})}setActions(t){this._actions.clear(),t.actionsList.forEach(i=>this._actions.set(i.id,i))}setSounds(t){this._isTTSEnable=t.sounds.isTTSEnable,this._voices=[],t.sounds.voices.forEach(i=>{this._voices.push(new c(i))})}calcVotes(t){const i=Number(this._votePrice);return!Number.isFinite(i)||i<=0||!Number.isFinite(t)||t<=0?0:Math.floor(t/i)}}export{A as D};