1"use strict";(self.hometalkChunk=self.hometalkChunk||[]).push([["notifications"],{32079(e,t,s){s.d(t,{A:()=>r});var i=s(73323),a=s(70533);function n(e,t){return this.api.list({...this.filters,limit:this.pageSize,page_num:e,offset:this.offset},t).then(t=>(this.pageData[e]=t,this.pageNum=e,this.totalItems=t.total_length,this.last_response=t,this.offset=this.pageSize*this.pageNum,this.finished=this.offset>=this.totalItems,t))}class o{constructor(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",o=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];"string"==typeof e&&(e=new a.Ay(e)),this.api=e,this.pageSize=t,this.filters=s,this.data_path=n,this.pageNum=i,this.totalItems=null,this.data=null,this.pageData={},this.offset=0,this.currentPageNumber=1,this.paginationId=0;const r=["entries","every","filter","find","findIndex","forEach","includes","indexOf","join","keys","lastIndexOf","map","reduce","reduceRight","slice","some","toLocaleString","toSource","toString","values"],l=(e,t)=>{let s=o?this.data:this.pageData[this.currentPageNumber];if(null===s)throw new Error("Data not loaded yet");return s[e](...t)};for(let a of r)this[a]=function(){return l(a,arguments)}}load(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.switchPage(this.pageNum,t,e,s)}switchPage(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=[];if(this.currentPageNumber=e,!t&&e in this.pageData&&1==s)return this.data=this.pageData[e],this.pageNum=e,Promise.resolve(this);for(let a=e;a<=s+e-1;a++)i.push(this.fetchData(a,t));return Promise.all(i).then(t=>{const i=t.reduce((e,t)=>this.data_path?e.concat(t[this.data_path]):e.concat(t),[]);return this.data=this.data&&this.data.concat(i)||i,this.data.link=t[t.length-1].link,this.data.total_length=t[t.length-1].total_length,this.finished=this.pageNum*this.pageSize>=this.data.total_length,this.lastPageLoaded=this.pageNum=e+s-1,this.paginationId=t[t.length-1].last_id,Promise.resolve(this)})}fetchData(e,t){return!t&&e in this.pageData?(this.data=this.pageData[e],this.pageNum=e,Promise.resolve(this)):n.call(this,e,this.data_path).then(e=>e)}get totalPages(){let e=Math.ceil(this.totalItems/this.pageSize);return e>1e4?1e4:e}first(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.switchPage(1,e)}get hasFirst(){return this.pageNum>1}prev(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.switchPage(this.pageNum-1,e)}get hasPrev(){return this.pageNum>1}next(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.switchPage(this.pageNum+1,e)}get hasNext(){return this.totalPages>this.pageNum}last(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.switchPage(this.totalPages,e)}get hasLast(){return this.totalPages>this.pageNum}getData(e){let t,s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t=this.data_path?(0,i.A)(e,this.data_path):e,s?this.removeDuplicateItems(t,s):t}removeDuplicateItems(e,t){if(!this.itemsIdentifiers){this.itemsIdentifiers={};for(let e=0;e<this.data.length;e++)this.itemsIdentifiers[this.data[e][t]]=1}return e.filter(e=>{const s=1===this.itemsIdentifiers[e[t]];return this.itemsIdentifiers[e[t]]=1,!s})}more(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.data&&this.data.link&&this.data.link.next||t&&!this.finished){let s=Object.keys(this.filters).map(e=>e+"="+this.filters[e]).join("&"),i=t?`api/${this.api.resource}?limit=${this.pageSize}&page_num=${parseInt(this.pageNum)+1}&last_id=${parseInt(this.paginationId)}&${s}`:this.data.link.next,a=new URL(i,window.location.href);return this.api.list(a.search.replace(/^\?/,""),this.data_path).then(s=>{const a=this.getData(s,e);return this.lastPageLoaded=this.pageNum=new URLSearchParams(i).get("page_num"),this.totalItems=s.total_length,this.data=this.data.concat(a),this.data.link=s.link,this.finished=t?0===s.length||s.length<this.pageSize:this.pageNum*this.pageSize>=parseInt(this.totalItems),this.lastDataLoad=s,this.paginationId=s.last_id,this})}}get hasMore(){return!!this.data&&!!this.data.link&&!!this.data.link.next}[Symbol.iterator](){if(null===this.data)throw new Error("Initial data not loaded yet");return(this.data||[]).values()}setData(e){return this.data=e,this}setPageNum(e){return this.pageNum=e,this}getArray(){return this.data}getCleanData(){let e=[...this.data];return delete e.link,delete e.total_length,delete e.last_id,e}resetFilters(e){this.filters=e,this.pageNum=1,this.totalItems=null,this.data=null,this.pageData={},this.offset=0,this.currentPageNumber=1}refresh(){return this.pageNum=1,this.totalItems=null,this.data=null,this.pageData={},this.offset=0,this.currentPageNumber=1,this.load(1,!0)}}const r=o},53473(e,t,s){s.d(t,{A:()=>h});var i=s(54705),a=s(96540),n=s.n(a),o=s(57908),r=s(90826),l=s(56848);class c extends n().Component{constructor(e){super(e),(0,i.A)(this,"expandText",()=>{var e=this.props.offSetTo;this.props.clickableSeeMore&&this.setState({showHiddenText:!0},()=>{this.props.handleClick&&l.XG.scrollTo("topText",{smooth:!0,offset:e})})}),this.state={showHiddenText:!1}}componentDidUpdate(e){this.props.text!==e.text&&this.setState({showHiddenText:!1})}htmlSubstr(e,t,s){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=!1;var n=document.createElement("div");function o(e,t){return t||e.nextSibling}return n.innerHTML=e,function e(t,s){var i=t.firstChild,n=null;do{n=null,n=null,"BR"!=i.nodeName&&"UL"!=i.nodeName&&"OL"!=i.nodeName||!a||(n=i.nextSibling,i.parentNode.removeChild(i)),3===i.nodeType?s(i):1===i.nodeType&&i.childNodes&&i.childNodes[0]&&e(i,s)}while(i=o(i,n))}(n,function(e){if(s>0){var n=e.data.length;if(t<=n?(e.data=e.substringData(t,n),t=0):(t-=n,e.data=""),n=e.data.length,(s-=n)<=0){var o=e.data.length+s+1;e.data=e.substringData(0,o);var r=e.data.lastIndexOf(" ");i.continueAfterSpaces&&r<o&&(r=e.data.length),e.data=e.substringData(0,r),a=!0}}else e.data="",a=!0}),n.innerHTML}visibleText(e){const{trimLimit:t,trimLines:s,trimOptions:i}=this.props;let a=this.htmlSubstr(e,0,t,i);return a=(0,o.UE)(a),i.removeLastBr&&(a=a.replace(/<br><\/(\w+)>$/,"</$1>")),i.removeAllBr&&(a=a.replace(/<br>/g," ")),void 0!==s&&(a=a.split("<br>").slice(0,s).join("<br>")),a}prepareHtml(e){let t=e.replace(/<!--(.*?)-->/g,"");return t=t.replace(/^\s+|\s+$/g,""),t}renderSeeMore(e,t){const{seeMore:s}=this.props;if(t.length<e.length){let e;return e="desktop"===r.A.getState().view.size?'<a href="javascript:" class="see_more text_spacing textControl arr sl-see-more"><i class="ics-ellipsis"></i></a>':'<a class="see_more text_spacing sl-see-more"><i class="ics-ellipsis fn"></i></a>',s&&(e=s),e}}render(){let{text:e}=this.props;if(!e)return null;const t=this.prepareHtml(e);e=(0,o.UE)(e);const s=t?this.visibleText(t):"";return"span"===this.props.elementName?this.state.showHiddenText?n().createElement("span",{dangerouslySetInnerHTML:{__html:e},className:this.props.className}):n().createElement(n().Fragment,null,n().createElement("span",{dangerouslySetInnerHTML:{__html:s},className:this.props.className}),s.length<t.length&&n().createElement("span",{onClick:this.expandText,dangerouslySetInnerHTML:{__html:this.renderSeeMore(t,s)}})):this.state.showHiddenText?n().createElement("b",{reset:"true",dangerouslySetInnerHTML:{__html:e},className:this.props.className}):n().createElement(n().Fragment,null,n().createElement("b",{reset:"true",dangerouslySetInnerHTML:{__html:s},className:this.props.className}),s.length<t.length&&n().createElement("b",{reset:"true",onClick:this.expandText,dangerouslySetInnerHTML:{__html:this.renderSeeMore(t,s)},className:this.props.className}))}}c.defaultProps={clickableSeeMore:!1,trimLimit:100,trimOptions:{}};const h=c},55220(e,t,s){s.r(t),s.d(t,{default:()=>O});var i=s(96540),a=s.n(i),n=s(91357),o=s(85182),r=s(5556),l=s.n(r);class c extends a().Component{render(){return a().createElement("div",{className:"loading-spinner-small"},a().createElement("div",{className:"small-spinner"},a().createElement("div",{className:"bar1"}),a().createElement("div",{className:"bar2"}),a().createElement("div",{className:"bar3"}),a().createElement("div",{className:"bar4"}),a().createElement("div",{className:"bar5"}),a().createElement("div",{className:"bar6"}),a().createElement("div",{className:"bar7"}),a().createElement("div",{className:"bar8"}),a().createElement("div",{className:"bar9"}),a().createElement("div",{className:"bar10"}),a().createElement("div",{className:"bar11"}),a().createElement("div",{className:"bar12"})))}}const h=c;var m=s(29967);class p extends a().Component{render(){return a().createElement("span",{className:`load-more-button relative ${this.props.loading?m.A.LANG.notifications.loading:""}`},a().createElement("a",{onClick:this.props.loadMore,className:"button neutral-button ","data-ht-track":JSON.stringify({action:"Load More",element_zone:this.props.groupName+" Notifications"})},"Load more"),this.props.loading&&a().createElement(h,null))}}p.defaultProps={loadMore:()=>{}},p.propTypes={loadMore:l().func.isRequired};const d=p;var u=s(54705),g=s(53473),f=s(44171),N=s(58168),v=s(40961);class b extends i.Component{render(){const{children:e,className:t,...s}=this.props;return s.className=`dropdown-trigger ${t}`,a().createElement("div",s,e)}}b.propTypes={children:l().node,className:l().string},b.defaultProps={className:""};const E=b;class _ extends i.Component{render(){const{children:e,className:t,...s}=this.props;return s.className=`dropdown-content ${t}`,a().createElement("div",s,e)}}
1_.propTypes={children:l().node,className:l().string},_.defaultProps={className:""};const w=_;class y extends i.Component{componentDidMount(){window.addEventListener("click",this.onWindowClick),window.addEventListener("touchstart",this.onWindowClick)}componentWillUnmount(){window.removeEventListener("click",this.onWindowClick),window.removeEventListener("touchstart",this.onWindowClick)}componentDidUpdate(e){this.props.forceClose!==e.forceClose&&this.props.forceClose&&this.hide()}constructor(e){super(e),(0,u.A)(this,"onWindowClick",e=>{const t=(0,v.findDOMNode)(this);e.target!==t&&!t.contains(e.target)&&this.isActive()&&this.hide()}),(0,u.A)(this,"onToggleClick",e=>{e.preventDefault(),this.isActive()?this.hide():this.show()}),this.state={active:!1}}isActive(){return"boolean"==typeof this.props.active?this.props.active:this.state.active}hide(){this.setState({active:!1},()=>{this.props.onHide&&this.props.onHide()})}show(){this.setState({active:!0},()=>{this.props.onShow&&this.props.onShow()})}render(){const{children:e,className:t,disabled:s,removeElement:n}=this.props,o=this.isActive(),r=`dropdown ${o?"dropdown-active":""} ${s?"dropdown-disabled":""}`,l=a().Children.map(e,e=>{if(e.type===E){const t=e.props.onClick;e=(0,i.cloneElement)(e,{ref:"trigger",onClick:i=>{s||(this.onToggleClick(i),t&&t.apply(e,arguments))}})}else e.type===w&&(e=n&&!o?null:(0,i.cloneElement)(e,{ref:"content",style:{display:o?"block":"none"}}));return e}),c={...this.props};return delete c.active,delete c.onShow,delete c.onHide,delete c.removeElement,delete c.forceClose,a().createElement("div",(0,N.A)({},c,{className:`${r} ${t}`}),l)}}y.propTypes={disabled:l().bool,active:l().bool,onHide:l().func,onShow:l().func,children:l().node,className:l().string,removeElement:l().bool,style:l().object},y.defaultProps={className:""};const k=y;var A=s(10029),x=s(50233);class S extends i.Component{render(){let e=this.props.triggerType.length?this.props.triggerType:"";return a().createElement(k,{onShow:this.props.onShow,onHide:this.props.onHide,forceClose:this.props.forceClose,className:`actions-dropdown-component ${this.props.className}`},a().createElement(E,{className:`dropdown-toggle ${this.props.isActive?"clicked":""} ${"flagTriggerDisabled"==e?"disabled":""}`},"regularTrigger"===e&&a().createElement("a",{className:"sl-dropdown"},a().createElement("i",{className:"ics-ellipsis fs20"})),("flagTrigger"===e||"flagTriggerDisabled"===e)&&a().createElement("a",{"data-ht-track":"Flag Report",className:"flag-ddown sl-dropdown"},a().createElement("i",{className:"ics-flag"}))),a().createElement(w,null,a().createElement("div",{className:"dropdown-list notHidden","data-tr_zone":"dropdown_actions"},this.props.children)))}}S.defaultProps={triggerType:"regularTrigger",className:""};const L=(0,x.Ng)(null,e=>({onLightBoxOpen:t=>e({type:"OPEN_LIGHT_BOX",content:t})}))((0,A.g_)(S));class T extends a().Component{constructor(e){super(e),(0,u.A)(this,"onShow",()=>{this.setState({isActive:!0})}),(0,u.A)(this,"onHide",()=>{this.setState({isActive:!1})}),this.state={isActive:!1}}render(){return a().createElement(n.A,null,a().createElement(L,{onShow:this.onShow,onHide:this.onHide,isActive:this.state.isActive},a().createElement("ul",null,a().createElement(a().Fragment,null,a().createElement("li",null,a().createElement("a",{href:"javascript:",onClick:()=>{this.props.unsubscribeFromNotification()},className:"ddown-link"},a().createElement("i",{className:"ics-minus"}),a().createElement("span",{className:"ddown-label"},m.A.LANG.notifications.unsubscribe))),a().createElement("li",null,a().createElement("a",{href:"javascript:",onClick:()=>this.props.deleteNotification(),className:"ddown-link"},a().createElement("i",{className:"ics-trash"}),a().createElement("span",{className:"ddown-label"},m.A.LANG.notifications.delete_notification)))))))}}const C=T;class D extends a().Component{constructor(e){super(e),(0,u.A)(this,"deleteNotification",()=>{(0,f.default)("Delete - Click Element",{element_type:"Delete",element_zone:this.props.groupName+" Notifications"}),o.A.delete("",{id:this.props.notification.id}).then(e=>{this.setState({deleted:!0}
1)})}),(0,u.A)(this,"unsubscribeFromNotification",()=>{(0,f.default)("Unsubscribe - Click Element",{element_type:"Unsubscribe",element_zone:this.props.groupName+" Notifications"}),o.A.delete(this.props.notification.id+"/subscribe",{}).then(e=>{this.setState({deleted:!0})})}),this.state={read:!1,deleted:!1},this.link=this.getLink()}componentDidMount(){this.setState({read:this.props.notification.is_read})}componentDidUpdate(e,t,s){this.props.notification.is_read!==e.notification.is_read&&this.setState({read:this.props.notification.is_read})}getLink(){let e,t=this.props.notification,s="";return"discussion_reply"===t.action&&(e=t.link.match(/([\d.]+)\/([^?]+)\?(scid|cid)=([\d.]+)+&(scid|cid)=([\d.]+)/))?s=e[1]+"/"+e[2]+"?scid="+e[4]+"#c-"+e[6]:(e=t.link.match(/([\d.]+)\/([^?]+)\?(scid|cid)=([\d.]+)/))&&(s=e[1]+"/"+e[2]+"?"+e[3]+"="+e[4]+"#c-"+e[4]),s||t.link}actionText(){let e="";switch(this.props.notification.action){case"discussion_reply":e="comment"===this.props.notification.object_type?"reply-comment-discussion-other":"reply-comment-discussion-yours";break;case"comment":e="discussion"===this.props.notification.object_type?"comment-discussion":"comment-project";break;case"comment_reply":e="comment"===this.props.notification.object_type?"reply-comment-project-other":"reply-comment-project-yours";break;case"comment_question":e="question-project";break;case"comment_question_reply":e="answer-project";break;case"clip":e="clip";break;case"like":e="answer"===this.props.notification.object_type?"like-answer":"project"===this.props.notification.object_type?"wowed":"like-comment";break;case"diysession":e="diy-session"}return{"reply-comment-discussion-other":m.A.LANG.notifications.reply_comment_discussion_other,"reply-comment-discussion-yours":m.A.LANG.notifications.reply_comment_discussion_yours,"comment-discussion":m.A.LANG.notifications.comment_discussion,"comment-project":m.A.LANG.notifications.comment_project,"reply-comment-project-other":m.A.LANG.notifications.reply_comment_project_other,"reply-comment-project-yours":m.A.LANG.notifications.reply_comment_project_yours,"question-project":m.A.LANG.notifications.question_project,"answer-project":m.A.LANG.notifications.answer_project,clip:m.A.LANG.notifications.clip,"like-comment":m.A.LANG.notifications.like_comment,"like-answer":m.A.LANG.notifications.like_answer,wowed:m.A.LANG.notifications.wowed}[e]}clickNotification(){(0,f.default)("Notifications",{element_type:"Notifications",element_zone:this.props.groupName+" Notifications"}),o.A.updateFromPath("notifications/",{id:this.props.notification.id}).then(e=>{this.setState({read:!0}),window.location.href=this.link})}render(){let e=this.props.notification;return a().createElement(a().Fragment,null,!this.state.deleted&&a().createElement("div",{className:"relative"},"diysession"!==e.action&&a().createElement(C,{deleteNotification:this.deleteNotification,unsubscribeFromNotification:this.unsubscribeFromNotification}),a().createElement("a",{className:"single-ntf flexbox flex-row "+(this.state.read?"read":""),onClick:()=>this.clickNotification()},2e3!==e.members.first.id&&a().createElement("img",{src:e.members.first.profile_photo+"?size=50x50",width:"43",height:"43",className:"avatar"}),a().createElement("div",{className:"body"},a().createElement("b",null,e.members.first.name)," ",e.members.count>1&&a().createElement("b",null,"& ",e.members.count-1," other",e.members.count>2&&a().createElement("span",null,"s")),"diysession"===e.action?a().createElement("p",null,"sent you ",e.num_actions," ",a().createElement("b",null,"message",1==e.num_actions?""
1:"s")):a().createElement("p",null,this.actionText()," ",a().createElement("b",null,'"',a().createElement(g.A,{text:e.object.text?e.object.text:e.object.summary,trimLimit:45,seeMore:"..."}),'"')),a().createElement("div",{className:"footer"},a().createElement("span",{className:"timestamp nowrap"},e.relativeTime))))))}}D.defaultProps={notification:{}},D.propTypes={notification:l().object};const j=D;var P=s(32079),I=s(46894),G=s.n(I);class M extends a().Component{constructor(e){super(e),this.state={notifications:[],firstLoad:!1,nextPagination:1,total_items:null}}componentDidMount(){this.paginator=new P.A(o.A.apiPath,7,{group:this.props.group.name}),this.loadNotifications()}componentDidUpdate(e,t,s){this.props.group.name!==e.group.name&&this.loadNotifications()}loadNotifications(){this.setState({loading:!0}),null==this.state.total_items?this.paginator.load(1,!0).then(e=>{this.setState({notifications:G()(this.state.notifications,{$set:e.data}),total_items:e.totalItems,firstLoad:!1,loading:!1})}):this.paginator.more().then(e=>{this.setState({notifications:G()(this.state.notifications,{$set:e.data}),loading:!1})})}render(){return this.props.group,a().createElement(a().Fragment,null,null==this.state.total_items?a().createElement("div",null,m.A.LANG.notifications.loading):a().createElement(a().Fragment,null,this.state.notifications.length?a().createElement(a().Fragment,null,this.state.notifications.map(e=>a().createElement(j,{notification:e,key:e.id,groupName:this.props.group.name})),this.state.total_items>this.state.notifications.length&&a().createElement(d,{loading:this.state.loading,loadMore:()=>this.loadNotifications(),groupName:this.props.group.name})):a().createElement("div",{className:"flexbox flex-column empty-tab"},a().createElement("div",{className:"flexbox w100 flex-column fs17 flex-align-center"},a().createElement("div",{className:"mp-illustrations jar-empty"}),a().createElement("p",null,m.A.LANG.notifications.empty_jar)))))}}M.defaultProps={group:{}},M.propTypes={group:l().object};const H=M;var $=s(98999),z=s(76681);class F extends a().Component{constructor(e){super(e),this.state={groups:[],currentGroup:null}}componentDidMount(){o.A.getGroups().then(e=>{this.setState({groups:e,currentGroup:e[0]})}),this.props.onSetMetaData({cssClass:"notifications-page",pageType:z.A.notifications,meta:{name:{robots:"noindex, nofollow"}}})}switchTab(e,t){e!==this.state.currentGroup&&(this.setState({currentGroup:e}),e.count>0&&(o.A.markGroupAsRead(e.name).then(e=>{const s=G()(this.state.groups,{[t]:{count:{$set:0}}});this.setState({groups:s})}),(0,$.NO)(G()(this.props.member,{notifications_count:{$set:this.props.member.notifications_count-e.count}}))))}render(){return a().createElement(n.A,null,a().createElement("div",{className:"notifications-page-wrap"},a().createElement("div",{className:"container-wrap innerwrap height-full"},a().createElement("div",{className:"ntf-tablinks-inline"},a().createElement("ul",null,this.state.groups.map((e,t)=>a().createElement("li",{key:t},a().createElement("a",{onClick:()=>this.switchTab(e,t),className:e.name===this.state.currentGroup.name?"selected":"","data-ht-track":JSON.stringify({action:e.name+" Tab",element_zone:this.state.currentGroup.name+" Notifications"})},Boolean(e.count)&&a().createElement("i",{className:"ics-notification"}),e.name))))),a().createElement("div",{className:"ntf-wrapper"},this.state.groups.map((e,t)=>a().createElement(a().Fragment,{key:t},a().createElement("div",{className:"ntf-tab-content "+(e.name===this.state.currentGroup.name?"expanded-tab":"")},e.name===this.state.currentGroup.name&&a().createElement(H,{group:this.state.currentGroup}))))))))}}const O=F}}]);
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.