PageSourceSearch

https://www.unsw.edu.au/etc.clientlibs/unsw-common/clientlibs/clie…/profile-search-a733c2c070a8b50f37e7.js

js unsw.edu.au collected 2026-10-01 07:22:58 UTC 14,128 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkunsw_common_ui_frontend=self.webpackChunkunsw_common_ui_frontend||[]).push([[7631],{3750:(function(Z,b,h){h.d(b,{o:function(){return U}});var t=h(4579);const U=(I,C)=>{const A=new t.s$().update(Uint8Array.from(C.split("").map(d=>d.charCodeAt(0)))).digest();return`${I}-${A}`}}),9022:(function(Z,b,h){var t=h(6540),U=h(4863),I=h(2068),C=h(9638);class L extends t.Component{render(){const{activeFilters:d,config:T,query:y,results:m,setSort:K,sortOptions:H,toggleSort:Q,searching:q,total:J,hideSort:S,noResultsMessage:O,forceResultsTitle:W,clearFiltersInMeta:G,resultsVisible:Y,hasSubmitButton:B}=this.props,{resultsPath:X,text:j}=T,{filterSingle:P,filterPlural:o,noResults:a,hasResults:i,showingResults:p,showingNoResults:g,sortLabel:$}=j;let x=m.length>0&&p?p.replace(/%x/,m.length).replace(/%y/,J):g,c="",w;const k=y.replace(/[\[\]"\\]/g,"");if(X!=="")return null;switch(!0){case W!==void 0:c=W;break;case q:c="Searching...";break;case(m.length>0&&y!==""&&d===1):c=`${i} "${k}" + ${d} ${P}`;break;case(m.length>0&&y!==""&&d>1):c=`${i} "${k}" + ${d} ${o}`;break;case(m.length>0&&y!==""):c=`${i} "${k}"`;break;case(m.length>0&&y===""&&d===1):c=`${i} ${d} ${P}`;break;case(m.length>0&&y===""&&d>1):c=`${i} ${d} ${o}`;break;case(m.length===0&&y===""&&d===1):c=`${a} ${d} ${P}`;break;case(m.length===0&&y===""&&d>1):c=`${a} ${d} ${o}`;break;case(m.length===0&&y!==""):c=`${a} "${k}"`;break;case(m.length!==0&&y===""&&O&&O!==""):c=O;break;default:c=g}return S||(w=t.createElement(U.A,{...this.props,...H,className:"sort",label:$,selectFilter:K,toggleFilter:Q})),t.createElement("div",{className:"meta"},c!==""?t.createElement("h2",null,c):"",t.createElement("p",{role:"status"},x),w,G&&(Y||!B)?t.createElement("div",{className:"text-reset"},t.createElement(I.A,{...this.props})):"")}}L.defaultProps={activeFilters:0,config:{...C.et},query:"",results:[],setSort:(A,d)=>null,sortOptions:{...C.wp},toggleSort:A=>null,clearFilters:()=>null,total:0},b.A=L}),3716:(function(Z,b,h){h.r(b),h.d(b,{ProfileSearchIndex:function(){return j}});var t=h(6540),U=h(5338),I=h(2696),C=h(8662),L=h(1312),A=h(3750),d=h(8789);class T extends t.Component{trackClick(){(0,d.d)(this.props.query,this.props.type,this.props.totalResults,this.props.title,this.props.liveUrl,this.props.rank)}render(){const{title:o,summary:a,metaData:i,liveUrl:p,openNewWindow:g}=this.props,$=g?{target:"_blank",rel:"noopener noreferrer"}:{};window.unsw.urlUtil.isExternal(p)&&($.rel="noopener noreferrer");const c=(i.staffFaculty?i.staffFaculty.split("|"):[]).map(k=>k.trim()).join(" | "),w=(0,A.o)("profile-card",p);return t.createElement("a",{className:"card-profile__container",href:p,"data-click-id":w,"data-click_category":"search-listing","data-click_title":document.title,"data-click_name":o,...$,onClick:()=>this.trackClick()},t.createElement("div",{className:"card-profile__image-container"},t.createElement("img",{src:i.image,alt:o})),t.createElement("div",{className:"card-profile__content-container"},t.createElement("div",{className:"card-profile__title"},c),t.createElement("div",{className:"card-profile__name"},t.createElement("h3",null,o)),i.staffRole&&t.createElement("p",{className:"card-profile__role"},i.staffRole),t.createElement("div",{className:"card-profile__content"},t.createElement("p",{dangerouslySetInnerHTML:{__html:a}})),t.createElement("div",{className:"card-profile__view-profile","aria-hidden":"true"},"View Profile",g&&t.createElement("span",{className:"sr-only"},"(Opens in a new window)"))))}}T.defaultProps={title:"",summary:"",metaData:{},liveUrl:"#"};var y=T;class m extends t.Component{trackClick(){(0,d.d)(this.props.query,this.props.type,this.props.totalResults,this.props.title,this.props.liveUrl,this.props.rank)}render(){const{title:o,metaData:a,liveUrl:i,openNewWindow:p,sanitizeHtml:g}=this.props,$=p?{target:"_blank",rel:"noopener noreferrer"}:{};window.unsw.urlUtil.isExternal(i)&&($.rel="noopener noreferrer");const c=(a.staffSchool?a.staffSchool.split("|"):[]).map(k=>k.trim()).join(" | "),w=(0,A.o)("expert-card",i);return t.createElement("a",{className:"card-profile__container",href:i,"data-click-id":w,"data-click_category":"search-listing","data-click_title":document.title,"data-click_name":o,...$,onClick:()=>this.trackClick()},t.createElement("div",{className:"card-profile__image-container"},t.createElement("img",{src:a.image,alt:o})),t.createElement("div",{className:"card-profile__content-container"},t.createElement("div",{className:"card-profile__title"},c),t.createElement("div",{className:"card-profile__name"},t.createElement("h3",null,o)),t.createElement("div",{className:"card-profile__content"},a.researchAreas?t.createElement("div",null,t.createElement("strong",null,"Research areas: "),t.createElement("span",{dangerouslySetInnerHTML:{__html:g(a.researchAreas)}})):"",a.phoneNumber||a.emailAddress?t.createElement("p",null,a.phoneNumber?t.createElement(t.Fragment,null,t.createElement("strong",null,"Contact: "),a.phoneNumber," \xA0|\xA0"):"",a.emailAddress?t.createElement("a",{href:`mailto:${a.emailAddress}`},a.emailAddress):""):""),t.createElement("div",{className:"card-profile__view-profile","aria-hidden":"true"}
1,t.createElement("span",null,"View Profile"),p&&t.createElement("span",{className:"sr-only"},"(Opens in a new window)"))))}}m.defaultProps={title:"",summary:"",metaData:{},liveUrl:"#"};var K=m;class H extends t.Component{render(){const{config:o,results:a,resultsSummary:i,query:p,profile:g,isExpert:$,sanitizeHtml:x}=this.props;return a.length===0||o.resultsPath!==""?null:t.createElement("div",{className:"profile-search-results"},t.createElement("div",{className:"card-profile unsw-brand-card-theme"},a.map((c,w)=>$?t.createElement(K,{key:w,...c,openNewWindow:o.openNewWindow==="true",sanitizeHtml:x,query:p,type:g,totalResults:i.totalMatching}):t.createElement(y,{key:w,...c,openNewWindow:o.openNewWindow==="true",query:p,type:g,totalResults:i.totalMatching}))))}}H.defaultProps={config:{resultsPath:""},results:[],resultsSummary:{},query:"",profile:""};var Q=H,q=h(9022),J=h(9426),S=h(9638);const O=document.getElementsByClassName("site-header-new desktop"),W={metastaffLastName:"metastaffLastName",relevance:"relevance"},G={atar:"",degreeType:"",faculty:"",areaStudy:"",fieldInterest:"",eligibility:""},Y="/content/dam/images/photos/people/headshots/other/2021-07-blank-avatar.jpg";class B extends I.A{constructor(o){super(o),this.mouseOverHeader=()=>{let{filterOptions:r}=this.state;for(let s=0;s<r.length;s++)r[s].open=!1;this.setState({filterOptions:r})},this.getFilterOptionsFromFacets=r=>{let s=this.state.filterOptions;return s.forEach(e=>{e.options=[]}),r.forEach(e=>{e.allValues&&e.allValues.forEach(n=>{if(n.queryStringParam){let l=n.queryStringParam.split("="),E=l[0],f=l[1],v=this.getFilterByParam(s,E);if(v!==void 0&&v.options!==void 0){let u;n.label==="1"?u="Yes":n.label==="0"?u="No":u=n.label,v.options.push({label:u,value:f})}}})}),s},this.getFilterByParam=(r,s)=>r.filter(e=>e.param===s)[0],this.initFilters=(r,s)=>{const e=this.getFilterOptionsFromFacets(s);let n=0;for(let l=0;l<e.length;l++){const E=e[l].id,f=r.filters.defaults[E]?r.filters.defaults[E]:"",v=f===""?!0:e[l].options.filter(u=>u.value===f).length>0;(e[l].selected===void 0||e[l].selected===""||e[l].selected===null)&&(e[l].selected=v?f:""),e[l].selected!==""&&++n}return{activeFilters:n,filterOptions:e}},this.createUrlHash=()=>{let{activeFilters:r,filterOptions:s,numRanks:e,inputQuery:n,query:l,startRank:E,sortOptions:f,perPage:v,componentId:u}=this.state,F="";e||(e=v);let V="";if(r>0){let R=[];for(let D=0;D<s.length;D++){const{param:_,selected:N}=s[D];N!==""&&R.push(encodeURIComponent(`${_}:${N}`))}V=R.length>0?`&filters=${R.join("+")}`:""}let M=this.props.isExpert?S.pD.selected:"relevance";if(this.state.validSortMethods){for(let R in this.state.validSortMethods)if(this.state.validSortMethods[R]===f.selected){M=R;break}}return l=encodeURIComponent(l||n),l!==""&&l!=="null"&&l!=="undefined"&&f.dirty!==!0&&(f.dirty=!0,f.selected=this.props.isExpert?S.pD.selected:"relevance",M=this.props.isExpert?S.pD.selected:"relevance"),u=u?encodeURIComponent(u):void 0,F=`search=${l}${V}&sort=${M}&startRank=${E}&numRanks=${e}${u?`&componentId=${u}`:""}`,this.setState({hash:F,sortOptions:f},()=>{if(this.state.dontSetParamsInHash){const R=new CustomEvent("hashchange",{});window.dispatchEvent(R)}else window.location.hash=`#${F}`}),F},this.createSearchUrl=()=>{let{activeFilters:r,filterOptions:s,query:e,startRank:n,numRanks:l,sortOptions:E,urlBase:f,scope:v,collection:u,excludedStaffRoles:F,staffAvailability:V,isExpert:M}=this.state,R="";if(r>0){let _=[];for(let N=0;N<s.length;N++){const{param:te,selected:z}=s[N];z&&z!==""&&s[N].type!=="input"&&te.indexOf("&")===-1&&z.indexOf("&")===-1&&_.push(`${te}=${z}`)}R=_.length>0?`&${_.join("&")}`:""}V===1&&(R+="&f.Availability%7CstaffAvailability=1"),e=encodeURIComponent(e||""),v=encodeURIComponent(v||""),u=encodeURIComponent(u||""),F=encodeURIComponent(F||"").split("%2C").map(_=>_.includes("%20")?`"${_}"`:_).join("+");let D=`${f}?form=json&collection=${u}&profile=profiles&query=${e||"!padrenull"}&start_rank=${n}&num_ranks=${l}${E.selected==="relevance"?"":`&sort=${E.selected}`}${R}${v?`&gscope1=${v}`:""}${F?`&meta_staffRole_not=${F}`:""}${M?"&expert=1":""}`;return this.setState({url:D,searching:!0},()=>this.doSearch()),D},this.doSearch=()=>{const{cache:r,url:s}=this.state,e=this.isCached();if(e!==!1)return this.fetchResult(r[e]),null;fetch(s,S.lw).then(n=>n.json()).then(n=>this.fetchResult(n)).catch(n=>this.error(n))},this.isCached=()=>{const{cache:r,url:s}=this.state;for(let e=0;e<r.length;e++)if(r[e].url===s)return e;return!1},this.fetchResult=r=>{if(!r||!r.response||!r.response.resultPacket||!r.response.resultPacket.results||r.response.resultPacket.results.length===0){this.setState({searching:!1,total:0});return}const e=r.response.facets,{activeFilters:n,filterOptions:l}=this.initFilters(this.state.config,e),{results:E,resultsSummary:f,query:v}=r.response.resultPacket;E.map(u=>{u.metaData.image=u.metaData.image||Y}),this.setState({facets:e,results:E,activeFilters:n,filterOptions:l,total:f.totalMatching,searching:!1,resultsSummary:f,profile:"staff"}),(0,d.q)(v,"staff",f.totalMatching)},this.toggleFilter=r=>{let{filterOptions:s}=this.state;for(let e=0;e<s.length;e++){const{id:n,open:l}=s[e];n===r?s[e].open=!l:s[e].open=!1}this.setState({filterOptions:s})},this.selectFilter=(r,s)=>{let{activeFilters:e,filterOptions:n}=this.state;for(let l=0;l<n.length;l++){const E=!!n[l].options.filter(f=>f.value===s).length;switch(!0){case!E:break;case(n[l].id===r&&n[l].selected===s):n[l].selected="",n[l].open=!1,--e,e=e<0?0:e;break;case(n[l].id===r&&n[l].selected!==""):n[l].selected=s,n[l].open=!1;break;case n[l].id===r:n[l].selected=s,n[l].open=!1,++e,e=e>n.length?n.length:e;break;default:}}this.setState({startRank:1,activeFilters:e,filterOptions:n,searchRefine:"filters"},()=>this.createUrlHash())},this.clearFilters=()=>{const{filterOptions:r}=this.state;for(let s=0;s<r.length;s++)r[s].selected="";this.setState({activeFilters:0,query:"",inputQuery:"",filterOptions:r,searchRefine:"filters"},()=>this.createUrlHash())},this.setSort=(r,s)=>{const{sortOptions:e}=this.state;return e.selected=s,e.open=!1,e.dirty=!0,this.setState({startRank:1,sortOptions:e,searchRefine:"sort"},()=>this.createUrlHash()),null},this.sanitizeHtml=r=>window.DOMPurify.sanitize(r,{ALLOWED_TAGS:["p","b","i","em","strong","a","h1","h2","h3","h4","h5","h6","br","ul","ol","li","br","span"],ALLOWED_ATTR:["href"]});const a=o.container,i=a.id,p=o.isExpert?S.Wt:S.vq,g=a!==null?a.dataset.apiUrl:"",$=a!==null?a.dataset.scope:"",x=a!==null?parseInt(a.dataset.hrdStaffAvailability):"",c=12,w=a&&a.dataset.collection?a.dataset.collection:"unsw~unsw-search",k=a!==null&&a.dataset.optionalFilters!==void 0?JSON.parse(a.dataset.optionalFilters):[],se=a&&a.dataset.excludedStaffRoles?a.dataset.excludedStaffRoles:"",re=o.isExpert?S.pD:S.aK,ae=p.filter(r=>!k.filter(s=>s.label===r.label).length>0||k.some(s=>s.label===r.label&&s.show)),ee=`${g}/?form=json&collection=${w}
1&profile=profiles&query=&start_rank=1&num_ranks=${c}`,le=window.location.hash?window.location.hash.substr(1):"",ne={url:ee,data:S.dF},ie=window.itemSearchConfig[i]?{...window.itemSearchConfig[i]}:{...S.et};this.state={activeFilters:0,cache:[ne],collection:w,componentId:i,config:ie,el:a,error:!1,filters:{...G},filterOptions:JSON.parse(JSON.stringify(ae||[])),hash:le,inputQuery:"",isExpert:o.isExpert=="true",keywords:[],numRanks:c.toString(),oldStartRank:1,perPage:c,results:[],facets:[],searching:!1,searchRefine:"filters",startRank:1,sort:o.isExpert?S.pD.selected:"relevance",scope:$,sortOptions:{...re},staffAvailability:x,total:0,query:"",url:ee,urlBase:g,hideSort:!!o.isExpert,excludedStaffRoles:se,validSortMethods:{...W}},window.sortOptions=window.sortOptions||{},window.sortOptions[i]=this.state}componentDidMount(){this.extractHash(),window.addEventListener("hashchange",this.extractHash,!1),O.length===1&&O[0].addEventListener("mouseenter",this.mouseOverHeader,!0)}componentWillUnmount(){window.removeEventListener("hashchange",()=>null,!1),O.length===1&&O[0].removeEventListener("mouseenter",this.mouseOverHeader,!0)}render(){return t.createElement(t.Fragment,null,t.createElement(C.A,{...this.state,submitSearch:this.submitSearch,setQuery:this.setQuery,clearFilters:this.clearFilters,selectFilter:this.selectFilter,toggleFilter:this.toggleFilter}),t.createElement(q.A,{...this.state,setSort:this.setSort,toggleSort:this.toggleSort}),t.createElement(Q,{...this.state,sanitizeHtml:this.sanitizeHtml}),t.createElement(J.A,{...this.state,setStartRank:this.setStartRank,hasFocus:this.hasFocus}))}}B.defaultProps={hash:"",jest:!1,hasModal:{filter:!1,sort:!1}};var X=B;class j{constructor(){this.selector=".profile-search",this.init()}init(){var o;this.$els=document.querySelectorAll(this.selector);const a=(o=document.querySelector(".profile-search--expert"))==null?void 0:o.getAttribute("data-expert");this.$els.forEach((i,p)=>{U.createRoot(i).render(t.createElement(X,{container:i,isExpert:a})),i.dataset.componentLoaded=!0})}}new j})}]);

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.