1"use strict";(self.webpackChunk_griddo_cx=self.webpackChunk_griddo_cx||[]).push([[513],{29024:function(e,t,l){l.r(t);var n=l(18134),o=l(26322),r=l(70278),s=l(32356),i=l(37447),a=l(60218),u=l(73991),c=l(64209),d=l(37411);const{Module:m,Pagination:f,ListFilters:g}=i.A,p={subjectFilter:"SUBJECT_AREA",regionFilter:"REGION",centersFilter:"CENTERS",topicFilter:"TOPIC"};t.default=e=>{var t,l,h,E,v;const{heroSection:y,leadText:b,templateOptions:S,subjectLabel:w,regionLabel:x,centersLabel:O,topicLabel:T,searchbarPlaceholder:A,itemsPerPage:I,relatedContent:L,data:j,linkText:C,filtersType:k}=e,{getNestedTranslation:N}=(0,s.s9)(),R=N("filters.noResultsTextLists","Canât find what you need? Try refining your search."),P=o.useRef(null),_=o.useRef(null),B="undefined"!=typeof window&&(null===(t=window)||void 0===t||null===(l=t.location)||void 0===l?void 0:l.search),F=new URLSearchParams(B),G=(()=>{let e=1;if("undefined"!=typeof window){const t=F.get("page");t&&(e=Number(t))}return e})(),[U,q]=o.useState(G),[M,J]=o.useState([]),[$,D]=o.useState([]),[H,Q]=o.useState(""),[V,X]=o.useState({}),[Y,z]=o.useState(null),[K,W]=o.useState(null),[{query:Z,isLoading:ee,isError:te,msg:le},ne]=(0,s.UH)(),[{query:oe,isLoading:re,isError:se,msg:ie},ae]=(0,s.jA)(),[{query:ue,isLoading:ce},de]=(0,s.jA)(),me={SUBJECT_AREA:w,REGION:x,CENTERS:O,TOPIC:T},fe=e=>{const t=new Set,l=e=>{if(e)if("number"!=typeof e){if("string"==typeof e){const l=parseInt(e);return void(isNaN(l)||l.toString()!==e||t.add(l))}if(Array.isArray(e))e.forEach(e=>l(e));else if("object"==typeof e){if(void 0!==e.id){const l="string"==typeof e.id?parseInt(e.id):e.id;isNaN(l)||t.add(l)}Object.values(e).forEach(e=>l(e))}}else t.add(e)};return l(e),Array.from(t)},ge=(e,t,l)=>{if(!e)return[];let o=(0,n.A)(e);if(l&&(o=o.filter(e=>Object.values(e).filter(e=>"string"==typeof e).map(e=>e.toLowerCase()).some(e=>e.includes(l.toLowerCase())))),t&&t.length>0&&V){const e={};Object.keys(V).forEach(l=>{var n;const o=l;e[o]=[],null===(n=V[l].items)||void 0===n||n.forEach(l=>{const n="string"==typeof l.id?parseInt(l.id):l.id;t.map(e=>"string"==typeof e?parseInt(e):e).includes(n)&&e[o].push(n)}),0===e[o].length&&delete e[o]}),o=o.filter(t=>Object.entries(e).map(([e,l])=>{const n=fe(t);return l.some(e=>n.includes(e))}).every(e=>!0===e))}return o},pe=o.useMemo(()=>{const e="manual"===j.mode?Y:K,t=ge(e,$,H);return Math.max(1,Math.ceil(t.length/I))},[j.mode,Y,K,$,H,I]);o.useEffect(()=>{de({data:{...j,related:[],allLanguages:j.allLanguages,order:"title-asc"}}),void 0!==typeof window&&window.scrollTo({top:0,left:0,behavior:"smooth"})},[]);const he=()=>{const e="manual"===j.mode?Y:K;if((null==e?void 0:e.length)>0&&oe&&Object.keys(oe).length>0){const t=new Set;e.forEach(e=>{fe(e).forEach(e=>t.add(e))});const l={};Object.keys(oe).forEach(e=>{var n;const o=oe[e],r=null===(n=o.items)||void 0===n?void 0:n.filter(e=>{const l="string"==typeof e.id?parseInt(e.id):e.id;return t.has(l)});r&&r.length>0&&(l[e]={...o,items:r})}),X(l)}else oe&&X(oe)};o.useEffect(()=>{if(!ce&&ue&&"auto"===j.mode){const e={data:{...j,sources:j.sources?j.sources.map(e=>({...e,filters:(0,u._j)([],e.filters,ue)})):null},items:999,page:1};ne(e)}},[j,ue,j.mode]),o.useEffect(()=>{"manual"===j.mode&&ue&&(()=>{if(j&&"manual"===j.mode){const e={data:{...j,sources:j.sources?j.sources.map(e=>{const t=e.filters&&Array.isArray(e.filters)?e.filters.map(e=>"number"==typeof e?{id:e,label:""}:e):[];return{...e,filters:(0,u._j)([],t,ue)}}):null},items:void 0};ne(e)}})()},[j,ue]);o.useEffect(()=>{var e;const t=[];j.sources&&j.sources.map(e=>{if(e.filters){e.filters.map(e=>t.push(e.id))}}),ae({data:{...j,sources:null!=j&&j.sources?null==j||null===(e=j.sources)||void 0===e?void 0:e.map(e=>({...e,filterOperator:"OR",globalOperator:e.globalOperator||"AND"})):null,related:t,order:"title-asc"},groupingCategories:!0}),he()},[j]),o.useEffect(()=>{he()},[oe,Y,K]),o.useEffect(()=>{"undefined"!=typeof window&&(F.set("page",String(U)),window.history.replaceState({},"",`${window.location.pathname}?${F}`))},[U]),(0,s.pX)(U,[_,P]),o.useEffect(()=>{var e;null!=Z&&null!==(e=Z.items)&&void 0!==e&&e.length&&("manual"===j.mode?z(Z.items):W(Z.items))},[Z,j.mode]),o.useEffect(()=>{te&&le&&console.error(JSON.stringify(le,null,2)),"manual"!==j.mode&&se&&ie&&console.error(JSON.stringify(ie,null,2))},[te,se]),o.useEffect(()=>{S&&J(S.map(e=>p[e]||e))},[null==S?void 0:S.length]),o.useEffect(()=>{z(null),W(null),D([]),Q(""),q(1)},[null==j?void 0:j.mode]);const Ee=o.useMemo(()=>{const e="manual"===j.mode?Y:K,t=ge(e,$,H);if(t){const e=(U-1)*I,l=e+I;return t.slice(e,l)}return[]},[Y,K,$,H,U,I,j.mode,V]);return o.createElement(a.A,null,o.createElement(r.Box,{bg:"ui02",id:"GeneralInfoList_Hero"},null==y?void 0:y.modules.map((e,t)=>o.createElement(i.B,Object.assign({},e,{key:t,altbg:!0})))),o.createElement(m,{bg:"ui02",py:"m"},o.createElement(r.VStack,{pb:(null==M?void 0:M.length)>0&&!se&&!re&&V?"0":"m"},o.createElement(r.Text,{textStyle:"body",color:"text02",as:"div"},o.createElement(c.o,{allowAllTypes:!0,source:b}))),(null==M?void 0:M.length)>0&&!se&&!re&&V&&o.createElement(r.Box,{ref:_},o.createElement(g,{showSearchBar:M.includes("searchbar"),searchbarPlaceholder:A,filters:M.filter(e=>{var t,l;return"searchbar"!==e&&(null===(t=V[e])||void 0===t||null===(l=t.items)||void 0===l?void 0:l.length)}),options:V,onFiltersUpdate:e=>(e=>{e.filter(e=>!$.includes(e)).concat($.filter(t=>!e.includes(t))).length&&(D(e),q(1))})(e),onSearchUpdate:e=>(e=>{H!==e&&(Q(e),q(1))})(e),resetPagination:e=>e&&q(1),addAllOption:!0,labels:me,filtersType:k,results:"manual"===j.mode&&Y||"auto"===j.mode&&K?ge(Y||K,$,H).length:(null==Z?void 0:Z.totalItems)||0,initialSelected:()=>(()=>{const e={};for(const[t,l]of F)if("page"!==t&&"QUERY"!==t&&ue){const t=l.split(",").map(e=>Number(e.trim()));Object.keys(ue).forEach(l=>{var n;if(null!==(n=ue[l])&&void 0!==n&&n.items){const n=ue[l].items.filter(e=>t.includes("string"==typeof e.id?parseInt(e.id):e.id));n&&n.length&&(e[l]=n)}})}return e})()})),!ee&&!ce&&"global"!==j.site&&(null!=Z&&null!==(h=Z.items)&&void 0!==h&&h.length||null!=Y&&Y.length||null!=K&&K.length)&&null!=$&&$.length?o.createElement(m,{bg:"ui02",pb:"s",pt:"xxs"},o.createElement(r.Text,{color:"text01",textStyle:"subtitle01","aria-live":"polite"},`${N("templates.results","Results")}: ${"manual"===j.mode&&Y||"auto"===j.mode&&K?ge(Y||K,$,H).length:(null==Z?void 0:Z.totalItems)||0}`)):null),!te&&!ee&&!ce&&("manual"===(null==j?void 0:j.mode)&&Y&&ge(Y,$,H).length>0||"auto"===(null==j?void 0:j.mode)&&K&&ge(K,$,H).length>0||!Y&&!K&&!(null==Z||null===(E=Z.items)||void 0===E||!E.length))&&o.createElement(r.Box,{ref:P,id:"GeneralInfoList_GeneralInfoDistributor"},o.createElement(i.B,{component:"GeneralInfoDistributor",queriedItems:Ee,isTemplate:!0,linkText:C,groupingLink:null})),!ee&&!ce&&("manual"===j.mode&&Y&&0===ge(Y,$,H).length||"auto"===j.mode&&K&&0===ge(K,$,H).length||!Y&&!K&&!(null!=Z&&null!==(v=Z.items)&&void 0!==v&&v.length))&&o.createElement(m,{bg:"ui01",py:"l"},o.createElement(r.Text,{color:"text01",textStyle:"quote"},R)),(ee||ce)&&o.createElement(r.Flex,{justifyContent:"center",width:"100%",bg:"ui02",py:"s"},o.createElement(d.A,null)),!te&&pe>1&&U&&o.createElement(f,{totalPages:pe,activePage:U,onSetPage:q,disabled:ee||ce}),o.createElement(r.Box,{id:"GeneralInfoList_RelatedContent"},null==L?void 0:L.modules.map((e,t)=>o.createElement(i.B,Object.assign({},e,{key:t}
1)))))}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.