fansunited-widgets-cdn 0.0.5 → 0.0.6

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.
@@ -2295,4 +2295,4 @@ SPDX-License-Identifier: Apache-2.0
2295
2295
  * See the License for the specific language governing permissions and
2296
2296
  * limitations under the License.
2297
2297
  */const tO="AsyncQueue";class nO{constructor(e=Promise.resolve()){this.Vu=[],this.mu=!1,this.fu=[],this.gu=null,this.pu=!1,this.yu=!1,this.wu=[],this.a_=new nne(this,"async_queue_retry"),this.Su=()=>{const i=r0();i&&$r(tO,"Visibility state changed to "+i.visibilityState),this.a_.t_()},this.bu=e;const n=r0();n&&typeof n.addEventListener=="function"&&n.addEventListener("visibilitychange",this.Su)}get isShuttingDown(){return this.mu}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.Du(),this.vu(e)}enterRestrictedMode(e){if(!this.mu){this.mu=!0,this.yu=e||!1;const n=r0();n&&typeof n.removeEventListener=="function"&&n.removeEventListener("visibilitychange",this.Su)}}enqueue(e){if(this.Du(),this.mu)return new Promise(()=>{});const n=new Rd;return this.vu(()=>this.mu&&this.yu?Promise.resolve():(e().then(n.resolve,n.reject),n.promise)).then(()=>n.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.Vu.push(e),this.Cu()))}async Cu(){if(this.Vu.length!==0){try{await this.Vu[0](),this.Vu.shift(),this.a_.reset()}catch(e){if(!Zte(e))throw e;$r(tO,"Operation failed with retryable error: "+e)}this.Vu.length>0&&this.a_.Xo(()=>this.Cu())}}vu(e){const n=this.bu.then(()=>(this.pu=!0,e().catch(i=>{this.gu=i,this.pu=!1;const r=function(c){let d=c.message||"";return c.stack&&(d=c.stack.includes(c.message)?c.stack:c.message+`
2298
- `+c.stack),d}(i);throw $P("INTERNAL UNHANDLED ERROR: ",r),i}).then(i=>(this.pu=!1,i))));return this.bu=n,n}enqueueAfterDelay(e,n,i){this.Du(),this.wu.indexOf(e)>-1&&(n=0);const r=a0.createAndSchedule(this,e,n,i,o=>this.Fu(o));return this.fu.push(r),r}Du(){this.gu&&n0()}verifyOperationInProgress(){}async Mu(){let e;do e=this.bu,await e;while(e!==this.bu)}xu(e){for(const n of this.fu)if(n.timerId===e)return!0;return!1}Ou(e){return this.Mu().then(()=>{this.fu.sort((n,i)=>n.targetTimeMs-i.targetTimeMs);for(const n of this.fu)if(n.skipDelay(),e!=="all"&&n.timerId===e)break;return this.Mu()})}Nu(e){this.wu.push(e)}Fu(e){const n=this.fu.indexOf(e);this.fu.splice(n,1)}}class lne extends eO{constructor(e,n,i,r){super(e,n,i,r),this.type="firestore",this._queue=new nO,this._persistenceKey=(r==null?void 0:r.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new nO(e),this._firestoreClient=void 0,await e}}}function cne(t,e){const n=typeof t=="object"?t:Ab(),i=typeof t=="string"?t:i0,r=Do(n,"firestore").getImmediate({identifier:i});if(!r._initialized){const o=nJ("firestore");o&&one(r,...o)}return r}(function(e,n=!0){(function(r){Id=r})(rc),la(new Hr("firestore",(i,{instanceIdentifier:r,options:o})=>{const c=i.getProvider("app").getImmediate(),d=new lne(new Qte(i.getProvider("auth-internal")),new Xte(c,i.getProvider("app-check-internal")),function(f,g){if(!Object.prototype.hasOwnProperty.apply(f.options,["projectId"]))throw new Li(Fi.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new Nf(f.options.projectId,g)}(c,r),c);return o=Object.assign({useFetchStreams:n},o),d._setSettings(o),d},"PUBLIC").setMultipleInstances(!0)),vr(jP,HP,e),vr(jP,HP,"esm2017")})();let s0;const une=t=>{const e=cA(t);s0=$te(e);const n=HZ(e),i=cne(e);return{app:e,auth:s0,analytics:n,db:i}},o0=({contentType:t,contentId:e,config:n,leadFields:i,leadPosition:r,campaignId:o,campaignName:c})=>{var C,x,E;const[d,p]=O.useState(!0),[f,g]=O.useState(null),v=O.useMemo(()=>{var M;return(M=n.theme)!=null&&M.primaryColor?jg({...H_,colorSchemes:{light:{palette:{primary:n.theme.primaryColor}},dark:{palette:{primary:n.theme.primaryColor}}}}):H_},[(C=n.theme)==null?void 0:C.primaryColor]);O.useEffect(()=>{une(n.firebase);const M=s0.onAuthStateChanged(N=>{N&&N.getIdToken().then(B=>{const F=IK({apiKey:n.fansUnited.apiKey,environment:n.fansUnited.environment,clientId:n.fansUnited.clientId,lang:n.fansUnited.lang,idSchema:"native",errorHandlingMode:"standard",authProvider:{getIdToken(){return B},logout(){}}});g(F),p(!1)})});return()=>M()},[]);const w=()=>{switch(t){case"classic-quiz":return _.jsx(WY,{initialQuizId:e});case"either-or":return _.jsx(FG,{initialGameId:e});case"list":{const{classicQuizUrl:M,eitherOrUrl:N,pollUrl:B,matchQuizUrl:F}=n.list||{};return _.jsx(tW,{contentId:e,classicQuizUrl:M,eitherOrUrl:N,pollUrl:B,matchQuizUrl:F})}default:return _.jsxs("div",{children:["Unknown content type: ",t]})}};return d?_.jsx(BI,{}):_.jsx(VL,{theme:v,defaultMode:((x=n.theme)==null?void 0:x.mode)||"light",defaultColorScheme:((E=n.theme)==null?void 0:E.mode)||"light",colorSchemeStorageKey:"fu-widget-color-scheme",modeStorageKey:"fu-widget-mode",disableNestedContext:!0,children:_.jsx(N_.Provider,{value:{fields:i??[],position:r??"after",campaignId:o,campaignName:c},children:_.jsx(VI.Provider,{value:f,children:w()})})})},{slice:dne,forEach:pne}=[];function hne(t){return pne.call(dne.call(arguments,1),e=>{if(e)for(const n in e)t[n]===void 0&&(t[n]=e[n])}),t}const iO=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,fne=function(t,e){const i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},r=encodeURIComponent(e);let o=`${t}=${r}`;if(i.maxAge>0){const c=i.maxAge-0;if(Number.isNaN(c))throw new Error("maxAge should be a Number");o+=`; Max-Age=${Math.floor(c)}`}if(i.domain){if(!iO.test(i.domain))throw new TypeError("option domain is invalid");o+=`; Domain=${i.domain}`}if(i.path){if(!iO.test(i.path))throw new TypeError("option path is invalid");o+=`; Path=${i.path}`}if(i.expires){if(typeof i.expires.toUTCString!="function")throw new TypeError("option expires is invalid");o+=`; Expires=${i.expires.toUTCString()}`}if(i.httpOnly&&(o+="; HttpOnly"),i.secure&&(o+="; Secure"),i.sameSite)switch(typeof i.sameSite=="string"?i.sameSite.toLowerCase():i.sameSite){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return o},rO={create(t,e,n,i){let r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};n&&(r.expires=new Date,r.expires.setTime(r.expires.getTime()+n*60*1e3)),i&&(r.domain=i),document.cookie=fne(t,encodeURIComponent(e),r)},read(t){const e=`${t}=`,n=document.cookie.split(";");for(let i=0;i<n.length;i++){let r=n[i];for(;r.charAt(0)===" ";)r=r.substring(1,r.length);if(r.indexOf(e)===0)return r.substring(e.length,r.length)}return null},remove(t){this.create(t,"",-1)}};var mne={name:"cookie",lookup(t){let{lookupCookie:e}=t;if(e&&typeof document<"u")return rO.read(e)||void 0},cacheUserLanguage(t,e){let{lookupCookie:n,cookieMinutes:i,cookieDomain:r,cookieOptions:o}=e;n&&typeof document<"u"&&rO.create(n,t,i,r,o)}},gne={name:"querystring",lookup(t){var i;let{lookupQuerystring:e}=t,n;if(typeof window<"u"){let{search:r}=window.location;!window.location.search&&((i=window.location.hash)==null?void 0:i.indexOf("?"))>-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));const c=r.substring(1).split("&");for(let d=0;d<c.length;d++){const p=c[d].indexOf("=");p>0&&c[d].substring(0,p)===e&&(n=c[d].substring(p+1))}}return n}};let _d=null;const aO=()=>{if(_d!==null)return _d;try{_d=window!=="undefined"&&window.localStorage!==null;const t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{_d=!1}return _d};var yne={name:"localStorage",lookup(t){let{lookupLocalStorage:e}=t;if(e&&aO())return window.localStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupLocalStorage:n}=e;n&&aO()&&window.localStorage.setItem(n,t)}};let Ad=null;const sO=()=>{if(Ad!==null)return Ad;try{Ad=window!=="undefined"&&window.sessionStorage!==null;const t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{Ad=!1}return Ad};var vne={name:"sessionStorage",lookup(t){let{lookupSessionStorage:e}=t;if(e&&sO())return window.sessionStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupSessionStorage:n}=e;n&&sO()&&window.sessionStorage.setItem(n,t)}},bne={name:"navigator",lookup(t){const e=[];if(typeof navigator<"u"){const{languages:n,userLanguage:i,language:r}=navigator;if(n)for(let o=0;o<n.length;o++)e.push(n[o]);i&&e.push(i),r&&e.push(r)}return e.length>0?e:void 0}},wne={name:"htmlTag",lookup(t){let{htmlTag:e}=t,n;const i=e||(typeof document<"u"?document.documentElement:null);return i&&typeof i.getAttribute=="function"&&(n=i.getAttribute("lang")),n}},Sne={name:"path",lookup(t){var r;let{lookupFromPathIndex:e}=t;if(typeof window>"u")return;const n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(n)?(r=n[typeof e=="number"?e:0])==null?void 0:r.replace("/",""):void 0}},Cne={name:"subdomain",lookup(t){var r,o;let{lookupFromSubdomainIndex:e}=t;const n=typeof e=="number"?e+1:1,i=typeof window<"u"&&((o=(r=window.location)==null?void 0:r.hostname)==null?void 0:o.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));if(i)return i[n]}};let oO=!1;try{document.cookie,oO=!0}catch{}const lO=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];oO||lO.splice(1,1);const Tne=()=>({order:lO,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:t=>t});class cO{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(e,n)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=e,this.options=hne(n,this.options||{},Tne()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=r=>r.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(mne),this.addDetector(gne),this.addDetector(yne),this.addDetector(vne),this.addDetector(bne),this.addDetector(wne),this.addDetector(Sne),this.addDetector(Cne)}addDetector(e){return this.detectors[e.name]=e,this}detect(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,n=[];return e.forEach(i=>{if(this.detectors[i]){let r=this.detectors[i].lookup(this.options);r&&typeof r=="string"&&(r=[r]),r&&(n=n.concat(r))}}),n=n.map(i=>this.options.convertDetectedLanguage(i)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?n:n.length>0?n[0]:null}cacheUserLanguage(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;n&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||n.forEach(i=>{this.detectors[i]&&this.detectors[i].cacheUserLanguage(e,this.options)}))}}cO.type="languageDetector";const xne={metadata:{language:"Bulgarian",code:"bg",direction:"ltr"},common:{back:"Назад",close:"Затвори",privacyPolicy:"Политика за поверителност",termsAndConditions:"Условия за ползване",labels:{time:"Време",min:"мин",sec:"сек",or:"или",of:"от",point_one:"Точки",point_other:"Точки"},loadMore:"Зареди още",loading:"Зареждане..."},quizzes:{label_one:"Куиз",label_other:"Куизове",subHeader:{title:"Куизове, анкети и други мини игри",description:"Разгледайте нашата селекция от куизове, анкети, игри и се забавлявайте!"},participant_one:"Участник",participant_other:"Участници",averageScore:"Среден резултат",question_one:"Въпрос",question_many:"Въпроси",question_other:"Въпроса",maxAttempts:"Максимален брой опити",timeRemaining:"Оставащо време",buttons:{finish:"Завърши куиза",start:"Започни куиза",playAgain:"Играй отново",playNext:"Играй този куиз",next:"Следващ въпрос",share:"Сподели резултата"},noQuizzes:{title:"Няма налични куизове",description:"В момента няма налични куизове. Проверете по-късно за нови предизвикателства!"},results:{score:"Твоят резултат",correctAnswers:"Верни отговори",messagePerfect:"Перфектно!",messageAmazing:"Страхотно!",messageWellDone:"Браво!",messageGoodEffort:"Добър опит!",messageKeepGoing:"Продължавай в същия дух!",loadingRecommendations:"Зареждане на препоръки за следващ куиз...",recommendedForYou:"Препоръчани куизове за теб",answers:{show:"Покажи отговорите",yours:"Твоят отговор",correct:"Верен отговор"},stats:{skipped:"Пропуснати",correct:"Верни",incorrect:"Грешни"},share:{title:"Сподели с приятел",clipboard_alert:"Резултатите ти бяха копирани в клипборда.",iosTitleOne:"Аз направих {{score}}% за {{time}}. Можеш ли да го подобриш?",iosTitleTwo:"Аз направих {{score}}%. Можеш ли да го подобриш?",androidTitle:"Можеш ли да подобриш моя резултат?",iosShareBody:'Аз направих {{score}}%. Виж този "{{quizTitle}}" на App Name и провери дали можеш да подобриш моя резултат! {{hashtags}}',androidShareBodyOne:'Аз направих {{score}}% за {{time}}. Виж този "{{quizTitle}}" на App Name и провери дали можеш да подобриш моя резултат! {{hashtags}}',androidShareBodyTwo:'Аз направих {{score}}%. Виж този "{{quizTitle}}" на App Name и провери дали можеш да подобриш моя резултат! {{hashtags}}'}}},leads:{header:{title:"Попълни и участвай за награда!",description:"Попълни формата и вземи участие в томбола за да спечелиш страхотна награда!"},buttons:{submit:"Изпрати и участвай"},form:{submit:"Изпрати",success:"Успешно изпратена форма",error:"Грешка при изпращане на формата. Моля опитайте отново.",fullName:"Име и фамилия",fullNamePlaceholder:"Въведете вашето име и фамилия",firstName:"Име",firstNamePlaceholder:"Въведете вашето име",lastName:"Фамилия",lastNamePlaceholder:"Въведете вашата фамилия",email:"Имейл",phone:"Телефон",phonePlaceholder:"Вашият телефонен номер",gender:"Пол",genderPlaceholder:"Изберете пол",genderOptions:{male:"Мъж",female:"Жена",other:"Друг",notSay:"Предпочитам да не казвам"},country:"Държава",countryPlaceholder:"Изберете държава от списъка"},success:{title:"Успешно изпратена форма!",subtitle:"Благодарим ви за участието.",description:"Ще бъдете уведомени ако спечелите наградата в рамките на 3 работни дни."}},prize:{title:"🏆 Спечелете награда!",description:"Завършете играта и участвайте в томбола за да спечелите награда!",cta:"Виж условията за ползване",termsAndConditions:"Условия за ползване"},eitherOr:{label_one:"Кое от двете?",label_other:"Кое от двете? игри",buttons:{play:"Играй",start:"Започни играта",playAgain:"Играй отново",share:"Сподели резултата"},tutorial:{howToPlay:"Как се играе",step1Title:"Бързи решения",step1Description:"Избери една от две опции преди времето да изтече. Избирай внимателно!",step2Title:"3 Живота",step2Description:"Играй докато не изгубиш всичките си 3 живота. Всяко грешно решение ти отнема живот.",step3Title:"Печели точки",step3Description:"Печели точки за вярни отговори. Създавай серии за бонус точки! Сравни резултата си с други играчи."},betterThanLabel:"Твоят личен рекорд е {{points}} точки и си по-добър от {{percentile}}% от играчите.",personalBest:"Личен рекорд",personalBestImprovedTitle:"Поздравления!",personalBestImprovedSubtitle:"Току-що подобри личния си рекорд!",yourScore:"Твоят резултат"}},Ine={metadata:{language:"English",code:"en",direction:"ltr"},common:{back:"Back",close:"Close",privacyPolicy:"Privacy Policy",termsAndConditions:"Terms and Conditions",labels:{time:"Time",min:"Min",sec:"Sec",or:"or",of:"of",point_one:"Point",point_other:"Points",leaderboard:"Leaderboard"},loadMore:"Load More",loading:"Loading..."},quizzes:{label_one:"Quiz",label_other:"Quizzes",subHeader:{title:"Quizzes, Polls and More",description:"Explore our selection of quizzes, polls, games and have fun!"},participant_one:"Participant",participant_other:"Participants",averageScore:"Average Score",question_one:"Question",question_many:"Questions",question_other:"Questions",maxAttempts:"Max Attempts",timeRemaining:"Time Remaining",buttons:{finish:"Finish Quiz",start:"Start the Quiz",playAgain:"Play Again",playNext:"Play Next",next:"Next Question",share:"Share Results"},noQuizzes:{title:"No Quizzes Available",description:"There are no quizzes available at the moment. Check back later for new challenges!"},results:{score:"Your Score",correctAnswers:"Correct Answers",messagePerfect:"Perfect!",messageAmazing:"Amazing!",messageWellDone:"Well Done!",messageGoodEffort:"Good Effort!",messageKeepGoing:"Keep Going!",loadingRecommendations:"Loading recommendations for the next quiz...",recommendedForYou:"Recommended quizzes for You",answers:{show:"Show answers",yours:"Your answer",correct:"Correct answer"},stats:{skipped:"Skipped",correct:"Correct",incorrect:"Wrong"},share:{title:"Share with a friend",clipboard_alert:"Your results were copied to the clipboard.",iosTitleOne:"I scored {{score}}% in {{time}}. Can you beat it?",iosTitleTwo:"I scored {{score}}%. Can you beat it?",androidTitle:"Can you beat my score?",iosShareBody:'I scored {{score}}%. Check out this "{{quizTitle}}" on App Name and see if you can beat my score! {{hashtags}}',androidShareBodyOne:'I scored {{score}}% in {{time}}. Check out this "{{quizTitle}}" on App Name and see if you can beat my score! {{hashtags}}',androidShareBodyTwo:'I scored {{score}}%. Check out this "{{quizTitle}}" on App Name and see if you can beat my score! {{hashtags}}'}}},leads:{header:{title:"Enter Prize Draw",description:"Enter your details below in order to be contacted in case of winning."},buttons:{submit:"Submit and Participate"},form:{submit:"Submit the form",success:"Form was successfully submitted.",error:"There was an error submitting the form. Please try again.",fullName:"Full name",fullNamePlaceholder:"Enter your full name",firstName:"First name",firstNamePlaceholder:"Enter your first name",lastName:"Last name",lastNamePlaceholder:"Enter your last name",email:"Email",phone:"Phone number",phonePlaceholder:"Your phone number",gender:"Gender",genderPlaceholder:"Select your gender",genderOptions:{male:"Male",female:"Female",other:"Other",notSay:"Prefer not to say"},country:"Country",countryPlaceholder:"Select your country"},success:{title:"Entry Submitted Successfully!",subtitle:"Thank you for entering.",description:"We'll contact you within 24 hours if you're the winner."}},prize:{title:"🏆 Win a Prize!",description:"Complete this quiz for a chance to win amazing rewards!",cta:"Read the Terms & Conditions",termsAndConditions:"Terms & Conditions"},eitherOr:{label_one:"Either/Or",label_other:"Either/Or Games",buttons:{play:"Play",start:"Start Game",playAgain:"Play Again",share:"Share Results"},tutorial:{howToPlay:"How to Play",step1Title:"Quick Decisions",step1Description:"You have 10 seconds to choose between two options. Choose wisely!",step2Title:"Three Lives",step2Description:"You start with 3 lives. Each wrong answer costs you one life. Game ends when you run out of lives.",step3Title:"Score Points",step3Description:"Earn points for correct answers. Build streaks for bonus points! Compare your score with other players."},betterThanLabel:"Your personal best is {{points}} points and you are better than {{percentile}}% of players.",personalBest:"Personal Best",personalBestImprovedTitle:"Congratulations!",personalBestImprovedSubtitle:"You just broke your personal record!",yourScore:"Your Score"}};ui.use(cO).use(aG).init({resources:{en:{common:Ine},bg:{common:xne}},fallbackLng:"en",supportedLngs:["en","bg"],defaultNS:"common",ns:["common"],interpolation:{escapeValue:!1},detection:{order:["path","localStorage","navigator"],lookupFromPathIndex:0,caches:["localStorage"]},react:{useSuspense:!0}});const Ene=(t,e)=>{var c,d,p,f;const n=t.getAttribute("data-lead-fields"),i=n?n.split(","):(c=e.leads)==null?void 0:c.defaultFields,r={contentType:t.getAttribute("data-content-type")||"",contentId:t.getAttribute("data-content-id")||"",config:e,leadFields:i,leadPosition:t.getAttribute("data-lead-position")||((d=e.leads)==null?void 0:d.position)||"after",campaignId:t.getAttribute("data-campaign-id")||((p=e.leads)==null?void 0:p.campaignId)||"",campaignName:t.getAttribute("data-campaign-name")||((f=e.leads)==null?void 0:f.campaignName)||""};rg.createRoot(t).render(O.createElement(O.StrictMode,null,O.createElement(o0,r)))},Rne=(t,e)=>{var c,d,p,f;const n=t.getAttribute("data-lead-fields"),i=n?n.split(","):(c=e.leads)==null?void 0:c.defaultFields,r={contentType:t.getAttribute("data-content-type")||"",contentId:t.getAttribute("data-content-id")||"",config:e,leadFields:i,leadPosition:t.getAttribute("data-lead-position")||((d=e.leads)==null?void 0:d.position)||"after",campaignId:t.getAttribute("data-campaign-id")||((p=e.leads)==null?void 0:p.campaignId)||"",campaignName:t.getAttribute("data-campaign-name")||((f=e.leads)==null?void 0:f.campaignName)||""};rg.createRoot(t).render(O.createElement(O.StrictMode,null,O.createElement(o0,r)))},_ne=(t,e)=>{const n={contentType:t.getAttribute("data-content-type")||"",contentId:t.getAttribute("data-content-id")||"",config:e,classicQuizUrl:t.getAttribute("data-classic-quiz-url")||void 0,eitherOrUrl:t.getAttribute("data-either-or-url")||void 0,pollUrl:t.getAttribute("data-poll-url")||void 0,matchQuizUrl:t.getAttribute("data-match-quiz-url")||void 0};rg.createRoot(t).render(O.createElement(O.StrictMode,null,O.createElement(o0,n)))};class Ane{constructor(){s(this,"config",null);s(this,"initializeWidgets",()=>{console.log("initializeWidgets called");const e=document.querySelectorAll('[data-component="fu-widget"]');console.log("Found widgets:",e.length),e.forEach(n=>{if(!(n instanceof HTMLElement))return;const i=n.getAttribute("data-content-type");if(console.log("Processing widget:",i),!this.config)throw new Error("Widget not initialized");switch(i){case"classic-quiz":Ene(n,this.config);break;case"poll":console.log("Poll widget not yet implemented");break;case"either-or":Rne(n,this.config);break;case"list":_ne(n,this.config);break;case"single-prediction":console.log("Single Prediction widget not yet implemented");break;case"match-quiz":console.log("Match Quiz widget not yet implemented");break;default:console.error(`Unknown content type: ${i}`)}})})}init(e){var n,i,r,o,c,d,p,f,g,v,w,C,x,E,M;console.log("WidgetLoader init called"),this.config={firebase:{projectId:((n=e.firebase)==null?void 0:n.projectId)||"",appId:((i=e.firebase)==null?void 0:i.appId)||"",apiKey:((r=e.firebase)==null?void 0:r.apiKey)||"",authDomain:((o=e.firebase)==null?void 0:o.authDomain)||"",measurementId:(c=e.firebase)==null?void 0:c.measurementId},fansUnited:{apiKey:((d=e.fansUnited)==null?void 0:d.apiKey)||"",environment:((p=e.fansUnited)==null?void 0:p.environment)||"prod",clientId:((f=e.fansUnited)==null?void 0:f.clientId)||"",lang:((g=e.fansUnited)==null?void 0:g.lang)||"en",idSchema:((v=e.fansUnited)==null?void 0:v.idSchema)||"native",errorHandlingMode:((w=e.fansUnited)==null?void 0:w.errorHandlingMode)||"default"},theme:e.theme?{mode:e.theme.mode,primaryColor:e.theme.primaryColor}:void 0,leads:{defaultFields:((C=e.leads)==null?void 0:C.defaultFields)||["fullName","email"],position:((x=e.leads)==null?void 0:x.position)||"after",campaignId:((E=e.leads)==null?void 0:E.campaignId)||"",campaignName:((M=e.leads)==null?void 0:M.campaignName)||""}},console.log("Config set, initializing widgets"),document.readyState==="loading"?(console.log("Document still loading, adding DOMContentLoaded listener"),document.addEventListener("DOMContentLoaded",this.initializeWidgets)):(console.log("Document already loaded, initializing widgets immediately"),this.initializeWidgets())}}const uO=new Ane;return window.FuWidget={init:t=>uO.init(t)},uO}();
2298
+ `+c.stack),d}(i);throw $P("INTERNAL UNHANDLED ERROR: ",r),i}).then(i=>(this.pu=!1,i))));return this.bu=n,n}enqueueAfterDelay(e,n,i){this.Du(),this.wu.indexOf(e)>-1&&(n=0);const r=a0.createAndSchedule(this,e,n,i,o=>this.Fu(o));return this.fu.push(r),r}Du(){this.gu&&n0()}verifyOperationInProgress(){}async Mu(){let e;do e=this.bu,await e;while(e!==this.bu)}xu(e){for(const n of this.fu)if(n.timerId===e)return!0;return!1}Ou(e){return this.Mu().then(()=>{this.fu.sort((n,i)=>n.targetTimeMs-i.targetTimeMs);for(const n of this.fu)if(n.skipDelay(),e!=="all"&&n.timerId===e)break;return this.Mu()})}Nu(e){this.wu.push(e)}Fu(e){const n=this.fu.indexOf(e);this.fu.splice(n,1)}}class lne extends eO{constructor(e,n,i,r){super(e,n,i,r),this.type="firestore",this._queue=new nO,this._persistenceKey=(r==null?void 0:r.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new nO(e),this._firestoreClient=void 0,await e}}}function cne(t,e){const n=typeof t=="object"?t:Ab(),i=typeof t=="string"?t:i0,r=Do(n,"firestore").getImmediate({identifier:i});if(!r._initialized){const o=nJ("firestore");o&&one(r,...o)}return r}(function(e,n=!0){(function(r){Id=r})(rc),la(new Hr("firestore",(i,{instanceIdentifier:r,options:o})=>{const c=i.getProvider("app").getImmediate(),d=new lne(new Qte(i.getProvider("auth-internal")),new Xte(c,i.getProvider("app-check-internal")),function(f,g){if(!Object.prototype.hasOwnProperty.apply(f.options,["projectId"]))throw new Li(Fi.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new Nf(f.options.projectId,g)}(c,r),c);return o=Object.assign({useFetchStreams:n},o),d._setSettings(o),d},"PUBLIC").setMultipleInstances(!0)),vr(jP,HP,e),vr(jP,HP,"esm2017")})();let s0;const une=t=>{const e=cA(t);s0=$te(e);const n=HZ(e),i=cne(e);return{app:e,auth:s0,analytics:n,db:i}},o0=({contentType:t,contentId:e,config:n,leadFields:i,leadPosition:r,campaignId:o,campaignName:c})=>{var C,x,E;const[d,p]=O.useState(!0),[f,g]=O.useState(null),v=O.useMemo(()=>{var M;return(M=n.theme)!=null&&M.primaryColor?jg({...H_,colorSchemes:{light:{palette:{primary:n.theme.primaryColor}},dark:{palette:{primary:n.theme.primaryColor}}}}):H_},[(C=n.theme)==null?void 0:C.primaryColor]);O.useEffect(()=>{une(n.firebase);const M=s0.onAuthStateChanged(N=>{N&&N.getIdToken().then(B=>{const F=IK({apiKey:n.fansUnited.apiKey,environment:n.fansUnited.environment,clientId:n.fansUnited.clientId,lang:n.fansUnited.lang,idSchema:"native",errorHandlingMode:"standard",authProvider:{getIdToken(){return B},logout(){}}});g(F),p(!1)})});return()=>M()},[]);const w=()=>{switch(t){case"classic-quiz":return _.jsx(WY,{initialQuizId:e});case"either-or":return _.jsx(FG,{initialGameId:e});case"list":{const{classicQuizUrl:M,eitherOrUrl:N,pollUrl:B,matchQuizUrl:F}=n.list||{};return _.jsx(tW,{contentId:e,classicQuizUrl:M,eitherOrUrl:N,pollUrl:B,matchQuizUrl:F})}default:return _.jsxs("div",{children:["Unknown content type: ",t]})}};return d?_.jsx(BI,{}):_.jsx(VL,{theme:v,defaultMode:((x=n.theme)==null?void 0:x.mode)||"light",defaultColorScheme:((E=n.theme)==null?void 0:E.mode)||"light",colorSchemeStorageKey:"fu-widget-color-scheme",modeStorageKey:"fu-widget-mode",disableNestedContext:!0,children:_.jsx(N_.Provider,{value:{fields:i??[],position:r??"after",campaignId:o,campaignName:c},children:_.jsx(VI.Provider,{value:f,children:w()})})})},{slice:dne,forEach:pne}=[];function hne(t){return pne.call(dne.call(arguments,1),e=>{if(e)for(const n in e)t[n]===void 0&&(t[n]=e[n])}),t}const iO=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,fne=function(t,e){const i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},r=encodeURIComponent(e);let o=`${t}=${r}`;if(i.maxAge>0){const c=i.maxAge-0;if(Number.isNaN(c))throw new Error("maxAge should be a Number");o+=`; Max-Age=${Math.floor(c)}`}if(i.domain){if(!iO.test(i.domain))throw new TypeError("option domain is invalid");o+=`; Domain=${i.domain}`}if(i.path){if(!iO.test(i.path))throw new TypeError("option path is invalid");o+=`; Path=${i.path}`}if(i.expires){if(typeof i.expires.toUTCString!="function")throw new TypeError("option expires is invalid");o+=`; Expires=${i.expires.toUTCString()}`}if(i.httpOnly&&(o+="; HttpOnly"),i.secure&&(o+="; Secure"),i.sameSite)switch(typeof i.sameSite=="string"?i.sameSite.toLowerCase():i.sameSite){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return o},rO={create(t,e,n,i){let r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};n&&(r.expires=new Date,r.expires.setTime(r.expires.getTime()+n*60*1e3)),i&&(r.domain=i),document.cookie=fne(t,encodeURIComponent(e),r)},read(t){const e=`${t}=`,n=document.cookie.split(";");for(let i=0;i<n.length;i++){let r=n[i];for(;r.charAt(0)===" ";)r=r.substring(1,r.length);if(r.indexOf(e)===0)return r.substring(e.length,r.length)}return null},remove(t){this.create(t,"",-1)}};var mne={name:"cookie",lookup(t){let{lookupCookie:e}=t;if(e&&typeof document<"u")return rO.read(e)||void 0},cacheUserLanguage(t,e){let{lookupCookie:n,cookieMinutes:i,cookieDomain:r,cookieOptions:o}=e;n&&typeof document<"u"&&rO.create(n,t,i,r,o)}},gne={name:"querystring",lookup(t){var i;let{lookupQuerystring:e}=t,n;if(typeof window<"u"){let{search:r}=window.location;!window.location.search&&((i=window.location.hash)==null?void 0:i.indexOf("?"))>-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));const c=r.substring(1).split("&");for(let d=0;d<c.length;d++){const p=c[d].indexOf("=");p>0&&c[d].substring(0,p)===e&&(n=c[d].substring(p+1))}}return n}};let _d=null;const aO=()=>{if(_d!==null)return _d;try{_d=window!=="undefined"&&window.localStorage!==null;const t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{_d=!1}return _d};var yne={name:"localStorage",lookup(t){let{lookupLocalStorage:e}=t;if(e&&aO())return window.localStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupLocalStorage:n}=e;n&&aO()&&window.localStorage.setItem(n,t)}};let Ad=null;const sO=()=>{if(Ad!==null)return Ad;try{Ad=window!=="undefined"&&window.sessionStorage!==null;const t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{Ad=!1}return Ad};var vne={name:"sessionStorage",lookup(t){let{lookupSessionStorage:e}=t;if(e&&sO())return window.sessionStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupSessionStorage:n}=e;n&&sO()&&window.sessionStorage.setItem(n,t)}},bne={name:"navigator",lookup(t){const e=[];if(typeof navigator<"u"){const{languages:n,userLanguage:i,language:r}=navigator;if(n)for(let o=0;o<n.length;o++)e.push(n[o]);i&&e.push(i),r&&e.push(r)}return e.length>0?e:void 0}},wne={name:"htmlTag",lookup(t){let{htmlTag:e}=t,n;const i=e||(typeof document<"u"?document.documentElement:null);return i&&typeof i.getAttribute=="function"&&(n=i.getAttribute("lang")),n}},Sne={name:"path",lookup(t){var r;let{lookupFromPathIndex:e}=t;if(typeof window>"u")return;const n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(n)?(r=n[typeof e=="number"?e:0])==null?void 0:r.replace("/",""):void 0}},Cne={name:"subdomain",lookup(t){var r,o;let{lookupFromSubdomainIndex:e}=t;const n=typeof e=="number"?e+1:1,i=typeof window<"u"&&((o=(r=window.location)==null?void 0:r.hostname)==null?void 0:o.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));if(i)return i[n]}};let oO=!1;try{document.cookie,oO=!0}catch{}const lO=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];oO||lO.splice(1,1);const Tne=()=>({order:lO,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:t=>t});class cO{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(e,n)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=e,this.options=hne(n,this.options||{},Tne()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=r=>r.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(mne),this.addDetector(gne),this.addDetector(yne),this.addDetector(vne),this.addDetector(bne),this.addDetector(wne),this.addDetector(Sne),this.addDetector(Cne)}addDetector(e){return this.detectors[e.name]=e,this}detect(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,n=[];return e.forEach(i=>{if(this.detectors[i]){let r=this.detectors[i].lookup(this.options);r&&typeof r=="string"&&(r=[r]),r&&(n=n.concat(r))}}),n=n.map(i=>this.options.convertDetectedLanguage(i)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?n:n.length>0?n[0]:null}cacheUserLanguage(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;n&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||n.forEach(i=>{this.detectors[i]&&this.detectors[i].cacheUserLanguage(e,this.options)}))}}cO.type="languageDetector";const xne={metadata:{language:"Bulgarian",code:"bg",direction:"ltr"},common:{back:"Назад",close:"Затвори",privacyPolicy:"Политика за поверителност",termsAndConditions:"Условия за ползване",labels:{time:"Време",min:"мин",sec:"сек",or:"или",of:"от",point_one:"Точки",point_other:"Точки"},loadMore:"Зареди още",loading:"Зареждане..."},quizzes:{label_one:"Куиз",label_other:"Куизове",subHeader:{title:"Куизове, анкети и други мини игри",description:"Разгледайте нашата селекция от куизове, анкети, игри и се забавлявайте!"},participant_one:"Участник",participant_other:"Участници",averageScore:"Среден резултат",question_one:"Въпрос",question_many:"Въпроси",question_other:"Въпроса",maxAttempts:"Максимален брой опити",timeRemaining:"Оставащо време",buttons:{finish:"Завърши куиза",start:"Започни куиза",playAgain:"Играй отново",playNext:"Играй този куиз",next:"Следващ въпрос",share:"Сподели резултата"},noQuizzes:{title:"Няма налични куизове",description:"В момента няма налични куизове. Проверете по-късно за нови предизвикателства!"},results:{score:"Твоят резултат",correctAnswers:"Верни отговори",messagePerfect:"Перфектно!",messageAmazing:"Страхотно!",messageWellDone:"Браво!",messageGoodEffort:"Добър опит!",messageKeepGoing:"Продължавай в същия дух!",loadingRecommendations:"Зареждане на препоръки за следващ куиз...",recommendedForYou:"Препоръчани куизове за теб",answers:{show:"Покажи отговорите",yours:"Твоят отговор",correct:"Верен отговор"},stats:{skipped:"Пропуснати",correct:"Верни",incorrect:"Грешни"},share:{title:"Сподели с приятел",clipboard_alert:"Резултатите ти бяха копирани в клипборда.",iosTitleOne:"Аз направих {{score}}% за {{time}}. Можеш ли да го подобриш?",iosTitleTwo:"Аз направих {{score}}%. Можеш ли да го подобриш?",androidTitle:"Можеш ли да подобриш моя резултат?",iosShareBody:'Аз направих {{score}}%. Виж този "{{quizTitle}}" на App Name и провери дали можеш да подобриш моя резултат! {{hashtags}}',androidShareBodyOne:'Аз направих {{score}}% за {{time}}. Виж този "{{quizTitle}}" на App Name и провери дали можеш да подобриш моя резултат! {{hashtags}}',androidShareBodyTwo:'Аз направих {{score}}%. Виж този "{{quizTitle}}" на App Name и провери дали можеш да подобриш моя резултат! {{hashtags}}'}}},leads:{header:{title:"Попълни и участвай за награда!",description:"Попълни формата и вземи участие в томбола за да спечелиш страхотна награда!"},buttons:{submit:"Изпрати и участвай"},form:{submit:"Изпрати",success:"Успешно изпратена форма",error:"Грешка при изпращане на формата. Моля опитайте отново.",fullName:"Име и фамилия",fullNamePlaceholder:"Въведете вашето име и фамилия",firstName:"Име",firstNamePlaceholder:"Въведете вашето име",lastName:"Фамилия",lastNamePlaceholder:"Въведете вашата фамилия",email:"Имейл",phone:"Телефон",phonePlaceholder:"Вашият телефонен номер",gender:"Пол",genderPlaceholder:"Изберете пол",genderOptions:{male:"Мъж",female:"Жена",other:"Друг",notSay:"Предпочитам да не казвам"},country:"Държава",countryPlaceholder:"Изберете държава от списъка"},success:{title:"Успешно изпратена форма!",subtitle:"Благодарим ви за участието.",description:"Ще бъдете уведомени ако спечелите наградата в рамките на 3 работни дни."}},prize:{title:"🏆 Спечелете награда!",description:"Завършете играта и участвайте в томбола за да спечелите награда!",cta:"Виж условията за ползване",termsAndConditions:"Условия за ползване"},eitherOr:{label_one:"Кое от двете?",label_other:"Кое от двете? игри",buttons:{play:"Играй",start:"Започни играта",playAgain:"Играй отново",share:"Сподели резултата"},tutorial:{howToPlay:"Как се играе",step1Title:"Бързи решения",step1Description:"Избери една от две опции преди времето да изтече. Избирай внимателно!",step2Title:"3 Живота",step2Description:"Играй докато не изгубиш всичките си 3 живота. Всяко грешно решение ти отнема живот.",step3Title:"Печели точки",step3Description:"Печели точки за вярни отговори. Създавай серии за бонус точки! Сравни резултата си с други играчи."},betterThanLabel:"Твоят личен рекорд е {{points}} точки и си по-добър от {{percentile}}% от играчите.",personalBest:"Личен рекорд",personalBestImprovedTitle:"Поздравления!",personalBestImprovedSubtitle:"Току-що подобри личния си рекорд!",yourScore:"Твоят резултат"}},Ine={metadata:{language:"English",code:"en",direction:"ltr"},common:{back:"Back",close:"Close",privacyPolicy:"Privacy Policy",termsAndConditions:"Terms and Conditions",labels:{time:"Time",min:"Min",sec:"Sec",or:"or",of:"of",point_one:"Point",point_other:"Points",leaderboard:"Leaderboard"},loadMore:"Load More",loading:"Loading..."},quizzes:{label_one:"Quiz",label_other:"Quizzes",subHeader:{title:"Quizzes, Polls and More",description:"Explore our selection of quizzes, polls, games and have fun!"},participant_one:"Participant",participant_other:"Participants",averageScore:"Average Score",question_one:"Question",question_many:"Questions",question_other:"Questions",maxAttempts:"Max Attempts",timeRemaining:"Time Remaining",buttons:{finish:"Finish Quiz",start:"Start the Quiz",playAgain:"Play Again",playNext:"Play Next",next:"Next Question",share:"Share Results"},noQuizzes:{title:"No Quizzes Available",description:"There are no quizzes available at the moment. Check back later for new challenges!"},results:{score:"Your Score",correctAnswers:"Correct Answers",messagePerfect:"Perfect!",messageAmazing:"Amazing!",messageWellDone:"Well Done!",messageGoodEffort:"Good Effort!",messageKeepGoing:"Keep Going!",loadingRecommendations:"Loading recommendations for the next quiz...",recommendedForYou:"Recommended quizzes for You",answers:{show:"Show answers",yours:"Your answer",correct:"Correct answer"},stats:{skipped:"Skipped",correct:"Correct",incorrect:"Wrong"},share:{title:"Share with a friend",clipboard_alert:"Your results were copied to the clipboard.",iosTitleOne:"I scored {{score}}% in {{time}}. Can you beat it?",iosTitleTwo:"I scored {{score}}%. Can you beat it?",androidTitle:"Can you beat my score?",iosShareBody:'I scored {{score}}%. Check out this "{{quizTitle}}" on App Name and see if you can beat my score! {{hashtags}}',androidShareBodyOne:'I scored {{score}}% in {{time}}. Check out this "{{quizTitle}}" on App Name and see if you can beat my score! {{hashtags}}',androidShareBodyTwo:'I scored {{score}}%. Check out this "{{quizTitle}}" on App Name and see if you can beat my score! {{hashtags}}'}}},leads:{header:{title:"Enter Prize Draw",description:"Enter your details below in order to be contacted in case of winning."},buttons:{submit:"Submit and Participate"},form:{submit:"Submit the form",success:"Form was successfully submitted.",error:"There was an error submitting the form. Please try again.",fullName:"Full name",fullNamePlaceholder:"Enter your full name",firstName:"First name",firstNamePlaceholder:"Enter your first name",lastName:"Last name",lastNamePlaceholder:"Enter your last name",email:"Email",phone:"Phone number",phonePlaceholder:"Your phone number",gender:"Gender",genderPlaceholder:"Select your gender",genderOptions:{male:"Male",female:"Female",other:"Other",notSay:"Prefer not to say"},country:"Country",countryPlaceholder:"Select your country"},success:{title:"Entry Submitted Successfully!",subtitle:"Thank you for entering.",description:"We'll contact you within 24 hours if you're the winner."}},prize:{title:"🏆 Win a Prize!",description:"Complete this quiz for a chance to win amazing rewards!",cta:"Read the Terms & Conditions",termsAndConditions:"Terms & Conditions"},eitherOr:{label_one:"Either/Or",label_other:"Either/Or Games",buttons:{play:"Play",start:"Start Game",playAgain:"Play Again",share:"Share Results"},tutorial:{howToPlay:"How to Play",step1Title:"Quick Decisions",step1Description:"You have 10 seconds to choose between two options. Choose wisely!",step2Title:"Three Lives",step2Description:"You start with 3 lives. Each wrong answer costs you one life. Game ends when you run out of lives.",step3Title:"Score Points",step3Description:"Earn points for correct answers. Build streaks for bonus points! Compare your score with other players."},betterThanLabel:"Your personal best is {{points}} points and you are better than {{percentile}}% of players.",personalBest:"Personal Best",personalBestImprovedTitle:"Congratulations!",personalBestImprovedSubtitle:"You just broke your personal record!",yourScore:"Your Score"}};ui.use(cO).use(aG).init({resources:{en:{common:Ine},bg:{common:xne}},fallbackLng:"en",supportedLngs:["en","bg"],defaultNS:"common",ns:["common"],interpolation:{escapeValue:!1},detection:{order:["path","localStorage","navigator"],lookupFromPathIndex:0,caches:["localStorage"]},react:{useSuspense:!0}});const Ene=(t,e)=>{var o,c,d,p;console.log("Initializing classic quiz");const n=t.getAttribute("data-lead-fields"),i=n?n.split(","):(o=e.leads)==null?void 0:o.defaultFields,r={contentType:t.getAttribute("data-content-type")||"",contentId:t.getAttribute("data-content-id")||"",config:e,leadFields:i,leadPosition:t.getAttribute("data-lead-position")||((c=e.leads)==null?void 0:c.position)||"after",campaignId:t.getAttribute("data-campaign-id")||((d=e.leads)==null?void 0:d.campaignId)||"",campaignName:t.getAttribute("data-campaign-name")||((p=e.leads)==null?void 0:p.campaignName)||""};console.log("Props prepared:",r);try{console.log("Creating root for element:",t);const f=rg.createRoot(t);console.log("Root created, rendering App"),f.render(O.createElement(O.StrictMode,null,O.createElement(o0,r))),console.log("App rendered")}catch(f){console.error("Error during React initialization:",f)}},Rne=(t,e)=>{var c,d,p,f;const n=t.getAttribute("data-lead-fields"),i=n?n.split(","):(c=e.leads)==null?void 0:c.defaultFields,r={contentType:t.getAttribute("data-content-type")||"",contentId:t.getAttribute("data-content-id")||"",config:e,leadFields:i,leadPosition:t.getAttribute("data-lead-position")||((d=e.leads)==null?void 0:d.position)||"after",campaignId:t.getAttribute("data-campaign-id")||((p=e.leads)==null?void 0:p.campaignId)||"",campaignName:t.getAttribute("data-campaign-name")||((f=e.leads)==null?void 0:f.campaignName)||""};rg.createRoot(t).render(O.createElement(O.StrictMode,null,O.createElement(o0,r)))},_ne=(t,e)=>{const n={contentType:t.getAttribute("data-content-type")||"",contentId:t.getAttribute("data-content-id")||"",config:e,classicQuizUrl:t.getAttribute("data-classic-quiz-url")||void 0,eitherOrUrl:t.getAttribute("data-either-or-url")||void 0,pollUrl:t.getAttribute("data-poll-url")||void 0,matchQuizUrl:t.getAttribute("data-match-quiz-url")||void 0};rg.createRoot(t).render(O.createElement(O.StrictMode,null,O.createElement(o0,n)))};class Ane{constructor(){s(this,"config",null);s(this,"initializeWidgets",()=>{console.log("initializeWidgets called");const e=document.querySelectorAll('[data-component="fu-widget"]');console.log("Found widgets:",e.length),e.forEach(n=>{if(!(n instanceof HTMLElement))return;const i=n.getAttribute("data-content-type");if(console.log("Processing widget:",i),!this.config)throw new Error("Widget not initialized");switch(i){case"classic-quiz":Ene(n,this.config);break;case"poll":console.log("Poll widget not yet implemented");break;case"either-or":Rne(n,this.config);break;case"list":_ne(n,this.config);break;case"single-prediction":console.log("Single Prediction widget not yet implemented");break;case"match-quiz":console.log("Match Quiz widget not yet implemented");break;default:console.error(`Unknown content type: ${i}`)}})})}init(e){var n,i,r,o,c,d,p,f,g,v,w,C,x,E,M;console.log("WidgetLoader init called"),this.config={firebase:{projectId:((n=e.firebase)==null?void 0:n.projectId)||"",appId:((i=e.firebase)==null?void 0:i.appId)||"",apiKey:((r=e.firebase)==null?void 0:r.apiKey)||"",authDomain:((o=e.firebase)==null?void 0:o.authDomain)||"",measurementId:(c=e.firebase)==null?void 0:c.measurementId},fansUnited:{apiKey:((d=e.fansUnited)==null?void 0:d.apiKey)||"",environment:((p=e.fansUnited)==null?void 0:p.environment)||"prod",clientId:((f=e.fansUnited)==null?void 0:f.clientId)||"",lang:((g=e.fansUnited)==null?void 0:g.lang)||"en",idSchema:((v=e.fansUnited)==null?void 0:v.idSchema)||"native",errorHandlingMode:((w=e.fansUnited)==null?void 0:w.errorHandlingMode)||"default"},theme:e.theme?{mode:e.theme.mode,primaryColor:e.theme.primaryColor}:void 0,leads:{defaultFields:((C=e.leads)==null?void 0:C.defaultFields)||["fullName","email"],position:((x=e.leads)==null?void 0:x.position)||"after",campaignId:((E=e.leads)==null?void 0:E.campaignId)||"",campaignName:((M=e.leads)==null?void 0:M.campaignName)||""}},console.log("Config set, initializing widgets"),document.readyState==="loading"?(console.log("Document still loading, adding DOMContentLoaded listener"),document.addEventListener("DOMContentLoaded",this.initializeWidgets)):(console.log("Document already loaded, initializing widgets immediately"),this.initializeWidgets())}}const uO=new Ane;return window.FuWidget={init:t=>uO.init(t)},uO}();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fansunited-widgets-cdn",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "private": false,
5
5
  "files": [
6
6
  "fu-widgets.iife.js"