PageSourceSearch

https://staticweb.usafacts.org/next/_next/static/chunks/5198.6c846853580d0ecc.js

js usafacts.org collected 2026-09-24 15:16:14 UTC 4,196 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5198],{55198:(e,t,a)=>{a.r(t),a.d(t,{Quiz:()=>m});var s=a(95155),l=a(18955),n=a(12115),i=a(45687),r=a(83551),o=a(10795),c=a(96254),d=a(76170),u=a(77979),h=a(33218),x=a(5747);function m(e){let{question:t,options:a,answer:m,successText:p,errorText:g,tiktokVideoId:f,attributes:b}=e,w=(0,l.c)("quiz"),[k,j]=(0,n.useState)(null),[v,y]=(0,n.useState)(!1),[N,S]=(0,n.useState)([[]]),[_,q]=(0,n.useState)(!1),z=(0,o.k)();async function L(){var e;let a=new URLSearchParams({question:(0,r.Rd)(t)}),s=await fetch("/api/v5/quiz/?".concat(a.toString()));return null!=(e=(await s.json()).data)?e:[]}return(null==t?void 0:t.trim())&&(null==a?void 0:a.length)&&(null==m?void 0:m.trim())?(0,s.jsxs)("div",{className:(0,u.cn)("rounded-lg bg-background-medium px-XS py-L md:-mx-L md:p-L"),children:[(0,s.jsx)("a",{href:"/weekly-fact-quiz/",className:"text-text-highlight body-sm",children:w("linkText")}),(0,s.jsx)("div",{className:"mt-base-L display-3 [&_*]:!text-primary-on-white",children:(0,s.jsx)(d.RichText,{text:t,overrideBodyStyle:!0})}),!v&&(0,s.jsxs)("div",{className:"pt-L",children:[a.map(e=>(0,s.jsxs)("button",{type:"button",className:(0,u.cn)("group flex w-full items-center gap-XXS border-t border-hairline py-M text-left"),role:"radio","aria-checked":k===e,tabIndex:0,onClick:()=>j(e),children:[(0,s.jsx)(c.A,{name:k===e?"radio-selected":"radio",className:(0,u.cn)(k===e?"text-text-highlight":"text-grey-500 group-hover:text-text-highlight group-focus-visible:text-text-highlight","flex-shrink-0")}),(0,s.jsx)("p",{className:"body-md",children:e})]},e)),(0,s.jsx)("button",{type:"button",onClick:()=>{k&&(q(!0),y(!0),L().then(e=>{S(function(e,t){let a={};t.forEach(e=>{a[e]=0}),null==e||e.forEach(e=>{let t=e.properties.selected;if(t&&a.hasOwnProperty(t)){var s;a[t]=(null!=(s=a[t])?s:0)+1}});let s=[["Answer","Responses"]];for(let e of t){var l;s.push([e,null!=(l=a[e])?l:0])}return s}(e,a)),q(!1)}).catch(e=>{console.error("Failed to fetch quiz results:",e)}),z("quiz_submitted",{question:(0,r.Rd)(t),selected:k,correct:k===m}))},disabled:v||!k,className:"button mt-XXS bg-magenta-500 text-white body-sm disabled:opacity-50","data-attribute":"inline-quiz-submit",children:w("submitButton")})]}),v&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"my-M inline-block text-secondary-on-white body-lg",children:(0,s.jsx)(d.RichText,{text:function(e,t,a,s){let{followUpText:l,defaultSuccessMessage:n,errorMessage:o,answerText:c,tiktokLink:d}=t,u=d?(0,i.F0)(d):"";if(e)return a&&!(0,r.N6)(a)?(0,r.mI)(a," ".concat(l).concat(u)):"<p>".concat(n," ").concat(l).concat(u,"</p>");let h=(0,i.F0)(c);if(s&&!(0,r.N6)(s))return(0,r.mI)(s,"".concat(h," ").concat(l).concat(u));let x=(0,i.F0)(o);return"<p>".concat(x," ").concat(l).concat(u,"</p>")}(k===m,{followUpText:w("followUpText"),defaultSuccessMessage:w("defaultSuccessMessage"),errorMessage:w.rich("errorMessage",{answer:m,strong:e=>(0,s.jsx)("strong",{children:e})}),answerText:w.rich("answerText",{answer:m,strong:e=>(0,s.jsx)("strong",{children:e})}),tiktokLink:f?w.rich("tiktokLink",{url:"https://www.tiktok.com/@usafacts/video/".concat(f),link:e=>(0,s.jsx)("a",{href:"https://www.tiktok.com/@usafacts/video/".concat(f),target:"_blank",rel:"noreferrer noopener",className:"underline decoration-text-highlight",children:e})}):null},p,g)})}),_&&(0,s.jsx)("div",{className:(0,u.cn)("flex h-[250px] w-full items-center justify-center rounded-sm"),role:"progressbar","aria-label":"Chart loading",children:w("loadingText")}),N.length>1&&(0,s.jsx)(h.default,{skeletonHeight:{mobile:"250px",tablet:"250px",desktop:"250px"},json:{base_visualisation_id:"24055803",bindings:{data:{label:0,value:[1]}},state:{color:{categorical_custom_palette:"".concat(m,": #e82494")}},data:{data:N}}}),f&&!N.length&&!_&&(0,s.jsx)("div",{className:"relative mx-auto mt-4 aspect-[9/16] w-full max-w-[325px]",children:(0,s.jsx)("iframe",{src:"https://www.tiktok.com/embed/v2/".concat(f),allow:"encrypted-media",className:"absolute left-0 top-0 h-full w-full rounded-sm"})})]})]}):(0,s.jsx)(x.U,{attributes:b,editorMessage:"Please add a question, options, and answer to the quiz component."})}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.