fansunited-widget-client-configuration 1.7.0 → 1.7.1
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.
|
@@ -85958,7 +85958,7 @@ const FSe = () => {
|
|
|
85958
85958
|
children: [
|
|
85959
85959
|
/* @__PURE__ */ A.jsxs(hn, { children: [
|
|
85960
85960
|
/* @__PURE__ */ A.jsx(cee, { sx: { mr: 1 } }),
|
|
85961
|
-
"SDK
|
|
85961
|
+
"SDK"
|
|
85962
85962
|
] }),
|
|
85963
85963
|
/* @__PURE__ */ A.jsxs(hn, { children: [
|
|
85964
85964
|
/* @__PURE__ */ A.jsx(dee, { sx: { mr: 1 } }),
|
|
@@ -85970,7 +85970,7 @@ const FSe = () => {
|
|
|
85970
85970
|
] }),
|
|
85971
85971
|
/* @__PURE__ */ A.jsxs(hn, { children: [
|
|
85972
85972
|
/* @__PURE__ */ A.jsx(QR, { sx: { mr: 1 } }),
|
|
85973
|
-
"Theme
|
|
85973
|
+
"Theme"
|
|
85974
85974
|
] }),
|
|
85975
85975
|
/* @__PURE__ */ A.jsxs(hn, { children: [
|
|
85976
85976
|
/* @__PURE__ */ A.jsx(lee, { sx: { mr: 1 } }),
|
|
@@ -3660,4 +3660,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
3660
3660
|
data-component="fu-widget"
|
|
3661
3661
|
data-content-type="list"${g}${b}${y}${v}${S}${_}${T}
|
|
3662
3662
|
></div>`,I=({title:O})=>C.jsx(rt,{title:O,sx:{maxWidth:300},children:C.jsx(Rn,{color:"primary"})}),P=()=>C.jsxs(mt,{sx:{pb:1,mb:3},children:[C.jsx(dn,{label:e.classicQuizURL,placeholder:"",defaultValue:i,required:!1,size:"md",endDecorator:C.jsx(I,{title:e.quizzesInfoMessage}),onChange:O=>a(O.target.value)}),C.jsx(dn,{label:e.eitherOrURL,placeholder:"",defaultValue:o,required:!1,size:"md",endDecorator:C.jsx(I,{title:e.eitherOrsInfoMessage}),onChange:O=>s(O.target.value)}),C.jsx(dn,{label:e.pollURL,placeholder:"",defaultValue:l,required:!1,size:"md",endDecorator:C.jsx(I,{title:e.pollsInfoMessage}),onChange:O=>c(O.target.value)})]}),k=()=>C.jsxs(mt,{sx:{pb:1,mb:3},children:[C.jsx(Uw,{label:e.itemsPerPage,description:e.itemsPerPageDescription,defaultValue:d,onChange:O=>u(O||null),size:"md"}),C.jsx(Uw,{label:e.itemsPerRow,description:e.itemsPerRowDescription,defaultValue:p,onChange:O=>h(O||null),size:"md"}),C.jsxs(Me,{sx:()=>({marginBottom:"16px"}),children:[C.jsx(Le,{color:"primary",children:e.mode}),C.jsx(wt,{defaultValue:m,onChange:(O,M)=>f(M),children:G_e.map((O,M)=>C.jsx(Xe,{value:O,children:q_e[O]},`basic-select-${O}-${M}`))}),C.jsx(xt,{children:e.modeDescription})]})]});return C.jsxs(oe,{mt:1,children:[k(),C.jsx(vi,{defaultValue:t,label:e.configureURLs,labelPosition:"end",description:"",descriptionColor:"neutral",disabled:!1,onChange:O=>{O===!1&&(a(""),s(""),c("")),n(O)}}),t&&P(),C.jsxs(oe,{position:"relative",mb:1,children:[C.jsx(Kc,{value:E,minRows:"5",maxRows:"20",readOnly:!0,onMouseDown:O=>O.preventDefault(),sx:{cursor:"default","&:hover":{cursor:"default"},"& textarea":{cursor:"default"}}}),C.jsx(rt,{title:e.copyToClipboard,children:C.jsx(st,{onClick:()=>{navigator.clipboard.writeText(E)},sx:{position:"absolute",top:"10px",right:"10px",zIndex:1},variant:"soft",color:"neutral",children:C.jsx(Xs,{})})})]}),C.jsx(Ns,{variant:"outlined",color:"primary",startDecorator:C.jsx(Rn,{}),sx:{mb:1,width:"fit-content"},children:C.jsxs(de,{color:"primary",fontSize:14,fontWeight:500,children:[e.divElementTextInfo,C.jsx(eo,{href:"https://docs.fansunitedmedia.com/docs/user-centric-widgets#/",underline:"always",target:"_blank",rel:"noopener noreferrer",children:"User-centric widgets"})]})})]})},s2=r=>r?.map(e=>({id:e.id,value:e.nickname?e.nickname:e.name||`No name ${e.id.slice(0,5)}`,label:e.nickname?e.nickname:e.name||`No name ${e.id.slice(0,5)}`,avatar:e.avatar}))||[],Y_e=({labels:r,ids:e,onChange:t})=>{const[n,i]=B.useState([]),[a,o]=B.useState([]),[s,l]=B.useState(""),[c,d]=B.useState("name"),[u,p]=B.useState(!1),[h,m]=B.useState(!1),{sdk:f}=ar(),g=!0,b=()=>m(!h),y=(S,_)=>{i(_);const T=_.map(E=>E.id);t(T&&T.length?T:null)},v=3;B.useEffect(()=>{!s&&e&&e.length&&f.profile.getByIds(e,void 0,g).then(S=>{i(s2(S))}).catch(S=>{b(),console.error(S),i([])})},[]);const w=B.useMemo(()=>Io((S,_)=>{p(!0),f.profile.getByIds(_==="id"?[S]:[],_==="name"?S:void 0,g).then(T=>{o([...s2(T)]),p(!1)}).catch(T=>{console.error(T),b(),o([]),p(!1)})},300),[]);B.useEffect(()=>{if(!s||s.length<v){o([]);return}return w(s,c),()=>w.cancel()},[s,w,c]);const x=(S,_)=>S.map((T,E)=>{var I;return C.jsx(Ut,{variant:"solid",endDecorator:C.jsx(Ja,{color:"danger",sx:{marginRight:.5},variant:"plain",onClick:P=>_({index:E}).onClick(P),children:C.jsx(no,{fontSize:"small"})}),sx:{marginLeft:"3px",marginY:"1px",backgroundColor:"#e0f3ff",padding:"2px",borderRadius:4,"&:hover":{cursor:"default"}},children:C.jsxs(oe,{display:"flex",alignItems:"center",mr:1,children:[C.jsx(br,{sx:{width:"1.5rem",height:" 1.5rem",mr:.5,borderRadius:"0.75rem"},src:(I=T.avatar)!=null?I:zt.avatar}),C.jsx(de,{children:T.label})]})},T.id)});return C.jsxs(C.Fragment,{children:[C.jsx(oe,{sx:{marginBottom:"16px"},children:C.jsx(Za,{forcePopupIcon:!1,multiple:!0,loading:u,disableClearable:!0,slotProps:{input:{sx:{"&::placeholder":{fontSize:"14px"}}},root:{sx:{boxShadow:"none",backgroundColor:"white",minHeight:38}}},isOptionEqualToValue:(S,_)=>S.id===_.id,endDecorator:C.jsxs(C.Fragment,{children:[u&&C.jsx(bn,{size:"sm",sx:{bgcolor:"primary",marginRight:2}}),C.jsx(xr,{orientation:"vertical"}),C.jsxs(wt,{variant:"plain",value:c,onChange:(S,_)=>d(_),slotProps:{listbox:{variant:"outlined"}},sx:{mr:-1.5,"&:hover":{bgcolor:"transparent"}},children:[C.jsx(Xe,{value:"name",children:r.searchByName}),C.jsx(Xe,{value:"id",children:r.searchById})]})]}),placeholder:n.length>0?"":r.excludedProfilesPlaceholder,options:a,filterSelectedOptions:!0,onInputChange:(S,_)=>{l(_)},onChange:y,getOptionKey:S=>S.id,value:n,renderTags:x,renderOption:(S,_)=>{var T;return C.jsx(Xa,le(ee({},S),{children:C.jsxs(oe,{display:"flex",alignItems:"center",mr:1,children:[C.jsx(br,{sx:{width:"1.5rem",height:" 1.5rem",mr:.5,borderRadius:"0.75rem"},src:(T=_.avatar)!=null?T:zt.avatar}),C.jsx(de,{children:_.label})]})}))}})}),C.jsx(or,{showToast:h,message:r.searchProfilesErrorMessage,color:"danger",hideToast:b})]})},J_e=({value:r,sx:e,tooltipPlacement:t})=>{const n=l=>{const c=Math.abs(l);return c>=1e9?(l/1e9).toFixed(1)+"b":c>=1e6?(l/1e6).toFixed(1)+"m":c>=1e3?(l/1e3).toFixed(1)+"k":l.toString()},i=l=>new Intl.NumberFormat("en-US").format(l),a=Math.abs(r)>=1e3,o=n(r),s=i(r);return a?C.jsx(rt,{title:s,placement:t,arrow:!0,children:C.jsx(de,{sx:e,children:o})}):C.jsx(de,{sx:e,children:o})},Q_e=(r,e,t,n)=>{if(r&&r.length===0){t([]);return}e.football.getPlayers({playerIds:r}).then(i=>{const a=i.data.map(o=>l2(o));t(a)}).catch(i=>{console.error("Error fetching players by ID:",i),n()})},l2=r=>{var e,t,n,i,a;return{id:r.id,name:r.name,avatar:((e=r.assets)==null?void 0:e.headshot)||zt.avatar,countryName:((t=r.country)==null?void 0:t.name)||"Unknown",countryFlag:((i=(n=r.country)==null?void 0:n.assets)==null?void 0:i.flag)||zt.flag,teams:((a=r.teams)==null?void 0:a.map(o=>{var s;return{id:o.id,name:o.name,logo:((s=o.assets)==null?void 0:s.logo)||zt.team}}))||[]}},X_e=({player:r,onRemove:e})=>C.jsx(rt,{title:C.jsxs(oe,{sx:{p:1},children:[C.jsx(de,{level:"body-sm",fontWeight:"bold",children:r.name}),C.jsxs(de,{level:"body-xs",sx:{display:"flex",alignItems:"center",gap:.5,mt:.5},children:[C.jsx("img",{src:r.countryFlag,alt:r.countryName,width:16,height:12,loading:"lazy"}),r.countryName]}),r.teams&&r.teams.length>0&&C.jsxs(oe,{sx:{mt:.5},children:[C.jsx(de,{level:"body-xs",sx:{mb:.5},children:"Teams:"}),C.jsx(oe,{sx:{display:"flex",flexDirection:"column",gap:.25},children:r.teams.map((t,n)=>C.jsxs(oe,{sx:{display:"flex",alignItems:"center",gap:.5},children:[C.jsx("img",{src:t.logo,alt:t.name,width:16,height:16,style:{borderRadius:"2px"},loading:"lazy"}),C.jsx(de,{level:"body-xs",children:t.name})]},n))})]})]}),placement:"left",variant:"solid",sx:{"--Tooltip-radius":"8px",maxWidth:300,bgcolor:"background.level1"},children:C.jsxs(oe,{sx:{display:"inline-flex",alignItems:"center",gap:.5,backgroundColor:"#e0f3ff",borderRadius:"50px",padding:"2px 8px 2px 2px",margin:"2px",position:"relative","&:hover":{backgroundColor:"#d0e8ff",cursor:"default"}},children:[C.jsx(br,{src:r.avatar,alt:r.name,size:"sm",sx:{width:24,height:24,border:"1px solid #fff"}}),C.jsx(de,{level:"body-sm",sx:{fontSize:"12px",maxWidth:80,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r.name}),C.jsx(kt,{size:"sm",variant:"plain",color:"danger",onClick:e,sx:{minHeight:16,minWidth:16,padding:0,ml:.5,"&:hover":{backgroundColor:"rgba(255, 0, 0, 0.1)"}},children:C.jsx(no,{sx:{fontSize:12}})})]})}),Z_e=({labels:r,teamIds:e,selectedPlayers:t,onChangePlayers:n})=>{const[i,a]=B.useState([]),[o,s]=B.useState([]),[l,c]=B.useState([]),[d,u]=B.useState(!1),[p,h]=B.useState(""),[m,f]=B.useState(!1),{sdk:g}=ar(),b=()=>f(!m),y=e&&e.length>0,v=(T,E)=>{a(E),n(E)},w=()=>G(void 0,null,function*(){if(y){u(!0);try{const T=e.map(P=>g.football.getTeamById(P)),E=yield Promise.all(T),I=[];E.forEach(P=>{if(P.squad&&P.squad.length>0){const k=P.squad.map(O=>{var M,L,j,F,V;return{id:O.id,name:O.name,avatar:((M=O.assets)==null?void 0:M.headshot)||zt.avatar,countryName:((L=O.country)==null?void 0:L.name)||"Unknown",countryFlag:((F=(j=O.country)==null?void 0:j.assets)==null?void 0:F.flag)||zt.flag,teams:[{id:P.id,name:P.name,logo:((V=P.assets)==null?void 0:V.logo)||zt.team}]}}).sort((O,M)=>O.name.localeCompare(M.name));I.push(...k)}}),c(I),s(I)}catch(T){console.error("Error fetching team players:",T),b()}finally{u(!1)}}}),x=T=>{if(!T){s(l);return}const E=l.filter(I=>I.name.toLowerCase().includes(T.toLowerCase()));s(E)};B.useEffect(()=>{Q_e(t,g,a,b)},[t]),B.useEffect(()=>{y&&w()},[e]);const S=B.useMemo(()=>Io(T=>{if(!y){if(!T||T.length<2){s([]),u(!1);return}u(!0),g.football.getPlayers({name:T,sortField:"name",sortOrder:"asc"}).then(E=>{const I=E.data.map(P=>l2(P));s(I),u(!1)}).catch(E=>{console.error("Error searching players:",E),s([]),u(!1),b()})}},300),[g,y]);B.useEffect(()=>(y?x(p):S(p),()=>{y||S.cancel()}),[p,y]);const _=(T,E)=>T.map((I,P)=>C.jsx(X_e,{player:I,onRemove:()=>{const k=E({index:P});k.onClick&&k.onClick({})}},I.id));return C.jsxs(C.Fragment,{children:[C.jsx(Za,{forcePopupIcon:y,multiple:!0,loading:d,slotProps:{input:{sx:{"&::placeholder":{fontSize:"14px"}}},root:{sx:{boxShadow:"none",backgroundColor:"white",minHeight:38,flexWrap:"wrap"}},noOptions:{sx:{}}},isOptionEqualToValue:(T,E)=>T.id===E.id,endDecorator:d?C.jsx(bn,{size:"sm",sx:{bgcolor:"primary"}}):null,placeholder:i.length>0?"":r?.searchPlayersPlaceholder,options:o,filterSelectedOptions:!0,onInputChange:(T,E)=>{h(E)},onChange:v,getOptionKey:T=>typeof T=="string"?T:T.id,getOptionLabel:T=>typeof T=="string"?T:T.name,value:i,renderTags:_,limitTags:1,renderOption:(T,E)=>{const I={props:T};return C.jsxs(Xa,le(ee({},T),{sx:{display:"flex",alignItems:"center",gap:1},children:[C.jsx(br,{src:E.avatar,alt:E.name,size:"sm",sx:{width:32,height:32}}),C.jsxs(oe,{sx:{flexGrow:1},children:[C.jsx(de,{level:"body-sm",fontWeight:"bold",children:E.name}),C.jsxs(oe,{sx:{display:"flex",alignItems:"center",gap:.5},children:[C.jsx("img",{src:E.countryFlag,alt:E.countryName,width:16,height:12,loading:"lazy"}),C.jsx(de,{level:"body-xs",color:"neutral",children:E.countryName})]})]})]}),`player-option-${E.id}-${I}`)}}),C.jsx(or,{showToast:m,message:r.getPlayersErrorMessage,color:"danger",hideToast:b})]})},e1e=(r,e={})=>{const{enabled:t=!0}=e,{sdk:n}=ar(),[i,a]=B.useState(null),[o,s]=B.useState(!1),[l,c]=B.useState(null),[d,u]=B.useState(null),p=B.useMemo(()=>ee({},r),[JSON.stringify(r)]),h=B.useCallback(()=>G(void 0,null,function*(){var m,f;s(!0),c(null);try{const g=yield n.football.getMatches(p);a(g.data),u((f=(m=g.meta)==null?void 0:m.pagination)!=null?f:null)}catch(g){c(g),a([]),u(null)}finally{s(!1)}}),[n,p]);return B.useEffect(()=>{t&&h()},[h,t]),{matches:i,loading:o,error:l,meta:d,refetch:h}},c2=Gt(C.jsx("path",{d:"M4.25 5.61C6.57 8.59 10 13 10 13v5c0 1.1.9 2 2 2s2-.9 2-2v-5s3.43-4.41 5.75-7.39c.51-.66.04-1.61-.8-1.61H5.04c-.83 0-1.3.95-.79 1.61"}),"FilterAltRounded"),u2=Gt(C.jsx("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.89-2-2-2m0 16H5V7h14zm-5.5-6c0 .83-.67 1.5-1.5 1.5s-1.5-.67-1.5-1.5.67-1.5 1.5-1.5 1.5.67 1.5 1.5M12 9c-2.73 0-5.06 1.66-6 4 .94 2.34 3.27 4 6 4s5.06-1.66 6-4c-.94-2.34-3.27-4-6-4m0 6.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5"}),"PreviewRounded"),To=pr("MuiStep",["root","indicator","horizontal","vertical","active","completed","disabled"]),Wl=pr("MuiStepIndicator",["root","colorPrimary","colorNeutral","colorDanger","colorSuccess","colorWarning","colorContext","variantPlain","variantOutlined","variantSoft","variantSolid","horizontal","vertical"]),t1e=Gt(C.jsx("path",{d:"M15.41 16.59 10.83 12l4.58-4.59L14 6l-6 6 6 6z"}),"KeyboardArrowLeft"),r1e=Gt(C.jsx("path",{d:"M8.59 16.59 13.17 12 8.59 7.41 10 6l6 6-6 6z"}),"KeyboardArrowRight"),d2=Gt(C.jsx("path",{d:"M7.41 15.41 12 10.83l4.59 4.58L18 14l-6-6-6 6z"}),"KeyboardArrowUp");class n1e{constructor(){pe(this,"id",""),pe(this,"title",""),pe(this,"alternative_title",null),pe(this,"description",null),pe(this,"type",null),pe(this,"auth_requirement",null),pe(this,"rules",null),pe(this,"ad_content",null),pe(this,"labels",null),pe(this,"branding",null),pe(this,"embed_code",null),pe(this,"custom_fields",null),pe(this,"images",null),pe(this,"status",""),pe(this,"flags",[]),pe(this,"context",null),pe(this,"options",[]),pe(this,"related",[]),pe(this,"multiple_choice",!1),pe(this,"max_multiple_choice_options",null),pe(this,"participation_count",0),pe(this,"preferences_enabled",!1),pe(this,"max_attempts",1),pe(this,"external_activity",null)}}const i1e=r=>{const[e,t]=B.useState(!1),[n,i]=B.useState(""),a=r.generatedEntity,o=u=>{const p=new n1e;return p.title=u.question||"",p.status="INACTIVE",p.options=(u.options||[]).map(h=>({title:h,description:"",images:{main:"",mobile:"",cover:""},embed_code:null,preference_mappings:[]})),p},s=u=>{i(u.id);const p=o(u);r.setPollRequestBody(p)},l=()=>{if(!a)return C.jsx(oe,{sx:{height:240,display:"flex",alignItems:"center",justifyContent:"center"},children:C.jsx(de,{level:"body-sm",children:r.labels.noPreviewAvailable})});const u=()=>C.jsxs(qo,{variant:"outlined",size:"sm",sx:{width:"100%",maxWidth:"100%","& > thead > tr > th:first-child, & > tbody > tr > td:first-child":{textAlign:"left"},"--TableCell-paddingX":"0.5rem",cursor:"default","& > tbody > tr:hover":{backgroundColor:"transparent"},"& > thead > tr > th":{backgroundColor:"#fff",verticalAlign:"middle"},"& > thead > tr > th, & > tbody > tr > td":{textAlign:"right"}},children:[C.jsx("thead",{children:C.jsx("tr",{children:C.jsx("th",{children:C.jsx(de,{level:"body-sm",children:r.labels.questions})})})}),C.jsx("tbody",{children:a.questions.map((h,m)=>{var f;return C.jsx("tr",{children:C.jsx("td",{children:C.jsxs(de,{level:"body-sm",children:[h.question," ",C.jsx(de,{children:(f=h.options)==null?void 0:f.map((g,b)=>C.jsx(Ut,{color:g.correct?"success":"neutral",variant:g.correct?"solid":"outlined",sx:{mr:1},size:"sm",children:g.option},`question-option-${b}`))})]})})},`question-${m}`)})})]}),p=()=>{const h=a.questions||[],m=f=>!f&&f!==0?"neutral":f>=5?"success":f>=4?"primary":f>=3?"warning":"neutral";return C.jsx(oe,{component:"ul",sx:{listStyle:"none",m:0,p:0,ml:0,pl:0,marginBlockStart:0,marginBlockEnd:0,marginInlineStart:0,marginInlineEnd:0,paddingInlineStart:0,display:"flex",flexDirection:"column",gap:1},children:h.map((f,g)=>{const b=n===f.id;return C.jsx(oe,{component:"li",children:C.jsx(Un,{variant:"outlined",sx:{p:1,borderRadius:"sm",cursor:"pointer",bgcolor:b?"var(--joy-palette-neutral-softBg, rgba(0,0,0,0.04))":"background.body",borderColor:b?"primary.solidBg":void 0,"&:hover":{backgroundColor:"var(--joy-palette-neutral-softBg, rgba(0,0,0,0.04))"},"&:hover .pollOptionChipNeutral":{backgroundColor:"background.level1",borderColor:"neutral.outlinedBorder"}},onClick:()=>s(f),role:"button",tabIndex:0,onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),s(f))},children:C.jsxs(oe,{sx:{display:"flex",alignItems:"flex-start",gap:1},children:[C.jsx(gb,{name:"selectedPollSuggestion",value:f.id,checked:b,onChange:()=>s(f),size:"sm"}),C.jsxs(oe,{sx:{flex:1,minWidth:0},children:[C.jsxs(oe,{sx:{display:"flex",alignItems:"center",gap:.5,mb:.5},children:[C.jsx(de,{level:"body-sm",fontWeight:600,p:0,children:f.question}),C.jsx(oe,{sx:{flex:1}}),f.engagement_score?C.jsx(rt,{title:r.labels.engagementScore,children:C.jsx(Ut,{size:"sm",variant:"solid",color:m(f.engagement_score),children:f.engagement_score})}):C.jsx(C.Fragment,{})]}),C.jsx(oe,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:(f.options||[]).map((y,v)=>C.jsx(Ut,{className:b?void 0:"pollOptionChipNeutral",variant:b?"soft":"outlined",color:b?"primary":"neutral",size:"sm",sx:{mr:.5,mb:.5},children:y},`poll-suggestion-opt-${v}`))})]})]})})},`poll-suggestion-${f.id||g}`)})})};return r.entityType==="poll"?C.jsx(Un,{sx:{overflowY:"auto",borderRadius:"sm",p:1,maxHeight:"400px",my:.5},children:p()}):C.jsxs(Un,{sx:{overflowY:"auto",borderRadius:"sm",maxHeight:"300px",my:.5},children:[C.jsxs(oe,{role:"button",tabIndex:0,onClick:()=>t(!e),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),t(m=>!m))},sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:1,fontSize:"xs",p:1,borderRadius:"sm",cursor:"pointer","&:hover":{backgroundColor:"var(--joy-palette-neutral-softBg, rgba(0,0,0,0.04))"}},children:[C.jsx(de,{level:"body-sm",sx:{flexGrow:1},children:a.title}),C.jsx(rt,{title:e?"":r.labels.expand,children:C.jsx(kt,{"aria-label":"expand row",variant:"plain",color:"neutral",size:"sm",sx:{"&:hover":{backgroundColor:"background.surface"}},children:e?C.jsx(d2,{}):C.jsx(gm,{})})})]}),C.jsx(oe,{sx:{display:e?"block":"none",p:1},children:e?u():null})]})},c=()=>!r.matches||r.matches.length===0?C.jsx(oe,{sx:{height:250,display:"flex",alignItems:"center",justifyContent:"center"},children:C.jsx(de,{level:"body-sm",children:r.labels.noMatchesFound})}):C.jsx(Un,{sx:{overflowY:"auto",borderRadius:"sm",maxHeight:"250px",my:.5},children:r.matches.map(u=>{var p,h,m,f,g,b,y,v,w,x,S,_,T,E,I,P,k,O,M,L,j,F,V,z;return C.jsxs(B.Fragment,{children:[C.jsxs(oe,{onClick:()=>r.setSelectedMatchId(u.id),onKeyDown:U=>{(U.key==="Enter"||U.key===" ")&&(U.preventDefault(),r.setSelectedMatchId(u.id))},role:"button",tabIndex:0,sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:1,fontSize:"xs",p:1,borderRadius:"sm",cursor:"pointer","&:hover":{backgroundColor:"var(--joy-palette-neutral-softBg, rgba(0,0,0,0.04))"},backgroundColor:r.selectedMatchId===u.id?"rgba(0,0,0,0.04)":"transparent"},children:[C.jsx(gb,{size:"sm",name:"selectedMatch",value:u.id,checked:r.selectedMatchId===u.id,onChange:U=>r.setSelectedMatchId(U.target.value),sx:{mr:1}}),C.jsx(rt,{title:(((h=(p=u.context)==null?void 0:p.competition)==null?void 0:h.name)||"Competition with no name")+((g=(f=(m=u.context)==null?void 0:m.competition)==null?void 0:f.country)!=null&&g.name?` (${u.context.competition.country.name})`:""),children:C.jsx(br,{src:((v=(y=(b=u.context)==null?void 0:b.competition)==null?void 0:y.assets)==null?void 0:v.logo)||zt.competition,sx:{width:"15px",height:"15px"},slotProps:{img:{loading:"lazy"}}})}),C.jsxs(de,{level:"body-sm",children:["[",Br(u.kickoffAt).format("HH:mm DD.MM.YYYY"),"]"]}),(w=u.homeTeam)!=null&&w.code?C.jsx(rt,{title:u.homeTeam.name,children:C.jsxs(oe,{display:"flex",gap:.5,alignItems:"center",minWidth:"60px",justifyContent:"flex-end",children:[C.jsx(de,{fontWeight:r.teamIdsFilter&&r.teamIdsFilter.includes(u.homeTeam.id)?700:400,children:u.homeTeam.code||u.homeTeam.name}),C.jsx(br,{src:((x=u.homeTeam.assets)==null?void 0:x.logo)||zt.team,sx:{width:"20px",height:"20px"},slotProps:{img:{loading:"lazy"}}})]})}):C.jsxs(C.Fragment,{children:[C.jsx(de,{fontWeight:r.teamIdsFilter&&r.teamIdsFilter.includes(u.homeTeam.id)?700:400,children:u.homeTeam.code||u.homeTeam.name}),C.jsx(br,{src:((S=u.homeTeam.assets)==null?void 0:S.logo)||zt.team,sx:{width:"20px",height:"20px"},slotProps:{img:{loading:"lazy"}}})]}),((T=(_=u?.scores)==null?void 0:_.ftScore)==null?void 0:T.homeGoals)!==null&&((I=(E=u?.scores)==null?void 0:E.ftScore)==null?void 0:I.awayGoals)!==null?C.jsx(Ut,{variant:"outlined",children:((O=(k=(P=u.scores)==null?void 0:P.ftScore)==null?void 0:k.homeGoals)!=null?O:"")+":"+((j=(L=(M=u.scores)==null?void 0:M.ftScore)==null?void 0:L.awayGoals)!=null?j:"")}):" : ",(F=u.awayTeam)!=null&&F.code?C.jsx(rt,{title:u.awayTeam.name,children:C.jsxs(oe,{display:"flex",gap:.5,alignItems:"center",children:[C.jsx(br,{src:((V=u.awayTeam.assets)==null?void 0:V.logo)||zt.team,sx:{width:"20px",height:"20px"},slotProps:{img:{loading:"lazy"}}})," ",C.jsx(de,{fontWeight:r.teamIdsFilter&&r.teamIdsFilter.includes(u.awayTeam.id)?700:400,children:u.awayTeam.code||u.awayTeam.name})]})}):C.jsxs(C.Fragment,{children:[C.jsx(br,{src:((z=u.awayTeam.assets)==null?void 0:z.logo)||zt.team,sx:{width:"20px",height:"20px"},slotProps:{img:{loading:"lazy"}}}),C.jsx(de,{fontWeight:r.teamIdsFilter&&r.teamIdsFilter.includes(u.awayTeam.id)?700:400,children:u.awayTeam.code||u.awayTeam.name})]})]}),C.jsx(xr,{sx:{my:.5}})]},`search-matches-custom-${u.id}`)})}),d=()=>C.jsxs(C.Fragment,{children:[C.jsx(de,{level:"body-xs",children:r.pagination?`${r.labels.page} ${r.pagination.currentPage} ${r.labels.of} ${r.pagination.numberOfPages} • ${r.pagination.totalItems} ${r.labels.total}`:""}),C.jsxs(oe,{sx:{display:"flex",gap:1},children:[C.jsx(kt,{size:"sm",color:"neutral",variant:"outlined",disabled:!r.pagination||r.pagination&&r.pagination.currentPage<=1,onClick:()=>r.setPage(u=>Math.max(1,u-1)),sx:{bgcolor:"background.surface"},children:C.jsx(t1e,{})}),C.jsx(kt,{size:"sm",color:"neutral",variant:"outlined",disabled:!r.pagination||r.pagination&&r.pagination.currentPage>=r.pagination.numberOfPages,onClick:()=>r.setPage(u=>r.pagination?Math.min(r.pagination.numberOfPages,u+1):u+1),sx:{bgcolor:"background.surface"},children:C.jsx(r1e,{})})]})]});return r.loading?C.jsx(oe,{sx:{height:240},children:C.jsx(Fl,{my:0})}):C.jsxs(C.Fragment,{children:[r.step==="search"?c():l(),C.jsxs(oe,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[C.jsx(st,{size:"sm",color:"primary",variant:"outlined",disabled:!r.selectedMatchId,onClick:r.onGenerate,children:r.step==="search"?r.labels.generate:r.labels.regenerate}),r.step==="search"?d():C.jsx(C.Fragment,{})]})]})},a1e=r=>{const e=Br(Date.now()).format("YYYY-MM-DD");if(r.step==="preview")return C.jsx(C.Fragment,{});const t=()=>r.entityType==="poll"?C.jsx(Up,{disabled:!r.matchFilters.teamIds||r.matchFilters.teamIds.length===0,checked:r.useFramingGuidelines,size:"sm",onChange:n=>{r.setUseFramingGuidelines(n.target.checked)},label:r.labels.useFramingGuidelinesLabel}):C.jsx(C.Fragment,{});return C.jsxs(C.Fragment,{children:[C.jsx(bL,{labels:{teamsSelectionPlaceholder:r.labels.teamsSelectionPlaceholder||"",searchTeamsErrorMessage:r.labels.searchTeamsErrorMessage},ids:r.matchFilters.teamIds||[],onChange:r.onChangeTeams,scope:r.competitionsScope,readOnly:r.isGenerating,AdditionalCheckbox:t()}),C.jsxs(Ct,{container:!0,spacing:2,minWidth:"100%",columns:{xs:0,sm:0,md:12},mb:2,children:[C.jsx(Ct,{xs:6,children:C.jsxs(Me,{size:"sm",children:[C.jsx(Le,{children:r.labels.fromDate}),C.jsx(it,{name:"fromDate",type:"date",defaultValue:r.matchFilters.fromDate,onChange:r.onChangeDates,sx:{backgroundColor:"#fff",borderRadius:"md",minHeight:"36px"},slotProps:{input:{max:e}},readOnly:r.isGenerating})]})}),C.jsx(Ct,{xs:6,children:C.jsxs(Me,{size:"sm",children:[C.jsx(Le,{children:r.labels.toDate}),C.jsx(it,{name:"toDate",type:"date",defaultValue:r.matchFilters.toDate,onChange:r.onChangeDates,sx:{backgroundColor:"#fff",borderRadius:"md",minHeight:"36px"},slotProps:{input:{max:e}},readOnly:r.isGenerating})]})})]})]})},o1e=Br(Date.now()).format("YYYY-MM-DD"),p2=r=>{const e=r?.toLowerCase();return e&&iu[e]?iu[e].key:"en"},h2=r=>({fromDate:"",toDate:o1e,competitionIds:r&&r.length?r:void 0,teamIds:void 0,sortOrder:"desc",status:"finished"}),s1e=r=>{var e;const[t,n]=B.useState(p2(r.defaultLanguage)),[i,a]=B.useState(h2(r.competitionsScope)),[o,s]=B.useState(1),[l,c]=B.useState(""),[d,u]=B.useState(!1),[p,h]=B.useState("search"),[m,f]=B.useState(!1),[g,b]=B.useState(null),[y,v]=B.useState(null),[w,x]=B.useState(!1),[S,_]=B.useState(!1),[T,E]=B.useState(""),[I,P]=B.useState(!1),[k,O]=B.useState(""),[M,L]=B.useState("danger"),j=10,F=B.useMemo(()=>{const J=i,{fromDate:Z,toDate:ae}=J,ue=fr(J,["fromDate","toDate"]),ke=ee({},ue);if(Z&&(ke.fromDate=`${Z}T00:00:00Z`),ae){const Ne=Br().add(1,"minute").format("THH:mm:ss")+"Z";ke.toDate=ae+Ne}return le(ee({},ke),{page:o,limit:j})},[i,o]),V=B.useMemo(()=>!(!g||r.entityType==="poll"&&!y),[g,r.entityType,y]);B.useEffect(()=>()=>{n(p2),a(h2(r.competitionsScope)),s(1),c(""),u(!1),h("search"),b(null)},[]);const{https:z}=ar(),{matches:U,loading:R,meta:$}=e1e(F,{enabled:d}),H=()=>{O(""),P(!1)},W=J=>{let Z="",ae="danger";switch(J){case"on_generate_failed":Z=r.labels.onEntityGenerateErrorMessage;break;case"on_create":Z=r.labels.onEntityCreateMessage,ae="success";break;case"on_create_failed":Z=r.labels.onEntityCreateErrorMessage;break}L(ae),O(Z),P(!0)},Q=J=>{var Z;const ae=J.map(ue=>ue.id);a(ue=>le(ee({},ue),{teamIds:ae||void 0})),s(1),u(!0),r.entityType==="poll"&&(J.length===0?(E(""),_(!1)):E(((Z=J[J.length-1])==null?void 0:Z.label)||""))},K=J=>{const{name:Z,value:ae}=J.target;a(ue=>le(ee({},ue),{[Z]:ae})),u(!0)},Y=()=>G(void 0,null,function*(){f(!0),r.entityType==="poll"&&v(null);let J=null;switch(r.entityType){case"classic_quiz":J=yield z.generatePostMatchQuiz({sportType:"football",lang:t,eventId:l});break;case"poll":const ae=S?T:"";J=yield z.generatePostMatchPoll({targetParticipant:ae,lang:t,eventId:l});break}if(!(J!=null&&J.ok)){const ae=yield J?.json();console.error("Failed to generate AI content",ae),f(!1),W("on_generate_failed");return}const Z=yield J?.json();if(r.entityType==="poll"){const ae=Z;ae.questions.sort((ue,ke)=>ke.engagement_score-ue.engagement_score),b(ae)}else b(Z);f(!1),h("preview")}),q=J=>G(void 0,null,function*(){x(!0);let Z=null;switch(r.entityType){case"classic_quiz":const ue=g;Z=yield z.createClassicQuiz(ue);break;case"poll":Z=yield z.createPoll(y);break}const ae=yield Z?.json();if(!(Z!=null&&Z.ok)){console.error("Failed to create content",ae),x(!1),W("on_create_failed");return}if(x(!1),J==="goto"){W("on_create"),r.toggleModal(),r.fetchEntityById(ae.data.id);return}W("on_create")});return C.jsx(ca,{open:r.isOpen,onClose:()=>{m||w||r.toggleModal()},children:C.jsxs(C.Fragment,{children:[C.jsxs(ua,{sx:{backgroundColor:"white",minWidth:"50%",height:900},children:[C.jsx(la,{children:r.labels.generateFootballPostMatchModalTitle}),C.jsx(xr,{}),C.jsx(sa,{sx:{overflowX:"hidden"},children:C.jsxs(C.Fragment,{children:[C.jsxs(Me,{size:"sm",sx:{mb:2},children:[C.jsx(Le,{children:r.labels.language}),C.jsx(wt,{value:t,onChange:(J,Z)=>Z&&n(Z),indicator:null,disabled:m,startDecorator:C.jsx("img",{loading:"lazy",width:"20",srcSet:`https://flagcdn.com/w40/${(io[t]||"gb").toLowerCase()}.png 2x`,src:`https://flagcdn.com/w20/${(io[t]||"gb").toLowerCase()}.png`,alt:((e=Object.values(St).find(J=>J.key===t))==null?void 0:e.name)||"Language"}),sx:{minWidth:220,minHeight:38},children:Object.values(St).map(J=>C.jsxs(Xe,{value:J.key,label:J.name,children:[C.jsx(Ui,{children:C.jsx("img",{loading:"lazy",width:"20",srcSet:`https://flagcdn.com/w40/${(io[J.key]||"gb").toLowerCase()}.png 2x`,src:`https://flagcdn.com/w20/${(io[J.key]||"gb").toLowerCase()}.png`,alt:J.name})}),J.name]},J.key))}),C.jsx(xt,{children:r.labels.targetLanguageDescription})]}),C.jsxs(qk,{sx:{my:2,width:"100%","--StepIndicator-size":"3rem","--Step-connectorInset":"0px",[`& .${Wl.root}`]:{borderWidth:3},[`& .${To.root}::after`]:{height:3},[`& .${To.completed}`]:{[`& .${Wl.root}`]:{borderColor:"primary.300",color:"primary.300"},"&::after":{bgcolor:"primary.300"}},[`& .${To.active}`]:{[`& .${Wl.root}`]:{borderColor:"currentColor"}},[`& .${To.disabled} *`]:{color:"neutral.outlinedDisabledColor"}},children:[C.jsx(Gp,{active:p==="search",orientation:"vertical",indicator:C.jsx(rt,{title:p==="preview"?r.labels.searchMatchTooltip:"",placement:"right",children:C.jsx(qp,{variant:p==="search"?"solid":"outlined",color:"primary",onClick:()=>{p==="preview"&&(b(null),h("search"))},onKeyDown:J=>{(J.key==="Enter"||J.key===" ")&&p==="preview"&&(J.preventDefault(),b(null),h("search"))},sx:ee({cursor:p==="preview"?"pointer":"default"},p==="preview"&&{animation:"pulse 2s infinite","@keyframes pulse":{"0%":{boxShadow:"0 0 0 0 rgba(25, 118, 210, 0.7)"},"70%":{boxShadow:"0 0 0 10px rgba(25, 118, 210, 0)"},"100%":{boxShadow:"0 0 0 0 rgba(25, 118, 210, 0)"}},"&:hover":{animation:"none",boxShadow:"0 0 0 4px rgba(25, 118, 210, 0.3)"}}),role:"button",tabIndex:p==="preview"?0:-1,children:C.jsx(c2,{})})}),children:C.jsx(de,{sx:ee({textTransform:"uppercase",fontWeight:"lg",fontSize:"0.75rem"},p==="preview"&&{cursor:"pointer"}),onClick:()=>{p==="preview"&&(b(null),h("search"))},onKeyDown:J=>{(J.key==="Enter"||J.key===" ")&&p==="preview"&&(J.preventDefault(),b(null),h("search"))},role:"button",tabIndex:p==="preview"?0:-1,children:r.labels.searchMatch})}),C.jsx(Gp,{orientation:"vertical",active:p==="preview",disabled:p!=="preview",indicator:C.jsx(qp,{variant:p==="preview"?"solid":"outlined",color:"primary",children:C.jsx(u2,{})}),children:C.jsx(de,{sx:{textTransform:"uppercase",fontWeight:"lg",fontSize:"0.75rem"},children:r.labels.preview})})]}),C.jsx(a1e,{entityType:r.entityType,step:p,labels:r.labels,useFramingGuidelines:S,matchFilters:i,competitionsScope:r.competitionsScope,generatedEntity:g,isGenerating:m,setUseFramingGuidelines:_,onChangeTeams:Q,onChangeDates:K}),d?C.jsx(Un,{variant:"outlined",sx:{p:1,borderRadius:"sm",bgcolor:"background.surface"},children:C.jsx(i1e,{step:p,loading:R||m,matches:U,selectedMatchId:l,generatedEntity:g,labels:r.labels,pagination:$,teamIdsFilter:i.teamIds,setPollRequestBody:v,setPage:s,setSelectedMatchId:c,onGenerate:Y,entityType:r.entityType,setGeneratedEntity:b})}):C.jsx(C.Fragment,{})]})}),C.jsxs(Hp,{children:[C.jsx(st,{variant:"outlined",color:"primary",loading:w,disabled:!V||m,onClick:()=>q("goto"),children:r.labels.createAndGoTo}),C.jsx(st,{variant:"solid",color:"primary",loading:w,disabled:!V||m,onClick:()=>q("continue"),children:r.labels.createAndContinue}),C.jsx(st,{disabled:m||w,variant:"plain",color:"neutral",onClick:J=>{J.stopPropagation(),r.toggleModal()},children:r.labels.close})]})]}),C.jsx(or,{showToast:I,color:M,message:k,hideToast:H})]})})},l1e=r=>{const[e,t]=B.useState(!1),n=r.generatedEntity,i=()=>{if(!n)return C.jsx(oe,{sx:{height:240,display:"flex",alignItems:"center",justifyContent:"center"},children:C.jsx(de,{level:"body-sm",children:r.labels.noPreviewAvailable})});const o=()=>C.jsxs(qo,{variant:"outlined",size:"sm",sx:{width:"100%",maxWidth:"100%","& > thead > tr > th:first-child, & > tbody > tr > td:first-child":{textAlign:"left"},"--TableCell-paddingX":"0.5rem",cursor:"default","& > tbody > tr:hover":{backgroundColor:"transparent"},"& > thead > tr > th":{backgroundColor:"#fff",verticalAlign:"middle"},"& > thead > tr > th, & > tbody > tr > td":{textAlign:"right"}},children:[C.jsx("thead",{children:C.jsx("tr",{children:C.jsx("th",{children:C.jsx(de,{level:"body-sm",children:r.labels.questions})})})}),C.jsx("tbody",{children:n.questions.map((s,l)=>{var c;return C.jsx("tr",{children:C.jsx("td",{children:C.jsxs(de,{level:"body-sm",children:[s.question," ",C.jsx(de,{children:(c=s.options)==null?void 0:c.map((d,u)=>C.jsx(Ut,{color:d.correct?"success":"neutral",variant:d.correct?"solid":"outlined",sx:{mr:1},size:"sm",children:d.option},`question-option-${u}`))})]})})},`question-${l}`)})})]});return C.jsxs(Un,{sx:{overflowY:"auto",borderRadius:"sm",maxHeight:"300px",my:.5},children:[C.jsxs(oe,{role:"button",tabIndex:0,onClick:()=>t(!e),onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),t(l=>!l))},sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:1,fontSize:"xs",p:1,borderRadius:"sm",cursor:"pointer","&:hover":{backgroundColor:"var(--joy-palette-neutral-softBg, rgba(0,0,0,0.04))"}},children:[C.jsx(de,{level:"body-sm",sx:{flexGrow:1},children:n.title}),C.jsx(rt,{title:e?"":r.labels.expand,children:C.jsx(kt,{"aria-label":"expand row",variant:"plain",color:"neutral",size:"sm",sx:{"&:hover":{backgroundColor:"background.surface"}},children:e?C.jsx(d2,{}):C.jsx(gm,{})})})]}),C.jsx(oe,{sx:{display:e?"block":"none",p:1},children:e?o():null})]})},a=()=>!r.races||r.races.length===0?C.jsx(oe,{sx:{height:240,display:"flex",alignItems:"center",justifyContent:"center"},children:C.jsx(de,{level:"body-sm",children:r.labels.noRacesFound})}):C.jsx(Un,{sx:{overflowY:"auto",borderRadius:"sm",maxHeight:"300px",my:.5},children:r.races.map(o=>{var s;const l=o.status==="Completed",c=o.status==="Scheduled";return C.jsxs(B.Fragment,{children:[C.jsxs(oe,{onClick:l?()=>r.setSelectedRaceId(o.id.toString()):void 0,onKeyDown:l?d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),r.setSelectedRaceId(o.id.toString()))}:void 0,role:l?"button":void 0,tabIndex:l?0:void 0,sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:1,fontSize:"xs",p:1,borderRadius:"sm",cursor:l?"pointer":"not-allowed",opacity:c?.6:1,"&:hover":l?{backgroundColor:"var(--joy-palette-neutral-softBg, rgba(0,0,0,0.04))"}:{},backgroundColor:r.selectedRaceId===o.id.toString()?"rgba(0,0,0,0.04)":"transparent"},children:[C.jsx(gb,{size:"sm",name:"selectedRace",value:o.id.toString(),checked:r.selectedRaceId===o.id.toString(),disabled:!l,onChange:l?d=>r.setSelectedRaceId(d.target.value):void 0,sx:{mr:1}}),C.jsx(rt,{title:o.competition.name+((s=o.competition.location)!=null&&s.country?` (${o.competition.location.country})`:""),children:C.jsx(br,{src:o.circuit.image||zt.competition,sx:{width:"15px",height:"15px"},slotProps:{img:{loading:"lazy"}}})}),C.jsxs(de,{level:"body-sm",children:["[",Br(o.date).format("HH:mm DD.MM.YYYY"),"]"]}),C.jsx(de,{level:"body-sm",fontWeight:600,children:o.competition.name}),C.jsx(de,{level:"body-sm",children:o.circuit.name}),C.jsx(Ut,{variant:l?"solid":"outlined",color:l?"success":"neutral",size:"sm",children:o.status==="Completed"?"Finished":"Upcoming"})]}),C.jsx(xr,{sx:{my:.5}})]},`race-${o.id}`)})});return r.loading?C.jsx(oe,{sx:{height:240},children:C.jsx(Fl,{my:0})}):C.jsxs(C.Fragment,{children:[r.step==="search"?a():i(),C.jsx(oe,{display:"flex",justifyContent:"space-between",alignItems:"center",children:C.jsx(st,{size:"sm",color:"primary",variant:"outlined",disabled:!r.selectedRaceId,onClick:r.onGenerate,children:r.step==="search"?r.labels.generate:r.labels.regenerate})})]})},f2=r=>{const e=r?.toLowerCase();return e&&iu[e]?iu[e].key:"en"},Nm=()=>new Date().getFullYear(),c1e=()=>{const r=Nm();return[r,r-1,r-2]},u1e=r=>{var e,t;const[n,i]=B.useState(f2(r.defaultLanguage)),[a,o]=B.useState(Nm()),[s,l]=B.useState([]),[c,d]=B.useState(!1),[u,p]=B.useState(""),[h,m]=B.useState("search"),[f,g]=B.useState(!1),[b,y]=B.useState(null),[v,w]=B.useState(!1),[x,S]=B.useState(!1),[_,T]=B.useState(""),[E,I]=B.useState("danger"),P=B.useMemo(()=>!!b,[b]);B.useEffect(()=>{r.isOpen?L(Nm()):(i(f2(r.defaultLanguage)),o(Nm()),l([]),p(""),m("search"),y(null))},[r.isOpen]);const{https:k}=ar(),O=()=>{T(""),S(!1)},M=z=>{let U="",R="danger";switch(z){case"on_generate_failed":U=r.labels.onEntityGenerateErrorMessage;break;case"on_create":U=r.labels.onEntityCreateMessage,R="success";break;case"on_create_failed":U=r.labels.onEntityCreateErrorMessage;break;case"fetch_races_failed":U=r.labels.fetchRacesErrorMessage;break}I(R),T(U),S(!0)},L=z=>G(void 0,null,function*(){d(!0);const U=yield k.apiSports.getRaces(z),R=yield U.json();if(!U.ok){console.error("Error fetching races:",R),d(!1),l([]),M("fetch_races_failed");return}const $=(R.response||[]).sort((K,Y)=>new Date(Y.date).getTime()-new Date(K.date).getTime()),H=$.filter(K=>K.status==="Completed"),W=$.filter(K=>K.status==="Scheduled"),Q=[...W.length>0?[W.sort((K,Y)=>new Date(K.date).getTime()-new Date(Y.date).getTime())[0]]:[],...H];l(Q),d(!1)}),j=z=>{o(z),p(""),L(z)},F=()=>G(void 0,null,function*(){g(!0);const z=yield k.generatePostMatchQuiz({sportType:"formula1",lang:n,eventId:u});if(!(z!=null&&z.ok)){const R=yield z?.json();console.error("Failed to generate AI content",R),g(!1),M("on_generate_failed");return}const U=yield z?.json();y(U),g(!1),m("preview")}),V=z=>G(void 0,null,function*(){w(!0);const U=b,R=yield k.createClassicQuiz(U),$=yield R.json();if(!(R!=null&&R.ok)){console.error("Failed to create content",$),w(!1),M("on_create_failed");return}if(w(!1),z==="goto"){M("on_create"),r.toggleModal(),r.fetchEntityById($.data.id);return}M("on_create")});return C.jsx(ca,{open:r.isOpen,onClose:()=>{f||v||r.toggleModal()},children:C.jsxs(C.Fragment,{children:[C.jsxs(ua,{sx:{backgroundColor:"white",minWidth:"50%",height:900},children:[C.jsx(la,{children:r.labels.generateFormulaOnePostEventModalTitle}),C.jsx(xr,{}),C.jsx(sa,{sx:{overflowX:"hidden"},children:C.jsxs(C.Fragment,{children:[C.jsxs(oe,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"1fr 1fr"},gap:2,mb:2},children:[C.jsxs(Me,{size:"sm",children:[C.jsx(Le,{children:r.labels.language}),C.jsx(wt,{value:n,onChange:(z,U)=>U&&i(U),indicator:null,disabled:f,startDecorator:C.jsx("img",{loading:"lazy",width:"20",srcSet:`https://flagcdn.com/w40/${(io[n]||"gb").toLowerCase()}.png 2x`,src:`https://flagcdn.com/w20/${(io[n]||"gb").toLowerCase()}.png`,alt:((e=Object.values(St).find(z=>z.key===n))==null?void 0:e.name)||"Language"}),sx:{minHeight:38},children:Object.values(St).map(z=>C.jsxs(Xe,{value:z.key,label:z.name,children:[C.jsx(Ui,{children:C.jsx("img",{loading:"lazy",width:"20",srcSet:`https://flagcdn.com/w40/${(io[z.key]||"gb").toLowerCase()}.png 2x`,src:`https://flagcdn.com/w20/${(io[z.key]||"gb").toLowerCase()}.png`,alt:z.name})}),z.name]},z.key))}),C.jsx(xt,{children:r.labels.targetLanguageDescription})]}),C.jsxs(Me,{size:"sm",children:[C.jsx(Le,{children:r.labels.season}),C.jsx(wt,{value:a,onChange:(z,U)=>U&&j(U),disabled:f||!!b,sx:{minHeight:38},children:c1e().map(z=>C.jsx(Xe,{value:z,children:z},z))}),C.jsx(xt,{children:r.labels.seasonDescription})]})]}),C.jsxs(qk,{sx:{my:2,width:"100%","--StepIndicator-size":"3rem","--Step-connectorInset":"0px",[`& .${Wl.root}`]:{borderWidth:3},[`& .${To.root}::after`]:{height:3},[`& .${To.completed}`]:{[`& .${Wl.root}`]:{borderColor:"primary.300",color:"primary.300"},"&::after":{bgcolor:"primary.300"}},[`& .${To.active}`]:{[`& .${Wl.root}`]:{borderColor:"currentColor"}},[`& .${To.disabled} *`]:{color:"neutral.outlinedDisabledColor"}},children:[C.jsx(Gp,{active:h==="search",orientation:"vertical",indicator:C.jsx(rt,{title:h==="preview"?(t=r.labels)==null?void 0:t.searchRaceTooltip:"",placement:"right",children:C.jsx(qp,{variant:h==="search"?"solid":"outlined",color:"primary",onClick:()=>{h==="preview"&&(y(null),m("search"))},onKeyDown:z=>{(z.key==="Enter"||z.key===" ")&&h==="preview"&&(z.preventDefault(),y(null),m("search"))},sx:ee({cursor:h==="preview"?"pointer":"default"},h==="preview"&&{animation:"pulse 2s infinite","@keyframes pulse":{"0%":{boxShadow:"0 0 0 0 rgba(25, 118, 210, 0.7)"},"70%":{boxShadow:"0 0 0 10px rgba(25, 118, 210, 0)"},"100%":{boxShadow:"0 0 0 0 rgba(25, 118, 210, 0)"}},"&:hover":{animation:"none",boxShadow:"0 0 0 4px rgba(25, 118, 210, 0.3)"}}),role:"button",tabIndex:h==="preview"?0:-1,children:C.jsx(c2,{})})}),children:C.jsx(de,{sx:ee({textTransform:"uppercase",fontWeight:"lg",fontSize:"0.75rem"},h==="preview"&&{cursor:"pointer"}),onClick:()=>{h==="preview"&&(y(null),m("search"))},onKeyDown:z=>{(z.key==="Enter"||z.key===" ")&&h==="preview"&&(z.preventDefault(),y(null),m("search"))},role:"button",tabIndex:h==="preview"?0:-1,children:r.labels.searchRace})}),C.jsx(Gp,{orientation:"vertical",active:h==="preview",disabled:h!=="preview",indicator:C.jsx(qp,{variant:h==="preview"?"solid":"outlined",color:"primary",children:C.jsx(u2,{})}),children:C.jsx(de,{sx:{textTransform:"uppercase",fontWeight:"lg",fontSize:"0.75rem"},children:r.labels.preview})})]}),C.jsx(Un,{variant:"outlined",sx:{mt:2,p:1,borderRadius:"sm",bgcolor:"background.surface"},children:C.jsx(l1e,{step:h,loading:c||f,races:s,selectedRaceId:u,generatedEntity:b,labels:r.labels,setSelectedRaceId:p,onGenerate:F,setGeneratedEntity:y})})]})}),C.jsxs(Hp,{children:[C.jsx(st,{variant:"outlined",color:"primary",loading:v,disabled:!P||f,onClick:()=>V("goto"),children:r.labels.createAndGoTo}),C.jsx(st,{variant:"solid",color:"primary",loading:v,disabled:!P||f,onClick:()=>V("continue"),children:r.labels.createAndContinue}),C.jsx(st,{disabled:f||v,variant:"plain",color:"neutral",onClick:z=>{z.stopPropagation(),r.toggleModal()},children:r.labels.close})]})]}),C.jsx(or,{showToast:x,color:E,message:_,hideToast:O})]})})},d1e={Login:Ebe,InformationInput:dn,RichText:Rx,HeaderButtons:ige,MarketSelection:Wbe,Accordion:Bde,DynamicFields:Cge,BasicSelect:Ude,BooleanSwitch:vi,Branding:ege,ProfileSearchSelect:pxe,RangeCalendar:xge,CompetitionSearchSelect:uxe,Related:Ybe,Images:obe,Duration:bge,DatePickerComponent:qu,Flags:rbe,Spinner:Fl,Tags:xL,Toast:or,AdContent:zde,Match:Gbe,Winners:QCe,CompetitionsSearchSelect:dxe,TeamsSearchSelect:bL,CustomSelect:d0e,Schedule:i0e,NoPermissionCard:wge,CustomFlatpickrCalendar:gw,ContextSelectFilter:ZCe,NumberInput:Uw,EntityContext:OIe,MiniGamesImages:DIe,AuthRequirement:MIe,SortableList:__e,ItemsPerPageFilter:T_e,ImageCard:Zu,RelatedRelationship:N_e,BonusPointsRelatedQuiz:z_e,ExportUsersLeads:U_e,SignOutButton:YD,BasicSortableList:V_e,WidgetEmbedCode:W_e,WidgetListEmbedCode:K_e,AdvancedProfileSearchSelect:Y_e,FormatNumber:J_e,PlayersSearchSelect:Z_e,GenerateFootballPostMatchModal:s1e,GenerateFormula1PostEventModal:u1e,BrandingImage:lw},m2=B.createContext(null),p1e=({children:r})=>C.jsx(m2.Provider,{value:d1e,children:r}),h1e=()=>{const r=B.useContext(m2);if(!r)throw new Error("useComponentContext must be used within a ComponentProvider");return r},g2=425,v2=1024,f1e=()=>{const[r,e]=B.useState(window.innerWidth<=v2),[t,n]=B.useState(window.innerWidth<=g2);return B.useLayoutEffect(()=>{const i=()=>{e(window.innerWidth<=v2),n(window.innerWidth<=g2)};return window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]),{isMobile:r,isPhone:t}},m1e={supportedLanguages:St,languagesMap:iu},g1e={areAllValuesFalsy:ZL,remapKeysToSpecificCase:ym},Xn={APIProvider:ele,AuthProvider:tle,AuthContext:PO,ComponentProvider:p1e,useComponentContext:h1e,useAPIContext:ar,useIsMobile:f1e,constants:m1e,helpers:g1e};class v1e{clientConfigErrorMessage;userNotFound;signOut;language;profilePreferences;cacheTTL;footballAssets;soon;update;configTitle;configDescription;configLanguageTitle;defaultLanguage;defaultLanguageHelperText;availableLanguages;availableLanguagesHelperText;translationRules;translationRulesHelperText;gameStatus;active;inactive;updateConfigMessage;updateConfigErrorMessage;categories;delete;id;name;addCategory;preferences;addPreference;selectCategories;uniqueCategoriesIdErrorMessage;uniquePreferencesIdErrorMessage;uploadImage;sportal365Images;search;clearImage;copyUrl;viewImage;cropImage;aspectRatio;crop;reset;urlCopiedToClipboardMessage;imageDeletedMessage;imageResetMessage;fromDate;toDate;uploadingImageMessage;uploadingImageErrorMessage;generateSignedInUrlErrorMessage;encryptingImageErrorMessage;hideFilters;showFilters;searchImage;searchSportal365ImagesErrorMessage;previous;next;add;branding;noBrandingsFound;createFirstBrandingTemplate;createBranding;colors;noColorsDefined;image;images;noImages;url;urls;noUrls;newBranding;deleteBranding;deleteBrandingConfirmation;close;brandingCreatedMessage;brandingUpdatedMessage;brandingDeletedMessage;createBrandingErrorMessage;updateBrandingErrorMessage;deleteBrandingErrorMessage;fetchBrandingsErrorMessage;mainLogo;mobileLogo;backgroundImage;mobileBackgroundImage;additionalImage;primaryColor;secondaryColor;contentColor;backgroundColor;borderColor;additionalColor;primaryUrl;secondaryUrl;privacyPolicyUrl;termsAndConditionsUrl;additionalUrl;constructor(e){this.clientConfigErrorMessage=e?.clientConfigErrorMessage||"There was a problem fetching client's configuration. Please try again",this.userNotFound=e?.userNotFound||"User not found. Please try again.",this.language=e?.language||"Language",this.profilePreferences=e?.profilePreferences||"Profile preferences",this.cacheTTL=e?.cacheTTL||"Cache TTL",this.footballAssets=e?.footballAssets||"Football Assets",this.soon=e?.soon||"Soon",this.update=e?.update||"Update Configuration",this.configTitle=e?.configTitle||"Configure Fans United",this.configDescription=e?.configDescription||"Customize different features of Fans United",this.defaultLanguage=e?.defaultLanguage||"Default language",this.defaultLanguageHelperText=e?.defaultLanguageHelperText||"What is the default language of your content? This field, if different from English, would be used in our translation tools.",this.availableLanguages=e?.availableLanguages||"Available languages",this.availableLanguagesHelperText=e?.availableLanguagesHelperText||"In case your project is multi-lingual, select the available languages for your app.",this.translationRules=e?.translationRules||"Translation rules",this.translationRulesHelperText=e?.translationRulesHelperText||"Select the default status when a game is automatically translated.",this.gameStatus=e?.gameStatus||"Game status",this.active=e?.active||"Active",this.inactive=e?.inactive||"Inactive",this.updateConfigMessage=e?.updateConfigMessage||"You have successfully updated Language configuration",this.updateConfigErrorMessage=e?.updateConfigErrorMessage||"There was a problem updating configuration. Please try again",this.categories=e?.categories||"Categories",this.delete=e?.delete||"Delete",this.id=e?.id||"ID",this.name=e?.name||"Name",this.addCategory=e?.addCategory||"Add Category",this.preferences=e?.preferences||"Preferences",this.addPreference=e?.addPreference||"Add Preference",this.selectCategories=e?.selectCategories||"Select categories for new preference",this.uniqueCategoriesIdErrorMessage=e?.uniqueCategoriesIdErrorMessage||"Categories' IDs must be unique!",this.uniquePreferencesIdErrorMessage=e?.uniquePreferencesIdErrorMessage||"Preferences' IDs must be unique!",this.uploadImage=e?.uploadImage||"Upload Image",this.sportal365Images=e?.sportal365Images||"Sportal365 Images",this.search=e?.search||"Search",this.clearImage=e?.clearImage||"Clear image",this.copyUrl=e?.copyUrl||"Copy URL",this.viewImage=e?.viewImage||"View image",this.cropImage=e?.cropImage||"Crop image",this.aspectRatio=e?.aspectRatio||"Aspect ratio",this.crop=e?.crop||"Crop",this.reset=e?.reset||"Reset",this.urlCopiedToClipboardMessage=e?.urlCopiedToClipboardMessage||"URL copied to clipboard",this.imageDeletedMessage=e?.imageDeletedMessage||"Image deleted",this.imageResetMessage=e?.imageResetMessage||"The initial size of the image has been restored",this.fromDate=e?.fromDate||"From Date",this.toDate=e?.toDate||"To Date",this.uploadingImageMessage=e?.uploadingImageMessage||"You have successfully uploaded image",this.uploadingImageErrorMessage=e?.uploadingImageErrorMessage||"There was a problem with uploading image to bucket. Please try again",this.generateSignedInUrlErrorMessage=e?.generateSignedInUrlErrorMessage||"There was a problem generating signed in URL to store the image in bucket. Please try again",this.encryptingImageErrorMessage=e?.encryptingImageErrorMessage||"There was a problem with encrypting image before uploading it to bucket. Please try again",this.searchImage=e?.searchImage||"Search image",this.hideFilters=e?.hideFilters||"Hide filters",this.showFilters=e?.showFilters||"Show filters",this.searchSportal365ImagesErrorMessage=e?.searchSportal365ImagesErrorMessage||"There was a problem with searching images from Sportal 365 API. Please try again",this.previous=e?.previous||"Previous",this.next=e?.next||"Next",this.mainLogo=e?.mainLogo||"Main Logo",this.mobileLogo=e?.mobileLogo||"Mobile logo",this.backgroundImage=e?.backgroundImage||"Background image",this.mobileBackgroundImage=e?.mobileBackgroundImage||"Mobile background image",this.additionalImage=e?.additionalImage||"Additional image",this.primaryColor=e?.primaryColor||"Primary color",this.secondaryColor=e?.secondaryColor||"Secondary color",this.contentColor=e?.contentColor||"Content color",this.backgroundColor=e?.backgroundColor||"Background color",this.borderColor=e?.borderColor||"Border color",this.additionalColor=e?.additionalColor||"Additional color",this.primaryUrl=e?.primaryUrl||"Primary URL",this.secondaryUrl=e?.secondaryUrl||"Secondary URL",this.privacyPolicyUrl=e?.privacyPolicyUrl||"Privacy policy URL",this.termsAndConditionsUrl=e?.termsAndConditionsUrl||"Terms and conditions URL",this.additionalUrl=e?.additionalUrl||"Additional URL",this.add=e?.add||"Add",this.branding=e?.branding||"Branding",this.noBrandingsFound=e?.noBrandingsFound||"No brandings found",this.createFirstBrandingTemplate=e?.createFirstBrandingTemplate||"Create your first branding template to get started",this.createBranding=e?.createBranding||"Create Branding",this.colors=e?.colors||"Colors",this.noColorsDefined=e?.noColorsDefined||"No colors defined",this.image=e?.image||"image",this.images=e?.images||"images",this.noImages=e?.noImages||"No images",this.url=e?.url||"URL",this.urls=e?.urls||"URLs",this.noUrls=e?.noUrls||"No URLs",this.newBranding=e?.newBranding||"New Branding",this.deleteBranding=e?.deleteBranding||"Delete",this.deleteBrandingConfirmation=e?.deleteBrandingConfirmation||"branding? This action cannot be undone.",this.close=e?.close||"Close",this.brandingCreatedMessage=e?.brandingCreatedMessage||"Branding created successfully",this.brandingUpdatedMessage=e?.brandingUpdatedMessage||"Branding updated successfully",this.brandingDeletedMessage=e?.brandingDeletedMessage||"Branding deleted successfully",this.createBrandingErrorMessage=e?.createBrandingErrorMessage||"There was a problem creating branding. Please try again",this.updateBrandingErrorMessage=e?.updateBrandingErrorMessage||"There was a problem updating branding. Please try again",this.deleteBrandingErrorMessage=e?.deleteBrandingErrorMessage||"There was a problem deleting branding. Please try again",this.fetchBrandingsErrorMessage=e?.fetchBrandingsErrorMessage||"There was a problem fetching brandings. Please try again"}}const ko=B.createContext(null),y1e=({labels:r,children:e})=>{const t=new v1e(r);return A.jsx(ko.Provider,{value:t,children:e})},b1e=({children:r})=>A.jsx(oe,{width:"100%",sx:{backgroundColor:"#fff"},children:r});function Gl(r){const e=B.useContext(r);if(e===void 0)throw new Error("Context was used outside of its Provider");return e}const hd={ar:"Arabic",bg:"Bulgarian",da:"Danish",de:"German",en:"English",el:"Greek",es:"Spanish",fr:"French",hi:"Hindi",hu:"Hungarian",it:"Italian",nl:"Dutch",pt:"Portuguese","pt-br":"Brazilian(Portuguese)",ro:"Romanian",sk:"Slovak",sr:"Serbian",sv:"Swedish",sw:"Swahili"};function Oi(r,e){try{return r.error.code===500?e:r.error.message?r.error.message:e}catch(t){return console.error("Error parsing API error response:",t),e}}const x1e=()=>{const[r,e]=B.useState(null),[t,n]=B.useState(!1),[i,a]=B.useState(!1),[o,s]=B.useState(!1),[l,c]=B.useState("danger"),[d,u]=B.useState(""),p=Gl(ko),h=B.useRef(null),{Spinner:m,Toast:f}=Xn.useComponentContext(),{https:g}=Xn.useAPIContext(),b=(I,P)=>{c(I),u(P),s(!0)};B.useEffect(()=>{async function I(){n(!0);const P=await g.getLanguageConfig(),k=await P.json();if(P.ok)e(k.data),n(!1);else{n(!1);const O=Oi(k,p.clientConfigErrorMessage);console.error(p.clientConfigErrorMessage,O),b("danger",O)}}I()},[]);const y=async()=>{a(!0);const I=await g.updateLanguageConfig({...r});if(I.ok)a(!1),b("success",p.updateConfigMessage);else{a(!1);const P=await I.json(),k=Oi(P,p.updateConfigErrorMessage);console.error(p.updateConfigErrorMessage,k),b("danger",k)}},v=I=>{let P=[...r.available_languages],k={...r.translation_rules};I||(P=new Array,k={}),P.includes(I)&&(P=P.filter(O=>O!==I),delete k[I]),I&&!P.includes(I)&&(delete k[r.default_language],k[I]={game_status:"INACTIVE"}),e({default_language:I,available_languages:P,translation_rules:Object.keys(k).length>0?k:null})},w=I=>{let P=[...r.available_languages],k={...r.translation_rules};P.includes(I)?(P=P.filter(O=>O!==I),delete k[I]):(P.push(I),k[I]={game_status:"INACTIVE"}),e({default_language:r.default_language,available_languages:P,translation_rules:Object.keys(k).length>0?k:null})},x=I=>{let P={...r.translation_rules,[I.language]:{game_status:I.value}};e({default_language:r.default_language,available_languages:r.available_languages,translation_rules:P})},S=()=>A.jsxs(oe,{sx:{mt:2},children:[A.jsx(de,{level:"title-sm",children:p.defaultLanguage}),A.jsx(xt,{children:p.defaultLanguageHelperText}),A.jsx(wt,{value:r?.default_language,size:"sm",name:"defaultLanguage",slotProps:{button:{sx:{whiteSpace:"nowrap"}}},onChange:(I,P)=>{v(P)},sx:{mt:1,minHeight:"37px",backgroundColor:"white",width:200},...r?.default_language&&{endDecorator:A.jsx(kt,{variant:"plain",color:"neutral",onMouseDown:I=>{I.stopPropagation()},onClick:()=>{v(null),h.current?.focusVisible()},sx:{width:"18px",height:"18px"},children:A.jsx(fa,{})}),indicator:null},children:Object.keys(hd).map(I=>A.jsx(Xe,{value:I,children:hd[I]},I))})]}),_=()=>A.jsxs(oe,{my:4,children:[A.jsx(de,{level:"title-sm",children:p.availableLanguages}),A.jsx(xt,{children:p.availableLanguagesHelperText}),A.jsx(oe,{mt:1,sx:{display:{xs:"flex",md:"block"},flexDirection:"column"},children:Object.keys(hd).map(I=>A.jsx(Up,{sx:{m:1,"& .MuiCheckbox-checkbox":{backgroundColor:"white","&:hover":{backgroundColor:"#f0f4f8"}},"& .MuiCheckbox-checkbox.Mui-checked":{backgroundColor:"#0066CC"}},checked:r.default_language===I||r?.available_languages.includes(I),disabled:!r.default_language||r.default_language===I,label:hd[I],onChange:()=>w(I)},I))})]}),T=I=>A.jsxs("tr",{children:[A.jsx("td",{children:A.jsx(de,{level:"body-sm",children:hd[I]})}),A.jsx("td",{children:A.jsxs(wt,{value:r.translation_rules[I].game_status,size:"sm",name:"sortBy",onChange:(P,k)=>{x({language:I,value:k})},sx:{my:.5,minHeight:"37px",backgroundColor:"white"},children:[A.jsx(Xe,{value:"ACTIVE",children:p.active},"option-active"),A.jsx(Xe,{value:"INACTIVE",children:p.inactive},"option-inactive")]})})]},`${I}-rule`),E=()=>A.jsxs(oe,{my:4,children:[A.jsx(de,{level:"title-sm",children:p.translationRules}),A.jsx(xt,{children:p.translationRulesHelperText}),A.jsx(Un,{sx:{mt:1},children:A.jsxs(qo,{variant:"outlined",hoverRow:!1,borderAxis:"bothBetween",size:"sm",sx:{backgroundColor:"#fff","& > thead > tr > th:first-child, & > tbody > tr > td:first-child":{textAlign:"left",width:"50%"},"--TableCell-paddingX":"0.5rem",cursor:"default","& > tbody > tr:hover":{backgroundColor:"transparent"},"& > thead > tr > th":{backgroundColor:"#fff",verticalAlign:"middle"},"& > thead > tr > th, & > tbody > tr > td":{textAlign:"right"}},children:[A.jsx("thead",{children:A.jsxs("tr",{children:[A.jsx("th",{children:p.language}),A.jsx("th",{children:p.gameStatus})]})}),A.jsx("tbody",{children:[r.default_language,...r.available_languages].map(I=>T(I))})]})})]});return t?A.jsx(m,{my:30}):!t&&r?A.jsxs(oe,{children:[S(),_(),r.default_language&&E(),A.jsx(oe,{textAlign:"center",children:A.jsx(st,{onClick:y,loading:i,children:p.update})}),A.jsx(f,{showToast:o,color:l,message:d,hideToast:()=>s(!o)})]}):A.jsx(A.Fragment,{})},y2=r=>new Set(r.map(t=>t.id)).size===r.length,w1e=()=>{const[r,e]=B.useState([]),[t,n]=B.useState({id:"",display_name:""}),[i,a]=B.useState([]),[o,s]=B.useState({id:"",display_name:"",categories:[]}),[l,c]=B.useState(!1),[d,u]=B.useState(!1),[p,h]=B.useState(!1),[m,f]=B.useState("danger"),[g,b]=B.useState(""),y=Gl(ko),{Spinner:v,Toast:w}=Xn.useComponentContext(),{https:x}=Xn.useAPIContext(),S=(j,F)=>{f(j),b(F),h(!0)};B.useEffect(()=>{async function j(){c(!0);const F=await x.getEntityFeature("profile_preferences"),V=await F.json();if(F.ok)e(V.data.categories),a(V.data.preferences),c(!1);else{c(!1);const z=Oi(V,y.clientConfigErrorMessage);console.error(y.clientConfigErrorMessage,z),S("danger",z)}}j()},[]);const _=async()=>{u(!0);const j=await x.updateProfilePreferences({preferences:i,categories:r});if(j.ok)u(!1),S("success",y.updateConfigMessage);else{u(!1);const F=await j.json(),V=Oi(F,y.updateConfigErrorMessage);console.error(y.updateConfigErrorMessage,V),S("danger",V)}},T=()=>{const j=[...r,t];if(!y2(j)){S("danger",y.uniqueCategoriesIdErrorMessage);return}e(j),n({id:"",display_name:""})},E=j=>{e(r.filter(F=>F.id!==j)),a(i.map(F=>({...F,categories:F.categories.filter(V=>V!==j)})))},I=()=>{const j=[...i,o];if(!y2(j)){S("danger",y.uniquePreferencesIdErrorMessage);return}a(j),s({id:"",display_name:"",categories:[]})},P=j=>{a(i.filter(F=>F.id!==j))},k=(j,F)=>{a(i.map(V=>{if(V.id===j){const z=V.categories.includes(F)?V.categories.filter(U=>U!==F):[...V.categories,F];return{...V,categories:z}}return V}))},O=j=>{const F=()=>{navigator.clipboard.writeText(j),S("primary","ID copied to clipboard")};return A.jsx(oe,{sx:{p:1,minWidth:"200px"},children:A.jsxs(oe,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[A.jsx(de,{level:"title-sm",textColor:"white",children:`${y.id}: ${j}`}),A.jsx(rt,{title:"Copy",placement:"right",children:A.jsx(kt,{variant:"soft",size:"sm",onClick:V=>{V.stopPropagation(),F()},sx:{"--IconButton-size":"8px",color:"#fff",bgcolor:"transparent","&:hover":{bgcolor:"transparent"}},children:A.jsx(Xs,{fontSize:"small"})})})]})})},M=()=>A.jsx(Ct,{xs:12,md:6,children:A.jsx(mt,{variant:"outlined",children:A.jsxs(ai,{children:[A.jsx(de,{level:"title-md",sx:{mb:1},children:y.categories}),A.jsx(xr,{sx:{mb:2}}),A.jsx(gt,{spacing:1,direction:"row",flexWrap:"wrap",useFlexGap:!0,sx:{mb:r.length>0?2:0},children:r.map(j=>A.jsx(Ut,{variant:"soft",color:"primary",sx:{"& .MuiChip-endDecorator":{cursor:"pointer",pointerEvents:"all"},"& .MuiChip-startDecorator":{cursor:"pointer",pointerEvents:"all"}},startDecorator:A.jsx(rt,{title:O(j.id),placement:"top",children:A.jsx(TA,{fontSize:"small",color:"primary"})}),endDecorator:A.jsx(rt,{title:y.delete,placement:"top",children:A.jsx(kt,{variant:"plain",size:"sm",color:"neutral",onClick:()=>E(j.id),sx:{":hover":{color:"#C41C1C",backgroundColor:"transparent"}},children:A.jsx(Yo,{fontSize:"small"})})}),children:j.display_name},j.id))}),A.jsxs(oe,{sx:{display:"flex",gap:1,flexWrap:"wrap",alignItems:"flex-start"},children:[A.jsxs(Me,{size:"sm",children:[A.jsx(Le,{required:!0,children:y.id}),A.jsx(it,{placeholder:"",value:t.id,onChange:j=>n({...t,id:j.target.value})})]}),A.jsxs(Me,{size:"sm",children:[A.jsx(Le,{required:!0,children:y.name}),A.jsx(it,{placeholder:"",value:t.display_name,onChange:j=>n({...t,display_name:j.target.value})})]}),A.jsx(st,{sx:{mt:"auto"},size:"sm",startDecorator:A.jsx(ro,{}),disabled:!t.id||!t.display_name,onClick:T,children:y.addCategory})]})]})})}),L=()=>A.jsx(Ct,{xs:12,md:6,children:A.jsx(mt,{variant:"outlined",children:A.jsxs(ai,{children:[A.jsx(de,{level:"title-md",sx:{mb:1},children:y.preferences}),A.jsx(xr,{sx:{mb:2}}),A.jsx(Ct,{container:!0,spacing:1,sx:{mb:i.length>0?2:0},children:i.map(j=>A.jsx(Ct,{xs:12,md:6,lg:4,children:A.jsx(mt,{variant:"soft",size:"sm",children:A.jsxs(ai,{children:[A.jsxs(oe,{sx:{display:"flex",justifyContent:"space-between"},children:[A.jsx(de,{level:"title-sm",startDecorator:A.jsx(rt,{title:O(j.id),placement:"top",children:A.jsx(TA,{fontSize:"small",color:"primary"})}),children:j.display_name}),A.jsx(rt,{title:y.delete,placement:"top",children:A.jsx(kt,{variant:"plain",size:"sm",color:"neutral",onClick:()=>P(j.id),sx:{"& .MuiChip-endDecorator":{cursor:"pointer",pointerEvents:"all"},":hover":{color:"#C41C1C",backgroundColor:"transparent"}},children:A.jsx(Yo,{fontSize:"small"})})})]}),A.jsxs(oe,{children:[A.jsxs(de,{level:"body-xs",sx:{mb:1},children:[y.categories,":"]}),A.jsx(gt,{direction:"row",spacing:1,flexWrap:"wrap",useFlexGap:!0,children:r.map(F=>A.jsx(Ut,{size:"sm",variant:j.categories.includes(F.id)?"solid":"outlined",color:j.categories.includes(F.id)?"primary":"neutral",onClick:()=>k(j.id,F.id),children:F.display_name},F.id))})]})]})})},j.id))}),A.jsxs(oe,{sx:{display:"flex",gap:1,flexWrap:"wrap",alignItems:"flex-start",mb:.5},children:[A.jsxs(Me,{size:"sm",children:[A.jsx(Le,{required:!0,children:y.id}),A.jsx(it,{placeholder:"",value:o.id,onChange:j=>s({...o,id:j.target.value})})]}),A.jsxs(Me,{size:"sm",children:[A.jsx(Le,{required:!0,children:y.name}),A.jsx(it,{placeholder:"",value:o.display_name,onChange:j=>s({...o,display_name:j.target.value})})]}),A.jsx(st,{sx:{mt:"auto"},size:"sm",startDecorator:A.jsx(ro,{}),disabled:!o.id||!o.display_name,onClick:I,children:y.addPreference})]}),A.jsxs(oe,{children:[A.jsxs(de,{level:"body-sm",mb:1,children:[y.selectCategories,":"]}),A.jsx(gt,{direction:"row",spacing:1,flexWrap:"wrap",useFlexGap:!0,children:r.map(j=>A.jsx(Ut,{size:"sm",variant:o.categories.includes(j.id)?"solid":"outlined",color:o.categories.includes(j.id)?"primary":"neutral",onClick:()=>s({...o,categories:o.categories.includes(j.id)?o.categories.filter(F=>F!==j.id):[...o.categories,j.id]}),children:j.display_name},j.id))})]})]})})});return l?A.jsx(v,{my:30}):A.jsxs(A.Fragment,{children:[A.jsxs(Ct,{container:!0,spacing:2,mb:4,mt:2,children:[M(),L()]}),A.jsx(oe,{textAlign:"center",children:A.jsx(st,{onClick:_,loading:d,children:y.update})}),A.jsx(w,{showToast:p,color:m,message:g,hideToast:()=>h(!p)})]})},C1e=[{value:"fullName",label:"Full Name"},{value:"firstName",label:"First Name"},{value:"lastName",label:"Last Name"},{value:"email",label:"Email"},{value:"gender",label:"Gender"},{value:"country",label:"Country"},{value:"phoneCountryCode",label:"Phone Country Code"},{value:"phoneNumber",label:"Phone Number"}],I1e=[{value:"before",label:"Before"},{value:"after",label:"After"}],S1e=[{code:"+93",country:"Afghanistan",flag:"🇦🇫"},{code:"+355",country:"Albania",flag:"🇦🇱"},{code:"+213",country:"Algeria",flag:"🇩🇿"},{code:"+376",country:"Andorra",flag:"🇦🇩"},{code:"+244",country:"Angola",flag:"🇦🇴"},{code:"+672",country:"Antarctica",flag:"🇦🇶"},{code:"+54",country:"Argentina",flag:"🇦🇷"},{code:"+374",country:"Armenia",flag:"🇦🇲"},{code:"+297",country:"Aruba",flag:"🇦🇼"},{code:"+61",country:"Australia",flag:"🇦🇺"},{code:"+43",country:"Austria",flag:"🇦🇹"},{code:"+994",country:"Azerbaijan",flag:"🇦🇿"},{code:"+973",country:"Bahrain",flag:"🇧🇭"},{code:"+880",country:"Bangladesh",flag:"🇧🇩"},{code:"+375",country:"Belarus",flag:"🇧🇾"},{code:"+32",country:"Belgium",flag:"🇧🇪"},{code:"+501",country:"Belize",flag:"🇧🇿"},{code:"+229",country:"Benin",flag:"🇧🇯"},{code:"+975",country:"Bhutan",flag:"🇧🇹"},{code:"+591",country:"Bolivia",flag:"🇧🇴"},{code:"+387",country:"Bosnia and Herzegovina",flag:"🇧🇦"},{code:"+267",country:"Botswana",flag:"🇧🇼"},{code:"+55",country:"Brazil",flag:"🇧🇷"},{code:"+246",country:"British Indian Ocean Territory",flag:"🇮🇴"},{code:"+673",country:"Brunei",flag:"🇧🇳"},{code:"+359",country:"Bulgaria",flag:"🇧🇬"},{code:"+226",country:"Burkina Faso",flag:"🇧🇫"},{code:"+257",country:"Burundi",flag:"🇧🇮"},{code:"+855",country:"Cambodia",flag:"🇰🇭"},{code:"+237",country:"Cameroon",flag:"🇨🇲"},{code:"+1",country:"Canada",flag:"🇨🇦"},{code:"+238",country:"Cape Verde",flag:"🇨🇻"},{code:"+236",country:"Central African Republic",flag:"🇨🇫"},{code:"+235",country:"Chad",flag:"🇹🇩"},{code:"+56",country:"Chile",flag:"🇨🇱"},{code:"+86",country:"China",flag:"🇨🇳"},{code:"+57",country:"Colombia",flag:"🇨🇴"},{code:"+269",country:"Comoros",flag:"🇰🇲"},{code:"+682",country:"Cook Islands",flag:"🇨🇰"},{code:"+506",country:"Costa Rica",flag:"🇨🇷"},{code:"+385",country:"Croatia",flag:"🇭🇷"},{code:"+53",country:"Cuba",flag:"🇨🇺"},{code:"+599",country:"Curaçao",flag:"🇨🇼"},{code:"+357",country:"Cyprus",flag:"🇨🇾"},{code:"+420",country:"Czech Republic",flag:"🇨🇿"},{code:"+243",country:"Democratic Republic of the Congo",flag:"🇨🇩"},{code:"+45",country:"Denmark",flag:"🇩🇰"},{code:"+253",country:"Djibouti",flag:"🇩🇯"},{code:"+670",country:"East Timor",flag:"🇹🇱"},{code:"+593",country:"Ecuador",flag:"🇪🇨"},{code:"+20",country:"Egypt",flag:"🇪🇬"},{code:"+503",country:"El Salvador",flag:"🇸🇻"},{code:"+240",country:"Equatorial Guinea",flag:"🇬🇶"},{code:"+291",country:"Eritrea",flag:"🇪🇷"},{code:"+372",country:"Estonia",flag:"🇪🇪"},{code:"+268",country:"Eswatini",flag:"🇸🇿"},{code:"+251",country:"Ethiopia",flag:"🇪🇹"},{code:"+500",country:"Falkland Islands",flag:"🇫🇰"},{code:"+298",country:"Faroe Islands",flag:"🇫🇴"},{code:"+679",country:"Fiji",flag:"🇫🇯"},{code:"+358",country:"Finland",flag:"🇫🇮"},{code:"+33",country:"France",flag:"🇫🇷"},{code:"+594",country:"French Guiana",flag:"🇬🇫"},{code:"+689",country:"French Polynesia",flag:"🇵🇫"},{code:"+241",country:"Gabon",flag:"🇬🇦"},{code:"+220",country:"Gambia",flag:"🇬🇲"},{code:"+995",country:"Georgia",flag:"🇬🇪"},{code:"+49",country:"Germany",flag:"🇩🇪"},{code:"+233",country:"Ghana",flag:"🇬🇭"},{code:"+350",country:"Gibraltar",flag:"🇬🇮"},{code:"+30",country:"Greece",flag:"🇬🇷"},{code:"+299",country:"Greenland",flag:"🇬🇱"},{code:"+590",country:"Guadeloupe",flag:"🇬🇵"},{code:"+502",country:"Guatemala",flag:"🇬🇹"},{code:"+224",country:"Guinea",flag:"🇬🇳"},{code:"+245",country:"Guinea-Bissau",flag:"🇬🇼"},{code:"+592",country:"Guyana",flag:"🇬🇾"},{code:"+509",country:"Haiti",flag:"🇭🇹"},{code:"+504",country:"Honduras",flag:"🇭🇳"},{code:"+852",country:"Hong Kong",flag:"🇭🇰"},{code:"+36",country:"Hungary",flag:"🇭🇺"},{code:"+354",country:"Iceland",flag:"🇮🇸"},{code:"+91",country:"India",flag:"🇮🇳"},{code:"+62",country:"Indonesia",flag:"🇮🇩"},{code:"+98",country:"Iran",flag:"🇮🇷"},{code:"+964",country:"Iraq",flag:"🇮🇶"},{code:"+353",country:"Ireland",flag:"🇮🇪"},{code:"+972",country:"Israel",flag:"🇮🇱"},{code:"+39",country:"Italy",flag:"🇮🇹"},{code:"+225",country:"Ivory Coast",flag:"🇨🇮"},{code:"+81",country:"Japan",flag:"🇯🇵"},{code:"+962",country:"Jordan",flag:"🇯🇴"},{code:"+254",country:"Kenya",flag:"🇰🇪"},{code:"+686",country:"Kiribati",flag:"🇰🇮"},{code:"+383",country:"Kosovo",flag:"🇽🇰"},{code:"+965",country:"Kuwait",flag:"🇰🇼"},{code:"+996",country:"Kyrgyzstan",flag:"🇰🇬"},{code:"+856",country:"Laos",flag:"🇱🇦"},{code:"+371",country:"Latvia",flag:"🇱🇻"},{code:"+961",country:"Lebanon",flag:"🇱🇧"},{code:"+266",country:"Lesotho",flag:"🇱🇸"},{code:"+231",country:"Liberia",flag:"🇱🇷"},{code:"+218",country:"Libya",flag:"🇱🇾"},{code:"+423",country:"Liechtenstein",flag:"🇱🇮"},{code:"+370",country:"Lithuania",flag:"🇱🇹"},{code:"+352",country:"Luxembourg",flag:"🇱🇺"},{code:"+853",country:"Macau",flag:"🇲🇴"},{code:"+261",country:"Madagascar",flag:"🇲🇬"},{code:"+265",country:"Malawi",flag:"🇲🇼"},{code:"+60",country:"Malaysia",flag:"🇲🇾"},{code:"+960",country:"Maldives",flag:"🇲🇻"},{code:"+223",country:"Mali",flag:"🇲🇱"},{code:"+356",country:"Malta",flag:"🇲🇹"},{code:"+692",country:"Marshall Islands",flag:"🇲🇭"},{code:"+596",country:"Martinique",flag:"🇲🇶"},{code:"+222",country:"Mauritania",flag:"🇲🇷"},{code:"+230",country:"Mauritius",flag:"🇲🇺"},{code:"+52",country:"Mexico",flag:"🇲🇽"},{code:"+691",country:"Micronesia",flag:"🇫🇲"},{code:"+373",country:"Moldova",flag:"🇲🇩"},{code:"+377",country:"Monaco",flag:"🇲🇨"},{code:"+976",country:"Mongolia",flag:"🇲🇳"},{code:"+382",country:"Montenegro",flag:"🇲🇪"},{code:"+212",country:"Morocco",flag:"🇲🇦"},{code:"+258",country:"Mozambique",flag:"🇲🇿"},{code:"+95",country:"Myanmar",flag:"🇲🇲"},{code:"+264",country:"Namibia",flag:"🇳🇦"},{code:"+674",country:"Nauru",flag:"🇳🇷"},{code:"+977",country:"Nepal",flag:"🇳🇵"},{code:"+31",country:"Netherlands",flag:"🇳🇱"},{code:"+687",country:"New Caledonia",flag:"🇳🇨"},{code:"+64",country:"New Zealand",flag:"🇳🇿"},{code:"+505",country:"Nicaragua",flag:"🇳🇮"},{code:"+227",country:"Niger",flag:"🇳🇪"},{code:"+234",country:"Nigeria",flag:"🇳🇬"},{code:"+683",country:"Niue",flag:"🇳🇺"},{code:"+850",country:"North Korea",flag:"🇰🇵"},{code:"+389",country:"North Macedonia",flag:"🇲🇰"},{code:"+47",country:"Norway",flag:"🇳🇴"},{code:"+968",country:"Oman",flag:"🇴🇲"},{code:"+92",country:"Pakistan",flag:"🇵🇰"},{code:"+680",country:"Palau",flag:"🇵🇼"},{code:"+970",country:"Palestine",flag:"🇵🇸"},{code:"+507",country:"Panama",flag:"🇵🇦"},{code:"+675",country:"Papua New Guinea",flag:"🇵🇬"},{code:"+595",country:"Paraguay",flag:"🇵🇾"},{code:"+51",country:"Peru",flag:"🇵🇪"},{code:"+63",country:"Philippines",flag:"🇵🇭"},{code:"+48",country:"Poland",flag:"🇵🇱"},{code:"+351",country:"Portugal",flag:"🇵🇹"},{code:"+974",country:"Qatar",flag:"🇶🇦"},{code:"+242",country:"Republic of the Congo",flag:"🇨🇬"},{code:"+262",country:"Réunion",flag:"🇷🇪"},{code:"+40",country:"Romania",flag:"🇷🇴"},{code:"+7",country:"Russia",flag:"🇷🇺"},{code:"+250",country:"Rwanda",flag:"🇷🇼"},{code:"+290",country:"Saint Helena",flag:"🇸🇭"},{code:"+685",country:"Samoa",flag:"🇼🇸"},{code:"+378",country:"San Marino",flag:"🇸🇲"},{code:"+239",country:"São Tomé and Príncipe",flag:"🇸🇹"},{code:"+966",country:"Saudi Arabia",flag:"🇸🇦"},{code:"+221",country:"Senegal",flag:"🇸🇳"},{code:"+381",country:"Serbia",flag:"🇷🇸"},{code:"+248",country:"Seychelles",flag:"🇸🇨"},{code:"+232",country:"Sierra Leone",flag:"🇸🇱"},{code:"+65",country:"Singapore",flag:"🇸🇬"},{code:"+421",country:"Slovakia",flag:"🇸🇰"},{code:"+386",country:"Slovenia",flag:"🇸🇮"},{code:"+677",country:"Solomon Islands",flag:"🇸🇧"},{code:"+252",country:"Somalia",flag:"🇸🇴"},{code:"+27",country:"South Africa",flag:"🇿🇦"},{code:"+82",country:"South Korea",flag:"🇰🇷"},{code:"+34",country:"Spain",flag:"🇪🇸"},{code:"+94",country:"Sri Lanka",flag:"🇱🇰"},{code:"+249",country:"Sudan",flag:"🇸🇩"},{code:"+597",country:"Suriname",flag:"🇸🇷"},{code:"+46",country:"Sweden",flag:"🇸🇪"},{code:"+41",country:"Switzerland",flag:"🇨🇭"},{code:"+963",country:"Syria",flag:"🇸🇾"},{code:"+886",country:"Taiwan",flag:"🇹🇼"},{code:"+992",country:"Tajikistan",flag:"🇹🇯"},{code:"+255",country:"Tanzania",flag:"🇹🇿"},{code:"+66",country:"Thailand",flag:"🇹🇭"},{code:"+228",country:"Togo",flag:"🇹🇬"},{code:"+690",country:"Tokelau",flag:"🇹🇰"},{code:"+676",country:"Tonga",flag:"🇹🇴"},{code:"+216",country:"Tunisia",flag:"🇹🇳"},{code:"+90",country:"Turkey",flag:"🇹🇷"},{code:"+993",country:"Turkmenistan",flag:"🇹🇲"},{code:"+688",country:"Tuvalu",flag:"🇹🇻"},{code:"+256",country:"Uganda",flag:"🇺🇬"},{code:"+380",country:"Ukraine",flag:"🇺🇦"},{code:"+971",country:"United Arab Emirates",flag:"🇦🇪"},{code:"+44",country:"United Kingdom",flag:"🇬🇧"},{code:"+1",country:"United States",flag:"🇺🇸"},{code:"+598",country:"Uruguay",flag:"🇺🇾"},{code:"+998",country:"Uzbekistan",flag:"🇺🇿"},{code:"+678",country:"Vanuatu",flag:"🇻🇺"},{code:"+58",country:"Venezuela",flag:"🇻🇪"},{code:"+84",country:"Vietnam",flag:"🇻🇳"},{code:"+681",country:"Wallis and Futuna",flag:"🇼🇫"},{code:"+967",country:"Yemen",flag:"🇾🇪"},{code:"+260",country:"Zambia",flag:"🇿🇲"},{code:"+263",country:"Zimbabwe",flag:"🇿🇼"}],_1e=({config:r,onConfigChange:e,getConfigValue:t})=>{const{BooleanSwitch:n}=Xn.useComponentContext(),i=a=>{const o=t(["leads","fields"],[]),s=o.includes(a)?o.filter(l=>l!==a):[...o,a];e(["leads","fields"],s)};return A.jsxs(gt,{spacing:3,children:[A.jsx(Ns,{color:"primary",variant:"soft",startDecorator:A.jsx(Fb,{}),children:'This configuration is used when the entity authentication requirement is set to "Lead". It defines the lead form fields and behavior for collecting user information.'}),A.jsxs(oe,{children:[A.jsx(de,{level:"title-sm",children:"Fields"}),A.jsx(xt,{sx:{mb:1},children:"Select the fields that will be shown in the lead form."}),A.jsx(oe,{sx:{display:"flex",flexWrap:"wrap",gap:1},children:C1e.map(a=>A.jsx(Up,{sx:{m:.5,"& .MuiCheckbox-checkbox":{backgroundColor:"white","&:hover":{backgroundColor:"#f0f4f8"}},"& .MuiCheckbox-checkbox.Mui-checked":{backgroundColor:"#0066CC"}},checked:t(["leads","fields"],[]).includes(a.value),label:a.label,onChange:()=>i(a.value)},a.value))})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Position"}),A.jsx(wt,{value:t(["leads","position"],null),onChange:(a,o)=>e(["leads","position"],o),children:I1e.map(a=>A.jsx(Xe,{value:a.value,children:a.label},a.value))}),A.jsx(xt,{children:"Determines when to show the lead form - before or after user submits their participation."})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Phone Country Code"}),A.jsx(wt,{placeholder:"Select country code",value:t(["leads","phoneCountryCode"],"")||null,onChange:(a,o)=>{e(["leads","phoneCountryCode"],o)},slotProps:{listbox:{sx:{maxHeight:"300px",overflow:"auto"}}},children:S1e.map((a,o)=>A.jsxs(Xe,{value:a.code,children:[a.flag," ",a.country," (",a.code,")"]},`${a.code}-${a.country}-${o}`))}),A.jsx(xt,{children:"Default phone country code for the lead form."})]}),A.jsx(n,{label:"Sync with Profile",defaultValue:t(["leads","syncWithProfile"],!1),description:`Link lead form data with profile data. Useful when widgets are exposed to non-authenticated users and there is a leaderboard
|
|
3663
|
-
where you want to show their names. When not synced, the names in the leaderboard will be shown as "UserXXXX" where XXXX is a random number.`,descriptionColor:"neutral",disabled:!1,onChange:a=>e(["leads","syncWithProfile"],a)}),A.jsxs(mt,{variant:"outlined",children:[A.jsx(de,{level:"title-md",children:"Campaign"}),A.jsx(xr,{}),A.jsx(xt,{children:"The campaign can be a custom name or ID that can be used later as criteria when exporting collected leads. This helps organize and filter leads based on different campaigns or promotions."}),A.jsxs(gt,{spacing:2,children:[A.jsxs(Me,{children:[A.jsx(Le,{children:"ID"}),A.jsx(it,{placeholder:"",value:t(["leads","campaignId"],""),onChange:a=>e(["leads","campaignId"],a.target.value)})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Name"}),A.jsx(it,{placeholder:"",value:t(["leads","campaignName"],""),onChange:a=>e(["leads","campaignName"],a.target.value)})]})]})]})]})},T1e=["50","100","200","300","400","500","600","700","800","900"],b2={50:"#EDF5FD",100:"#E3EFFB",200:"#C7DFF7",300:"#97C3F0",400:"#4393E4",500:"#0B6BCB",600:"#185EA5",700:"#12467B",800:"#0A2744",900:"#051423"},k1e=[{value:"light",label:"Light"},{value:"dark",label:"Dark"}],A1e=({config:r,onConfigChange:e,getConfigValue:t})=>{const n=(i,a)=>{e(["theme","primaryColor",i],a)};return A.jsxs(gt,{spacing:3,children:[A.jsx(Ns,{color:"warning",variant:"soft",startDecorator:A.jsx(qZ,{}),children:A.jsxs(oe,{children:[A.jsx(de,{level:"title-sm",sx:{mb:.5},children:"Legacy Theme Configuration"}),A.jsx(de,{level:"body-sm",children:"The theme configuration in this tab will be deprecated in the future. This theme configuration is only used in Either/Or, Match Prediction, and Team Next Match Prediction widgets at the moment. Later on these widgets will be migrated to the new theme system."})]})}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Mode"}),A.jsx(wt,{value:t(["theme","mode"],"light"),onChange:(i,a)=>e(["theme","mode"],a),children:k1e.map(i=>A.jsx(Xe,{value:i.value,children:i.label},i.value))}),A.jsx(xt,{children:"Select the theme mode (light or dark)"})]}),A.jsxs(oe,{children:[A.jsx(de,{level:"title-sm",children:"Primary Color Palette"}),A.jsx(xt,{sx:{mb:1},children:"Configure the primary color shades for the theme. Each shade represents a different intensity of the primary color."}),A.jsx(gt,{spacing:2,children:T1e.map(i=>{const a=t(["theme","primaryColor",i],""),o=a||b2[i];return A.jsxs(Me,{children:[A.jsx(Le,{children:i}),A.jsx(it,{value:a,onChange:s=>n(i,s.target.value),placeholder:b2[i],endDecorator:A.jsx(oe,{component:"input",type:"color",value:o,onChange:s=>n(i,s.target.value),sx:{width:"36px",height:"28px",border:"none",borderRadius:"4px",cursor:"pointer",padding:0,backgroundColor:"transparent","&::-webkit-color-swatch-wrapper":{padding:"2px",borderRadius:"4px"},"&::-webkit-color-swatch":{border:"1px solid",borderColor:"neutral.outlinedBorder",borderRadius:"3px"},"&::-moz-color-swatch":{border:"1px solid",borderColor:"neutral.outlinedBorder",borderRadius:"3px"}}})})]},i)})})]})]})},x2=[{code:"bg",name:"Bulgarian",flag:"🇧🇬"},{code:"en",name:"English",flag:"🇬🇧"},{code:"ro",name:"Romanian",flag:"🇷🇴"},{code:"pt",name:"Portuguese",flag:"🇵🇹"},{code:"pt-br",name:"Portuguese (Brazil)",flag:"🇧🇷"},{code:"sr",name:"Serbian",flag:"🇷🇸"},{code:"fr",name:"French",flag:"🇫🇷"},{code:"fr-be",name:"French (Belgium)",flag:"🇧🇪"},{code:"de",name:"German",flag:"🇩🇪"},{code:"it",name:"Italian",flag:"🇮🇹"},{code:"pl",name:"Polish",flag:"🇵🇱"},{code:"sk",name:"Slovak",flag:"🇸🇰"},{code:"el",name:"Greek",flag:"🇬🇷"}],P1e=[{value:"left",label:"Left"},{value:"right",label:"Right"}],E1e=[{value:"twoByTwo",label:"Two by Two (2x2 Grid)"},{value:"row",label:"Row"},{value:"column",label:"Column"}],O1e=[{value:"STANDARD",label:"Standard"},{value:"SPLIT",label:"Split"},{value:"OVERLAY",label:"Overlay"}],R1e=[{value:null,label:"None"},{value:"REGISTERED",label:"Registered users only"}],tC=[{value:"_self",label:"Same Window"},{value:"_blank",label:"New Tab"}],D1e=[{value:"modal",label:"Modal"},{value:"link",label:"Link"}],M1e=({onConfigChange:r,getConfigValue:e})=>{const[t,n]=B.useState({general:!1,display:!1,widgetSpecific:!1}),[i,a]=B.useState(!1),{BooleanSwitch:o,ImageCard:s}=Xn.useComponentContext(),l=B.useRef(null),c=Gl(ko),d=f=>{n(g=>({...g,[f]:!g[f]}))},u=f=>!f||typeof f!="object"?!0:Object.values(f).every(g=>g===""||g===null||g===void 0),p=f=>{if(r(f,void 0),f.length>1){const g=f.slice(0,-1),y={...e(g,{})};delete y[f[f.length-1]],u(y)&&r(g,void 0)}},h=(f,g,b)=>{r([f,g],b);const v={...e([f],{}),[g]:b};u(v)&&r([f],void 0)},m=({widgets:f})=>A.jsxs(oe,{sx:{display:"flex",gap:.5,flexWrap:"wrap",mt:1},children:[A.jsx(de,{level:"body-xs",sx:{color:"text.tertiary",mr:.5},children:"Affected Widgets:"}),f.map(g=>A.jsx(Ut,{size:"sm",variant:"soft",color:"primary",children:g},g))]});return A.jsxs(gt,{spacing:2,children:[A.jsx(Ns,{color:"primary",variant:"soft",startDecorator:A.jsx(Fb,{}),children:A.jsxs(oe,{children:["All settings below are optional and serve as default values for your widgets. Each widget can be individually configured with different settings by passing data attributes directly to the widget embed code. This allows you to override these defaults on a per-widget basis.",A.jsxs(oe,{sx:{display:"flex",alignItems:"center",gap:.5,mt:1},children:[A.jsx(VZ,{sx:{fontSize:"1rem"}}),A.jsx(eo,{href:"https://docs.fansunitedmedia.com/docs/user-centric-widgets#/",target:"_blank",rel:"noopener noreferrer",children:"Learn more in the documentation"})]})]})}),A.jsxs(mt,{variant:"outlined",sx:{p:0,transition:"all 0.2s ease-in-out",overflow:"hidden"},children:[A.jsxs(oe,{sx:{p:1.5,bgcolor:"neutral.softBg",display:"flex",alignItems:"center",justifyContent:"center",gap:1,cursor:"pointer",borderTopLeftRadius:"sm",borderTopRightRadius:"sm",position:"relative"},onClick:()=>d("general"),children:[A.jsx(de,{level:"title-md",textAlign:"center",sx:{flex:1},children:"General Settings"}),A.jsx(oe,{sx:{position:"absolute",right:16},children:t.general?A.jsx(hh,{}):A.jsx(ph,{})})]}),t.general&&A.jsxs(gt,{spacing:2,sx:{p:2},children:[A.jsxs(Me,{children:[A.jsx(Le,{children:"Language"}),A.jsx(wt,{value:e(["language"],"en"),onChange:(f,g)=>r(["language"],g),children:(()=>{const f=e(["language"],"en"),g=x2.some(b=>b.code===f);return A.jsxs(A.Fragment,{children:[f&&!g&&A.jsxs(Xe,{value:f,children:[f," (Custom value)"]}),x2.map(b=>A.jsx(Xe,{value:b.code,children:A.jsxs(oe,{sx:{display:"flex",alignItems:"center",gap:1},children:[A.jsx("span",{children:b.flag}),A.jsx("span",{children:b.name})]})},b.code))]})})()}),A.jsx(xt,{children:"Controls the widget labels language."})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Layout Template"}),A.jsx(wt,{value:e(["layoutTemplate"],null),onChange:(f,g)=>r(["layoutTemplate"],g),...e(["layoutTemplate"],null)&&{endDecorator:A.jsx(kt,{variant:"plain",color:"neutral",onMouseDown:f=>{f.stopPropagation()},onClick:()=>{p(["layoutTemplate"]),l.current?.focusVisible()},sx:{width:"18px",height:"18px"},children:A.jsx(fa,{})}),indicator:null},children:O1e.map(f=>A.jsx(Xe,{value:f.value,children:f.label},f.value))}),A.jsx(xt,{children:"Choose the overall layout template for widgets. Standard: image takes 30% width with configurable position. Split: image takes 50% width on the left. Overlay: image as background with content overlay."})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Image Position"}),A.jsx(wt,{value:e(["imagePosition"],null),onChange:(f,g)=>r(["imagePosition"],g),...e(["imagePosition"],null)&&{endDecorator:A.jsx(kt,{variant:"plain",color:"neutral",onMouseDown:f=>{f.stopPropagation()},onClick:()=>{p(["imagePosition"]),l.current?.focusVisible()},sx:{width:"18px",height:"18px"},children:A.jsx(fa,{})}),indicator:null},children:P1e.map(f=>A.jsx(Xe,{value:f.value,children:f.label},f.value))}),A.jsx(xt,{children:"Position of the image relative to the main content. Applicable only for Standard layout."})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Options Layout"}),A.jsx(wt,{value:e(["optionsLayout"],null),onChange:(f,g)=>r(["optionsLayout"],g),...e(["optionsLayout"],null)&&{endDecorator:A.jsx(kt,{variant:"plain",color:"neutral",onMouseDown:f=>{f.stopPropagation()},onClick:()=>{p(["optionsLayout"]),l.current?.focusVisible()},sx:{width:"18px",height:"18px"},children:A.jsx(fa,{})}),indicator:null},children:E1e.map(f=>A.jsx(Xe,{value:f.value,children:f.label},f.value))}),A.jsx(xt,{children:"Define how answer options are displayed."})]}),A.jsxs(oe,{children:[A.jsxs(oe,{sx:{display:"flex",alignItems:"center",gap:1,mb:2},children:[A.jsx(de,{level:"body-sm",sx:{fontWeight:i?400:600,color:i?"text.secondary":"primary.500",transition:"all 0.2s ease"},children:"Upload Image"}),A.jsx(Kp,{checked:i,onChange:f=>a(f.target.checked),color:"primary"}),A.jsx(de,{level:"body-sm",sx:{fontWeight:i?600:400,color:i?"primary.500":"text.secondary",transition:"all 0.2s ease"},children:"URL Input"})]}),A.jsxs(gt,{mb:2,gap:1,children:[A.jsx(de,{level:"body-sm",children:"Replace the default placeholder image with a custom one. Applicable only for Split and Overlay layouts."}),A.jsx(de,{level:"body-sm",children:"Recommendations: 4:5 ratio for Split and 16:9 ratio for Overlay."})]}),i?A.jsxs(Me,{children:[A.jsx(Le,{children:"Default Image Placeholder"}),A.jsx(it,{value:e(["defaultImagePlaceholderUrl"],""),onChange:f=>r(["defaultImagePlaceholderUrl"],f.target.value),placeholder:"https://example.com/placeholder.jpg"})]}):A.jsx(s,{labels:c,title:"Default Image Placeholder",image:e(["defaultImagePlaceholderUrl"],""),onChangeImages:f=>r(["defaultImagePlaceholderUrl"],f),clearImage:()=>p(["defaultImagePlaceholderUrl"])})]}),A.jsx(mt,{variant:"outlined",sx:{p:0},children:A.jsxs(gt,{spacing:2,children:[A.jsx(de,{level:"title-sm",fontWeight:"lg",px:2,pt:2,children:"Sign In CTA"}),A.jsxs(oe,{sx:{px:2},children:[A.jsx(de,{level:"body-xs",sx:{color:"text.secondary"},children:'Configures the sign in view for entities with auth requirement "Registered". When not configured, a disabled button with label "Sign In" will be displayed.'}),A.jsxs(de,{level:"body-xs",sx:{color:"text.secondary",mt:.5},children:["Order of priority: function name ",">"," URL."]}),A.jsx(m,{widgets:["Classic Quiz","Poll","Personality Quiz","Match Quiz"]})]}),A.jsx(xr,{}),A.jsxs(gt,{spacing:2,sx:{px:2,pb:2},children:[A.jsxs(Me,{children:[A.jsx(Le,{children:"Label"}),A.jsx(it,{value:e(["signInCTA","defaultLabel"],""),onChange:f=>h("signInCTA","defaultLabel",f.target.value),placeholder:"Sign in to participate"}),A.jsx(xt,{children:"Text displayed on the sign in button"})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Function Name"}),A.jsx(it,{value:e(["signInCTA","onClick"],""),onChange:f=>h("signInCTA","onClick",f.target.value),placeholder:"handleSignIn()"}),A.jsx(xt,{children:"JavaScript function name to be triggered when the button is clicked"})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"URL"}),A.jsx(it,{value:e(["signInCTA","url"],""),onChange:f=>h("signInCTA","url",f.target.value),placeholder:"https://yourdomain.com/signin"}),A.jsx(xt,{children:"URL to navigate to when the button is clicked (alternative to function name)"})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Target"}),A.jsx(wt,{value:e(["signInCTA","target"],""),onChange:(f,g)=>h("signInCTA","target",g),...e(["signInCTA","target"])&&{endDecorator:A.jsx(kt,{variant:"plain",color:"neutral",onMouseDown:f=>{f.stopPropagation()},onClick:()=>{p(["signInCTA","target"]),l.current?.focusVisible()},sx:{width:"18px",height:"18px"},children:A.jsx(fa,{})}),indicator:null},children:tC.map(f=>A.jsx(Xe,{value:f.value,children:f.label},f.value))}),A.jsx(xt,{children:"Where to open the URL (current tab or new tab)"})]})]})]})}),A.jsx(mt,{variant:"outlined",sx:{p:0},children:A.jsxs(gt,{spacing:2,children:[A.jsx(de,{level:"title-sm",fontWeight:"lg",px:2,pt:2,children:"Additional CTA"}),A.jsxs(oe,{sx:{px:2},children:[A.jsx(de,{level:"body-xs",sx:{color:"text.secondary"},children:"Shown after user participation. The button will not be displayed if no settings are configured."}),A.jsxs(de,{level:"body-xs",sx:{color:"text.secondary",mt:.5},children:["Order of priority: function name ",">"," URL."]})]}),A.jsx(xr,{}),A.jsxs(gt,{spacing:2,sx:{px:2,pb:2},children:[A.jsxs(Me,{children:[A.jsx(Le,{children:"Label"}),A.jsx(it,{value:e(["additionalCTA","defaultLabel"],""),onChange:f=>h("additionalCTA","defaultLabel",f.target.value),placeholder:"Learn More"}),A.jsx(xt,{children:"Text displayed on the button after user participation"})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Function Name"}),A.jsx(it,{value:e(["additionalCTA","onClick"],""),onChange:f=>h("additionalCTA","onClick",f.target.value),placeholder:"handleAdditionalAction()"}),A.jsx(xt,{children:"JavaScript function name to be triggered when the button is clicked"})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"URL"}),A.jsx(it,{value:e(["additionalCTA","url"],""),onChange:f=>h("additionalCTA","url",f.target.value),placeholder:"https://yourdomain.com/info"}),A.jsx(xt,{children:"URL to navigate to when the button is clicked (alternative to function name)"})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Target"}),A.jsx(wt,{value:e(["additionalCTA","target"],""),onChange:(f,g)=>h("additionalCTA","target",g),...e(["additionalCTA","target"])&&{endDecorator:A.jsx(kt,{variant:"plain",color:"neutral",onMouseDown:f=>{f.stopPropagation()},onClick:()=>{p(["additionalCTA","target"]),l.current?.focusVisible()},sx:{width:"18px",height:"18px"},children:A.jsx(fa,{})}),indicator:null},children:tC.map(f=>A.jsx(Xe,{value:f.value,children:f.label},f.value))}),A.jsx(xt,{children:"Where to open the URL (current tab or new tab)"})]})]})]})}),A.jsx(mt,{variant:"outlined",sx:{p:0},children:A.jsxs(gt,{spacing:2,children:[A.jsx(de,{level:"title-sm",fontWeight:"lg",px:2,pt:2,children:"Rules Display"}),A.jsxs(oe,{sx:{px:2},children:[A.jsx(de,{level:"body-xs",sx:{color:"text.secondary"},children:"An info icon shown after headline text for example QUIZ, POLL, MATCH QUIZ and etc. The icon is shown only when rules are configured."}),A.jsx(m,{widgets:["Classic Quiz","Poll","Personality Quiz","Match Quiz","Event Game"]})]}),A.jsx(xr,{}),A.jsxs(gt,{spacing:2,sx:{px:2,pb:2},children:[A.jsxs(Me,{children:[A.jsx(Le,{children:"Display Type"}),A.jsx(wt,{value:e(["rulesDisplay","type"],""),onChange:(f,g)=>h("rulesDisplay","type",g),...e(["rulesDisplay","type"])&&{endDecorator:A.jsx(kt,{variant:"plain",color:"neutral",onMouseDown:f=>{f.stopPropagation()},onClick:()=>{p(["rulesDisplay","type"]),l.current?.focusVisible()},sx:{width:"18px",height:"18px"},children:A.jsx(fa,{})}),indicator:null},children:D1e.map(f=>A.jsx(Xe,{value:f.value,children:f.label},f.value))}),A.jsx(xt,{children:"You can choose between displaying rules in a modal dialog (default) or as a link to an external page"})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"URL"}),A.jsx(it,{value:e(["rulesDisplay","url"],""),onChange:f=>h("rulesDisplay","url",f.target.value),placeholder:"https://yourdomain.com/rules"}),A.jsx(xt,{children:"URL to navigate to when the info icon is clicked"})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Target"}),A.jsx(wt,{value:e(["rulesDisplay","target"],""),onChange:(f,g)=>h("rulesDisplay","target",g),...e(["rulesDisplay","target"])&&{endDecorator:A.jsx(kt,{variant:"plain",color:"neutral",onMouseDown:f=>{f.stopPropagation()},onClick:()=>{p(["rulesDisplay","target"]),l.current?.focusVisible()},sx:{width:"18px",height:"18px"},children:A.jsx(fa,{})}),indicator:null},children:tC.map(f=>A.jsx(Xe,{value:f.value,children:f.label},f.value))}),A.jsx(xt,{children:"Where to open the URL (current tab or new tab)"})]})]})]})})]})]}),A.jsxs(mt,{variant:"outlined",sx:{p:0,transition:"all 0.2s ease-in-out",overflow:"hidden"},children:[A.jsxs(oe,{sx:{p:1.5,bgcolor:"neutral.softBg",display:"flex",alignItems:"center",justifyContent:"center",gap:1,cursor:"pointer",borderTopLeftRadius:"sm",borderTopRightRadius:"sm",position:"relative"},onClick:()=>d("display"),children:[A.jsx(de,{level:"title-md",textAlign:"center",sx:{flex:1},children:"Display Settings"}),A.jsx(oe,{sx:{position:"absolute",right:16},children:t.display?A.jsx(hh,{}):A.jsx(ph,{})})]}),t.display&&A.jsxs(gt,{spacing:1.5,sx:{p:2},children:[A.jsxs(oe,{children:[A.jsx(o,{label:"Show Team Labels",defaultValue:e(["showTeamLabels"],!1),description:"Display team names in the widget",descriptionColor:"neutral",disabled:!1,onChange:f=>r(["showTeamLabels"],f)}),A.jsx(m,{widgets:["Match Quiz"]})]}),A.jsx(xr,{sx:{my:.5}}),A.jsxs(oe,{children:[A.jsx(o,{label:"Show Points",defaultValue:e(["showPoints"],!1),description:"When enabled, the widget will show the points for each fixture question",descriptionColor:"neutral",disabled:!1,onChange:f=>r(["showPoints"],f)}),A.jsx(m,{widgets:["Match Quiz","Event Game"]})]}),A.jsx(xr,{sx:{my:.5}}),A.jsxs(oe,{children:[A.jsx(o,{label:"Show Prediction Details",defaultValue:e(["showPredictionDetails"],!1),description:"When enabled and the game predictions are resolved, the widget will show a tabular view where users can view their prediction outcomes",descriptionColor:"neutral",disabled:!1,onChange:f=>r(["showPredictionDetails"],f)}),A.jsx(m,{widgets:["Match Quiz","Event Game"]})]}),A.jsx(xr,{sx:{my:.5}}),A.jsxs(oe,{children:[A.jsx(o,{label:"Show Countdown",defaultValue:e(["showCountdown"],!1),description:"When enabled, the widget will show a countdown to the game cutoff time",descriptionColor:"neutral",disabled:!1,onChange:f=>r(["showCountdown"],f)}),A.jsx(m,{widgets:["Match Quiz","Event Game"]})]}),A.jsx(xr,{sx:{my:.5}}),A.jsxs(oe,{children:[A.jsx(o,{label:"Show Answer Explanations",defaultValue:e(["showAnswerExplanations"],!1),description:"When enabled and the user submits their answers, the widget will show a tabular view where users can view answer explanations",descriptionColor:"neutral",disabled:!1,onChange:f=>r(["showAnswerExplanations"],f)}),A.jsx(m,{widgets:["Classic Quiz","Personality Quiz"]})]})]})]}),A.jsxs(mt,{variant:"outlined",sx:{p:0,overflow:"hidden",transition:"all 0.2s ease-in-out"},children:[A.jsxs(oe,{sx:{p:1.5,bgcolor:"neutral.softBg",display:"flex",alignItems:"center",justifyContent:"center",gap:1,cursor:"pointer",borderTopLeftRadius:"sm",borderTopRightRadius:"sm",position:"relative"},onClick:()=>d("widgetSpecific"),children:[A.jsx(de,{level:"title-md",textAlign:"center",sx:{flex:1},children:"Widget-Specific Settings"}),A.jsx(oe,{sx:{position:"absolute",right:16},children:t.widgetSpecific?A.jsx(hh,{}):A.jsx(ph,{})})]}),t.widgetSpecific&&A.jsxs(gt,{spacing:2,sx:{p:2},children:[A.jsxs(oe,{children:[A.jsx(de,{level:"body-sm",fontWeight:"lg",sx:{mb:1,color:"text.primary"},children:"Player of the Match"}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Authentication Requirement"}),A.jsx(wt,{value:e(["playerOfTheMatch","authRequirement"],null),onChange:(f,g)=>{r(["playerOfTheMatch","authRequirement"],g)},...e(["playerOfTheMatch","authRequirement"],null)&&{endDecorator:A.jsx(kt,{variant:"plain",color:"neutral",onMouseDown:f=>{f.stopPropagation()},onClick:()=>{p(["playerOfTheMatch","authRequirement"]),l.current?.focusVisible()},sx:{width:"18px",height:"18px"},children:A.jsx(fa,{})}),indicator:null},children:R1e.map((f,g)=>A.jsx(Xe,{value:f.value,children:f.label},f.value||`none-${g}`))}),A.jsx(xt,{children:"Authentication level required to vote for player of the match"})]})]}),A.jsx(xr,{sx:{my:2}}),A.jsxs(oe,{children:[A.jsx(de,{level:"body-sm",fontWeight:"lg",sx:{mb:1,color:"text.primary"},children:"List Widget URLs"}),A.jsxs(de,{level:"body-xs",sx:{color:"text.secondary",mb:1.5},children:["Configure relative paths or full URL patterns for different content types. The ","{CONTENT_ID}"," placeholder is optional - if present, it gets replaced with the actual content ID. If not present, the URL is used as provided. When left empty, the widget will load the content in a modal view."]}),A.jsxs(gt,{spacing:1.5,children:[A.jsxs(Me,{children:[A.jsx(Le,{children:"Classic Quiz URL"}),A.jsx(it,{value:e(["urls","classicQuizUrl"],""),onChange:f=>r(["urls","classicQuizUrl"],f.target.value),placeholder:"/quiz/{CONTENT_ID}"})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Personality Quiz URL"}),A.jsx(it,{value:e(["urls","personalityQuizUrl"],""),onChange:f=>r(["urls","personalityQuizUrl"],f.target.value),placeholder:"/personality-quiz/{CONTENT_ID}"})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Either/Or URL"}),A.jsx(it,{value:e(["urls","eitherOrUrl"],""),onChange:f=>r(["urls","eitherOrUrl"],f.target.value),placeholder:"/either-or/{CONTENT_ID}"})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Match Quiz URL"}),A.jsx(it,{value:e(["urls","matchQuizUrl"],""),onChange:f=>r(["urls","matchQuizUrl"],f.target.value),placeholder:"/match-quiz/{CONTENT_ID}"})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Poll URL"}),A.jsx(it,{value:e(["urls","pollUrl"],""),onChange:f=>r(["urls","pollUrl"],f.target.value),placeholder:"/poll/{CONTENT_ID}"})]})]})]})]})]})]})},Or={mode:"light",spacingScale:{"3xs":"2px","2xs":"4px",xs:"8px",sm:"12px",md:"16px",lg:"24px",xl:"32px","2xl":"40px","3xl":"48px"},colorSchemes:{light:{palette:{success:{plainColor:"#4CAF50",outlinedBorder:"#4CAF50"},danger:{softBg:"#FEE4E2",plainColor:"#F44336",outlinedBorder:"#F44336"},primary:{plainColor:"#1A77D2",outlinedBorder:"#1A77D2",onPrimary:"#FAFAFA",primaryContainer:"#2397F3"},warning:{softBg:"#FEF0C7",plainColor:"#DC6803"},neutral:{softBg:"#F8F9FA",solidBg:"#6C757D",solidColor:"#FFF",plainActiveBg:"#DDE7EE",outlinedBorder:"#CDD7E1",outlinedColor:"#32383E",outlinedHoverBg:"#F0F4F8",plainHoverBg:"#F0F4F8",plainHoverColor:"#0B0D0E",plainColor:"#32383E",solidHoverBg:"#5C636A"},background:{surface:"#FFF",popup:"#FFF"}},textPrimary:"#212121",textSecondary:"#212121",textColor:"#212121",textDisabled:"#212121",surface:"#FFFFFF",onSurface:"#F5F5F5",surfaceVariant:"#EEEEEE",surfaceTintDim:"#212121",surfaceInverse:"#F5F5F5",outlineEnabledBorder:"#E0E0E0",secondaryContainer:"#BDBDBD"},dark:{palette:{primary:{plainColor:"#1A77D2",outlinedBorder:"#1A77D2",onPrimary:"#FAFAFA",primaryContainer:"#2397F3"},success:{plainColor:"#4CAF50",outlinedBorder:"#4CAF50"},danger:{softBg:"#430A0A",plainColor:"#F44336",outlinedBorder:"#F44336"},warning:{softBg:"#FEF0C7",plainColor:"#DC6803"},neutral:{softBg:"#32383E",solidBg:"#CDD7E1",solidColor:"#0B0D0E",plainActiveBg:"#636B74",outlinedBorder:"#32383E",outlinedColor:"#CDD7E1",outlinedHoverBg:"#32383E",plainHoverBg:"#32383E",plainHoverColor:"#CDD7E1",plainColor:"#CDD7E1",solidHoverBg:"#DDE7EE"},background:{surface:"#0B0D0E",popup:"#171A1C"}},textPrimary:"#FAFAFA",textSecondary:"#FAFAFA",textColor:"#FAFAFA",textDisabled:"#FAFAFA",surface:"#424242",onSurface:"#212121",surfaceVariant:"#616161",surfaceTintDim:"#FAFAFA",surfaceInverse:"#FAFAFA",outlineEnabledBorder:"#757575",secondaryContainer:"#757575"}},customFontFamily:{light:{primary:"Ubuntu, sans-serif",secondary:"Roboto, sans-serif"},dark:{primary:"Ubuntu, sans-serif",secondary:"Roboto, sans-serif"}},customRadius:{light:{none:"0px","2xs":"2px",xs:"4px",sm:"8px",md:"12px",lg:"16px",xl:"24px","2xl":"232px",full:"1000px"},dark:{none:"0px","2xs":"2px",xs:"4px",sm:"8px",md:"12px",lg:"16px",xl:"24px","2xl":"232px",full:"1000px"}},border:{light:{size:"1px"},dark:{size:"2px"}},imageBackgroundGradient:{light:{standard:"linear-gradient(270deg, rgba(255, 255, 255, 0) 0%, rgba(18, 18, 18, 0.8) 100%)",split:"linear-gradient(270deg, rgba(255, 255, 255, 0) 0%, rgba(18, 18, 18, 0.8) 100%)"},dark:{standard:"linear-gradient(270deg, rgba(255, 255, 255, 0) 0%, rgba(18, 18, 18, 0.8) 100%)",split:"linear-gradient(270deg, rgba(255, 255, 255, 0) 0%, rgba(18, 18, 18, 0.8) 100%)",overlay:"linear-gradient(270deg, rgba(255, 255, 255, 0) 0%, rgba(18, 18, 18, 0.8) 100%)"}},customBreakpoints:{values:{xs:0,sm:444,md:600,lg:900,xl:1200,xxl:1536}}},L1e=["3xs","2xs","xs","sm","md","lg","xl","2xl","3xl"],w2=["none","2xs","xs","sm","md","lg","xl","2xl","full"],j1e=["xs","sm","md","lg","xl","xxl"],$1e=({onConfigChange:r,getConfigValue:e})=>{const[t,n]=B.useState({spacing:!1,colorSchemes:!1,fontFamily:!1,radius:!1,border:!1,gradient:!1,breakpoints:!1}),i=p=>{n(h=>({...h,[p]:!h[p]}))},a=p=>parseInt(p.replace("px",""))||0,o=p=>`${p}px`,s=p=>p.replace(/([A-Z])/g," $1").trim().replace(/^./,h=>h.toUpperCase()),l=(p,h)=>A.jsxs(oe,{sx:{p:1.5,bgcolor:"neutral.softBg",display:"flex",alignItems:"center",justifyContent:"center",gap:1,cursor:"pointer",borderTopLeftRadius:"sm",borderTopRightRadius:"sm",position:"relative"},onClick:()=>i(h),children:[A.jsx(de,{level:"title-md",textAlign:"center",sx:{flex:1},children:p}),A.jsx(oe,{sx:{position:"absolute",right:16},children:t[h]?A.jsx(hh,{}):A.jsx(ph,{})})]}),c=(p,h,m)=>{const f=e(h,""),g=f||m;return A.jsxs(Me,{size:"sm",children:[A.jsx(Le,{sx:{fontSize:"0.75rem"},children:p}),A.jsx(it,{size:"sm",value:f,onChange:b=>r(h,b.target.value),placeholder:m,endDecorator:A.jsx(oe,{component:"input",type:"color",value:g,onChange:b=>r(h,b.target.value),sx:{width:"32px",height:"24px",border:"none",borderRadius:"4px",cursor:"pointer",padding:0,backgroundColor:"transparent","&::-webkit-color-swatch-wrapper":{padding:"2px",borderRadius:"4px"},"&::-webkit-color-swatch":{border:"1px solid",borderColor:"neutral.outlinedBorder",borderRadius:"3px"},"&::-moz-color-swatch":{border:"1px solid",borderColor:"neutral.outlinedBorder",borderRadius:"3px"}}})})]})},d=p=>{const h=["primary","success","danger","warning","neutral","background"],m=Or.colorSchemes[p].palette;return A.jsxs(oe,{children:[A.jsx(de,{level:"body-sm",fontWeight:"lg",sx:{mb:1},children:"Palette"}),A.jsx(gt,{spacing:1.5,children:h.map(f=>{const g=m[f];return g?A.jsxs(mt,{variant:"outlined",size:"sm",sx:{p:1.5},children:[A.jsx(de,{level:"body-xs",fontWeight:"lg",sx:{mb:1,textTransform:"capitalize"},children:f}),A.jsx(Ct,{container:!0,spacing:1,children:Object.entries(g).map(([b,y])=>A.jsx(Ct,{xs:6,children:c(s(b),["themeOptions","colorSchemes",p,"palette",f,b],y)},b))})]},f):null})})]})},u=p=>{const h=Or.colorSchemes[p],m=["textPrimary","textSecondary","textColor","textDisabled","surface","onSurface","surfaceVariant","surfaceTintDim","surfaceInverse","outlineEnabledBorder","secondaryContainer"];return A.jsxs(oe,{children:[A.jsx(de,{level:"body-sm",fontWeight:"lg",sx:{mb:1},children:"Color Tokens"}),A.jsx(Ct,{container:!0,spacing:1,children:m.map(f=>{const g=h[f];return g?A.jsx(Ct,{xs:6,children:c(s(f),["themeOptions","colorSchemes",p,f],g)},f):null})})]})};return A.jsxs(gt,{spacing:2,children:[A.jsx(Ns,{color:"primary",variant:"soft",startDecorator:A.jsx(Fb,{}),children:A.jsxs(oe,{children:[A.jsx(de,{level:"body-sm",children:"Configure theme options to customize the visual appearance of your widgets. All fields show default values as placeholders for reference. Only values you explicitly set will be saved to your configuration."}),A.jsxs(de,{level:"body-sm",sx:{mt:1},children:["Learn more about how these options affect your widgets in our"," ",A.jsx("a",{href:"https://help.fansunitedmedia.com/770336-Classic-Quiz-Widget-Advanced-Customization-with-Theme-Options",target:"_blank",rel:"noopener noreferrer",style:{color:"inherit",fontWeight:600},children:"documentation"}),"."]})]})}),A.jsxs(gt,{spacing:.5,children:[A.jsxs(oe,{sx:{display:"flex",alignItems:"center",gap:1},children:[A.jsx(de,{level:"body-sm",sx:{fontWeight:e(["themeOptions","mode"],Or.mode)==="light"?600:400,color:e(["themeOptions","mode"],Or.mode)==="light"?"primary.500":"text.secondary",transition:"all 0.2s ease"},children:"Light Mode"}),A.jsx(Kp,{checked:e(["themeOptions","mode"],Or.mode)==="dark",onChange:p=>r(["themeOptions","mode"],p.target.checked?"dark":"light"),color:"primary"}),A.jsx(de,{level:"body-sm",sx:{fontWeight:e(["themeOptions","mode"],Or.mode)==="dark"?600:400,color:e(["themeOptions","mode"],Or.mode)==="dark"?"primary.500":"text.secondary",transition:"all 0.2s ease"},children:"Dark Mode"})]}),A.jsx(de,{level:"body-sm",children:"Select the default theme mode for your widgets."})]}),A.jsxs(mt,{variant:"outlined",sx:{p:0,transition:"all 0.2s ease-in-out",overflow:"hidden"},children:[l("Spacing","spacing"),t.spacing&&A.jsxs(gt,{spacing:2,sx:{p:2},children:[A.jsx(de,{level:"title-sm",pl:1,children:"Define spacing values for different size scales. These values control the spacing between elements, such as padding, margins, and gaps. Values are in pixels."}),A.jsx(Ct,{container:!0,spacing:2,children:L1e.map(p=>{const h=Or.spacingScale[p],m=e(["themeOptions","spacingScale",p],"");return A.jsx(Ct,{xs:6,sm:4,md:3,children:A.jsxs(Me,{children:[A.jsx(Le,{children:p}),A.jsx(it,{type:"number",value:m?a(m):"",onChange:f=>{const g=parseInt(f.target.value);isNaN(g)||r(["themeOptions","spacingScale",p],o(g))},placeholder:a(h).toString(),endDecorator:"px",slotProps:{input:{min:0}},sx:{"& input[type=number]::-webkit-outer-spin-button, & input[type=number]::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:0},"& input[type=number]":{MozAppearance:"textfield"}}})]})},p)})})]})]}),A.jsxs(mt,{variant:"outlined",sx:{p:0,transition:"all 0.2s ease-in-out",overflow:"hidden"},children:[l("Colors","colorSchemes"),t.colorSchemes&&A.jsxs(gt,{spacing:2,sx:{p:2},children:[A.jsx(de,{level:"title-sm",pl:1,children:"These colors control the appearance of buttons, backgrounds, text, borders, and other UI elements."}),A.jsxs(Ct,{container:!0,spacing:2,children:[A.jsx(Ct,{xs:12,md:6,children:A.jsxs(mt,{variant:"soft",sx:{p:2},children:[A.jsx(de,{level:"title-sm",sx:{mb:2},children:"Light Mode"}),A.jsxs(gt,{spacing:2,children:[d("light"),u("light")]})]})}),A.jsx(Ct,{xs:12,md:6,children:A.jsxs(mt,{variant:"soft",sx:{p:2},children:[A.jsx(de,{level:"title-sm",sx:{mb:2},children:"Dark Mode"}),A.jsxs(gt,{spacing:2,children:[d("dark"),u("dark")]})]})})]})]})]}),A.jsxs(mt,{variant:"outlined",sx:{p:0,transition:"all 0.2s ease-in-out",overflow:"hidden"},children:[l("Font Family","fontFamily"),t.fontFamily&&A.jsxs(gt,{spacing:2,sx:{p:2},children:[A.jsx(de,{level:"title-sm",pl:1,children:"Primary font is used for headings and important text, while secondary font is used for body text and descriptions."}),A.jsxs(Ct,{container:!0,spacing:2,children:[A.jsx(Ct,{xs:12,md:6,children:A.jsxs(mt,{variant:"soft",sx:{p:2},children:[A.jsx(de,{level:"title-sm",sx:{mb:2},children:"Light Mode"}),A.jsxs(gt,{spacing:2,children:[A.jsxs(Me,{children:[A.jsx(Le,{children:"Primary Font"}),A.jsx(it,{value:e(["themeOptions","customFontFamily","light","primary"],""),onChange:p=>r(["themeOptions","customFontFamily","light","primary"],p.target.value),placeholder:Or.customFontFamily.light.primary})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Secondary Font"}),A.jsx(it,{value:e(["themeOptions","customFontFamily","light","secondary"],""),onChange:p=>r(["themeOptions","customFontFamily","light","secondary"],p.target.value),placeholder:Or.customFontFamily.light.secondary})]})]})]})}),A.jsx(Ct,{xs:12,md:6,children:A.jsxs(mt,{variant:"soft",sx:{p:2},children:[A.jsx(de,{level:"title-sm",sx:{mb:2},children:"Dark Mode"}),A.jsxs(gt,{spacing:2,children:[A.jsxs(Me,{children:[A.jsx(Le,{children:"Primary Font"}),A.jsx(it,{value:e(["themeOptions","customFontFamily","dark","primary"],""),onChange:p=>r(["themeOptions","customFontFamily","dark","primary"],p.target.value),placeholder:Or.customFontFamily.dark.primary})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Secondary Font"}),A.jsx(it,{value:e(["themeOptions","customFontFamily","dark","secondary"],""),onChange:p=>r(["themeOptions","customFontFamily","dark","secondary"],p.target.value),placeholder:Or.customFontFamily.dark.secondary})]})]})]})})]})]})]}),A.jsxs(mt,{variant:"outlined",sx:{p:0,transition:"all 0.2s ease-in-out",overflow:"hidden"},children:[l("Radius","radius"),t.radius&&A.jsxs(gt,{spacing:2,sx:{p:2},children:[A.jsx(de,{level:"title-sm",pl:1,children:"These values control the roundness of corners for buttons, cards, inputs, and other UI elements. Values are in pixels."}),A.jsxs(Ct,{container:!0,spacing:2,children:[A.jsx(Ct,{xs:12,md:6,children:A.jsxs(mt,{variant:"soft",sx:{p:2},children:[A.jsx(de,{level:"title-sm",sx:{mb:2},children:"Light Mode"}),A.jsx(Ct,{container:!0,spacing:1.5,children:w2.map(p=>{const h=Or.customRadius.light[p],m=e(["themeOptions","customRadius","light",p],"");return A.jsx(Ct,{xs:6,sm:4,children:A.jsxs(Me,{size:"sm",children:[A.jsx(Le,{sx:{fontSize:"0.75rem"},children:p}),A.jsx(it,{size:"sm",type:"number",value:m?a(m):"",onChange:f=>{const g=parseInt(f.target.value);isNaN(g)||r(["themeOptions","customRadius","light",p],o(g))},placeholder:a(h).toString(),endDecorator:"px",slotProps:{input:{min:0}},sx:{"& input[type=number]::-webkit-outer-spin-button, & input[type=number]::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:0},"& input[type=number]":{MozAppearance:"textfield"}}})]})},p)})})]})}),A.jsx(Ct,{xs:12,md:6,children:A.jsxs(mt,{variant:"soft",sx:{p:2},children:[A.jsx(de,{level:"title-sm",sx:{mb:2},children:"Dark Mode"}),A.jsx(Ct,{container:!0,spacing:1.5,children:w2.map(p=>{const h=Or.customRadius.dark[p],m=e(["themeOptions","customRadius","dark",p],"");return A.jsx(Ct,{xs:6,sm:4,children:A.jsxs(Me,{size:"sm",children:[A.jsx(Le,{sx:{fontSize:"0.75rem"},children:p}),A.jsx(it,{size:"sm",type:"number",value:m?a(m):"",onChange:f=>{const g=parseInt(f.target.value);isNaN(g)||r(["themeOptions","customRadius","dark",p],o(g))},placeholder:a(h).toString(),endDecorator:"px",slotProps:{input:{min:0}},sx:{"& input[type=number]::-webkit-outer-spin-button, & input[type=number]::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:0},"& input[type=number]":{MozAppearance:"textfield"}}})]})},p)})})]})})]})]})]}),A.jsxs(mt,{variant:"outlined",sx:{p:0,transition:"all 0.2s ease-in-out",overflow:"hidden"},children:[l("Border","border"),t.border&&A.jsxs(gt,{spacing:2,sx:{p:2},children:[A.jsx(de,{level:"title-sm",pl:1,children:"This controls the thickness of borders around cards and other outlined elements. Values are in pixels."}),A.jsxs(Ct,{container:!0,spacing:2,children:[A.jsx(Ct,{xs:12,md:6,children:A.jsxs(mt,{variant:"soft",sx:{p:2},children:[A.jsx(de,{level:"title-sm",sx:{mb:2},children:"Light Mode"}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Border Size"}),A.jsx(it,{type:"number",value:e(["themeOptions","border","light","size"],"")?a(e(["themeOptions","border","light","size"],"")):"",onChange:p=>{const h=parseInt(p.target.value);isNaN(h)||r(["themeOptions","border","light","size"],o(h))},placeholder:a(Or.border.light.size).toString(),endDecorator:"px",slotProps:{input:{min:0}},sx:{"& input[type=number]::-webkit-outer-spin-button, & input[type=number]::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:0},"& input[type=number]":{MozAppearance:"textfield"}}})]})]})}),A.jsx(Ct,{xs:12,md:6,children:A.jsxs(mt,{variant:"soft",sx:{p:2},children:[A.jsx(de,{level:"title-sm",sx:{mb:2},children:"Dark Mode"}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Border Size"}),A.jsx(it,{type:"number",value:e(["themeOptions","border","dark","size"],"")?a(e(["themeOptions","border","dark","size"],"")):"",onChange:p=>{const h=parseInt(p.target.value);isNaN(h)||r(["themeOptions","border","dark","size"],o(h))},placeholder:a(Or.border.dark.size).toString(),endDecorator:"px",slotProps:{input:{min:0}},sx:{"& input[type=number]::-webkit-outer-spin-button, & input[type=number]::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:0},"& input[type=number]":{MozAppearance:"textfield"}}})]})]})})]})]})]}),A.jsxs(mt,{variant:"outlined",sx:{p:0,transition:"all 0.2s ease-in-out",overflow:"hidden"},children:[l("Image Background Gradient","gradient"),t.gradient&&A.jsxs(gt,{spacing:2,sx:{p:2},children:[A.jsx(de,{level:"title-sm",pl:1,children:"Configure CSS gradient values for image backgrounds. These gradients are applied as overlays on images to ensure text readability."}),A.jsxs(Ct,{container:!0,spacing:2,children:[A.jsx(Ct,{xs:12,md:6,children:A.jsxs(mt,{variant:"soft",sx:{p:2},children:[A.jsx(de,{level:"title-sm",sx:{mb:2},children:"Light Mode"}),A.jsxs(gt,{spacing:2,children:[A.jsxs(Me,{children:[A.jsx(Le,{children:"Standard"}),A.jsx(it,{value:e(["themeOptions","imageBackgroundGradient","light","standard"],""),onChange:p=>r(["themeOptions","imageBackgroundGradient","light","standard"],p.target.value),placeholder:Or.imageBackgroundGradient.light.standard})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Split"}),A.jsx(it,{value:e(["themeOptions","imageBackgroundGradient","light","split"],""),onChange:p=>r(["themeOptions","imageBackgroundGradient","light","split"],p.target.value),placeholder:Or.imageBackgroundGradient.light.split})]})]})]})}),A.jsx(Ct,{xs:12,md:6,children:A.jsxs(mt,{variant:"soft",sx:{p:2},children:[A.jsx(de,{level:"title-sm",sx:{mb:2},children:"Dark Mode"}),A.jsxs(gt,{spacing:2,children:[A.jsxs(Me,{children:[A.jsx(Le,{children:"Standard"}),A.jsx(it,{value:e(["themeOptions","imageBackgroundGradient","dark","standard"],""),onChange:p=>r(["themeOptions","imageBackgroundGradient","dark","standard"],p.target.value),placeholder:Or.imageBackgroundGradient.dark.standard})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Split"}),A.jsx(it,{value:e(["themeOptions","imageBackgroundGradient","dark","split"],""),onChange:p=>r(["themeOptions","imageBackgroundGradient","dark","split"],p.target.value),placeholder:Or.imageBackgroundGradient.dark.split})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Overlay"}),A.jsx(it,{value:e(["themeOptions","imageBackgroundGradient","dark","overlay"],""),onChange:p=>r(["themeOptions","imageBackgroundGradient","dark","overlay"],p.target.value),placeholder:Or.imageBackgroundGradient.dark.overlay})]})]})]})})]})]})]}),A.jsxs(mt,{variant:"outlined",sx:{p:0,transition:"all 0.2s ease-in-out",overflow:"hidden"},children:[l("Breakpoints","breakpoints"),t.breakpoints&&A.jsxs(gt,{spacing:2,sx:{p:2},children:[A.jsx(de,{level:"title-sm",pl:1,children:"Configure responsive breakpoint values. These define the width thresholds at which widgets adapt their layout based on the available width - either the parent container width when embedded (e.g., in article containers) or the device screen size when rendered standalone. This ensures proper responsive behavior in all contexts. Values are in pixels."}),A.jsx(Ct,{container:!0,spacing:2,children:j1e.map(p=>{const h=Or.customBreakpoints.values[p],m=e(["themeOptions","customBreakpoints","values",p],"");return A.jsx(Ct,{xs:6,sm:4,md:2,children:A.jsxs(Me,{children:[A.jsx(Le,{children:p}),A.jsx(it,{type:"number",value:m!==""?m:"",onChange:f=>{const g=parseInt(f.target.value);isNaN(g)||r(["themeOptions","customBreakpoints","values",p],g)},placeholder:h.toString(),endDecorator:"px",slotProps:{input:{min:0}},sx:{"& input[type=number]::-webkit-outer-spin-button, & input[type=number]::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:0},"& input[type=number]":{MozAppearance:"textfield"}}})]})},p)})})]})]})]})},C2=[{code:"bg",name:"Bulgarian",flag:"🇧🇬"},{code:"en",name:"English",flag:"🇬🇧"},{code:"ro",name:"Romanian",flag:"🇷🇴"},{code:"el",name:"Greek",flag:"🇬🇷"},{code:"sk",name:"Slovak",flag:"🇸🇰"},{code:"pt",name:"Portuguese",flag:"🇵🇹"},{code:"sr",name:"Serbian",flag:"🇷🇸"},{code:"hu",name:"Hungarian",flag:"🇭🇺"},{code:"sv",name:"Swedish",flag:"🇸🇪"},{code:"es",name:"Spanish",flag:"🇪🇸"},{code:"fr",name:"French",flag:"🇫🇷"},{code:"nl",name:"Dutch",flag:"🇳🇱"},{code:"de",name:"German",flag:"🇩🇪"},{code:"it",name:"Italian",flag:"🇮🇹"},{code:"ar",name:"Arabic",flag:"🇸🇦"}],I2=[{value:"native",label:"Native"},{value:"sportal365",label:"Sportal365"},{value:"enetpulse",label:"Enetpulse"}],F1e=({id:r,title:e,description:t,config:n,clientApiKeys:i,onTitleChange:a,onDescriptionChange:o,onConfigChange:s,onClose:l,onSave:c,isSubmitting:d,isEditing:u})=>{const[p,h]=B.useState(0),[m,f]=B.useState(!1),[g,b]=B.useState(""),[y,v]=B.useState(""),w=(T,E)=>{const I={...n};let P=I;for(let k=0;k<T.length-1;k++)P[T[k]]||(P[T[k]]={}),P=P[T[k]];P[T[T.length-1]]=E,s(I)},x=(T,E="")=>{let I=n;for(const P of T)if(I&&typeof I=="object"&&P in I)I=I[P];else return E;return I??E},S=T=>{if(T)b(JSON.stringify(n,null,2)),v("");else try{const E=JSON.parse(g);s(E),v("")}catch{v("Invalid JSON format. Please fix the errors before switching to form mode.");return}f(T)},_=T=>{b(T);try{const E=JSON.parse(T);s(E),v("")}catch{v("Invalid JSON format")}};return A.jsxs(gt,{spacing:3,children:[r&&A.jsxs(Me,{children:[A.jsx(Le,{children:"ID"}),A.jsx(it,{value:r,readOnly:!0})]}),A.jsxs(oe,{children:[A.jsxs(Me,{required:!0,sx:{mb:2},children:[A.jsx(Le,{children:"Title"}),A.jsx(it,{placeholder:"",value:e,onChange:T=>a(T.target.value)})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Description"}),A.jsx(Kc,{placeholder:"",minRows:2,value:t,onChange:T=>o(T.target.value)})]})]}),A.jsx(xr,{}),A.jsxs(oe,{sx:{display:"flex",alignItems:"center",gap:1},children:[A.jsx(de,{level:"body-sm",sx:{fontWeight:m?400:600,color:m?"text.secondary":"primary.500",transition:"all 0.2s ease"},children:"Form View"}),A.jsx(Kp,{checked:m,onChange:T=>S(T.target.checked),color:"primary"}),A.jsx(de,{level:"body-sm",sx:{fontWeight:m?600:400,color:m?"primary.500":"text.secondary",transition:"all 0.2s ease"},children:"Raw JSON"})]}),m?A.jsxs(Me,{error:!!y,children:[A.jsx(Le,{children:"Raw JSON Configuration"}),A.jsx(Kc,{placeholder:"",minRows:15,maxRows:25,value:g,onChange:T=>_(T.target.value),sx:{fontFamily:"monospace",fontSize:"0.875rem"}}),y&&A.jsx(xt,{children:y})]}):A.jsxs(Jp,{value:p,onChange:(T,E)=>h(E),children:[A.jsxs(Yp,{sx:{flexWrap:"wrap"},children:[A.jsxs(ln,{children:[A.jsx(GZ,{sx:{mr:1}}),"SDK Configuration"]}),A.jsxs(ln,{children:[A.jsx(KZ,{sx:{mr:1}}),"Firebase"]}),A.jsxs(ln,{children:[A.jsx(UZ,{sx:{mr:1}}),"Leads"]}),A.jsxs(ln,{children:[A.jsx(kA,{sx:{mr:1}}),"Theme Options"]}),A.jsxs(ln,{children:[A.jsx(WZ,{sx:{mr:1}}),"Misc"]}),A.jsxs(ln,{children:[A.jsx(HZ,{sx:{mr:1}}),"Legacy"]})]}),A.jsx(xn,{value:0,children:A.jsxs(gt,{spacing:2,children:[A.jsxs(Me,{children:[A.jsx(Le,{children:"API Key"}),A.jsx(wt,{placeholder:"",value:x(["fansUnited","apiKey"],"")||null,onChange:(T,E)=>w(["fansUnited","apiKey"],E),children:(()=>{const T=x(["fansUnited","apiKey"],""),E=i.some(I=>I.value===T);return A.jsxs(A.Fragment,{children:[T&&!E&&A.jsxs(Xe,{value:T,children:[T," (Custom value)"]}),i.map(I=>A.jsx(Xe,{value:I.value,children:I.label},I.value))]})})()}),A.jsx(xt,{children:"Controls which API key will be used to authenticate with APIs"})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"ID Schema"}),A.jsx(wt,{value:x(["fansUnited","idSchema"],"native"),onChange:(T,E)=>w(["fansUnited","idSchema"],E),children:(()=>{const T=x(["fansUnited","idSchema"],"native"),E=I2.some(I=>I.value===T);return A.jsxs(A.Fragment,{children:[T&&!E&&A.jsxs(Xe,{value:T,children:[T," (Custom value)"]}),I2.map(I=>A.jsx(Xe,{value:I.value,children:I.label},I.value))]})})()}),A.jsx(xt,{children:"Responsible for setting the football provider IDs"})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Language"}),A.jsx(wt,{value:x(["language"],"en"),onChange:(T,E)=>w(["language"],E),children:(()=>{const T=x(["language"],"en"),E=C2.some(I=>I.code===T);return A.jsxs(A.Fragment,{children:[T&&!E&&A.jsxs(Xe,{value:T,children:[T," (Custom value)"]}),C2.map(I=>A.jsx(Xe,{value:I.code,children:A.jsxs(oe,{sx:{display:"flex",alignItems:"center",gap:1},children:[A.jsx("span",{children:I.flag}),A.jsx("span",{children:I.name})]})},I.code))]})})()}),A.jsx(xt,{children:"Controls the football content language that will be loaded from Football API"})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Token Cookie Name"}),A.jsx(it,{placeholder:"",value:x(["fansUnited","tokenCookieName"]),onChange:T=>w(["fansUnited","tokenCookieName"],T.target.value)}),A.jsx(xt,{children:"Used when widgets will be used with websites that have current authentication flow. To provide a valid JWT, the widgets will read the JWT from a document cookie."})]})]})}),A.jsx(xn,{value:1,children:A.jsxs(gt,{spacing:2,children:[A.jsxs(Me,{children:[A.jsx(Le,{children:"API Key"}),A.jsx(it,{placeholder:"",value:x(["firebase","apiKey"]),onChange:T=>w(["firebase","apiKey"],T.target.value)})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Auth Domain"}),A.jsx(it,{placeholder:"",value:x(["firebase","authDomain"]),onChange:T=>w(["firebase","authDomain"],T.target.value)})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Project ID"}),A.jsx(it,{placeholder:"",value:x(["firebase","projectId"]),onChange:T=>w(["firebase","projectId"],T.target.value)})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"App ID"}),A.jsx(it,{placeholder:"",value:x(["firebase","appId"]),onChange:T=>w(["firebase","appId"],T.target.value)})]})]})}),A.jsx(xn,{value:2,children:A.jsx(_1e,{config:n,onConfigChange:w,getConfigValue:x})}),A.jsx(xn,{value:3,children:A.jsx($1e,{onConfigChange:w,getConfigValue:x})}),A.jsx(xn,{value:4,children:A.jsx(M1e,{onConfigChange:w,getConfigValue:x})}),A.jsx(xn,{value:5,children:A.jsx(A1e,{config:n,onConfigChange:w,getConfigValue:x})})]}),A.jsxs(oe,{sx:{display:"flex",gap:1,justifyContent:"flex-end",pt:2},children:[A.jsx(st,{variant:"outlined",color:"neutral",onClick:l,children:"Close"}),A.jsx(st,{onClick:c,loading:d,disabled:!e||m&&!!y,children:u?"Update":"Create"})]})]})},N1e=()=>{const[r,e]=B.useState([]),[t,n]=B.useState(!1),[i,a]=B.useState(!1),[o,s]=B.useState(!1),[l,c]=B.useState(!1),[d,u]=B.useState(null),[p,h]=B.useState(null),[m,f]=B.useState({title:"",description:"",config:{}}),[g,b]=B.useState(null),[y,v]=B.useState(!1),[w,x]=B.useState("danger"),[S,_]=B.useState(""),{Spinner:T,Toast:E}=Xn.useComponentContext(),{https:I}=Xn.useAPIContext(),P=(U,R)=>{x(U),_(R),v(!0)},k=async(U=!0)=>{U&&n(!0);const[R,$]=await Promise.all([I.getWidgetConfigurations(!0),I.getClientById()]),H=await R.json(),W=await $.json();if(R.ok)e(H.data||[]);else{const Q=Oi(H,"Failed to fetch widget configurations");console.error("Error fetching configurations:",Q),P("danger",Q)}if($.ok)b(W.data);else{const Q=Oi(W,"Failed to fetch client info data");console.error("Error fetching client info:",Q),P("danger",Q)}U&&n(!1)};B.useEffect(()=>{k()},[]);const O=()=>{h(null);const U=g?.infrastructure?.toLowerCase()||"prod";f({title:"",description:"",config:{language:"en",fansUnited:{apiKey:"",clientId:g?.id||"",environment:U,idSchema:"native",errorHandlingMode:"standard",tokenCookieName:""},firebase:{apiKey:"",authDomain:"",projectId:"",appId:""}}}),s(!0)},M=U=>{h(U),f({...U,config:typeof U.config=="string"?JSON.parse(U.config):U.config}),s(!0)},L=U=>{u(U),c(!0)},j=async U=>{try{if(navigator.clipboard&&typeof navigator.clipboard.writeText=="function"){await navigator.clipboard.writeText(U),P("primary","Configuration ID copied to clipboard");return}const R=document.createElement("textarea");R.value=U,R.style.position="fixed",R.style.left="-9999px",R.style.opacity="0",document.body.appendChild(R),R.focus(),R.select();const $=document.execCommand("copy");document.body.removeChild(R),$?P("primary","Configuration ID copied to clipboard"):P("danger","Failed to copy configuration ID with exec command")}catch(R){console.error("Failed to copy configuration ID:",R),P("danger","Failed to copy configuration ID")}},F=async()=>{if(d?.id){a(!0);try{const U=await I.deleteWidgetConfiguration(d.id);if(U.ok)P("success","Configuration deleted successfully"),c(!1),u(null),await k(!0);else{const R=await U.json(),$=Oi(R,"Failed to delete configuration");console.error("Error deleting configuration:",$),P("danger",$)}}catch(U){console.error("Error deleting configuration:",U),P("danger","Failed to delete configuration")}finally{a(!1)}}},V=()=>{c(!1),u(null)},z=async()=>{if(!m.title){P("warning","Please fill in all fields");return}a(!0);try{const U={title:m.title,description:m.description,config:m.config},R=p?.id?await I.updateWidgetConfiguration(p.id,U):await I.createWidgetConfiguration(U),$=await R.json();if(R.ok){const H=$.data;P("success",`Configuration ${p?"updated":"created"} successfully`),await k(!1),!p?.id&&H?.id&&(h(H),f({...H,config:typeof H.config=="string"?JSON.parse(H.config):H.config}))}else{const H=Oi($,"Failed to save configuration");console.error("Error saving configuration:",H),P("danger",H)}}catch(U){console.error("Error saving configuration:",U),P("danger","Failed to save configuration")}finally{a(!1)}};return t?A.jsx(T,{my:30}):A.jsxs(A.Fragment,{children:[A.jsx(oe,{mb:2,children:A.jsx(st,{startDecorator:A.jsx(ro,{}),onClick:O,children:"Add"})}),r.length===0?A.jsx(mt,{variant:"outlined",sx:{textAlign:"center",py:8,borderStyle:"dashed",borderWidth:2,borderColor:"neutral.outlinedBorder"},children:A.jsxs(ai,{sx:{alignItems:"center"},children:[A.jsx(de,{level:"h4",fontWeight:"bold",startDecorator:A.jsx(YZ,{sx:{fontSize:24,color:"neutral.400"}}),textAlign:"center",children:"No configurations found"}),A.jsx(de,{level:"body-md",color:"neutral",children:"Create your first widget configuration to get started"})]})}):A.jsx(Un,{variant:"outlined",sx:{borderRadius:"sm",overflow:"auto"},children:A.jsxs(qo,{"aria-label":"widget configurations table",stickyHeader:!0,sx:{"--unstable_TableCell-height":"22px"},children:[A.jsx("thead",{children:A.jsxs("tr",{children:[A.jsx("th",{style:{width:"200px"},children:"Title"}),A.jsx("th",{children:"Description"}),A.jsx("th",{style:{width:"100px",textAlign:"right"},children:"Actions"})]})}),A.jsx("tbody",{children:r.map(U=>A.jsxs("tr",{children:[A.jsx("td",{children:A.jsx(de,{level:"title-sm",children:U.title})}),A.jsx("td",{children:A.jsx(de,{level:"body-sm",children:U.description})}),A.jsx("td",{style:{textAlign:"center"},children:A.jsxs(gt,{direction:"row",spacing:1,justifyContent:"flex-end",children:[A.jsx(rt,{title:"Copy Configuration ID",placement:"top",children:A.jsx(kt,{size:"sm",variant:"soft",color:"neutral",onClick:()=>j(U.id),children:A.jsx(Xs,{})})}),A.jsx(kt,{size:"sm",variant:"soft",color:"primary",onClick:()=>M(U),children:A.jsx(jb,{})}),A.jsx(kt,{size:"sm",variant:"soft",color:"danger",onClick:()=>L(U),children:A.jsx(Yo,{})})]})})]},U.id))})]})}),A.jsx(ca,{open:o,onClose:()=>s(!1),children:A.jsxs(ua,{sx:{width:"90vw",maxWidth:"900px",maxHeight:"90vh",overflow:"auto"},children:[A.jsx(Wp,{}),A.jsx(la,{children:p?`${m.title}`:"New Configuration"}),A.jsx(sa,{sx:{mt:1},children:A.jsx(F1e,{id:m.id,title:m.title,description:m.description,config:m.config,clientApiKeys:g?.google_endpoints_keys||[],onTitleChange:U=>f({...m,title:U}),onDescriptionChange:U=>f({...m,description:U}),onConfigChange:U=>f({...m,config:U}),onClose:()=>s(!1),onSave:z,isSubmitting:i,isEditing:!!p})})]})}),A.jsx(ca,{open:l,onClose:V,children:A.jsxs(ua,{variant:"outlined",role:"alertdialog",sx:{maxWidth:500},children:[A.jsx(la,{children:A.jsxs(de,{level:"h4",startDecorator:A.jsx(EA,{color:"error"}),children:["Delete ",d?.title]})}),A.jsx(xr,{}),A.jsx(sa,{children:A.jsxs(de,{level:"body-md",children:["Are you sure you want to delete"," ",A.jsx(de,{fontWeight:"bold",fontStyle:"italic",children:d?.title})," ","configuration? This action cannot be undone."]})}),A.jsxs(oe,{sx:{display:"flex",gap:1,justifyContent:"flex-end",pt:2},children:[A.jsx(st,{variant:"plain",color:"neutral",onClick:V,children:"Cancel"}),A.jsx(st,{variant:"solid",color:"danger",onClick:F,loading:i,children:"Delete"})]})]})}),A.jsx(E,{showToast:y,color:w,message:S,hideToast:()=>v(!1)})]})},B1e=({name:r,branding:e,onNameChange:t,onBrandingChange:n,onClose:i,onSave:a,isSubmitting:o,isEditing:s})=>{const[l,c]=B.useState(!1),[d,u]=B.useState(0),{InformationInput:p,BrandingImage:h}=Xn.useComponentContext(),m=Gl(ko),f=["mobile_logo","background_image","mobile_background_image","additional_image"],g=new Map().set("main_logo",m.mainLogo).set("mobile_logo",m.mobileLogo).set("background_image",m.backgroundImage).set("mobile_background_image",m.mobileBackgroundImage).set("additional_image",m.additionalImage),b=new Map().set("primary_color",m.primaryColor).set("secondary_color",m.secondaryColor).set("content_color",m.contentColor).set("background_color",m.backgroundColor).set("border_color",m.borderColor).set("additional_color",m.additionalColor),y=new Map().set("primary_url",m.primaryUrl).set("secondary_url",m.secondaryUrl).set("privacy_policy_url",m.privacyPolicyUrl).set("terms_and_conditions_url",m.termsAndConditionsUrl).set("additional_url",m.additionalUrl),v=(_,T)=>{const E=_.target.value,I={...e};I.colors[T]=E,n(I)},w=(_,T)=>{const E=_.target.value,I={...e};I.urls[T]=E,n(I)},x=(_,T)=>{const E={...e};E.images[T]=_,n(E)},S=_=>{const T={...e};T.images[_]="",n(T)};return A.jsxs(gt,{spacing:3,children:[A.jsx(oe,{children:A.jsxs(Me,{required:!0,children:[A.jsx(Le,{children:"Name"}),A.jsx(it,{placeholder:"Enter branding name",value:r,onChange:_=>t(_.target.value)})]})}),A.jsxs(Jp,{value:d,onChange:(_,T)=>u(T),sx:{p:0,bgcolor:"transparent"},children:[A.jsxs(Yp,{sx:{borderRadius:0,fontSize:"0.875rem",[`& .${Kk.root}`]:{'&[aria-selected="true"]':{bgcolor:"transparent",py:1,borderColor:"transparent","&::before":{content:'""',display:"block",position:"absolute",height:2,bottom:-2,left:0,right:0},"&::after":{bgcolor:"primary.500"}}}},tabFlex:"auto",children:[A.jsxs(ln,{children:[A.jsx(Ui,{children:A.jsx(dh,{sx:{width:"20px"}})}),"Images"]}),A.jsxs(ln,{children:[A.jsx(Ui,{children:A.jsx(zZ,{sx:{width:"20px"}})}),"Colors"]}),A.jsxs(ln,{children:[A.jsx(Ui,{children:A.jsx(Nb,{sx:{width:"20px"}})}),"URLs"]})]}),A.jsxs(xn,{value:0,sx:{px:0},children:[A.jsx(h,{labels:{},title:"Main Logo",image:e.images.main_logo,onChangeImages:_=>x(_,"main_logo"),clearImage:()=>S("main_logo"),readOnly:!1}),A.jsx(eo,{underline:"hover",onClick:()=>c(!l),sx:{marginBottom:"10px"},children:l?"Hide More Images":"Show More Images"}),l&&A.jsx(A.Fragment,{children:f.map(_=>A.jsx(h,{labels:{},title:g.get(_)||_,image:e.images[_],onChangeImages:T=>x(T,_),clearImage:()=>S(_),readOnly:!1},`branding-image-${_}`))})]}),A.jsx(xn,{value:1,sx:{px:0},children:A.jsx(oe,{children:Object.keys(e.colors).map(_=>A.jsx(oe,{mb:2,children:A.jsx(p,{size:"sm",label:b.get(_)||_,placeholder:"#000000",defaultValue:e.colors[_],required:!1,readOnly:!1,onChange:T=>v(T,_),endDecorator:A.jsx(oe,{component:"input",type:"color",value:e.colors[_]||"#000000",onChange:T=>{const E={target:{value:T.target.value}};v(E,_)},sx:{width:"36px",height:"28px",border:"none",borderRadius:"4px",cursor:"pointer",padding:0,backgroundColor:"transparent","&::-webkit-color-swatch-wrapper":{padding:"2px",borderRadius:"4px"},"&::-webkit-color-swatch":{border:"1px solid",borderColor:"neutral.outlinedBorder",borderRadius:"3px"},"&::-moz-color-swatch":{border:"1px solid",borderColor:"neutral.outlinedBorder",borderRadius:"3px"}}})})},`branding-color-${_}`))})}),A.jsx(xn,{value:2,sx:{px:0},children:A.jsx(oe,{children:Object.keys(e.urls).map(_=>A.jsx(oe,{mb:2,children:A.jsx(p,{size:"sm",label:y.get(_)||_,placeholder:"",defaultValue:e.urls[_],required:!1,readOnly:!1,onChange:T=>w(T,_)})},`branding-url-${_}`))})})]}),A.jsxs(oe,{sx:{display:"flex",gap:1,justifyContent:"flex-end",pt:2},children:[A.jsx(st,{variant:"outlined",color:"neutral",onClick:i,children:"Close"}),A.jsx(st,{onClick:a,loading:o,disabled:!r,children:s?"Update":"Create"})]})]})},S2={name:"",colors:{primary_color:"",secondary_color:"",content_color:"",background_color:"",border_color:"",additional_color:""},urls:{primary_url:"",secondary_url:"",privacy_policy_url:"",terms_and_conditions_url:"",additional_url:""},images:{main_logo:"",mobile_logo:"",background_image:"",mobile_background_image:"",additional_image:""}},z1e=()=>{const[r,e]=B.useState([]),[t,n]=B.useState(!1),[i,a]=B.useState(!1),[o,s]=B.useState(!1),[l,c]=B.useState(!1),[d,u]=B.useState(null),[p,h]=B.useState(null),[m,f]=B.useState({...S2}),[g,b]=B.useState(!1),[y,v]=B.useState("danger"),[w,x]=B.useState(""),{Spinner:S,Toast:_}=Xn.useComponentContext(),{https:T}=Xn.useAPIContext(),E=Gl(ko),I=(V,z)=>{v(V),x(z),b(!0)},P=async(V=!0)=>{V&&n(!0);try{const z=await T.getBrandingTemplates([],!0),U=await z.json();if(z.ok)e(U.data||[]);else{const R=Oi(U,E.fetchBrandingsErrorMessage);console.error("Error fetching brandings:",R),I("danger",R)}}catch(z){console.error("Error fetching brandings:",z),I("danger",E.fetchBrandingsErrorMessage)}finally{V&&n(!1)}};B.useEffect(()=>{P()},[]);const k=()=>{h(null),f({name:"",...S2}),s(!0)},O=V=>{h(V),f({...V}),s(!0)},M=V=>{u(V),c(!0)},L=async()=>{if(d?.id){a(!0);try{const V=await T.deleteBrandingTemplate(d.id);if(V.ok)I("success",E.brandingDeletedMessage),c(!1),u(null),await P(!0);else{const z=await V.json(),U=Oi(z,E.deleteBrandingErrorMessage);console.error("Error deleting branding:",U),I("danger",U)}}catch(V){console.error("Error deleting branding:",V),I("danger",E.deleteBrandingErrorMessage)}finally{a(!1)}}},j=()=>{c(!1),u(null)},F=async()=>{if(!m.name){I("warning",`Please enter a ${E.name.toLowerCase()}`);return}a(!0);try{const V={name:m.name,colors:m.colors,urls:m.urls,images:m.images},z=p?.id?await T.updateBrandingTemplate(p.id,V):await T.createBrandingTemplate(V),U=await z.json();if(z.ok){const R=U.data;I("success",p?E.brandingUpdatedMessage:E.brandingCreatedMessage),await P(!1),!p?.id&&R?.id&&(h(R),f(R))}else{const R=Oi(U,p?E.updateBrandingErrorMessage:E.createBrandingErrorMessage);console.error("Error saving branding:",R),I("danger",R)}}catch(V){console.error("Error saving branding:",V),I("danger",p?E.updateBrandingErrorMessage:E.createBrandingErrorMessage)}finally{a(!1)}};return t?A.jsx(S,{my:30}):A.jsxs(A.Fragment,{children:[A.jsx(oe,{mb:2,children:A.jsx(st,{startDecorator:A.jsx(ro,{}),onClick:k,children:E.add})}),r.length===0?A.jsx(mt,{variant:"outlined",sx:{textAlign:"center",py:8,borderStyle:"dashed",borderWidth:2,borderColor:"neutral.outlinedBorder"},children:A.jsxs(ai,{sx:{alignItems:"center"},children:[A.jsx(de,{level:"h4",fontWeight:"bold",startDecorator:A.jsx(kA,{sx:{fontSize:24,color:"neutral.400"}}),textAlign:"center",children:E.noBrandingsFound}),A.jsx(de,{level:"body-md",color:"neutral",children:E.createFirstBrandingTemplate})]})}):A.jsx(Ct,{container:!0,spacing:3,sx:{alignItems:"stretch"},children:r.map(V=>A.jsx(Ct,{xs:12,sm:6,md:4,lg:3,sx:{display:"flex"},children:A.jsx(mt,{variant:"outlined",sx:{width:"100%",display:"flex",flexDirection:"column",transition:"all 0.2s ease-in-out",cursor:"pointer","&:hover":{boxShadow:"md",transform:"translateY(-4px)",borderColor:"primary.outlinedBorder"}},onClick:()=>O(V),children:A.jsxs(ai,{sx:{pb:2,display:"flex",flexDirection:"column",flex:1},children:[A.jsxs(gt,{direction:"row",justifyContent:"space-between",alignItems:"center",mb:2,children:[A.jsx(de,{level:"title-lg",fontWeight:"bold",sx:{flex:1,pr:1},noWrap:!0,children:V.name}),A.jsx(kt,{sx:{minWidth:"24px",minHeight:"24px"},size:"sm",variant:"soft",color:"danger",onClick:z=>{z.stopPropagation(),M(V)},children:A.jsx(Yo,{sx:{width:"20px",height:"20px"}})})]}),A.jsx(cb,{ratio:"16/9",sx:{bgcolor:"background.level1",mb:2},children:V.images?.main_logo?A.jsx("img",{src:V.images.main_logo,alt:V.name,style:{objectFit:"contain",padding:"16px"}}):A.jsx(oe,{sx:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",gap:1},children:A.jsx(dh,{sx:{fontSize:48,color:"neutral.400"}})})}),A.jsxs(oe,{mb:2,children:[A.jsx(de,{level:"body-xs",color:"neutral",mb:.5,children:E.colors}),A.jsxs(gt,{direction:"row",spacing:.5,children:[Object.values(V.colors||{}).filter(z=>z).slice(0,6).map((z,U)=>A.jsx(oe,{sx:{width:24,height:24,borderRadius:"sm",bgcolor:z||"neutral.200",border:"1px solid",borderColor:"neutral.outlinedBorder",flexShrink:0}},U)),Object.values(V.colors||{}).filter(z=>z).length===0&&A.jsx(de,{level:"body-xs",color:"neutral",children:E.noColorsDefined})]})]}),A.jsxs(gt,{direction:"row",spacing:1,flexWrap:"wrap",useFlexGap:!0,children:[(()=>{const z=V.images?Object.values(V.images).filter(U=>U).length:0;return z>0?A.jsxs(Ut,{size:"sm",variant:"soft",color:"primary",startDecorator:A.jsx(dh,{}),children:[z," ",z===1?E.image:E.images]}):A.jsx(Ut,{size:"sm",variant:"soft",color:"neutral",startDecorator:A.jsx(dh,{}),children:E.noImages})})(),(()=>{const z=V.urls?Object.values(V.urls).filter(U=>U).length:0;return z>0?A.jsxs(Ut,{size:"sm",variant:"soft",color:"primary",startDecorator:A.jsx(Nb,{}),children:[z," ",z===1?E.url:E.urls]}):A.jsx(Ut,{size:"sm",variant:"soft",color:"neutral",startDecorator:A.jsx(Nb,{}),children:E.noUrls})})()]})]})})},V.id))}),A.jsx(ca,{open:o,onClose:()=>s(!1),children:A.jsxs(ua,{sx:{width:"90vw",maxWidth:"900px",maxHeight:"90vh",overflow:"auto"},children:[A.jsx(Wp,{}),A.jsx(la,{children:p?`${m.name}`:E.newBranding}),A.jsx(sa,{sx:{mt:1},children:A.jsx(B1e,{name:m.name,branding:m,onNameChange:V=>f({...m,name:V}),onBrandingChange:V=>f({...m,...V}),onClose:()=>s(!1),onSave:F,isSubmitting:i,isEditing:!!p})})]})}),A.jsx(ca,{open:l,onClose:j,children:A.jsxs(ua,{variant:"outlined",role:"alertdialog",sx:{maxWidth:500},children:[A.jsx(la,{children:A.jsxs(de,{level:"h4",startDecorator:A.jsx(EA,{color:"error"}),children:[E.deleteBranding," ",d?.name]})}),A.jsx(xr,{}),A.jsx(sa,{children:A.jsxs(de,{level:"body-md",children:["Are you sure you want to delete"," ",A.jsx(de,{fontWeight:"bold",fontStyle:"italic",children:d?.name})," ",E.deleteBrandingConfirmation]})}),A.jsxs(oe,{sx:{display:"flex",gap:1,justifyContent:"flex-end",pt:2},children:[A.jsx(st,{variant:"plain",color:"neutral",onClick:j,children:E.close}),A.jsx(st,{variant:"solid",color:"danger",onClick:L,loading:i,children:E.delete})]})]})}),A.jsx(_,{showToast:g,color:y,message:w,hideToast:()=>b(!1)})]})},U1e=()=>{const r=Gl(ko);return A.jsxs(A.Fragment,{children:[A.jsxs(oe,{m:1,children:[A.jsx(de,{level:"h3",children:r.configTitle}),A.jsx(xt,{children:r.configDescription})]}),A.jsx(mt,{variant:"plain",children:A.jsxs(Jp,{"aria-label":"Configurations",defaultValue:0,sx:{"@media (max-width: 899px)":{"& .MuiTabList-root":{flexDirection:"column"}}},children:[A.jsxs(Yp,{children:[A.jsx(ln,{disableIndicator:!0,children:r.language}),A.jsx(ln,{disableIndicator:!0,children:r.profilePreferences}),A.jsx(ln,{disableIndicator:!0,children:"User-Centric Widgets"}),A.jsx(ln,{disableIndicator:!0,children:"Branding"}),A.jsxs(ln,{disableIndicator:!0,disabled:!0,children:[r.cacheTTL,A.jsx(Ut,{size:"sm",variant:"solid",color:"primary",children:r.soon})]}),A.jsxs(ln,{disableIndicator:!0,disabled:!0,children:[r.footballAssets,A.jsx(Ut,{size:"sm",variant:"solid",color:"primary",children:r.soon})]})]}),A.jsx(xn,{value:0,children:A.jsx(x1e,{})}),A.jsx(xn,{value:1,children:A.jsx(w1e,{})}),A.jsx(xn,{value:2,children:A.jsx(N1e,{})}),A.jsx(xn,{value:3,children:A.jsx(z1e,{})})]})})]})},H1e=({fansUnitedEnvironment:r})=>{const{AuthContext:e,useComponentContext:t}=Xn,n=B.useContext(e),i=B.useContext(ko),{Login:a}=t();return n?A.jsx(b1e,{children:A.jsx(U1e,{})}):A.jsx(a,{environment:r,userNotFound:i.userNotFound})},V1e=r=>{const e={apiKey:r.fansUnitedApiKey,clientId:r.fansUnitedClientId,environment:r.fansUnitedEnvironment,language:r.fansUnitedLanguage,errorHandlingMode:"standard",sportal365Project:r.sportal365Project,sportal365Infrastructure:r.sportal365Infrastructure},{AuthProvider:t,APIProvider:n,ComponentProvider:i}=Xn;return A.jsx(t,{environment:r.fansUnitedEnvironment,children:A.jsx(y1e,{labels:r.labels,children:A.jsx(n,{config:e,children:A.jsx(i,{children:A.jsx(H1e,{fansUnitedEnvironment:r.fansUnitedEnvironment,hideSignOutButton:r.hideSignOutButton})})})})})};$a.ConfigurationManager=V1e,Object.defineProperty($a,Symbol.toStringTag,{value:"Module"})});
|
|
3663
|
+
where you want to show their names. When not synced, the names in the leaderboard will be shown as "UserXXXX" where XXXX is a random number.`,descriptionColor:"neutral",disabled:!1,onChange:a=>e(["leads","syncWithProfile"],a)}),A.jsxs(mt,{variant:"outlined",children:[A.jsx(de,{level:"title-md",children:"Campaign"}),A.jsx(xr,{}),A.jsx(xt,{children:"The campaign can be a custom name or ID that can be used later as criteria when exporting collected leads. This helps organize and filter leads based on different campaigns or promotions."}),A.jsxs(gt,{spacing:2,children:[A.jsxs(Me,{children:[A.jsx(Le,{children:"ID"}),A.jsx(it,{placeholder:"",value:t(["leads","campaignId"],""),onChange:a=>e(["leads","campaignId"],a.target.value)})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Name"}),A.jsx(it,{placeholder:"",value:t(["leads","campaignName"],""),onChange:a=>e(["leads","campaignName"],a.target.value)})]})]})]})]})},T1e=["50","100","200","300","400","500","600","700","800","900"],b2={50:"#EDF5FD",100:"#E3EFFB",200:"#C7DFF7",300:"#97C3F0",400:"#4393E4",500:"#0B6BCB",600:"#185EA5",700:"#12467B",800:"#0A2744",900:"#051423"},k1e=[{value:"light",label:"Light"},{value:"dark",label:"Dark"}],A1e=({config:r,onConfigChange:e,getConfigValue:t})=>{const n=(i,a)=>{e(["theme","primaryColor",i],a)};return A.jsxs(gt,{spacing:3,children:[A.jsx(Ns,{color:"warning",variant:"soft",startDecorator:A.jsx(qZ,{}),children:A.jsxs(oe,{children:[A.jsx(de,{level:"title-sm",sx:{mb:.5},children:"Legacy Theme Configuration"}),A.jsx(de,{level:"body-sm",children:"The theme configuration in this tab will be deprecated in the future. This theme configuration is only used in Either/Or, Match Prediction, and Team Next Match Prediction widgets at the moment. Later on these widgets will be migrated to the new theme system."})]})}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Mode"}),A.jsx(wt,{value:t(["theme","mode"],"light"),onChange:(i,a)=>e(["theme","mode"],a),children:k1e.map(i=>A.jsx(Xe,{value:i.value,children:i.label},i.value))}),A.jsx(xt,{children:"Select the theme mode (light or dark)"})]}),A.jsxs(oe,{children:[A.jsx(de,{level:"title-sm",children:"Primary Color Palette"}),A.jsx(xt,{sx:{mb:1},children:"Configure the primary color shades for the theme. Each shade represents a different intensity of the primary color."}),A.jsx(gt,{spacing:2,children:T1e.map(i=>{const a=t(["theme","primaryColor",i],""),o=a||b2[i];return A.jsxs(Me,{children:[A.jsx(Le,{children:i}),A.jsx(it,{value:a,onChange:s=>n(i,s.target.value),placeholder:b2[i],endDecorator:A.jsx(oe,{component:"input",type:"color",value:o,onChange:s=>n(i,s.target.value),sx:{width:"36px",height:"28px",border:"none",borderRadius:"4px",cursor:"pointer",padding:0,backgroundColor:"transparent","&::-webkit-color-swatch-wrapper":{padding:"2px",borderRadius:"4px"},"&::-webkit-color-swatch":{border:"1px solid",borderColor:"neutral.outlinedBorder",borderRadius:"3px"},"&::-moz-color-swatch":{border:"1px solid",borderColor:"neutral.outlinedBorder",borderRadius:"3px"}}})})]},i)})})]})]})},x2=[{code:"bg",name:"Bulgarian",flag:"🇧🇬"},{code:"en",name:"English",flag:"🇬🇧"},{code:"ro",name:"Romanian",flag:"🇷🇴"},{code:"pt",name:"Portuguese",flag:"🇵🇹"},{code:"pt-br",name:"Portuguese (Brazil)",flag:"🇧🇷"},{code:"sr",name:"Serbian",flag:"🇷🇸"},{code:"fr",name:"French",flag:"🇫🇷"},{code:"fr-be",name:"French (Belgium)",flag:"🇧🇪"},{code:"de",name:"German",flag:"🇩🇪"},{code:"it",name:"Italian",flag:"🇮🇹"},{code:"pl",name:"Polish",flag:"🇵🇱"},{code:"sk",name:"Slovak",flag:"🇸🇰"},{code:"el",name:"Greek",flag:"🇬🇷"}],P1e=[{value:"left",label:"Left"},{value:"right",label:"Right"}],E1e=[{value:"twoByTwo",label:"Two by Two (2x2 Grid)"},{value:"row",label:"Row"},{value:"column",label:"Column"}],O1e=[{value:"STANDARD",label:"Standard"},{value:"SPLIT",label:"Split"},{value:"OVERLAY",label:"Overlay"}],R1e=[{value:null,label:"None"},{value:"REGISTERED",label:"Registered users only"}],tC=[{value:"_self",label:"Same Window"},{value:"_blank",label:"New Tab"}],D1e=[{value:"modal",label:"Modal"},{value:"link",label:"Link"}],M1e=({onConfigChange:r,getConfigValue:e})=>{const[t,n]=B.useState({general:!1,display:!1,widgetSpecific:!1}),[i,a]=B.useState(!1),{BooleanSwitch:o,ImageCard:s}=Xn.useComponentContext(),l=B.useRef(null),c=Gl(ko),d=f=>{n(g=>({...g,[f]:!g[f]}))},u=f=>!f||typeof f!="object"?!0:Object.values(f).every(g=>g===""||g===null||g===void 0),p=f=>{if(r(f,void 0),f.length>1){const g=f.slice(0,-1),y={...e(g,{})};delete y[f[f.length-1]],u(y)&&r(g,void 0)}},h=(f,g,b)=>{r([f,g],b);const v={...e([f],{}),[g]:b};u(v)&&r([f],void 0)},m=({widgets:f})=>A.jsxs(oe,{sx:{display:"flex",gap:.5,flexWrap:"wrap",mt:1},children:[A.jsx(de,{level:"body-xs",sx:{color:"text.tertiary",mr:.5},children:"Affected Widgets:"}),f.map(g=>A.jsx(Ut,{size:"sm",variant:"soft",color:"primary",children:g},g))]});return A.jsxs(gt,{spacing:2,children:[A.jsx(Ns,{color:"primary",variant:"soft",startDecorator:A.jsx(Fb,{}),children:A.jsxs(oe,{children:["All settings below are optional and serve as default values for your widgets. Each widget can be individually configured with different settings by passing data attributes directly to the widget embed code. This allows you to override these defaults on a per-widget basis.",A.jsxs(oe,{sx:{display:"flex",alignItems:"center",gap:.5,mt:1},children:[A.jsx(VZ,{sx:{fontSize:"1rem"}}),A.jsx(eo,{href:"https://docs.fansunitedmedia.com/docs/user-centric-widgets#/",target:"_blank",rel:"noopener noreferrer",children:"Learn more in the documentation"})]})]})}),A.jsxs(mt,{variant:"outlined",sx:{p:0,transition:"all 0.2s ease-in-out",overflow:"hidden"},children:[A.jsxs(oe,{sx:{p:1.5,bgcolor:"neutral.softBg",display:"flex",alignItems:"center",justifyContent:"center",gap:1,cursor:"pointer",borderTopLeftRadius:"sm",borderTopRightRadius:"sm",position:"relative"},onClick:()=>d("general"),children:[A.jsx(de,{level:"title-md",textAlign:"center",sx:{flex:1},children:"General Settings"}),A.jsx(oe,{sx:{position:"absolute",right:16},children:t.general?A.jsx(hh,{}):A.jsx(ph,{})})]}),t.general&&A.jsxs(gt,{spacing:2,sx:{p:2},children:[A.jsxs(Me,{children:[A.jsx(Le,{children:"Language"}),A.jsx(wt,{value:e(["language"],"en"),onChange:(f,g)=>r(["language"],g),children:(()=>{const f=e(["language"],"en"),g=x2.some(b=>b.code===f);return A.jsxs(A.Fragment,{children:[f&&!g&&A.jsxs(Xe,{value:f,children:[f," (Custom value)"]}),x2.map(b=>A.jsx(Xe,{value:b.code,children:A.jsxs(oe,{sx:{display:"flex",alignItems:"center",gap:1},children:[A.jsx("span",{children:b.flag}),A.jsx("span",{children:b.name})]})},b.code))]})})()}),A.jsx(xt,{children:"Controls the widget labels language."})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Layout Template"}),A.jsx(wt,{value:e(["layoutTemplate"],null),onChange:(f,g)=>r(["layoutTemplate"],g),...e(["layoutTemplate"],null)&&{endDecorator:A.jsx(kt,{variant:"plain",color:"neutral",onMouseDown:f=>{f.stopPropagation()},onClick:()=>{p(["layoutTemplate"]),l.current?.focusVisible()},sx:{width:"18px",height:"18px"},children:A.jsx(fa,{})}),indicator:null},children:O1e.map(f=>A.jsx(Xe,{value:f.value,children:f.label},f.value))}),A.jsx(xt,{children:"Choose the overall layout template for widgets. Standard: image takes 30% width with configurable position. Split: image takes 50% width on the left. Overlay: image as background with content overlay."})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Image Position"}),A.jsx(wt,{value:e(["imagePosition"],null),onChange:(f,g)=>r(["imagePosition"],g),...e(["imagePosition"],null)&&{endDecorator:A.jsx(kt,{variant:"plain",color:"neutral",onMouseDown:f=>{f.stopPropagation()},onClick:()=>{p(["imagePosition"]),l.current?.focusVisible()},sx:{width:"18px",height:"18px"},children:A.jsx(fa,{})}),indicator:null},children:P1e.map(f=>A.jsx(Xe,{value:f.value,children:f.label},f.value))}),A.jsx(xt,{children:"Position of the image relative to the main content. Applicable only for Standard layout."})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Options Layout"}),A.jsx(wt,{value:e(["optionsLayout"],null),onChange:(f,g)=>r(["optionsLayout"],g),...e(["optionsLayout"],null)&&{endDecorator:A.jsx(kt,{variant:"plain",color:"neutral",onMouseDown:f=>{f.stopPropagation()},onClick:()=>{p(["optionsLayout"]),l.current?.focusVisible()},sx:{width:"18px",height:"18px"},children:A.jsx(fa,{})}),indicator:null},children:E1e.map(f=>A.jsx(Xe,{value:f.value,children:f.label},f.value))}),A.jsx(xt,{children:"Define how answer options are displayed."})]}),A.jsxs(oe,{children:[A.jsxs(oe,{sx:{display:"flex",alignItems:"center",gap:1,mb:2},children:[A.jsx(de,{level:"body-sm",sx:{fontWeight:i?400:600,color:i?"text.secondary":"primary.500",transition:"all 0.2s ease"},children:"Upload Image"}),A.jsx(Kp,{checked:i,onChange:f=>a(f.target.checked),color:"primary"}),A.jsx(de,{level:"body-sm",sx:{fontWeight:i?600:400,color:i?"primary.500":"text.secondary",transition:"all 0.2s ease"},children:"URL Input"})]}),A.jsxs(gt,{mb:2,gap:1,children:[A.jsx(de,{level:"body-sm",children:"Replace the default placeholder image with a custom one. Applicable only for Split and Overlay layouts."}),A.jsx(de,{level:"body-sm",children:"Recommendations: 4:5 ratio for Split and 16:9 ratio for Overlay."})]}),i?A.jsxs(Me,{children:[A.jsx(Le,{children:"Default Image Placeholder"}),A.jsx(it,{value:e(["defaultImagePlaceholderUrl"],""),onChange:f=>r(["defaultImagePlaceholderUrl"],f.target.value),placeholder:"https://example.com/placeholder.jpg"})]}):A.jsx(s,{labels:c,title:"Default Image Placeholder",image:e(["defaultImagePlaceholderUrl"],""),onChangeImages:f=>r(["defaultImagePlaceholderUrl"],f),clearImage:()=>p(["defaultImagePlaceholderUrl"])})]}),A.jsx(mt,{variant:"outlined",sx:{p:0},children:A.jsxs(gt,{spacing:2,children:[A.jsx(de,{level:"title-sm",fontWeight:"lg",px:2,pt:2,children:"Sign In CTA"}),A.jsxs(oe,{sx:{px:2},children:[A.jsx(de,{level:"body-xs",sx:{color:"text.secondary"},children:'Configures the sign in view for entities with auth requirement "Registered". When not configured, a disabled button with label "Sign In" will be displayed.'}),A.jsxs(de,{level:"body-xs",sx:{color:"text.secondary",mt:.5},children:["Order of priority: function name ",">"," URL."]}),A.jsx(m,{widgets:["Classic Quiz","Poll","Personality Quiz","Match Quiz"]})]}),A.jsx(xr,{}),A.jsxs(gt,{spacing:2,sx:{px:2,pb:2},children:[A.jsxs(Me,{children:[A.jsx(Le,{children:"Label"}),A.jsx(it,{value:e(["signInCTA","defaultLabel"],""),onChange:f=>h("signInCTA","defaultLabel",f.target.value),placeholder:"Sign in to participate"}),A.jsx(xt,{children:"Text displayed on the sign in button"})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Function Name"}),A.jsx(it,{value:e(["signInCTA","onClick"],""),onChange:f=>h("signInCTA","onClick",f.target.value),placeholder:"handleSignIn()"}),A.jsx(xt,{children:"JavaScript function name to be triggered when the button is clicked"})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"URL"}),A.jsx(it,{value:e(["signInCTA","url"],""),onChange:f=>h("signInCTA","url",f.target.value),placeholder:"https://yourdomain.com/signin"}),A.jsx(xt,{children:"URL to navigate to when the button is clicked (alternative to function name)"})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Target"}),A.jsx(wt,{value:e(["signInCTA","target"],""),onChange:(f,g)=>h("signInCTA","target",g),...e(["signInCTA","target"])&&{endDecorator:A.jsx(kt,{variant:"plain",color:"neutral",onMouseDown:f=>{f.stopPropagation()},onClick:()=>{p(["signInCTA","target"]),l.current?.focusVisible()},sx:{width:"18px",height:"18px"},children:A.jsx(fa,{})}),indicator:null},children:tC.map(f=>A.jsx(Xe,{value:f.value,children:f.label},f.value))}),A.jsx(xt,{children:"Where to open the URL (current tab or new tab)"})]})]})]})}),A.jsx(mt,{variant:"outlined",sx:{p:0},children:A.jsxs(gt,{spacing:2,children:[A.jsx(de,{level:"title-sm",fontWeight:"lg",px:2,pt:2,children:"Additional CTA"}),A.jsxs(oe,{sx:{px:2},children:[A.jsx(de,{level:"body-xs",sx:{color:"text.secondary"},children:"Shown after user participation. The button will not be displayed if no settings are configured."}),A.jsxs(de,{level:"body-xs",sx:{color:"text.secondary",mt:.5},children:["Order of priority: function name ",">"," URL."]})]}),A.jsx(xr,{}),A.jsxs(gt,{spacing:2,sx:{px:2,pb:2},children:[A.jsxs(Me,{children:[A.jsx(Le,{children:"Label"}),A.jsx(it,{value:e(["additionalCTA","defaultLabel"],""),onChange:f=>h("additionalCTA","defaultLabel",f.target.value),placeholder:"Learn More"}),A.jsx(xt,{children:"Text displayed on the button after user participation"})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Function Name"}),A.jsx(it,{value:e(["additionalCTA","onClick"],""),onChange:f=>h("additionalCTA","onClick",f.target.value),placeholder:"handleAdditionalAction()"}),A.jsx(xt,{children:"JavaScript function name to be triggered when the button is clicked"})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"URL"}),A.jsx(it,{value:e(["additionalCTA","url"],""),onChange:f=>h("additionalCTA","url",f.target.value),placeholder:"https://yourdomain.com/info"}),A.jsx(xt,{children:"URL to navigate to when the button is clicked (alternative to function name)"})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Target"}),A.jsx(wt,{value:e(["additionalCTA","target"],""),onChange:(f,g)=>h("additionalCTA","target",g),...e(["additionalCTA","target"])&&{endDecorator:A.jsx(kt,{variant:"plain",color:"neutral",onMouseDown:f=>{f.stopPropagation()},onClick:()=>{p(["additionalCTA","target"]),l.current?.focusVisible()},sx:{width:"18px",height:"18px"},children:A.jsx(fa,{})}),indicator:null},children:tC.map(f=>A.jsx(Xe,{value:f.value,children:f.label},f.value))}),A.jsx(xt,{children:"Where to open the URL (current tab or new tab)"})]})]})]})}),A.jsx(mt,{variant:"outlined",sx:{p:0},children:A.jsxs(gt,{spacing:2,children:[A.jsx(de,{level:"title-sm",fontWeight:"lg",px:2,pt:2,children:"Rules Display"}),A.jsxs(oe,{sx:{px:2},children:[A.jsx(de,{level:"body-xs",sx:{color:"text.secondary"},children:"An info icon shown after headline text for example QUIZ, POLL, MATCH QUIZ and etc. The icon is shown only when rules are configured."}),A.jsx(m,{widgets:["Classic Quiz","Poll","Personality Quiz","Match Quiz","Event Game"]})]}),A.jsx(xr,{}),A.jsxs(gt,{spacing:2,sx:{px:2,pb:2},children:[A.jsxs(Me,{children:[A.jsx(Le,{children:"Display Type"}),A.jsx(wt,{value:e(["rulesDisplay","type"],""),onChange:(f,g)=>h("rulesDisplay","type",g),...e(["rulesDisplay","type"])&&{endDecorator:A.jsx(kt,{variant:"plain",color:"neutral",onMouseDown:f=>{f.stopPropagation()},onClick:()=>{p(["rulesDisplay","type"]),l.current?.focusVisible()},sx:{width:"18px",height:"18px"},children:A.jsx(fa,{})}),indicator:null},children:D1e.map(f=>A.jsx(Xe,{value:f.value,children:f.label},f.value))}),A.jsx(xt,{children:"You can choose between displaying rules in a modal dialog (default) or as a link to an external page"})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"URL"}),A.jsx(it,{value:e(["rulesDisplay","url"],""),onChange:f=>h("rulesDisplay","url",f.target.value),placeholder:"https://yourdomain.com/rules"}),A.jsx(xt,{children:"URL to navigate to when the info icon is clicked"})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Target"}),A.jsx(wt,{value:e(["rulesDisplay","target"],""),onChange:(f,g)=>h("rulesDisplay","target",g),...e(["rulesDisplay","target"])&&{endDecorator:A.jsx(kt,{variant:"plain",color:"neutral",onMouseDown:f=>{f.stopPropagation()},onClick:()=>{p(["rulesDisplay","target"]),l.current?.focusVisible()},sx:{width:"18px",height:"18px"},children:A.jsx(fa,{})}),indicator:null},children:tC.map(f=>A.jsx(Xe,{value:f.value,children:f.label},f.value))}),A.jsx(xt,{children:"Where to open the URL (current tab or new tab)"})]})]})]})})]})]}),A.jsxs(mt,{variant:"outlined",sx:{p:0,transition:"all 0.2s ease-in-out",overflow:"hidden"},children:[A.jsxs(oe,{sx:{p:1.5,bgcolor:"neutral.softBg",display:"flex",alignItems:"center",justifyContent:"center",gap:1,cursor:"pointer",borderTopLeftRadius:"sm",borderTopRightRadius:"sm",position:"relative"},onClick:()=>d("display"),children:[A.jsx(de,{level:"title-md",textAlign:"center",sx:{flex:1},children:"Display Settings"}),A.jsx(oe,{sx:{position:"absolute",right:16},children:t.display?A.jsx(hh,{}):A.jsx(ph,{})})]}),t.display&&A.jsxs(gt,{spacing:1.5,sx:{p:2},children:[A.jsxs(oe,{children:[A.jsx(o,{label:"Show Team Labels",defaultValue:e(["showTeamLabels"],!1),description:"Display team names in the widget",descriptionColor:"neutral",disabled:!1,onChange:f=>r(["showTeamLabels"],f)}),A.jsx(m,{widgets:["Match Quiz"]})]}),A.jsx(xr,{sx:{my:.5}}),A.jsxs(oe,{children:[A.jsx(o,{label:"Show Points",defaultValue:e(["showPoints"],!1),description:"When enabled, the widget will show the points for each fixture question",descriptionColor:"neutral",disabled:!1,onChange:f=>r(["showPoints"],f)}),A.jsx(m,{widgets:["Match Quiz","Event Game"]})]}),A.jsx(xr,{sx:{my:.5}}),A.jsxs(oe,{children:[A.jsx(o,{label:"Show Prediction Details",defaultValue:e(["showPredictionDetails"],!1),description:"When enabled and the game predictions are resolved, the widget will show a tabular view where users can view their prediction outcomes",descriptionColor:"neutral",disabled:!1,onChange:f=>r(["showPredictionDetails"],f)}),A.jsx(m,{widgets:["Match Quiz","Event Game"]})]}),A.jsx(xr,{sx:{my:.5}}),A.jsxs(oe,{children:[A.jsx(o,{label:"Show Countdown",defaultValue:e(["showCountdown"],!1),description:"When enabled, the widget will show a countdown to the game cutoff time",descriptionColor:"neutral",disabled:!1,onChange:f=>r(["showCountdown"],f)}),A.jsx(m,{widgets:["Match Quiz","Event Game"]})]}),A.jsx(xr,{sx:{my:.5}}),A.jsxs(oe,{children:[A.jsx(o,{label:"Show Answer Explanations",defaultValue:e(["showAnswerExplanations"],!1),description:"When enabled and the user submits their answers, the widget will show a tabular view where users can view answer explanations",descriptionColor:"neutral",disabled:!1,onChange:f=>r(["showAnswerExplanations"],f)}),A.jsx(m,{widgets:["Classic Quiz","Personality Quiz"]})]})]})]}),A.jsxs(mt,{variant:"outlined",sx:{p:0,overflow:"hidden",transition:"all 0.2s ease-in-out"},children:[A.jsxs(oe,{sx:{p:1.5,bgcolor:"neutral.softBg",display:"flex",alignItems:"center",justifyContent:"center",gap:1,cursor:"pointer",borderTopLeftRadius:"sm",borderTopRightRadius:"sm",position:"relative"},onClick:()=>d("widgetSpecific"),children:[A.jsx(de,{level:"title-md",textAlign:"center",sx:{flex:1},children:"Widget-Specific Settings"}),A.jsx(oe,{sx:{position:"absolute",right:16},children:t.widgetSpecific?A.jsx(hh,{}):A.jsx(ph,{})})]}),t.widgetSpecific&&A.jsxs(gt,{spacing:2,sx:{p:2},children:[A.jsxs(oe,{children:[A.jsx(de,{level:"body-sm",fontWeight:"lg",sx:{mb:1,color:"text.primary"},children:"Player of the Match"}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Authentication Requirement"}),A.jsx(wt,{value:e(["playerOfTheMatch","authRequirement"],null),onChange:(f,g)=>{r(["playerOfTheMatch","authRequirement"],g)},...e(["playerOfTheMatch","authRequirement"],null)&&{endDecorator:A.jsx(kt,{variant:"plain",color:"neutral",onMouseDown:f=>{f.stopPropagation()},onClick:()=>{p(["playerOfTheMatch","authRequirement"]),l.current?.focusVisible()},sx:{width:"18px",height:"18px"},children:A.jsx(fa,{})}),indicator:null},children:R1e.map((f,g)=>A.jsx(Xe,{value:f.value,children:f.label},f.value||`none-${g}`))}),A.jsx(xt,{children:"Authentication level required to vote for player of the match"})]})]}),A.jsx(xr,{sx:{my:2}}),A.jsxs(oe,{children:[A.jsx(de,{level:"body-sm",fontWeight:"lg",sx:{mb:1,color:"text.primary"},children:"List Widget URLs"}),A.jsxs(de,{level:"body-xs",sx:{color:"text.secondary",mb:1.5},children:["Configure relative paths or full URL patterns for different content types. The ","{CONTENT_ID}"," placeholder is optional - if present, it gets replaced with the actual content ID. If not present, the URL is used as provided. When left empty, the widget will load the content in a modal view."]}),A.jsxs(gt,{spacing:1.5,children:[A.jsxs(Me,{children:[A.jsx(Le,{children:"Classic Quiz URL"}),A.jsx(it,{value:e(["urls","classicQuizUrl"],""),onChange:f=>r(["urls","classicQuizUrl"],f.target.value),placeholder:"/quiz/{CONTENT_ID}"})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Personality Quiz URL"}),A.jsx(it,{value:e(["urls","personalityQuizUrl"],""),onChange:f=>r(["urls","personalityQuizUrl"],f.target.value),placeholder:"/personality-quiz/{CONTENT_ID}"})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Either/Or URL"}),A.jsx(it,{value:e(["urls","eitherOrUrl"],""),onChange:f=>r(["urls","eitherOrUrl"],f.target.value),placeholder:"/either-or/{CONTENT_ID}"})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Match Quiz URL"}),A.jsx(it,{value:e(["urls","matchQuizUrl"],""),onChange:f=>r(["urls","matchQuizUrl"],f.target.value),placeholder:"/match-quiz/{CONTENT_ID}"})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Poll URL"}),A.jsx(it,{value:e(["urls","pollUrl"],""),onChange:f=>r(["urls","pollUrl"],f.target.value),placeholder:"/poll/{CONTENT_ID}"})]})]})]})]})]})]})},Or={mode:"light",spacingScale:{"3xs":"2px","2xs":"4px",xs:"8px",sm:"12px",md:"16px",lg:"24px",xl:"32px","2xl":"40px","3xl":"48px"},colorSchemes:{light:{palette:{success:{plainColor:"#4CAF50",outlinedBorder:"#4CAF50"},danger:{softBg:"#FEE4E2",plainColor:"#F44336",outlinedBorder:"#F44336"},primary:{plainColor:"#1A77D2",outlinedBorder:"#1A77D2",onPrimary:"#FAFAFA",primaryContainer:"#2397F3"},warning:{softBg:"#FEF0C7",plainColor:"#DC6803"},neutral:{softBg:"#F8F9FA",solidBg:"#6C757D",solidColor:"#FFF",plainActiveBg:"#DDE7EE",outlinedBorder:"#CDD7E1",outlinedColor:"#32383E",outlinedHoverBg:"#F0F4F8",plainHoverBg:"#F0F4F8",plainHoverColor:"#0B0D0E",plainColor:"#32383E",solidHoverBg:"#5C636A"},background:{surface:"#FFF",popup:"#FFF"}},textPrimary:"#212121",textSecondary:"#212121",textColor:"#212121",textDisabled:"#212121",surface:"#FFFFFF",onSurface:"#F5F5F5",surfaceVariant:"#EEEEEE",surfaceTintDim:"#212121",surfaceInverse:"#F5F5F5",outlineEnabledBorder:"#E0E0E0",secondaryContainer:"#BDBDBD"},dark:{palette:{primary:{plainColor:"#1A77D2",outlinedBorder:"#1A77D2",onPrimary:"#FAFAFA",primaryContainer:"#2397F3"},success:{plainColor:"#4CAF50",outlinedBorder:"#4CAF50"},danger:{softBg:"#430A0A",plainColor:"#F44336",outlinedBorder:"#F44336"},warning:{softBg:"#FEF0C7",plainColor:"#DC6803"},neutral:{softBg:"#32383E",solidBg:"#CDD7E1",solidColor:"#0B0D0E",plainActiveBg:"#636B74",outlinedBorder:"#32383E",outlinedColor:"#CDD7E1",outlinedHoverBg:"#32383E",plainHoverBg:"#32383E",plainHoverColor:"#CDD7E1",plainColor:"#CDD7E1",solidHoverBg:"#DDE7EE"},background:{surface:"#0B0D0E",popup:"#171A1C"}},textPrimary:"#FAFAFA",textSecondary:"#FAFAFA",textColor:"#FAFAFA",textDisabled:"#FAFAFA",surface:"#424242",onSurface:"#212121",surfaceVariant:"#616161",surfaceTintDim:"#FAFAFA",surfaceInverse:"#FAFAFA",outlineEnabledBorder:"#757575",secondaryContainer:"#757575"}},customFontFamily:{light:{primary:"Ubuntu, sans-serif",secondary:"Roboto, sans-serif"},dark:{primary:"Ubuntu, sans-serif",secondary:"Roboto, sans-serif"}},customRadius:{light:{none:"0px","2xs":"2px",xs:"4px",sm:"8px",md:"12px",lg:"16px",xl:"24px","2xl":"232px",full:"1000px"},dark:{none:"0px","2xs":"2px",xs:"4px",sm:"8px",md:"12px",lg:"16px",xl:"24px","2xl":"232px",full:"1000px"}},border:{light:{size:"1px"},dark:{size:"2px"}},imageBackgroundGradient:{light:{standard:"linear-gradient(270deg, rgba(255, 255, 255, 0) 0%, rgba(18, 18, 18, 0.8) 100%)",split:"linear-gradient(270deg, rgba(255, 255, 255, 0) 0%, rgba(18, 18, 18, 0.8) 100%)"},dark:{standard:"linear-gradient(270deg, rgba(255, 255, 255, 0) 0%, rgba(18, 18, 18, 0.8) 100%)",split:"linear-gradient(270deg, rgba(255, 255, 255, 0) 0%, rgba(18, 18, 18, 0.8) 100%)",overlay:"linear-gradient(270deg, rgba(255, 255, 255, 0) 0%, rgba(18, 18, 18, 0.8) 100%)"}},customBreakpoints:{values:{xs:0,sm:444,md:600,lg:900,xl:1200,xxl:1536}}},L1e=["3xs","2xs","xs","sm","md","lg","xl","2xl","3xl"],w2=["none","2xs","xs","sm","md","lg","xl","2xl","full"],j1e=["xs","sm","md","lg","xl","xxl"],$1e=({onConfigChange:r,getConfigValue:e})=>{const[t,n]=B.useState({spacing:!1,colorSchemes:!1,fontFamily:!1,radius:!1,border:!1,gradient:!1,breakpoints:!1}),i=p=>{n(h=>({...h,[p]:!h[p]}))},a=p=>parseInt(p.replace("px",""))||0,o=p=>`${p}px`,s=p=>p.replace(/([A-Z])/g," $1").trim().replace(/^./,h=>h.toUpperCase()),l=(p,h)=>A.jsxs(oe,{sx:{p:1.5,bgcolor:"neutral.softBg",display:"flex",alignItems:"center",justifyContent:"center",gap:1,cursor:"pointer",borderTopLeftRadius:"sm",borderTopRightRadius:"sm",position:"relative"},onClick:()=>i(h),children:[A.jsx(de,{level:"title-md",textAlign:"center",sx:{flex:1},children:p}),A.jsx(oe,{sx:{position:"absolute",right:16},children:t[h]?A.jsx(hh,{}):A.jsx(ph,{})})]}),c=(p,h,m)=>{const f=e(h,""),g=f||m;return A.jsxs(Me,{size:"sm",children:[A.jsx(Le,{sx:{fontSize:"0.75rem"},children:p}),A.jsx(it,{size:"sm",value:f,onChange:b=>r(h,b.target.value),placeholder:m,endDecorator:A.jsx(oe,{component:"input",type:"color",value:g,onChange:b=>r(h,b.target.value),sx:{width:"32px",height:"24px",border:"none",borderRadius:"4px",cursor:"pointer",padding:0,backgroundColor:"transparent","&::-webkit-color-swatch-wrapper":{padding:"2px",borderRadius:"4px"},"&::-webkit-color-swatch":{border:"1px solid",borderColor:"neutral.outlinedBorder",borderRadius:"3px"},"&::-moz-color-swatch":{border:"1px solid",borderColor:"neutral.outlinedBorder",borderRadius:"3px"}}})})]})},d=p=>{const h=["primary","success","danger","warning","neutral","background"],m=Or.colorSchemes[p].palette;return A.jsxs(oe,{children:[A.jsx(de,{level:"body-sm",fontWeight:"lg",sx:{mb:1},children:"Palette"}),A.jsx(gt,{spacing:1.5,children:h.map(f=>{const g=m[f];return g?A.jsxs(mt,{variant:"outlined",size:"sm",sx:{p:1.5},children:[A.jsx(de,{level:"body-xs",fontWeight:"lg",sx:{mb:1,textTransform:"capitalize"},children:f}),A.jsx(Ct,{container:!0,spacing:1,children:Object.entries(g).map(([b,y])=>A.jsx(Ct,{xs:6,children:c(s(b),["themeOptions","colorSchemes",p,"palette",f,b],y)},b))})]},f):null})})]})},u=p=>{const h=Or.colorSchemes[p],m=["textPrimary","textSecondary","textColor","textDisabled","surface","onSurface","surfaceVariant","surfaceTintDim","surfaceInverse","outlineEnabledBorder","secondaryContainer"];return A.jsxs(oe,{children:[A.jsx(de,{level:"body-sm",fontWeight:"lg",sx:{mb:1},children:"Color Tokens"}),A.jsx(Ct,{container:!0,spacing:1,children:m.map(f=>{const g=h[f];return g?A.jsx(Ct,{xs:6,children:c(s(f),["themeOptions","colorSchemes",p,f],g)},f):null})})]})};return A.jsxs(gt,{spacing:2,children:[A.jsx(Ns,{color:"primary",variant:"soft",startDecorator:A.jsx(Fb,{}),children:A.jsxs(oe,{children:[A.jsx(de,{level:"body-sm",children:"Configure theme options to customize the visual appearance of your widgets. All fields show default values as placeholders for reference. Only values you explicitly set will be saved to your configuration."}),A.jsxs(de,{level:"body-sm",sx:{mt:1},children:["Learn more about how these options affect your widgets in our"," ",A.jsx("a",{href:"https://help.fansunitedmedia.com/770336-Classic-Quiz-Widget-Advanced-Customization-with-Theme-Options",target:"_blank",rel:"noopener noreferrer",style:{color:"inherit",fontWeight:600},children:"documentation"}),"."]})]})}),A.jsxs(gt,{spacing:.5,children:[A.jsxs(oe,{sx:{display:"flex",alignItems:"center",gap:1},children:[A.jsx(de,{level:"body-sm",sx:{fontWeight:e(["themeOptions","mode"],Or.mode)==="light"?600:400,color:e(["themeOptions","mode"],Or.mode)==="light"?"primary.500":"text.secondary",transition:"all 0.2s ease"},children:"Light Mode"}),A.jsx(Kp,{checked:e(["themeOptions","mode"],Or.mode)==="dark",onChange:p=>r(["themeOptions","mode"],p.target.checked?"dark":"light"),color:"primary"}),A.jsx(de,{level:"body-sm",sx:{fontWeight:e(["themeOptions","mode"],Or.mode)==="dark"?600:400,color:e(["themeOptions","mode"],Or.mode)==="dark"?"primary.500":"text.secondary",transition:"all 0.2s ease"},children:"Dark Mode"})]}),A.jsx(de,{level:"body-sm",children:"Select the default theme mode for your widgets."})]}),A.jsxs(mt,{variant:"outlined",sx:{p:0,transition:"all 0.2s ease-in-out",overflow:"hidden"},children:[l("Spacing","spacing"),t.spacing&&A.jsxs(gt,{spacing:2,sx:{p:2},children:[A.jsx(de,{level:"title-sm",pl:1,children:"Define spacing values for different size scales. These values control the spacing between elements, such as padding, margins, and gaps. Values are in pixels."}),A.jsx(Ct,{container:!0,spacing:2,children:L1e.map(p=>{const h=Or.spacingScale[p],m=e(["themeOptions","spacingScale",p],"");return A.jsx(Ct,{xs:6,sm:4,md:3,children:A.jsxs(Me,{children:[A.jsx(Le,{children:p}),A.jsx(it,{type:"number",value:m?a(m):"",onChange:f=>{const g=parseInt(f.target.value);isNaN(g)||r(["themeOptions","spacingScale",p],o(g))},placeholder:a(h).toString(),endDecorator:"px",slotProps:{input:{min:0}},sx:{"& input[type=number]::-webkit-outer-spin-button, & input[type=number]::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:0},"& input[type=number]":{MozAppearance:"textfield"}}})]})},p)})})]})]}),A.jsxs(mt,{variant:"outlined",sx:{p:0,transition:"all 0.2s ease-in-out",overflow:"hidden"},children:[l("Colors","colorSchemes"),t.colorSchemes&&A.jsxs(gt,{spacing:2,sx:{p:2},children:[A.jsx(de,{level:"title-sm",pl:1,children:"These colors control the appearance of buttons, backgrounds, text, borders, and other UI elements."}),A.jsxs(Ct,{container:!0,spacing:2,children:[A.jsx(Ct,{xs:12,md:6,children:A.jsxs(mt,{variant:"soft",sx:{p:2},children:[A.jsx(de,{level:"title-sm",sx:{mb:2},children:"Light Mode"}),A.jsxs(gt,{spacing:2,children:[d("light"),u("light")]})]})}),A.jsx(Ct,{xs:12,md:6,children:A.jsxs(mt,{variant:"soft",sx:{p:2},children:[A.jsx(de,{level:"title-sm",sx:{mb:2},children:"Dark Mode"}),A.jsxs(gt,{spacing:2,children:[d("dark"),u("dark")]})]})})]})]})]}),A.jsxs(mt,{variant:"outlined",sx:{p:0,transition:"all 0.2s ease-in-out",overflow:"hidden"},children:[l("Font Family","fontFamily"),t.fontFamily&&A.jsxs(gt,{spacing:2,sx:{p:2},children:[A.jsx(de,{level:"title-sm",pl:1,children:"Primary font is used for headings and important text, while secondary font is used for body text and descriptions."}),A.jsxs(Ct,{container:!0,spacing:2,children:[A.jsx(Ct,{xs:12,md:6,children:A.jsxs(mt,{variant:"soft",sx:{p:2},children:[A.jsx(de,{level:"title-sm",sx:{mb:2},children:"Light Mode"}),A.jsxs(gt,{spacing:2,children:[A.jsxs(Me,{children:[A.jsx(Le,{children:"Primary Font"}),A.jsx(it,{value:e(["themeOptions","customFontFamily","light","primary"],""),onChange:p=>r(["themeOptions","customFontFamily","light","primary"],p.target.value),placeholder:Or.customFontFamily.light.primary})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Secondary Font"}),A.jsx(it,{value:e(["themeOptions","customFontFamily","light","secondary"],""),onChange:p=>r(["themeOptions","customFontFamily","light","secondary"],p.target.value),placeholder:Or.customFontFamily.light.secondary})]})]})]})}),A.jsx(Ct,{xs:12,md:6,children:A.jsxs(mt,{variant:"soft",sx:{p:2},children:[A.jsx(de,{level:"title-sm",sx:{mb:2},children:"Dark Mode"}),A.jsxs(gt,{spacing:2,children:[A.jsxs(Me,{children:[A.jsx(Le,{children:"Primary Font"}),A.jsx(it,{value:e(["themeOptions","customFontFamily","dark","primary"],""),onChange:p=>r(["themeOptions","customFontFamily","dark","primary"],p.target.value),placeholder:Or.customFontFamily.dark.primary})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Secondary Font"}),A.jsx(it,{value:e(["themeOptions","customFontFamily","dark","secondary"],""),onChange:p=>r(["themeOptions","customFontFamily","dark","secondary"],p.target.value),placeholder:Or.customFontFamily.dark.secondary})]})]})]})})]})]})]}),A.jsxs(mt,{variant:"outlined",sx:{p:0,transition:"all 0.2s ease-in-out",overflow:"hidden"},children:[l("Radius","radius"),t.radius&&A.jsxs(gt,{spacing:2,sx:{p:2},children:[A.jsx(de,{level:"title-sm",pl:1,children:"These values control the roundness of corners for buttons, cards, inputs, and other UI elements. Values are in pixels."}),A.jsxs(Ct,{container:!0,spacing:2,children:[A.jsx(Ct,{xs:12,md:6,children:A.jsxs(mt,{variant:"soft",sx:{p:2},children:[A.jsx(de,{level:"title-sm",sx:{mb:2},children:"Light Mode"}),A.jsx(Ct,{container:!0,spacing:1.5,children:w2.map(p=>{const h=Or.customRadius.light[p],m=e(["themeOptions","customRadius","light",p],"");return A.jsx(Ct,{xs:6,sm:4,children:A.jsxs(Me,{size:"sm",children:[A.jsx(Le,{sx:{fontSize:"0.75rem"},children:p}),A.jsx(it,{size:"sm",type:"number",value:m?a(m):"",onChange:f=>{const g=parseInt(f.target.value);isNaN(g)||r(["themeOptions","customRadius","light",p],o(g))},placeholder:a(h).toString(),endDecorator:"px",slotProps:{input:{min:0}},sx:{"& input[type=number]::-webkit-outer-spin-button, & input[type=number]::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:0},"& input[type=number]":{MozAppearance:"textfield"}}})]})},p)})})]})}),A.jsx(Ct,{xs:12,md:6,children:A.jsxs(mt,{variant:"soft",sx:{p:2},children:[A.jsx(de,{level:"title-sm",sx:{mb:2},children:"Dark Mode"}),A.jsx(Ct,{container:!0,spacing:1.5,children:w2.map(p=>{const h=Or.customRadius.dark[p],m=e(["themeOptions","customRadius","dark",p],"");return A.jsx(Ct,{xs:6,sm:4,children:A.jsxs(Me,{size:"sm",children:[A.jsx(Le,{sx:{fontSize:"0.75rem"},children:p}),A.jsx(it,{size:"sm",type:"number",value:m?a(m):"",onChange:f=>{const g=parseInt(f.target.value);isNaN(g)||r(["themeOptions","customRadius","dark",p],o(g))},placeholder:a(h).toString(),endDecorator:"px",slotProps:{input:{min:0}},sx:{"& input[type=number]::-webkit-outer-spin-button, & input[type=number]::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:0},"& input[type=number]":{MozAppearance:"textfield"}}})]})},p)})})]})})]})]})]}),A.jsxs(mt,{variant:"outlined",sx:{p:0,transition:"all 0.2s ease-in-out",overflow:"hidden"},children:[l("Border","border"),t.border&&A.jsxs(gt,{spacing:2,sx:{p:2},children:[A.jsx(de,{level:"title-sm",pl:1,children:"This controls the thickness of borders around cards and other outlined elements. Values are in pixels."}),A.jsxs(Ct,{container:!0,spacing:2,children:[A.jsx(Ct,{xs:12,md:6,children:A.jsxs(mt,{variant:"soft",sx:{p:2},children:[A.jsx(de,{level:"title-sm",sx:{mb:2},children:"Light Mode"}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Border Size"}),A.jsx(it,{type:"number",value:e(["themeOptions","border","light","size"],"")?a(e(["themeOptions","border","light","size"],"")):"",onChange:p=>{const h=parseInt(p.target.value);isNaN(h)||r(["themeOptions","border","light","size"],o(h))},placeholder:a(Or.border.light.size).toString(),endDecorator:"px",slotProps:{input:{min:0}},sx:{"& input[type=number]::-webkit-outer-spin-button, & input[type=number]::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:0},"& input[type=number]":{MozAppearance:"textfield"}}})]})]})}),A.jsx(Ct,{xs:12,md:6,children:A.jsxs(mt,{variant:"soft",sx:{p:2},children:[A.jsx(de,{level:"title-sm",sx:{mb:2},children:"Dark Mode"}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Border Size"}),A.jsx(it,{type:"number",value:e(["themeOptions","border","dark","size"],"")?a(e(["themeOptions","border","dark","size"],"")):"",onChange:p=>{const h=parseInt(p.target.value);isNaN(h)||r(["themeOptions","border","dark","size"],o(h))},placeholder:a(Or.border.dark.size).toString(),endDecorator:"px",slotProps:{input:{min:0}},sx:{"& input[type=number]::-webkit-outer-spin-button, & input[type=number]::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:0},"& input[type=number]":{MozAppearance:"textfield"}}})]})]})})]})]})]}),A.jsxs(mt,{variant:"outlined",sx:{p:0,transition:"all 0.2s ease-in-out",overflow:"hidden"},children:[l("Image Background Gradient","gradient"),t.gradient&&A.jsxs(gt,{spacing:2,sx:{p:2},children:[A.jsx(de,{level:"title-sm",pl:1,children:"Configure CSS gradient values for image backgrounds. These gradients are applied as overlays on images to ensure text readability."}),A.jsxs(Ct,{container:!0,spacing:2,children:[A.jsx(Ct,{xs:12,md:6,children:A.jsxs(mt,{variant:"soft",sx:{p:2},children:[A.jsx(de,{level:"title-sm",sx:{mb:2},children:"Light Mode"}),A.jsxs(gt,{spacing:2,children:[A.jsxs(Me,{children:[A.jsx(Le,{children:"Standard"}),A.jsx(it,{value:e(["themeOptions","imageBackgroundGradient","light","standard"],""),onChange:p=>r(["themeOptions","imageBackgroundGradient","light","standard"],p.target.value),placeholder:Or.imageBackgroundGradient.light.standard})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Split"}),A.jsx(it,{value:e(["themeOptions","imageBackgroundGradient","light","split"],""),onChange:p=>r(["themeOptions","imageBackgroundGradient","light","split"],p.target.value),placeholder:Or.imageBackgroundGradient.light.split})]})]})]})}),A.jsx(Ct,{xs:12,md:6,children:A.jsxs(mt,{variant:"soft",sx:{p:2},children:[A.jsx(de,{level:"title-sm",sx:{mb:2},children:"Dark Mode"}),A.jsxs(gt,{spacing:2,children:[A.jsxs(Me,{children:[A.jsx(Le,{children:"Standard"}),A.jsx(it,{value:e(["themeOptions","imageBackgroundGradient","dark","standard"],""),onChange:p=>r(["themeOptions","imageBackgroundGradient","dark","standard"],p.target.value),placeholder:Or.imageBackgroundGradient.dark.standard})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Split"}),A.jsx(it,{value:e(["themeOptions","imageBackgroundGradient","dark","split"],""),onChange:p=>r(["themeOptions","imageBackgroundGradient","dark","split"],p.target.value),placeholder:Or.imageBackgroundGradient.dark.split})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Overlay"}),A.jsx(it,{value:e(["themeOptions","imageBackgroundGradient","dark","overlay"],""),onChange:p=>r(["themeOptions","imageBackgroundGradient","dark","overlay"],p.target.value),placeholder:Or.imageBackgroundGradient.dark.overlay})]})]})]})})]})]})]}),A.jsxs(mt,{variant:"outlined",sx:{p:0,transition:"all 0.2s ease-in-out",overflow:"hidden"},children:[l("Breakpoints","breakpoints"),t.breakpoints&&A.jsxs(gt,{spacing:2,sx:{p:2},children:[A.jsx(de,{level:"title-sm",pl:1,children:"Configure responsive breakpoint values. These define the width thresholds at which widgets adapt their layout based on the available width - either the parent container width when embedded (e.g., in article containers) or the device screen size when rendered standalone. This ensures proper responsive behavior in all contexts. Values are in pixels."}),A.jsx(Ct,{container:!0,spacing:2,children:j1e.map(p=>{const h=Or.customBreakpoints.values[p],m=e(["themeOptions","customBreakpoints","values",p],"");return A.jsx(Ct,{xs:6,sm:4,md:2,children:A.jsxs(Me,{children:[A.jsx(Le,{children:p}),A.jsx(it,{type:"number",value:m!==""?m:"",onChange:f=>{const g=parseInt(f.target.value);isNaN(g)||r(["themeOptions","customBreakpoints","values",p],g)},placeholder:h.toString(),endDecorator:"px",slotProps:{input:{min:0}},sx:{"& input[type=number]::-webkit-outer-spin-button, & input[type=number]::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:0},"& input[type=number]":{MozAppearance:"textfield"}}})]})},p)})})]})]})]})},C2=[{code:"bg",name:"Bulgarian",flag:"🇧🇬"},{code:"en",name:"English",flag:"🇬🇧"},{code:"ro",name:"Romanian",flag:"🇷🇴"},{code:"el",name:"Greek",flag:"🇬🇷"},{code:"sk",name:"Slovak",flag:"🇸🇰"},{code:"pt",name:"Portuguese",flag:"🇵🇹"},{code:"sr",name:"Serbian",flag:"🇷🇸"},{code:"hu",name:"Hungarian",flag:"🇭🇺"},{code:"sv",name:"Swedish",flag:"🇸🇪"},{code:"es",name:"Spanish",flag:"🇪🇸"},{code:"fr",name:"French",flag:"🇫🇷"},{code:"nl",name:"Dutch",flag:"🇳🇱"},{code:"de",name:"German",flag:"🇩🇪"},{code:"it",name:"Italian",flag:"🇮🇹"},{code:"ar",name:"Arabic",flag:"🇸🇦"}],I2=[{value:"native",label:"Native"},{value:"sportal365",label:"Sportal365"},{value:"enetpulse",label:"Enetpulse"}],F1e=({id:r,title:e,description:t,config:n,clientApiKeys:i,onTitleChange:a,onDescriptionChange:o,onConfigChange:s,onClose:l,onSave:c,isSubmitting:d,isEditing:u})=>{const[p,h]=B.useState(0),[m,f]=B.useState(!1),[g,b]=B.useState(""),[y,v]=B.useState(""),w=(T,E)=>{const I={...n};let P=I;for(let k=0;k<T.length-1;k++)P[T[k]]||(P[T[k]]={}),P=P[T[k]];P[T[T.length-1]]=E,s(I)},x=(T,E="")=>{let I=n;for(const P of T)if(I&&typeof I=="object"&&P in I)I=I[P];else return E;return I??E},S=T=>{if(T)b(JSON.stringify(n,null,2)),v("");else try{const E=JSON.parse(g);s(E),v("")}catch{v("Invalid JSON format. Please fix the errors before switching to form mode.");return}f(T)},_=T=>{b(T);try{const E=JSON.parse(T);s(E),v("")}catch{v("Invalid JSON format")}};return A.jsxs(gt,{spacing:3,children:[r&&A.jsxs(Me,{children:[A.jsx(Le,{children:"ID"}),A.jsx(it,{value:r,readOnly:!0})]}),A.jsxs(oe,{children:[A.jsxs(Me,{required:!0,sx:{mb:2},children:[A.jsx(Le,{children:"Title"}),A.jsx(it,{placeholder:"",value:e,onChange:T=>a(T.target.value)})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Description"}),A.jsx(Kc,{placeholder:"",minRows:2,value:t,onChange:T=>o(T.target.value)})]})]}),A.jsx(xr,{}),A.jsxs(oe,{sx:{display:"flex",alignItems:"center",gap:1},children:[A.jsx(de,{level:"body-sm",sx:{fontWeight:m?400:600,color:m?"text.secondary":"primary.500",transition:"all 0.2s ease"},children:"Form View"}),A.jsx(Kp,{checked:m,onChange:T=>S(T.target.checked),color:"primary"}),A.jsx(de,{level:"body-sm",sx:{fontWeight:m?600:400,color:m?"primary.500":"text.secondary",transition:"all 0.2s ease"},children:"Raw JSON"})]}),m?A.jsxs(Me,{error:!!y,children:[A.jsx(Le,{children:"Raw JSON Configuration"}),A.jsx(Kc,{placeholder:"",minRows:15,maxRows:25,value:g,onChange:T=>_(T.target.value),sx:{fontFamily:"monospace",fontSize:"0.875rem"}}),y&&A.jsx(xt,{children:y})]}):A.jsxs(Jp,{value:p,onChange:(T,E)=>h(E),children:[A.jsxs(Yp,{sx:{flexWrap:"wrap"},children:[A.jsxs(ln,{children:[A.jsx(GZ,{sx:{mr:1}}),"SDK"]}),A.jsxs(ln,{children:[A.jsx(KZ,{sx:{mr:1}}),"Firebase"]}),A.jsxs(ln,{children:[A.jsx(UZ,{sx:{mr:1}}),"Leads"]}),A.jsxs(ln,{children:[A.jsx(kA,{sx:{mr:1}}),"Theme"]}),A.jsxs(ln,{children:[A.jsx(WZ,{sx:{mr:1}}),"Misc"]}),A.jsxs(ln,{children:[A.jsx(HZ,{sx:{mr:1}}),"Legacy"]})]}),A.jsx(xn,{value:0,children:A.jsxs(gt,{spacing:2,children:[A.jsxs(Me,{children:[A.jsx(Le,{children:"API Key"}),A.jsx(wt,{placeholder:"",value:x(["fansUnited","apiKey"],"")||null,onChange:(T,E)=>w(["fansUnited","apiKey"],E),children:(()=>{const T=x(["fansUnited","apiKey"],""),E=i.some(I=>I.value===T);return A.jsxs(A.Fragment,{children:[T&&!E&&A.jsxs(Xe,{value:T,children:[T," (Custom value)"]}),i.map(I=>A.jsx(Xe,{value:I.value,children:I.label},I.value))]})})()}),A.jsx(xt,{children:"Controls which API key will be used to authenticate with APIs"})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"ID Schema"}),A.jsx(wt,{value:x(["fansUnited","idSchema"],"native"),onChange:(T,E)=>w(["fansUnited","idSchema"],E),children:(()=>{const T=x(["fansUnited","idSchema"],"native"),E=I2.some(I=>I.value===T);return A.jsxs(A.Fragment,{children:[T&&!E&&A.jsxs(Xe,{value:T,children:[T," (Custom value)"]}),I2.map(I=>A.jsx(Xe,{value:I.value,children:I.label},I.value))]})})()}),A.jsx(xt,{children:"Responsible for setting the football provider IDs"})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Language"}),A.jsx(wt,{value:x(["language"],"en"),onChange:(T,E)=>w(["language"],E),children:(()=>{const T=x(["language"],"en"),E=C2.some(I=>I.code===T);return A.jsxs(A.Fragment,{children:[T&&!E&&A.jsxs(Xe,{value:T,children:[T," (Custom value)"]}),C2.map(I=>A.jsx(Xe,{value:I.code,children:A.jsxs(oe,{sx:{display:"flex",alignItems:"center",gap:1},children:[A.jsx("span",{children:I.flag}),A.jsx("span",{children:I.name})]})},I.code))]})})()}),A.jsx(xt,{children:"Controls the football content language that will be loaded from Football API"})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Token Cookie Name"}),A.jsx(it,{placeholder:"",value:x(["fansUnited","tokenCookieName"]),onChange:T=>w(["fansUnited","tokenCookieName"],T.target.value)}),A.jsx(xt,{children:"Used when widgets will be used with websites that have current authentication flow. To provide a valid JWT, the widgets will read the JWT from a document cookie."})]})]})}),A.jsx(xn,{value:1,children:A.jsxs(gt,{spacing:2,children:[A.jsxs(Me,{children:[A.jsx(Le,{children:"API Key"}),A.jsx(it,{placeholder:"",value:x(["firebase","apiKey"]),onChange:T=>w(["firebase","apiKey"],T.target.value)})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Auth Domain"}),A.jsx(it,{placeholder:"",value:x(["firebase","authDomain"]),onChange:T=>w(["firebase","authDomain"],T.target.value)})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"Project ID"}),A.jsx(it,{placeholder:"",value:x(["firebase","projectId"]),onChange:T=>w(["firebase","projectId"],T.target.value)})]}),A.jsxs(Me,{children:[A.jsx(Le,{children:"App ID"}),A.jsx(it,{placeholder:"",value:x(["firebase","appId"]),onChange:T=>w(["firebase","appId"],T.target.value)})]})]})}),A.jsx(xn,{value:2,children:A.jsx(_1e,{config:n,onConfigChange:w,getConfigValue:x})}),A.jsx(xn,{value:3,children:A.jsx($1e,{onConfigChange:w,getConfigValue:x})}),A.jsx(xn,{value:4,children:A.jsx(M1e,{onConfigChange:w,getConfigValue:x})}),A.jsx(xn,{value:5,children:A.jsx(A1e,{config:n,onConfigChange:w,getConfigValue:x})})]}),A.jsxs(oe,{sx:{display:"flex",gap:1,justifyContent:"flex-end",pt:2},children:[A.jsx(st,{variant:"outlined",color:"neutral",onClick:l,children:"Close"}),A.jsx(st,{onClick:c,loading:d,disabled:!e||m&&!!y,children:u?"Update":"Create"})]})]})},N1e=()=>{const[r,e]=B.useState([]),[t,n]=B.useState(!1),[i,a]=B.useState(!1),[o,s]=B.useState(!1),[l,c]=B.useState(!1),[d,u]=B.useState(null),[p,h]=B.useState(null),[m,f]=B.useState({title:"",description:"",config:{}}),[g,b]=B.useState(null),[y,v]=B.useState(!1),[w,x]=B.useState("danger"),[S,_]=B.useState(""),{Spinner:T,Toast:E}=Xn.useComponentContext(),{https:I}=Xn.useAPIContext(),P=(U,R)=>{x(U),_(R),v(!0)},k=async(U=!0)=>{U&&n(!0);const[R,$]=await Promise.all([I.getWidgetConfigurations(!0),I.getClientById()]),H=await R.json(),W=await $.json();if(R.ok)e(H.data||[]);else{const Q=Oi(H,"Failed to fetch widget configurations");console.error("Error fetching configurations:",Q),P("danger",Q)}if($.ok)b(W.data);else{const Q=Oi(W,"Failed to fetch client info data");console.error("Error fetching client info:",Q),P("danger",Q)}U&&n(!1)};B.useEffect(()=>{k()},[]);const O=()=>{h(null);const U=g?.infrastructure?.toLowerCase()||"prod";f({title:"",description:"",config:{language:"en",fansUnited:{apiKey:"",clientId:g?.id||"",environment:U,idSchema:"native",errorHandlingMode:"standard",tokenCookieName:""},firebase:{apiKey:"",authDomain:"",projectId:"",appId:""}}}),s(!0)},M=U=>{h(U),f({...U,config:typeof U.config=="string"?JSON.parse(U.config):U.config}),s(!0)},L=U=>{u(U),c(!0)},j=async U=>{try{if(navigator.clipboard&&typeof navigator.clipboard.writeText=="function"){await navigator.clipboard.writeText(U),P("primary","Configuration ID copied to clipboard");return}const R=document.createElement("textarea");R.value=U,R.style.position="fixed",R.style.left="-9999px",R.style.opacity="0",document.body.appendChild(R),R.focus(),R.select();const $=document.execCommand("copy");document.body.removeChild(R),$?P("primary","Configuration ID copied to clipboard"):P("danger","Failed to copy configuration ID with exec command")}catch(R){console.error("Failed to copy configuration ID:",R),P("danger","Failed to copy configuration ID")}},F=async()=>{if(d?.id){a(!0);try{const U=await I.deleteWidgetConfiguration(d.id);if(U.ok)P("success","Configuration deleted successfully"),c(!1),u(null),await k(!0);else{const R=await U.json(),$=Oi(R,"Failed to delete configuration");console.error("Error deleting configuration:",$),P("danger",$)}}catch(U){console.error("Error deleting configuration:",U),P("danger","Failed to delete configuration")}finally{a(!1)}}},V=()=>{c(!1),u(null)},z=async()=>{if(!m.title){P("warning","Please fill in all fields");return}a(!0);try{const U={title:m.title,description:m.description,config:m.config},R=p?.id?await I.updateWidgetConfiguration(p.id,U):await I.createWidgetConfiguration(U),$=await R.json();if(R.ok){const H=$.data;P("success",`Configuration ${p?"updated":"created"} successfully`),await k(!1),!p?.id&&H?.id&&(h(H),f({...H,config:typeof H.config=="string"?JSON.parse(H.config):H.config}))}else{const H=Oi($,"Failed to save configuration");console.error("Error saving configuration:",H),P("danger",H)}}catch(U){console.error("Error saving configuration:",U),P("danger","Failed to save configuration")}finally{a(!1)}};return t?A.jsx(T,{my:30}):A.jsxs(A.Fragment,{children:[A.jsx(oe,{mb:2,children:A.jsx(st,{startDecorator:A.jsx(ro,{}),onClick:O,children:"Add"})}),r.length===0?A.jsx(mt,{variant:"outlined",sx:{textAlign:"center",py:8,borderStyle:"dashed",borderWidth:2,borderColor:"neutral.outlinedBorder"},children:A.jsxs(ai,{sx:{alignItems:"center"},children:[A.jsx(de,{level:"h4",fontWeight:"bold",startDecorator:A.jsx(YZ,{sx:{fontSize:24,color:"neutral.400"}}),textAlign:"center",children:"No configurations found"}),A.jsx(de,{level:"body-md",color:"neutral",children:"Create your first widget configuration to get started"})]})}):A.jsx(Un,{variant:"outlined",sx:{borderRadius:"sm",overflow:"auto"},children:A.jsxs(qo,{"aria-label":"widget configurations table",stickyHeader:!0,sx:{"--unstable_TableCell-height":"22px"},children:[A.jsx("thead",{children:A.jsxs("tr",{children:[A.jsx("th",{style:{width:"200px"},children:"Title"}),A.jsx("th",{children:"Description"}),A.jsx("th",{style:{width:"100px",textAlign:"right"},children:"Actions"})]})}),A.jsx("tbody",{children:r.map(U=>A.jsxs("tr",{children:[A.jsx("td",{children:A.jsx(de,{level:"title-sm",children:U.title})}),A.jsx("td",{children:A.jsx(de,{level:"body-sm",children:U.description})}),A.jsx("td",{style:{textAlign:"center"},children:A.jsxs(gt,{direction:"row",spacing:1,justifyContent:"flex-end",children:[A.jsx(rt,{title:"Copy Configuration ID",placement:"top",children:A.jsx(kt,{size:"sm",variant:"soft",color:"neutral",onClick:()=>j(U.id),children:A.jsx(Xs,{})})}),A.jsx(kt,{size:"sm",variant:"soft",color:"primary",onClick:()=>M(U),children:A.jsx(jb,{})}),A.jsx(kt,{size:"sm",variant:"soft",color:"danger",onClick:()=>L(U),children:A.jsx(Yo,{})})]})})]},U.id))})]})}),A.jsx(ca,{open:o,onClose:()=>s(!1),children:A.jsxs(ua,{sx:{width:"90vw",maxWidth:"900px",maxHeight:"90vh",overflow:"auto"},children:[A.jsx(Wp,{}),A.jsx(la,{children:p?`${m.title}`:"New Configuration"}),A.jsx(sa,{sx:{mt:1},children:A.jsx(F1e,{id:m.id,title:m.title,description:m.description,config:m.config,clientApiKeys:g?.google_endpoints_keys||[],onTitleChange:U=>f({...m,title:U}),onDescriptionChange:U=>f({...m,description:U}),onConfigChange:U=>f({...m,config:U}),onClose:()=>s(!1),onSave:z,isSubmitting:i,isEditing:!!p})})]})}),A.jsx(ca,{open:l,onClose:V,children:A.jsxs(ua,{variant:"outlined",role:"alertdialog",sx:{maxWidth:500},children:[A.jsx(la,{children:A.jsxs(de,{level:"h4",startDecorator:A.jsx(EA,{color:"error"}),children:["Delete ",d?.title]})}),A.jsx(xr,{}),A.jsx(sa,{children:A.jsxs(de,{level:"body-md",children:["Are you sure you want to delete"," ",A.jsx(de,{fontWeight:"bold",fontStyle:"italic",children:d?.title})," ","configuration? This action cannot be undone."]})}),A.jsxs(oe,{sx:{display:"flex",gap:1,justifyContent:"flex-end",pt:2},children:[A.jsx(st,{variant:"plain",color:"neutral",onClick:V,children:"Cancel"}),A.jsx(st,{variant:"solid",color:"danger",onClick:F,loading:i,children:"Delete"})]})]})}),A.jsx(E,{showToast:y,color:w,message:S,hideToast:()=>v(!1)})]})},B1e=({name:r,branding:e,onNameChange:t,onBrandingChange:n,onClose:i,onSave:a,isSubmitting:o,isEditing:s})=>{const[l,c]=B.useState(!1),[d,u]=B.useState(0),{InformationInput:p,BrandingImage:h}=Xn.useComponentContext(),m=Gl(ko),f=["mobile_logo","background_image","mobile_background_image","additional_image"],g=new Map().set("main_logo",m.mainLogo).set("mobile_logo",m.mobileLogo).set("background_image",m.backgroundImage).set("mobile_background_image",m.mobileBackgroundImage).set("additional_image",m.additionalImage),b=new Map().set("primary_color",m.primaryColor).set("secondary_color",m.secondaryColor).set("content_color",m.contentColor).set("background_color",m.backgroundColor).set("border_color",m.borderColor).set("additional_color",m.additionalColor),y=new Map().set("primary_url",m.primaryUrl).set("secondary_url",m.secondaryUrl).set("privacy_policy_url",m.privacyPolicyUrl).set("terms_and_conditions_url",m.termsAndConditionsUrl).set("additional_url",m.additionalUrl),v=(_,T)=>{const E=_.target.value,I={...e};I.colors[T]=E,n(I)},w=(_,T)=>{const E=_.target.value,I={...e};I.urls[T]=E,n(I)},x=(_,T)=>{const E={...e};E.images[T]=_,n(E)},S=_=>{const T={...e};T.images[_]="",n(T)};return A.jsxs(gt,{spacing:3,children:[A.jsx(oe,{children:A.jsxs(Me,{required:!0,children:[A.jsx(Le,{children:"Name"}),A.jsx(it,{placeholder:"Enter branding name",value:r,onChange:_=>t(_.target.value)})]})}),A.jsxs(Jp,{value:d,onChange:(_,T)=>u(T),sx:{p:0,bgcolor:"transparent"},children:[A.jsxs(Yp,{sx:{borderRadius:0,fontSize:"0.875rem",[`& .${Kk.root}`]:{'&[aria-selected="true"]':{bgcolor:"transparent",py:1,borderColor:"transparent","&::before":{content:'""',display:"block",position:"absolute",height:2,bottom:-2,left:0,right:0},"&::after":{bgcolor:"primary.500"}}}},tabFlex:"auto",children:[A.jsxs(ln,{children:[A.jsx(Ui,{children:A.jsx(dh,{sx:{width:"20px"}})}),"Images"]}),A.jsxs(ln,{children:[A.jsx(Ui,{children:A.jsx(zZ,{sx:{width:"20px"}})}),"Colors"]}),A.jsxs(ln,{children:[A.jsx(Ui,{children:A.jsx(Nb,{sx:{width:"20px"}})}),"URLs"]})]}),A.jsxs(xn,{value:0,sx:{px:0},children:[A.jsx(h,{labels:{},title:"Main Logo",image:e.images.main_logo,onChangeImages:_=>x(_,"main_logo"),clearImage:()=>S("main_logo"),readOnly:!1}),A.jsx(eo,{underline:"hover",onClick:()=>c(!l),sx:{marginBottom:"10px"},children:l?"Hide More Images":"Show More Images"}),l&&A.jsx(A.Fragment,{children:f.map(_=>A.jsx(h,{labels:{},title:g.get(_)||_,image:e.images[_],onChangeImages:T=>x(T,_),clearImage:()=>S(_),readOnly:!1},`branding-image-${_}`))})]}),A.jsx(xn,{value:1,sx:{px:0},children:A.jsx(oe,{children:Object.keys(e.colors).map(_=>A.jsx(oe,{mb:2,children:A.jsx(p,{size:"sm",label:b.get(_)||_,placeholder:"#000000",defaultValue:e.colors[_],required:!1,readOnly:!1,onChange:T=>v(T,_),endDecorator:A.jsx(oe,{component:"input",type:"color",value:e.colors[_]||"#000000",onChange:T=>{const E={target:{value:T.target.value}};v(E,_)},sx:{width:"36px",height:"28px",border:"none",borderRadius:"4px",cursor:"pointer",padding:0,backgroundColor:"transparent","&::-webkit-color-swatch-wrapper":{padding:"2px",borderRadius:"4px"},"&::-webkit-color-swatch":{border:"1px solid",borderColor:"neutral.outlinedBorder",borderRadius:"3px"},"&::-moz-color-swatch":{border:"1px solid",borderColor:"neutral.outlinedBorder",borderRadius:"3px"}}})})},`branding-color-${_}`))})}),A.jsx(xn,{value:2,sx:{px:0},children:A.jsx(oe,{children:Object.keys(e.urls).map(_=>A.jsx(oe,{mb:2,children:A.jsx(p,{size:"sm",label:y.get(_)||_,placeholder:"",defaultValue:e.urls[_],required:!1,readOnly:!1,onChange:T=>w(T,_)})},`branding-url-${_}`))})})]}),A.jsxs(oe,{sx:{display:"flex",gap:1,justifyContent:"flex-end",pt:2},children:[A.jsx(st,{variant:"outlined",color:"neutral",onClick:i,children:"Close"}),A.jsx(st,{onClick:a,loading:o,disabled:!r,children:s?"Update":"Create"})]})]})},S2={name:"",colors:{primary_color:"",secondary_color:"",content_color:"",background_color:"",border_color:"",additional_color:""},urls:{primary_url:"",secondary_url:"",privacy_policy_url:"",terms_and_conditions_url:"",additional_url:""},images:{main_logo:"",mobile_logo:"",background_image:"",mobile_background_image:"",additional_image:""}},z1e=()=>{const[r,e]=B.useState([]),[t,n]=B.useState(!1),[i,a]=B.useState(!1),[o,s]=B.useState(!1),[l,c]=B.useState(!1),[d,u]=B.useState(null),[p,h]=B.useState(null),[m,f]=B.useState({...S2}),[g,b]=B.useState(!1),[y,v]=B.useState("danger"),[w,x]=B.useState(""),{Spinner:S,Toast:_}=Xn.useComponentContext(),{https:T}=Xn.useAPIContext(),E=Gl(ko),I=(V,z)=>{v(V),x(z),b(!0)},P=async(V=!0)=>{V&&n(!0);try{const z=await T.getBrandingTemplates([],!0),U=await z.json();if(z.ok)e(U.data||[]);else{const R=Oi(U,E.fetchBrandingsErrorMessage);console.error("Error fetching brandings:",R),I("danger",R)}}catch(z){console.error("Error fetching brandings:",z),I("danger",E.fetchBrandingsErrorMessage)}finally{V&&n(!1)}};B.useEffect(()=>{P()},[]);const k=()=>{h(null),f({name:"",...S2}),s(!0)},O=V=>{h(V),f({...V}),s(!0)},M=V=>{u(V),c(!0)},L=async()=>{if(d?.id){a(!0);try{const V=await T.deleteBrandingTemplate(d.id);if(V.ok)I("success",E.brandingDeletedMessage),c(!1),u(null),await P(!0);else{const z=await V.json(),U=Oi(z,E.deleteBrandingErrorMessage);console.error("Error deleting branding:",U),I("danger",U)}}catch(V){console.error("Error deleting branding:",V),I("danger",E.deleteBrandingErrorMessage)}finally{a(!1)}}},j=()=>{c(!1),u(null)},F=async()=>{if(!m.name){I("warning",`Please enter a ${E.name.toLowerCase()}`);return}a(!0);try{const V={name:m.name,colors:m.colors,urls:m.urls,images:m.images},z=p?.id?await T.updateBrandingTemplate(p.id,V):await T.createBrandingTemplate(V),U=await z.json();if(z.ok){const R=U.data;I("success",p?E.brandingUpdatedMessage:E.brandingCreatedMessage),await P(!1),!p?.id&&R?.id&&(h(R),f(R))}else{const R=Oi(U,p?E.updateBrandingErrorMessage:E.createBrandingErrorMessage);console.error("Error saving branding:",R),I("danger",R)}}catch(V){console.error("Error saving branding:",V),I("danger",p?E.updateBrandingErrorMessage:E.createBrandingErrorMessage)}finally{a(!1)}};return t?A.jsx(S,{my:30}):A.jsxs(A.Fragment,{children:[A.jsx(oe,{mb:2,children:A.jsx(st,{startDecorator:A.jsx(ro,{}),onClick:k,children:E.add})}),r.length===0?A.jsx(mt,{variant:"outlined",sx:{textAlign:"center",py:8,borderStyle:"dashed",borderWidth:2,borderColor:"neutral.outlinedBorder"},children:A.jsxs(ai,{sx:{alignItems:"center"},children:[A.jsx(de,{level:"h4",fontWeight:"bold",startDecorator:A.jsx(kA,{sx:{fontSize:24,color:"neutral.400"}}),textAlign:"center",children:E.noBrandingsFound}),A.jsx(de,{level:"body-md",color:"neutral",children:E.createFirstBrandingTemplate})]})}):A.jsx(Ct,{container:!0,spacing:3,sx:{alignItems:"stretch"},children:r.map(V=>A.jsx(Ct,{xs:12,sm:6,md:4,lg:3,sx:{display:"flex"},children:A.jsx(mt,{variant:"outlined",sx:{width:"100%",display:"flex",flexDirection:"column",transition:"all 0.2s ease-in-out",cursor:"pointer","&:hover":{boxShadow:"md",transform:"translateY(-4px)",borderColor:"primary.outlinedBorder"}},onClick:()=>O(V),children:A.jsxs(ai,{sx:{pb:2,display:"flex",flexDirection:"column",flex:1},children:[A.jsxs(gt,{direction:"row",justifyContent:"space-between",alignItems:"center",mb:2,children:[A.jsx(de,{level:"title-lg",fontWeight:"bold",sx:{flex:1,pr:1},noWrap:!0,children:V.name}),A.jsx(kt,{sx:{minWidth:"24px",minHeight:"24px"},size:"sm",variant:"soft",color:"danger",onClick:z=>{z.stopPropagation(),M(V)},children:A.jsx(Yo,{sx:{width:"20px",height:"20px"}})})]}),A.jsx(cb,{ratio:"16/9",sx:{bgcolor:"background.level1",mb:2},children:V.images?.main_logo?A.jsx("img",{src:V.images.main_logo,alt:V.name,style:{objectFit:"contain",padding:"16px"}}):A.jsx(oe,{sx:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",gap:1},children:A.jsx(dh,{sx:{fontSize:48,color:"neutral.400"}})})}),A.jsxs(oe,{mb:2,children:[A.jsx(de,{level:"body-xs",color:"neutral",mb:.5,children:E.colors}),A.jsxs(gt,{direction:"row",spacing:.5,children:[Object.values(V.colors||{}).filter(z=>z).slice(0,6).map((z,U)=>A.jsx(oe,{sx:{width:24,height:24,borderRadius:"sm",bgcolor:z||"neutral.200",border:"1px solid",borderColor:"neutral.outlinedBorder",flexShrink:0}},U)),Object.values(V.colors||{}).filter(z=>z).length===0&&A.jsx(de,{level:"body-xs",color:"neutral",children:E.noColorsDefined})]})]}),A.jsxs(gt,{direction:"row",spacing:1,flexWrap:"wrap",useFlexGap:!0,children:[(()=>{const z=V.images?Object.values(V.images).filter(U=>U).length:0;return z>0?A.jsxs(Ut,{size:"sm",variant:"soft",color:"primary",startDecorator:A.jsx(dh,{}),children:[z," ",z===1?E.image:E.images]}):A.jsx(Ut,{size:"sm",variant:"soft",color:"neutral",startDecorator:A.jsx(dh,{}),children:E.noImages})})(),(()=>{const z=V.urls?Object.values(V.urls).filter(U=>U).length:0;return z>0?A.jsxs(Ut,{size:"sm",variant:"soft",color:"primary",startDecorator:A.jsx(Nb,{}),children:[z," ",z===1?E.url:E.urls]}):A.jsx(Ut,{size:"sm",variant:"soft",color:"neutral",startDecorator:A.jsx(Nb,{}),children:E.noUrls})})()]})]})})},V.id))}),A.jsx(ca,{open:o,onClose:()=>s(!1),children:A.jsxs(ua,{sx:{width:"90vw",maxWidth:"900px",maxHeight:"90vh",overflow:"auto"},children:[A.jsx(Wp,{}),A.jsx(la,{children:p?`${m.name}`:E.newBranding}),A.jsx(sa,{sx:{mt:1},children:A.jsx(B1e,{name:m.name,branding:m,onNameChange:V=>f({...m,name:V}),onBrandingChange:V=>f({...m,...V}),onClose:()=>s(!1),onSave:F,isSubmitting:i,isEditing:!!p})})]})}),A.jsx(ca,{open:l,onClose:j,children:A.jsxs(ua,{variant:"outlined",role:"alertdialog",sx:{maxWidth:500},children:[A.jsx(la,{children:A.jsxs(de,{level:"h4",startDecorator:A.jsx(EA,{color:"error"}),children:[E.deleteBranding," ",d?.name]})}),A.jsx(xr,{}),A.jsx(sa,{children:A.jsxs(de,{level:"body-md",children:["Are you sure you want to delete"," ",A.jsx(de,{fontWeight:"bold",fontStyle:"italic",children:d?.name})," ",E.deleteBrandingConfirmation]})}),A.jsxs(oe,{sx:{display:"flex",gap:1,justifyContent:"flex-end",pt:2},children:[A.jsx(st,{variant:"plain",color:"neutral",onClick:j,children:E.close}),A.jsx(st,{variant:"solid",color:"danger",onClick:L,loading:i,children:E.delete})]})]})}),A.jsx(_,{showToast:g,color:y,message:w,hideToast:()=>b(!1)})]})},U1e=()=>{const r=Gl(ko);return A.jsxs(A.Fragment,{children:[A.jsxs(oe,{m:1,children:[A.jsx(de,{level:"h3",children:r.configTitle}),A.jsx(xt,{children:r.configDescription})]}),A.jsx(mt,{variant:"plain",children:A.jsxs(Jp,{"aria-label":"Configurations",defaultValue:0,sx:{"@media (max-width: 899px)":{"& .MuiTabList-root":{flexDirection:"column"}}},children:[A.jsxs(Yp,{children:[A.jsx(ln,{disableIndicator:!0,children:r.language}),A.jsx(ln,{disableIndicator:!0,children:r.profilePreferences}),A.jsx(ln,{disableIndicator:!0,children:"User-Centric Widgets"}),A.jsx(ln,{disableIndicator:!0,children:"Branding"}),A.jsxs(ln,{disableIndicator:!0,disabled:!0,children:[r.cacheTTL,A.jsx(Ut,{size:"sm",variant:"solid",color:"primary",children:r.soon})]}),A.jsxs(ln,{disableIndicator:!0,disabled:!0,children:[r.footballAssets,A.jsx(Ut,{size:"sm",variant:"solid",color:"primary",children:r.soon})]})]}),A.jsx(xn,{value:0,children:A.jsx(x1e,{})}),A.jsx(xn,{value:1,children:A.jsx(w1e,{})}),A.jsx(xn,{value:2,children:A.jsx(N1e,{})}),A.jsx(xn,{value:3,children:A.jsx(z1e,{})})]})})]})},H1e=({fansUnitedEnvironment:r})=>{const{AuthContext:e,useComponentContext:t}=Xn,n=B.useContext(e),i=B.useContext(ko),{Login:a}=t();return n?A.jsx(b1e,{children:A.jsx(U1e,{})}):A.jsx(a,{environment:r,userNotFound:i.userNotFound})},V1e=r=>{const e={apiKey:r.fansUnitedApiKey,clientId:r.fansUnitedClientId,environment:r.fansUnitedEnvironment,language:r.fansUnitedLanguage,errorHandlingMode:"standard",sportal365Project:r.sportal365Project,sportal365Infrastructure:r.sportal365Infrastructure},{AuthProvider:t,APIProvider:n,ComponentProvider:i}=Xn;return A.jsx(t,{environment:r.fansUnitedEnvironment,children:A.jsx(y1e,{labels:r.labels,children:A.jsx(n,{config:e,children:A.jsx(i,{children:A.jsx(H1e,{fansUnitedEnvironment:r.fansUnitedEnvironment,hideSignOutButton:r.hideSignOutButton})})})})})};$a.ConfigurationManager=V1e,Object.defineProperty($a,Symbol.toStringTag,{value:"Module"})});
|