Version Description
- 2022-11-22 =
- Improved: when editing a list, you can choose if it should be shown on the Manage Subscription page (on by default);
- Improved: form templates now link to existing Privacy Page;
- Changed: [subscriber:count] shortcode now counts only subscribed subscribers (and not unconfirmed or inactive);
- Fixed: automations beta badge overflows menu in some languages;
- Fixed: failing to create automation tables with "Base table or view already exists" in rare cases;
- Fixed: displaying wrong tasks in System Status.
Download this release
Release Info
Developer | MailPoet |
Plugin | MailPoet Newsletters (New) |
Version | 4.0.1 |
Comparing to | |
See all releases |
Code changes from version 4.0.0 to 4.0.1
- assets/dist/js/admin.js +1 -1
assets/dist/js/admin.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
/*! For license information please see admin.js.LICENSE.txt */
|
2 |
-
(self.webpackChunkMailPoet3=self.webpackChunkMailPoet3||[]).push([[328],{49868:function(){jQuery.AsyncQueue=function(){var e,t,n,r,a=this,s=[],o=!1;return r=function(){var e=s.shift();e?(e.apply(a,[a]),!1===o&&r()):t&&t.apply(a)},this.onFailure=function(t){e=t},this.onComplete=function(e){t=e},this.add=function(e){return s.push(e),this},this.storeData=function(e){return n=e,this},this.lastCallbackData=function(){return n},this.run=function(){o=!1,r()},this.pause=function(){return o=!0,this},this.failure=function(){if(o=!0,e){var t=[a];for(i=0;i<arguments.length;i++)t.push(arguments[i]);e.apply(a,t)}},this}},80640:function(e,t,n){"use strict";var r={};n.r(r),n.d(r,{canUseWooSubscriptions:function(){return _i},findFiltersValueForSegment:function(){return Oi},getAvailableFilters:function(){return Ai},getCustomFieldsList:function(){return Ii},getErrors:function(){return Ei},getMembershipPlans:function(){return xi},getNewslettersList:function(){return wi},getProductCategories:function(){return yi},getProducts:function(){return gi},getSegment:function(){return Ci},getSegmentFilter:function(){return Di},getStaticSegmentsList:function(){return Ti},getSubscriberCount:function(){return ki},getSubscriptionProducts:function(){return vi},getTags:function(){return Ni},getWooCommerceCountries:function(){return Si},getWooCommerceCurrencySymbol:function(){return ji},getWordpressRoles:function(){return bi}});var a={};n.r(a),n.d(a,{handleSave:function(){return zi},pageLoaded:function(){return Hi},setErrors:function(){return Ui},setSegment:function(){return $i},updateSegment:function(){return Zi},updateSegmentFilter:function(){return Vi},updateSegmentFilterFromEvent:function(){return Yi},updateSegmentFromEvent:function(){return Wi},updateSubscriberCount:function(){return Bi}});var s={};n.r(s),n.d(s,{LOAD_SEGMENT:function(){return Ki},SAVE_SEGMENT:function(){return Qi}});var i=n(64151),o=n(75774),l=n(42676),c=n(65443),d=n.n(c),u=n(65311),p=n.n(u),m=n(39519),h=n.n(m),f=n(93878),g=n(18490),x=n(62668),v=n(69156),b=n(26138),y=n(49231),w=n(35614),_=(n(16381),n(20264));class j extends y.Component{constructor(e){super(e),(0,b.Z)(this,"getFieldId",(e=>{const t=e||this.props;return t.field.id||t.field.name})),(0,b.Z)(this,"getSelectedValues",(()=>{if(void 0!==this.props.field.selected)return this.props.field.selected(this.props.item);if(void 0!==this.props.item&&void 0!==this.props.field.name){if(!this.allowMultipleValues())return this.props.item[this.props.field.name];if(w.ZP.isArray(this.props.item[this.props.field.name]))return this.props.item[this.props.field.name].map((e=>e.id))}return null})),(0,b.Z)(this,"getItems",(()=>{let e;return void 0!==window[`mailpoet_${this.props.field.endpoint}`]?e=window[`mailpoet_${this.props.field.endpoint}`]:void 0!==this.props.field.values&&(e=this.props.field.values),w.ZP.isArray(e)&&void 0!==this.props.field.filter&&(e=e.filter(this.props.field.filter)),e})),(0,b.Z)(this,"getLabel",(e=>void 0!==this.props.field.getLabel?this.props.field.getLabel(e,this.props.item):e.name)),(0,b.Z)(this,"getSearchLabel",(e=>void 0!==this.props.field.getSearchLabel?this.props.field.getSearchLabel(e,this.props.item):null)),(0,b.Z)(this,"getValue",(e=>void 0!==this.props.field.getValue?this.props.field.getValue(e,this.props.item):e.id)),(0,b.Z)(this,"getCount",(e=>void 0!==this.props.field.getCount?this.props.field.getCount(e,this.props.item):null)),(0,b.Z)(this,"getTag",(e=>void 0!==this.props.field.getTag?this.props.field.getTag(e,this.props.item):null)),(0,b.Z)(this,"setupSelect2",(()=>{if(this.isSelect2Initialized())return;const e=e=>{let t="";return e.tag&&(t+=`<span class="mailpoet-form-select2-tag">${e.tag}</span>`),t+=`<span class="mailpoet-form-select2-text"><span>${e.text}</span></span>`,e.count&&(t+=`<span class="mailpoet-form-select2-count">${e.count}</span>`),t};let t={disabled:this.props.disabled||!1,width:this.props.width||"",placeholder:{id:"",text:this.props.field.placeholder},dropdownCssClass:"mailpoet-form-select2-dropdown",escapeMarkup:e=>e,templateResult:e,templateSelection:e};const n=this.props.field.remoteQuery||null;if(n)t=Object.assign(t,{ajax:{url:window.ajaxurl,type:"POST",dataType:"json",data:function(e){return{action:"mailpoet",api_version:window.mailpoet_api_version,token:window.mailpoet_token,endpoint:n.endpoint,method:n.method,data:Object.assign(n.data,{query:e.term})}},processResults:function(e){let t;return t=w.ZP.has(e,"data")?e.data.map((e=>({id:e.id||e.value,text:e.name||e.text}))):[],{results:t}}},minimumInputLength:n.minimumInputLength||2});else if(void 0!==this.props.field.getCount||void 0!==this.props.field.getTag){const e=this.getItems(this.props.field);let n=this.getSelectedValues()||[];Array.isArray(n)||(n=[n]);const r=e.map((e=>{const t=this.getValue(e);return{id:t,tag:this.getTag(e),text:this.getLabel(e),count:this.getCount(e),selected:n.indexOf(t)>-1}}));t=Object.assign(t,{data:r})}void 0!==this.props.field.extendSelect2Options&&(t=Object.assign(t,this.props.field.extendSelect2Options));const r=p()(`#${this.selectRef.current.id}`).select2(t);let a=!1;r.on("select2:unselecting",(()=>{a=!0})),r.on("select2:opening",(e=>{!0===a&&(a=!1,e.preventDefault())})),r.on("change",this.handleChange)})),(0,b.Z)(this,"resetSelect2",(()=>{this.destroySelect2(),this.setupSelect2()})),(0,b.Z)(this,"destroySelect2",(()=>{this.isSelect2Initialized()&&(p()(`#${this.selectRef.current.id}`).select2("destroy"),this.cleanupAfterSelect2())})),(0,b.Z)(this,"cleanupAfterSelect2",(()=>{p()(`#${this.selectRef.current.id}`).find("option:not(.default)").remove(),p()(`#${this.selectRef.current.id}`).off("select2:unselecting").off("select2:opening")})),(0,b.Z)(this,"allowMultipleValues",(()=>!0===this.props.field.multiple)),(0,b.Z)(this,"isSelect2Initialized",(()=>!0===p()(`#${this.selectRef.current.id}`).hasClass("select2-hidden-accessible"))),(0,b.Z)(this,"isSelect2Component",(()=>this.allowMultipleValues()||this.props.field.forceSelect2)),(0,b.Z)(this,"handleChange",(e=>{if(void 0===this.props.onValueChange)return;const t=p()(`#${this.selectRef.current.id}`).children(":selected").map((function(){return{id:p()(this).val(),text:p()(this).text()}})),n=this.props.field.multiple?w.ZP.pluck(t,"id"):w.ZP.pluck(t,"id").toString(),r=this.transformChangedValue(n,t);this.props.onValueChange({target:{value:r,name:this.props.field.name,id:e.target.id}})})),(0,b.Z)(this,"transformChangedValue",((e,t)=>"function"==typeof this.props.field.transformChangedValue?this.props.field.transformChangedValue.call(this,e,t):e)),(0,b.Z)(this,"insertEmptyOption",(()=>{if(!this.allowMultipleValues())return this.props.field.placeholder?(0,_.jsx)("option",{className:"default"}):void 0})),this.selectRef=(0,y.createRef)()}componentDidMount(){this.isSelect2Component()&&this.setupSelect2()}componentDidUpdate(e){void 0!==this.props.item&&void 0!==e.item&&this.props.item.id!==e.item.id&&p()(`#${this.selectRef.current.id}`).val(this.getSelectedValues()).trigger("change"),this.isSelect2Initialized()&&this.getFieldId(this.props)!==this.getFieldId(e)&&void 0!==this.props.field.resetSelect2OnUpdate&&this.resetSelect2()}componentWillUnmount(){this.isSelect2Component()&&this.destroySelect2()}render(){const e=this.getItems(this.props.field),t=this.getSelectedValues(),n=e.map((e=>{const t=this.getLabel(e),n=this.getSearchLabel(e),r=this.getValue(e);return(0,_.jsx)("option",{className:"default",value:r,title:n,children:t},`option-${e.id}`)}));return(0,_.jsx)("div",{className:"mailpoet-form-select mailpoet-form-input",children:(0,_.jsxs)("select",{id:this.getFieldId(),ref:this.selectRef,disabled:this.props.field.disabled,"data-placeholder":this.props.field.placeholder,multiple:this.props.field.multiple,defaultValue:t,...this.props.field.validation,children:[this.insertEmptyOption(),n]})})}}j.propTypes={onValueChange:h().func,field:h().shape({name:h().string.isRequired,values:h().oneOfType([h().object,h().array]),getLabel:h().func,resetSelect2OnUpdate:h().bool,selected:h().func,endpoint:h().string,filter:h().func,getSearchLabel:h().func,getValue:h().func,getCount:h().func,getTag:h().func,placeholder:h().string,remoteQuery:h().object,extendSelect2Options:h().object,multiple:h().bool,forceSelect2:h().bool,transformChangedValue:h().func,disabled:h().bool,validation:h().shape({"data-parsley-required":h().bool,"data-parsley-required-message":h().string,"data-parsley-type":h().string,"data-parsley-errors-container":h().string,maxLength:h().number})}).isRequired,item:h().object,disabled:h().bool,width:h().string},j.defaultProps={onValueChange:function(){},disabled:!1,width:"",item:void 0};var S=n(34352),I=n.n(S),C=n(20360);function T(){if(!x.x.subscribersLimitReached)return null;const e=x.x.hasValidApiKey,t=x.x.I18n.t("subscribersLimitNoticeTitle").replace("[subscribersLimit]",x.x.subscribersLimit),n=x.x.I18n.t(e?"yourPlanLimit":"freeVersionLimit").replace("[subscribersLimit]",x.x.subscribersLimit),r=e?x.x.MailPoetComUrlFactory.getUpgradeUrl(x.x.pluginPartialKey):x.x.MailPoetComUrlFactory.getPurchasePlanUrl(x.x.subscribersCount+1),a=I()(x.x.I18n.t("youCanDisableWPUsersList"),/\[link](.*?)\[\/link]/g,(e=>(0,_.jsx)("a",{href:"?page=mailpoet-segments",children:e},"goToSegments")));return(0,_.jsxs)(C.q,{type:"error",timeout:!1,closable:!1,renderInPlace:!0,children:[(0,_.jsx)("h3",{children:t}),(0,_.jsxs)("p",{children:[n," ",x.x.I18n.t("youNeedToUpgrade"),"active"===x.x.wpSegmentState?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("br",{}),a]}):null]}),(0,_.jsxs)("p",{children:[(0,_.jsx)("a",{target:"_blank",rel:"noopener noreferrer",className:"button button-primary",href:r,children:x.x.I18n.t("upgradeNow")}),e&&(0,_.jsxs)(_.Fragment,{children:[" ",(0,_.jsx)("button",{type:"button",className:"button",onClick:async()=>{await x.x.Ajax.post({api_version:x.x.apiVersion,endpoint:"services",action:"recheckKeys"}),window.location.reload()},children:x.x.I18n.t("refreshMySubscribers")})]})]})]})}function k(e){let{mssKeyInvalid:t,subscribersCount:n}=e;return t?(0,_.jsxs)(C.q,{type:"error",timeout:!1,closable:!1,renderInPlace:!0,children:[(0,_.jsx)("h3",{children:x.x.I18n.t("allSendingPausedHeader")}),(0,_.jsx)("p",{children:I()(x.x.I18n.t("allSendingPausedBody"),/\[link\](.*?)\[\/link\]/g,(e=>(0,_.jsx)("a",{href:"?page=mailpoet-settings#premium",children:e},"check-sending")))}),(0,_.jsx)("p",{children:(0,_.jsx)("a",{href:`https://account.mailpoet.com?s=${n}`,className:"button button-primary",target:"_blank",rel:"noopener noreferrer",children:x.x.I18n.t("allSendingPausedLink")})})]}):null}var N=n(46838);function D(){if(!x.x.emailVolumeLimitReached)return null;const e=x.x.I18n.t("emailVolumeLimitNoticeTitle").replace("[emailVolumeLimit]",x.x.emailVolumeLimit),t=x.x.I18n.t("youReachedEmailVolumeLimit").replace("[emailVolumeLimit]",x.x.emailVolumeLimit),n=x.x.MailPoetComUrlFactory.getUpgradeUrl(x.x.pluginPartialKey),r=new Date,a=new Date(r.getFullYear(),r.getMonth()+1,1);let s=I()(x.x.I18n.t("toContinueUpgradeYourPlanOrWaitUntil"),/\[link](.*?)\[\/link]/g,(e=>(0,_.jsx)("a",{target:"_blank",rel:"noreferrer",href:n,children:e},e)));return s=I()(s,/<b>\[date]<\/b>\./g,(()=>(0,N.ZP)(`<b>${x.x.Date.short(a)}</b>.`))),(0,_.jsxs)(C.q,{type:"error",timeout:!1,closable:!1,renderInPlace:!0,children:[(0,_.jsx)("h3",{children:e}),(0,_.jsxs)("p",{children:[t,(0,_.jsx)("br",{}),s]}),(0,_.jsxs)("p",{children:[(0,_.jsx)("a",{target:"_blank",rel:"noopener noreferrer",className:"button button-primary",href:n,children:x.x.I18n.t("upgradeNow")})," ",(0,_.jsx)("button",{type:"button",className:"button",onClick:async()=>{await x.x.Ajax.post({api_version:x.x.apiVersion,endpoint:"services",action:"recheckKeys"}),window.location.reload()},children:x.x.I18n.t("refreshMyEmailVolumeLimit")})]})]})}var E=n(13763);function A(e){let{cacheCalculation:t}=e;const[n,r]=(0,y.useState)(!1),[a,s]=(0,y.useState)([]),i=(new Date).getTime()-new Date(t).getTime(),o=Math.floor(i/1e3/60);return(0,_.jsxs)("div",{className:"mailpoet-subscribers-cache-notice",children:[I()(x.x.I18n.t("subscribersCountWereCalculatedWithMinutesAgo"),/<abbr>(.*?)<\/abbr>/,((e,n)=>(0,_.jsx)("abbr",{title:t,children:e.replace(/(\{\$mins\}|\$mins)/i,String(o))},n))),(0,_.jsx)(E.z,{className:"mailpoet-subscribers-cache-notice-button",type:"button",variant:"secondary",dimension:"small",onClick:()=>{r(!0),x.x.Ajax.post({api_version:x.x.apiVersion,endpoint:"settings",action:"recalculateSubscribersCountsCache"}).done((()=>{window.location.reload()})).fail((e=>{s(e.errors.map((e=>e.message))),r(!1)}))},withSpinner:n,children:x.x.I18n.t("recalculateNow")}),(0,_.jsx)("div",{className:"mailpoet-gap"}),a.length>0&&(0,_.jsx)(C.q,{type:"error",children:a.map((e=>(0,_.jsx)("p",{children:e},e)))})]})}var O=n(58996);function R(e){let{subscribersInPlan:t,subscribersInPlanLimit:n}=e;if(!1===t)return null;const r=n?(0,_.jsx)("b",{children:x.x.I18n.t("subscribersInPlanCount").replace("%1$d",t.toLocaleString()).replace("%2$d",n.toLocaleString())},"subscribers_count"):(0,_.jsx)("b",{children:t},"subscribers_count");return(0,_.jsxs)("div",{className:"mailpoet-subscribers-in-plan",children:[I()(x.x.I18n.t("subscribersInPlan"),"%s",(()=>r))," ",(0,_.jsx)(O.Tooltip,{tooltip:x.x.I18n.t("subscribersInPlanTooltip"),place:"right"}),(0,_.jsx)("span",{className:"mailpoet-subscribers-in-plan-spacer",children:" "})]})}var P=n(16751);function M(e){let{id:t,engagementScore:n}=e;const r={unknown:{name:x.x.I18n.t("unknownBadgeName"),type:"unknown",tooltipTitle:x.x.I18n.t("unknownBadgeTooltip"),tooltipText:x.x.I18n.t("tooltipUnknown")},excellent:{name:x.x.I18n.t("excellentBadgeName"),type:"excellent",tooltipTitle:x.x.I18n.t("excellentBadgeTooltip"),tooltipText:x.x.I18n.t("tooltipExcellent")},good:{name:x.x.I18n.t("goodBadgeName"),type:"good",tooltipTitle:x.x.I18n.t("goodBadgeTooltip"),tooltipText:x.x.I18n.t("tooltipGood")},average:{name:x.x.I18n.t("averageBadgeName"),type:"average",tooltipTitle:x.x.I18n.t("averageBadgeTooltip"),tooltipText:x.x.I18n.t("tooltipAverage")}},a=`badge-${t}`;let s;s=null==n?r.unknown:n<20?r.average:n<50?r.good:r.excellent;const i=(0,_.jsxs)("div",{children:[(0,_.jsx)("div",{className:"mailpoet-listing-stats-tooltip-title",children:s.tooltipTitle.toUpperCase()}),(0,_.jsx)("div",{className:"mailpoet-listing-stats-tooltip-description",children:x.x.I18n.t("engagementScoreDescription")}),(0,_.jsxs)("div",{className:"mailpoet-listing-stats-tooltip-content",children:[(0,_.jsx)(P.C,{type:"unknown",name:x.x.I18n.t("unknownBadgeName")})," : ",r.unknown.tooltipText,(0,_.jsx)("br",{}),(0,_.jsx)(P.C,{type:"excellent",name:x.x.I18n.t("excellentBadgeName")})," : ",r.excellent.tooltipText,(0,_.jsx)("br",{}),(0,_.jsx)(P.C,{type:"good",name:x.x.I18n.t("goodBadgeName")})," : ",r.good.tooltipText,(0,_.jsx)("br",{}),(0,_.jsx)(P.C,{type:"average",name:x.x.I18n.t("averageBadgeName")})," : ",r.average.tooltipText]})]},`tooltip-${a}`);return(0,_.jsxs)("div",{className:"mailpoet-listing-stats-opened-clicked",children:[null!=n&&(0,_.jsxs)("div",{className:"mailpoet-listing-stats-percentages",children:[n.toLocaleString(void 0,{minimumFractionDigits:1,maximumFractionDigits:1}),"%"]}),(0,_.jsx)("div",{children:(0,_.jsx)(P.C,{isInverted:!0,type:s.type,name:s.name,tooltip:i,tooltipId:a,tooltipPlace:"top"})})]})}var L=n(33684),F=n(4445);function q(e){let{location:t}=e;return(0,_.jsxs)(L.Q,{children:[(0,_.jsxs)(o.Link,{className:"mailpoet-button button-secondary",to:{pathname:"/new",state:{backUrl:null==t?void 0:t.pathname}},children:[F.R,(0,_.jsx)("span",{"data-automation-id":"add-new-subscribers-button",children:x.x.I18n.t("new")})]}),(0,_.jsx)("a",{className:"mailpoet-button not-small-screen button-secondary",href:"?page=mailpoet-import","data-automation-id":"import-subscribers-button",children:x.x.I18n.t("import")}),(0,_.jsx)("a",{id:"mailpoet_export_button",className:"mailpoet-button not-small-screen button-secondary",href:"?page=mailpoet-export",children:x.x.I18n.t("export")})]})}q.propTypes={location:h().object.isRequired};const $=(0,l.EN)(q),U=x.x.trackingConfig.emailTrackingEnabled,Z=[{name:"email",label:x.x.I18n.t("subscriber"),sortable:!0},{name:"status",label:x.x.I18n.t("status"),sortable:!0},{name:"segments",label:x.x.I18n.t("lists")},{name:"tags",label:x.x.I18n.t("tags")},{name:"statistics",label:x.x.I18n.t("statisticsColumn"),display:U},{name:"created_at",label:x.x.I18n.t("subscribedOn"),sortable:!0}],V={onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneSubscriberTrashed"):x.x.I18n.t("multipleSubscribersTrashed").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneSubscriberDeleted"):x.x.I18n.t("multipleSubscribersDeleted").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneSubscriberRestored"):x.x.I18n.t("multipleSubscribersRestored").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onNoItemsFound:e=>"bounced"===e&&!window.mailpoet_premium_active&&!window.mailpoet_mss_active&&(0,_.jsxs)("div",{children:[(0,_.jsx)("p",{children:x.x.I18n.t("bouncedSubscribersHelp")}),(0,_.jsx)("p",{children:(0,_.jsx)("a",{href:"admin.php?page=mailpoet-upgrade",className:"button-primary",children:x.x.I18n.t("bouncedSubscribersPremiumButtonText")})})]})},W=(e,t,n,r)=>(0,_.jsxs)(v.u,{title:r,onRequestClose:t,isDismissible:!0,children:[(0,_.jsx)(j,{field:n}),(0,_.jsx)("span",{className:"mailpoet-gap-half"}),(0,_.jsx)(f.Button,{onClick:e,dimension:"small",variant:"secondary",children:x.x.I18n.t("apply")})]}),Y=[{name:"moveToList",label:x.x.I18n.t("moveToList"),onSelect:function(e,t){return W(e,t,{id:"move_to_segment",name:"move_to_segment",endpoint:"segments",filter:function(e){return!(e.deleted_at||"default"!==e.type)}},x.x.I18n.t("moveToList"))},getData:function(){return{segment_id:Number(p()("#move_to_segment").val())}},onSuccess:function(e){x.x.Notice.success(x.x.I18n.t("multipleSubscribersMovedToList").replace("%1$d",Number(e.meta.count).toLocaleString()).replace("%2$s",e.meta.segment))}},{name:"addToList",label:x.x.I18n.t("addToList"),onSelect:function(e,t){return W(e,t,{id:"add_to_segment",name:"add_to_segment",endpoint:"segments",filter:function(e){return!(e.deleted_at||"default"!==e.type)}},x.x.I18n.t("addToList"))},getData:function(){return{segment_id:Number(p()("#add_to_segment").val())}},onSuccess:function(e){x.x.Notice.success(x.x.I18n.t("multipleSubscribersAddedToList").replace("%1$d",Number(e.meta.count).toLocaleString()).replace("%2$s",e.meta.segment))}},{name:"removeFromList",label:x.x.I18n.t("removeFromList"),onSelect:function(e,t){return W(e,t,{id:"remove_from_segment",name:"remove_from_segment",endpoint:"segments",filter:function(e){return!("default"!==e.type)}},x.x.I18n.t("removeFromList"))},getData:function(){return{segment_id:Number(p()("#remove_from_segment").val())}},onSuccess:function(e){x.x.Notice.success(x.x.I18n.t("multipleSubscribersRemovedFromList").replace("%1$d",Number(e.meta.count).toLocaleString()).replace("%2$s",e.meta.segment))}},{name:"removeFromAllLists",label:x.x.I18n.t("removeFromAllLists"),onSuccess:function(e){x.x.Notice.success(x.x.I18n.t("multipleSubscribersRemovedFromAllLists").replace("%1$d",Number(e.meta.count).toLocaleString()))}},{name:"trash",label:x.x.I18n.t("moveToTrash"),onSuccess:V.onTrash},{name:"unsubscribe",label:x.x.I18n.t("unsubscribe"),onSelect:(e,t,n)=>{const r="all"!==n.selection?n.selected_ids.length:n.count;return(0,_.jsxs)(v.u,{title:x.x.I18n.t("unsubscribe"),onRequestClose:t,isDismissible:!0,children:[(0,_.jsx)("p",{children:x.x.I18n.t("unsubscribeConfirm").replace("%s",r.toLocaleString())}),(0,_.jsx)("span",{className:"mailpoet-gap-half"}),(0,_.jsx)(f.Button,{onClick:e,dimension:"small",variant:"secondary",automationId:"bulk-unsubscribe-confirm",children:x.x.I18n.t("apply")})]})}}],B=[{name:"statistics",label:x.x.I18n.t("statsListingActionTitle"),link:function(e,t){return(0,_.jsx)(o.Link,{to:{pathname:`/stats/${e.id}`,state:{backUrl:null==t?void 0:t.pathname}},children:x.x.I18n.t("statsListingActionTitle")})}},{name:"edit",label:x.x.I18n.t("edit"),link:function(e,t){return(0,_.jsx)(o.Link,{to:{pathname:`/edit/${e.id}`,state:{backUrl:null==t?void 0:t.pathname}},children:x.x.I18n.t("edit")})}},{name:"sendConfirmationEmail",className:"mailpoet-hide-on-mobile",label:x.x.I18n.t("resendConfirmationEmail"),display:function(e){return"unconfirmed"===e.status&&e.count_confirmations<window.mailpoet_max_confirmation_emails},onClick:function(e){return x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"subscribers",action:"sendConfirmationEmail",data:{id:e.id}}).done((()=>x.x.Notice.success(x.x.I18n.t("oneConfirmationEmailSent")))).fail((e=>x.x.Notice.showApiErrorNotice(e)))}},{name:"trash",className:"mailpoet-hide-on-mobile"}],H=e=>0===Number(e.wp_user_id)&&0===Number(e.is_woocommerce_user);function z(e){let{match:t}=e;const n=(0,l.TH)();return(0,_.jsxs)("div",{children:[(0,_.jsx)($,{}),(0,_.jsx)(R,{subscribersInPlan:x.x.subscribersCount,subscribersInPlanLimit:x.x.subscribersLimit}),(0,_.jsx)(T,{}),(0,_.jsx)(D,{}),(0,_.jsx)(k,{mssKeyInvalid:window.mailpoet_mss_key_invalid,subscribersCount:window.mailpoet_subscribers_count}),(0,_.jsx)(A,{cacheCalculation:window.mailpoet_subscribers_counts_cache_created_at}),(0,_.jsx)(g.N,{limit:window.mailpoet_listing_per_page,location:n,params:t.params,endpoint:"subscribers",onRenderItem:(e,t)=>{const r=d()("manage-column","column-primary","has-row-actions","column-username");let a="";switch(e.status){case"subscribed":a=x.x.I18n.t("subscribed");break;case"unconfirmed":a=x.x.I18n.t("unconfirmed");break;case"unsubscribed":a=x.x.I18n.t("unsubscribed");break;case"inactive":a=x.x.I18n.t("inactive");break;case"bounced":a=x.x.I18n.t("bounced");break;default:a="Invalid"}const s=[];return e.subscriptions.length>0&&e.subscriptions.forEach((e=>{const t=(e=>{let t=!1;return window.mailpoet_segments.forEach((n=>{n.id===e&&(t=n)})),t})(e.segment_id);!1!==t&&"subscribed"===e.status&&s.push(t)})),(0,_.jsxs)("div",{children:[(0,_.jsxs)("td",{className:r,children:[(0,_.jsx)(o.Link,{className:"mailpoet-listing-title",to:{pathname:`/edit/${e.id}`,state:{backUrl:null==n?void 0:n.pathname}},children:e.email}),(0,_.jsxs)("div",{className:"mailpoet-listing-subtitle",children:[e.first_name," ",e.last_name]}),t]}),(0,_.jsx)("td",{className:"column","data-colname":x.x.I18n.t("status"),children:a}),(0,_.jsx)("td",{className:"column","data-colname":x.x.I18n.t("lists"),children:(0,_.jsx)(f.Tags,{segments:s,dimension:"large"})}),(0,_.jsx)("td",{className:"column","data-colname":x.x.I18n.t("tags"),children:(0,_.jsx)(f.Tags,{subscriberTags:e.tags,variant:"wordpress",isInverted:!0})}),!0===U?(0,_.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":x.x.I18n.t("statisticsColumn"),children:(0,_.jsx)("div",{className:"mailpoet-listing-stats",children:(0,_.jsx)("a",{href:`#/stats/${e.id}`,children:(0,_.jsx)(M,{id:e.id,engagementScore:e.engagement_score})},`stats-link-${e.id}`)})}):null,(0,_.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("subscribedOn"),children:[x.x.Date.short(e.created_at),(0,_.jsx)("br",{}),x.x.Date.time(e.created_at)]})]})},columns:Z,bulk_actions:Y,item_actions:B,messages:V,sort_by:"created_at",sort_order:"desc",isItemDeletable:H})]})}z.propTypes={match:h().shape({params:h().object}).isRequired};var G=n(73136),K=n.n(G),Q=n(29449),X=n(12447),J=n.n(X),ee=n(32033);class te extends y.Component{render(){const e=this.props.field.name||null,t=this.props.item||{};let n,r;this.props.onValueChange instanceof Function&&(n=t[this.props.field.name],n=void 0===n?this.props.field.defaultValue||"":n),!n&&this.props.field.defaultValue&&(r=this.props.field.defaultValue);let a=this.props.field.id||null;!a&&this.props.field.name&&(a=`field_${this.props.field.name}`);let s=this.props.field.className||null;return s||this.props.field.size||(s="regular-text"),(0,_.jsx)(ee.I,{type:"text",disabled:void 0!==this.props.field.disabled&&this.props.field.disabled(this.props.item),className:s,size:"auto"!==this.props.field.size&&this.props.field.size>0?this.props.field.size:null,name:e,id:a,value:n,defaultValue:r,placeholder:this.props.field.placeholder,onChange:this.props.onValueChange,onBlur:this.props.onBlurEvent,customLabel:this.props.field.customLabel,tooltip:this.props.field.tooltip,...this.props.field.validation})}}te.propTypes={onValueChange:h().func,onBlurEvent:h().func,field:h().shape({name:h().string.isRequired,defaultValue:h().string,id:h().string,className:h().string,size:h().oneOfType([h().string,h().number]),disabled:h().func,placeholder:h().string,validation:h().shape({"data-parsley-required":h().bool,"data-parsley-required-message":h().string,"data-parsley-type":h().string,"data-parsley-errors-container":h().string,maxLength:h().number}),customLabel:h().string,tooltip:h().string}).isRequired,item:h().object.isRequired},te.defaultProps={onValueChange:function(){},onBlurEvent:function(){}};var ne=n(8279);function re(e){return(0,_.jsx)(ne.g,{type:"text",name:e.field.name,id:`field_${e.field.name}`,value:e.item[e.field.name],placeholder:e.field.placeholder,defaultValue:e.field.defaultValue,onChange:e.onValueChange,className:e.field.className,customLabel:e.field.customLabel,tooltip:e.field.tooltip,...e.field.validation})}re.propTypes={item:h().object.isRequired,field:h().shape({name:h().string,placeholder:h().string,defaultValue:h().string,validation:h().shape({"data-parsley-required":h().bool,"data-parsley-required-message":h().string,"data-parsley-type":h().string,"data-parsley-errors-container":h().string,maxLength:h().number}),className:h().string,customLabel:h().string,tooltip:h().string}).isRequired,onValueChange:h().func.isRequired};var ae=n(64530);class se extends y.Component{render(){if(void 0===this.props.field.values)return!1;let e,t=!1,n=!1,r=!1;void 0!==this.props.field.placeholder&&(n=(0,_.jsx)("option",{value:"",children:this.props.field.placeholder})),void 0!==this.props.field.filter&&(t=this.props.field.filter),w.ZP.isFunction(this.props.field.sortBy)&&(r=this.props.field.sortBy),e=r?w.ZP.map(w.ZP.sortBy(w.ZP.pairs(this.props.field.values),(e=>r(e[0],e[1]))),(e=>e[0])):Object.keys(this.props.field.values);const a=e.filter((e=>!1===t||t(this.props.item,e))).map((e=>(0,_.jsx)("option",{value:e,children:this.props.field.values[e]},`option-${e}`)));return(0,_.jsxs)(ae.Select,{name:this.props.field.name,id:`field_${this.props.field.name}`,value:this.props.item[this.props.field.name]||"",onChange:this.props.onValueChange,automationId:this.props.automationId,...this.props.field.validation,children:[n,a]})}}se.propTypes={onValueChange:h().func,field:h().shape({name:h().string.isRequired,values:h().objectOf(h().string),placeholder:h().string,filter:h().func,sortBy:h().func,validation:h().shape({"data-parsley-required":h().bool,"data-parsley-required-message":h().string,"data-parsley-type":h().string,"data-parsley-errors-container":h().string,maxLength:h().number})}).isRequired,item:h().object.isRequired,automationId:h().string},se.defaultProps={automationId:"",onValueChange:function(){}};var ie=n(34993);class oe extends y.Component{constructor(e){super(e),(0,b.Z)(this,"onValueChange",((e,t)=>this.props.onValueChange(t))),this.onValueChange=this.onValueChange.bind(this)}render(){if(void 0===this.props.field.values)return!1;const e=this.props.item[this.props.field.name],t=Object.keys(this.props.field.values).map((t=>(0,_.jsx)("p",{children:(0,_.jsx)(ie.Y,{checked:e===t,value:t,onCheck:this.onValueChange,name:this.props.field.name,children:this.props.field.values[t]})},`radio-${t}`)));return(0,_.jsx)("div",{children:t})}}oe.propTypes={onValueChange:h().func,field:h().shape({name:h().string.isRequired,values:h().objectOf(h().string)}).isRequired,item:h().object.isRequired},oe.defaultProps={onValueChange:function(){}};var le=n(25367);class ce extends y.Component{constructor(e){super(e),(0,b.Z)(this,"onValueChange",((e,t)=>(t.target.value=e?"1":"0",this.props.onValueChange(t)))),this.onValueChange=this.onValueChange.bind(this)}render(){if(void 0===this.props.field.values)return!1;const e=!!Number(this.props.item[this.props.field.name]),t=Object.keys(this.props.field.values).map((t=>(0,_.jsx)("p",{children:(0,_.jsx)(le.X,{value:"1",checked:e,name:this.props.field.name,onCheck:this.onValueChange,children:this.props.field.values[t]})},`checkbox-${t}`)));return(0,_.jsx)("div",{children:t})}}function de(e){const t=[];void 0!==e.placeholder&&t.push((0,_.jsx)("option",{value:"",children:e.placeholder},0));const n=K()().year();for(let e=n;e>=n-100;e-=1)t.push((0,_.jsx)("option",{value:e,children:e},e));return(0,_.jsx)(f.Select,{isMinWidth:!0,name:`${e.name}[year]`,value:e.year,onChange:e.onValueChange,children:t})}function ue(e){const t=[];void 0!==e.placeholder&&t.push((0,_.jsx)("option",{value:"",children:e.placeholder},0));for(let n=1;n<=12;n+=1)t.push((0,_.jsx)("option",{value:n,children:e.monthNames[n-1]},n));return(0,_.jsx)(f.Select,{isMinWidth:!0,name:`${e.name}[month]`,value:e.month,onChange:e.onValueChange,children:t})}function pe(e){const t=[];void 0!==e.placeholder&&t.push((0,_.jsx)("option",{value:"",children:e.placeholder},0));for(let e=1;e<=31;e+=1)t.push((0,_.jsx)("option",{value:e,children:e},e));return(0,_.jsx)(f.Select,{isMinWidth:!0,name:`${e.name}[day]`,value:e.day,onChange:e.onValueChange,children:t})}ce.propTypes={onValueChange:h().func.isRequired,field:h().shape({name:h().string.isRequired,values:h().objectOf(h().string)}).isRequired,item:h().object.isRequired},de.propTypes={name:h().string.isRequired,placeholder:h().string.isRequired,onValueChange:h().func.isRequired,year:h().oneOfType([h().string,h().number]).isRequired},ue.propTypes={name:h().string.isRequired,placeholder:h().string.isRequired,onValueChange:h().func.isRequired,month:h().oneOfType([h().string,h().number]).isRequired,monthNames:h().arrayOf(h().string).isRequired},pe.propTypes={name:h().string.isRequired,placeholder:h().string.isRequired,onValueChange:h().func.isRequired,day:h().oneOfType([h().string,h().number]).isRequired};class me extends y.Component{constructor(e){super(e),this.state={year:"",month:"",day:""},this.onValueChange=this.onValueChange.bind(this)}componentDidMount(){this.extractDateParts()}componentDidUpdate(e){void 0!==this.props.item&&void 0!==e.item&&this.props.item.id!==e.item.id&&this.extractDateParts()}onValueChange(e){const t=e.target.name.match(/(.*?)\[(.*?)\]/);let n=null,r=null;if(null!==t&&3===t.length){[,n,r]=t;const a=Number(e.target.value);this.setState({[`${r}`]:a},(()=>{this.props.onValueChange({target:{name:n,value:this.formatValue()}})}))}}formatValue(){let e;switch(this.props.field.params.date_type){case"year_month_day":e={year:this.state.year,month:this.state.month,day:this.state.day};break;case"year_month":e={year:this.state.year,month:this.state.month};break;case"month":e={month:this.state.month};break;case"year":e={year:this.state.year};break;default:e={value:"invalid type"}}return e}extractDateParts(){const e=void 0!==this.props.item[this.props.field.name]?this.props.item[this.props.field.name].trim():"";if(""===e)return;const t=K()(e);this.setState({year:t.format("YYYY"),month:t.format("M"),day:t.format("D")})}render(){const e=window.mailpoet_month_names||[];let t=(window.mailpoet_date_formats||{})[this.props.field.params.date_type][0];this.props.field.params.date_format&&(t=this.props.field.params.date_format);const n=t.split("/").map((t=>{switch(t){case"YYYY":return(0,_.jsx)(de,{onValueChange:this.onValueChange,name:this.props.field.name,year:this.state.year,placeholder:this.props.field.year_placeholder},"year");case"MM":return(0,_.jsx)(ue,{onValueChange:this.onValueChange,name:this.props.field.name,month:this.state.month,monthNames:e,placeholder:this.props.field.month_placeholder},"month");case"DD":return(0,_.jsx)(pe,{onValueChange:this.onValueChange,name:this.props.field.name,day:this.state.day,placeholder:this.props.field.day_placeholder},"day");default:return(0,_.jsx)("div",{children:"Invalid date type"})}}));return(0,_.jsx)("div",{children:n})}}me.propTypes={item:h().object.isRequired,field:h().shape({name:h().string,day_placeholder:h().string,month_placeholder:h().string,year_placeholder:h().string,params:h().object}).isRequired,onValueChange:h().func.isRequired};var he=n(49029),fe=n(55741);function ge(e){const t=Array.isArray(e.item[e.field.name])?e.field.name&&e.item[e.field.name].map((t=>e.field.getName(t))):[];let n=[];return e.field.endpoint?n=function(e){let t=[];return void 0!==window[`mailpoet_${e}`]&&(t=window[`mailpoet_${e}`]),t}(String(e.field.endpoint)).map((t=>e.field.getName(t))):e.field.suggestedValues&&(n=e.field.suggestedValues),(0,_.jsx)(fe.T,{label:e.field.label,name:e.field.name,placeholder:e.field.placeholder,selectedValues:t,suggestedValues:n,onChange:e.onValueChange})}class xe extends y.Component{constructor(){super(...arguments),(0,b.Z)(this,"renderField",(e=>{let t,n=!1;e.field.description&&(n=(0,_.jsx)("p",{className:"description",children:e.field.description}));let r=e.field;switch(void 0!==e.field.field&&(r=p().merge(r,e.field.field)),r.type){case"text":t=(0,_.jsx)(te,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"textarea":t=(0,_.jsx)(re,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"select":t=(0,_.jsx)(se,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"radio":t=(0,_.jsx)(oe,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"checkbox":t=(0,_.jsx)(ce,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"selection":t=(0,_.jsx)(j,{onValueChange:e.onValueChange,field:e.field,automationId:e.automationId,inline:e.inline,description:e.description,item:e.item},`selection-field-${r.name}`);break;case"date":t=(0,_.jsx)(me,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"reactComponent":t=(0,_.jsx)(e.field.component,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"tokenField":t=(0,_.jsx)(ge,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,description:e.description});break;case"empty":break;default:t="invalid"}const a="function"==typeof this.props.field.disabled?this.props.field.disabled(this.props.field):this.props.field.disabled,s={...this.props.field.onWrapperClick?{onClick:this.props.field.onWrapperClick}:{}};return(0,_.jsxs)("div",{className:d()("mailpoet-form-field",{"mailpoet-form-field-disabled":a}),...s,children:[t,n]},`field-${e.index||0}`)}))}render(){let e=!1;e=void 0!==this.props.field.fields?this.props.field.fields.map(((e,t)=>this.renderField({index:t,field:e,item:this.props.item,onValueChange:this.props.onValueChange||!1}))):this.renderField(this.props);let t=!1;this.props.field.label&&(t=(0,_.jsx)(he.X,{level:4,children:(0,_.jsx)("label",{htmlFor:`field_${this.props.field.name}`,children:this.props.field.label})}));let n=!1;return this.props.field.tip&&(n=(0,_.jsx)("p",{className:"mailpoet-form-description",children:this.props.field.tip})),(0,_.jsxs)("div",{className:`mailpoet-form-field-${this.props.field.name} form-field-row-${this.props.field.name}`,children:[t,n,e]})}}xe.propTypes={onValueChange:h().func,field:h().shape({name:h().string.isRequired,values:h().objectOf(h().string),tip:h().oneOfType([h().array,h().string]),label:h().string,fields:h().arrayOf(h().object),description:h().string,onWrapperClick:h().func,disabled:h().oneOfType([h().func,h().bool])}).isRequired,item:h().object.isRequired},xe.defaultProps={onValueChange:function(){}};class ve extends y.Component{constructor(e){super(e),(0,b.Z)(this,"getValues",(()=>this.props.item||this.state.item)),(0,b.Z)(this,"getErrors",(()=>this.props.errors||this.state.errors)),(0,b.Z)(this,"loadItem",(e=>{this.setState({loading:!0}),this.props.endpoint&&x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:this.props.endpoint,action:"get",data:{id:e}}).done((e=>{this.setState({loading:!1,item:e.data}),"function"==typeof this.props.onItemLoad&&this.props.onItemLoad(e.data)})).fail((()=>{this.setState({loading:!1,item:{}},(function(){this.props.history.push("/lists")}))}))})),(0,b.Z)(this,"handleSubmit",(e=>{if(e.preventDefault(),void 0!==this.props.isValid&&!1===this.props.isValid())return;this.setState({loading:!0});const t={};this.props.fields.forEach((e=>{void 0!==e.fields?e.fields.forEach((e=>{t[e.name]=this.state.item[e.name]})):t[e.name]=this.state.item[e.name]})),void 0!==this.props.params.id&&(t.id=this.props.params.id),this.props.endpoint&&x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:this.props.endpoint,action:"save",data:t}).always((()=>{this.setState({loading:!1})})).done((()=>{void 0!==this.props.onSuccess?this.props.onSuccess():this.props.history.push("/"),void 0!==this.props.params.id?this.props.messages.onUpdate():this.props.messages.onCreate()})).fail((e=>{e.errors.length>0&&this.setState({errors:e.errors})}))})),(0,b.Z)(this,"handleValueChange",(e=>{const{name:t,value:n}=Object.prototype.hasOwnProperty.call(e,"target")?e.target:e;return this.props.onChange?this.props.onChange(e):(this.setState((e=>{const r=e.item;return r[t]=n,{item:r}})),!0)})),this.formRef=(0,y.createRef)(),this.state={loading:!1,errors:[],item:{}}}componentDidMount(){void 0!==this.props.params.id?this.loadItem(this.props.params.id):J()((()=>{this.setState({item:p()(".mailpoet_form").mailpoetSerializeObject()})}))}componentDidUpdate(e){void 0===this.props.params.id&&e.location.pathname!==this.props.location.pathname&&(J()((()=>{this.setState({loading:!1,item:{}})})),void 0===this.props.item&&this.formRef.current.reset())}render(){let e;void 0!==this.getErrors()&&(e=this.getErrors().map((e=>(0,_.jsx)("div",{className:"mailpoet_notice notice inline error is-dismissible",children:(0,_.jsx)("p",{children:e.message})},`error-${e.message}`))));const t=d()("mailpoet_form",{mailpoet_form_loading:this.state.loading||this.props.loading});let n=!1,r=!1;void 0!==this.props.beforeFormContent&&(n=this.props.beforeFormContent(this.getValues())),void 0!==this.props.afterFormContent&&(r=this.props.afterFormContent(this.getValues()));const a=this.props.fields.map((e=>{let t=this.handleValueChange;return e.onBeforeChange&&(t=t=>(e.onBeforeChange(t),this.handleValueChange(t))),(0,_.jsx)(xe,{field:e,item:this.getValues(),onValueChange:t,automationId:e.automationId},`field-${e.name}`)}));let s=!1;return s=this.props.children?this.props.children:(0,_.jsx)(f.Button,{type:"submit",isDisabled:this.state.loading,children:x.x.I18n.t("save")}),(0,_.jsxs)("div",{children:[(0,_.jsx)("div",{className:"mailpoet-form-content-around",children:n}),(0,_.jsxs)("form",{id:this.props.id,ref:this.formRef,className:t,onSubmit:void 0!==this.props.onSubmit?this.props.onSubmit:this.handleSubmit,"data-automation-id":this.props.automationId,children:[e,(0,_.jsxs)("div",{className:"mailpoet-form-grid",children:[a,(0,_.jsx)("div",{className:"mailpoet-form-actions",children:s})]})]}),(0,_.jsx)("div",{className:"mailpoet-form-content-around",children:r})]})}}ve.propTypes={params:h().shape({id:h().string}),location:h().shape({pathname:h().string}),item:h().object,errors:h().arrayOf(h().object),endpoint:h().string,fields:h().arrayOf(h().object),messages:h().shape({onUpdate:h().func,onCreate:h().func}),loading:h().bool,children:h().array,id:h().string,automationId:h().string,beforeFormContent:h().func,afterFormContent:h().func,onItemLoad:h().func,isValid:h().func,onChange:h().func,onSubmit:h().func,onSuccess:h().func,history:h().shape({push:h().func.isRequired}).isRequired},ve.defaultProps={params:{},location:{},errors:void 0,fields:void 0,item:void 0,onItemLoad:void 0,isValid:void 0,onSuccess:void 0,onChange:void 0,loading:!1,beforeFormContent:void 0,afterFormContent:void 0,children:void 0,id:"",onSubmit:void 0,automationId:"",messages:{onUpdate:()=>{},onCreate:()=>{}},endpoint:void 0};const be=(0,l.EN)(ve);var ye=n(14223);const we=[{name:"email",label:x.x.I18n.t("email"),type:"text",disabled:function(e){return Number(e.wp_user_id>0)||1===Number(e.is_woocommerce_user)}},{name:"first_name",label:x.x.I18n.t("firstname"),type:"text",disabled:function(e){return Number(e.wp_user_id>0)||1===Number(e.is_woocommerce_user)}},{name:"last_name",label:x.x.I18n.t("lastname"),type:"text",disabled:function(e){return Number(e.wp_user_id>0)||1===Number(e.is_woocommerce_user)}},{name:"status",label:x.x.I18n.t("status"),type:"select",automationId:"subscriber-status",values:{subscribed:x.x.I18n.t("subscribed"),unconfirmed:x.x.I18n.t("unconfirmed"),unsubscribed:x.x.I18n.t("unsubscribed"),inactive:x.x.I18n.t("inactive"),bounced:x.x.I18n.t("bounced")}},{name:"segments",label:x.x.I18n.t("lists"),type:"selection",placeholder:x.x.I18n.t("selectList"),tip:x.x.I18n.t("welcomeEmailTip"),api_version:window.mailpoet_api_version,endpoint:"segments",multiple:!0,selected:function(e){return!1===Array.isArray(e.subscriptions)?null:e.subscriptions.filter((e=>"subscribed"===e.status)).map((e=>e.segment_id))},filter:function(e){return!e.deleted_at&&"default"===e.type},getLabel:function(e){return e.name},getCount:function(e){return e.subscribers},getSearchLabel:function(e,t){let n="";return void 0!==t.subscriptions&&t.subscriptions.forEach((t=>{if(e.id===t.segment_id&&(n=e.name,"unsubscribed"===t.status)){const e=x.x.Date.format(t.updated_at);n+=" (%1$s)".replace("%1$s",x.x.I18n.t("unsubscribedOn").replace("%1$s",e))}})),n}},{name:"tags",label:x.x.I18n.t("tags"),type:"tokenField",placeholder:x.x.I18n.t("addNewTag"),suggestedValues:[],endpoint:"tags",getName:function(e){return Object.prototype.hasOwnProperty.call(e,"name")?e.name:e}}];(window.mailpoet_custom_fields||[]).forEach((e=>{const t={name:`cf_${e.id}`,label:e.name,type:e.type};switch(e.params&&(t.params=e.params,e.params.values&&(t.values=e.params.values)),e.type){case"date":t.year_placeholder=x.x.I18n.t("year"),t.month_placeholder=x.x.I18n.t("month"),t.day_placeholder=x.x.I18n.t("day");break;case"select":t.placeholder="-";break;default:t.placeholder=""}we.push(t)}));const _e={onUpdate:function(){x.x.Notice.success(x.x.I18n.t("subscriberUpdated"))},onCreate:function(){x.x.Notice.success(x.x.I18n.t("subscriberAdded")),x.x.trackEvent("Subscribers > Add new")}};function je(e){if(Number(e.wp_user_id)>0)return(0,_.jsx)("p",{className:"description",children:I()(x.x.I18n.t("WPUserEditNotice"),/\[link\](.*?)\[\/link\]/g,((t,n)=>(0,_.jsx)("a",{href:`user-edit.php?user_id=${e.wp_user_id}`,children:t},n)))})}function Se(e){var t;return(0,_.jsxs)(_.Fragment,{children:[null==e||null===(t=e.unsubscribes)||void 0===t?void 0:t.map((e=>{const t=K()(e.createdAt.date).format("dddd MMMM Do YYYY [at] h:mm:ss a");let n;return n="admin"===e.source?x.x.I18n.t("unsubscribedAdmin").replace("%1$d",t).replace("%2$d",e.meta):"manage"===e.source?x.x.I18n.t("unsubscribedManage").replace("%1$d",t):"newsletter"===e.source?I()(x.x.I18n.t("unsubscribedNewsletter").replace("%1$d",t),/\[link\]/g,((t,n)=>(0,_.jsx)("a",{href:`admin.php?page=mailpoet-newsletter-editor&id=${e.newsletterId}`,children:e.newsletterSubject},n))):x.x.I18n.t("unsubscribedUnknown").replace("%1$d",t),(0,_.jsx)("p",{className:"description",children:n},n)})),(0,_.jsxs)("p",{className:"description",children:[(0,_.jsx)("strong",{children:x.x.I18n.t("tip")})," ",x.x.I18n.t("customFieldsTip")]})]})}function Ie(e){var t;let{match:n}=e;const r=(0,l.TH)(),a=(0,l.k6)(),s=(null===(t=r.state)||void 0===t?void 0:t.backUrl)||"/";return(0,_.jsxs)("div",{children:[(0,_.jsx)(Q.A,{color:"#fff"}),(0,_.jsx)(ye.B,{}),(0,_.jsxs)(he.X,{level:1,className:"mailpoet-title",children:[(0,_.jsx)("span",{children:x.x.I18n.t("subscriber")}),(0,_.jsx)(o.Link,{className:"mailpoet-button button button-secondary button-small",to:s,children:x.x.I18n.t("backToList")})]}),(0,_.jsx)(T,{}),(0,_.jsx)(be,{automationId:"subscriber_edit_form",endpoint:"subscribers",fields:we,params:n.params,messages:_e,beforeFormContent:je,afterFormContent:Se,onSuccess:()=>a.push(s)})]})}Ie.propTypes={match:h().shape({params:h().shape({id:h().string}).isRequired}).isRequired};var Ce=n(15317),Te=n(76087);function ke(e){var t;let{email:n}=e;const r=(null===(t=(0,l.TH)().state)||void 0===t?void 0:t.backUrl)||"/";return(0,_.jsxs)(he.X,{level:1,className:"mailpoet-title",children:[(0,_.jsx)("span",{children:x.x.I18n.t("statsHeading").replace("%s",n)}),(0,_.jsx)(o.Link,{className:"mailpoet-button button button-secondary button-small",to:r,children:x.x.I18n.t("backToList")})]})}var Ne=n(93492);function De(e){let{totalSent:t,open:n,machineOpen:r,click:a,subscriber:s}=e,i=0,o=0,l=0,c=0;const d=t-(n+r),u=t>0;return u&&(i=Math.round(n/t*100),o=Math.round(r/t*100),l=Math.round(a/t*100),c=Math.round(d/t*100)),(0,_.jsx)("div",{className:"mailpoet-tab-content mailpoet-subscriber-stats-summary",children:(0,_.jsx)("div",{className:"mailpoet-listing",children:(0,_.jsx)("table",{className:"mailpoet-listing-table",children:(0,_.jsxs)("tbody",{children:[(0,_.jsxs)("tr",{children:[(0,_.jsx)("td",{children:x.x.I18n.t("statsSentEmail")}),(0,_.jsx)("td",{children:(0,_.jsx)("b",{children:t.toLocaleString()})}),(0,_.jsx)("td",{})]}),(0,_.jsxs)("tr",{children:[(0,_.jsx)("td",{children:(0,_.jsx)(Ne.V,{children:x.x.I18n.t("statsOpened")})}),(0,_.jsx)("td",{children:(0,_.jsx)("b",{children:n.toLocaleString()})}),(0,_.jsx)("td",{children:u&&(0,_.jsxs)(_.Fragment,{children:[i,"%"]})})]}),(0,_.jsxs)("tr",{children:[(0,_.jsxs)("td",{children:[(0,_.jsx)(Ne.V,{children:x.x.I18n.t("statsMachineOpened")}),(0,_.jsx)(O.Tooltip,{tooltip:I()(x.x.I18n.t("statsMachineOpenedTooltip"),/\[link](.*?)\[\/link]/,(e=>(0,_.jsx)("span",{style:{pointerEvents:"all"},children:(0,_.jsx)("a",{href:"https://kb.mailpoet.com/article/368-what-are-machine-opens",target:"_blank","data-beacon-article":"6124b7fb21ef206e5592e188",rel:"noopener noreferrer",children:e},"kb-link")},"machine-opened-info")))})]}),(0,_.jsx)("td",{children:(0,_.jsx)("b",{children:r.toLocaleString()})}),(0,_.jsx)("td",{children:u&&(0,_.jsxs)(_.Fragment,{children:[o,"%"]})})]}),(0,_.jsxs)("tr",{children:[(0,_.jsx)("td",{children:(0,_.jsx)(Ne.V,{isInverted:!0,children:x.x.I18n.t("statsClicked")})}),(0,_.jsx)("td",{children:(0,_.jsx)("b",{children:a.toLocaleString()})}),(0,_.jsx)("td",{children:u&&(0,_.jsxs)(_.Fragment,{children:[l,"%"]})})]}),(0,_.jsxs)("tr",{children:[(0,_.jsx)("td",{children:x.x.I18n.t("statsNotClicked")}),(0,_.jsx)("td",{children:(0,_.jsx)("b",{children:d.toLocaleString()})}),(0,_.jsx)("td",{children:u&&(0,_.jsxs)(_.Fragment,{children:[c,"%"]})})]}),(0,_.jsxs)("tr",{children:[(0,_.jsx)("td",{children:x.x.I18n.t("statisticsColumn")}),(0,_.jsx)("td",{children:(0,_.jsx)("div",{className:"mailpoet-listing-stats",children:(0,_.jsx)(M,{id:s.id,engagementScore:s.engagement_score})})}),(0,_.jsx)("td",{})]})]})})})})}function Ee(e){let{revenueValue:t,count:n,averageRevenueValue:r}=e;return(0,_.jsx)("div",{className:"mailpoet-tab-content mailpoet-subscriber-stats-summary",children:(0,_.jsx)("div",{className:"mailpoet-listing",children:(0,_.jsx)("table",{className:"mailpoet-listing-table",children:(0,_.jsxs)("tbody",{children:[(0,_.jsxs)("tr",{children:[(0,_.jsx)("td",{children:"Orders created"}),(0,_.jsx)("td",{children:(0,_.jsx)("b",{children:n.toLocaleString()})})]}),(0,_.jsxs)("tr",{children:[(0,_.jsx)("td",{children:"Total revenue"}),(0,_.jsx)("td",{children:(0,_.jsx)("b",{children:t})})]}),(0,_.jsxs)("tr",{children:[(0,_.jsx)("td",{children:"Average revenue"}),(0,_.jsx)("td",{children:(0,_.jsx)("b",{children:r})})]})]})})})})}var Ae=n(34517),Oe=n(68230);function Re(e){let{limitReached:t,limitValue:n,subscribersCountTowardsLimit:r,premiumActive:a,hasValidApiKey:s,hasPremiumSupport:i}=e;return(0,_.jsxs)("table",{className:"mailpoet-listing-table","data-automation-id":"subscriber-stats-no-access",children:[(0,_.jsx)("thead",{children:(0,_.jsxs)("tr",{children:[(0,_.jsx)("th",{children:x.x.I18n.t("email")}),(0,_.jsx)("th",{children:x.x.I18n.t("columnAction")}),(0,_.jsx)("th",{children:x.x.I18n.t("columnCount")}),(0,_.jsx)("th",{children:x.x.I18n.t("columnActionOn")})]})}),(0,_.jsx)("tbody",{children:(0,_.jsx)("tr",{children:(0,_.jsx)("td",{colSpan:4,children:(0,_.jsx)("div",{className:"mailpoet-subscriber-stats-no-access-content",children:(0,_.jsx)(Oe.K,{title:a&&t?x.x.I18n.t("upgradeRequired"):x.x.I18n.t("premiumFeature"),message:(()=>{let e=x.x.I18n.t("premiumRequired");return a?(e=i?x.x.I18n.t("planLimitReached"):x.x.I18n.t("freeLimitReached"),(0,_.jsx)("p",{children:I()(e,/(\[subscribersCount]|\[subscribersLimit])/g,(e=>"[subscribersCount]"===e?r:n))})):(0,_.jsx)("p",{children:I()(e,/\[link](.*?)\[\/link]/g,(e=>(0,_.jsx)("a",{href:x.x.premiumLink,children:e},e)))})})(),actionButton:a&&t?(0,_.jsx)(E.z,{href:s?x.x.MailPoetComUrlFactory.getUpgradeUrl():x.x.MailPoetComUrlFactory.getPurchasePlanUrl(r+1),children:x.x.I18n.t("premiumBannerCtaUpgrade")}):(0,_.jsx)(E.z,{href:x.x.MailPoetComUrlFactory.getPurchasePlanUrl(x.x.subscribersCount,x.x.currentWpUserEmail,null,{utm_medium:"stats",utm_campaign:"signup"}),children:x.x.I18n.t("premiumBannerCtaFree")})})})})})})]})}function Pe(e){let{params:t,location:n}=e;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(he.X,{level:4,children:x.x.I18n.t("openedEmailsHeading")}),!x.x.premiumActive||x.x.subscribersLimitReached?(0,_.jsx)(Re,{limitReached:x.x.subscribersLimitReached,limitValue:x.x.subscribersLimit,subscribersCountTowardsLimit:x.x.subscribersCount,premiumActive:x.x.premiumActive,hasValidApiKey:x.x.hasValidApiKey,hasPremiumSupport:x.x.hasPremiumSupport}):Ae.Hooks.applyFilters("mailpoet_subscribers_opened_emails_stats",t,n)]})}function Me(){const e=(0,l.$B)(),t=(0,l.TH)(),[n,r]=(0,y.useState)(null),[a,s]=(0,y.useState)(!0),i=(0,Te.S)(window).notices.error;return(0,y.useEffect)((()=>{x.x.Ajax.post({api_version:x.x.apiVersion,endpoint:"subscriberStats",action:"get",data:{subscriber_id:e.params.id}}).done((e=>{r(e.data),s(!1)})).fail((e=>{s(!1),e.errors.length>0&&i((0,_.jsx)(_.Fragment,{children:e.errors.map((e=>(0,_.jsx)("p",{children:e.message},e.message)))}),{scroll:!0})}))}),[e.params.id,i]),a?(0,_.jsx)(Ce.g,{}):(0,_.jsxs)("div",{className:"mailpoet-subscriber-stats",children:[(0,_.jsx)(ke,{email:n.email}),(0,_.jsxs)("p",{children:[x.x.I18n.t("lastEngagement"),": ",n.last_engagement?x.x.Date.format(n.last_engagement):x.x.I18n.t("never")]}),(0,_.jsxs)("div",{className:"mailpoet-subscriber-stats-summary-grid",children:[(0,_.jsx)(De,{click:n.click,open:n.open,machineOpen:n.machine_open,totalSent:n.total_sent,subscriber:{id:Number(e.params.id),engagement_score:n.engagement_score}}),n.woocommerce&&(0,_.jsx)(Ee,{averageRevenueValue:n.woocommerce.formatted_average,count:n.woocommerce.count,revenueValue:n.woocommerce.formatted})]}),(0,_.jsx)(Pe,{params:e.params,location:t})]})}var Le=n(1349);function Fe(){return(0,_.jsx)(Te.k.Provider,{value:(0,Te.S)(window),children:(0,_.jsxs)(o.HashRouter,{children:[(0,_.jsx)(Le.w,{}),(0,_.jsxs)(l.rs,{children:[(0,_.jsx)(l.AW,{path:"/new",component:Ie}),(0,_.jsx)(l.AW,{path:"/edit/:id",component:Ie}),(0,_.jsx)(l.AW,{path:"/stats/:id/(.*)?",component:Me}),(0,_.jsx)(l.AW,{path:"*",component:z})]})]})})}const qe=document.getElementById("subscribers_container");qe&&i.render((0,_.jsx)(Fe,{}),qe);var $e=n(7501),Ue=n(58583);class Ze extends y.PureComponent{render(){const e=this.props.event,t=e.soon;let n;if(this.props.premium)n=(0,_.jsx)("a",{href:"?page=mailpoet-premium",target:"_blank",children:x.x.I18n.t("premiumFeatureLink")});else if(e.actionButtonLink&&e.actionButtonTitle)n=(0,_.jsx)("a",{href:e.actionButtonLink,target:"_blank",rel:"noopener noreferrer",children:e.actionButtonTitle});else{const r=t?null:w.ZP.partial(this.props.eventsConfigurator,e.slug);n=(0,_.jsx)(E.z,{disabled:t,onClick:r,role:"presentation",automationId:`create_${e.slug}`,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),r())},children:e.actionButtonTitle||x.x.I18n.t("setUp")})}return(0,_.jsxs)("div",{"data-type":e.slug,className:"mailpoet-newsletter-type",children:[(0,_.jsx)("div",{className:"mailpoet-newsletter-type-image",children:e.badge&&(0,_.jsx)(Ue.C,{title:e.badge.text})}),(0,_.jsxs)("div",{className:"mailpoet-newsletter-type-content",children:[(0,_.jsxs)(he.X,{level:4,children:[e.title," ",e.soon&&`(${x.x.I18n.t("soon")})`]}),(0,_.jsx)("p",{children:e.description}),(0,_.jsx)("div",{className:"mailpoet-flex-grow"}),(0,_.jsx)("div",{className:"mailpoet-newsletter-type-action",children:n})]})]})}}Ze.defaultProps={premium:!1},Ze.propTypes={premium:h().bool,eventsConfigurator:h().func.isRequired,event:h().shape({slug:h().string.isRequired,actionButtonLink:h().string,title:h().string.isRequired,soon:h().bool,badge:h().shape({style:h().string,text:h().string}),description:h().string.isRequired,actionButtonTitle:h().string}).isRequired};class Ve extends y.Component{constructor(e){super(e),this.email=this.props.email,this.emailEvents=this.email.events,this.eventsConfigurator=this.eventsConfigurator.bind(this)}eventsConfigurator(e){x.x.trackEvent("Emails > Automatic Type selected",{"Email type":e}),this.props.history.push(`/new/${this.email.slug}/${e}/conditions`)}render(){return w.ZP.map(this.emailEvents,((e,t)=>(0,_.jsx)(Ze,{premium:this.email.premium,event:e,eventsConfigurator:this.eventsConfigurator},t)))}}Ve.propTypes={email:h().shape({title:h().string.isRequired,slug:h().string.isRequired,premium:h().bool}).isRequired,history:h().shape({push:h().func.isRequired}).isRequired};const We=(0,l.EN)(Ve),Ye={woocommerce:(0,_.jsxs)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 120 71",style:{enableBackground:"new 0 0 120 71"},children:[(0,_.jsx)("path",{fill:"#9ca6cc",d:"M11.4,0.7h97.1c6.1,0,11.1,4.9,11.1,11v36.7c0,6.1-5,11-11.1,11H73.7L78.5,71l-21-11.6h-46 c-6.1,0-11.1-4.9-11.1-11V11.7C0.3,5.7,5.3,0.7,11.4,0.7z"}),(0,_.jsx)("path",{fill:"#fff",d:"M7.2,10.7c0.7-0.9,1.7-1.4,3.1-1.5c2.5-0.2,3.9,1,4.2,3.5c1.5,10,3.2,18.5,4.9,25.5l10.6-20 c1-1.8,2.2-2.8,3.6-2.9c2.1-0.1,3.4,1.2,4,4c1.2,6.4,2.8,11.8,4.6,16.4c1.3-12.2,3.4-21,6.4-26.4c0.7-1.3,1.8-2,3.2-2.1 c1.1-0.1,2.1,0.2,3.1,1c0.9,0.7,1.4,1.6,1.5,2.7c0,0.9-0.1,1.6-0.5,2.3c-1.9,3.5-3.4,9.3-4.7,17.3c-1.2,7.8-1.6,13.9-1.4,18.3 c0.1,1.2-0.1,2.3-0.6,3.2c-0.6,1.1-1.5,1.6-2.6,1.7c-1.3,0.1-2.6-0.5-3.8-1.8c-4.5-4.6-8.1-11.4-10.7-20.5c-3.2,6.1-5.5,10.8-7,13.8 c-2.9,5.4-5.3,8.2-7.3,8.4c-1.3,0.1-2.4-1-3.4-3.3C11.9,44.1,9.3,32,6.4,14C6.2,12.7,6.5,11.6,7.2,10.7z M111.3,18.3 c-1.7-3-4.3-4.9-7.8-5.6c-0.9-0.2-1.8-0.3-2.6-0.3c-4.7,0-8.4,2.4-11.4,7.2c-2.5,4.1-3.8,8.6-3.8,13.5c0,3.7,0.8,6.9,2.3,9.5 c1.7,3,4.3,4.9,7.8,5.6c0.9,0.2,1.8,0.3,2.6,0.3c4.7,0,8.5-2.4,11.4-7.2c2.5-4.1,3.8-8.6,3.8-13.6C113.7,24,112.9,20.9,111.3,18.3z M105.2,31.6c-0.7,3.2-1.9,5.5-3.7,7.1c-1.4,1.2-2.7,1.8-3.9,1.5c-1.2-0.2-2.1-1.2-2.9-3.1c-0.6-1.5-0.9-3-0.9-4.4 c0-1.2,0.1-2.4,0.3-3.5c0.4-2,1.3-3.9,2.6-5.7c1.6-2.4,3.3-3.3,5-3c1.2,0.2,2.1,1.2,2.9,3.1c0.6,1.5,0.9,3,0.9,4.4 C105.6,29.3,105.5,30.5,105.2,31.6z M81,18.3c-1.7-3-4.4-4.9-7.8-5.6c-0.9-0.2-1.8-0.3-2.6-0.3c-4.7,0-8.4,2.4-11.4,7.2 c-2.5,4.1-3.8,8.6-3.8,13.5c0,3.7,0.8,6.9,2.3,9.5c1.7,3,4.3,4.9,7.8,5.6c0.9,0.2,1.8,0.3,2.6,0.3c4.7,0,8.5-2.4,11.4-7.2 c2.5-4.1,3.8-8.6,3.8-13.6C83.3,24,82.5,20.9,81,18.3z M74.8,31.6c-0.7,3.2-1.9,5.5-3.7,7.1c-1.4,1.2-2.7,1.8-3.9,1.5 c-1.2-0.2-2.1-1.2-2.9-3.1c-0.6-1.5-0.9-3-0.9-4.4c0-1.2,0.1-2.4,0.3-3.5c0.4-2,1.3-3.9,2.6-5.7c1.6-2.4,3.3-3.3,5-3 c1.2,0.2,2.1,1.2,2.9,3.1c0.6,1.5,0.9,3,0.9,4.4C75.2,29.3,75.1,30.5,74.8,31.6z"})]})};var Be=n(19606);function He(e){let{errors:t}=e;return t.length<1?null:(0,_.jsx)(C.q,{type:"error",closable:!1,children:t.map((e=>(0,_.jsx)("p",{children:e.message},e.message)))})}var ze=n(11699);function Ge(e){let{filter:t,history:n,hideClosingButton:r=!1,hideScreenOptions:a=!0}=e;const[s,i]=(0,y.useState)(!1),o=e=>{void 0!==e&&(n.push(`/new/${e}`),x.x.trackEvent("Emails > Type selected",{"Email type":e}))},l=async()=>{x.x.trackEvent("Emails > Type selected",{"Email type":"wc_transactional"});let e=window.mailpoet_woocommerce_transactional_email_id;if(!e)try{e=(await x.x.Ajax.post({api_version:x.x.apiVersion,endpoint:"settings",action:"set",data:{"woocommerce.use_mailpoet_editor":1}})).data.woocommerce.transactional_email_id,x.x.trackEvent("Emails > WooCommerce email customizer enabled")}catch(e){return(0,ze.q)(e)&&e.errors.length>0?(0,_.jsx)(He,{errors:e.errors}):null}return window.location.href=`?page=mailpoet-newsletter-editor&id=${e}`,null},c=e=>{const t=!0===window.mailpoet_is_new_user?"mailpoet_badge mailpoet_badge_video":"mailpoet_badge mailpoet_badge_video mailpoet_badge_video_grey";return(0,_.jsxs)("div",{"data-type":e.slug,className:"mailpoet-newsletter-type",children:[(0,_.jsx)("div",{className:"mailpoet-newsletter-type-image"}),(0,_.jsxs)("div",{className:"mailpoet-newsletter-type-content",children:[(0,_.jsxs)(he.X,{level:4,children:[e.title," ",e.beta?`(${x.x.I18n.t("beta")})`:""]}),(0,_.jsx)("p",{children:e.description}),e.videoGuide&&(0,_.jsxs)("a",{className:t,href:e.videoGuide,"data-beacon-article":e.videoGuideBeacon,target:"_blank",rel:"noopener noreferrer",children:[(0,_.jsx)("span",{className:"dashicons dashicons-format-video"}),x.x.I18n.t("seeVideoGuide")]}),(0,_.jsx)("div",{className:"mailpoet-flex-grow"}),(0,_.jsx)("div",{className:"mailpoet-newsletter-type-action",children:e.action})]})]},e.slug)},d=w.ZP.partial((e=>{i(!0),x.x.trackEvent("Emails > Type selected",{"Email type":e}),x.x.Ajax.post({api_version:x.x.apiVersion,endpoint:"newsletters",action:"create",data:{type:e,subject:x.x.I18n.t("draftNewsletterTitle")}}).done((e=>{n.push(`/template/${e.data.id}`)})).fail((e=>(i(!1),e.errors.length>0?(0,_.jsx)(He,{errors:e.errors}):null)))}),"standard"),u=w.ZP.partial(o,"notification"),p=w.ZP.partial(o,"welcome"),m=w.ZP.partial(o,"re-engagement"),h=[{slug:"standard",title:x.x.I18n.t("regularNewsletterTypeTitle"),description:x.x.I18n.t("regularNewsletterTypeDescription"),action:(0,_.jsx)(E.z,{automationId:"create_standard",onClick:d,tabIndex:0,withSpinner:s,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),d())},children:x.x.I18n.t("create")})},{slug:"welcome",title:x.x.I18n.t("welcomeNewsletterTypeTitle"),description:x.x.I18n.t("welcomeNewsletterTypeDescription"),videoGuide:"https://kb.mailpoet.com/article/254-video-guide-to-welcome-emails",videoGuideBeacon:"5b05ebf20428635ba8b2aa53",action:(0,_.jsx)(E.z,{onClick:p,automationId:"create_welcome",withSpinner:s,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),p())},tabIndex:0,children:x.x.I18n.t("setUp")})},{slug:"notification",title:x.x.I18n.t("postNotificationNewsletterTypeTitle"),description:x.x.I18n.t("postNotificationNewsletterTypeDescription"),videoGuide:"https://kb.mailpoet.com/article/210-video-guide-to-post-notifications",videoGuideBeacon:"59ba6fb3042863033a1cd5a5",action:(0,_.jsx)(E.z,{automationId:"create_notification",onClick:u,withSpinner:s,tabIndex:0,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),u())},children:x.x.I18n.t("setUp")})},{slug:"re_engagement",title:x.x.I18n.t("tabReEngagementTitle"),description:x.x.I18n.t("reEngagementDescription"),action:(0,_.jsx)(E.z,{automationId:"create_notification",onClick:m,withSpinner:s,tabIndex:0,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),m())},children:x.x.I18n.t("setUp")})}];let f=Ae.Hooks.applyFilters("mailpoet_newsletters_types",[...h],this);t&&(f=f.filter(t));const g=x.x.Ajax.constructGetUrl({api_version:x.x.apiVersion,endpoint:"newsletterTemplates",action:"getAll"});return(0,_.jsxs)(_.Fragment,{children:[a&&(0,_.jsx)(ye.B,{}),(0,_.jsx)("link",{rel:"prefetch",href:window.mailpoet_editor_javascript_url,as:"script"}),(0,_.jsxs)("div",{className:"mailpoet-newsletter-types",children:[!r&&(0,_.jsx)("div",{className:"mailpoet-newsletter-types-close",children:(0,_.jsx)("button",{type:"button",onClick:()=>n.push("/"),className:"mailpoet-modal-close",children:Be.X})}),f.map((e=>c(e)),this),(()=>{if(!window.mailpoet_woocommerce_automatic_emails)return[];let e=window.mailpoet_woocommerce_automatic_emails;return t&&(e=w.ZP.filter(e,t)),w.ZP.map(e,(e=>{const r=e;return(0,_.jsxs)(y.Fragment,{children:[!t&&(0,_.jsxs)("div",{className:"mailpoet-newsletter-types-separator",children:[(0,_.jsx)("div",{className:"mailpoet-newsletter-types-separator-line"}),(0,_.jsx)("div",{className:"mailpoet-newsletter-types-separator-logo",children:Ye[r.slug]||null}),(0,_.jsx)("div",{className:"mailpoet-newsletter-types-separator-line"})]}),(0,_.jsx)(We,{email:r,history:n}),"woocommerce"===r.slug&&(x.x.isWoocommerceActive?[{slug:"wc_transactional",title:x.x.I18n.t("wooCommerceCustomizerTypeTitle"),description:x.x.I18n.t("wooCommerceCustomizerTypeDescription"),action:(0,_.jsx)(E.z,{automationId:"customize_woocommerce",onClick:l,tabIndex:0,onKeyDown:async e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),await l())},children:x.x.I18n.t("customize")})}]:[]).map((e=>c(e)),this)]},r.slug)}))})()]}),(0,_.jsx)("link",{rel:"prefetch",href:g,as:"fetch"})]})}Ge.defaultProps={filter:null,hideScreenOptions:!0,hideClosingButton:!1};const Ke=(0,l.EN)(Ge);var Qe=n(69916);function Xe(e){let{newsletter:t,isSent:n,currentTime:r}=e,a=n;if(void 0===a&&(a=t.statistics&&t.queue&&"scheduled"!==t.queue.status),!a)return null;const s={link:`/stats/${t.id}`,onClick:Ae.Hooks.applyFilters("mailpoet_newsletters_listing_stats_tracking",$e.gP)},i=Number(t.total_sent||t.queue.count_processed);let l,c,d,u,p,m=0,h=0,g=null;i>0&&(m=100*t.statistics.clicked/i,h=100*t.statistics.opened/i,g=t.statistics.revenue),void 0!==r?(l=6,c=t.queue.scheduled_at||t.queue.created_at,d=K()(r).diff(K()(c),"hours"),u=d<l,p=!0):(u=!1,p=!1);const v=i>=20&&t.statistics.opened>=5&&!u,b=(e,n)=>((e,t,n,r)=>r<=0||!t.link?e:t.externalLink?(0,_.jsx)("a",{href:t.link,onClick:t.onClick||null,children:e},`stats-${n}`):(0,_.jsx)(o.Link,{to:t.link,onClick:t.onClick||null,children:e},`stats-${n}`))(e,s,`${n}-${t.id}`,i),y=(0,_.jsx)(Qe.M,{opened:h,clicked:m,revenues:g&&g.value>0?g.formatted:null,hideBadges:!v,newsletterId:t.id,wrapContentInLink:b}),w=(0,_.jsxs)(_.Fragment,{children:[y,u&&b((0,_.jsx)(f.Tag,{className:"mailpoet-listing-stats-too-early",dimension:"large",variant:"excellent",isInverted:!0,children:x.x.I18n.t("checkBackInHours").replace("%1$d",l-d)}),"check-back")]});let j;return p&&h<5&&d>=24&&i>=10&&(j=(0,_.jsx)("div",{children:(0,_.jsx)("a",{href:"https://kb.mailpoet.com/article/191-how-to-improve-my-open-and-click-rates","data-beacon-article":"58f671152c7d3a057f8858e8",target:"_blank",rel:"noopener noreferrer",className:"mailpoet_stat_link_small",children:x.x.I18n.t("improveThisLinkText")})})),(0,_.jsxs)(_.Fragment,{children:[w,j]})}const Je=h().shape({clicked:h().number,opened:h().number,unsubscribed:h().number,revenue:h().shape({count:h().number,currency:h().string,formatted:h().string,value:h().number})}),et=h().shape({status:h().string,count_processed:h().string.isRequired,count_total:h().string.isRequired,created_at:h().string,scheduled_at:h().string});Xe.propTypes={newsletter:h().shape({id:h().number.isRequired,queue:h().oneOfType([et,h().bool]),total_sent:h().number,statistics:h().oneOfType([Je,h().bool])}).isRequired,isSent:h().bool,currentTime:h().string},Xe.defaultProps={isSent:void 0,currentTime:void 0};const tt=x.x.trackingConfig.emailTrackingEnabled,nt=window.mailpoet_woocommerce_automatic_emails||{},rt={onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneNewsletterTrashed"):x.x.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneNewsletterDeleted"):x.x.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneNewsletterRestored"):x.x.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)}},at=[{name:"subject",label:x.x.I18n.t("subject"),sortable:!0},{name:"settings",label:x.x.I18n.t("settings")},{name:"statistics",label:x.x.I18n.t("statistics"),display:tt},{name:"status",label:x.x.I18n.t("status"),width:145},{name:"updated_at",label:x.x.I18n.t("lastModifiedOn"),sortable:!0}],st=[{name:"trash",label:x.x.I18n.t("moveToTrash"),onSuccess:rt.onTrash}];let it=[{name:"view",link:function(e){return(0,_.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:x.x.I18n.t("preview")})}},{name:"edit",className:"mailpoet-hide-on-mobile",label:x.x.I18n.t("edit"),onClick:$e.Q2},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:x.x.I18n.t("duplicate"),onClick:(e,t)=>x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{x.x.Notice.success(x.x.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&x.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},{name:"trash",className:"mailpoet-hide-on-mobile"}];it=(0,$e.y8)(it);class ot extends y.Component{constructor(e){super(e),(0,b.Z)(this,"updateStatus",((e,t)=>{t.persist(),x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"setStatus",data:{id:Number(t.target.getAttribute("data-id")),status:e?"active":"draft"}}).done((e=>{if("active"===e.data.status){const e=t.target.getAttribute("data-group"),n=nt[e];x.x.Notice.success(x.x.I18n.t("automaticEmailActivated").replace("%1s",n.title))}this.forceUpdate()})).fail((n=>{x.x.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,b.Z)(this,"renderStatus",(e=>{const t=parseInt(e.total_sent,10)>-1?x.x.I18n.t("sentToXCustomers").replace("%1$d",e.total_sent.toLocaleString()):null;return(0,_.jsxs)("div",{children:[(0,_.jsx)(f.Toggle,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,"data-group":e.options.group,dimension:"small",defaultChecked:"active"===e.status}),(0,_.jsxs)("p",{className:"mailpoet-listing-notification-status",children:[t&&(0,_.jsx)(o.Link,{to:`/sending-status/${e.id}`,children:t}),!t&&(0,_.jsx)("span",{className:"mailpoet-listing-status-unknown mailpoet-font-extra-small",children:x.x.I18n.t("notSentYet")})]})]})})),(0,b.Z)(this,"renderSettings",(e=>{const t=nt[e.options.group].events[e.options.event];let n;try{n=JSON.parse(e.options.meta||null)}catch(t){n=e.options.meta||null}const r=n&&n.option?w.ZP.pluck(n.option,"name"):[];if(n&&w.ZP.isEmpty(r))return(0,_.jsx)("span",{className:"mailpoet-listing-error",children:x.x.I18n.t("automaticEmailEventOptionsNotConfigured")});let a,s;if(a=r.length>1&&"listingScheduleDisplayTextPlural"in t?I()(t.listingScheduleDisplayTextPlural,"%s",((e,t)=>(0,_.jsx)(f.Tags,{strings:r},t))):I()(t.listingScheduleDisplayText,"%s",((e,t)=>(0,_.jsx)(f.Tags,{strings:r},t))),a&&"immediate"!==e.options.afterTimeType)switch(e.options.afterTimeType){case"minutes":s=x.x.I18n.t("sendingDelayMinutes").replace("%1$d",e.options.afterTimeNumber);break;case"hours":s=x.x.I18n.t("sendingDelayHours").replace("%1$d",e.options.afterTimeNumber);break;case"days":s=x.x.I18n.t("sendingDelayDays").replace("%1$d",e.options.afterTimeNumber);break;case"weeks":s=x.x.I18n.t("sendingDelayWeeks").replace("%1$d",e.options.afterTimeNumber);break;default:s=x.x.I18n.t("sendingDelayInvalid")}return(0,_.jsxs)("span",{children:[a,s&&(0,_.jsxs)("div",{className:"mailpoet-listing-schedule",children:[(0,_.jsx)("div",{className:"mailpoet-listing-schedule-icon",children:(0,_.jsx)(f.ScheduledIcon,{})}),s]})]})})),(0,b.Z)(this,"renderItem",((e,t)=>{const n=d()("manage-column","column-primary","has-row-actions");return(0,_.jsxs)("div",{children:[(0,_.jsxs)("td",{className:n,children:[(0,_.jsx)("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`,children:e.subject}),t]}),(0,_.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("settings"),children:this.renderSettings(e)}),!0===tt?(0,_.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":x.x.I18n.t("statistics"),children:(0,_.jsx)(Xe,{newsletter:e,isSent:e.total_sent>0&&!!e.statistics})}):null,(0,_.jsx)("td",{className:"column","data-colname":x.x.I18n.t("status"),children:this.renderStatus(e)}),(0,_.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("lastModifiedOn"),children:[x.x.Date.short(e.updated_at),(0,_.jsx)("br",{}),x.x.Date.time(e.updated_at)]})]})})),(0,b.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={eventCounts:{},newslettersCount:void 0},this.afterGetItems=this.afterGetItems.bind(this)}afterGetItems(e){(0,$e._X)(e),this.countEmailTypes(e)}countEmailTypes(e){const t={woocommerce_product_purchased:0,woocommerce_product_purchased_in_category:0,woocommerce_first_purchase:0};if(Array.isArray(e.items)){const n=e.items.map((e=>e.options.event)).reduce(((e,t)=>(e[t]?e[t]+=1:e[t]=1,e)),t);this.setState({eventCounts:n})}}renderWarning(){const{eventCounts:e}=this.state;return e.woocommerce_product_purchased+e.woocommerce_product_purchased_in_category+e.woocommerce_first_purchase?"1"===window.mailpoet_woocommerce_optin_on_checkout?null:(0,_.jsxs)("div",{className:"notice error",children:[(0,_.jsx)("p",{children:x.x.I18n.t("wooCommerceEmailsWarning")}),(0,_.jsx)("p",{children:(0,_.jsx)("a",{href:"?page=mailpoet-settings#woocommerce",children:x.x.I18n.t("wooCommerceEmailsWarningLink")})})]}):null}render(){const{match:e,location:t}=this.props;return(0,_.jsxs)(_.Fragment,{children:[this.renderWarning(),0===this.state.newslettersCount&&(0,_.jsx)(Ke,{filter:e=>"woocommerce"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&(0,_.jsx)(g.N,{limit:window.mailpoet_listing_per_page,location:t,params:e.params,endpoint:"newsletters",type:"automatic",base_url:"woocommerce",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:at,bulk_actions:st,item_actions:it,messages:rt,auto_refresh:!0,sort_by:"updated_at",sort_order:"desc",afterGetItems:e=>{if(!e.loading){const t=e.groups.reduce(((e,t)=>e+t.count),0);this.setState({newslettersCount:t})}this.afterGetItems(e)}})]})}}ot.propTypes={match:h().shape({params:h().shape({tab:h().string}).isRequired}).isRequired,location:h().object.isRequired};const lt=(0,l.EN)(ot);var ct=n(22058),dt=n(30189);const ut=(0,l.EN)((e=>(0,_.jsx)(dt.b,{...e})));var pt=n(58125),mt=n(31539);class ht extends y.Component{constructor(e){super(e),this.onPreview=this.onPreview.bind(this),this.onDelete=this.onDelete.bind(this),this.onSelect=this.onSelect.bind(this)}onDelete(){const{id:e,name:t,beforeDelete:n,afterDelete:r}=this.props;(0,mt._)({message:x.x.I18n.t("confirmTemplateDeletion").replace("%1$s",t),onConfirm:()=>{n(),x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"delete",data:{id:e}}).done((()=>{r(!0,e)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,_.jsx)("p",{children:e.message},e.message))),{scroll:!0}),r(!1)}))}})}onPreview(){x.x.Modal.popup({title:this.props.name,template:'<img src="{{ thumbnail }}" />',data:this.props})}onSelect(){const{newsletterId:e,name:t,beforeSelect:n,afterSelect:r}=this.props;n(),x.x.trackEvent("Emails > Template selected",{"Email name":t}),x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"save",data:{id:e,template_id:this.props.id}}).done((e=>{r(!0,e.data.id)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,_.jsx)("p",{children:e.message},e.message))),{scroll:!0}),r(!1)}))}render(){const{index:e,name:t,thumbnail:n,readonly:r}=this.props;let a="";return"string"==typeof n&&n.length>0&&(a=(0,_.jsxs)("a",{className:"mailpoet-template-preview",href:"#",onClick:e=>{e.preventDefault(),this.onPreview(e)},children:[(0,_.jsx)("div",{className:"mailpoet-template-thumbnail",children:n?(0,_.jsx)("img",{src:n,alt:x.x.I18n.t("templatePreview"),loading:"lazy"}):""}),(0,_.jsx)("div",{className:"mailpoet-template-preview-overlay",children:(0,_.jsx)(E.z,{children:x.x.I18n.t("zoom")})})]})),(0,_.jsx)(pt.G,{label:t,onSelect:this.onSelect,onDelete:!1===r?this.onDelete:void 0,automationId:`select_template_${e}`,className:"mailpoet-template-two-lines",children:a})}}ht.contextType=Te.k,ht.propTypes={index:h().number.isRequired,id:h().number.isRequired,newsletterId:h().string.isRequired,name:h().string.isRequired,thumbnail:h().string,readonly:h().bool.isRequired,beforeDelete:h().func.isRequired,afterDelete:h().func.isRequired,beforeSelect:h().func.isRequired,afterSelect:h().func.isRequired},ht.defaultProps={thumbnail:null};class ft extends y.Component{constructor(e){super(e),this.fileRef=(0,y.createRef)(),this.handleSubmit=this.handleSubmit.bind(this)}handleSubmit(e){if(e.preventDefault(),w.ZP.size(this.fileRef.current.files)<=0)return!1;const t=w.ZP.first(this.fileRef.current.files),n=new FileReader;return n.onload=e=>{try{this.saveTemplate(JSON.parse(e.target.result)),x.x.trackEvent("Emails > Template imported")}catch(e){this.context.notices.error((0,_.jsx)("p",{children:x.x.I18n.t("templateFileMalformedError")}))}},n.readAsText(t),!0}saveTemplate(e){const t=e,{beforeImport:n,afterImport:r}=this.props;w.ZP.isUndefined(t.body)||(t.body=JSON.stringify(t.body));try{t.categories=JSON.parse(t.categories)}catch(e){t.categories=[]}-1===t.categories.indexOf("saved")&&t.categories.push("saved"),-1===t.categories.indexOf("standard")&&-1===t.categories.indexOf("welcome")&&-1===t.categories.indexOf("notification")&&t.categories.push("standard"),t.categories=JSON.stringify(t.categories),n(),x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"save",data:t}).done((e=>{r(!0,e.data)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,_.jsx)("p",{children:e.message},e.message))),{scroll:!0}),r(!1)}))}render(){return(0,_.jsxs)("div",{className:"mailpoet-template-import",children:[(0,_.jsxs)("h4",{children:[x.x.I18n.t("importTemplateTitle"),(0,_.jsx)(O.Tooltip,{tooltip:x.x.I18n.t("helpTooltipTemplateUpload"),place:"right",className:"tooltip-help-import-template"})]}),(0,_.jsxs)("form",{onSubmit:this.handleSubmit,children:[(0,_.jsx)("input",{type:"file",placeholder:x.x.I18n.t("selectJsonFileToUpload"),ref:this.fileRef}),(0,_.jsx)("p",{className:"submit",children:(0,_.jsx)("input",{className:"button button-primary",type:"submit",value:x.x.I18n.t("upload")})})]})]})}}ft.contextType=Te.k,ft.propTypes={beforeImport:h().func.isRequired,afterImport:h().func.isRequired};const gt=[];window.mailpoet_newsletters_templates_recently_sent_count&>.push({name:"recent",label:x.x.I18n.t("recentlySent")}),gt.push({name:"standard",label:x.x.I18n.t("tabStandardTitle")},{name:"welcome",label:x.x.I18n.t("tabWelcomeTitle")},{name:"notification",label:x.x.I18n.t("tabNotificationTitle")},{name:"re_engagement",label:x.x.I18n.t("tabReEngagementTitle")},{name:"blank",label:x.x.I18n.t("tabBlankTitle")}),window.mailpoet_woocommerce_active&>.push({name:"woocommerce",label:x.x.I18n.t("tabWoocommerceTitle")}),gt.push({name:"saved",label:x.x.I18n.t("savedTemplates")});class xt extends y.Component{constructor(e){super(e),this.state={loading:!0,templates:{},emailType:null,emailOptions:{},selectedTab:""},this.templates={},this.addTemplate=this.addTemplate.bind(this),this.afterTemplateDelete=this.afterTemplateDelete.bind(this),this.afterTemplateSelect=this.afterTemplateSelect.bind(this),this.afterTemplateImport=this.afterTemplateImport.bind(this)}componentDidMount(){x.x.Ajax.get({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"getAll"}).done((e=>{0===e.data.length&&(e.data=[{name:x.x.I18n.t("mailpoetGuideTemplateTitle"),categories:'["welcome", "notification", "standard", "woocommerce"]',readonly:!0}]),e.data.forEach(this.addTemplate),this.sortTemplates()})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,_.jsx)("p",{children:e.message},e.message))),{scroll:!0})})).always((()=>{this.selectInitialTab()}))}addTemplate(e){const t=gt.map((e=>e.name));let n;-1===t.indexOf("woocommerce")&&t.push("woocommerce");try{n=JSON.parse(e.categories).filter((e=>-1!==t.indexOf(e)))}catch(e){n=[]}0===n.length&&n.push("saved"),n.forEach((t=>{void 0===this.templates[t]&&(this.templates[t]=[]),this.templates[t].unshift(e)}))}sortTemplates(){const e=["welcome","notification","standard"];Object.keys(this.templates).forEach((t=>{this.templates[t].sort(((n,r)=>{if(e.includes(t)){if(n.categories.includes('"blank"')&&!r.categories.includes('"blank"'))return-1;if(!n.categories.includes('"blank"')&&r.categories.includes('"blank"'))return 1}return n.id<r.id?1:-1}))}))}selectInitialTab(){let e,t,n="standard";x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"get",data:{id:this.props.match.params.id}}).done((r=>{e=r.data.type,t=r.data.options,"automatic"===e&&(e=r.data.options.group||e),window.mailpoet_newsletters_templates_recently_sent_count?n="recent":w.ZP.findWhere(gt,{name:r.data.type})?n=r.data.type:"automatic"===r.data.type&&w.ZP.findWhere(gt,{name:r.data.options.group})&&(n=r.data.options.group)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,_.jsx)("p",{children:e.message},e.message))),{scroll:!0})})).always((()=>{this.setState({templates:this.templates,emailType:e,emailOptions:t,selectedTab:n,loading:!1})}))}afterTemplateDelete(e,t){e&&Object.keys(this.templates).forEach((e=>{this.templates[e]=this.templates[e].filter((e=>e.id!==t))})),this.setState({templates:this.templates,loading:!1})}afterTemplateSelect(e,t){e?window.location=(e=>`admin.php?page=mailpoet-newsletter-editor&id=${e}`)(t):this.setState({loading:!1})}afterTemplateImport(e,t){e&&this.addTemplate(t),this.setState({templates:this.templates,selectedTab:e?"saved":"import",loading:!1})}render(){if(this.state.loading)return(0,_.jsx)(Ce.g,{});const e=gt.concat({name:"import",label:x.x.I18n.t("tabImportTitle")}).map((e=>Object.assign(e,{automationId:`templates-${e.name.replace(/\s+/g,"-").toLowerCase()}`})));let t=null;if("import"===this.state.selectedTab)t=(0,_.jsx)(ft,{beforeImport:()=>this.setState({loading:!0}),afterImport:this.afterTemplateImport});else{let e=this.state.templates[this.state.selectedTab]||[];e=0===e.length?this.state.loading?null:(0,_.jsx)("p",{children:x.x.I18n.t("noTemplates")}):e.map(((e,t)=>(0,_.jsx)(ht,{index:t,newsletterId:this.props.match.params.id,beforeDelete:()=>this.setState({loading:!0}),afterDelete:this.afterTemplateDelete,beforeSelect:()=>this.setState({loading:!0}),afterSelect:this.afterTemplateSelect,id:e.id,name:e.name,thumbnail:e.thumbnail,readonly:e.readonly},e.id))),t=e}let n,r=null;if("automation"===this.state.emailType){var a;const e=null===(a=this.state.emailOptions)||void 0===a?void 0:a.automationId,t=e?`admin.php?page=mailpoet-automation-editor&id=${e}`:"admin.php?page=mailpoet-automation";n=()=>{window.location=t},r=(0,_.jsx)("input",{type:"button",className:"button link-button",onClick:n,value:"Cancel"})}return(0,_.jsxs)("div",{children:[(0,_.jsx)(Q.A,{color:"#fff"}),(0,_.jsx)(ut,{emailType:this.state.emailType,automationId:"email_template_selection_heading",buttons:r,onLogoClick:n}),(0,_.jsxs)("div",{className:"mailpoet-templates",children:[(0,_.jsx)(ct.R,{categories:e,active:this.state.selectedTab,onSelect:e=>this.setState({selectedTab:e})}),t]})]})}}xt.contextType=Te.k,xt.propTypes={match:h().shape({params:h().shape({id:h().string}).isRequired}).isRequired};var vt=n(61888),bt=n.n(vt),yt=n(88245),wt=n.n(yt),_t=n(69229),jt=n(15325),St=n.n(jt),It=n(60016),Ct=n(29514),Tt=n.n(Ct);function kt(e){let{dimension:t,isFullWidth:n,iconStart:r,iconEnd:a,...s}=e;return(0,_.jsxs)("div",{className:d()("mailpoet-datepicker mailpoet-form-input",{[`mailpoet-form-input-${t}`]:t,"mailpoet-disabled":s.disabled,"mailpoet-full-width":n}),children:[r,(0,_.jsx)(St(),{useWeekdaysShort:!0,calendarStartDay:s.calendarStartDay??x.x.wpWeekStartsOn,...s}),a]})}const Nt={abbreviated:[x.x.I18n.t("januaryShort"),x.x.I18n.t("februaryShort"),x.x.I18n.t("marchShort"),x.x.I18n.t("aprilShort"),x.x.I18n.t("mayShort"),x.x.I18n.t("juneShort"),x.x.I18n.t("julyShort"),x.x.I18n.t("augustShort"),x.x.I18n.t("septemberShort"),x.x.I18n.t("octoberShort"),x.x.I18n.t("novemberShort"),x.x.I18n.t("decemberShort")],wide:[x.x.I18n.t("january"),x.x.I18n.t("february"),x.x.I18n.t("march"),x.x.I18n.t("april"),x.x.I18n.t("may"),x.x.I18n.t("june"),x.x.I18n.t("july"),x.x.I18n.t("august"),x.x.I18n.t("september"),x.x.I18n.t("october"),x.x.I18n.t("november"),x.x.I18n.t("december")]},Dt={narrow:[x.x.I18n.t("sundayMin"),x.x.I18n.t("mondayMin"),x.x.I18n.t("tuesdayMin"),x.x.I18n.t("wednesdayMin"),x.x.I18n.t("thursdayMin"),x.x.I18n.t("fridayMin"),x.x.I18n.t("saturdayMin")],abbreviated:[x.x.I18n.t("sundayShort"),x.x.I18n.t("mondayShort"),x.x.I18n.t("tuesdayShort"),x.x.I18n.t("wednesdayShort"),x.x.I18n.t("thursdayShort"),x.x.I18n.t("fridayShort"),x.x.I18n.t("saturdayShort")],wide:[x.x.I18n.t("sunday"),x.x.I18n.t("monday"),x.x.I18n.t("tuesday"),x.x.I18n.t("wednesday"),x.x.I18n.t("thursday"),x.x.I18n.t("friday"),x.x.I18n.t("saturday")]};It.Z.localize.month=Tt()({values:Nt,defaultWidth:"wide"}),It.Z.localize.day=Tt()({values:Dt,defaultWidth:"wide"}),It.Z.options.weekStartsOn=void 0!==x.x.wpWeekStartsOn?x.x.wpWeekStartsOn:1,(0,jt.registerLocale)("mailpoet",It.Z);class Et extends y.Component{constructor(){super(...arguments),(0,b.Z)(this,"onChange",((e,t)=>{const n=t,r=this.getStorageDate(e);n.target.name=this.getFieldName(),n.target.value=r,this.props.onChange(n)})),(0,b.Z)(this,"getFieldName",(()=>this.props.name||"date")),(0,b.Z)(this,"getDisplayDateFormat",(e=>x.x.Date.convertFormat(e).replace(/D/g,"d").replace(/Y/g,"y").replace(/\[/g,"").replace(/\]/g,""))),(0,b.Z)(this,"getDate",(e=>{const t={parseFormat:this.props.storageFormat};return x.x.Date.toDate(e,t)})),(0,b.Z)(this,"getStorageDate",(e=>{const t={format:this.props.storageFormat};return x.x.Date.format(e,t)}))}render(){return(0,_.jsx)(kt,{name:this.getFieldName(),selected:this.getDate(this.props.value),dateFormat:this.getDisplayDateFormat(this.props.displayFormat),disabled:this.props.disabled,onChange:this.onChange,minDate:this.getDate(window.mailpoet_current_date),maxDate:this.props.maxDate,locale:"mailpoet",...this.props.validation})}}Et.propTypes={displayFormat:h().string.isRequired,onChange:h().func.isRequired,name:h().string,storageFormat:h().string.isRequired,value:h().string.isRequired,disabled:h().bool.isRequired,validation:h().shape({"data-parsley-required":h().bool,"data-parsley-required-message":h().string,"data-parsley-type":h().string,"data-parsley-errors-container":h().string,maxLength:h().number}).isRequired,maxDate:h().instanceOf(Date)},Et.defaultProps={name:"date",maxDate:null};class At extends y.Component{render(){const e=Object.keys(this.props.timeOfDayItems).map((e=>(0,_.jsx)("option",{value:e,children:this.props.timeOfDayItems[e]},`option-${this.props.timeOfDayItems[e]}`)));return(0,_.jsx)(ae.Select,{name:this.props.name||"time",value:this.props.value,disabled:this.props.disabled,onChange:this.props.onChange,isMinWidth:!0,...this.props.validation,children:e})}}At.propTypes={timeOfDayItems:h().objectOf(h().string).isRequired,name:h().string,value:h().string.isRequired,disabled:h().bool,onChange:h().func.isRequired,validation:h().object},At.defaultProps={name:"time",disabled:!1,validation:{}};class Ot extends y.Component{constructor(e){super(e),(0,b.Z)(this,"DATE_TIME_SEPARATOR"," "),(0,b.Z)(this,"getDateTime",(()=>[this.state.date,this.state.time].join(this.DATE_TIME_SEPARATOR))),(0,b.Z)(this,"buildStateFromProps",(e=>{const t=e.value||this.props.defaultDateTime,[n,r]=t.split(this.DATE_TIME_SEPARATOR);return{date:n,time:r}})),(0,b.Z)(this,"handleChange",(e=>{const t={};t[e.target.name]=e.target.value,this.setState(t,this.propagateChange)})),(0,b.Z)(this,"propagateChange",(()=>{this.props.onChange&&this.props.onChange({target:{name:this.props.name||"",value:this.getDateTime()}})})),this.state=this.buildStateFromProps(e)}componentDidUpdate(e){this.props.value===e.value&&this.props.defaultDateTime===e.defaultDateTime||J()((()=>{this.setState(this.buildStateFromProps(this.props))}))}render(){return(0,_.jsxs)(_t.Grid.Column,{className:"mailpoet-datetime-container",children:[(0,_.jsx)(Et,{name:"date",value:this.state.date,onChange:this.handleChange,displayFormat:this.props.dateDisplayFormat,storageFormat:this.props.dateStorageFormat,disabled:this.props.disabled,validation:this.props.dateValidation,maxDate:this.props.maxDate}),(0,_.jsx)(At,{name:"time",value:this.state.time,onChange:this.handleChange,disabled:this.props.disabled,validation:this.props.timeValidation,timeOfDayItems:this.props.timeOfDayItems})]})}}Ot.propTypes={value:h().string,defaultDateTime:h().string.isRequired,dateDisplayFormat:h().string.isRequired,dateStorageFormat:h().string.isRequired,onChange:h().func,name:h().string,disabled:h().bool,dateValidation:h().object.isRequired,timeValidation:h().any,timeOfDayItems:h().objectOf(h().string).isRequired,maxDate:h().instanceOf(Date)},Ot.defaultProps={onChange:void 0,name:"",disabled:!1,timeValidation:void 0,value:void 0,maxDate:null};var Rt=n(78046),Pt=n(38332),Mt=n(1057),Lt=n(61445);class Ft extends y.Component{constructor(e){super(e),(0,b.Z)(this,"isEmailAddressAuthorized",(e=>(window.mailpoet_authorized_emails||[]).includes(e))),(0,b.Z)(this,"showInvalidFromAddressError",(()=>{(0,Pt.Ib)(this.domElementSelector,this.parsleyFieldName," "),this.setState({showAuthEmailsError:!0})})),(0,b.Z)(this,"showSenderFieldError",((e,t)=>{window.mailpoet_mss_active&&((0,Pt.dy)(this.domElementSelector,this.parsleyFieldName),(0,Pt.K0)(this.domElementSelector)?e||this.showInvalidFromAddressError(t):(0,Pt.OP)(this.domElementSelector))})),(0,b.Z)(this,"showSenderDomainError",(e=>{e&&this.setState({showSenderDomainWarning:!0})})),this.state={emailAddress:e.item.sender_address,showSenderDomainWarning:!1,showAuthEmailsError:!1},this.onChange=this.onChange.bind(this),this.onBlur=this.onBlur.bind(this),window.mailpoet_sender_address_field_blur=this.onBlur;const t=e.field.id||`field_${e.field.name}`;this.domElementSelector=`#${t}`,this.parsleyFieldName="invalidFromAddress"}componentDidMount(){this.validateEmailAddress()}onChange(e){const t=e.target.value.toLowerCase();this.setState({emailAddress:t}),this.props.onValueChange({...e,target:{...e.target,name:e.target.name,value:t}}),this.setState({showAuthEmailsError:!1,showSenderDomainWarning:!1}),(0,Pt.dy)(this.domElementSelector,this.parsleyFieldName)}onBlur(){this.validateEmailAddress()}validateEmailAddress(){if(!window.mailpoet_mss_active)return;const e=this.state.emailAddress,t=(0,Mt.DA)(e);if(window.mailpoet_verified_sender_domains.includes(t))return;const n=this.isEmailAddressAuthorized(e);this.showSenderFieldError(n,e),x.x.freeMailDomains.indexOf(t)>-1||(0,Lt.g)(e).then((t=>{this.showSenderDomainError(t,e)})).catch((()=>{}))}render(){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(te,{item:{...this.props.item,sender_address:this.state.emailAddress},field:this.props.field,onValueChange:this.onChange,onBlurEvent:this.onBlur}),(0,_.jsx)("div",{className:"regular-text regular-text-full-width",children:(0,_.jsx)(Rt.L,{emailAddress:this.state.emailAddress,mssActive:window.mailpoet_mss_active,isEmailAuthorized:!this.state.showAuthEmailsError,showSenderDomainWarning:this.state.showSenderDomainWarning,onSuccessfulEmailOrDomainAuthorization:e=>{"email"===e.type&&(this.setState({showAuthEmailsError:!1}),x.x.trackEvent("MSS in plugin authorize email",{"authorized email source":"newsletter",wasSuccessful:"yes"})),"domain"===e.type&&(this.setState({showSenderDomainWarning:!1}),x.x.trackEvent("MSS in plugin verify sender domain",{"verify sender domain source":"newsletter",wasSuccessful:"yes"})),(0,Pt.dy)(this.domElementSelector,this.parsleyFieldName)}})})]})}}Ft.propTypes={field:h().object.isRequired,item:h().shape({sender_address:h().string.isRequired}).isRequired,onValueChange:h().func},Ft.defaultProps={onValueChange:function(){}};const qt=w.ZP.once((()=>x.x.trackEvent("User has typed a GA campaign name"))),$t=I()(x.x.I18n.t("gaCampaignTip"),/\[link\](.*?)\[\/link\]/g,((e,t)=>(0,_.jsxs)("span",{children:[(0,_.jsx)("br",{}),(0,_.jsx)("a",{href:"https://kb.mailpoet.com/article/187-track-your-newsletters-subscribers-in-google-analytics","data-beacon-article":"58b597d12c7d3a576d359144",target:"_blank",rel:"noopener noreferrer",className:"mailpoet-link",children:e})]},t))),Ut={name:"ga_campaign",label:x.x.I18n.t("gaCampaignLine"),tip:$t,type:"text",onBeforeChange:qt};var Zt=n(9134);let Vt,Wt;!function(e){e.Standard="standard",e.Automatic="automatic",e.Welcome="welcome",e.Notification="notification",e.NotificationHistory="notification_history",e.WCTransactional="wc_transactional",e.ReEngagement="re_engagement"}(Vt||(Vt={})),function(e){e.Draft="draft",e.Scheduled="scheduled",e.Sending="sending",e.Sent="sent",e.Active="active"}(Wt||(Wt={}));const Yt=window.mailpoet_current_time||"00:00",Bt=`${window.mailpoet_tomorrow_date} 08:00:00`,Ht=window.mailpoet_schedule_time_of_day,zt=window.mailpoet_date_display_format,Gt=window.mailpoet_date_storage_format;class Kt extends y.Component{constructor(){super(...arguments),(0,b.Z)(this,"getCurrentValue",(()=>{var e;return{isScheduled:"0",scheduledAt:Bt,...(null===(e=this.props.item)||void 0===e?void 0:e[this.props.field.name])??{}}})),(0,b.Z)(this,"getDateValidation",(()=>({"data-parsley-required":!0,"data-parsley-required-message":x.x.I18n.t("noScheduledDateError"),"data-parsley-errors-container":"#mailpoet_scheduling"}))),(0,b.Z)(this,"isScheduled",(()=>"1"===this.getCurrentValue().isScheduled)),(0,b.Z)(this,"handleCheckboxChange",((e,t)=>{const n={...t};n.target.value=t.target.checked?"1":"0",this.handleValueChange(n)})),(0,b.Z)(this,"handleValueChange",(e=>{const t=this.getCurrentValue(),n={};n[e.target.name]=e.target.value,this.props.onValueChange({target:{name:this.props.field.name,value:{...t,...n}}})}))}render(){let e;const t=new Date;return t.setFullYear(t.getFullYear()+5),this.isScheduled()&&(e=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("span",{className:"mailpoet-form-schedule-time",children:[x.x.I18n.t("websiteTimeIs")," ",Yt]}),(0,_.jsx)("div",{className:"mailpoet-gap"}),(0,_.jsx)("div",{id:"mailpoet_scheduling",children:(0,_.jsx)(Ot,{name:"scheduledAt",value:this.getCurrentValue().scheduledAt,onChange:this.handleValueChange,disabled:this.props.field.disabled,dateValidation:this.getDateValidation(),defaultDateTime:Bt,timeOfDayItems:Ht,dateDisplayFormat:zt,dateStorageFormat:Gt,maxDate:t})})]})),(0,_.jsxs)("div",{children:[(0,_.jsx)(Zt.Z,{checked:this.isScheduled(),disabled:this.props.field.disabled,name:"isScheduled",onCheck:this.handleCheckboxChange,automationId:"email-schedule-checkbox"}),e]})}}let Qt=[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:x.x.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:x.x.I18n.t("subjectLine"),tooltip:x.x.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":x.x.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:x.x.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:x.x.I18n.t("preheaderLine"),tooltip:`${x.x.I18n.t("preheaderLineTip1")} ${x.x.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"segments",label:x.x.I18n.t("segments"),tip:x.x.I18n.t("segmentsTip"),type:"selection",placeholder:x.x.I18n.t("selectSegmentPlaceholder"),id:"mailpoet_segments",api_version:window.mailpoet_api_version,endpoint:"segments",multiple:!0,filter:function(e){return!e.deleted_at},getLabel:function(e){return e.name},getCount:function(e){return parseInt(e.subscribers,10).toLocaleString()},transformChangedValue:function(e){const t=this.getItems()||[];return e.map((e=>t.find((t=>t.id===e))))},validation:{"data-parsley-required":!0,"data-parsley-required-message":x.x.I18n.t("noSegmentsSelectedError"),"data-parsley-segments-with-subscribers":x.x.I18n.t("noSegmentWithSubscribersSelectedError")}},{name:"options",label:x.x.I18n.t("scheduleIt"),type:"reactComponent",component:Kt},{name:"sender",label:x.x.I18n.t("sender"),tip:x.x.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:x.x.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:Ft,placeholder:x.x.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},Ut,{name:"reply-to",label:x.x.I18n.t("replyTo"),tip:x.x.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:x.x.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:x.x.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]}];Qt=Ae.Hooks.applyFilters("mailpoet_newsletters_3rd_step_fields",Qt);const Xt={getFields:()=>Qt,getSendButtonOptions:function(){var e,t;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const r=K()(window.mailpoet_current_date_time),a="object"==typeof n.options&&"1"===(null===(e=n.options)||void 0===e?void 0:e.isScheduled)&&x.x.Date.isInFuture(null===(t=n.options)||void 0===t?void 0:t.scheduledAt,r),s={value:a?x.x.I18n.t("schedule"):x.x.I18n.t("send")};return n.status!==Wt.Sent&&n.status!==Wt.Sending||(s.disabled="disabled"),s}},Jt=window.mailpoet_time_format||"H:i",en={immediate:x.x.I18n.t("delayImmediately"),hours:x.x.I18n.t("delayHoursAfter"),days:x.x.I18n.t("delayDaysAfter"),weeks:x.x.I18n.t("delayWeeksAfter")},tn={daily:x.x.I18n.t("daily"),weekly:x.x.I18n.t("weekly"),monthly:x.x.I18n.t("monthly"),nthWeekDay:x.x.I18n.t("monthlyEvery"),immediately:x.x.I18n.t("immediately")},nn=w.ZP.object(w.ZP.map(w.ZP.times(24,(e=>3600*e)),(e=>{const t=new Date(null);return t.setSeconds(e),[e,x.x.Date.format(t,{format:Jt,offset:0})]}))),rn={0:x.x.I18n.t("sunday"),1:x.x.I18n.t("monday"),2:x.x.I18n.t("tuesday"),3:x.x.I18n.t("wednesday"),4:x.x.I18n.t("thursday"),5:x.x.I18n.t("friday"),6:x.x.I18n.t("saturday")},an=w.ZP.object(w.ZP.map(w.ZP.times(28,(e=>e)),(e=>{const t={0:x.x.I18n.t("first"),1:x.x.I18n.t("second"),2:x.x.I18n.t("third")};let n;return n=void 0!==t[e]?t[e]:x.x.I18n.t("nth").replace("%1$d",e+1),[e+1,n]}))),sn={1:x.x.I18n.t("first"),2:x.x.I18n.t("second"),3:x.x.I18n.t("third"),L:x.x.I18n.t("last")},on={name:"intervalType",values:tn},ln={name:"timeOfDay",values:nn},cn={name:"weekDay",values:rn},dn={name:"monthDay",values:an},un={name:"nthWeekDay",values:sn};class pn extends y.Component{constructor(){super(...arguments),(0,b.Z)(this,"getCurrentValue",(()=>this.props.item[this.props.field.name]||{})),(0,b.Z)(this,"handleValueChanges",(e=>{const t=this.getCurrentValue();return this.props.onValueChange({target:{name:this.props.field.name,value:w.ZP.extend({},t,e)}})})),(0,b.Z)(this,"handleIntervalChange",(e=>{const t=e.target.value,n={};n.intervalType=t,"monthly"===t&&(n.monthDay="1"),this.handleValueChanges(n)})),(0,b.Z)(this,"handleTimeOfDayChange",(e=>this.handleValueChanges({timeOfDay:e.target.value}))),(0,b.Z)(this,"handleWeekDayChange",(e=>this.handleValueChanges({weekDay:e.target.value}))),(0,b.Z)(this,"handleMonthDayChange",(e=>this.handleValueChanges({monthDay:e.target.value}))),(0,b.Z)(this,"handleNthWeekDayChange",(e=>this.handleValueChanges({nthWeekDay:e.target.value})))}render(){const e=this.getCurrentValue();let t,n,r,a;return"immediately"!==e.intervalType&&(t=(0,_.jsx)(se,{field:ln,item:this.getCurrentValue(),onValueChange:this.handleTimeOfDayChange})),"weekly"!==e.intervalType&&"nthWeekDay"!==e.intervalType||(n=(0,_.jsx)(se,{field:cn,item:this.getCurrentValue(),onValueChange:this.handleWeekDayChange})),"monthly"===e.intervalType&&(r=(0,_.jsx)(se,{field:dn,item:this.getCurrentValue(),onValueChange:this.handleMonthDayChange})),"nthWeekDay"===e.intervalType&&(a=(0,_.jsx)(se,{field:un,item:this.getCurrentValue(),onValueChange:this.handleNthWeekDayChange})),(0,_.jsxs)("div",{children:[(0,_.jsxs)(_t.Grid.CenteredRow,{children:[(0,_.jsx)(se,{field:on,item:this.getCurrentValue(),onValueChange:this.handleIntervalChange,automationId:"newsletter_interval_type"}),"immediately"===e.intervalType&&(0,_.jsx)("div",{children:(0,_.jsx)("p",{children:x.x.I18n.t("postNotificationNewsletterAfterValueText")})})]}),(0,_.jsx)("div",{className:"mailpoet-gap"}),(0,_.jsxs)("div",{className:"mailpoet-grid-column mailpoet-flex",children:[a,r,n,t]}),"immediately"!==e.intervalType&&(0,_.jsx)("div",{className:"mailpoet-gap"})]})}}pn.propTypes={item:h().object.isRequired,field:h().shape({name:h().string}).isRequired,onValueChange:h().func.isRequired};let mn=[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:x.x.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:x.x.I18n.t("subjectLine"),tooltip:x.x.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":x.x.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:x.x.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:x.x.I18n.t("preheaderLine"),tooltip:`${x.x.I18n.t("preheaderLineTip1")} ${x.x.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"options",label:x.x.I18n.t("selectFrequency"),type:"reactComponent",component:pn},{name:"segments",label:x.x.I18n.t("segments"),tip:x.x.I18n.t("segmentsTip"),type:"selection",placeholder:x.x.I18n.t("selectSegmentPlaceholder"),id:"mailpoet_segments",api_version:window.mailpoet_api_version,endpoint:"segments",multiple:!0,filter:function(e){return!e.deleted_at},getLabel:function(e){return e.name},getCount:function(e){return parseInt(e.subscribers,10).toLocaleString()},transformChangedValue:function(e){const t=this.getItems();return w.ZP.map(e,(e=>w.ZP.find(t,(t=>t.id===e))))},validation:{"data-parsley-required":!0,"data-parsley-required-message":x.x.I18n.t("noSegmentsSelectedError")}},{name:"sender",label:x.x.I18n.t("sender"),tip:x.x.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:x.x.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:Ft,placeholder:x.x.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},Ut,{name:"reply-to",label:x.x.I18n.t("replyTo"),tip:x.x.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:x.x.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:x.x.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]}];mn=Ae.Hooks.applyFilters("mailpoet_newsletters_3rd_step_fields",mn);const hn={getFields:function(){return mn},getSendButtonOptions:function(){return{value:x.x.I18n.t("activate")}}},fn=window.mailpoet_roles||{},gn=w.ZP.filter(window.mailpoet_segments||[],(e=>"default"===e.type)),xn={name:"event",values:{segment:x.x.I18n.t("onSubscriptionToList"),user:x.x.I18n.t("onWPUserRegistration")}},vn={name:"segment",placeholder:x.x.I18n.t("selectSegmentPlaceholder"),forceSelect2:!0,values:gn,getCount:e=>parseInt(e.subscribers,10).toLocaleString(),getLabel:e=>e.name,getValue:e=>e.id},bn={name:"role",values:fn},yn={name:"afterTimeNumber",size:3,validation:{"data-parsley-required":!0,"data-parsley-errors-container":".mailpoet-form-errors","data-parsley-scheduled-at":x.x.I18n.t("emailCanBeScheduledUpToFiveYears")}},wn={name:"afterTimeType",values:en};class _n extends y.Component{constructor(){super(...arguments),(0,b.Z)(this,"getCurrentValue",(()=>this.props.item[this.props.field.name]||{})),(0,b.Z)(this,"handleValueChange",((e,t)=>{const n=this.getCurrentValue(),r={};let a=t;return"afterTimeNumber"===e&&(a=parseInt(t,10),a=Number.isNaN(a)?"":a),r[e]=a,this.props.onValueChange({target:{name:this.props.field.name,value:w.ZP.extend({},n,r)}})})),(0,b.Z)(this,"handleEventChange",(e=>this.handleValueChange("event",e.target.value))),(0,b.Z)(this,"handleSegmentChange",(e=>this.handleValueChange("segment",e.target.value))),(0,b.Z)(this,"handleRoleChange",(e=>this.handleValueChange("role",e.target.value))),(0,b.Z)(this,"handleAfterTimeNumberChange",(e=>this.handleValueChange("afterTimeNumber",e.target.value))),(0,b.Z)(this,"handleAfterTimeTypeChange",(e=>this.handleValueChange("afterTimeType",e.target.value)))}render(){const e=this.getCurrentValue();let t,n;return t="user"===e.event?(0,_.jsx)(se,{field:bn,item:this.getCurrentValue(),onValueChange:this.handleRoleChange}):(0,_.jsx)(j,{field:vn,item:this.getCurrentValue(),onValueChange:this.handleSegmentChange}),"immediate"!==e.afterTimeType&&(n=(0,_.jsx)(te,{field:yn,item:this.getCurrentValue(),onValueChange:this.handleAfterTimeNumberChange})),(0,_.jsxs)("div",{children:[(0,_.jsx)(se,{field:xn,item:this.getCurrentValue(),onValueChange:this.handleEventChange}),(0,_.jsx)("div",{className:"mailpoet-gap"}),t,(0,_.jsx)("div",{className:"mailpoet-gap"}),(0,_.jsxs)("div",{className:"mailpoet-grid-column mailpoet-flex",children:[n,(0,_.jsx)(se,{field:wn,item:this.getCurrentValue(),onValueChange:this.handleAfterTimeTypeChange})]}),(0,_.jsx)("div",{className:"mailpoet-form-errors"}),(0,_.jsx)("div",{className:"mailpoet-gap"})]})}}_n.propTypes={history:h().shape({push:h().func.isRequired}).isRequired,item:h().object.isRequired,field:h().shape({name:h().string}).isRequired,onValueChange:h().func.isRequired};const jn=(0,l.EN)(_n);let Sn=[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:x.x.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:x.x.I18n.t("subjectLine"),tooltip:x.x.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":x.x.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:x.x.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:x.x.I18n.t("preheaderLine"),tooltip:`${x.x.I18n.t("preheaderLineTip1")} ${x.x.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"options",label:x.x.I18n.t("selectEventToSendWelcomeEmail"),type:"reactComponent",component:jn},Ut,{name:"sender",label:x.x.I18n.t("sender"),tip:x.x.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:x.x.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:Ft,placeholder:x.x.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},{name:"empty",type:"empty"},{name:"reply-to",label:x.x.I18n.t("replyTo"),tip:x.x.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:x.x.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:x.x.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]}];Sn=Ae.Hooks.applyFilters("mailpoet_newsletters_3rd_step_fields",Sn);const In={getFields:function(){return Sn},getSendButtonOptions:function(){return{value:x.x.I18n.t("activate")}}};class Cn extends y.Component{constructor(e){super(e);const{item:t,event:n}=this.props;this.handleChange=this.handleChange.bind(this);const r=t.afterTimeType||n.defaultAfterTimeType||"immediate",a="minutes"===r?30:1,s=t.afterTimeNumber||a;this.state={afterTimeType:r,afterTimeNumber:s},t.afterTimeNumber===s&&t.afterTimeType===r||this.propagateChange(this.state)}handleChange(e,t){let{value:n}=e.target;"afterTimeNumber"===t&&(n=parseInt(e.target.value,10),n=Number.isNaN(n)?null:n);const r={[t]:n},{afterTimeType:a}=this.state;"afterTimeType"===t&&a!==n&&("minutes"===a&&(r.afterTimeNumber=1),"minutes"===n&&(r.afterTimeNumber=30)),this.setState(r,this.propagateChange(r))}displayAfterTimeTypeOptions(){const{event:e}=this.props;let t=en;e.timeDelayValues&&(t=Object.entries(e.timeDelayValues).reduce(((e,t)=>{let[n,r]=t;return e[n]=r.text,e}),{}));const{afterTimeType:n}=this.state,r={field:{id:"scheduling_time_interval",name:"scheduling_time_interval",forceSelect2:!0,values:w.ZP.map(t,((e,t)=>({name:e,id:t}))),extendSelect2Options:{minimumResultsForSearch:1/0},selected:()=>n},onValueChange:w.ZP.partial(this.handleChange,w.ZP,"afterTimeType")};return(0,_.jsx)(j,{field:r.field,onValueChange:r.onValueChange})}displayAfterTimeNumberField(){const{afterTimeNumberSize:e,event:t}=this.props,{afterTimeType:n,afterTimeNumber:r}=this.state;if("immediate"===n)return null;if(t.timeDelayValues&&t.timeDelayValues[n]&&!t.timeDelayValues[n].displayAfterTimeNumberField)return null;const a={field:{id:"scheduling_time_duration",name:"scheduling_time_duration",defaultValue:r?r.toString():"",size:e,validation:{"data-parsley-required":!0,"data-parsley-errors-container":".mailpoet-form-errors","data-parsley-scheduled-at":x.x.I18n.t("emailCanBeScheduledUpToFiveYears")}},item:{},onValueChange:w.ZP.partial(this.handleChange,w.ZP,"afterTimeNumber")};return(0,_.jsx)(te,{field:a.field,item:a.item,onValueChange:a.onValueChange})}propagateChange(e){const{onValueChange:t}=this.props;t&&t(e)}render(){const{event:e}=this.props;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("h4",{children:[" ",x.x.I18n.t("whenToSendMail")," "]}),(0,_.jsxs)(_t.Grid.CenteredRow,{className:"mailpoet-re-engagement-scheduling",children:[this.displayAfterTimeNumberField(),this.displayAfterTimeTypeOptions(),e.afterDelayText&&(0,_.jsx)("p",{children:e.afterDelayText})]}),(0,_.jsx)("div",{className:"mailpoet-form-errors"}),(0,_.jsx)("div",{className:"mailpoet-gap"}),e.schedulingReadMoreLink&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("a",{href:e.schedulingReadMoreLink.link,target:"_blank",rel:"noopener noreferrer",className:"event-scheduling-read-more-link",children:e.schedulingReadMoreLink.text}),(0,_.jsx)("div",{className:"mailpoet-gap"})]})]})}}function Tn(e){const t=e&&e.values?e.values:[];return t?t.map((e=>({id:e.id,name:e.name}))):t}function kn(e){let{eventOptions:t,eventSlug:n,selected:r,onValueChange:a}=e;function s(e){a&&a({eventOptionValue:e.target.value})}return(0,_.jsx)("div",{children:(0,_.jsx)("div",{className:"event-option-selection",children:function(){if(!t)return t;const e={field:{name:`event_options_${n}`,forceSelect2:!0,endpoint:t.endpoint,resetSelect2OnUpdate:!0,values:Tn(t),multiple:t.multiple||!1,placeholder:t.placeholder||!1,transformChangedValue:(e,t)=>w.ZP.map(t,(e=>({id:e.id,name:e.text}))),selected:()=>r,getLabel:w.ZP.property("name"),getValue:w.ZP.property("id"),validation:{"data-parsley-required":!0}},onValueChange:s,item:{action:""}};return"product_categories"===t.endpoint&&(e.field.name="category_ids",e.item={action:"purchasedCategory"}),"products"===t.endpoint&&(e.field.name="product_ids",e.item={action:"purchasedProduct"}),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(j,{field:e.field,onValueChange:e.onValueChange,item:e.item}),(0,_.jsx)("div",{className:"mailpoet-gap"})]})}()})})}Cn.propTypes={item:h().shape({afterTimeType:h().string.isRequired,afterTimeNumber:h().number}).isRequired,afterTimeNumberSize:h().number,onValueChange:h().func,event:h().shape({defaultAfterTimeType:h().string,afterDelayText:h().string,timeDelayValues:h().objectOf(h().shape({text:h().string,displayAfterTimeNumberField:h().bool})),schedulingReadMoreLink:h().shape({link:h().string.isRequired,text:h().string.isRequired})}).isRequired},Cn.defaultProps={afterTimeNumberSize:3,onValueChange:null};class Nn extends y.Component{constructor(e){super(e);const{field:t}=e;this.handleChange=this.handleChange.bind(this),this.email=t.email,this.emailOptions=t.emailOptions,this.events=w.ZP.indexBy(this.email.events,"slug"),this.segments=w.ZP.filter(window.mailpoet_segments,(e=>null===e.deleted_at));const n=this.events[this.emailOptions.event],r=this.emailOptions.afterTimeType||n.defaultAfterTimeType||"immediate";this.state={event:n,afterTimeType:r,eventSlug:this.emailOptions.event,eventOptionValue:null,afterTimeNumber:this.emailOptions.afterTimeNumber||1,segment:this.emailOptions.segment?this.emailOptions.segment:null}}handleChange(e){const{afterTimeNumber:t}=this.state,n=e;n.afterTimeType&&"immediate"===n.afterTimeType?n.afterTimeNumber=null:!n.afterTimeType||n.afterTimeNumber||t||(n.afterTimeNumber=1),this.setState(e,this.propagateChange)}displayScheduling(){const{afterTimeNumber:e,afterTimeType:t,event:n}=this.state,r={item:{afterTimeNumber:e,afterTimeType:t},event:n,onValueChange:this.handleChange};return(0,_.jsx)(Cn,{item:r.item,event:r.event,onValueChange:r.onValueChange})}displaySegments(){const{segment:e}=this.state;if("user"===this.emailOptions.sendTo)return null;const t={field:{id:"segments",forceSelect2:!0,values:this.segments,extendSelect2Options:{minimumResultsForSearch:1/0},selected:()=>e},onValueChange:e=>this.handleChange({segment:e.target.value})};return(0,_.jsx)("div",{className:"event-segment-selection",children:(0,_.jsx)(j,{field:t.field,onValueChange:t.onValueChange})})}displayEventOptions(){const{event:e,eventSlug:t}=this.state;let n;try{n=JSON.parse(this.emailOptions.meta||null)}catch(e){n=this.emailOptions.meta||null}const r={emailSlug:this.email.slug,eventSlug:t,onValueChange:this.handleChange,eventOptions:e.options||null};return n&&n.option&&("remote"===r.eventOptions.type&&(r.eventOptions.values=n.option),r.selected=w.ZP.map(n.option,(e=>e.id))),(0,_.jsx)(kn,{emailSlug:r.emailSlug,eventSlug:r.eventSlug,eventOptions:r.eventOptions,onValueChange:r.onValueChange,selected:r.selected})}displayHeader(){const{event:e}=this.state;return e.title}propagateChange(){const{eventSlug:e,afterTimeType:t,afterTimeNumber:n,segment:r,eventOptionValue:a}=this.state,{onValueChange:s}=this.props;if(!s)return;const i={group:this.email.slug,event:e,afterTimeType:t};n&&(i.afterTimeNumber=n),r&&(i.segment=r),a&&(i.meta=JSON.stringify({option:this.state.eventOptionValue})),s({target:{name:"options",value:i}})}render(){return(0,_.jsxs)("div",{children:[(0,_.jsx)(he.X,{level:5,children:this.displayHeader()}),this.displayEventOptions(),this.displaySegments(),this.displayScheduling()]})}}Nn.propTypes={field:h().shape({email:h().shape({events:h().object.isRequired}).isRequired,emailOptions:h().object.isRequired}).isRequired,onValueChange:h().func},Nn.defaultProps={onValueChange:null};const Dn=window.mailpoet_woocommerce_automatic_emails||[],En={getFields:function(e){return(e=>{const t=Dn[e.options.group];if(!t)return!1;const n=e.options;return[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:x.x.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:x.x.I18n.t("subjectLine"),tooltip:x.x.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":x.x.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:x.x.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:x.x.I18n.t("preheaderLine"),tooltip:`${x.x.I18n.t("preheaderLineTip1")} ${x.x.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"options",label:x.x.I18n.t("sendAutomaticEmailWhenHeading").replace("%1s",t.title),type:"reactComponent",component:Nn,email:t,emailOptions:n},Ut,{name:"sender",label:x.x.I18n.t("sender"),tip:x.x.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:x.x.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"text",placeholder:x.x.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},{name:"empty",type:"empty"},{name:"reply-to",label:x.x.I18n.t("replyTo"),tip:x.x.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:x.x.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:x.x.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]}]})(e)},getSendButtonOptions:function(){return{value:x.x.I18n.t("activate")}}};var An=n(30211);function On(e){let{afterTimeNumber:t,afterTimeType:n,updateAfterTimeNumber:r,updateAfterTimeType:a,inactiveSubscribersPeriod:s}=e;const i="weeks"===n?7:30,o=Number(t)*i;let l=s;return 365===s&&(l=360),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(he.X,{level:4,children:x.x.I18n.t("selectEventToSendReEngagementEmail")}),(0,_.jsxs)(_t.Grid.CenteredRow,{className:"mailpoet-re-engagement-scheduling",children:[(0,_.jsx)("p",{children:x.x.I18n.t("reEngagementTextPre")}),(0,_.jsx)(ee.I,{type:"text",placeholder:x.x.I18n.t("reEngagementAterTimeNumberPlaceholder"),value:t,onChange:(0,Mt.z2)(r)}),(0,_.jsxs)(ae.Select,{value:n,onChange:(0,Mt.z2)(a),children:[(0,_.jsx)("option",{value:"weeks",children:"weeks"}),(0,_.jsx)("option",{value:"months",children:"months"})]})]}),!!s&&l<=o&&(0,_.jsx)("p",{className:"mailpoet-re-engagement-scheduling-note",children:I()(x.x.I18n.t("reEngagementEmailWarning").replace("{$months}",`${Math.floor(s/30)}`),/\[link\](.*?)\[\/link\]/g,(e=>(0,_.jsx)("a",{href:"https://kb.mailpoet.com/article/264-inactive-subscribers",target:"_blank",rel:"noopener noreferrer","data-beacon-article":"5cbf19622c7d3a026fd3efe1",children:e},"link")))})]})}const Rn=[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:x.x.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:x.x.I18n.t("subjectLine"),tooltip:x.x.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":x.x.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:x.x.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:x.x.I18n.t("preheaderLine"),tooltip:`${x.x.I18n.t("preheaderLineTip1")} ${x.x.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"options",type:"reactComponent",component:function(e){return(0,_.jsx)(On,{afterTimeNumber:e.item.options.afterTimeNumber.toString(),afterTimeType:e.item.options.afterTimeType,inactiveSubscribersPeriod:Number(x.x.deactivateSubscriberAfterInactiveDays),updateAfterTimeNumber:t=>{e.onValueChange({target:{name:"options",value:(0,An.assoc)("afterTimeNumber",t,e.item.options)}})},updateAfterTimeType:t=>{e.onValueChange({target:{name:"options",value:(0,An.assoc)("afterTimeType",t,e.item.options)}})}})}},{name:"segments",label:x.x.I18n.t("segments"),tip:x.x.I18n.t("segmentsTip"),type:"selection",placeholder:x.x.I18n.t("selectSegmentPlaceholder"),id:"mailpoet_segments",api_version:x.x.apiVersion,endpoint:"segments",multiple:!0,filter:function(e){return!e.deleted_at&&"dynamic"!==e.type},getLabel:function(e){return e.name},getCount:function(e){return parseInt(e.subscribers,10).toLocaleString()},transformChangedValue:function(e){const t=this.getItems();return(0,An.map)((e=>(0,An.find)((t=>t.id===e),t)),e)},validation:{"data-parsley-required":!0,"data-parsley-required-message":x.x.I18n.t("noSegmentsSelectedError")}},{name:"sender",label:x.x.I18n.t("sender"),tip:x.x.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:x.x.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:Ft,placeholder:x.x.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},{name:"reply-to",label:x.x.I18n.t("replyTo"),tip:x.x.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:x.x.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:x.x.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]},Ut],Pn={getFields:()=>Rn,getSendButtonOptions:()=>({value:x.x.I18n.t("activate")})};var Mn=n(1740);let Ln=null;var Fn=n(33357);const qn=window.mailpoet_woocommerce_automatic_emails||[],$n=(e,t)=>`${wt()(t,{strict:!0,lower:!0})||"email"}-${e}`,Un=e=>"immediate"===e.afterTimeType?"immediate":`${e.afterTimeNumber} ${e.afterTimeType}`;function Zn(e){let t,n;return e&&e.body&&e.body.content&&(n=e.body.content,t=JSON.stringify(e.body.content),!n.blocks||!Array.isArray(n.blocks)||0===n.blocks.length)?x.x.I18n.t("newsletterIsEmpty"):window.mailpoet_mss_active&&t.indexOf("[link:subscription_unsubscribe_url]")<0&&t.indexOf("[link:subscription_unsubscribe]")<0?x.x.I18n.t("unsubscribeLinkMissing"):"re_engagement"===e.type&&t.indexOf("[link:subscription_re_engage_url]")<0?x.x.I18n.t("reEngageLinkMissing"):"notification"===e.type&&t.indexOf('"type":"automatedLatestContent"')<0&&t.indexOf('"type":"automatedLatestContentLayout"')<0?x.x.I18n.t("automatedLatestContentMissing"):"standard"===e.type&&"sent"===e.status?x.x.I18n.t("emailAlreadySent"):"re_engagement"!==e.type||x.x.trackingConfig.emailTrackingEnabled?void 0:(0,_.jsx)("span",{style:{pointerEvents:"all"},children:I()(x.x.I18n.t("reEngagementEmailsDisableIfTrackingIs"),/\[link\](.*?)\[\/link\]/g,(e=>(0,_.jsx)("a",{href:"?page=mailpoet-settings#/advanced",rel:"noopener noreferrer",children:e},"advancedSettingsTabLink")))})}class Vn extends y.Component{constructor(e){super(e),(0,b.Z)(this,"getFieldsByNewsletter",(e=>this.getSubtype(e).getFields(e))),(0,b.Z)(this,"getSendButtonOptions",(()=>this.getSubtype(this.state.item).getSendButtonOptions(this.state.item))),(0,b.Z)(this,"getSubtype",(e=>{switch(e.type){case"notification":return hn;case"welcome":return In;case"re_engagement":return Pn;case"automatic":if(qn[e.options.group])return En;default:return Xt}})),(0,b.Z)(this,"getThumbnailPromise",(e=>this.state.thumbnailPromise?this.state.thumbnailPromise:(0,Mn.W0)(e))),(0,b.Z)(this,"isValid",(()=>p()("#mailpoet_newsletter").parsley().isValid())),(0,b.Z)(this,"isValidFromAddress",(async()=>{if("MailPoet"!==window.mailpoet_mta_method)return!0;const e=await this.loadVerifiedSenderDomains(),t=(0,Mt.DA)(this.state.item.sender_address);if(-1!==e.indexOf(t))return!0;const n=await this.loadAuthorizedEmailAddresses(),r=this.state.item.sender_address;return-1!==n.indexOf(r)})),(0,b.Z)(this,"isGaFieldDisabled",(()=>!window.mailpoet_premium_active)),(0,b.Z)(this,"loadItem",(e=>(this.setState({loading:!0}),x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"get",data:{id:e}}).done((e=>{const t="draft"===e.data.status?this.getThumbnailPromise(e.meta.preview_url):null,n=e.data;if("automation"===n.type){var r;const e=null===(r=n.options)||void 0===r?void 0:r.automationId,t=e?`admin.php?page=mailpoet-automation-editor&id=${e}`:"/new";return this.setState({item:{}},(()=>{this.props.history.push(t)}))}return n.ga_campaign||this.isGaFieldDisabled()||(n.ga_campaign=$n(n.id,n.subject)),this.setState({item:e.data,fields:this.getFieldsByNewsletter(e.data),thumbnailPromise:t,validationError:Zn(e.data)}),!0})).fail((()=>{this.setState({item:{}},(()=>{this.props.history.push("/new")}))}))))),(0,b.Z)(this,"saveTemplate",((e,t)=>{this.getThumbnailPromise(e.meta.preview_url).then((n=>{x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"save",data:{newsletter_id:e.data.id,name:e.data.subject,thumbnail_data:n,body:JSON.stringify(e.data.body),categories:'["recent"]'}}).fail((e=>{this.showError(e),this.setState({loading:!1}),x.x.Modal.loading(!1)})),t()})).catch((e=>{this.showError({errors:[e]})}))})),(0,b.Z)(this,"loadAuthorizedEmailAddresses",(async()=>{if("MailPoet"!==window.mailpoet_mta_method)return[];const e=(await x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"mailer",action:"getAuthorizedEmailAddresses"})).data||[];return window.mailpoet_authorized_emails=e,e})),(0,b.Z)(this,"loadVerifiedSenderDomains",(async()=>"MailPoet"!==window.mailpoet_mta_method?[]:(await x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"mailer",action:"getVerifiedSenderDomains"})).data||[])),(0,b.Z)(this,"handleSend",(e=>(e.preventDefault(),this.isValid()?(x.x.Modal.loading(!0),this.isValidFromAddress().then((t=>t?this.saveNewsletter(e).done((()=>{this.setState({loading:!0})})).done((e=>{switch(e.data.type){case"notification":case"welcome":case"automatic":case"re_engagement":return this.activateNewsletter(e);default:return this.sendNewsletter(e)}})).fail((e=>{this.showError(e),this.setState({loading:!1}),x.x.Modal.loading(!1)})):(window.mailpoet_sender_address_field_blur(),x.x.Modal.loading(!1))))):p()("#mailpoet_newsletter").parsley().validate()))),(0,b.Z)(this,"sendNewsletter",(e=>x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sendingQueue",action:"add",data:{newsletter_id:this.state.item.id}}).done((t=>{this.saveTemplate(e,(()=>{if(window.mailpoet_show_congratulate_after_first_newsletter)return x.x.Modal.loading(!1),void this.props.history.push(`/send/congratulate/${this.state.item.id}`);this.props.history.push(`/${this.state.item.type||""}`);let n=[];e.data.segments.map((e=>n.push(...e.filters))),n=bt().uniqWith(n,((e,t)=>e.action===t.action&&e.type===t.type));const r=n.map((e=>function(e){const t=e.action,n=e.type;if("email"===n)switch(t){case"machineOpensAbsoluteCount":return"# of machine-opens";case"opensAbsoluteCount":return"# of opens";case"numberOfOrders":return"# of orders";case"clicked":return"clicked";case"clickedAny":return"clicked any email";case"opened":return"opened";case"machineOpened":return"machine-opened";default:return""}if("userRole"===n)switch(t){case"subscriberTag":return"subscriber tags";case"subscribedToList":return"subscribed to list";case"subscriberScore":return"score";case"wordpressRole":return"WordPress user role";case"mailpoetCustomField":return"MailPoet custom field";default:return""}if("woocommerce"===n)switch(t){case"customerInCountry":return"is in country";case"purchasedCategory":return"purchased in category";case"purchasedProduct":return"purchased product";case"subscribedDate":return"subscribed date";case"totalSpent":return"total spent";default:return""}return"woocommerceSubscription"===n&&"hasActiveSubscription"===t?"has an active subscription":"woocommerceMembership"===n&&"isMemberOf"===t?"is active member of":""}(e))).join(", ");"scheduled"===t.data.status?(this.context.notices.success((0,_.jsx)("p",{children:x.x.I18n.t("newsletterHasBeenScheduled")})),x.x.trackEvent("Emails > Newsletter sent",{scheduled:!0,segments:r})):(this.context.notices.success((0,_.jsx)("p",{children:x.x.I18n.t("newsletterBeingSent")}),{id:"mailpoet_notice_being_sent"}),x.x.trackEvent("Emails > Newsletter sent",{scheduled:!1,segments:r})),x.x.Modal.loading(!1)}))})).fail((e=>{this.showError(e),this.setState({loading:!1}),x.x.Modal.loading(!1)})))),(0,b.Z)(this,"activateNewsletter",(e=>x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"setStatus",data:{id:this.props.match.params.id,status:"active"}}).done((t=>{this.saveTemplate(e,(()=>{if(window.mailpoet_show_congratulate_after_first_newsletter)return x.x.Modal.loading(!1),void this.props.history.push(`/send/congratulate/${this.state.item.id}`);const e=this.state.item.options;this.props.history.push("automatic"===this.state.item.type?`/${e.group}`:`/${this.state.item.type||""}`),"automatic"===this.state.item.type&&qn[e.group]?(this.context.notices.success((0,_.jsx)("p",{children:x.x.I18n.t("automaticEmailActivated").replace("%1s",qn[e.group].title)})),x.x.trackEvent("Emails > Automatic email activated",{Type:wt()(`${e.group}-${e.event}`),Delay:Un(e)})):"welcome"===t.data.type?(this.context.notices.success((0,_.jsx)("p",{children:x.x.I18n.t("welcomeEmailActivated")})),x.x.trackEvent("Emails > Welcome email activated",{"List type":e.event,Delay:Un(e)})):"re_engagement"===t.data.type?(this.context.notices.success((0,_.jsx)("p",{children:x.x.I18n.t("reEngagementEmailActivated")})),x.x.trackEvent("Emails > Re-engagement email activated",{Inactivity:Un(e)})):"notification"===t.data.type&&(this.context.notices.success((0,_.jsx)("p",{children:x.x.I18n.t("postNotificationActivated")})),x.x.trackEvent("Emails > Post notifications activated",{Frequency:e.intervalType})),x.x.Modal.loading(!1)}))})).fail((e=>{this.showError(e),this.setState({loading:!1}),x.x.Modal.loading(!1)})))),(0,b.Z)(this,"handleResume",(e=>(e.preventDefault(),this.isValid()?this.saveNewsletter(e).done((()=>{this.setState({loading:!0})})).done((()=>{x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sendingQueue",action:"resume",data:{newsletter_id:this.state.item.id}}).done((()=>{this.props.history.push(`/${this.state.item.type||""}`),this.context.notices.success((0,_.jsx)("p",{children:x.x.I18n.t("newsletterSendingHasBeenResumed")}))})).fail((e=>{this.showError(e)}))})).fail((e=>{this.showError(e)})).always((()=>{this.setState({loading:!1})})):p()("#mailpoet_newsletter").parsley().validate(),!1))),(0,b.Z)(this,"handleSave",(e=>{e.preventDefault(),this.saveNewsletter(e).done((()=>{this.context.notices.success((0,_.jsx)("p",{children:x.x.I18n.t("newsletterUpdated")}))})).done((()=>{const e="automatic"===this.state.item.type?this.state.item.options.group:this.state.item.type;this.props.history.push(`/${e||""}`)})).fail((e=>{this.showError(e)}))})),(0,b.Z)(this,"handleRedirectToDesign",(e=>{e.preventDefault();const t=e.target.href;this.saveNewsletter(e).done((()=>{this.context.notices.success((0,_.jsx)("p",{children:x.x.I18n.t("newsletterUpdated")}))})).done((()=>{window.location=t})).fail((e=>{this.showError(e)}))})),(0,b.Z)(this,"saveNewsletter",(()=>{const e=this.state.item;e.queue=void 0,this.setState({loading:!0});const t=bt().omit(e,["body","created_at","deleted_at","hash","status","updated_at","type"]);return x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"save",data:t})})),(0,b.Z)(this,"showError",(e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,_.jsx)("p",{children:e.message},e.message))),{scroll:!0,timeout:!1})})),(0,b.Z)(this,"handleFormChange",(e=>{const t=e.target.name,n=e.target.value;return this.setState((e=>{const r=e.item,a=r.subject,s=r.ga_campaign;return r[t]=n,"subject"===t&&s===$n(r.id,a)&&(r.ga_campaign=$n(r.id,n)),"reply_to_address"===t&&(r[t]=n.toLowerCase()),{item:r}})),!0})),(0,b.Z)(this,"handleSaveDraft",(()=>{p()("#mailpoet_newsletter").parsley().destroy()})),(0,b.Z)(this,"disableSegmentsSelectorWhenPaused",(e=>t=>"segments"===t.name||"options"===t.name?{...t,disabled:e}:t)),(0,b.Z)(this,"disableGAIfPremiumInactive",(e=>t=>{if("ga_campaign"===t.name){let n=()=>{};return e()&&(n=()=>this.setState({showPremiumModal:!0})),{...t,disabled:e,onWrapperClick:n}}return t})),(0,b.Z)(this,"getPreparedFields",((e,t)=>this.state.fields.map(this.disableSegmentsSelectorWhenPaused(e)).map(this.disableGAIfPremiumInactive(t)))),(0,b.Z)(this,"closePremiumModal",(()=>this.setState({showPremiumModal:!1}))),this.state={fields:[],item:{},loading:!0,thumbnailPromise:null,showPremiumModal:!1}}componentDidMount(){this.loadItem(this.props.match.params.id).always((()=>{this.setState({loading:!1})})),p()("#mailpoet_newsletter").parsley({successClass:""})}componentDidUpdate(e){this.props.match.params.id!==e.match.params.id&&this.loadItem(this.props.match.params.id).always((()=>{this.setState({loading:!1})}))}render(){const{showPremiumModal:e,item:{status:t,queue:n,type:r,options:a}}=this.state,s="sending"===t&&n&&"paused"===n.status,i=this.getSendButtonOptions(),o=this.getPreparedFields(s,this.isGaFieldDisabled),l=!(!window.mailpoet_subscribers_limit_reached&&!window.mailpoet_mss_key_pending_approval&&void 0===this.state.validationError);let c=r;return"automatic"===c&&(c=a.group||c),(0,_.jsxs)("div",{className:"mailpoet-form-send-email",children:[(0,_.jsx)(Q.A,{color:"#fff"}),(0,_.jsx)(ut,{emailType:c,automationId:"newsletter_send_heading"}),(0,_.jsxs)(be,{id:"mailpoet_newsletter",fields:o,automationId:"newsletter_send_form",item:this.state.item,loading:this.state.loading,onChange:this.handleFormChange,onSubmit:this.handleSave,children:[(0,_.jsxs)(_t.Grid.CenteredRow,{className:"send-newsletter-buttons",children:[(0,_.jsx)(f.Button,{variant:"secondary",type:"submit",automationId:"email-save-draft",onClick:this.handleSaveDraft,isDisabled:this.state.loading,children:x.x.I18n.t("saveDraftAndClose")}),s?(0,_.jsx)(f.Button,{type:"button",onClick:this.handleResume,isDisabled:l||this.state.loading,automationId:"email-resume",children:x.x.I18n.t("resume")}):(0,_.jsx)(f.Button,{type:"button",onClick:this.handleSend,...i,isDisabled:l||this.state.loading,automationId:"email-submit",children:i.value||x.x.I18n.t("send")}),void 0!==this.state.validationError&&(0,_.jsx)(O.Tooltip,{tooltip:(0,_.jsx)("div",{children:this.state.validationError}),tooltipId:"helpTooltipSendEmail"})]}),(0,_.jsxs)("p",{children:[x.x.I18n.t("orSimply")," ",(0,_.jsx)("a",{className:"mailpoet-link",href:`?page=mailpoet-newsletter-editor&id=${this.props.match.params.id}`,onClick:this.handleRedirectToDesign,children:x.x.I18n.t("goBackToDesign")}),"."]}),window.mailpoet_mss_key_pending_approval&&(0,_.jsx)("div",{className:"mailpoet_error",children:I()(x.x.I18n.t("pendingKeyApprovalNotice"),/\[link\](.*?)\[\/link\]/g,(e=>(0,_.jsx)("a",{href:"https://account.mailpoet.com/authorization",target:"_blank",rel:"noopener noreferrer",children:e},"pendingKeyApprovalNoticeLink")))}),e&&(0,_.jsx)(Fn.Z,{onRequestClose:this.closePremiumModal,children:x.x.I18n.t("gaOnlyAvailableForPremium")})]})]})}}Vn.contextType=Te.k,Vn.propTypes={match:h().shape({params:h().shape({id:h().string}).isRequired}).isRequired,history:h().shape({push:h().func.isRequired}).isRequired};const Wn=(0,l.EN)(Vn);function Yn(e){const[t,n]=(0,y.useState)(!1);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(he.X,{level:0,children:x.x.I18n.t("congratulationsSuccessHeader")}),(0,_.jsx)(he.X,{level:3,children:(r=e.newsletter,"welcome"===r.type?x.x.I18n.t("congratulationsWelcomeEmailSuccessBody"):"notification"===r.type?x.x.I18n.t("congratulationsPostNotificationSuccessBody"):"automatic"===r.type?x.x.I18n.t("congratulationsWooSuccessBody"):"scheduled"===r.status?x.x.I18n.t("congratulationsScheduleSuccessBody"):x.x.I18n.t("congratulationsSendSuccessBody"))}),(0,_.jsx)("div",{className:"mailpoet-gap-large"}),(0,_.jsx)("div",{className:"mailpoet-gap-large"}),(0,_.jsx)("img",{src:e.illustrationImageUrl,alt:"",width:"500"}),(0,_.jsx)("div",{className:"mailpoet-gap-large"}),(0,_.jsx)(f.Button,{type:"button",dimension:"small",onClick:()=>{e.successClicked(),n(!0)},withSpinner:t,children:x.x.I18n.t("close")})]});var r}function Bn(e){return(0,_.jsxs)("div",{className:"mailpoet-wizard-step",children:[(0,_.jsx)("div",{className:"mailpoet-wizard-step-illustration",children:(0,_.jsx)("img",{src:e.illustrationUrl,width:"500",alt:""})}),(0,_.jsx)("div",{className:"mailpoet-wizard-step-content",children:e.children})]})}function Hn(e){let{children:t,isOrdered:n}=e;const r=n?"ol":"ul";return(0,_.jsx)(r,{className:`mailpoet-${r}`,children:t})}function zn(){return(0,_.jsxs)(Hn,{children:[(0,_.jsx)("li",{children:x.x.I18n.t("welcomeWizardMSSList1")}),(0,_.jsx)("li",{children:x.x.I18n.t("welcomeWizardMSSList2")}),(0,_.jsx)("li",{children:x.x.I18n.t("welcomeWizardMSSList4")}),(0,_.jsx)("li",{children:x.x.I18n.t("welcomeWizardMSSList5")})]})}function Gn(){return(0,_.jsxs)(Hn,{children:[(0,_.jsx)("li",{children:x.x.I18n.t("welcomeWizardMSSNotFreeList1")}),(0,_.jsx)("li",{children:x.x.I18n.t("welcomeWizardMSSNotFreeList2")}),(0,_.jsx)("li",{children:x.x.I18n.t("welcomeWizardMSSNotFreeList3")}),(0,_.jsx)("li",{children:x.x.I18n.t("welcomeWizardMSSNotFreeList4")}),(0,_.jsx)("li",{children:x.x.I18n.t("welcomeWizardMSSNotFreeList5")})]})}function Kn(e){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("div",{className:"mailpoet-gap"}),(0,_.jsx)("div",{className:"mailpoet-gap"}),(0,_.jsx)(f.Button,{isFullWidth:!0,href:e.mailpoetAccountUrl,target:"_blank",rel:"noopener noreferrer",onClick:t=>{t.preventDefault(),window.open(e.mailpoetAccountUrl),e.next()},children:e.nextButtonText}),(0,_.jsx)(f.Button,{isFullWidth:!0,variant:"tertiary",onClick:e.next,onKeyDown:t=>{["keydown","keypress"].includes(t.type)&&["Enter"," "].includes(t.key)&&(t.preventDefault(),e.next())},withSpinner:e.nextWithSpinner,children:x.x.I18n.t("welcomeWizardMSSNoThanks")})]})}function Qn(e){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(he.X,{level:1,children:x.x.I18n.t("welcomeWizardMSSFreeTitle")}),(0,_.jsx)("div",{className:"mailpoet-gap"}),(0,_.jsx)("p",{children:x.x.I18n.t("welcomeWizardMSSFreeSubtitle")}),(0,_.jsx)("div",{className:"mailpoet-gap"}),(0,_.jsxs)(he.X,{level:5,children:[x.x.I18n.t("welcomeWizardMSSFreeListTitle"),":"]}),(0,_.jsx)(zn,{}),(0,_.jsx)(Kn,{mailpoetAccountUrl:x.x.MailPoetComUrlFactory.getPurchasePlanUrl(x.x.subscribersCount,x.x.currentWpUserEmail,"starter",{utm_medium:"onboarding",utm_campaign:"purchase"}),next:e.next,nextButtonText:x.x.I18n.t("welcomeWizardMSSFreeButton")})]})}function Xn(e){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(he.X,{level:1,children:x.x.I18n.t("welcomeWizardMSSNotFreeTitle")}),(0,_.jsx)("div",{className:"mailpoet-gap"}),(0,_.jsxs)("p",{children:[x.x.I18n.t("welcomeWizardMSSNotFreeSubtitle"),":"]}),(0,_.jsx)(Gn,{}),(0,_.jsx)(Kn,{mailpoetAccountUrl:e.mailpoetAccountUrl,next:e.next,nextButtonText:x.x.I18n.t("welcomeWizardMSSNotFreeButton")})]})}function Jn(e){return e.subscribersCount<1e3?(0,_.jsx)(Qn,{mailpoetAccountUrl:e.mailpoetAccountUrl,next:e.next}):(0,_.jsx)(Xn,{mailpoetAccountUrl:e.purchaseUrl,next:e.next})}function er(e){const[t,n]=(0,y.useState)(!1);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(he.X,{level:1,children:(r=e.newsletter.type,{standard:x.x.I18n.t("congratulationsMSSPitchHeader"),welcome:x.x.I18n.t("congratulationsMSSPitchHeaderAutomated"),notification:x.x.I18n.t("congratulationsMSSPitchHeaderAutomated"),woocommerce:x.x.I18n.t("congratulationsMSSPitchHeaderAutomated")}[r]||x.x.I18n.t("congratulationsMSSPitchHeaderAutomated"))}),(0,_.jsx)(Bn,{illustrationUrl:e.MSSPitchIllustrationUrl,children:(0,_.jsxs)("div",{className:"mailpoet-welcome-wizard-step-content",children:[(0,_.jsx)(he.X,{level:4,children:x.x.I18n.t("congratulationsMSSPitchSubHeader")}),(0,_.jsx)("p",{children:x.x.I18n.t(e.subscribersCount<1e3?"welcomeWizardMSSFreeSubtitle":"welcomeWizardMSSNotFreeSubtitle")}),(0,_.jsxs)(he.X,{level:5,children:[x.x.I18n.t("welcomeWizardMSSFreeListTitle"),":"]}),(0,_.jsx)(zn,{}),(0,_.jsx)(Kn,{mailpoetAccountUrl:e.purchaseUrl,next:()=>{e.onFinish(),n(!0)},nextButtonText:x.x.I18n.t("welcomeWizardMSSFreeButton"),nextWithSpinner:t})]})})]});var r}function tr(e){return window.has_mss_key_specified?(0,_.jsx)(Yn,{successClicked:e.successClicked,illustrationImageUrl:e.illustrationImageUrl,newsletter:e.newsletter}):(0,_.jsx)(er,{MSSPitchIllustrationUrl:e.MSSPitchIllustrationUrl,onFinish:e.successClicked,subscribersCount:e.subscribersCount,purchaseUrl:e.purchaseUrl,newsletter:e.newsletter})}function nr(e){const[t,n]=(0,y.useState)(!1);return(0,_.jsxs)("div",{children:[(0,_.jsx)(he.X,{level:1,children:x.x.I18n.t("congratulationsSendFailHeader")}),(0,_.jsx)(he.X,{level:3,children:I()(x.x.I18n.t("congratulationsSendFailExplain"),/\[link\](.*?)\[\/link\]/g,((e,t)=>(0,_.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:"https://kb.mailpoet.com/article/231-sending-does-not-work","data-beacon-article":"5a0257ac2c7d3a272c0d7ad6",children:e},t)))}),(0,_.jsx)("div",{className:"mailpoet-gap-large"}),(0,_.jsx)("div",{className:"mailpoet-gap-large"}),(0,_.jsx)("img",{src:window.mailpoet_congratulations_error_image,alt:"",width:"500"}),(0,_.jsx)("div",{className:"mailpoet-gap-large"}),(0,_.jsx)(f.Button,{dimension:"small",type:"button",onClick:()=>{e.failClicked(),n(!0)},withSpinner:t,children:x.x.I18n.t("close")})]})}Yn.propTypes={successClicked:h().func.isRequired,illustrationImageUrl:h().string.isRequired,newsletter:h().shape({status:h().string.isRequired,type:h().string.isRequired}).isRequired},Bn.propTypes={illustrationUrl:h().string.isRequired,children:h().oneOfType([h().arrayOf(h().node),h().node]).isRequired},Kn.propTypes={mailpoetAccountUrl:h().string.isRequired,next:h().func.isRequired,nextButtonText:h().string.isRequired,nextWithSpinner:h().bool},Kn.defaultProps={nextWithSpinner:!1},Qn.propTypes={next:h().func.isRequired},Xn.propTypes={mailpoetAccountUrl:h().string.isRequired,next:h().func.isRequired},Jn.propTypes={next:h().func.isRequired,subscribersCount:h().number.isRequired,mailpoetAccountUrl:h().string.isRequired,purchaseUrl:h().string.isRequired},tr.propTypes={successClicked:h().func.isRequired,illustrationImageUrl:h().string.isRequired,MSSPitchIllustrationUrl:h().string.isRequired,newsletter:h().shape({status:h().string.isRequired,type:h().string.isRequired}).isRequired,subscribersCount:h().number.isRequired,purchaseUrl:h().string.isRequired},nr.propTypes={failClicked:h().func.isRequired};var rr=n(59001);function ar(e){return(0,_.jsx)("div",{className:"mailpoet-congratulate-loading",children:e.showRichLoadingScreen&&(0,_.jsxs)("div",{children:[(0,_.jsx)(he.X,{level:0,children:x.x.I18n.t("congratulationsLoadingHeader")}),(0,_.jsx)(he.X,{level:3,children:x.x.I18n.t("congratulationsLoadingBody")}),(0,_.jsx)("div",{className:"mailpoet-gap-large"}),(0,_.jsx)("div",{className:"mailpoet-gap-large"}),(0,_.jsx)(rr.a,{size:64})]})})}ar.propTypes={showRichLoadingScreen:h().bool.isRequired};const sr=Math.floor(4*Math.random());function ir(){return x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"settings",action:"set",data:{show_congratulate_after_first_newsletter:!1}}).always((()=>{window.location=window.mailpoet_main_page}))}class or extends y.Component{constructor(e){super(e),this.state={loading:!0,newsletter:null,testingPassed:!1,timeStart:K()(),minimumLoadingTimePassed:!1},this.tick=this.tick.bind(this)}componentDidMount(){this.loadNewsletter(this.props.match.params.id),this.tick()}componentDidUpdate(e){e.match.params.id!==this.props.match.params.id&&this.loadNewsletter(this.props.match.params.id)}tick(){K()().subtract(20,"second").isAfter(this.state.timeStart)&&this.setState({error:!0,loading:!1}),this.state.loading&&this.loadNewsletter(this.props.match.params.id),K()().subtract(6,"seconds").isAfter(this.state.timeStart)&&this.setState({minimumLoadingTimePassed:!0}),!this.state.loading&&this.state.minimumLoadingTimePassed||setTimeout(this.tick,2e3)}loadNewsletter(e){x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"get",data:{id:e}}).done((e=>this.newsletterLoaded(e.data)))}newsletterLoaded(e){"standard"!==e.type||"scheduled"===e.status?this.setState({newsletter:e,loading:!1,minimumLoadingTimePassed:!0}):"sent"===e.status||"sending"===e.status?this.setState({newsletter:e,loading:!1,testingPassed:!0}):this.setState({newsletter:e})}renderContent(){return this.state.loading||!this.state.minimumLoadingTimePassed?(e=!this.state.newsletter,(0,_.jsx)(ar,{illustrationImageUrl:window.mailpoet_congratulations_loading_image,successClicked:ir,showRichLoadingScreen:e})):this.state.error?(x.x.trackEvent("Cron testing done",{"Cron is working":"false"}),(0,_.jsx)(nr,{failClicked:()=>{window.location=window.mailpoet_main_page}})):(t=this.state.newsletter,this.state.testingPassed&&x.x.trackEvent("Cron testing done",{"Cron is working":"true"}),(0,_.jsx)(tr,{illustrationImageUrl:window.mailpoet_congratulations_success_images[sr],MSSPitchIllustrationUrl:window.mailpoet_congratulations_success_images[sr],successClicked:ir,newsletter:t,isWoocommerceActive:window.mailpoet_woocommerce_active,subscribersCount:window.mailpoet_subscribers_count,purchaseUrl:x.x.MailPoetComUrlFactory.getPurchasePlanUrl(x.x.subscribersCount,x.x.currentWpUserEmail,"starter",{utm_medium:"first-newsletter-congratulations",utm_campaign:"purchase"})}));var e,t}render(){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("style",{dangerouslySetInnerHTML:{__html:"body { background: #fff; overflow-x: hidden; }"}}),(0,_.jsxs)("div",{className:"mailpoet-congratulate",children:[(0,_.jsx)("div",{className:"mailpoet-gap-large"}),this.renderContent()]})]})}}or.propTypes={match:h().shape({params:h().shape({id:h().string}).isRequired}).isRequired};class lr extends y.Component{constructor(){super(...arguments),(0,b.Z)(this,"showTemplateSelection",(e=>{this.props.history.push(`/template/${e}`)}))}componentDidMount(){x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:{type:"standard"}}).done((e=>{this.showTemplateSelection(e.data.id)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,_.jsx)("p",{children:e.message},e.message))),{scroll:!0})}))}render(){return(0,_.jsx)("div",{children:(0,_.jsx)(ut,{emailType:"standard",automationId:"standard_newsletter_creation_heading"})})}}lr.contextType=Te.k,lr.propTypes={history:h().shape({push:h().func.isRequired}).isRequired};const cr=(0,l.EN)(lr),dr={name:"options",type:"reactComponent",component:pn};class ur extends y.Component{constructor(e){super(e),(0,b.Z)(this,"handleValueChange",(e=>{const t=this.state;t[e.target.name]=e.target.value,this.setState(t)})),(0,b.Z)(this,"handleNext",(()=>{x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:w.ZP.extend({},this.state,{type:"notification",subject:x.x.I18n.t("draftPostNotificationTitle")})}).done((e=>{this.showTemplateSelection(e.data.id)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,_.jsx)("p",{children:e.message},e.message))),{scroll:!0})}))})),(0,b.Z)(this,"showTemplateSelection",(e=>{this.props.history.push(`/template/${e}`)})),this.state={options:{intervalType:"daily",timeOfDay:0,weekDay:1,monthDay:0,nthWeekDay:1}}}render(){return(0,_.jsxs)("div",{children:[(0,_.jsx)(Q.A,{color:"#fff"}),(0,_.jsx)(ut,{emailType:"notification",automationId:"post_notification_creation_heading"}),(0,_.jsxs)(_t.Grid.Column,{align:"center",className:"mailpoet-schedule-email",children:[(0,_.jsx)(he.X,{level:4,children:x.x.I18n.t("selectEventToSendPostNotificationEmail")}),(0,_.jsx)(pn,{item:this.state,field:dr,onValueChange:this.handleValueChange}),(0,_.jsx)(E.z,{isFullWidth:!0,onClick:this.handleNext,type:"button",children:x.x.I18n.t("next")})]})]})}}ur.contextType=Te.k,ur.propTypes={history:h().shape({push:h().func.isRequired}).isRequired};const pr=(0,l.EN)(ur),mr={name:"options",label:"Event",type:"reactComponent",component:jn};class hr extends y.Component{constructor(e){super(e),(0,b.Z)(this,"isValid",(()=>p()("#welcome_scheduling").parsley().isValid())),(0,b.Z)(this,"validate",(()=>p()("#welcome_scheduling").parsley().validate()));let t=window.mailpoet_segments||[],n=1;t=t.filter((e=>"default"===e.type)),w.ZP.size(t)>0&&(n=w.ZP.first(t).id),this.state={options:{event:"segment",segment:n,role:"subscriber",afterTimeNumber:1,afterTimeType:"immediate"}},this.handleValueChange=this.handleValueChange.bind(this),this.handleNext=this.handleNext.bind(this)}handleValueChange(e){const{state:t}=this;t[e.target.name]=e.target.value,this.setState(t)}handleNext(e){e.preventDefault(),this.isValid()?x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:w.ZP.extend({},this.state,{type:"welcome",subject:x.x.I18n.t("draftNewsletterTitle")})}).done((e=>{this.showTemplateSelection(e.data.id)})).fail((e=>{e.errors.length>0&&x.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})})):this.validate()}showTemplateSelection(e){this.props.history.push(`/template/${e}`)}render(){return(0,_.jsxs)("div",{children:[(0,_.jsx)(Q.A,{color:"#fff"}),(0,_.jsx)(ut,{emailType:"welcome",automationId:"welcome_email_creation_heading"}),(0,_.jsxs)(_t.Grid.Column,{align:"center",className:"mailpoet-schedule-email",children:[(0,_.jsx)(he.X,{level:4,children:x.x.I18n.t("selectEventToSendWelcomeEmail")}),(0,_.jsxs)("form",{id:"welcome_scheduling",children:[(0,_.jsx)(jn,{item:this.state,field:mr,onValueChange:this.handleValueChange}),(0,_.jsx)(E.z,{isFullWidth:!0,type:"submit",onClick:this.handleNext,children:x.x.I18n.t("next")})]})]})]})}}hr.propTypes={history:h().shape({push:h().func.isRequired}).isRequired};class fr extends y.Component{static getEventOptions(e){return e.options||null}static getEventOptionsFirstValue(e){return e&&w.ZP.isArray(e.values)&&e.values[0].id?e.values[0].id:null}constructor(e){super(e),(0,b.Z)(this,"isValid",(()=>!p()("#newsletter_scheduling").parsley()||p()("#newsletter_scheduling").parsley().isValid())),(0,b.Z)(this,"validate",(()=>{p()("#newsletter_scheduling").parsley()&&p()("#newsletter_scheduling").parsley().validate()})),(0,b.Z)(this,"resetValidationErrors",(()=>{p()("#newsletter_scheduling").parsley()&&p()("#newsletter_scheduling").parsley().reset()}));const{email:t,name:n}=e;this.handleChange=this.handleChange.bind(this),this.handleNextStep=this.handleNextStep.bind(this),this.email=t,this.emailEvents=this.email.events,this.segments=w.ZP.filter(window.mailpoet_segments,(e=>null===e.deleted_at));const r=this.getEvent(n),a=this.constructor.getEventOptions(r),s=this.constructor.getEventOptionsFirstValue(a);this.state={event:r,eventSlug:r.slug,eventOptionValue:s,segment:r.sendToLists?this.getFirstSegment():null,afterTimeType:r.defaultAfterTimeType||"immediate",afterTimeNumber:null}}handleChange(e){const{segment:t,afterTimeNumber:n}=this.state,r=e;if(r.eventSlug){r.event=this.getEvent(r.eventSlug),r.segment=r.event.sendToLists?t||this.getFirstSegment():null;const e=this.constructor.getEventOptions(r.event);r.eventOptionValue=e?this.constructor.getEventOptionsFirstValue(e):null}r.afterTimeType&&"immediate"===r.afterTimeType?r.afterTimeNumber=null:!r.afterTimeType||r.afterTimeNumber||n||(r.afterTimeNumber=1),this.setState(r),this.resetValidationErrors(),this.isValid()&&this.validate()}handleNextStep(e){if(e.preventDefault(),!this.isValid())return void this.validate();const{history:t}=this.props,{eventSlug:n,afterTimeType:r,afterTimeNumber:a,event:s,segment:i,eventOptionValue:o}=this.state,l={group:this.email.slug,event:n,afterTimeType:r};a&&(l.afterTimeNumber=a),l.sendTo=s.sendToLists?"segment":"user",i&&(l.segment=i),o&&(l.meta=JSON.stringify({option:o})),x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:{type:"automatic",subject:x.x.I18n.t("draftNewsletterTitle"),options:l}}).done((e=>{x.x.trackEvent("Emails > New Automatic Email Created",{"Event type":l.event,"Schedule type":l.afterTimeType,"Schedule value":l.afterTimeNumber}),t.push(`/template/${e.data.id}`)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,_.jsx)("p",{children:e.message},e.message))),{scroll:!0})}))}getEvent(e){return this.emailEvents[e]}getFirstSegment(){return w.ZP.isArray(this.segments)&&this.segments[0].id?this.segments[0].id:null}displayHeader(){const{event:e}=this.state;return e.title}displayEventOptions(){const{eventSlug:e,event:t}=this.state,n={emailSlug:this.email.slug,eventSlug:e,eventOptions:this.constructor.getEventOptions(t),onValueChange:this.handleChange};return(0,_.jsx)(kn,{emailSlug:n.emailSlug,eventSlug:n.eventSlug,eventOptions:n.eventOptions,onValueChange:n.onValueChange})}displaySegments(){const{event:e}=this.state;if(!e.sendToLists)return null;const t={field:{id:"segments",forceSelect2:!0,values:this.segments,extendSelect2Options:{minimumResultsForSearch:1/0}},onValueChange:e=>this.handleChange({segment:e.target.value})};return(0,_.jsx)("div",{className:"event-segment-selection",children:(0,_.jsx)(j,{field:t.field,onValueChange:t.onValueChange})})}displayScheduling(){const{afterTimeNumber:e,afterTimeType:t,event:n}=this.state,r={item:{afterTimeNumber:e,afterTimeType:t},event:n,onValueChange:this.handleChange};return(0,_.jsx)(Cn,{item:r.item,event:r.event,onValueChange:r.onValueChange})}displayEventTip(){const{event:e}=this.state;return e.tip?(0,_.jsxs)("p",{className:"description",children:[(0,_.jsx)("strong",{children:x.x.I18n.t("tip")})," ",e.tip]}):null}render(){return(0,_.jsxs)("div",{children:[(0,_.jsx)(Q.A,{color:"#fff"}),(0,_.jsx)(ut,{emailType:"woocommerce",automationId:"woocommerce_email_creation_heading"}),(0,_.jsx)(_t.Grid.Column,{align:"center",className:"mailpoet-schedule-email",children:(0,_.jsxs)("form",{id:"newsletter_scheduling",children:[(0,_.jsx)(he.X,{level:4,children:this.displayHeader()}),(0,_.jsx)("div",{children:this.displayEventOptions()}),(0,_.jsx)("div",{children:this.displaySegments()}),(0,_.jsx)("div",{children:this.displayScheduling()}),(0,_.jsx)(E.z,{isFullWidth:!0,onClick:this.handleNextStep,type:"submit",children:x.x.I18n.t("next")})]})}),this.displayEventTip()]})}}fr.contextType=Te.k,fr.propTypes={history:h().shape({push:h().func.isRequired}).isRequired,name:h().string.isRequired,email:h().shape({title:h().string.isRequired,slug:h().string.isRequired}).isRequired};var gr=n(11879),xr=n(84188),vr=n(70792);const br=h().shape({status:h().string,count_processed:h().string.isRequired,count_total:h().string.isRequired,scheduled_at:h().string}),yr=h().shape({id:h().number.isRequired,sent_at:h().string,status:h().string.isRequired,queue:h().oneOfType([br,h().bool])});function wr(e){let{newsletter:t}=e;const[n,r]=(0,y.useState)("paused"===t.queue.status),[a,s]=(0,y.useState)([]);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(He,{errors:a}),n&&(0,_.jsx)(E.z,{dimension:"small",onClick:()=>{s([]),x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sendingQueue",action:"resume",data:{newsletter_id:t.id}}).done((()=>r(!1))).fail((e=>s(e.errors)))},children:x.x.I18n.t("resume")}),!n&&(0,_.jsx)(E.z,{dimension:"small",onClick:()=>{s([]),x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sendingQueue",action:"pause",data:{newsletter_id:t.id}}).done((()=>r(!0))).fail((e=>s(e.errors)))},children:x.x.I18n.t("pause")})]})}function _r(e){let{newsletter:t,mailerLog:n}=e,r=t.sent_at||t.queue.scheduled_at;r&&(r=(0,xr.default)(r,"yyyy-MM-dd HH:mm:ss",new Date));const a=t.queue&&"scheduled"!==t.queue.status,s="paused"===n.status,i=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(o.Link,{to:`/sending-status/${t.id}`,"data-automation-id":`sending_status_${t.id}`,children:(0,_.jsx)(vr.s,{processed:parseInt(t.queue.count_processed,10),scheduledFor:r,total:parseInt(t.queue.count_total,10),isPaused:s,status:t.status})}),"completed"!==t.queue.status&&!s&&(0,_.jsx)(wr,{newsletter:t})]}),l=(0,_.jsx)(vr.s,{scheduledFor:r,isPaused:"scheduled"===t.queue.status&&s,status:t.status});return(0,_.jsxs)(_.Fragment,{children:[a&&i,!a&&l]})}wr.propTypes={newsletter:yr.isRequired},_r.propTypes={newsletter:yr.isRequired,mailerLog:h().shape({status:h().string}).isRequired};const jr=x.x.trackingConfig.emailTrackingEnabled,Sr={onNoItemsFound:(e,t)=>x.x.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneNewsletterTrashed"):x.x.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneNewsletterDeleted"):x.x.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneNewsletterRestored"):x.x.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)}},Ir=[{name:"subject",label:x.x.I18n.t("subject"),sortable:!0},{name:"status",label:x.x.I18n.t("status")},{name:"segments",label:x.x.I18n.t("lists")},{name:"statistics",label:x.x.I18n.t("statistics"),display:jr},{name:"sent_at",label:x.x.I18n.t("sentOn"),sortable:!0}],Cr=[{name:"trash",label:x.x.I18n.t("moveToTrash"),onSuccess:Sr.onTrash}],Tr=e=>{const t=()=>{window.location.href=`?page=mailpoet-newsletter-editor&id=${e.id}`};e.queue&&"sending"===e.status&&null===e.queue.status?(0,mt._)({message:x.x.I18n.t("confirmEdit"),onConfirm:t}):t()};let kr=[{name:"view",link:function(e){return(0,_.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:x.x.I18n.t("preview")})}},{name:"edit",className:"mailpoet-hide-on-mobile",label:x.x.I18n.t("edit"),onClick:Tr},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:x.x.I18n.t("duplicate"),onClick:function(e,t){return x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{x.x.Notice.success(x.x.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&x.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}},{name:"trash",className:"mailpoet-hide-on-mobile"}];kr=(0,$e.y8)(kr);class Nr extends y.Component{constructor(e){super(e),(0,b.Z)(this,"renderItem",((e,t,n)=>{const r=d()("manage-column","column-primary","has-row-actions");return(0,_.jsxs)("div",{children:[(0,_.jsxs)("td",{className:r,children:[(0,_.jsx)("a",{className:"mailpoet-listing-title",href:"#",onClick:t=>{t.preventDefault(),Tr(e)},children:e.queue.newsletter_rendered_subject||e.subject}),t]}),(0,_.jsx)("td",{className:"column mailpoet-listing-status-column","data-colname":x.x.I18n.t("status"),children:(0,_.jsx)(_r,{newsletter:e,mailerLog:n.mta_log})}),(0,_.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("lists"),children:(0,_.jsx)(gr.$,{segments:e.segments,dimension:"large"})}),!0===jr?(0,_.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":x.x.I18n.t("statistics"),children:(0,_.jsx)(Xe,{newsletter:e,currentTime:n.current_time})}):null,(0,_.jsx)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("sentOn"),children:e.sent_at?(0,_.jsxs)(_.Fragment,{children:[x.x.Date.short(e.sent_at),(0,_.jsx)("br",{}),x.x.Date.time(e.sent_at)]}):null})]})})),(0,b.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return(0,_.jsxs)(_.Fragment,{children:[0===this.state.newslettersCount&&(0,_.jsx)(Ke,{filter:e=>"standard"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&(0,_.jsx)(g.N,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,endpoint:"newsletters",type:"standard",base_url:"standard",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:Ir,bulk_actions:Cr,item_actions:kr,messages:Sr,auto_refresh:!0,sort_by:"sent_at",sort_order:"desc",afterGetItems:e=>{if(!e.loading){const t=e.groups.reduce(((e,t)=>e+t.count),0);this.setState({newslettersCount:t})}(0,$e._X)(e),(0,$e.bF)(e)}})]})}}Nr.contextType=Te.k,Nr.propTypes={location:h().object.isRequired,match:h().shape({params:h().object}).isRequired};const Dr=(0,l.EN)(Nr),Er=window.mailpoet_roles||{},Ar=window.mailpoet_segments||{},Or=x.x.trackingConfig.emailTrackingEnabled,Rr={onNoItemsFound:(e,t)=>x.x.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneNewsletterTrashed"):x.x.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneNewsletterDeleted"):x.x.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneNewsletterRestored"):x.x.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)}},Pr=[{name:"subject",label:x.x.I18n.t("subject"),sortable:!0},{name:"settings",label:x.x.I18n.t("settings")},{name:"statistics",label:x.x.I18n.t("statistics"),display:Or},{name:"status",label:x.x.I18n.t("status"),width:145},{name:"updated_at",label:x.x.I18n.t("lastModifiedOn"),sortable:!0}],Mr=[{name:"trash",label:x.x.I18n.t("moveToTrash"),onSuccess:Rr.onTrash}];let Lr=[{name:"view",link:function(e){return(0,_.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:x.x.I18n.t("preview")})}},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:x.x.I18n.t("duplicate"),onClick:(e,t)=>x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{x.x.Notice.success(x.x.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&x.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},{name:"edit",className:"mailpoet-hide-on-mobile",label:x.x.I18n.t("edit"),onClick:$e.Q2},{name:"trash",className:"mailpoet-hide-on-mobile"}];Lr=(0,$e.y8)(Lr);class Fr extends y.Component{constructor(e){super(e),(0,b.Z)(this,"updateStatus",((e,t)=>{t.persist(),x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"setStatus",data:{id:Number(t.target.getAttribute("data-id")),status:e?"active":"draft"}}).done((e=>{"active"===e.data.status&&x.x.Notice.success(x.x.I18n.t("welcomeEmailActivated")),this.forceUpdate()})).fail((n=>{x.x.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,b.Z)(this,"renderStatus",(e=>{const t=x.x.I18n.t("sentToXSubscribers").replace("%1$d",e.total_sent.toLocaleString()),n=x.x.I18n.t("scheduledToXSubscribers").replace("%1$d",e.total_scheduled.toLocaleString());return(0,_.jsxs)("div",{children:[(0,_.jsx)(Zt.Z,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"active"===e.status}),(0,_.jsxs)("p",{className:"mailpoet-listing-stats-description",children:[(0,_.jsx)(o.Link,{to:`/sending-status/${e.id}`,"data-automation-id":`sending_status_${e.id}`,children:t})," ",(0,_.jsx)("br",{}),n]})]})})),(0,b.Z)(this,"renderSettings",(e=>{let t,n,r;if("user"===e.options.event)t="mailpoet_all"===e.options.role?x.x.I18n.t("welcomeEventWPUserAnyRole"):I()(x.x.I18n.t("welcomeEventWPUserWithRole"),"%1$s",((t,n)=>(0,_.jsx)(Ne.V,{variant:"list",children:Er[e.options.role]},n)));else{if(r=w.ZP.find(Ar,(t=>Number(t.id)===Number(e.options.segment))),void 0===r)return(0,_.jsx)(o.Link,{className:"mailpoet-listing-error",to:`/send/${e.id}`,children:x.x.I18n.t("sendingToSegmentsNotSpecified")});t=I()(x.x.I18n.t("welcomeEventSegment"),"%1$s",((e,t)=>(0,_.jsx)(Ne.V,{variant:"list",children:r.name},t)))}if(t&&"immediate"!==e.options.afterTimeType)switch(e.options.afterTimeType){case"minutes":n=x.x.I18n.t("sendingDelayMinutes").replace("%1$d",e.options.afterTimeNumber);break;case"hours":n=x.x.I18n.t("sendingDelayHours").replace("%1$d",e.options.afterTimeNumber);break;case"days":n=x.x.I18n.t("sendingDelayDays").replace("%1$d",e.options.afterTimeNumber);break;case"weeks":n=x.x.I18n.t("sendingDelayWeeks").replace("%1$d",e.options.afterTimeNumber);break;default:n=x.x.I18n.t("sendingDelayInvalid")}return(0,_.jsxs)("span",{children:[t,n&&(0,_.jsxs)("div",{className:"mailpoet-listing-schedule",children:[(0,_.jsx)("div",{className:"mailpoet-listing-schedule-icon",children:(0,_.jsx)(vr.P,{})}),n]})]})})),(0,b.Z)(this,"renderItem",((e,t)=>{const n=d()("manage-column","column-primary","has-row-actions");return(0,_.jsxs)("div",{children:[(0,_.jsxs)("td",{className:n,children:[(0,_.jsx)("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`,children:e.subject}),t]}),(0,_.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("settings"),children:this.renderSettings(e)}),!0===Or?(0,_.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":x.x.I18n.t("statistics"),children:(0,_.jsx)(Xe,{newsletter:e,isSent:e.total_sent>0&&!!e.statistics})}):null,(0,_.jsx)("td",{className:"column","data-colname":x.x.I18n.t("status"),children:this.renderStatus(e)}),(0,_.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("lastModifiedOn"),children:[x.x.Date.short(e.updated_at),(0,_.jsx)("br",{}),x.x.Date.time(e.updated_at)]})]})})),(0,b.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return(0,_.jsxs)(_.Fragment,{children:[0===this.state.newslettersCount&&(0,_.jsx)(Ke,{filter:e=>"welcome"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&(0,_.jsx)(g.N,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,endpoint:"newsletters",type:"welcome",base_url:"welcome",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:Pr,bulk_actions:Mr,item_actions:Lr,messages:Rr,auto_refresh:!0,sort_by:"updated_at",sort_order:"desc",afterGetItems:e=>{if(!e.loading){const t=e.groups.reduce(((e,t)=>e+t.count),0);this.setState({newslettersCount:t})}(0,$e._X)(e),(0,$e.bF)(e)}})]})}}Fr.propTypes={location:h().object.isRequired,match:h().shape({params:h().object}).isRequired};const qr=(0,l.EN)(Fr),$r={onNoItemsFound:(e,t)=>x.x.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneNewsletterTrashed"):x.x.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneNewsletterDeleted"):x.x.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneNewsletterRestored"):x.x.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)}},Ur=[{name:"subject",label:x.x.I18n.t("subject"),sortable:!0},{name:"settings",label:x.x.I18n.t("settings")},{name:"history",label:x.x.I18n.t("history"),width:100},{name:"status",label:x.x.I18n.t("status"),width:100},{name:"updated_at",label:x.x.I18n.t("lastModifiedOn"),sortable:!0}],Zr=[{name:"trash",label:x.x.I18n.t("moveToTrash"),onSuccess:$r.onTrash}],Vr=[{name:"view",link:function(e){return(0,_.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:x.x.I18n.t("preview")})}},{name:"edit",className:"mailpoet-hide-on-mobile",label:x.x.I18n.t("edit"),onClick:$e.Q2},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:x.x.I18n.t("duplicate"),onClick:function(e,t){return x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{x.x.Notice.success(x.x.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&x.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}},{name:"trash",className:"mailpoet-hide-on-mobile"}];class Wr extends y.Component{constructor(e){super(e),(0,b.Z)(this,"updateStatus",((e,t)=>{t.persist(),x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"setStatus",data:{id:Number(t.target.getAttribute("data-id")),status:e?"active":"draft"}}).done((e=>{"active"===e.data.status&&x.x.Notice.success(x.x.I18n.t("postNotificationActivated")),this.forceUpdate()})).fail((n=>{x.x.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,b.Z)(this,"renderStatus",(e=>(0,_.jsx)(Zt.Z,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"active"===e.status}))),(0,b.Z)(this,"renderSettings",(e=>{let t;if(0===e.segments.length)return(0,_.jsx)(o.Link,{className:"mailpoet-listing-error",to:`/send/${e.id}`,children:x.x.I18n.t("sendingToSegmentsNotSpecified")});const n=I()(x.x.I18n.t("sendTo"),"%1$s",((t,n)=>(0,_.jsx)(gr.$,{segments:e.segments},n)));switch(e.options.intervalType){case"daily":t=x.x.I18n.t("sendDaily").replace("%1$s",nn[e.options.timeOfDay]);break;case"weekly":t=x.x.I18n.t("sendWeekly").replace("%1$s",rn[e.options.weekDay]).replace("%2$s",nn[e.options.timeOfDay]);break;case"monthly":t=x.x.I18n.t("sendMonthly").replace("%1$s",an[e.options.monthDay]).replace("%2$s",nn[e.options.timeOfDay]);break;case"nthWeekDay":t=x.x.I18n.t("sendNthWeekDay").replace("%1$s",sn[e.options.nthWeekDay]).replace("%2$s",rn[e.options.weekDay]).replace("%3$s",nn[e.options.timeOfDay]);break;case"immediately":t=x.x.I18n.t("sendImmediately");break;default:t="Invalid sending frequency"}return(0,_.jsxs)("span",{children:[n,(0,_.jsxs)("div",{className:"mailpoet-listing-schedule",children:[(0,_.jsx)("div",{className:"mailpoet-listing-schedule-icon",children:(0,_.jsx)(vr.P,{})}),t]})]})})),(0,b.Z)(this,"renderHistoryLink",(e=>0===Number(e.children_count)?(0,_.jsx)("span",{className:"mailpoet-listing-status-unknown mailpoet-font-extra-small mailpoet-listing-notification-status",children:x.x.I18n.t("notSentYet")}):(0,_.jsxs)(o.Link,{className:"mailpoet-nowrap","data-automation-id":`history-${e.id}`,to:`/notification/history/${e.id}`,children:[(0,_.jsx)(E.z,{className:"mailpoet-hide-on-mobile",dimension:"small",children:x.x.I18n.t("viewHistory")}),(0,_.jsx)(E.z,{className:"mailpoet-show-on-mobile mailpoet-listing-notification-status",dimension:"small",variant:"secondary",children:x.x.I18n.t("viewHistory")})]}))),(0,b.Z)(this,"renderItem",((e,t)=>{const n=d()("manage-column","column-primary","has-row-actions");return(0,_.jsxs)("div",{children:[(0,_.jsxs)("td",{className:n,children:[(0,_.jsx)("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`,children:e.subject}),t]}),(0,_.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("settings"),children:this.renderSettings(e)}),(0,_.jsx)("td",{className:"column","data-colname":x.x.I18n.t("history"),children:this.renderHistoryLink(e)}),(0,_.jsx)("td",{className:"column","data-colname":x.x.I18n.t("status"),children:this.renderStatus(e)}),(0,_.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("lastModifiedOn"),children:[x.x.Date.short(e.updated_at),(0,_.jsx)("br",{}),x.x.Date.time(e.updated_at)]})]})})),(0,b.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return(0,_.jsxs)(_.Fragment,{children:[0===this.state.newslettersCount&&(0,_.jsx)(Ke,{filter:e=>"notification"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&(0,_.jsx)(g.N,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,endpoint:"newsletters",type:"notification",base_url:"notification",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:Ur,bulk_actions:Zr,item_actions:Vr,messages:$r,auto_refresh:!0,sort_by:"updated_at",sort_order:"desc",afterGetItems:e=>{if(!e.loading){const t=e.groups.reduce(((e,t)=>e+t.count),0);this.setState({newslettersCount:t})}(0,$e._X)(e),(0,$e.bF)(e)}})]})}}Wr.propTypes={location:h().object.isRequired,match:h().shape({params:h().object}).isRequired};const Yr=(0,l.EN)(Wr),Br=x.x.trackingConfig.emailTrackingEnabled,Hr={onNoItemsFound:(e,t)=>x.x.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneNewsletterTrashed"):x.x.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneNewsletterDeleted"):x.x.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneNewsletterRestored"):x.x.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)}},zr=[{name:"subject",label:x.x.I18n.t("subject"),sortable:!0},{name:"settings",label:x.x.I18n.t("settings")},{name:"statistics",label:x.x.I18n.t("statistics"),display:Br},{name:"status",label:x.x.I18n.t("status"),width:145},{name:"updated_at",label:x.x.I18n.t("lastModifiedOn"),sortable:!0}],Gr=[{name:"trash",label:x.x.I18n.t("moveToTrash"),onSuccess:Hr.onTrash}];let Kr=[{name:"view",link:function(e){return(0,_.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:x.x.I18n.t("preview")})}},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:x.x.I18n.t("duplicate"),onClick:(e,t)=>x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{x.x.Notice.success(x.x.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&x.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},{name:"edit",className:"mailpoet-hide-on-mobile",label:x.x.I18n.t("edit"),onClick:$e.Q2},{name:"trash",className:"mailpoet-hide-on-mobile"}];Kr=(0,$e.y8)(Kr);class Qr extends y.Component{constructor(e){super(e),(0,b.Z)(this,"updateStatus",((e,t)=>{t.persist(),x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"setStatus",data:{id:Number(t.target.getAttribute("data-id")),status:e?"active":"draft"}}).done((e=>{"active"===e.data.status&&x.x.Notice.success(x.x.I18n.t("reEngagementEmailActivated")),this.forceUpdate()})).fail((n=>{x.x.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,b.Z)(this,"renderStatus",(e=>{const t=x.x.I18n.t("sentToXSubscribers").replace("%1$d",e.total_sent.toLocaleString());return(0,_.jsxs)("div",{children:[(0,_.jsx)(Zt.Z,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"active"===e.status}),(0,_.jsx)("p",{className:"mailpoet-listing-stats-description",children:(0,_.jsx)(o.Link,{to:`/sending-status/${e.id}`,"data-automation-id":`sending_status_${e.id}`,children:t})})]})})),(0,b.Z)(this,"renderSettings",(e=>{if(0===e.segments.length)return(0,_.jsx)(o.Link,{className:"mailpoet-listing-error",to:`/send/${e.id}`,children:x.x.I18n.t("sendingToSegmentsNotSpecified")});const t=I()(x.x.I18n.t("sendTo"),"%1$s",((t,n)=>(0,_.jsx)(gr.$,{segments:e.segments},n)));let n="reEngagementFrequencyMonth";e.options.afterTimeNumber>1&&"months"===e.options.afterTimeType?n="reEngagementFrequencyMonths":e.options.afterTimeNumber>1&&"weeks"===e.options.afterTimeType?n="reEngagementFrequencyWeeks":1===e.options.afterTimeNumber&&"weeks"===e.options.afterTimeType&&(n="reEngagementFrequencyWeek");const r=x.x.I18n.t("reEngagementSettings").replace("{$count}",e.options.afterTimeNumber).replace("{$frequency}",x.x.I18n.t(n));return(0,_.jsxs)("span",{children:[t,(0,_.jsxs)("div",{className:"mailpoet-listing-schedule",children:[(0,_.jsx)("div",{className:"mailpoet-listing-schedule-icon",children:(0,_.jsx)(vr.P,{})}),r]})]})})),(0,b.Z)(this,"renderItem",((e,t)=>{const n=d()("manage-column","column-primary","has-row-actions");return(0,_.jsxs)("div",{children:[(0,_.jsxs)("td",{className:n,children:[(0,_.jsx)("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`,children:e.subject}),t]}),(0,_.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("settings"),children:this.renderSettings(e)}),!0===Br?(0,_.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":x.x.I18n.t("statistics"),children:(0,_.jsx)(Xe,{newsletter:e,isSent:e.total_sent>0&&!!e.statistics})}):null,(0,_.jsx)("td",{className:"column","data-colname":x.x.I18n.t("status"),children:this.renderStatus(e)}),(0,_.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("lastModifiedOn"),children:[x.x.Date.short(e.updated_at),(0,_.jsx)("br",{}),x.x.Date.time(e.updated_at)]})]})})),(0,b.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return(0,_.jsxs)(_.Fragment,{children:[0===this.state.newslettersCount&&(0,_.jsx)(Ke,{filter:e=>"re_engagement"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&(0,_.jsx)(g.N,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,endpoint:"newsletters",type:"re_engagement",base_url:"re_engagement",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:zr,bulk_actions:Gr,item_actions:Kr,messages:Hr,auto_refresh:!0,sort_by:"updated_at",sort_order:"desc",afterGetItems:e=>{if(!e.loading){const t=e.groups.reduce(((e,t)=>e+t.count),0);this.setState({newslettersCount:t})}(0,$e._X)(e),(0,$e.bF)(e)}})]})}}Qr.propTypes={location:h().object.isRequired,match:h().shape({params:h().object}).isRequired};const Xr=(0,l.EN)(Qr),Jr=x.x.trackingConfig.emailTrackingEnabled,ea=[{name:"subject",label:x.x.I18n.t("subject")},{name:"status",label:x.x.I18n.t("status")},{name:"segments",label:x.x.I18n.t("lists")},{name:"statistics",label:x.x.I18n.t("statistics"),display:Jr},{name:"sent_at",label:x.x.I18n.t("sentOn"),sortable:!0}],ta={onNoItemsFound:(e,t)=>x.x.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneNewsletterTrashed"):x.x.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneNewsletterDeleted"):x.x.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneNewsletterRestored"):x.x.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)}},na=[{name:"trash",label:x.x.I18n.t("moveToTrash"),onSuccess:ta.onTrash}],ra=(0,$e.y8)([{name:"view",link:function(e){return(0,_.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:x.x.I18n.t("preview")})}},{name:"trash",className:"mailpoet-hide-on-mobile"}]),aa=(e,t,n)=>{const r=d()("manage-column","column-primary","has-row-actions");return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("td",{className:r,children:[(0,_.jsx)("strong",{children:(0,_.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:e.queue.newsletter_rendered_subject||e.subject})}),t]}),(0,_.jsx)("td",{className:"column mailpoet-listing-status-column","data-colname":x.x.I18n.t("status"),children:(0,_.jsx)(_r,{newsletter:e,mailerLog:n.mta_log})}),(0,_.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("lists"),children:(0,_.jsx)(gr.$,{segments:e.segments,dimension:"large"})}),!0===Jr?(0,_.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":x.x.I18n.t("statistics"),children:(0,_.jsx)(Xe,{newsletter:e,currentTime:n.current_time})}):null,(0,_.jsx)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("sentOn"),children:e.sent_at?(0,_.jsxs)(_.Fragment,{children:[x.x.Date.short(e.sent_at),(0,_.jsx)("br",{}),x.x.Date.time(e.sent_at)]}):null})]})};function sa(e){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(o.Link,{className:"mailpoet-button button button-secondary button-small",to:"/notification",children:x.x.I18n.t("backToPostNotifications")}),(0,_.jsx)(g.N,{limit:window.mailpoet_listing_per_page,location:e.location,params:{...e.match.params,parentId:e.parentId},endpoint:"newsletters",type:"notification_history",base_url:"notification/history/:parentId",onRenderItem:aa,columns:ea,messages:ta,item_actions:ra,bulk_actions:na,auto_refresh:!0,sort_by:"sent_at",sort_order:"desc",afterGetItems:e=>{(0,$e._X)(e),(0,$e.bF)(e)}})]})}sa.propTypes={parentId:h().string.isRequired,location:h().shape({pathname:h().string}).isRequired,match:h().shape({params:h().shape({id:h().node}).isRequired}).isRequired};const ia=(0,l.EN)(sa),oa=[{name:"subscriber_id",label:x.x.I18n.t("subscriber"),sortable:!0},{name:"status",label:x.x.I18n.t("sendingStatus")},{name:"failureReason",label:x.x.I18n.t("failureReason")}],la={onNoItemsFound:()=>x.x.I18n.t("noSendingTaskFound")};function ca(e){const[t,n]=(0,y.useState)({id:e.match.params.id,subject:"",sent:!1});return(0,y.useEffect)((()=>{x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"get",data:{id:t.id}}).done((e=>n({id:t.id,subject:e.data.subject,sent:null!==e.data.sent_at}))).fail((e=>x.x.Notice.showApiErrorNotice(e)))}),[t.id]),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("h1",{children:x.x.I18n.t("sendingStatusTitle")}),(0,_.jsx)(ma,{newsletter:t}),(0,_.jsx)(pa,{location:e.location,params:e.match.params})]})}ca.propTypes={location:h().shape({pathname:h().string}).isRequired,match:h().shape({params:h().shape({id:h().string.isRequired}).isRequired}).isRequired};const da=(e,t)=>e.location.pathname===t.location.pathname&&e.params.id===t.params.id,ua=e=>(0,_.jsx)("div",{children:(0,_.jsx)(ha,{...e})}),pa=(0,y.memo)((e=>{let{location:t,params:n}=e;return(0,_.jsx)(g.N,{limit:window.mailpoet_listing_per_page,location:t,params:n,endpoint:"sending_task_subscribers",base_url:"sending-status/:id",onRenderItem:ua,getListingItemKey:e=>`${e.taskId}-${e.subscriberId}`,columns:oa,messages:la,auto_refresh:!0,sort_by:"failed",sort_order:"desc",afterGetItems:e=>{(0,$e._X)(e),(0,$e.bF)(e)}})}),da);function ma(e){let{newsletter:t}=e;return t.id&&t.subject&&t.sent?(0,_.jsx)("p",{children:(0,_.jsx)(o.Link,{to:`/stats/${t.id}`,children:t.subject})}):null}function ha(e){let{error:t,failed:n,taskId:r,processed:a,email:s,subscriberId:i,lastName:o,firstName:l}=e;const c=d()("manage-column","column-primary","has-row-actions");let u=x.x.I18n.t("unprocessed");return a&&(u=n?(0,_.jsxs)("span",{children:[x.x.I18n.t("failed"),(0,_.jsx)("br",{}),(0,_.jsx)("a",{className:"button",href:"#",onClick:e=>{e.preventDefault(),x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sending_task_subscribers",action:"resend",data:{taskId:r,subscriberId:i}}).done((()=>window.mailpoet_listing.forceUpdate())).fail((e=>x.x.Notice.showApiErrorNotice(e)))},children:x.x.I18n.t("resend")})]}):x.x.I18n.t("sent")),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("td",{"data-automation-id":`name_${r}_${i}`,className:c,children:[(0,_.jsx)("a",{className:"mailpoet-listing-title",href:`admin.php?page=mailpoet-subscribers#/edit/${i}`,children:s}),(0,_.jsx)("div",{className:"mailpoet-listing-subtitle",children:`${l} ${o}`})]}),(0,_.jsx)("td",{className:"column","data-automation-id":`status_${r}_${i}`,"data-colname":x.x.I18n.t("sendingStatus"),children:u}),(0,_.jsx)("td",{className:"column","data-automation-id":`error_${r}_${i}`,"data-colname":x.x.I18n.t("failureReason"),children:t})]})}function fa(){return(0,_.jsx)("style",{dangerouslySetInnerHTML:{__html:".wrap { margin: 0 !important; }"}})}pa.propTypes={location:h().shape({pathname:h().string}).isRequired,params:h().shape({id:h().string.isRequired}).isRequired},ma.propTypes={newsletter:h().shape({id:h().string,subject:h().string,sent:h().bool})},ma.defaultProps={newsletter:{id:null,subject:null,sent:!1}},ha.propTypes={error:h().string,email:h().string.isRequired,failed:h().number.isRequired,taskId:h().number.isRequired,lastName:h().string.isRequired,firstName:h().string.isRequired,processed:h().number.isRequired,subscriberId:h().number.isRequired},ha.defaultProps={error:""};var ga=n(51713),xa=n(84663),va=n(13101);const ba=e=>{const t=e<.1?2:1;return x.x.Num.toLocaleFixed(e,t)},ya=e=>+(+e).toFixed(1);function wa(e){let{newsletter:t,isWoocommerceActive:n}=e;const r=t.total_sent||0;let a=0,s=0,i=0,o=0,l=0;r>0&&(a=100*t.statistics.clicked/r,s=100*t.statistics.opened/r,i=100*t.statistics.machineOpened/r,o=100*t.statistics.unsubscribed/r,l=100*t.statistics.bounced/r);const c=ba(a),d=ba(s),u=ba(i),p=ba(o),m=ba(l),h=r>=20&&t.statistics.opened>=5,f=t.statistics.unsubscribed>=5&&r>=100,g=t.statistics.bounced>=5&&r>=100,v=(0,va.y)("opened",s)||"",b=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("div",{className:"mailpoet-statistics-value-small",children:[(0,_.jsxs)("span",{className:`mailpoet-statistics-value-number mailpoet-statistics-value-number-${v}`,children:[d,"% "]}),x.x.I18n.t("percentageOpened")]}),h&&(0,_.jsx)(va.$,{isInverted:!1,stat:"opened",rate:s,tooltipId:`opened-${t.id||"0"}`,tooltipPlace:"right"})]}),y=(0,_.jsxs)("div",{className:"mailpoet-statistics-value-small",children:[(0,_.jsxs)("span",{className:"mailpoet-statistics-value-number",children:[u,"% "]}),x.x.I18n.t("percentageMachineOpened"),(0,_.jsx)(O.Tooltip,{tooltip:I()(x.x.I18n.t("percentageMachineOpenedTooltip"),/\[link](.*?)\[\/link]/,(e=>(0,_.jsx)("span",{style:{pointerEvents:"all"},children:(0,_.jsx)("a",{href:"https://kb.mailpoet.com/article/368-what-are-machine-opens",target:"_blank","data-beacon-article":"6124b7fb21ef206e5592e188",rel:"noopener noreferrer",children:e},"kb-link")},"machine-opened-tooltip")))})]}),w=ya(o),j=f?(0,va.y)("unsubscribed",w):"",S=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("div",{className:"mailpoet-statistics-value-small",children:[(0,_.jsxs)("span",{className:`mailpoet-statistics-value-number mailpoet-statistics-value-number-${j}`,children:[p,"% "]}),x.x.I18n.t("percentageUnsubscribed")]}),f&&(0,_.jsx)(va.$,{isInverted:!1,stat:"unsubscribed",rate:w,tooltipId:`unsubscribed-${t.id||"0"}`,tooltipPlace:"right"})]}),C=ya(l),T=g?(0,va.y)("bounced",C):"",k=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("div",{className:"mailpoet-statistics-value-small",children:[(0,_.jsxs)("span",{className:`mailpoet-statistics-value-number mailpoet-statistics-value-number-${T}`,children:[m,"% "]}),x.x.I18n.t("percentageBounced")]}),g&&(0,_.jsx)(va.$,{isInverted:!1,stat:"bounced",rate:C,tooltipId:`bounced-${t.id||"0"}`,tooltipPlace:"right"})]}),N=(0,va.y)("clicked",a),D=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("div",{className:"mailpoet-statistics-value",children:[(0,_.jsxs)("span",{className:`mailpoet-statistics-value-number mailpoet-statistics-value-number-${N}`,children:[c,"% "]}),x.x.I18n.t("percentageClicked")]}),h&&(0,_.jsx)(va.$,{isInverted:!1,stat:"clicked",rate:a,tooltipId:`clicked-${t.id||"0"}`,tooltipPlace:"right"})]});return(0,_.jsxs)("div",{className:"mailpoet-stats-general",children:[(0,_.jsxs)(_t.Grid.ThreeColumns,{className:"mailpoet-stats-general-top-row",children:[(0,_.jsx)("div",{children:(0,_.jsxs)("div",{className:"mailpoet-statistics-value-small",children:[x.x.I18n.t("statsTotalSent"),": ",(0,_.jsx)("span",{className:"mailpoet-statistics-value-number",children:r.toLocaleString()})]})}),(0,_.jsx)("div",{className:"mailpoet-statistics-with-left-separator",children:S}),(0,_.jsx)("div",{className:"mailpoet-statistics-with-left-separator",children:k})]}),(0,_.jsxs)(_t.Grid.ThreeColumns,{children:[(0,_.jsx)("div",{children:D}),(0,_.jsxs)("div",{className:"mailpoet-statistics-with-left-separator",children:[b,y]}),n&&(0,_.jsx)("div",{className:"mailpoet-statistics-with-left-separator",children:Ae.Hooks.applyFilters("mailpoet_newsletters_revenues_stats",null,t.statistics.revenue)}),!n&&(0,_.jsx)("div",{})]}),(0,_.jsx)("p",{className:"mailpoet-stats-general-read-more",children:(0,_.jsx)("a",{href:"https://kb.mailpoet.com/article/190-whats-a-good-email-open-rate",target:"_blank",rel:"noopener noreferrer","data-beacon-article":"58f671152c7d3a057f8858e8",children:x.x.I18n.t("readMoreOnStats")})})]})}function _a(e){let{newsletter:t}=e;const n=t.queue.scheduled_at||t.queue.created_at;return(0,_.jsxs)(_t.Grid.ThreeColumns,{className:"mailpoet-stats-info",children:[(0,_.jsxs)("div",{className:"mailpoet-grid-span-two-columns",children:[(0,_.jsx)(he.X,{level:1,children:t.subject}),(0,_.jsx)("div",{children:(0,_.jsxs)("b",{children:[x.x.Date.short(n)," • ",x.x.Date.time(n)]})}),Array.isArray(t.segments)&&t.segments.length&&(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{className:"mailpoet-stats-info-key",children:x.x.I18n.t("statsToSegments")}),": ",(0,_.jsx)(f.Tags,{dimension:"large",segments:t.segments})]})]}),(0,_.jsxs)("div",{className:"mailpoet-stats-info-sender-preview",children:[(0,_.jsxs)("div",{children:[(0,_.jsxs)("div",{className:"mailpoet-stats-info-key-value",children:[(0,_.jsxs)("span",{className:"mailpoet-stats-info-key",children:[x.x.I18n.t("statsFromAddress"),": "]}),t.sender_address?t.sender_address:"-"]}),(0,_.jsxs)("div",{className:"mailpoet-stats-info-key-value",children:[(0,_.jsxs)("span",{className:"mailpoet-stats-info-key",children:[x.x.I18n.t("statsReplyToAddress"),": "]}),t.reply_to_address?t.reply_to_address:"-"]}),(0,_.jsxs)("div",{className:"mailpoet-stats-info-key-value",children:[(0,_.jsxs)("span",{className:"mailpoet-stats-info-key",children:[x.x.I18n.t("googleAnalytics"),": "]}),t.ga_campaign?t.ga_campaign:"-"]})]}),(0,_.jsx)("div",{children:(0,_.jsx)(f.Button,{href:t.preview_url,target:"_blank",rel:"noopener noreferrer",children:x.x.I18n.t("statsPreviewNewsletter")})})]})]})}function ja(){const e=(0,_.jsx)(E.z,{href:x.x.MailPoetComUrlFactory.getPurchasePlanUrl(x.x.subscribersCount,x.x.currentWpUserEmail,"starter",{utm_medium:"stats",utm_campaign:"signup"}),target:"_blank",rel:"noopener noreferrer",children:x.x.I18n.t("premiumBannerCtaFree")}),t=(0,_.jsxs)("p",{children:[x.x.I18n.t("premiumBannerDescription")," ",(0,_.jsx)("a",{href:"admin.php?page=mailpoet-upgrade",children:x.x.I18n.t("learnMore")}),"."]});return(0,_.jsx)("div",{className:"mailpoet-stats-premium-required",children:(0,_.jsx)(Oe.K,{title:x.x.I18n.t("premiumFeature"),message:t,actionButton:e})})}function Sa(){if(!window.mailpoet_display_detailed_stats)return(0,_.jsx)(ja,{});if(window.mailpoet_subscribers_limit_reached){const e=window.mailpoet_has_valid_api_key,t=x.x.I18n.t("upgradeRequired"),n=x.x.I18n.t(e?"newsletterYourPlanLimit":"newsletterFreeVersionLimit").replace("[subscribersLimit]",window.mailpoet_subscribers_limit).replace("[subscribersCount]",window.mailpoet_subscribers_count),r=e?x.x.MailPoetComUrlFactory.getUpgradeUrl(x.x.pluginPartialKey):x.x.MailPoetComUrlFactory.getPurchasePlanUrl(window.mailpoet_subscribers_count+1);return(0,_.jsx)("div",{className:"mailpoet-stats-premium-required",children:(0,_.jsx)(Oe.K,{title:t,message:(0,_.jsx)("p",{children:n}),actionButton:(0,_.jsx)(E.z,{target:"_blank",rel:"noopener noreferrer",href:r,children:x.x.I18n.t("upgradeNow")})})})}return null}const Ia=(0,l.EN)((function(e){let{match:t,history:n,location:r}=e;const[a,s]=(0,y.useState)({item:void 0,loading:!0}),i=(0,y.useCallback)((e=>{s({loading:!0,item:a.item}),x.x.Modal.loading(!0),x.x.Ajax.post({api_version:x.x.apiVersion,endpoint:window.mailpoet_display_detailed_stats?"stats":"newsletters",action:window.mailpoet_display_detailed_stats?"get":"getWithStats",data:{id:e}}).always((()=>{x.x.Modal.loading(!1)})).done((e=>{s({loading:!1,item:e.data})})).fail((e=>{x.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0}),s({loading:!1}),n.push("/")}))}),[n,a.item]);(0,y.useEffect)((()=>{var e;window.scrollTo(0,0),(null===(e=a.item)||void 0===e?void 0:e.id)!==t.params.id&&i(t.params.id)}),[t.params.id,i,a.item]);const{item:o,loading:l}=a,c=o;return l?null:null==c||!c.subject||null!=c&&c.queue?c?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(ye.B,{}),(0,_.jsx)(fa,{}),(0,_.jsx)(L.Q,{}),(0,_.jsxs)("div",{className:"mailpoet-stats-page",children:[(0,_.jsx)(k,{mssKeyInvalid:window.mailpoet_mss_key_invalid,subscribersCount:window.mailpoet_subscribers_count}),(0,_.jsx)(_a,{newsletter:c}),(0,_.jsx)(wa,{newsletter:c,isWoocommerceActive:x.x.isWoocommerceActive}),(0,_.jsxs)(ga.m,{activeKey:"clicked",children:[(0,_.jsx)(xa.O,{title:x.x.I18n.t("clickedLinks"),children:Ae.Hooks.applyFilters("mailpoet_newsletters_clicked_links_table",(0,_.jsx)(Sa,{}),c.clicked_links)},"clicked"),Ae.Hooks.applyFilters("mailpoet_newsletters_purchased_products",null,c),(0,_.jsx)(xa.O,{title:x.x.I18n.t("subscriberEngagement"),children:Ae.Hooks.applyFilters("mailpoet_newsletters_subscriber_engagement",(0,_.jsx)(Sa,{}),r,t.params,c)},"engagement"),(0,_.jsx)(xa.O,{title:x.x.I18n.t("bounces"),automationId:"bounces-tab",children:Ae.Hooks.applyFilters("mailpoet_newsletters_bounces",(0,_.jsx)(Sa,{}),r,t.params)},"bounces")]})]})]}):(0,_.jsxs)("h3",{children:[" ",x.x.I18n.t("emailDoesNotExist")," "]}):(0,_.jsx)("div",{children:(0,_.jsx)(he.X,{level:1,children:c.subject})})}));var Ca=n(17768),Ta=n(7197),ka=n(23064),Na=n.n(ka);function Da(e){const t=e.installedDaysAgo,n=t>30?x.x.I18n.t("reviewRequestUsingForMonths").replace("[months]",Math.round(t/30)):x.x.I18n.t("reviewRequestUsingForDays").replace("[days]",t);return(0,_.jsxs)("div",{className:"mailpoet_review_request",children:[(0,_.jsx)("img",{src:e.reviewRequestIllustrationUrl,height:"280",width:"280",alt:""}),(0,_.jsx)("h2",{children:x.x.I18n.t("reviewRequestHeading")}),(0,_.jsx)("p",{children:x.x.I18n.t("reviewRequestDidYouKnow").replace("[username]",e.username)}),(0,_.jsx)("p",{children:n}),(0,_.jsx)("p",{children:(0,_.jsx)("a",{href:"http://bit.ly/2Bi124o",target:"_blank",rel:"noopener noreferrer",className:"button button-primary",children:x.x.I18n.t("reviewRequestRateUsNow")})}),(0,_.jsx)("p",{children:(0,_.jsx)("a",{id:"mailpoet_review_request_not_now",children:x.x.I18n.t("reviewRequestNotNow")})})]})}Da.propTypes={installedDaysAgo:h().number.isRequired,reviewRequestIllustrationUrl:h().string.isRequired,username:h().string.isRequired};const Ea=()=>((0,y.useLayoutEffect)((()=>{window.mailpoet_display_nps_poll&&x.x.libs3rdPartyEnabled&&(Ln||(Ln=x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"analytics",action:"getTrackingData"})),Ln).then((e=>{let{data:t}=e;return(e=>{let t;t=window.mailpoet_display_nps_form?"EqOgKsgZd832Sz9w":window.mailpoet_is_new_user?"6L479eVPXk7pBn6S":"k0aJAsQAWI2ERyGv",Na()({writeKey:t,userId:window.mailpoet_current_wp_user.ID+window.mailpoet_site_url,traits:{name:window.mailpoet_current_wp_user.user_nicename,email:window.mailpoet_current_wp_user.user_email,mailpoetVersion:window.mailpoet_version,mailpoetPremiumIsActive:window.mailpoet_premium_active,createdAt:e.installedAtIso,newslettersSent:e.newslettersSent,welcomeEmails:e.welcomeEmails,postnotificationEmails:e.postnotificationEmails,woocommerceEmails:e.woocommerceEmails,subscribers:e.subscribers,lists:e.lists,sendingMethod:e.sendingMethod,woocommerceIsInstalled:e.woocommerceIsInstalled},events:{submit:e=>{e.rating>=9&&e.completed&&x.x.Modal.popup({width:800,template:Ta.renderToString(Da({username:window.mailpoet_current_wp_user_firstname||window.mailpoet_current_wp_user.user_login,reviewRequestIllustrationUrl:window.mailpoet_review_request_illustration_url,installedDaysAgo:window.mailpoet_installed_days_ago})),onInit:()=>{document.getElementById("mailpoet_review_request_not_now").addEventListener("click",(()=>x.x.Modal.close()))}})}}})})(t)}))}),[]),null),Aa=e=>function(t){return Ea(),(0,_.jsx)(e,{...t})};function Oa(){return(0,_.jsx)(L.Q,{children:(0,_.jsxs)(o.Link,{id:"mailpoet-new-email",className:"mailpoet-button button-secondary",to:"/new",onClick:()=>x.x.trackEvent("Emails > Add New"),"data-automation-id":"new_email",children:[F.R,(0,_.jsx)("span",{children:x.x.I18n.t("new")})]})})}const Ra=(0,l.EN)((function(e){let{children:t,location:n}=e;return null!==(0,dt.X)(n)||(e=>e.hash.match(/^#\/new/)||e.pathname.match(/^\/new/))(n)?null:t}));function Pa(e){let{mailpoetInstalledDaysAgo:t,sendTransactionalEmails:n,mtaMethod:r,noticeDismissed:a,apiVersion:s}=e;const[i,o]=(0,y.useState)(!1),l=()=>{x.x.Ajax.post({api_version:s,endpoint:"UserFlags",action:"set",data:{transactional_emails_opt_in_notice_dismissed:"1"}})};return t<30||n||"PHPMail"===r||"1"===a||i?null:(0,_.jsxs)(C.q,{type:"success",timeout:!1,onClose:l,children:[(0,_.jsx)("h3",{children:x.x.I18n.t("transactionalEmailNoticeTitle")}),(0,_.jsxs)("p",{children:[x.x.I18n.t("transactionalEmailNoticeBody")," ",(0,_.jsx)("a",{href:"https://kb.mailpoet.com/article/292-choose-how-to-send-your-wordpress-websites-emails",target:"_blank",rel:"noopener noreferrer",children:x.x.I18n.t("transactionalEmailNoticeBodyReadMore")})]}),(0,_.jsx)("p",{children:(0,_.jsx)("button",{type:"button",className:"button",onClick:()=>{o(!0),x.x.Ajax.post({api_version:s,endpoint:"settings",action:"set",data:{send_transactional_emails:"1"}}),l()},children:x.x.I18n.t("transactionalEmailNoticeCTA")})})]})}const Ma=window.mailpoet_woocommerce_automatic_emails||[],La=Aa((()=>{const{parentId:e}=(0,l.UO)();return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(Ra,{children:(0,_.jsx)(Oa,{})}),(0,_.jsxs)(Ca.t,{activeKey:"standard",routerType:"switch-only",onSwitch:e=>(e=>x.x.trackEvent(`Tab Emails > ${e} clicked`))(e),automationId:"newsletters_listing_tabs",children:[(0,_.jsx)(xa.O,{route:"standard/(.*)?",title:x.x.I18n.t("tabStandardTitle"),automationId:`tab-${x.x.I18n.t("tabStandardTitle")}`,children:(0,_.jsx)(Dr,{})},"standard"),(0,_.jsx)(xa.O,{route:"welcome/(.*)?",title:x.x.I18n.t("tabWelcomeTitle"),automationId:`tab-${x.x.I18n.t("tabWelcomeTitle")}`,children:(0,_.jsx)(qr,{})},"welcome"),(0,_.jsx)(xa.O,{route:"notification/(.*)?",title:x.x.I18n.t("tabNotificationTitle"),automationId:`tab-${x.x.I18n.t("tabNotificationTitle")}`,children:e?(0,_.jsx)(ia,{parentId:e}):(0,_.jsx)(Yr,{})},"notification"),(0,_.jsx)(xa.O,{route:"re_engagement/(.*)?",title:x.x.I18n.t("tabReEngagementTitle"),automationId:`tab-${x.x.I18n.t("tabReEngagementTitle")}`,children:(0,_.jsx)(Xr,{})},"re_engagement"),window.mailpoet_woocommerce_active&&w.ZP.map(Ma,(e=>(0,_.jsx)(xa.O,{route:`${e.slug}/(.*)?`,title:e.title,automationId:`tab-${e.title}`,children:(0,_.jsx)(lt,{})},e.slug)))]})]})}));function Fa(e){let{history:t}=e;return(0,_.jsx)(Ke,{history:t,hideClosingButton:0===window.mailpoet_newsletters_count})}Fa.propTypes={history:h().shape({push:h().func.isRequired}).isRequired};const qa=[...(()=>{const e=[];return w.ZP.each(Ma,(t=>{e.push({path:`/${t.slug}/(.*)?`,component:La});const{events:n}=t;w.ZP.isObject(n)&&w.ZP.each(n,(n=>{e.push({path:`/new/${t.slug}/${n.slug}/conditions`,render:e=>{const r={...e,email:t,name:n.slug};return(0,_.jsx)(fr,{...r})}})})),e.push({path:`/new/${t.slug}`,render:e=>{const n={...e,email:t};return(0,_.jsx)(We,{...n})}})})),e})(),{path:"/notification/history/:parentId/(.*)?",component:La},{path:"/(standard|welcome|notification|re_engagement)/(.*)?",component:La},{path:"/new/standard",component:cr},{path:"/new/notification",component:pr},{path:"/new/welcome",component:hr},{path:"/new/re-engagement",component:function(){let e="";x.x.deactivateSubscriberAfterInactiveDays&&(e=(Math.floor(Number(x.x.deactivateSubscriberAfterInactiveDays)/30)-1).toString());const[t,n]=(0,y.useState)({afterTimeNumber:e,afterTimeType:"months"}),[r,a]=(0,y.useState)([]),[s,i]=(0,y.useState)(!1),o=(0,l.k6)();return(0,_.jsxs)("div",{children:[(0,_.jsx)(Q.A,{color:"#fff"}),r&&(0,_.jsx)(He,{errors:r}),(0,_.jsx)(ut,{emailType:"re_engagement",automationId:"re_engagement_heading_creation_heading"}),(0,_.jsxs)(_t.Grid.Column,{align:"center",className:"mailpoet-schedule-email",children:[(0,_.jsx)(On,{afterTimeNumber:t.afterTimeNumber,afterTimeType:t.afterTimeType,inactiveSubscribersPeriod:Number(x.x.deactivateSubscriberAfterInactiveDays),updateAfterTimeNumber:(0,An.compose)([n,(0,An.assoc)("afterTimeNumber",An.__,t)]),updateAfterTimeType:(0,An.compose)([n,(0,An.assoc)("afterTimeType",An.__,t)])}),(0,_.jsx)(E.z,{isFullWidth:!0,onClick:()=>(a([]),i(!0),void x.x.Ajax.post({api_version:x.x.apiVersion,endpoint:"newsletters",action:"create",data:{type:"re_engagement",subject:x.x.I18n.t("draftNewsletterTitle"),options:t}}).done((e=>{var t;t=e.data.id,o.push(`/template/${t}`)})).fail((e=>{i(!1),e.errors&&a(e.errors)}))),type:"button",isDisabled:!t.afterTimeNumber||s,withSpinner:s,children:x.x.I18n.t("next")})]})]})}},{path:"/new",component:Fa},{name:"template",path:"/template/:id",component:xt},{path:"/send/congratulate/:id",component:or},{path:"/send/:id",component:Wn},{path:"/sending-status/:id/(.*)?",component:ca},{path:"/stats/:id/(.*)?",component:Ia}];function $a(){return(0,_.jsx)(Te.k.Provider,{value:(0,Te.S)(window),children:(0,_.jsxs)(o.HashRouter,{children:[(0,_.jsx)(Le.w,{}),(0,_.jsx)(T,{}),(0,_.jsx)(D,{}),(0,_.jsx)(Pa,{mailpoetInstalledDaysAgo:window.mailpoet_installed_days_ago,sendTransactionalEmails:window.mailpoet_send_transactional_emails,mtaMethod:window.mailpoet_mta_method,apiVersion:window.mailpoet_api_version,noticeDismissed:window.mailpoet_transactional_emails_opt_in_notice_dismissed}),(0,_.jsx)(k,{mssKeyInvalid:window.mailpoet_mss_key_invalid,subscribersCount:window.mailpoet_subscribers_count}),(0,_.jsxs)(l.rs,{children:[(0,_.jsx)(l.AW,{exact:!0,path:"/",render:()=>(0,_.jsx)(l.l_,{to:0===window.mailpoet_newsletters_count?"/new":"/standard"})}),qa.map((e=>(0,_.jsx)(l.AW,{path:e.path,component:e.component,name:e.name||null,data:e.data||null,render:e.render},e.path)))]})]})})}const Ua=document.getElementById("newsletters_container");Ua&&(window.mailpoet_listing=i.render((0,_.jsx)($a,{}),Ua));const Za=e=>"wp_users"===e.type,Va=e=>"woocommerce_users"===e.type,Wa=e=>Za(e)||Va(e),Ya=x.x.trackingConfig.emailTrackingEnabled,Ba=[{name:"name",label:x.x.I18n.t("name"),sortable:!0},{name:"description",label:x.x.I18n.t("description")},{name:"average_subscriber_score",label:x.x.I18n.t("listScore"),display:Ya},{name:"subscribed",label:x.x.I18n.t("subscribed"),className:"mailpoet-listing-column-narrow"},{name:"unconfirmed",label:x.x.I18n.t("unconfirmed"),className:"mailpoet-listing-column-narrow"},{name:"unsubscribed",label:x.x.I18n.t("unsubscribed"),className:"mailpoet-listing-column-narrow"},{name:"inactive",label:x.x.I18n.t("inactive"),className:"mailpoet-listing-column-narrow"},{name:"bounced",label:x.x.I18n.t("bounced"),className:"mailpoet-listing-column-narrow"},{name:"created_at",label:x.x.I18n.t("createdOn"),sortable:!0}],Ha={onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneSegmentTrashed"):x.x.I18n.t("multipleSegmentsTrashed").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneSegmentDeleted"):x.x.I18n.t("multipleSegmentsDeleted").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneSegmentRestored"):x.x.I18n.t("multipleSegmentsRestored").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)}},za=[{name:"trash",label:x.x.I18n.t("moveToTrash"),onSuccess:Ha.onTrash}],Ga=e=>!Wa(e),Ka=[{name:"edit",className:"mailpoet-hide-on-mobile",link:function(e){return(0,_.jsx)(o.Link,{to:`/edit/${e.id}`,children:x.x.I18n.t("edit")})},display:function(e){return!Wa(e)}},{name:"duplicate_segment",className:"mailpoet-hide-on-mobile",label:x.x.I18n.t("duplicate"),onClick:(e,t)=>x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"segments",action:"duplicate",data:{id:e.id}}).done((e=>{x.x.Notice.success(x.x.I18n.t("listDuplicated").replace("%1$s",e.data.name)),t()})).fail((e=>{x.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})})),display:function(e){return!Wa(e)}},{name:"read_more",className:"mailpoet-hide-on-mobile",link:function(){return(0,_.jsx)("a",{href:"https://kb.mailpoet.com/article/133-the-wordpress-users-list",target:"_blank",rel:"noopener noreferrer",children:x.x.I18n.t("readMore")})},display:function(e){return Za(e)}},{name:"synchronize_segment",label:x.x.I18n.t("forceSync"),onClick:function(e,t){x.x.Modal.loading(!0),x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"segments",action:"synchronize",data:{type:e.type}}).done((()=>{let n=x.x.I18n.t("listSynchronized").replace("%1$s",e.name);"woocommerce_users"===e.type&&(n=x.x.I18n.t("listSynchronizationWasScheduled").replace("%1$s",e.name)),x.x.Modal.loading(!1),x.x.Notice.success(n),t()})).fail((e=>{x.x.Modal.loading(!1),e.errors.length>0&&x.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},display:function(e){return Za(e)||Va(e)}},{name:"view_subscribers",link:function(e){return(0,_.jsx)("a",{href:e.subscribers_url,"data-automation-id":`view_subscribers_${e.name}`,children:x.x.I18n.t("viewSubscribers")})}},{name:"trash",className:"mailpoet-hide-on-mobile",display:function(e){return!Va(e)}}];class Qa extends y.Component{constructor(){super(...arguments),(0,b.Z)(this,"renderItem",((e,t)=>{const n=d()("manage-column","column-primary","has-row-actions"),r=Number(e.subscribers_count.subscribed||0),a=Number(e.subscribers_count.unconfirmed||0),s=Number(e.subscribers_count.unsubscribed||0),i=Number(e.subscribers_count.inactive||0),l=Number(e.subscribers_count.bounced||0);let c;return c=Wa(e)?(0,_.jsx)("span",{className:"mailpoet-listing-title",children:e.name}):(0,_.jsx)(o.Link,{className:"mailpoet-listing-title",to:`/edit/${e.id}`,children:e.name}),(0,_.jsxs)("div",{children:[(0,_.jsxs)("td",{className:n,"data-automation-id":`segment_name_${e.name}`,children:[c,t]}),(0,_.jsx)("td",{"data-colname":x.x.I18n.t("description"),children:(0,_.jsx)("abbr",{children:e.description})}),Ya?(0,_.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":x.x.I18n.t("averageScore"),children:(0,_.jsx)("div",{className:"mailpoet-listing-stats",children:(0,_.jsx)(M,{id:e.id,engagementScore:e.average_engagement_score})})}):null,(0,_.jsx)("td",{className:"mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("subscribed"),children:(0,_.jsx)("abbr",{children:r.toLocaleString()})}),(0,_.jsx)("td",{className:"mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("unconfirmed"),children:(0,_.jsx)("abbr",{children:a.toLocaleString()})}),(0,_.jsx)("td",{className:"mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("unsubscribed"),children:(0,_.jsx)("abbr",{children:s.toLocaleString()})}),(0,_.jsx)("td",{className:"mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("inactive"),children:(0,_.jsx)("abbr",{children:i.toLocaleString()})}),(0,_.jsx)("td",{className:"mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("bounced"),children:(0,_.jsx)("abbr",{children:l.toLocaleString()})}),(0,_.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("createdOn"),children:[x.x.Date.short(e.created_at),(0,_.jsx)("br",{}),x.x.Date.time(e.created_at)]})]})}))}render(){return(0,_.jsx)("div",{className:"mailpoet-segments-listing",children:(0,_.jsx)(g.N,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,messages:Ha,search:!1,endpoint:"segments",base_url:"lists",onRenderItem:this.renderItem,columns:Ba,bulk_actions:za,item_actions:Ka,sort_by:"name",sort_order:"asc",isItemDeletable:Ga,isItemToggleable:Za})})}}Qa.propTypes={location:h().object.isRequired,match:h().shape({params:h().object}).isRequired};const Xa=(0,l.EN)(Qa),Ja=[{name:"name",label:x.x.I18n.t("name"),type:"text"},{name:"description",label:x.x.I18n.t("description"),type:"textarea",tip:x.x.I18n.t("segmentDescriptionTip")}],es={onUpdate:function(){x.x.Notice.success(x.x.I18n.t("segmentUpdated"))},onCreate:function(){x.x.Notice.success(x.x.I18n.t("segmentAdded")),x.x.trackEvent("Lists > Add new")}};function ts(e){return(0,_.jsxs)("div",{children:[(0,_.jsx)(Q.A,{color:"#fff"}),(0,_.jsx)(ye.B,{}),(0,_.jsxs)(he.X,{level:1,className:"mailpoet-title",children:[(0,_.jsx)("span",{children:x.x.I18n.t("segment")}),(0,_.jsx)(o.Link,{className:"mailpoet-button button button-secondary button-small",to:"/",children:x.x.I18n.t("backToList")})]}),(0,_.jsx)(T,{}),(0,_.jsx)(be,{endpoint:"segments",fields:Ja,params:e.match.params,messages:es})]})}ts.propTypes={match:h().shape({params:h().shape({id:h().string}).isRequired}).isRequired};var ns=n(85479),rs=n(87834),as=n(5635),ss=n(77595);function is(e){let{filterIndex:t}=e;const n=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,ns.Z)("mailpoet-dynamic-segments-form"),s=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getNewslettersList()),[]),i=null==s?void 0:s.map((e=>{const t=e.sent_at?x.x.Date.format(e.sent_at):x.x.I18n.t("notSentYet");return{label:e.subject,tag:t,value:Number(e.id)}}));return(0,y.useEffect)((()=>{n.operator!==ss.AnyValueTypes.ANY&&n.operator!==ss.AnyValueTypes.ALL&&n.operator!==ss.AnyValueTypes.NONE&&r({operator:ss.AnyValueTypes.ANY},t),n.action===ss.EmailActionTypes.MACHINE_OPENED&&n.operator===ss.AnyValueTypes.NONE&&r({operator:ss.AnyValueTypes.ANY},t)}),[n.action,n.operator,t,r]),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(_t.Grid.CenteredRow,{children:(0,_.jsxs)(ae.Select,{isFullWidth:!0,value:n.operator,onChange:e=>{a("operator",t,e)},children:[(0,_.jsx)("option",{value:ss.AnyValueTypes.ANY,children:x.x.I18n.t("anyOf")}),(0,_.jsx)("option",{value:ss.AnyValueTypes.ALL,children:x.x.I18n.t("allOf")}),n.action!==ss.EmailActionTypes.MACHINE_OPENED?(0,_.jsx)("option",{value:ss.AnyValueTypes.NONE,children:x.x.I18n.t("noneOf")}):null]},"select")}),(0,_.jsx)(_t.Grid.CenteredRow,{children:(0,_.jsx)(as.ReactSelect,{dimension:"small",isFullWidth:!0,isMulti:!0,placeholder:x.x.I18n.t("selectNewsletterPlaceholder"),options:i,automationId:"segment-email",value:(0,An.filter)((e=>{if(!n.newsletters)return;const t=e.value;return-1!==n.newsletters.indexOf(t)}),i),onChange:e=>{r({newsletters:(0,An.map)("value",e)},t)}})})]})}const os=e=>!!e;function ls(e){return x.x.I18n.t("emailActionOpensDaysSentence").split(/({days})/gim).map(e)}function cs(e){let{filterIndex:t}=e;const n=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,ns.Z)("mailpoet-dynamic-segments-form");return(0,y.useEffect)((()=>{void 0===n.operator&&r({operator:"more"},t)}),[r,n,t]),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(_t.Grid.CenteredRow,{children:(s=e=>"{condition}"===e?(0,_.jsxs)(ae.Select,{value:n.operator,onChange:e=>{a("operator",t,e)},children:[(0,_.jsx)("option",{value:"more",children:x.x.I18n.t("moreThan")}),(0,_.jsx)("option",{value:"less",children:x.x.I18n.t("lessThan")}),(0,_.jsx)("option",{value:"equals",children:x.x.I18n.t("equals")}),(0,_.jsx)("option",{value:"not_equals",children:x.x.I18n.t("notEquals")})]},"select"):"{opens}"===e?(0,_.jsx)(ee.I,{type:"number",value:n.opens||"","data-automation-id":"segment-number-of-opens",onChange:e=>{a("opens",t,e)},min:"0",placeholder:x.x.I18n.t("emailActionOpens")},"input"):"string"==typeof e&&e.trim().length>1?(0,_.jsx)("div",{children:e},"opens"):null,x.x.I18n.t("emailActionOpensSentence").split(/({condition})|({opens})|(\b[a-zA-Z]+\b)/gim).map(s))}),(0,_.jsx)(_t.Grid.CenteredRow,{children:ls((e=>"{days}"===e?(0,_.jsx)(ee.I,{type:"number",value:n.days||"","data-automation-id":"segment-number-of-days",onChange:e=>{a("days",t,e)},min:"0",placeholder:x.x.I18n.t("emailActionDays")},"input"):"string"==typeof e&&e.trim().length>1?(0,_.jsx)("div",{children:e},e):null))})]});var s}const ds=[{value:ss.EmailActionTypes.OPENS_ABSOLUTE_COUNT,label:x.x.I18n.t("emailActionOpensAbsoluteCount"),group:ss.SegmentTypes.Email},{value:ss.EmailActionTypes.MACHINE_OPENS_ABSOLUTE_COUNT,label:x.x.I18n.t("emailActionMachineOpensAbsoluteCount"),group:ss.SegmentTypes.Email},{value:ss.EmailActionTypes.OPENED,label:x.x.I18n.t("emailActionOpened"),group:ss.SegmentTypes.Email},{value:ss.EmailActionTypes.MACHINE_OPENED,label:x.x.I18n.t("emailActionMachineOpened"),group:ss.SegmentTypes.Email},{value:ss.EmailActionTypes.CLICKED,label:x.x.I18n.t("emailActionClicked"),group:ss.SegmentTypes.Email},{value:ss.EmailActionTypes.CLICKED_ANY,label:x.x.I18n.t("emailActionClickedAnyEmail"),group:ss.SegmentTypes.Email}],us={[ss.EmailActionTypes.OPENS_ABSOLUTE_COUNT]:cs,[ss.EmailActionTypes.MACHINE_OPENS_ABSOLUTE_COUNT]:cs,[ss.EmailActionTypes.CLICKED]:function(e){let{filterIndex:t}=e;const n=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,ns.Z)("mailpoet-dynamic-segments-form"),s=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getNewslettersList()),[]),[i,o]=(0,y.useState)([]),[l,c]=(0,y.useState)([]),[d,u]=(0,y.useState)(!1),p=null==s?void 0:s.map((e=>{const t=e.sent_at?x.x.Date.format(e.sent_at):x.x.I18n.t("notSentYet");return{label:e.subject,tag:t,value:Number(e.id)}})),m=(0,y.useCallback)((()=>{var e;os(n.newsletter_id)&&(c([]),e=n.newsletter_id,o([]),u(!0),x.x.Ajax.post({api_version:x.x.apiVersion,endpoint:"newsletter_links",action:"get",data:{newsletterId:e}}).then((e=>{const{data:t}=e,n=t.map((e=>({value:e.id,label:e.url})));u(!1),c(n)})).fail((e=>{o(e.errors)})))}),[n.newsletter_id]);return(0,y.useEffect)((()=>{m()}),[m,n.newsletter_id]),(0,y.useEffect)((()=>{n.operator!==ss.AnyValueTypes.ANY&&n.operator!==ss.AnyValueTypes.ALL&&n.operator!==ss.AnyValueTypes.NONE&&r({operator:ss.AnyValueTypes.ANY},t)}),[n.operator,t,r]),(0,_.jsxs)(_.Fragment,{children:[i.length>0&&(0,_.jsx)(He,{errors:i}),(0,_.jsx)(_t.Grid.CenteredRow,{children:(0,_.jsx)(as.ReactSelect,{dimension:"small",isFullWidth:!0,placeholder:x.x.I18n.t("selectNewsletterPlaceholder"),options:p,value:(0,An.find)(["value",n.newsletter_id],p),onChange:e=>{r({newsletter_id:e.value,link_ids:[]},t)},automationId:"segment-email"})}),(0,_.jsxs)(_t.Grid.CenteredRow,{children:[(0,_.jsxs)(ae.Select,{isMinWidth:!0,value:n.operator,onChange:e=>a("operator",t,e),automationId:"select-operator",children:[(0,_.jsx)("option",{value:ss.AnyValueTypes.ANY,children:x.x.I18n.t("anyOf")}),(0,_.jsx)("option",{value:ss.AnyValueTypes.ALL,children:x.x.I18n.t("allOf")}),(0,_.jsx)("option",{value:ss.AnyValueTypes.NONE,children:x.x.I18n.t("noneOf")})]},"select-operator"),d&&(0,_.jsx)("span",{children:x.x.I18n.t("loadingDynamicSegmentItems")}),!d&&os(n.newsletter_id)&&(0,_.jsx)(as.ReactSelect,{isMulti:!0,dimension:"small",isFullWidth:!0,automationId:"segment-link-select",placeholder:x.x.I18n.t("allLinksPlaceholder"),options:l.length?l:[{value:0,label:x.x.I18n.t("noLinksHint"),isDisabled:!0}],value:(0,An.filter)((e=>!!n.link_ids&&-1!==n.link_ids.indexOf(e.value)),l),onChange:e=>{r({link_ids:(e||[]).map((e=>e.value))},t)}})]})]})},[ss.EmailActionTypes.OPENED]:is,[ss.EmailActionTypes.MACHINE_OPENED]:is,[ss.EmailActionTypes.CLICKED_ANY]:null};var ps;!function(e){e.NUMBER_OF_ORDERS="numberOfOrders",e.PURCHASED_CATEGORY="purchasedCategory",e.PURCHASED_PRODUCT="purchasedProduct",e.TOTAL_SPENT="totalSpent",e.CUSTOMER_IN_COUNTRY="customerInCountry"}(ps||(ps={}));const ms=[{value:ps.CUSTOMER_IN_COUNTRY,label:x.x.I18n.t("wooCustomerInCountry"),group:ss.SegmentTypes.WooCommerce},{value:ps.NUMBER_OF_ORDERS,label:x.x.I18n.t("wooNumberOfOrders"),group:ss.SegmentTypes.WooCommerce},{value:ps.PURCHASED_CATEGORY,label:x.x.I18n.t("wooPurchasedCategory"),group:ss.SegmentTypes.WooCommerce},{value:ps.PURCHASED_PRODUCT,label:x.x.I18n.t("wooPurchasedProduct"),group:ss.SegmentTypes.WooCommerce},{value:ps.TOTAL_SPENT,label:x.x.I18n.t("wooTotalSpent"),group:ss.SegmentTypes.WooCommerce}],hs=[ps.PURCHASED_PRODUCT,ps.PURCHASED_CATEGORY];function fs(e){let{filterIndex:t}=e;const n=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,ns.Z)("mailpoet-dynamic-segments-form");(0,y.useEffect)((()=>{n.action===ss.SubscriberActionTypes.WORDPRESS_ROLE&&n.operator!==ss.AnyValueTypes.ANY&&n.operator!==ss.AnyValueTypes.ALL&&n.operator!==ss.AnyValueTypes.NONE&&r({operator:ss.AnyValueTypes.ANY},t)}),[r,n,t]);const s=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getWordpressRoles()),[]).map((e=>({value:e.role_id,label:e.role_name})));return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(_t.Grid.CenteredRow,{children:(0,_.jsxs)(ae.Select,{isFullWidth:!0,value:n.operator,onChange:e=>{a("operator",t,e)},children:[(0,_.jsx)("option",{value:ss.AnyValueTypes.ANY,children:x.x.I18n.t("anyOf")}),(0,_.jsx)("option",{value:ss.AnyValueTypes.ALL,children:x.x.I18n.t("allOf")}),(0,_.jsx)("option",{value:ss.AnyValueTypes.NONE,children:x.x.I18n.t("noneOf")})]},"select")}),(0,_.jsx)(_t.Grid.CenteredRow,{children:(0,_.jsx)(as.ReactSelect,{dimension:"small",isFullWidth:!0,isMulti:!0,automationId:"segment-wordpress-role",placeholder:x.x.I18n.t("selectUserRolePlaceholder"),options:s,value:(0,An.filter)((e=>{if(n.wordpressRole)return-1!==n.wordpressRole.indexOf(e.value)}),s),onChange:e=>{r({wordpressRole:(0,An.map)("value",e)},t)}})})]})}let gs;!function(e){e.HIGHER_THAN="higherThan",e.LOWER_THAN="lowerThan",e.EQUALS="equals",e.NOT_EQUALS="not_equals",e.UNKNOWN="unknown",e.NOT_UNKNOWN="not_unknown"}(gs||(gs={}));const xs=[gs.HIGHER_THAN,gs.LOWER_THAN,gs.EQUALS,gs.NOT_EQUALS,gs.UNKNOWN,gs.NOT_UNKNOWN];var vs=n(30091),bs=n(47612);let ys;!function(e){e.BEFORE="before",e.AFTER="after",e.ON="on",e.NOT_ON="notOn",e.IN_THE_LAST="inTheLast",e.NOT_IN_THE_LAST="notInTheLast"}(ys||(ys={}));const ws=[ys.BEFORE,ys.AFTER,ys.ON,ys.NOT_ON,ys.IN_THE_LAST,ys.NOT_IN_THE_LAST],_s=e=>{if(null!==e){if(Array.isArray(e))throw new Error("convertDateToString can process only single date array given");return x.x.Date.format(e,{format:"Y-m-d"})}},js=e=>{const t=(0,vs.default)(e);if((0,bs.default)(t))return t};function Ss(e){return"string"==typeof e.value&&e.value.length>0&&("equals"===e.operator||"contains"===e.operator||"not_equals"===e.operator||"more_than"===e.operator||"less_than"===e.operator)}function Is(e){let{filterIndex:t}=e;const n=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilterFromEvent:r,updateSegmentFilter:a}=(0,ns.Z)("mailpoet-dynamic-segments-form");return(0,y.useEffect)((()=>{void 0===n.operator&&a({operator:"equals",value:""},t)}),[a,n,t]),(0,_.jsxs)(_t.Grid.CenteredRow,{children:[(0,_.jsxs)(ae.Select,{automationId:"text-custom-field-operator",value:n.operator,onChange:e=>{r("operator",t,e)},children:[(0,_.jsx)("option",{value:"equals",children:x.x.I18n.t("equals")}),(0,_.jsx)("option",{value:"not_equals",children:x.x.I18n.t("notEquals")}),(0,_.jsx)("option",{value:"contains",children:x.x.I18n.t("contains")}),(0,_.jsx)("option",{value:"more_than",children:x.x.I18n.t("moreThan")}),(0,_.jsx)("option",{value:"less_than",children:x.x.I18n.t("lessThan")})]},"select"),(0,_.jsx)(ee.I,{"data-automation-id":"text-custom-field-value",value:n.value||"",onChange:e=>{r("value",t,e)},placeholder:x.x.I18n.t("value")},"input")]})}function Cs(e){return"string"==typeof e.value&&e.value.length>0}function Ts(e){let{filterIndex:t}=e;const n=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r}=(0,ns.Z)("mailpoet-dynamic-segments-form"),a=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getCustomFieldsList()),[]),s=(0,An.find)({id:Number(n.custom_field_id)},a);if(!s)return null;const i=s.params;if(!i||!Array.isArray(i.values))return null;const o=i.values.map((e=>({value:e.value,label:e.value})));return(0,_.jsx)(as.ReactSelect,{dimension:"small",isFullWidth:!0,placeholder:x.x.I18n.t("selectValue"),options:o,value:n.value?{value:n.value,label:n.value}:null,onChange:e=>{r({value:e.value,operator:"equals"},t)},automationId:"segment-wordpress-role"})}var ks=n(42384),Ns=n(95822);const Ds=e=>{if(null!==e){if(Array.isArray(e))throw new Error("convertDateToString can process only single date array given");return(0,Ns.default)(e,"yyyy-MM-dd 00:00:00")}},Es=e=>{const t=(0,vs.default)(e);if((0,bs.default)(t))return t},As={month:function(e){let{onChange:t,item:n,filterIndex:r}=e;return(0,y.useEffect)((()=>{void 0!==n.value&&""!==n.value||t((0,An.assign)(n,{value:"2017-01-01 00:00:00"}),r)}),[t,n,r]),(0,_.jsxs)(ae.Select,{value:n.value,onChange:e=>{t((0,An.assign)(n,{value:e.target.value}),r)},children:[(0,_.jsx)("option",{value:"2017-01-01 00:00:00",children:x.x.I18n.t("january")}),(0,_.jsx)("option",{value:"2017-02-01 00:00:00",children:x.x.I18n.t("february")}),(0,_.jsx)("option",{value:"2017-03-01 00:00:00",children:x.x.I18n.t("march")}),(0,_.jsx)("option",{value:"2017-04-01 00:00:00",children:x.x.I18n.t("april")}),(0,_.jsx)("option",{value:"2017-05-01 00:00:00",children:x.x.I18n.t("may")}),(0,_.jsx)("option",{value:"2017-06-01 00:00:00",children:x.x.I18n.t("june")}),(0,_.jsx)("option",{value:"2017-07-01 00:00:00",children:x.x.I18n.t("july")}),(0,_.jsx)("option",{value:"2017-08-01 00:00:00",children:x.x.I18n.t("august")}),(0,_.jsx)("option",{value:"2017-09-01 00:00:00",children:x.x.I18n.t("september")}),(0,_.jsx)("option",{value:"2017-10-01 00:00:00",children:x.x.I18n.t("october")}),(0,_.jsx)("option",{value:"2017-11-01 00:00:00",children:x.x.I18n.t("november")}),(0,_.jsx)("option",{value:"2017-12-01 00:00:00",children:x.x.I18n.t("december")})]},"select")},year:function(e){let{onChange:t,item:n,filterIndex:r}=e;const a=(0,ks.default)(new Date);return(0,y.useEffect)((()=>{void 0!==n.value&&""!==n.value||t((0,An.assign)(n,{value:`${a}-01-01 00:00:00`,operator:"equals"}),r)}),[a,t,n,r]),(0,_.jsxs)(_t.Grid.CenteredRow,{children:[(0,_.jsxs)(ae.Select,{value:n.operator,onChange:e=>{t((0,An.assign)(n,{operator:e.target.value}),r)},children:[(0,_.jsx)("option",{value:"equals",children:x.x.I18n.t("equals")}),(0,_.jsx)("option",{value:"before",children:x.x.I18n.t("before")}),(0,_.jsx)("option",{value:"after",children:x.x.I18n.t("after")})]},"select-operator"),(0,_.jsx)(ae.Select,{value:n.value,onChange:e=>{t((0,An.assign)(n,{value:e.target.value}),r)},children:(0,An.range)(0,100).map((e=>(0,_.jsx)("option",{value:a-e+"-01-01 00:00:00",children:a-e},a-e)))},"select-year")]})},year_month:function(e){let{onChange:t,item:n,filterIndex:r}=e;return(0,y.useEffect)((()=>{void 0!==n.value&&""!==n.value||t((0,An.assign)(n,{value:`${(0,Ns.default)(new Date,"yyyy-MM-dd")} 00:00:00`,operator:"equals"}),r)}),[t,n,r]),(0,_.jsxs)(_t.Grid.CenteredRow,{children:[(0,_.jsxs)(ae.Select,{value:n.operator,onChange:e=>{t((0,An.assign)(n,{operator:e.target.value}),r)},children:[(0,_.jsx)("option",{value:"equals",children:x.x.I18n.t("equals")}),(0,_.jsx)("option",{value:"before",children:x.x.I18n.t("before")}),(0,_.jsx)("option",{value:"after",children:x.x.I18n.t("after")})]},"select-operator"),(0,_.jsx)(kt,{onChange:e=>t((0,An.assign)(n,{value:Ds(e)}),r),selected:n.value?Es(n.value):void 0,dateFormat:"MM/yyyy",showMonthYearPicker:!0})]})},year_month_day:function(e){let{onChange:t,item:n,filterIndex:r}=e;return(0,y.useEffect)((()=>{void 0!==n.value&&""!==n.value||t((0,An.assign)(n,{value:`${(0,Ns.default)(new Date,"yyyy-MM-dd")} 00:00:00`,operator:"equals"}),r)}),[t,n,r]),(0,_.jsxs)(_t.Grid.CenteredRow,{children:[(0,_.jsxs)(ae.Select,{value:n.operator,onChange:e=>{t((0,An.assign)(n,{operator:e.target.value}),r)},children:[(0,_.jsx)("option",{value:"equals",children:x.x.I18n.t("equals")}),(0,_.jsx)("option",{value:"before",children:x.x.I18n.t("before")}),(0,_.jsx)("option",{value:"after",children:x.x.I18n.t("after")})]},"select-operator"),(0,_.jsx)(kt,{dateFormat:"MMM d, yyyy",onChange:e=>t((0,An.assign)(n,{value:Ds(e)}),r),selected:n.value?Es(n.value):void 0})]})}};var Os;!function(e){e.DATE="date",e.TEXT="text",e.TEXTAREA="textarea",e.RADIO="radio",e.CHECKBOX="checkbox",e.SELECT="select"}(Os||(Os={}));const Rs={[Os.TEXT]:Ss,[Os.TEXTAREA]:Ss,[Os.RADIO]:Cs,[Os.SELECT]:Cs,[Os.CHECKBOX]:function(e){return"1"===e.value||"0"===e.value},[Os.DATE]:function(e){return("month"===e.date_type||!("string"!=typeof e.operator||e.operator.length<1))&&"string"==typeof e.value&&e.value.length>1}},Ps={[Os.TEXT]:Is,[Os.TEXTAREA]:Is,[Os.RADIO]:Ts,[Os.SELECT]:Ts,[Os.CHECKBOX]:function(e){let{filterIndex:t}=e;const n=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilterFromEvent:r,updateSegmentFilter:a}=(0,ns.Z)("mailpoet-dynamic-segments-form");return(0,y.useEffect)((()=>{"1"!==n.value&&"0"!==n.value&&a({operator:"equals",value:"1"},t)}),[a,n,t]),(0,_.jsxs)(ae.Select,{value:n.value,onChange:e=>r("value",t,e),children:[(0,_.jsx)("option",{value:"1",children:x.x.I18n.t("checked")}),(0,_.jsx)("option",{value:"0",children:x.x.I18n.t("unchecked")})]},"select")},[Os.DATE]:function(e){let{customField:t,filterIndex:n}=e;const r=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(n)),[n]),{updateSegmentFilter:a}=(0,ns.Z)("mailpoet-dynamic-segments-form");(0,y.useEffect)((()=>{r.date_type!==t.params.date_type&&a({date_type:t.params.date_type,value:""},n)}),[r.date_type,a,t.params.date_type,n]);const s=As[t.params.date_type];return s?(0,_.jsx)(s,{item:r,onChange:a,filterIndex:n}):null}},{subscribersLimitReached:Ms,subscribersLimit:Ls,subscribersCount:Fs,premiumActive:qs,hasValidApiKey:$s,hasValidPremiumKey:Us,isPremiumPluginInstalled:Zs,premiumPluginDownloadUrl:Vs,premiumPluginActivationUrl:Ws,pluginPartialKey:Ys}=x.x,Bs=$s||Us,Hs=e=>{const t=x.x.I18n.t(e);return(0,_.jsx)("p",{children:I()(t,/(\[subscribersCount]|\[subscribersLimit])/g,(e=>"[subscribersCount]"===e?Fs:Ls))})},zs=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"_blank";return(0,_.jsx)(E.z,{href:t,target:n,rel:"noopener noreferrer",children:x.x.I18n.t(e)})};function Gs(e){let t,n,{message:r,actionButton:a}=e;if(Bs&&!qs)t=Hs("premiumFeatureDescription"),n=Zs?zs("premiumFeatureButtonActivatePremium",Ws,"_self"):zs("premiumFeatureButtonDownloadPremium",Vs);else if(Ms){t=Hs("premiumFeatureDescriptionSubscribersLimitReached");const e=Bs?x.x.MailPoetComUrlFactory.getUpgradeUrl(Ys):x.x.MailPoetComUrlFactory.getPurchasePlanUrl(+Fs+1);n=zs("premiumFeatureButtonUpgradePlan",e)}else t=r,n=a;return(0,_.jsx)(Oe.K,{title:x.x.I18n.t("premiumFeature"),message:t,actionButton:n})}function Ks(){return(0,_.jsx)(Gs,{message:(()=>{const e=x.x.I18n.t("premiumFeatureMultipleConditions");return(0,_.jsx)("p",{children:I()(e,/\[link](.*?)\[\/link]/g,(e=>(0,_.jsx)("a",{href:x.x.premiumLink,target:"_blank",rel:"noopener noreferrer",children:e},e)))})})(),actionButton:(0,_.jsx)(E.z,{href:x.x.MailPoetComUrlFactory.getPurchasePlanUrl(x.x.subscribersCount,x.x.currentWpUserEmail,null,{utm_medium:"segments",utm_campaign:"signup"}),target:"_blank",rel:"noopener noreferrer",children:x.x.I18n.t("premiumBannerCtaFree")})})}const Qs=[{value:ss.SubscriberActionTypes.MAILPOET_CUSTOM_FIELD,label:x.x.I18n.t("mailpoetCustomField"),group:ss.SegmentTypes.WordPressRole},{value:ss.SubscriberActionTypes.SUBSCRIBER_SCORE,label:x.x.I18n.t("subscriberScore"),group:ss.SegmentTypes.WordPressRole},{value:ss.SubscriberActionTypes.SUBSCRIBED_DATE,label:x.x.I18n.t("subscribedDate"),group:ss.SegmentTypes.WordPressRole},{value:ss.SubscriberActionTypes.SUBSCRIBED_TO_LIST,label:x.x.I18n.t("subscribedToList"),group:ss.SegmentTypes.WordPressRole},{value:ss.SubscriberActionTypes.SUBSCRIBER_TAG,label:x.x.I18n.t("subscriberTag"),group:ss.SegmentTypes.WordPressRole},{value:ss.SubscriberActionTypes.WORDPRESS_ROLE,label:x.x.I18n.t("segmentsSubscriber"),group:ss.SegmentTypes.WordPressRole}],Xs={[ss.SubscriberActionTypes.WORDPRESS_ROLE]:fs,[ss.SubscriberActionTypes.SUBSCRIBER_SCORE]:function(e){let{filterIndex:t}=e;const n=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,ns.Z)("mailpoet-dynamic-segments-form");return(0,y.useEffect)((()=>{xs.includes(n.operator)||r({operator:gs.HIGHER_THAN},t),n.operator!==gs.HIGHER_THAN&&n.operator!==gs.LOWER_THAN&&n.operator!==gs.EQUALS&&n.operator!==gs.NOT_EQUALS||void 0!==n.value||r({value:""},t),n.operator!==gs.UNKNOWN&&n.operator!==gs.NOT_UNKNOWN||r({value:null},t)}),[r,n,t]),(0,_.jsx)(_t.Grid.CenteredRow,{children:(s=e=>"{condition}"===e?(0,_.jsxs)(ae.Select,{value:n.operator,automationId:"segment-subscriber-score-operator",onChange:e=>{a("operator",t,e)},children:[(0,_.jsx)("option",{value:gs.HIGHER_THAN,children:x.x.I18n.t("higherThan")}),(0,_.jsx)("option",{value:gs.LOWER_THAN,children:x.x.I18n.t("lowerThan")}),(0,_.jsx)("option",{value:gs.EQUALS,children:x.x.I18n.t("equals")}),(0,_.jsx)("option",{value:gs.NOT_EQUALS,children:x.x.I18n.t("notEquals")}),(0,_.jsx)("option",{value:gs.UNKNOWN,children:x.x.I18n.t("unknown")}),(0,_.jsx)("option",{value:gs.NOT_UNKNOWN,children:x.x.I18n.t("notUnknown")})]},"select"):"{score}"===e?(n.operator===gs.HIGHER_THAN||n.operator===gs.LOWER_THAN||n.operator===gs.EQUALS||n.operator===gs.NOT_EQUALS)&&(0,_.jsx)(ee.I,{type:"number",value:n.value||"","data-automation-id":"segment-subscriber-score-value",onChange:e=>{a("value",t,e)},min:"0",placeholder:x.x.I18n.t("subscriberScorePlaceholder")},"input"):"string"==typeof e&&e.trim().length>0?n.operator!==gs.UNKNOWN&&n.operator!==gs.NOT_UNKNOWN&&(0,_.jsx)("div",{children:e},"score"):null,x.x.I18n.t("subscriberScoreSentence").split(/({condition})|({score})|(\b%\b)/gim).map(s))});var s},[ss.SubscriberActionTypes.SUBSCRIBED_DATE]:function(e){let{filterIndex:t}=e;const n=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,ns.Z)("mailpoet-dynamic-segments-form");return(0,y.useEffect)((()=>{ws.includes(n.operator)||r({operator:ys.BEFORE},t),n.operator!==ys.BEFORE&&n.operator!==ys.AFTER&&n.operator!==ys.ON&&n.operator!==ys.NOT_ON||void 0!==js(n.value)&&/^\d+-\d+-\d+$/.test(n.value)||r({value:_s(new Date)},t),n.operator!==ys.IN_THE_LAST&&n.operator!==ys.NOT_IN_THE_LAST||"string"!=typeof n.value||/^\d*$/.exec(n.value)||r({value:""},t)}),[r,n,t]),(0,_.jsxs)(_t.Grid.CenteredRow,{children:[(0,_.jsxs)(ae.Select,{value:n.operator,onChange:e=>{a("operator",t,e)},children:[(0,_.jsx)("option",{value:ys.BEFORE,children:x.x.I18n.t("before")}),(0,_.jsx)("option",{value:ys.AFTER,children:x.x.I18n.t("after")}),(0,_.jsx)("option",{value:ys.ON,children:x.x.I18n.t("on")}),(0,_.jsx)("option",{value:ys.NOT_ON,children:x.x.I18n.t("notOn")}),(0,_.jsx)("option",{value:ys.IN_THE_LAST,children:x.x.I18n.t("inTheLast")}),(0,_.jsx)("option",{value:ys.NOT_IN_THE_LAST,children:x.x.I18n.t("notInTheLast")})]},"select"),(n.operator===ys.BEFORE||n.operator===ys.AFTER||n.operator===ys.ON||n.operator===ys.NOT_ON)&&(0,_.jsx)(kt,{dateFormat:"MMM d, yyyy",onChange:e=>{r({value:_s(e)},t)},selected:n.value?js(n.value):void 0}),(n.operator===ys.IN_THE_LAST||n.operator===ys.NOT_IN_THE_LAST)&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(ee.I,{type:"number",value:n.value,onChange:e=>{a("value",t,e)},min:"1",placeholder:x.x.I18n.t("daysPlaceholder")},"input"),(0,_.jsx)("span",{children:x.x.I18n.t("daysPlaceholder")})]})]})},[ss.SubscriberActionTypes.MAILPOET_CUSTOM_FIELD]:function(e){let{filterIndex:t}=e;const n=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r}=(0,ns.Z)("mailpoet-dynamic-segments-form"),a=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getCustomFieldsList()),[]),s=(0,An.find)({id:Number(n.custom_field_id)},a),i=a.map((e=>({value:e.id.toString(),label:e.name}))),o=Ps[n.custom_field_type];return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("div",{children:(0,_.jsx)(as.ReactSelect,{dimension:"small",isFullWidth:!0,placeholder:x.x.I18n.t("selectCustomFieldPlaceholder"),options:i,automationId:"select-custom-field",value:(0,An.find)((e=>{if(n.custom_field_id)return n.custom_field_id===e.value}),i),onChange:e=>{const n=(0,An.find)({id:Number(e.value)},a);n&&r({custom_field_id:e.value,custom_field_type:n.type,operator:void 0,value:void 0},t)}})}),(0,_.jsx)("div",{children:o&&(0,_.jsx)(o,{customField:s,filterIndex:t})})]})},[ss.SubscriberActionTypes.SUBSCRIBED_TO_LIST]:function(e){let{filterIndex:t}=e;const n=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),r=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getStaticSegmentsList()),[]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:s}=(0,ns.Z)("mailpoet-dynamic-segments-form");(0,y.useEffect)((()=>{n.operator!==ss.AnyValueTypes.ANY&&n.operator!==ss.AnyValueTypes.ALL&&n.operator!==ss.AnyValueTypes.NONE&&a({operator:ss.AnyValueTypes.ANY},t)}),[a,n,t]);const i=r.map((e=>({value:e.id,label:e.name})));return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(_t.Grid.CenteredRow,{children:(0,_.jsxs)(ae.Select,{isFullWidth:!0,value:n.operator,onChange:e=>{s("operator",t,e)},children:[(0,_.jsx)("option",{value:ss.AnyValueTypes.ANY,children:x.x.I18n.t("anyOf")}),(0,_.jsx)("option",{value:ss.AnyValueTypes.ALL,children:x.x.I18n.t("allOf")}),(0,_.jsx)("option",{value:ss.AnyValueTypes.NONE,children:x.x.I18n.t("noneOf")})]},"select")}),(0,_.jsx)(_t.Grid.CenteredRow,{children:(0,_.jsx)(as.ReactSelect,{dimension:"small",isFullWidth:!0,isMulti:!0,placeholder:x.x.I18n.t("searchLists"),options:i,value:(0,An.filter)((e=>{if(!n.segments)return;const t=e.value;return-1!==n.segments.indexOf(t)}),i),onChange:e=>{a({segments:(0,An.map)("value",e)},t)}})})]})},[ss.SubscriberActionTypes.SUBSCRIBER_TAG]:function(e){let{filterIndex:t}=e;return Ae.Hooks.applyFilters("mailpoet_dynamic_segments_filter_subscriber_tag",(0,_.jsx)(Ks,{}),t)}};var Js;!function(e){e.MEMBER_OF="isMemberOf"}(Js||(Js={}));const ei=[{value:Js.MEMBER_OF,label:x.x.I18n.t("segmentsActiveMembership"),group:ss.SegmentTypes.WooCommerceMembership}];var ti;!function(e){e.ACTIVE_SUBSCRIPTIONS="hasActiveSubscription"}(ti||(ti={}));const ni=[{value:ti.ACTIVE_SUBSCRIPTIONS,label:x.x.I18n.t("segmentsActiveSubscription"),group:ss.SegmentTypes.WooCommerceSubscription}],ri={[ss.SegmentTypes.Email]:function(e){return!!Object.values(ss.EmailActionTypes).some((t=>t===e.action))&&(e.action===ss.EmailActionTypes.CLICKED_ANY||(e.action===ss.EmailActionTypes.CLICKED?!!e.newsletter_id:e.action!==ss.EmailActionTypes.OPENS_ABSOLUTE_COUNT&&e.action!==ss.EmailActionTypes.MACHINE_OPENS_ABSOLUTE_COUNT?Array.isArray(e.newsletters)&&e.newsletters.length>0:!!e.days&&!!e.opens&&!!e.operator))},[ss.SegmentTypes.WooCommerce]:function(e){if(!Object.values(ps).some((t=>t===e.action)))return!1;const t=void 0===e.category_ids||0===e.category_ids.length||!e.operator;if(e.action===ps.PURCHASED_CATEGORY&&t)return!1;const n=void 0===e.product_ids||0===e.product_ids.length||!e.operator;if(e.action===ps.PURCHASED_PRODUCT&&n)return!1;const r=void 0===e.country_code||0===e.country_code.length;if(e.action===ps.CUSTOMER_IN_COUNTRY&&r)return!1;const a=!e.number_of_orders_count||!e.number_of_orders_days||!e.number_of_orders_type;return!(e.action===ps.NUMBER_OF_ORDERS&&a||!(e.action!==ps.TOTAL_SPENT||e.total_spent_amount&&e.total_spent_days&&e.total_spent_type))},[ss.SegmentTypes.WordPressRole]:function(e){return e.action&&e.action!==ss.SubscriberActionTypes.WORDPRESS_ROLE?e.action===ss.SubscriberActionTypes.MAILPOET_CUSTOM_FIELD?function(e){const t=Rs[e.custom_field_type];return!!t&&t(e)}(e):e.action===ss.SubscriberActionTypes.SUBSCRIBER_SCORE?function(e){if(e.operator===gs.HIGHER_THAN||e.operator===gs.LOWER_THAN||e.operator===gs.EQUALS||e.operator===gs.NOT_EQUALS){const t=Number(e.value),n=Number(parseFloat(e.value));return!Number.isNaN(t)&&!Number.isNaN(n)&&t>=0&&t<=100}return e.operator===gs.UNKNOWN||e.operator===gs.NOT_UNKNOWN}(e):e.action===ss.SubscriberActionTypes.SUBSCRIBED_TO_LIST?function(e){return(e.operator===ss.AnyValueTypes.ANY||e.operator===ss.AnyValueTypes.ALL||e.operator===ss.AnyValueTypes.NONE)&&Array.isArray(e.segments)&&e.segments.length>0}(e):e.action===ss.SubscriberActionTypes.SUBSCRIBER_TAG?function(e){return Ae.Hooks.applyFilters("mailpoet_dynamic_segments_filter_subscriber_tag_validate",!1,e)}(e):!(!e.operator||!e.value)&&(e.operator===ys.BEFORE||e.operator===ys.AFTER||e.operator===ys.ON||e.operator===ys.NOT_ON?/^\d+-\d+-\d+$/.test(e.value):(e.operator===ys.IN_THE_LAST||e.operator===ys.NOT_IN_THE_LAST)&&(/^\d+$/.test(e.value)&&Number(e.value)>0)):Array.isArray(e.wordpressRole)&&e.wordpressRole.length>0},[ss.SegmentTypes.WooCommerceMembership]:function(e){const t=!e.plan_ids||!e.plan_ids.length||!e.operator;return e.action!==Js.MEMBER_OF||!t},[ss.SegmentTypes.WooCommerceSubscription]:function(e){const t=!e.product_ids||!e.product_ids.length||!e.operator;return e.action!==ti.ACTIVE_SUBSCRIPTIONS||!t}};function ai(e){return!(e.length<1)&&0===e.map((e=>void 0!==ri[e.segmentType]&&ri[e.segmentType](e))).filter((e=>!1===e)).length}let si,ii;function oi(){const e=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegment()),[]),t=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSubscriberCount()),[]),{updateSubscriberCount:n}=(0,ns.Z)("mailpoet-dynamic-segments-form"),r=JSON.stringify(e),a=(0,y.useRef)(1),s=(0,y.useRef)(null),i=(0,y.useRef)(!1),o=(0,y.useRef)((0,vt.debounce)((function e(t){if(i.current)return void(s.current=t);s.current=null,a.current+=1;const r=a.current;i.current=!0,function(e){const t={filters:e.filters,filters_connect:e.filters_connect};return bt().isEqual(t,si)?Promise.resolve(ii):(si={filters:[...e.filters],filters_connect:e.filters_connect},x.x.Ajax.post({api_version:x.x.apiVersion,endpoint:"dynamic_segments",action:"getCount",data:e,timeout:2e4}).then((e=>{const{data:t}=e;return ii={count:t.count,errors:void 0},ii})))}(t).then((t=>{if(i.current=!1,s.current)return void e(s.current);if(r!==a.current)return;const o={loading:!1};t&&(o.count=t.count,o.errors=t.errors),n(o)}),(e=>{i.current=!1;const t={},r=e.errors.map((e=>e.message));t.loading=!1,t.count=void 0,t.errors=r,n(t)}))}),2e3,{trailing:!0}));return(0,y.useEffect)((()=>{ai(e.filters)?(n({loading:!0,count:void 0,errors:void 0}),(0,o.current)(e)):n({count:void 0,loading:!1})}),[e,r,n]),t.errors?(0,_.jsx)("div",{className:"mailpoet-form-field",children:(0,_.jsxs)("span",{className:"mailpoet-form-error-message",children:[x.x.I18n.t("dynamicSegmentSizeCalculatingTimeout")," ",(0,_.jsx)("a",{href:"https://kb.mailpoet.com/article/237-guide-to-subscriber-segmentation?utm_source=plugin&utm_medium=segments","data-beacon-article":"5a574bd92c7d3a194368233e",target:"_blank",className:"mailpoet-form-error-message",rel:"noopener noreferrer",children:x.x.I18n.t("learnMore")})]})}):t.loading||void 0!==t.count?t.loading?(0,_.jsx)("div",{className:"mailpoet-form-field",children:(0,_.jsx)("span",{className:"mailpoet-form-notice-message",children:x.x.I18n.t("dynamicSegmentSizeIsCalculated")})}):(0,_.jsx)("div",{className:"mailpoet-form-field",children:(0,_.jsx)("span",{className:"mailpoet-form-notice-message",children:x.x.I18n.t("dynamicSegmentSize").replace("%1$d",t.count.toLocaleString())})}):(0,_.jsx)("span",{})}const li={[ss.SegmentTypes.Email]:function(e){let{filterIndex:t}=e;const n=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),r=us[n.action];return r?(0,_.jsx)(r,{filterIndex:t}):null},[ss.SegmentTypes.WooCommerce]:e=>{let{filterIndex:t}=e;const n=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,ns.Z)("mailpoet-dynamic-segments-form"),s=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getProductCategories()),[]),i=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getWooCommerceCountries()),[]),o=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getProducts()),[]),l=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getWooCommerceCurrencySymbol()),[]),c=o.map((e=>({value:e.id,label:e.name}))),d=s.map((e=>({value:e.id,label:e.name}))),u=i.map((e=>({value:e.code,label:e.name})));let p;return(0,y.useEffect)((()=>{void 0===n.number_of_orders_type&&n.action===ps.NUMBER_OF_ORDERS&&r({number_of_orders_type:"="},t),void 0===n.total_spent_type&&n.action===ps.TOTAL_SPENT&&r({total_spent_type:">"},t),hs.includes(n.action)&&n.operator!==ss.AnyValueTypes.ALL&&n.operator!==ss.AnyValueTypes.ANY&&n.operator!==ss.AnyValueTypes.NONE&&r({operator:ss.AnyValueTypes.ANY},t),n.action===ps.CUSTOMER_IN_COUNTRY&&n.operator!==ss.AnyValueTypes.ANY&&n.operator!==ss.AnyValueTypes.NONE&&r({operator:ss.AnyValueTypes.ANY},t)}),[r,n,t]),n.action===ps.PURCHASED_PRODUCT?p=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(_t.Grid.CenteredRow,{children:(0,_.jsxs)(ae.Select,{value:n.operator,onChange:e=>{r({operator:e.target.value},t)},automationId:"select-operator",children:[(0,_.jsx)("option",{value:ss.AnyValueTypes.ANY,children:x.x.I18n.t("anyOf")}),(0,_.jsx)("option",{value:ss.AnyValueTypes.ALL,children:x.x.I18n.t("allOf")}),(0,_.jsx)("option",{value:ss.AnyValueTypes.NONE,children:x.x.I18n.t("noneOf")})]},"select-operator")}),(0,_.jsx)(_t.Grid.CenteredRow,{children:(0,_.jsx)(as.ReactSelect,{isMulti:!0,dimension:"small",isFullWidth:!0,placeholder:x.x.I18n.t("selectWooPurchasedProduct"),options:c,value:(0,An.filter)((e=>{if(void 0!==n.product_ids&&0!==n.product_ids.length)return-1!==n.product_ids.indexOf(e.value)}),c),onChange:e=>{r({product_ids:(e||[]).map((e=>e.value))},t)},automationId:"select-segment-products"},"select-segment-products")})]}):n.action===ps.PURCHASED_CATEGORY?p=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(_t.Grid.CenteredRow,{children:(0,_.jsxs)(ae.Select,{value:n.operator,onChange:e=>{r({operator:e.target.value},t)},automationId:"select-operator",children:[(0,_.jsx)("option",{value:ss.AnyValueTypes.ANY,children:x.x.I18n.t("anyOf")}),(0,_.jsx)("option",{value:ss.AnyValueTypes.ALL,children:x.x.I18n.t("allOf")}),(0,_.jsx)("option",{value:ss.AnyValueTypes.NONE,children:x.x.I18n.t("noneOf")})]},"select-operator")}),(0,_.jsx)(_t.Grid.CenteredRow,{children:(0,_.jsx)(as.ReactSelect,{isMulti:!0,dimension:"small",isFullWidth:!0,placeholder:x.x.I18n.t("selectWooPurchasedCategory"),options:d,value:(0,An.filter)((e=>{if(void 0!==n.category_ids&&0!==n.category_ids.length)return-1!==n.category_ids.indexOf(e.value)}),d),onChange:e=>{r({category_ids:(e||[]).map((e=>e.value))},t)},automationId:"select-segment-category"},"select-segment-category")})]}):n.action===ps.NUMBER_OF_ORDERS?p=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(_t.Grid.CenteredRow,{children:[(0,_.jsxs)(ae.Select,{value:n.number_of_orders_type,onChange:e=>{a("number_of_orders_type",t,e)},automationId:"select-number-of-orders-type",children:[(0,_.jsx)("option",{value:"=",children:x.x.I18n.t("equals")}),(0,_.jsx)("option",{value:"!=",children:x.x.I18n.t("notEquals")}),(0,_.jsx)("option",{value:">",children:x.x.I18n.t("moreThan")}),(0,_.jsx)("option",{value:"<",children:x.x.I18n.t("lessThan")})]},"select"),(0,_.jsx)(ee.I,{"data-automation-id":"input-number-of-orders-count",type:"number",min:0,value:n.number_of_orders_count||"",placeholder:x.x.I18n.t("wooNumberOfOrdersCount"),onChange:e=>{a("number_of_orders_count",t,e)}}),(0,_.jsx)("div",{children:x.x.I18n.t("wooNumberOfOrdersOrders")})]}),(0,_.jsxs)(_t.Grid.CenteredRow,{children:[(0,_.jsx)("div",{children:x.x.I18n.t("inTheLast")}),(0,_.jsx)(ee.I,{"data-automation-id":"input-number-of-orders-days",type:"number",min:1,value:n.number_of_orders_days||"",placeholder:x.x.I18n.t("daysPlaceholder"),onChange:e=>{a("number_of_orders_days",t,e)}}),(0,_.jsx)("div",{children:x.x.I18n.t("days")})]})]}):n.action===ps.TOTAL_SPENT?p=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(_t.Grid.CenteredRow,{children:[(0,_.jsxs)(ae.Select,{value:n.total_spent_type,onChange:e=>{a("total_spent_type",t,e)},automationId:"select-total-spent-type",children:[(0,_.jsx)("option",{value:"=",children:x.x.I18n.t("equals")}),(0,_.jsx)("option",{value:"!=",children:x.x.I18n.t("notEquals")}),(0,_.jsx)("option",{value:">",children:x.x.I18n.t("moreThan")}),(0,_.jsx)("option",{value:"<",children:x.x.I18n.t("lessThan")})]},"select"),(0,_.jsx)(ee.I,{"data-automation-id":"input-total-spent-amount",type:"number",min:0,step:.01,value:n.total_spent_amount||"",placeholder:x.x.I18n.t("wooTotalSpentAmount"),onChange:e=>{a("total_spent_amount",t,e)}}),(0,_.jsx)("div",{children:l})]}),(0,_.jsxs)(_t.Grid.CenteredRow,{children:[(0,_.jsx)("div",{children:x.x.I18n.t("inTheLast")}),(0,_.jsx)(ee.I,{"data-automation-id":"input-total-spent-days",type:"number",min:1,value:n.total_spent_days||"",placeholder:x.x.I18n.t("daysPlaceholder"),onChange:e=>{a("total_spent_days",t,e)}}),(0,_.jsx)("div",{children:x.x.I18n.t("days")})]})]}):n.action===ps.CUSTOMER_IN_COUNTRY&&(p=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(_t.Grid.CenteredRow,{children:(0,_.jsxs)(ae.Select,{value:n.operator,onChange:e=>{r({operator:e.target.value},t)},automationId:"select-operator-country",children:[(0,_.jsx)("option",{value:ss.AnyValueTypes.ANY,children:x.x.I18n.t("anyOf")}),(0,_.jsx)("option",{value:ss.AnyValueTypes.NONE,children:x.x.I18n.t("noneOf")})]},"select-operator-country")}),(0,_.jsx)(_t.Grid.CenteredRow,{children:(0,_.jsx)(as.ReactSelect,{dimension:"small",isFullWidth:!0,isMulti:!0,placeholder:x.x.I18n.t("selectWooCountry"),options:u,value:(0,An.filter)((e=>{if(n.country_code)return-1!==n.country_code.indexOf(e.value)}),u),onChange:e=>{r({country_code:(e||[]).map((e=>e.value))},t)},automationId:"select-segment-country"},"select-segment-country")})]})),p},[ss.SegmentTypes.WordPressRole]:function(e){let{filterIndex:t}=e;const n=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]);let r;return r=n.action?Xs[n.action]:fs,r?(0,_.jsx)(r,{filterIndex:t}):null},[ss.SegmentTypes.WooCommerceMembership]:function(e){let{filterIndex:t}=e;const n=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,ns.Z)("mailpoet-dynamic-segments-form"),s=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getMembershipPlans()),[]).map((e=>({value:e.id,label:e.name})));return(0,y.useEffect)((()=>{n.action===Js.MEMBER_OF&&n.operator!==ss.AnyValueTypes.ANY&&n.operator!==ss.AnyValueTypes.ALL&&n.operator!==ss.AnyValueTypes.NONE&&r({operator:ss.AnyValueTypes.ANY},t)}),[r,n,t]),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(_t.Grid.CenteredRow,{children:(0,_.jsxs)(ae.Select,{value:n.operator,onChange:e=>a("operator",t,e),automationId:"select-operator",children:[(0,_.jsx)("option",{value:ss.AnyValueTypes.ANY,children:x.x.I18n.t("anyOf")}),(0,_.jsx)("option",{value:ss.AnyValueTypes.ALL,children:x.x.I18n.t("allOf")}),(0,_.jsx)("option",{value:ss.AnyValueTypes.NONE,children:x.x.I18n.t("noneOf")})]},"select-operator")}),(0,_.jsx)(_t.Grid.CenteredRow,{children:(0,_.jsx)(as.ReactSelect,{isMulti:!0,dimension:"small",isFullWidth:!0,placeholder:x.x.I18n.t("selectWooMembership"),options:s,value:(0,An.filter)((e=>!!n.plan_ids&&-1!==n.plan_ids.indexOf(e.value)),s),onChange:e=>{r({plan_ids:(e||[]).map((e=>e.value))},t)},automationId:"select-segment-plans"},"select-segment-membership-plan")})]})},[ss.SegmentTypes.WooCommerceSubscription]:function(e){let{filterIndex:t}=e;const n=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,ns.Z)("mailpoet-dynamic-segments-form"),s=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSubscriptionProducts()),[]).map((e=>({value:e.id,label:e.name})));return(0,y.useEffect)((()=>{n.action===ti.ACTIVE_SUBSCRIPTIONS&&n.operator!==ss.AnyValueTypes.ANY&&n.operator!==ss.AnyValueTypes.ALL&&n.operator!==ss.AnyValueTypes.NONE&&r({operator:ss.AnyValueTypes.ANY},t)}),[r,n,t]),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(_t.Grid.CenteredRow,{children:(0,_.jsxs)(ae.Select,{value:n.operator,onChange:e=>a("operator",t,e),automationId:"select-operator",children:[(0,_.jsx)("option",{value:ss.AnyValueTypes.ANY,children:x.x.I18n.t("anyOf")}),(0,_.jsx)("option",{value:ss.AnyValueTypes.ALL,children:x.x.I18n.t("allOf")}),(0,_.jsx)("option",{value:ss.AnyValueTypes.NONE,children:x.x.I18n.t("noneOf")})]},"select-operator")}),(0,_.jsx)(_t.Grid.CenteredRow,{children:(0,_.jsx)(as.ReactSelect,{isMulti:!0,dimension:"small",isFullWidth:!0,placeholder:x.x.I18n.t("selectWooSubscription"),options:s,value:(0,An.filter)((e=>!!n.product_ids&&-1!==n.product_ids.indexOf(e.value)),s),onChange:e=>{r({product_ids:(e||[]).map((e=>e.value))},t)},automationId:"select-segment-products"},"select-segment-category")})]})}};function ci(e){let{filterIndex:t}=e;const n=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]);if(void 0===n||void 0===li[n.segmentType])return null;const r=li[n.segmentType];return(0,_.jsx)(r,{filterIndex:t})}function di(){const e=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegment()),[]),t=[ss.EmailActionTypes.OPENED,ss.EmailActionTypes.OPENS_ABSOLUTE_COUNT,ss.EmailActionTypes.MACHINE_OPENED,ss.EmailActionTypes.MACHINE_OPENS_ABSOLUTE_COUNT];let n=!1;return e.filters.forEach((e=>{t.includes(e.action)&&(n=!0)})),n?(0,_.jsx)("div",{className:"mailpoet-form-field",children:(0,_.jsx)("span",{className:"mailpoet-form-notice-message",children:x.x.I18n.t("privacyProtectionNotice")})}):(0,_.jsx)("span",{})}const ui=Ae.Hooks.applyFilters("mailpoet_dynamic_segments_form_filters_before",(()=>null)),pi=Ae.Hooks.applyFilters("mailpoet_dynamic_filters_filter_before",(()=>null)),mi=Ae.Hooks.applyFilters("mailpoet_dynamic_filters_filter_after",(()=>(0,_.jsx)("div",{className:"mailpoet-gap"})));function hi(e){let{segmentId:t}=e;const n=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegment()),[]),r=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getAvailableFilters()),[]),a=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").findFiltersValueForSegment(n)),[n]),s=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSubscriberCount()),[]),i=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getErrors()),[]),{updateSegment:o,updateSegmentFilter:l,handleSave:c}=(0,ns.Z)("mailpoet-dynamic-segments-form"),[d,u]=(0,y.useState)(!1),p=Ae.Hooks.applyFilters("mailpoet_dynamic_segments_form_add_condition_action",(()=>{u(!0)}));return(0,_.jsxs)("form",{className:"mailpoet_form",children:[i.length>0&&(0,_.jsx)(He,{errors:i.map((e=>({message:e})))}),(0,_.jsxs)("div",{className:"mailpoet-form-grid",children:[(0,_.jsxs)("div",{className:"mailpoet-form-field-name form-field-row-name mailpoet-segments-name-section",children:[(0,_.jsx)(he.X,{level:4,children:(0,_.jsx)("label",{htmlFor:"field_name",children:x.x.I18n.t("name")})}),(0,_.jsx)("div",{className:"mailpoet-form-field",children:(0,_.jsx)(ee.I,{isFullWidth:!0,type:"text",name:"name",id:"field_name",defaultValue:n.name,"data-automation-id":"input-name",onChange:e=>{o({name:e.target.value})}})})]}),(0,_.jsxs)("div",{className:"mailpoet-form-field-description form-field-row-description mailpoet-segments-description-section",children:[(0,_.jsx)(he.X,{level:4,children:(0,_.jsx)("label",{htmlFor:"field_description",children:x.x.I18n.t("description")})}),(0,_.jsx)("p",{className:"mailpoet-form-description",children:x.x.I18n.t("segmentDescriptionTip")}),(0,_.jsx)("div",{className:"mailpoet-form-field",children:(0,_.jsx)(ne.g,{isFullWidth:!0,name:"description",id:"field_description",value:n.description,"data-automation-id":"input-description",onChange:e=>{o({description:e.target.value})}})})]}),(0,_.jsxs)("div",{className:"mailpoet-segments-segments-section",children:[(0,_.jsx)(he.X,{level:4,children:(0,_.jsx)("label",{htmlFor:"field_filters",children:x.x.I18n.t("formPageTitle")})}),(0,_.jsx)(ui,{}),Array.isArray(a)&&a.map(((e,t)=>(0,_.jsxs)(y.Fragment,{children:[(0,_.jsxs)(_t.Grid.ThreeColumns,{className:"mailpoet-segments-grid",automationId:`filter-row-${t}`,children:[(0,_.jsx)(pi,{filterRows:a,index:t}),(0,_.jsx)(_t.Grid.CenteredRow,{children:(0,_.jsx)(as.ReactSelect,{dimension:"small",placeholder:x.x.I18n.t("selectActionPlaceholder"),options:r,value:e.filterValue,onChange:e=>{l({segmentType:e.group,action:e.value},t)},automationId:"select-segment-action",isFullWidth:!0})}),void 0!==e.index&&(0,_.jsx)(ci,{filterIndex:e.index})]}),(0,_.jsx)(mi,{index:t})]},e.index))),(0,_.jsx)(E.z,{type:"button",variant:"tertiary",iconStart:F.R,onClick:e=>{e.preventDefault(),p(n,o)},children:x.x.I18n.t("addCondition")})]}),d&&(0,_.jsx)("div",{className:"mailpoet-grid-span-two-columns",children:(0,_.jsx)(Ks,{})}),(0,_.jsxs)("div",{className:"mailpoet-segments-counter-section",children:[(0,_.jsx)(oi,{}),(0,_.jsx)(di,{})]}),(0,_.jsx)("div",{className:"mailpoet-form-actions",children:(0,_.jsx)(E.z,{type:"submit",onClick:e=>{e.preventDefault(),c(t)},isDisabled:!ai(n.filters)||void 0===s.count,children:x.x.I18n.t("save")})})]})]})}var fi=n(38104);const gi=e=>e.products,xi=e=>e.membershipPlans,vi=e=>e.subscriptionProducts,bi=e=>e.wordpressRoles,yi=e=>e.productCategories,wi=e=>e.newslettersList,_i=e=>e.canUseWooSubscriptions,ji=e=>e.wooCurrencySymbol,Si=e=>e.wooCountries,Ii=e=>e.customFieldsList,Ci=e=>e.segment,Ti=e=>e.staticSegmentsList,ki=e=>e.subscriberCount,Ni=e=>e.tags,Di=(e,t)=>{let n;return Array.isArray(e.segment.filters)?(n={...e.segment.filters[t]},n):n},Ei=e=>e.errors,Ai=e=>e.allAvailableFilters,Oi=(e,t)=>{const n=[];return t.filters.forEach(((t,r)=>{e.allAvailableFilters.forEach((e=>{e.options.forEach((e=>{e.group===t.segmentType&&e.value===t.action&&n.push({filterValue:e,index:r})}))}))})),n};function Ri(e,t){return{...e,segment:t.segment}}function Pi(e,t){return{...e,errors:t.errors}}function Mi(e,t){const n=e.segment;return{...e,segment:(0,An.assign)(n,t.segment)}}function Li(e,t){const n={...e.segment};return n.filters[t.filterIndex]=(0,An.assign)(n.filters[t.filterIndex],t.filter),{...e,segment:n}}function Fi(e,t){const n=e.subscriberCount;return{...e,subscriberCount:(0,An.assign)(n,t.subscriberCount)}}const qi=e=>function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e,n=arguments.length>1?arguments[1]:void 0;switch(n.type){case ss.Actions.SET_SEGMENT:return Ri(t,n);case ss.Actions.SET_ERRORS:return Pi(t,n);case ss.Actions.UPDATE_SEGMENT:return Mi(t,n);case ss.Actions.UPDATE_SEGMENT_FILTER:return Li(t,n);case ss.Actions.UPDATE_SUBSCRIBER_COUNT:return Fi(t,n);default:return t}};function $i(e){return{type:ss.Actions.SET_SEGMENT,segment:e}}function Ui(e){return{type:ss.Actions.SET_ERRORS,errors:e}}function Zi(e){return{type:ss.Actions.UPDATE_SEGMENT,segment:e}}function Vi(e,t){return{type:ss.Actions.UPDATE_SEGMENT_FILTER,filter:e,filterIndex:t}}function Wi(e,t){return{type:ss.Actions.UPDATE_SEGMENT,segment:{[e]:t.target.value}}}function Yi(e,t,n){return{type:ss.Actions.UPDATE_SEGMENT_FILTER,filter:{[e]:n.target.value},filterIndex:t}}function Bi(e){return{type:ss.Actions.UPDATE_SUBSCRIBER_COUNT,subscriberCount:e}}function*Hi(e){if(void 0===e)return;x.x.Modal.loading(!0);const{res:t,success:n}=yield{type:"LOAD_SEGMENT",segmentId:e};n&&!t.is_plugin_missing||(window.location.href="admin.php?page=mailpoet-segments#/segments"),yield $i(t),x.x.Modal.loading(!1)}function*zi(e){const t=(0,fi.select)("mailpoet-dynamic-segments-form").getSegment();yield Ui([]);const{error:n,success:r}=yield{type:"SAVE_SEGMENT",segment:t};var a;r?(window.location.href="admin.php?page=mailpoet-segments#/segments",void 0!==e?x.x.Notice.success(x.x.I18n.t("dynamicSegmentUpdated")):(a=t,x.x.Notice.success(x.x.I18n.t("dynamicSegmentAdded")),x.x.trackEvent("Segments > Add new",{type:a.segmentType||"unknown type",subtype:a.action||a.wordpressRole||"unknown subtype"}))):yield Ui(n)}function Gi(e){let t=JSON.parse(JSON.stringify(e));return(0,An.has)("link_id",e)&&(t=(0,An.assign)(t,{link_id:e.link_id.toString()})),(0,An.has)("newsletter_id",e)&&(t=(0,An.assign)(t,{newsletter_id:e.newsletter_id.toString()})),(0,An.has)("product_id",e)&&(t=(0,An.assign)(t,{product_id:e.product_id.toString()})),(0,An.has)("category_id",e)&&(t=(0,An.assign)(t,{category_id:e.category_id.toString()})),t}async function Ki(e){const t=e.segmentId;try{return{success:!0,res:Gi((await x.x.Ajax.post({api_version:x.x.apiVersion,endpoint:"dynamic_segments",action:"get",data:{id:t}})).data)}}catch(e){return{success:!1,error:(0,ze.q)(e)?e.errors.map((e=>e.message)):null,res:e}}}async function Qi(e){const t=e.segment;try{return await x.x.Ajax.post({api_version:x.x.apiVersion,endpoint:"dynamic_segments",action:"save",data:t}),{success:!0}}catch(e){return{success:!1,error:(0,ze.q)(e)?e.errors.map((e=>e.message)):null}}}function Xi(e,t){const n=[{label:x.x.I18n.t("email"),options:ds},{label:x.x.I18n.t("wpUserRole"),options:Qs}];return x.x.isWoocommerceActive&&n.push({label:x.x.I18n.t("woocommerce"),options:ms}),x.x.isWoocommerceActive&&t&&n.push({label:x.x.I18n.t("woocommerceMemberships"),options:ei}),x.x.isWoocommerceActive&&e&&n.push({label:x.x.I18n.t("woocommerceSubscriptions"),options:ni}),n}function Ji(){const e=(0,l.$B)();(()=>{const e={products:window.mailpoet_products,staticSegmentsList:window.mailpoet_static_segments_list,membershipPlans:window.mailpoet_membership_plans,subscriptionProducts:window.mailpoet_subscription_products,productCategories:window.mailpoet_product_categories,newslettersList:window.mailpoet_newsletters_list,wordpressRoles:window.wordpress_editable_roles_list,canUseWooMemberships:window.mailpoet_can_use_woocommerce_memberships,canUseWooSubscriptions:window.mailpoet_can_use_woocommerce_subscriptions,wooCurrencySymbol:window.mailpoet_woocommerce_currency_symbol,wooCountries:window.mailpoet_woocommerce_countries,customFieldsList:window.mailpoet_custom_fields,tags:window.mailpoet_tags,segment:{filters_connect:ss.SegmentConnectTypes.AND,filters:[{segmentType:ss.SegmentTypes.WordPressRole,action:ss.SubscriberActionTypes.WORDPRESS_ROLE}]},subscriberCount:{loading:!1},errors:[],allAvailableFilters:Xi(window.mailpoet_can_use_woocommerce_subscriptions,window.mailpoet_can_use_woocommerce_memberships)},t={selectors:r,actions:a,controls:s,reducer:qi(e),resolvers:{}};(0,fi.registerStore)("mailpoet-dynamic-segments-form",t)})();const{pageLoaded:t}=(0,ns.Z)("mailpoet-dynamic-segments-form");return(0,y.useEffect)((()=>{t(e.params.id)}),[e.params.id,t]),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(Q.A,{color:"#fff"}),(0,_.jsx)(ye.B,{}),(0,_.jsxs)(he.X,{level:1,className:"mailpoet-title",children:[(0,_.jsx)("span",{children:x.x.I18n.t("formPageTitle")}),(0,_.jsx)(o.Link,{className:"mailpoet-button button button-secondary button-small",to:"/segments",children:x.x.I18n.t("backToList")})]}),(0,_.jsx)(hi,{segmentId:Number(e.params.id)})]})}const eo=[{name:"name",label:x.x.I18n.t("nameColumn"),sortable:!0},{name:"description",label:x.x.I18n.t("description"),sortable:!1},{name:"count",label:x.x.I18n.t("subscribersCountColumn"),sortable:!1},{name:"subscribed",label:x.x.I18n.t("subscribed"),sortable:!1},{name:"updated_at",label:x.x.I18n.t("updatedAtColumn"),sortable:!0}],to={onLoadingItems:()=>x.x.I18n.t("loadingDynamicSegmentItems"),onNoItemsFound:()=>x.x.I18n.t("noDynamicSegmentItemsFound"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneDynamicSegmentTrashed"):x.x.I18n.t("multipleDynamicSegmentsTrashed").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneDynamicSegmentDeleted"):x.x.I18n.t("multipleDynamicSegmentsDeleted").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneDynamicSegmentRestored"):x.x.I18n.t("multipleDynamicSegmentsRestored").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)}},no=[{name:"edit",className:"mailpoet-hide-on-mobile",link:e=>(0,_.jsx)(o.Link,{to:`/edit-segment/${e.id}`,children:x.x.I18n.t("edit")}),display:e=>!e.is_plugin_missing},{name:"edit_disabled",className:"mailpoet-hide-on-mobile mailpoet-disabled",link:e=>(0,_.jsx)(o.Link,{to:`/edit-segment/${e.id}`,children:x.x.I18n.t("edit")}),display:e=>e.is_plugin_missing},{name:"view_subscribers",link:e=>(0,_.jsx)("a",{href:e.subscribers_url,children:x.x.I18n.t("viewSubscribers")})},{name:"trash",className:"mailpoet-hide-on-mobile"}],ro=[{name:"trash",label:x.x.I18n.t("moveToTrash"),onSuccess:to.onTrash}];function ao(e,t){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("td",{className:"column-primary","data-colname":x.x.I18n.t("nameColumn"),children:[(0,_.jsx)("span",{className:"mailpoet-listing-title",children:e.name}),t]}),(0,_.jsx)("td",{"data-colname":x.x.I18n.t("description"),children:(0,_.jsx)("abbr",{children:e.description})}),e.is_plugin_missing?(0,_.jsx)("td",{colSpan:"2",className:"column mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("missingPluginMessageColumn"),children:e.missing_plugin_message&&e.missing_plugin_message.message&&e.missing_plugin_message.link?I()(e.missing_plugin_message.message,/\[link](.*?)\[\/link]/g,(t=>(0,_.jsx)("a",{className:"mailpoet-listing-link-important",href:e.missing_plugin_message.link,target:"_blank",rel:"noopener noreferrer",children:t},"missingPluginMessageLink"))):e.missing_plugin_message}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("subscribersCountColumn"),children:parseInt(e.count_all,10).toLocaleString()}),(0,_.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("subscribed"),children:parseInt(e.count_subscribed,10).toLocaleString()})]}),(0,_.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("updatedAtColumn"),children:[x.x.Date.short(e.created_at),(0,_.jsx)("br",{}),x.x.Date.time(e.created_at)]})]})}function so(e){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(g.N,{limit:window.mailpoet_listing_per_page,location:e.location,params:e.match.params,search:!0,onRenderItem:ao,endpoint:"dynamic_segments",base_url:"segments",columns:eo,messages:to,sort_by:"created_at",sort_order:"desc",item_actions:no,bulk_actions:ro}),(0,_.jsxs)("p",{className:"mailpoet_sending_methods_help help",children:[(0,_.jsxs)("b",{children:[x.x.I18n.t("segmentsTip"),":"]})," ",x.x.I18n.t("segmentsTipText")," ",(0,_.jsx)("a",{href:"https://kb.mailpoet.com/article/237-guide-to-subscriber-segmentation?utm_source=plugin&utm_medium=segments&utm_campaign=helpdocs","data-beacon-article":"5a574bd92c7d3a194368233e",target:"_blank",rel:"noopener noreferrer",children:x.x.I18n.t("segmentsTipLink")})]})]})}so.propTypes={location:h().object.isRequired,match:h().shape({params:h().object}).isRequired};const io=(0,l.EN)(so);function oo(){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(L.Q,{children:[(0,_.jsxs)(o.Link,{className:"mailpoet-button button-secondary",to:"/new",children:[F.R,(0,_.jsx)("span",{children:x.x.I18n.t("new")})]}),(0,_.jsxs)(o.Link,{className:"mailpoet-button button-secondary",to:"/new-segment","data-automation-id":"new-segment",children:[F.R,(0,_.jsx)("span",{children:x.x.I18n.t("newSegment")})]})]}),(0,_.jsx)(R,{subscribersInPlan:x.x.subscribersCount,subscribersInPlanLimit:x.x.subscribersLimit}),(0,_.jsx)(A,{cacheCalculation:window.mailpoet_subscribers_counts_cache_created_at}),(0,_.jsx)(T,{}),(0,_.jsx)(D,{}),(0,_.jsx)(k,{mssKeyInvalid:x.x.hasInvalidMssApiKey,subscribersCount:x.x.subscribersCount})]})}const lo=document.getElementById("segments_container");function co(){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(oo,{}),(0,_.jsxs)(Ca.t,{activeKey:"lists",routerType:"switch-only",children:[(0,_.jsx)(xa.O,{route:"lists/(.*)?",title:x.x.I18n.t("pageTitle"),children:(0,_.jsx)(Xa,{})},"lists"),(0,_.jsx)(xa.O,{route:"segments/(.*)?",title:x.x.I18n.t("pageTitleSegments"),automationId:"dynamic-segments-tab",children:(0,_.jsx)(io,{})},"segments")]})]})}function uo(){return(0,_.jsx)(Te.k.Provider,{value:(0,Te.S)(window),children:(0,_.jsxs)(o.HashRouter,{children:[(0,_.jsx)(Le.w,{}),(0,_.jsxs)(l.rs,{children:[(0,_.jsx)(l.AW,{exact:!0,path:"/",render:()=>(0,_.jsx)(l.l_,{to:"/lists"})}),(0,_.jsx)(l.AW,{path:"/new",component:ts}),(0,_.jsx)(l.AW,{path:"/edit/:id",component:ts}),(0,_.jsx)(l.AW,{path:"/new-segment",component:Ji}),(0,_.jsx)(l.AW,{path:"/edit-segment/:id",component:Ji}),(0,_.jsx)(l.AW,{path:"/segments/(.*)?",component:co}),(0,_.jsx)(l.AW,{path:"/lists/(.*)?",component:co})]})]})})}lo&&i.render((0,_.jsx)(uo,{}),lo);const po=()=>{x.x.trackEvent("Forms > Add New"),setTimeout((()=>{window.location=window.mailpoet_form_template_selection_url}),200)};function mo(){const[e,t]=(0,y.useState)(!1);return(0,_.jsx)(L.Q,{children:(0,_.jsx)(E.z,{onClick:()=>{t(!0),po()},withSpinner:e,automationId:"create_new_form",variant:"secondary",iconStart:F.R,children:x.x.I18n.t("new")})})}const ho=[{name:"name",label:x.x.I18n.t("formName"),sortable:!0},{name:"segments",label:x.x.I18n.t("segments")},{name:"type",label:x.x.I18n.t("type")},{name:"status",label:x.x.I18n.t("status")},{name:"updated_at",label:x.x.I18n.t("updatedAt"),sortable:!0}],fo={onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneFormTrashed"):x.x.I18n.t("multipleFormsTrashed").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneFormDeleted"):x.x.I18n.t("multipleFormsDeleted").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneFormRestored"):x.x.I18n.t("multipleFormsRestored").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onNoItemsFound:()=>(0,_.jsxs)("div",{className:"mailpoet-forms-add-new-row",children:[(0,_.jsx)("p",{children:x.x.I18n.t("noItemsFound")}),(0,_.jsx)(f.Button,{onClick:po,automationId:"add_new_form",iconStart:F.R,children:x.x.I18n.t("new")})]})},go=[{name:"trash",label:x.x.I18n.t("moveToTrash"),onSuccess:fo.onTrash}],xo=[{name:"edit",className:"mailpoet-hide-on-mobile",label:x.x.I18n.t("edit"),link:function(e){return(0,_.jsx)("a",{href:`admin.php?page=mailpoet-form-editor&id=${e.id}`,children:x.x.I18n.t("edit")})}},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:x.x.I18n.t("duplicate"),onClick:function(e,t){return x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"forms",action:"duplicate",data:{id:e.id}}).done((e=>{const n=e.data.name?e.data.name:x.x.I18n.t("noName");x.x.Notice.success(x.x.I18n.t("formDuplicated").replace("%1$s",n)),t()})).fail((e=>{e.errors.length>0&&x.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}},{name:"trash",className:"mailpoet-hide-on-mobile"}];class vo extends y.Component{constructor(){super(...arguments),(0,b.Z)(this,"updateStatus",((e,t)=>{t.persist(),x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"forms",action:"setStatus",data:{id:Number(t.target.getAttribute("data-id")),status:e?"enabled":"disabled"}}).done((e=>{"enabled"===e.data.status&&x.x.Notice.success(x.x.I18n.t("formActivated"))})).fail((n=>{x.x.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,b.Z)(this,"isItemInactive",(e=>"disabled"===e.status)),(0,b.Z)(this,"renderItem",((e,t)=>{const n=d()("manage-column","column-primary","has-row-actions"),r=window.mailpoet_segments.filter((t=>-1!==p().inArray(t.id,e.segments))),a=function(e){var t,n,r,a,s,i,o,l;const c=[];return"1"===(null==e||null===(t=e.form_placement)||void 0===t||null===(n=t.fixed_bar)||void 0===n?void 0:n.enabled)&&c.push(x.x.I18n.t("placeFixedBarFormOnPages")),"1"===(null==e||null===(r=e.form_placement)||void 0===r||null===(a=r.below_posts)||void 0===a?void 0:a.enabled)&&c.push(x.x.I18n.t("placeFormBellowPages")),"1"===(null==e||null===(s=e.form_placement)||void 0===s||null===(i=s.popup)||void 0===i?void 0:i.enabled)&&c.push(x.x.I18n.t("placePopupFormOnPages")),"1"===(null==e||null===(o=e.form_placement)||void 0===o||null===(l=o.slide_in)||void 0===l?void 0:l.enabled)&&c.push(x.x.I18n.t("placeSlideInFormOnPages")),c.length>0?c.join(", "):x.x.I18n.t("placeFormOthers")}(e.settings);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("td",{className:n,children:[(0,_.jsx)("a",{className:"mailpoet-listing-title",href:`admin.php?page=mailpoet-form-editor&id=${e.id}`,children:e.name?e.name:`(${x.x.I18n.t("noName")})`}),t]}),(0,_.jsx)("td",{className:"column","data-colname":x.x.I18n.t("segments"),children:(0,_.jsx)(gr.$,{segments:r,dimension:"large",children:"user"===e.settings.segments_selected_by&&(0,_.jsx)("span",{className:"mailpoet-tags-prefix",children:x.x.I18n.t("userChoice")})})}),(0,_.jsx)("td",{className:"column","data-colname":x.x.I18n.t("type"),children:a}),(0,_.jsx)("td",{className:"column","data-colname":x.x.I18n.t("status"),children:this.renderStatus(e)}),(0,_.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("updatedAt"),children:[x.x.Date.short(e.updated_at),(0,_.jsx)("br",{}),x.x.Date.time(e.updated_at)]})]})}))}renderStatus(e){return(0,_.jsxs)("div",{children:[(0,_.jsx)(Zt.Z,{onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"enabled"===e.status}),(0,_.jsxs)("p",{children:[x.x.I18n.t("signups"),": ",e.signups.toLocaleString()]})]})}render(){return(0,_.jsxs)("div",{className:"mailpoet-listing-no-actions-on-mobile",children:[(0,_.jsx)(mo,{}),(0,_.jsx)(g.N,{limit:window.mailpoet_listing_per_page,className:"mailpoet-forms-listing",location:this.props.location,params:this.props.match.params,messages:fo,search:!1,endpoint:"forms",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:ho,bulk_actions:go,item_actions:xo})]})}}vo.propTypes={location:h().object.isRequired,match:h().shape({params:h().object}).isRequired};const bo=Aa(vo);function yo(){return(0,_.jsx)(Te.k.Provider,{value:(0,Te.S)(window),children:(0,_.jsxs)(o.HashRouter,{children:[(0,_.jsx)(Le.w,{}),(0,_.jsx)(l.AW,{path:"*",component:bo})]})})}const wo=document.getElementById("forms_container");function _o(){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("p",{children:x.x.I18n.t("knowledgeBaseIntro")}),(0,_.jsxs)("ul",{className:"mailpoet-text-links",children:[(0,_.jsx)("li",{children:(0,_.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/116-common-problems",children:"Common Problems"})}),(0,_.jsx)("li",{children:(0,_.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/165-newsletters",children:"Newsletters"})}),(0,_.jsx)("li",{children:(0,_.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/156-migration-questions",children:"Migration Questions"})}),(0,_.jsx)("li",{children:(0,_.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/149-sending-methods",children:"Sending Methods"})}),(0,_.jsx)("li",{children:(0,_.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/139-subscription-forms",children:"Subscription Forms"})}),(0,_.jsx)("li",{children:(0,_.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/114-getting-started",children:"Getting Started"})}),(0,_.jsx)("li",{children:(0,_.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/123-newsletter-designer",children:"Newsletter Designer"})}),(0,_.jsx)("li",{children:(0,_.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/121-subscribers-and-lists",children:"Subscribers and Lists"})})]}),(0,_.jsx)(E.z,{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/",children:x.x.I18n.t("knowledgeBaseButton")})]})}function jo(e){e.target.select()}function So(e){if(w.ZP.isObject(e)){const t=Object.keys(e).map((t=>`${t}: ${e[t]}`));return(0,_.jsx)("textarea",{readOnly:!0,onFocus:jo,value:t.join("\n"),style:{width:"100%",height:"400px"}})}return(0,_.jsx)("p",{children:x.x.I18n.t("systemInfoDataError")})}function Io(){const e=window.systemInfoData;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("div",{className:"mailpoet_notice notice inline",children:(0,_.jsx)("p",{children:x.x.I18n.t("systemInfoIntro")})}),So(e)]})}function Co(e){return(0,_.jsx)("table",{className:"widefat fixed",style:{maxWidth:e.max_width},children:(0,_.jsx)("tbody",{children:e.rows.map((e=>(0,_.jsxs)("tr",{children:[(0,_.jsx)("td",{className:"row-title",children:e.key}),(0,_.jsx)("td",{children:e.value})]},`row_${e.key}`)))})})}function To(e){return(0,_.jsx)("span",{children:!0===e.children&&e.truthy||!1===e.children&&e.falsy||e.unknown})}function ko(e){const t=e.status_data,n={active:x.x.I18n.t("running"),inactive:x.x.I18n.t("cronWaiting")},r=Array.isArray(t.last_error)?(0,_.jsx)(_.Fragment,{children:t.last_error.map((e=>(0,_.jsxs)("div",{children:[e.worker,": ",(0,_.jsx)("i",{children:e.message})]},e.worker)))}):t.last_error;return(0,_.jsxs)("div",{children:[(0,_.jsx)("h4",{children:x.x.I18n.t("systemStatusCronStatusTitle")}),(0,_.jsx)(Co,{max_width:"400px",rows:[{key:x.x.I18n.t("accessible"),value:(0,_.jsx)(To,{children:t.accessible})},{key:x.x.I18n.t("status"),value:n[t.status]?n[t.status]:x.x.I18n.t("unknown")},{key:x.x.I18n.t("lastUpdated"),value:t.updated_at?x.x.Date.full(1e3*t.updated_at):x.x.I18n.t("unknown")},{key:x.x.I18n.t("lastRunStarted"),value:t.run_accessed_at?x.x.Date.full(1e3*t.run_started_at):x.x.I18n.t("unknown")},{key:x.x.I18n.t("lastRunCompleted"),value:t.run_completed_at?x.x.Date.full(1e3*t.run_completed_at):x.x.I18n.t("unknown")},{key:x.x.I18n.t("lastSeenError"),value:r||x.x.I18n.t("none")},{key:x.x.I18n.t("lastSeenErrorDate"),value:t.last_error_date?x.x.Date.full(1e3*t.last_error_date):x.x.I18n.t("unknown")}]})]})}function No(e){let t=e.task.scheduled_at;t&&(t=(0,xr.default)(t,"yyyy-MM-dd HH:mm:ss",new Date));const n=(0,xr.default)(e.task.updated_at,"yyyy-MM-dd HH:mm:ss",new Date);return(0,_.jsxs)("tr",{children:[(0,_.jsx)("td",{className:"column column-primary",children:e.task.id}),(0,_.jsx)("td",{className:"column",children:e.task.type}),(0,_.jsx)("td",{className:"column",children:e.task.newsletter?(0,_.jsx)("a",{href:e.task.newsletter.preview_url,"data-newsletter-id":e.task.newsletter.newsletter_id,"data-queue-id":e.task.newsletter.queue_id,target:"_blank",rel:"noopener noreferrer",children:e.task.newsletter.subject||x.x.I18n.t("preview")}):x.x.I18n.t("none")}),(0,_.jsx)("td",{className:"column",children:e.task.priority}),e.show_scheduled_at?(0,_.jsx)("td",{className:"column-date",children:(0,_.jsx)("abbr",{children:`${x.x.Date.short(t)} ${x.x.Date.time(t)}`})}):null,(0,_.jsx)("td",{className:"column-date",children:(0,_.jsx)("abbr",{children:`${x.x.Date.short(n)} ${x.x.Date.time(n)}`})})]})}function Do(e){return(0,_.jsxs)("tr",{children:[(0,_.jsx)("th",{className:"row-title",children:"Id"}),(0,_.jsx)("th",{className:"row-title",children:x.x.I18n.t("type")}),(0,_.jsx)("th",{className:"row-title",children:x.x.I18n.t("email")}),(0,_.jsx)("th",{className:"row-title",children:x.x.I18n.t("priority")}),e.show_scheduled_at?(0,_.jsx)("th",{className:"row-title",children:x.x.I18n.t("scheduledAt")}):null,(0,_.jsx)("th",{className:"row-title",children:x.x.I18n.t("updatedAt")})]})}function Eo(e){const t=e.show_scheduled_at?6:5;return(0,_.jsxs)("table",{className:"widefat fixed striped",children:[(0,_.jsx)("thead",{children:(0,_.jsx)(Do,{show_scheduled_at:e.show_scheduled_at})}),(0,_.jsx)("tbody",{children:e.tasks.length?e.tasks.map((t=>(0,_.jsx)(No,{task:t,show_scheduled_at:e.show_scheduled_at},t.id))):(0,_.jsx)("tr",{className:"mailpoet-listing-no-items",children:(0,_.jsx)("td",{colSpan:t,children:x.x.I18n.t("nothingToShow")})})}),(0,_.jsx)("tfoot",{children:(0,_.jsx)(Do,{show_scheduled_at:e.show_scheduled_at})})]})}function Ao(e){const t=e.status_data;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("h4",{children:x.x.I18n.t("systemStatusQueueTitle")}),(0,_.jsx)(Co,{max_width:"400px",rows:[{key:x.x.I18n.t("status"),value:"paused"===t.status?x.x.I18n.t("paused"):x.x.I18n.t("running")},{key:x.x.I18n.t("startedAt"),value:t.started?x.x.Date.full(1e3*t.started):x.x.I18n.t("unknown")},{key:x.x.I18n.t("sentEmails"),value:t.sent||0},{key:x.x.I18n.t("retryAttempt"),value:t.retry_attempt||x.x.I18n.t("none")},{key:x.x.I18n.t("retryAt"),value:t.retry_at?x.x.Date.full(1e3*t.retry_at):x.x.I18n.t("none")},{key:x.x.I18n.t("error"),value:t.error?t.error.error_message:x.x.I18n.t("none")},{key:x.x.I18n.t("totalCompletedTasks"),value:t.tasksStatusCounts.completed},{key:x.x.I18n.t("totalRunningTasks"),value:t.tasksStatusCounts.running},{key:x.x.I18n.t("totalPausedTasks"),value:t.tasksStatusCounts.paused},{key:x.x.I18n.t("totalScheduledTasks"),value:t.tasksStatusCounts.scheduled}]}),(0,_.jsx)("h5",{children:x.x.I18n.t("scheduledTasks")}),(0,_.jsx)(Eo,{show_scheduled_at:!0,tasks:t.latestTasks.filter((e=>"scheduled"===e.status))}),(0,_.jsx)("h5",{children:x.x.I18n.t("runningTasks")}),(0,_.jsx)(Eo,{tasks:t.latestTasks.filter((e=>null===e.status))}),(0,_.jsx)("h5",{children:x.x.I18n.t("completedTasks")}),(0,_.jsx)(Eo,{tasks:t.latestTasks.filter((e=>"completed"===e.status))})]})}function Oo(e){let{version:t,storage:n,latestTrigger:r,latestCompletedTrigger:a,latestCompletedRun:s}=e;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("h4",{children:x.x.I18n.t("actionSchedulerStatus")}),(0,_.jsx)(Co,{max_width:"400px",rows:[{key:x.x.I18n.t("version"),value:t},{key:x.x.I18n.t("storage"),value:n},{key:x.x.I18n.t("latestActionSchedulerTrigger"),value:x.x.Date.full(K().utc(r).local())},{key:x.x.I18n.t("latestActionSchedulerCompletedTrigger"),value:x.x.Date.full(K().utc(a).local())},{key:x.x.I18n.t("latestActionSchedulerCompletedRun"),value:x.x.Date.full(K().utc(s).local())}]})]})}function Ro(e,t,n,r,a,s){const i=e?"success":"error";let o=e?t:n;return r&&(o=I()(o,/\[link\](.*?)\[\/link\]/g,(e=>(0,_.jsx)("a",{className:"mailpoet-text-link",href:r,"data-beacon-article":a,children:e},"kb-link")))),(0,_.jsxs)("div",{className:`mailpoet_notice notice inline notice-${i}`,children:[(0,_.jsx)("p",{children:o}),s?(0,_.jsx)("p",{children:(0,_.jsx)("i",{children:s})}):null]})}function Po(e){const t=e.cron.isReachable,n=e.cron.url,r=`${x.x.I18n.t("systemStatusConnectionUnsuccessful")} ${x.x.I18n.t("systemStatusCronConnectionUnsuccessfulInfo")}`,a=x.x.I18n.t("systemStatusConnectionSuccessful"),s=t?null:e.cron.pingResponse;return(0,_.jsxs)("div",{children:[(0,_.jsx)("h4",{children:x.x.I18n.t("systemStatusCronTitle")}),(0,_.jsx)("p",{children:(0,_.jsx)("a",{className:"mailpoet-text-link",href:n,target:"_blank",rel:"noopener noreferrer",children:n})}),Ro(t,a,r,"https://kb.mailpoet.com/article/231-sending-does-not-work","5a0257ac2c7d3a272c0d7ad6",s)]})}function Mo(e){const t=e.mss.enabled?`${x.x.I18n.t("systemStatusConnectionUnsuccessful")} ${x.x.I18n.t("systemStatusMSSConnectionUnsuccessfulInfo")}`:x.x.I18n.t("systemStatusMSSConnectionCanNotConnect"),n=e.mss.enabled?x.x.I18n.t("systemStatusConnectionSuccessful"):x.x.I18n.t("systemStatusMSSConnectionCanConnect");return(0,_.jsxs)("div",{children:[(0,_.jsx)("h4",{children:x.x.I18n.t("systemStatusMSSTitle")}),Ro(e.mss.isReachable,n,t,"https://kb.mailpoet.com/article/319-known-errors-when-validating-a-mailpoet-key","5ef1da9d2c7d3a10cba966c5",null)]})}function Lo(){const e=window.systemStatusData,t=window.actionSchedulerData;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("div",{className:"mailpoet_notice notice inline",children:(0,_.jsx)("p",{children:e.mss.enabled?x.x.I18n.t("systemStatusIntroCronMSS"):x.x.I18n.t("systemStatusIntroCron")})}),Po(e),Mo(e),(0,_.jsx)(ko,{status_data:e.cronStatus}),(0,_.jsx)(Oo,{...t}),t?(0,_.jsx)(Ao,{status_data:e.queueStatus}):null]})}function Fo(){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("p",{children:x.x.I18n.t("yourPrivacyContent1")}),(0,_.jsx)("p",{children:x.x.I18n.t("yourPrivacyContent2")}),(0,_.jsx)("p",{children:x.x.I18n.t("yourPrivacyContent3")}),(0,_.jsx)(E.z,{target:"_blank",rel:"noreferrer noopener",href:"https://www.mailpoet.com/privacy-notice/",children:x.x.I18n.t("yourPrivacyButton")})]})}function qo(){return(0,_.jsxs)(Te.k.Provider,{value:(0,Te.S)(window),children:[(0,_.jsx)(L.D,{}),(0,_.jsx)(Le.w,{}),(0,_.jsxs)(Ca.t,{activeKey:"knowledgeBase",children:[(0,_.jsx)(f.Tab,{title:x.x.I18n.t("tabKnowledgeBaseTitle"),children:(0,_.jsx)(_o,{})},"knowledgeBase"),(0,_.jsx)(f.Tab,{title:x.x.I18n.t("tabSystemStatusTitle"),children:(0,_.jsx)(Lo,{})},"systemStatus"),(0,_.jsx)(f.Tab,{title:x.x.I18n.t("tabSystemInfoTitle"),children:(0,_.jsx)(Io,{})},"systemInfo"),(0,_.jsx)(f.Tab,{title:x.x.I18n.t("tabYourPrivacyTitle"),children:(0,_.jsx)(Fo,{})},"yourPrivacy")]})]})}wo&&i.render((0,_.jsx)(yo,{}),wo),Co.propTypes={max_width:h().string,rows:h().arrayOf(h().shape({key:h().string.isRequired,value:h().oneOfType([h().string,h().number,h().element]).isRequired})).isRequired},Co.defaultProps={max_width:"auto"},To.propTypes={truthy:h().string,falsy:h().string,unknown:h().string,children:h().bool},To.defaultProps={truthy:x.x.I18n.t("yes"),falsy:x.x.I18n.t("no"),unknown:x.x.I18n.t("unknown"),children:null},ko.propTypes={status_data:h().shape({accessible:h().bool,last_error_date:h().string,status:h().string,updated_at:h().number,run_accessed_at:h().number,run_completed_at:h().number,run_started_at:h().number,last_error:h().oneOfType([h().string,h().array])}).isRequired},No.propTypes={show_scheduled_at:h().bool,task:h().shape({id:h().number.isRequired,type:h().string.isRequired,priority:h().number.isRequired,updated_at:h().string.isRequired,scheduled_at:h().string,status:h().string,newsletter:h().shape({newsletter_id:h().number.isRequired,queue_id:h().number.isRequired,preview_url:h().string.isRequired,subject:h().string})}).isRequired},No.defaultProps={show_scheduled_at:!1},Do.propTypes={show_scheduled_at:h().bool},Do.defaultProps={show_scheduled_at:!1},Eo.propTypes={show_scheduled_at:h().bool,tasks:h().arrayOf(No.propTypes.task).isRequired},Eo.defaultProps={show_scheduled_at:!1},Ao.propTypes={status_data:h().shape({status:h().string,started:h().number,sent:h().number,retry_attempt:h().number,retry_at:h().number,error:h().shape({operation:h().string,error_message:h().string}),tasksStatusCounts:h().shape({completed:h().number.isRequired,running:h().number.isRequired,paused:h().number.isRequired,scheduled:h().number.isRequired}).isRequired,latestTasks:h().arrayOf(No.propTypes.task).isRequired}).isRequired};const $o=document.getElementById("help_container");$o&&i.render((0,_.jsx)(qo,{}),$o);const Uo=(0,l.EN)((function(e){let{children:t,location:{pathname:n}}=e;return(0,y.useEffect)((()=>{window.scrollTo(0,0)}),[n]),t||null}));function Zo(e){let{activeMethod:t,onMethodChange:n}=e;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("div",{className:"mailpoet-settings-label",children:[(0,_.jsx)("span",{className:"mailpoet_import_heading",children:x.x.I18n.t("methodSelectionHead")}),(0,_.jsx)("div",{className:"mailpoet-settings-inputs-row",children:(0,_.jsx)("a",{href:"https://kb.mailpoet.com/article/242-video-guide-importing-subscribers-using-a-csv-file","data-beacon-article":"5a8e8f0204286305fbc9be9a",target:"_blank",rel:"noopener noreferrer",children:(0,_.jsx)(Ne.V,{dimension:"large",variant:"excellent",isInverted:!0,children:x.x.I18n.t("seeVideo")})})})]}),(0,_.jsxs)("div",{className:"mailpoet-settings-inputs",children:[(0,_.jsxs)("div",{className:"mailpoet-settings-inputs-row",children:[(0,_.jsx)(ie.Y,{name:"select_method",automationId:"import-paste-method",id:"import-paste-method",checked:"paste-method"===t,value:"paste-method",onCheck:n}),(0,_.jsx)("label",{htmlFor:"import-paste-method",children:x.x.I18n.t("methodPaste")})]}),(0,_.jsxs)("div",{className:"mailpoet-settings-inputs-row",children:[(0,_.jsx)(ie.Y,{name:"select_method",automationId:"import-csv-method",id:"import-csv-method",checked:"file-method"===t,value:"file-method",onCheck:n}),(0,_.jsx)("label",{htmlFor:"import-csv-method",children:x.x.I18n.t("methodUpload")})]}),(0,_.jsxs)("div",{className:"mailpoet-settings-inputs-row",children:[(0,_.jsx)(ie.Y,{name:"select_method",automationId:"import-mailchimp-method",id:"import-mailchimp-method",checked:"mailchimp-method"===t,value:"mailchimp-method",onCheck:n}),(0,_.jsx)("label",{htmlFor:"import-mailchimp-method",children:x.x.I18n.t("methodMailChimp")})]})]})]})}function Vo(e){let{hidePrevious:t,isLastStep:n,canGoNext:r,onPreviousAction:a,onNextAction:s}=e;return(0,_.jsxs)("div",{className:"mailpoet-settings-save",children:[!t&&(0,_.jsx)(E.z,{type:"button",variant:"secondary",onClick:a,children:x.x.I18n.t("previousStep")}),(0,_.jsx)(E.z,{type:"button",automationId:"import-next-step",isDisabled:!r,onClick:()=>{r&&s()},children:x.x.I18n.t(n?"import":"nextStep")})]})}function Wo(e){let{onValueChange:t,canFinish:n,onFinish:r,data:a,onPrevious:s}=e;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("div",{className:"mailpoet-settings-label",children:[(0,_.jsx)("label",{htmlFor:"paste_input",children:x.x.I18n.t("pasteLabel")}),(0,_.jsx)("p",{className:"description",children:I()(x.x.I18n.t("pasteDescription"),/\[link\](.*?)\[\/link\]/,(e=>(0,_.jsx)("a",{className:"mailpoet-link",href:"https://kb.mailpoet.com/article/126-importing-subscribers-with-csv-files","data-beacon-article":"57ce079f903360649f6e56fc",target:"_blank",rel:"noopener noreferrer",children:e},"kb-link")))})]}),(0,_.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,_.jsx)(ne.g,{id:"paste_input",rows:"15",placeholder:"Email, First Name, Last Name\njohn@doe.com, John, Doe\nmary@smith.com, Mary, Smith\njohnny@walker.com, Johnny, Walker",isCode:!0,onChange:e=>{t(e.target.value)},defaultValue:a})}),(0,_.jsx)(Vo,{canGoNext:n,onPreviousAction:s,onNextAction:r})]})}function Yo(e){let{onValueChange:t,canFinish:n,onFinish:r,onPrevious:a}=e;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("div",{className:"mailpoet-settings-label",children:[(0,_.jsx)("label",{htmlFor:"file_local",children:x.x.I18n.t("methodUpload")}),(0,_.jsx)("p",{className:"description",children:I()(x.x.I18n.t("pasteDescription"),/\[link\](.*?)\[\/link\]/,(e=>(0,_.jsx)("a",{className:"mailpoet-link",href:"https://kb.mailpoet.com/article/126-importing-subscribers-with-csv-files","data-beacon-article":"57ce079f903360649f6e56fc",target:"_blank",rel:"noopener noreferrer",children:e},"kb-link")))})]}),(0,_.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,_.jsx)(ee.I,{type:"file",id:"file_local",accept:".csv","data-automation-id":"import-file-upload-input",onChange:e=>{const n=e.target.value.match(/[^.]+$/);x.x.Notice.hide(),null===n||"csv"!==n[0].toLowerCase()?(x.x.Notice.error(x.x.I18n.t("wrongFileFormat")),t("")):t(e.target.files[0])}})}),(0,_.jsx)(Vo,{canGoNext:n,onPreviousAction:a,onNextAction:r})]})}function Bo(e){let{onFinish:t,onPrevious:n}=e;const[r,a]=(0,y.useState)(""),[s,i]=(0,y.useState)(void 0),[o,l]=(0,y.useState)([]);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("div",{className:"mailpoet-settings-label",children:(0,_.jsxs)("label",{htmlFor:"mailpoet_mailchimp_key_input",children:[(0,_.jsx)("span",{className:"mailpoet_import_heading",children:x.x.I18n.t("methodMailChimpLabel")}),(0,_.jsx)("p",{className:"description",children:I()(x.x.I18n.t("methodMailChimpDescription"),/\[link\](.*?)\[\/link\]/,(e=>(0,_.jsx)("a",{className:"mailpoet-link",href:"https://kb.mailpoet.com/article/255-migrating-from-mailchimp-to-mailpoet#api","data-beacon-article":"5b16db842c7d3a0fa9a2aa15",target:"_blank",rel:"noopener noreferrer",children:e},"kb-link")))})]})}),(0,_.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,_.jsxs)("div",{className:"mailpoet-settings-inputs-row mailpoet-settings-inputs-row-centered",children:[(0,_.jsx)(ee.I,{dimension:"small",id:"mailpoet_mailchimp_key_input",type:"text",onChange:e=>{a(e.target.value),""===e.target.value.trim()&&i(void 0)}}),(0,_.jsx)("span",{className:"mailpoet-gap"}),(0,_.jsx)(E.z,{type:"button",dimension:"small",onClick:()=>{x.x.Modal.loading(!0),x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"importExport",action:"getMailChimpLists",data:{api_key:r}}).always((()=>{x.x.Modal.loading(!1)})).done((e=>i(e.data))).fail((e=>{e.errors.length>0&&x.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},children:x.x.I18n.t("methodMailChimpVerify")}),(0,_.jsx)("span",{className:"mailpoet-gap"}),(0,_.jsx)("span",{children:Array.isArray(s)&&0===s.length?x.x.I18n.t("noMailChimpLists"):null})]})}),s?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("div",{className:"mailpoet-settings-label",children:x.x.I18n.t("methodMailChimpSelectList")}),(0,_.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,_.jsx)(j,{field:{id:"segments",name:"list-selection",multiple:!0,placeholder:x.x.I18n.t("methodMailChimpSelectPlaceholder"),forceSelect2:!0,values:s},onValueChange:e=>l(e.target.value)})})]}):null,(0,_.jsx)(Vo,{canGoNext:Array.isArray(o)&&o.length>0,onPreviousAction:n,onNextAction:()=>{x.x.Modal.loading(!0),x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"importExport",action:"getMailChimpSubscribers",data:{api_key:r,lists:o}}).always((()=>{x.x.Modal.loading(!1)})).done((e=>t(e.data))).fail((e=>{e.errors.length>0&&x.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}})]})}Zo.propTypes={activeMethod:h().string,onMethodChange:h().func.isRequired},Zo.defaultProps={activeMethod:void 0},Vo.propTypes={canGoNext:h().bool,hidePrevious:h().bool,isLastStep:h().bool,onPreviousAction:h().func,onNextAction:h().func},Vo.defaultProps={hidePrevious:!1,isLastStep:!1,canGoNext:!0,onPreviousAction:()=>{},onNextAction:()=>{}},Wo.propTypes={onFinish:h().func,onPrevious:h().func,canFinish:h().bool.isRequired,onValueChange:h().func.isRequired,data:h().string},Wo.defaultProps={onFinish:()=>{},onPrevious:()=>{},data:""},Yo.propTypes={canFinish:h().bool.isRequired,onFinish:h().func,onPrevious:h().func,onValueChange:h().func.isRequired},Yo.defaultProps={onFinish:()=>{},onPrevious:()=>{}},Bo.propTypes={onFinish:h().func,onPrevious:h().func},Bo.defaultProps={onFinish:()=>{},onPrevious:()=>{}};var Ho=n(71906),zo=n.n(Ho);const Go=e=>window.roleBasedEmails.findIndex((t=>e.startsWith(`${t}@`)))>=0,Ko=e=>{let t,n=w.ZP.unescape(e);return n=n.toLowerCase().replace(/^["';.,\s]+|[^\x20-\x7E]+$|["';.,_\s]+$/g,"").replace(/\s+|%\d+|,+/g,""),t=/<(.*?)>/.exec(n),t&&(n=t[1].trim()),t=/mailto:(?:\s+)?(.*)/.exec(n),t&&(n=t[1].trim()),!!window.mailpoet_email_regex.test(n)&&!Go(n)&&n};function Qo(e){let{history:t,setStepMethodSelectionData:n,subscribersLimitForValidation:r}=e;const[a,s]=(0,y.useState)(void 0),[i,o]=(0,y.useState)(""),[l,c]=(0,y.useState)(void 0),d=e=>{n(e),t.push(((e,t,n)=>void 0===e||void 0===e.subscribersCount||e.subscribersCount<t||"mailchimp-method"===n?"step_data_manipulation":"step_input_validation")(e,r,a))},u=()=>{t.push("/step_clean_list")},p=()=>{((e,t)=>{const n=encodeURI(e).split(/%..|./).length-1;x.x.Notice.hide(),n>window.maxPostSizeBytes?x.x.Notice.error(x.x.I18n.t("maxPostSizeNotice")):(x.x.Modal.loading(!0),zo().parse(e,function(e){return{skipEmptyLines:!0,error(){x.x.Notice.hide(),x.x.Notice.error(x.x.I18n.t("dataProcessingError"))},complete(t){const n=function(e){let t=[];const n=[],r=[],a=[],s=[];let i,o,l,c,d=null,u=null,p=!1;return Object.keys(e).forEach((m=>{l=e[m].map((e=>e.trim())),c=l.length,null===u&&(u=c),c===u&&(null===d?(Object.keys(l).forEach((e=>{o=Ko(l[e]),null===d&&window.mailpoet_email_regex.test(o)&&(d=e,n[o]=!0,l[e]=o,t[o]=l)})),null===d&&0===parseInt(m,10)&&(p=!0,t[0]=l)):""!==l[d]&&(i=Ko(l[d]),w.ZP.has(n,i)?r.push(i):Go(l[d])?s.push(l[d]):window.mailpoet_email_regex.test(i)?(n[i]=!0,l[d]=i,t[i]=l):a.push(l[d])))})),t=w.ZP.values(t),t&&(p&&t.length>=2||!p&&t.length>=1)?{header:window.mailpoet_email_regex.test(t[0][d])?null:t.shift(),subscribers:t,subscribersCount:t.length,duplicate:w.ZP.uniq(r),invalid:w.ZP.uniq(a),role:w.ZP.uniq(s)}:null}(t.data);if(n)e(n);else{let e=x.x.I18n.t("noValidRecords");e=e.replace("[link]",'<a href="https://kb.mailpoet.com/article/126-importing-subscribers-with-csv-files" data-beacon-article="57ce079f903360649f6e56fc">'),e=e.replace("[/link]","</a>"),x.x.Notice.error(e)}x.x.Modal.loading(!1)}}}((e=>{x.x.trackEvent("Subscribers import started",{source:"file-method"===a?"file upload":"pasted data"}),d(e)}))))})("paste-method"===a?i:l)};return(0,_.jsxs)("div",{className:"mailpoet-settings-grid",children:[(0,_.jsx)(Zo,{activeMethod:a,onMethodChange:s}),"paste-method"===a&&(0,_.jsx)(Wo,{onPrevious:u,onValueChange:o,onFinish:p,canFinish:!!i.trim(),data:i}),"file-method"===a&&(0,_.jsx)(Yo,{onPrevious:u,onValueChange:c,onFinish:p,canFinish:!!l,data:l}),"mailchimp-method"===a&&(0,_.jsx)(Bo,{onPrevious:u,onFinish:e=>{x.x.trackEvent("Subscribers import started",{source:"MailChimp"}),d(e)}}),void 0===a&&(0,_.jsx)(Vo,{canGoNext:!1,onPreviousAction:u})]})}Qo.propTypes={history:h().shape({push:h().func.isRequired}).isRequired,setStepMethodSelectionData:h().func.isRequired,subscribersLimitForValidation:h().number.isRequired};const Xo=(0,l.EN)(Qo);function Jo(e){let{onProceed:t}=e;return(0,_.jsxs)("div",{className:"mailpoet-clean-list-step-container",children:[(0,_.jsx)("p",{children:x.x.I18n.t("cleanListText1")}),(0,_.jsx)("p",{children:x.x.I18n.t("cleanListText2")}),(0,_.jsxs)("p",{children:[t&&(0,_.jsx)(E.z,{onClick:t,variant:"tertiary",children:x.x.I18n.t("listCleaningGotIt")}),(0,_.jsx)(E.z,{target:"_blank",href:"https://kb.mailpoet.com/article/287-list-cleaning-services",children:x.x.I18n.t("tryListCleaning")})]})]})}function el(e){let{onSubmit:t,history:n}=e;const[r,a]=(0,y.useState)(void 0);return(0,_.jsxs)("div",{className:"mailpoet-settings-grid",children:[(0,_.jsx)("div",{className:"mailpoet-settings-label",children:x.x.I18n.t("validationStepHeading")}),(0,_.jsxs)("div",{className:"mailpoet-settings-inputs",children:[(0,_.jsxs)("div",{className:"mailpoet-settings-inputs-row",children:[(0,_.jsx)(ie.Y,{automationId:"mailpoet_import_validation_step_option1",id:"existing-list",checked:"existing-list"===r,value:"existing-list",onCheck:a}),(0,_.jsx)("label",{htmlFor:"existing-list",children:x.x.I18n.t("validationStepRadio1")})]}),(0,_.jsxs)("div",{className:"mailpoet-settings-inputs-row",children:[(0,_.jsx)(ie.Y,{automationId:"mailpoet_import_validation_step_option2",id:"address-book",checked:"address-book"===r,value:"address-book",onCheck:a}),(0,_.jsx)("label",{htmlFor:"address-book",children:x.x.I18n.t("validationStepRadio2")})]})]}),(0,_.jsx)(Vo,{canGoNext:void 0!==r,onPreviousAction:()=>n.push("step_method_selection"),onNextAction:()=>t(r)})]})}function tl(){return(0,_.jsxs)("div",{className:"mailpoet-clean-list-step-container","data-automation-id":"import_wrong_source_block",children:[(0,_.jsx)("p",{children:x.x.I18n.t("validationStepBlock1")}),(0,_.jsx)("p",{children:x.x.I18n.t("validationStepBlock2")}),(0,_.jsx)("p",{children:(0,_.jsx)(E.z,{href:"https://kb.mailpoet.com/article/269-reconfirm-subscribers-to-your-list",target:"_blank",rel:"noopener noreferrer",children:x.x.I18n.t("validationStepBlockButton")})})]})}function nl(e){let{onSubmit:t}=e;const[n,r]=(0,y.useState)("over2years"),a=(0,y.useCallback)((e=>{r(e.target.value)}),[r]),s=(0,y.useCallback)((()=>{t("over2years"===n||"1to2years"===n?"notRecently":"recently")}),[t,n]);return(0,_.jsxs)("div",{className:"mailpoet-settings-grid",children:[(0,_.jsx)("div",{className:"mailpoet-settings-label",children:x.x.I18n.t("validationStepLastSentHeading")}),(0,_.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,_.jsxs)(ae.Select,{defaultValue:n,onChange:a,automationId:"last_sent_to_list",children:[(0,_.jsx)("option",{value:"over2years",children:x.x.I18n.t("validationStepLastSentOption1")}),(0,_.jsx)("option",{value:"1to2years",children:x.x.I18n.t("validationStepLastSentOption2")}),(0,_.jsx)("option",{value:"less1year",children:x.x.I18n.t("validationStepLastSentOption3")}),(0,_.jsx)("option",{value:"less3months",children:x.x.I18n.t("validationStepLastSentOption4")})]})}),(0,_.jsx)("div",{className:"mailpoet-settings-save",children:(0,_.jsx)(E.z,{type:"button",automationId:"last_sent_to_list_next",onClick:s,children:x.x.I18n.t("validationStepLastSentNext")})})]})}function rl(e){let{stepMethodSelectionData:t,history:n}=e;const[r,a]=(0,y.useState)(void 0),[s,i]=(0,y.useState)(void 0);(0,y.useEffect)((()=>{void 0===t&&n.replace("step_method_selection")}),[t,n]);const o=(0,y.useCallback)((e=>{i(e),"recently"===e&&n.push("step_data_manipulation")}),[n,i]);return(0,_.jsxs)(_.Fragment,{children:[void 0===r&&(0,_.jsx)(el,{onSubmit:a,history:n}),"address-book"===r&&(0,_.jsx)(tl,{}),"existing-list"===r&&void 0===s&&(0,_.jsx)(nl,{onSubmit:o}),"existing-list"===r&&"notRecently"===s&&(0,_.jsx)(Jo,{})]})}el.propTypes={history:h().shape({push:h().func.isRequired}).isRequired,onSubmit:h().func.isRequired},nl.propTypes={onSubmit:h().func.isRequired},rl.propTypes={history:h().shape({push:h().func.isRequired,replace:h().func.isRequired}).isRequired,stepMethodSelectionData:h().shape({duplicate:h().arrayOf(h().string),header:h().arrayOf(h().string),invalid:h().arrayOf(h().string),role:h().arrayOf(h().string),subscribersCount:h().number,subscribers:h().arrayOf(h().arrayOf(h().string))})},rl.defaultProps={stepMethodSelectionData:void 0};const al=(0,l.EN)(rl),sl=e=>{let{translation:t,subscribers:n}=e,r="";return n.length&&(r=I()(t.replace("%2$s",n.join(", ")),"%1$s",(()=>(0,_.jsx)("strong",{children:n.length.toLocaleString()},t))),r=(0,_.jsx)("p",{children:r})),r};function il(e){let{stepMethodSelectionData:t}=e;const{invalid:n,duplicate:r,role:a}=t,[s,i]=(0,y.useState)(!1),o=d()("mailpoet_subscribers_data_parse_results_details",{mailpoet_hidden:!s}),l=(0,_.jsx)(sl,{translation:x.x.I18n.t("importNoticeInvalid"),subscribers:n}),c=(0,_.jsx)(sl,{translation:x.x.I18n.t("importNoticeDuplicate"),subscribers:r});let u="";if(a.length&&(u=I()(x.x.I18n.t("importNoticeRoleBased"),/(%1\$s|\[link\].*\[\/link\]|%2\$s)/,(e=>"%1$s"===e?(0,_.jsx)("strong",{children:a.length.toLocaleString()},"role-length"):"%2$s"===e?a.join(", "):(0,_.jsx)("a",{href:"https://kb.mailpoet.com/article/270-role-based-email-addresses-are-not-allowed","data-beacon-article":"5d0a1da404286318cac46fe5",target:"_blank",rel:"noopener noreferrer",children:e.replace("[link]","").replace("[/link]","")},e))),u=(0,_.jsx)("p",{children:u})),n.length||r.length||a.length){const e=n.length+r.length+a.length;return(0,_.jsxs)("div",{className:"error",children:[(0,_.jsxs)("p",{children:[I()(x.x.I18n.t("importNoticeSkipped"),"%1$s",(()=>(0,_.jsx)("strong",{children:e.toLocaleString()},"lengths")))," ",(0,_.jsx)("a",{className:"mailpoet_subscribers_data_parse_results_details_show","data-automation-id":"show-more-details",onClick:()=>i(!s),role:"button",tabIndex:0,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),i(!s))},children:x.x.I18n.t("showMoreDetails")})]}),(0,_.jsxs)("div",{className:o,children:[(0,_.jsx)("hr",{}),l,c,u]})]})}return null}function ol(e){let{header:t,subscribers:n}=e;const r=((e,t)=>{const n=[],r=[];let a,s,i,o;return Object.keys(e[0]).forEach((l=>{a=e[0][l],s="ignore",a%1!=0&&window.mailpoet_email_regex.test(a)?s="email":t&&(i=t[l],o=window.mailpoetColumns.map((e=>e.name)).indexOf(i),-1!==o?s=window.mailpoetColumns[o].id:i&&(/first|first name|given name/i.test(i)?s="first_name":/last|last name/i.test(i)&&(s="last_name"))),s="ignore"!==s&&-1===r.indexOf(s)?s:"ignore",n[l]={column_id:s},r.push(s)})),n})(n,t);return(0,_.jsxs)("tr",{children:[(0,_.jsx)("th",{children:x.x.I18n.t("matchData")}),r.map(((e,t)=>(0,_.jsx)("th",{children:(0,_.jsx)("select",{className:"mailpoet_subscribers_column_data_match","data-column-id":e.column_id,"data-column-index":t,id:`column_${t}`})},e.column_id+t)))]})}function ll(e){let{header:t}=e;return(0,_.jsxs)("tr",{className:"mailpoet_header",children:[(0,_.jsx)("td",{}),t.map((e=>(0,_.jsx)("td",{children:e},e)))]})}function cl(e){let{subscriber:t,index:n}=e;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("td",{children:n}),t.map(((e,t)=>(0,_.jsx)("td",{children:e},`${e}-${n}-${t}`)))]})}function dl(e){let{subscribers:t,subscribersCount:n}=e;const r=". . .",a=Array(t[0].length).fill(r);return(0,_.jsxs)(_.Fragment,{children:[t.slice(0,10).map(((e,t)=>(0,_.jsx)("tr",{children:(0,_.jsx)(cl,{subscriber:e,index:t+1})},`${e[0]}-${t}`))),n>11?(0,_.jsx)("tr",{children:(0,_.jsx)(cl,{subscriber:a,index:r})},"filler"):null,n>10?(0,_.jsx)("tr",{children:(0,_.jsx)(cl,{subscriber:t[n-1],index:n})},t[n-1][0]):null]})}function ul(e){let{subscribersCount:t,subscribers:n,header:r}=e;return(0,y.useLayoutEffect)((()=>{(()=>{const e={data:window.mailpoetColumnsSelect2,width:"15em"};p()("select.mailpoet_subscribers_column_data_match").select2(e).on("select2:selecting",(t=>{const n=t.currentTarget,r=t.params.args.data.id;"create"===r?(t.preventDefault(),p()(n).select2("close"),x.x.Modal.popup({title:x.x.I18n.t("addNewField"),template:p()("#form_template_field_form").html()}),p()("#form_field_new").parsley().on("form:submit",(()=>{const t=p()("#form_field_new").mailpoetSerializeObject();return x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"customFields",action:"save",data:t}).done((t=>{const r={id:t.data.id,name:t.data.name,text:t.data.name,type:t.data.type,params:t.data.params,custom:!0};2===window.mailpoetColumnsSelect2.length&&window.mailpoetColumnsSelect2.push({name:x.x.I18n.t("userColumns"),children:[]}),window.mailpoetColumnsSelect2[2].children.push(r),window.mailpoetColumns.push(r),p()("select.mailpoet_subscribers_column_data_match").each((()=>{p()(n).html("").select2("destroy").select2(e)})),p()(n).data("column-id",r.id),x.x.Modal.close()})).fail((e=>{e.errors.length>0&&x.x.Notice.error(e.errors.map((e=>e.message)),{positionAfter:"#field_name"})})),!1}))):p()("select.mailpoet_subscribers_column_data_match").each((()=>{const e=n,a=p()(e).val();a===r&&"ignore"!==a&&(confirm(`${x.x.I18n.t("selectedValueAlreadyMatched")} ${x.x.I18n.t("confirmCorrespondingColumn")}`)?p()(e).data("column-id","ignore"):(t.preventDefault(),p()(n).select2("close")))}))})).on("select2:select",(e=>{const t=e.currentTarget,n=e.params.data.id;p()(t).data("column-id",n)})).on("select2:open",(()=>{const e=document.querySelectorAll(".select2-search__field[aria-controls]");0!==e.length&&e[e.length-1].focus()})),p().map(p()(".mailpoet_subscribers_column_data_match"),(e=>{const t=p()(e).data("column-id");p()(e).val(t).trigger("change")}))})()})),(0,_.jsx)("div",{className:"subscribers_data",children:(0,_.jsxs)("table",{className:"mailpoet_subscribers widefat fixed",children:[(0,_.jsx)("thead",{children:(0,_.jsx)(ol,{header:r,subscribers:n})}),(0,_.jsxs)("tbody",{children:[r?(0,_.jsx)(ll,{header:r}):null,(0,_.jsx)(dl,{subscribers:n,subscribersCount:t})]})]})})}function pl(e){let{setSelectedSegments:t}=e;const{segments:n}=(0,y.useContext)(Te.k),{all:r,updateAll:a}=n,[s,i]=(0,y.useState)(r);(0,y.useLayoutEffect)((()=>{!function(e,n){const r=p()("select#mailpoet_segments_select");if(r.data("select2"))return;const a=e=>{let t=`<span class="mailpoet-form-select2-text"><span>${e.name}</span></span>`;return e.count&&(t+=`<span class="mailpoet-form-select2-count">${e.count}</span>`),t};r.html(""),r.select2({data:e.map((e=>({...e,text:e.name}))),dropdownCssClass:"mailpoet-form-select2-dropdown",escapeMarkup:e=>e,templateResult:a,templateSelection:a}).on("change",(e=>{const n=p()('[data-id="notice_segmentSelection"]');e.currentTarget.value?p()('[data-id="notice_segmentSelection"]').remove():n.length||x.x.Notice.error(x.x.I18n.t("segmentSelectionRequired"),{static:!0,scroll:!0,id:"notice_segmentSelection",hideClose:!0});(e=>{t(e)})(w.ZP.pluck(r.select2("data"),"id"))}))}(s)}),[s,t]);const o=e=>{!function(){const e=p()("select#mailpoet_segments_select");e.data("select2")&&(e.select2("destroy"),e.find("option").remove(),e.off("select2:unselecting").off("change").off("select2:opening"))}(),t([]),i([...s,e]),a([...s,e])};return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("div",{className:"mailpoet-settings-label",children:(0,_.jsxs)("label",{htmlFor:"mailpoet_segments_select",children:[x.x.I18n.t("pickLists"),(0,_.jsx)("p",{className:"description",children:x.x.I18n.t("pickListsDescription")})]})}),(0,_.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,_.jsxs)("div",{className:"mailpoet-settings-inputs-row mailpoet-settings-inputs-row-centered",children:[(0,_.jsx)("div",{className:"mailpoet-form-select mailpoet-form-input",children:(0,_.jsx)("select",{id:"mailpoet_segments_select","data-placeholder":x.x.I18n.t("select"),multiple:"multiple",children:(0,_.jsx)("option",{})})}),(0,_.jsx)(E.z,{variant:"tertiary",onClick:()=>{return e=o,x.x.Modal.popup({title:x.x.I18n.t("addNewList"),template:p()("#new_segment_template").html()}),p()("#new_segment_name").on("keypress",(e=>{13===e.which&&p()("#new_segment_process").trigger("click")})),p()("#new_segment_process").on("click",(()=>{const t=p()("#new_segment_name").val().trim(),n=p()("#new_segment_description").val().trim();x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"ImportExport",action:"addSegment",data:{name:t,description:n}}).done((t=>{e({id:t.data.id,name:t.data.name,text:t.data.name,subscriberCount:0}),x.x.Modal.close()})).fail((e=>{e.errors.length>0&&(x.x.Notice.hide(),x.x.Notice.error(e.errors.map((e=>e.message)),{positionAfter:"#new_segment_name"}))}))})),void p()("#new_segment_cancel").on("click",(()=>{x.x.Modal.close()}));var e},children:x.x.I18n.t("createANewList")})]})})]})}function ml(){return(0,_.jsx)("p",{className:"description",children:I()(x.x.I18n.t("consentSubscribed"),/\[link](.*?)\[\/link]/,(e=>(0,_.jsx)("a",{className:"mailpoet-link",href:"https://kb.mailpoet.com/article/357-why-express-consent-is-important",target:"_blank","data-beacon-article":"605ca22ac44f5d025f447f39",rel:"noopener noreferrer",children:e},"kb-link")))})}function hl(e){let{newSubscribersStatus:t,setNewSubscribersStatus:n}=e;const r=(0,y.useCallback)((e=>{n(e.target.value)}),[n]);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("div",{className:"mailpoet-settings-label",children:[(0,_.jsx)("label",{htmlFor:"new_subscribers_status",children:x.x.I18n.t("newSubscribersStatus")}),(0,_.jsx)(ml,{})]}),(0,_.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,_.jsxs)(ae.Select,{id:"new_subscribers_status",placeholder:x.x.I18n.t("select"),name:"new_subscribers_status",onChange:r,defaultValue:t,children:[(0,_.jsx)("option",{value:"subscribed",children:x.x.I18n.t("subscribed")}),(0,_.jsx)("option",{value:"inactive",children:x.x.I18n.t("inactive")}),(0,_.jsx)("option",{value:"unsubscribed",children:x.x.I18n.t("unsubscribed")})]})})]})}function fl(e){let{existingSubscribersStatus:t,setExistingSubscribersStatus:n}=e;const r=(0,y.useCallback)((e=>{n(e.target.value)}),[n]);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("div",{className:"mailpoet-settings-label",children:[(0,_.jsx)("label",{htmlFor:"existing_subscribers_status",children:x.x.I18n.t("existingSubscribersStatus")}),(0,_.jsx)(ml,{})]}),(0,_.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,_.jsxs)(ae.Select,{id:"existing_subscribers_status",placeholder:x.x.I18n.t("select"),name:"existing_subscribers_status",onChange:r,defaultValue:t,children:[(0,_.jsx)("option",{value:"dont_update",children:x.x.I18n.t("dontUpdate")}),(0,_.jsx)("option",{value:"subscribed",children:x.x.I18n.t("subscribed")}),(0,_.jsx)("option",{value:"inactive",children:x.x.I18n.t("inactive")}),(0,_.jsx)("option",{value:"unsubscribed",children:x.x.I18n.t("unsubscribed")})]})})]})}function gl(e){let{updateExistingSubscribers:t,setUpdateExistingSubscribers:n}=e;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("div",{className:"mailpoet-settings-label",children:x.x.I18n.t("updateExistingSubscribers")}),(0,_.jsxs)("div",{className:"mailpoet-settings-inputs",children:[(0,_.jsx)(ie.Y,{id:"update_existing_subscribers",name:"update_existing_subscribers",value:"1",checked:t,onCheck:()=>n(!0)}),(0,_.jsx)("label",{htmlFor:"update_existing_subscribers",children:x.x.I18n.t("updateExistingSubscribersYes")}),(0,_.jsx)("span",{className:"mailpoet-gap"}),(0,_.jsx)(ie.Y,{id:"dont_update_existing_subscribers",name:"update_existing_subscribers",value:"",checked:!t,onCheck:()=>n(!1)}),(0,_.jsx)("label",{htmlFor:"dont_update_existing_subscribers",children:x.x.I18n.t("updateExistingSubscribersNo")})]})]})}function xl(e){let{selectedTags:t,setSelectedTags:n}=e;const r=(0,y.useCallback)((e=>{let{value:t}=e;n(t)}),[n]),a=x.x.tags.map((e=>e.name));return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("div",{className:"mailpoet-settings-label",children:[x.x.I18n.t("assignTagsLabel"),(0,_.jsx)("p",{className:"description",children:x.x.I18n.t("assignTagsDescription")})]}),(0,_.jsx)("div",{className:"mailpoet-settings-inputs mailpoet-import-tags",children:(0,_.jsx)(fe.T,{name:"tags",onChange:r,suggestedValues:a,selectedValues:t,placeholder:x.x.I18n.t("addNewTag")})})]})}function vl(e){let{history:t,stepMethodSelectionData:n,subscribersLimitForValidation:r,setStepDataManipulationData:a}=e;const[s,i]=(0,y.useState)([]),[o,l]=(0,y.useState)(!0),[c,d]=(0,y.useState)("subscribed"),[u,m]=(0,y.useState)("dontUpdate"),[h,f]=(0,y.useState)([]);return(0,y.useEffect)((()=>{void 0===n&&t.replace("step_method_selection")}),[n,t]),void 0===n?null:(0,_.jsxs)("div",{"data-automation-id":"import_data_manipulation_step",children:[(0,_.jsx)(il,{stepMethodSelectionData:n}),(0,_.jsx)(ul,{subscribersCount:n.subscribersCount,subscribers:n.subscribers,header:n.header}),(0,_.jsxs)("div",{className:"mailpoet-settings-grid",children:[(0,_.jsx)(pl,{setSelectedSegments:i}),(0,_.jsx)(hl,{newSubscribersStatus:c,setNewSubscribersStatus:d}),(0,_.jsx)(fl,{existingSubscribersStatus:u,setExistingSubscribersStatus:m}),(0,_.jsx)(gl,{setUpdateExistingSubscribers:l,updateExistingSubscribers:o}),(0,_.jsx)(xl,{selectedTags:h,setSelectedTags:f}),(0,_.jsx)(Vo,{canGoNext:s.length>0,onPreviousAction:()=>t.push(function(e,t){return void 0===e||void 0===e.subscribersCount||e.subscribersCount<t?"step_method_selection":"step_input_validation"}(n,r)),onNextAction:()=>{((e,n,r,s,i,o,l)=>{const c={},d=new(p().AsyncQueue);let u=0;const m=Date.now()/1e3,h={created:0,updated:0,errors:[],segments:[],tags:[]};x.x.Modal.loading(!0);const f=(2e3,e.reduce(((e,t,n)=>(n%2e3==0&&e.push([]),e[e.length-1].push(t),e)),[]));w.ZP.each(p()("select.mailpoet_subscribers_column_data_match"),((e,t)=>{const n=p()(e).data("column-id");"ignore"!==n&&(c[n]={index:t})})),w.ZP.each(f,(()=>{d.add((e=>{e.pause(),x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"ImportExport",action:"processImport",data:JSON.stringify({columns:c,subscribers:f[u],timestamp:m,segments:n,newSubscribersStatus:r,existingSubscribersStatus:s,updateSubscribers:i,tags:o})}).done((t=>{const n=t.data.added_to_segment_with_welcome_notification;h.created+=t.data.created,h.updated+=t.data.updated,h.segments=t.data.segments,h.added_to_segment_with_welcome_notification=n,e.run()})).fail((e=>{x.x.Modal.loading(!1),e.errors.length>0&&x.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})})),u+=1}))})),d.run(),d.onComplete((()=>{x.x.Modal.loading(!1),h.errors.length>0&&!h.updated&&!h.created?x.x.Notice.error(w.ZP.flatten(h.errors)):(h.segments=w.ZP.map(w.ZP.filter(h.segments,(e=>n.includes(e.id))),(e=>e.name)),a(h),t.push("step_results"))}))})(n.subscribers,s,c,u,o,h)},isLastStep:!0})]})]})}sl.propTypes={translation:h().string.isRequired,subscribers:h().arrayOf(h().string).isRequired},il.propTypes={stepMethodSelectionData:h().shape({duplicate:h().arrayOf(h().string),invalid:h().arrayOf(h().string),role:h().arrayOf(h().string)})},il.defaultProps={stepMethodSelectionData:{invalid:[],duplicate:[],role:[]}},ol.propTypes={subscribers:h().arrayOf(h().arrayOf(h().oneOfType([h().string,h().number]))).isRequired,header:h().arrayOf(h().string)},ol.defaultProps={header:[]},ll.propTypes={header:h().arrayOf(h().string).isRequired},cl.propTypes={subscriber:h().arrayOf(h().oneOfType([h().string,h().number])).isRequired,index:h().node.isRequired},dl.propTypes={subscribersCount:h().number.isRequired,subscribers:h().arrayOf(h().arrayOf(h().oneOfType([h().string,h().number]))).isRequired},ul.propTypes={subscribersCount:h().number,subscribers:h().arrayOf(h().arrayOf(h().oneOfType([h().string,h().number]))),header:h().arrayOf(h().string)},ul.defaultProps={subscribersCount:0,subscribers:[],header:[]},pl.propTypes={setSelectedSegments:h().func.isRequired},gl.propTypes={setUpdateExistingSubscribers:h().func.isRequired,updateExistingSubscribers:h().bool.isRequired},n(49868),vl.propTypes={history:h().shape({push:h().func.isRequired,replace:h().func.isRequired}).isRequired,stepMethodSelectionData:h().shape({duplicate:h().arrayOf(h().string),header:h().arrayOf(h().string),invalid:h().arrayOf(h().string),role:h().arrayOf(h().string),subscribersCount:h().number,subscribers:h().arrayOf(h().arrayOf(h().oneOfType([h().string,h().number])))}),subscribersLimitForValidation:h().number.isRequired,setStepDataManipulationData:h().func.isRequired},vl.defaultProps={stepMethodSelectionData:void 0};const bl=(0,l.EN)(vl);function yl(e){let{subscribersCount:t,segments:n,initialMessage:r}=e;if(t){let e=I()(r,"%1$s",(()=>(0,_.jsx)("strong",{children:t.toLocaleString()},"%1$s")));return e=I()(e,"%2$s",(()=>`"${n.join('", "')}"`)),(0,_.jsx)("p",{children:e})}return null}function wl(e){let{createdSubscribers:t,updatedSubscribers:n}=e;return t||n?null:(0,_.jsx)("p",{children:x.x.I18n.t("importNoAction")})}function _l(e){let{createdSubscribers:t,updatedSubscribers:n}=e;return t||n?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("p",{children:(0,_.jsx)("b",{children:x.x.I18n.t("congratulationResult")})}),(0,_.jsx)("p",{children:I()(x.x.I18n.t("suppressionListReminder"),/\[link](.*?)\[\/link]/,(e=>(0,_.jsx)("a",{className:"mailpoet-link",href:"https://kb.mailpoet.com/article/359-how-to-import-a-suppression-list","data-beacon-article":"6064973ce0324b5fdfd0650c",target:"_blank",rel:"noopener noreferrer",children:e},"kb-link")))})]}):null}function jl(e){let{addedToSegmentWithWelcomeNotification:t}=e;return t?(0,_.jsx)("p",{children:x.x.I18n.t("importNoWelcomeEmail")}):null}function Sl(e){let{errors:t,createdSubscribers:n,updatedSubscribers:r,segments:a,addedToSegmentWithWelcomeNotification:s,history:i}=e;return(0,y.useEffect)((()=>{void 0===a&&0===t.length&&void 0===n&&void 0===r&&i.replace("step_method_selection")}),[a,n,t.length,i,r]),t.length&&x.x.Notice.error(w.ZP.flatten(t)),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("div",{className:"updated",children:[(0,_.jsx)(yl,{subscribersCount:n,segments:a,initialMessage:x.x.I18n.t("subscribersCreated")}),(0,_.jsx)(yl,{subscribersCount:r,segments:a,initialMessage:x.x.I18n.t("subscribersUpdated")}),(0,_.jsx)(wl,{createdSubscribers:n,updatedSubscribers:r}),(0,_.jsx)(jl,{addedToSegmentWithWelcomeNotification:s})]}),(0,_.jsx)(_l,{createdSubscribers:n,updatedSubscribers:r}),(0,_.jsx)("div",{className:"mailpoet-settings-grid",children:(0,_.jsxs)("div",{className:"mailpoet-settings-save",children:[(0,_.jsx)(E.z,{variant:"secondary",type:"button",onClick:()=>i.push("step_method_selection"),children:x.x.I18n.t("importAgain")}),(0,_.jsx)(E.z,{type:"button",onClick:()=>{window.location.href="admin.php?page=mailpoet-subscribers"},children:x.x.I18n.t("viewSubscribers")})]})})]})}yl.propTypes={segments:h().arrayOf(h().string.isRequired),subscribersCount:h().number,initialMessage:h().string},yl.defaultProps={segments:[],subscribersCount:0,initialMessage:""},wl.propTypes={createdSubscribers:h().number,updatedSubscribers:h().number},wl.defaultProps={createdSubscribers:0,updatedSubscribers:0},_l.propTypes={createdSubscribers:h().number,updatedSubscribers:h().number},_l.defaultProps={createdSubscribers:0,updatedSubscribers:0},jl.propTypes={addedToSegmentWithWelcomeNotification:h().bool},jl.defaultProps={addedToSegmentWithWelcomeNotification:!1},Sl.propTypes={history:h().shape({push:h().func.isRequired,replace:h().func.isRequired}).isRequired,errors:h().arrayOf(h().string.isRequired),segments:h().arrayOf(h().string.isRequired),createdSubscribers:h().number,updatedSubscribers:h().number,addedToSegmentWithWelcomeNotification:h().bool},Sl.defaultProps={errors:[],segments:void 0,createdSubscribers:void 0,updatedSubscribers:void 0,addedToSegmentWithWelcomeNotification:void 0};const Il=(0,l.EN)(Sl);function Cl(e){let{history:t}=e;return(0,_.jsx)(Jo,{onProceed:()=>t.push("step_method_selection")})}const Tl=document.getElementById("import_container");function kl(){const[e,t]=(0,y.useState)(void 0),[n,r]=(0,y.useState)({}),a=(0,Te.S)(window);return(0,_.jsx)(Te.k.Provider,{value:a,children:(0,_.jsxs)(o.HashRouter,{children:[(0,_.jsx)(Le.w,{}),(0,_.jsx)(Uo,{children:(0,_.jsxs)(l.rs,{children:[(0,_.jsx)(l.AW,{path:"/step_clean_list",render:e=>(0,_.jsx)(Cl,{...e})}),(0,_.jsx)(l.AW,{path:"/step_method_selection",render:e=>(0,_.jsx)(Xo,{...e,setStepMethodSelectionData:t,subscribersLimitForValidation:100})}),(0,_.jsx)(l.AW,{path:"/step_input_validation",render:t=>(0,_.jsx)(al,{...t,stepMethodSelectionData:e})}),(0,_.jsx)(l.AW,{path:"/step_data_manipulation",render:t=>(0,_.jsx)(bl,{...t,stepMethodSelectionData:e,subscribersLimitForValidation:100,setStepDataManipulationData:r})}),(0,_.jsx)(l.AW,{path:"/step_results",render:e=>(0,_.jsx)(Il,{...e,errors:n.errors,createdSubscribers:n.created,updatedSubscribers:n.updated,segments:n.segments,addedToSegmentWithWelcomeNotification:n.added_to_segment_with_welcome_notification})}),(0,_.jsx)(l.AW,{path:"*",render:()=>(0,_.jsx)(l.l_,{to:"/step_clean_list"})})]})})]})})}Tl&&i.render((0,_.jsx)(kl,{}),Tl);var Nl=n(88525),Dl=n.n(Nl),El=n(73658);function Al(e){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(he.X,{level:1,children:x.x.I18n.t("welcomeWizardLetsStartTitle")}),(0,_.jsx)("div",{className:"mailpoet-gap"}),(0,_.jsx)("p",{children:x.x.I18n.t("welcomeWizardSenderText")}),(0,_.jsx)("div",{className:"mailpoet-gap"}),(0,_.jsxs)("form",{id:"mailpoet_sender_form",onSubmit:t=>{t.preventDefault(),p()("#mailpoet_sender_form").parsley().validate()&&e.submit_sender()},children:[(0,_.jsxs)(_t.Grid.TwoColumns,{children:[(0,_.jsxs)("label",{htmlFor:"senderName",children:[(0,_.jsx)("span",{className:"mailpoet-wizard-label",children:x.x.I18n.t("senderName")}),(0,_.jsx)(ee.I,{isFullWidth:!0,name:"senderName",type:"text",placeholder:"John Doe",value:e.sender?e.sender.name:"","data-parsley-required":!0,onChange:t=>e.update_sender({name:t.target.value})})]}),(0,_.jsxs)("label",{htmlFor:"senderAddress",children:[(0,_.jsx)("span",{className:"mailpoet-wizard-label",children:x.x.I18n.t("senderAddress")}),(0,_.jsx)(ee.I,{isFullWidth:!0,name:"senderAddress",type:"text",placeholder:"john@doe.com",value:e.sender?e.sender.address:"","data-parsley-required":!0,"data-parsley-type":"email",onChange:t=>e.update_sender({address:t.target.value})})]})]}),(0,_.jsx)("div",{className:"mailpoet-gap"}),(0,_.jsx)("div",{className:"mailpoet-gap"}),(0,_.jsx)(E.z,{isFullWidth:!0,type:"submit",withSpinner:e.loading,children:x.x.I18n.t("continue")}),(0,_.jsx)(E.z,{href:"#finish",isDisabled:e.loading,isFullWidth:!0,onClick:e.finish,variant:"tertiary",children:x.x.I18n.t("finishLater")})]})]})}p()(document).ready((()=>{let e;if(!p()("#mailpoet_subscribers_export").length)return;if(!window.exportData.segments)return;const t=Dl().compile(p()("#mailpoet_subscribers_export_template").html());function n(t){const n="mailpoet-disabled";"on"===t?e.removeClass(n):e.addClass(n)}p()("#mailpoet-export").html(t(window.exportData));const r=p()("#export_lists"),a=p()("#export_columns");function s(e){let t=`<span class="mailpoet-form-select2-text"><span>${e.name}</span></span>`;return void 0!==e.count&&(t+=`<span class="mailpoet-form-select2-count">${e.count}</span>`),t}function i(e,t){e.data("select2")&&e.html("").select2("destroy"),e.select2({data:t,width:"20em",dropdownCssClass:"mailpoet-form-select2-dropdown",escapeMarkup:e=>e,templateResult:s,templateSelection:s}).on("select2:selecting",(t=>{const n=t.params.args.data.id,r=["select","deselect"];let a;w.ZP.contains(r,n)&&(t.preventDefault(),"deselect"===n?p()(t.target).val("").trigger("change"):(a=[],w.ZP.each(e.find("option"),(e=>{const t=e.value;w.ZP.contains(r,t)||a.push(t)})),p()(t.target).val(a).trigger("change")),p()(t.target).select2("close"))})).on("change",(()=>{window.exportData.segments&&r.select2("data").length&&a.select2("data").length||!window.exportData.segments&&a.select2("data").length?n("on"):n("off")}))}e=p()("#mailpoet-export-button"),window.segments.forEach((e=>{r.append(p()("<option></option>").attr("value",e.id).text(e.name))})),window.subscriberFieldsSelect2.forEach((e=>{e.text=e.name,e.children.forEach((e=>{e.name=(0,El.r)(e.name),e.text=(0,El.r)(e.name)}))})),i(r,window.segments),i(a,window.subscriberFieldsSelect2),a.val(["email","first_name","last_name","list_status","global_status","subscribed_ip","created_at","confirmed_at","confirmed_ip"]).trigger("change"),e.on("click",(e=>{if(p()(e.target).hasClass("mailpoet-disabled"))return;x.x.Modal.loading(!0);const t=p()(':radio[name="option_format"]:checked').val();x.x.Ajax.post({api_version:x.x.apiVersion,endpoint:"ImportExport",action:"processExport",data:JSON.stringify({export_format_option:t,segments:!!window.exportData.segments&&r.val(),subscriber_fields:a.val()})}).always((()=>{x.x.Modal.loading(!1)})).done((e=>{const n=x.x.I18n.t("exportMessage").replace("%1$s",`<strong>${parseInt(e.data.totalExported,10).toLocaleString()}</strong>`).replace("[link]",`<a href="${e.data.exportFileURL}" target="_blank" >`).replace("[/link]","</a>");p()("#export_result_notice").html(`<p>${n}</p>`).show(),window.location.href=e.data.exportFileURL,x.x.trackEvent("Subscribers export completed",{"Total exported":e.data.totalExported,"File Format":t})})).fail((e=>{e.errors.length>0&&x.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}))})),Al.propTypes={finish:h().func.isRequired,loading:h().bool.isRequired,update_sender:h().func.isRequired,submit_sender:h().func.isRequired,sender:h().shape({name:h().string,address:h().string})},Al.defaultProps={sender:null};const Ol=(0,_.jsx)("svg",{width:"13",height:"11",viewBox:"0 0 13 11",children:(0,_.jsx)("path",{fill:"currentColor",d:"M9.967.638c.483-.698 1.405-.846 2.06-.33.654.515.793 1.499.31 2.197l-5.44 7.857c-.55.794-1.64.857-2.267.132l-3.4-3.928c-.552-.638-.515-1.632.083-2.22.598-.59 1.53-.55 2.082.088l2.19 2.532L9.968.638z"})}),Rl=(0,_.jsx)("svg",{width:"17",height:"16",viewBox:"0 0 17 16",children:(0,_.jsx)("path",{fill:"currentColor",d:"M12.407 3.31c.576.576.576 1.509 0 2.084L9.914 7.888l2.411 2.412c.586.585.586 1.535 0 2.121-.585.586-1.535.586-2.12 0l-2.413-2.412L5.3 12.503c-.576.575-1.509.575-2.084 0-.575-.575-.575-1.508 0-2.083l2.493-2.495-2.41-2.41c-.587-.587-.587-1.536 0-2.122.585-.586 1.535-.586 2.12 0L7.83 5.804l2.494-2.493c.575-.576 1.508-.576 2.083 0z"})});function Pl(e){let{onCheck:t,showError:n,checked:r,automationId:a,...s}=e;return(0,_.jsxs)("div",{className:d()({"mailpoet-form-yesno":!0,"mailpoet-form-yesno-error":n,"mailpoet-disabled":s.disabled}),"data-automation-id":a,children:[(0,_.jsxs)("label",{children:[(0,_.jsx)("input",{type:"radio",checked:!0===r,onChange:()=>t(!0),...s}),(0,_.jsx)("span",{className:"mailpoet-form-yesno-control mailpoet-form-yesno-yes",children:Ol})]}),(0,_.jsxs)("label",{children:[(0,_.jsx)("input",{type:"radio",checked:!1===r,onChange:()=>t(!1),...s}),(0,_.jsx)("span",{className:"mailpoet-form-yesno-control mailpoet-form-yesno-no",children:Rl})]})]})}const Ml=e=>null==e;function Ll(e){let{loading:t,submitForm:n}=e;const[r,a]=(0,y.useState)({tracking:void 0,libs3rdParty:void 0}),[s,i]=(0,y.useState)(!1);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(he.X,{level:1,children:x.x.I18n.t("welcomeWizardUsageTrackingStepTitle")}),(0,_.jsx)("div",{className:"mailpoet-gap"}),(0,_.jsxs)("form",{onSubmit:function(e){return e.preventDefault(),i(!0),Ml(r.libs3rdParty)||Ml(r.tracking)||n(r.tracking,r.libs3rdParty),!1},children:[(0,_.jsxs)("div",{className:"mailpoet-wizard-woocommerce-option",children:[(0,_.jsx)("div",{className:"mailpoet-wizard-woocommerce-toggle",children:(0,_.jsx)(Pl,{showError:s&&Ml(r.libs3rdParty),onCheck:e=>{const t={libs3rdParty:e};a((e=>({...e,...t})))},checked:r.libs3rdParty,name:"mailpoet_libs_3rdParty"})}),(0,_.jsxs)("div",{children:[(0,_.jsxs)("p",{children:[x.x.I18n.t("welcomeWizardUsageTrackingStepLibs3rdPartyLabel")," "]}),(0,_.jsxs)("div",{className:"mailpoet-wizard-note",children:[(0,_.jsx)("span",{children:x.x.I18n.t("welcomeWizardUsageTrackingStepLibs3rdPartyLabelNoteNote")}),I()(x.x.I18n.t("welcomeWizardUsageTrackingStepLibs3rdPartyLabelNote"),/\[link\](.*?)\[\/link\]/g,((e,t)=>(0,_.jsx)("a",{href:"https://kb.mailpoet.com/article/338-what-3rd-party-libraries-we-use","data-beacon-article":"5f7c7dd94cedfd0017dcece8",target:"_blank",rel:"noopener noreferrer",children:e},t)))]})]})]}),(0,_.jsx)("div",{className:"mailpoet-gap"}),(0,_.jsxs)("div",{className:"mailpoet-wizard-woocommerce-option",children:[(0,_.jsx)("div",{className:"mailpoet-wizard-woocommerce-toggle",children:(0,_.jsx)(Pl,{showError:s&&Ml(r.tracking),onCheck:e=>{const t={tracking:e};a((e=>({...e,...t})))},checked:r.tracking,name:"mailpoet_tracking"})}),(0,_.jsxs)("div",{children:[(0,_.jsxs)("p",{children:[x.x.I18n.t("welcomeWizardUsageTrackingStepTrackingLabel")," "]}),(0,_.jsxs)("div",{className:"mailpoet-wizard-note",children:[(0,_.jsx)("span",{children:x.x.I18n.t("welcomeWizardUsageTrackingStepTrackingLabelNoteNote")}),I()(x.x.I18n.t("welcomeWizardUsageTrackingStepTrackingLabelNote"),/\[link\](.*?)\[\/link\]/g,((e,t)=>(0,_.jsx)("a",{href:"https://kb.mailpoet.com/article/130-sharing-your-data-with-us","data-beacon-article":"57ce0aaac6979108399a0454",target:"_blank",rel:"noopener noreferrer",children:e},t)))]})]})]}),(0,_.jsx)("div",{className:"mailpoet-gap"}),(0,_.jsx)(E.z,{isFullWidth:!0,type:"submit",withSpinner:t,disabled:t,children:x.x.I18n.t("continue")})]})]})}function Fl(e){let{children:t}=e;return(0,_.jsx)("div",{className:"mailpoet-steps-content",children:t})}function ql(e){const[t,n]=(0,y.useState)(null),[r,a]=(0,y.useState)(!1===e.showCustomersImportSetting?"unsubscribed":null),[s,i]=(0,y.useState)(!1),o=e.isWizardStep?x.x.I18n.t("wooCommerceSetupFinishButtonTextWizard"):x.x.I18n.t("wooCommerceSetupFinishButtonTextStandalone");let l;return"subscribed"===r&&(l=!0),"unsubscribed"===r&&(l=!1),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(f.TypographyHeading,{level:1,children:x.x.I18n.t("wooCommerceSetupTitle")}),(0,_.jsx)("div",{className:"mailpoet-gap"}),(0,_.jsx)("p",{children:x.x.I18n.t("wooCommerceSetupInfo")}),(0,_.jsx)("div",{className:"mailpoet-gap"}),(0,_.jsxs)("form",{onSubmit:n=>(n.preventDefault(),i(!0),null===r||null===t||e.submitForm(r,"true"===t),!1),children:[e.showCustomersImportSetting?(0,_.jsxs)("div",{className:"mailpoet-wizard-woocommerce-option",children:[(0,_.jsx)("div",{className:"mailpoet-wizard-woocommerce-toggle",children:(0,_.jsx)(Pl,{showError:s&&null===r,checked:l,onCheck:e=>a(e?"subscribed":"unsubscribed"),name:"mailpoet_woocommerce_import_type",automationId:"woocommerce_import_type"})}),(0,_.jsxs)("div",{children:[(0,_.jsx)("p",{children:I()(x.x.I18n.t("wooCommerceSetupImportInfo"),/\[link\](.*?)\[\/link\]/,(e=>(0,_.jsx)("a",{href:"https://kb.mailpoet.com/article/284-import-old-customers-to-the-woocommerce-customers-list","data-beacon-article":"5d722c7104286364bc8ecf19",rel:"noopener noreferrer",target:"_blank",children:e},e)))}),(0,_.jsxs)("div",{className:"mailpoet-wizard-note",children:[(0,_.jsx)("span",{children:"GDPR"}),x.x.I18n.t("wooCommerceSetupImportGDPRInfo")]})]})]}):null,(0,_.jsxs)("div",{className:"mailpoet-wizard-woocommerce-option",children:[(0,_.jsx)("div",{className:"mailpoet-wizard-woocommerce-toggle",children:(0,_.jsx)(Pl,{showError:s&&null===t,checked:t,onCheck:e=>n(e),name:"mailpoet_woocommerce_tracking",automationId:"woocommerce_tracking"})}),(0,_.jsxs)("div",{children:[(0,_.jsx)("p",{children:I()(x.x.I18n.t("wooCommerceSetupTrackingInfo"),/\[link\](.*?)\[\/link\]/,(e=>(0,_.jsx)("a",{href:"https://kb.mailpoet.com/article/280-woocommerce-cookie-tracking","data-beacon-article":"5d5fa44c2c7d3a7a4d778906",rel:"noopener noreferrer",target:"_blank",children:e},e)))}),(0,_.jsxs)("div",{className:"mailpoet-wizard-note",children:[(0,_.jsx)("span",{children:"GDPR"}),x.x.I18n.t("wooCommerceSetupTrackingGDPRInfo")]})]})]}),(0,_.jsx)("div",{className:"mailpoet-gap"}),(0,_.jsx)(f.Button,{isFullWidth:!0,type:"submit",withSpinner:e.loading,disabled:e.loading,automationId:"submit_woocommerce_setup",children:o})]})]})}function $l(e){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("div",{className:"mailpoet-wizard-logo",children:(0,_.jsx)("img",{src:window.mailpoet_logo_url,width:"160",height:"50",alt:"MailPoet logo"})}),(0,_.jsx)(Bn,{illustrationUrl:e.illustrationUrl,children:e.children})]})}function Ul(e){let{isWizardStep:t=!1}=e;const[n,r]=(0,y.useState)(!1),a=e=>{r(!1),x.x.Notice.showApiErrorNotice(e,{scroll:!0})},s=()=>x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"importExport",action:"setupWooCommerceInitialImport"}).fail(a),i=()=>{window.location=window.finish_wizard_url},o=(0,_.jsx)($l,{illustrationUrl:window.wizard_woocommerce_illustration_url,children:(0,_.jsx)(ql,{loading:n,submitForm:(e,t)=>{r(!0);const n="basic"===x.x.trackingConfig.level?"basic":"partial";var o;(o={woocommerce_import_screen_displayed:1,"mailpoet_subscribe_old_woocommerce_customers.enabled":"subscribed"===e?1:0,"tracking.level":t?"full":n,"woocommerce.accept_cookie_revenue_tracking.set":1},x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"settings",action:"set",data:o}).fail(a)).then(s).then(i)},isWizardStep:t,showCustomersImportSetting:window.mailpoet_show_customers_import})});return t?o:(0,_.jsx)(Fl,{children:o})}Ll.propTypes={loading:h().bool.isRequired,submitForm:h().func.isRequired},ql.propTypes={submitForm:h().func.isRequired,loading:h().bool.isRequired,showCustomersImportSetting:h().bool.isRequired,isWizardStep:h().bool},ql.defaultProps={isWizardStep:!1},$l.propTypes={illustrationUrl:h().string.isRequired,children:h().oneOfType([h().arrayOf(h().node),h().node]).isRequired},Ul.propTypes={isWizardStep:h().bool},Ul.defaultProps={isWizardStep:!1};const Zl=e=>{let{name:t,address:n}=e;const r=n.split("@").pop().toLowerCase();return window.mailpoet_free_domains.indexOf(r)>-1?(e=>{let{name:t,address:n}=e;const r=`wordpress@${window.location.hostname.replace("www.","")}`;return{sender:{name:t,address:r},reply_to:{name:t,address:n},"signup_confirmation.from.address":r,"signup_confirmation.from.name":t,"signup_confirmation.reply_to.address":n,"signup_confirmation.reply_to.name":t}})({name:t,address:n}):(e=>{let{name:t,address:n}=e;return{sender:{name:t,address:n},reply_to:{name:t,address:n},"signup_confirmation.from.address":n,"signup_confirmation.from.name":t,"signup_confirmation.reply_to.address":n,"signup_confirmation.reply_to.name":t}})({name:t,address:n})},Vl=()=>{let e=2;return window.has_mss_key_specified||(e+=1),window.mailpoet_woocommerce_active&&(e+=1),e},Wl=(e,t,n)=>{n<Vl()?e.push(`/steps/${n+1}`):t()};var Yl=n(84113);function Bl(e){const t=Vl(),n=parseInt(e.match.params.step,10),[r,a]=(0,y.useState)(!1),[s,i]=(0,y.useState)(window.sender_data);function o(){a(!0),window.location=window.finish_wizard_url}(0,y.useEffect)((()=>{(n>t||n<1)&&e.history.push("/steps/1")}),[n,t,e.history]);const l=(0,w.r$)(Wl,e.history,o);function c(e){return a(!0),x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"settings",action:"set",data:e}).then((()=>a(!1))).fail((e=>{a(!1),e.errors.length>0&&x.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}const d=(0,y.useCallback)(((e,t)=>{a(!0),c({analytics:{enabled:e?"1":""},"3rd_party_libs":{enabled:t?"1":""}}).then((()=>l(n)))}),[l,n]),u=(0,y.useCallback)((e=>{i({...s,...e})}),[s]),p=(0,y.useCallback)((()=>{c(Zl(s)).then((()=>l(n)))}),[l,s,n]),m=(0,y.useCallback)((e=>{e.preventDefault(),a(!0),c(Zl({address:window.admin_email,name:""})).then((()=>{window.mailpoet_woocommerce_active?l(t-1):o()}))}),[l,t]),h=1===(f=n)?"WelcomeWizardSenderStep":2===f?"WelcomeWizardUsageTrackingStep":window.mailpoet_woocommerce_active&&f===Vl()?"WizardWooCommerceStep":"WelcomeWizardPitchMSSStep";var f;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(Yl.R,{count:t,current:n}),(0,_.jsxs)(Fl,{children:["WelcomeWizardSenderStep"===h?(0,_.jsx)($l,{illustrationUrl:window.wizard_sender_illustration_url,children:(0,_.jsx)(Al,{update_sender:u,submit_sender:p,finish:m,loading:r,sender:s})}):null,"WelcomeWizardUsageTrackingStep"===h?(0,_.jsx)($l,{illustrationUrl:window.wizard_tracking_illustration_url,children:(0,_.jsx)(Ll,{loading:r,submitForm:d})}):null,"WelcomeWizardPitchMSSStep"===h?(0,_.jsx)($l,{illustrationUrl:window.wizard_MSS_pitch_illustration_url,children:(0,_.jsx)(Jn,{next:()=>l(n),subscribersCount:window.mailpoet_subscribers_count,mailpoetAccountUrl:window.mailpoet_account_url,purchaseUrl:x.x.MailPoetComUrlFactory.getPurchasePlanUrl(x.x.subscribersCount,x.x.currentWpUserEmail,"business",{utm_medium:"onboarding",utm_campaign:"purchase"})})}):null,"WizardWooCommerceStep"===h?(0,_.jsx)(Ul,{isWizardStep:!0}):null]})]})}function Hl(){let e="/steps/1";window.location.search.includes("woocommerce-setup")&&(e="/woocommerce");const t=(0,Te.S)(window);return(0,_.jsx)(Te.k.Provider,{value:t,children:(0,_.jsxs)(o.HashRouter,{children:[(0,_.jsx)(Le.w,{}),(0,_.jsxs)(l.rs,{children:[(0,_.jsx)(l.AW,{path:"/steps/:step",component:Bl}),(0,_.jsx)(l.AW,{path:"/woocommerce",component:Ul}),(0,_.jsx)(l.AW,{render:()=>(0,_.jsx)(l.l_,{to:e})})]})]})})}Bl.propTypes={match:h().shape({params:h().shape({step:h().string}).isRequired}).isRequired,history:h().shape({push:h().func.isRequired}).isRequired};const zl=document.getElementById("mailpoet-wizard-container");function Gl(){const[e,t]=(0,y.useState)(null),n=(0,Te.S)(window),r=n.notices.error;function a(a){const s=a.target.name,i=a.target.checked;x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"featureFlags",action:"set",data:{[s]:i?1:0}}).done((()=>{const r=e[s];r.value=i,t({...e,[s]:r});const a=`Feature '${s}' was ${i?"enabled":"disabled"}.`;n.notices.success((0,_.jsx)("p",{children:a}))})).fail((e=>{e.errors.length>0&&r(e.errors.map((e=>(0,_.jsx)("p",{children:e.message},e.message))),{scroll:!0})}))}return(0,y.useEffect)((()=>{x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"featureFlags",action:"getAll"}).done((e=>{const n=e.data.reduce(((e,t)=>({...e,[t.name]:t})),{});t(n)})).fail((e=>{e.errors.length>0&&r((0,_.jsx)(_.Fragment,{children:e.errors.map((e=>(0,_.jsx)("p",{children:e.message})))}),{scroll:!0})}))}),[r]),null===e?(0,_.jsx)("p",{children:"Loading experimental features..."}):0===Object.values(e).length?(0,_.jsx)("p",{children:"There are no experimental features at the moment."}):(0,_.jsx)(Te.k.Provider,{value:n,children:(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(Le.w,{}),Object.values(e).map((e=>{const t=`experimental-feature-${e.name}`;return(0,_.jsx)("div",{children:(0,_.jsxs)("label",{htmlFor:t,children:[(0,_.jsx)("input",{id:t,type:"checkbox",name:e.name,defaultChecked:e.value,onChange:a})," ",e.name]})},e.name)}))]})})}zl&&i.render((0,_.jsx)(Hl,{}),zl);const Kl=document.getElementById("experimental_features_container");Kl&&i.render((0,_.jsx)(Gl,{}),Kl);var Ql=n(54969);function Xl(e){let{message:t,editing:n}=e;return n?(0,_.jsx)("textarea",{value:t,className:"mailpoet-logs-full-message",readOnly:!0}):(0,_.jsx)(_.Fragment,{children:`${t.substr(0,150)}…`})}function Jl(e){let{log:t}=e;const[n,r]=(0,y.useState)(!1);return(0,_.jsxs)("tr",{children:[(0,_.jsx)("td",{role:"gridcell",children:t.name}),(0,_.jsx)("td",{onClick:function(e){(function(e){return(e.ctrlKey||e.metaKey)&&!e.altKey})(e)&&(n||r(!0))},role:"gridcell",children:(0,_.jsx)(Xl,{message:t.message,editing:n})}),(0,_.jsx)("td",{role:"gridcell",children:x.x.Date.full(t.created_at)})]},`log-row-${t.id}`)}function ec(e){let{logs:t,onFilter:n,originalFrom:r,originalTo:a,originalSearch:s,originalOffset:i,originalLimit:o}=e;const[l,c]=(0,y.useState)(r??void 0),[d,u]=(0,y.useState)(a??void 0),[p,m]=(0,y.useState)(i??""),[h,g]=(0,y.useState)(o??""),[v,b]=(0,y.useState)(s||""),w=(0,vt.curry)(((e,t)=>{e(null!==t?x.x.Date.format(t,{format:"Y-m-d"}):void 0)})),j=(0,y.useCallback)((()=>{const e={};l&&(e.from=l),d&&(e.to=d),p&&""!==p.trim()&&(e.offset=p),h&&""!==h.trim()&&(e.limit=h),v&&""!==v.trim()&&(e.search=v.trim()),n(e)}),[l,h,p,v,d,n]);return(0,_.jsxs)("div",{className:"mailpoet-listing mailpoet-logs",children:[(0,_.jsxs)("div",{className:"mailpoet-listing-header",children:[(0,_.jsxs)("div",{className:"mailpoet-listing-search",children:[(0,_.jsx)("label",{htmlFor:"search_input",className:"screen-reader-text",children:x.x.I18n.t("searchLabel")}),(0,_.jsx)(f.Input,{dimension:"small",iconStart:Ql.J,type:"search",id:"search_input",name:"s",onChange:e=>b(e.target.value),value:v,placeholder:x.x.I18n.t("searchLabel")})]}),(0,_.jsxs)("div",{className:"mailpoet-listing-filters",children:[`${x.x.I18n.t("from")}:`,(0,_.jsx)(kt,{dateFormat:"MMMM d, yyyy",onChange:w(c),maxDate:new Date,selected:l?(0,vs.default)(l):void 0,dimension:"small"}),`${x.x.I18n.t("to")}:`,(0,_.jsx)(kt,{dateFormat:"MMMM d, yyyy",onChange:w(u),maxDate:new Date,selected:d?(0,vs.default)(d):void 0,dimension:"small"})]}),(0,_.jsxs)("div",{className:"mailpoet-logs-limit",children:[(0,_.jsx)("label",{htmlFor:"offset_input",className:"screen-reader-text",children:x.x.I18n.t("offsetLabel")}),(0,_.jsx)(f.Input,{dimension:"small",id:"offset_input",name:"o",type:"number",onChange:e=>m(e.target.value),value:p,placeholder:x.x.I18n.t("offsetLabel")})]}),(0,_.jsxs)("div",{className:"mailpoet-logs-limit",children:[(0,_.jsx)("label",{htmlFor:"limit_input",className:"screen-reader-text",children:x.x.I18n.t("limitLabel")}),(0,_.jsx)(f.Input,{dimension:"small",id:"limit_input",name:"l",type:"number",onChange:e=>g(e.target.value),value:h,placeholder:x.x.I18n.t("limitLabel")})]}),(0,_.jsx)(f.Button,{dimension:"small",onClick:j,children:x.x.I18n.t("filter")})]}),(0,_.jsxs)("table",{className:"mailpoet-listing-table widefat striped",role:"grid",children:[(0,_.jsx)("thead",{children:(0,_.jsxs)("tr",{children:[(0,_.jsx)("th",{children:x.x.I18n.t("tableHeaderName")}),(0,_.jsx)("th",{children:x.x.I18n.t("tableHeaderMessage")}),(0,_.jsx)("th",{children:x.x.I18n.t("tableHeaderCreatedOn")})]})}),(0,_.jsx)("tbody",{children:t.map((e=>(0,_.jsx)(Jl,{log:e},`log-${e.id}`)))})]})]})}const tc=document.getElementById("mailpoet_logs_container");if(tc){const e=new URL(window.location.href);i.render((0,_.jsx)(ec,{logs:window.mailpoet_logs,originalFrom:e.searchParams.get("from"),originalTo:e.searchParams.get("to"),originalSearch:e.searchParams.get("search"),originalOffset:e.searchParams.get("offset"),originalLimit:e.searchParams.get("limit"),onFilter:t=>{e.searchParams.delete("from"),e.searchParams.delete("to"),e.searchParams.delete("search"),e.searchParams.delete("offset"),e.searchParams.delete("limit"),Object.entries(t).forEach((t=>{let[n,r]=t;e.searchParams.append(n,r)})),window.location.href=e.href}}),tc)}var nc=n(16468);function rc(e){let{onRequestClose:t}=e;const[n,r]=(0,y.useState)(!1);return p()((e=>{e(document).on("click",".notice .mailpoet-js-button-fix-this",(()=>{r(!0)}))})),(0,_.jsxs)(Te.k.Provider,{value:(0,Te.S)(window),children:[(0,_.jsx)(Le.w,{}),n&&(0,_.jsx)(nc.d,{onRequestClose:()=>{r(!1),t()}})]})}rc.defaultProps={onRequestClose:vt.noop};const ac=document.getElementById("mailpoet_set_from_address_modal");ac&&i.render((0,_.jsx)(rc,{onRequestClose:()=>{window.location.href.includes("?page=mailpoet-settings")&&window.location.reload()}}),ac);const sc=e=>(async e=>{if("MailPoet"!==x.x.mtaMethod)return!0;const t=await(async()=>"MailPoet"!==x.x.mtaMethod?[]:(await x.x.Ajax.post({api_version:x.x.apiVersion,endpoint:"mailer",action:"getVerifiedSenderDomains"})).data||[])(),n=(0,Mt.DA)(e);return-1!==t.indexOf(n)||-1!==(await(async()=>"MailPoet"!==x.x.mtaMethod?[]:(await x.x.Ajax.post({api_version:x.x.apiVersion,endpoint:"mailer",action:"getAuthorizedEmailAddresses"})).data||[])()).indexOf(e)})(e).then((e=>{if(!e)return x.x.Notice.error(x.x.I18n.t("mailerSendingNotResumedUnauthorized"),{scroll:!0}),x.x.trackEvent("Unauthorized email used",{"Unauthorized email source":"send"}),!1;x.x.Ajax.post({api_version:x.x.apiVersion,endpoint:"mailer",action:"resumeSending"}).done((()=>{x.x.Notice.success(x.x.I18n.t("mailerSendingResumedNotice"))})).fail((e=>{e.errors.length>0&&x.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}));p()((e=>{e(document).on("click",".notice .mailpoet-js-button-resume-sending",(e=>{sc(e.target.value)}))}));var ic=n(28438);const oc=e=>{const t=window.location.href.includes("?page=mailpoet-settings"),n=window.location.href.includes("?page=mailpoet-newsletters#/send");(e=>{const t=`${(0,Mt.HD)()||"some other"} page`;e&&e.type&&"email"===e.type?x.x.trackEvent("MSS in plugin authorize email",{"authorized email source":"modal","original page":t,wasSuccessful:"yes"}):e&&e.type&&"domain"===e.type&&x.x.trackEvent("MSS in plugin verify sender domain",{"verify sender domain source":"modal","original page":t,wasSuccessful:"yes"})})(e),(t||n)&&window.location.reload()};function lc(){const[e,t]=(0,y.useState)(""),[n,r]=(0,y.useState)("email");return(0,y.useEffect)((()=>{const e=e=>{var n,a,s,i;e.preventDefault();const o=String((null==e||null===(n=e.target)||void 0===n||null===(a=n.dataset)||void 0===a?void 0:a.email)||""),l=String((null==e||null===(s=e.target)||void 0===s||null===(i=s.dataset)||void 0===i?void 0:i.type)||"");r(l||"email"),t(o)};p()((t=>{t(document).on("click",".mailpoet-js-button-authorize-email-and-sender-domain",e)}))}),[]),(0,_.jsx)(_.Fragment,{children:e&&(0,_.jsx)(ic.h,{senderEmail:e,onRequestClose:()=>{t("")},onSuccessAction:oc,showSenderEmailTab:"email"===n,showSenderDomainTab:"domain"===n,initialTab:"domain"===n?"sender_domain":"sender_email"})})}const cc=document.getElementById("mailpoet_authorize_sender_email_modal");cc&&i.render((0,_.jsx)(lc,{}),cc)},87933:function(e,t){"use strict";function n(e,t){switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}}function r(e,t){switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}}var a={p:r,P:function(e,t){var a,s=e.match(/(P+)(p+)?/)||[],i=s[1],o=s[2];if(!o)return n(e,t);switch(i){case"P":a=t.dateTime({width:"short"});break;case"PP":a=t.dateTime({width:"medium"});break;case"PPP":a=t.dateTime({width:"long"});break;default:a=t.dateTime({width:"full"})}return a.replace("{{date}}",n(i,t)).replace("{{time}}",r(o,t))}};t.Z=a},78435:function(e,t,n){"use strict";function r(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}n.d(t,{Z:function(){return r}})},84327:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(78789),a=n(32275),s=n(4335),i=n(44438);function o(e){(0,i.Z)(1,arguments);var t=(0,s.Z)(e),n=new Date(0);n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0);var r=(0,a.Z)(n);return r}var l=6048e5;function c(e){(0,i.Z)(1,arguments);var t=(0,r.default)(e),n=(0,a.Z)(t).getTime()-o(t).getTime();return Math.round(n/l)+1}},4335:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(78789),a=n(44438),s=n(32275);function i(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getUTCFullYear(),i=new Date(0);i.setUTCFullYear(n+1,0,4),i.setUTCHours(0,0,0,0);var o=(0,s.Z)(i),l=new Date(0);l.setUTCFullYear(n,0,4),l.setUTCHours(0,0,0,0);var c=(0,s.Z)(l);return t.getTime()>=o.getTime()?n+1:t.getTime()>=c.getTime()?n:n-1}},27191:function(e,t,n){"use strict";n.d(t,{Z:function(){return d}});var r=n(78789),a=n(15290),s=n(40640),i=n(44438),o=n(66557);function l(e,t){(0,i.Z)(1,arguments);var n=t||{},r=n.locale,l=r&&r.options&&r.options.firstWeekContainsDate,c=null==l?1:(0,o.Z)(l),d=null==n.firstWeekContainsDate?c:(0,o.Z)(n.firstWeekContainsDate),u=(0,s.Z)(e,t),p=new Date(0);p.setUTCFullYear(u,0,d),p.setUTCHours(0,0,0,0);var m=(0,a.Z)(p,t);return m}var c=6048e5;function d(e,t){(0,i.Z)(1,arguments);var n=(0,r.default)(e),s=(0,a.Z)(n,t).getTime()-l(n,t).getTime();return Math.round(s/c)+1}},40640:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(78789),a=n(44438),s=n(15290),i=n(66557);function o(e,t){(0,a.Z)(1,arguments);var n=(0,r.default)(e),o=n.getUTCFullYear(),l=t||{},c=l.locale,d=c&&c.options&&c.options.firstWeekContainsDate,u=null==d?1:(0,i.Z)(d),p=null==l.firstWeekContainsDate?u:(0,i.Z)(l.firstWeekContainsDate);if(!(p>=1&&p<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var m=new Date(0);m.setUTCFullYear(o+1,0,p),m.setUTCHours(0,0,0,0);var h=(0,s.Z)(m,t),f=new Date(0);f.setUTCFullYear(o,0,p),f.setUTCHours(0,0,0,0);var g=(0,s.Z)(f,t);return n.getTime()>=h.getTime()?o+1:n.getTime()>=g.getTime()?o:o-1}},28135:function(e,t,n){"use strict";n.d(t,{Do:function(){return i},Iu:function(){return s},qp:function(){return o}});var r=["D","DD"],a=["YY","YYYY"];function s(e){return-1!==r.indexOf(e)}function i(e){return-1!==a.indexOf(e)}function o(e,t,n){if("YYYY"===e)throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://git.io/fxCyr"));if("YY"===e)throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://git.io/fxCyr"));if("D"===e)throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://git.io/fxCyr"));if("DD"===e)throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://git.io/fxCyr"))}},32275:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var r=n(78789),a=n(44438);function s(e){(0,a.Z)(1,arguments);var t=1,n=(0,r.default)(e),s=n.getUTCDay(),i=(s<t?7:0)+s-t;return n.setUTCDate(n.getUTCDate()-i),n.setUTCHours(0,0,0,0),n}},15290:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(78789),a=n(44438),s=n(66557);function i(e,t){(0,a.Z)(1,arguments);var n=t||{},i=n.locale,o=i&&i.options&&i.options.weekStartsOn,l=null==o?0:(0,s.Z)(o),c=null==n.weekStartsOn?l:(0,s.Z)(n.weekStartsOn);if(!(c>=0&&c<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var d=(0,r.default)(e),u=d.getUTCDay(),p=(u<c?7:0)+u-c;return d.setUTCDate(d.getUTCDate()-p),d.setUTCHours(0,0,0,0),d}},71050:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var r=n(66557),a=n(47010),s=n(44438),i=36e5;function o(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.Z)(e,n*i)}},47010:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(66557),a=n(78789),s=n(44438);function i(e,t){(0,s.Z)(2,arguments);var n=(0,a.default)(e).getTime(),i=(0,r.Z)(t);return new Date(n+i)}},94392:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(66557),a=n(47010),s=n(44438);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.Z)(e,6e4*n)}},84613:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(66557),a=n(78789),s=n(44438);function i(e,t){(0,s.Z)(2,arguments);var n=(0,a.default)(e),i=(0,r.Z)(t);if(isNaN(i))return new Date(NaN);if(!i)return n;var o=n.getDate(),l=new Date(n.getTime());l.setMonth(n.getMonth()+i+1,0);var c=l.getDate();return o>=c?l:(n.setFullYear(l.getFullYear(),l.getMonth(),o),n)}},90806:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(66557),a=n(63703),s=n(44438);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t),i=7*n;return(0,a.default)(e,i)}},31247:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(66557),a=n(84613),s=n(44438);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.default)(e,12*n)}},31213:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var r=n(78435),a=n(81793),s=n(44438),i=864e5;function o(e,t){(0,s.Z)(2,arguments);var n=(0,a.default)(e),o=(0,a.default)(t),l=n.getTime()-(0,r.Z)(n),c=o.getTime()-(0,r.Z)(o);return Math.round((l-c)/i)}},46418:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t),i=n.getFullYear()-s.getFullYear(),o=n.getMonth()-s.getMonth();return 12*i+o}},27088:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var r=n(72611),a=n(78435),s=n(44438),i=6048e5;function o(e,t,n){(0,s.Z)(2,arguments);var o=(0,r.default)(e,n),l=(0,r.default)(t,n),c=o.getTime()-(0,a.Z)(o),d=l.getTime()-(0,a.Z)(l);return Math.round((c-d)/i)}},86854:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t);return n.getFullYear()-s.getFullYear()}},68392:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e);return t.setHours(23,59,59,999),t}},48216:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}},82296:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(78789),a=n(66557),s=n(44438);function i(e,t){(0,s.Z)(1,arguments);var n=t||{},i=n.locale,o=i&&i.options&&i.options.weekStartsOn,l=null==o?0:(0,a.Z)(o),c=null==n.weekStartsOn?l:(0,a.Z)(n.weekStartsOn);if(!(c>=0&&c<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var d=(0,r.default)(e),u=d.getDay(),p=6+(u<c?-7:0)-(u-c);return d.setDate(d.getDate()+p),d.setHours(23,59,59,999),d}},95822:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return M}});var r=n(47612),a=n(60016),s=n(59719),i=n(78789),o=n(44438),l=864e5,c=n(84327),d=n(4335),u=n(27191),p=n(40640);function m(e,t){for(var n=e<0?"-":"",r=Math.abs(e).toString();r.length<t;)r="0"+r;return n+r}var h=function(e,t){var n=e.getUTCFullYear(),r=n>0?n:1-n;return m("yy"===t?r%100:r,t.length)},f=function(e,t){var n=e.getUTCMonth();return"M"===t?String(n+1):m(n+1,2)},g=function(e,t){return m(e.getUTCDate(),t.length)},x=function(e,t){return m(e.getUTCHours()%12||12,t.length)},v=function(e,t){return m(e.getUTCHours(),t.length)},b=function(e,t){return m(e.getUTCMinutes(),t.length)},y=function(e,t){return m(e.getUTCSeconds(),t.length)},w=function(e,t){var n=t.length,r=e.getUTCMilliseconds();return m(Math.floor(r*Math.pow(10,n-3)),t.length)},_={G:function(e,t,n){var r=e.getUTCFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if("yo"===t){var r=e.getUTCFullYear(),a=r>0?r:1-r;return n.ordinalNumber(a,{unit:"year"})}return h(e,t)},Y:function(e,t,n,r){var a=(0,p.Z)(e,r),s=a>0?a:1-a;return"YY"===t?m(s%100,2):"Yo"===t?n.ordinalNumber(s,{unit:"year"}):m(s,t.length)},R:function(e,t){return m((0,d.Z)(e),t.length)},u:function(e,t){return m(e.getUTCFullYear(),t.length)},Q:function(e,t,n){var r=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return m(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){var r=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return m(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){var r=e.getUTCMonth();switch(t){case"M":case"MM":return f(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){var r=e.getUTCMonth();switch(t){case"L":return String(r+1);case"LL":return m(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){var a=(0,u.Z)(e,r);return"wo"===t?n.ordinalNumber(a,{unit:"week"}):m(a,t.length)},I:function(e,t,n){var r=(0,c.Z)(e);return"Io"===t?n.ordinalNumber(r,{unit:"week"}):m(r,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getUTCDate(),{unit:"date"}):g(e,t)},D:function(e,t,n){var r=function(e){(0,o.Z)(1,arguments);var t=(0,i.default)(e),n=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var r=t.getTime(),a=n-r;return Math.floor(a/l)+1}(e);return"Do"===t?n.ordinalNumber(r,{unit:"dayOfYear"}):m(r,t.length)},E:function(e,t,n){var r=e.getUTCDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){var a=e.getUTCDay(),s=(a-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(s);case"ee":return m(s,2);case"eo":return n.ordinalNumber(s,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){var a=e.getUTCDay(),s=(a-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(s);case"cc":return m(s,t.length);case"co":return n.ordinalNumber(s,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,n){var r=e.getUTCDay(),a=0===r?7:r;switch(t){case"i":return String(a);case"ii":return m(a,t.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){var r=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(e,t,n){var r,a=e.getUTCHours();switch(r=12===a?"noon":0===a?"midnight":a/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(e,t,n){var r,a=e.getUTCHours();switch(r=a>=17?"evening":a>=12?"afternoon":a>=4?"morning":"night",t){case"B":case"BB":case"BBB":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){var r=e.getUTCHours()%12;return 0===r&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return x(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getUTCHours(),{unit:"hour"}):v(e,t)},K:function(e,t,n){var r=e.getUTCHours()%12;return"Ko"===t?n.ordinalNumber(r,{unit:"hour"}):m(r,t.length)},k:function(e,t,n){var r=e.getUTCHours();return 0===r&&(r=24),"ko"===t?n.ordinalNumber(r,{unit:"hour"}):m(r,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):b(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):y(e,t)},S:function(e,t){return w(e,t)},X:function(e,t,n,r){var a=(r._originalDate||e).getTimezoneOffset();if(0===a)return"Z";switch(t){case"X":return S(a);case"XXXX":case"XX":return I(a);default:return I(a,":")}},x:function(e,t,n,r){var a=(r._originalDate||e).getTimezoneOffset();switch(t){case"x":return S(a);case"xxxx":case"xx":return I(a);default:return I(a,":")}},O:function(e,t,n,r){var a=(r._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+j(a,":");default:return"GMT"+I(a,":")}},z:function(e,t,n,r){var a=(r._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+j(a,":");default:return"GMT"+I(a,":")}},t:function(e,t,n,r){var a=r._originalDate||e;return m(Math.floor(a.getTime()/1e3),t.length)},T:function(e,t,n,r){return m((r._originalDate||e).getTime(),t.length)}};function j(e,t){var n=e>0?"-":"+",r=Math.abs(e),a=Math.floor(r/60),s=r%60;if(0===s)return n+String(a);var i=t||"";return n+String(a)+i+m(s,2)}function S(e,t){return e%60==0?(e>0?"-":"+")+m(Math.abs(e)/60,2):I(e,t)}function I(e,t){var n=t||"",r=e>0?"-":"+",a=Math.abs(e);return r+m(Math.floor(a/60),2)+n+m(a%60,2)}var C=_,T=n(87933),k=n(78435),N=n(28135),D=n(66557),E=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,A=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,O=/^'([^]*?)'?$/,R=/''/g,P=/[a-zA-Z]/;function M(e,t,n){(0,o.Z)(2,arguments);var l=String(t),c=n||{},d=c.locale||a.Z,u=d.options&&d.options.firstWeekContainsDate,p=null==u?1:(0,D.Z)(u),m=null==c.firstWeekContainsDate?p:(0,D.Z)(c.firstWeekContainsDate);if(!(m>=1&&m<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var h=d.options&&d.options.weekStartsOn,f=null==h?0:(0,D.Z)(h),g=null==c.weekStartsOn?f:(0,D.Z)(c.weekStartsOn);if(!(g>=0&&g<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!d.localize)throw new RangeError("locale must contain localize property");if(!d.formatLong)throw new RangeError("locale must contain formatLong property");var x=(0,i.default)(e);if(!(0,r.default)(x))throw new RangeError("Invalid time value");var v=(0,k.Z)(x),b=(0,s.Z)(x,v),y={firstWeekContainsDate:m,weekStartsOn:g,locale:d,_originalDate:x},w=l.match(A).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,T.Z[t])(e,d.formatLong,y):e})).join("").match(E).map((function(n){if("''"===n)return"'";var r=n[0];if("'"===r)return L(n);var a=C[r];if(a)return!c.useAdditionalWeekYearTokens&&(0,N.Do)(n)&&(0,N.qp)(n,t,e),!c.useAdditionalDayOfYearTokens&&(0,N.Iu)(n)&&(0,N.qp)(n,t,e),a(b,n,d.localize,y);if(r.match(P))throw new RangeError("Format string contains an unescaped latin alphabet character `"+r+"`");return n})).join("");return w}function L(e){return e.match(O)[1].replace(R,"'")}},33184:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getDate();return n}},32097:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getDay();return n}},42370:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getHours();return n}},84097:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return d}});var r=n(78789),a=n(72611),s=n(44438);function i(e){return(0,s.Z)(1,arguments),(0,a.default)(e,{weekStartsOn:1})}function o(e){(0,s.Z)(1,arguments);var t=(0,r.default)(e),n=t.getFullYear(),a=new Date(0);a.setFullYear(n+1,0,4),a.setHours(0,0,0,0);var o=i(a),l=new Date(0);l.setFullYear(n,0,4),l.setHours(0,0,0,0);var c=i(l);return t.getTime()>=o.getTime()?n+1:t.getTime()>=c.getTime()?n:n-1}function l(e){(0,s.Z)(1,arguments);var t=o(e),n=new Date(0);n.setFullYear(t,0,4),n.setHours(0,0,0,0);var r=i(n);return r}var c=6048e5;function d(e){(0,s.Z)(1,arguments);var t=(0,r.default)(e),n=i(t).getTime()-l(t).getTime();return Math.round(n/c)+1}},91352:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getMinutes();return n}},66821:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getMonth();return n}},12838:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=Math.floor(t.getMonth()/3)+1;return n}},54909:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getSeconds();return n}},31359:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getTime();return n}},42384:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e){return(0,a.Z)(1,arguments),(0,r.default)(e).getFullYear()}},40538:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t);return n.getTime()>s.getTime()}},94326:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t);return n.getTime()<s.getTime()}},27930:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return a}});var r=n(44438);function a(e){return(0,r.Z)(1,arguments),e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e)}},4820:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t);return n.getTime()===s.getTime()}},72986:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(81793),a=n(44438);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t);return n.getTime()===s.getTime()}},51467:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t);return n.getFullYear()===s.getFullYear()&&n.getMonth()===s.getMonth()}},41667:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(27747),a=n(44438);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t);return n.getTime()===s.getTime()}},99114:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t);return n.getFullYear()===s.getFullYear()}},47612:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(27930),a=n(78789),s=n(44438);function i(e){if((0,s.Z)(1,arguments),!(0,r.default)(e)&&"number"!=typeof e)return!1;var t=(0,a.default)(e);return!isNaN(Number(t))}},34256:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e).getTime(),s=(0,r.default)(t.start).getTime(),i=(0,r.default)(t.end).getTime();if(!(s<=i))throw new RangeError("Invalid interval");return n>=s&&n<=i}},60016:function(e,t,n){"use strict";n.d(t,{Z:function(){return h}});var r={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function a(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth,r=e.formats[n]||e.formats[e.defaultWidth];return r}}var s={date:a({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:a({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:a({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},i={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function o(e){return function(t,n){var r,a=n||{};if("formatting"===(a.context?String(a.context):"standalone")&&e.formattingValues){var s=e.defaultFormattingWidth||e.defaultWidth,i=a.width?String(a.width):s;r=e.formattingValues[i]||e.formattingValues[s]}else{var o=e.defaultWidth,l=a.width?String(a.width):e.defaultWidth;r=e.values[l]||e.values[o]}return r[e.argumentCallback?e.argumentCallback(t):t]}}var l={ordinalNumber:function(e,t){var n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:o({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:o({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:function(e){return e-1}}),month:o({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:o({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:o({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})};function c(e){return function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.width,a=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],s=t.match(a);if(!s)return null;var i,o=s[0],l=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?u(l,(function(e){return e.test(o)})):d(l,(function(e){return e.test(o)}));i=e.valueCallback?e.valueCallback(c):c,i=n.valueCallback?n.valueCallback(i):i;var p=t.slice(o.length);return{value:i,rest:p}}}function d(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n}function u(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return n}var p,m={ordinalNumber:(p={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}},function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.match(p.matchPattern);if(!n)return null;var r=n[0],a=e.match(p.parsePattern);if(!a)return null;var s=p.valueCallback?p.valueCallback(a[0]):a[0];s=t.valueCallback?t.valueCallback(s):s;var i=e.slice(r.length);return{value:s,rest:i}}),era:c({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:c({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:c({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:c({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:c({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},h={code:"en-US",formatDistance:function(e,t,n){var a,s=r[e];return a="string"==typeof s?s:1===t?s.one:s.other.replace("{{count}}",t.toString()),null!=n&&n.addSuffix?n.comparison&&n.comparison>0?"in "+a:a+" ago":a},formatLong:s,formatRelative:function(e,t,n,r){return i[e]},localize:l,match:m,options:{weekStartsOn:0,firstWeekContainsDate:1}}},82399:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e){var t,n;if((0,a.Z)(1,arguments),e&&"function"==typeof e.forEach)t=e;else{if("object"!=typeof e||null===e)return new Date(NaN);t=Array.prototype.slice.call(e)}return t.forEach((function(e){var t=(0,r.default)(e);(void 0===n||n<t||isNaN(Number(t)))&&(n=t)})),n||new Date(NaN)}},1711:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e){var t,n;if((0,a.Z)(1,arguments),e&&"function"==typeof e.forEach)t=e;else{if("object"!=typeof e||null===e)return new Date(NaN);t=Array.prototype.slice.call(e)}return t.forEach((function(e){var t=(0,r.default)(e);(void 0===n||n>t||isNaN(t.getDate()))&&(n=t)})),n||new Date(NaN)}},84188:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return ie}});var r=n(60016),a=n(59719),s=n(78789);function i(e,t){if(null==e)throw new TypeError("assign requires that input parameter not be null or undefined");for(var n in t=t||{})Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}var o=n(87933),l=n(78435),c=n(28135),d=n(66557),u=n(40640),p=n(44438);function m(e,t,n){(0,p.Z)(2,arguments);var r=n||{},a=r.locale,i=a&&a.options&&a.options.weekStartsOn,o=null==i?0:(0,d.Z)(i),l=null==r.weekStartsOn?o:(0,d.Z)(r.weekStartsOn);if(!(l>=0&&l<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var c=(0,s.default)(e),u=(0,d.Z)(t),m=c.getUTCDay(),h=u%7,f=(h+7)%7,g=(f<l?7:0)+u-m;return c.setUTCDate(c.getUTCDate()+g),c}var h=n(84327),f=n(27191),g=n(32275),x=n(15290),v=/^(1[0-2]|0?\d)/,b=/^(3[0-1]|[0-2]?\d)/,y=/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,w=/^(5[0-3]|[0-4]?\d)/,_=/^(2[0-3]|[0-1]?\d)/,j=/^(2[0-4]|[0-1]?\d)/,S=/^(1[0-1]|0?\d)/,I=/^(1[0-2]|0?\d)/,C=/^[0-5]?\d/,T=/^[0-5]?\d/,k=/^\d/,N=/^\d{1,2}/,D=/^\d{1,3}/,E=/^\d{1,4}/,A=/^-?\d+/,O=/^-?\d/,R=/^-?\d{1,2}/,P=/^-?\d{1,3}/,M=/^-?\d{1,4}/,L=/^([+-])(\d{2})(\d{2})?|Z/,F=/^([+-])(\d{2})(\d{2})|Z/,q=/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,$=/^([+-])(\d{2}):(\d{2})|Z/,U=/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/;function Z(e,t,n){var r=t.match(e);if(!r)return null;var a=parseInt(r[0],10);return{value:n?n(a):a,rest:t.slice(r[0].length)}}function V(e,t){var n=t.match(e);return n?"Z"===n[0]?{value:0,rest:t.slice(1)}:{value:("+"===n[1]?1:-1)*(36e5*(n[2]?parseInt(n[2],10):0)+6e4*(n[3]?parseInt(n[3],10):0)+1e3*(n[5]?parseInt(n[5],10):0)),rest:t.slice(n[0].length)}:null}function W(e,t){return Z(A,e,t)}function Y(e,t,n){switch(e){case 1:return Z(k,t,n);case 2:return Z(N,t,n);case 3:return Z(D,t,n);case 4:return Z(E,t,n);default:return Z(new RegExp("^\\d{1,"+e+"}"),t,n)}}function B(e,t,n){switch(e){case 1:return Z(O,t,n);case 2:return Z(R,t,n);case 3:return Z(P,t,n);case 4:return Z(M,t,n);default:return Z(new RegExp("^-?\\d{1,"+e+"}"),t,n)}}function H(e){switch(e){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;default:return 0}}function z(e,t){var n,r=t>0,a=r?t:1-t;if(a<=50)n=e||100;else{var s=a+50;n=e+100*Math.floor(s/100)-(e>=s%100?100:0)}return r?n:1-n}var G=[31,28,31,30,31,30,31,31,30,31,30,31],K=[31,29,31,30,31,30,31,31,30,31,30,31];function Q(e){return e%400==0||e%4==0&&e%100!=0}var X={G:{priority:140,parse:function(e,t,n,r){switch(t){case"G":case"GG":case"GGG":return n.era(e,{width:"abbreviated"})||n.era(e,{width:"narrow"});case"GGGGG":return n.era(e,{width:"narrow"});default:return n.era(e,{width:"wide"})||n.era(e,{width:"abbreviated"})||n.era(e,{width:"narrow"})}},set:function(e,t,n,r){return t.era=n,e.setUTCFullYear(n,0,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["R","u","t","T"]},y:{priority:130,parse:function(e,t,n,r){var a=function(e){return{year:e,isTwoDigitYear:"yy"===t}};switch(t){case"y":return Y(4,e,a);case"yo":return n.ordinalNumber(e,{unit:"year",valueCallback:a});default:return Y(t.length,e,a)}},validate:function(e,t,n){return t.isTwoDigitYear||t.year>0},set:function(e,t,n,r){var a=e.getUTCFullYear();if(n.isTwoDigitYear){var s=z(n.year,a);return e.setUTCFullYear(s,0,1),e.setUTCHours(0,0,0,0),e}var i="era"in t&&1!==t.era?1-n.year:n.year;return e.setUTCFullYear(i,0,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","u","w","I","i","e","c","t","T"]},Y:{priority:130,parse:function(e,t,n,r){var a=function(e){return{year:e,isTwoDigitYear:"YY"===t}};switch(t){case"Y":return Y(4,e,a);case"Yo":return n.ordinalNumber(e,{unit:"year",valueCallback:a});default:return Y(t.length,e,a)}},validate:function(e,t,n){return t.isTwoDigitYear||t.year>0},set:function(e,t,n,r){var a=(0,u.Z)(e,r);if(n.isTwoDigitYear){var s=z(n.year,a);return e.setUTCFullYear(s,0,r.firstWeekContainsDate),e.setUTCHours(0,0,0,0),(0,x.Z)(e,r)}var i="era"in t&&1!==t.era?1-n.year:n.year;return e.setUTCFullYear(i,0,r.firstWeekContainsDate),e.setUTCHours(0,0,0,0),(0,x.Z)(e,r)},incompatibleTokens:["y","R","u","Q","q","M","L","I","d","D","i","t","T"]},R:{priority:130,parse:function(e,t,n,r){return B("R"===t?4:t.length,e)},set:function(e,t,n,r){var a=new Date(0);return a.setUTCFullYear(n,0,4),a.setUTCHours(0,0,0,0),(0,g.Z)(a)},incompatibleTokens:["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"]},u:{priority:130,parse:function(e,t,n,r){return B("u"===t?4:t.length,e)},set:function(e,t,n,r){return e.setUTCFullYear(n,0,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["G","y","Y","R","w","I","i","e","c","t","T"]},Q:{priority:120,parse:function(e,t,n,r){switch(t){case"Q":case"QQ":return Y(t.length,e);case"Qo":return n.ordinalNumber(e,{unit:"quarter"});case"QQQ":return n.quarter(e,{width:"abbreviated",context:"formatting"})||n.quarter(e,{width:"narrow",context:"formatting"});case"QQQQQ":return n.quarter(e,{width:"narrow",context:"formatting"});default:return n.quarter(e,{width:"wide",context:"formatting"})||n.quarter(e,{width:"abbreviated",context:"formatting"})||n.quarter(e,{width:"narrow",context:"formatting"})}},validate:function(e,t,n){return t>=1&&t<=4},set:function(e,t,n,r){return e.setUTCMonth(3*(n-1),1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"]},q:{priority:120,parse:function(e,t,n,r){switch(t){case"q":case"qq":return Y(t.length,e);case"qo":return n.ordinalNumber(e,{unit:"quarter"});case"qqq":return n.quarter(e,{width:"abbreviated",context:"standalone"})||n.quarter(e,{width:"narrow",context:"standalone"});case"qqqqq":return n.quarter(e,{width:"narrow",context:"standalone"});default:return n.quarter(e,{width:"wide",context:"standalone"})||n.quarter(e,{width:"abbreviated",context:"standalone"})||n.quarter(e,{width:"narrow",context:"standalone"})}},validate:function(e,t,n){return t>=1&&t<=4},set:function(e,t,n,r){return e.setUTCMonth(3*(n-1),1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"]},M:{priority:110,parse:function(e,t,n,r){var a=function(e){return e-1};switch(t){case"M":return Z(v,e,a);case"MM":return Y(2,e,a);case"Mo":return n.ordinalNumber(e,{unit:"month",valueCallback:a});case"MMM":return n.month(e,{width:"abbreviated",context:"formatting"})||n.month(e,{width:"narrow",context:"formatting"});case"MMMMM":return n.month(e,{width:"narrow",context:"formatting"});default:return n.month(e,{width:"wide",context:"formatting"})||n.month(e,{width:"abbreviated",context:"formatting"})||n.month(e,{width:"narrow",context:"formatting"})}},validate:function(e,t,n){return t>=0&&t<=11},set:function(e,t,n,r){return e.setUTCMonth(n,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]},L:{priority:110,parse:function(e,t,n,r){var a=function(e){return e-1};switch(t){case"L":return Z(v,e,a);case"LL":return Y(2,e,a);case"Lo":return n.ordinalNumber(e,{unit:"month",valueCallback:a});case"LLL":return n.month(e,{width:"abbreviated",context:"standalone"})||n.month(e,{width:"narrow",context:"standalone"});case"LLLLL":return n.month(e,{width:"narrow",context:"standalone"});default:return n.month(e,{width:"wide",context:"standalone"})||n.month(e,{width:"abbreviated",context:"standalone"})||n.month(e,{width:"narrow",context:"standalone"})}},validate:function(e,t,n){return t>=0&&t<=11},set:function(e,t,n,r){return e.setUTCMonth(n,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","Q","M","w","I","D","i","e","c","t","T"]},w:{priority:100,parse:function(e,t,n,r){switch(t){case"w":return Z(w,e);case"wo":return n.ordinalNumber(e,{unit:"week"});default:return Y(t.length,e)}},validate:function(e,t,n){return t>=1&&t<=53},set:function(e,t,n,r){return(0,x.Z)(function(e,t,n){(0,p.Z)(2,arguments);var r=(0,s.default)(e),a=(0,d.Z)(t),i=(0,f.Z)(r,n)-a;return r.setUTCDate(r.getUTCDate()-7*i),r}(e,n,r),r)},incompatibleTokens:["y","R","u","q","Q","M","L","I","d","D","i","t","T"]},I:{priority:100,parse:function(e,t,n,r){switch(t){case"I":return Z(w,e);case"Io":return n.ordinalNumber(e,{unit:"week"});default:return Y(t.length,e)}},validate:function(e,t,n){return t>=1&&t<=53},set:function(e,t,n,r){return(0,g.Z)(function(e,t){(0,p.Z)(2,arguments);var n=(0,s.default)(e),r=(0,d.Z)(t),a=(0,h.Z)(n)-r;return n.setUTCDate(n.getUTCDate()-7*a),n}(e,n,r),r)},incompatibleTokens:["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"]},d:{priority:90,subPriority:1,parse:function(e,t,n,r){switch(t){case"d":return Z(b,e);case"do":return n.ordinalNumber(e,{unit:"date"});default:return Y(t.length,e)}},validate:function(e,t,n){var r=Q(e.getUTCFullYear()),a=e.getUTCMonth();return r?t>=1&&t<=K[a]:t>=1&&t<=G[a]},set:function(e,t,n,r){return e.setUTCDate(n),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","Q","w","I","D","i","e","c","t","T"]},D:{priority:90,subPriority:1,parse:function(e,t,n,r){switch(t){case"D":case"DD":return Z(y,e);case"Do":return n.ordinalNumber(e,{unit:"date"});default:return Y(t.length,e)}},validate:function(e,t,n){return Q(e.getUTCFullYear())?t>=1&&t<=366:t>=1&&t<=365},set:function(e,t,n,r){return e.setUTCMonth(0,n),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"]},E:{priority:90,parse:function(e,t,n,r){switch(t){case"E":case"EE":case"EEE":return n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"EEEEE":return n.day(e,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});default:return n.day(e,{width:"wide",context:"formatting"})||n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"})}},validate:function(e,t,n){return t>=0&&t<=6},set:function(e,t,n,r){return(e=m(e,n,r)).setUTCHours(0,0,0,0),e},incompatibleTokens:["D","i","e","c","t","T"]},e:{priority:90,parse:function(e,t,n,r){var a=function(e){var t=7*Math.floor((e-1)/7);return(e+r.weekStartsOn+6)%7+t};switch(t){case"e":case"ee":return Y(t.length,e,a);case"eo":return n.ordinalNumber(e,{unit:"day",valueCallback:a});case"eee":return n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"eeeee":return n.day(e,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});default:return n.day(e,{width:"wide",context:"formatting"})||n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"})}},validate:function(e,t,n){return t>=0&&t<=6},set:function(e,t,n,r){return(e=m(e,n,r)).setUTCHours(0,0,0,0),e},incompatibleTokens:["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"]},c:{priority:90,parse:function(e,t,n,r){var a=function(e){var t=7*Math.floor((e-1)/7);return(e+r.weekStartsOn+6)%7+t};switch(t){case"c":case"cc":return Y(t.length,e,a);case"co":return n.ordinalNumber(e,{unit:"day",valueCallback:a});case"ccc":return n.day(e,{width:"abbreviated",context:"standalone"})||n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"});case"ccccc":return n.day(e,{width:"narrow",context:"standalone"});case"cccccc":return n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"});default:return n.day(e,{width:"wide",context:"standalone"})||n.day(e,{width:"abbreviated",context:"standalone"})||n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"})}},validate:function(e,t,n){return t>=0&&t<=6},set:function(e,t,n,r){return(e=m(e,n,r)).setUTCHours(0,0,0,0),e},incompatibleTokens:["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"]},i:{priority:90,parse:function(e,t,n,r){var a=function(e){return 0===e?7:e};switch(t){case"i":case"ii":return Y(t.length,e);case"io":return n.ordinalNumber(e,{unit:"day"});case"iii":return n.day(e,{width:"abbreviated",context:"formatting",valueCallback:a})||n.day(e,{width:"short",context:"formatting",valueCallback:a})||n.day(e,{width:"narrow",context:"formatting",valueCallback:a});case"iiiii":return n.day(e,{width:"narrow",context:"formatting",valueCallback:a});case"iiiiii":return n.day(e,{width:"short",context:"formatting",valueCallback:a})||n.day(e,{width:"narrow",context:"formatting",valueCallback:a});default:return n.day(e,{width:"wide",context:"formatting",valueCallback:a})||n.day(e,{width:"abbreviated",context:"formatting",valueCallback:a})||n.day(e,{width:"short",context:"formatting",valueCallback:a})||n.day(e,{width:"narrow",context:"formatting",valueCallback:a})}},validate:function(e,t,n){return t>=1&&t<=7},set:function(e,t,n,r){return e=function(e,t){(0,p.Z)(2,arguments);var n=(0,d.Z)(t);n%7==0&&(n-=7);var r=1,a=(0,s.default)(e),i=a.getUTCDay(),o=((n%7+7)%7<r?7:0)+n-i;return a.setUTCDate(a.getUTCDate()+o),a}(e,n,r),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"]},a:{priority:80,parse:function(e,t,n,r){switch(t){case"a":case"aa":case"aaa":return n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaaa":return n.dayPeriod(e,{width:"narrow",context:"formatting"});default:return n.dayPeriod(e,{width:"wide",context:"formatting"})||n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"})}},set:function(e,t,n,r){return e.setUTCHours(H(n),0,0,0),e},incompatibleTokens:["b","B","H","k","t","T"]},b:{priority:80,parse:function(e,t,n,r){switch(t){case"b":case"bb":case"bbb":return n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbbb":return n.dayPeriod(e,{width:"narrow",context:"formatting"});default:return n.dayPeriod(e,{width:"wide",context:"formatting"})||n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"})}},set:function(e,t,n,r){return e.setUTCHours(H(n),0,0,0),e},incompatibleTokens:["a","B","H","k","t","T"]},B:{priority:80,parse:function(e,t,n,r){switch(t){case"B":case"BB":case"BBB":return n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBBB":return n.dayPeriod(e,{width:"narrow",context:"formatting"});default:return n.dayPeriod(e,{width:"wide",context:"formatting"})||n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"})}},set:function(e,t,n,r){return e.setUTCHours(H(n),0,0,0),e},incompatibleTokens:["a","b","t","T"]},h:{priority:70,parse:function(e,t,n,r){switch(t){case"h":return Z(I,e);case"ho":return n.ordinalNumber(e,{unit:"hour"});default:return Y(t.length,e)}},validate:function(e,t,n){return t>=1&&t<=12},set:function(e,t,n,r){var a=e.getUTCHours()>=12;return a&&n<12?e.setUTCHours(n+12,0,0,0):a||12!==n?e.setUTCHours(n,0,0,0):e.setUTCHours(0,0,0,0),e},incompatibleTokens:["H","K","k","t","T"]},H:{priority:70,parse:function(e,t,n,r){switch(t){case"H":return Z(_,e);case"Ho":return n.ordinalNumber(e,{unit:"hour"});default:return Y(t.length,e)}},validate:function(e,t,n){return t>=0&&t<=23},set:function(e,t,n,r){return e.setUTCHours(n,0,0,0),e},incompatibleTokens:["a","b","h","K","k","t","T"]},K:{priority:70,parse:function(e,t,n,r){switch(t){case"K":return Z(S,e);case"Ko":return n.ordinalNumber(e,{unit:"hour"});default:return Y(t.length,e)}},validate:function(e,t,n){return t>=0&&t<=11},set:function(e,t,n,r){return e.getUTCHours()>=12&&n<12?e.setUTCHours(n+12,0,0,0):e.setUTCHours(n,0,0,0),e},incompatibleTokens:["h","H","k","t","T"]},k:{priority:70,parse:function(e,t,n,r){switch(t){case"k":return Z(j,e);case"ko":return n.ordinalNumber(e,{unit:"hour"});default:return Y(t.length,e)}},validate:function(e,t,n){return t>=1&&t<=24},set:function(e,t,n,r){var a=n<=24?n%24:n;return e.setUTCHours(a,0,0,0),e},incompatibleTokens:["a","b","h","H","K","t","T"]},m:{priority:60,parse:function(e,t,n,r){switch(t){case"m":return Z(C,e);case"mo":return n.ordinalNumber(e,{unit:"minute"});default:return Y(t.length,e)}},validate:function(e,t,n){return t>=0&&t<=59},set:function(e,t,n,r){return e.setUTCMinutes(n,0,0),e},incompatibleTokens:["t","T"]},s:{priority:50,parse:function(e,t,n,r){switch(t){case"s":return Z(T,e);case"so":return n.ordinalNumber(e,{unit:"second"});default:return Y(t.length,e)}},validate:function(e,t,n){return t>=0&&t<=59},set:function(e,t,n,r){return e.setUTCSeconds(n,0),e},incompatibleTokens:["t","T"]},S:{priority:30,parse:function(e,t,n,r){return Y(t.length,e,(function(e){return Math.floor(e*Math.pow(10,3-t.length))}))},set:function(e,t,n,r){return e.setUTCMilliseconds(n),e},incompatibleTokens:["t","T"]},X:{priority:10,parse:function(e,t,n,r){switch(t){case"X":return V(L,e);case"XX":return V(F,e);case"XXXX":return V(q,e);case"XXXXX":return V(U,e);default:return V($,e)}},set:function(e,t,n,r){return t.timestampIsSet?e:new Date(e.getTime()-n)},incompatibleTokens:["t","T","x"]},x:{priority:10,parse:function(e,t,n,r){switch(t){case"x":return V(L,e);case"xx":return V(F,e);case"xxxx":return V(q,e);case"xxxxx":return V(U,e);default:return V($,e)}},set:function(e,t,n,r){return t.timestampIsSet?e:new Date(e.getTime()-n)},incompatibleTokens:["t","T","X"]},t:{priority:40,parse:function(e,t,n,r){return W(e)},set:function(e,t,n,r){return[new Date(1e3*n),{timestampIsSet:!0}]},incompatibleTokens:"*"},T:{priority:20,parse:function(e,t,n,r){return W(e)},set:function(e,t,n,r){return[new Date(n),{timestampIsSet:!0}]},incompatibleTokens:"*"}},J=X,ee=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,te=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,ne=/^'([^]*?)'?$/,re=/''/g,ae=/\S/,se=/[a-zA-Z]/;function ie(e,t,n,u){(0,p.Z)(3,arguments);var m=String(e),h=String(t),f=u||{},g=f.locale||r.Z;if(!g.match)throw new RangeError("locale must contain match property");var x=g.options&&g.options.firstWeekContainsDate,v=null==x?1:(0,d.Z)(x),b=null==f.firstWeekContainsDate?v:(0,d.Z)(f.firstWeekContainsDate);if(!(b>=1&&b<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var y=g.options&&g.options.weekStartsOn,w=null==y?0:(0,d.Z)(y),_=null==f.weekStartsOn?w:(0,d.Z)(f.weekStartsOn);if(!(_>=0&&_<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(""===h)return""===m?(0,s.default)(n):new Date(NaN);var j,S={firstWeekContainsDate:b,weekStartsOn:_,locale:g},I=[{priority:10,subPriority:-1,set:oe,index:0}],C=h.match(te).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,o.Z[t])(e,g.formatLong,S):e})).join("").match(ee),T=[];for(j=0;j<C.length;j++){var k=C[j];!f.useAdditionalWeekYearTokens&&(0,c.Do)(k)&&(0,c.qp)(k,h,e),!f.useAdditionalDayOfYearTokens&&(0,c.Iu)(k)&&(0,c.qp)(k,h,e);var N=k[0],D=J[N];if(D){var E=D.incompatibleTokens;if(Array.isArray(E)){for(var A=void 0,O=0;O<T.length;O++){var R=T[O].token;if(-1!==E.indexOf(R)||R===N){A=T[O];break}}if(A)throw new RangeError("The format string mustn't contain `".concat(A.fullToken,"` and `").concat(k,"` at the same time"))}else if("*"===D.incompatibleTokens&&T.length)throw new RangeError("The format string mustn't contain `".concat(k,"` and any other token at the same time"));T.push({token:N,fullToken:k});var P=D.parse(m,k,g.match,S);if(!P)return new Date(NaN);I.push({priority:D.priority,subPriority:D.subPriority||0,set:D.set,validate:D.validate,value:P.value,index:I.length}),m=P.rest}else{if(N.match(se))throw new RangeError("Format string contains an unescaped latin alphabet character `"+N+"`");if("''"===k?k="'":"'"===N&&(k=le(k)),0!==m.indexOf(k))return new Date(NaN);m=m.slice(k.length)}}if(m.length>0&&ae.test(m))return new Date(NaN);var M=I.map((function(e){return e.priority})).sort((function(e,t){return t-e})).filter((function(e,t,n){return n.indexOf(e)===t})).map((function(e){return I.filter((function(t){return t.priority===e})).sort((function(e,t){return t.subPriority-e.subPriority}))})).map((function(e){return e[0]})),L=(0,s.default)(n);if(isNaN(L))return new Date(NaN);var F=(0,a.Z)(L,(0,l.Z)(L)),q={};for(j=0;j<M.length;j++){var $=M[j];if($.validate&&!$.validate(F,$.value,S))return new Date(NaN);var U=$.set(F,q,$.value,S);U[0]?(F=U[0],i(q,U[1])):F=U}return F}function oe(e,t){if(t.timestampIsSet)return e;var n=new Date(0);return n.setFullYear(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()),n.setHours(e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()),n}function le(e){return e.match(ne)[1].replace(re,"'")}},30091:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(61600),a=n(44438),s=n(66557);function i(e,t){(0,a.Z)(1,arguments);var n=t||{},r=null==n.additionalDigits?2:(0,s.Z)(n.additionalDigits);if(2!==r&&1!==r&&0!==r)throw new RangeError("additionalDigits must be 0, 1 or 2");if("string"!=typeof e&&"[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);var i,o=u(e);if(o.date){var l=p(o.date,r);i=m(l.restDateString,l.year)}if(!i||isNaN(i.getTime()))return new Date(NaN);var c,d=i.getTime(),h=0;if(o.time&&(h=f(o.time),isNaN(h)))return new Date(NaN);if(!o.timezone){var g=new Date(d+h),v=new Date(0);return v.setFullYear(g.getUTCFullYear(),g.getUTCMonth(),g.getUTCDate()),v.setHours(g.getUTCHours(),g.getUTCMinutes(),g.getUTCSeconds(),g.getUTCMilliseconds()),v}return c=x(o.timezone),isNaN(c)?new Date(NaN):new Date(d+h+c)}var o={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},l=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,c=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,d=/^([+-])(\d{2})(?::?(\d{2}))?$/;function u(e){var t,n={},r=e.split(o.dateTimeDelimiter);if(r.length>2)return n;if(/:/.test(r[0])?t=r[0]:(n.date=r[0],t=r[1],o.timeZoneDelimiter.test(n.date)&&(n.date=e.split(o.timeZoneDelimiter)[0],t=e.substr(n.date.length,e.length))),t){var a=o.timezone.exec(t);a?(n.time=t.replace(a[1],""),n.timezone=a[1]):n.time=t}return n}function p(e,t){var n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),r=e.match(n);if(!r)return{year:NaN,restDateString:""};var a=r[1]?parseInt(r[1]):null,s=r[2]?parseInt(r[2]):null;return{year:null===s?a:100*s,restDateString:e.slice((r[1]||r[2]).length)}}function m(e,t){if(null===t)return new Date(NaN);var n=e.match(l);if(!n)return new Date(NaN);var r=!!n[4],a=h(n[1]),s=h(n[2])-1,i=h(n[3]),o=h(n[4]),c=h(n[5])-1;if(r)return function(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}(0,o,c)?function(e,t,n){var r=new Date(0);r.setUTCFullYear(e,0,4);var a=7*(t-1)+n+1-(r.getUTCDay()||7);return r.setUTCDate(r.getUTCDate()+a),r}(t,o,c):new Date(NaN);var d=new Date(0);return function(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(v[t]||(b(e)?29:28))}(t,s,i)&&function(e,t){return t>=1&&t<=(b(e)?366:365)}(t,a)?(d.setUTCFullYear(t,s,Math.max(a,i)),d):new Date(NaN)}function h(e){return e?parseInt(e):1}function f(e){var t=e.match(c);if(!t)return NaN;var n=g(t[1]),a=g(t[2]),s=g(t[3]);return function(e,t,n){return 24===e?0===t&&0===n:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}(n,a,s)?n*r.vh+a*r.yJ+1e3*s:NaN}function g(e){return e&&parseFloat(e.replace(",","."))||0}function x(e){if("Z"===e)return 0;var t=e.match(d);if(!t)return 0;var n="+"===t[1]?-1:1,a=parseInt(t[2]),s=t[3]&&parseInt(t[3])||0;return function(e,t){return t>=0&&t<=59}(0,s)?n*(a*r.vh+s*r.yJ):NaN}var v=[31,null,31,30,31,30,31,31,30,31,30,31];function b(e){return e%400==0||e%4==0&&e%100!=0}},47067:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(66557),a=n(78789),s=n(44438);function i(e,t){(0,s.Z)(2,arguments);var n=(0,a.default)(e),i=(0,r.Z)(t);return n.setHours(i),n}},6257:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(66557),a=n(78789),s=n(44438);function i(e,t){(0,s.Z)(2,arguments);var n=(0,a.default)(e),i=(0,r.Z)(t);return n.setMinutes(i),n}},28208:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var r=n(66557),a=n(78789),s=n(44438);function i(e){(0,s.Z)(1,arguments);var t=(0,a.default)(e),n=t.getFullYear(),r=t.getMonth(),i=new Date(0);return i.setFullYear(n,r+1,0),i.setHours(0,0,0,0),i.getDate()}function o(e,t){(0,s.Z)(2,arguments);var n=(0,a.default)(e),o=(0,r.Z)(t),l=n.getFullYear(),c=n.getDate(),d=new Date(0);d.setFullYear(l,o,15),d.setHours(0,0,0,0);var u=i(d);return n.setMonth(o,Math.min(c,u)),n}},5042:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var r=n(66557),a=n(78789),s=n(28208),i=n(44438);function o(e,t){(0,i.Z)(2,arguments);var n=(0,a.default)(e),o=(0,r.Z)(t),l=Math.floor(n.getMonth()/3)+1,c=o-l;return(0,s.default)(n,n.getMonth()+3*c)}},14603:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(66557),a=n(78789),s=n(44438);function i(e,t){(0,s.Z)(2,arguments);var n=(0,a.default)(e),i=(0,r.Z)(t);return n.setSeconds(i),n}},57006:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(66557),a=n(78789),s=n(44438);function i(e,t){(0,s.Z)(2,arguments);var n=(0,a.default)(e),i=(0,r.Z)(t);return isNaN(n.getTime())?new Date(NaN):(n.setFullYear(i),n)}},81793:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e);return t.setHours(0,0,0,0),t}},13167:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e);return t.setDate(1),t.setHours(0,0,0,0),t}},27747:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getMonth(),s=n-n%3;return t.setMonth(s,1),t.setHours(0,0,0,0),t}},72611:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(78789),a=n(66557),s=n(44438);function i(e,t){(0,s.Z)(1,arguments);var n=t||{},i=n.locale,o=i&&i.options&&i.options.weekStartsOn,l=null==o?0:(0,a.Z)(o),c=null==n.weekStartsOn?l:(0,a.Z)(n.weekStartsOn);if(!(c>=0&&c<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var d=(0,r.default)(e),u=d.getDay(),p=(u<c?7:0)+u-c;return d.setDate(d.getDate()-p),d.setHours(0,0,0,0),d}},19752:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=new Date(0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}},22836:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(66557),a=n(63703),s=n(44438);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.default)(e,-n)}},76508:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(66557),a=n(71050),s=n(44438);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.default)(e,-n)}},59719:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(66557),a=n(47010),s=n(44438);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.Z)(e,-n)}},79605:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(66557),a=n(94392),s=n(44438);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.default)(e,-n)}},76136:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(66557),a=n(84613),s=n(44438);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.default)(e,-n)}},83538:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(66557),a=n(90806),s=n(44438);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.default)(e,-n)}},35865:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(66557),a=n(31247),s=n(44438);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.default)(e,-n)}},29514:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(t,n){var r,a=n||{};if("formatting"===(a.context?String(a.context):"standalone")&&e.formattingValues){var s=e.defaultFormattingWidth||e.defaultWidth,i=a.width?String(a.width):s;r=e.formattingValues[i]||e.formattingValues[s]}else{var o=e.defaultWidth,l=a.width?String(a.width):e.defaultWidth;r=e.values[l]||e.values[o]}return r[e.argumentCallback?e.argumentCallback(t):t]}},e.exports=t.default},71906:function(e,t){var n,r;n=function e(){"use strict";var t="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==t?t:{},n=!t.document&&!!t.postMessage,r=n&&/blob:/i.test((t.location||{}).protocol),a={},s=0,i={parse:function(n,r){var o=(r=r||{}).dynamicTyping||!1;if(w(o)&&(r.dynamicTypingFunction=o,o={}),r.dynamicTyping=o,r.transform=!!w(r.transform)&&r.transform,r.worker&&i.WORKERS_SUPPORTED){var l=function(){if(!i.WORKERS_SUPPORTED)return!1;var n,r,o=(n=t.URL||t.webkitURL||null,r=e.toString(),i.BLOB_URL||(i.BLOB_URL=n.createObjectURL(new Blob(["(",r,")();"],{type:"text/javascript"})))),l=new t.Worker(o);return l.onmessage=g,l.id=s++,a[l.id]=l}();return l.userStep=r.step,l.userChunk=r.chunk,l.userComplete=r.complete,l.userError=r.error,r.step=w(r.step),r.chunk=w(r.chunk),r.complete=w(r.complete),r.error=w(r.error),delete r.worker,void l.postMessage({input:n,config:r,workerId:l.id})}var m=null;return i.NODE_STREAM_INPUT,"string"==typeof n?m=r.download?new c(r):new u(r):!0===n.readable&&w(n.read)&&w(n.on)?m=new p(r):(t.File&&n instanceof File||n instanceof Object)&&(m=new d(r)),m.stream(n)},unparse:function(e,t){var n=!1,r=!0,a=",",s="\r\n",o='"',l=o+o,c=!1,d=null,u=!1;!function(){if("object"==typeof t){if("string"!=typeof t.delimiter||i.BAD_DELIMITERS.filter((function(e){return-1!==t.delimiter.indexOf(e)})).length||(a=t.delimiter),("boolean"==typeof t.quotes||"function"==typeof t.quotes||Array.isArray(t.quotes))&&(n=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(c=t.skipEmptyLines),"string"==typeof t.newline&&(s=t.newline),"string"==typeof t.quoteChar&&(o=t.quoteChar),"boolean"==typeof t.header&&(r=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw new Error("Option columns is empty");d=t.columns}void 0!==t.escapeChar&&(l=t.escapeChar+o),("boolean"==typeof t.escapeFormulae||t.escapeFormulae instanceof RegExp)&&(u=t.escapeFormulae instanceof RegExp?t.escapeFormulae:/^[=+\-@\t\r].*$/)}}();var p=new RegExp(h(o),"g");if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return m(null,e,c);if("object"==typeof e[0])return m(d||Object.keys(e[0]),e,c)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||d),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),m(e.fields||[],e.data||[],c);throw new Error("Unable to serialize unrecognized input");function m(e,t,n){var i="";"string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t));var o=Array.isArray(e)&&0<e.length,l=!Array.isArray(t[0]);if(o&&r){for(var c=0;c<e.length;c++)0<c&&(i+=a),i+=f(e[c],c);0<t.length&&(i+=s)}for(var d=0;d<t.length;d++){var u=o?e.length:t[d].length,p=!1,m=o?0===Object.keys(t[d]).length:0===t[d].length;if(n&&!o&&(p="greedy"===n?""===t[d].join("").trim():1===t[d].length&&0===t[d][0].length),"greedy"===n&&o){for(var h=[],g=0;g<u;g++){var x=l?e[g]:g;h.push(t[d][x])}p=""===h.join("").trim()}if(!p){for(var v=0;v<u;v++){0<v&&!m&&(i+=a);var b=o&&l?e[v]:v;i+=f(t[d][b],v)}d<t.length-1&&(!n||0<u&&!m)&&(i+=s)}}return i}function f(e,t){if(null==e)return"";if(e.constructor===Date)return JSON.stringify(e).slice(1,25);var r=!1;u&&"string"==typeof e&&u.test(e)&&(e="'"+e,r=!0);var s=e.toString().replace(p,l);return(r=r||!0===n||"function"==typeof n&&n(e,t)||Array.isArray(n)&&n[t]||function(e,t){for(var n=0;n<t.length;n++)if(-1<e.indexOf(t[n]))return!0;return!1}(s,i.BAD_DELIMITERS)||-1<s.indexOf(a)||" "===s.charAt(0)||" "===s.charAt(s.length-1))?o+s+o:s}}};if(i.RECORD_SEP=String.fromCharCode(30),i.UNIT_SEP=String.fromCharCode(31),i.BYTE_ORDER_MARK="\ufeff",i.BAD_DELIMITERS=["\r","\n",'"',i.BYTE_ORDER_MARK],i.WORKERS_SUPPORTED=!n&&!!t.Worker,i.NODE_STREAM_INPUT=1,i.LocalChunkSize=10485760,i.RemoteChunkSize=5242880,i.DefaultDelimiter=",",i.Parser=f,i.ParserHandle=m,i.NetworkStreamer=c,i.FileStreamer=d,i.StringStreamer=u,i.ReadableStreamStreamer=p,t.jQuery){var o=t.jQuery;o.fn.parse=function(e){var n=e.config||{},r=[];return this.each((function(e){if("INPUT"!==o(this).prop("tagName").toUpperCase()||"file"!==o(this).attr("type").toLowerCase()||!t.FileReader||!this.files||0===this.files.length)return!0;for(var a=0;a<this.files.length;a++)r.push({file:this.files[a],inputElem:this,instanceConfig:o.extend({},n)})})),a(),this;function a(){if(0!==r.length){var t,n,a,l=r[0];if(w(e.before)){var c=e.before(l.file,l.inputElem);if("object"==typeof c){if("abort"===c.action)return"AbortError",t=l.file,n=l.inputElem,a=c.reason,void(w(e.error)&&e.error({name:"AbortError"},t,n,a));if("skip"===c.action)return void s();"object"==typeof c.config&&(l.instanceConfig=o.extend(l.instanceConfig,c.config))}else if("skip"===c)return void s()}var d=l.instanceConfig.complete;l.instanceConfig.complete=function(e){w(d)&&d(e,l.file,l.inputElem),s()},i.parse(l.file,l.instanceConfig)}else w(e.complete)&&e.complete()}function s(){r.splice(0,1),a()}}}function l(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},function(e){var t=b(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new m(t),(this._handle.streamer=this)._config=t}.call(this,e),this.parseChunk=function(e,n){if(this.isFirstChunk&&w(this._config.beforeFirstChunk)){var a=this._config.beforeFirstChunk(e);void 0!==a&&(e=a)}this.isFirstChunk=!1,this._halted=!1;var s=this._partialLine+e;this._partialLine="";var o=this._handle.parse(s,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var l=o.meta.cursor;this._finished||(this._partialLine=s.substring(l-this._baseIndex),this._baseIndex=l),o&&o.data&&(this._rowCount+=o.data.length);var c=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(r)t.postMessage({results:o,workerId:i.WORKER_ID,finished:c});else if(w(this._config.chunk)&&!n){if(this._config.chunk(o,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);o=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(o.data),this._completeResults.errors=this._completeResults.errors.concat(o.errors),this._completeResults.meta=o.meta),this._completed||!c||!w(this._config.complete)||o&&o.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),c||o&&o.meta.paused||this._nextChunk(),o}this._halted=!0},this._sendError=function(e){w(this._config.error)?this._config.error(e):r&&this._config.error&&t.postMessage({workerId:i.WORKER_ID,error:e,finished:!1})}}function c(e){var t;(e=e||{}).chunkSize||(e.chunkSize=i.RemoteChunkSize),l.call(this,e),this._nextChunk=n?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),n||(t.onload=y(this._chunkLoaded,this),t.onerror=y(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!n),this._config.downloadRequestHeaders){var e=this._config.downloadRequestHeaders;for(var r in e)t.setRequestHeader(r,e[r])}if(this._config.chunkSize){var a=this._start+this._config.chunkSize-1;t.setRequestHeader("Range","bytes="+this._start+"-"+a)}try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}n&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:t.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(e){var t=e.getResponseHeader("Content-Range");return null===t?-1:parseInt(t.substring(t.lastIndexOf("/")+1))}(t),this.parseChunk(t.responseText)))},this._chunkError=function(e){var n=t.statusText||e;this._sendError(new Error(n))}}function d(e){var t,n;(e=e||{}).chunkSize||(e.chunkSize=i.LocalChunkSize),l.call(this,e);var r="undefined"!=typeof FileReader;this.stream=function(e){this._input=e,n=e.slice||e.webkitSlice||e.mozSlice,r?((t=new FileReader).onload=y(this._chunkLoaded,this),t.onerror=y(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var e=this._input;if(this._config.chunkSize){var a=Math.min(this._start+this._config.chunkSize,this._input.size);e=n.call(e,this._start,a)}var s=t.readAsText(e,this._config.encoding);r||this._chunkLoaded({target:{result:s}})},this._chunkLoaded=function(e){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function u(e){var t;l.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var e,n=this._config.chunkSize;return n?(e=t.substring(0,n),t=t.substring(n)):(e=t,t=""),this._finished=!t,this.parseChunk(e)}}}function p(e){l.call(this,e=e||{});var t=[],n=!0,r=!1;this.pause=function(){l.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){l.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){r&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):n=!0},this._streamData=y((function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),n&&(n=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}}),this),this._streamError=y((function(e){this._streamCleanUp(),this._sendError(e)}),this),this._streamEnd=y((function(){this._streamCleanUp(),r=!0,this._streamData("")}),this),this._streamCleanUp=y((function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)}),this)}function m(e){var t,n,r,a=Math.pow(2,53),s=-a,o=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,l=/^(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))$/,c=this,d=0,u=0,p=!1,m=!1,g=[],x={data:[],errors:[],meta:{}};if(w(e.step)){var v=e.step;e.step=function(t){if(x=t,j())_();else{if(_(),0===x.data.length)return;d+=t.data.length,e.preview&&d>e.preview?n.abort():(x.data=x.data[0],v(x,c))}}}function y(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function _(){return x&&r&&(I("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+i.DefaultDelimiter+"'"),r=!1),e.skipEmptyLines&&(x.data=x.data.filter((function(e){return!y(e)}))),j()&&function(){if(x)if(Array.isArray(x.data[0])){for(var t=0;j()&&t<x.data.length;t++)x.data[t].forEach(n);x.data.splice(0,1)}else x.data.forEach(n);function n(t,n){w(e.transformHeader)&&(t=e.transformHeader(t,n)),g.push(t)}}(),function(){if(!x||!e.header&&!e.dynamicTyping&&!e.transform)return x;function t(t,n){var r,a=e.header?{}:[];for(r=0;r<t.length;r++){var s=r,i=t[r];e.header&&(s=r>=g.length?"__parsed_extra":g[r]),e.transform&&(i=e.transform(i,s)),i=S(s,i),"__parsed_extra"===s?(a[s]=a[s]||[],a[s].push(i)):a[s]=i}return e.header&&(r>g.length?I("FieldMismatch","TooManyFields","Too many fields: expected "+g.length+" fields but parsed "+r,u+n):r<g.length&&I("FieldMismatch","TooFewFields","Too few fields: expected "+g.length+" fields but parsed "+r,u+n)),a}var n=1;return!x.data.length||Array.isArray(x.data[0])?(x.data=x.data.map(t),n=x.data.length):x.data=t(x.data,0),e.header&&x.meta&&(x.meta.fields=g),u+=n,x}()}function j(){return e.header&&0===g.length}function S(t,n){return r=t,e.dynamicTypingFunction&&void 0===e.dynamicTyping[r]&&(e.dynamicTyping[r]=e.dynamicTypingFunction(r)),!0===(e.dynamicTyping[r]||e.dynamicTyping)?"true"===n||"TRUE"===n||"false"!==n&&"FALSE"!==n&&(function(e){if(o.test(e)){var t=parseFloat(e);if(s<t&&t<a)return!0}return!1}(n)?parseFloat(n):l.test(n)?new Date(n):""===n?null:n):n;var r}function I(e,t,n,r){var a={type:e,code:t,message:n};void 0!==r&&(a.row=r),x.errors.push(a)}this.parse=function(a,s,o){var l=e.quoteChar||'"';if(e.newline||(e.newline=function(e,t){e=e.substring(0,1048576);var n=new RegExp(h(t)+"([^]*?)"+h(t),"gm"),r=(e=e.replace(n,"")).split("\r"),a=e.split("\n"),s=1<a.length&&a[0].length<r[0].length;if(1===r.length||s)return"\n";for(var i=0,o=0;o<r.length;o++)"\n"===r[o][0]&&i++;return i>=r.length/2?"\r\n":"\r"}(a,l)),r=!1,e.delimiter)w(e.delimiter)&&(e.delimiter=e.delimiter(a),x.meta.delimiter=e.delimiter);else{var c=function(t,n,r,a,s){var o,l,c,d;s=s||[",","\t","|",";",i.RECORD_SEP,i.UNIT_SEP];for(var u=0;u<s.length;u++){var p=s[u],m=0,h=0,g=0;c=void 0;for(var x=new f({comments:a,delimiter:p,newline:n,preview:10}).parse(t),v=0;v<x.data.length;v++)if(r&&y(x.data[v]))g++;else{var b=x.data[v].length;h+=b,void 0!==c?0<b&&(m+=Math.abs(b-c),c=b):c=b}0<x.data.length&&(h/=x.data.length-g),(void 0===l||m<=l)&&(void 0===d||d<h)&&1.99<h&&(l=m,o=p,d=h)}return{successful:!!(e.delimiter=o),bestDelimiter:o}}(a,e.newline,e.skipEmptyLines,e.comments,e.delimitersToGuess);c.successful?e.delimiter=c.bestDelimiter:(r=!0,e.delimiter=i.DefaultDelimiter),x.meta.delimiter=e.delimiter}var d=b(e);return e.preview&&e.header&&d.preview++,t=a,n=new f(d),x=n.parse(t,s,o),_(),p?{meta:{paused:!0}}:x||{meta:{paused:!1}}},this.paused=function(){return p},this.pause=function(){p=!0,n.abort(),t=w(e.chunk)?"":t.substring(n.getCharIndex())},this.resume=function(){c.streamer._halted?(p=!1,c.streamer.parseChunk(t,!0)):setTimeout(c.resume,3)},this.aborted=function(){return m},this.abort=function(){m=!0,n.abort(),x.meta.aborted=!0,w(e.complete)&&e.complete(x),t=""}}function h(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function f(e){var t,n=(e=e||{}).delimiter,r=e.newline,a=e.comments,s=e.step,o=e.preview,l=e.fastMode,c=t=void 0===e.quoteChar||null===e.quoteChar?'"':e.quoteChar;if(void 0!==e.escapeChar&&(c=e.escapeChar),("string"!=typeof n||-1<i.BAD_DELIMITERS.indexOf(n))&&(n=","),a===n)throw new Error("Comment character same as delimiter");!0===a?a="#":("string"!=typeof a||-1<i.BAD_DELIMITERS.indexOf(a))&&(a=!1),"\n"!==r&&"\r"!==r&&"\r\n"!==r&&(r="\n");var d=0,u=!1;this.parse=function(e,i,p){if("string"!=typeof e)throw new Error("Input must be a string");var m=e.length,f=n.length,g=r.length,x=a.length,v=w(s),b=[],y=[],_=[],j=d=0;if(!e)return M();if(l||!1!==l&&-1===e.indexOf(t)){for(var S=e.split(r),I=0;I<S.length;I++){if(_=S[I],d+=_.length,I!==S.length-1)d+=r.length;else if(p)return M();if(!a||_.substring(0,x)!==a){if(v){if(b=[],A(_.split(n)),L(),u)return M()}else A(_.split(n));if(o&&o<=I)return b=b.slice(0,o),M(!0)}}return M()}for(var C=e.indexOf(n,d),T=e.indexOf(r,d),k=new RegExp(h(c)+h(t),"g"),N=e.indexOf(t,d);;)if(e[d]!==t)if(a&&0===_.length&&e.substring(d,d+x)===a){if(-1===T)return M();d=T+g,T=e.indexOf(r,d),C=e.indexOf(n,d)}else if(-1!==C&&(C<T||-1===T))_.push(e.substring(d,C)),d=C+f,C=e.indexOf(n,d);else{if(-1===T)break;if(_.push(e.substring(d,T)),P(T+g),v&&(L(),u))return M();if(o&&b.length>=o)return M(!0)}else for(N=d,d++;;){if(-1===(N=e.indexOf(t,N+1)))return p||y.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:b.length,index:d}),R();if(N===m-1)return R(e.substring(d,N).replace(k,t));if(t!==c||e[N+1]!==c){if(t===c||0===N||e[N-1]!==c){-1!==C&&C<N+1&&(C=e.indexOf(n,N+1)),-1!==T&&T<N+1&&(T=e.indexOf(r,N+1));var D=O(-1===T?C:Math.min(C,T));if(e.substr(N+1+D,f)===n){_.push(e.substring(d,N).replace(k,t)),e[d=N+1+D+f]!==t&&(N=e.indexOf(t,d)),C=e.indexOf(n,d),T=e.indexOf(r,d);break}var E=O(T);if(e.substring(N+1+E,N+1+E+g)===r){if(_.push(e.substring(d,N).replace(k,t)),P(N+1+E+g),C=e.indexOf(n,d),N=e.indexOf(t,d),v&&(L(),u))return M();if(o&&b.length>=o)return M(!0);break}y.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:b.length,index:d}),N++}}else N++}return R();function A(e){b.push(e),j=d}function O(t){var n=0;if(-1!==t){var r=e.substring(N+1,t);r&&""===r.trim()&&(n=r.length)}return n}function R(t){return p||(void 0===t&&(t=e.substring(d)),_.push(t),d=m,A(_),v&&L()),M()}function P(t){d=t,A(_),_=[],T=e.indexOf(r,d)}function M(e){return{data:b,errors:y,meta:{delimiter:n,linebreak:r,aborted:u,truncated:!!e,cursor:j+(i||0)}}}function L(){s(M()),b=[],y=[]}},this.abort=function(){u=!0},this.getCharIndex=function(){return d}}function g(e){var t=e.data,n=a[t.workerId],r=!1;if(t.error)n.userError(t.error,t.file);else if(t.results&&t.results.data){var s={abort:function(){r=!0,x(t.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:v,resume:v};if(w(n.userStep)){for(var i=0;i<t.results.data.length&&(n.userStep({data:t.results.data[i],errors:t.results.errors,meta:t.results.meta},s),!r);i++);delete t.results}else w(n.userChunk)&&(n.userChunk(t.results,s,t.file),delete t.results)}t.finished&&!r&&x(t.workerId,t.results)}function x(e,t){var n=a[e];w(n.userComplete)&&n.userComplete(t),n.terminate(),delete a[e]}function v(){throw new Error("Not implemented.")}function b(e){if("object"!=typeof e||null===e)return e;var t=Array.isArray(e)?[]:{};for(var n in e)t[n]=b(e[n]);return t}function y(e,t){return function(){e.apply(t,arguments)}}function w(e){return"function"==typeof e}return r&&(t.onmessage=function(e){var n=e.data;if(void 0===i.WORKER_ID&&n&&(i.WORKER_ID=n.workerId),"string"==typeof n.input)t.postMessage({workerId:i.WORKER_ID,results:i.parse(n.input,n.config),finished:!0});else if(t.File&&n.input instanceof File||n.input instanceof Object){var r=i.parse(n.input,n.config);r&&t.postMessage({workerId:i.WORKER_ID,results:r,finished:!0})}}),(c.prototype=Object.create(l.prototype)).constructor=c,(d.prototype=Object.create(l.prototype)).constructor=d,(u.prototype=Object.create(u.prototype)).constructor=u,(p.prototype=Object.create(l.prototype)).constructor=p,i},void 0===(r=n.apply(t,[]))||(e.exports=r)},15325:function(e,t,n){!function(e,t,n,r,a,s,i,o,l,c,d,u,p,m,h,f,g,x,v,b,y,w,_,j,S,I,C,T,k,N,D,E,A,O,R,P,M,L,F,q,$,U,Z,V,W,Y,B,H,z,G,K,Q,X,J,ee,te,ne,re,ae,se,ie,oe,le){"use strict";function ce(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var de=ce(t),ue=ce(r),pe=ce(a),me=ce(s),he=ce(i),fe=ce(o),ge=ce(l),xe=ce(c),ve=ce(d),be=ce(u),ye=ce(p),we=ce(f),_e=ce(g),je=ce(x),Se=ce(v),Ie=ce(b),Ce=ce(y),Te=ce(w),ke=ce(_),Ne=ce(j),De=ce(S),Ee=ce(I),Ae=ce(C),Oe=ce(T),Re=ce(k),Pe=ce(N),Me=ce(D),Le=ce(E),Fe=ce(A),qe=ce(O),$e=ce(R),Ue=ce(P),Ze=ce(M),Ve=ce(L),We=ce(F),Ye=ce($),Be=ce(U),He=ce(Z),ze=ce(V),Ge=ce(W),Ke=ce(Y),Qe=ce(B),Xe=ce(G),Je=ce(K),et=ce(Q),tt=ce(X),nt=ce(J),rt=ce(ee),at=ce(te),st=ce(ne),it=ce(re),ot=ce(ae),lt=ce(se),ct=ce(ie),dt=ce(oe);function ut(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function pt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ut(Object(n),!0).forEach((function(t){xt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ut(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function mt(e){return(mt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ht(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ft(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function gt(e,t,n){return t&&ft(e.prototype,t),n&&ft(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function xt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vt(){return(vt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function bt(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");Object.defineProperty(e,"prototype",{value:Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),writable:!1}),t&&wt(e,t)}function yt(e){return(yt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function wt(e,t){return(wt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _t(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function jt(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _t(e)}function St(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=yt(e);if(t){var a=yt(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return jt(this,n)}}function It(e){return function(e){if(Array.isArray(e))return Ct(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Ct(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ct(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ct(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Tt(e,t){switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}}function kt(e,t){switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}}var Nt={p:kt,P:function(e,t){var n,r=e.match(/(P+)(p+)?/)||[],a=r[1],s=r[2];if(!s)return Tt(e,t);switch(a){case"P":n=t.dateTime({width:"short"});break;case"PP":n=t.dateTime({width:"medium"});break;case"PPP":n=t.dateTime({width:"long"});break;default:n=t.dateTime({width:"full"})}return n.replace("{{date}}",Tt(a,t)).replace("{{time}}",kt(s,t))}},Dt=12,Et=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;function At(e){var t=e?"string"==typeof e||e instanceof String?lt.default(e):it.default(e):new Date;return Rt(t)?t:null}function Ot(e,t,n,r,a){var s=null,i=Xt(n)||Xt(Qt()),o=!0;return Array.isArray(t)?(t.forEach((function(t){var l=ot.default(e,t,new Date,{locale:i});r&&(o=Rt(l,a)&&e===Pt(l,t,n)),Rt(l,a)&&o&&(s=l)})),s):(s=ot.default(e,t,new Date,{locale:i}),r?o=Rt(s)&&e===Pt(s,t,n):Rt(s)||(t=t.match(Et).map((function(e){var t=e[0];return"p"===t||"P"===t?i?(0,Nt[t])(e,i.formatLong):t:e})).join(""),e.length>0&&(s=ot.default(e,t.slice(0,e.length),new Date)),Rt(s)||(s=new Date(e))),Rt(s)&&o?s:null)}function Rt(e,t){return t=t||new Date("1/1/1000"),me.default(e)&&!at.default(e,t)}function Pt(e,t,n){if("en"===n)return he.default(e,t,{awareOfUnicodeTokens:!0});var r=Xt(n);return n&&!r&&console.warn('A locale object was not found for the provided string ["'.concat(n,'"].')),!r&&Qt()&&Xt(Qt())&&(r=Xt(Qt())),he.default(e,t,{locale:r||null,awareOfUnicodeTokens:!0})}function Mt(e,t){var n=t.dateFormat,r=t.locale;return e&&Pt(e,Array.isArray(n)?n[0]:n,r)||""}function Lt(e,t){var n=t.hour,r=void 0===n?0:n,a=t.minute,s=void 0===a?0:a,i=t.second,o=void 0===i?0:i;return Le.default(Me.default(Pe.default(e,o),s),r)}function Ft(e,t){var n=t&&Xt(t)||Qt()&&Xt(Qt());return De.default(e,n?{locale:n}:null)}function qt(e,t){return Pt(e,"ddd",t)}function $t(e){return Be.default(e)}function Ut(e,t,n){var r=Xt(t||Qt());return He.default(e,{locale:r,weekStartsOn:n})}function Zt(e){return ze.default(e)}function Vt(e){return Ke.default(e)}function Wt(e){return Ge.default(e)}function Yt(e,t){return e&&t?tt.default(e,t):!e&&!t}function Bt(e,t){return e&&t?et.default(e,t):!e&&!t}function Ht(e,t){return e&&t?nt.default(e,t):!e&&!t}function zt(e,t){return e&&t?Je.default(e,t):!e&&!t}function Gt(e,t){return e&&t?Xe.default(e,t):!e&&!t}function Kt(e,t,n){var r,a=Be.default(t),s=Qe.default(n);try{r=st.default(e,{start:a,end:s})}catch(e){r=!1}return r}function Qt(){return("undefined"!=typeof window?window:globalThis).__localeId__}function Xt(e){if("string"==typeof e){var t="undefined"!=typeof window?window:globalThis;return t.__localeData__?t.__localeData__[e]:null}return e}function Jt(e,t){return Pt(Fe.default(At(),e),"LLLL",t)}function en(e,t){return Pt(Fe.default(At(),e),"LLL",t)}function tn(e,t){return Pt(qe.default(At(),e),"QQQ",t)}function nn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,r=t.maxDate,a=t.excludeDates,s=t.excludeDateIntervals,i=t.includeDates,o=t.includeDateIntervals,l=t.filterDate;return dn(e,{minDate:n,maxDate:r})||a&&a.some((function(t){return zt(e,t)}))||s&&s.some((function(t){var n=t.start,r=t.end;return st.default(e,{start:n,end:r})}))||i&&!i.some((function(t){return zt(e,t)}))||o&&!o.some((function(t){var n=t.start,r=t.end;return st.default(e,{start:n,end:r})}))||l&&!l(At(e))||!1}function rn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.excludeDates,r=t.excludeDateIntervals;return r&&r.length>0?r.some((function(t){var n=t.start,r=t.end;return st.default(e,{start:n,end:r})})):n&&n.some((function(t){return zt(e,t)}))||!1}function an(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,r=t.maxDate,a=t.excludeDates,s=t.includeDates,i=t.filterDate;return dn(e,{minDate:n,maxDate:r})||a&&a.some((function(t){return Bt(e,t)}))||s&&!s.some((function(t){return Bt(e,t)}))||i&&!i(At(e))||!1}function sn(e,t,n,r){var a=Oe.default(e),s=Ee.default(e),i=Oe.default(t),o=Ee.default(t),l=Oe.default(r);return a===i&&a===l?s<=n&&n<=o:a<i?l===a&&s<=n||l===i&&o>=n||l<i&&l>a:void 0}function on(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,r=t.maxDate,a=t.excludeDates,s=t.includeDates,i=t.filterDate;return dn(e,{minDate:n,maxDate:r})||a&&a.some((function(t){return Ht(e,t)}))||s&&!s.some((function(t){return Ht(e,t)}))||i&&!i(At(e))||!1}function ln(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,r=t.maxDate;return dn(new Date(e,0,1),{minDate:n,maxDate:r})||!1}function cn(e,t,n,r){var a=Oe.default(e),s=Ae.default(e),i=Oe.default(t),o=Ae.default(t),l=Oe.default(r);return a===i&&a===l?s<=n&&n<=o:a<i?l===a&&s<=n||l===i&&o>=n||l<i&&l>a:void 0}function dn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,r=t.maxDate;return n&&Ve.default(e,n)<0||r&&Ve.default(e,r)>0}function un(e,t){return t.some((function(t){return Te.default(t)===Te.default(e)&&Ce.default(t)===Ce.default(e)}))}function pn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.excludeTimes,r=t.includeTimes,a=t.filterTime;return n&&un(e,n)||r&&!un(e,r)||a&&!a(e)||!1}function mn(e,t){var n=t.minTime,r=t.maxTime;if(!n||!r)throw new Error("Both minTime and maxTime props required");var a,s=At(),i=Le.default(Me.default(s,Ce.default(e)),Te.default(e)),o=Le.default(Me.default(s,Ce.default(n)),Te.default(n)),l=Le.default(Me.default(s,Ce.default(r)),Te.default(r));try{a=!st.default(i,{start:o,end:l})}catch(e){a=!1}return a}function hn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,r=t.includeDates,a=je.default(e,1);return n&&We.default(n,a)>0||r&&r.every((function(e){return We.default(e,a)>0}))||!1}function fn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.maxDate,r=t.includeDates,a=be.default(e,1);return n&&We.default(a,n)>0||r&&r.every((function(e){return We.default(a,e)>0}))||!1}function gn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,r=t.includeDates,a=Se.default(e,1);return n&&Ye.default(n,a)>0||r&&r.every((function(e){return Ye.default(e,a)>0}))||!1}function xn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.maxDate,r=t.includeDates,a=ye.default(e,1);return n&&Ye.default(a,n)>0||r&&r.every((function(e){return Ye.default(a,e)>0}))||!1}function vn(e){var t=e.minDate,n=e.includeDates;if(n&&t){var r=n.filter((function(e){return Ve.default(e,t)>=0}));return Ue.default(r)}return n?Ue.default(n):t}function bn(e){var t=e.maxDate,n=e.includeDates;if(n&&t){var r=n.filter((function(e){return Ve.default(e,t)<=0}));return Ze.default(r)}return n?Ze.default(n):t}function yn(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"react-datepicker__day--highlighted",n=new Map,r=0,a=e.length;r<a;r++){var s=e[r];if(pe.default(s)){var i=Pt(s,"MM.dd.yyyy"),o=n.get(i)||[];o.includes(t)||(o.push(t),n.set(i,o))}else if("object"===mt(s)){var l=Object.keys(s),c=l[0],d=s[l[0]];if("string"==typeof c&&d.constructor===Array)for(var u=0,p=d.length;u<p;u++){var m=Pt(d[u],"MM.dd.yyyy"),h=n.get(m)||[];h.includes(c)||(h.push(c),n.set(m,h))}}}return n}function wn(e,t,n,r,a){for(var s=a.length,i=[],o=0;o<s;o++){var l=fe.default(ge.default(e,Te.default(a[o])),Ce.default(a[o])),c=fe.default(e,(n+1)*r);rt.default(l,t)&&at.default(l,c)&&i.push(a[o])}return i}function _n(e){return e<10?"0".concat(e):"".concat(e)}function jn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Dt,n=Math.ceil(Oe.default(e)/t)*t;return{startPeriod:n-(t-1),endPeriod:n}}function Sn(e,t,n,r){for(var a=[],s=0;s<2*t+1;s++){var i=e+t-s,o=!0;n&&(o=Oe.default(n)<=i),r&&o&&(o=Oe.default(r)>=i),o&&a.push(i)}return a}var In=function(e){bt(r,e);var n=St(r);function r(e){var a;ht(this,r),xt(_t(a=n.call(this,e)),"renderOptions",(function(){var e=a.props.year,t=a.state.yearsList.map((function(t){return de.default.createElement("div",{className:e===t?"react-datepicker__year-option react-datepicker__year-option--selected_year":"react-datepicker__year-option",key:t,onClick:a.onChange.bind(_t(a),t),"aria-selected":e===t?"true":void 0},e===t?de.default.createElement("span",{className:"react-datepicker__year-option--selected"},"✓"):"",t)})),n=a.props.minDate?Oe.default(a.props.minDate):null,r=a.props.maxDate?Oe.default(a.props.maxDate):null;return r&&a.state.yearsList.find((function(e){return e===r}))||t.unshift(de.default.createElement("div",{className:"react-datepicker__year-option",key:"upcoming",onClick:a.incrementYears},de.default.createElement("a",{className:"react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-upcoming"}))),n&&a.state.yearsList.find((function(e){return e===n}))||t.push(de.default.createElement("div",{className:"react-datepicker__year-option",key:"previous",onClick:a.decrementYears},de.default.createElement("a",{className:"react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-previous"}))),t})),xt(_t(a),"onChange",(function(e){a.props.onChange(e)})),xt(_t(a),"handleClickOutside",(function(){a.props.onCancel()})),xt(_t(a),"shiftYears",(function(e){var t=a.state.yearsList.map((function(t){return t+e}));a.setState({yearsList:t})})),xt(_t(a),"incrementYears",(function(){return a.shiftYears(1)})),xt(_t(a),"decrementYears",(function(){return a.shiftYears(-1)}));var s=e.yearDropdownItemNumber,i=e.scrollableYearDropdown,o=s||(i?10:5);return a.state={yearsList:Sn(a.props.year,o,a.props.minDate,a.props.maxDate)},a.dropdownRef=t.createRef(),a}return gt(r,[{key:"componentDidMount",value:function(){var e=this.dropdownRef.current;e&&(e.scrollTop=e.scrollHeight/2-e.clientHeight/2)}},{key:"render",value:function(){var e=ue.default({"react-datepicker__year-dropdown":!0,"react-datepicker__year-dropdown--scrollable":this.props.scrollableYearDropdown});return de.default.createElement("div",{className:e,ref:this.dropdownRef},this.renderOptions())}}]),r}(de.default.Component),Cn=ct.default(In),Tn=function(e){bt(n,e);var t=St(n);function n(){var e;ht(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return xt(_t(e=t.call.apply(t,[this].concat(a))),"state",{dropdownVisible:!1}),xt(_t(e),"renderSelectOptions",(function(){for(var t=e.props.minDate?Oe.default(e.props.minDate):1900,n=e.props.maxDate?Oe.default(e.props.maxDate):2100,r=[],a=t;a<=n;a++)r.push(de.default.createElement("option",{key:a,value:a},a));return r})),xt(_t(e),"onSelectChange",(function(t){e.onChange(t.target.value)})),xt(_t(e),"renderSelectMode",(function(){return de.default.createElement("select",{value:e.props.year,className:"react-datepicker__year-select",onChange:e.onSelectChange},e.renderSelectOptions())})),xt(_t(e),"renderReadView",(function(t){return de.default.createElement("div",{key:"read",style:{visibility:t?"visible":"hidden"},className:"react-datepicker__year-read-view",onClick:function(t){return e.toggleDropdown(t)}},de.default.createElement("span",{className:"react-datepicker__year-read-view--down-arrow"}),de.default.createElement("span",{className:"react-datepicker__year-read-view--selected-year"},e.props.year))})),xt(_t(e),"renderDropdown",(function(){return de.default.createElement(Cn,{key:"dropdown",year:e.props.year,onChange:e.onChange,onCancel:e.toggleDropdown,minDate:e.props.minDate,maxDate:e.props.maxDate,scrollableYearDropdown:e.props.scrollableYearDropdown,yearDropdownItemNumber:e.props.yearDropdownItemNumber})})),xt(_t(e),"renderScrollMode",(function(){var t=e.state.dropdownVisible,n=[e.renderReadView(!t)];return t&&n.unshift(e.renderDropdown()),n})),xt(_t(e),"onChange",(function(t){e.toggleDropdown(),t!==e.props.year&&e.props.onChange(t)})),xt(_t(e),"toggleDropdown",(function(t){e.setState({dropdownVisible:!e.state.dropdownVisible},(function(){e.props.adjustDateOnChange&&e.handleYearChange(e.props.date,t)}))})),xt(_t(e),"handleYearChange",(function(t,n){e.onSelect(t,n),e.setOpen()})),xt(_t(e),"onSelect",(function(t,n){e.props.onSelect&&e.props.onSelect(t,n)})),xt(_t(e),"setOpen",(function(){e.props.setOpen&&e.props.setOpen(!0)})),e}return gt(n,[{key:"render",value:function(){var e;switch(this.props.dropdownMode){case"scroll":e=this.renderScrollMode();break;case"select":e=this.renderSelectMode()}return de.default.createElement("div",{className:"react-datepicker__year-dropdown-container react-datepicker__year-dropdown-container--".concat(this.props.dropdownMode)},e)}}]),n}(de.default.Component),kn=function(e){bt(n,e);var t=St(n);function n(){var e;ht(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return xt(_t(e=t.call.apply(t,[this].concat(a))),"isSelectedMonth",(function(t){return e.props.month===t})),xt(_t(e),"renderOptions",(function(){return e.props.monthNames.map((function(t,n){return de.default.createElement("div",{className:e.isSelectedMonth(n)?"react-datepicker__month-option react-datepicker__month-option--selected_month":"react-datepicker__month-option",key:t,onClick:e.onChange.bind(_t(e),n),"aria-selected":e.isSelectedMonth(n)?"true":void 0},e.isSelectedMonth(n)?de.default.createElement("span",{className:"react-datepicker__month-option--selected"},"✓"):"",t)}))})),xt(_t(e),"onChange",(function(t){return e.props.onChange(t)})),xt(_t(e),"handleClickOutside",(function(){return e.props.onCancel()})),e}return gt(n,[{key:"render",value:function(){return de.default.createElement("div",{className:"react-datepicker__month-dropdown"},this.renderOptions())}}]),n}(de.default.Component),Nn=ct.default(kn),Dn=function(e){bt(n,e);var t=St(n);function n(){var e;ht(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return xt(_t(e=t.call.apply(t,[this].concat(a))),"state",{dropdownVisible:!1}),xt(_t(e),"renderSelectOptions",(function(e){return e.map((function(e,t){return de.default.createElement("option",{key:t,value:t},e)}))})),xt(_t(e),"renderSelectMode",(function(t){return de.default.createElement("select",{value:e.props.month,className:"react-datepicker__month-select",onChange:function(t){return e.onChange(t.target.value)}},e.renderSelectOptions(t))})),xt(_t(e),"renderReadView",(function(t,n){return de.default.createElement("div",{key:"read",style:{visibility:t?"visible":"hidden"},className:"react-datepicker__month-read-view",onClick:e.toggleDropdown},de.default.createElement("span",{className:"react-datepicker__month-read-view--down-arrow"}),de.default.createElement("span",{className:"react-datepicker__month-read-view--selected-month"},n[e.props.month]))})),xt(_t(e),"renderDropdown",(function(t){return de.default.createElement(Nn,{key:"dropdown",month:e.props.month,monthNames:t,onChange:e.onChange,onCancel:e.toggleDropdown})})),xt(_t(e),"renderScrollMode",(function(t){var n=e.state.dropdownVisible,r=[e.renderReadView(!n,t)];return n&&r.unshift(e.renderDropdown(t)),r})),xt(_t(e),"onChange",(function(t){e.toggleDropdown(),t!==e.props.month&&e.props.onChange(t)})),xt(_t(e),"toggleDropdown",(function(){return e.setState({dropdownVisible:!e.state.dropdownVisible})})),e}return gt(n,[{key:"render",value:function(){var e,t=this,n=[0,1,2,3,4,5,6,7,8,9,10,11].map(this.props.useShortMonthInDropdown?function(e){return en(e,t.props.locale)}:function(e){return Jt(e,t.props.locale)});switch(this.props.dropdownMode){case"scroll":e=this.renderScrollMode(n);break;case"select":e=this.renderSelectMode(n)}return de.default.createElement("div",{className:"react-datepicker__month-dropdown-container react-datepicker__month-dropdown-container--".concat(this.props.dropdownMode)},e)}}]),n}(de.default.Component);function En(e,t){for(var n=[],r=Zt(e),a=Zt(t);!rt.default(r,a);)n.push(At(r)),r=be.default(r,1);return n}var An=function(e){bt(n,e);var t=St(n);function n(e){var r;return ht(this,n),xt(_t(r=t.call(this,e)),"renderOptions",(function(){return r.state.monthYearsList.map((function(e){var t=Re.default(e),n=Yt(r.props.date,e)&&Bt(r.props.date,e);return de.default.createElement("div",{className:n?"react-datepicker__month-year-option--selected_month-year":"react-datepicker__month-year-option",key:t,onClick:r.onChange.bind(_t(r),t),"aria-selected":n?"true":void 0},n?de.default.createElement("span",{className:"react-datepicker__month-year-option--selected"},"✓"):"",Pt(e,r.props.dateFormat,r.props.locale))}))})),xt(_t(r),"onChange",(function(e){return r.props.onChange(e)})),xt(_t(r),"handleClickOutside",(function(){r.props.onCancel()})),r.state={monthYearsList:En(r.props.minDate,r.props.maxDate)},r}return gt(n,[{key:"render",value:function(){var e=ue.default({"react-datepicker__month-year-dropdown":!0,"react-datepicker__month-year-dropdown--scrollable":this.props.scrollableMonthYearDropdown});return de.default.createElement("div",{className:e},this.renderOptions())}}]),n}(de.default.Component),On=ct.default(An),Rn=function(e){bt(n,e);var t=St(n);function n(){var e;ht(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return xt(_t(e=t.call.apply(t,[this].concat(a))),"state",{dropdownVisible:!1}),xt(_t(e),"renderSelectOptions",(function(){for(var t=Zt(e.props.minDate),n=Zt(e.props.maxDate),r=[];!rt.default(t,n);){var a=Re.default(t);r.push(de.default.createElement("option",{key:a,value:a},Pt(t,e.props.dateFormat,e.props.locale))),t=be.default(t,1)}return r})),xt(_t(e),"onSelectChange",(function(t){e.onChange(t.target.value)})),xt(_t(e),"renderSelectMode",(function(){return de.default.createElement("select",{value:Re.default(Zt(e.props.date)),className:"react-datepicker__month-year-select",onChange:e.onSelectChange},e.renderSelectOptions())})),xt(_t(e),"renderReadView",(function(t){var n=Pt(e.props.date,e.props.dateFormat,e.props.locale);return de.default.createElement("div",{key:"read",style:{visibility:t?"visible":"hidden"},className:"react-datepicker__month-year-read-view",onClick:function(t){return e.toggleDropdown(t)}},de.default.createElement("span",{className:"react-datepicker__month-year-read-view--down-arrow"}),de.default.createElement("span",{className:"react-datepicker__month-year-read-view--selected-month-year"},n))})),xt(_t(e),"renderDropdown",(function(){return de.default.createElement(On,{key:"dropdown",date:e.props.date,dateFormat:e.props.dateFormat,onChange:e.onChange,onCancel:e.toggleDropdown,minDate:e.props.minDate,maxDate:e.props.maxDate,scrollableMonthYearDropdown:e.props.scrollableMonthYearDropdown,locale:e.props.locale})})),xt(_t(e),"renderScrollMode",(function(){var t=e.state.dropdownVisible,n=[e.renderReadView(!t)];return t&&n.unshift(e.renderDropdown()),n})),xt(_t(e),"onChange",(function(t){e.toggleDropdown();var n=At(parseInt(t));Yt(e.props.date,n)&&Bt(e.props.date,n)||e.props.onChange(n)})),xt(_t(e),"toggleDropdown",(function(){return e.setState({dropdownVisible:!e.state.dropdownVisible})})),e}return gt(n,[{key:"render",value:function(){var e;switch(this.props.dropdownMode){case"scroll":e=this.renderScrollMode();break;case"select":e=this.renderSelectMode()}return de.default.createElement("div",{className:"react-datepicker__month-year-dropdown-container react-datepicker__month-year-dropdown-container--".concat(this.props.dropdownMode)},e)}}]),n}(de.default.Component),Pn=function(e){bt(n,e);var t=St(n);function n(){var e;ht(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return xt(_t(e=t.call.apply(t,[this].concat(a))),"dayEl",de.default.createRef()),xt(_t(e),"handleClick",(function(t){!e.isDisabled()&&e.props.onClick&&e.props.onClick(t)})),xt(_t(e),"handleMouseEnter",(function(t){!e.isDisabled()&&e.props.onMouseEnter&&e.props.onMouseEnter(t)})),xt(_t(e),"handleOnKeyDown",(function(t){" "===t.key&&(t.preventDefault(),t.key="Enter"),e.props.handleOnKeyDown(t)})),xt(_t(e),"isSameDay",(function(t){return zt(e.props.day,t)})),xt(_t(e),"isKeyboardSelected",(function(){return!e.props.disabledKeyboardNavigation&&!e.isSameDay(e.props.selected)&&e.isSameDay(e.props.preSelection)})),xt(_t(e),"isDisabled",(function(){return nn(e.props.day,e.props)})),xt(_t(e),"isExcluded",(function(){return rn(e.props.day,e.props)})),xt(_t(e),"getHighLightedClass",(function(t){var n=e.props,r=n.day,a=n.highlightDates;if(!a)return!1;var s=Pt(r,"MM.dd.yyyy");return a.get(s)})),xt(_t(e),"isInRange",(function(){var t=e.props,n=t.day,r=t.startDate,a=t.endDate;return!(!r||!a)&&Kt(n,r,a)})),xt(_t(e),"isInSelectingRange",(function(){var t,n=e.props,r=n.day,a=n.selectsStart,s=n.selectsEnd,i=n.selectsRange,o=n.selectsDisabledDaysInRange,l=n.startDate,c=n.endDate,d=null!==(t=e.props.selectingDate)&&void 0!==t?t:e.props.preSelection;return!(!(a||s||i)||!d||!o&&e.isDisabled())&&(a&&c&&(at.default(d,c)||Gt(d,c))?Kt(r,d,c):(s&&l&&(rt.default(d,l)||Gt(d,l))||!(!i||!l||c||!rt.default(d,l)&&!Gt(d,l)))&&Kt(r,l,d))})),xt(_t(e),"isSelectingRangeStart",(function(){var t;if(!e.isInSelectingRange())return!1;var n=e.props,r=n.day,a=n.startDate,s=n.selectsStart,i=null!==(t=e.props.selectingDate)&&void 0!==t?t:e.props.preSelection;return zt(r,s?i:a)})),xt(_t(e),"isSelectingRangeEnd",(function(){var t;if(!e.isInSelectingRange())return!1;var n=e.props,r=n.day,a=n.endDate,s=n.selectsEnd,i=null!==(t=e.props.selectingDate)&&void 0!==t?t:e.props.preSelection;return zt(r,s?i:a)})),xt(_t(e),"isRangeStart",(function(){var t=e.props,n=t.day,r=t.startDate,a=t.endDate;return!(!r||!a)&&zt(r,n)})),xt(_t(e),"isRangeEnd",(function(){var t=e.props,n=t.day,r=t.startDate,a=t.endDate;return!(!r||!a)&&zt(a,n)})),xt(_t(e),"isWeekend",(function(){var t=ke.default(e.props.day);return 0===t||6===t})),xt(_t(e),"isAfterMonth",(function(){return void 0!==e.props.month&&(e.props.month+1)%12===Ee.default(e.props.day)})),xt(_t(e),"isBeforeMonth",(function(){return void 0!==e.props.month&&(Ee.default(e.props.day)+1)%12===e.props.month})),xt(_t(e),"isCurrentDay",(function(){return e.isSameDay(At())})),xt(_t(e),"isSelected",(function(){return e.isSameDay(e.props.selected)})),xt(_t(e),"getClassNames",(function(t){var n=e.props.dayClassName?e.props.dayClassName(t):void 0;return ue.default("react-datepicker__day",n,"react-datepicker__day--"+qt(e.props.day),{"react-datepicker__day--disabled":e.isDisabled(),"react-datepicker__day--excluded":e.isExcluded(),"react-datepicker__day--selected":e.isSelected(),"react-datepicker__day--keyboard-selected":e.isKeyboardSelected(),"react-datepicker__day--range-start":e.isRangeStart(),"react-datepicker__day--range-end":e.isRangeEnd(),"react-datepicker__day--in-range":e.isInRange(),"react-datepicker__day--in-selecting-range":e.isInSelectingRange(),"react-datepicker__day--selecting-range-start":e.isSelectingRangeStart(),"react-datepicker__day--selecting-range-end":e.isSelectingRangeEnd(),"react-datepicker__day--today":e.isCurrentDay(),"react-datepicker__day--weekend":e.isWeekend(),"react-datepicker__day--outside-month":e.isAfterMonth()||e.isBeforeMonth()},e.getHighLightedClass("react-datepicker__day--highlighted"))})),xt(_t(e),"getAriaLabel",(function(){var t=e.props,n=t.day,r=t.ariaLabelPrefixWhenEnabled,a=void 0===r?"Choose":r,s=t.ariaLabelPrefixWhenDisabled,i=void 0===s?"Not available":s,o=e.isDisabled()||e.isExcluded()?i:a;return"".concat(o," ").concat(Pt(n,"PPPP",e.props.locale))})),xt(_t(e),"getTabIndex",(function(t,n){var r=t||e.props.selected,a=n||e.props.preSelection;return e.isKeyboardSelected()||e.isSameDay(r)&&zt(a,r)?0:-1})),xt(_t(e),"handleFocusDay",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=!1;0===e.getTabIndex()&&!t.isInputFocused&&e.isSameDay(e.props.preSelection)&&(document.activeElement&&document.activeElement!==document.body||(n=!0),e.props.inline&&!e.props.shouldFocusDayInline&&(n=!1),e.props.containerRef&&e.props.containerRef.current&&e.props.containerRef.current.contains(document.activeElement)&&document.activeElement.classList.contains("react-datepicker__day")&&(n=!0)),n&&e.dayEl.current.focus({preventScroll:!0})})),xt(_t(e),"renderDayContents",(function(){return e.props.monthShowsDuplicateDaysEnd&&e.isAfterMonth()||e.props.monthShowsDuplicateDaysStart&&e.isBeforeMonth()?null:e.props.renderDayContents?e.props.renderDayContents(Ne.default(e.props.day),e.props.day):Ne.default(e.props.day)})),xt(_t(e),"render",(function(){return de.default.createElement("div",{ref:e.dayEl,className:e.getClassNames(e.props.day),onKeyDown:e.handleOnKeyDown,onClick:e.handleClick,onMouseEnter:e.handleMouseEnter,tabIndex:e.getTabIndex(),"aria-label":e.getAriaLabel(),role:"option","aria-disabled":e.isDisabled(),"aria-current":e.isCurrentDay()?"date":void 0,"aria-selected":e.isSelected()},e.renderDayContents())})),e}return gt(n,[{key:"componentDidMount",value:function(){this.handleFocusDay()}},{key:"componentDidUpdate",value:function(e){this.handleFocusDay(e)}}]),n}(de.default.Component),Mn=function(e){bt(n,e);var t=St(n);function n(){var e;ht(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return xt(_t(e=t.call.apply(t,[this].concat(a))),"handleClick",(function(t){e.props.onClick&&e.props.onClick(t)})),e}return gt(n,[{key:"render",value:function(){var e=this.props,t=e.weekNumber,n=e.ariaLabelPrefix,r=void 0===n?"week ":n,a={"react-datepicker__week-number":!0,"react-datepicker__week-number--clickable":!!e.onClick};return de.default.createElement("div",{className:ue.default(a),"aria-label":"".concat(r," ").concat(this.props.weekNumber),onClick:this.handleClick},t)}}]),n}(de.default.Component),Ln=function(e){bt(n,e);var t=St(n);function n(){var e;ht(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return xt(_t(e=t.call.apply(t,[this].concat(a))),"handleDayClick",(function(t,n){e.props.onDayClick&&e.props.onDayClick(t,n)})),xt(_t(e),"handleDayMouseEnter",(function(t){e.props.onDayMouseEnter&&e.props.onDayMouseEnter(t)})),xt(_t(e),"handleWeekClick",(function(t,n,r){"function"==typeof e.props.onWeekSelect&&e.props.onWeekSelect(t,n,r),e.props.shouldCloseOnSelect&&e.props.setOpen(!1)})),xt(_t(e),"formatWeekNumber",(function(t){return e.props.formatWeekNumber?e.props.formatWeekNumber(t):Ft(t)})),xt(_t(e),"renderDays",(function(){var t=Ut(e.props.day,e.props.locale,e.props.calendarStartDay),n=[],r=e.formatWeekNumber(t);if(e.props.showWeekNumber){var a=e.props.onWeekSelect?e.handleWeekClick.bind(_t(e),t,r):void 0;n.push(de.default.createElement(Mn,{key:"W",weekNumber:r,onClick:a,ariaLabelPrefix:e.props.ariaLabelPrefix}))}return n.concat([0,1,2,3,4,5,6].map((function(n){var r=xe.default(t,n);return de.default.createElement(Pn,{ariaLabelPrefixWhenEnabled:e.props.chooseDayAriaLabelPrefix,ariaLabelPrefixWhenDisabled:e.props.disabledDayAriaLabelPrefix,key:r.valueOf(),day:r,month:e.props.month,onClick:e.handleDayClick.bind(_t(e),r),onMouseEnter:e.handleDayMouseEnter.bind(_t(e),r),minDate:e.props.minDate,maxDate:e.props.maxDate,excludeDates:e.props.excludeDates,excludeDateIntervals:e.props.excludeDateIntervals,includeDates:e.props.includeDates,includeDateIntervals:e.props.includeDateIntervals,highlightDates:e.props.highlightDates,selectingDate:e.props.selectingDate,filterDate:e.props.filterDate,preSelection:e.props.preSelection,selected:e.props.selected,selectsStart:e.props.selectsStart,selectsEnd:e.props.selectsEnd,selectsRange:e.props.selectsRange,selectsDisabledDaysInRange:e.props.selectsDisabledDaysInRange,startDate:e.props.startDate,endDate:e.props.endDate,dayClassName:e.props.dayClassName,renderDayContents:e.props.renderDayContents,disabledKeyboardNavigation:e.props.disabledKeyboardNavigation,handleOnKeyDown:e.props.handleOnKeyDown,isInputFocused:e.props.isInputFocused,containerRef:e.props.containerRef,inline:e.props.inline,shouldFocusDayInline:e.props.shouldFocusDayInline,monthShowsDuplicateDaysEnd:e.props.monthShowsDuplicateDaysEnd,monthShowsDuplicateDaysStart:e.props.monthShowsDuplicateDaysStart,locale:e.props.locale})})))})),e}return gt(n,[{key:"render",value:function(){return de.default.createElement("div",{className:"react-datepicker__week"},this.renderDays())}}],[{key:"defaultProps",get:function(){return{shouldCloseOnSelect:!0}}}]),n}(de.default.Component),Fn=function(e){bt(n,e);var t=St(n);function n(){var e;ht(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return xt(_t(e=t.call.apply(t,[this].concat(a))),"MONTH_REFS",It(Array(12)).map((function(){return de.default.createRef()}))),xt(_t(e),"isDisabled",(function(t){return nn(t,e.props)})),xt(_t(e),"isExcluded",(function(t){return rn(t,e.props)})),xt(_t(e),"handleDayClick",(function(t,n){e.props.onDayClick&&e.props.onDayClick(t,n,e.props.orderInDisplay)})),xt(_t(e),"handleDayMouseEnter",(function(t){e.props.onDayMouseEnter&&e.props.onDayMouseEnter(t)})),xt(_t(e),"handleMouseLeave",(function(){e.props.onMouseLeave&&e.props.onMouseLeave()})),xt(_t(e),"isRangeStartMonth",(function(t){var n=e.props,r=n.day,a=n.startDate,s=n.endDate;return!(!a||!s)&&Bt(Fe.default(r,t),a)})),xt(_t(e),"isRangeStartQuarter",(function(t){var n=e.props,r=n.day,a=n.startDate,s=n.endDate;return!(!a||!s)&&Ht(qe.default(r,t),a)})),xt(_t(e),"isRangeEndMonth",(function(t){var n=e.props,r=n.day,a=n.startDate,s=n.endDate;return!(!a||!s)&&Bt(Fe.default(r,t),s)})),xt(_t(e),"isRangeEndQuarter",(function(t){var n=e.props,r=n.day,a=n.startDate,s=n.endDate;return!(!a||!s)&&Ht(qe.default(r,t),s)})),xt(_t(e),"isWeekInMonth",(function(t){var n=e.props.day,r=xe.default(t,6);return Bt(t,n)||Bt(r,n)})),xt(_t(e),"isCurrentMonth",(function(e,t){return Oe.default(e)===Oe.default(At())&&t===Ee.default(At())})),xt(_t(e),"isSelectedMonth",(function(e,t,n){return Ee.default(e)===t&&Oe.default(e)===Oe.default(n)})),xt(_t(e),"isSelectedQuarter",(function(e,t,n){return Ae.default(e)===t&&Oe.default(e)===Oe.default(n)})),xt(_t(e),"renderWeeks",(function(){for(var t=[],n=e.props.fixedHeight,r=0,a=!1,s=Ut(Zt(e.props.day),e.props.locale,e.props.calendarStartDay);t.push(de.default.createElement(Ln,{ariaLabelPrefix:e.props.weekAriaLabelPrefix,chooseDayAriaLabelPrefix:e.props.chooseDayAriaLabelPrefix,disabledDayAriaLabelPrefix:e.props.disabledDayAriaLabelPrefix,key:r,day:s,month:Ee.default(e.props.day),onDayClick:e.handleDayClick,onDayMouseEnter:e.handleDayMouseEnter,onWeekSelect:e.props.onWeekSelect,formatWeekNumber:e.props.formatWeekNumber,locale:e.props.locale,minDate:e.props.minDate,maxDate:e.props.maxDate,excludeDates:e.props.excludeDates,excludeDateIntervals:e.props.excludeDateIntervals,includeDates:e.props.includeDates,includeDateIntervals:e.props.includeDateIntervals,inline:e.props.inline,shouldFocusDayInline:e.props.shouldFocusDayInline,highlightDates:e.props.highlightDates,selectingDate:e.props.selectingDate,filterDate:e.props.filterDate,preSelection:e.props.preSelection,selected:e.props.selected,selectsStart:e.props.selectsStart,selectsEnd:e.props.selectsEnd,selectsRange:e.props.selectsRange,selectsDisabledDaysInRange:e.props.selectsDisabledDaysInRange,showWeekNumber:e.props.showWeekNumbers,startDate:e.props.startDate,endDate:e.props.endDate,dayClassName:e.props.dayClassName,setOpen:e.props.setOpen,shouldCloseOnSelect:e.props.shouldCloseOnSelect,disabledKeyboardNavigation:e.props.disabledKeyboardNavigation,renderDayContents:e.props.renderDayContents,handleOnKeyDown:e.props.handleOnKeyDown,isInputFocused:e.props.isInputFocused,containerRef:e.props.containerRef,calendarStartDay:e.props.calendarStartDay,monthShowsDuplicateDaysEnd:e.props.monthShowsDuplicateDaysEnd,monthShowsDuplicateDaysStart:e.props.monthShowsDuplicateDaysStart})),!a;){r++,s=ve.default(s,1);var i=n&&r>=6,o=!n&&!e.isWeekInMonth(s);if(i||o){if(!e.props.peekNextMonth)break;a=!0}}return t})),xt(_t(e),"onMonthClick",(function(t,n){e.handleDayClick(Zt(Fe.default(e.props.day,n)),t)})),xt(_t(e),"handleMonthNavigation",(function(t,n){e.isDisabled(n)||e.isExcluded(n)||(e.props.setPreSelection(n),e.MONTH_REFS[t].current&&e.MONTH_REFS[t].current.focus())})),xt(_t(e),"onMonthKeyDown",(function(t,n){var r=t.key;if(!e.props.disabledKeyboardNavigation)switch(r){case"Enter":e.onMonthClick(t,n),e.props.setPreSelection(e.props.selected);break;case"ArrowRight":e.handleMonthNavigation(11===n?0:n+1,be.default(e.props.preSelection,1));break;case"ArrowLeft":e.handleMonthNavigation(0===n?11:n-1,je.default(e.props.preSelection,1))}})),xt(_t(e),"onQuarterClick",(function(t,n){e.handleDayClick(Wt(qe.default(e.props.day,n)),t)})),xt(_t(e),"getMonthClassNames",(function(t){var n=e.props,r=n.day,a=n.startDate,s=n.endDate,i=n.selected,o=n.minDate,l=n.maxDate,c=n.preSelection,d=n.monthClassName,u=d?d(r):void 0;return ue.default("react-datepicker__month-text","react-datepicker__month-".concat(t),u,{"react-datepicker__month--disabled":(o||l)&&an(Fe.default(r,t),e.props),"react-datepicker__month--selected":e.isSelectedMonth(r,t,i),"react-datepicker__month-text--keyboard-selected":Ee.default(c)===t,"react-datepicker__month--in-range":sn(a,s,t,r),"react-datepicker__month--range-start":e.isRangeStartMonth(t),"react-datepicker__month--range-end":e.isRangeEndMonth(t),"react-datepicker__month-text--today":e.isCurrentMonth(r,t)})})),xt(_t(e),"getTabIndex",(function(t){var n=Ee.default(e.props.preSelection);return e.props.disabledKeyboardNavigation||t!==n?"-1":"0"})),xt(_t(e),"getAriaLabel",(function(t){var n=e.props,r=n.ariaLabelPrefix,a=void 0===r?"Choose":r,s=n.disabledDayAriaLabelPrefix,i=void 0===s?"Not available":s,o=n.day,l=Fe.default(o,t),c=e.isDisabled(l)||e.isExcluded(l)?i:a;return"".concat(c," ").concat(Pt(l,"MMMM yyyy"))})),xt(_t(e),"getQuarterClassNames",(function(t){var n=e.props,r=n.day,a=n.startDate,s=n.endDate,i=n.selected,o=n.minDate,l=n.maxDate;return ue.default("react-datepicker__quarter-text","react-datepicker__quarter-".concat(t),{"react-datepicker__quarter--disabled":(o||l)&&on(qe.default(r,t),e.props),"react-datepicker__quarter--selected":e.isSelectedQuarter(r,t,i),"react-datepicker__quarter--in-range":cn(a,s,t,r),"react-datepicker__quarter--range-start":e.isRangeStartQuarter(t),"react-datepicker__quarter--range-end":e.isRangeEndQuarter(t)})})),xt(_t(e),"renderMonths",(function(){var t=e.props,n=t.showFullMonthYearPicker,r=t.showTwoColumnMonthYearPicker,a=t.showFourColumnMonthYearPicker,s=t.locale,i=t.day,o=t.selected;return(a?[[0,1,2,3],[4,5,6,7],[8,9,10,11]]:r?[[0,1],[2,3],[4,5],[6,7],[8,9],[10,11]]:[[0,1,2],[3,4,5],[6,7,8],[9,10,11]]).map((function(t,r){return de.default.createElement("div",{className:"react-datepicker__month-wrapper",key:r},t.map((function(t,r){return de.default.createElement("div",{ref:e.MONTH_REFS[t],key:r,onClick:function(n){e.onMonthClick(n,t)},onKeyDown:function(n){e.onMonthKeyDown(n,t)},tabIndex:e.getTabIndex(t),className:e.getMonthClassNames(t),role:"option","aria-label":e.getAriaLabel(t),"aria-current":e.isCurrentMonth(i,t)?"date":void 0,"aria-selected":e.isSelectedMonth(i,t,o)},n?Jt(t,s):en(t,s))})))}))})),xt(_t(e),"renderQuarters",(function(){var t=e.props,n=t.day,r=t.selected;return de.default.createElement("div",{className:"react-datepicker__quarter-wrapper"},[1,2,3,4].map((function(t,a){return de.default.createElement("div",{key:a,role:"option",onClick:function(n){e.onQuarterClick(n,t)},className:e.getQuarterClassNames(t),"aria-selected":e.isSelectedQuarter(n,t,r)},tn(t,e.props.locale))})))})),xt(_t(e),"getClassNames",(function(){var t=e.props;t.day;var n=t.selectingDate,r=t.selectsStart,a=t.selectsEnd,s=t.showMonthYearPicker,i=t.showQuarterYearPicker;return ue.default("react-datepicker__month",{"react-datepicker__month--selecting-range":n&&(r||a)},{"react-datepicker__monthPicker":s},{"react-datepicker__quarterPicker":i})})),e}return gt(n,[{key:"render",value:function(){var e=this.props,t=e.showMonthYearPicker,n=e.showQuarterYearPicker,r=e.day,a=e.ariaLabelPrefix,s=void 0===a?"month ":a;return de.default.createElement("div",{className:this.getClassNames(),onMouseLeave:this.handleMouseLeave,"aria-label":"".concat(s," ").concat(Pt(r,"yyyy-MM")),role:"listbox"},t?this.renderMonths():n?this.renderQuarters():this.renderWeeks())}}]),n}(de.default.Component),qn=function(e){bt(n,e);var t=St(n);function n(){var e;ht(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return xt(_t(e=t.call.apply(t,[this].concat(a))),"state",{height:null}),xt(_t(e),"handleClick",(function(t){(e.props.minTime||e.props.maxTime)&&mn(t,e.props)||(e.props.excludeTimes||e.props.includeTimes||e.props.filterTime)&&pn(t,e.props)||e.props.onChange(t)})),xt(_t(e),"isSelectedTime",(function(t,n,r){return e.props.selected&&n===Te.default(t)&&r===Ce.default(t)})),xt(_t(e),"liClasses",(function(t,n,r){var a=["react-datepicker__time-list-item",e.props.timeClassName?e.props.timeClassName(t,n,r):void 0];return e.isSelectedTime(t,n,r)&&a.push("react-datepicker__time-list-item--selected"),((e.props.minTime||e.props.maxTime)&&mn(t,e.props)||(e.props.excludeTimes||e.props.includeTimes||e.props.filterTime)&&pn(t,e.props))&&a.push("react-datepicker__time-list-item--disabled"),e.props.injectTimes&&(60*Te.default(t)+Ce.default(t))%e.props.intervals!=0&&a.push("react-datepicker__time-list-item--injected"),a.join(" ")})),xt(_t(e),"handleOnKeyDown",(function(t,n){" "===t.key&&(t.preventDefault(),t.key="Enter"),"Enter"===t.key&&e.handleClick(n),e.props.handleOnKeyDown(t)})),xt(_t(e),"renderTimes",(function(){for(var t=[],n=e.props.format?e.props.format:"p",r=e.props.intervals,a=$t(At(e.props.selected)),s=1440/r,i=e.props.injectTimes&&e.props.injectTimes.sort((function(e,t){return e-t})),o=e.props.selected||e.props.openToDate||At(),l=Te.default(o),c=Ce.default(o),d=Le.default(Me.default(a,c),l),u=0;u<s;u++){var p=fe.default(a,u*r);if(t.push(p),i){var m=wn(a,p,u,r,i);t=t.concat(m)}}return t.map((function(t,r){return de.default.createElement("li",{key:r,onClick:e.handleClick.bind(_t(e),t),className:e.liClasses(t,l,c),ref:function(n){(at.default(t,d)||Gt(t,d))&&(e.centerLi=n)},onKeyDown:function(n){e.handleOnKeyDown(n,t)},tabIndex:"0","aria-selected":e.isSelectedTime(t,l,c)?"true":void 0},Pt(t,n,e.props.locale))}))})),e}return gt(n,[{key:"componentDidMount",value:function(){this.list.scrollTop=n.calcCenterPosition(this.props.monthRef?this.props.monthRef.clientHeight-this.header.clientHeight:this.list.clientHeight,this.centerLi),this.props.monthRef&&this.header&&this.setState({height:this.props.monthRef.clientHeight-this.header.clientHeight})}},{key:"render",value:function(){var e=this,t=this.state.height;return de.default.createElement("div",{className:"react-datepicker__time-container ".concat(this.props.todayButton?"react-datepicker__time-container--with-today-button":"")},de.default.createElement("div",{className:"react-datepicker__header react-datepicker__header--time ".concat(this.props.showTimeSelectOnly?"react-datepicker__header--time--only":""),ref:function(t){e.header=t}},de.default.createElement("div",{className:"react-datepicker-time__header"},this.props.timeCaption)),de.default.createElement("div",{className:"react-datepicker__time"},de.default.createElement("div",{className:"react-datepicker__time-box"},de.default.createElement("ul",{className:"react-datepicker__time-list",ref:function(t){e.list=t},style:t?{height:t}:{},tabIndex:"0"},this.renderTimes()))))}}],[{key:"defaultProps",get:function(){return{intervals:30,onTimeChange:function(){},todayButton:null,timeCaption:"Time"}}}]),n}(de.default.Component);xt(qn,"calcCenterPosition",(function(e,t){return t.offsetTop-(e/2-t.clientHeight/2)}));var $n=function(e){bt(n,e);var t=St(n);function n(e){var r;return ht(this,n),xt(_t(r=t.call(this,e)),"YEAR_REFS",It(Array(r.props.yearItemNumber)).map((function(){return de.default.createRef()}))),xt(_t(r),"isDisabled",(function(e){return nn(e,r.props)})),xt(_t(r),"isExcluded",(function(e){return rn(e,r.props)})),xt(_t(r),"updateFocusOnPaginate",(function(e){var t=function(){this.YEAR_REFS[e].current.focus()}.bind(_t(r));window.requestAnimationFrame(t)})),xt(_t(r),"handleYearClick",(function(e,t){r.props.onDayClick&&r.props.onDayClick(e,t)})),xt(_t(r),"handleYearNavigation",(function(e,t){var n=r.props,a=n.date,s=n.yearItemNumber,i=jn(a,s).startPeriod;r.isDisabled(t)||r.isExcluded(t)||(r.props.setPreSelection(t),e-i==-1?r.updateFocusOnPaginate(s-1):e-i===s?r.updateFocusOnPaginate(0):r.YEAR_REFS[e-i].current.focus())})),xt(_t(r),"isSameDay",(function(e,t){return zt(e,t)})),xt(_t(r),"isCurrentYear",(function(e){return e===Oe.default(At())})),xt(_t(r),"isKeyboardSelected",(function(e){var t=Vt($e.default(r.props.date,e));return!r.props.disabledKeyboardNavigation&&!r.props.inline&&!zt(t,Vt(r.props.selected))&&zt(t,Vt(r.props.preSelection))})),xt(_t(r),"onYearClick",(function(e,t){var n=r.props.date;r.handleYearClick(Vt($e.default(n,t)),e)})),xt(_t(r),"onYearKeyDown",(function(e,t){var n=e.key;if(!r.props.disabledKeyboardNavigation)switch(n){case"Enter":r.onYearClick(e,t),r.props.setPreSelection(r.props.selected);break;case"ArrowRight":r.handleYearNavigation(t+1,ye.default(r.props.preSelection,1));break;case"ArrowLeft":r.handleYearNavigation(t-1,Se.default(r.props.preSelection,1))}})),xt(_t(r),"getYearClassNames",(function(e){var t=r.props,n=t.minDate,a=t.maxDate,s=t.selected;return ue.default("react-datepicker__year-text",{"react-datepicker__year-text--selected":e===Oe.default(s),"react-datepicker__year-text--disabled":(n||a)&&ln(e,r.props),"react-datepicker__year-text--keyboard-selected":r.isKeyboardSelected(e),"react-datepicker__year-text--today":r.isCurrentYear(e)})})),xt(_t(r),"getYearTabIndex",(function(e){return r.props.disabledKeyboardNavigation?"-1":e===Oe.default(r.props.preSelection)?"0":"-1"})),r}return gt(n,[{key:"render",value:function(){for(var e=this,t=[],n=this.props,r=jn(n.date,n.yearItemNumber),a=r.startPeriod,s=r.endPeriod,i=function(n){t.push(de.default.createElement("div",{ref:e.YEAR_REFS[n-a],onClick:function(t){e.onYearClick(t,n)},onKeyDown:function(t){e.onYearKeyDown(t,n)},tabIndex:e.getYearTabIndex(n),className:e.getYearClassNames(n),key:n,"aria-current":e.isCurrentYear(n)?"date":void 0},n))},o=a;o<=s;o++)i(o);return de.default.createElement("div",{className:"react-datepicker__year"},de.default.createElement("div",{className:"react-datepicker__year-wrapper"},t))}}]),n}(de.default.Component),Un=function(e){bt(n,e);var t=St(n);function n(e){var r;return ht(this,n),xt(_t(r=t.call(this,e)),"onTimeChange",(function(e){r.setState({time:e});var t=new Date;t.setHours(e.split(":")[0]),t.setMinutes(e.split(":")[1]),r.props.onChange(t)})),xt(_t(r),"renderTimeInput",(function(){var e=r.state.time,t=r.props,n=t.date,a=t.timeString,s=t.customTimeInput;return s?de.default.cloneElement(s,{date:n,value:e,onChange:r.onTimeChange}):de.default.createElement("input",{type:"time",className:"react-datepicker-time__input",placeholder:"Time",name:"time-input",required:!0,value:e,onChange:function(e){r.onTimeChange(e.target.value||a)}})})),r.state={time:r.props.timeString},r}return gt(n,[{key:"render",value:function(){return de.default.createElement("div",{className:"react-datepicker__input-time-container"},de.default.createElement("div",{className:"react-datepicker-time__caption"},this.props.timeInputLabel),de.default.createElement("div",{className:"react-datepicker-time__input-container"},de.default.createElement("div",{className:"react-datepicker-time__input"},this.renderTimeInput())))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return e.timeString!==t.time?{time:e.timeString}:null}}]),n}(de.default.Component);function Zn(e){var t=e.className,n=e.children,r=e.showPopperArrow,a=e.arrowProps,s=void 0===a?{}:a;return de.default.createElement("div",{className:t},r&&de.default.createElement("div",vt({className:"react-datepicker__triangle"},s)),n)}var Vn=["react-datepicker__year-select","react-datepicker__month-select","react-datepicker__month-year-select"],Wn=function(e){bt(n,e);var t=St(n);function n(e){var r;return ht(this,n),xt(_t(r=t.call(this,e)),"handleClickOutside",(function(e){r.props.onClickOutside(e)})),xt(_t(r),"setClickOutsideRef",(function(){return r.containerRef.current})),xt(_t(r),"handleDropdownFocus",(function(e){(function(){var e=((arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).className||"").split(/\s+/);return Vn.some((function(t){return e.indexOf(t)>=0}))})(e.target)&&r.props.onDropdownFocus()})),xt(_t(r),"getDateInView",(function(){var e=r.props,t=e.preSelection,n=e.selected,a=e.openToDate,s=vn(r.props),i=bn(r.props),o=At();return a||n||t||(s&&at.default(o,s)?s:i&&rt.default(o,i)?i:o)})),xt(_t(r),"increaseMonth",(function(){r.setState((function(e){var t=e.date;return{date:be.default(t,1)}}),(function(){return r.handleMonthChange(r.state.date)}))})),xt(_t(r),"decreaseMonth",(function(){r.setState((function(e){var t=e.date;return{date:je.default(t,1)}}),(function(){return r.handleMonthChange(r.state.date)}))})),xt(_t(r),"handleDayClick",(function(e,t,n){r.props.onSelect(e,t,n),r.props.setPreSelection&&r.props.setPreSelection(e)})),xt(_t(r),"handleDayMouseEnter",(function(e){r.setState({selectingDate:e}),r.props.onDayMouseEnter&&r.props.onDayMouseEnter(e)})),xt(_t(r),"handleMonthMouseLeave",(function(){r.setState({selectingDate:null}),r.props.onMonthMouseLeave&&r.props.onMonthMouseLeave()})),xt(_t(r),"handleYearChange",(function(e){r.props.onYearChange&&r.props.onYearChange(e),r.props.adjustDateOnChange&&(r.props.onSelect&&r.props.onSelect(e),r.props.setOpen&&r.props.setOpen(!0)),r.props.setPreSelection&&r.props.setPreSelection(e)})),xt(_t(r),"handleMonthChange",(function(e){r.props.onMonthChange&&r.props.onMonthChange(e),r.props.adjustDateOnChange&&(r.props.onSelect&&r.props.onSelect(e),r.props.setOpen&&r.props.setOpen(!0)),r.props.setPreSelection&&r.props.setPreSelection(e)})),xt(_t(r),"handleMonthYearChange",(function(e){r.handleYearChange(e),r.handleMonthChange(e)})),xt(_t(r),"changeYear",(function(e){r.setState((function(t){var n=t.date;return{date:$e.default(n,e)}}),(function(){return r.handleYearChange(r.state.date)}))})),xt(_t(r),"changeMonth",(function(e){r.setState((function(t){var n=t.date;return{date:Fe.default(n,e)}}),(function(){return r.handleMonthChange(r.state.date)}))})),xt(_t(r),"changeMonthYear",(function(e){r.setState((function(t){var n=t.date;return{date:$e.default(Fe.default(n,Ee.default(e)),Oe.default(e))}}),(function(){return r.handleMonthYearChange(r.state.date)}))})),xt(_t(r),"header",(function(){var e=Ut(arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.state.date,r.props.locale,r.props.calendarStartDay),t=[];return r.props.showWeekNumbers&&t.push(de.default.createElement("div",{key:"W",className:"react-datepicker__day-name"},r.props.weekLabel||"#")),t.concat([0,1,2,3,4,5,6].map((function(t){var n=xe.default(e,t),a=r.formatWeekday(n,r.props.locale),s=r.props.weekDayClassName?r.props.weekDayClassName(n):void 0;return de.default.createElement("div",{key:t,className:ue.default("react-datepicker__day-name",s)},a)})))})),xt(_t(r),"formatWeekday",(function(e,t){return r.props.formatWeekDay?function(e,t,n){return t(Pt(e,"EEEE",n))}(e,r.props.formatWeekDay,t):r.props.useWeekdaysShort?function(e,t){return Pt(e,"EEE",t)}(e,t):function(e,t){return Pt(e,"EEEEEE",t)}(e,t)})),xt(_t(r),"decreaseYear",(function(){r.setState((function(e){var t=e.date;return{date:Se.default(t,r.props.showYearPicker?r.props.yearItemNumber:1)}}),(function(){return r.handleYearChange(r.state.date)}))})),xt(_t(r),"renderPreviousButton",(function(){if(!r.props.renderCustomHeader){var e;switch(!0){case r.props.showMonthYearPicker:e=gn(r.state.date,r.props);break;case r.props.showYearPicker:e=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,r=t.yearItemNumber,a=void 0===r?Dt:r,s=jn(Vt(Se.default(e,a)),a).endPeriod,i=n&&Oe.default(n);return i&&i>s||!1}(r.state.date,r.props);break;default:e=hn(r.state.date,r.props)}if((r.props.forceShowMonthNavigation||r.props.showDisabledMonthNavigation||!e)&&!r.props.showTimeSelectOnly){var t=["react-datepicker__navigation","react-datepicker__navigation--previous"],n=r.decreaseMonth;(r.props.showMonthYearPicker||r.props.showQuarterYearPicker||r.props.showYearPicker)&&(n=r.decreaseYear),e&&r.props.showDisabledMonthNavigation&&(t.push("react-datepicker__navigation--previous--disabled"),n=null);var a=r.props.showMonthYearPicker||r.props.showQuarterYearPicker||r.props.showYearPicker,s=r.props,i=s.previousMonthButtonLabel,o=s.previousYearButtonLabel,l=r.props,c=l.previousMonthAriaLabel,d=void 0===c?"string"==typeof i?i:"Previous Month":c,u=l.previousYearAriaLabel,p=void 0===u?"string"==typeof o?o:"Previous Year":u;return de.default.createElement("button",{type:"button",className:t.join(" "),onClick:n,onKeyDown:r.props.handleOnKeyDown,"aria-label":a?p:d},de.default.createElement("span",{className:["react-datepicker__navigation-icon","react-datepicker__navigation-icon--previous"].join(" ")},a?r.props.previousYearButtonLabel:r.props.previousMonthButtonLabel))}}})),xt(_t(r),"increaseYear",(function(){r.setState((function(e){var t=e.date;return{date:ye.default(t,r.props.showYearPicker?r.props.yearItemNumber:1)}}),(function(){return r.handleYearChange(r.state.date)}))})),xt(_t(r),"renderNextButton",(function(){if(!r.props.renderCustomHeader){var e;switch(!0){case r.props.showMonthYearPicker:e=xn(r.state.date,r.props);break;case r.props.showYearPicker:e=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.maxDate,r=t.yearItemNumber,a=void 0===r?Dt:r,s=jn(ye.default(e,a),a).startPeriod,i=n&&Oe.default(n);return i&&i<s||!1}(r.state.date,r.props);break;default:e=fn(r.state.date,r.props)}if((r.props.forceShowMonthNavigation||r.props.showDisabledMonthNavigation||!e)&&!r.props.showTimeSelectOnly){var t=["react-datepicker__navigation","react-datepicker__navigation--next"];r.props.showTimeSelect&&t.push("react-datepicker__navigation--next--with-time"),r.props.todayButton&&t.push("react-datepicker__navigation--next--with-today-button");var n=r.increaseMonth;(r.props.showMonthYearPicker||r.props.showQuarterYearPicker||r.props.showYearPicker)&&(n=r.increaseYear),e&&r.props.showDisabledMonthNavigation&&(t.push("react-datepicker__navigation--next--disabled"),n=null);var a=r.props.showMonthYearPicker||r.props.showQuarterYearPicker||r.props.showYearPicker,s=r.props,i=s.nextMonthButtonLabel,o=s.nextYearButtonLabel,l=r.props,c=l.nextMonthAriaLabel,d=void 0===c?"string"==typeof i?i:"Next Month":c,u=l.nextYearAriaLabel,p=void 0===u?"string"==typeof o?o:"Next Year":u;return de.default.createElement("button",{type:"button",className:t.join(" "),onClick:n,onKeyDown:r.props.handleOnKeyDown,"aria-label":a?p:d},de.default.createElement("span",{className:["react-datepicker__navigation-icon","react-datepicker__navigation-icon--next"].join(" ")},a?r.props.nextYearButtonLabel:r.props.nextMonthButtonLabel))}}})),xt(_t(r),"renderCurrentMonth",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.state.date,t=["react-datepicker__current-month"];return r.props.showYearDropdown&&t.push("react-datepicker__current-month--hasYearDropdown"),r.props.showMonthDropdown&&t.push("react-datepicker__current-month--hasMonthDropdown"),r.props.showMonthYearDropdown&&t.push("react-datepicker__current-month--hasMonthYearDropdown"),de.default.createElement("div",{className:t.join(" ")},Pt(e,r.props.dateFormat,r.props.locale))})),xt(_t(r),"renderYearDropdown",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(r.props.showYearDropdown&&!e)return de.default.createElement(Tn,{adjustDateOnChange:r.props.adjustDateOnChange,date:r.state.date,onSelect:r.props.onSelect,setOpen:r.props.setOpen,dropdownMode:r.props.dropdownMode,onChange:r.changeYear,minDate:r.props.minDate,maxDate:r.props.maxDate,year:Oe.default(r.state.date),scrollableYearDropdown:r.props.scrollableYearDropdown,yearDropdownItemNumber:r.props.yearDropdownItemNumber})})),xt(_t(r),"renderMonthDropdown",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(r.props.showMonthDropdown&&!e)return de.default.createElement(Dn,{dropdownMode:r.props.dropdownMode,locale:r.props.locale,onChange:r.changeMonth,month:Ee.default(r.state.date),useShortMonthInDropdown:r.props.useShortMonthInDropdown})})),xt(_t(r),"renderMonthYearDropdown",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(r.props.showMonthYearDropdown&&!e)return de.default.createElement(Rn,{dropdownMode:r.props.dropdownMode,locale:r.props.locale,dateFormat:r.props.dateFormat,onChange:r.changeMonthYear,minDate:r.props.minDate,maxDate:r.props.maxDate,date:r.state.date,scrollableMonthYearDropdown:r.props.scrollableMonthYearDropdown})})),xt(_t(r),"renderTodayButton",(function(){if(r.props.todayButton&&!r.props.showTimeSelectOnly)return de.default.createElement("div",{className:"react-datepicker__today-button",onClick:function(e){return r.props.onSelect(Be.default(At()),e)}},r.props.todayButton)})),xt(_t(r),"renderDefaultHeader",(function(e){var t=e.monthDate,n=e.i;return de.default.createElement("div",{className:"react-datepicker__header ".concat(r.props.showTimeSelect?"react-datepicker__header--has-time-select":"")},r.renderCurrentMonth(t),de.default.createElement("div",{className:"react-datepicker__header__dropdown react-datepicker__header__dropdown--".concat(r.props.dropdownMode),onFocus:r.handleDropdownFocus},r.renderMonthDropdown(0!==n),r.renderMonthYearDropdown(0!==n),r.renderYearDropdown(0!==n)),de.default.createElement("div",{className:"react-datepicker__day-names"},r.header(t)))})),xt(_t(r),"renderCustomHeader",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.monthDate,n=e.i;if(r.props.showTimeSelect&&!r.state.monthContainer||r.props.showTimeSelectOnly)return null;var a=hn(r.state.date,r.props),s=fn(r.state.date,r.props),i=gn(r.state.date,r.props),o=xn(r.state.date,r.props),l=!r.props.showMonthYearPicker&&!r.props.showQuarterYearPicker&&!r.props.showYearPicker;return de.default.createElement("div",{className:"react-datepicker__header react-datepicker__header--custom",onFocus:r.props.onDropdownFocus},r.props.renderCustomHeader(pt(pt({},r.state),{},{customHeaderCount:n,monthDate:t,changeMonth:r.changeMonth,changeYear:r.changeYear,decreaseMonth:r.decreaseMonth,increaseMonth:r.increaseMonth,decreaseYear:r.decreaseYear,increaseYear:r.increaseYear,prevMonthButtonDisabled:a,nextMonthButtonDisabled:s,prevYearButtonDisabled:i,nextYearButtonDisabled:o})),l&&de.default.createElement("div",{className:"react-datepicker__day-names"},r.header(t)))})),xt(_t(r),"renderYearHeader",(function(){var e=r.state.date,t=r.props,n=t.showYearPicker,a=jn(e,t.yearItemNumber),s=a.startPeriod,i=a.endPeriod;return de.default.createElement("div",{className:"react-datepicker__header react-datepicker-year-header"},n?"".concat(s," - ").concat(i):Oe.default(e))})),xt(_t(r),"renderHeader",(function(e){switch(!0){case void 0!==r.props.renderCustomHeader:return r.renderCustomHeader(e);case r.props.showMonthYearPicker||r.props.showQuarterYearPicker||r.props.showYearPicker:return r.renderYearHeader(e);default:return r.renderDefaultHeader(e)}})),xt(_t(r),"renderMonths",(function(){if(!r.props.showTimeSelectOnly&&!r.props.showYearPicker){for(var e=[],t=r.props.showPreviousMonths?r.props.monthsShown-1:0,n=je.default(r.state.date,t),a=0;a<r.props.monthsShown;++a){var s=a-r.props.monthSelectedIn,i=be.default(n,s),o="month-".concat(a),l=a<r.props.monthsShown-1,c=a>0;e.push(de.default.createElement("div",{key:o,ref:function(e){r.monthContainer=e},className:"react-datepicker__month-container"},r.renderHeader({monthDate:i,i:a}),de.default.createElement(Fn,{chooseDayAriaLabelPrefix:r.props.chooseDayAriaLabelPrefix,disabledDayAriaLabelPrefix:r.props.disabledDayAriaLabelPrefix,weekAriaLabelPrefix:r.props.weekAriaLabelPrefix,onChange:r.changeMonthYear,day:i,dayClassName:r.props.dayClassName,calendarStartDay:r.props.calendarStartDay,monthClassName:r.props.monthClassName,onDayClick:r.handleDayClick,handleOnKeyDown:r.props.handleOnDayKeyDown,onDayMouseEnter:r.handleDayMouseEnter,onMouseLeave:r.handleMonthMouseLeave,onWeekSelect:r.props.onWeekSelect,orderInDisplay:a,formatWeekNumber:r.props.formatWeekNumber,locale:r.props.locale,minDate:r.props.minDate,maxDate:r.props.maxDate,excludeDates:r.props.excludeDates,excludeDateIntervals:r.props.excludeDateIntervals,highlightDates:r.props.highlightDates,selectingDate:r.state.selectingDate,includeDates:r.props.includeDates,includeDateIntervals:r.props.includeDateIntervals,inline:r.props.inline,shouldFocusDayInline:r.props.shouldFocusDayInline,fixedHeight:r.props.fixedHeight,filterDate:r.props.filterDate,preSelection:r.props.preSelection,setPreSelection:r.props.setPreSelection,selected:r.props.selected,selectsStart:r.props.selectsStart,selectsEnd:r.props.selectsEnd,selectsRange:r.props.selectsRange,selectsDisabledDaysInRange:r.props.selectsDisabledDaysInRange,showWeekNumbers:r.props.showWeekNumbers,startDate:r.props.startDate,endDate:r.props.endDate,peekNextMonth:r.props.peekNextMonth,setOpen:r.props.setOpen,shouldCloseOnSelect:r.props.shouldCloseOnSelect,renderDayContents:r.props.renderDayContents,disabledKeyboardNavigation:r.props.disabledKeyboardNavigation,showMonthYearPicker:r.props.showMonthYearPicker,showFullMonthYearPicker:r.props.showFullMonthYearPicker,showTwoColumnMonthYearPicker:r.props.showTwoColumnMonthYearPicker,showFourColumnMonthYearPicker:r.props.showFourColumnMonthYearPicker,showYearPicker:r.props.showYearPicker,showQuarterYearPicker:r.props.showQuarterYearPicker,isInputFocused:r.props.isInputFocused,containerRef:r.containerRef,monthShowsDuplicateDaysEnd:l,monthShowsDuplicateDaysStart:c})))}return e}})),xt(_t(r),"renderYears",(function(){if(!r.props.showTimeSelectOnly)return r.props.showYearPicker?de.default.createElement("div",{className:"react-datepicker__year--container"},r.renderHeader(),de.default.createElement($n,vt({onDayClick:r.handleDayClick,date:r.state.date},r.props))):void 0})),xt(_t(r),"renderTimeSection",(function(){if(r.props.showTimeSelect&&(r.state.monthContainer||r.props.showTimeSelectOnly))return de.default.createElement(qn,{selected:r.props.selected,openToDate:r.props.openToDate,onChange:r.props.onTimeChange,timeClassName:r.props.timeClassName,format:r.props.timeFormat,includeTimes:r.props.includeTimes,intervals:r.props.timeIntervals,minTime:r.props.minTime,maxTime:r.props.maxTime,excludeTimes:r.props.excludeTimes,filterTime:r.props.filterTime,timeCaption:r.props.timeCaption,todayButton:r.props.todayButton,showMonthDropdown:r.props.showMonthDropdown,showMonthYearDropdown:r.props.showMonthYearDropdown,showYearDropdown:r.props.showYearDropdown,withPortal:r.props.withPortal,monthRef:r.state.monthContainer,injectTimes:r.props.injectTimes,locale:r.props.locale,handleOnKeyDown:r.props.handleOnKeyDown,showTimeSelectOnly:r.props.showTimeSelectOnly})})),xt(_t(r),"renderInputTimeSection",(function(){var e=new Date(r.props.selected),t=Rt(e)&&Boolean(r.props.selected)?"".concat(_n(e.getHours()),":").concat(_n(e.getMinutes())):"";if(r.props.showTimeInput)return de.default.createElement(Un,{date:e,timeString:t,timeInputLabel:r.props.timeInputLabel,onChange:r.props.onTimeChange,customTimeInput:r.props.customTimeInput})})),r.containerRef=de.default.createRef(),r.state={date:r.getDateInView(),selectingDate:null,monthContainer:null},r}return gt(n,[{key:"componentDidMount",value:function(){this.props.showTimeSelect&&(this.assignMonthContainer=void this.setState({monthContainer:this.monthContainer}))}},{key:"componentDidUpdate",value:function(e){this.props.preSelection&&!zt(this.props.preSelection,e.preSelection)?this.setState({date:this.props.preSelection}):this.props.openToDate&&!zt(this.props.openToDate,e.openToDate)&&this.setState({date:this.props.openToDate})}},{key:"render",value:function(){var e=this.props.container||Zn;return de.default.createElement("div",{ref:this.containerRef},de.default.createElement(e,{className:ue.default("react-datepicker",this.props.className,{"react-datepicker--time-only":this.props.showTimeSelectOnly}),showPopperArrow:this.props.showPopperArrow,arrowProps:this.props.arrowProps},this.renderPreviousButton(),this.renderNextButton(),this.renderMonths(),this.renderYears(),this.renderTodayButton(),this.renderTimeSection(),this.renderInputTimeSection(),this.props.children))}}],[{key:"defaultProps",get:function(){return{onDropdownFocus:function(){},monthsShown:1,monthSelectedIn:0,forceShowMonthNavigation:!1,timeCaption:"Time",previousYearButtonLabel:"Previous Year",nextYearButtonLabel:"Next Year",previousMonthButtonLabel:"Previous Month",nextMonthButtonLabel:"Next Month",customTimeInput:null,yearItemNumber:Dt}}}]),n}(de.default.Component),Yn=function(e){bt(n,e);var t=St(n);function n(e){var r;return ht(this,n),(r=t.call(this,e)).el=document.createElement("div"),r}return gt(n,[{key:"componentDidMount",value:function(){this.portalRoot=(this.props.portalHost||document).getElementById(this.props.portalId),this.portalRoot||(this.portalRoot=document.createElement("div"),this.portalRoot.setAttribute("id",this.props.portalId),(this.props.portalHost||document.body).appendChild(this.portalRoot)),this.portalRoot.appendChild(this.el)}},{key:"componentWillUnmount",value:function(){this.portalRoot.removeChild(this.el)}},{key:"render",value:function(){return dt.default.createPortal(this.props.children,this.el)}}]),n}(de.default.Component),Bn=function(e){return!e.disabled&&-1!==e.tabIndex},Hn=function(e){bt(n,e);var t=St(n);function n(e){var r;return ht(this,n),xt(_t(r=t.call(this,e)),"getTabChildren",(function(){return Array.prototype.slice.call(r.tabLoopRef.current.querySelectorAll("[tabindex], a, button, input, select, textarea"),1,-1).filter(Bn)})),xt(_t(r),"handleFocusStart",(function(e){var t=r.getTabChildren();t&&t.length>1&&t[t.length-1].focus()})),xt(_t(r),"handleFocusEnd",(function(e){var t=r.getTabChildren();t&&t.length>1&&t[0].focus()})),r.tabLoopRef=de.default.createRef(),r}return gt(n,[{key:"render",value:function(){return this.props.enableTabLoop?de.default.createElement("div",{className:"react-datepicker__tab-loop",ref:this.tabLoopRef},de.default.createElement("div",{className:"react-datepicker__tab-loop__start",tabIndex:"0",onFocus:this.handleFocusStart}),this.props.children,de.default.createElement("div",{className:"react-datepicker__tab-loop__end",tabIndex:"0",onFocus:this.handleFocusEnd})):this.props.children}}],[{key:"defaultProps",get:function(){return{enableTabLoop:!0}}}]),n}(de.default.Component),zn=function(e){bt(n,e);var t=St(n);function n(){return ht(this,n),t.apply(this,arguments)}return gt(n,[{key:"render",value:function(){var e,t=this.props,n=t.className,r=t.wrapperClassName,a=t.hidePopper,s=t.popperComponent,i=t.popperModifiers,o=t.popperPlacement,l=t.popperProps,c=t.targetComponent,d=t.enableTabLoop,u=t.popperOnKeyDown,p=t.portalId,m=t.portalHost;if(!a){var h=ue.default("react-datepicker-popper",n);e=de.default.createElement(le.Popper,vt({modifiers:i,placement:o},l),(function(e){var t=e.ref,n=e.style,r=e.placement,a=e.arrowProps;return de.default.createElement(Hn,{enableTabLoop:d},de.default.createElement("div",{ref:t,style:n,className:h,"data-placement":r,onKeyDown:u},de.default.cloneElement(s,{arrowProps:a})))}))}this.props.popperContainer&&(e=de.default.createElement(this.props.popperContainer,{},e)),p&&!a&&(e=de.default.createElement(Yn,{portalId:p,portalHost:m},e));var f=ue.default("react-datepicker-wrapper",r);return de.default.createElement(le.Manager,{className:"react-datepicker-manager"},de.default.createElement(le.Reference,null,(function(e){var t=e.ref;return de.default.createElement("div",{ref:t,className:f},c)})),e)}}],[{key:"defaultProps",get:function(){return{hidePopper:!0,popperModifiers:[],popperProps:{},popperPlacement:"bottom-start"}}}]),n}(de.default.Component),Gn="react-datepicker-ignore-onclickoutside",Kn=ct.default(Wn),Qn="Date input not valid.",Xn=function(e){bt(n,e);var t=St(n);function n(e){var r;return ht(this,n),xt(_t(r=t.call(this,e)),"getPreSelection",(function(){return r.props.openToDate?r.props.openToDate:r.props.selectsEnd&&r.props.startDate?r.props.startDate:r.props.selectsStart&&r.props.endDate?r.props.endDate:At()})),xt(_t(r),"calcInitialState",(function(){var e,t=r.getPreSelection(),n=vn(r.props),a=bn(r.props),s=n&&at.default(t,Be.default(n))?n:a&&rt.default(t,Qe.default(a))?a:t;return{open:r.props.startOpen||!1,preventFocus:!1,preSelection:null!==(e=r.props.selectsRange?r.props.startDate:r.props.selected)&&void 0!==e?e:s,highlightDates:yn(r.props.highlightDates),focused:!1,shouldFocusDayInline:!1}})),xt(_t(r),"clearPreventFocusTimeout",(function(){r.preventFocusTimeout&&clearTimeout(r.preventFocusTimeout)})),xt(_t(r),"setFocus",(function(){r.input&&r.input.focus&&r.input.focus({preventScroll:!0})})),xt(_t(r),"setBlur",(function(){r.input&&r.input.blur&&r.input.blur(),r.cancelFocusInput()})),xt(_t(r),"setOpen",(function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];r.setState({open:e,preSelection:e&&r.state.open?r.state.preSelection:r.calcInitialState().preSelection,lastPreSelectChange:er},(function(){e||r.setState((function(e){return{focused:!!t&&e.focused}}),(function(){!t&&r.setBlur(),r.setState({inputValue:null})}))}))})),xt(_t(r),"inputOk",(function(){return pe.default(r.state.preSelection)})),xt(_t(r),"isCalendarOpen",(function(){return void 0===r.props.open?r.state.open&&!r.props.disabled&&!r.props.readOnly:r.props.open})),xt(_t(r),"handleFocus",(function(e){r.state.preventFocus||(r.props.onFocus(e),r.props.preventOpenOnFocus||r.props.readOnly||r.setOpen(!0)),r.setState({focused:!0})})),xt(_t(r),"cancelFocusInput",(function(){clearTimeout(r.inputFocusTimeout),r.inputFocusTimeout=null})),xt(_t(r),"deferFocusInput",(function(){r.cancelFocusInput(),r.inputFocusTimeout=setTimeout((function(){return r.setFocus()}),1)})),xt(_t(r),"handleDropdownFocus",(function(){r.cancelFocusInput()})),xt(_t(r),"handleBlur",(function(e){(!r.state.open||r.props.withPortal||r.props.showTimeInput)&&r.props.onBlur(e),r.setState({focused:!1})})),xt(_t(r),"handleCalendarClickOutside",(function(e){r.props.inline||r.setOpen(!1),r.props.onClickOutside(e),r.props.withPortal&&e.preventDefault()})),xt(_t(r),"handleChange",(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var a=t[0];if(!r.props.onChangeRaw||(r.props.onChangeRaw.apply(_t(r),t),"function"==typeof a.isDefaultPrevented&&!a.isDefaultPrevented())){r.setState({inputValue:a.target.value,lastPreSelectChange:Jn});var s=Ot(a.target.value,r.props.dateFormat,r.props.locale,r.props.strictParsing,r.props.minDate);!s&&a.target.value||r.setSelected(s,a,!0)}})),xt(_t(r),"handleSelect",(function(e,t,n){if(r.setState({preventFocus:!0},(function(){return r.preventFocusTimeout=setTimeout((function(){return r.setState({preventFocus:!1})}),50),r.preventFocusTimeout})),r.props.onChangeRaw&&r.props.onChangeRaw(t),r.setSelected(e,t,!1,n),!r.props.shouldCloseOnSelect||r.props.showTimeSelect)r.setPreSelection(e);else if(!r.props.inline){r.props.selectsRange||r.setOpen(!1);var a=r.props,s=a.startDate,i=a.endDate;!s||i||at.default(e,s)||r.setOpen(!1)}})),xt(_t(r),"setSelected",(function(e,t,n,a){var s=e;if(null===s||!nn(s,r.props)){var i=r.props,o=i.onChange,l=i.selectsRange,c=i.startDate,d=i.endDate;if(!Gt(r.props.selected,s)||r.props.allowSameDay||l)if(null!==s&&(!r.props.selected||n&&(r.props.showTimeSelect||r.props.showTimeSelectOnly||r.props.showTimeInput)||(s=Lt(s,{hour:Te.default(r.props.selected),minute:Ce.default(r.props.selected),second:Ie.default(r.props.selected)})),r.props.inline||r.setState({preSelection:s}),r.props.focusSelectedMonth||r.setState({monthSelectedIn:a})),l){var u=c&&d;c||d?c&&!d&&(at.default(s,c)?o([s,null],t):o([c,s],t)):o([s,null],t),u&&o([s,null],t)}else o(s,t);n||(r.props.onSelect(s,t),r.setState({inputValue:null}))}})),xt(_t(r),"setPreSelection",(function(e){var t=void 0!==r.props.minDate,n=void 0!==r.props.maxDate,a=!0;if(e){var s=Be.default(e);if(t&&n)a=Kt(e,r.props.minDate,r.props.maxDate);else if(t){var i=Be.default(r.props.minDate);a=rt.default(e,i)||Gt(s,i)}else if(n){var o=Qe.default(r.props.maxDate);a=at.default(e,o)||Gt(s,o)}}a&&r.setState({preSelection:e})})),xt(_t(r),"handleTimeChange",(function(e){var t=Lt(r.props.selected?r.props.selected:r.getPreSelection(),{hour:Te.default(e),minute:Ce.default(e)});r.setState({preSelection:t}),r.props.onChange(t),r.props.shouldCloseOnSelect&&r.setOpen(!1),r.props.showTimeInput&&r.setOpen(!0),r.setState({inputValue:null})})),xt(_t(r),"onInputClick",(function(){r.props.disabled||r.props.readOnly||r.setOpen(!0),r.props.onInputClick()})),xt(_t(r),"onInputKeyDown",(function(e){r.props.onKeyDown(e);var t=e.key;if(r.state.open||r.props.inline||r.props.preventOpenOnFocus){if(r.state.open){if("ArrowDown"===t||"ArrowUp"===t){e.preventDefault();var n=r.calendar.componentNode&&r.calendar.componentNode.querySelector('.react-datepicker__day[tabindex="0"]');return void(n&&n.focus({preventScroll:!0}))}var a=At(r.state.preSelection);"Enter"===t?(e.preventDefault(),r.inputOk()&&r.state.lastPreSelectChange===er?(r.handleSelect(a,e),!r.props.shouldCloseOnSelect&&r.setPreSelection(a)):r.setOpen(!1)):"Escape"===t&&(e.preventDefault(),r.setOpen(!1)),r.inputOk()||r.props.onInputError({code:1,msg:Qn})}}else"ArrowDown"!==t&&"ArrowUp"!==t&&"Enter"!==t||r.onInputClick()})),xt(_t(r),"onDayKeyDown",(function(e){r.props.onKeyDown(e);var t=e.key,n=At(r.state.preSelection);if("Enter"===t)e.preventDefault(),r.handleSelect(n,e),!r.props.shouldCloseOnSelect&&r.setPreSelection(n);else if("Escape"===t)e.preventDefault(),r.setOpen(!1),r.inputOk()||r.props.onInputError({code:1,msg:Qn});else if(!r.props.disabledKeyboardNavigation){var a;switch(t){case"ArrowLeft":a=we.default(n,1);break;case"ArrowRight":a=xe.default(n,1);break;case"ArrowUp":a=_e.default(n,1);break;case"ArrowDown":a=ve.default(n,1);break;case"PageUp":a=je.default(n,1);break;case"PageDown":a=be.default(n,1);break;case"Home":a=Se.default(n,1);break;case"End":a=ye.default(n,1)}if(!a)return void(r.props.onInputError&&r.props.onInputError({code:1,msg:Qn}));if(e.preventDefault(),r.setState({lastPreSelectChange:er}),r.props.adjustDateOnChange&&r.setSelected(a),r.setPreSelection(a),r.props.inline){var s=Ee.default(n),i=Ee.default(a),o=Oe.default(n),l=Oe.default(a);s!==i||o!==l?r.setState({shouldFocusDayInline:!0}):r.setState({shouldFocusDayInline:!1})}}})),xt(_t(r),"onPopperKeyDown",(function(e){"Escape"===e.key&&(e.preventDefault(),r.setState({preventFocus:!0},(function(){r.setOpen(!1),setTimeout((function(){r.setFocus(),r.setState({preventFocus:!1})}))})))})),xt(_t(r),"onClearClick",(function(e){e&&e.preventDefault&&e.preventDefault(),r.props.selectsRange?r.props.onChange([null,null],e):r.props.onChange(null,e),r.setState({inputValue:null})})),xt(_t(r),"clear",(function(){r.onClearClick()})),xt(_t(r),"onScroll",(function(e){"boolean"==typeof r.props.closeOnScroll&&r.props.closeOnScroll?e.target!==document&&e.target!==document.documentElement&&e.target!==document.body||r.setOpen(!1):"function"==typeof r.props.closeOnScroll&&r.props.closeOnScroll(e)&&r.setOpen(!1)})),xt(_t(r),"renderCalendar",(function(){return r.props.inline||r.isCalendarOpen()?de.default.createElement(Kn,{ref:function(e){r.calendar=e},locale:r.props.locale,calendarStartDay:r.props.calendarStartDay,chooseDayAriaLabelPrefix:r.props.chooseDayAriaLabelPrefix,disabledDayAriaLabelPrefix:r.props.disabledDayAriaLabelPrefix,weekAriaLabelPrefix:r.props.weekAriaLabelPrefix,adjustDateOnChange:r.props.adjustDateOnChange,setOpen:r.setOpen,shouldCloseOnSelect:r.props.shouldCloseOnSelect,dateFormat:r.props.dateFormatCalendar,useWeekdaysShort:r.props.useWeekdaysShort,formatWeekDay:r.props.formatWeekDay,dropdownMode:r.props.dropdownMode,selected:r.props.selected,preSelection:r.state.preSelection,onSelect:r.handleSelect,onWeekSelect:r.props.onWeekSelect,openToDate:r.props.openToDate,minDate:r.props.minDate,maxDate:r.props.maxDate,selectsStart:r.props.selectsStart,selectsEnd:r.props.selectsEnd,selectsRange:r.props.selectsRange,startDate:r.props.startDate,endDate:r.props.endDate,excludeDates:r.props.excludeDates,excludeDateIntervals:r.props.excludeDateIntervals,filterDate:r.props.filterDate,onClickOutside:r.handleCalendarClickOutside,formatWeekNumber:r.props.formatWeekNumber,highlightDates:r.state.highlightDates,includeDates:r.props.includeDates,includeDateIntervals:r.props.includeDateIntervals,includeTimes:r.props.includeTimes,injectTimes:r.props.injectTimes,inline:r.props.inline,shouldFocusDayInline:r.state.shouldFocusDayInline,peekNextMonth:r.props.peekNextMonth,showMonthDropdown:r.props.showMonthDropdown,showPreviousMonths:r.props.showPreviousMonths,useShortMonthInDropdown:r.props.useShortMonthInDropdown,showMonthYearDropdown:r.props.showMonthYearDropdown,showWeekNumbers:r.props.showWeekNumbers,showYearDropdown:r.props.showYearDropdown,withPortal:r.props.withPortal,forceShowMonthNavigation:r.props.forceShowMonthNavigation,showDisabledMonthNavigation:r.props.showDisabledMonthNavigation,scrollableYearDropdown:r.props.scrollableYearDropdown,scrollableMonthYearDropdown:r.props.scrollableMonthYearDropdown,todayButton:r.props.todayButton,weekLabel:r.props.weekLabel,outsideClickIgnoreClass:Gn,fixedHeight:r.props.fixedHeight,monthsShown:r.props.monthsShown,monthSelectedIn:r.state.monthSelectedIn,onDropdownFocus:r.handleDropdownFocus,onMonthChange:r.props.onMonthChange,onYearChange:r.props.onYearChange,dayClassName:r.props.dayClassName,weekDayClassName:r.props.weekDayClassName,monthClassName:r.props.monthClassName,timeClassName:r.props.timeClassName,showTimeSelect:r.props.showTimeSelect,showTimeSelectOnly:r.props.showTimeSelectOnly,onTimeChange:r.handleTimeChange,timeFormat:r.props.timeFormat,timeIntervals:r.props.timeIntervals,minTime:r.props.minTime,maxTime:r.props.maxTime,excludeTimes:r.props.excludeTimes,filterTime:r.props.filterTime,timeCaption:r.props.timeCaption,className:r.props.calendarClassName,container:r.props.calendarContainer,yearItemNumber:r.props.yearItemNumber,yearDropdownItemNumber:r.props.yearDropdownItemNumber,previousMonthAriaLabel:r.props.previousMonthAriaLabel,previousMonthButtonLabel:r.props.previousMonthButtonLabel,nextMonthAriaLabel:r.props.nextMonthAriaLabel,nextMonthButtonLabel:r.props.nextMonthButtonLabel,previousYearAriaLabel:r.props.previousYearAriaLabel,previousYearButtonLabel:r.props.previousYearButtonLabel,nextYearAriaLabel:r.props.nextYearAriaLabel,nextYearButtonLabel:r.props.nextYearButtonLabel,timeInputLabel:r.props.timeInputLabel,disabledKeyboardNavigation:r.props.disabledKeyboardNavigation,renderCustomHeader:r.props.renderCustomHeader,popperProps:r.props.popperProps,renderDayContents:r.props.renderDayContents,onDayMouseEnter:r.props.onDayMouseEnter,onMonthMouseLeave:r.props.onMonthMouseLeave,selectsDisabledDaysInRange:r.props.selectsDisabledDaysInRange,showTimeInput:r.props.showTimeInput,showMonthYearPicker:r.props.showMonthYearPicker,showFullMonthYearPicker:r.props.showFullMonthYearPicker,showTwoColumnMonthYearPicker:r.props.showTwoColumnMonthYearPicker,showFourColumnMonthYearPicker:r.props.showFourColumnMonthYearPicker,showYearPicker:r.props.showYearPicker,showQuarterYearPicker:r.props.showQuarterYearPicker,showPopperArrow:r.props.showPopperArrow,excludeScrollbar:r.props.excludeScrollbar,handleOnKeyDown:r.props.onKeyDown,handleOnDayKeyDown:r.onDayKeyDown,isInputFocused:r.state.focused,customTimeInput:r.props.customTimeInput,setPreSelection:r.setPreSelection},r.props.children):null})),xt(_t(r),"renderDateInput",(function(){var e,t=ue.default(r.props.className,xt({},Gn,r.state.open)),n=r.props.customInput||de.default.createElement("input",{type:"text"}),a=r.props.customInputRef||"ref",s="string"==typeof r.props.value?r.props.value:"string"==typeof r.state.inputValue?r.state.inputValue:r.props.selectsRange?function(e,t,n){if(!e)return"";var r=Mt(e,n),a=t?Mt(t,n):"";return"".concat(r," - ").concat(a)}(r.props.startDate,r.props.endDate,r.props):Mt(r.props.selected,r.props);return de.default.cloneElement(n,(xt(e={},a,(function(e){r.input=e})),xt(e,"value",s),xt(e,"onBlur",r.handleBlur),xt(e,"onChange",r.handleChange),xt(e,"onClick",r.onInputClick),xt(e,"onFocus",r.handleFocus),xt(e,"onKeyDown",r.onInputKeyDown),xt(e,"id",r.props.id),xt(e,"name",r.props.name),xt(e,"autoFocus",r.props.autoFocus),xt(e,"placeholder",r.props.placeholderText),xt(e,"disabled",r.props.disabled),xt(e,"autoComplete",r.props.autoComplete),xt(e,"className",ue.default(n.props.className,t)),xt(e,"title",r.props.title),xt(e,"readOnly",r.props.readOnly),xt(e,"required",r.props.required),xt(e,"tabIndex",r.props.tabIndex),xt(e,"aria-describedby",r.props.ariaDescribedBy),xt(e,"aria-invalid",r.props.ariaInvalid),xt(e,"aria-labelledby",r.props.ariaLabelledBy),xt(e,"aria-required",r.props.ariaRequired),e))})),xt(_t(r),"renderClearButton",(function(){var e=r.props,t=e.isClearable,n=e.selected,a=e.startDate,s=e.endDate,i=e.clearButtonTitle,o=e.clearButtonClassName,l=void 0===o?"":o,c=e.ariaLabelClose,d=void 0===c?"Close":c;return!t||null==n&&null==a&&null==s?null:de.default.createElement("button",{type:"button",className:"react-datepicker__close-icon ".concat(l).trim(),"aria-label":d,onClick:r.onClearClick,title:i,tabIndex:-1})})),r.state=r.calcInitialState(),r}return gt(n,[{key:"componentDidMount",value:function(){window.addEventListener("scroll",this.onScroll,!0)}},{key:"componentDidUpdate",value:function(e,t){var n,r;e.inline&&(n=e.selected,r=this.props.selected,n&&r?Ee.default(n)!==Ee.default(r)||Oe.default(n)!==Oe.default(r):n!==r)&&this.setPreSelection(this.props.selected),void 0!==this.state.monthSelectedIn&&e.monthsShown!==this.props.monthsShown&&this.setState({monthSelectedIn:0}),e.highlightDates!==this.props.highlightDates&&this.setState({highlightDates:yn(this.props.highlightDates)}),t.focused||Gt(e.selected,this.props.selected)||this.setState({inputValue:null}),t.open!==this.state.open&&(!1===t.open&&!0===this.state.open&&this.props.onCalendarOpen(),!0===t.open&&!1===this.state.open&&this.props.onCalendarClose())}},{key:"componentWillUnmount",value:function(){this.clearPreventFocusTimeout(),window.removeEventListener("scroll",this.onScroll,!0)}},{key:"renderInputContainer",value:function(){return de.default.createElement("div",{className:"react-datepicker__input-container"},this.renderDateInput(),this.renderClearButton())}},{key:"render",value:function(){var e=this.renderCalendar();if(this.props.inline)return e;if(this.props.withPortal){var t=this.state.open?de.default.createElement("div",{className:"react-datepicker__portal"},e):null;return this.state.open&&this.props.portalId&&(t=de.default.createElement(Yn,{portalId:this.props.portalId,portalHost:this.props.portalHost},t)),de.default.createElement("div",null,this.renderInputContainer(),t)}return de.default.createElement(zn,{className:this.props.popperClassName,wrapperClassName:this.props.wrapperClassName,hidePopper:!this.isCalendarOpen(),portalId:this.props.portalId,portalHost:this.props.portalHost,popperModifiers:this.props.popperModifiers,targetComponent:this.renderInputContainer(),popperContainer:this.props.popperContainer,popperComponent:e,popperPlacement:this.props.popperPlacement,popperProps:this.props.popperProps,popperOnKeyDown:this.onPopperKeyDown,enableTabLoop:this.props.enableTabLoop})}}],[{key:"defaultProps",get:function(){return{allowSameDay:!1,dateFormat:"MM/dd/yyyy",dateFormatCalendar:"LLLL yyyy",onChange:function(){},disabled:!1,disabledKeyboardNavigation:!1,dropdownMode:"scroll",onFocus:function(){},onBlur:function(){},onKeyDown:function(){},onInputClick:function(){},onSelect:function(){},onClickOutside:function(){},onMonthChange:function(){},onCalendarOpen:function(){},onCalendarClose:function(){},preventOpenOnFocus:!1,onYearChange:function(){},onInputError:function(){},monthsShown:1,readOnly:!1,withPortal:!1,selectsDisabledDaysInRange:!1,shouldCloseOnSelect:!0,showTimeSelect:!1,showTimeInput:!1,showPreviousMonths:!1,showMonthYearPicker:!1,showFullMonthYearPicker:!1,showTwoColumnMonthYearPicker:!1,showFourColumnMonthYearPicker:!1,showYearPicker:!1,showQuarterYearPicker:!1,strictParsing:!1,timeIntervals:30,timeCaption:"Time",previousMonthAriaLabel:"Previous Month",previousMonthButtonLabel:"Previous Month",nextMonthAriaLabel:"Next Month",nextMonthButtonLabel:"Next Month",previousYearAriaLabel:"Previous Year",previousYearButtonLabel:"Previous Year",nextYearAriaLabel:"Next Year",nextYearButtonLabel:"Next Year",timeInputLabel:"Time",enableTabLoop:!0,yearItemNumber:Dt,renderDayContents:function(e){return e},focusSelectedMonth:!1,showPopperArrow:!0,excludeScrollbar:!0,customTimeInput:null,calendarStartDay:void 0}}}]),n}(de.default.Component),Jn="input",er="navigate";e.CalendarContainer=Zn,e.default=Xn,e.getDefaultLocale=Qt,e.registerLocale=function(e,t){var n="undefined"!=typeof window?window:globalThis;n.__localeData__||(n.__localeData__={}),n.__localeData__[e]=t},e.setDefaultLocale=function(e){("undefined"!=typeof window?window:globalThis).__localeId__=e},Object.defineProperty(e,"__esModule",{value:!0})}(t,n(49231),n(39519),n(65443),n(27930),n(47612),n(95822),n(94392),n(71050),n(63703),n(90806),n(84613),n(31247),n(79605),n(76508),n(22836),n(83538),n(76136),n(35865),n(54909),n(91352),n(42370),n(32097),n(33184),n(84097),n(66821),n(12838),n(42384),n(31359),n(14603),n(6257),n(47067),n(28208),n(5042),n(57006),n(1711),n(82399),n(31213),n(46418),n(27088),n(86854),n(81793),n(72611),n(13167),n(27747),n(19752),n(68392),n(82296),n(48216),n(4820),n(72986),n(51467),n(99114),n(41667),n(40538),n(94326),n(34256),n(78789),n(84188),n(30091),n(68103),n(64151),n(55703))},82330:function(e){var t="undefined"!=typeof Element,n="function"==typeof Map,r="function"==typeof Set,a="function"==typeof ArrayBuffer&&!!ArrayBuffer.isView;function s(e,i){if(e===i)return!0;if(e&&i&&"object"==typeof e&&"object"==typeof i){if(e.constructor!==i.constructor)return!1;var o,l,c,d;if(Array.isArray(e)){if((o=e.length)!=i.length)return!1;for(l=o;0!=l--;)if(!s(e[l],i[l]))return!1;return!0}if(n&&e instanceof Map&&i instanceof Map){if(e.size!==i.size)return!1;for(d=e.entries();!(l=d.next()).done;)if(!i.has(l.value[0]))return!1;for(d=e.entries();!(l=d.next()).done;)if(!s(l.value[1],i.get(l.value[0])))return!1;return!0}if(r&&e instanceof Set&&i instanceof Set){if(e.size!==i.size)return!1;for(d=e.entries();!(l=d.next()).done;)if(!i.has(l.value[0]))return!1;return!0}if(a&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(i)){if((o=e.length)!=i.length)return!1;for(l=o;0!=l--;)if(e[l]!==i[l])return!1;return!0}if(e.constructor===RegExp)return e.source===i.source&&e.flags===i.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===i.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===i.toString();if((o=(c=Object.keys(e)).length)!==Object.keys(i).length)return!1;for(l=o;0!=l--;)if(!Object.prototype.hasOwnProperty.call(i,c[l]))return!1;if(t&&e instanceof Element)return!1;for(l=o;0!=l--;)if(("_owner"!==c[l]&&"__v"!==c[l]&&"__o"!==c[l]||!e.$$typeof)&&!s(e[c[l]],i[c[l]]))return!1;return!0}return e!=e&&i!=i}e.exports=function(e,t){try{return s(e,t)}catch(e){if((e.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw e}}},68103:function(e,t,n){"use strict";n.r(t),n.d(t,{IGNORE_CLASS_NAME:function(){return h}});var r=n(49231),a=n(64151);function s(e,t){return s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},s(e,t)}function i(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function o(e,t,n){return e===t||(e.correspondingElement?e.correspondingElement.classList.contains(n):e.classList.contains(n))}var l,c,d=(void 0===l&&(l=0),function(){return++l}),u={},p={},m=["touchstart","touchmove"],h="ignore-react-onclickoutside";function f(e,t){var n=null;return-1!==m.indexOf(t)&&c&&(n={passive:!e.props.preventDefault}),n}t.default=function(e,t){var n,l,m=e.displayName||e.name||"Component";return l=n=function(n){var l,h;function g(e){var r;return(r=n.call(this,e)||this).__outsideClickHandler=function(e){if("function"!=typeof r.__clickOutsideHandlerProp){var t=r.getInstance();if("function"!=typeof t.props.handleClickOutside){if("function"!=typeof t.handleClickOutside)throw new Error("WrappedComponent: "+m+" lacks a handleClickOutside(event) function for processing outside click events.");t.handleClickOutside(e)}else t.props.handleClickOutside(e)}else r.__clickOutsideHandlerProp(e)},r.__getComponentNode=function(){var e=r.getInstance();return t&&"function"==typeof t.setClickOutsideRef?t.setClickOutsideRef()(e):"function"==typeof e.setClickOutsideRef?e.setClickOutsideRef():(0,a.findDOMNode)(e)},r.enableOnClickOutside=function(){if("undefined"!=typeof document&&!p[r._uid]){void 0===c&&(c=function(){if("undefined"!=typeof window&&"function"==typeof window.addEventListener){var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}}),n=function(){};return window.addEventListener("testPassiveEventSupport",n,t),window.removeEventListener("testPassiveEventSupport",n,t),e}}()),p[r._uid]=!0;var e=r.props.eventTypes;e.forEach||(e=[e]),u[r._uid]=function(e){var t;null!==r.componentNode&&(r.props.preventDefault&&e.preventDefault(),r.props.stopPropagation&&e.stopPropagation(),r.props.excludeScrollbar&&(t=e,document.documentElement.clientWidth<=t.clientX||document.documentElement.clientHeight<=t.clientY)||function(e,t,n){if(e===t)return!0;for(;e.parentNode||e.host;){if(e.parentNode&&o(e,t,n))return!0;e=e.parentNode||e.host}return e}(e.composed&&e.composedPath&&e.composedPath().shift()||e.target,r.componentNode,r.props.outsideClickIgnoreClass)===document&&r.__outsideClickHandler(e))},e.forEach((function(e){document.addEventListener(e,u[r._uid],f(i(r),e))}))}},r.disableOnClickOutside=function(){delete p[r._uid];var e=u[r._uid];if(e&&"undefined"!=typeof document){var t=r.props.eventTypes;t.forEach||(t=[t]),t.forEach((function(t){return document.removeEventListener(t,e,f(i(r),t))})),delete u[r._uid]}},r.getRef=function(e){return r.instanceRef=e},r._uid=d(),r}h=n,(l=g).prototype=Object.create(h.prototype),l.prototype.constructor=l,s(l,h);var x=g.prototype;return x.getInstance=function(){if(e.prototype&&!e.prototype.isReactComponent)return this;var t=this.instanceRef;return t.getInstance?t.getInstance():t},x.componentDidMount=function(){if("undefined"!=typeof document&&document.createElement){var e=this.getInstance();if(t&&"function"==typeof t.handleClickOutside&&(this.__clickOutsideHandlerProp=t.handleClickOutside(e),"function"!=typeof this.__clickOutsideHandlerProp))throw new Error("WrappedComponent: "+m+" lacks a function for processing outside click events specified by the handleClickOutside config option.");this.componentNode=this.__getComponentNode(),this.props.disableOnClickOutside||this.enableOnClickOutside()}},x.componentDidUpdate=function(){this.componentNode=this.__getComponentNode()},x.componentWillUnmount=function(){this.disableOnClickOutside()},x.render=function(){var t=this.props;t.excludeScrollbar;var n=function(e,t){if(null==e)return{};var n,r,a={},s=Object.keys(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(t,["excludeScrollbar"]);return e.prototype&&e.prototype.isReactComponent?n.ref=this.getRef:n.wrappedRef=this.getRef,n.disableOnClickOutside=this.disableOnClickOutside,n.enableOnClickOutside=this.enableOnClickOutside,(0,r.createElement)(e,n)},g}(r.Component),n.displayName="OnClickOutside("+m+")",n.defaultProps={eventTypes:["mousedown","touchstart"],excludeScrollbar:t&&t.excludeScrollbar||!1,outsideClickIgnoreClass:h,preventDefault:!1,stopPropagation:!1},n.getClass=function(){return e.getClass?e.getClass():e},l}},55703:function(e,t,n){"use strict";n.r(t),n.d(t,{Manager:function(){return i},Popper:function(){return y},Reference:function(){return j},usePopper:function(){return g}});var r=n(49231),a=r.createContext(),s=r.createContext();function i(e){var t=e.children,n=r.useState(null),i=n[0],o=n[1],l=r.useRef(!1);r.useEffect((function(){return function(){l.current=!0}}),[]);var c=r.useCallback((function(e){l.current||o(e)}),[]);return r.createElement(a.Provider,{value:i},r.createElement(s.Provider,{value:c},t))}var o=function(e){return Array.isArray(e)?e[0]:e},l=function(e){if("function"==typeof e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e.apply(void 0,n)}},c=function(e,t){if("function"==typeof e)return l(e,t);null!=e&&(e.current=t)},d=function(e){return e.reduce((function(e,t){var n=t[0],r=t[1];return e[n]=r,e}),{})},u="undefined"!=typeof window&&window.document&&window.document.createElement?r.useLayoutEffect:r.useEffect,p=n(27087),m=n(82330),h=n.n(m),f=[],g=function(e,t,n){void 0===n&&(n={});var a=r.useRef(null),s={onFirstUpdate:n.onFirstUpdate,placement:n.placement||"bottom",strategy:n.strategy||"absolute",modifiers:n.modifiers||f},i=r.useState({styles:{popper:{position:s.strategy,left:"0",top:"0"},arrow:{position:"absolute"}},attributes:{}}),o=i[0],l=i[1],c=r.useMemo((function(){return{name:"updateState",enabled:!0,phase:"write",fn:function(e){var t=e.state,n=Object.keys(t.elements);l({styles:d(n.map((function(e){return[e,t.styles[e]||{}]}))),attributes:d(n.map((function(e){return[e,t.attributes[e]]})))})},requires:["computeStyles"]}}),[]),m=r.useMemo((function(){var e={onFirstUpdate:s.onFirstUpdate,placement:s.placement,strategy:s.strategy,modifiers:[].concat(s.modifiers,[c,{name:"applyStyles",enabled:!1}])};return h()(a.current,e)?a.current||e:(a.current=e,e)}),[s.onFirstUpdate,s.placement,s.strategy,s.modifiers,c]),g=r.useRef();return u((function(){g.current&&g.current.setOptions(m)}),[m]),u((function(){if(null!=e&&null!=t){var r=(n.createPopper||p.fi)(e,t,m);return g.current=r,function(){r.destroy(),g.current=null}}}),[e,t,n.createPopper]),{state:g.current?g.current.state:null,styles:o.styles,attributes:o.attributes,update:g.current?g.current.update:null,forceUpdate:g.current?g.current.forceUpdate:null}},x=function(){},v=function(){return Promise.resolve(null)},b=[];function y(e){var t=e.placement,n=void 0===t?"bottom":t,s=e.strategy,i=void 0===s?"absolute":s,l=e.modifiers,d=void 0===l?b:l,u=e.referenceElement,p=e.onFirstUpdate,m=e.innerRef,h=e.children,f=r.useContext(a),y=r.useState(null),w=y[0],_=y[1],j=r.useState(null),S=j[0],I=j[1];r.useEffect((function(){c(m,w)}),[m,w]);var C=r.useMemo((function(){return{placement:n,strategy:i,onFirstUpdate:p,modifiers:[].concat(d,[{name:"arrow",enabled:null!=S,options:{element:S}}])}}),[n,i,p,d,S]),T=g(u||f,w,C),k=T.state,N=T.styles,D=T.forceUpdate,E=T.update,A=r.useMemo((function(){return{ref:_,style:N.popper,placement:k?k.placement:n,hasPopperEscaped:k&&k.modifiersData.hide?k.modifiersData.hide.hasPopperEscaped:null,isReferenceHidden:k&&k.modifiersData.hide?k.modifiersData.hide.isReferenceHidden:null,arrowProps:{style:N.arrow,ref:I},forceUpdate:D||x,update:E||v}}),[_,I,n,k,N,E,D]);return o(h)(A)}var w=n(20282),_=n.n(w);function j(e){var t=e.children,n=e.innerRef,a=r.useContext(s),i=r.useCallback((function(e){c(n,e),l(a,e)}),[n,a]);return r.useEffect((function(){return function(){return c(n,null)}})),r.useEffect((function(){_()(Boolean(a),"`Reference` should not be used outside of a `Manager` component.")}),[a]),o(t)({ref:i})}},23064:function(e){e.exports=function(e){if(!window.satismeter){window.satismeter=function(){var e=[];function t(){e.push(arguments)}return t.q=e,t}();var t=document.createElement("script"),n=document.getElementsByTagName("script")[0].parentNode;t.async=1,t.src="https://app.satismeter.com/satismeter.js",n.appendChild(t)}return window.satismeter(e)}},16381:function(e,t,n){var r,a,s;a=[n(65311)],r=function(t){var n=function(){if(t&&t.fn&&t.fn.select2&&t.fn.select2.amd)var n=t.fn.select2.amd;var r,a,s,i;return n&&n.requirejs||(n?a=n:n={},function(e){var t,n,i,o,l={},c={},d={},u={},p=Object.prototype.hasOwnProperty,m=[].slice,h=/\.js$/;function f(e,t){return p.call(e,t)}function g(e,t){var n,r,a,s,i,o,l,c,u,p,m,f=t&&t.split("/"),g=d.map,x=g&&g["*"]||{};if(e){for(i=(e=e.split("/")).length-1,d.nodeIdCompat&&h.test(e[i])&&(e[i]=e[i].replace(h,"")),"."===e[0].charAt(0)&&f&&(e=f.slice(0,f.length-1).concat(e)),u=0;u<e.length;u++)if("."===(m=e[u]))e.splice(u,1),u-=1;else if(".."===m){if(0===u||1===u&&".."===e[2]||".."===e[u-1])continue;u>0&&(e.splice(u-1,2),u-=2)}e=e.join("/")}if((f||x)&&g){for(u=(n=e.split("/")).length;u>0;u-=1){if(r=n.slice(0,u).join("/"),f)for(p=f.length;p>0;p-=1)if((a=g[f.slice(0,p).join("/")])&&(a=a[r])){s=a,o=u;break}if(s)break;!l&&x&&x[r]&&(l=x[r],c=u)}!s&&l&&(s=l,o=c),s&&(n.splice(0,o,s),e=n.join("/"))}return e}function x(t,r){return function(){var a=m.call(arguments,0);return"string"!=typeof a[0]&&1===a.length&&a.push(null),n.apply(e,a.concat([t,r]))}}function v(e){return function(t){l[e]=t}}function b(n){if(f(c,n)){var r=c[n];delete c[n],u[n]=!0,t.apply(e,r)}if(!f(l,n)&&!f(u,n))throw new Error("No "+n);return l[n]}function y(e){var t,n=e?e.indexOf("!"):-1;return n>-1&&(t=e.substring(0,n),e=e.substring(n+1,e.length)),[t,e]}function w(e){return e?y(e):[]}function _(e){return function(){return d&&d.config&&d.config[e]||{}}}i=function(e,t){var n,r,a=y(e),s=a[0],i=t[1];return e=a[1],s&&(n=b(s=g(s,i))),s?e=n&&n.normalize?n.normalize(e,(r=i,function(e){return g(e,r)})):g(e,i):(s=(a=y(e=g(e,i)))[0],e=a[1],s&&(n=b(s))),{f:s?s+"!"+e:e,n:e,pr:s,p:n}},o={require:function(e){return x(e)},exports:function(e){var t=l[e];return void 0!==t?t:l[e]={}},module:function(e){return{id:e,uri:"",exports:l[e],config:_(e)}}},t=function(t,n,r,a){var s,d,p,m,h,g,y,_=[],j=typeof r;if(g=w(a=a||t),"undefined"===j||"function"===j){for(n=!n.length&&r.length?["require","exports","module"]:n,h=0;h<n.length;h+=1)if("require"===(d=(m=i(n[h],g)).f))_[h]=o.require(t);else if("exports"===d)_[h]=o.exports(t),y=!0;else if("module"===d)s=_[h]=o.module(t);else if(f(l,d)||f(c,d)||f(u,d))_[h]=b(d);else{if(!m.p)throw new Error(t+" missing "+d);m.p.load(m.n,x(a,!0),v(d),{}),_[h]=l[d]}p=r?r.apply(l[t],_):void 0,t&&(s&&s.exports!==e&&s.exports!==l[t]?l[t]=s.exports:p===e&&y||(l[t]=p))}else t&&(l[t]=r)},r=a=n=function(r,a,s,l,c){if("string"==typeof r)return o[r]?o[r](a):b(i(r,w(a)).f);if(!r.splice){if((d=r).deps&&n(d.deps,d.callback),!a)return;a.splice?(r=a,a=s,s=null):r=e}return a=a||function(){},"function"==typeof s&&(s=l,l=c),l?t(e,r,a,s):setTimeout((function(){t(e,r,a,s)}),4),n},n.config=function(e){return n(e)},r._defined=l,(s=function(e,t,n){if("string"!=typeof e)throw new Error("See almond README: incorrect module build, no module name");t.splice||(n=t,t=[]),f(l,e)||f(c,e)||(c[e]=[e,t,n])}).amd={jQuery:!0}}(),n.requirejs=r,n.require=a,n.define=s),n.define("almond",(function(){})),n.define("jquery",[],(function(){var e=t||$;return null==e&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),e})),n.define("select2/utils",["jquery"],(function(e){var t={};function n(e){var t=e.prototype,n=[];for(var r in t)"function"==typeof t[r]&&"constructor"!==r&&n.push(r);return n}t.Extend=function(e,t){var n={}.hasOwnProperty;function r(){this.constructor=e}for(var a in t)n.call(t,a)&&(e[a]=t[a]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e},t.Decorate=function(e,t){var r=n(t),a=n(e);function s(){var n=Array.prototype.unshift,r=t.prototype.constructor.length,a=e.prototype.constructor;r>0&&(n.call(arguments,e.prototype.constructor),a=t.prototype.constructor),a.apply(this,arguments)}t.displayName=e.displayName,s.prototype=new function(){this.constructor=s};for(var i=0;i<a.length;i++){var o=a[i];s.prototype[o]=e.prototype[o]}for(var l=function(e){var n=function(){};e in s.prototype&&(n=s.prototype[e]);var r=t.prototype[e];return function(){return Array.prototype.unshift.call(arguments,n),r.apply(this,arguments)}},c=0;c<r.length;c++){var d=r[c];s.prototype[d]=l(d)}return s};var r=function(){this.listeners={}};r.prototype.on=function(e,t){this.listeners=this.listeners||{},e in this.listeners?this.listeners[e].push(t):this.listeners[e]=[t]},r.prototype.trigger=function(e){var t=Array.prototype.slice,n=t.call(arguments,1);this.listeners=this.listeners||{},null==n&&(n=[]),0===n.length&&n.push({}),n[0]._type=e,e in this.listeners&&this.invoke(this.listeners[e],t.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},r.prototype.invoke=function(e,t){for(var n=0,r=e.length;n<r;n++)e[n].apply(this,t)},t.Observable=r,t.generateChars=function(e){for(var t="",n=0;n<e;n++)t+=Math.floor(36*Math.random()).toString(36);return t},t.bind=function(e,t){return function(){e.apply(t,arguments)}},t._convertData=function(e){for(var t in e){var n=t.split("-"),r=e;if(1!==n.length){for(var a=0;a<n.length;a++){var s=n[a];(s=s.substring(0,1).toLowerCase()+s.substring(1))in r||(r[s]={}),a==n.length-1&&(r[s]=e[t]),r=r[s]}delete e[t]}}return e},t.hasScroll=function(t,n){var r=e(n),a=n.style.overflowX,s=n.style.overflowY;return(a!==s||"hidden"!==s&&"visible"!==s)&&("scroll"===a||"scroll"===s||r.innerHeight()<n.scrollHeight||r.innerWidth()<n.scrollWidth)},t.escapeMarkup=function(e){var t={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return"string"!=typeof e?e:String(e).replace(/[&<>"'\/\\]/g,(function(e){return t[e]}))},t.__cache={};var a=0;return t.GetUniqueElementId=function(e){var n=e.getAttribute("data-select2-id");return null!=n||(n=e.id?"select2-data-"+e.id:"select2-data-"+(++a).toString()+"-"+t.generateChars(4),e.setAttribute("data-select2-id",n)),n},t.StoreData=function(e,n,r){var a=t.GetUniqueElementId(e);t.__cache[a]||(t.__cache[a]={}),t.__cache[a][n]=r},t.GetData=function(n,r){var a=t.GetUniqueElementId(n);return r?t.__cache[a]&&null!=t.__cache[a][r]?t.__cache[a][r]:e(n).data(r):t.__cache[a]},t.RemoveData=function(e){var n=t.GetUniqueElementId(e);null!=t.__cache[n]&&delete t.__cache[n],e.removeAttribute("data-select2-id")},t.copyNonInternalCssClasses=function(e,t){var n=e.getAttribute("class").trim().split(/\s+/);n=n.filter((function(e){return 0===e.indexOf("select2-")}));var r=t.getAttribute("class").trim().split(/\s+/);r=r.filter((function(e){return 0!==e.indexOf("select2-")}));var a=n.concat(r);e.setAttribute("class",a.join(" "))},t})),n.define("select2/results",["jquery","./utils"],(function(e,t){function n(e,t,r){this.$element=e,this.data=r,this.options=t,n.__super__.constructor.call(this)}return t.Extend(n,t.Observable),n.prototype.render=function(){var t=e('<ul class="select2-results__options" role="listbox"></ul>');return this.options.get("multiple")&&t.attr("aria-multiselectable","true"),this.$results=t,t},n.prototype.clear=function(){this.$results.empty()},n.prototype.displayMessage=function(t){var n=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var r=e('<li role="alert" aria-live="assertive" class="select2-results__option"></li>'),a=this.options.get("translations").get(t.message);r.append(n(a(t.args))),r[0].className+=" select2-results__message",this.$results.append(r)},n.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},n.prototype.append=function(e){this.hideLoading();var t=[];if(null!=e.results&&0!==e.results.length){e.results=this.sort(e.results);for(var n=0;n<e.results.length;n++){var r=e.results[n],a=this.option(r);t.push(a)}this.$results.append(t)}else 0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"})},n.prototype.position=function(e,t){t.find(".select2-results").append(e)},n.prototype.sort=function(e){return this.options.get("sorter")(e)},n.prototype.highlightFirstItem=function(){var e=this.$results.find(".select2-results__option--selectable"),t=e.filter(".select2-results__option--selected");t.length>0?t.first().trigger("mouseenter"):e.first().trigger("mouseenter"),this.ensureHighlightVisible()},n.prototype.setClasses=function(){var n=this;this.data.current((function(r){var a=r.map((function(e){return e.id.toString()}));n.$results.find(".select2-results__option--selectable").each((function(){var n=e(this),r=t.GetData(this,"data"),s=""+r.id;null!=r.element&&r.element.selected||null==r.element&&a.indexOf(s)>-1?(this.classList.add("select2-results__option--selected"),n.attr("aria-selected","true")):(this.classList.remove("select2-results__option--selected"),n.attr("aria-selected","false"))}))}))},n.prototype.showLoading=function(e){this.hideLoading();var t={disabled:!0,loading:!0,text:this.options.get("translations").get("searching")(e)},n=this.option(t);n.className+=" loading-results",this.$results.prepend(n)},n.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},n.prototype.option=function(n){var r=document.createElement("li");r.classList.add("select2-results__option"),r.classList.add("select2-results__option--selectable");var a={role:"option"},s=window.Element.prototype.matches||window.Element.prototype.msMatchesSelector||window.Element.prototype.webkitMatchesSelector;for(var i in(null!=n.element&&s.call(n.element,":disabled")||null==n.element&&n.disabled)&&(a["aria-disabled"]="true",r.classList.remove("select2-results__option--selectable"),r.classList.add("select2-results__option--disabled")),null==n.id&&r.classList.remove("select2-results__option--selectable"),null!=n._resultId&&(r.id=n._resultId),n.title&&(r.title=n.title),n.children&&(a.role="group",a["aria-label"]=n.text,r.classList.remove("select2-results__option--selectable"),r.classList.add("select2-results__option--group")),a){var o=a[i];r.setAttribute(i,o)}if(n.children){var l=e(r),c=document.createElement("strong");c.className="select2-results__group",this.template(n,c);for(var d=[],u=0;u<n.children.length;u++){var p=n.children[u],m=this.option(p);d.push(m)}var h=e("<ul></ul>",{class:"select2-results__options select2-results__options--nested",role:"none"});h.append(d),l.append(c),l.append(h)}else this.template(n,r);return t.StoreData(r,"data",n),r},n.prototype.bind=function(n,r){var a=this,s=n.id+"-results";this.$results.attr("id",s),n.on("results:all",(function(e){a.clear(),a.append(e.data),n.isOpen()&&(a.setClasses(),a.highlightFirstItem())})),n.on("results:append",(function(e){a.append(e.data),n.isOpen()&&a.setClasses()})),n.on("query",(function(e){a.hideMessages(),a.showLoading(e)})),n.on("select",(function(){n.isOpen()&&(a.setClasses(),a.options.get("scrollAfterSelect")&&a.highlightFirstItem())})),n.on("unselect",(function(){n.isOpen()&&(a.setClasses(),a.options.get("scrollAfterSelect")&&a.highlightFirstItem())})),n.on("open",(function(){a.$results.attr("aria-expanded","true"),a.$results.attr("aria-hidden","false"),a.setClasses(),a.ensureHighlightVisible()})),n.on("close",(function(){a.$results.attr("aria-expanded","false"),a.$results.attr("aria-hidden","true"),a.$results.removeAttr("aria-activedescendant")})),n.on("results:toggle",(function(){var e=a.getHighlightedResults();0!==e.length&&e.trigger("mouseup")})),n.on("results:select",(function(){var e=a.getHighlightedResults();if(0!==e.length){var n=t.GetData(e[0],"data");e.hasClass("select2-results__option--selected")?a.trigger("close",{}):a.trigger("select",{data:n})}})),n.on("results:previous",(function(){var e=a.getHighlightedResults(),t=a.$results.find(".select2-results__option--selectable"),n=t.index(e);if(!(n<=0)){var r=n-1;0===e.length&&(r=0);var s=t.eq(r);s.trigger("mouseenter");var i=a.$results.offset().top,o=s.offset().top,l=a.$results.scrollTop()+(o-i);0===r?a.$results.scrollTop(0):o-i<0&&a.$results.scrollTop(l)}})),n.on("results:next",(function(){var e=a.getHighlightedResults(),t=a.$results.find(".select2-results__option--selectable"),n=t.index(e)+1;if(!(n>=t.length)){var r=t.eq(n);r.trigger("mouseenter");var s=a.$results.offset().top+a.$results.outerHeight(!1),i=r.offset().top+r.outerHeight(!1),o=a.$results.scrollTop()+i-s;0===n?a.$results.scrollTop(0):i>s&&a.$results.scrollTop(o)}})),n.on("results:focus",(function(e){e.element[0].classList.add("select2-results__option--highlighted"),e.element[0].setAttribute("aria-selected","true")})),n.on("results:message",(function(e){a.displayMessage(e)})),e.fn.mousewheel&&this.$results.on("mousewheel",(function(e){var t=a.$results.scrollTop(),n=a.$results.get(0).scrollHeight-t+e.deltaY,r=e.deltaY>0&&t-e.deltaY<=0,s=e.deltaY<0&&n<=a.$results.height();r?(a.$results.scrollTop(0),e.preventDefault(),e.stopPropagation()):s&&(a.$results.scrollTop(a.$results.get(0).scrollHeight-a.$results.height()),e.preventDefault(),e.stopPropagation())})),this.$results.on("mouseup",".select2-results__option--selectable",(function(n){var r=e(this),s=t.GetData(this,"data");r.hasClass("select2-results__option--selected")?a.options.get("multiple")?a.trigger("unselect",{originalEvent:n,data:s}):a.trigger("close",{}):a.trigger("select",{originalEvent:n,data:s})})),this.$results.on("mouseenter",".select2-results__option--selectable",(function(n){var r=t.GetData(this,"data");a.getHighlightedResults().removeClass("select2-results__option--highlighted").attr("aria-selected","false"),a.trigger("results:focus",{data:r,element:e(this)})}))},n.prototype.getHighlightedResults=function(){return this.$results.find(".select2-results__option--highlighted")},n.prototype.destroy=function(){this.$results.remove()},n.prototype.ensureHighlightVisible=function(){var e=this.getHighlightedResults();if(0!==e.length){var t=this.$results.find(".select2-results__option--selectable").index(e),n=this.$results.offset().top,r=e.offset().top,a=this.$results.scrollTop()+(r-n),s=r-n;a-=2*e.outerHeight(!1),t<=2?this.$results.scrollTop(0):(s>this.$results.outerHeight()||s<0)&&this.$results.scrollTop(a)}},n.prototype.template=function(t,n){var r=this.options.get("templateResult"),a=this.options.get("escapeMarkup"),s=r(t,n);null==s?n.style.display="none":"string"==typeof s?n.innerHTML=a(s):e(n).append(s)},n})),n.define("select2/keys",[],(function(){return{BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46}})),n.define("select2/selection/base",["jquery","../utils","../keys"],(function(e,t,n){function r(e,t){this.$element=e,this.options=t,r.__super__.constructor.call(this)}return t.Extend(r,t.Observable),r.prototype.render=function(){var n=e('<span class="select2-selection" role="combobox" aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=t.GetData(this.$element[0],"old-tabindex")?this._tabindex=t.GetData(this.$element[0],"old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),n.attr("title",this.$element.attr("title")),n.attr("tabindex",this._tabindex),n.attr("aria-disabled","false"),this.$selection=n,n},r.prototype.bind=function(e,t){var r=this,a=e.id+"-results";this.container=e,this.$selection.on("focus",(function(e){r.trigger("focus",e)})),this.$selection.on("blur",(function(e){r._handleBlur(e)})),this.$selection.on("keydown",(function(e){r.trigger("keypress",e),e.which===n.SPACE&&e.preventDefault()})),e.on("results:focus",(function(e){r.$selection.attr("aria-activedescendant",e.data._resultId)})),e.on("selection:update",(function(e){r.update(e.data)})),e.on("open",(function(){r.$selection.attr("aria-expanded","true"),r.$selection.attr("aria-owns",a),r._attachCloseHandler(e)})),e.on("close",(function(){r.$selection.attr("aria-expanded","false"),r.$selection.removeAttr("aria-activedescendant"),r.$selection.removeAttr("aria-owns"),r.$selection.trigger("focus"),r._detachCloseHandler(e)})),e.on("enable",(function(){r.$selection.attr("tabindex",r._tabindex),r.$selection.attr("aria-disabled","false")})),e.on("disable",(function(){r.$selection.attr("tabindex","-1"),r.$selection.attr("aria-disabled","true")}))},r.prototype._handleBlur=function(t){var n=this;window.setTimeout((function(){document.activeElement==n.$selection[0]||e.contains(n.$selection[0],document.activeElement)||n.trigger("blur",t)}),1)},r.prototype._attachCloseHandler=function(n){e(document.body).on("mousedown.select2."+n.id,(function(n){var r=e(n.target).closest(".select2");e(".select2.select2-container--open").each((function(){this!=r[0]&&t.GetData(this,"element").select2("close")}))}))},r.prototype._detachCloseHandler=function(t){e(document.body).off("mousedown.select2."+t.id)},r.prototype.position=function(e,t){t.find(".selection").append(e)},r.prototype.destroy=function(){this._detachCloseHandler(this.container)},r.prototype.update=function(e){throw new Error("The `update` method must be defined in child classes.")},r.prototype.isEnabled=function(){return!this.isDisabled()},r.prototype.isDisabled=function(){return this.options.get("disabled")},r})),n.define("select2/selection/single",["jquery","./base","../utils","../keys"],(function(e,t,n,r){function a(){a.__super__.constructor.apply(this,arguments)}return n.Extend(a,t),a.prototype.render=function(){var e=a.__super__.render.call(this);return e[0].classList.add("select2-selection--single"),e.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),e},a.prototype.bind=function(e,t){var n=this;a.__super__.bind.apply(this,arguments);var r=e.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",r).attr("role","textbox").attr("aria-readonly","true"),this.$selection.attr("aria-labelledby",r),this.$selection.attr("aria-controls",r),this.$selection.on("mousedown",(function(e){1===e.which&&n.trigger("toggle",{originalEvent:e})})),this.$selection.on("focus",(function(e){})),this.$selection.on("blur",(function(e){})),e.on("focus",(function(t){e.isOpen()||n.$selection.trigger("focus")}))},a.prototype.clear=function(){var e=this.$selection.find(".select2-selection__rendered");e.empty(),e.removeAttr("title")},a.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},a.prototype.selectionContainer=function(){return e("<span></span>")},a.prototype.update=function(e){if(0!==e.length){var t=e[0],n=this.$selection.find(".select2-selection__rendered"),r=this.display(t,n);n.empty().append(r);var a=t.title||t.text;a?n.attr("title",a):n.removeAttr("title")}else this.clear()},a})),n.define("select2/selection/multiple",["jquery","./base","../utils"],(function(e,t,n){function r(e,t){r.__super__.constructor.apply(this,arguments)}return n.Extend(r,t),r.prototype.render=function(){var e=r.__super__.render.call(this);return e[0].classList.add("select2-selection--multiple"),e.html('<ul class="select2-selection__rendered"></ul>'),e},r.prototype.bind=function(t,a){var s=this;r.__super__.bind.apply(this,arguments);var i=t.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",i),this.$selection.on("click",(function(e){s.trigger("toggle",{originalEvent:e})})),this.$selection.on("click",".select2-selection__choice__remove",(function(t){if(!s.isDisabled()){var r=e(this).parent(),a=n.GetData(r[0],"data");s.trigger("unselect",{originalEvent:t,data:a})}})),this.$selection.on("keydown",".select2-selection__choice__remove",(function(e){s.isDisabled()||e.stopPropagation()}))},r.prototype.clear=function(){var e=this.$selection.find(".select2-selection__rendered");e.empty(),e.removeAttr("title")},r.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},r.prototype.selectionContainer=function(){return e('<li class="select2-selection__choice"><button type="button" class="select2-selection__choice__remove" tabindex="-1"><span aria-hidden="true">×</span></button><span class="select2-selection__choice__display"></span></li>')},r.prototype.update=function(e){if(this.clear(),0!==e.length){for(var t=[],r=this.$selection.find(".select2-selection__rendered").attr("id")+"-choice-",a=0;a<e.length;a++){var s=e[a],i=this.selectionContainer(),o=this.display(s,i),l=r+n.generateChars(4)+"-";s.id?l+=s.id:l+=n.generateChars(4),i.find(".select2-selection__choice__display").append(o).attr("id",l);var c=s.title||s.text;c&&i.attr("title",c);var d=this.options.get("translations").get("removeItem"),u=i.find(".select2-selection__choice__remove");u.attr("title",d()),u.attr("aria-label",d()),u.attr("aria-describedby",l),n.StoreData(i[0],"data",s),t.push(i)}this.$selection.find(".select2-selection__rendered").append(t)}},r})),n.define("select2/selection/placeholder",[],(function(){function e(e,t,n){this.placeholder=this.normalizePlaceholder(n.get("placeholder")),e.call(this,t,n)}return e.prototype.normalizePlaceholder=function(e,t){return"string"==typeof t&&(t={id:"",text:t}),t},e.prototype.createPlaceholder=function(e,t){var n=this.selectionContainer();n.html(this.display(t)),n[0].classList.add("select2-selection__placeholder"),n[0].classList.remove("select2-selection__choice");var r=t.title||t.text||n.text();return this.$selection.find(".select2-selection__rendered").attr("title",r),n},e.prototype.update=function(e,t){var n=1==t.length&&t[0].id!=this.placeholder.id;if(t.length>1||n)return e.call(this,t);this.clear();var r=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(r)},e})),n.define("select2/selection/allowClear",["jquery","../keys","../utils"],(function(e,t,n){function r(){}return r.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",(function(e){r._handleClear(e)})),t.on("keypress",(function(e){r._handleKeyboardClear(e,t)}))},r.prototype._handleClear=function(e,t){if(!this.isDisabled()){var r=this.$selection.find(".select2-selection__clear");if(0!==r.length){t.stopPropagation();var a=n.GetData(r[0],"data"),s=this.$element.val();this.$element.val(this.placeholder.id);var i={data:a};if(this.trigger("clear",i),i.prevented)this.$element.val(s);else{for(var o=0;o<a.length;o++)if(i={data:a[o]},this.trigger("unselect",i),i.prevented)return void this.$element.val(s);this.$element.trigger("input").trigger("change"),this.trigger("toggle",{})}}}},r.prototype._handleKeyboardClear=function(e,n,r){r.isOpen()||n.which!=t.DELETE&&n.which!=t.BACKSPACE||this._handleClear(n)},r.prototype.update=function(t,r){if(t.call(this,r),this.$selection.find(".select2-selection__clear").remove(),this.$selection[0].classList.remove("select2-selection--clearable"),!(this.$selection.find(".select2-selection__placeholder").length>0||0===r.length)){var a=this.$selection.find(".select2-selection__rendered").attr("id"),s=this.options.get("translations").get("removeAllItems"),i=e('<button type="button" class="select2-selection__clear" tabindex="-1"><span aria-hidden="true">×</span></button>');i.attr("title",s()),i.attr("aria-label",s()),i.attr("aria-describedby",a),n.StoreData(i[0],"data",r),this.$selection.prepend(i),this.$selection[0].classList.add("select2-selection--clearable")}},r})),n.define("select2/selection/search",["jquery","../utils","../keys"],(function(e,t,n){function r(e,t,n){e.call(this,t,n)}return r.prototype.render=function(t){var n=this.options.get("translations").get("search"),r=e('<span class="select2-search select2-search--inline"><textarea class="select2-search__field" type="search" tabindex="-1" autocorrect="off" autocapitalize="none" spellcheck="false" role="searchbox" aria-autocomplete="list" ></textarea></span>');this.$searchContainer=r,this.$search=r.find("textarea"),this.$search.prop("autocomplete",this.options.get("autocomplete")),this.$search.attr("aria-label",n());var a=t.call(this);return this._transferTabIndex(),a.append(this.$searchContainer),a},r.prototype.bind=function(e,r,a){var s=this,i=r.id+"-results",o=r.id+"-container";e.call(this,r,a),s.$search.attr("aria-describedby",o),r.on("open",(function(){s.$search.attr("aria-controls",i),s.$search.trigger("focus")})),r.on("close",(function(){s.$search.val(""),s.resizeSearch(),s.$search.removeAttr("aria-controls"),s.$search.removeAttr("aria-activedescendant"),s.$search.trigger("focus")})),r.on("enable",(function(){s.$search.prop("disabled",!1),s._transferTabIndex()})),r.on("disable",(function(){s.$search.prop("disabled",!0)})),r.on("focus",(function(e){s.$search.trigger("focus")})),r.on("results:focus",(function(e){e.data._resultId?s.$search.attr("aria-activedescendant",e.data._resultId):s.$search.removeAttr("aria-activedescendant")})),this.$selection.on("focusin",".select2-search--inline",(function(e){s.trigger("focus",e)})),this.$selection.on("focusout",".select2-search--inline",(function(e){s._handleBlur(e)})),this.$selection.on("keydown",".select2-search--inline",(function(e){if(e.stopPropagation(),s.trigger("keypress",e),s._keyUpPrevented=e.isDefaultPrevented(),e.which===n.BACKSPACE&&""===s.$search.val()){var r=s.$selection.find(".select2-selection__choice").last();if(r.length>0){var a=t.GetData(r[0],"data");s.searchRemoveChoice(a),e.preventDefault()}}})),this.$selection.on("click",".select2-search--inline",(function(e){s.$search.val()&&e.stopPropagation()}));var l=document.documentMode,c=l&&l<=11;this.$selection.on("input.searchcheck",".select2-search--inline",(function(e){c?s.$selection.off("input.search input.searchcheck"):s.$selection.off("keyup.search")})),this.$selection.on("keyup.search input.search",".select2-search--inline",(function(e){if(c&&"input"===e.type)s.$selection.off("input.search input.searchcheck");else{var t=e.which;t!=n.SHIFT&&t!=n.CTRL&&t!=n.ALT&&t!=n.TAB&&s.handleSearch(e)}}))},r.prototype._transferTabIndex=function(e){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},r.prototype.createPlaceholder=function(e,t){this.$search.attr("placeholder",t.text)},r.prototype.update=function(e,t){var n=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),e.call(this,t),this.resizeSearch(),n&&this.$search.trigger("focus")},r.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var e=this.$search.val();this.trigger("query",{term:e})}this._keyUpPrevented=!1},r.prototype.searchRemoveChoice=function(e,t){this.trigger("unselect",{data:t}),this.$search.val(t.text),this.handleSearch()},r.prototype.resizeSearch=function(){this.$search.css("width","25px");var e="100%";""===this.$search.attr("placeholder")&&(e=.75*(this.$search.val().length+1)+"em"),this.$search.css("width",e)},r})),n.define("select2/selection/selectionCss",["../utils"],(function(e){function t(){}return t.prototype.render=function(t){var n=t.call(this),r=this.options.get("selectionCssClass")||"";return-1!==r.indexOf(":all:")&&(r=r.replace(":all:",""),e.copyNonInternalCssClasses(n[0],this.$element[0])),n.addClass(r),n},t})),n.define("select2/selection/eventRelay",["jquery"],(function(e){function t(){}return t.prototype.bind=function(t,n,r){var a=this,s=["open","opening","close","closing","select","selecting","unselect","unselecting","clear","clearing"],i=["opening","closing","selecting","unselecting","clearing"];t.call(this,n,r),n.on("*",(function(t,n){if(-1!==s.indexOf(t)){n=n||{};var r=e.Event("select2:"+t,{params:n});a.$element.trigger(r),-1!==i.indexOf(t)&&(n.prevented=r.isDefaultPrevented())}}))},t})),n.define("select2/translation",["jquery","require"],(function(e,t){function n(e){this.dict=e||{}}return n.prototype.all=function(){return this.dict},n.prototype.get=function(e){return this.dict[e]},n.prototype.extend=function(t){this.dict=e.extend({},t.all(),this.dict)},n._cache={},n.loadPath=function(e){if(!(e in n._cache)){var r=t(e);n._cache[e]=r}return new n(n._cache[e])},n})),n.define("select2/diacritics",[],(function(){return{"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Œ":"OE","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","œ":"oe","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ώ":"ω","ς":"σ","’":"'"}})),n.define("select2/data/base",["../utils"],(function(e){function t(e,n){t.__super__.constructor.call(this)}return e.Extend(t,e.Observable),t.prototype.current=function(e){throw new Error("The `current` method must be defined in child classes.")},t.prototype.query=function(e,t){throw new Error("The `query` method must be defined in child classes.")},t.prototype.bind=function(e,t){},t.prototype.destroy=function(){},t.prototype.generateResultId=function(t,n){var r=t.id+"-result-";return r+=e.generateChars(4),null!=n.id?r+="-"+n.id.toString():r+="-"+e.generateChars(4),r},t})),n.define("select2/data/select",["./base","../utils","jquery"],(function(e,t,n){function r(e,t){this.$element=e,this.options=t,r.__super__.constructor.call(this)}return t.Extend(r,e),r.prototype.current=function(e){var t=this;e(Array.prototype.map.call(this.$element[0].querySelectorAll(":checked"),(function(e){return t.item(n(e))})))},r.prototype.select=function(e){var t=this;if(e.selected=!0,null!=e.element&&"option"===e.element.tagName.toLowerCase())return e.element.selected=!0,void this.$element.trigger("input").trigger("change");if(this.$element.prop("multiple"))this.current((function(n){var r=[];(e=[e]).push.apply(e,n);for(var a=0;a<e.length;a++){var s=e[a].id;-1===r.indexOf(s)&&r.push(s)}t.$element.val(r),t.$element.trigger("input").trigger("change")}));else{var n=e.id;this.$element.val(n),this.$element.trigger("input").trigger("change")}},r.prototype.unselect=function(e){var t=this;if(this.$element.prop("multiple")){if(e.selected=!1,null!=e.element&&"option"===e.element.tagName.toLowerCase())return e.element.selected=!1,void this.$element.trigger("input").trigger("change");this.current((function(n){for(var r=[],a=0;a<n.length;a++){var s=n[a].id;s!==e.id&&-1===r.indexOf(s)&&r.push(s)}t.$element.val(r),t.$element.trigger("input").trigger("change")}))}},r.prototype.bind=function(e,t){var n=this;this.container=e,e.on("select",(function(e){n.select(e.data)})),e.on("unselect",(function(e){n.unselect(e.data)}))},r.prototype.destroy=function(){this.$element.find("*").each((function(){t.RemoveData(this)}))},r.prototype.query=function(e,t){var r=[],a=this;this.$element.children().each((function(){if("option"===this.tagName.toLowerCase()||"optgroup"===this.tagName.toLowerCase()){var t=n(this),s=a.item(t),i=a.matches(e,s);null!==i&&r.push(i)}})),t({results:r})},r.prototype.addOptions=function(e){this.$element.append(e)},r.prototype.option=function(e){var r;e.children?(r=document.createElement("optgroup")).label=e.text:void 0!==(r=document.createElement("option")).textContent?r.textContent=e.text:r.innerText=e.text,void 0!==e.id&&(r.value=e.id),e.disabled&&(r.disabled=!0),e.selected&&(r.selected=!0),e.title&&(r.title=e.title);var a=this._normalizeItem(e);return a.element=r,t.StoreData(r,"data",a),n(r)},r.prototype.item=function(e){var r={};if(null!=(r=t.GetData(e[0],"data")))return r;var a=e[0];if("option"===a.tagName.toLowerCase())r={id:e.val(),text:e.text(),disabled:e.prop("disabled"),selected:e.prop("selected"),title:e.prop("title")};else if("optgroup"===a.tagName.toLowerCase()){r={text:e.prop("label"),children:[],title:e.prop("title")};for(var s=e.children("option"),i=[],o=0;o<s.length;o++){var l=n(s[o]),c=this.item(l);i.push(c)}r.children=i}return(r=this._normalizeItem(r)).element=e[0],t.StoreData(e[0],"data",r),r},r.prototype._normalizeItem=function(e){e!==Object(e)&&(e={id:e,text:e});return null!=(e=n.extend({},{text:""},e)).id&&(e.id=e.id.toString()),null!=e.text&&(e.text=e.text.toString()),null==e._resultId&&e.id&&null!=this.container&&(e._resultId=this.generateResultId(this.container,e)),n.extend({},{selected:!1,disabled:!1},e)},r.prototype.matches=function(e,t){return this.options.get("matcher")(e,t)},r})),n.define("select2/data/array",["./select","../utils","jquery"],(function(e,t,n){function r(e,t){this._dataToConvert=t.get("data")||[],r.__super__.constructor.call(this,e,t)}return t.Extend(r,e),r.prototype.bind=function(e,t){r.__super__.bind.call(this,e,t),this.addOptions(this.convertToOptions(this._dataToConvert))},r.prototype.select=function(e){var t=this.$element.find("option").filter((function(t,n){return n.value==e.id.toString()}));0===t.length&&(t=this.option(e),this.addOptions(t)),r.__super__.select.call(this,e)},r.prototype.convertToOptions=function(e){var t=this,r=this.$element.find("option"),a=r.map((function(){return t.item(n(this)).id})).get(),s=[];function i(e){return function(){return n(this).val()==e.id}}for(var o=0;o<e.length;o++){var l=this._normalizeItem(e[o]);if(a.indexOf(l.id)>=0){var c=r.filter(i(l)),d=this.item(c),u=n.extend(!0,{},l,d),p=this.option(u);c.replaceWith(p)}else{var m=this.option(l);if(l.children){var h=this.convertToOptions(l.children);m.append(h)}s.push(m)}}return s},r})),n.define("select2/data/ajax",["./array","../utils","jquery"],(function(e,t,n){function r(e,t){this.ajaxOptions=this._applyDefaults(t.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),r.__super__.constructor.call(this,e,t)}return t.Extend(r,e),r.prototype._applyDefaults=function(e){var t={data:function(e){return n.extend({},e,{q:e.term})},transport:function(e,t,r){var a=n.ajax(e);return a.then(t),a.fail(r),a}};return n.extend({},t,e,!0)},r.prototype.processResults=function(e){return e},r.prototype.query=function(e,t){var r=this;null!=this._request&&("function"==typeof this._request.abort&&this._request.abort(),this._request=null);var a=n.extend({type:"GET"},this.ajaxOptions);function s(){var n=a.transport(a,(function(n){var a=r.processResults(n,e);r.options.get("debug")&&window.console&&console.error&&(a&&a.results&&Array.isArray(a.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),t(a)}),(function(){(!("status"in n)||0!==n.status&&"0"!==n.status)&&r.trigger("results:message",{message:"errorLoading"})}));r._request=n}"function"==typeof a.url&&(a.url=a.url.call(this.$element,e)),"function"==typeof a.data&&(a.data=a.data.call(this.$element,e)),this.ajaxOptions.delay&&null!=e.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(s,this.ajaxOptions.delay)):s()},r})),n.define("select2/data/tags",["jquery"],(function(e){function t(e,t,n){var r=n.get("tags"),a=n.get("createTag");void 0!==a&&(this.createTag=a);var s=n.get("insertTag");if(void 0!==s&&(this.insertTag=s),e.call(this,t,n),Array.isArray(r))for(var i=0;i<r.length;i++){var o=r[i],l=this._normalizeItem(o),c=this.option(l);this.$element.append(c)}}return t.prototype.query=function(e,t,n){var r=this;this._removeOldTags(),null!=t.term&&null==t.page?e.call(this,t,(function e(a,s){for(var i=a.results,o=0;o<i.length;o++){var l=i[o],c=null!=l.children&&!e({results:l.children},!0);if((l.text||"").toUpperCase()===(t.term||"").toUpperCase()||c)return!s&&(a.data=i,void n(a))}if(s)return!0;var d=r.createTag(t);if(null!=d){var u=r.option(d);u.attr("data-select2-tag","true"),r.addOptions([u]),r.insertTag(i,d)}a.results=i,n(a)})):e.call(this,t,n)},t.prototype.createTag=function(e,t){if(null==t.term)return null;var n=t.term.trim();return""===n?null:{id:n,text:n}},t.prototype.insertTag=function(e,t,n){t.unshift(n)},t.prototype._removeOldTags=function(t){this.$element.find("option[data-select2-tag]").each((function(){this.selected||e(this).remove()}))},t})),n.define("select2/data/tokenizer",["jquery"],(function(e){function t(e,t,n){var r=n.get("tokenizer");void 0!==r&&(this.tokenizer=r),e.call(this,t,n)}return t.prototype.bind=function(e,t,n){e.call(this,t,n),this.$search=t.dropdown.$search||t.selection.$search||n.find(".select2-search__field")},t.prototype.query=function(t,n,r){var a=this;n.term=n.term||"";var s=this.tokenizer(n,this.options,(function(t){var n=a._normalizeItem(t);if(!a.$element.find("option").filter((function(){return e(this).val()===n.id})).length){var r=a.option(n);r.attr("data-select2-tag",!0),a._removeOldTags(),a.addOptions([r])}!function(e){a.trigger("select",{data:e})}(n)}));s.term!==n.term&&(this.$search.length&&(this.$search.val(s.term),this.$search.trigger("focus")),n.term=s.term),t.call(this,n,r)},t.prototype.tokenizer=function(t,n,r,a){for(var s=r.get("tokenSeparators")||[],i=n.term,o=0,l=this.createTag||function(e){return{id:e.term,text:e.term}};o<i.length;){var c=i[o];if(-1!==s.indexOf(c)){var d=i.substr(0,o),u=l(e.extend({},n,{term:d}));null!=u?(a(u),i=i.substr(o+1)||"",o=0):o++}else o++}return{term:i}},t})),n.define("select2/data/minimumInputLength",[],(function(){function e(e,t,n){this.minimumInputLength=n.get("minimumInputLength"),e.call(this,t,n)}return e.prototype.query=function(e,t,n){t.term=t.term||"",t.term.length<this.minimumInputLength?this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:t.term,params:t}}):e.call(this,t,n)},e})),n.define("select2/data/maximumInputLength",[],(function(){function e(e,t,n){this.maximumInputLength=n.get("maximumInputLength"),e.call(this,t,n)}return e.prototype.query=function(e,t,n){t.term=t.term||"",this.maximumInputLength>0&&t.term.length>this.maximumInputLength?this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:t.term,params:t}}):e.call(this,t,n)},e})),n.define("select2/data/maximumSelectionLength",[],(function(){function e(e,t,n){this.maximumSelectionLength=n.get("maximumSelectionLength"),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("select",(function(){r._checkIfMaximumSelected()}))},e.prototype.query=function(e,t,n){var r=this;this._checkIfMaximumSelected((function(){e.call(r,t,n)}))},e.prototype._checkIfMaximumSelected=function(e,t){var n=this;this.current((function(e){var r=null!=e?e.length:0;n.maximumSelectionLength>0&&r>=n.maximumSelectionLength?n.trigger("results:message",{message:"maximumSelected",args:{maximum:n.maximumSelectionLength}}):t&&t()}))},e})),n.define("select2/dropdown",["jquery","./utils"],(function(e,t){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return t.Extend(n,t.Observable),n.prototype.render=function(){var t=e('<span class="select2-dropdown"><span class="select2-results"></span></span>');return t.attr("dir",this.options.get("dir")),this.$dropdown=t,t},n.prototype.bind=function(){},n.prototype.position=function(e,t){},n.prototype.destroy=function(){this.$dropdown.remove()},n})),n.define("select2/dropdown/search",["jquery"],(function(e){function t(){}return t.prototype.render=function(t){var n=t.call(this),r=this.options.get("translations").get("search"),a=e('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocorrect="off" autocapitalize="none" spellcheck="false" role="searchbox" aria-autocomplete="list" /></span>');return this.$searchContainer=a,this.$search=a.find("input"),this.$search.prop("autocomplete",this.options.get("autocomplete")),this.$search.attr("aria-label",r()),n.prepend(a),n},t.prototype.bind=function(t,n,r){var a=this,s=n.id+"-results";t.call(this,n,r),this.$search.on("keydown",(function(e){a.trigger("keypress",e),a._keyUpPrevented=e.isDefaultPrevented()})),this.$search.on("input",(function(t){e(this).off("keyup")})),this.$search.on("keyup input",(function(e){a.handleSearch(e)})),n.on("open",(function(){a.$search.attr("tabindex",0),a.$search.attr("aria-controls",s),a.$search.trigger("focus"),window.setTimeout((function(){a.$search.trigger("focus")}),0)})),n.on("close",(function(){a.$search.attr("tabindex",-1),a.$search.removeAttr("aria-controls"),a.$search.removeAttr("aria-activedescendant"),a.$search.val(""),a.$search.trigger("blur")})),n.on("focus",(function(){n.isOpen()||a.$search.trigger("focus")})),n.on("results:all",(function(e){null!=e.query.term&&""!==e.query.term||(a.showSearch(e)?a.$searchContainer[0].classList.remove("select2-search--hide"):a.$searchContainer[0].classList.add("select2-search--hide"))})),n.on("results:focus",(function(e){e.data._resultId?a.$search.attr("aria-activedescendant",e.data._resultId):a.$search.removeAttr("aria-activedescendant")}))},t.prototype.handleSearch=function(e){if(!this._keyUpPrevented){var t=this.$search.val();this.trigger("query",{term:t})}this._keyUpPrevented=!1},t.prototype.showSearch=function(e,t){return!0},t})),n.define("select2/dropdown/hidePlaceholder",[],(function(){function e(e,t,n,r){this.placeholder=this.normalizePlaceholder(n.get("placeholder")),e.call(this,t,n,r)}return e.prototype.append=function(e,t){t.results=this.removePlaceholder(t.results),e.call(this,t)},e.prototype.normalizePlaceholder=function(e,t){return"string"==typeof t&&(t={id:"",text:t}),t},e.prototype.removePlaceholder=function(e,t){for(var n=t.slice(0),r=t.length-1;r>=0;r--){var a=t[r];this.placeholder.id===a.id&&n.splice(r,1)}return n},e})),n.define("select2/dropdown/infiniteScroll",["jquery"],(function(e){function t(e,t,n,r){this.lastParams={},e.call(this,t,n,r),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return t.prototype.append=function(e,t){this.$loadingMore.remove(),this.loading=!1,e.call(this,t),this.showLoadingMore(t)&&(this.$results.append(this.$loadingMore),this.loadMoreIfNeeded())},t.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("query",(function(e){r.lastParams=e,r.loading=!0})),t.on("query:append",(function(e){r.lastParams=e,r.loading=!0})),this.$results.on("scroll",this.loadMoreIfNeeded.bind(this))},t.prototype.loadMoreIfNeeded=function(){var t=e.contains(document.documentElement,this.$loadingMore[0]);!this.loading&&t&&this.$results.offset().top+this.$results.outerHeight(!1)+50>=this.$loadingMore.offset().top+this.$loadingMore.outerHeight(!1)&&this.loadMore()},t.prototype.loadMore=function(){this.loading=!0;var t=e.extend({},{page:1},this.lastParams);t.page++,this.trigger("query:append",t)},t.prototype.showLoadingMore=function(e,t){return t.pagination&&t.pagination.more},t.prototype.createLoadingMore=function(){var t=e('<li class="select2-results__option select2-results__option--load-more"role="option" aria-disabled="true"></li>'),n=this.options.get("translations").get("loadingMore");return t.html(n(this.lastParams)),t},t})),n.define("select2/dropdown/attachBody",["jquery","../utils"],(function(e,t){function n(t,n,r){this.$dropdownParent=e(r.get("dropdownParent")||document.body),t.call(this,n,r)}return n.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("open",(function(){r._showDropdown(),r._attachPositioningHandler(t),r._bindContainerResultHandlers(t)})),t.on("close",(function(){r._hideDropdown(),r._detachPositioningHandler(t)})),this.$dropdownContainer.on("mousedown",(function(e){e.stopPropagation()}))},n.prototype.destroy=function(e){e.call(this),this.$dropdownContainer.remove()},n.prototype.position=function(e,t,n){t.attr("class",n.attr("class")),t[0].classList.remove("select2"),t[0].classList.add("select2-container--open"),t.css({position:"absolute",top:-999999}),this.$container=n},n.prototype.render=function(t){var n=e("<span></span>"),r=t.call(this);return n.append(r),this.$dropdownContainer=n,n},n.prototype._hideDropdown=function(e){this.$dropdownContainer.detach()},n.prototype._bindContainerResultHandlers=function(e,t){if(!this._containerResultsHandlersBound){var n=this;t.on("results:all",(function(){n._positionDropdown(),n._resizeDropdown()})),t.on("results:append",(function(){n._positionDropdown(),n._resizeDropdown()})),t.on("results:message",(function(){n._positionDropdown(),n._resizeDropdown()})),t.on("select",(function(){n._positionDropdown(),n._resizeDropdown()})),t.on("unselect",(function(){n._positionDropdown(),n._resizeDropdown()})),this._containerResultsHandlersBound=!0}},n.prototype._attachPositioningHandler=function(n,r){var a=this,s="scroll.select2."+r.id,i="resize.select2."+r.id,o="orientationchange.select2."+r.id,l=this.$container.parents().filter(t.hasScroll);l.each((function(){t.StoreData(this,"select2-scroll-position",{x:e(this).scrollLeft(),y:e(this).scrollTop()})})),l.on(s,(function(n){var r=t.GetData(this,"select2-scroll-position");e(this).scrollTop(r.y)})),e(window).on(s+" "+i+" "+o,(function(e){a._positionDropdown(),a._resizeDropdown()}))},n.prototype._detachPositioningHandler=function(n,r){var a="scroll.select2."+r.id,s="resize.select2."+r.id,i="orientationchange.select2."+r.id;this.$container.parents().filter(t.hasScroll).off(a),e(window).off(a+" "+s+" "+i)},n.prototype._positionDropdown=function(){var t=e(window),n=this.$dropdown[0].classList.contains("select2-dropdown--above"),r=this.$dropdown[0].classList.contains("select2-dropdown--below"),a=null,s=this.$container.offset();s.bottom=s.top+this.$container.outerHeight(!1);var i={height:this.$container.outerHeight(!1)};i.top=s.top,i.bottom=s.top+i.height;var o=this.$dropdown.outerHeight(!1),l=t.scrollTop(),c=t.scrollTop()+t.height(),d=l<s.top-o,u=c>s.bottom+o,p={left:s.left,top:i.bottom},m=this.$dropdownParent;"static"===m.css("position")&&(m=m.offsetParent());var h={top:0,left:0};(e.contains(document.body,m[0])||m[0].isConnected)&&(h=m.offset()),p.top-=h.top,p.left-=h.left,n||r||(a="below"),u||!d||n?!d&&u&&n&&(a="below"):a="above",("above"==a||n&&"below"!==a)&&(p.top=i.top-h.top-o),null!=a&&(this.$dropdown[0].classList.remove("select2-dropdown--below"),this.$dropdown[0].classList.remove("select2-dropdown--above"),this.$dropdown[0].classList.add("select2-dropdown--"+a),this.$container[0].classList.remove("select2-container--below"),this.$container[0].classList.remove("select2-container--above"),this.$container[0].classList.add("select2-container--"+a)),this.$dropdownContainer.css(p)},n.prototype._resizeDropdown=function(){var e={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(e.minWidth=e.width,e.position="relative",e.width="auto"),this.$dropdown.css(e)},n.prototype._showDropdown=function(e){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},n})),n.define("select2/dropdown/minimumResultsForSearch",[],(function(){function e(t){for(var n=0,r=0;r<t.length;r++){var a=t[r];a.children?n+=e(a.children):n++}return n}function t(e,t,n,r){this.minimumResultsForSearch=n.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),e.call(this,t,n,r)}return t.prototype.showSearch=function(t,n){return!(e(n.data.results)<this.minimumResultsForSearch)&&t.call(this,n)},t})),n.define("select2/dropdown/selectOnClose",["../utils"],(function(e){function t(){}return t.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("close",(function(e){r._handleSelectOnClose(e)}))},t.prototype._handleSelectOnClose=function(t,n){if(n&&null!=n.originalSelect2Event){var r=n.originalSelect2Event;if("select"===r._type||"unselect"===r._type)return}var a=this.getHighlightedResults();if(!(a.length<1)){var s=e.GetData(a[0],"data");null!=s.element&&s.element.selected||null==s.element&&s.selected||this.trigger("select",{data:s})}},t})),n.define("select2/dropdown/closeOnSelect",[],(function(){function e(){}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("select",(function(e){r._selectTriggered(e)})),t.on("unselect",(function(e){r._selectTriggered(e)}))},e.prototype._selectTriggered=function(e,t){var n=t.originalEvent;n&&(n.ctrlKey||n.metaKey)||this.trigger("close",{originalEvent:n,originalSelect2Event:t})},e})),n.define("select2/dropdown/dropdownCss",["../utils"],(function(e){function t(){}return t.prototype.render=function(t){var n=t.call(this),r=this.options.get("dropdownCssClass")||"";return-1!==r.indexOf(":all:")&&(r=r.replace(":all:",""),e.copyNonInternalCssClasses(n[0],this.$element[0])),n.addClass(r),n},t})),n.define("select2/dropdown/tagsSearchHighlight",["../utils"],(function(e){function t(){}return t.prototype.highlightFirstItem=function(t){var n=this.$results.find(".select2-results__option--selectable:not(.select2-results__option--selected)");if(n.length>0){var r=n.first(),a=e.GetData(r[0],"data").element;if(a&&a.getAttribute&&"true"===a.getAttribute("data-select2-tag"))return void r.trigger("mouseenter")}t.call(this)},t})),n.define("select2/i18n/en",[],(function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Please delete "+t+" character";return 1!=t&&(n+="s"),n},inputTooShort:function(e){return"Please enter "+(e.minimum-e.input.length)+" or more characters"},loadingMore:function(){return"Loading more results…"},maximumSelected:function(e){var t="You can only select "+e.maximum+" item";return 1!=e.maximum&&(t+="s"),t},noResults:function(){return"No results found"},searching:function(){return"Searching…"},removeAllItems:function(){return"Remove all items"},removeItem:function(){return"Remove item"},search:function(){return"Search"}}})),n.define("select2/defaults",["jquery","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/selectionCss","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./dropdown/dropdownCss","./dropdown/tagsSearchHighlight","./i18n/en"],(function(e,t,n,r,a,s,i,o,l,c,d,u,p,m,h,f,g,x,v,b,y,w,_,j,S,I,C,T,k,N,D){function E(){this.reset()}return E.prototype.apply=function(d){if(null==(d=e.extend(!0,{},this.defaults,d)).dataAdapter&&(null!=d.ajax?d.dataAdapter=h:null!=d.data?d.dataAdapter=m:d.dataAdapter=p,d.minimumInputLength>0&&(d.dataAdapter=c.Decorate(d.dataAdapter,x)),d.maximumInputLength>0&&(d.dataAdapter=c.Decorate(d.dataAdapter,v)),d.maximumSelectionLength>0&&(d.dataAdapter=c.Decorate(d.dataAdapter,b)),d.tags&&(d.dataAdapter=c.Decorate(d.dataAdapter,f)),null==d.tokenSeparators&&null==d.tokenizer||(d.dataAdapter=c.Decorate(d.dataAdapter,g))),null==d.resultsAdapter&&(d.resultsAdapter=t,null!=d.ajax&&(d.resultsAdapter=c.Decorate(d.resultsAdapter,j)),null!=d.placeholder&&(d.resultsAdapter=c.Decorate(d.resultsAdapter,_)),d.selectOnClose&&(d.resultsAdapter=c.Decorate(d.resultsAdapter,C)),d.tags&&(d.resultsAdapter=c.Decorate(d.resultsAdapter,N))),null==d.dropdownAdapter){if(d.multiple)d.dropdownAdapter=y;else{var u=c.Decorate(y,w);d.dropdownAdapter=u}0!==d.minimumResultsForSearch&&(d.dropdownAdapter=c.Decorate(d.dropdownAdapter,I)),d.closeOnSelect&&(d.dropdownAdapter=c.Decorate(d.dropdownAdapter,T)),null!=d.dropdownCssClass&&(d.dropdownAdapter=c.Decorate(d.dropdownAdapter,k)),d.dropdownAdapter=c.Decorate(d.dropdownAdapter,S)}null==d.selectionAdapter&&(d.multiple?d.selectionAdapter=r:d.selectionAdapter=n,null!=d.placeholder&&(d.selectionAdapter=c.Decorate(d.selectionAdapter,a)),d.allowClear&&(d.selectionAdapter=c.Decorate(d.selectionAdapter,s)),d.multiple&&(d.selectionAdapter=c.Decorate(d.selectionAdapter,i)),null!=d.selectionCssClass&&(d.selectionAdapter=c.Decorate(d.selectionAdapter,o)),d.selectionAdapter=c.Decorate(d.selectionAdapter,l)),d.language=this._resolveLanguage(d.language),d.language.push("en");for(var D=[],E=0;E<d.language.length;E++){var A=d.language[E];-1===D.indexOf(A)&&D.push(A)}return d.language=D,d.translations=this._processTranslations(d.language,d.debug),d},E.prototype.reset=function(){function t(e){return e.replace(/[^\u0000-\u007E]/g,(function(e){return u[e]||e}))}this.defaults={amdLanguageBase:"./i18n/",autocomplete:"off",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:c.escapeMarkup,language:{},matcher:function n(r,a){if(null==r.term||""===r.term.trim())return a;if(a.children&&a.children.length>0){for(var s=e.extend(!0,{},a),i=a.children.length-1;i>=0;i--)null==n(r,a.children[i])&&s.children.splice(i,1);return s.children.length>0?s:n(r,s)}var o=t(a.text).toUpperCase(),l=t(r.term).toUpperCase();return o.indexOf(l)>-1?a:null},minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,scrollAfterSelect:!1,sorter:function(e){return e},templateResult:function(e){return e.text},templateSelection:function(e){return e.text},theme:"default",width:"resolve"}},E.prototype.applyFromElement=function(e,t){var n=e.language,r=this.defaults.language,a=t.prop("lang"),s=t.closest("[lang]").prop("lang"),i=Array.prototype.concat.call(this._resolveLanguage(a),this._resolveLanguage(n),this._resolveLanguage(r),this._resolveLanguage(s));return e.language=i,e},E.prototype._resolveLanguage=function(t){if(!t)return[];if(e.isEmptyObject(t))return[];if(e.isPlainObject(t))return[t];var n;n=Array.isArray(t)?t:[t];for(var r=[],a=0;a<n.length;a++)if(r.push(n[a]),"string"==typeof n[a]&&n[a].indexOf("-")>0){var s=n[a].split("-")[0];r.push(s)}return r},E.prototype._processTranslations=function(t,n){for(var r=new d,a=0;a<t.length;a++){var s=new d,i=t[a];if("string"==typeof i)try{s=d.loadPath(i)}catch(e){try{i=this.defaults.amdLanguageBase+i,s=d.loadPath(i)}catch(e){n&&window.console&&console.warn&&console.warn('Select2: The language file for "'+i+'" could not be automatically loaded. A fallback will be used instead.')}}else s=e.isPlainObject(i)?new d(i):i;r.extend(s)}return r},E.prototype.set=function(t,n){var r={};r[e.camelCase(t)]=n;var a=c._convertData(r);e.extend(!0,this.defaults,a)},new E})),n.define("select2/options",["jquery","./defaults","./utils"],(function(e,t,n){function r(e,n){this.options=e,null!=n&&this.fromElement(n),null!=n&&(this.options=t.applyFromElement(this.options,n)),this.options=t.apply(this.options)}return r.prototype.fromElement=function(t){var r=["select2"];null==this.options.multiple&&(this.options.multiple=t.prop("multiple")),null==this.options.disabled&&(this.options.disabled=t.prop("disabled")),null==this.options.autocomplete&&t.prop("autocomplete")&&(this.options.autocomplete=t.prop("autocomplete")),null==this.options.dir&&(t.prop("dir")?this.options.dir=t.prop("dir"):t.closest("[dir]").prop("dir")?this.options.dir=t.closest("[dir]").prop("dir"):this.options.dir="ltr"),t.prop("disabled",this.options.disabled),t.prop("multiple",this.options.multiple),n.GetData(t[0],"select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),n.StoreData(t[0],"data",n.GetData(t[0],"select2Tags")),n.StoreData(t[0],"tags",!0)),n.GetData(t[0],"ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),t.attr("ajax--url",n.GetData(t[0],"ajaxUrl")),n.StoreData(t[0],"ajax-Url",n.GetData(t[0],"ajaxUrl")));var a={};function s(e,t){return t.toUpperCase()}for(var i=0;i<t[0].attributes.length;i++){var o=t[0].attributes[i].name,l="data-";if(o.substr(0,l.length)==l){var c=o.substring(l.length),d=n.GetData(t[0],c);a[c.replace(/-([a-z])/g,s)]=d}}e.fn.jquery&&"1."==e.fn.jquery.substr(0,2)&&t[0].dataset&&(a=e.extend(!0,{},t[0].dataset,a));var u=e.extend(!0,{},n.GetData(t[0]),a);for(var p in u=n._convertData(u))r.indexOf(p)>-1||(e.isPlainObject(this.options[p])?e.extend(this.options[p],u[p]):this.options[p]=u[p]);return this},r.prototype.get=function(e){return this.options[e]},r.prototype.set=function(e,t){this.options[e]=t},r})),n.define("select2/core",["jquery","./options","./utils","./keys"],(function(e,t,n,r){var a=function(e,r){null!=n.GetData(e[0],"select2")&&n.GetData(e[0],"select2").destroy(),this.$element=e,this.id=this._generateId(e),r=r||{},this.options=new t(r,e),a.__super__.constructor.call(this);var s=e.attr("tabindex")||0;n.StoreData(e[0],"old-tabindex",s),e.attr("tabindex","-1");var i=this.options.get("dataAdapter");this.dataAdapter=new i(e,this.options);var o=this.render();this._placeContainer(o);var l=this.options.get("selectionAdapter");this.selection=new l(e,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,o);var c=this.options.get("dropdownAdapter");this.dropdown=new c(e,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,o);var d=this.options.get("resultsAdapter");this.results=new d(e,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var u=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current((function(e){u.trigger("selection:update",{data:e})})),e[0].classList.add("select2-hidden-accessible"),e.attr("aria-hidden","true"),this._syncAttributes(),n.StoreData(e[0],"select2",this),e.data("select2",this)};return n.Extend(a,n.Observable),a.prototype._generateId=function(e){return"select2-"+(null!=e.attr("id")?e.attr("id"):null!=e.attr("name")?e.attr("name")+"-"+n.generateChars(2):n.generateChars(4)).replace(/(:|\.|\[|\]|,)/g,"")},a.prototype._placeContainer=function(e){e.insertAfter(this.$element);var t=this._resolveWidth(this.$element,this.options.get("width"));null!=t&&e.css("width",t)},a.prototype._resolveWidth=function(e,t){var n=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==t){var r=this._resolveWidth(e,"style");return null!=r?r:this._resolveWidth(e,"element")}if("element"==t){var a=e.outerWidth(!1);return a<=0?"auto":a+"px"}if("style"==t){var s=e.attr("style");if("string"!=typeof s)return null;for(var i=s.split(";"),o=0,l=i.length;o<l;o+=1){var c=i[o].replace(/\s/g,"").match(n);if(null!==c&&c.length>=1)return c[1]}return null}return"computedstyle"==t?window.getComputedStyle(e[0]).width:t},a.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},a.prototype._registerDomEvents=function(){var e=this;this.$element.on("change.select2",(function(){e.dataAdapter.current((function(t){e.trigger("selection:update",{data:t})}))})),this.$element.on("focus.select2",(function(t){e.trigger("focus",t)})),this._syncA=n.bind(this._syncAttributes,this),this._syncS=n.bind(this._syncSubtree,this),this._observer=new window.MutationObserver((function(t){e._syncA(),e._syncS(t)})),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})},a.prototype._registerDataEvents=function(){var e=this;this.dataAdapter.on("*",(function(t,n){e.trigger(t,n)}))},a.prototype._registerSelectionEvents=function(){var e=this,t=["toggle","focus"];this.selection.on("toggle",(function(){e.toggleDropdown()})),this.selection.on("focus",(function(t){e.focus(t)})),this.selection.on("*",(function(n,r){-1===t.indexOf(n)&&e.trigger(n,r)}))},a.prototype._registerDropdownEvents=function(){var e=this;this.dropdown.on("*",(function(t,n){e.trigger(t,n)}))},a.prototype._registerResultsEvents=function(){var e=this;this.results.on("*",(function(t,n){e.trigger(t,n)}))},a.prototype._registerEvents=function(){var e=this;this.on("open",(function(){e.$container[0].classList.add("select2-container--open")})),this.on("close",(function(){e.$container[0].classList.remove("select2-container--open")})),this.on("enable",(function(){e.$container[0].classList.remove("select2-container--disabled")})),this.on("disable",(function(){e.$container[0].classList.add("select2-container--disabled")})),this.on("blur",(function(){e.$container[0].classList.remove("select2-container--focus")})),this.on("query",(function(t){e.isOpen()||e.trigger("open",{}),this.dataAdapter.query(t,(function(n){e.trigger("results:all",{data:n,query:t})}))})),this.on("query:append",(function(t){this.dataAdapter.query(t,(function(n){e.trigger("results:append",{data:n,query:t})}))})),this.on("keypress",(function(t){var n=t.which;e.isOpen()?n===r.ESC||n===r.UP&&t.altKey?(e.close(t),t.preventDefault()):n===r.ENTER||n===r.TAB?(e.trigger("results:select",{}),t.preventDefault()):n===r.SPACE&&t.ctrlKey?(e.trigger("results:toggle",{}),t.preventDefault()):n===r.UP?(e.trigger("results:previous",{}),t.preventDefault()):n===r.DOWN&&(e.trigger("results:next",{}),t.preventDefault()):(n===r.ENTER||n===r.SPACE||n===r.DOWN&&t.altKey)&&(e.open(),t.preventDefault())}))},a.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.isDisabled()?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},a.prototype._isChangeMutation=function(e){var t=this;if(e.addedNodes&&e.addedNodes.length>0){for(var n=0;n<e.addedNodes.length;n++)if(e.addedNodes[n].selected)return!0}else{if(e.removedNodes&&e.removedNodes.length>0)return!0;if(Array.isArray(e))return e.some((function(e){return t._isChangeMutation(e)}))}return!1},a.prototype._syncSubtree=function(e){var t=this._isChangeMutation(e),n=this;t&&this.dataAdapter.current((function(e){n.trigger("selection:update",{data:e})}))},a.prototype.trigger=function(e,t){var n=a.__super__.trigger,r={open:"opening",close:"closing",select:"selecting",unselect:"unselecting",clear:"clearing"};if(void 0===t&&(t={}),e in r){var s=r[e],i={prevented:!1,name:e,args:t};if(n.call(this,s,i),i.prevented)return void(t.prevented=!0)}n.call(this,e,t)},a.prototype.toggleDropdown=function(){this.isDisabled()||(this.isOpen()?this.close():this.open())},a.prototype.open=function(){this.isOpen()||this.isDisabled()||this.trigger("query",{})},a.prototype.close=function(e){this.isOpen()&&this.trigger("close",{originalEvent:e})},a.prototype.isEnabled=function(){return!this.isDisabled()},a.prototype.isDisabled=function(){return this.options.get("disabled")},a.prototype.isOpen=function(){return this.$container[0].classList.contains("select2-container--open")},a.prototype.hasFocus=function(){return this.$container[0].classList.contains("select2-container--focus")},a.prototype.focus=function(e){this.hasFocus()||(this.$container[0].classList.add("select2-container--focus"),this.trigger("focus",{}))},a.prototype.enable=function(e){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),null!=e&&0!==e.length||(e=[!0]);var t=!e[0];this.$element.prop("disabled",t)},a.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var e=[];return this.dataAdapter.current((function(t){e=t})),e},a.prototype.val=function(e){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==e||0===e.length)return this.$element.val();var t=e[0];Array.isArray(t)&&(t=t.map((function(e){return e.toString()}))),this.$element.val(t).trigger("input").trigger("change")},a.prototype.destroy=function(){n.RemoveData(this.$container[0]),this.$container.remove(),this._observer.disconnect(),this._observer=null,this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",n.GetData(this.$element[0],"old-tabindex")),this.$element[0].classList.remove("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),n.RemoveData(this.$element[0]),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null},a.prototype.render=function(){var t=e('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>');return t.attr("dir",this.options.get("dir")),this.$container=t,this.$container[0].classList.add("select2-container--"+this.options.get("theme")),n.StoreData(t[0],"element",this.$element),t},a})),n.define("select2/dropdown/attachContainer",[],(function(){function e(e,t,n){e.call(this,t,n)}return e.prototype.position=function(e,t,n){n.find(".dropdown-wrapper").append(t),t[0].classList.add("select2-dropdown--below"),n[0].classList.add("select2-container--below")},e})),n.define("select2/dropdown/stopPropagation",[],(function(){function e(){}return e.prototype.bind=function(e,t,n){e.call(this,t,n);this.$dropdown.on(["blur","change","click","dblclick","focus","focusin","focusout","input","keydown","keyup","keypress","mousedown","mouseenter","mouseleave","mousemove","mouseover","mouseup","search","touchend","touchstart"].join(" "),(function(e){e.stopPropagation()}))},e})),n.define("select2/selection/stopPropagation",[],(function(){function e(){}return e.prototype.bind=function(e,t,n){e.call(this,t,n);this.$selection.on(["blur","change","click","dblclick","focus","focusin","focusout","input","keydown","keyup","keypress","mousedown","mouseenter","mouseleave","mousemove","mouseover","mouseup","search","touchend","touchstart"].join(" "),(function(e){e.stopPropagation()}))},e})),i=function(e){var t,n,r=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],a="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],s=Array.prototype.slice;if(e.event.fixHooks)for(var i=r.length;i;)e.event.fixHooks[r[--i]]=e.event.mouseHooks;var o=e.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var t=a.length;t;)this.addEventListener(a[--t],l,!1);else this.onmousewheel=l;e.data(this,"mousewheel-line-height",o.getLineHeight(this)),e.data(this,"mousewheel-page-height",o.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var t=a.length;t;)this.removeEventListener(a[--t],l,!1);else this.onmousewheel=null;e.removeData(this,"mousewheel-line-height"),e.removeData(this,"mousewheel-page-height")},getLineHeight:function(t){var n=e(t),r=n["offsetParent"in e.fn?"offsetParent":"parent"]();return r.length||(r=e("body")),parseInt(r.css("fontSize"),10)||parseInt(n.css("fontSize"),10)||16},getPageHeight:function(t){return e(t).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};function l(r){var a=r||window.event,i=s.call(arguments,1),l=0,u=0,p=0,m=0,h=0,f=0;if((r=e.event.fix(a)).type="mousewheel","detail"in a&&(p=-1*a.detail),"wheelDelta"in a&&(p=a.wheelDelta),"wheelDeltaY"in a&&(p=a.wheelDeltaY),"wheelDeltaX"in a&&(u=-1*a.wheelDeltaX),"axis"in a&&a.axis===a.HORIZONTAL_AXIS&&(u=-1*p,p=0),l=0===p?u:p,"deltaY"in a&&(l=p=-1*a.deltaY),"deltaX"in a&&(u=a.deltaX,0===p&&(l=-1*u)),0!==p||0!==u){if(1===a.deltaMode){var g=e.data(this,"mousewheel-line-height");l*=g,p*=g,u*=g}else if(2===a.deltaMode){var x=e.data(this,"mousewheel-page-height");l*=x,p*=x,u*=x}if(m=Math.max(Math.abs(p),Math.abs(u)),(!n||m<n)&&(n=m,d(a,m)&&(n/=40)),d(a,m)&&(l/=40,u/=40,p/=40),l=Math[l>=1?"floor":"ceil"](l/n),u=Math[u>=1?"floor":"ceil"](u/n),p=Math[p>=1?"floor":"ceil"](p/n),o.settings.normalizeOffset&&this.getBoundingClientRect){var v=this.getBoundingClientRect();h=r.clientX-v.left,f=r.clientY-v.top}return r.deltaX=u,r.deltaY=p,r.deltaFactor=n,r.offsetX=h,r.offsetY=f,r.deltaMode=0,i.unshift(r,l,u,p),t&&clearTimeout(t),t=setTimeout(c,200),(e.event.dispatch||e.event.handle).apply(this,i)}}function c(){n=null}function d(e,t){return o.settings.adjustOldDeltas&&"mousewheel"===e.type&&t%120==0}e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})},"function"==typeof n.define&&n.define.amd?n.define("jquery-mousewheel",["jquery"],i):e.exports=i,n.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults","./select2/utils"],(function(e,t,n,r,a){if(null==e.fn.select2){var s=["open","close","destroy"];e.fn.select2=function(t){if("object"==typeof(t=t||{}))return this.each((function(){var r=e.extend(!0,{},t);new n(e(this),r)})),this;if("string"==typeof t){var r,i=Array.prototype.slice.call(arguments,1);return this.each((function(){var e=a.GetData(this,"select2");null==e&&window.console&&console.error&&console.error("The select2('"+t+"') method was called on an element that is not using Select2."),r=e[t].apply(e,i)})),s.indexOf(t)>-1?this:r}throw new Error("Invalid arguments for Select2: "+t)}}return null==e.fn.select2.defaults&&(e.fn.select2.defaults=r),n})),{define:n.define,require:n.require}}(),r=n.require("jquery.select2");return t.fn.select2.amd=n,r},void 0===(s=r.apply(t,a))||(e.exports=s)},20282:function(e){"use strict";e.exports=function(){}},65311:function(e){"use strict";e.exports=jQuery}},function(e){e.O(0,[351],(function(){return 80640,e(e.s=80640)})),e.O()}]);
|
1 |
/*! For license information please see admin.js.LICENSE.txt */
|
2 |
+
(self.webpackChunkMailPoet3=self.webpackChunkMailPoet3||[]).push([[328],{49868:function(){jQuery.AsyncQueue=function(){var e,t,n,r,a=this,s=[],o=!1;return r=function(){var e=s.shift();e?(e.apply(a,[a]),!1===o&&r()):t&&t.apply(a)},this.onFailure=function(t){e=t},this.onComplete=function(e){t=e},this.add=function(e){return s.push(e),this},this.storeData=function(e){return n=e,this},this.lastCallbackData=function(){return n},this.run=function(){o=!1,r()},this.pause=function(){return o=!0,this},this.failure=function(){if(o=!0,e){var t=[a];for(i=0;i<arguments.length;i++)t.push(arguments[i]);e.apply(a,t)}},this}},80640:function(e,t,n){"use strict";var r={};n.r(r),n.d(r,{canUseWooSubscriptions:function(){return _i},findFiltersValueForSegment:function(){return Oi},getAvailableFilters:function(){return Ai},getCustomFieldsList:function(){return Ii},getErrors:function(){return Ei},getMembershipPlans:function(){return xi},getNewslettersList:function(){return wi},getProductCategories:function(){return yi},getProducts:function(){return gi},getSegment:function(){return Ci},getSegmentFilter:function(){return Di},getStaticSegmentsList:function(){return Ti},getSubscriberCount:function(){return ki},getSubscriptionProducts:function(){return vi},getTags:function(){return Ni},getWooCommerceCountries:function(){return Si},getWooCommerceCurrencySymbol:function(){return ji},getWordpressRoles:function(){return bi}});var a={};n.r(a),n.d(a,{handleSave:function(){return zi},pageLoaded:function(){return Hi},setErrors:function(){return Ui},setSegment:function(){return $i},updateSegment:function(){return Zi},updateSegmentFilter:function(){return Vi},updateSegmentFilterFromEvent:function(){return Yi},updateSegmentFromEvent:function(){return Wi},updateSubscriberCount:function(){return Bi}});var s={};n.r(s),n.d(s,{LOAD_SEGMENT:function(){return Ki},SAVE_SEGMENT:function(){return Qi}});var i=n(64151),o=n(75774),l=n(42676),c=n(65443),d=n.n(c),u=n(65311),p=n.n(u),m=n(39519),h=n.n(m),f=n(93878),g=n(18490),x=n(62668),v=n(69156),b=n(26138),y=n(49231),w=n(35614),_=(n(16381),n(20264));class j extends y.Component{constructor(e){super(e),(0,b.Z)(this,"getFieldId",(e=>{const t=e||this.props;return t.field.id||t.field.name})),(0,b.Z)(this,"getSelectedValues",(()=>{if(void 0!==this.props.field.selected)return this.props.field.selected(this.props.item);if(void 0!==this.props.item&&void 0!==this.props.field.name){if(!this.allowMultipleValues())return this.props.item[this.props.field.name];if(w.ZP.isArray(this.props.item[this.props.field.name]))return this.props.item[this.props.field.name].map((e=>e.id))}return null})),(0,b.Z)(this,"getItems",(()=>{let e;return void 0!==window[`mailpoet_${this.props.field.endpoint}`]?e=window[`mailpoet_${this.props.field.endpoint}`]:void 0!==this.props.field.values&&(e=this.props.field.values),w.ZP.isArray(e)&&void 0!==this.props.field.filter&&(e=e.filter(this.props.field.filter)),e})),(0,b.Z)(this,"getLabel",(e=>void 0!==this.props.field.getLabel?this.props.field.getLabel(e,this.props.item):e.name)),(0,b.Z)(this,"getSearchLabel",(e=>void 0!==this.props.field.getSearchLabel?this.props.field.getSearchLabel(e,this.props.item):null)),(0,b.Z)(this,"getValue",(e=>void 0!==this.props.field.getValue?this.props.field.getValue(e,this.props.item):e.id)),(0,b.Z)(this,"getCount",(e=>void 0!==this.props.field.getCount?this.props.field.getCount(e,this.props.item):null)),(0,b.Z)(this,"getTag",(e=>void 0!==this.props.field.getTag?this.props.field.getTag(e,this.props.item):null)),(0,b.Z)(this,"setupSelect2",(()=>{if(this.isSelect2Initialized())return;const e=e=>{let t="";return e.tag&&(t+=`<span class="mailpoet-form-select2-tag">${e.tag}</span>`),t+=`<span class="mailpoet-form-select2-text"><span>${e.text}</span></span>`,e.count&&(t+=`<span class="mailpoet-form-select2-count">${e.count}</span>`),t};let t={disabled:this.props.disabled||!1,width:this.props.width||"",placeholder:{id:"",text:this.props.field.placeholder},dropdownCssClass:"mailpoet-form-select2-dropdown",escapeMarkup:e=>e,templateResult:e,templateSelection:e};const n=this.props.field.remoteQuery||null;if(n)t=Object.assign(t,{ajax:{url:window.ajaxurl,type:"POST",dataType:"json",data:function(e){return{action:"mailpoet",api_version:window.mailpoet_api_version,token:window.mailpoet_token,endpoint:n.endpoint,method:n.method,data:Object.assign(n.data,{query:e.term})}},processResults:function(e){let t;return t=w.ZP.has(e,"data")?e.data.map((e=>({id:e.id||e.value,text:e.name||e.text}))):[],{results:t}}},minimumInputLength:n.minimumInputLength||2});else if(void 0!==this.props.field.getCount||void 0!==this.props.field.getTag){const e=this.getItems(this.props.field);let n=this.getSelectedValues()||[];Array.isArray(n)||(n=[n]);const r=e.map((e=>{const t=this.getValue(e);return{id:t,tag:this.getTag(e),text:this.getLabel(e),count:this.getCount(e),selected:n.indexOf(t)>-1}}));t=Object.assign(t,{data:r})}void 0!==this.props.field.extendSelect2Options&&(t=Object.assign(t,this.props.field.extendSelect2Options));const r=p()(`#${this.selectRef.current.id}`).select2(t);let a=!1;r.on("select2:unselecting",(()=>{a=!0})),r.on("select2:opening",(e=>{!0===a&&(a=!1,e.preventDefault())})),r.on("change",this.handleChange)})),(0,b.Z)(this,"resetSelect2",(()=>{this.destroySelect2(),this.setupSelect2()})),(0,b.Z)(this,"destroySelect2",(()=>{this.isSelect2Initialized()&&(p()(`#${this.selectRef.current.id}`).select2("destroy"),this.cleanupAfterSelect2())})),(0,b.Z)(this,"cleanupAfterSelect2",(()=>{p()(`#${this.selectRef.current.id}`).find("option:not(.default)").remove(),p()(`#${this.selectRef.current.id}`).off("select2:unselecting").off("select2:opening")})),(0,b.Z)(this,"allowMultipleValues",(()=>!0===this.props.field.multiple)),(0,b.Z)(this,"isSelect2Initialized",(()=>!0===p()(`#${this.selectRef.current.id}`).hasClass("select2-hidden-accessible"))),(0,b.Z)(this,"isSelect2Component",(()=>this.allowMultipleValues()||this.props.field.forceSelect2)),(0,b.Z)(this,"handleChange",(e=>{if(void 0===this.props.onValueChange)return;const t=p()(`#${this.selectRef.current.id}`).children(":selected").map((function(){return{id:p()(this).val(),text:p()(this).text()}})),n=this.props.field.multiple?w.ZP.pluck(t,"id"):w.ZP.pluck(t,"id").toString(),r=this.transformChangedValue(n,t);this.props.onValueChange({target:{value:r,name:this.props.field.name,id:e.target.id}})})),(0,b.Z)(this,"transformChangedValue",((e,t)=>"function"==typeof this.props.field.transformChangedValue?this.props.field.transformChangedValue.call(this,e,t):e)),(0,b.Z)(this,"insertEmptyOption",(()=>{if(!this.allowMultipleValues())return this.props.field.placeholder?(0,_.jsx)("option",{className:"default"}):void 0})),this.selectRef=(0,y.createRef)()}componentDidMount(){this.isSelect2Component()&&this.setupSelect2()}componentDidUpdate(e){void 0!==this.props.item&&void 0!==e.item&&this.props.item.id!==e.item.id&&p()(`#${this.selectRef.current.id}`).val(this.getSelectedValues()).trigger("change"),this.isSelect2Initialized()&&this.getFieldId(this.props)!==this.getFieldId(e)&&void 0!==this.props.field.resetSelect2OnUpdate&&this.resetSelect2()}componentWillUnmount(){this.isSelect2Component()&&this.destroySelect2()}render(){const e=this.getItems(this.props.field),t=this.getSelectedValues(),n=e.map((e=>{const t=this.getLabel(e),n=this.getSearchLabel(e),r=this.getValue(e);return(0,_.jsx)("option",{className:"default",value:r,title:n,children:t},`option-${e.id}`)}));return(0,_.jsx)("div",{className:"mailpoet-form-select mailpoet-form-input",children:(0,_.jsxs)("select",{id:this.getFieldId(),ref:this.selectRef,disabled:this.props.field.disabled,"data-placeholder":this.props.field.placeholder,multiple:this.props.field.multiple,defaultValue:t,...this.props.field.validation,children:[this.insertEmptyOption(),n]})})}}j.propTypes={onValueChange:h().func,field:h().shape({name:h().string.isRequired,values:h().oneOfType([h().object,h().array]),getLabel:h().func,resetSelect2OnUpdate:h().bool,selected:h().func,endpoint:h().string,filter:h().func,getSearchLabel:h().func,getValue:h().func,getCount:h().func,getTag:h().func,placeholder:h().string,remoteQuery:h().object,extendSelect2Options:h().object,multiple:h().bool,forceSelect2:h().bool,transformChangedValue:h().func,disabled:h().bool,validation:h().shape({"data-parsley-required":h().bool,"data-parsley-required-message":h().string,"data-parsley-type":h().string,"data-parsley-errors-container":h().string,maxLength:h().number})}).isRequired,item:h().object,disabled:h().bool,width:h().string},j.defaultProps={onValueChange:function(){},disabled:!1,width:"",item:void 0};var S=n(34352),I=n.n(S),C=n(20360);function T(){if(!x.x.subscribersLimitReached)return null;const e=x.x.hasValidApiKey,t=x.x.I18n.t("subscribersLimitNoticeTitle").replace("[subscribersLimit]",x.x.subscribersLimit),n=x.x.I18n.t(e?"yourPlanLimit":"freeVersionLimit").replace("[subscribersLimit]",x.x.subscribersLimit),r=e?x.x.MailPoetComUrlFactory.getUpgradeUrl(x.x.pluginPartialKey):x.x.MailPoetComUrlFactory.getPurchasePlanUrl(x.x.subscribersCount+1),a=I()(x.x.I18n.t("youCanDisableWPUsersList"),/\[link](.*?)\[\/link]/g,(e=>(0,_.jsx)("a",{href:"?page=mailpoet-segments",children:e},"goToSegments")));return(0,_.jsxs)(C.q,{type:"error",timeout:!1,closable:!1,renderInPlace:!0,children:[(0,_.jsx)("h3",{children:t}),(0,_.jsxs)("p",{children:[n," ",x.x.I18n.t("youNeedToUpgrade"),"active"===x.x.wpSegmentState?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("br",{}),a]}):null]}),(0,_.jsxs)("p",{children:[(0,_.jsx)("a",{target:"_blank",rel:"noopener noreferrer",className:"button button-primary",href:r,children:x.x.I18n.t("upgradeNow")}),e&&(0,_.jsxs)(_.Fragment,{children:[" ",(0,_.jsx)("button",{type:"button",className:"button",onClick:async()=>{await x.x.Ajax.post({api_version:x.x.apiVersion,endpoint:"services",action:"recheckKeys"}),window.location.reload()},children:x.x.I18n.t("refreshMySubscribers")})]})]})]})}function k(e){let{mssKeyInvalid:t,subscribersCount:n}=e;return t?(0,_.jsxs)(C.q,{type:"error",timeout:!1,closable:!1,renderInPlace:!0,children:[(0,_.jsx)("h3",{children:x.x.I18n.t("allSendingPausedHeader")}),(0,_.jsx)("p",{children:I()(x.x.I18n.t("allSendingPausedBody"),/\[link\](.*?)\[\/link\]/g,(e=>(0,_.jsx)("a",{href:"?page=mailpoet-settings#premium",children:e},"check-sending")))}),(0,_.jsx)("p",{children:(0,_.jsx)("a",{href:`https://account.mailpoet.com?s=${n}`,className:"button button-primary",target:"_blank",rel:"noopener noreferrer",children:x.x.I18n.t("allSendingPausedLink")})})]}):null}var N=n(46838);function D(){if(!x.x.emailVolumeLimitReached)return null;const e=x.x.I18n.t("emailVolumeLimitNoticeTitle").replace("[emailVolumeLimit]",x.x.emailVolumeLimit),t=x.x.I18n.t("youReachedEmailVolumeLimit").replace("[emailVolumeLimit]",x.x.emailVolumeLimit),n=x.x.MailPoetComUrlFactory.getUpgradeUrl(x.x.pluginPartialKey),r=new Date,a=new Date(r.getFullYear(),r.getMonth()+1,1);let s=I()(x.x.I18n.t("toContinueUpgradeYourPlanOrWaitUntil"),/\[link](.*?)\[\/link]/g,(e=>(0,_.jsx)("a",{target:"_blank",rel:"noreferrer",href:n,children:e},e)));return s=I()(s,/<b>\[date]<\/b>\./g,(()=>(0,N.ZP)(`<b>${x.x.Date.short(a)}</b>.`))),(0,_.jsxs)(C.q,{type:"error",timeout:!1,closable:!1,renderInPlace:!0,children:[(0,_.jsx)("h3",{children:e}),(0,_.jsxs)("p",{children:[t,(0,_.jsx)("br",{}),s]}),(0,_.jsxs)("p",{children:[(0,_.jsx)("a",{target:"_blank",rel:"noopener noreferrer",className:"button button-primary",href:n,children:x.x.I18n.t("upgradeNow")})," ",(0,_.jsx)("button",{type:"button",className:"button",onClick:async()=>{await x.x.Ajax.post({api_version:x.x.apiVersion,endpoint:"services",action:"recheckKeys"}),window.location.reload()},children:x.x.I18n.t("refreshMyEmailVolumeLimit")})]})]})}var E=n(13763);function A(e){let{cacheCalculation:t}=e;const[n,r]=(0,y.useState)(!1),[a,s]=(0,y.useState)([]),i=(new Date).getTime()-new Date(t).getTime(),o=Math.floor(i/1e3/60);return(0,_.jsxs)("div",{className:"mailpoet-subscribers-cache-notice",children:[I()(x.x.I18n.t("subscribersCountWereCalculatedWithMinutesAgo"),/<abbr>(.*?)<\/abbr>/,((e,n)=>(0,_.jsx)("abbr",{title:t,children:e.replace(/(\{\$mins\}|\$mins)/i,String(o))},n))),(0,_.jsx)(E.z,{className:"mailpoet-subscribers-cache-notice-button",type:"button",variant:"secondary",dimension:"small",onClick:()=>{r(!0),x.x.Ajax.post({api_version:x.x.apiVersion,endpoint:"settings",action:"recalculateSubscribersCountsCache"}).done((()=>{window.location.reload()})).fail((e=>{s(e.errors.map((e=>e.message))),r(!1)}))},withSpinner:n,children:x.x.I18n.t("recalculateNow")}),(0,_.jsx)("div",{className:"mailpoet-gap"}),a.length>0&&(0,_.jsx)(C.q,{type:"error",children:a.map((e=>(0,_.jsx)("p",{children:e},e)))})]})}var O=n(58996);function R(e){let{subscribersInPlan:t,subscribersInPlanLimit:n}=e;if(!1===t)return null;const r=n?(0,_.jsx)("b",{children:x.x.I18n.t("subscribersInPlanCount").replace("%1$d",t.toLocaleString()).replace("%2$d",n.toLocaleString())},"subscribers_count"):(0,_.jsx)("b",{children:t},"subscribers_count");return(0,_.jsxs)("div",{className:"mailpoet-subscribers-in-plan",children:[I()(x.x.I18n.t("subscribersInPlan"),"%s",(()=>r))," ",(0,_.jsx)(O.Tooltip,{tooltip:x.x.I18n.t("subscribersInPlanTooltip"),place:"right"}),(0,_.jsx)("span",{className:"mailpoet-subscribers-in-plan-spacer",children:" "})]})}var P=n(16751);function M(e){let{id:t,engagementScore:n}=e;const r={unknown:{name:x.x.I18n.t("unknownBadgeName"),type:"unknown",tooltipTitle:x.x.I18n.t("unknownBadgeTooltip"),tooltipText:x.x.I18n.t("tooltipUnknown")},excellent:{name:x.x.I18n.t("excellentBadgeName"),type:"excellent",tooltipTitle:x.x.I18n.t("excellentBadgeTooltip"),tooltipText:x.x.I18n.t("tooltipExcellent")},good:{name:x.x.I18n.t("goodBadgeName"),type:"good",tooltipTitle:x.x.I18n.t("goodBadgeTooltip"),tooltipText:x.x.I18n.t("tooltipGood")},average:{name:x.x.I18n.t("averageBadgeName"),type:"average",tooltipTitle:x.x.I18n.t("averageBadgeTooltip"),tooltipText:x.x.I18n.t("tooltipAverage")}},a=`badge-${t}`;let s;s=null==n?r.unknown:n<20?r.average:n<50?r.good:r.excellent;const i=(0,_.jsxs)("div",{children:[(0,_.jsx)("div",{className:"mailpoet-listing-stats-tooltip-title",children:s.tooltipTitle.toUpperCase()}),(0,_.jsx)("div",{className:"mailpoet-listing-stats-tooltip-description",children:x.x.I18n.t("engagementScoreDescription")}),(0,_.jsxs)("div",{className:"mailpoet-listing-stats-tooltip-content",children:[(0,_.jsx)(P.C,{type:"unknown",name:x.x.I18n.t("unknownBadgeName")})," : ",r.unknown.tooltipText,(0,_.jsx)("br",{}),(0,_.jsx)(P.C,{type:"excellent",name:x.x.I18n.t("excellentBadgeName")})," : ",r.excellent.tooltipText,(0,_.jsx)("br",{}),(0,_.jsx)(P.C,{type:"good",name:x.x.I18n.t("goodBadgeName")})," : ",r.good.tooltipText,(0,_.jsx)("br",{}),(0,_.jsx)(P.C,{type:"average",name:x.x.I18n.t("averageBadgeName")})," : ",r.average.tooltipText]})]},`tooltip-${a}`);return(0,_.jsxs)("div",{className:"mailpoet-listing-stats-opened-clicked",children:[null!=n&&(0,_.jsxs)("div",{className:"mailpoet-listing-stats-percentages",children:[n.toLocaleString(void 0,{minimumFractionDigits:1,maximumFractionDigits:1}),"%"]}),(0,_.jsx)("div",{children:(0,_.jsx)(P.C,{isInverted:!0,type:s.type,name:s.name,tooltip:i,tooltipId:a,tooltipPlace:"top"})})]})}var L=n(33684),F=n(4445);function q(e){let{location:t}=e;return(0,_.jsxs)(L.Q,{children:[(0,_.jsxs)(o.Link,{className:"mailpoet-button button-secondary",to:{pathname:"/new",state:{backUrl:null==t?void 0:t.pathname}},children:[F.R,(0,_.jsx)("span",{"data-automation-id":"add-new-subscribers-button",children:x.x.I18n.t("new")})]}),(0,_.jsx)("a",{className:"mailpoet-button not-small-screen button-secondary",href:"?page=mailpoet-import","data-automation-id":"import-subscribers-button",children:x.x.I18n.t("import")}),(0,_.jsx)("a",{id:"mailpoet_export_button",className:"mailpoet-button not-small-screen button-secondary",href:"?page=mailpoet-export",children:x.x.I18n.t("export")})]})}q.propTypes={location:h().object.isRequired};const $=(0,l.EN)(q),U=x.x.trackingConfig.emailTrackingEnabled,Z=[{name:"email",label:x.x.I18n.t("subscriber"),sortable:!0},{name:"status",label:x.x.I18n.t("status"),sortable:!0},{name:"segments",label:x.x.I18n.t("lists")},{name:"tags",label:x.x.I18n.t("tags")},{name:"statistics",label:x.x.I18n.t("statisticsColumn"),display:U},{name:"created_at",label:x.x.I18n.t("subscribedOn"),sortable:!0}],V={onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneSubscriberTrashed"):x.x.I18n.t("multipleSubscribersTrashed").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneSubscriberDeleted"):x.x.I18n.t("multipleSubscribersDeleted").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneSubscriberRestored"):x.x.I18n.t("multipleSubscribersRestored").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onNoItemsFound:e=>"bounced"===e&&!window.mailpoet_premium_active&&!window.mailpoet_mss_active&&(0,_.jsxs)("div",{children:[(0,_.jsx)("p",{children:x.x.I18n.t("bouncedSubscribersHelp")}),(0,_.jsx)("p",{children:(0,_.jsx)("a",{href:"admin.php?page=mailpoet-upgrade",className:"button-primary",children:x.x.I18n.t("bouncedSubscribersPremiumButtonText")})})]})},W=(e,t,n,r)=>(0,_.jsxs)(v.u,{title:r,onRequestClose:t,isDismissible:!0,children:[(0,_.jsx)(j,{field:n}),(0,_.jsx)("span",{className:"mailpoet-gap-half"}),(0,_.jsx)(f.Button,{onClick:e,dimension:"small",variant:"secondary",children:x.x.I18n.t("apply")})]}),Y=[{name:"moveToList",label:x.x.I18n.t("moveToList"),onSelect:function(e,t){return W(e,t,{id:"move_to_segment",name:"move_to_segment",endpoint:"segments",filter:function(e){return!(e.deleted_at||"default"!==e.type)}},x.x.I18n.t("moveToList"))},getData:function(){return{segment_id:Number(p()("#move_to_segment").val())}},onSuccess:function(e){x.x.Notice.success(x.x.I18n.t("multipleSubscribersMovedToList").replace("%1$d",Number(e.meta.count).toLocaleString()).replace("%2$s",e.meta.segment))}},{name:"addToList",label:x.x.I18n.t("addToList"),onSelect:function(e,t){return W(e,t,{id:"add_to_segment",name:"add_to_segment",endpoint:"segments",filter:function(e){return!(e.deleted_at||"default"!==e.type)}},x.x.I18n.t("addToList"))},getData:function(){return{segment_id:Number(p()("#add_to_segment").val())}},onSuccess:function(e){x.x.Notice.success(x.x.I18n.t("multipleSubscribersAddedToList").replace("%1$d",Number(e.meta.count).toLocaleString()).replace("%2$s",e.meta.segment))}},{name:"removeFromList",label:x.x.I18n.t("removeFromList"),onSelect:function(e,t){return W(e,t,{id:"remove_from_segment",name:"remove_from_segment",endpoint:"segments",filter:function(e){return!("default"!==e.type)}},x.x.I18n.t("removeFromList"))},getData:function(){return{segment_id:Number(p()("#remove_from_segment").val())}},onSuccess:function(e){x.x.Notice.success(x.x.I18n.t("multipleSubscribersRemovedFromList").replace("%1$d",Number(e.meta.count).toLocaleString()).replace("%2$s",e.meta.segment))}},{name:"removeFromAllLists",label:x.x.I18n.t("removeFromAllLists"),onSuccess:function(e){x.x.Notice.success(x.x.I18n.t("multipleSubscribersRemovedFromAllLists").replace("%1$d",Number(e.meta.count).toLocaleString()))}},{name:"trash",label:x.x.I18n.t("moveToTrash"),onSuccess:V.onTrash},{name:"unsubscribe",label:x.x.I18n.t("unsubscribe"),onSelect:(e,t,n)=>{const r="all"!==n.selection?n.selected_ids.length:n.count;return(0,_.jsxs)(v.u,{title:x.x.I18n.t("unsubscribe"),onRequestClose:t,isDismissible:!0,children:[(0,_.jsx)("p",{children:x.x.I18n.t("unsubscribeConfirm").replace("%s",r.toLocaleString())}),(0,_.jsx)("span",{className:"mailpoet-gap-half"}),(0,_.jsx)(f.Button,{onClick:e,dimension:"small",variant:"secondary",automationId:"bulk-unsubscribe-confirm",children:x.x.I18n.t("apply")})]})}}],B=[{name:"statistics",label:x.x.I18n.t("statsListingActionTitle"),link:function(e,t){return(0,_.jsx)(o.Link,{to:{pathname:`/stats/${e.id}`,state:{backUrl:null==t?void 0:t.pathname}},children:x.x.I18n.t("statsListingActionTitle")})}},{name:"edit",label:x.x.I18n.t("edit"),link:function(e,t){return(0,_.jsx)(o.Link,{to:{pathname:`/edit/${e.id}`,state:{backUrl:null==t?void 0:t.pathname}},children:x.x.I18n.t("edit")})}},{name:"sendConfirmationEmail",className:"mailpoet-hide-on-mobile",label:x.x.I18n.t("resendConfirmationEmail"),display:function(e){return"unconfirmed"===e.status&&e.count_confirmations<window.mailpoet_max_confirmation_emails},onClick:function(e){return x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"subscribers",action:"sendConfirmationEmail",data:{id:e.id}}).done((()=>x.x.Notice.success(x.x.I18n.t("oneConfirmationEmailSent")))).fail((e=>x.x.Notice.showApiErrorNotice(e)))}},{name:"trash",className:"mailpoet-hide-on-mobile"}],H=e=>0===Number(e.wp_user_id)&&0===Number(e.is_woocommerce_user);function z(e){let{match:t}=e;const n=(0,l.TH)();return(0,_.jsxs)("div",{children:[(0,_.jsx)($,{}),(0,_.jsx)(R,{subscribersInPlan:x.x.subscribersCount,subscribersInPlanLimit:x.x.subscribersLimit}),(0,_.jsx)(T,{}),(0,_.jsx)(D,{}),(0,_.jsx)(k,{mssKeyInvalid:window.mailpoet_mss_key_invalid,subscribersCount:window.mailpoet_subscribers_count}),(0,_.jsx)(A,{cacheCalculation:window.mailpoet_subscribers_counts_cache_created_at}),(0,_.jsx)(g.N,{limit:window.mailpoet_listing_per_page,location:n,params:t.params,endpoint:"subscribers",onRenderItem:(e,t)=>{const r=d()("manage-column","column-primary","has-row-actions","column-username");let a="";switch(e.status){case"subscribed":a=x.x.I18n.t("subscribed");break;case"unconfirmed":a=x.x.I18n.t("unconfirmed");break;case"unsubscribed":a=x.x.I18n.t("unsubscribed");break;case"inactive":a=x.x.I18n.t("inactive");break;case"bounced":a=x.x.I18n.t("bounced");break;default:a="Invalid"}const s=[];return e.subscriptions.length>0&&e.subscriptions.forEach((e=>{const t=(e=>{let t=!1;return window.mailpoet_segments.forEach((n=>{n.id===e&&(t=n)})),t})(e.segment_id);!1!==t&&"subscribed"===e.status&&s.push(t)})),(0,_.jsxs)("div",{children:[(0,_.jsxs)("td",{className:r,children:[(0,_.jsx)(o.Link,{className:"mailpoet-listing-title",to:{pathname:`/edit/${e.id}`,state:{backUrl:null==n?void 0:n.pathname}},children:e.email}),(0,_.jsxs)("div",{className:"mailpoet-listing-subtitle",children:[e.first_name," ",e.last_name]}),t]}),(0,_.jsx)("td",{className:"column","data-colname":x.x.I18n.t("status"),children:a}),(0,_.jsx)("td",{className:"column","data-colname":x.x.I18n.t("lists"),children:(0,_.jsx)(f.Tags,{segments:s,dimension:"large"})}),(0,_.jsx)("td",{className:"column","data-colname":x.x.I18n.t("tags"),children:(0,_.jsx)(f.Tags,{subscriberTags:e.tags,variant:"wordpress",isInverted:!0})}),!0===U?(0,_.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":x.x.I18n.t("statisticsColumn"),children:(0,_.jsx)("div",{className:"mailpoet-listing-stats",children:(0,_.jsx)("a",{href:`#/stats/${e.id}`,children:(0,_.jsx)(M,{id:e.id,engagementScore:e.engagement_score})},`stats-link-${e.id}`)})}):null,(0,_.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("subscribedOn"),children:[x.x.Date.short(e.created_at),(0,_.jsx)("br",{}),x.x.Date.time(e.created_at)]})]})},columns:Z,bulk_actions:Y,item_actions:B,messages:V,sort_by:"created_at",sort_order:"desc",isItemDeletable:H})]})}z.propTypes={match:h().shape({params:h().object}).isRequired};var G=n(73136),K=n.n(G),Q=n(29449),X=n(12447),J=n.n(X),ee=n(32033);class te extends y.Component{render(){const e=this.props.field.name||null,t=this.props.item||{};let n,r;this.props.onValueChange instanceof Function&&(n=t[this.props.field.name],n=void 0===n?this.props.field.defaultValue||"":n),!n&&this.props.field.defaultValue&&(r=this.props.field.defaultValue);let a=this.props.field.id||null;!a&&this.props.field.name&&(a=`field_${this.props.field.name}`);let s=this.props.field.className||null;return s||this.props.field.size||(s="regular-text"),(0,_.jsx)(ee.I,{type:"text",disabled:void 0!==this.props.field.disabled&&this.props.field.disabled(this.props.item),className:s,size:"auto"!==this.props.field.size&&this.props.field.size>0?this.props.field.size:null,name:e,id:a,value:n,defaultValue:r,placeholder:this.props.field.placeholder,onChange:this.props.onValueChange,onBlur:this.props.onBlurEvent,customLabel:this.props.field.customLabel,tooltip:this.props.field.tooltip,...this.props.field.validation})}}te.propTypes={onValueChange:h().func,onBlurEvent:h().func,field:h().shape({name:h().string.isRequired,defaultValue:h().string,id:h().string,className:h().string,size:h().oneOfType([h().string,h().number]),disabled:h().func,placeholder:h().string,validation:h().shape({"data-parsley-required":h().bool,"data-parsley-required-message":h().string,"data-parsley-type":h().string,"data-parsley-errors-container":h().string,maxLength:h().number}),customLabel:h().string,tooltip:h().string}).isRequired,item:h().object.isRequired},te.defaultProps={onValueChange:function(){},onBlurEvent:function(){}};var ne=n(8279);function re(e){return(0,_.jsx)(ne.g,{type:"text",name:e.field.name,id:`field_${e.field.name}`,value:e.item[e.field.name],placeholder:e.field.placeholder,defaultValue:e.field.defaultValue,onChange:e.onValueChange,className:e.field.className,customLabel:e.field.customLabel,tooltip:e.field.tooltip,...e.field.validation})}re.propTypes={item:h().object.isRequired,field:h().shape({name:h().string,placeholder:h().string,defaultValue:h().string,validation:h().shape({"data-parsley-required":h().bool,"data-parsley-required-message":h().string,"data-parsley-type":h().string,"data-parsley-errors-container":h().string,maxLength:h().number}),className:h().string,customLabel:h().string,tooltip:h().string}).isRequired,onValueChange:h().func.isRequired};var ae=n(64530);class se extends y.Component{render(){if(void 0===this.props.field.values)return!1;let e,t=!1,n=!1,r=!1;void 0!==this.props.field.placeholder&&(n=(0,_.jsx)("option",{value:"",children:this.props.field.placeholder})),void 0!==this.props.field.filter&&(t=this.props.field.filter),w.ZP.isFunction(this.props.field.sortBy)&&(r=this.props.field.sortBy),e=r?w.ZP.map(w.ZP.sortBy(w.ZP.pairs(this.props.field.values),(e=>r(e[0],e[1]))),(e=>e[0])):Object.keys(this.props.field.values);const a=e.filter((e=>!1===t||t(this.props.item,e))).map((e=>(0,_.jsx)("option",{value:e,children:this.props.field.values[e]},`option-${e}`)));return(0,_.jsxs)(ae.Select,{name:this.props.field.name,id:`field_${this.props.field.name}`,value:this.props.item[this.props.field.name]||"",onChange:this.props.onValueChange,automationId:this.props.automationId,...this.props.field.validation,children:[n,a]})}}se.propTypes={onValueChange:h().func,field:h().shape({name:h().string.isRequired,values:h().objectOf(h().string),placeholder:h().string,filter:h().func,sortBy:h().func,validation:h().shape({"data-parsley-required":h().bool,"data-parsley-required-message":h().string,"data-parsley-type":h().string,"data-parsley-errors-container":h().string,maxLength:h().number})}).isRequired,item:h().object.isRequired,automationId:h().string},se.defaultProps={automationId:"",onValueChange:function(){}};var ie=n(34993);class oe extends y.Component{constructor(e){super(e),(0,b.Z)(this,"onValueChange",((e,t)=>this.props.onValueChange(t))),this.onValueChange=this.onValueChange.bind(this)}render(){if(void 0===this.props.field.values)return!1;const e=this.props.item[this.props.field.name],t=Object.keys(this.props.field.values).map((t=>(0,_.jsx)("p",{children:(0,_.jsx)(ie.Y,{checked:e===t,value:t,onCheck:this.onValueChange,name:this.props.field.name,children:this.props.field.values[t]})},`radio-${t}`)));return(0,_.jsx)("div",{children:t})}}oe.propTypes={onValueChange:h().func,field:h().shape({name:h().string.isRequired,values:h().objectOf(h().string)}).isRequired,item:h().object.isRequired},oe.defaultProps={onValueChange:function(){}};var le=n(25367);class ce extends y.Component{constructor(e){super(e),(0,b.Z)(this,"onValueChange",((e,t)=>(t.target.value=e?"1":"0",this.props.onValueChange(t)))),this.onValueChange=this.onValueChange.bind(this)}render(){if(void 0===this.props.field.values)return!1;const e=!!Number(this.props.item[this.props.field.name]),t=Object.keys(this.props.field.values).map((t=>(0,_.jsx)("p",{children:(0,_.jsx)(le.X,{value:"1",checked:e,name:this.props.field.name,onCheck:this.onValueChange,children:this.props.field.values[t]})},`checkbox-${t}`)));return(0,_.jsx)("div",{children:t})}}function de(e){const t=[];void 0!==e.placeholder&&t.push((0,_.jsx)("option",{value:"",children:e.placeholder},0));const n=K()().year();for(let e=n;e>=n-100;e-=1)t.push((0,_.jsx)("option",{value:e,children:e},e));return(0,_.jsx)(f.Select,{isMinWidth:!0,name:`${e.name}[year]`,value:e.year,onChange:e.onValueChange,children:t})}function ue(e){const t=[];void 0!==e.placeholder&&t.push((0,_.jsx)("option",{value:"",children:e.placeholder},0));for(let n=1;n<=12;n+=1)t.push((0,_.jsx)("option",{value:n,children:e.monthNames[n-1]},n));return(0,_.jsx)(f.Select,{isMinWidth:!0,name:`${e.name}[month]`,value:e.month,onChange:e.onValueChange,children:t})}function pe(e){const t=[];void 0!==e.placeholder&&t.push((0,_.jsx)("option",{value:"",children:e.placeholder},0));for(let e=1;e<=31;e+=1)t.push((0,_.jsx)("option",{value:e,children:e},e));return(0,_.jsx)(f.Select,{isMinWidth:!0,name:`${e.name}[day]`,value:e.day,onChange:e.onValueChange,children:t})}ce.propTypes={onValueChange:h().func.isRequired,field:h().shape({name:h().string.isRequired,values:h().objectOf(h().string)}).isRequired,item:h().object.isRequired},de.propTypes={name:h().string.isRequired,placeholder:h().string.isRequired,onValueChange:h().func.isRequired,year:h().oneOfType([h().string,h().number]).isRequired},ue.propTypes={name:h().string.isRequired,placeholder:h().string.isRequired,onValueChange:h().func.isRequired,month:h().oneOfType([h().string,h().number]).isRequired,monthNames:h().arrayOf(h().string).isRequired},pe.propTypes={name:h().string.isRequired,placeholder:h().string.isRequired,onValueChange:h().func.isRequired,day:h().oneOfType([h().string,h().number]).isRequired};class me extends y.Component{constructor(e){super(e),this.state={year:"",month:"",day:""},this.onValueChange=this.onValueChange.bind(this)}componentDidMount(){this.extractDateParts()}componentDidUpdate(e){void 0!==this.props.item&&void 0!==e.item&&this.props.item.id!==e.item.id&&this.extractDateParts()}onValueChange(e){const t=e.target.name.match(/(.*?)\[(.*?)\]/);let n=null,r=null;if(null!==t&&3===t.length){[,n,r]=t;const a=Number(e.target.value);this.setState({[`${r}`]:a},(()=>{this.props.onValueChange({target:{name:n,value:this.formatValue()}})}))}}formatValue(){let e;switch(this.props.field.params.date_type){case"year_month_day":e={year:this.state.year,month:this.state.month,day:this.state.day};break;case"year_month":e={year:this.state.year,month:this.state.month};break;case"month":e={month:this.state.month};break;case"year":e={year:this.state.year};break;default:e={value:"invalid type"}}return e}extractDateParts(){const e=void 0!==this.props.item[this.props.field.name]?this.props.item[this.props.field.name].trim():"";if(""===e)return;const t=K()(e);this.setState({year:t.format("YYYY"),month:t.format("M"),day:t.format("D")})}render(){const e=window.mailpoet_month_names||[];let t=(window.mailpoet_date_formats||{})[this.props.field.params.date_type][0];this.props.field.params.date_format&&(t=this.props.field.params.date_format);const n=t.split("/").map((t=>{switch(t){case"YYYY":return(0,_.jsx)(de,{onValueChange:this.onValueChange,name:this.props.field.name,year:this.state.year,placeholder:this.props.field.year_placeholder},"year");case"MM":return(0,_.jsx)(ue,{onValueChange:this.onValueChange,name:this.props.field.name,month:this.state.month,monthNames:e,placeholder:this.props.field.month_placeholder},"month");case"DD":return(0,_.jsx)(pe,{onValueChange:this.onValueChange,name:this.props.field.name,day:this.state.day,placeholder:this.props.field.day_placeholder},"day");default:return(0,_.jsx)("div",{children:"Invalid date type"})}}));return(0,_.jsx)("div",{children:n})}}me.propTypes={item:h().object.isRequired,field:h().shape({name:h().string,day_placeholder:h().string,month_placeholder:h().string,year_placeholder:h().string,params:h().object}).isRequired,onValueChange:h().func.isRequired};var he=n(49029),fe=n(55741);function ge(e){const t=Array.isArray(e.item[e.field.name])?e.field.name&&e.item[e.field.name].map((t=>e.field.getName(t))):[];let n=[];return e.field.endpoint?n=function(e){let t=[];return void 0!==window[`mailpoet_${e}`]&&(t=window[`mailpoet_${e}`]),t}(String(e.field.endpoint)).map((t=>e.field.getName(t))):e.field.suggestedValues&&(n=e.field.suggestedValues),(0,_.jsx)(fe.T,{label:e.field.label,name:e.field.name,placeholder:e.field.placeholder,selectedValues:t,suggestedValues:n,onChange:e.onValueChange})}class xe extends y.Component{constructor(){super(...arguments),(0,b.Z)(this,"renderField",(e=>{let t,n=!1;e.field.description&&(n=(0,_.jsx)("p",{className:"description",children:e.field.description}));let r=e.field;switch(void 0!==e.field.field&&(r=p().merge(r,e.field.field)),r.type){case"text":t=(0,_.jsx)(te,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"textarea":t=(0,_.jsx)(re,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"select":t=(0,_.jsx)(se,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"radio":t=(0,_.jsx)(oe,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"checkbox":t=(0,_.jsx)(ce,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"selection":t=(0,_.jsx)(j,{onValueChange:e.onValueChange,field:e.field,automationId:e.automationId,inline:e.inline,description:e.description,item:e.item},`selection-field-${r.name}`);break;case"date":t=(0,_.jsx)(me,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"reactComponent":t=(0,_.jsx)(e.field.component,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"tokenField":t=(0,_.jsx)(ge,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,description:e.description});break;case"empty":break;default:t="invalid"}const a="function"==typeof this.props.field.disabled?this.props.field.disabled(this.props.field):this.props.field.disabled,s={...this.props.field.onWrapperClick?{onClick:this.props.field.onWrapperClick}:{}};return(0,_.jsxs)("div",{className:d()("mailpoet-form-field",{"mailpoet-form-field-disabled":a}),...s,children:[t,n]},`field-${e.index||0}`)}))}render(){let e=!1;e=void 0!==this.props.field.fields?this.props.field.fields.map(((e,t)=>this.renderField({index:t,field:e,item:this.props.item,onValueChange:this.props.onValueChange||!1}))):this.renderField(this.props);let t=!1;this.props.field.label&&(t=(0,_.jsx)(he.X,{level:4,children:(0,_.jsx)("label",{htmlFor:`field_${this.props.field.name}`,children:this.props.field.label})}));let n=!1;return this.props.field.tip&&(n=(0,_.jsx)("p",{className:"mailpoet-form-description",children:this.props.field.tip})),(0,_.jsxs)("div",{className:`mailpoet-form-field-${this.props.field.name} form-field-row-${this.props.field.name}`,children:[t,n,e]})}}xe.propTypes={onValueChange:h().func,field:h().shape({name:h().string.isRequired,values:h().objectOf(h().string),tip:h().oneOfType([h().array,h().string]),label:h().string,fields:h().arrayOf(h().object),description:h().string,onWrapperClick:h().func,disabled:h().oneOfType([h().func,h().bool])}).isRequired,item:h().object.isRequired},xe.defaultProps={onValueChange:function(){}};class ve extends y.Component{constructor(e){super(e),(0,b.Z)(this,"getValues",(()=>this.props.item||this.state.item)),(0,b.Z)(this,"getErrors",(()=>this.props.errors||this.state.errors)),(0,b.Z)(this,"loadItem",(e=>{this.setState({loading:!0}),this.props.endpoint&&x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:this.props.endpoint,action:"get",data:{id:e}}).done((e=>{this.setState({loading:!1,item:e.data}),"function"==typeof this.props.onItemLoad&&this.props.onItemLoad(e.data)})).fail((()=>{this.setState({loading:!1,item:{}},(function(){this.props.history.push("/lists")}))}))})),(0,b.Z)(this,"handleSubmit",(e=>{if(e.preventDefault(),void 0!==this.props.isValid&&!1===this.props.isValid())return;this.setState({loading:!0});const t={};this.props.fields.forEach((e=>{void 0!==e.fields?e.fields.forEach((e=>{t[e.name]=this.state.item[e.name]})):t[e.name]=this.state.item[e.name]})),void 0!==this.props.params.id&&(t.id=this.props.params.id),this.props.endpoint&&x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:this.props.endpoint,action:"save",data:t}).always((()=>{this.setState({loading:!1})})).done((()=>{void 0!==this.props.onSuccess?this.props.onSuccess():this.props.history.push("/"),void 0!==this.props.params.id?this.props.messages.onUpdate():this.props.messages.onCreate()})).fail((e=>{e.errors.length>0&&this.setState({errors:e.errors})}))})),(0,b.Z)(this,"handleValueChange",(e=>{const{name:t,value:n}=Object.prototype.hasOwnProperty.call(e,"target")?e.target:e;return this.props.onChange?this.props.onChange(e):(this.setState((e=>{const r=e.item;return r[t]=n,{item:r}})),!0)})),this.formRef=(0,y.createRef)(),this.state={loading:!1,errors:[],item:{}}}componentDidMount(){void 0!==this.props.params.id?this.loadItem(this.props.params.id):J()((()=>{const e=p()(".mailpoet_form").mailpoetSerializeObject(),t=Array.isArray(this.props.fields)&&this.props.fields.length>0&&this.props.fields.find((e=>"checkbox"===(null==e?void 0:e.type)&&(null==e?void 0:e.isChecked)));t&&t.name&&(e[t.name]="1"),this.setState({item:e})}))}componentDidUpdate(e){void 0===this.props.params.id&&e.location.pathname!==this.props.location.pathname&&(J()((()=>{this.setState({loading:!1,item:{}})})),void 0===this.props.item&&this.formRef.current.reset())}render(){let e;void 0!==this.getErrors()&&(e=this.getErrors().map((e=>(0,_.jsx)("div",{className:"mailpoet_notice notice inline error is-dismissible",children:(0,_.jsx)("p",{children:e.message})},`error-${e.message}`))));const t=d()("mailpoet_form",{mailpoet_form_loading:this.state.loading||this.props.loading});let n=!1,r=!1;void 0!==this.props.beforeFormContent&&(n=this.props.beforeFormContent(this.getValues())),void 0!==this.props.afterFormContent&&(r=this.props.afterFormContent(this.getValues()));const a=this.props.fields.map((e=>{let t=this.handleValueChange;return e.onBeforeChange&&(t=t=>(e.onBeforeChange(t),this.handleValueChange(t))),(0,_.jsx)(xe,{field:e,item:this.getValues(),onValueChange:t,automationId:e.automationId},`field-${e.name}`)}));let s=!1;return s=this.props.children?this.props.children:(0,_.jsx)(f.Button,{type:"submit",isDisabled:this.state.loading,children:x.x.I18n.t("save")}),(0,_.jsxs)("div",{children:[(0,_.jsx)("div",{className:"mailpoet-form-content-around",children:n}),(0,_.jsxs)("form",{id:this.props.id,ref:this.formRef,className:t,onSubmit:void 0!==this.props.onSubmit?this.props.onSubmit:this.handleSubmit,"data-automation-id":this.props.automationId,children:[e,(0,_.jsxs)("div",{className:"mailpoet-form-grid",children:[a,(0,_.jsx)("div",{className:"mailpoet-form-actions",children:s})]})]}),(0,_.jsx)("div",{className:"mailpoet-form-content-around",children:r})]})}}ve.propTypes={params:h().shape({id:h().string}),location:h().shape({pathname:h().string}),item:h().object,errors:h().arrayOf(h().object),endpoint:h().string,fields:h().arrayOf(h().object),messages:h().shape({onUpdate:h().func,onCreate:h().func}),loading:h().bool,children:h().array,id:h().string,automationId:h().string,beforeFormContent:h().func,afterFormContent:h().func,onItemLoad:h().func,isValid:h().func,onChange:h().func,onSubmit:h().func,onSuccess:h().func,history:h().shape({push:h().func.isRequired}).isRequired},ve.defaultProps={params:{},location:{},errors:void 0,fields:void 0,item:void 0,onItemLoad:void 0,isValid:void 0,onSuccess:void 0,onChange:void 0,loading:!1,beforeFormContent:void 0,afterFormContent:void 0,children:void 0,id:"",onSubmit:void 0,automationId:"",messages:{onUpdate:()=>{},onCreate:()=>{}},endpoint:void 0};const be=(0,l.EN)(ve);var ye=n(14223);const we=[{name:"email",label:x.x.I18n.t("email"),type:"text",disabled:function(e){return Number(e.wp_user_id>0)||1===Number(e.is_woocommerce_user)}},{name:"first_name",label:x.x.I18n.t("firstname"),type:"text",disabled:function(e){return Number(e.wp_user_id>0)||1===Number(e.is_woocommerce_user)}},{name:"last_name",label:x.x.I18n.t("lastname"),type:"text",disabled:function(e){return Number(e.wp_user_id>0)||1===Number(e.is_woocommerce_user)}},{name:"status",label:x.x.I18n.t("status"),type:"select",automationId:"subscriber-status",values:{subscribed:x.x.I18n.t("subscribed"),unconfirmed:x.x.I18n.t("unconfirmed"),unsubscribed:x.x.I18n.t("unsubscribed"),inactive:x.x.I18n.t("inactive"),bounced:x.x.I18n.t("bounced")}},{name:"segments",label:x.x.I18n.t("lists"),type:"selection",placeholder:x.x.I18n.t("selectList"),tip:x.x.I18n.t("welcomeEmailTip"),api_version:window.mailpoet_api_version,endpoint:"segments",multiple:!0,selected:function(e){return!1===Array.isArray(e.subscriptions)?null:e.subscriptions.filter((e=>"subscribed"===e.status)).map((e=>e.segment_id))},filter:function(e){return!e.deleted_at&&"default"===e.type},getLabel:function(e){return e.name},getCount:function(e){return e.subscribers},getSearchLabel:function(e,t){let n="";return void 0!==t.subscriptions&&t.subscriptions.forEach((t=>{if(e.id===t.segment_id&&(n=e.name,"unsubscribed"===t.status)){const e=x.x.Date.format(t.updated_at);n+=" (%1$s)".replace("%1$s",x.x.I18n.t("unsubscribedOn").replace("%1$s",e))}})),n}},{name:"tags",label:x.x.I18n.t("tags"),type:"tokenField",placeholder:x.x.I18n.t("addNewTag"),suggestedValues:[],endpoint:"tags",getName:function(e){return Object.prototype.hasOwnProperty.call(e,"name")?e.name:e}}];(window.mailpoet_custom_fields||[]).forEach((e=>{const t={name:`cf_${e.id}`,label:e.name,type:e.type};switch(e.params&&(t.params=e.params,e.params.values&&(t.values=e.params.values)),e.type){case"date":t.year_placeholder=x.x.I18n.t("year"),t.month_placeholder=x.x.I18n.t("month"),t.day_placeholder=x.x.I18n.t("day");break;case"select":t.placeholder="-";break;default:t.placeholder=""}we.push(t)}));const _e={onUpdate:function(){x.x.Notice.success(x.x.I18n.t("subscriberUpdated"))},onCreate:function(){x.x.Notice.success(x.x.I18n.t("subscriberAdded")),x.x.trackEvent("Subscribers > Add new")}};function je(e){if(Number(e.wp_user_id)>0)return(0,_.jsx)("p",{className:"description",children:I()(x.x.I18n.t("WPUserEditNotice"),/\[link\](.*?)\[\/link\]/g,((t,n)=>(0,_.jsx)("a",{href:`user-edit.php?user_id=${e.wp_user_id}`,children:t},n)))})}function Se(e){var t;return(0,_.jsxs)(_.Fragment,{children:[null==e||null===(t=e.unsubscribes)||void 0===t?void 0:t.map((e=>{const t=K()(e.createdAt.date).format("dddd MMMM Do YYYY [at] h:mm:ss a");let n;return n="admin"===e.source?x.x.I18n.t("unsubscribedAdmin").replace("%1$d",t).replace("%2$d",e.meta):"manage"===e.source?x.x.I18n.t("unsubscribedManage").replace("%1$d",t):"newsletter"===e.source?I()(x.x.I18n.t("unsubscribedNewsletter").replace("%1$d",t),/\[link\]/g,((t,n)=>(0,_.jsx)("a",{href:`admin.php?page=mailpoet-newsletter-editor&id=${e.newsletterId}`,children:e.newsletterSubject},n))):x.x.I18n.t("unsubscribedUnknown").replace("%1$d",t),(0,_.jsx)("p",{className:"description",children:n},n)})),(0,_.jsxs)("p",{className:"description",children:[(0,_.jsx)("strong",{children:x.x.I18n.t("tip")})," ",x.x.I18n.t("customFieldsTip")]})]})}function Ie(e){var t;let{match:n}=e;const r=(0,l.TH)(),a=(0,l.k6)(),s=(null===(t=r.state)||void 0===t?void 0:t.backUrl)||"/";return(0,_.jsxs)("div",{children:[(0,_.jsx)(Q.A,{color:"#fff"}),(0,_.jsx)(ye.B,{}),(0,_.jsxs)(he.X,{level:1,className:"mailpoet-title",children:[(0,_.jsx)("span",{children:x.x.I18n.t("subscriber")}),(0,_.jsx)(o.Link,{className:"mailpoet-button button button-secondary button-small",to:s,children:x.x.I18n.t("backToList")})]}),(0,_.jsx)(T,{}),(0,_.jsx)(be,{automationId:"subscriber_edit_form",endpoint:"subscribers",fields:we,params:n.params,messages:_e,beforeFormContent:je,afterFormContent:Se,onSuccess:()=>a.push(s)})]})}Ie.propTypes={match:h().shape({params:h().shape({id:h().string}).isRequired}).isRequired};var Ce=n(15317),Te=n(76087);function ke(e){var t;let{email:n}=e;const r=(null===(t=(0,l.TH)().state)||void 0===t?void 0:t.backUrl)||"/";return(0,_.jsxs)(he.X,{level:1,className:"mailpoet-title",children:[(0,_.jsx)("span",{children:x.x.I18n.t("statsHeading").replace("%s",n)}),(0,_.jsx)(o.Link,{className:"mailpoet-button button button-secondary button-small",to:r,children:x.x.I18n.t("backToList")})]})}var Ne=n(93492);function De(e){let{totalSent:t,open:n,machineOpen:r,click:a,subscriber:s}=e,i=0,o=0,l=0,c=0;const d=t-(n+r),u=t>0;return u&&(i=Math.round(n/t*100),o=Math.round(r/t*100),l=Math.round(a/t*100),c=Math.round(d/t*100)),(0,_.jsx)("div",{className:"mailpoet-tab-content mailpoet-subscriber-stats-summary",children:(0,_.jsx)("div",{className:"mailpoet-listing",children:(0,_.jsx)("table",{className:"mailpoet-listing-table",children:(0,_.jsxs)("tbody",{children:[(0,_.jsxs)("tr",{children:[(0,_.jsx)("td",{children:x.x.I18n.t("statsSentEmail")}),(0,_.jsx)("td",{children:(0,_.jsx)("b",{children:t.toLocaleString()})}),(0,_.jsx)("td",{})]}),(0,_.jsxs)("tr",{children:[(0,_.jsx)("td",{children:(0,_.jsx)(Ne.V,{children:x.x.I18n.t("statsOpened")})}),(0,_.jsx)("td",{children:(0,_.jsx)("b",{children:n.toLocaleString()})}),(0,_.jsx)("td",{children:u&&(0,_.jsxs)(_.Fragment,{children:[i,"%"]})})]}),(0,_.jsxs)("tr",{children:[(0,_.jsxs)("td",{children:[(0,_.jsx)(Ne.V,{children:x.x.I18n.t("statsMachineOpened")}),(0,_.jsx)(O.Tooltip,{tooltip:I()(x.x.I18n.t("statsMachineOpenedTooltip"),/\[link](.*?)\[\/link]/,(e=>(0,_.jsx)("span",{style:{pointerEvents:"all"},children:(0,_.jsx)("a",{href:"https://kb.mailpoet.com/article/368-what-are-machine-opens",target:"_blank","data-beacon-article":"6124b7fb21ef206e5592e188",rel:"noopener noreferrer",children:e},"kb-link")},"machine-opened-info")))})]}),(0,_.jsx)("td",{children:(0,_.jsx)("b",{children:r.toLocaleString()})}),(0,_.jsx)("td",{children:u&&(0,_.jsxs)(_.Fragment,{children:[o,"%"]})})]}),(0,_.jsxs)("tr",{children:[(0,_.jsx)("td",{children:(0,_.jsx)(Ne.V,{isInverted:!0,children:x.x.I18n.t("statsClicked")})}),(0,_.jsx)("td",{children:(0,_.jsx)("b",{children:a.toLocaleString()})}),(0,_.jsx)("td",{children:u&&(0,_.jsxs)(_.Fragment,{children:[l,"%"]})})]}),(0,_.jsxs)("tr",{children:[(0,_.jsx)("td",{children:x.x.I18n.t("statsNotClicked")}),(0,_.jsx)("td",{children:(0,_.jsx)("b",{children:d.toLocaleString()})}),(0,_.jsx)("td",{children:u&&(0,_.jsxs)(_.Fragment,{children:[c,"%"]})})]}),(0,_.jsxs)("tr",{children:[(0,_.jsx)("td",{children:x.x.I18n.t("statisticsColumn")}),(0,_.jsx)("td",{children:(0,_.jsx)("div",{className:"mailpoet-listing-stats",children:(0,_.jsx)(M,{id:s.id,engagementScore:s.engagement_score})})}),(0,_.jsx)("td",{})]})]})})})})}function Ee(e){let{revenueValue:t,count:n,averageRevenueValue:r}=e;return(0,_.jsx)("div",{className:"mailpoet-tab-content mailpoet-subscriber-stats-summary",children:(0,_.jsx)("div",{className:"mailpoet-listing",children:(0,_.jsx)("table",{className:"mailpoet-listing-table",children:(0,_.jsxs)("tbody",{children:[(0,_.jsxs)("tr",{children:[(0,_.jsx)("td",{children:"Orders created"}),(0,_.jsx)("td",{children:(0,_.jsx)("b",{children:n.toLocaleString()})})]}),(0,_.jsxs)("tr",{children:[(0,_.jsx)("td",{children:"Total revenue"}),(0,_.jsx)("td",{children:(0,_.jsx)("b",{children:t})})]}),(0,_.jsxs)("tr",{children:[(0,_.jsx)("td",{children:"Average revenue"}),(0,_.jsx)("td",{children:(0,_.jsx)("b",{children:r})})]})]})})})})}var Ae=n(34517),Oe=n(68230);function Re(e){let{limitReached:t,limitValue:n,subscribersCountTowardsLimit:r,premiumActive:a,hasValidApiKey:s,hasPremiumSupport:i}=e;return(0,_.jsxs)("table",{className:"mailpoet-listing-table","data-automation-id":"subscriber-stats-no-access",children:[(0,_.jsx)("thead",{children:(0,_.jsxs)("tr",{children:[(0,_.jsx)("th",{children:x.x.I18n.t("email")}),(0,_.jsx)("th",{children:x.x.I18n.t("columnAction")}),(0,_.jsx)("th",{children:x.x.I18n.t("columnCount")}),(0,_.jsx)("th",{children:x.x.I18n.t("columnActionOn")})]})}),(0,_.jsx)("tbody",{children:(0,_.jsx)("tr",{children:(0,_.jsx)("td",{colSpan:4,children:(0,_.jsx)("div",{className:"mailpoet-subscriber-stats-no-access-content",children:(0,_.jsx)(Oe.K,{title:a&&t?x.x.I18n.t("upgradeRequired"):x.x.I18n.t("premiumFeature"),message:(()=>{let e=x.x.I18n.t("premiumRequired");return a?(e=i?x.x.I18n.t("planLimitReached"):x.x.I18n.t("freeLimitReached"),(0,_.jsx)("p",{children:I()(e,/(\[subscribersCount]|\[subscribersLimit])/g,(e=>"[subscribersCount]"===e?r:n))})):(0,_.jsx)("p",{children:I()(e,/\[link](.*?)\[\/link]/g,(e=>(0,_.jsx)("a",{href:x.x.premiumLink,children:e},e)))})})(),actionButton:a&&t?(0,_.jsx)(E.z,{href:s?x.x.MailPoetComUrlFactory.getUpgradeUrl():x.x.MailPoetComUrlFactory.getPurchasePlanUrl(r+1),children:x.x.I18n.t("premiumBannerCtaUpgrade")}):(0,_.jsx)(E.z,{href:x.x.MailPoetComUrlFactory.getPurchasePlanUrl(x.x.subscribersCount,x.x.currentWpUserEmail,null,{utm_medium:"stats",utm_campaign:"signup"}),children:x.x.I18n.t("premiumBannerCtaFree")})})})})})})]})}function Pe(e){let{params:t,location:n}=e;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(he.X,{level:4,children:x.x.I18n.t("openedEmailsHeading")}),!x.x.premiumActive||x.x.subscribersLimitReached?(0,_.jsx)(Re,{limitReached:x.x.subscribersLimitReached,limitValue:x.x.subscribersLimit,subscribersCountTowardsLimit:x.x.subscribersCount,premiumActive:x.x.premiumActive,hasValidApiKey:x.x.hasValidApiKey,hasPremiumSupport:x.x.hasPremiumSupport}):Ae.Hooks.applyFilters("mailpoet_subscribers_opened_emails_stats",t,n)]})}function Me(){const e=(0,l.$B)(),t=(0,l.TH)(),[n,r]=(0,y.useState)(null),[a,s]=(0,y.useState)(!0),i=(0,Te.S)(window).notices.error;return(0,y.useEffect)((()=>{x.x.Ajax.post({api_version:x.x.apiVersion,endpoint:"subscriberStats",action:"get",data:{subscriber_id:e.params.id}}).done((e=>{r(e.data),s(!1)})).fail((e=>{s(!1),e.errors.length>0&&i((0,_.jsx)(_.Fragment,{children:e.errors.map((e=>(0,_.jsx)("p",{children:e.message},e.message)))}),{scroll:!0})}))}),[e.params.id,i]),a?(0,_.jsx)(Ce.g,{}):(0,_.jsxs)("div",{className:"mailpoet-subscriber-stats",children:[(0,_.jsx)(ke,{email:n.email}),(0,_.jsxs)("p",{children:[x.x.I18n.t("lastEngagement"),": ",n.last_engagement?x.x.Date.format(n.last_engagement):x.x.I18n.t("never")]}),(0,_.jsxs)("div",{className:"mailpoet-subscriber-stats-summary-grid",children:[(0,_.jsx)(De,{click:n.click,open:n.open,machineOpen:n.machine_open,totalSent:n.total_sent,subscriber:{id:Number(e.params.id),engagement_score:n.engagement_score}}),n.woocommerce&&(0,_.jsx)(Ee,{averageRevenueValue:n.woocommerce.formatted_average,count:n.woocommerce.count,revenueValue:n.woocommerce.formatted})]}),(0,_.jsx)(Pe,{params:e.params,location:t})]})}var Le=n(1349);function Fe(){return(0,_.jsx)(Te.k.Provider,{value:(0,Te.S)(window),children:(0,_.jsxs)(o.HashRouter,{children:[(0,_.jsx)(Le.w,{}),(0,_.jsxs)(l.rs,{children:[(0,_.jsx)(l.AW,{path:"/new",component:Ie}),(0,_.jsx)(l.AW,{path:"/edit/:id",component:Ie}),(0,_.jsx)(l.AW,{path:"/stats/:id/(.*)?",component:Me}),(0,_.jsx)(l.AW,{path:"*",component:z})]})]})})}const qe=document.getElementById("subscribers_container");qe&&i.render((0,_.jsx)(Fe,{}),qe);var $e=n(7501),Ue=n(58583);class Ze extends y.PureComponent{render(){const e=this.props.event,t=e.soon;let n;if(this.props.premium)n=(0,_.jsx)("a",{href:"?page=mailpoet-premium",target:"_blank",children:x.x.I18n.t("premiumFeatureLink")});else if(e.actionButtonLink&&e.actionButtonTitle)n=(0,_.jsx)("a",{href:e.actionButtonLink,target:"_blank",rel:"noopener noreferrer",children:e.actionButtonTitle});else{const r=t?null:w.ZP.partial(this.props.eventsConfigurator,e.slug);n=(0,_.jsx)(E.z,{disabled:t,onClick:r,role:"presentation",automationId:`create_${e.slug}`,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),r())},children:e.actionButtonTitle||x.x.I18n.t("setUp")})}return(0,_.jsxs)("div",{"data-type":e.slug,className:"mailpoet-newsletter-type",children:[(0,_.jsx)("div",{className:"mailpoet-newsletter-type-image",children:e.badge&&(0,_.jsx)(Ue.C,{title:e.badge.text})}),(0,_.jsxs)("div",{className:"mailpoet-newsletter-type-content",children:[(0,_.jsxs)(he.X,{level:4,children:[e.title," ",e.soon&&`(${x.x.I18n.t("soon")})`]}),(0,_.jsx)("p",{children:e.description}),(0,_.jsx)("div",{className:"mailpoet-flex-grow"}),(0,_.jsx)("div",{className:"mailpoet-newsletter-type-action",children:n})]})]})}}Ze.defaultProps={premium:!1},Ze.propTypes={premium:h().bool,eventsConfigurator:h().func.isRequired,event:h().shape({slug:h().string.isRequired,actionButtonLink:h().string,title:h().string.isRequired,soon:h().bool,badge:h().shape({style:h().string,text:h().string}),description:h().string.isRequired,actionButtonTitle:h().string}).isRequired};class Ve extends y.Component{constructor(e){super(e),this.email=this.props.email,this.emailEvents=this.email.events,this.eventsConfigurator=this.eventsConfigurator.bind(this)}eventsConfigurator(e){x.x.trackEvent("Emails > Automatic Type selected",{"Email type":e}),this.props.history.push(`/new/${this.email.slug}/${e}/conditions`)}render(){return w.ZP.map(this.emailEvents,((e,t)=>(0,_.jsx)(Ze,{premium:this.email.premium,event:e,eventsConfigurator:this.eventsConfigurator},t)))}}Ve.propTypes={email:h().shape({title:h().string.isRequired,slug:h().string.isRequired,premium:h().bool}).isRequired,history:h().shape({push:h().func.isRequired}).isRequired};const We=(0,l.EN)(Ve),Ye={woocommerce:(0,_.jsxs)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 120 71",style:{enableBackground:"new 0 0 120 71"},children:[(0,_.jsx)("path",{fill:"#9ca6cc",d:"M11.4,0.7h97.1c6.1,0,11.1,4.9,11.1,11v36.7c0,6.1-5,11-11.1,11H73.7L78.5,71l-21-11.6h-46 c-6.1,0-11.1-4.9-11.1-11V11.7C0.3,5.7,5.3,0.7,11.4,0.7z"}),(0,_.jsx)("path",{fill:"#fff",d:"M7.2,10.7c0.7-0.9,1.7-1.4,3.1-1.5c2.5-0.2,3.9,1,4.2,3.5c1.5,10,3.2,18.5,4.9,25.5l10.6-20 c1-1.8,2.2-2.8,3.6-2.9c2.1-0.1,3.4,1.2,4,4c1.2,6.4,2.8,11.8,4.6,16.4c1.3-12.2,3.4-21,6.4-26.4c0.7-1.3,1.8-2,3.2-2.1 c1.1-0.1,2.1,0.2,3.1,1c0.9,0.7,1.4,1.6,1.5,2.7c0,0.9-0.1,1.6-0.5,2.3c-1.9,3.5-3.4,9.3-4.7,17.3c-1.2,7.8-1.6,13.9-1.4,18.3 c0.1,1.2-0.1,2.3-0.6,3.2c-0.6,1.1-1.5,1.6-2.6,1.7c-1.3,0.1-2.6-0.5-3.8-1.8c-4.5-4.6-8.1-11.4-10.7-20.5c-3.2,6.1-5.5,10.8-7,13.8 c-2.9,5.4-5.3,8.2-7.3,8.4c-1.3,0.1-2.4-1-3.4-3.3C11.9,44.1,9.3,32,6.4,14C6.2,12.7,6.5,11.6,7.2,10.7z M111.3,18.3 c-1.7-3-4.3-4.9-7.8-5.6c-0.9-0.2-1.8-0.3-2.6-0.3c-4.7,0-8.4,2.4-11.4,7.2c-2.5,4.1-3.8,8.6-3.8,13.5c0,3.7,0.8,6.9,2.3,9.5 c1.7,3,4.3,4.9,7.8,5.6c0.9,0.2,1.8,0.3,2.6,0.3c4.7,0,8.5-2.4,11.4-7.2c2.5-4.1,3.8-8.6,3.8-13.6C113.7,24,112.9,20.9,111.3,18.3z M105.2,31.6c-0.7,3.2-1.9,5.5-3.7,7.1c-1.4,1.2-2.7,1.8-3.9,1.5c-1.2-0.2-2.1-1.2-2.9-3.1c-0.6-1.5-0.9-3-0.9-4.4 c0-1.2,0.1-2.4,0.3-3.5c0.4-2,1.3-3.9,2.6-5.7c1.6-2.4,3.3-3.3,5-3c1.2,0.2,2.1,1.2,2.9,3.1c0.6,1.5,0.9,3,0.9,4.4 C105.6,29.3,105.5,30.5,105.2,31.6z M81,18.3c-1.7-3-4.4-4.9-7.8-5.6c-0.9-0.2-1.8-0.3-2.6-0.3c-4.7,0-8.4,2.4-11.4,7.2 c-2.5,4.1-3.8,8.6-3.8,13.5c0,3.7,0.8,6.9,2.3,9.5c1.7,3,4.3,4.9,7.8,5.6c0.9,0.2,1.8,0.3,2.6,0.3c4.7,0,8.5-2.4,11.4-7.2 c2.5-4.1,3.8-8.6,3.8-13.6C83.3,24,82.5,20.9,81,18.3z M74.8,31.6c-0.7,3.2-1.9,5.5-3.7,7.1c-1.4,1.2-2.7,1.8-3.9,1.5 c-1.2-0.2-2.1-1.2-2.9-3.1c-0.6-1.5-0.9-3-0.9-4.4c0-1.2,0.1-2.4,0.3-3.5c0.4-2,1.3-3.9,2.6-5.7c1.6-2.4,3.3-3.3,5-3 c1.2,0.2,2.1,1.2,2.9,3.1c0.6,1.5,0.9,3,0.9,4.4C75.2,29.3,75.1,30.5,74.8,31.6z"})]})};var Be=n(19606);function He(e){let{errors:t}=e;return t.length<1?null:(0,_.jsx)(C.q,{type:"error",closable:!1,children:t.map((e=>(0,_.jsx)("p",{children:e.message},e.message)))})}var ze=n(11699);function Ge(e){let{filter:t,history:n,hideClosingButton:r=!1,hideScreenOptions:a=!0}=e;const[s,i]=(0,y.useState)(!1),o=e=>{void 0!==e&&(n.push(`/new/${e}`),x.x.trackEvent("Emails > Type selected",{"Email type":e}))},l=async()=>{x.x.trackEvent("Emails > Type selected",{"Email type":"wc_transactional"});let e=window.mailpoet_woocommerce_transactional_email_id;if(!e)try{e=(await x.x.Ajax.post({api_version:x.x.apiVersion,endpoint:"settings",action:"set",data:{"woocommerce.use_mailpoet_editor":1}})).data.woocommerce.transactional_email_id,x.x.trackEvent("Emails > WooCommerce email customizer enabled")}catch(e){return(0,ze.q)(e)&&e.errors.length>0?(0,_.jsx)(He,{errors:e.errors}):null}return window.location.href=`?page=mailpoet-newsletter-editor&id=${e}`,null},c=e=>{const t=!0===window.mailpoet_is_new_user?"mailpoet_badge mailpoet_badge_video":"mailpoet_badge mailpoet_badge_video mailpoet_badge_video_grey";return(0,_.jsxs)("div",{"data-type":e.slug,className:"mailpoet-newsletter-type",children:[(0,_.jsx)("div",{className:"mailpoet-newsletter-type-image"}),(0,_.jsxs)("div",{className:"mailpoet-newsletter-type-content",children:[(0,_.jsxs)(he.X,{level:4,children:[e.title," ",e.beta?`(${x.x.I18n.t("beta")})`:""]}),(0,_.jsx)("p",{children:e.description}),e.videoGuide&&(0,_.jsxs)("a",{className:t,href:e.videoGuide,"data-beacon-article":e.videoGuideBeacon,target:"_blank",rel:"noopener noreferrer",children:[(0,_.jsx)("span",{className:"dashicons dashicons-format-video"}),x.x.I18n.t("seeVideoGuide")]}),(0,_.jsx)("div",{className:"mailpoet-flex-grow"}),(0,_.jsx)("div",{className:"mailpoet-newsletter-type-action",children:e.action})]})]},e.slug)},d=w.ZP.partial((e=>{i(!0),x.x.trackEvent("Emails > Type selected",{"Email type":e}),x.x.Ajax.post({api_version:x.x.apiVersion,endpoint:"newsletters",action:"create",data:{type:e,subject:x.x.I18n.t("draftNewsletterTitle")}}).done((e=>{n.push(`/template/${e.data.id}`)})).fail((e=>(i(!1),e.errors.length>0?(0,_.jsx)(He,{errors:e.errors}):null)))}),"standard"),u=w.ZP.partial(o,"notification"),p=w.ZP.partial(o,"welcome"),m=w.ZP.partial(o,"re-engagement"),h=[{slug:"standard",title:x.x.I18n.t("regularNewsletterTypeTitle"),description:x.x.I18n.t("regularNewsletterTypeDescription"),action:(0,_.jsx)(E.z,{automationId:"create_standard",onClick:d,tabIndex:0,withSpinner:s,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),d())},children:x.x.I18n.t("create")})},{slug:"welcome",title:x.x.I18n.t("welcomeNewsletterTypeTitle"),description:x.x.I18n.t("welcomeNewsletterTypeDescription"),videoGuide:"https://kb.mailpoet.com/article/254-video-guide-to-welcome-emails",videoGuideBeacon:"5b05ebf20428635ba8b2aa53",action:(0,_.jsx)(E.z,{onClick:p,automationId:"create_welcome",withSpinner:s,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),p())},tabIndex:0,children:x.x.I18n.t("setUp")})},{slug:"notification",title:x.x.I18n.t("postNotificationNewsletterTypeTitle"),description:x.x.I18n.t("postNotificationNewsletterTypeDescription"),videoGuide:"https://kb.mailpoet.com/article/210-video-guide-to-post-notifications",videoGuideBeacon:"59ba6fb3042863033a1cd5a5",action:(0,_.jsx)(E.z,{automationId:"create_notification",onClick:u,withSpinner:s,tabIndex:0,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),u())},children:x.x.I18n.t("setUp")})},{slug:"re_engagement",title:x.x.I18n.t("tabReEngagementTitle"),description:x.x.I18n.t("reEngagementDescription"),action:(0,_.jsx)(E.z,{automationId:"create_notification",onClick:m,withSpinner:s,tabIndex:0,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),m())},children:x.x.I18n.t("setUp")})}];let f=Ae.Hooks.applyFilters("mailpoet_newsletters_types",[...h],this);t&&(f=f.filter(t));const g=x.x.Ajax.constructGetUrl({api_version:x.x.apiVersion,endpoint:"newsletterTemplates",action:"getAll"});return(0,_.jsxs)(_.Fragment,{children:[a&&(0,_.jsx)(ye.B,{}),(0,_.jsx)("link",{rel:"prefetch",href:window.mailpoet_editor_javascript_url,as:"script"}),(0,_.jsxs)("div",{className:"mailpoet-newsletter-types",children:[!r&&(0,_.jsx)("div",{className:"mailpoet-newsletter-types-close",children:(0,_.jsx)("button",{type:"button",onClick:()=>n.push("/"),className:"mailpoet-modal-close",children:Be.X})}),f.map((e=>c(e)),this),(()=>{if(!window.mailpoet_woocommerce_automatic_emails)return[];let e=window.mailpoet_woocommerce_automatic_emails;return t&&(e=w.ZP.filter(e,t)),w.ZP.map(e,(e=>{const r=e;return(0,_.jsxs)(y.Fragment,{children:[!t&&(0,_.jsxs)("div",{className:"mailpoet-newsletter-types-separator",children:[(0,_.jsx)("div",{className:"mailpoet-newsletter-types-separator-line"}),(0,_.jsx)("div",{className:"mailpoet-newsletter-types-separator-logo",children:Ye[r.slug]||null}),(0,_.jsx)("div",{className:"mailpoet-newsletter-types-separator-line"})]}),(0,_.jsx)(We,{email:r,history:n}),"woocommerce"===r.slug&&(x.x.isWoocommerceActive?[{slug:"wc_transactional",title:x.x.I18n.t("wooCommerceCustomizerTypeTitle"),description:x.x.I18n.t("wooCommerceCustomizerTypeDescription"),action:(0,_.jsx)(E.z,{automationId:"customize_woocommerce",onClick:l,tabIndex:0,onKeyDown:async e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),await l())},children:x.x.I18n.t("customize")})}]:[]).map((e=>c(e)),this)]},r.slug)}))})()]}),(0,_.jsx)("link",{rel:"prefetch",href:g,as:"fetch"})]})}Ge.defaultProps={filter:null,hideScreenOptions:!0,hideClosingButton:!1};const Ke=(0,l.EN)(Ge);var Qe=n(69916);function Xe(e){let{newsletter:t,isSent:n,currentTime:r}=e,a=n;if(void 0===a&&(a=t.statistics&&t.queue&&"scheduled"!==t.queue.status),!a)return null;const s={link:`/stats/${t.id}`,onClick:Ae.Hooks.applyFilters("mailpoet_newsletters_listing_stats_tracking",$e.gP)},i=Number(t.total_sent||t.queue.count_processed);let l,c,d,u,p,m=0,h=0,g=null;i>0&&(m=100*t.statistics.clicked/i,h=100*t.statistics.opened/i,g=t.statistics.revenue),void 0!==r?(l=6,c=t.queue.scheduled_at||t.queue.created_at,d=K()(r).diff(K()(c),"hours"),u=d<l,p=!0):(u=!1,p=!1);const v=i>=20&&t.statistics.opened>=5&&!u,b=(e,n)=>((e,t,n,r)=>r<=0||!t.link?e:t.externalLink?(0,_.jsx)("a",{href:t.link,onClick:t.onClick||null,children:e},`stats-${n}`):(0,_.jsx)(o.Link,{to:t.link,onClick:t.onClick||null,children:e},`stats-${n}`))(e,s,`${n}-${t.id}`,i),y=(0,_.jsx)(Qe.M,{opened:h,clicked:m,revenues:g&&g.value>0?g.formatted:null,hideBadges:!v,newsletterId:t.id,wrapContentInLink:b}),w=(0,_.jsxs)(_.Fragment,{children:[y,u&&b((0,_.jsx)(f.Tag,{className:"mailpoet-listing-stats-too-early",dimension:"large",variant:"excellent",isInverted:!0,children:x.x.I18n.t("checkBackInHours").replace("%1$d",l-d)}),"check-back")]});let j;return p&&h<5&&d>=24&&i>=10&&(j=(0,_.jsx)("div",{children:(0,_.jsx)("a",{href:"https://kb.mailpoet.com/article/191-how-to-improve-my-open-and-click-rates","data-beacon-article":"58f671152c7d3a057f8858e8",target:"_blank",rel:"noopener noreferrer",className:"mailpoet_stat_link_small",children:x.x.I18n.t("improveThisLinkText")})})),(0,_.jsxs)(_.Fragment,{children:[w,j]})}const Je=h().shape({clicked:h().number,opened:h().number,unsubscribed:h().number,revenue:h().shape({count:h().number,currency:h().string,formatted:h().string,value:h().number})}),et=h().shape({status:h().string,count_processed:h().string.isRequired,count_total:h().string.isRequired,created_at:h().string,scheduled_at:h().string});Xe.propTypes={newsletter:h().shape({id:h().number.isRequired,queue:h().oneOfType([et,h().bool]),total_sent:h().number,statistics:h().oneOfType([Je,h().bool])}).isRequired,isSent:h().bool,currentTime:h().string},Xe.defaultProps={isSent:void 0,currentTime:void 0};const tt=x.x.trackingConfig.emailTrackingEnabled,nt=window.mailpoet_woocommerce_automatic_emails||{},rt={onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneNewsletterTrashed"):x.x.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneNewsletterDeleted"):x.x.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneNewsletterRestored"):x.x.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)}},at=[{name:"subject",label:x.x.I18n.t("subject"),sortable:!0},{name:"settings",label:x.x.I18n.t("settings")},{name:"statistics",label:x.x.I18n.t("statistics"),display:tt},{name:"status",label:x.x.I18n.t("status"),width:145},{name:"updated_at",label:x.x.I18n.t("lastModifiedOn"),sortable:!0}],st=[{name:"trash",label:x.x.I18n.t("moveToTrash"),onSuccess:rt.onTrash}];let it=[{name:"view",link:function(e){return(0,_.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:x.x.I18n.t("preview")})}},{name:"edit",className:"mailpoet-hide-on-mobile",label:x.x.I18n.t("edit"),onClick:$e.Q2},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:x.x.I18n.t("duplicate"),onClick:(e,t)=>x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{x.x.Notice.success(x.x.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&x.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},{name:"trash",className:"mailpoet-hide-on-mobile"}];it=(0,$e.y8)(it);class ot extends y.Component{constructor(e){super(e),(0,b.Z)(this,"updateStatus",((e,t)=>{t.persist(),x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"setStatus",data:{id:Number(t.target.getAttribute("data-id")),status:e?"active":"draft"}}).done((e=>{if("active"===e.data.status){const e=t.target.getAttribute("data-group"),n=nt[e];x.x.Notice.success(x.x.I18n.t("automaticEmailActivated").replace("%1s",n.title))}this.forceUpdate()})).fail((n=>{x.x.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,b.Z)(this,"renderStatus",(e=>{const t=parseInt(e.total_sent,10)>-1?x.x.I18n.t("sentToXCustomers").replace("%1$d",e.total_sent.toLocaleString()):null;return(0,_.jsxs)("div",{children:[(0,_.jsx)(f.Toggle,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,"data-group":e.options.group,dimension:"small",defaultChecked:"active"===e.status}),(0,_.jsxs)("p",{className:"mailpoet-listing-notification-status",children:[t&&(0,_.jsx)(o.Link,{to:`/sending-status/${e.id}`,children:t}),!t&&(0,_.jsx)("span",{className:"mailpoet-listing-status-unknown mailpoet-font-extra-small",children:x.x.I18n.t("notSentYet")})]})]})})),(0,b.Z)(this,"renderSettings",(e=>{const t=nt[e.options.group].events[e.options.event];let n;try{n=JSON.parse(e.options.meta||null)}catch(t){n=e.options.meta||null}const r=n&&n.option?w.ZP.pluck(n.option,"name"):[];if(n&&w.ZP.isEmpty(r))return(0,_.jsx)("span",{className:"mailpoet-listing-error",children:x.x.I18n.t("automaticEmailEventOptionsNotConfigured")});let a,s;if(a=r.length>1&&"listingScheduleDisplayTextPlural"in t?I()(t.listingScheduleDisplayTextPlural,"%s",((e,t)=>(0,_.jsx)(f.Tags,{strings:r},t))):I()(t.listingScheduleDisplayText,"%s",((e,t)=>(0,_.jsx)(f.Tags,{strings:r},t))),a&&"immediate"!==e.options.afterTimeType)switch(e.options.afterTimeType){case"minutes":s=x.x.I18n.t("sendingDelayMinutes").replace("%1$d",e.options.afterTimeNumber);break;case"hours":s=x.x.I18n.t("sendingDelayHours").replace("%1$d",e.options.afterTimeNumber);break;case"days":s=x.x.I18n.t("sendingDelayDays").replace("%1$d",e.options.afterTimeNumber);break;case"weeks":s=x.x.I18n.t("sendingDelayWeeks").replace("%1$d",e.options.afterTimeNumber);break;default:s=x.x.I18n.t("sendingDelayInvalid")}return(0,_.jsxs)("span",{children:[a,s&&(0,_.jsxs)("div",{className:"mailpoet-listing-schedule",children:[(0,_.jsx)("div",{className:"mailpoet-listing-schedule-icon",children:(0,_.jsx)(f.ScheduledIcon,{})}),s]})]})})),(0,b.Z)(this,"renderItem",((e,t)=>{const n=d()("manage-column","column-primary","has-row-actions");return(0,_.jsxs)("div",{children:[(0,_.jsxs)("td",{className:n,children:[(0,_.jsx)("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`,children:e.subject}),t]}),(0,_.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("settings"),children:this.renderSettings(e)}),!0===tt?(0,_.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":x.x.I18n.t("statistics"),children:(0,_.jsx)(Xe,{newsletter:e,isSent:e.total_sent>0&&!!e.statistics})}):null,(0,_.jsx)("td",{className:"column","data-colname":x.x.I18n.t("status"),children:this.renderStatus(e)}),(0,_.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("lastModifiedOn"),children:[x.x.Date.short(e.updated_at),(0,_.jsx)("br",{}),x.x.Date.time(e.updated_at)]})]})})),(0,b.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={eventCounts:{},newslettersCount:void 0},this.afterGetItems=this.afterGetItems.bind(this)}afterGetItems(e){(0,$e._X)(e),this.countEmailTypes(e)}countEmailTypes(e){const t={woocommerce_product_purchased:0,woocommerce_product_purchased_in_category:0,woocommerce_first_purchase:0};if(Array.isArray(e.items)){const n=e.items.map((e=>e.options.event)).reduce(((e,t)=>(e[t]?e[t]+=1:e[t]=1,e)),t);this.setState({eventCounts:n})}}renderWarning(){const{eventCounts:e}=this.state;return e.woocommerce_product_purchased+e.woocommerce_product_purchased_in_category+e.woocommerce_first_purchase?"1"===window.mailpoet_woocommerce_optin_on_checkout?null:(0,_.jsxs)("div",{className:"notice error",children:[(0,_.jsx)("p",{children:x.x.I18n.t("wooCommerceEmailsWarning")}),(0,_.jsx)("p",{children:(0,_.jsx)("a",{href:"?page=mailpoet-settings#woocommerce",children:x.x.I18n.t("wooCommerceEmailsWarningLink")})})]}):null}render(){const{match:e,location:t}=this.props;return(0,_.jsxs)(_.Fragment,{children:[this.renderWarning(),0===this.state.newslettersCount&&(0,_.jsx)(Ke,{filter:e=>"woocommerce"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&(0,_.jsx)(g.N,{limit:window.mailpoet_listing_per_page,location:t,params:e.params,endpoint:"newsletters",type:"automatic",base_url:"woocommerce",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:at,bulk_actions:st,item_actions:it,messages:rt,auto_refresh:!0,sort_by:"updated_at",sort_order:"desc",afterGetItems:e=>{if(!e.loading){const t=e.groups.reduce(((e,t)=>e+t.count),0);this.setState({newslettersCount:t})}this.afterGetItems(e)}})]})}}ot.propTypes={match:h().shape({params:h().shape({tab:h().string}).isRequired}).isRequired,location:h().object.isRequired};const lt=(0,l.EN)(ot);var ct=n(22058),dt=n(30189);const ut=(0,l.EN)((e=>(0,_.jsx)(dt.b,{...e})));var pt=n(58125),mt=n(31539);class ht extends y.Component{constructor(e){super(e),this.onPreview=this.onPreview.bind(this),this.onDelete=this.onDelete.bind(this),this.onSelect=this.onSelect.bind(this)}onDelete(){const{id:e,name:t,beforeDelete:n,afterDelete:r}=this.props;(0,mt._)({message:x.x.I18n.t("confirmTemplateDeletion").replace("%1$s",t),onConfirm:()=>{n(),x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"delete",data:{id:e}}).done((()=>{r(!0,e)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,_.jsx)("p",{children:e.message},e.message))),{scroll:!0}),r(!1)}))}})}onPreview(){x.x.Modal.popup({title:this.props.name,template:'<img src="{{ thumbnail }}" />',data:this.props})}onSelect(){const{newsletterId:e,name:t,beforeSelect:n,afterSelect:r}=this.props;n(),x.x.trackEvent("Emails > Template selected",{"Email name":t}),x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"save",data:{id:e,template_id:this.props.id}}).done((e=>{r(!0,e.data.id)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,_.jsx)("p",{children:e.message},e.message))),{scroll:!0}),r(!1)}))}render(){const{index:e,name:t,thumbnail:n,readonly:r}=this.props;let a="";return"string"==typeof n&&n.length>0&&(a=(0,_.jsxs)("a",{className:"mailpoet-template-preview",href:"#",onClick:e=>{e.preventDefault(),this.onPreview(e)},children:[(0,_.jsx)("div",{className:"mailpoet-template-thumbnail",children:n?(0,_.jsx)("img",{src:n,alt:x.x.I18n.t("templatePreview"),loading:"lazy"}):""}),(0,_.jsx)("div",{className:"mailpoet-template-preview-overlay",children:(0,_.jsx)(E.z,{children:x.x.I18n.t("zoom")})})]})),(0,_.jsx)(pt.G,{label:t,onSelect:this.onSelect,onDelete:!1===r?this.onDelete:void 0,automationId:`select_template_${e}`,className:"mailpoet-template-two-lines",children:a})}}ht.contextType=Te.k,ht.propTypes={index:h().number.isRequired,id:h().number.isRequired,newsletterId:h().string.isRequired,name:h().string.isRequired,thumbnail:h().string,readonly:h().bool.isRequired,beforeDelete:h().func.isRequired,afterDelete:h().func.isRequired,beforeSelect:h().func.isRequired,afterSelect:h().func.isRequired},ht.defaultProps={thumbnail:null};class ft extends y.Component{constructor(e){super(e),this.fileRef=(0,y.createRef)(),this.handleSubmit=this.handleSubmit.bind(this)}handleSubmit(e){if(e.preventDefault(),w.ZP.size(this.fileRef.current.files)<=0)return!1;const t=w.ZP.first(this.fileRef.current.files),n=new FileReader;return n.onload=e=>{try{this.saveTemplate(JSON.parse(e.target.result)),x.x.trackEvent("Emails > Template imported")}catch(e){this.context.notices.error((0,_.jsx)("p",{children:x.x.I18n.t("templateFileMalformedError")}))}},n.readAsText(t),!0}saveTemplate(e){const t=e,{beforeImport:n,afterImport:r}=this.props;w.ZP.isUndefined(t.body)||(t.body=JSON.stringify(t.body));try{t.categories=JSON.parse(t.categories)}catch(e){t.categories=[]}-1===t.categories.indexOf("saved")&&t.categories.push("saved"),-1===t.categories.indexOf("standard")&&-1===t.categories.indexOf("welcome")&&-1===t.categories.indexOf("notification")&&t.categories.push("standard"),t.categories=JSON.stringify(t.categories),n(),x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"save",data:t}).done((e=>{r(!0,e.data)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,_.jsx)("p",{children:e.message},e.message))),{scroll:!0}),r(!1)}))}render(){return(0,_.jsxs)("div",{className:"mailpoet-template-import",children:[(0,_.jsxs)("h4",{children:[x.x.I18n.t("importTemplateTitle"),(0,_.jsx)(O.Tooltip,{tooltip:x.x.I18n.t("helpTooltipTemplateUpload"),place:"right",className:"tooltip-help-import-template"})]}),(0,_.jsxs)("form",{onSubmit:this.handleSubmit,children:[(0,_.jsx)("input",{type:"file",placeholder:x.x.I18n.t("selectJsonFileToUpload"),ref:this.fileRef}),(0,_.jsx)("p",{className:"submit",children:(0,_.jsx)("input",{className:"button button-primary",type:"submit",value:x.x.I18n.t("upload")})})]})]})}}ft.contextType=Te.k,ft.propTypes={beforeImport:h().func.isRequired,afterImport:h().func.isRequired};const gt=[];window.mailpoet_newsletters_templates_recently_sent_count&>.push({name:"recent",label:x.x.I18n.t("recentlySent")}),gt.push({name:"standard",label:x.x.I18n.t("tabStandardTitle")},{name:"welcome",label:x.x.I18n.t("tabWelcomeTitle")},{name:"notification",label:x.x.I18n.t("tabNotificationTitle")},{name:"re_engagement",label:x.x.I18n.t("tabReEngagementTitle")},{name:"blank",label:x.x.I18n.t("tabBlankTitle")}),window.mailpoet_woocommerce_active&>.push({name:"woocommerce",label:x.x.I18n.t("tabWoocommerceTitle")}),gt.push({name:"saved",label:x.x.I18n.t("savedTemplates")});class xt extends y.Component{constructor(e){super(e),this.state={loading:!0,templates:{},emailType:null,emailOptions:{},selectedTab:""},this.templates={},this.addTemplate=this.addTemplate.bind(this),this.afterTemplateDelete=this.afterTemplateDelete.bind(this),this.afterTemplateSelect=this.afterTemplateSelect.bind(this),this.afterTemplateImport=this.afterTemplateImport.bind(this)}componentDidMount(){x.x.Ajax.get({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"getAll"}).done((e=>{0===e.data.length&&(e.data=[{name:x.x.I18n.t("mailpoetGuideTemplateTitle"),categories:'["welcome", "notification", "standard", "woocommerce"]',readonly:!0}]),e.data.forEach(this.addTemplate),this.sortTemplates()})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,_.jsx)("p",{children:e.message},e.message))),{scroll:!0})})).always((()=>{this.selectInitialTab()}))}addTemplate(e){const t=gt.map((e=>e.name));let n;-1===t.indexOf("woocommerce")&&t.push("woocommerce");try{n=JSON.parse(e.categories).filter((e=>-1!==t.indexOf(e)))}catch(e){n=[]}0===n.length&&n.push("saved"),n.forEach((t=>{void 0===this.templates[t]&&(this.templates[t]=[]),this.templates[t].unshift(e)}))}sortTemplates(){const e=["welcome","notification","standard"];Object.keys(this.templates).forEach((t=>{this.templates[t].sort(((n,r)=>{if(e.includes(t)){if(n.categories.includes('"blank"')&&!r.categories.includes('"blank"'))return-1;if(!n.categories.includes('"blank"')&&r.categories.includes('"blank"'))return 1}return n.id<r.id?1:-1}))}))}selectInitialTab(){let e,t,n="standard";x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"get",data:{id:this.props.match.params.id}}).done((r=>{e=r.data.type,t=r.data.options,"automatic"===e&&(e=r.data.options.group||e),window.mailpoet_newsletters_templates_recently_sent_count?n="recent":w.ZP.findWhere(gt,{name:r.data.type})?n=r.data.type:"automatic"===r.data.type&&w.ZP.findWhere(gt,{name:r.data.options.group})&&(n=r.data.options.group)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,_.jsx)("p",{children:e.message},e.message))),{scroll:!0})})).always((()=>{this.setState({templates:this.templates,emailType:e,emailOptions:t,selectedTab:n,loading:!1})}))}afterTemplateDelete(e,t){e&&Object.keys(this.templates).forEach((e=>{this.templates[e]=this.templates[e].filter((e=>e.id!==t))})),this.setState({templates:this.templates,loading:!1})}afterTemplateSelect(e,t){e?window.location=(e=>`admin.php?page=mailpoet-newsletter-editor&id=${e}`)(t):this.setState({loading:!1})}afterTemplateImport(e,t){e&&this.addTemplate(t),this.setState({templates:this.templates,selectedTab:e?"saved":"import",loading:!1})}render(){if(this.state.loading)return(0,_.jsx)(Ce.g,{});const e=gt.concat({name:"import",label:x.x.I18n.t("tabImportTitle")}).map((e=>Object.assign(e,{automationId:`templates-${e.name.replace(/\s+/g,"-").toLowerCase()}`})));let t=null;if("import"===this.state.selectedTab)t=(0,_.jsx)(ft,{beforeImport:()=>this.setState({loading:!0}),afterImport:this.afterTemplateImport});else{let e=this.state.templates[this.state.selectedTab]||[];e=0===e.length?this.state.loading?null:(0,_.jsx)("p",{children:x.x.I18n.t("noTemplates")}):e.map(((e,t)=>(0,_.jsx)(ht,{index:t,newsletterId:this.props.match.params.id,beforeDelete:()=>this.setState({loading:!0}),afterDelete:this.afterTemplateDelete,beforeSelect:()=>this.setState({loading:!0}),afterSelect:this.afterTemplateSelect,id:e.id,name:e.name,thumbnail:e.thumbnail,readonly:e.readonly},e.id))),t=e}let n,r=null;if("automation"===this.state.emailType){var a;const e=null===(a=this.state.emailOptions)||void 0===a?void 0:a.automationId,t=e?`admin.php?page=mailpoet-automation-editor&id=${e}`:"admin.php?page=mailpoet-automation";n=()=>{window.location=t},r=(0,_.jsx)("input",{type:"button",className:"button link-button",onClick:n,value:"Cancel"})}return(0,_.jsxs)("div",{children:[(0,_.jsx)(Q.A,{color:"#fff"}),(0,_.jsx)(ut,{emailType:this.state.emailType,automationId:"email_template_selection_heading",buttons:r,onLogoClick:n}),(0,_.jsxs)("div",{className:"mailpoet-templates",children:[(0,_.jsx)(ct.R,{categories:e,active:this.state.selectedTab,onSelect:e=>this.setState({selectedTab:e})}),t]})]})}}xt.contextType=Te.k,xt.propTypes={match:h().shape({params:h().shape({id:h().string}).isRequired}).isRequired};var vt=n(61888),bt=n.n(vt),yt=n(88245),wt=n.n(yt),_t=n(69229),jt=n(15325),St=n.n(jt),It=n(60016),Ct=n(29514),Tt=n.n(Ct);function kt(e){let{dimension:t,isFullWidth:n,iconStart:r,iconEnd:a,...s}=e;return(0,_.jsxs)("div",{className:d()("mailpoet-datepicker mailpoet-form-input",{[`mailpoet-form-input-${t}`]:t,"mailpoet-disabled":s.disabled,"mailpoet-full-width":n}),children:[r,(0,_.jsx)(St(),{useWeekdaysShort:!0,calendarStartDay:s.calendarStartDay??x.x.wpWeekStartsOn,...s}),a]})}const Nt={abbreviated:[x.x.I18n.t("januaryShort"),x.x.I18n.t("februaryShort"),x.x.I18n.t("marchShort"),x.x.I18n.t("aprilShort"),x.x.I18n.t("mayShort"),x.x.I18n.t("juneShort"),x.x.I18n.t("julyShort"),x.x.I18n.t("augustShort"),x.x.I18n.t("septemberShort"),x.x.I18n.t("octoberShort"),x.x.I18n.t("novemberShort"),x.x.I18n.t("decemberShort")],wide:[x.x.I18n.t("january"),x.x.I18n.t("february"),x.x.I18n.t("march"),x.x.I18n.t("april"),x.x.I18n.t("may"),x.x.I18n.t("june"),x.x.I18n.t("july"),x.x.I18n.t("august"),x.x.I18n.t("september"),x.x.I18n.t("october"),x.x.I18n.t("november"),x.x.I18n.t("december")]},Dt={narrow:[x.x.I18n.t("sundayMin"),x.x.I18n.t("mondayMin"),x.x.I18n.t("tuesdayMin"),x.x.I18n.t("wednesdayMin"),x.x.I18n.t("thursdayMin"),x.x.I18n.t("fridayMin"),x.x.I18n.t("saturdayMin")],abbreviated:[x.x.I18n.t("sundayShort"),x.x.I18n.t("mondayShort"),x.x.I18n.t("tuesdayShort"),x.x.I18n.t("wednesdayShort"),x.x.I18n.t("thursdayShort"),x.x.I18n.t("fridayShort"),x.x.I18n.t("saturdayShort")],wide:[x.x.I18n.t("sunday"),x.x.I18n.t("monday"),x.x.I18n.t("tuesday"),x.x.I18n.t("wednesday"),x.x.I18n.t("thursday"),x.x.I18n.t("friday"),x.x.I18n.t("saturday")]};It.Z.localize.month=Tt()({values:Nt,defaultWidth:"wide"}),It.Z.localize.day=Tt()({values:Dt,defaultWidth:"wide"}),It.Z.options.weekStartsOn=void 0!==x.x.wpWeekStartsOn?x.x.wpWeekStartsOn:1,(0,jt.registerLocale)("mailpoet",It.Z);class Et extends y.Component{constructor(){super(...arguments),(0,b.Z)(this,"onChange",((e,t)=>{const n=t,r=this.getStorageDate(e);n.target.name=this.getFieldName(),n.target.value=r,this.props.onChange(n)})),(0,b.Z)(this,"getFieldName",(()=>this.props.name||"date")),(0,b.Z)(this,"getDisplayDateFormat",(e=>x.x.Date.convertFormat(e).replace(/D/g,"d").replace(/Y/g,"y").replace(/\[/g,"").replace(/\]/g,""))),(0,b.Z)(this,"getDate",(e=>{const t={parseFormat:this.props.storageFormat};return x.x.Date.toDate(e,t)})),(0,b.Z)(this,"getStorageDate",(e=>{const t={format:this.props.storageFormat};return x.x.Date.format(e,t)}))}render(){return(0,_.jsx)(kt,{name:this.getFieldName(),selected:this.getDate(this.props.value),dateFormat:this.getDisplayDateFormat(this.props.displayFormat),disabled:this.props.disabled,onChange:this.onChange,minDate:this.getDate(window.mailpoet_current_date),maxDate:this.props.maxDate,locale:"mailpoet",...this.props.validation})}}Et.propTypes={displayFormat:h().string.isRequired,onChange:h().func.isRequired,name:h().string,storageFormat:h().string.isRequired,value:h().string.isRequired,disabled:h().bool.isRequired,validation:h().shape({"data-parsley-required":h().bool,"data-parsley-required-message":h().string,"data-parsley-type":h().string,"data-parsley-errors-container":h().string,maxLength:h().number}).isRequired,maxDate:h().instanceOf(Date)},Et.defaultProps={name:"date",maxDate:null};class At extends y.Component{render(){const e=Object.keys(this.props.timeOfDayItems).map((e=>(0,_.jsx)("option",{value:e,children:this.props.timeOfDayItems[e]},`option-${this.props.timeOfDayItems[e]}`)));return(0,_.jsx)(ae.Select,{name:this.props.name||"time",value:this.props.value,disabled:this.props.disabled,onChange:this.props.onChange,isMinWidth:!0,...this.props.validation,children:e})}}At.propTypes={timeOfDayItems:h().objectOf(h().string).isRequired,name:h().string,value:h().string.isRequired,disabled:h().bool,onChange:h().func.isRequired,validation:h().object},At.defaultProps={name:"time",disabled:!1,validation:{}};class Ot extends y.Component{constructor(e){super(e),(0,b.Z)(this,"DATE_TIME_SEPARATOR"," "),(0,b.Z)(this,"getDateTime",(()=>[this.state.date,this.state.time].join(this.DATE_TIME_SEPARATOR))),(0,b.Z)(this,"buildStateFromProps",(e=>{const t=e.value||this.props.defaultDateTime,[n,r]=t.split(this.DATE_TIME_SEPARATOR);return{date:n,time:r}})),(0,b.Z)(this,"handleChange",(e=>{const t={};t[e.target.name]=e.target.value,this.setState(t,this.propagateChange)})),(0,b.Z)(this,"propagateChange",(()=>{this.props.onChange&&this.props.onChange({target:{name:this.props.name||"",value:this.getDateTime()}})})),this.state=this.buildStateFromProps(e)}componentDidUpdate(e){this.props.value===e.value&&this.props.defaultDateTime===e.defaultDateTime||J()((()=>{this.setState(this.buildStateFromProps(this.props))}))}render(){return(0,_.jsxs)(_t.Grid.Column,{className:"mailpoet-datetime-container",children:[(0,_.jsx)(Et,{name:"date",value:this.state.date,onChange:this.handleChange,displayFormat:this.props.dateDisplayFormat,storageFormat:this.props.dateStorageFormat,disabled:this.props.disabled,validation:this.props.dateValidation,maxDate:this.props.maxDate}),(0,_.jsx)(At,{name:"time",value:this.state.time,onChange:this.handleChange,disabled:this.props.disabled,validation:this.props.timeValidation,timeOfDayItems:this.props.timeOfDayItems})]})}}Ot.propTypes={value:h().string,defaultDateTime:h().string.isRequired,dateDisplayFormat:h().string.isRequired,dateStorageFormat:h().string.isRequired,onChange:h().func,name:h().string,disabled:h().bool,dateValidation:h().object.isRequired,timeValidation:h().any,timeOfDayItems:h().objectOf(h().string).isRequired,maxDate:h().instanceOf(Date)},Ot.defaultProps={onChange:void 0,name:"",disabled:!1,timeValidation:void 0,value:void 0,maxDate:null};var Rt=n(78046),Pt=n(38332),Mt=n(1057),Lt=n(61445);class Ft extends y.Component{constructor(e){super(e),(0,b.Z)(this,"isEmailAddressAuthorized",(e=>(window.mailpoet_authorized_emails||[]).includes(e))),(0,b.Z)(this,"showInvalidFromAddressError",(()=>{(0,Pt.Ib)(this.domElementSelector,this.parsleyFieldName," "),this.setState({showAuthEmailsError:!0})})),(0,b.Z)(this,"showSenderFieldError",((e,t)=>{window.mailpoet_mss_active&&((0,Pt.dy)(this.domElementSelector,this.parsleyFieldName),(0,Pt.K0)(this.domElementSelector)?e||this.showInvalidFromAddressError(t):(0,Pt.OP)(this.domElementSelector))})),(0,b.Z)(this,"showSenderDomainError",(e=>{e&&this.setState({showSenderDomainWarning:!0})})),this.state={emailAddress:e.item.sender_address,showSenderDomainWarning:!1,showAuthEmailsError:!1},this.onChange=this.onChange.bind(this),this.onBlur=this.onBlur.bind(this),window.mailpoet_sender_address_field_blur=this.onBlur;const t=e.field.id||`field_${e.field.name}`;this.domElementSelector=`#${t}`,this.parsleyFieldName="invalidFromAddress"}componentDidMount(){this.validateEmailAddress()}onChange(e){const t=e.target.value.toLowerCase();this.setState({emailAddress:t}),this.props.onValueChange({...e,target:{...e.target,name:e.target.name,value:t}}),this.setState({showAuthEmailsError:!1,showSenderDomainWarning:!1}),(0,Pt.dy)(this.domElementSelector,this.parsleyFieldName)}onBlur(){this.validateEmailAddress()}validateEmailAddress(){if(!window.mailpoet_mss_active)return;const e=this.state.emailAddress,t=(0,Mt.DA)(e);if(window.mailpoet_verified_sender_domains.includes(t))return;const n=this.isEmailAddressAuthorized(e);this.showSenderFieldError(n,e),x.x.freeMailDomains.indexOf(t)>-1||(0,Lt.g)(e).then((t=>{this.showSenderDomainError(t,e)})).catch((()=>{}))}render(){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(te,{item:{...this.props.item,sender_address:this.state.emailAddress},field:this.props.field,onValueChange:this.onChange,onBlurEvent:this.onBlur}),(0,_.jsx)("div",{className:"regular-text regular-text-full-width",children:(0,_.jsx)(Rt.L,{emailAddress:this.state.emailAddress,mssActive:window.mailpoet_mss_active,isEmailAuthorized:!this.state.showAuthEmailsError,showSenderDomainWarning:this.state.showSenderDomainWarning,onSuccessfulEmailOrDomainAuthorization:e=>{"email"===e.type&&(this.setState({showAuthEmailsError:!1}),x.x.trackEvent("MSS in plugin authorize email",{"authorized email source":"newsletter",wasSuccessful:"yes"})),"domain"===e.type&&(this.setState({showSenderDomainWarning:!1}),x.x.trackEvent("MSS in plugin verify sender domain",{"verify sender domain source":"newsletter",wasSuccessful:"yes"})),(0,Pt.dy)(this.domElementSelector,this.parsleyFieldName)}})})]})}}Ft.propTypes={field:h().object.isRequired,item:h().shape({sender_address:h().string.isRequired}).isRequired,onValueChange:h().func},Ft.defaultProps={onValueChange:function(){}};const qt=w.ZP.once((()=>x.x.trackEvent("User has typed a GA campaign name"))),$t=I()(x.x.I18n.t("gaCampaignTip"),/\[link\](.*?)\[\/link\]/g,((e,t)=>(0,_.jsxs)("span",{children:[(0,_.jsx)("br",{}),(0,_.jsx)("a",{href:"https://kb.mailpoet.com/article/187-track-your-newsletters-subscribers-in-google-analytics","data-beacon-article":"58b597d12c7d3a576d359144",target:"_blank",rel:"noopener noreferrer",className:"mailpoet-link",children:e})]},t))),Ut={name:"ga_campaign",label:x.x.I18n.t("gaCampaignLine"),tip:$t,type:"text",onBeforeChange:qt};var Zt=n(9134);let Vt,Wt;!function(e){e.Standard="standard",e.Automatic="automatic",e.Welcome="welcome",e.Notification="notification",e.NotificationHistory="notification_history",e.WCTransactional="wc_transactional",e.ReEngagement="re_engagement"}(Vt||(Vt={})),function(e){e.Draft="draft",e.Scheduled="scheduled",e.Sending="sending",e.Sent="sent",e.Active="active"}(Wt||(Wt={}));const Yt=window.mailpoet_current_time||"00:00",Bt=`${window.mailpoet_tomorrow_date} 08:00:00`,Ht=window.mailpoet_schedule_time_of_day,zt=window.mailpoet_date_display_format,Gt=window.mailpoet_date_storage_format;class Kt extends y.Component{constructor(){super(...arguments),(0,b.Z)(this,"getCurrentValue",(()=>{var e;return{isScheduled:"0",scheduledAt:Bt,...(null===(e=this.props.item)||void 0===e?void 0:e[this.props.field.name])??{}}})),(0,b.Z)(this,"getDateValidation",(()=>({"data-parsley-required":!0,"data-parsley-required-message":x.x.I18n.t("noScheduledDateError"),"data-parsley-errors-container":"#mailpoet_scheduling"}))),(0,b.Z)(this,"isScheduled",(()=>"1"===this.getCurrentValue().isScheduled)),(0,b.Z)(this,"handleCheckboxChange",((e,t)=>{const n={...t};n.target.value=t.target.checked?"1":"0",this.handleValueChange(n)})),(0,b.Z)(this,"handleValueChange",(e=>{const t=this.getCurrentValue(),n={};n[e.target.name]=e.target.value,this.props.onValueChange({target:{name:this.props.field.name,value:{...t,...n}}})}))}render(){let e;const t=new Date;return t.setFullYear(t.getFullYear()+5),this.isScheduled()&&(e=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("span",{className:"mailpoet-form-schedule-time",children:[x.x.I18n.t("websiteTimeIs")," ",Yt]}),(0,_.jsx)("div",{className:"mailpoet-gap"}),(0,_.jsx)("div",{id:"mailpoet_scheduling",children:(0,_.jsx)(Ot,{name:"scheduledAt",value:this.getCurrentValue().scheduledAt,onChange:this.handleValueChange,disabled:this.props.field.disabled,dateValidation:this.getDateValidation(),defaultDateTime:Bt,timeOfDayItems:Ht,dateDisplayFormat:zt,dateStorageFormat:Gt,maxDate:t})})]})),(0,_.jsxs)("div",{children:[(0,_.jsx)(Zt.Z,{checked:this.isScheduled(),disabled:this.props.field.disabled,name:"isScheduled",onCheck:this.handleCheckboxChange,automationId:"email-schedule-checkbox"}),e]})}}let Qt=[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:x.x.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:x.x.I18n.t("subjectLine"),tooltip:x.x.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":x.x.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:x.x.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:x.x.I18n.t("preheaderLine"),tooltip:`${x.x.I18n.t("preheaderLineTip1")} ${x.x.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"segments",label:x.x.I18n.t("segments"),tip:x.x.I18n.t("segmentsTip"),type:"selection",placeholder:x.x.I18n.t("selectSegmentPlaceholder"),id:"mailpoet_segments",api_version:window.mailpoet_api_version,endpoint:"segments",multiple:!0,filter:function(e){return!e.deleted_at},getLabel:function(e){return e.name},getCount:function(e){return parseInt(e.subscribers,10).toLocaleString()},transformChangedValue:function(e){const t=this.getItems()||[];return e.map((e=>t.find((t=>t.id===e))))},validation:{"data-parsley-required":!0,"data-parsley-required-message":x.x.I18n.t("noSegmentsSelectedError"),"data-parsley-segments-with-subscribers":x.x.I18n.t("noSegmentWithSubscribersSelectedError")}},{name:"options",label:x.x.I18n.t("scheduleIt"),type:"reactComponent",component:Kt},{name:"sender",label:x.x.I18n.t("sender"),tip:x.x.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:x.x.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:Ft,placeholder:x.x.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},Ut,{name:"reply-to",label:x.x.I18n.t("replyTo"),tip:x.x.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:x.x.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:x.x.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]}];Qt=Ae.Hooks.applyFilters("mailpoet_newsletters_3rd_step_fields",Qt);const Xt={getFields:()=>Qt,getSendButtonOptions:function(){var e,t;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const r=K()(window.mailpoet_current_date_time),a="object"==typeof n.options&&"1"===(null===(e=n.options)||void 0===e?void 0:e.isScheduled)&&x.x.Date.isInFuture(null===(t=n.options)||void 0===t?void 0:t.scheduledAt,r),s={value:a?x.x.I18n.t("schedule"):x.x.I18n.t("send")};return n.status!==Wt.Sent&&n.status!==Wt.Sending||(s.disabled="disabled"),s}},Jt=window.mailpoet_time_format||"H:i",en={immediate:x.x.I18n.t("delayImmediately"),hours:x.x.I18n.t("delayHoursAfter"),days:x.x.I18n.t("delayDaysAfter"),weeks:x.x.I18n.t("delayWeeksAfter")},tn={daily:x.x.I18n.t("daily"),weekly:x.x.I18n.t("weekly"),monthly:x.x.I18n.t("monthly"),nthWeekDay:x.x.I18n.t("monthlyEvery"),immediately:x.x.I18n.t("immediately")},nn=w.ZP.object(w.ZP.map(w.ZP.times(24,(e=>3600*e)),(e=>{const t=new Date(null);return t.setSeconds(e),[e,x.x.Date.format(t,{format:Jt,offset:0})]}))),rn={0:x.x.I18n.t("sunday"),1:x.x.I18n.t("monday"),2:x.x.I18n.t("tuesday"),3:x.x.I18n.t("wednesday"),4:x.x.I18n.t("thursday"),5:x.x.I18n.t("friday"),6:x.x.I18n.t("saturday")},an=w.ZP.object(w.ZP.map(w.ZP.times(28,(e=>e)),(e=>{const t={0:x.x.I18n.t("first"),1:x.x.I18n.t("second"),2:x.x.I18n.t("third")};let n;return n=void 0!==t[e]?t[e]:x.x.I18n.t("nth").replace("%1$d",e+1),[e+1,n]}))),sn={1:x.x.I18n.t("first"),2:x.x.I18n.t("second"),3:x.x.I18n.t("third"),L:x.x.I18n.t("last")},on={name:"intervalType",values:tn},ln={name:"timeOfDay",values:nn},cn={name:"weekDay",values:rn},dn={name:"monthDay",values:an},un={name:"nthWeekDay",values:sn};class pn extends y.Component{constructor(){super(...arguments),(0,b.Z)(this,"getCurrentValue",(()=>this.props.item[this.props.field.name]||{})),(0,b.Z)(this,"handleValueChanges",(e=>{const t=this.getCurrentValue();return this.props.onValueChange({target:{name:this.props.field.name,value:w.ZP.extend({},t,e)}})})),(0,b.Z)(this,"handleIntervalChange",(e=>{const t=e.target.value,n={};n.intervalType=t,"monthly"===t&&(n.monthDay="1"),this.handleValueChanges(n)})),(0,b.Z)(this,"handleTimeOfDayChange",(e=>this.handleValueChanges({timeOfDay:e.target.value}))),(0,b.Z)(this,"handleWeekDayChange",(e=>this.handleValueChanges({weekDay:e.target.value}))),(0,b.Z)(this,"handleMonthDayChange",(e=>this.handleValueChanges({monthDay:e.target.value}))),(0,b.Z)(this,"handleNthWeekDayChange",(e=>this.handleValueChanges({nthWeekDay:e.target.value})))}render(){const e=this.getCurrentValue();let t,n,r,a;return"immediately"!==e.intervalType&&(t=(0,_.jsx)(se,{field:ln,item:this.getCurrentValue(),onValueChange:this.handleTimeOfDayChange})),"weekly"!==e.intervalType&&"nthWeekDay"!==e.intervalType||(n=(0,_.jsx)(se,{field:cn,item:this.getCurrentValue(),onValueChange:this.handleWeekDayChange})),"monthly"===e.intervalType&&(r=(0,_.jsx)(se,{field:dn,item:this.getCurrentValue(),onValueChange:this.handleMonthDayChange})),"nthWeekDay"===e.intervalType&&(a=(0,_.jsx)(se,{field:un,item:this.getCurrentValue(),onValueChange:this.handleNthWeekDayChange})),(0,_.jsxs)("div",{children:[(0,_.jsxs)(_t.Grid.CenteredRow,{children:[(0,_.jsx)(se,{field:on,item:this.getCurrentValue(),onValueChange:this.handleIntervalChange,automationId:"newsletter_interval_type"}),"immediately"===e.intervalType&&(0,_.jsx)("div",{children:(0,_.jsx)("p",{children:x.x.I18n.t("postNotificationNewsletterAfterValueText")})})]}),(0,_.jsx)("div",{className:"mailpoet-gap"}),(0,_.jsxs)("div",{className:"mailpoet-grid-column mailpoet-flex",children:[a,r,n,t]}),"immediately"!==e.intervalType&&(0,_.jsx)("div",{className:"mailpoet-gap"})]})}}pn.propTypes={item:h().object.isRequired,field:h().shape({name:h().string}).isRequired,onValueChange:h().func.isRequired};let mn=[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:x.x.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:x.x.I18n.t("subjectLine"),tooltip:x.x.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":x.x.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:x.x.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:x.x.I18n.t("preheaderLine"),tooltip:`${x.x.I18n.t("preheaderLineTip1")} ${x.x.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"options",label:x.x.I18n.t("selectFrequency"),type:"reactComponent",component:pn},{name:"segments",label:x.x.I18n.t("segments"),tip:x.x.I18n.t("segmentsTip"),type:"selection",placeholder:x.x.I18n.t("selectSegmentPlaceholder"),id:"mailpoet_segments",api_version:window.mailpoet_api_version,endpoint:"segments",multiple:!0,filter:function(e){return!e.deleted_at},getLabel:function(e){return e.name},getCount:function(e){return parseInt(e.subscribers,10).toLocaleString()},transformChangedValue:function(e){const t=this.getItems();return w.ZP.map(e,(e=>w.ZP.find(t,(t=>t.id===e))))},validation:{"data-parsley-required":!0,"data-parsley-required-message":x.x.I18n.t("noSegmentsSelectedError")}},{name:"sender",label:x.x.I18n.t("sender"),tip:x.x.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:x.x.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:Ft,placeholder:x.x.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},Ut,{name:"reply-to",label:x.x.I18n.t("replyTo"),tip:x.x.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:x.x.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:x.x.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]}];mn=Ae.Hooks.applyFilters("mailpoet_newsletters_3rd_step_fields",mn);const hn={getFields:function(){return mn},getSendButtonOptions:function(){return{value:x.x.I18n.t("activate")}}},fn=window.mailpoet_roles||{},gn=w.ZP.filter(window.mailpoet_segments||[],(e=>"default"===e.type)),xn={name:"event",values:{segment:x.x.I18n.t("onSubscriptionToList"),user:x.x.I18n.t("onWPUserRegistration")}},vn={name:"segment",placeholder:x.x.I18n.t("selectSegmentPlaceholder"),forceSelect2:!0,values:gn,getCount:e=>parseInt(e.subscribers,10).toLocaleString(),getLabel:e=>e.name,getValue:e=>e.id},bn={name:"role",values:fn},yn={name:"afterTimeNumber",size:3,validation:{"data-parsley-required":!0,"data-parsley-errors-container":".mailpoet-form-errors","data-parsley-scheduled-at":x.x.I18n.t("emailCanBeScheduledUpToFiveYears")}},wn={name:"afterTimeType",values:en};class _n extends y.Component{constructor(){super(...arguments),(0,b.Z)(this,"getCurrentValue",(()=>this.props.item[this.props.field.name]||{})),(0,b.Z)(this,"handleValueChange",((e,t)=>{const n=this.getCurrentValue(),r={};let a=t;return"afterTimeNumber"===e&&(a=parseInt(t,10),a=Number.isNaN(a)?"":a),r[e]=a,this.props.onValueChange({target:{name:this.props.field.name,value:w.ZP.extend({},n,r)}})})),(0,b.Z)(this,"handleEventChange",(e=>this.handleValueChange("event",e.target.value))),(0,b.Z)(this,"handleSegmentChange",(e=>this.handleValueChange("segment",e.target.value))),(0,b.Z)(this,"handleRoleChange",(e=>this.handleValueChange("role",e.target.value))),(0,b.Z)(this,"handleAfterTimeNumberChange",(e=>this.handleValueChange("afterTimeNumber",e.target.value))),(0,b.Z)(this,"handleAfterTimeTypeChange",(e=>this.handleValueChange("afterTimeType",e.target.value)))}render(){const e=this.getCurrentValue();let t,n;return t="user"===e.event?(0,_.jsx)(se,{field:bn,item:this.getCurrentValue(),onValueChange:this.handleRoleChange}):(0,_.jsx)(j,{field:vn,item:this.getCurrentValue(),onValueChange:this.handleSegmentChange}),"immediate"!==e.afterTimeType&&(n=(0,_.jsx)(te,{field:yn,item:this.getCurrentValue(),onValueChange:this.handleAfterTimeNumberChange})),(0,_.jsxs)("div",{children:[(0,_.jsx)(se,{field:xn,item:this.getCurrentValue(),onValueChange:this.handleEventChange}),(0,_.jsx)("div",{className:"mailpoet-gap"}),t,(0,_.jsx)("div",{className:"mailpoet-gap"}),(0,_.jsxs)("div",{className:"mailpoet-grid-column mailpoet-flex",children:[n,(0,_.jsx)(se,{field:wn,item:this.getCurrentValue(),onValueChange:this.handleAfterTimeTypeChange})]}),(0,_.jsx)("div",{className:"mailpoet-form-errors"}),(0,_.jsx)("div",{className:"mailpoet-gap"})]})}}_n.propTypes={history:h().shape({push:h().func.isRequired}).isRequired,item:h().object.isRequired,field:h().shape({name:h().string}).isRequired,onValueChange:h().func.isRequired};const jn=(0,l.EN)(_n);let Sn=[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:x.x.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:x.x.I18n.t("subjectLine"),tooltip:x.x.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":x.x.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:x.x.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:x.x.I18n.t("preheaderLine"),tooltip:`${x.x.I18n.t("preheaderLineTip1")} ${x.x.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"options",label:x.x.I18n.t("selectEventToSendWelcomeEmail"),type:"reactComponent",component:jn},Ut,{name:"sender",label:x.x.I18n.t("sender"),tip:x.x.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:x.x.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:Ft,placeholder:x.x.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},{name:"empty",type:"empty"},{name:"reply-to",label:x.x.I18n.t("replyTo"),tip:x.x.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:x.x.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:x.x.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]}];Sn=Ae.Hooks.applyFilters("mailpoet_newsletters_3rd_step_fields",Sn);const In={getFields:function(){return Sn},getSendButtonOptions:function(){return{value:x.x.I18n.t("activate")}}};class Cn extends y.Component{constructor(e){super(e);const{item:t,event:n}=this.props;this.handleChange=this.handleChange.bind(this);const r=t.afterTimeType||n.defaultAfterTimeType||"immediate",a="minutes"===r?30:1,s=t.afterTimeNumber||a;this.state={afterTimeType:r,afterTimeNumber:s},t.afterTimeNumber===s&&t.afterTimeType===r||this.propagateChange(this.state)}handleChange(e,t){let{value:n}=e.target;"afterTimeNumber"===t&&(n=parseInt(e.target.value,10),n=Number.isNaN(n)?null:n);const r={[t]:n},{afterTimeType:a}=this.state;"afterTimeType"===t&&a!==n&&("minutes"===a&&(r.afterTimeNumber=1),"minutes"===n&&(r.afterTimeNumber=30)),this.setState(r,this.propagateChange(r))}displayAfterTimeTypeOptions(){const{event:e}=this.props;let t=en;e.timeDelayValues&&(t=Object.entries(e.timeDelayValues).reduce(((e,t)=>{let[n,r]=t;return e[n]=r.text,e}),{}));const{afterTimeType:n}=this.state,r={field:{id:"scheduling_time_interval",name:"scheduling_time_interval",forceSelect2:!0,values:w.ZP.map(t,((e,t)=>({name:e,id:t}))),extendSelect2Options:{minimumResultsForSearch:1/0},selected:()=>n},onValueChange:w.ZP.partial(this.handleChange,w.ZP,"afterTimeType")};return(0,_.jsx)(j,{field:r.field,onValueChange:r.onValueChange})}displayAfterTimeNumberField(){const{afterTimeNumberSize:e,event:t}=this.props,{afterTimeType:n,afterTimeNumber:r}=this.state;if("immediate"===n)return null;if(t.timeDelayValues&&t.timeDelayValues[n]&&!t.timeDelayValues[n].displayAfterTimeNumberField)return null;const a={field:{id:"scheduling_time_duration",name:"scheduling_time_duration",defaultValue:r?r.toString():"",size:e,validation:{"data-parsley-required":!0,"data-parsley-errors-container":".mailpoet-form-errors","data-parsley-scheduled-at":x.x.I18n.t("emailCanBeScheduledUpToFiveYears")}},item:{},onValueChange:w.ZP.partial(this.handleChange,w.ZP,"afterTimeNumber")};return(0,_.jsx)(te,{field:a.field,item:a.item,onValueChange:a.onValueChange})}propagateChange(e){const{onValueChange:t}=this.props;t&&t(e)}render(){const{event:e}=this.props;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("h4",{children:[" ",x.x.I18n.t("whenToSendMail")," "]}),(0,_.jsxs)(_t.Grid.CenteredRow,{className:"mailpoet-re-engagement-scheduling",children:[this.displayAfterTimeNumberField(),this.displayAfterTimeTypeOptions(),e.afterDelayText&&(0,_.jsx)("p",{children:e.afterDelayText})]}),(0,_.jsx)("div",{className:"mailpoet-form-errors"}),(0,_.jsx)("div",{className:"mailpoet-gap"}),e.schedulingReadMoreLink&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("a",{href:e.schedulingReadMoreLink.link,target:"_blank",rel:"noopener noreferrer",className:"event-scheduling-read-more-link",children:e.schedulingReadMoreLink.text}),(0,_.jsx)("div",{className:"mailpoet-gap"})]})]})}}function Tn(e){const t=e&&e.values?e.values:[];return t?t.map((e=>({id:e.id,name:e.name}))):t}function kn(e){let{eventOptions:t,eventSlug:n,selected:r,onValueChange:a}=e;function s(e){a&&a({eventOptionValue:e.target.value})}return(0,_.jsx)("div",{children:(0,_.jsx)("div",{className:"event-option-selection",children:function(){if(!t)return t;const e={field:{name:`event_options_${n}`,forceSelect2:!0,endpoint:t.endpoint,resetSelect2OnUpdate:!0,values:Tn(t),multiple:t.multiple||!1,placeholder:t.placeholder||!1,transformChangedValue:(e,t)=>w.ZP.map(t,(e=>({id:e.id,name:e.text}))),selected:()=>r,getLabel:w.ZP.property("name"),getValue:w.ZP.property("id"),validation:{"data-parsley-required":!0}},onValueChange:s,item:{action:""}};return"product_categories"===t.endpoint&&(e.field.name="category_ids",e.item={action:"purchasedCategory"}),"products"===t.endpoint&&(e.field.name="product_ids",e.item={action:"purchasedProduct"}),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(j,{field:e.field,onValueChange:e.onValueChange,item:e.item}),(0,_.jsx)("div",{className:"mailpoet-gap"})]})}()})})}Cn.propTypes={item:h().shape({afterTimeType:h().string.isRequired,afterTimeNumber:h().number}).isRequired,afterTimeNumberSize:h().number,onValueChange:h().func,event:h().shape({defaultAfterTimeType:h().string,afterDelayText:h().string,timeDelayValues:h().objectOf(h().shape({text:h().string,displayAfterTimeNumberField:h().bool})),schedulingReadMoreLink:h().shape({link:h().string.isRequired,text:h().string.isRequired})}).isRequired},Cn.defaultProps={afterTimeNumberSize:3,onValueChange:null};class Nn extends y.Component{constructor(e){super(e);const{field:t}=e;this.handleChange=this.handleChange.bind(this),this.email=t.email,this.emailOptions=t.emailOptions,this.events=w.ZP.indexBy(this.email.events,"slug"),this.segments=w.ZP.filter(window.mailpoet_segments,(e=>null===e.deleted_at));const n=this.events[this.emailOptions.event],r=this.emailOptions.afterTimeType||n.defaultAfterTimeType||"immediate";this.state={event:n,afterTimeType:r,eventSlug:this.emailOptions.event,eventOptionValue:null,afterTimeNumber:this.emailOptions.afterTimeNumber||1,segment:this.emailOptions.segment?this.emailOptions.segment:null}}handleChange(e){const{afterTimeNumber:t}=this.state,n=e;n.afterTimeType&&"immediate"===n.afterTimeType?n.afterTimeNumber=null:!n.afterTimeType||n.afterTimeNumber||t||(n.afterTimeNumber=1),this.setState(e,this.propagateChange)}displayScheduling(){const{afterTimeNumber:e,afterTimeType:t,event:n}=this.state,r={item:{afterTimeNumber:e,afterTimeType:t},event:n,onValueChange:this.handleChange};return(0,_.jsx)(Cn,{item:r.item,event:r.event,onValueChange:r.onValueChange})}displaySegments(){const{segment:e}=this.state;if("user"===this.emailOptions.sendTo)return null;const t={field:{id:"segments",forceSelect2:!0,values:this.segments,extendSelect2Options:{minimumResultsForSearch:1/0},selected:()=>e},onValueChange:e=>this.handleChange({segment:e.target.value})};return(0,_.jsx)("div",{className:"event-segment-selection",children:(0,_.jsx)(j,{field:t.field,onValueChange:t.onValueChange})})}displayEventOptions(){const{event:e,eventSlug:t}=this.state;let n;try{n=JSON.parse(this.emailOptions.meta||null)}catch(e){n=this.emailOptions.meta||null}const r={emailSlug:this.email.slug,eventSlug:t,onValueChange:this.handleChange,eventOptions:e.options||null};return n&&n.option&&("remote"===r.eventOptions.type&&(r.eventOptions.values=n.option),r.selected=w.ZP.map(n.option,(e=>e.id))),(0,_.jsx)(kn,{emailSlug:r.emailSlug,eventSlug:r.eventSlug,eventOptions:r.eventOptions,onValueChange:r.onValueChange,selected:r.selected})}displayHeader(){const{event:e}=this.state;return e.title}propagateChange(){const{eventSlug:e,afterTimeType:t,afterTimeNumber:n,segment:r,eventOptionValue:a}=this.state,{onValueChange:s}=this.props;if(!s)return;const i={group:this.email.slug,event:e,afterTimeType:t};n&&(i.afterTimeNumber=n),r&&(i.segment=r),a&&(i.meta=JSON.stringify({option:this.state.eventOptionValue})),s({target:{name:"options",value:i}})}render(){return(0,_.jsxs)("div",{children:[(0,_.jsx)(he.X,{level:5,children:this.displayHeader()}),this.displayEventOptions(),this.displaySegments(),this.displayScheduling()]})}}Nn.propTypes={field:h().shape({email:h().shape({events:h().object.isRequired}).isRequired,emailOptions:h().object.isRequired}).isRequired,onValueChange:h().func},Nn.defaultProps={onValueChange:null};const Dn=window.mailpoet_woocommerce_automatic_emails||[],En={getFields:function(e){return(e=>{const t=Dn[e.options.group];if(!t)return!1;const n=e.options;return[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:x.x.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:x.x.I18n.t("subjectLine"),tooltip:x.x.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":x.x.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:x.x.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:x.x.I18n.t("preheaderLine"),tooltip:`${x.x.I18n.t("preheaderLineTip1")} ${x.x.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"options",label:x.x.I18n.t("sendAutomaticEmailWhenHeading").replace("%1s",t.title),type:"reactComponent",component:Nn,email:t,emailOptions:n},Ut,{name:"sender",label:x.x.I18n.t("sender"),tip:x.x.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:x.x.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"text",placeholder:x.x.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},{name:"empty",type:"empty"},{name:"reply-to",label:x.x.I18n.t("replyTo"),tip:x.x.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:x.x.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:x.x.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]}]})(e)},getSendButtonOptions:function(){return{value:x.x.I18n.t("activate")}}};var An=n(30211);function On(e){let{afterTimeNumber:t,afterTimeType:n,updateAfterTimeNumber:r,updateAfterTimeType:a,inactiveSubscribersPeriod:s}=e;const i="weeks"===n?7:30,o=Number(t)*i;let l=s;return 365===s&&(l=360),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(he.X,{level:4,children:x.x.I18n.t("selectEventToSendReEngagementEmail")}),(0,_.jsxs)(_t.Grid.CenteredRow,{className:"mailpoet-re-engagement-scheduling",children:[(0,_.jsx)("p",{children:x.x.I18n.t("reEngagementTextPre")}),(0,_.jsx)(ee.I,{type:"text",placeholder:x.x.I18n.t("reEngagementAterTimeNumberPlaceholder"),value:t,onChange:(0,Mt.z2)(r)}),(0,_.jsxs)(ae.Select,{value:n,onChange:(0,Mt.z2)(a),children:[(0,_.jsx)("option",{value:"weeks",children:"weeks"}),(0,_.jsx)("option",{value:"months",children:"months"})]})]}),!!s&&l<=o&&(0,_.jsx)("p",{className:"mailpoet-re-engagement-scheduling-note",children:I()(x.x.I18n.t("reEngagementEmailWarning").replace("{$months}",`${Math.floor(s/30)}`),/\[link\](.*?)\[\/link\]/g,(e=>(0,_.jsx)("a",{href:"https://kb.mailpoet.com/article/264-inactive-subscribers",target:"_blank",rel:"noopener noreferrer","data-beacon-article":"5cbf19622c7d3a026fd3efe1",children:e},"link")))})]})}const Rn=[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:x.x.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:x.x.I18n.t("subjectLine"),tooltip:x.x.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":x.x.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:x.x.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:x.x.I18n.t("preheaderLine"),tooltip:`${x.x.I18n.t("preheaderLineTip1")} ${x.x.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"options",type:"reactComponent",component:function(e){return(0,_.jsx)(On,{afterTimeNumber:e.item.options.afterTimeNumber.toString(),afterTimeType:e.item.options.afterTimeType,inactiveSubscribersPeriod:Number(x.x.deactivateSubscriberAfterInactiveDays),updateAfterTimeNumber:t=>{e.onValueChange({target:{name:"options",value:(0,An.assoc)("afterTimeNumber",t,e.item.options)}})},updateAfterTimeType:t=>{e.onValueChange({target:{name:"options",value:(0,An.assoc)("afterTimeType",t,e.item.options)}})}})}},{name:"segments",label:x.x.I18n.t("segments"),tip:x.x.I18n.t("segmentsTip"),type:"selection",placeholder:x.x.I18n.t("selectSegmentPlaceholder"),id:"mailpoet_segments",api_version:x.x.apiVersion,endpoint:"segments",multiple:!0,filter:function(e){return!e.deleted_at&&"dynamic"!==e.type},getLabel:function(e){return e.name},getCount:function(e){return parseInt(e.subscribers,10).toLocaleString()},transformChangedValue:function(e){const t=this.getItems();return(0,An.map)((e=>(0,An.find)((t=>t.id===e),t)),e)},validation:{"data-parsley-required":!0,"data-parsley-required-message":x.x.I18n.t("noSegmentsSelectedError")}},{name:"sender",label:x.x.I18n.t("sender"),tip:x.x.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:x.x.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:Ft,placeholder:x.x.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},{name:"reply-to",label:x.x.I18n.t("replyTo"),tip:x.x.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:x.x.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:x.x.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]},Ut],Pn={getFields:()=>Rn,getSendButtonOptions:()=>({value:x.x.I18n.t("activate")})};var Mn=n(1740);let Ln=null;var Fn=n(33357);const qn=window.mailpoet_woocommerce_automatic_emails||[],$n=(e,t)=>`${wt()(t,{strict:!0,lower:!0})||"email"}-${e}`,Un=e=>"immediate"===e.afterTimeType?"immediate":`${e.afterTimeNumber} ${e.afterTimeType}`;function Zn(e){let t,n;return e&&e.body&&e.body.content&&(n=e.body.content,t=JSON.stringify(e.body.content),!n.blocks||!Array.isArray(n.blocks)||0===n.blocks.length)?x.x.I18n.t("newsletterIsEmpty"):window.mailpoet_mss_active&&t.indexOf("[link:subscription_unsubscribe_url]")<0&&t.indexOf("[link:subscription_unsubscribe]")<0?x.x.I18n.t("unsubscribeLinkMissing"):"re_engagement"===e.type&&t.indexOf("[link:subscription_re_engage_url]")<0?x.x.I18n.t("reEngageLinkMissing"):"notification"===e.type&&t.indexOf('"type":"automatedLatestContent"')<0&&t.indexOf('"type":"automatedLatestContentLayout"')<0?x.x.I18n.t("automatedLatestContentMissing"):"standard"===e.type&&"sent"===e.status?x.x.I18n.t("emailAlreadySent"):"re_engagement"!==e.type||x.x.trackingConfig.emailTrackingEnabled?void 0:(0,_.jsx)("span",{style:{pointerEvents:"all"},children:I()(x.x.I18n.t("reEngagementEmailsDisableIfTrackingIs"),/\[link\](.*?)\[\/link\]/g,(e=>(0,_.jsx)("a",{href:"?page=mailpoet-settings#/advanced",rel:"noopener noreferrer",children:e},"advancedSettingsTabLink")))})}class Vn extends y.Component{constructor(e){super(e),(0,b.Z)(this,"getFieldsByNewsletter",(e=>this.getSubtype(e).getFields(e))),(0,b.Z)(this,"getSendButtonOptions",(()=>this.getSubtype(this.state.item).getSendButtonOptions(this.state.item))),(0,b.Z)(this,"getSubtype",(e=>{switch(e.type){case"notification":return hn;case"welcome":return In;case"re_engagement":return Pn;case"automatic":if(qn[e.options.group])return En;default:return Xt}})),(0,b.Z)(this,"getThumbnailPromise",(e=>this.state.thumbnailPromise?this.state.thumbnailPromise:(0,Mn.W0)(e))),(0,b.Z)(this,"isValid",(()=>p()("#mailpoet_newsletter").parsley().isValid())),(0,b.Z)(this,"isValidFromAddress",(async()=>{if("MailPoet"!==window.mailpoet_mta_method)return!0;const e=await this.loadVerifiedSenderDomains(),t=(0,Mt.DA)(this.state.item.sender_address);if(-1!==e.indexOf(t))return!0;const n=await this.loadAuthorizedEmailAddresses(),r=this.state.item.sender_address;return-1!==n.indexOf(r)})),(0,b.Z)(this,"isGaFieldDisabled",(()=>!window.mailpoet_premium_active)),(0,b.Z)(this,"loadItem",(e=>(this.setState({loading:!0}),x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"get",data:{id:e}}).done((e=>{const t="draft"===e.data.status?this.getThumbnailPromise(e.meta.preview_url):null,n=e.data;if("automation"===n.type){var r;const e=null===(r=n.options)||void 0===r?void 0:r.automationId,t=e?`admin.php?page=mailpoet-automation-editor&id=${e}`:"/new";return this.setState({item:{}},(()=>{this.props.history.push(t)}))}return n.ga_campaign||this.isGaFieldDisabled()||(n.ga_campaign=$n(n.id,n.subject)),this.setState({item:e.data,fields:this.getFieldsByNewsletter(e.data),thumbnailPromise:t,validationError:Zn(e.data)}),!0})).fail((()=>{this.setState({item:{}},(()=>{this.props.history.push("/new")}))}))))),(0,b.Z)(this,"saveTemplate",((e,t)=>{this.getThumbnailPromise(e.meta.preview_url).then((n=>{x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"save",data:{newsletter_id:e.data.id,name:e.data.subject,thumbnail_data:n,body:JSON.stringify(e.data.body),categories:'["recent"]'}}).fail((e=>{this.showError(e),this.setState({loading:!1}),x.x.Modal.loading(!1)})),t()})).catch((e=>{this.showError({errors:[e]})}))})),(0,b.Z)(this,"loadAuthorizedEmailAddresses",(async()=>{if("MailPoet"!==window.mailpoet_mta_method)return[];const e=(await x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"mailer",action:"getAuthorizedEmailAddresses"})).data||[];return window.mailpoet_authorized_emails=e,e})),(0,b.Z)(this,"loadVerifiedSenderDomains",(async()=>"MailPoet"!==window.mailpoet_mta_method?[]:(await x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"mailer",action:"getVerifiedSenderDomains"})).data||[])),(0,b.Z)(this,"handleSend",(e=>(e.preventDefault(),this.isValid()?(x.x.Modal.loading(!0),this.isValidFromAddress().then((t=>t?this.saveNewsletter(e).done((()=>{this.setState({loading:!0})})).done((e=>{switch(e.data.type){case"notification":case"welcome":case"automatic":case"re_engagement":return this.activateNewsletter(e);default:return this.sendNewsletter(e)}})).fail((e=>{this.showError(e),this.setState({loading:!1}),x.x.Modal.loading(!1)})):(window.mailpoet_sender_address_field_blur(),x.x.Modal.loading(!1))))):p()("#mailpoet_newsletter").parsley().validate()))),(0,b.Z)(this,"sendNewsletter",(e=>x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sendingQueue",action:"add",data:{newsletter_id:this.state.item.id}}).done((t=>{this.saveTemplate(e,(()=>{if(window.mailpoet_show_congratulate_after_first_newsletter)return x.x.Modal.loading(!1),void this.props.history.push(`/send/congratulate/${this.state.item.id}`);this.props.history.push(`/${this.state.item.type||""}`);let n=[];e.data.segments.map((e=>n.push(...e.filters))),n=bt().uniqWith(n,((e,t)=>e.action===t.action&&e.type===t.type));const r=n.map((e=>function(e){const t=e.action,n=e.type;if("email"===n)switch(t){case"machineOpensAbsoluteCount":return"# of machine-opens";case"opensAbsoluteCount":return"# of opens";case"numberOfOrders":return"# of orders";case"clicked":return"clicked";case"clickedAny":return"clicked any email";case"opened":return"opened";case"machineOpened":return"machine-opened";default:return""}if("userRole"===n)switch(t){case"subscriberTag":return"subscriber tags";case"subscribedToList":return"subscribed to list";case"subscriberScore":return"score";case"wordpressRole":return"WordPress user role";case"mailpoetCustomField":return"MailPoet custom field";default:return""}if("woocommerce"===n)switch(t){case"customerInCountry":return"is in country";case"purchasedCategory":return"purchased in category";case"purchasedProduct":return"purchased product";case"subscribedDate":return"subscribed date";case"totalSpent":return"total spent";default:return""}return"woocommerceSubscription"===n&&"hasActiveSubscription"===t?"has an active subscription":"woocommerceMembership"===n&&"isMemberOf"===t?"is active member of":""}(e))).join(", ");"scheduled"===t.data.status?(this.context.notices.success((0,_.jsx)("p",{children:x.x.I18n.t("newsletterHasBeenScheduled")})),x.x.trackEvent("Emails > Newsletter sent",{scheduled:!0,segments:r})):(this.context.notices.success((0,_.jsx)("p",{children:x.x.I18n.t("newsletterBeingSent")}),{id:"mailpoet_notice_being_sent"}),x.x.trackEvent("Emails > Newsletter sent",{scheduled:!1,segments:r})),x.x.Modal.loading(!1)}))})).fail((e=>{this.showError(e),this.setState({loading:!1}),x.x.Modal.loading(!1)})))),(0,b.Z)(this,"activateNewsletter",(e=>x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"setStatus",data:{id:this.props.match.params.id,status:"active"}}).done((t=>{this.saveTemplate(e,(()=>{if(window.mailpoet_show_congratulate_after_first_newsletter)return x.x.Modal.loading(!1),void this.props.history.push(`/send/congratulate/${this.state.item.id}`);const e=this.state.item.options;this.props.history.push("automatic"===this.state.item.type?`/${e.group}`:`/${this.state.item.type||""}`),"automatic"===this.state.item.type&&qn[e.group]?(this.context.notices.success((0,_.jsx)("p",{children:x.x.I18n.t("automaticEmailActivated").replace("%1s",qn[e.group].title)})),x.x.trackEvent("Emails > Automatic email activated",{Type:wt()(`${e.group}-${e.event}`),Delay:Un(e)})):"welcome"===t.data.type?(this.context.notices.success((0,_.jsx)("p",{children:x.x.I18n.t("welcomeEmailActivated")})),x.x.trackEvent("Emails > Welcome email activated",{"List type":e.event,Delay:Un(e)})):"re_engagement"===t.data.type?(this.context.notices.success((0,_.jsx)("p",{children:x.x.I18n.t("reEngagementEmailActivated")})),x.x.trackEvent("Emails > Re-engagement email activated",{Inactivity:Un(e)})):"notification"===t.data.type&&(this.context.notices.success((0,_.jsx)("p",{children:x.x.I18n.t("postNotificationActivated")})),x.x.trackEvent("Emails > Post notifications activated",{Frequency:e.intervalType})),x.x.Modal.loading(!1)}))})).fail((e=>{this.showError(e),this.setState({loading:!1}),x.x.Modal.loading(!1)})))),(0,b.Z)(this,"handleResume",(e=>(e.preventDefault(),this.isValid()?this.saveNewsletter(e).done((()=>{this.setState({loading:!0})})).done((()=>{x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sendingQueue",action:"resume",data:{newsletter_id:this.state.item.id}}).done((()=>{this.props.history.push(`/${this.state.item.type||""}`),this.context.notices.success((0,_.jsx)("p",{children:x.x.I18n.t("newsletterSendingHasBeenResumed")}))})).fail((e=>{this.showError(e)}))})).fail((e=>{this.showError(e)})).always((()=>{this.setState({loading:!1})})):p()("#mailpoet_newsletter").parsley().validate(),!1))),(0,b.Z)(this,"handleSave",(e=>{e.preventDefault(),this.saveNewsletter(e).done((()=>{this.context.notices.success((0,_.jsx)("p",{children:x.x.I18n.t("newsletterUpdated")}))})).done((()=>{const e="automatic"===this.state.item.type?this.state.item.options.group:this.state.item.type;this.props.history.push(`/${e||""}`)})).fail((e=>{this.showError(e)}))})),(0,b.Z)(this,"handleRedirectToDesign",(e=>{e.preventDefault();const t=e.target.href;this.saveNewsletter(e).done((()=>{this.context.notices.success((0,_.jsx)("p",{children:x.x.I18n.t("newsletterUpdated")}))})).done((()=>{window.location=t})).fail((e=>{this.showError(e)}))})),(0,b.Z)(this,"saveNewsletter",(()=>{const e=this.state.item;e.queue=void 0,this.setState({loading:!0});const t=bt().omit(e,["body","created_at","deleted_at","hash","status","updated_at","type"]);return x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"save",data:t})})),(0,b.Z)(this,"showError",(e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,_.jsx)("p",{children:e.message},e.message))),{scroll:!0,timeout:!1})})),(0,b.Z)(this,"handleFormChange",(e=>{const t=e.target.name,n=e.target.value;return this.setState((e=>{const r=e.item,a=r.subject,s=r.ga_campaign;return r[t]=n,"subject"===t&&s===$n(r.id,a)&&(r.ga_campaign=$n(r.id,n)),"reply_to_address"===t&&(r[t]=n.toLowerCase()),{item:r}})),!0})),(0,b.Z)(this,"handleSaveDraft",(()=>{p()("#mailpoet_newsletter").parsley().destroy()})),(0,b.Z)(this,"disableSegmentsSelectorWhenPaused",(e=>t=>"segments"===t.name||"options"===t.name?{...t,disabled:e}:t)),(0,b.Z)(this,"disableGAIfPremiumInactive",(e=>t=>{if("ga_campaign"===t.name){let n=()=>{};return e()&&(n=()=>this.setState({showPremiumModal:!0})),{...t,disabled:e,onWrapperClick:n}}return t})),(0,b.Z)(this,"getPreparedFields",((e,t)=>this.state.fields.map(this.disableSegmentsSelectorWhenPaused(e)).map(this.disableGAIfPremiumInactive(t)))),(0,b.Z)(this,"closePremiumModal",(()=>this.setState({showPremiumModal:!1}))),this.state={fields:[],item:{},loading:!0,thumbnailPromise:null,showPremiumModal:!1}}componentDidMount(){this.loadItem(this.props.match.params.id).always((()=>{this.setState({loading:!1})})),p()("#mailpoet_newsletter").parsley({successClass:""})}componentDidUpdate(e){this.props.match.params.id!==e.match.params.id&&this.loadItem(this.props.match.params.id).always((()=>{this.setState({loading:!1})}))}render(){const{showPremiumModal:e,item:{status:t,queue:n,type:r,options:a}}=this.state,s="sending"===t&&n&&"paused"===n.status,i=this.getSendButtonOptions(),o=this.getPreparedFields(s,this.isGaFieldDisabled),l=!(!window.mailpoet_subscribers_limit_reached&&!window.mailpoet_mss_key_pending_approval&&void 0===this.state.validationError);let c=r;return"automatic"===c&&(c=a.group||c),(0,_.jsxs)("div",{className:"mailpoet-form-send-email",children:[(0,_.jsx)(Q.A,{color:"#fff"}),(0,_.jsx)(ut,{emailType:c,automationId:"newsletter_send_heading"}),(0,_.jsxs)(be,{id:"mailpoet_newsletter",fields:o,automationId:"newsletter_send_form",item:this.state.item,loading:this.state.loading,onChange:this.handleFormChange,onSubmit:this.handleSave,children:[(0,_.jsxs)(_t.Grid.CenteredRow,{className:"send-newsletter-buttons",children:[(0,_.jsx)(f.Button,{variant:"secondary",type:"submit",automationId:"email-save-draft",onClick:this.handleSaveDraft,isDisabled:this.state.loading,children:x.x.I18n.t("saveDraftAndClose")}),s?(0,_.jsx)(f.Button,{type:"button",onClick:this.handleResume,isDisabled:l||this.state.loading,automationId:"email-resume",children:x.x.I18n.t("resume")}):(0,_.jsx)(f.Button,{type:"button",onClick:this.handleSend,...i,isDisabled:l||this.state.loading,automationId:"email-submit",children:i.value||x.x.I18n.t("send")}),void 0!==this.state.validationError&&(0,_.jsx)(O.Tooltip,{tooltip:(0,_.jsx)("div",{children:this.state.validationError}),tooltipId:"helpTooltipSendEmail"})]}),(0,_.jsxs)("p",{children:[x.x.I18n.t("orSimply")," ",(0,_.jsx)("a",{className:"mailpoet-link",href:`?page=mailpoet-newsletter-editor&id=${this.props.match.params.id}`,onClick:this.handleRedirectToDesign,children:x.x.I18n.t("goBackToDesign")}),"."]}),window.mailpoet_mss_key_pending_approval&&(0,_.jsx)("div",{className:"mailpoet_error",children:I()(x.x.I18n.t("pendingKeyApprovalNotice"),/\[link\](.*?)\[\/link\]/g,(e=>(0,_.jsx)("a",{href:"https://account.mailpoet.com/authorization",target:"_blank",rel:"noopener noreferrer",children:e},"pendingKeyApprovalNoticeLink")))}),e&&(0,_.jsx)(Fn.Z,{onRequestClose:this.closePremiumModal,children:x.x.I18n.t("gaOnlyAvailableForPremium")})]})]})}}Vn.contextType=Te.k,Vn.propTypes={match:h().shape({params:h().shape({id:h().string}).isRequired}).isRequired,history:h().shape({push:h().func.isRequired}).isRequired};const Wn=(0,l.EN)(Vn);function Yn(e){const[t,n]=(0,y.useState)(!1);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(he.X,{level:0,children:x.x.I18n.t("congratulationsSuccessHeader")}),(0,_.jsx)(he.X,{level:3,children:(r=e.newsletter,"welcome"===r.type?x.x.I18n.t("congratulationsWelcomeEmailSuccessBody"):"notification"===r.type?x.x.I18n.t("congratulationsPostNotificationSuccessBody"):"automatic"===r.type?x.x.I18n.t("congratulationsWooSuccessBody"):"scheduled"===r.status?x.x.I18n.t("congratulationsScheduleSuccessBody"):x.x.I18n.t("congratulationsSendSuccessBody"))}),(0,_.jsx)("div",{className:"mailpoet-gap-large"}),(0,_.jsx)("div",{className:"mailpoet-gap-large"}),(0,_.jsx)("img",{src:e.illustrationImageUrl,alt:"",width:"500"}),(0,_.jsx)("div",{className:"mailpoet-gap-large"}),(0,_.jsx)(f.Button,{type:"button",dimension:"small",onClick:()=>{e.successClicked(),n(!0)},withSpinner:t,children:x.x.I18n.t("close")})]});var r}function Bn(e){return(0,_.jsxs)("div",{className:"mailpoet-wizard-step",children:[(0,_.jsx)("div",{className:"mailpoet-wizard-step-illustration",children:(0,_.jsx)("img",{src:e.illustrationUrl,width:"500",alt:""})}),(0,_.jsx)("div",{className:"mailpoet-wizard-step-content",children:e.children})]})}function Hn(e){let{children:t,isOrdered:n}=e;const r=n?"ol":"ul";return(0,_.jsx)(r,{className:`mailpoet-${r}`,children:t})}function zn(){return(0,_.jsxs)(Hn,{children:[(0,_.jsx)("li",{children:x.x.I18n.t("welcomeWizardMSSList1")}),(0,_.jsx)("li",{children:x.x.I18n.t("welcomeWizardMSSList2")}),(0,_.jsx)("li",{children:x.x.I18n.t("welcomeWizardMSSList4")}),(0,_.jsx)("li",{children:x.x.I18n.t("welcomeWizardMSSList5")})]})}function Gn(){return(0,_.jsxs)(Hn,{children:[(0,_.jsx)("li",{children:x.x.I18n.t("welcomeWizardMSSNotFreeList1")}),(0,_.jsx)("li",{children:x.x.I18n.t("welcomeWizardMSSNotFreeList2")}),(0,_.jsx)("li",{children:x.x.I18n.t("welcomeWizardMSSNotFreeList3")}),(0,_.jsx)("li",{children:x.x.I18n.t("welcomeWizardMSSNotFreeList4")}),(0,_.jsx)("li",{children:x.x.I18n.t("welcomeWizardMSSNotFreeList5")})]})}function Kn(e){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("div",{className:"mailpoet-gap"}),(0,_.jsx)("div",{className:"mailpoet-gap"}),(0,_.jsx)(f.Button,{isFullWidth:!0,href:e.mailpoetAccountUrl,target:"_blank",rel:"noopener noreferrer",onClick:t=>{t.preventDefault(),window.open(e.mailpoetAccountUrl),e.next()},children:e.nextButtonText}),(0,_.jsx)(f.Button,{isFullWidth:!0,variant:"tertiary",onClick:e.next,onKeyDown:t=>{["keydown","keypress"].includes(t.type)&&["Enter"," "].includes(t.key)&&(t.preventDefault(),e.next())},withSpinner:e.nextWithSpinner,children:x.x.I18n.t("welcomeWizardMSSNoThanks")})]})}function Qn(e){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(he.X,{level:1,children:x.x.I18n.t("welcomeWizardMSSFreeTitle")}),(0,_.jsx)("div",{className:"mailpoet-gap"}),(0,_.jsx)("p",{children:x.x.I18n.t("welcomeWizardMSSFreeSubtitle")}),(0,_.jsx)("div",{className:"mailpoet-gap"}),(0,_.jsxs)(he.X,{level:5,children:[x.x.I18n.t("welcomeWizardMSSFreeListTitle"),":"]}),(0,_.jsx)(zn,{}),(0,_.jsx)(Kn,{mailpoetAccountUrl:x.x.MailPoetComUrlFactory.getPurchasePlanUrl(x.x.subscribersCount,x.x.currentWpUserEmail,"starter",{utm_medium:"onboarding",utm_campaign:"purchase"}),next:e.next,nextButtonText:x.x.I18n.t("welcomeWizardMSSFreeButton")})]})}function Xn(e){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(he.X,{level:1,children:x.x.I18n.t("welcomeWizardMSSNotFreeTitle")}),(0,_.jsx)("div",{className:"mailpoet-gap"}),(0,_.jsxs)("p",{children:[x.x.I18n.t("welcomeWizardMSSNotFreeSubtitle"),":"]}),(0,_.jsx)(Gn,{}),(0,_.jsx)(Kn,{mailpoetAccountUrl:e.mailpoetAccountUrl,next:e.next,nextButtonText:x.x.I18n.t("welcomeWizardMSSNotFreeButton")})]})}function Jn(e){return e.subscribersCount<1e3?(0,_.jsx)(Qn,{mailpoetAccountUrl:e.mailpoetAccountUrl,next:e.next}):(0,_.jsx)(Xn,{mailpoetAccountUrl:e.purchaseUrl,next:e.next})}function er(e){const[t,n]=(0,y.useState)(!1);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(he.X,{level:1,children:(r=e.newsletter.type,{standard:x.x.I18n.t("congratulationsMSSPitchHeader"),welcome:x.x.I18n.t("congratulationsMSSPitchHeaderAutomated"),notification:x.x.I18n.t("congratulationsMSSPitchHeaderAutomated"),woocommerce:x.x.I18n.t("congratulationsMSSPitchHeaderAutomated")}[r]||x.x.I18n.t("congratulationsMSSPitchHeaderAutomated"))}),(0,_.jsx)(Bn,{illustrationUrl:e.MSSPitchIllustrationUrl,children:(0,_.jsxs)("div",{className:"mailpoet-welcome-wizard-step-content",children:[(0,_.jsx)(he.X,{level:4,children:x.x.I18n.t("congratulationsMSSPitchSubHeader")}),(0,_.jsx)("p",{children:x.x.I18n.t(e.subscribersCount<1e3?"welcomeWizardMSSFreeSubtitle":"welcomeWizardMSSNotFreeSubtitle")}),(0,_.jsxs)(he.X,{level:5,children:[x.x.I18n.t("welcomeWizardMSSFreeListTitle"),":"]}),(0,_.jsx)(zn,{}),(0,_.jsx)(Kn,{mailpoetAccountUrl:e.purchaseUrl,next:()=>{e.onFinish(),n(!0)},nextButtonText:x.x.I18n.t("welcomeWizardMSSFreeButton"),nextWithSpinner:t})]})})]});var r}function tr(e){return window.has_mss_key_specified?(0,_.jsx)(Yn,{successClicked:e.successClicked,illustrationImageUrl:e.illustrationImageUrl,newsletter:e.newsletter}):(0,_.jsx)(er,{MSSPitchIllustrationUrl:e.MSSPitchIllustrationUrl,onFinish:e.successClicked,subscribersCount:e.subscribersCount,purchaseUrl:e.purchaseUrl,newsletter:e.newsletter})}function nr(e){const[t,n]=(0,y.useState)(!1);return(0,_.jsxs)("div",{children:[(0,_.jsx)(he.X,{level:1,children:x.x.I18n.t("congratulationsSendFailHeader")}),(0,_.jsx)(he.X,{level:3,children:I()(x.x.I18n.t("congratulationsSendFailExplain"),/\[link\](.*?)\[\/link\]/g,((e,t)=>(0,_.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:"https://kb.mailpoet.com/article/231-sending-does-not-work","data-beacon-article":"5a0257ac2c7d3a272c0d7ad6",children:e},t)))}),(0,_.jsx)("div",{className:"mailpoet-gap-large"}),(0,_.jsx)("div",{className:"mailpoet-gap-large"}),(0,_.jsx)("img",{src:window.mailpoet_congratulations_error_image,alt:"",width:"500"}),(0,_.jsx)("div",{className:"mailpoet-gap-large"}),(0,_.jsx)(f.Button,{dimension:"small",type:"button",onClick:()=>{e.failClicked(),n(!0)},withSpinner:t,children:x.x.I18n.t("close")})]})}Yn.propTypes={successClicked:h().func.isRequired,illustrationImageUrl:h().string.isRequired,newsletter:h().shape({status:h().string.isRequired,type:h().string.isRequired}).isRequired},Bn.propTypes={illustrationUrl:h().string.isRequired,children:h().oneOfType([h().arrayOf(h().node),h().node]).isRequired},Kn.propTypes={mailpoetAccountUrl:h().string.isRequired,next:h().func.isRequired,nextButtonText:h().string.isRequired,nextWithSpinner:h().bool},Kn.defaultProps={nextWithSpinner:!1},Qn.propTypes={next:h().func.isRequired},Xn.propTypes={mailpoetAccountUrl:h().string.isRequired,next:h().func.isRequired},Jn.propTypes={next:h().func.isRequired,subscribersCount:h().number.isRequired,mailpoetAccountUrl:h().string.isRequired,purchaseUrl:h().string.isRequired},tr.propTypes={successClicked:h().func.isRequired,illustrationImageUrl:h().string.isRequired,MSSPitchIllustrationUrl:h().string.isRequired,newsletter:h().shape({status:h().string.isRequired,type:h().string.isRequired}).isRequired,subscribersCount:h().number.isRequired,purchaseUrl:h().string.isRequired},nr.propTypes={failClicked:h().func.isRequired};var rr=n(59001);function ar(e){return(0,_.jsx)("div",{className:"mailpoet-congratulate-loading",children:e.showRichLoadingScreen&&(0,_.jsxs)("div",{children:[(0,_.jsx)(he.X,{level:0,children:x.x.I18n.t("congratulationsLoadingHeader")}),(0,_.jsx)(he.X,{level:3,children:x.x.I18n.t("congratulationsLoadingBody")}),(0,_.jsx)("div",{className:"mailpoet-gap-large"}),(0,_.jsx)("div",{className:"mailpoet-gap-large"}),(0,_.jsx)(rr.a,{size:64})]})})}ar.propTypes={showRichLoadingScreen:h().bool.isRequired};const sr=Math.floor(4*Math.random());function ir(){return x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"settings",action:"set",data:{show_congratulate_after_first_newsletter:!1}}).always((()=>{window.location=window.mailpoet_main_page}))}class or extends y.Component{constructor(e){super(e),this.state={loading:!0,newsletter:null,testingPassed:!1,timeStart:K()(),minimumLoadingTimePassed:!1},this.tick=this.tick.bind(this)}componentDidMount(){this.loadNewsletter(this.props.match.params.id),this.tick()}componentDidUpdate(e){e.match.params.id!==this.props.match.params.id&&this.loadNewsletter(this.props.match.params.id)}tick(){K()().subtract(20,"second").isAfter(this.state.timeStart)&&this.setState({error:!0,loading:!1}),this.state.loading&&this.loadNewsletter(this.props.match.params.id),K()().subtract(6,"seconds").isAfter(this.state.timeStart)&&this.setState({minimumLoadingTimePassed:!0}),!this.state.loading&&this.state.minimumLoadingTimePassed||setTimeout(this.tick,2e3)}loadNewsletter(e){x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"get",data:{id:e}}).done((e=>this.newsletterLoaded(e.data)))}newsletterLoaded(e){"standard"!==e.type||"scheduled"===e.status?this.setState({newsletter:e,loading:!1,minimumLoadingTimePassed:!0}):"sent"===e.status||"sending"===e.status?this.setState({newsletter:e,loading:!1,testingPassed:!0}):this.setState({newsletter:e})}renderContent(){return this.state.loading||!this.state.minimumLoadingTimePassed?(e=!this.state.newsletter,(0,_.jsx)(ar,{illustrationImageUrl:window.mailpoet_congratulations_loading_image,successClicked:ir,showRichLoadingScreen:e})):this.state.error?(x.x.trackEvent("Cron testing done",{"Cron is working":"false"}),(0,_.jsx)(nr,{failClicked:()=>{window.location=window.mailpoet_main_page}})):(t=this.state.newsletter,this.state.testingPassed&&x.x.trackEvent("Cron testing done",{"Cron is working":"true"}),(0,_.jsx)(tr,{illustrationImageUrl:window.mailpoet_congratulations_success_images[sr],MSSPitchIllustrationUrl:window.mailpoet_congratulations_success_images[sr],successClicked:ir,newsletter:t,isWoocommerceActive:window.mailpoet_woocommerce_active,subscribersCount:window.mailpoet_subscribers_count,purchaseUrl:x.x.MailPoetComUrlFactory.getPurchasePlanUrl(x.x.subscribersCount,x.x.currentWpUserEmail,"starter",{utm_medium:"first-newsletter-congratulations",utm_campaign:"purchase"})}));var e,t}render(){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("style",{dangerouslySetInnerHTML:{__html:"body { background: #fff; overflow-x: hidden; }"}}),(0,_.jsxs)("div",{className:"mailpoet-congratulate",children:[(0,_.jsx)("div",{className:"mailpoet-gap-large"}),this.renderContent()]})]})}}or.propTypes={match:h().shape({params:h().shape({id:h().string}).isRequired}).isRequired};class lr extends y.Component{constructor(){super(...arguments),(0,b.Z)(this,"showTemplateSelection",(e=>{this.props.history.push(`/template/${e}`)}))}componentDidMount(){x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:{type:"standard"}}).done((e=>{this.showTemplateSelection(e.data.id)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,_.jsx)("p",{children:e.message},e.message))),{scroll:!0})}))}render(){return(0,_.jsx)("div",{children:(0,_.jsx)(ut,{emailType:"standard",automationId:"standard_newsletter_creation_heading"})})}}lr.contextType=Te.k,lr.propTypes={history:h().shape({push:h().func.isRequired}).isRequired};const cr=(0,l.EN)(lr),dr={name:"options",type:"reactComponent",component:pn};class ur extends y.Component{constructor(e){super(e),(0,b.Z)(this,"handleValueChange",(e=>{const t=this.state;t[e.target.name]=e.target.value,this.setState(t)})),(0,b.Z)(this,"handleNext",(()=>{x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:w.ZP.extend({},this.state,{type:"notification",subject:x.x.I18n.t("draftPostNotificationTitle")})}).done((e=>{this.showTemplateSelection(e.data.id)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,_.jsx)("p",{children:e.message},e.message))),{scroll:!0})}))})),(0,b.Z)(this,"showTemplateSelection",(e=>{this.props.history.push(`/template/${e}`)})),this.state={options:{intervalType:"daily",timeOfDay:0,weekDay:1,monthDay:0,nthWeekDay:1}}}render(){return(0,_.jsxs)("div",{children:[(0,_.jsx)(Q.A,{color:"#fff"}),(0,_.jsx)(ut,{emailType:"notification",automationId:"post_notification_creation_heading"}),(0,_.jsxs)(_t.Grid.Column,{align:"center",className:"mailpoet-schedule-email",children:[(0,_.jsx)(he.X,{level:4,children:x.x.I18n.t("selectEventToSendPostNotificationEmail")}),(0,_.jsx)(pn,{item:this.state,field:dr,onValueChange:this.handleValueChange}),(0,_.jsx)(E.z,{isFullWidth:!0,onClick:this.handleNext,type:"button",children:x.x.I18n.t("next")})]})]})}}ur.contextType=Te.k,ur.propTypes={history:h().shape({push:h().func.isRequired}).isRequired};const pr=(0,l.EN)(ur),mr={name:"options",label:"Event",type:"reactComponent",component:jn};class hr extends y.Component{constructor(e){super(e),(0,b.Z)(this,"isValid",(()=>p()("#welcome_scheduling").parsley().isValid())),(0,b.Z)(this,"validate",(()=>p()("#welcome_scheduling").parsley().validate()));let t=window.mailpoet_segments||[],n=1;t=t.filter((e=>"default"===e.type)),w.ZP.size(t)>0&&(n=w.ZP.first(t).id),this.state={options:{event:"segment",segment:n,role:"subscriber",afterTimeNumber:1,afterTimeType:"immediate"}},this.handleValueChange=this.handleValueChange.bind(this),this.handleNext=this.handleNext.bind(this)}handleValueChange(e){const{state:t}=this;t[e.target.name]=e.target.value,this.setState(t)}handleNext(e){e.preventDefault(),this.isValid()?x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:w.ZP.extend({},this.state,{type:"welcome",subject:x.x.I18n.t("draftNewsletterTitle")})}).done((e=>{this.showTemplateSelection(e.data.id)})).fail((e=>{e.errors.length>0&&x.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})})):this.validate()}showTemplateSelection(e){this.props.history.push(`/template/${e}`)}render(){return(0,_.jsxs)("div",{children:[(0,_.jsx)(Q.A,{color:"#fff"}),(0,_.jsx)(ut,{emailType:"welcome",automationId:"welcome_email_creation_heading"}),(0,_.jsxs)(_t.Grid.Column,{align:"center",className:"mailpoet-schedule-email",children:[(0,_.jsx)(he.X,{level:4,children:x.x.I18n.t("selectEventToSendWelcomeEmail")}),(0,_.jsxs)("form",{id:"welcome_scheduling",children:[(0,_.jsx)(jn,{item:this.state,field:mr,onValueChange:this.handleValueChange}),(0,_.jsx)(E.z,{isFullWidth:!0,type:"submit",onClick:this.handleNext,children:x.x.I18n.t("next")})]})]})]})}}hr.propTypes={history:h().shape({push:h().func.isRequired}).isRequired};class fr extends y.Component{static getEventOptions(e){return e.options||null}static getEventOptionsFirstValue(e){return e&&w.ZP.isArray(e.values)&&e.values[0].id?e.values[0].id:null}constructor(e){super(e),(0,b.Z)(this,"isValid",(()=>!p()("#newsletter_scheduling").parsley()||p()("#newsletter_scheduling").parsley().isValid())),(0,b.Z)(this,"validate",(()=>{p()("#newsletter_scheduling").parsley()&&p()("#newsletter_scheduling").parsley().validate()})),(0,b.Z)(this,"resetValidationErrors",(()=>{p()("#newsletter_scheduling").parsley()&&p()("#newsletter_scheduling").parsley().reset()}));const{email:t,name:n}=e;this.handleChange=this.handleChange.bind(this),this.handleNextStep=this.handleNextStep.bind(this),this.email=t,this.emailEvents=this.email.events,this.segments=w.ZP.filter(window.mailpoet_segments,(e=>null===e.deleted_at));const r=this.getEvent(n),a=this.constructor.getEventOptions(r),s=this.constructor.getEventOptionsFirstValue(a);this.state={event:r,eventSlug:r.slug,eventOptionValue:s,segment:r.sendToLists?this.getFirstSegment():null,afterTimeType:r.defaultAfterTimeType||"immediate",afterTimeNumber:null}}handleChange(e){const{segment:t,afterTimeNumber:n}=this.state,r=e;if(r.eventSlug){r.event=this.getEvent(r.eventSlug),r.segment=r.event.sendToLists?t||this.getFirstSegment():null;const e=this.constructor.getEventOptions(r.event);r.eventOptionValue=e?this.constructor.getEventOptionsFirstValue(e):null}r.afterTimeType&&"immediate"===r.afterTimeType?r.afterTimeNumber=null:!r.afterTimeType||r.afterTimeNumber||n||(r.afterTimeNumber=1),this.setState(r),this.resetValidationErrors(),this.isValid()&&this.validate()}handleNextStep(e){if(e.preventDefault(),!this.isValid())return void this.validate();const{history:t}=this.props,{eventSlug:n,afterTimeType:r,afterTimeNumber:a,event:s,segment:i,eventOptionValue:o}=this.state,l={group:this.email.slug,event:n,afterTimeType:r};a&&(l.afterTimeNumber=a),l.sendTo=s.sendToLists?"segment":"user",i&&(l.segment=i),o&&(l.meta=JSON.stringify({option:o})),x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:{type:"automatic",subject:x.x.I18n.t("draftNewsletterTitle"),options:l}}).done((e=>{x.x.trackEvent("Emails > New Automatic Email Created",{"Event type":l.event,"Schedule type":l.afterTimeType,"Schedule value":l.afterTimeNumber}),t.push(`/template/${e.data.id}`)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,_.jsx)("p",{children:e.message},e.message))),{scroll:!0})}))}getEvent(e){return this.emailEvents[e]}getFirstSegment(){return w.ZP.isArray(this.segments)&&this.segments[0].id?this.segments[0].id:null}displayHeader(){const{event:e}=this.state;return e.title}displayEventOptions(){const{eventSlug:e,event:t}=this.state,n={emailSlug:this.email.slug,eventSlug:e,eventOptions:this.constructor.getEventOptions(t),onValueChange:this.handleChange};return(0,_.jsx)(kn,{emailSlug:n.emailSlug,eventSlug:n.eventSlug,eventOptions:n.eventOptions,onValueChange:n.onValueChange})}displaySegments(){const{event:e}=this.state;if(!e.sendToLists)return null;const t={field:{id:"segments",forceSelect2:!0,values:this.segments,extendSelect2Options:{minimumResultsForSearch:1/0}},onValueChange:e=>this.handleChange({segment:e.target.value})};return(0,_.jsx)("div",{className:"event-segment-selection",children:(0,_.jsx)(j,{field:t.field,onValueChange:t.onValueChange})})}displayScheduling(){const{afterTimeNumber:e,afterTimeType:t,event:n}=this.state,r={item:{afterTimeNumber:e,afterTimeType:t},event:n,onValueChange:this.handleChange};return(0,_.jsx)(Cn,{item:r.item,event:r.event,onValueChange:r.onValueChange})}displayEventTip(){const{event:e}=this.state;return e.tip?(0,_.jsxs)("p",{className:"description",children:[(0,_.jsx)("strong",{children:x.x.I18n.t("tip")})," ",e.tip]}):null}render(){return(0,_.jsxs)("div",{children:[(0,_.jsx)(Q.A,{color:"#fff"}),(0,_.jsx)(ut,{emailType:"woocommerce",automationId:"woocommerce_email_creation_heading"}),(0,_.jsx)(_t.Grid.Column,{align:"center",className:"mailpoet-schedule-email",children:(0,_.jsxs)("form",{id:"newsletter_scheduling",children:[(0,_.jsx)(he.X,{level:4,children:this.displayHeader()}),(0,_.jsx)("div",{children:this.displayEventOptions()}),(0,_.jsx)("div",{children:this.displaySegments()}),(0,_.jsx)("div",{children:this.displayScheduling()}),(0,_.jsx)(E.z,{isFullWidth:!0,onClick:this.handleNextStep,type:"submit",children:x.x.I18n.t("next")})]})}),this.displayEventTip()]})}}fr.contextType=Te.k,fr.propTypes={history:h().shape({push:h().func.isRequired}).isRequired,name:h().string.isRequired,email:h().shape({title:h().string.isRequired,slug:h().string.isRequired}).isRequired};var gr=n(11879),xr=n(84188),vr=n(70792);const br=h().shape({status:h().string,count_processed:h().string.isRequired,count_total:h().string.isRequired,scheduled_at:h().string}),yr=h().shape({id:h().number.isRequired,sent_at:h().string,status:h().string.isRequired,queue:h().oneOfType([br,h().bool])});function wr(e){let{newsletter:t}=e;const[n,r]=(0,y.useState)("paused"===t.queue.status),[a,s]=(0,y.useState)([]);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(He,{errors:a}),n&&(0,_.jsx)(E.z,{dimension:"small",onClick:()=>{s([]),x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sendingQueue",action:"resume",data:{newsletter_id:t.id}}).done((()=>r(!1))).fail((e=>s(e.errors)))},children:x.x.I18n.t("resume")}),!n&&(0,_.jsx)(E.z,{dimension:"small",onClick:()=>{s([]),x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sendingQueue",action:"pause",data:{newsletter_id:t.id}}).done((()=>r(!0))).fail((e=>s(e.errors)))},children:x.x.I18n.t("pause")})]})}function _r(e){let{newsletter:t,mailerLog:n}=e,r=t.sent_at||t.queue.scheduled_at;r&&(r=(0,xr.default)(r,"yyyy-MM-dd HH:mm:ss",new Date));const a=t.queue&&"scheduled"!==t.queue.status,s="paused"===n.status,i=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(o.Link,{to:`/sending-status/${t.id}`,"data-automation-id":`sending_status_${t.id}`,children:(0,_.jsx)(vr.s,{processed:parseInt(t.queue.count_processed,10),scheduledFor:r,total:parseInt(t.queue.count_total,10),isPaused:s,status:t.status})}),"completed"!==t.queue.status&&!s&&(0,_.jsx)(wr,{newsletter:t})]}),l=(0,_.jsx)(vr.s,{scheduledFor:r,isPaused:"scheduled"===t.queue.status&&s,status:t.status});return(0,_.jsxs)(_.Fragment,{children:[a&&i,!a&&l]})}wr.propTypes={newsletter:yr.isRequired},_r.propTypes={newsletter:yr.isRequired,mailerLog:h().shape({status:h().string}).isRequired};const jr=x.x.trackingConfig.emailTrackingEnabled,Sr={onNoItemsFound:(e,t)=>x.x.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneNewsletterTrashed"):x.x.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneNewsletterDeleted"):x.x.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneNewsletterRestored"):x.x.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)}},Ir=[{name:"subject",label:x.x.I18n.t("subject"),sortable:!0},{name:"status",label:x.x.I18n.t("status")},{name:"segments",label:x.x.I18n.t("lists")},{name:"statistics",label:x.x.I18n.t("statistics"),display:jr},{name:"sent_at",label:x.x.I18n.t("sentOn"),sortable:!0}],Cr=[{name:"trash",label:x.x.I18n.t("moveToTrash"),onSuccess:Sr.onTrash}],Tr=e=>{const t=()=>{window.location.href=`?page=mailpoet-newsletter-editor&id=${e.id}`};e.queue&&"sending"===e.status&&null===e.queue.status?(0,mt._)({message:x.x.I18n.t("confirmEdit"),onConfirm:t}):t()};let kr=[{name:"view",link:function(e){return(0,_.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:x.x.I18n.t("preview")})}},{name:"edit",className:"mailpoet-hide-on-mobile",label:x.x.I18n.t("edit"),onClick:Tr},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:x.x.I18n.t("duplicate"),onClick:function(e,t){return x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{x.x.Notice.success(x.x.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&x.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}},{name:"trash",className:"mailpoet-hide-on-mobile"}];kr=(0,$e.y8)(kr);class Nr extends y.Component{constructor(e){super(e),(0,b.Z)(this,"renderItem",((e,t,n)=>{const r=d()("manage-column","column-primary","has-row-actions");return(0,_.jsxs)("div",{children:[(0,_.jsxs)("td",{className:r,children:[(0,_.jsx)("a",{className:"mailpoet-listing-title",href:"#",onClick:t=>{t.preventDefault(),Tr(e)},children:e.queue.newsletter_rendered_subject||e.subject}),t]}),(0,_.jsx)("td",{className:"column mailpoet-listing-status-column","data-colname":x.x.I18n.t("status"),children:(0,_.jsx)(_r,{newsletter:e,mailerLog:n.mta_log})}),(0,_.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("lists"),children:(0,_.jsx)(gr.$,{segments:e.segments,dimension:"large"})}),!0===jr?(0,_.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":x.x.I18n.t("statistics"),children:(0,_.jsx)(Xe,{newsletter:e,currentTime:n.current_time})}):null,(0,_.jsx)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("sentOn"),children:e.sent_at?(0,_.jsxs)(_.Fragment,{children:[x.x.Date.short(e.sent_at),(0,_.jsx)("br",{}),x.x.Date.time(e.sent_at)]}):null})]})})),(0,b.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return(0,_.jsxs)(_.Fragment,{children:[0===this.state.newslettersCount&&(0,_.jsx)(Ke,{filter:e=>"standard"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&(0,_.jsx)(g.N,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,endpoint:"newsletters",type:"standard",base_url:"standard",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:Ir,bulk_actions:Cr,item_actions:kr,messages:Sr,auto_refresh:!0,sort_by:"sent_at",sort_order:"desc",afterGetItems:e=>{if(!e.loading){const t=e.groups.reduce(((e,t)=>e+t.count),0);this.setState({newslettersCount:t})}(0,$e._X)(e),(0,$e.bF)(e)}})]})}}Nr.contextType=Te.k,Nr.propTypes={location:h().object.isRequired,match:h().shape({params:h().object}).isRequired};const Dr=(0,l.EN)(Nr),Er=window.mailpoet_roles||{},Ar=window.mailpoet_segments||{},Or=x.x.trackingConfig.emailTrackingEnabled,Rr={onNoItemsFound:(e,t)=>x.x.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneNewsletterTrashed"):x.x.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneNewsletterDeleted"):x.x.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneNewsletterRestored"):x.x.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)}},Pr=[{name:"subject",label:x.x.I18n.t("subject"),sortable:!0},{name:"settings",label:x.x.I18n.t("settings")},{name:"statistics",label:x.x.I18n.t("statistics"),display:Or},{name:"status",label:x.x.I18n.t("status"),width:145},{name:"updated_at",label:x.x.I18n.t("lastModifiedOn"),sortable:!0}],Mr=[{name:"trash",label:x.x.I18n.t("moveToTrash"),onSuccess:Rr.onTrash}];let Lr=[{name:"view",link:function(e){return(0,_.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:x.x.I18n.t("preview")})}},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:x.x.I18n.t("duplicate"),onClick:(e,t)=>x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{x.x.Notice.success(x.x.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&x.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},{name:"edit",className:"mailpoet-hide-on-mobile",label:x.x.I18n.t("edit"),onClick:$e.Q2},{name:"trash",className:"mailpoet-hide-on-mobile"}];Lr=(0,$e.y8)(Lr);class Fr extends y.Component{constructor(e){super(e),(0,b.Z)(this,"updateStatus",((e,t)=>{t.persist(),x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"setStatus",data:{id:Number(t.target.getAttribute("data-id")),status:e?"active":"draft"}}).done((e=>{"active"===e.data.status&&x.x.Notice.success(x.x.I18n.t("welcomeEmailActivated")),this.forceUpdate()})).fail((n=>{x.x.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,b.Z)(this,"renderStatus",(e=>{const t=x.x.I18n.t("sentToXSubscribers").replace("%1$d",e.total_sent.toLocaleString()),n=x.x.I18n.t("scheduledToXSubscribers").replace("%1$d",e.total_scheduled.toLocaleString());return(0,_.jsxs)("div",{children:[(0,_.jsx)(Zt.Z,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"active"===e.status}),(0,_.jsxs)("p",{className:"mailpoet-listing-stats-description",children:[(0,_.jsx)(o.Link,{to:`/sending-status/${e.id}`,"data-automation-id":`sending_status_${e.id}`,children:t})," ",(0,_.jsx)("br",{}),n]})]})})),(0,b.Z)(this,"renderSettings",(e=>{let t,n,r;if("user"===e.options.event)t="mailpoet_all"===e.options.role?x.x.I18n.t("welcomeEventWPUserAnyRole"):I()(x.x.I18n.t("welcomeEventWPUserWithRole"),"%1$s",((t,n)=>(0,_.jsx)(Ne.V,{variant:"list",children:Er[e.options.role]},n)));else{if(r=w.ZP.find(Ar,(t=>Number(t.id)===Number(e.options.segment))),void 0===r)return(0,_.jsx)(o.Link,{className:"mailpoet-listing-error",to:`/send/${e.id}`,children:x.x.I18n.t("sendingToSegmentsNotSpecified")});t=I()(x.x.I18n.t("welcomeEventSegment"),"%1$s",((e,t)=>(0,_.jsx)(Ne.V,{variant:"list",children:r.name},t)))}if(t&&"immediate"!==e.options.afterTimeType)switch(e.options.afterTimeType){case"minutes":n=x.x.I18n.t("sendingDelayMinutes").replace("%1$d",e.options.afterTimeNumber);break;case"hours":n=x.x.I18n.t("sendingDelayHours").replace("%1$d",e.options.afterTimeNumber);break;case"days":n=x.x.I18n.t("sendingDelayDays").replace("%1$d",e.options.afterTimeNumber);break;case"weeks":n=x.x.I18n.t("sendingDelayWeeks").replace("%1$d",e.options.afterTimeNumber);break;default:n=x.x.I18n.t("sendingDelayInvalid")}return(0,_.jsxs)("span",{children:[t,n&&(0,_.jsxs)("div",{className:"mailpoet-listing-schedule",children:[(0,_.jsx)("div",{className:"mailpoet-listing-schedule-icon",children:(0,_.jsx)(vr.P,{})}),n]})]})})),(0,b.Z)(this,"renderItem",((e,t)=>{const n=d()("manage-column","column-primary","has-row-actions");return(0,_.jsxs)("div",{children:[(0,_.jsxs)("td",{className:n,children:[(0,_.jsx)("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`,children:e.subject}),t]}),(0,_.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("settings"),children:this.renderSettings(e)}),!0===Or?(0,_.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":x.x.I18n.t("statistics"),children:(0,_.jsx)(Xe,{newsletter:e,isSent:e.total_sent>0&&!!e.statistics})}):null,(0,_.jsx)("td",{className:"column","data-colname":x.x.I18n.t("status"),children:this.renderStatus(e)}),(0,_.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("lastModifiedOn"),children:[x.x.Date.short(e.updated_at),(0,_.jsx)("br",{}),x.x.Date.time(e.updated_at)]})]})})),(0,b.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return(0,_.jsxs)(_.Fragment,{children:[0===this.state.newslettersCount&&(0,_.jsx)(Ke,{filter:e=>"welcome"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&(0,_.jsx)(g.N,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,endpoint:"newsletters",type:"welcome",base_url:"welcome",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:Pr,bulk_actions:Mr,item_actions:Lr,messages:Rr,auto_refresh:!0,sort_by:"updated_at",sort_order:"desc",afterGetItems:e=>{if(!e.loading){const t=e.groups.reduce(((e,t)=>e+t.count),0);this.setState({newslettersCount:t})}(0,$e._X)(e),(0,$e.bF)(e)}})]})}}Fr.propTypes={location:h().object.isRequired,match:h().shape({params:h().object}).isRequired};const qr=(0,l.EN)(Fr),$r={onNoItemsFound:(e,t)=>x.x.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneNewsletterTrashed"):x.x.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneNewsletterDeleted"):x.x.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneNewsletterRestored"):x.x.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)}},Ur=[{name:"subject",label:x.x.I18n.t("subject"),sortable:!0},{name:"settings",label:x.x.I18n.t("settings")},{name:"history",label:x.x.I18n.t("history"),width:100},{name:"status",label:x.x.I18n.t("status"),width:100},{name:"updated_at",label:x.x.I18n.t("lastModifiedOn"),sortable:!0}],Zr=[{name:"trash",label:x.x.I18n.t("moveToTrash"),onSuccess:$r.onTrash}],Vr=[{name:"view",link:function(e){return(0,_.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:x.x.I18n.t("preview")})}},{name:"edit",className:"mailpoet-hide-on-mobile",label:x.x.I18n.t("edit"),onClick:$e.Q2},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:x.x.I18n.t("duplicate"),onClick:function(e,t){return x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{x.x.Notice.success(x.x.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&x.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}},{name:"trash",className:"mailpoet-hide-on-mobile"}];class Wr extends y.Component{constructor(e){super(e),(0,b.Z)(this,"updateStatus",((e,t)=>{t.persist(),x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"setStatus",data:{id:Number(t.target.getAttribute("data-id")),status:e?"active":"draft"}}).done((e=>{"active"===e.data.status&&x.x.Notice.success(x.x.I18n.t("postNotificationActivated")),this.forceUpdate()})).fail((n=>{x.x.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,b.Z)(this,"renderStatus",(e=>(0,_.jsx)(Zt.Z,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"active"===e.status}))),(0,b.Z)(this,"renderSettings",(e=>{let t;if(0===e.segments.length)return(0,_.jsx)(o.Link,{className:"mailpoet-listing-error",to:`/send/${e.id}`,children:x.x.I18n.t("sendingToSegmentsNotSpecified")});const n=I()(x.x.I18n.t("sendTo"),"%1$s",((t,n)=>(0,_.jsx)(gr.$,{segments:e.segments},n)));switch(e.options.intervalType){case"daily":t=x.x.I18n.t("sendDaily").replace("%1$s",nn[e.options.timeOfDay]);break;case"weekly":t=x.x.I18n.t("sendWeekly").replace("%1$s",rn[e.options.weekDay]).replace("%2$s",nn[e.options.timeOfDay]);break;case"monthly":t=x.x.I18n.t("sendMonthly").replace("%1$s",an[e.options.monthDay]).replace("%2$s",nn[e.options.timeOfDay]);break;case"nthWeekDay":t=x.x.I18n.t("sendNthWeekDay").replace("%1$s",sn[e.options.nthWeekDay]).replace("%2$s",rn[e.options.weekDay]).replace("%3$s",nn[e.options.timeOfDay]);break;case"immediately":t=x.x.I18n.t("sendImmediately");break;default:t="Invalid sending frequency"}return(0,_.jsxs)("span",{children:[n,(0,_.jsxs)("div",{className:"mailpoet-listing-schedule",children:[(0,_.jsx)("div",{className:"mailpoet-listing-schedule-icon",children:(0,_.jsx)(vr.P,{})}),t]})]})})),(0,b.Z)(this,"renderHistoryLink",(e=>0===Number(e.children_count)?(0,_.jsx)("span",{className:"mailpoet-listing-status-unknown mailpoet-font-extra-small mailpoet-listing-notification-status",children:x.x.I18n.t("notSentYet")}):(0,_.jsxs)(o.Link,{className:"mailpoet-nowrap","data-automation-id":`history-${e.id}`,to:`/notification/history/${e.id}`,children:[(0,_.jsx)(E.z,{className:"mailpoet-hide-on-mobile",dimension:"small",children:x.x.I18n.t("viewHistory")}),(0,_.jsx)(E.z,{className:"mailpoet-show-on-mobile mailpoet-listing-notification-status",dimension:"small",variant:"secondary",children:x.x.I18n.t("viewHistory")})]}))),(0,b.Z)(this,"renderItem",((e,t)=>{const n=d()("manage-column","column-primary","has-row-actions");return(0,_.jsxs)("div",{children:[(0,_.jsxs)("td",{className:n,children:[(0,_.jsx)("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`,children:e.subject}),t]}),(0,_.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("settings"),children:this.renderSettings(e)}),(0,_.jsx)("td",{className:"column","data-colname":x.x.I18n.t("history"),children:this.renderHistoryLink(e)}),(0,_.jsx)("td",{className:"column","data-colname":x.x.I18n.t("status"),children:this.renderStatus(e)}),(0,_.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("lastModifiedOn"),children:[x.x.Date.short(e.updated_at),(0,_.jsx)("br",{}),x.x.Date.time(e.updated_at)]})]})})),(0,b.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return(0,_.jsxs)(_.Fragment,{children:[0===this.state.newslettersCount&&(0,_.jsx)(Ke,{filter:e=>"notification"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&(0,_.jsx)(g.N,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,endpoint:"newsletters",type:"notification",base_url:"notification",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:Ur,bulk_actions:Zr,item_actions:Vr,messages:$r,auto_refresh:!0,sort_by:"updated_at",sort_order:"desc",afterGetItems:e=>{if(!e.loading){const t=e.groups.reduce(((e,t)=>e+t.count),0);this.setState({newslettersCount:t})}(0,$e._X)(e),(0,$e.bF)(e)}})]})}}Wr.propTypes={location:h().object.isRequired,match:h().shape({params:h().object}).isRequired};const Yr=(0,l.EN)(Wr),Br=x.x.trackingConfig.emailTrackingEnabled,Hr={onNoItemsFound:(e,t)=>x.x.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneNewsletterTrashed"):x.x.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneNewsletterDeleted"):x.x.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneNewsletterRestored"):x.x.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)}},zr=[{name:"subject",label:x.x.I18n.t("subject"),sortable:!0},{name:"settings",label:x.x.I18n.t("settings")},{name:"statistics",label:x.x.I18n.t("statistics"),display:Br},{name:"status",label:x.x.I18n.t("status"),width:145},{name:"updated_at",label:x.x.I18n.t("lastModifiedOn"),sortable:!0}],Gr=[{name:"trash",label:x.x.I18n.t("moveToTrash"),onSuccess:Hr.onTrash}];let Kr=[{name:"view",link:function(e){return(0,_.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:x.x.I18n.t("preview")})}},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:x.x.I18n.t("duplicate"),onClick:(e,t)=>x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{x.x.Notice.success(x.x.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&x.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},{name:"edit",className:"mailpoet-hide-on-mobile",label:x.x.I18n.t("edit"),onClick:$e.Q2},{name:"trash",className:"mailpoet-hide-on-mobile"}];Kr=(0,$e.y8)(Kr);class Qr extends y.Component{constructor(e){super(e),(0,b.Z)(this,"updateStatus",((e,t)=>{t.persist(),x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"setStatus",data:{id:Number(t.target.getAttribute("data-id")),status:e?"active":"draft"}}).done((e=>{"active"===e.data.status&&x.x.Notice.success(x.x.I18n.t("reEngagementEmailActivated")),this.forceUpdate()})).fail((n=>{x.x.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,b.Z)(this,"renderStatus",(e=>{const t=x.x.I18n.t("sentToXSubscribers").replace("%1$d",e.total_sent.toLocaleString());return(0,_.jsxs)("div",{children:[(0,_.jsx)(Zt.Z,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"active"===e.status}),(0,_.jsx)("p",{className:"mailpoet-listing-stats-description",children:(0,_.jsx)(o.Link,{to:`/sending-status/${e.id}`,"data-automation-id":`sending_status_${e.id}`,children:t})})]})})),(0,b.Z)(this,"renderSettings",(e=>{if(0===e.segments.length)return(0,_.jsx)(o.Link,{className:"mailpoet-listing-error",to:`/send/${e.id}`,children:x.x.I18n.t("sendingToSegmentsNotSpecified")});const t=I()(x.x.I18n.t("sendTo"),"%1$s",((t,n)=>(0,_.jsx)(gr.$,{segments:e.segments},n)));let n="reEngagementFrequencyMonth";e.options.afterTimeNumber>1&&"months"===e.options.afterTimeType?n="reEngagementFrequencyMonths":e.options.afterTimeNumber>1&&"weeks"===e.options.afterTimeType?n="reEngagementFrequencyWeeks":1===e.options.afterTimeNumber&&"weeks"===e.options.afterTimeType&&(n="reEngagementFrequencyWeek");const r=x.x.I18n.t("reEngagementSettings").replace("{$count}",e.options.afterTimeNumber).replace("{$frequency}",x.x.I18n.t(n));return(0,_.jsxs)("span",{children:[t,(0,_.jsxs)("div",{className:"mailpoet-listing-schedule",children:[(0,_.jsx)("div",{className:"mailpoet-listing-schedule-icon",children:(0,_.jsx)(vr.P,{})}),r]})]})})),(0,b.Z)(this,"renderItem",((e,t)=>{const n=d()("manage-column","column-primary","has-row-actions");return(0,_.jsxs)("div",{children:[(0,_.jsxs)("td",{className:n,children:[(0,_.jsx)("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`,children:e.subject}),t]}),(0,_.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("settings"),children:this.renderSettings(e)}),!0===Br?(0,_.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":x.x.I18n.t("statistics"),children:(0,_.jsx)(Xe,{newsletter:e,isSent:e.total_sent>0&&!!e.statistics})}):null,(0,_.jsx)("td",{className:"column","data-colname":x.x.I18n.t("status"),children:this.renderStatus(e)}),(0,_.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("lastModifiedOn"),children:[x.x.Date.short(e.updated_at),(0,_.jsx)("br",{}),x.x.Date.time(e.updated_at)]})]})})),(0,b.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return(0,_.jsxs)(_.Fragment,{children:[0===this.state.newslettersCount&&(0,_.jsx)(Ke,{filter:e=>"re_engagement"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&(0,_.jsx)(g.N,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,endpoint:"newsletters",type:"re_engagement",base_url:"re_engagement",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:zr,bulk_actions:Gr,item_actions:Kr,messages:Hr,auto_refresh:!0,sort_by:"updated_at",sort_order:"desc",afterGetItems:e=>{if(!e.loading){const t=e.groups.reduce(((e,t)=>e+t.count),0);this.setState({newslettersCount:t})}(0,$e._X)(e),(0,$e.bF)(e)}})]})}}Qr.propTypes={location:h().object.isRequired,match:h().shape({params:h().object}).isRequired};const Xr=(0,l.EN)(Qr),Jr=x.x.trackingConfig.emailTrackingEnabled,ea=[{name:"subject",label:x.x.I18n.t("subject")},{name:"status",label:x.x.I18n.t("status")},{name:"segments",label:x.x.I18n.t("lists")},{name:"statistics",label:x.x.I18n.t("statistics"),display:Jr},{name:"sent_at",label:x.x.I18n.t("sentOn"),sortable:!0}],ta={onNoItemsFound:(e,t)=>x.x.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneNewsletterTrashed"):x.x.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneNewsletterDeleted"):x.x.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneNewsletterRestored"):x.x.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)}},na=[{name:"trash",label:x.x.I18n.t("moveToTrash"),onSuccess:ta.onTrash}],ra=(0,$e.y8)([{name:"view",link:function(e){return(0,_.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:x.x.I18n.t("preview")})}},{name:"trash",className:"mailpoet-hide-on-mobile"}]),aa=(e,t,n)=>{const r=d()("manage-column","column-primary","has-row-actions");return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("td",{className:r,children:[(0,_.jsx)("strong",{children:(0,_.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:e.queue.newsletter_rendered_subject||e.subject})}),t]}),(0,_.jsx)("td",{className:"column mailpoet-listing-status-column","data-colname":x.x.I18n.t("status"),children:(0,_.jsx)(_r,{newsletter:e,mailerLog:n.mta_log})}),(0,_.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("lists"),children:(0,_.jsx)(gr.$,{segments:e.segments,dimension:"large"})}),!0===Jr?(0,_.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":x.x.I18n.t("statistics"),children:(0,_.jsx)(Xe,{newsletter:e,currentTime:n.current_time})}):null,(0,_.jsx)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("sentOn"),children:e.sent_at?(0,_.jsxs)(_.Fragment,{children:[x.x.Date.short(e.sent_at),(0,_.jsx)("br",{}),x.x.Date.time(e.sent_at)]}):null})]})};function sa(e){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(o.Link,{className:"mailpoet-button button button-secondary button-small",to:"/notification",children:x.x.I18n.t("backToPostNotifications")}),(0,_.jsx)(g.N,{limit:window.mailpoet_listing_per_page,location:e.location,params:{...e.match.params,parentId:e.parentId},endpoint:"newsletters",type:"notification_history",base_url:"notification/history/:parentId",onRenderItem:aa,columns:ea,messages:ta,item_actions:ra,bulk_actions:na,auto_refresh:!0,sort_by:"sent_at",sort_order:"desc",afterGetItems:e=>{(0,$e._X)(e),(0,$e.bF)(e)}})]})}sa.propTypes={parentId:h().string.isRequired,location:h().shape({pathname:h().string}).isRequired,match:h().shape({params:h().shape({id:h().node}).isRequired}).isRequired};const ia=(0,l.EN)(sa),oa=[{name:"subscriber_id",label:x.x.I18n.t("subscriber"),sortable:!0},{name:"status",label:x.x.I18n.t("sendingStatus")},{name:"failureReason",label:x.x.I18n.t("failureReason")}],la={onNoItemsFound:()=>x.x.I18n.t("noSendingTaskFound")};function ca(e){const[t,n]=(0,y.useState)({id:e.match.params.id,subject:"",sent:!1});return(0,y.useEffect)((()=>{x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"get",data:{id:t.id}}).done((e=>n({id:t.id,subject:e.data.subject,sent:null!==e.data.sent_at}))).fail((e=>x.x.Notice.showApiErrorNotice(e)))}),[t.id]),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("h1",{children:x.x.I18n.t("sendingStatusTitle")}),(0,_.jsx)(ma,{newsletter:t}),(0,_.jsx)(pa,{location:e.location,params:e.match.params})]})}ca.propTypes={location:h().shape({pathname:h().string}).isRequired,match:h().shape({params:h().shape({id:h().string.isRequired}).isRequired}).isRequired};const da=(e,t)=>e.location.pathname===t.location.pathname&&e.params.id===t.params.id,ua=e=>(0,_.jsx)("div",{children:(0,_.jsx)(ha,{...e})}),pa=(0,y.memo)((e=>{let{location:t,params:n}=e;return(0,_.jsx)(g.N,{limit:window.mailpoet_listing_per_page,location:t,params:n,endpoint:"sending_task_subscribers",base_url:"sending-status/:id",onRenderItem:ua,getListingItemKey:e=>`${e.taskId}-${e.subscriberId}`,columns:oa,messages:la,auto_refresh:!0,sort_by:"failed",sort_order:"desc",afterGetItems:e=>{(0,$e._X)(e),(0,$e.bF)(e)}})}),da);function ma(e){let{newsletter:t}=e;return t.id&&t.subject&&t.sent?(0,_.jsx)("p",{children:(0,_.jsx)(o.Link,{to:`/stats/${t.id}`,children:t.subject})}):null}function ha(e){let{error:t,failed:n,taskId:r,processed:a,email:s,subscriberId:i,lastName:o,firstName:l}=e;const c=d()("manage-column","column-primary","has-row-actions");let u=x.x.I18n.t("unprocessed");return a&&(u=n?(0,_.jsxs)("span",{children:[x.x.I18n.t("failed"),(0,_.jsx)("br",{}),(0,_.jsx)("a",{className:"button",href:"#",onClick:e=>{e.preventDefault(),x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sending_task_subscribers",action:"resend",data:{taskId:r,subscriberId:i}}).done((()=>window.mailpoet_listing.forceUpdate())).fail((e=>x.x.Notice.showApiErrorNotice(e)))},children:x.x.I18n.t("resend")})]}):x.x.I18n.t("sent")),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("td",{"data-automation-id":`name_${r}_${i}`,className:c,children:[(0,_.jsx)("a",{className:"mailpoet-listing-title",href:`admin.php?page=mailpoet-subscribers#/edit/${i}`,children:s}),(0,_.jsx)("div",{className:"mailpoet-listing-subtitle",children:`${l} ${o}`})]}),(0,_.jsx)("td",{className:"column","data-automation-id":`status_${r}_${i}`,"data-colname":x.x.I18n.t("sendingStatus"),children:u}),(0,_.jsx)("td",{className:"column","data-automation-id":`error_${r}_${i}`,"data-colname":x.x.I18n.t("failureReason"),children:t})]})}function fa(){return(0,_.jsx)("style",{dangerouslySetInnerHTML:{__html:".wrap { margin: 0 !important; }"}})}pa.propTypes={location:h().shape({pathname:h().string}).isRequired,params:h().shape({id:h().string.isRequired}).isRequired},ma.propTypes={newsletter:h().shape({id:h().string,subject:h().string,sent:h().bool})},ma.defaultProps={newsletter:{id:null,subject:null,sent:!1}},ha.propTypes={error:h().string,email:h().string.isRequired,failed:h().number.isRequired,taskId:h().number.isRequired,lastName:h().string.isRequired,firstName:h().string.isRequired,processed:h().number.isRequired,subscriberId:h().number.isRequired},ha.defaultProps={error:""};var ga=n(51713),xa=n(84663),va=n(13101);const ba=e=>{const t=e<.1?2:1;return x.x.Num.toLocaleFixed(e,t)},ya=e=>+(+e).toFixed(1);function wa(e){let{newsletter:t,isWoocommerceActive:n}=e;const r=t.total_sent||0;let a=0,s=0,i=0,o=0,l=0;r>0&&(a=100*t.statistics.clicked/r,s=100*t.statistics.opened/r,i=100*t.statistics.machineOpened/r,o=100*t.statistics.unsubscribed/r,l=100*t.statistics.bounced/r);const c=ba(a),d=ba(s),u=ba(i),p=ba(o),m=ba(l),h=r>=20&&t.statistics.opened>=5,f=t.statistics.unsubscribed>=5&&r>=100,g=t.statistics.bounced>=5&&r>=100,v=(0,va.y)("opened",s)||"",b=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("div",{className:"mailpoet-statistics-value-small",children:[(0,_.jsxs)("span",{className:`mailpoet-statistics-value-number mailpoet-statistics-value-number-${v}`,children:[d,"% "]}),x.x.I18n.t("percentageOpened")]}),h&&(0,_.jsx)(va.$,{isInverted:!1,stat:"opened",rate:s,tooltipId:`opened-${t.id||"0"}`,tooltipPlace:"right"})]}),y=(0,_.jsxs)("div",{className:"mailpoet-statistics-value-small",children:[(0,_.jsxs)("span",{className:"mailpoet-statistics-value-number",children:[u,"% "]}),x.x.I18n.t("percentageMachineOpened"),(0,_.jsx)(O.Tooltip,{tooltip:I()(x.x.I18n.t("percentageMachineOpenedTooltip"),/\[link](.*?)\[\/link]/,(e=>(0,_.jsx)("span",{style:{pointerEvents:"all"},children:(0,_.jsx)("a",{href:"https://kb.mailpoet.com/article/368-what-are-machine-opens",target:"_blank","data-beacon-article":"6124b7fb21ef206e5592e188",rel:"noopener noreferrer",children:e},"kb-link")},"machine-opened-tooltip")))})]}),w=ya(o),j=f?(0,va.y)("unsubscribed",w):"",S=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("div",{className:"mailpoet-statistics-value-small",children:[(0,_.jsxs)("span",{className:`mailpoet-statistics-value-number mailpoet-statistics-value-number-${j}`,children:[p,"% "]}),x.x.I18n.t("percentageUnsubscribed")]}),f&&(0,_.jsx)(va.$,{isInverted:!1,stat:"unsubscribed",rate:w,tooltipId:`unsubscribed-${t.id||"0"}`,tooltipPlace:"right"})]}),C=ya(l),T=g?(0,va.y)("bounced",C):"",k=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("div",{className:"mailpoet-statistics-value-small",children:[(0,_.jsxs)("span",{className:`mailpoet-statistics-value-number mailpoet-statistics-value-number-${T}`,children:[m,"% "]}),x.x.I18n.t("percentageBounced")]}),g&&(0,_.jsx)(va.$,{isInverted:!1,stat:"bounced",rate:C,tooltipId:`bounced-${t.id||"0"}`,tooltipPlace:"right"})]}),N=(0,va.y)("clicked",a),D=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("div",{className:"mailpoet-statistics-value",children:[(0,_.jsxs)("span",{className:`mailpoet-statistics-value-number mailpoet-statistics-value-number-${N}`,children:[c,"% "]}),x.x.I18n.t("percentageClicked")]}),h&&(0,_.jsx)(va.$,{isInverted:!1,stat:"clicked",rate:a,tooltipId:`clicked-${t.id||"0"}`,tooltipPlace:"right"})]});return(0,_.jsxs)("div",{className:"mailpoet-stats-general",children:[(0,_.jsxs)(_t.Grid.ThreeColumns,{className:"mailpoet-stats-general-top-row",children:[(0,_.jsx)("div",{children:(0,_.jsxs)("div",{className:"mailpoet-statistics-value-small",children:[x.x.I18n.t("statsTotalSent"),": ",(0,_.jsx)("span",{className:"mailpoet-statistics-value-number",children:r.toLocaleString()})]})}),(0,_.jsx)("div",{className:"mailpoet-statistics-with-left-separator",children:S}),(0,_.jsx)("div",{className:"mailpoet-statistics-with-left-separator",children:k})]}),(0,_.jsxs)(_t.Grid.ThreeColumns,{children:[(0,_.jsx)("div",{children:D}),(0,_.jsxs)("div",{className:"mailpoet-statistics-with-left-separator",children:[b,y]}),n&&(0,_.jsx)("div",{className:"mailpoet-statistics-with-left-separator",children:Ae.Hooks.applyFilters("mailpoet_newsletters_revenues_stats",null,t.statistics.revenue)}),!n&&(0,_.jsx)("div",{})]}),(0,_.jsx)("p",{className:"mailpoet-stats-general-read-more",children:(0,_.jsx)("a",{href:"https://kb.mailpoet.com/article/190-whats-a-good-email-open-rate",target:"_blank",rel:"noopener noreferrer","data-beacon-article":"58f671152c7d3a057f8858e8",children:x.x.I18n.t("readMoreOnStats")})})]})}function _a(e){let{newsletter:t}=e;const n=t.queue.scheduled_at||t.queue.created_at;return(0,_.jsxs)(_t.Grid.ThreeColumns,{className:"mailpoet-stats-info",children:[(0,_.jsxs)("div",{className:"mailpoet-grid-span-two-columns",children:[(0,_.jsx)(he.X,{level:1,children:t.subject}),(0,_.jsx)("div",{children:(0,_.jsxs)("b",{children:[x.x.Date.short(n)," • ",x.x.Date.time(n)]})}),Array.isArray(t.segments)&&t.segments.length&&(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{className:"mailpoet-stats-info-key",children:x.x.I18n.t("statsToSegments")}),": ",(0,_.jsx)(f.Tags,{dimension:"large",segments:t.segments})]})]}),(0,_.jsxs)("div",{className:"mailpoet-stats-info-sender-preview",children:[(0,_.jsxs)("div",{children:[(0,_.jsxs)("div",{className:"mailpoet-stats-info-key-value",children:[(0,_.jsxs)("span",{className:"mailpoet-stats-info-key",children:[x.x.I18n.t("statsFromAddress"),": "]}),t.sender_address?t.sender_address:"-"]}),(0,_.jsxs)("div",{className:"mailpoet-stats-info-key-value",children:[(0,_.jsxs)("span",{className:"mailpoet-stats-info-key",children:[x.x.I18n.t("statsReplyToAddress"),": "]}),t.reply_to_address?t.reply_to_address:"-"]}),(0,_.jsxs)("div",{className:"mailpoet-stats-info-key-value",children:[(0,_.jsxs)("span",{className:"mailpoet-stats-info-key",children:[x.x.I18n.t("googleAnalytics"),": "]}),t.ga_campaign?t.ga_campaign:"-"]})]}),(0,_.jsx)("div",{children:(0,_.jsx)(f.Button,{href:t.preview_url,target:"_blank",rel:"noopener noreferrer",children:x.x.I18n.t("statsPreviewNewsletter")})})]})]})}function ja(){const e=(0,_.jsx)(E.z,{href:x.x.MailPoetComUrlFactory.getPurchasePlanUrl(x.x.subscribersCount,x.x.currentWpUserEmail,"starter",{utm_medium:"stats",utm_campaign:"signup"}),target:"_blank",rel:"noopener noreferrer",children:x.x.I18n.t("premiumBannerCtaFree")}),t=(0,_.jsxs)("p",{children:[x.x.I18n.t("premiumBannerDescription")," ",(0,_.jsx)("a",{href:"admin.php?page=mailpoet-upgrade",children:x.x.I18n.t("learnMore")}),"."]});return(0,_.jsx)("div",{className:"mailpoet-stats-premium-required",children:(0,_.jsx)(Oe.K,{title:x.x.I18n.t("premiumFeature"),message:t,actionButton:e})})}function Sa(){if(!window.mailpoet_display_detailed_stats)return(0,_.jsx)(ja,{});if(window.mailpoet_subscribers_limit_reached){const e=window.mailpoet_has_valid_api_key,t=x.x.I18n.t("upgradeRequired"),n=x.x.I18n.t(e?"newsletterYourPlanLimit":"newsletterFreeVersionLimit").replace("[subscribersLimit]",window.mailpoet_subscribers_limit).replace("[subscribersCount]",window.mailpoet_subscribers_count),r=e?x.x.MailPoetComUrlFactory.getUpgradeUrl(x.x.pluginPartialKey):x.x.MailPoetComUrlFactory.getPurchasePlanUrl(window.mailpoet_subscribers_count+1);return(0,_.jsx)("div",{className:"mailpoet-stats-premium-required",children:(0,_.jsx)(Oe.K,{title:t,message:(0,_.jsx)("p",{children:n}),actionButton:(0,_.jsx)(E.z,{target:"_blank",rel:"noopener noreferrer",href:r,children:x.x.I18n.t("upgradeNow")})})})}return null}const Ia=(0,l.EN)((function(e){let{match:t,history:n,location:r}=e;const[a,s]=(0,y.useState)({item:void 0,loading:!0}),i=(0,y.useCallback)((e=>{s({loading:!0,item:a.item}),x.x.Modal.loading(!0),x.x.Ajax.post({api_version:x.x.apiVersion,endpoint:window.mailpoet_display_detailed_stats?"stats":"newsletters",action:window.mailpoet_display_detailed_stats?"get":"getWithStats",data:{id:e}}).always((()=>{x.x.Modal.loading(!1)})).done((e=>{s({loading:!1,item:e.data})})).fail((e=>{x.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0}),s({loading:!1}),n.push("/")}))}),[n,a.item]);(0,y.useEffect)((()=>{var e;window.scrollTo(0,0),(null===(e=a.item)||void 0===e?void 0:e.id)!==t.params.id&&i(t.params.id)}),[t.params.id,i,a.item]);const{item:o,loading:l}=a,c=o;return l?null:null==c||!c.subject||null!=c&&c.queue?c?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(ye.B,{}),(0,_.jsx)(fa,{}),(0,_.jsx)(L.Q,{}),(0,_.jsxs)("div",{className:"mailpoet-stats-page",children:[(0,_.jsx)(k,{mssKeyInvalid:window.mailpoet_mss_key_invalid,subscribersCount:window.mailpoet_subscribers_count}),(0,_.jsx)(_a,{newsletter:c}),(0,_.jsx)(wa,{newsletter:c,isWoocommerceActive:x.x.isWoocommerceActive}),(0,_.jsxs)(ga.m,{activeKey:"clicked",children:[(0,_.jsx)(xa.O,{title:x.x.I18n.t("clickedLinks"),children:Ae.Hooks.applyFilters("mailpoet_newsletters_clicked_links_table",(0,_.jsx)(Sa,{}),c.clicked_links)},"clicked"),Ae.Hooks.applyFilters("mailpoet_newsletters_purchased_products",null,c),(0,_.jsx)(xa.O,{title:x.x.I18n.t("subscriberEngagement"),children:Ae.Hooks.applyFilters("mailpoet_newsletters_subscriber_engagement",(0,_.jsx)(Sa,{}),r,t.params,c)},"engagement"),(0,_.jsx)(xa.O,{title:x.x.I18n.t("bounces"),automationId:"bounces-tab",children:Ae.Hooks.applyFilters("mailpoet_newsletters_bounces",(0,_.jsx)(Sa,{}),r,t.params)},"bounces")]})]})]}):(0,_.jsxs)("h3",{children:[" ",x.x.I18n.t("emailDoesNotExist")," "]}):(0,_.jsx)("div",{children:(0,_.jsx)(he.X,{level:1,children:c.subject})})}));var Ca=n(17768),Ta=n(7197),ka=n(23064),Na=n.n(ka);function Da(e){const t=e.installedDaysAgo,n=t>30?x.x.I18n.t("reviewRequestUsingForMonths").replace("[months]",Math.round(t/30)):x.x.I18n.t("reviewRequestUsingForDays").replace("[days]",t);return(0,_.jsxs)("div",{className:"mailpoet_review_request",children:[(0,_.jsx)("img",{src:e.reviewRequestIllustrationUrl,height:"280",width:"280",alt:""}),(0,_.jsx)("h2",{children:x.x.I18n.t("reviewRequestHeading")}),(0,_.jsx)("p",{children:x.x.I18n.t("reviewRequestDidYouKnow").replace("[username]",e.username)}),(0,_.jsx)("p",{children:n}),(0,_.jsx)("p",{children:(0,_.jsx)("a",{href:"http://bit.ly/2Bi124o",target:"_blank",rel:"noopener noreferrer",className:"button button-primary",children:x.x.I18n.t("reviewRequestRateUsNow")})}),(0,_.jsx)("p",{children:(0,_.jsx)("a",{id:"mailpoet_review_request_not_now",children:x.x.I18n.t("reviewRequestNotNow")})})]})}Da.propTypes={installedDaysAgo:h().number.isRequired,reviewRequestIllustrationUrl:h().string.isRequired,username:h().string.isRequired};const Ea=()=>((0,y.useLayoutEffect)((()=>{window.mailpoet_display_nps_poll&&x.x.libs3rdPartyEnabled&&(Ln||(Ln=x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"analytics",action:"getTrackingData"})),Ln).then((e=>{let{data:t}=e;return(e=>{let t;t=window.mailpoet_display_nps_form?"EqOgKsgZd832Sz9w":window.mailpoet_is_new_user?"6L479eVPXk7pBn6S":"k0aJAsQAWI2ERyGv",Na()({writeKey:t,userId:window.mailpoet_current_wp_user.ID+window.mailpoet_site_url,traits:{name:window.mailpoet_current_wp_user.user_nicename,email:window.mailpoet_current_wp_user.user_email,mailpoetVersion:window.mailpoet_version,mailpoetPremiumIsActive:window.mailpoet_premium_active,createdAt:e.installedAtIso,newslettersSent:e.newslettersSent,welcomeEmails:e.welcomeEmails,postnotificationEmails:e.postnotificationEmails,woocommerceEmails:e.woocommerceEmails,subscribers:e.subscribers,lists:e.lists,sendingMethod:e.sendingMethod,woocommerceIsInstalled:e.woocommerceIsInstalled},events:{submit:e=>{e.rating>=9&&e.completed&&x.x.Modal.popup({width:800,template:Ta.renderToString(Da({username:window.mailpoet_current_wp_user_firstname||window.mailpoet_current_wp_user.user_login,reviewRequestIllustrationUrl:window.mailpoet_review_request_illustration_url,installedDaysAgo:window.mailpoet_installed_days_ago})),onInit:()=>{document.getElementById("mailpoet_review_request_not_now").addEventListener("click",(()=>x.x.Modal.close()))}})}}})})(t)}))}),[]),null),Aa=e=>function(t){return Ea(),(0,_.jsx)(e,{...t})};function Oa(){return(0,_.jsx)(L.Q,{children:(0,_.jsxs)(o.Link,{id:"mailpoet-new-email",className:"mailpoet-button button-secondary",to:"/new",onClick:()=>x.x.trackEvent("Emails > Add New"),"data-automation-id":"new_email",children:[F.R,(0,_.jsx)("span",{children:x.x.I18n.t("new")})]})})}const Ra=(0,l.EN)((function(e){let{children:t,location:n}=e;return null!==(0,dt.X)(n)||(e=>e.hash.match(/^#\/new/)||e.pathname.match(/^\/new/))(n)?null:t}));function Pa(e){let{mailpoetInstalledDaysAgo:t,sendTransactionalEmails:n,mtaMethod:r,noticeDismissed:a,apiVersion:s}=e;const[i,o]=(0,y.useState)(!1),l=()=>{x.x.Ajax.post({api_version:s,endpoint:"UserFlags",action:"set",data:{transactional_emails_opt_in_notice_dismissed:"1"}})};return t<30||n||"PHPMail"===r||"1"===a||i?null:(0,_.jsxs)(C.q,{type:"success",timeout:!1,onClose:l,children:[(0,_.jsx)("h3",{children:x.x.I18n.t("transactionalEmailNoticeTitle")}),(0,_.jsxs)("p",{children:[x.x.I18n.t("transactionalEmailNoticeBody")," ",(0,_.jsx)("a",{href:"https://kb.mailpoet.com/article/292-choose-how-to-send-your-wordpress-websites-emails",target:"_blank",rel:"noopener noreferrer",children:x.x.I18n.t("transactionalEmailNoticeBodyReadMore")})]}),(0,_.jsx)("p",{children:(0,_.jsx)("button",{type:"button",className:"button",onClick:()=>{o(!0),x.x.Ajax.post({api_version:s,endpoint:"settings",action:"set",data:{send_transactional_emails:"1"}}),l()},children:x.x.I18n.t("transactionalEmailNoticeCTA")})})]})}const Ma=window.mailpoet_woocommerce_automatic_emails||[],La=Aa((()=>{const{parentId:e}=(0,l.UO)();return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(Ra,{children:(0,_.jsx)(Oa,{})}),(0,_.jsxs)(Ca.t,{activeKey:"standard",routerType:"switch-only",onSwitch:e=>(e=>x.x.trackEvent(`Tab Emails > ${e} clicked`))(e),automationId:"newsletters_listing_tabs",children:[(0,_.jsx)(xa.O,{route:"standard/(.*)?",title:x.x.I18n.t("tabStandardTitle"),automationId:`tab-${x.x.I18n.t("tabStandardTitle")}`,children:(0,_.jsx)(Dr,{})},"standard"),(0,_.jsx)(xa.O,{route:"welcome/(.*)?",title:x.x.I18n.t("tabWelcomeTitle"),automationId:`tab-${x.x.I18n.t("tabWelcomeTitle")}`,children:(0,_.jsx)(qr,{})},"welcome"),(0,_.jsx)(xa.O,{route:"notification/(.*)?",title:x.x.I18n.t("tabNotificationTitle"),automationId:`tab-${x.x.I18n.t("tabNotificationTitle")}`,children:e?(0,_.jsx)(ia,{parentId:e}):(0,_.jsx)(Yr,{})},"notification"),(0,_.jsx)(xa.O,{route:"re_engagement/(.*)?",title:x.x.I18n.t("tabReEngagementTitle"),automationId:`tab-${x.x.I18n.t("tabReEngagementTitle")}`,children:(0,_.jsx)(Xr,{})},"re_engagement"),window.mailpoet_woocommerce_active&&w.ZP.map(Ma,(e=>(0,_.jsx)(xa.O,{route:`${e.slug}/(.*)?`,title:e.title,automationId:`tab-${e.title}`,children:(0,_.jsx)(lt,{})},e.slug)))]})]})}));function Fa(e){let{history:t}=e;return(0,_.jsx)(Ke,{history:t,hideClosingButton:0===window.mailpoet_newsletters_count})}Fa.propTypes={history:h().shape({push:h().func.isRequired}).isRequired};const qa=[...(()=>{const e=[];return w.ZP.each(Ma,(t=>{e.push({path:`/${t.slug}/(.*)?`,component:La});const{events:n}=t;w.ZP.isObject(n)&&w.ZP.each(n,(n=>{e.push({path:`/new/${t.slug}/${n.slug}/conditions`,render:e=>{const r={...e,email:t,name:n.slug};return(0,_.jsx)(fr,{...r})}})})),e.push({path:`/new/${t.slug}`,render:e=>{const n={...e,email:t};return(0,_.jsx)(We,{...n})}})})),e})(),{path:"/notification/history/:parentId/(.*)?",component:La},{path:"/(standard|welcome|notification|re_engagement)/(.*)?",component:La},{path:"/new/standard",component:cr},{path:"/new/notification",component:pr},{path:"/new/welcome",component:hr},{path:"/new/re-engagement",component:function(){let e="";x.x.deactivateSubscriberAfterInactiveDays&&(e=(Math.floor(Number(x.x.deactivateSubscriberAfterInactiveDays)/30)-1).toString());const[t,n]=(0,y.useState)({afterTimeNumber:e,afterTimeType:"months"}),[r,a]=(0,y.useState)([]),[s,i]=(0,y.useState)(!1),o=(0,l.k6)();return(0,_.jsxs)("div",{children:[(0,_.jsx)(Q.A,{color:"#fff"}),r&&(0,_.jsx)(He,{errors:r}),(0,_.jsx)(ut,{emailType:"re_engagement",automationId:"re_engagement_heading_creation_heading"}),(0,_.jsxs)(_t.Grid.Column,{align:"center",className:"mailpoet-schedule-email",children:[(0,_.jsx)(On,{afterTimeNumber:t.afterTimeNumber,afterTimeType:t.afterTimeType,inactiveSubscribersPeriod:Number(x.x.deactivateSubscriberAfterInactiveDays),updateAfterTimeNumber:(0,An.compose)([n,(0,An.assoc)("afterTimeNumber",An.__,t)]),updateAfterTimeType:(0,An.compose)([n,(0,An.assoc)("afterTimeType",An.__,t)])}),(0,_.jsx)(E.z,{isFullWidth:!0,onClick:()=>(a([]),i(!0),void x.x.Ajax.post({api_version:x.x.apiVersion,endpoint:"newsletters",action:"create",data:{type:"re_engagement",subject:x.x.I18n.t("draftNewsletterTitle"),options:t}}).done((e=>{var t;t=e.data.id,o.push(`/template/${t}`)})).fail((e=>{i(!1),e.errors&&a(e.errors)}))),type:"button",isDisabled:!t.afterTimeNumber||s,withSpinner:s,children:x.x.I18n.t("next")})]})]})}},{path:"/new",component:Fa},{name:"template",path:"/template/:id",component:xt},{path:"/send/congratulate/:id",component:or},{path:"/send/:id",component:Wn},{path:"/sending-status/:id/(.*)?",component:ca},{path:"/stats/:id/(.*)?",component:Ia}];function $a(){return(0,_.jsx)(Te.k.Provider,{value:(0,Te.S)(window),children:(0,_.jsxs)(o.HashRouter,{children:[(0,_.jsx)(Le.w,{}),(0,_.jsx)(T,{}),(0,_.jsx)(D,{}),(0,_.jsx)(Pa,{mailpoetInstalledDaysAgo:window.mailpoet_installed_days_ago,sendTransactionalEmails:window.mailpoet_send_transactional_emails,mtaMethod:window.mailpoet_mta_method,apiVersion:window.mailpoet_api_version,noticeDismissed:window.mailpoet_transactional_emails_opt_in_notice_dismissed}),(0,_.jsx)(k,{mssKeyInvalid:window.mailpoet_mss_key_invalid,subscribersCount:window.mailpoet_subscribers_count}),(0,_.jsxs)(l.rs,{children:[(0,_.jsx)(l.AW,{exact:!0,path:"/",render:()=>(0,_.jsx)(l.l_,{to:0===window.mailpoet_newsletters_count?"/new":"/standard"})}),qa.map((e=>(0,_.jsx)(l.AW,{path:e.path,component:e.component,name:e.name||null,data:e.data||null,render:e.render},e.path)))]})]})})}const Ua=document.getElementById("newsletters_container");Ua&&(window.mailpoet_listing=i.render((0,_.jsx)($a,{}),Ua));const Za=e=>"wp_users"===e.type,Va=e=>"woocommerce_users"===e.type,Wa=e=>Za(e)||Va(e),Ya=x.x.trackingConfig.emailTrackingEnabled,Ba=[{name:"name",label:x.x.I18n.t("name"),sortable:!0},{name:"description",label:x.x.I18n.t("description")},{name:"average_subscriber_score",label:x.x.I18n.t("listScore"),display:Ya},{name:"subscribed",label:x.x.I18n.t("subscribed"),className:"mailpoet-listing-column-narrow"},{name:"unconfirmed",label:x.x.I18n.t("unconfirmed"),className:"mailpoet-listing-column-narrow"},{name:"unsubscribed",label:x.x.I18n.t("unsubscribed"),className:"mailpoet-listing-column-narrow"},{name:"inactive",label:x.x.I18n.t("inactive"),className:"mailpoet-listing-column-narrow"},{name:"bounced",label:x.x.I18n.t("bounced"),className:"mailpoet-listing-column-narrow"},{name:"created_at",label:x.x.I18n.t("createdOn"),sortable:!0}],Ha={onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneSegmentTrashed"):x.x.I18n.t("multipleSegmentsTrashed").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneSegmentDeleted"):x.x.I18n.t("multipleSegmentsDeleted").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneSegmentRestored"):x.x.I18n.t("multipleSegmentsRestored").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)}},za=[{name:"trash",label:x.x.I18n.t("moveToTrash"),onSuccess:Ha.onTrash}],Ga=e=>!Wa(e),Ka=[{name:"edit",className:"mailpoet-hide-on-mobile",link:function(e){return(0,_.jsx)(o.Link,{to:`/edit/${e.id}`,children:x.x.I18n.t("edit")})},display:function(e){return!Wa(e)}},{name:"duplicate_segment",className:"mailpoet-hide-on-mobile",label:x.x.I18n.t("duplicate"),onClick:(e,t)=>x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"segments",action:"duplicate",data:{id:e.id}}).done((e=>{x.x.Notice.success(x.x.I18n.t("listDuplicated").replace("%1$s",e.data.name)),t()})).fail((e=>{x.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})})),display:function(e){return!Wa(e)}},{name:"read_more",className:"mailpoet-hide-on-mobile",link:function(){return(0,_.jsx)("a",{href:"https://kb.mailpoet.com/article/133-the-wordpress-users-list",target:"_blank",rel:"noopener noreferrer",children:x.x.I18n.t("readMore")})},display:function(e){return Za(e)}},{name:"synchronize_segment",label:x.x.I18n.t("forceSync"),onClick:function(e,t){x.x.Modal.loading(!0),x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"segments",action:"synchronize",data:{type:e.type}}).done((()=>{let n=x.x.I18n.t("listSynchronized").replace("%1$s",e.name);"woocommerce_users"===e.type&&(n=x.x.I18n.t("listSynchronizationWasScheduled").replace("%1$s",e.name)),x.x.Modal.loading(!1),x.x.Notice.success(n),t()})).fail((e=>{x.x.Modal.loading(!1),e.errors.length>0&&x.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},display:function(e){return Za(e)||Va(e)}},{name:"view_subscribers",link:function(e){return(0,_.jsx)("a",{href:e.subscribers_url,"data-automation-id":`view_subscribers_${e.name}`,children:x.x.I18n.t("viewSubscribers")})}},{name:"trash",className:"mailpoet-hide-on-mobile",display:function(e){return!Va(e)}}];class Qa extends y.Component{constructor(){super(...arguments),(0,b.Z)(this,"renderItem",((e,t)=>{const n=d()("manage-column","column-primary","has-row-actions"),r=Number(e.subscribers_count.subscribed||0),a=Number(e.subscribers_count.unconfirmed||0),s=Number(e.subscribers_count.unsubscribed||0),i=Number(e.subscribers_count.inactive||0),l=Number(e.subscribers_count.bounced||0);let c;return c=Wa(e)?(0,_.jsx)("span",{className:"mailpoet-listing-title",children:e.name}):(0,_.jsx)(o.Link,{className:"mailpoet-listing-title",to:`/edit/${e.id}`,children:e.name}),(0,_.jsxs)("div",{children:[(0,_.jsxs)("td",{className:n,"data-automation-id":`segment_name_${e.name}`,children:[c,t]}),(0,_.jsx)("td",{"data-colname":x.x.I18n.t("description"),children:(0,_.jsx)("abbr",{children:e.description})}),Ya?(0,_.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":x.x.I18n.t("averageScore"),children:(0,_.jsx)("div",{className:"mailpoet-listing-stats",children:(0,_.jsx)(M,{id:e.id,engagementScore:e.average_engagement_score})})}):null,(0,_.jsx)("td",{className:"mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("subscribed"),children:(0,_.jsx)("abbr",{children:r.toLocaleString()})}),(0,_.jsx)("td",{className:"mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("unconfirmed"),children:(0,_.jsx)("abbr",{children:a.toLocaleString()})}),(0,_.jsx)("td",{className:"mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("unsubscribed"),children:(0,_.jsx)("abbr",{children:s.toLocaleString()})}),(0,_.jsx)("td",{className:"mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("inactive"),children:(0,_.jsx)("abbr",{children:i.toLocaleString()})}),(0,_.jsx)("td",{className:"mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("bounced"),children:(0,_.jsx)("abbr",{children:l.toLocaleString()})}),(0,_.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("createdOn"),children:[x.x.Date.short(e.created_at),(0,_.jsx)("br",{}),x.x.Date.time(e.created_at)]})]})}))}render(){return(0,_.jsx)("div",{className:"mailpoet-segments-listing",children:(0,_.jsx)(g.N,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,messages:Ha,search:!1,endpoint:"segments",base_url:"lists",onRenderItem:this.renderItem,columns:Ba,bulk_actions:za,item_actions:Ka,sort_by:"name",sort_order:"asc",isItemDeletable:Ga,isItemToggleable:Za})})}}Qa.propTypes={location:h().object.isRequired,match:h().shape({params:h().object}).isRequired};const Xa=(0,l.EN)(Qa),Ja=[{name:"name",label:x.x.I18n.t("name"),type:"text"},{name:"description",label:x.x.I18n.t("description"),type:"textarea",tip:x.x.I18n.t("segmentDescriptionTip")},{name:"showInManageSubscriptionPage",label:x.x.I18n.t("showInManageSubscriptionPage"),type:"checkbox",values:{showInManageSubscriptionPage:x.x.I18n.t("showInManageSubscriptionPageTip")},isChecked:!0}],es={onUpdate:function(){x.x.Notice.success(x.x.I18n.t("segmentUpdated"))},onCreate:function(){x.x.Notice.success(x.x.I18n.t("segmentAdded")),x.x.trackEvent("Lists > Add new")}};function ts(e){return(0,_.jsxs)("div",{children:[(0,_.jsx)(Q.A,{color:"#fff"}),(0,_.jsx)(ye.B,{}),(0,_.jsxs)(he.X,{level:1,className:"mailpoet-title",children:[(0,_.jsx)("span",{children:x.x.I18n.t("segment")}),(0,_.jsx)(o.Link,{className:"mailpoet-button button button-secondary button-small",to:"/",children:x.x.I18n.t("backToList")})]}),(0,_.jsx)(T,{}),(0,_.jsx)(be,{endpoint:"segments",fields:Ja,params:e.match.params,messages:es})]})}ts.propTypes={match:h().shape({params:h().shape({id:h().string}).isRequired}).isRequired};var ns=n(85479),rs=n(87834),as=n(5635),ss=n(77595);function is(e){let{filterIndex:t}=e;const n=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,ns.Z)("mailpoet-dynamic-segments-form"),s=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getNewslettersList()),[]),i=null==s?void 0:s.map((e=>{const t=e.sent_at?x.x.Date.format(e.sent_at):x.x.I18n.t("notSentYet");return{label:e.subject,tag:t,value:Number(e.id)}}));return(0,y.useEffect)((()=>{n.operator!==ss.AnyValueTypes.ANY&&n.operator!==ss.AnyValueTypes.ALL&&n.operator!==ss.AnyValueTypes.NONE&&r({operator:ss.AnyValueTypes.ANY},t),n.action===ss.EmailActionTypes.MACHINE_OPENED&&n.operator===ss.AnyValueTypes.NONE&&r({operator:ss.AnyValueTypes.ANY},t)}),[n.action,n.operator,t,r]),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(_t.Grid.CenteredRow,{children:(0,_.jsxs)(ae.Select,{isFullWidth:!0,value:n.operator,onChange:e=>{a("operator",t,e)},children:[(0,_.jsx)("option",{value:ss.AnyValueTypes.ANY,children:x.x.I18n.t("anyOf")}),(0,_.jsx)("option",{value:ss.AnyValueTypes.ALL,children:x.x.I18n.t("allOf")}),n.action!==ss.EmailActionTypes.MACHINE_OPENED?(0,_.jsx)("option",{value:ss.AnyValueTypes.NONE,children:x.x.I18n.t("noneOf")}):null]},"select")}),(0,_.jsx)(_t.Grid.CenteredRow,{children:(0,_.jsx)(as.ReactSelect,{dimension:"small",isFullWidth:!0,isMulti:!0,placeholder:x.x.I18n.t("selectNewsletterPlaceholder"),options:i,automationId:"segment-email",value:(0,An.filter)((e=>{if(!n.newsletters)return;const t=e.value;return-1!==n.newsletters.indexOf(t)}),i),onChange:e=>{r({newsletters:(0,An.map)("value",e)},t)}})})]})}const os=e=>!!e;function ls(e){return x.x.I18n.t("emailActionOpensDaysSentence").split(/({days})/gim).map(e)}function cs(e){let{filterIndex:t}=e;const n=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,ns.Z)("mailpoet-dynamic-segments-form");return(0,y.useEffect)((()=>{void 0===n.operator&&r({operator:"more"},t)}),[r,n,t]),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(_t.Grid.CenteredRow,{children:(s=e=>"{condition}"===e?(0,_.jsxs)(ae.Select,{value:n.operator,onChange:e=>{a("operator",t,e)},children:[(0,_.jsx)("option",{value:"more",children:x.x.I18n.t("moreThan")}),(0,_.jsx)("option",{value:"less",children:x.x.I18n.t("lessThan")}),(0,_.jsx)("option",{value:"equals",children:x.x.I18n.t("equals")}),(0,_.jsx)("option",{value:"not_equals",children:x.x.I18n.t("notEquals")})]},"select"):"{opens}"===e?(0,_.jsx)(ee.I,{type:"number",value:n.opens||"","data-automation-id":"segment-number-of-opens",onChange:e=>{a("opens",t,e)},min:"0",placeholder:x.x.I18n.t("emailActionOpens")},"input"):"string"==typeof e&&e.trim().length>1?(0,_.jsx)("div",{children:e},"opens"):null,x.x.I18n.t("emailActionOpensSentence").split(/({condition})|({opens})|(\b[a-zA-Z]+\b)/gim).map(s))}),(0,_.jsx)(_t.Grid.CenteredRow,{children:ls((e=>"{days}"===e?(0,_.jsx)(ee.I,{type:"number",value:n.days||"","data-automation-id":"segment-number-of-days",onChange:e=>{a("days",t,e)},min:"0",placeholder:x.x.I18n.t("emailActionDays")},"input"):"string"==typeof e&&e.trim().length>1?(0,_.jsx)("div",{children:e},e):null))})]});var s}const ds=[{value:ss.EmailActionTypes.OPENS_ABSOLUTE_COUNT,label:x.x.I18n.t("emailActionOpensAbsoluteCount"),group:ss.SegmentTypes.Email},{value:ss.EmailActionTypes.MACHINE_OPENS_ABSOLUTE_COUNT,label:x.x.I18n.t("emailActionMachineOpensAbsoluteCount"),group:ss.SegmentTypes.Email},{value:ss.EmailActionTypes.OPENED,label:x.x.I18n.t("emailActionOpened"),group:ss.SegmentTypes.Email},{value:ss.EmailActionTypes.MACHINE_OPENED,label:x.x.I18n.t("emailActionMachineOpened"),group:ss.SegmentTypes.Email},{value:ss.EmailActionTypes.CLICKED,label:x.x.I18n.t("emailActionClicked"),group:ss.SegmentTypes.Email},{value:ss.EmailActionTypes.CLICKED_ANY,label:x.x.I18n.t("emailActionClickedAnyEmail"),group:ss.SegmentTypes.Email}],us={[ss.EmailActionTypes.OPENS_ABSOLUTE_COUNT]:cs,[ss.EmailActionTypes.MACHINE_OPENS_ABSOLUTE_COUNT]:cs,[ss.EmailActionTypes.CLICKED]:function(e){let{filterIndex:t}=e;const n=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,ns.Z)("mailpoet-dynamic-segments-form"),s=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getNewslettersList()),[]),[i,o]=(0,y.useState)([]),[l,c]=(0,y.useState)([]),[d,u]=(0,y.useState)(!1),p=null==s?void 0:s.map((e=>{const t=e.sent_at?x.x.Date.format(e.sent_at):x.x.I18n.t("notSentYet");return{label:e.subject,tag:t,value:Number(e.id)}})),m=(0,y.useCallback)((()=>{var e;os(n.newsletter_id)&&(c([]),e=n.newsletter_id,o([]),u(!0),x.x.Ajax.post({api_version:x.x.apiVersion,endpoint:"newsletter_links",action:"get",data:{newsletterId:e}}).then((e=>{const{data:t}=e,n=t.map((e=>({value:e.id,label:e.url})));u(!1),c(n)})).fail((e=>{o(e.errors)})))}),[n.newsletter_id]);return(0,y.useEffect)((()=>{m()}),[m,n.newsletter_id]),(0,y.useEffect)((()=>{n.operator!==ss.AnyValueTypes.ANY&&n.operator!==ss.AnyValueTypes.ALL&&n.operator!==ss.AnyValueTypes.NONE&&r({operator:ss.AnyValueTypes.ANY},t)}),[n.operator,t,r]),(0,_.jsxs)(_.Fragment,{children:[i.length>0&&(0,_.jsx)(He,{errors:i}),(0,_.jsx)(_t.Grid.CenteredRow,{children:(0,_.jsx)(as.ReactSelect,{dimension:"small",isFullWidth:!0,placeholder:x.x.I18n.t("selectNewsletterPlaceholder"),options:p,value:(0,An.find)(["value",n.newsletter_id],p),onChange:e=>{r({newsletter_id:e.value,link_ids:[]},t)},automationId:"segment-email"})}),(0,_.jsxs)(_t.Grid.CenteredRow,{children:[(0,_.jsxs)(ae.Select,{isMinWidth:!0,value:n.operator,onChange:e=>a("operator",t,e),automationId:"select-operator",children:[(0,_.jsx)("option",{value:ss.AnyValueTypes.ANY,children:x.x.I18n.t("anyOf")}),(0,_.jsx)("option",{value:ss.AnyValueTypes.ALL,children:x.x.I18n.t("allOf")}),(0,_.jsx)("option",{value:ss.AnyValueTypes.NONE,children:x.x.I18n.t("noneOf")})]},"select-operator"),d&&(0,_.jsx)("span",{children:x.x.I18n.t("loadingDynamicSegmentItems")}),!d&&os(n.newsletter_id)&&(0,_.jsx)(as.ReactSelect,{isMulti:!0,dimension:"small",isFullWidth:!0,automationId:"segment-link-select",placeholder:x.x.I18n.t("allLinksPlaceholder"),options:l.length?l:[{value:0,label:x.x.I18n.t("noLinksHint"),isDisabled:!0}],value:(0,An.filter)((e=>!!n.link_ids&&-1!==n.link_ids.indexOf(e.value)),l),onChange:e=>{r({link_ids:(e||[]).map((e=>e.value))},t)}})]})]})},[ss.EmailActionTypes.OPENED]:is,[ss.EmailActionTypes.MACHINE_OPENED]:is,[ss.EmailActionTypes.CLICKED_ANY]:null};var ps;!function(e){e.NUMBER_OF_ORDERS="numberOfOrders",e.PURCHASED_CATEGORY="purchasedCategory",e.PURCHASED_PRODUCT="purchasedProduct",e.TOTAL_SPENT="totalSpent",e.CUSTOMER_IN_COUNTRY="customerInCountry"}(ps||(ps={}));const ms=[{value:ps.CUSTOMER_IN_COUNTRY,label:x.x.I18n.t("wooCustomerInCountry"),group:ss.SegmentTypes.WooCommerce},{value:ps.NUMBER_OF_ORDERS,label:x.x.I18n.t("wooNumberOfOrders"),group:ss.SegmentTypes.WooCommerce},{value:ps.PURCHASED_CATEGORY,label:x.x.I18n.t("wooPurchasedCategory"),group:ss.SegmentTypes.WooCommerce},{value:ps.PURCHASED_PRODUCT,label:x.x.I18n.t("wooPurchasedProduct"),group:ss.SegmentTypes.WooCommerce},{value:ps.TOTAL_SPENT,label:x.x.I18n.t("wooTotalSpent"),group:ss.SegmentTypes.WooCommerce}],hs=[ps.PURCHASED_PRODUCT,ps.PURCHASED_CATEGORY];function fs(e){let{filterIndex:t}=e;const n=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,ns.Z)("mailpoet-dynamic-segments-form");(0,y.useEffect)((()=>{n.action===ss.SubscriberActionTypes.WORDPRESS_ROLE&&n.operator!==ss.AnyValueTypes.ANY&&n.operator!==ss.AnyValueTypes.ALL&&n.operator!==ss.AnyValueTypes.NONE&&r({operator:ss.AnyValueTypes.ANY},t)}),[r,n,t]);const s=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getWordpressRoles()),[]).map((e=>({value:e.role_id,label:e.role_name})));return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(_t.Grid.CenteredRow,{children:(0,_.jsxs)(ae.Select,{isFullWidth:!0,value:n.operator,onChange:e=>{a("operator",t,e)},children:[(0,_.jsx)("option",{value:ss.AnyValueTypes.ANY,children:x.x.I18n.t("anyOf")}),(0,_.jsx)("option",{value:ss.AnyValueTypes.ALL,children:x.x.I18n.t("allOf")}),(0,_.jsx)("option",{value:ss.AnyValueTypes.NONE,children:x.x.I18n.t("noneOf")})]},"select")}),(0,_.jsx)(_t.Grid.CenteredRow,{children:(0,_.jsx)(as.ReactSelect,{dimension:"small",isFullWidth:!0,isMulti:!0,automationId:"segment-wordpress-role",placeholder:x.x.I18n.t("selectUserRolePlaceholder"),options:s,value:(0,An.filter)((e=>{if(n.wordpressRole)return-1!==n.wordpressRole.indexOf(e.value)}),s),onChange:e=>{r({wordpressRole:(0,An.map)("value",e)},t)}})})]})}let gs;!function(e){e.HIGHER_THAN="higherThan",e.LOWER_THAN="lowerThan",e.EQUALS="equals",e.NOT_EQUALS="not_equals",e.UNKNOWN="unknown",e.NOT_UNKNOWN="not_unknown"}(gs||(gs={}));const xs=[gs.HIGHER_THAN,gs.LOWER_THAN,gs.EQUALS,gs.NOT_EQUALS,gs.UNKNOWN,gs.NOT_UNKNOWN];var vs=n(30091),bs=n(47612);let ys;!function(e){e.BEFORE="before",e.AFTER="after",e.ON="on",e.NOT_ON="notOn",e.IN_THE_LAST="inTheLast",e.NOT_IN_THE_LAST="notInTheLast"}(ys||(ys={}));const ws=[ys.BEFORE,ys.AFTER,ys.ON,ys.NOT_ON,ys.IN_THE_LAST,ys.NOT_IN_THE_LAST],_s=e=>{if(null!==e){if(Array.isArray(e))throw new Error("convertDateToString can process only single date array given");return x.x.Date.format(e,{format:"Y-m-d"})}},js=e=>{const t=(0,vs.default)(e);if((0,bs.default)(t))return t};function Ss(e){return"string"==typeof e.value&&e.value.length>0&&("equals"===e.operator||"contains"===e.operator||"not_equals"===e.operator||"more_than"===e.operator||"less_than"===e.operator)}function Is(e){let{filterIndex:t}=e;const n=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilterFromEvent:r,updateSegmentFilter:a}=(0,ns.Z)("mailpoet-dynamic-segments-form");return(0,y.useEffect)((()=>{void 0===n.operator&&a({operator:"equals",value:""},t)}),[a,n,t]),(0,_.jsxs)(_t.Grid.CenteredRow,{children:[(0,_.jsxs)(ae.Select,{automationId:"text-custom-field-operator",value:n.operator,onChange:e=>{r("operator",t,e)},children:[(0,_.jsx)("option",{value:"equals",children:x.x.I18n.t("equals")}),(0,_.jsx)("option",{value:"not_equals",children:x.x.I18n.t("notEquals")}),(0,_.jsx)("option",{value:"contains",children:x.x.I18n.t("contains")}),(0,_.jsx)("option",{value:"more_than",children:x.x.I18n.t("moreThan")}),(0,_.jsx)("option",{value:"less_than",children:x.x.I18n.t("lessThan")})]},"select"),(0,_.jsx)(ee.I,{"data-automation-id":"text-custom-field-value",value:n.value||"",onChange:e=>{r("value",t,e)},placeholder:x.x.I18n.t("value")},"input")]})}function Cs(e){return"string"==typeof e.value&&e.value.length>0}function Ts(e){let{filterIndex:t}=e;const n=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r}=(0,ns.Z)("mailpoet-dynamic-segments-form"),a=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getCustomFieldsList()),[]),s=(0,An.find)({id:Number(n.custom_field_id)},a);if(!s)return null;const i=s.params;if(!i||!Array.isArray(i.values))return null;const o=i.values.map((e=>({value:e.value,label:e.value})));return(0,_.jsx)(as.ReactSelect,{dimension:"small",isFullWidth:!0,placeholder:x.x.I18n.t("selectValue"),options:o,value:n.value?{value:n.value,label:n.value}:null,onChange:e=>{r({value:e.value,operator:"equals"},t)},automationId:"segment-wordpress-role"})}var ks=n(42384),Ns=n(95822);const Ds=e=>{if(null!==e){if(Array.isArray(e))throw new Error("convertDateToString can process only single date array given");return(0,Ns.default)(e,"yyyy-MM-dd 00:00:00")}},Es=e=>{const t=(0,vs.default)(e);if((0,bs.default)(t))return t},As={month:function(e){let{onChange:t,item:n,filterIndex:r}=e;return(0,y.useEffect)((()=>{void 0!==n.value&&""!==n.value||t((0,An.assign)(n,{value:"2017-01-01 00:00:00"}),r)}),[t,n,r]),(0,_.jsxs)(ae.Select,{value:n.value,onChange:e=>{t((0,An.assign)(n,{value:e.target.value}),r)},children:[(0,_.jsx)("option",{value:"2017-01-01 00:00:00",children:x.x.I18n.t("january")}),(0,_.jsx)("option",{value:"2017-02-01 00:00:00",children:x.x.I18n.t("february")}),(0,_.jsx)("option",{value:"2017-03-01 00:00:00",children:x.x.I18n.t("march")}),(0,_.jsx)("option",{value:"2017-04-01 00:00:00",children:x.x.I18n.t("april")}),(0,_.jsx)("option",{value:"2017-05-01 00:00:00",children:x.x.I18n.t("may")}),(0,_.jsx)("option",{value:"2017-06-01 00:00:00",children:x.x.I18n.t("june")}),(0,_.jsx)("option",{value:"2017-07-01 00:00:00",children:x.x.I18n.t("july")}),(0,_.jsx)("option",{value:"2017-08-01 00:00:00",children:x.x.I18n.t("august")}),(0,_.jsx)("option",{value:"2017-09-01 00:00:00",children:x.x.I18n.t("september")}),(0,_.jsx)("option",{value:"2017-10-01 00:00:00",children:x.x.I18n.t("october")}),(0,_.jsx)("option",{value:"2017-11-01 00:00:00",children:x.x.I18n.t("november")}),(0,_.jsx)("option",{value:"2017-12-01 00:00:00",children:x.x.I18n.t("december")})]},"select")},year:function(e){let{onChange:t,item:n,filterIndex:r}=e;const a=(0,ks.default)(new Date);return(0,y.useEffect)((()=>{void 0!==n.value&&""!==n.value||t((0,An.assign)(n,{value:`${a}-01-01 00:00:00`,operator:"equals"}),r)}),[a,t,n,r]),(0,_.jsxs)(_t.Grid.CenteredRow,{children:[(0,_.jsxs)(ae.Select,{value:n.operator,onChange:e=>{t((0,An.assign)(n,{operator:e.target.value}),r)},children:[(0,_.jsx)("option",{value:"equals",children:x.x.I18n.t("equals")}),(0,_.jsx)("option",{value:"before",children:x.x.I18n.t("before")}),(0,_.jsx)("option",{value:"after",children:x.x.I18n.t("after")})]},"select-operator"),(0,_.jsx)(ae.Select,{value:n.value,onChange:e=>{t((0,An.assign)(n,{value:e.target.value}),r)},children:(0,An.range)(0,100).map((e=>(0,_.jsx)("option",{value:a-e+"-01-01 00:00:00",children:a-e},a-e)))},"select-year")]})},year_month:function(e){let{onChange:t,item:n,filterIndex:r}=e;return(0,y.useEffect)((()=>{void 0!==n.value&&""!==n.value||t((0,An.assign)(n,{value:`${(0,Ns.default)(new Date,"yyyy-MM-dd")} 00:00:00`,operator:"equals"}),r)}),[t,n,r]),(0,_.jsxs)(_t.Grid.CenteredRow,{children:[(0,_.jsxs)(ae.Select,{value:n.operator,onChange:e=>{t((0,An.assign)(n,{operator:e.target.value}),r)},children:[(0,_.jsx)("option",{value:"equals",children:x.x.I18n.t("equals")}),(0,_.jsx)("option",{value:"before",children:x.x.I18n.t("before")}),(0,_.jsx)("option",{value:"after",children:x.x.I18n.t("after")})]},"select-operator"),(0,_.jsx)(kt,{onChange:e=>t((0,An.assign)(n,{value:Ds(e)}),r),selected:n.value?Es(n.value):void 0,dateFormat:"MM/yyyy",showMonthYearPicker:!0})]})},year_month_day:function(e){let{onChange:t,item:n,filterIndex:r}=e;return(0,y.useEffect)((()=>{void 0!==n.value&&""!==n.value||t((0,An.assign)(n,{value:`${(0,Ns.default)(new Date,"yyyy-MM-dd")} 00:00:00`,operator:"equals"}),r)}),[t,n,r]),(0,_.jsxs)(_t.Grid.CenteredRow,{children:[(0,_.jsxs)(ae.Select,{value:n.operator,onChange:e=>{t((0,An.assign)(n,{operator:e.target.value}),r)},children:[(0,_.jsx)("option",{value:"equals",children:x.x.I18n.t("equals")}),(0,_.jsx)("option",{value:"before",children:x.x.I18n.t("before")}),(0,_.jsx)("option",{value:"after",children:x.x.I18n.t("after")})]},"select-operator"),(0,_.jsx)(kt,{dateFormat:"MMM d, yyyy",onChange:e=>t((0,An.assign)(n,{value:Ds(e)}),r),selected:n.value?Es(n.value):void 0})]})}};var Os;!function(e){e.DATE="date",e.TEXT="text",e.TEXTAREA="textarea",e.RADIO="radio",e.CHECKBOX="checkbox",e.SELECT="select"}(Os||(Os={}));const Rs={[Os.TEXT]:Ss,[Os.TEXTAREA]:Ss,[Os.RADIO]:Cs,[Os.SELECT]:Cs,[Os.CHECKBOX]:function(e){return"1"===e.value||"0"===e.value},[Os.DATE]:function(e){return("month"===e.date_type||!("string"!=typeof e.operator||e.operator.length<1))&&"string"==typeof e.value&&e.value.length>1}},Ps={[Os.TEXT]:Is,[Os.TEXTAREA]:Is,[Os.RADIO]:Ts,[Os.SELECT]:Ts,[Os.CHECKBOX]:function(e){let{filterIndex:t}=e;const n=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilterFromEvent:r,updateSegmentFilter:a}=(0,ns.Z)("mailpoet-dynamic-segments-form");return(0,y.useEffect)((()=>{"1"!==n.value&&"0"!==n.value&&a({operator:"equals",value:"1"},t)}),[a,n,t]),(0,_.jsxs)(ae.Select,{value:n.value,onChange:e=>r("value",t,e),children:[(0,_.jsx)("option",{value:"1",children:x.x.I18n.t("checked")}),(0,_.jsx)("option",{value:"0",children:x.x.I18n.t("unchecked")})]},"select")},[Os.DATE]:function(e){let{customField:t,filterIndex:n}=e;const r=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(n)),[n]),{updateSegmentFilter:a}=(0,ns.Z)("mailpoet-dynamic-segments-form");(0,y.useEffect)((()=>{r.date_type!==t.params.date_type&&a({date_type:t.params.date_type,value:""},n)}),[r.date_type,a,t.params.date_type,n]);const s=As[t.params.date_type];return s?(0,_.jsx)(s,{item:r,onChange:a,filterIndex:n}):null}},{subscribersLimitReached:Ms,subscribersLimit:Ls,subscribersCount:Fs,premiumActive:qs,hasValidApiKey:$s,hasValidPremiumKey:Us,isPremiumPluginInstalled:Zs,premiumPluginDownloadUrl:Vs,premiumPluginActivationUrl:Ws,pluginPartialKey:Ys}=x.x,Bs=$s||Us,Hs=e=>{const t=x.x.I18n.t(e);return(0,_.jsx)("p",{children:I()(t,/(\[subscribersCount]|\[subscribersLimit])/g,(e=>"[subscribersCount]"===e?Fs:Ls))})},zs=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"_blank";return(0,_.jsx)(E.z,{href:t,target:n,rel:"noopener noreferrer",children:x.x.I18n.t(e)})};function Gs(e){let t,n,{message:r,actionButton:a}=e;if(Bs&&!qs)t=Hs("premiumFeatureDescription"),n=Zs?zs("premiumFeatureButtonActivatePremium",Ws,"_self"):zs("premiumFeatureButtonDownloadPremium",Vs);else if(Ms){t=Hs("premiumFeatureDescriptionSubscribersLimitReached");const e=Bs?x.x.MailPoetComUrlFactory.getUpgradeUrl(Ys):x.x.MailPoetComUrlFactory.getPurchasePlanUrl(+Fs+1);n=zs("premiumFeatureButtonUpgradePlan",e)}else t=r,n=a;return(0,_.jsx)(Oe.K,{title:x.x.I18n.t("premiumFeature"),message:t,actionButton:n})}function Ks(){return(0,_.jsx)(Gs,{message:(()=>{const e=x.x.I18n.t("premiumFeatureMultipleConditions");return(0,_.jsx)("p",{children:I()(e,/\[link](.*?)\[\/link]/g,(e=>(0,_.jsx)("a",{href:x.x.premiumLink,target:"_blank",rel:"noopener noreferrer",children:e},e)))})})(),actionButton:(0,_.jsx)(E.z,{href:x.x.MailPoetComUrlFactory.getPurchasePlanUrl(x.x.subscribersCount,x.x.currentWpUserEmail,null,{utm_medium:"segments",utm_campaign:"signup"}),target:"_blank",rel:"noopener noreferrer",children:x.x.I18n.t("premiumBannerCtaFree")})})}const Qs=[{value:ss.SubscriberActionTypes.MAILPOET_CUSTOM_FIELD,label:x.x.I18n.t("mailpoetCustomField"),group:ss.SegmentTypes.WordPressRole},{value:ss.SubscriberActionTypes.SUBSCRIBER_SCORE,label:x.x.I18n.t("subscriberScore"),group:ss.SegmentTypes.WordPressRole},{value:ss.SubscriberActionTypes.SUBSCRIBED_DATE,label:x.x.I18n.t("subscribedDate"),group:ss.SegmentTypes.WordPressRole},{value:ss.SubscriberActionTypes.SUBSCRIBED_TO_LIST,label:x.x.I18n.t("subscribedToList"),group:ss.SegmentTypes.WordPressRole},{value:ss.SubscriberActionTypes.SUBSCRIBER_TAG,label:x.x.I18n.t("subscriberTag"),group:ss.SegmentTypes.WordPressRole},{value:ss.SubscriberActionTypes.WORDPRESS_ROLE,label:x.x.I18n.t("segmentsSubscriber"),group:ss.SegmentTypes.WordPressRole}],Xs={[ss.SubscriberActionTypes.WORDPRESS_ROLE]:fs,[ss.SubscriberActionTypes.SUBSCRIBER_SCORE]:function(e){let{filterIndex:t}=e;const n=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,ns.Z)("mailpoet-dynamic-segments-form");return(0,y.useEffect)((()=>{xs.includes(n.operator)||r({operator:gs.HIGHER_THAN},t),n.operator!==gs.HIGHER_THAN&&n.operator!==gs.LOWER_THAN&&n.operator!==gs.EQUALS&&n.operator!==gs.NOT_EQUALS||void 0!==n.value||r({value:""},t),n.operator!==gs.UNKNOWN&&n.operator!==gs.NOT_UNKNOWN||r({value:null},t)}),[r,n,t]),(0,_.jsx)(_t.Grid.CenteredRow,{children:(s=e=>"{condition}"===e?(0,_.jsxs)(ae.Select,{value:n.operator,automationId:"segment-subscriber-score-operator",onChange:e=>{a("operator",t,e)},children:[(0,_.jsx)("option",{value:gs.HIGHER_THAN,children:x.x.I18n.t("higherThan")}),(0,_.jsx)("option",{value:gs.LOWER_THAN,children:x.x.I18n.t("lowerThan")}),(0,_.jsx)("option",{value:gs.EQUALS,children:x.x.I18n.t("equals")}),(0,_.jsx)("option",{value:gs.NOT_EQUALS,children:x.x.I18n.t("notEquals")}),(0,_.jsx)("option",{value:gs.UNKNOWN,children:x.x.I18n.t("unknown")}),(0,_.jsx)("option",{value:gs.NOT_UNKNOWN,children:x.x.I18n.t("notUnknown")})]},"select"):"{score}"===e?(n.operator===gs.HIGHER_THAN||n.operator===gs.LOWER_THAN||n.operator===gs.EQUALS||n.operator===gs.NOT_EQUALS)&&(0,_.jsx)(ee.I,{type:"number",value:n.value||"","data-automation-id":"segment-subscriber-score-value",onChange:e=>{a("value",t,e)},min:"0",placeholder:x.x.I18n.t("subscriberScorePlaceholder")},"input"):"string"==typeof e&&e.trim().length>0?n.operator!==gs.UNKNOWN&&n.operator!==gs.NOT_UNKNOWN&&(0,_.jsx)("div",{children:e},"score"):null,x.x.I18n.t("subscriberScoreSentence").split(/({condition})|({score})|(\b%\b)/gim).map(s))});var s},[ss.SubscriberActionTypes.SUBSCRIBED_DATE]:function(e){let{filterIndex:t}=e;const n=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,ns.Z)("mailpoet-dynamic-segments-form");return(0,y.useEffect)((()=>{ws.includes(n.operator)||r({operator:ys.BEFORE},t),n.operator!==ys.BEFORE&&n.operator!==ys.AFTER&&n.operator!==ys.ON&&n.operator!==ys.NOT_ON||void 0!==js(n.value)&&/^\d+-\d+-\d+$/.test(n.value)||r({value:_s(new Date)},t),n.operator!==ys.IN_THE_LAST&&n.operator!==ys.NOT_IN_THE_LAST||"string"!=typeof n.value||/^\d*$/.exec(n.value)||r({value:""},t)}),[r,n,t]),(0,_.jsxs)(_t.Grid.CenteredRow,{children:[(0,_.jsxs)(ae.Select,{value:n.operator,onChange:e=>{a("operator",t,e)},children:[(0,_.jsx)("option",{value:ys.BEFORE,children:x.x.I18n.t("before")}),(0,_.jsx)("option",{value:ys.AFTER,children:x.x.I18n.t("after")}),(0,_.jsx)("option",{value:ys.ON,children:x.x.I18n.t("on")}),(0,_.jsx)("option",{value:ys.NOT_ON,children:x.x.I18n.t("notOn")}),(0,_.jsx)("option",{value:ys.IN_THE_LAST,children:x.x.I18n.t("inTheLast")}),(0,_.jsx)("option",{value:ys.NOT_IN_THE_LAST,children:x.x.I18n.t("notInTheLast")})]},"select"),(n.operator===ys.BEFORE||n.operator===ys.AFTER||n.operator===ys.ON||n.operator===ys.NOT_ON)&&(0,_.jsx)(kt,{dateFormat:"MMM d, yyyy",onChange:e=>{r({value:_s(e)},t)},selected:n.value?js(n.value):void 0}),(n.operator===ys.IN_THE_LAST||n.operator===ys.NOT_IN_THE_LAST)&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(ee.I,{type:"number",value:n.value,onChange:e=>{a("value",t,e)},min:"1",placeholder:x.x.I18n.t("daysPlaceholder")},"input"),(0,_.jsx)("span",{children:x.x.I18n.t("daysPlaceholder")})]})]})},[ss.SubscriberActionTypes.MAILPOET_CUSTOM_FIELD]:function(e){let{filterIndex:t}=e;const n=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r}=(0,ns.Z)("mailpoet-dynamic-segments-form"),a=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getCustomFieldsList()),[]),s=(0,An.find)({id:Number(n.custom_field_id)},a),i=a.map((e=>({value:e.id.toString(),label:e.name}))),o=Ps[n.custom_field_type];return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("div",{children:(0,_.jsx)(as.ReactSelect,{dimension:"small",isFullWidth:!0,placeholder:x.x.I18n.t("selectCustomFieldPlaceholder"),options:i,automationId:"select-custom-field",value:(0,An.find)((e=>{if(n.custom_field_id)return n.custom_field_id===e.value}),i),onChange:e=>{const n=(0,An.find)({id:Number(e.value)},a);n&&r({custom_field_id:e.value,custom_field_type:n.type,operator:void 0,value:void 0},t)}})}),(0,_.jsx)("div",{children:o&&(0,_.jsx)(o,{customField:s,filterIndex:t})})]})},[ss.SubscriberActionTypes.SUBSCRIBED_TO_LIST]:function(e){let{filterIndex:t}=e;const n=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),r=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getStaticSegmentsList()),[]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:s}=(0,ns.Z)("mailpoet-dynamic-segments-form");(0,y.useEffect)((()=>{n.operator!==ss.AnyValueTypes.ANY&&n.operator!==ss.AnyValueTypes.ALL&&n.operator!==ss.AnyValueTypes.NONE&&a({operator:ss.AnyValueTypes.ANY},t)}),[a,n,t]);const i=r.map((e=>({value:e.id,label:e.name})));return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(_t.Grid.CenteredRow,{children:(0,_.jsxs)(ae.Select,{isFullWidth:!0,value:n.operator,onChange:e=>{s("operator",t,e)},children:[(0,_.jsx)("option",{value:ss.AnyValueTypes.ANY,children:x.x.I18n.t("anyOf")}),(0,_.jsx)("option",{value:ss.AnyValueTypes.ALL,children:x.x.I18n.t("allOf")}),(0,_.jsx)("option",{value:ss.AnyValueTypes.NONE,children:x.x.I18n.t("noneOf")})]},"select")}),(0,_.jsx)(_t.Grid.CenteredRow,{children:(0,_.jsx)(as.ReactSelect,{dimension:"small",isFullWidth:!0,isMulti:!0,placeholder:x.x.I18n.t("searchLists"),options:i,value:(0,An.filter)((e=>{if(!n.segments)return;const t=e.value;return-1!==n.segments.indexOf(t)}),i),onChange:e=>{a({segments:(0,An.map)("value",e)},t)}})})]})},[ss.SubscriberActionTypes.SUBSCRIBER_TAG]:function(e){let{filterIndex:t}=e;return Ae.Hooks.applyFilters("mailpoet_dynamic_segments_filter_subscriber_tag",(0,_.jsx)(Ks,{}),t)}};var Js;!function(e){e.MEMBER_OF="isMemberOf"}(Js||(Js={}));const ei=[{value:Js.MEMBER_OF,label:x.x.I18n.t("segmentsActiveMembership"),group:ss.SegmentTypes.WooCommerceMembership}];var ti;!function(e){e.ACTIVE_SUBSCRIPTIONS="hasActiveSubscription"}(ti||(ti={}));const ni=[{value:ti.ACTIVE_SUBSCRIPTIONS,label:x.x.I18n.t("segmentsActiveSubscription"),group:ss.SegmentTypes.WooCommerceSubscription}],ri={[ss.SegmentTypes.Email]:function(e){return!!Object.values(ss.EmailActionTypes).some((t=>t===e.action))&&(e.action===ss.EmailActionTypes.CLICKED_ANY||(e.action===ss.EmailActionTypes.CLICKED?!!e.newsletter_id:e.action!==ss.EmailActionTypes.OPENS_ABSOLUTE_COUNT&&e.action!==ss.EmailActionTypes.MACHINE_OPENS_ABSOLUTE_COUNT?Array.isArray(e.newsletters)&&e.newsletters.length>0:!!e.days&&!!e.opens&&!!e.operator))},[ss.SegmentTypes.WooCommerce]:function(e){if(!Object.values(ps).some((t=>t===e.action)))return!1;const t=void 0===e.category_ids||0===e.category_ids.length||!e.operator;if(e.action===ps.PURCHASED_CATEGORY&&t)return!1;const n=void 0===e.product_ids||0===e.product_ids.length||!e.operator;if(e.action===ps.PURCHASED_PRODUCT&&n)return!1;const r=void 0===e.country_code||0===e.country_code.length;if(e.action===ps.CUSTOMER_IN_COUNTRY&&r)return!1;const a=!e.number_of_orders_count||!e.number_of_orders_days||!e.number_of_orders_type;return!(e.action===ps.NUMBER_OF_ORDERS&&a||!(e.action!==ps.TOTAL_SPENT||e.total_spent_amount&&e.total_spent_days&&e.total_spent_type))},[ss.SegmentTypes.WordPressRole]:function(e){return e.action&&e.action!==ss.SubscriberActionTypes.WORDPRESS_ROLE?e.action===ss.SubscriberActionTypes.MAILPOET_CUSTOM_FIELD?function(e){const t=Rs[e.custom_field_type];return!!t&&t(e)}(e):e.action===ss.SubscriberActionTypes.SUBSCRIBER_SCORE?function(e){if(e.operator===gs.HIGHER_THAN||e.operator===gs.LOWER_THAN||e.operator===gs.EQUALS||e.operator===gs.NOT_EQUALS){const t=Number(e.value),n=Number(parseFloat(e.value));return!Number.isNaN(t)&&!Number.isNaN(n)&&t>=0&&t<=100}return e.operator===gs.UNKNOWN||e.operator===gs.NOT_UNKNOWN}(e):e.action===ss.SubscriberActionTypes.SUBSCRIBED_TO_LIST?function(e){return(e.operator===ss.AnyValueTypes.ANY||e.operator===ss.AnyValueTypes.ALL||e.operator===ss.AnyValueTypes.NONE)&&Array.isArray(e.segments)&&e.segments.length>0}(e):e.action===ss.SubscriberActionTypes.SUBSCRIBER_TAG?function(e){return Ae.Hooks.applyFilters("mailpoet_dynamic_segments_filter_subscriber_tag_validate",!1,e)}(e):!(!e.operator||!e.value)&&(e.operator===ys.BEFORE||e.operator===ys.AFTER||e.operator===ys.ON||e.operator===ys.NOT_ON?/^\d+-\d+-\d+$/.test(e.value):(e.operator===ys.IN_THE_LAST||e.operator===ys.NOT_IN_THE_LAST)&&(/^\d+$/.test(e.value)&&Number(e.value)>0)):Array.isArray(e.wordpressRole)&&e.wordpressRole.length>0},[ss.SegmentTypes.WooCommerceMembership]:function(e){const t=!e.plan_ids||!e.plan_ids.length||!e.operator;return e.action!==Js.MEMBER_OF||!t},[ss.SegmentTypes.WooCommerceSubscription]:function(e){const t=!e.product_ids||!e.product_ids.length||!e.operator;return e.action!==ti.ACTIVE_SUBSCRIPTIONS||!t}};function ai(e){return!(e.length<1)&&0===e.map((e=>void 0!==ri[e.segmentType]&&ri[e.segmentType](e))).filter((e=>!1===e)).length}let si,ii;function oi(){const e=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegment()),[]),t=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSubscriberCount()),[]),{updateSubscriberCount:n}=(0,ns.Z)("mailpoet-dynamic-segments-form"),r=JSON.stringify(e),a=(0,y.useRef)(1),s=(0,y.useRef)(null),i=(0,y.useRef)(!1),o=(0,y.useRef)((0,vt.debounce)((function e(t){if(i.current)return void(s.current=t);s.current=null,a.current+=1;const r=a.current;i.current=!0,function(e){const t={filters:e.filters,filters_connect:e.filters_connect};return bt().isEqual(t,si)?Promise.resolve(ii):(si={filters:[...e.filters],filters_connect:e.filters_connect},x.x.Ajax.post({api_version:x.x.apiVersion,endpoint:"dynamic_segments",action:"getCount",data:e,timeout:2e4}).then((e=>{const{data:t}=e;return ii={count:t.count,errors:void 0},ii})))}(t).then((t=>{if(i.current=!1,s.current)return void e(s.current);if(r!==a.current)return;const o={loading:!1};t&&(o.count=t.count,o.errors=t.errors),n(o)}),(e=>{i.current=!1;const t={},r=e.errors.map((e=>e.message));t.loading=!1,t.count=void 0,t.errors=r,n(t)}))}),2e3,{trailing:!0}));return(0,y.useEffect)((()=>{ai(e.filters)?(n({loading:!0,count:void 0,errors:void 0}),(0,o.current)(e)):n({count:void 0,loading:!1})}),[e,r,n]),t.errors?(0,_.jsx)("div",{className:"mailpoet-form-field",children:(0,_.jsxs)("span",{className:"mailpoet-form-error-message",children:[x.x.I18n.t("dynamicSegmentSizeCalculatingTimeout")," ",(0,_.jsx)("a",{href:"https://kb.mailpoet.com/article/237-guide-to-subscriber-segmentation?utm_source=plugin&utm_medium=segments","data-beacon-article":"5a574bd92c7d3a194368233e",target:"_blank",className:"mailpoet-form-error-message",rel:"noopener noreferrer",children:x.x.I18n.t("learnMore")})]})}):t.loading||void 0!==t.count?t.loading?(0,_.jsx)("div",{className:"mailpoet-form-field",children:(0,_.jsx)("span",{className:"mailpoet-form-notice-message",children:x.x.I18n.t("dynamicSegmentSizeIsCalculated")})}):(0,_.jsx)("div",{className:"mailpoet-form-field",children:(0,_.jsx)("span",{className:"mailpoet-form-notice-message",children:x.x.I18n.t("dynamicSegmentSize").replace("%1$d",t.count.toLocaleString())})}):(0,_.jsx)("span",{})}const li={[ss.SegmentTypes.Email]:function(e){let{filterIndex:t}=e;const n=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),r=us[n.action];return r?(0,_.jsx)(r,{filterIndex:t}):null},[ss.SegmentTypes.WooCommerce]:e=>{let{filterIndex:t}=e;const n=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,ns.Z)("mailpoet-dynamic-segments-form"),s=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getProductCategories()),[]),i=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getWooCommerceCountries()),[]),o=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getProducts()),[]),l=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getWooCommerceCurrencySymbol()),[]),c=o.map((e=>({value:e.id,label:e.name}))),d=s.map((e=>({value:e.id,label:e.name}))),u=i.map((e=>({value:e.code,label:e.name})));let p;return(0,y.useEffect)((()=>{void 0===n.number_of_orders_type&&n.action===ps.NUMBER_OF_ORDERS&&r({number_of_orders_type:"="},t),void 0===n.total_spent_type&&n.action===ps.TOTAL_SPENT&&r({total_spent_type:">"},t),hs.includes(n.action)&&n.operator!==ss.AnyValueTypes.ALL&&n.operator!==ss.AnyValueTypes.ANY&&n.operator!==ss.AnyValueTypes.NONE&&r({operator:ss.AnyValueTypes.ANY},t),n.action===ps.CUSTOMER_IN_COUNTRY&&n.operator!==ss.AnyValueTypes.ANY&&n.operator!==ss.AnyValueTypes.NONE&&r({operator:ss.AnyValueTypes.ANY},t)}),[r,n,t]),n.action===ps.PURCHASED_PRODUCT?p=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(_t.Grid.CenteredRow,{children:(0,_.jsxs)(ae.Select,{value:n.operator,onChange:e=>{r({operator:e.target.value},t)},automationId:"select-operator",children:[(0,_.jsx)("option",{value:ss.AnyValueTypes.ANY,children:x.x.I18n.t("anyOf")}),(0,_.jsx)("option",{value:ss.AnyValueTypes.ALL,children:x.x.I18n.t("allOf")}),(0,_.jsx)("option",{value:ss.AnyValueTypes.NONE,children:x.x.I18n.t("noneOf")})]},"select-operator")}),(0,_.jsx)(_t.Grid.CenteredRow,{children:(0,_.jsx)(as.ReactSelect,{isMulti:!0,dimension:"small",isFullWidth:!0,placeholder:x.x.I18n.t("selectWooPurchasedProduct"),options:c,value:(0,An.filter)((e=>{if(void 0!==n.product_ids&&0!==n.product_ids.length)return-1!==n.product_ids.indexOf(e.value)}),c),onChange:e=>{r({product_ids:(e||[]).map((e=>e.value))},t)},automationId:"select-segment-products"},"select-segment-products")})]}):n.action===ps.PURCHASED_CATEGORY?p=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(_t.Grid.CenteredRow,{children:(0,_.jsxs)(ae.Select,{value:n.operator,onChange:e=>{r({operator:e.target.value},t)},automationId:"select-operator",children:[(0,_.jsx)("option",{value:ss.AnyValueTypes.ANY,children:x.x.I18n.t("anyOf")}),(0,_.jsx)("option",{value:ss.AnyValueTypes.ALL,children:x.x.I18n.t("allOf")}),(0,_.jsx)("option",{value:ss.AnyValueTypes.NONE,children:x.x.I18n.t("noneOf")})]},"select-operator")}),(0,_.jsx)(_t.Grid.CenteredRow,{children:(0,_.jsx)(as.ReactSelect,{isMulti:!0,dimension:"small",isFullWidth:!0,placeholder:x.x.I18n.t("selectWooPurchasedCategory"),options:d,value:(0,An.filter)((e=>{if(void 0!==n.category_ids&&0!==n.category_ids.length)return-1!==n.category_ids.indexOf(e.value)}),d),onChange:e=>{r({category_ids:(e||[]).map((e=>e.value))},t)},automationId:"select-segment-category"},"select-segment-category")})]}):n.action===ps.NUMBER_OF_ORDERS?p=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(_t.Grid.CenteredRow,{children:[(0,_.jsxs)(ae.Select,{value:n.number_of_orders_type,onChange:e=>{a("number_of_orders_type",t,e)},automationId:"select-number-of-orders-type",children:[(0,_.jsx)("option",{value:"=",children:x.x.I18n.t("equals")}),(0,_.jsx)("option",{value:"!=",children:x.x.I18n.t("notEquals")}),(0,_.jsx)("option",{value:">",children:x.x.I18n.t("moreThan")}),(0,_.jsx)("option",{value:"<",children:x.x.I18n.t("lessThan")})]},"select"),(0,_.jsx)(ee.I,{"data-automation-id":"input-number-of-orders-count",type:"number",min:0,value:n.number_of_orders_count||"",placeholder:x.x.I18n.t("wooNumberOfOrdersCount"),onChange:e=>{a("number_of_orders_count",t,e)}}),(0,_.jsx)("div",{children:x.x.I18n.t("wooNumberOfOrdersOrders")})]}),(0,_.jsxs)(_t.Grid.CenteredRow,{children:[(0,_.jsx)("div",{children:x.x.I18n.t("inTheLast")}),(0,_.jsx)(ee.I,{"data-automation-id":"input-number-of-orders-days",type:"number",min:1,value:n.number_of_orders_days||"",placeholder:x.x.I18n.t("daysPlaceholder"),onChange:e=>{a("number_of_orders_days",t,e)}}),(0,_.jsx)("div",{children:x.x.I18n.t("days")})]})]}):n.action===ps.TOTAL_SPENT?p=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(_t.Grid.CenteredRow,{children:[(0,_.jsxs)(ae.Select,{value:n.total_spent_type,onChange:e=>{a("total_spent_type",t,e)},automationId:"select-total-spent-type",children:[(0,_.jsx)("option",{value:"=",children:x.x.I18n.t("equals")}),(0,_.jsx)("option",{value:"!=",children:x.x.I18n.t("notEquals")}),(0,_.jsx)("option",{value:">",children:x.x.I18n.t("moreThan")}),(0,_.jsx)("option",{value:"<",children:x.x.I18n.t("lessThan")})]},"select"),(0,_.jsx)(ee.I,{"data-automation-id":"input-total-spent-amount",type:"number",min:0,step:.01,value:n.total_spent_amount||"",placeholder:x.x.I18n.t("wooTotalSpentAmount"),onChange:e=>{a("total_spent_amount",t,e)}}),(0,_.jsx)("div",{children:l})]}),(0,_.jsxs)(_t.Grid.CenteredRow,{children:[(0,_.jsx)("div",{children:x.x.I18n.t("inTheLast")}),(0,_.jsx)(ee.I,{"data-automation-id":"input-total-spent-days",type:"number",min:1,value:n.total_spent_days||"",placeholder:x.x.I18n.t("daysPlaceholder"),onChange:e=>{a("total_spent_days",t,e)}}),(0,_.jsx)("div",{children:x.x.I18n.t("days")})]})]}):n.action===ps.CUSTOMER_IN_COUNTRY&&(p=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(_t.Grid.CenteredRow,{children:(0,_.jsxs)(ae.Select,{value:n.operator,onChange:e=>{r({operator:e.target.value},t)},automationId:"select-operator-country",children:[(0,_.jsx)("option",{value:ss.AnyValueTypes.ANY,children:x.x.I18n.t("anyOf")}),(0,_.jsx)("option",{value:ss.AnyValueTypes.NONE,children:x.x.I18n.t("noneOf")})]},"select-operator-country")}),(0,_.jsx)(_t.Grid.CenteredRow,{children:(0,_.jsx)(as.ReactSelect,{dimension:"small",isFullWidth:!0,isMulti:!0,placeholder:x.x.I18n.t("selectWooCountry"),options:u,value:(0,An.filter)((e=>{if(n.country_code)return-1!==n.country_code.indexOf(e.value)}),u),onChange:e=>{r({country_code:(e||[]).map((e=>e.value))},t)},automationId:"select-segment-country"},"select-segment-country")})]})),p},[ss.SegmentTypes.WordPressRole]:function(e){let{filterIndex:t}=e;const n=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]);let r;return r=n.action?Xs[n.action]:fs,r?(0,_.jsx)(r,{filterIndex:t}):null},[ss.SegmentTypes.WooCommerceMembership]:function(e){let{filterIndex:t}=e;const n=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,ns.Z)("mailpoet-dynamic-segments-form"),s=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getMembershipPlans()),[]).map((e=>({value:e.id,label:e.name})));return(0,y.useEffect)((()=>{n.action===Js.MEMBER_OF&&n.operator!==ss.AnyValueTypes.ANY&&n.operator!==ss.AnyValueTypes.ALL&&n.operator!==ss.AnyValueTypes.NONE&&r({operator:ss.AnyValueTypes.ANY},t)}),[r,n,t]),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(_t.Grid.CenteredRow,{children:(0,_.jsxs)(ae.Select,{value:n.operator,onChange:e=>a("operator",t,e),automationId:"select-operator",children:[(0,_.jsx)("option",{value:ss.AnyValueTypes.ANY,children:x.x.I18n.t("anyOf")}),(0,_.jsx)("option",{value:ss.AnyValueTypes.ALL,children:x.x.I18n.t("allOf")}),(0,_.jsx)("option",{value:ss.AnyValueTypes.NONE,children:x.x.I18n.t("noneOf")})]},"select-operator")}),(0,_.jsx)(_t.Grid.CenteredRow,{children:(0,_.jsx)(as.ReactSelect,{isMulti:!0,dimension:"small",isFullWidth:!0,placeholder:x.x.I18n.t("selectWooMembership"),options:s,value:(0,An.filter)((e=>!!n.plan_ids&&-1!==n.plan_ids.indexOf(e.value)),s),onChange:e=>{r({plan_ids:(e||[]).map((e=>e.value))},t)},automationId:"select-segment-plans"},"select-segment-membership-plan")})]})},[ss.SegmentTypes.WooCommerceSubscription]:function(e){let{filterIndex:t}=e;const n=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,ns.Z)("mailpoet-dynamic-segments-form"),s=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSubscriptionProducts()),[]).map((e=>({value:e.id,label:e.name})));return(0,y.useEffect)((()=>{n.action===ti.ACTIVE_SUBSCRIPTIONS&&n.operator!==ss.AnyValueTypes.ANY&&n.operator!==ss.AnyValueTypes.ALL&&n.operator!==ss.AnyValueTypes.NONE&&r({operator:ss.AnyValueTypes.ANY},t)}),[r,n,t]),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(_t.Grid.CenteredRow,{children:(0,_.jsxs)(ae.Select,{value:n.operator,onChange:e=>a("operator",t,e),automationId:"select-operator",children:[(0,_.jsx)("option",{value:ss.AnyValueTypes.ANY,children:x.x.I18n.t("anyOf")}),(0,_.jsx)("option",{value:ss.AnyValueTypes.ALL,children:x.x.I18n.t("allOf")}),(0,_.jsx)("option",{value:ss.AnyValueTypes.NONE,children:x.x.I18n.t("noneOf")})]},"select-operator")}),(0,_.jsx)(_t.Grid.CenteredRow,{children:(0,_.jsx)(as.ReactSelect,{isMulti:!0,dimension:"small",isFullWidth:!0,placeholder:x.x.I18n.t("selectWooSubscription"),options:s,value:(0,An.filter)((e=>!!n.product_ids&&-1!==n.product_ids.indexOf(e.value)),s),onChange:e=>{r({product_ids:(e||[]).map((e=>e.value))},t)},automationId:"select-segment-products"},"select-segment-category")})]})}};function ci(e){let{filterIndex:t}=e;const n=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]);if(void 0===n||void 0===li[n.segmentType])return null;const r=li[n.segmentType];return(0,_.jsx)(r,{filterIndex:t})}function di(){const e=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegment()),[]),t=[ss.EmailActionTypes.OPENED,ss.EmailActionTypes.OPENS_ABSOLUTE_COUNT,ss.EmailActionTypes.MACHINE_OPENED,ss.EmailActionTypes.MACHINE_OPENS_ABSOLUTE_COUNT];let n=!1;return e.filters.forEach((e=>{t.includes(e.action)&&(n=!0)})),n?(0,_.jsx)("div",{className:"mailpoet-form-field",children:(0,_.jsx)("span",{className:"mailpoet-form-notice-message",children:x.x.I18n.t("privacyProtectionNotice")})}):(0,_.jsx)("span",{})}const ui=Ae.Hooks.applyFilters("mailpoet_dynamic_segments_form_filters_before",(()=>null)),pi=Ae.Hooks.applyFilters("mailpoet_dynamic_filters_filter_before",(()=>null)),mi=Ae.Hooks.applyFilters("mailpoet_dynamic_filters_filter_after",(()=>(0,_.jsx)("div",{className:"mailpoet-gap"})));function hi(e){let{segmentId:t}=e;const n=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegment()),[]),r=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getAvailableFilters()),[]),a=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").findFiltersValueForSegment(n)),[n]),s=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getSubscriberCount()),[]),i=(0,rs.Z)((e=>e("mailpoet-dynamic-segments-form").getErrors()),[]),{updateSegment:o,updateSegmentFilter:l,handleSave:c}=(0,ns.Z)("mailpoet-dynamic-segments-form"),[d,u]=(0,y.useState)(!1),p=Ae.Hooks.applyFilters("mailpoet_dynamic_segments_form_add_condition_action",(()=>{u(!0)}));return(0,_.jsxs)("form",{className:"mailpoet_form",children:[i.length>0&&(0,_.jsx)(He,{errors:i.map((e=>({message:e})))}),(0,_.jsxs)("div",{className:"mailpoet-form-grid",children:[(0,_.jsxs)("div",{className:"mailpoet-form-field-name form-field-row-name mailpoet-segments-name-section",children:[(0,_.jsx)(he.X,{level:4,children:(0,_.jsx)("label",{htmlFor:"field_name",children:x.x.I18n.t("name")})}),(0,_.jsx)("div",{className:"mailpoet-form-field",children:(0,_.jsx)(ee.I,{isFullWidth:!0,type:"text",name:"name",id:"field_name",defaultValue:n.name,"data-automation-id":"input-name",onChange:e=>{o({name:e.target.value})}})})]}),(0,_.jsxs)("div",{className:"mailpoet-form-field-description form-field-row-description mailpoet-segments-description-section",children:[(0,_.jsx)(he.X,{level:4,children:(0,_.jsx)("label",{htmlFor:"field_description",children:x.x.I18n.t("description")})}),(0,_.jsx)("p",{className:"mailpoet-form-description",children:x.x.I18n.t("segmentDescriptionTip")}),(0,_.jsx)("div",{className:"mailpoet-form-field",children:(0,_.jsx)(ne.g,{isFullWidth:!0,name:"description",id:"field_description",value:n.description,"data-automation-id":"input-description",onChange:e=>{o({description:e.target.value})}})})]}),(0,_.jsxs)("div",{className:"mailpoet-segments-segments-section",children:[(0,_.jsx)(he.X,{level:4,children:(0,_.jsx)("label",{htmlFor:"field_filters",children:x.x.I18n.t("formPageTitle")})}),(0,_.jsx)(ui,{}),Array.isArray(a)&&a.map(((e,t)=>(0,_.jsxs)(y.Fragment,{children:[(0,_.jsxs)(_t.Grid.ThreeColumns,{className:"mailpoet-segments-grid",automationId:`filter-row-${t}`,children:[(0,_.jsx)(pi,{filterRows:a,index:t}),(0,_.jsx)(_t.Grid.CenteredRow,{children:(0,_.jsx)(as.ReactSelect,{dimension:"small",placeholder:x.x.I18n.t("selectActionPlaceholder"),options:r,value:e.filterValue,onChange:e=>{l({segmentType:e.group,action:e.value},t)},automationId:"select-segment-action",isFullWidth:!0})}),void 0!==e.index&&(0,_.jsx)(ci,{filterIndex:e.index})]}),(0,_.jsx)(mi,{index:t})]},e.index))),(0,_.jsx)(E.z,{type:"button",variant:"tertiary",iconStart:F.R,onClick:e=>{e.preventDefault(),p(n,o)},children:x.x.I18n.t("addCondition")})]}),d&&(0,_.jsx)("div",{className:"mailpoet-grid-span-two-columns",children:(0,_.jsx)(Ks,{})}),(0,_.jsxs)("div",{className:"mailpoet-segments-counter-section",children:[(0,_.jsx)(oi,{}),(0,_.jsx)(di,{})]}),(0,_.jsx)("div",{className:"mailpoet-form-actions",children:(0,_.jsx)(E.z,{type:"submit",onClick:e=>{e.preventDefault(),c(t)},isDisabled:!ai(n.filters)||void 0===s.count,children:x.x.I18n.t("save")})})]})]})}var fi=n(38104);const gi=e=>e.products,xi=e=>e.membershipPlans,vi=e=>e.subscriptionProducts,bi=e=>e.wordpressRoles,yi=e=>e.productCategories,wi=e=>e.newslettersList,_i=e=>e.canUseWooSubscriptions,ji=e=>e.wooCurrencySymbol,Si=e=>e.wooCountries,Ii=e=>e.customFieldsList,Ci=e=>e.segment,Ti=e=>e.staticSegmentsList,ki=e=>e.subscriberCount,Ni=e=>e.tags,Di=(e,t)=>{let n;return Array.isArray(e.segment.filters)?(n={...e.segment.filters[t]},n):n},Ei=e=>e.errors,Ai=e=>e.allAvailableFilters,Oi=(e,t)=>{const n=[];return t.filters.forEach(((t,r)=>{e.allAvailableFilters.forEach((e=>{e.options.forEach((e=>{e.group===t.segmentType&&e.value===t.action&&n.push({filterValue:e,index:r})}))}))})),n};function Ri(e,t){return{...e,segment:t.segment}}function Pi(e,t){return{...e,errors:t.errors}}function Mi(e,t){const n=e.segment;return{...e,segment:(0,An.assign)(n,t.segment)}}function Li(e,t){const n={...e.segment};return n.filters[t.filterIndex]=(0,An.assign)(n.filters[t.filterIndex],t.filter),{...e,segment:n}}function Fi(e,t){const n=e.subscriberCount;return{...e,subscriberCount:(0,An.assign)(n,t.subscriberCount)}}const qi=e=>function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e,n=arguments.length>1?arguments[1]:void 0;switch(n.type){case ss.Actions.SET_SEGMENT:return Ri(t,n);case ss.Actions.SET_ERRORS:return Pi(t,n);case ss.Actions.UPDATE_SEGMENT:return Mi(t,n);case ss.Actions.UPDATE_SEGMENT_FILTER:return Li(t,n);case ss.Actions.UPDATE_SUBSCRIBER_COUNT:return Fi(t,n);default:return t}};function $i(e){return{type:ss.Actions.SET_SEGMENT,segment:e}}function Ui(e){return{type:ss.Actions.SET_ERRORS,errors:e}}function Zi(e){return{type:ss.Actions.UPDATE_SEGMENT,segment:e}}function Vi(e,t){return{type:ss.Actions.UPDATE_SEGMENT_FILTER,filter:e,filterIndex:t}}function Wi(e,t){return{type:ss.Actions.UPDATE_SEGMENT,segment:{[e]:t.target.value}}}function Yi(e,t,n){return{type:ss.Actions.UPDATE_SEGMENT_FILTER,filter:{[e]:n.target.value},filterIndex:t}}function Bi(e){return{type:ss.Actions.UPDATE_SUBSCRIBER_COUNT,subscriberCount:e}}function*Hi(e){if(void 0===e)return;x.x.Modal.loading(!0);const{res:t,success:n}=yield{type:"LOAD_SEGMENT",segmentId:e};n&&!t.is_plugin_missing||(window.location.href="admin.php?page=mailpoet-segments#/segments"),yield $i(t),x.x.Modal.loading(!1)}function*zi(e){const t=(0,fi.select)("mailpoet-dynamic-segments-form").getSegment();yield Ui([]);const{error:n,success:r}=yield{type:"SAVE_SEGMENT",segment:t};var a;r?(window.location.href="admin.php?page=mailpoet-segments#/segments",void 0!==e?x.x.Notice.success(x.x.I18n.t("dynamicSegmentUpdated")):(a=t,x.x.Notice.success(x.x.I18n.t("dynamicSegmentAdded")),x.x.trackEvent("Segments > Add new",{type:a.segmentType||"unknown type",subtype:a.action||a.wordpressRole||"unknown subtype"}))):yield Ui(n)}function Gi(e){let t=JSON.parse(JSON.stringify(e));return(0,An.has)("link_id",e)&&(t=(0,An.assign)(t,{link_id:e.link_id.toString()})),(0,An.has)("newsletter_id",e)&&(t=(0,An.assign)(t,{newsletter_id:e.newsletter_id.toString()})),(0,An.has)("product_id",e)&&(t=(0,An.assign)(t,{product_id:e.product_id.toString()})),(0,An.has)("category_id",e)&&(t=(0,An.assign)(t,{category_id:e.category_id.toString()})),t}async function Ki(e){const t=e.segmentId;try{return{success:!0,res:Gi((await x.x.Ajax.post({api_version:x.x.apiVersion,endpoint:"dynamic_segments",action:"get",data:{id:t}})).data)}}catch(e){return{success:!1,error:(0,ze.q)(e)?e.errors.map((e=>e.message)):null,res:e}}}async function Qi(e){const t=e.segment;try{return await x.x.Ajax.post({api_version:x.x.apiVersion,endpoint:"dynamic_segments",action:"save",data:t}),{success:!0}}catch(e){return{success:!1,error:(0,ze.q)(e)?e.errors.map((e=>e.message)):null}}}function Xi(e,t){const n=[{label:x.x.I18n.t("email"),options:ds},{label:x.x.I18n.t("wpUserRole"),options:Qs}];return x.x.isWoocommerceActive&&n.push({label:x.x.I18n.t("woocommerce"),options:ms}),x.x.isWoocommerceActive&&t&&n.push({label:x.x.I18n.t("woocommerceMemberships"),options:ei}),x.x.isWoocommerceActive&&e&&n.push({label:x.x.I18n.t("woocommerceSubscriptions"),options:ni}),n}function Ji(){const e=(0,l.$B)();(()=>{const e={products:window.mailpoet_products,staticSegmentsList:window.mailpoet_static_segments_list,membershipPlans:window.mailpoet_membership_plans,subscriptionProducts:window.mailpoet_subscription_products,productCategories:window.mailpoet_product_categories,newslettersList:window.mailpoet_newsletters_list,wordpressRoles:window.wordpress_editable_roles_list,canUseWooMemberships:window.mailpoet_can_use_woocommerce_memberships,canUseWooSubscriptions:window.mailpoet_can_use_woocommerce_subscriptions,wooCurrencySymbol:window.mailpoet_woocommerce_currency_symbol,wooCountries:window.mailpoet_woocommerce_countries,customFieldsList:window.mailpoet_custom_fields,tags:window.mailpoet_tags,segment:{filters_connect:ss.SegmentConnectTypes.AND,filters:[{segmentType:ss.SegmentTypes.WordPressRole,action:ss.SubscriberActionTypes.WORDPRESS_ROLE}]},subscriberCount:{loading:!1},errors:[],allAvailableFilters:Xi(window.mailpoet_can_use_woocommerce_subscriptions,window.mailpoet_can_use_woocommerce_memberships)},t={selectors:r,actions:a,controls:s,reducer:qi(e),resolvers:{}};(0,fi.registerStore)("mailpoet-dynamic-segments-form",t)})();const{pageLoaded:t}=(0,ns.Z)("mailpoet-dynamic-segments-form");return(0,y.useEffect)((()=>{t(e.params.id)}),[e.params.id,t]),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(Q.A,{color:"#fff"}),(0,_.jsx)(ye.B,{}),(0,_.jsxs)(he.X,{level:1,className:"mailpoet-title",children:[(0,_.jsx)("span",{children:x.x.I18n.t("formPageTitle")}),(0,_.jsx)(o.Link,{className:"mailpoet-button button button-secondary button-small",to:"/segments",children:x.x.I18n.t("backToList")})]}),(0,_.jsx)(hi,{segmentId:Number(e.params.id)})]})}const eo=[{name:"name",label:x.x.I18n.t("nameColumn"),sortable:!0},{name:"description",label:x.x.I18n.t("description"),sortable:!1},{name:"count",label:x.x.I18n.t("subscribersCountColumn"),sortable:!1},{name:"subscribed",label:x.x.I18n.t("subscribed"),sortable:!1},{name:"updated_at",label:x.x.I18n.t("updatedAtColumn"),sortable:!0}],to={onLoadingItems:()=>x.x.I18n.t("loadingDynamicSegmentItems"),onNoItemsFound:()=>x.x.I18n.t("noDynamicSegmentItemsFound"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneDynamicSegmentTrashed"):x.x.I18n.t("multipleDynamicSegmentsTrashed").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneDynamicSegmentDeleted"):x.x.I18n.t("multipleDynamicSegmentsDeleted").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneDynamicSegmentRestored"):x.x.I18n.t("multipleDynamicSegmentsRestored").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)}},no=[{name:"edit",className:"mailpoet-hide-on-mobile",link:e=>(0,_.jsx)(o.Link,{to:`/edit-segment/${e.id}`,children:x.x.I18n.t("edit")}),display:e=>!e.is_plugin_missing},{name:"edit_disabled",className:"mailpoet-hide-on-mobile mailpoet-disabled",link:e=>(0,_.jsx)(o.Link,{to:`/edit-segment/${e.id}`,children:x.x.I18n.t("edit")}),display:e=>e.is_plugin_missing},{name:"view_subscribers",link:e=>(0,_.jsx)("a",{href:e.subscribers_url,children:x.x.I18n.t("viewSubscribers")})},{name:"trash",className:"mailpoet-hide-on-mobile"}],ro=[{name:"trash",label:x.x.I18n.t("moveToTrash"),onSuccess:to.onTrash}];function ao(e,t){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("td",{className:"column-primary","data-colname":x.x.I18n.t("nameColumn"),children:[(0,_.jsx)("span",{className:"mailpoet-listing-title",children:e.name}),t]}),(0,_.jsx)("td",{"data-colname":x.x.I18n.t("description"),children:(0,_.jsx)("abbr",{children:e.description})}),e.is_plugin_missing?(0,_.jsx)("td",{colSpan:"2",className:"column mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("missingPluginMessageColumn"),children:e.missing_plugin_message&&e.missing_plugin_message.message&&e.missing_plugin_message.link?I()(e.missing_plugin_message.message,/\[link](.*?)\[\/link]/g,(t=>(0,_.jsx)("a",{className:"mailpoet-listing-link-important",href:e.missing_plugin_message.link,target:"_blank",rel:"noopener noreferrer",children:t},"missingPluginMessageLink"))):e.missing_plugin_message}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("subscribersCountColumn"),children:parseInt(e.count_all,10).toLocaleString()}),(0,_.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("subscribed"),children:parseInt(e.count_subscribed,10).toLocaleString()})]}),(0,_.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("updatedAtColumn"),children:[x.x.Date.short(e.created_at),(0,_.jsx)("br",{}),x.x.Date.time(e.created_at)]})]})}function so(e){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(g.N,{limit:window.mailpoet_listing_per_page,location:e.location,params:e.match.params,search:!0,onRenderItem:ao,endpoint:"dynamic_segments",base_url:"segments",columns:eo,messages:to,sort_by:"created_at",sort_order:"desc",item_actions:no,bulk_actions:ro}),(0,_.jsxs)("p",{className:"mailpoet_sending_methods_help help",children:[(0,_.jsxs)("b",{children:[x.x.I18n.t("segmentsTip"),":"]})," ",x.x.I18n.t("segmentsTipText")," ",(0,_.jsx)("a",{href:"https://kb.mailpoet.com/article/237-guide-to-subscriber-segmentation?utm_source=plugin&utm_medium=segments&utm_campaign=helpdocs","data-beacon-article":"5a574bd92c7d3a194368233e",target:"_blank",rel:"noopener noreferrer",children:x.x.I18n.t("segmentsTipLink")})]})]})}so.propTypes={location:h().object.isRequired,match:h().shape({params:h().object}).isRequired};const io=(0,l.EN)(so);function oo(){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(L.Q,{children:[(0,_.jsxs)(o.Link,{className:"mailpoet-button button-secondary",to:"/new",children:[F.R,(0,_.jsx)("span",{children:x.x.I18n.t("new")})]}),(0,_.jsxs)(o.Link,{className:"mailpoet-button button-secondary",to:"/new-segment","data-automation-id":"new-segment",children:[F.R,(0,_.jsx)("span",{children:x.x.I18n.t("newSegment")})]})]}),(0,_.jsx)(R,{subscribersInPlan:x.x.subscribersCount,subscribersInPlanLimit:x.x.subscribersLimit}),(0,_.jsx)(A,{cacheCalculation:window.mailpoet_subscribers_counts_cache_created_at}),(0,_.jsx)(T,{}),(0,_.jsx)(D,{}),(0,_.jsx)(k,{mssKeyInvalid:x.x.hasInvalidMssApiKey,subscribersCount:x.x.subscribersCount})]})}const lo=document.getElementById("segments_container");function co(){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(oo,{}),(0,_.jsxs)(Ca.t,{activeKey:"lists",routerType:"switch-only",children:[(0,_.jsx)(xa.O,{route:"lists/(.*)?",title:x.x.I18n.t("pageTitle"),children:(0,_.jsx)(Xa,{})},"lists"),(0,_.jsx)(xa.O,{route:"segments/(.*)?",title:x.x.I18n.t("pageTitleSegments"),automationId:"dynamic-segments-tab",children:(0,_.jsx)(io,{})},"segments")]})]})}function uo(){return(0,_.jsx)(Te.k.Provider,{value:(0,Te.S)(window),children:(0,_.jsxs)(o.HashRouter,{children:[(0,_.jsx)(Le.w,{}),(0,_.jsxs)(l.rs,{children:[(0,_.jsx)(l.AW,{exact:!0,path:"/",render:()=>(0,_.jsx)(l.l_,{to:"/lists"})}),(0,_.jsx)(l.AW,{path:"/new",component:ts}),(0,_.jsx)(l.AW,{path:"/edit/:id",component:ts}),(0,_.jsx)(l.AW,{path:"/new-segment",component:Ji}),(0,_.jsx)(l.AW,{path:"/edit-segment/:id",component:Ji}),(0,_.jsx)(l.AW,{path:"/segments/(.*)?",component:co}),(0,_.jsx)(l.AW,{path:"/lists/(.*)?",component:co})]})]})})}lo&&i.render((0,_.jsx)(uo,{}),lo);const po=()=>{x.x.trackEvent("Forms > Add New"),setTimeout((()=>{window.location=window.mailpoet_form_template_selection_url}),200)};function mo(){const[e,t]=(0,y.useState)(!1);return(0,_.jsx)(L.Q,{children:(0,_.jsx)(E.z,{onClick:()=>{t(!0),po()},withSpinner:e,automationId:"create_new_form",variant:"secondary",iconStart:F.R,children:x.x.I18n.t("new")})})}const ho=[{name:"name",label:x.x.I18n.t("formName"),sortable:!0},{name:"segments",label:x.x.I18n.t("segments")},{name:"type",label:x.x.I18n.t("type")},{name:"status",label:x.x.I18n.t("status")},{name:"updated_at",label:x.x.I18n.t("updatedAt"),sortable:!0}],fo={onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneFormTrashed"):x.x.I18n.t("multipleFormsTrashed").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneFormDeleted"):x.x.I18n.t("multipleFormsDeleted").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?x.x.I18n.t("oneFormRestored"):x.x.I18n.t("multipleFormsRestored").replace("%1$d",t.toLocaleString()),x.x.Notice.success(n)},onNoItemsFound:()=>(0,_.jsxs)("div",{className:"mailpoet-forms-add-new-row",children:[(0,_.jsx)("p",{children:x.x.I18n.t("noItemsFound")}),(0,_.jsx)(f.Button,{onClick:po,automationId:"add_new_form",iconStart:F.R,children:x.x.I18n.t("new")})]})},go=[{name:"trash",label:x.x.I18n.t("moveToTrash"),onSuccess:fo.onTrash}],xo=[{name:"edit",className:"mailpoet-hide-on-mobile",label:x.x.I18n.t("edit"),link:function(e){return(0,_.jsx)("a",{href:`admin.php?page=mailpoet-form-editor&id=${e.id}`,children:x.x.I18n.t("edit")})}},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:x.x.I18n.t("duplicate"),onClick:function(e,t){return x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"forms",action:"duplicate",data:{id:e.id}}).done((e=>{const n=e.data.name?e.data.name:x.x.I18n.t("noName");x.x.Notice.success(x.x.I18n.t("formDuplicated").replace("%1$s",n)),t()})).fail((e=>{e.errors.length>0&&x.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}},{name:"trash",className:"mailpoet-hide-on-mobile"}];class vo extends y.Component{constructor(){super(...arguments),(0,b.Z)(this,"updateStatus",((e,t)=>{t.persist(),x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"forms",action:"setStatus",data:{id:Number(t.target.getAttribute("data-id")),status:e?"enabled":"disabled"}}).done((e=>{"enabled"===e.data.status&&x.x.Notice.success(x.x.I18n.t("formActivated"))})).fail((n=>{x.x.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,b.Z)(this,"isItemInactive",(e=>"disabled"===e.status)),(0,b.Z)(this,"renderItem",((e,t)=>{const n=d()("manage-column","column-primary","has-row-actions"),r=window.mailpoet_segments.filter((t=>-1!==p().inArray(t.id,e.segments))),a=function(e){var t,n,r,a,s,i,o,l;const c=[];return"1"===(null==e||null===(t=e.form_placement)||void 0===t||null===(n=t.fixed_bar)||void 0===n?void 0:n.enabled)&&c.push(x.x.I18n.t("placeFixedBarFormOnPages")),"1"===(null==e||null===(r=e.form_placement)||void 0===r||null===(a=r.below_posts)||void 0===a?void 0:a.enabled)&&c.push(x.x.I18n.t("placeFormBellowPages")),"1"===(null==e||null===(s=e.form_placement)||void 0===s||null===(i=s.popup)||void 0===i?void 0:i.enabled)&&c.push(x.x.I18n.t("placePopupFormOnPages")),"1"===(null==e||null===(o=e.form_placement)||void 0===o||null===(l=o.slide_in)||void 0===l?void 0:l.enabled)&&c.push(x.x.I18n.t("placeSlideInFormOnPages")),c.length>0?c.join(", "):x.x.I18n.t("placeFormOthers")}(e.settings);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("td",{className:n,children:[(0,_.jsx)("a",{className:"mailpoet-listing-title",href:`admin.php?page=mailpoet-form-editor&id=${e.id}`,children:e.name?e.name:`(${x.x.I18n.t("noName")})`}),t]}),(0,_.jsx)("td",{className:"column","data-colname":x.x.I18n.t("segments"),children:(0,_.jsx)(gr.$,{segments:r,dimension:"large",children:"user"===e.settings.segments_selected_by&&(0,_.jsx)("span",{className:"mailpoet-tags-prefix",children:x.x.I18n.t("userChoice")})})}),(0,_.jsx)("td",{className:"column","data-colname":x.x.I18n.t("type"),children:a}),(0,_.jsx)("td",{className:"column","data-colname":x.x.I18n.t("status"),children:this.renderStatus(e)}),(0,_.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":x.x.I18n.t("updatedAt"),children:[x.x.Date.short(e.updated_at),(0,_.jsx)("br",{}),x.x.Date.time(e.updated_at)]})]})}))}renderStatus(e){return(0,_.jsxs)("div",{children:[(0,_.jsx)(Zt.Z,{onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"enabled"===e.status}),(0,_.jsxs)("p",{children:[x.x.I18n.t("signups"),": ",e.signups.toLocaleString()]})]})}render(){return(0,_.jsxs)("div",{className:"mailpoet-listing-no-actions-on-mobile",children:[(0,_.jsx)(mo,{}),(0,_.jsx)(g.N,{limit:window.mailpoet_listing_per_page,className:"mailpoet-forms-listing",location:this.props.location,params:this.props.match.params,messages:fo,search:!1,endpoint:"forms",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:ho,bulk_actions:go,item_actions:xo})]})}}vo.propTypes={location:h().object.isRequired,match:h().shape({params:h().object}).isRequired};const bo=Aa(vo);function yo(){return(0,_.jsx)(Te.k.Provider,{value:(0,Te.S)(window),children:(0,_.jsxs)(o.HashRouter,{children:[(0,_.jsx)(Le.w,{}),(0,_.jsx)(l.AW,{path:"*",component:bo})]})})}const wo=document.getElementById("forms_container");function _o(){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("p",{children:x.x.I18n.t("knowledgeBaseIntro")}),(0,_.jsxs)("ul",{className:"mailpoet-text-links",children:[(0,_.jsx)("li",{children:(0,_.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/116-common-problems",children:"Common Problems"})}),(0,_.jsx)("li",{children:(0,_.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/165-newsletters",children:"Newsletters"})}),(0,_.jsx)("li",{children:(0,_.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/156-migration-questions",children:"Migration Questions"})}),(0,_.jsx)("li",{children:(0,_.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/149-sending-methods",children:"Sending Methods"})}),(0,_.jsx)("li",{children:(0,_.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/139-subscription-forms",children:"Subscription Forms"})}),(0,_.jsx)("li",{children:(0,_.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/114-getting-started",children:"Getting Started"})}),(0,_.jsx)("li",{children:(0,_.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/123-newsletter-designer",children:"Newsletter Designer"})}),(0,_.jsx)("li",{children:(0,_.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/121-subscribers-and-lists",children:"Subscribers and Lists"})})]}),(0,_.jsx)(E.z,{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/",children:x.x.I18n.t("knowledgeBaseButton")})]})}function jo(e){e.target.select()}function So(e){if(w.ZP.isObject(e)){const t=Object.keys(e).map((t=>`${t}: ${e[t]}`));return(0,_.jsx)("textarea",{readOnly:!0,onFocus:jo,value:t.join("\n"),style:{width:"100%",height:"400px"}})}return(0,_.jsx)("p",{children:x.x.I18n.t("systemInfoDataError")})}function Io(){const e=window.systemInfoData;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("div",{className:"mailpoet_notice notice inline",children:(0,_.jsx)("p",{children:x.x.I18n.t("systemInfoIntro")})}),So(e)]})}function Co(e){return(0,_.jsx)("table",{className:"widefat fixed",style:{maxWidth:e.max_width},children:(0,_.jsx)("tbody",{children:e.rows.map((e=>(0,_.jsxs)("tr",{children:[(0,_.jsx)("td",{className:"row-title",children:e.key}),(0,_.jsx)("td",{children:e.value})]},`row_${e.key}`)))})})}function To(e){return(0,_.jsx)("span",{children:!0===e.children&&e.truthy||!1===e.children&&e.falsy||e.unknown})}function ko(e){const t=e.status_data,n={active:x.x.I18n.t("running"),inactive:x.x.I18n.t("cronWaiting")},r=Array.isArray(t.last_error)?(0,_.jsx)(_.Fragment,{children:t.last_error.map((e=>(0,_.jsxs)("div",{children:[e.worker,": ",(0,_.jsx)("i",{children:e.message})]},e.worker)))}):t.last_error;return(0,_.jsxs)("div",{children:[(0,_.jsx)("h4",{children:x.x.I18n.t("systemStatusCronStatusTitle")}),(0,_.jsx)(Co,{max_width:"400px",rows:[{key:x.x.I18n.t("accessible"),value:(0,_.jsx)(To,{children:t.accessible})},{key:x.x.I18n.t("status"),value:n[t.status]?n[t.status]:x.x.I18n.t("unknown")},{key:x.x.I18n.t("lastUpdated"),value:t.updated_at?x.x.Date.full(1e3*t.updated_at):x.x.I18n.t("unknown")},{key:x.x.I18n.t("lastRunStarted"),value:t.run_accessed_at?x.x.Date.full(1e3*t.run_started_at):x.x.I18n.t("unknown")},{key:x.x.I18n.t("lastRunCompleted"),value:t.run_completed_at?x.x.Date.full(1e3*t.run_completed_at):x.x.I18n.t("unknown")},{key:x.x.I18n.t("lastSeenError"),value:r||x.x.I18n.t("none")},{key:x.x.I18n.t("lastSeenErrorDate"),value:t.last_error_date?x.x.Date.full(1e3*t.last_error_date):x.x.I18n.t("unknown")}]})]})}function No(e){let t=e.task.scheduled_at;t&&(t=(0,xr.default)(t,"yyyy-MM-dd HH:mm:ss",new Date));const n=(0,xr.default)(e.task.updated_at,"yyyy-MM-dd HH:mm:ss",new Date);return(0,_.jsxs)("tr",{children:[(0,_.jsx)("td",{className:"column column-primary",children:e.task.id}),(0,_.jsx)("td",{className:"column",children:e.task.type}),(0,_.jsx)("td",{className:"column",children:e.task.newsletter?(0,_.jsx)("a",{href:e.task.newsletter.preview_url,"data-newsletter-id":e.task.newsletter.newsletter_id,"data-queue-id":e.task.newsletter.queue_id,target:"_blank",rel:"noopener noreferrer",children:e.task.newsletter.subject||x.x.I18n.t("preview")}):x.x.I18n.t("none")}),(0,_.jsx)("td",{className:"column",children:e.task.priority}),e.show_scheduled_at?(0,_.jsx)("td",{className:"column-date",children:(0,_.jsx)("abbr",{children:`${x.x.Date.short(t)} ${x.x.Date.time(t)}`})}):null,(0,_.jsx)("td",{className:"column-date",children:(0,_.jsx)("abbr",{children:`${x.x.Date.short(n)} ${x.x.Date.time(n)}`})})]})}function Do(e){return(0,_.jsxs)("tr",{children:[(0,_.jsx)("th",{className:"row-title",children:"Id"}),(0,_.jsx)("th",{className:"row-title",children:x.x.I18n.t("type")}),(0,_.jsx)("th",{className:"row-title",children:x.x.I18n.t("email")}),(0,_.jsx)("th",{className:"row-title",children:x.x.I18n.t("priority")}),e.show_scheduled_at?(0,_.jsx)("th",{className:"row-title",children:x.x.I18n.t("scheduledAt")}):null,(0,_.jsx)("th",{className:"row-title",children:x.x.I18n.t("updatedAt")})]})}function Eo(e){const t=e.show_scheduled_at?6:5;return(0,_.jsxs)("table",{className:"widefat fixed striped",children:[(0,_.jsx)("thead",{children:(0,_.jsx)(Do,{show_scheduled_at:e.show_scheduled_at})}),(0,_.jsx)("tbody",{children:e.tasks.length?e.tasks.map((t=>(0,_.jsx)(No,{task:t,show_scheduled_at:e.show_scheduled_at},t.id))):(0,_.jsx)("tr",{className:"mailpoet-listing-no-items",children:(0,_.jsx)("td",{colSpan:t,children:x.x.I18n.t("nothingToShow")})})}),(0,_.jsx)("tfoot",{children:(0,_.jsx)(Do,{show_scheduled_at:e.show_scheduled_at})})]})}function Ao(e){const t=e.status_data;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("h4",{children:x.x.I18n.t("systemStatusQueueTitle")}),(0,_.jsx)(Co,{max_width:"400px",rows:[{key:x.x.I18n.t("status"),value:"paused"===t.status?x.x.I18n.t("paused"):x.x.I18n.t("running")},{key:x.x.I18n.t("startedAt"),value:t.started?x.x.Date.full(1e3*t.started):x.x.I18n.t("unknown")},{key:x.x.I18n.t("sentEmails"),value:t.sent||0},{key:x.x.I18n.t("retryAttempt"),value:t.retry_attempt||x.x.I18n.t("none")},{key:x.x.I18n.t("retryAt"),value:t.retry_at?x.x.Date.full(1e3*t.retry_at):x.x.I18n.t("none")},{key:x.x.I18n.t("error"),value:t.error?t.error.error_message:x.x.I18n.t("none")},{key:x.x.I18n.t("totalCompletedTasks"),value:t.tasksStatusCounts.completed},{key:x.x.I18n.t("totalRunningTasks"),value:t.tasksStatusCounts.running},{key:x.x.I18n.t("totalPausedTasks"),value:t.tasksStatusCounts.paused},{key:x.x.I18n.t("totalScheduledTasks"),value:t.tasksStatusCounts.scheduled}]}),(0,_.jsx)("h5",{children:x.x.I18n.t("scheduledTasks")}),(0,_.jsx)(Eo,{show_scheduled_at:!0,tasks:t.latestTasks.filter((e=>"scheduled"===e.status))}),(0,_.jsx)("h5",{children:x.x.I18n.t("runningTasks")}),(0,_.jsx)(Eo,{tasks:t.latestTasks.filter((e=>null===e.status))}),(0,_.jsx)("h5",{children:x.x.I18n.t("completedTasks")}),(0,_.jsx)(Eo,{tasks:t.latestTasks.filter((e=>"completed"===e.status))})]})}function Oo(e){let{version:t,storage:n,latestTrigger:r,latestCompletedTrigger:a,latestCompletedRun:s}=e;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("h4",{children:x.x.I18n.t("actionSchedulerStatus")}),(0,_.jsx)(Co,{max_width:"400px",rows:[{key:x.x.I18n.t("version"),value:t},{key:x.x.I18n.t("storage"),value:n},{key:x.x.I18n.t("latestActionSchedulerTrigger"),value:x.x.Date.full(K().utc(r).local())},{key:x.x.I18n.t("latestActionSchedulerCompletedTrigger"),value:x.x.Date.full(K().utc(a).local())},{key:x.x.I18n.t("latestActionSchedulerCompletedRun"),value:x.x.Date.full(K().utc(s).local())}]})]})}function Ro(e,t,n,r,a,s){const i=e?"success":"error";let o=e?t:n;return r&&(o=I()(o,/\[link\](.*?)\[\/link\]/g,(e=>(0,_.jsx)("a",{className:"mailpoet-text-link",href:r,"data-beacon-article":a,children:e},"kb-link")))),(0,_.jsxs)("div",{className:`mailpoet_notice notice inline notice-${i}`,children:[(0,_.jsx)("p",{children:o}),s?(0,_.jsx)("p",{children:(0,_.jsx)("i",{children:s})}):null]})}function Po(e){const t=e.cron.isReachable,n=e.cron.url,r=`${x.x.I18n.t("systemStatusConnectionUnsuccessful")} ${x.x.I18n.t("systemStatusCronConnectionUnsuccessfulInfo")}`,a=x.x.I18n.t("systemStatusConnectionSuccessful"),s=t?null:e.cron.pingResponse;return(0,_.jsxs)("div",{children:[(0,_.jsx)("h4",{children:x.x.I18n.t("systemStatusCronTitle")}),(0,_.jsx)("p",{children:(0,_.jsx)("a",{className:"mailpoet-text-link",href:n,target:"_blank",rel:"noopener noreferrer",children:n})}),Ro(t,a,r,"https://kb.mailpoet.com/article/231-sending-does-not-work","5a0257ac2c7d3a272c0d7ad6",s)]})}function Mo(e){const t=e.mss.enabled?`${x.x.I18n.t("systemStatusConnectionUnsuccessful")} ${x.x.I18n.t("systemStatusMSSConnectionUnsuccessfulInfo")}`:x.x.I18n.t("systemStatusMSSConnectionCanNotConnect"),n=e.mss.enabled?x.x.I18n.t("systemStatusConnectionSuccessful"):x.x.I18n.t("systemStatusMSSConnectionCanConnect");return(0,_.jsxs)("div",{children:[(0,_.jsx)("h4",{children:x.x.I18n.t("systemStatusMSSTitle")}),Ro(e.mss.isReachable,n,t,"https://kb.mailpoet.com/article/319-known-errors-when-validating-a-mailpoet-key","5ef1da9d2c7d3a10cba966c5",null)]})}function Lo(){const e=window.systemStatusData,t=window.actionSchedulerData;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("div",{className:"mailpoet_notice notice inline",children:(0,_.jsx)("p",{children:e.mss.enabled?x.x.I18n.t("systemStatusIntroCronMSS"):x.x.I18n.t("systemStatusIntroCron")})}),Po(e),Mo(e),(0,_.jsx)(ko,{status_data:e.cronStatus}),(0,_.jsx)(Oo,{...t}),t?(0,_.jsx)(Ao,{status_data:e.queueStatus}):null]})}function Fo(){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("p",{children:x.x.I18n.t("yourPrivacyContent1")}),(0,_.jsx)("p",{children:x.x.I18n.t("yourPrivacyContent2")}),(0,_.jsx)("p",{children:x.x.I18n.t("yourPrivacyContent3")}),(0,_.jsx)(E.z,{target:"_blank",rel:"noreferrer noopener",href:"https://www.mailpoet.com/privacy-notice/",children:x.x.I18n.t("yourPrivacyButton")})]})}function qo(){return(0,_.jsxs)(Te.k.Provider,{value:(0,Te.S)(window),children:[(0,_.jsx)(L.D,{}),(0,_.jsx)(Le.w,{}),(0,_.jsxs)(Ca.t,{activeKey:"knowledgeBase",children:[(0,_.jsx)(f.Tab,{title:x.x.I18n.t("tabKnowledgeBaseTitle"),children:(0,_.jsx)(_o,{})},"knowledgeBase"),(0,_.jsx)(f.Tab,{title:x.x.I18n.t("tabSystemStatusTitle"),children:(0,_.jsx)(Lo,{})},"systemStatus"),(0,_.jsx)(f.Tab,{title:x.x.I18n.t("tabSystemInfoTitle"),children:(0,_.jsx)(Io,{})},"systemInfo"),(0,_.jsx)(f.Tab,{title:x.x.I18n.t("tabYourPrivacyTitle"),children:(0,_.jsx)(Fo,{})},"yourPrivacy")]})]})}wo&&i.render((0,_.jsx)(yo,{}),wo),Co.propTypes={max_width:h().string,rows:h().arrayOf(h().shape({key:h().string.isRequired,value:h().oneOfType([h().string,h().number,h().element]).isRequired})).isRequired},Co.defaultProps={max_width:"auto"},To.propTypes={truthy:h().string,falsy:h().string,unknown:h().string,children:h().bool},To.defaultProps={truthy:x.x.I18n.t("yes"),falsy:x.x.I18n.t("no"),unknown:x.x.I18n.t("unknown"),children:null},ko.propTypes={status_data:h().shape({accessible:h().bool,last_error_date:h().string,status:h().string,updated_at:h().number,run_accessed_at:h().number,run_completed_at:h().number,run_started_at:h().number,last_error:h().oneOfType([h().string,h().array])}).isRequired},No.propTypes={show_scheduled_at:h().bool,task:h().shape({id:h().number.isRequired,type:h().string.isRequired,priority:h().number.isRequired,updated_at:h().string.isRequired,scheduled_at:h().string,status:h().string,newsletter:h().shape({newsletter_id:h().number.isRequired,queue_id:h().number.isRequired,preview_url:h().string.isRequired,subject:h().string})}).isRequired},No.defaultProps={show_scheduled_at:!1},Do.propTypes={show_scheduled_at:h().bool},Do.defaultProps={show_scheduled_at:!1},Eo.propTypes={show_scheduled_at:h().bool,tasks:h().arrayOf(No.propTypes.task).isRequired},Eo.defaultProps={show_scheduled_at:!1},Ao.propTypes={status_data:h().shape({status:h().string,started:h().number,sent:h().number,retry_attempt:h().number,retry_at:h().number,error:h().shape({operation:h().string,error_message:h().string}),tasksStatusCounts:h().shape({completed:h().number.isRequired,running:h().number.isRequired,paused:h().number.isRequired,scheduled:h().number.isRequired}).isRequired,latestTasks:h().arrayOf(No.propTypes.task).isRequired}).isRequired};const $o=document.getElementById("help_container");$o&&i.render((0,_.jsx)(qo,{}),$o);const Uo=(0,l.EN)((function(e){let{children:t,location:{pathname:n}}=e;return(0,y.useEffect)((()=>{window.scrollTo(0,0)}),[n]),t||null}));function Zo(e){let{activeMethod:t,onMethodChange:n}=e;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("div",{className:"mailpoet-settings-label",children:[(0,_.jsx)("span",{className:"mailpoet_import_heading",children:x.x.I18n.t("methodSelectionHead")}),(0,_.jsx)("div",{className:"mailpoet-settings-inputs-row",children:(0,_.jsx)("a",{href:"https://kb.mailpoet.com/article/242-video-guide-importing-subscribers-using-a-csv-file","data-beacon-article":"5a8e8f0204286305fbc9be9a",target:"_blank",rel:"noopener noreferrer",children:(0,_.jsx)(Ne.V,{dimension:"large",variant:"excellent",isInverted:!0,children:x.x.I18n.t("seeVideo")})})})]}),(0,_.jsxs)("div",{className:"mailpoet-settings-inputs",children:[(0,_.jsxs)("div",{className:"mailpoet-settings-inputs-row",children:[(0,_.jsx)(ie.Y,{name:"select_method",automationId:"import-paste-method",id:"import-paste-method",checked:"paste-method"===t,value:"paste-method",onCheck:n}),(0,_.jsx)("label",{htmlFor:"import-paste-method",children:x.x.I18n.t("methodPaste")})]}),(0,_.jsxs)("div",{className:"mailpoet-settings-inputs-row",children:[(0,_.jsx)(ie.Y,{name:"select_method",automationId:"import-csv-method",id:"import-csv-method",checked:"file-method"===t,value:"file-method",onCheck:n}),(0,_.jsx)("label",{htmlFor:"import-csv-method",children:x.x.I18n.t("methodUpload")})]}),(0,_.jsxs)("div",{className:"mailpoet-settings-inputs-row",children:[(0,_.jsx)(ie.Y,{name:"select_method",automationId:"import-mailchimp-method",id:"import-mailchimp-method",checked:"mailchimp-method"===t,value:"mailchimp-method",onCheck:n}),(0,_.jsx)("label",{htmlFor:"import-mailchimp-method",children:x.x.I18n.t("methodMailChimp")})]})]})]})}function Vo(e){let{hidePrevious:t,isLastStep:n,canGoNext:r,onPreviousAction:a,onNextAction:s}=e;return(0,_.jsxs)("div",{className:"mailpoet-settings-save",children:[!t&&(0,_.jsx)(E.z,{type:"button",variant:"secondary",onClick:a,children:x.x.I18n.t("previousStep")}),(0,_.jsx)(E.z,{type:"button",automationId:"import-next-step",isDisabled:!r,onClick:()=>{r&&s()},children:x.x.I18n.t(n?"import":"nextStep")})]})}function Wo(e){let{onValueChange:t,canFinish:n,onFinish:r,data:a,onPrevious:s}=e;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("div",{className:"mailpoet-settings-label",children:[(0,_.jsx)("label",{htmlFor:"paste_input",children:x.x.I18n.t("pasteLabel")}),(0,_.jsx)("p",{className:"description",children:I()(x.x.I18n.t("pasteDescription"),/\[link\](.*?)\[\/link\]/,(e=>(0,_.jsx)("a",{className:"mailpoet-link",href:"https://kb.mailpoet.com/article/126-importing-subscribers-with-csv-files","data-beacon-article":"57ce079f903360649f6e56fc",target:"_blank",rel:"noopener noreferrer",children:e},"kb-link")))})]}),(0,_.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,_.jsx)(ne.g,{id:"paste_input",rows:"15",placeholder:"Email, First Name, Last Name\njohn@doe.com, John, Doe\nmary@smith.com, Mary, Smith\njohnny@walker.com, Johnny, Walker",isCode:!0,onChange:e=>{t(e.target.value)},defaultValue:a})}),(0,_.jsx)(Vo,{canGoNext:n,onPreviousAction:s,onNextAction:r})]})}function Yo(e){let{onValueChange:t,canFinish:n,onFinish:r,onPrevious:a}=e;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("div",{className:"mailpoet-settings-label",children:[(0,_.jsx)("label",{htmlFor:"file_local",children:x.x.I18n.t("methodUpload")}),(0,_.jsx)("p",{className:"description",children:I()(x.x.I18n.t("pasteDescription"),/\[link\](.*?)\[\/link\]/,(e=>(0,_.jsx)("a",{className:"mailpoet-link",href:"https://kb.mailpoet.com/article/126-importing-subscribers-with-csv-files","data-beacon-article":"57ce079f903360649f6e56fc",target:"_blank",rel:"noopener noreferrer",children:e},"kb-link")))})]}),(0,_.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,_.jsx)(ee.I,{type:"file",id:"file_local",accept:".csv","data-automation-id":"import-file-upload-input",onChange:e=>{const n=e.target.value.match(/[^.]+$/);x.x.Notice.hide(),null===n||"csv"!==n[0].toLowerCase()?(x.x.Notice.error(x.x.I18n.t("wrongFileFormat")),t("")):t(e.target.files[0])}})}),(0,_.jsx)(Vo,{canGoNext:n,onPreviousAction:a,onNextAction:r})]})}function Bo(e){let{onFinish:t,onPrevious:n}=e;const[r,a]=(0,y.useState)(""),[s,i]=(0,y.useState)(void 0),[o,l]=(0,y.useState)([]);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("div",{className:"mailpoet-settings-label",children:(0,_.jsxs)("label",{htmlFor:"mailpoet_mailchimp_key_input",children:[(0,_.jsx)("span",{className:"mailpoet_import_heading",children:x.x.I18n.t("methodMailChimpLabel")}),(0,_.jsx)("p",{className:"description",children:I()(x.x.I18n.t("methodMailChimpDescription"),/\[link\](.*?)\[\/link\]/,(e=>(0,_.jsx)("a",{className:"mailpoet-link",href:"https://kb.mailpoet.com/article/255-migrating-from-mailchimp-to-mailpoet#api","data-beacon-article":"5b16db842c7d3a0fa9a2aa15",target:"_blank",rel:"noopener noreferrer",children:e},"kb-link")))})]})}),(0,_.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,_.jsxs)("div",{className:"mailpoet-settings-inputs-row mailpoet-settings-inputs-row-centered",children:[(0,_.jsx)(ee.I,{dimension:"small",id:"mailpoet_mailchimp_key_input",type:"text",onChange:e=>{a(e.target.value),""===e.target.value.trim()&&i(void 0)}}),(0,_.jsx)("span",{className:"mailpoet-gap"}),(0,_.jsx)(E.z,{type:"button",dimension:"small",onClick:()=>{x.x.Modal.loading(!0),x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"importExport",action:"getMailChimpLists",data:{api_key:r}}).always((()=>{x.x.Modal.loading(!1)})).done((e=>i(e.data))).fail((e=>{e.errors.length>0&&x.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},children:x.x.I18n.t("methodMailChimpVerify")}),(0,_.jsx)("span",{className:"mailpoet-gap"}),(0,_.jsx)("span",{children:Array.isArray(s)&&0===s.length?x.x.I18n.t("noMailChimpLists"):null})]})}),s?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("div",{className:"mailpoet-settings-label",children:x.x.I18n.t("methodMailChimpSelectList")}),(0,_.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,_.jsx)(j,{field:{id:"segments",name:"list-selection",multiple:!0,placeholder:x.x.I18n.t("methodMailChimpSelectPlaceholder"),forceSelect2:!0,values:s},onValueChange:e=>l(e.target.value)})})]}):null,(0,_.jsx)(Vo,{canGoNext:Array.isArray(o)&&o.length>0,onPreviousAction:n,onNextAction:()=>{x.x.Modal.loading(!0),x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"importExport",action:"getMailChimpSubscribers",data:{api_key:r,lists:o}}).always((()=>{x.x.Modal.loading(!1)})).done((e=>t(e.data))).fail((e=>{e.errors.length>0&&x.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}})]})}Zo.propTypes={activeMethod:h().string,onMethodChange:h().func.isRequired},Zo.defaultProps={activeMethod:void 0},Vo.propTypes={canGoNext:h().bool,hidePrevious:h().bool,isLastStep:h().bool,onPreviousAction:h().func,onNextAction:h().func},Vo.defaultProps={hidePrevious:!1,isLastStep:!1,canGoNext:!0,onPreviousAction:()=>{},onNextAction:()=>{}},Wo.propTypes={onFinish:h().func,onPrevious:h().func,canFinish:h().bool.isRequired,onValueChange:h().func.isRequired,data:h().string},Wo.defaultProps={onFinish:()=>{},onPrevious:()=>{},data:""},Yo.propTypes={canFinish:h().bool.isRequired,onFinish:h().func,onPrevious:h().func,onValueChange:h().func.isRequired},Yo.defaultProps={onFinish:()=>{},onPrevious:()=>{}},Bo.propTypes={onFinish:h().func,onPrevious:h().func},Bo.defaultProps={onFinish:()=>{},onPrevious:()=>{}};var Ho=n(71906),zo=n.n(Ho);const Go=e=>window.roleBasedEmails.findIndex((t=>e.startsWith(`${t}@`)))>=0,Ko=e=>{let t,n=w.ZP.unescape(e);return n=n.toLowerCase().replace(/^["';.,\s]+|[^\x20-\x7E]+$|["';.,_\s]+$/g,"").replace(/\s+|%\d+|,+/g,""),t=/<(.*?)>/.exec(n),t&&(n=t[1].trim()),t=/mailto:(?:\s+)?(.*)/.exec(n),t&&(n=t[1].trim()),!!window.mailpoet_email_regex.test(n)&&!Go(n)&&n};function Qo(e){let{history:t,setStepMethodSelectionData:n,subscribersLimitForValidation:r}=e;const[a,s]=(0,y.useState)(void 0),[i,o]=(0,y.useState)(""),[l,c]=(0,y.useState)(void 0),d=e=>{n(e),t.push(((e,t,n)=>void 0===e||void 0===e.subscribersCount||e.subscribersCount<t||"mailchimp-method"===n?"step_data_manipulation":"step_input_validation")(e,r,a))},u=()=>{t.push("/step_clean_list")},p=()=>{((e,t)=>{const n=encodeURI(e).split(/%..|./).length-1;x.x.Notice.hide(),n>window.maxPostSizeBytes?x.x.Notice.error(x.x.I18n.t("maxPostSizeNotice")):(x.x.Modal.loading(!0),zo().parse(e,function(e){return{skipEmptyLines:!0,error(){x.x.Notice.hide(),x.x.Notice.error(x.x.I18n.t("dataProcessingError"))},complete(t){const n=function(e){let t=[];const n=[],r=[],a=[],s=[];let i,o,l,c,d=null,u=null,p=!1;return Object.keys(e).forEach((m=>{l=e[m].map((e=>e.trim())),c=l.length,null===u&&(u=c),c===u&&(null===d?(Object.keys(l).forEach((e=>{o=Ko(l[e]),null===d&&window.mailpoet_email_regex.test(o)&&(d=e,n[o]=!0,l[e]=o,t[o]=l)})),null===d&&0===parseInt(m,10)&&(p=!0,t[0]=l)):""!==l[d]&&(i=Ko(l[d]),w.ZP.has(n,i)?r.push(i):Go(l[d])?s.push(l[d]):window.mailpoet_email_regex.test(i)?(n[i]=!0,l[d]=i,t[i]=l):a.push(l[d])))})),t=w.ZP.values(t),t&&(p&&t.length>=2||!p&&t.length>=1)?{header:window.mailpoet_email_regex.test(t[0][d])?null:t.shift(),subscribers:t,subscribersCount:t.length,duplicate:w.ZP.uniq(r),invalid:w.ZP.uniq(a),role:w.ZP.uniq(s)}:null}(t.data);if(n)e(n);else{let e=x.x.I18n.t("noValidRecords");e=e.replace("[link]",'<a href="https://kb.mailpoet.com/article/126-importing-subscribers-with-csv-files" data-beacon-article="57ce079f903360649f6e56fc">'),e=e.replace("[/link]","</a>"),x.x.Notice.error(e)}x.x.Modal.loading(!1)}}}((e=>{x.x.trackEvent("Subscribers import started",{source:"file-method"===a?"file upload":"pasted data"}),d(e)}))))})("paste-method"===a?i:l)};return(0,_.jsxs)("div",{className:"mailpoet-settings-grid",children:[(0,_.jsx)(Zo,{activeMethod:a,onMethodChange:s}),"paste-method"===a&&(0,_.jsx)(Wo,{onPrevious:u,onValueChange:o,onFinish:p,canFinish:!!i.trim(),data:i}),"file-method"===a&&(0,_.jsx)(Yo,{onPrevious:u,onValueChange:c,onFinish:p,canFinish:!!l,data:l}),"mailchimp-method"===a&&(0,_.jsx)(Bo,{onPrevious:u,onFinish:e=>{x.x.trackEvent("Subscribers import started",{source:"MailChimp"}),d(e)}}),void 0===a&&(0,_.jsx)(Vo,{canGoNext:!1,onPreviousAction:u})]})}Qo.propTypes={history:h().shape({push:h().func.isRequired}).isRequired,setStepMethodSelectionData:h().func.isRequired,subscribersLimitForValidation:h().number.isRequired};const Xo=(0,l.EN)(Qo);function Jo(e){let{onProceed:t}=e;return(0,_.jsxs)("div",{className:"mailpoet-clean-list-step-container",children:[(0,_.jsx)("p",{children:x.x.I18n.t("cleanListText1")}),(0,_.jsx)("p",{children:x.x.I18n.t("cleanListText2")}),(0,_.jsxs)("p",{children:[t&&(0,_.jsx)(E.z,{onClick:t,variant:"tertiary",children:x.x.I18n.t("listCleaningGotIt")}),(0,_.jsx)(E.z,{target:"_blank",href:"https://kb.mailpoet.com/article/287-list-cleaning-services",children:x.x.I18n.t("tryListCleaning")})]})]})}function el(e){let{onSubmit:t,history:n}=e;const[r,a]=(0,y.useState)(void 0);return(0,_.jsxs)("div",{className:"mailpoet-settings-grid",children:[(0,_.jsx)("div",{className:"mailpoet-settings-label",children:x.x.I18n.t("validationStepHeading")}),(0,_.jsxs)("div",{className:"mailpoet-settings-inputs",children:[(0,_.jsxs)("div",{className:"mailpoet-settings-inputs-row",children:[(0,_.jsx)(ie.Y,{automationId:"mailpoet_import_validation_step_option1",id:"existing-list",checked:"existing-list"===r,value:"existing-list",onCheck:a}),(0,_.jsx)("label",{htmlFor:"existing-list",children:x.x.I18n.t("validationStepRadio1")})]}),(0,_.jsxs)("div",{className:"mailpoet-settings-inputs-row",children:[(0,_.jsx)(ie.Y,{automationId:"mailpoet_import_validation_step_option2",id:"address-book",checked:"address-book"===r,value:"address-book",onCheck:a}),(0,_.jsx)("label",{htmlFor:"address-book",children:x.x.I18n.t("validationStepRadio2")})]})]}),(0,_.jsx)(Vo,{canGoNext:void 0!==r,onPreviousAction:()=>n.push("step_method_selection"),onNextAction:()=>t(r)})]})}function tl(){return(0,_.jsxs)("div",{className:"mailpoet-clean-list-step-container","data-automation-id":"import_wrong_source_block",children:[(0,_.jsx)("p",{children:x.x.I18n.t("validationStepBlock1")}),(0,_.jsx)("p",{children:x.x.I18n.t("validationStepBlock2")}),(0,_.jsx)("p",{children:(0,_.jsx)(E.z,{href:"https://kb.mailpoet.com/article/269-reconfirm-subscribers-to-your-list",target:"_blank",rel:"noopener noreferrer",children:x.x.I18n.t("validationStepBlockButton")})})]})}function nl(e){let{onSubmit:t}=e;const[n,r]=(0,y.useState)("over2years"),a=(0,y.useCallback)((e=>{r(e.target.value)}),[r]),s=(0,y.useCallback)((()=>{t("over2years"===n||"1to2years"===n?"notRecently":"recently")}),[t,n]);return(0,_.jsxs)("div",{className:"mailpoet-settings-grid",children:[(0,_.jsx)("div",{className:"mailpoet-settings-label",children:x.x.I18n.t("validationStepLastSentHeading")}),(0,_.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,_.jsxs)(ae.Select,{defaultValue:n,onChange:a,automationId:"last_sent_to_list",children:[(0,_.jsx)("option",{value:"over2years",children:x.x.I18n.t("validationStepLastSentOption1")}),(0,_.jsx)("option",{value:"1to2years",children:x.x.I18n.t("validationStepLastSentOption2")}),(0,_.jsx)("option",{value:"less1year",children:x.x.I18n.t("validationStepLastSentOption3")}),(0,_.jsx)("option",{value:"less3months",children:x.x.I18n.t("validationStepLastSentOption4")})]})}),(0,_.jsx)("div",{className:"mailpoet-settings-save",children:(0,_.jsx)(E.z,{type:"button",automationId:"last_sent_to_list_next",onClick:s,children:x.x.I18n.t("validationStepLastSentNext")})})]})}function rl(e){let{stepMethodSelectionData:t,history:n}=e;const[r,a]=(0,y.useState)(void 0),[s,i]=(0,y.useState)(void 0);(0,y.useEffect)((()=>{void 0===t&&n.replace("step_method_selection")}),[t,n]);const o=(0,y.useCallback)((e=>{i(e),"recently"===e&&n.push("step_data_manipulation")}),[n,i]);return(0,_.jsxs)(_.Fragment,{children:[void 0===r&&(0,_.jsx)(el,{onSubmit:a,history:n}),"address-book"===r&&(0,_.jsx)(tl,{}),"existing-list"===r&&void 0===s&&(0,_.jsx)(nl,{onSubmit:o}),"existing-list"===r&&"notRecently"===s&&(0,_.jsx)(Jo,{})]})}el.propTypes={history:h().shape({push:h().func.isRequired}).isRequired,onSubmit:h().func.isRequired},nl.propTypes={onSubmit:h().func.isRequired},rl.propTypes={history:h().shape({push:h().func.isRequired,replace:h().func.isRequired}).isRequired,stepMethodSelectionData:h().shape({duplicate:h().arrayOf(h().string),header:h().arrayOf(h().string),invalid:h().arrayOf(h().string),role:h().arrayOf(h().string),subscribersCount:h().number,subscribers:h().arrayOf(h().arrayOf(h().string))})},rl.defaultProps={stepMethodSelectionData:void 0};const al=(0,l.EN)(rl),sl=e=>{let{translation:t,subscribers:n}=e,r="";return n.length&&(r=I()(t.replace("%2$s",n.join(", ")),"%1$s",(()=>(0,_.jsx)("strong",{children:n.length.toLocaleString()},t))),r=(0,_.jsx)("p",{children:r})),r};function il(e){let{stepMethodSelectionData:t}=e;const{invalid:n,duplicate:r,role:a}=t,[s,i]=(0,y.useState)(!1),o=d()("mailpoet_subscribers_data_parse_results_details",{mailpoet_hidden:!s}),l=(0,_.jsx)(sl,{translation:x.x.I18n.t("importNoticeInvalid"),subscribers:n}),c=(0,_.jsx)(sl,{translation:x.x.I18n.t("importNoticeDuplicate"),subscribers:r});let u="";if(a.length&&(u=I()(x.x.I18n.t("importNoticeRoleBased"),/(%1\$s|\[link\].*\[\/link\]|%2\$s)/,(e=>"%1$s"===e?(0,_.jsx)("strong",{children:a.length.toLocaleString()},"role-length"):"%2$s"===e?a.join(", "):(0,_.jsx)("a",{href:"https://kb.mailpoet.com/article/270-role-based-email-addresses-are-not-allowed","data-beacon-article":"5d0a1da404286318cac46fe5",target:"_blank",rel:"noopener noreferrer",children:e.replace("[link]","").replace("[/link]","")},e))),u=(0,_.jsx)("p",{children:u})),n.length||r.length||a.length){const e=n.length+r.length+a.length;return(0,_.jsxs)("div",{className:"error",children:[(0,_.jsxs)("p",{children:[I()(x.x.I18n.t("importNoticeSkipped"),"%1$s",(()=>(0,_.jsx)("strong",{children:e.toLocaleString()},"lengths")))," ",(0,_.jsx)("a",{className:"mailpoet_subscribers_data_parse_results_details_show","data-automation-id":"show-more-details",onClick:()=>i(!s),role:"button",tabIndex:0,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),i(!s))},children:x.x.I18n.t("showMoreDetails")})]}),(0,_.jsxs)("div",{className:o,children:[(0,_.jsx)("hr",{}),l,c,u]})]})}return null}function ol(e){let{header:t,subscribers:n}=e;const r=((e,t)=>{const n=[],r=[];let a,s,i,o;return Object.keys(e[0]).forEach((l=>{a=e[0][l],s="ignore",a%1!=0&&window.mailpoet_email_regex.test(a)?s="email":t&&(i=t[l],o=window.mailpoetColumns.map((e=>e.name)).indexOf(i),-1!==o?s=window.mailpoetColumns[o].id:i&&(/first|first name|given name/i.test(i)?s="first_name":/last|last name/i.test(i)&&(s="last_name"))),s="ignore"!==s&&-1===r.indexOf(s)?s:"ignore",n[l]={column_id:s},r.push(s)})),n})(n,t);return(0,_.jsxs)("tr",{children:[(0,_.jsx)("th",{children:x.x.I18n.t("matchData")}),r.map(((e,t)=>(0,_.jsx)("th",{children:(0,_.jsx)("select",{className:"mailpoet_subscribers_column_data_match","data-column-id":e.column_id,"data-column-index":t,id:`column_${t}`})},e.column_id+t)))]})}function ll(e){let{header:t}=e;return(0,_.jsxs)("tr",{className:"mailpoet_header",children:[(0,_.jsx)("td",{}),t.map((e=>(0,_.jsx)("td",{children:e},e)))]})}function cl(e){let{subscriber:t,index:n}=e;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("td",{children:n}),t.map(((e,t)=>(0,_.jsx)("td",{children:e},`${e}-${n}-${t}`)))]})}function dl(e){let{subscribers:t,subscribersCount:n}=e;const r=". . .",a=Array(t[0].length).fill(r);return(0,_.jsxs)(_.Fragment,{children:[t.slice(0,10).map(((e,t)=>(0,_.jsx)("tr",{children:(0,_.jsx)(cl,{subscriber:e,index:t+1})},`${e[0]}-${t}`))),n>11?(0,_.jsx)("tr",{children:(0,_.jsx)(cl,{subscriber:a,index:r})},"filler"):null,n>10?(0,_.jsx)("tr",{children:(0,_.jsx)(cl,{subscriber:t[n-1],index:n})},t[n-1][0]):null]})}function ul(e){let{subscribersCount:t,subscribers:n,header:r}=e;return(0,y.useLayoutEffect)((()=>{(()=>{const e={data:window.mailpoetColumnsSelect2,width:"15em"};p()("select.mailpoet_subscribers_column_data_match").select2(e).on("select2:selecting",(t=>{const n=t.currentTarget,r=t.params.args.data.id;"create"===r?(t.preventDefault(),p()(n).select2("close"),x.x.Modal.popup({title:x.x.I18n.t("addNewField"),template:p()("#form_template_field_form").html()}),p()("#form_field_new").parsley().on("form:submit",(()=>{const t=p()("#form_field_new").mailpoetSerializeObject();return x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"customFields",action:"save",data:t}).done((t=>{const r={id:t.data.id,name:t.data.name,text:t.data.name,type:t.data.type,params:t.data.params,custom:!0};2===window.mailpoetColumnsSelect2.length&&window.mailpoetColumnsSelect2.push({name:x.x.I18n.t("userColumns"),children:[]}),window.mailpoetColumnsSelect2[2].children.push(r),window.mailpoetColumns.push(r),p()("select.mailpoet_subscribers_column_data_match").each((()=>{p()(n).html("").select2("destroy").select2(e)})),p()(n).data("column-id",r.id),x.x.Modal.close()})).fail((e=>{e.errors.length>0&&x.x.Notice.error(e.errors.map((e=>e.message)),{positionAfter:"#field_name"})})),!1}))):p()("select.mailpoet_subscribers_column_data_match").each((()=>{const e=n,a=p()(e).val();a===r&&"ignore"!==a&&(confirm(`${x.x.I18n.t("selectedValueAlreadyMatched")} ${x.x.I18n.t("confirmCorrespondingColumn")}`)?p()(e).data("column-id","ignore"):(t.preventDefault(),p()(n).select2("close")))}))})).on("select2:select",(e=>{const t=e.currentTarget,n=e.params.data.id;p()(t).data("column-id",n)})).on("select2:open",(()=>{const e=document.querySelectorAll(".select2-search__field[aria-controls]");0!==e.length&&e[e.length-1].focus()})),p().map(p()(".mailpoet_subscribers_column_data_match"),(e=>{const t=p()(e).data("column-id");p()(e).val(t).trigger("change")}))})()})),(0,_.jsx)("div",{className:"subscribers_data",children:(0,_.jsxs)("table",{className:"mailpoet_subscribers widefat fixed",children:[(0,_.jsx)("thead",{children:(0,_.jsx)(ol,{header:r,subscribers:n})}),(0,_.jsxs)("tbody",{children:[r?(0,_.jsx)(ll,{header:r}):null,(0,_.jsx)(dl,{subscribers:n,subscribersCount:t})]})]})})}function pl(e){let{setSelectedSegments:t}=e;const{segments:n}=(0,y.useContext)(Te.k),{all:r,updateAll:a}=n,[s,i]=(0,y.useState)(r);(0,y.useLayoutEffect)((()=>{!function(e,n){const r=p()("select#mailpoet_segments_select");if(r.data("select2"))return;const a=e=>{let t=`<span class="mailpoet-form-select2-text"><span>${e.name}</span></span>`;return e.count&&(t+=`<span class="mailpoet-form-select2-count">${e.count}</span>`),t};r.html(""),r.select2({data:e.map((e=>({...e,text:e.name}))),dropdownCssClass:"mailpoet-form-select2-dropdown",escapeMarkup:e=>e,templateResult:a,templateSelection:a}).on("change",(e=>{const n=p()('[data-id="notice_segmentSelection"]');e.currentTarget.value?p()('[data-id="notice_segmentSelection"]').remove():n.length||x.x.Notice.error(x.x.I18n.t("segmentSelectionRequired"),{static:!0,scroll:!0,id:"notice_segmentSelection",hideClose:!0});(e=>{t(e)})(w.ZP.pluck(r.select2("data"),"id"))}))}(s)}),[s,t]);const o=e=>{!function(){const e=p()("select#mailpoet_segments_select");e.data("select2")&&(e.select2("destroy"),e.find("option").remove(),e.off("select2:unselecting").off("change").off("select2:opening"))}(),t([]),i([...s,e]),a([...s,e])};return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("div",{className:"mailpoet-settings-label",children:(0,_.jsxs)("label",{htmlFor:"mailpoet_segments_select",children:[x.x.I18n.t("pickLists"),(0,_.jsx)("p",{className:"description",children:x.x.I18n.t("pickListsDescription")})]})}),(0,_.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,_.jsxs)("div",{className:"mailpoet-settings-inputs-row mailpoet-settings-inputs-row-centered",children:[(0,_.jsx)("div",{className:"mailpoet-form-select mailpoet-form-input",children:(0,_.jsx)("select",{id:"mailpoet_segments_select","data-placeholder":x.x.I18n.t("select"),multiple:"multiple",children:(0,_.jsx)("option",{})})}),(0,_.jsx)(E.z,{variant:"tertiary",onClick:()=>{return e=o,x.x.Modal.popup({title:x.x.I18n.t("addNewList"),template:p()("#new_segment_template").html()}),p()("#new_segment_name").on("keypress",(e=>{13===e.which&&p()("#new_segment_process").trigger("click")})),p()("#new_segment_process").on("click",(()=>{const t=p()("#new_segment_name").val().trim(),n=p()("#new_segment_description").val().trim();x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"ImportExport",action:"addSegment",data:{name:t,description:n}}).done((t=>{e({id:t.data.id,name:t.data.name,text:t.data.name,subscriberCount:0}),x.x.Modal.close()})).fail((e=>{e.errors.length>0&&(x.x.Notice.hide(),x.x.Notice.error(e.errors.map((e=>e.message)),{positionAfter:"#new_segment_name"}))}))})),void p()("#new_segment_cancel").on("click",(()=>{x.x.Modal.close()}));var e},children:x.x.I18n.t("createANewList")})]})})]})}function ml(){return(0,_.jsx)("p",{className:"description",children:I()(x.x.I18n.t("consentSubscribed"),/\[link](.*?)\[\/link]/,(e=>(0,_.jsx)("a",{className:"mailpoet-link",href:"https://kb.mailpoet.com/article/357-why-express-consent-is-important",target:"_blank","data-beacon-article":"605ca22ac44f5d025f447f39",rel:"noopener noreferrer",children:e},"kb-link")))})}function hl(e){let{newSubscribersStatus:t,setNewSubscribersStatus:n}=e;const r=(0,y.useCallback)((e=>{n(e.target.value)}),[n]);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("div",{className:"mailpoet-settings-label",children:[(0,_.jsx)("label",{htmlFor:"new_subscribers_status",children:x.x.I18n.t("newSubscribersStatus")}),(0,_.jsx)(ml,{})]}),(0,_.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,_.jsxs)(ae.Select,{id:"new_subscribers_status",placeholder:x.x.I18n.t("select"),name:"new_subscribers_status",onChange:r,defaultValue:t,children:[(0,_.jsx)("option",{value:"subscribed",children:x.x.I18n.t("subscribed")}),(0,_.jsx)("option",{value:"inactive",children:x.x.I18n.t("inactive")}),(0,_.jsx)("option",{value:"unsubscribed",children:x.x.I18n.t("unsubscribed")})]})})]})}function fl(e){let{existingSubscribersStatus:t,setExistingSubscribersStatus:n}=e;const r=(0,y.useCallback)((e=>{n(e.target.value)}),[n]);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("div",{className:"mailpoet-settings-label",children:[(0,_.jsx)("label",{htmlFor:"existing_subscribers_status",children:x.x.I18n.t("existingSubscribersStatus")}),(0,_.jsx)(ml,{})]}),(0,_.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,_.jsxs)(ae.Select,{id:"existing_subscribers_status",placeholder:x.x.I18n.t("select"),name:"existing_subscribers_status",onChange:r,defaultValue:t,children:[(0,_.jsx)("option",{value:"dont_update",children:x.x.I18n.t("dontUpdate")}),(0,_.jsx)("option",{value:"subscribed",children:x.x.I18n.t("subscribed")}),(0,_.jsx)("option",{value:"inactive",children:x.x.I18n.t("inactive")}),(0,_.jsx)("option",{value:"unsubscribed",children:x.x.I18n.t("unsubscribed")})]})})]})}function gl(e){let{updateExistingSubscribers:t,setUpdateExistingSubscribers:n}=e;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("div",{className:"mailpoet-settings-label",children:x.x.I18n.t("updateExistingSubscribers")}),(0,_.jsxs)("div",{className:"mailpoet-settings-inputs",children:[(0,_.jsx)(ie.Y,{id:"update_existing_subscribers",name:"update_existing_subscribers",value:"1",checked:t,onCheck:()=>n(!0)}),(0,_.jsx)("label",{htmlFor:"update_existing_subscribers",children:x.x.I18n.t("updateExistingSubscribersYes")}),(0,_.jsx)("span",{className:"mailpoet-gap"}),(0,_.jsx)(ie.Y,{id:"dont_update_existing_subscribers",name:"update_existing_subscribers",value:"",checked:!t,onCheck:()=>n(!1)}),(0,_.jsx)("label",{htmlFor:"dont_update_existing_subscribers",children:x.x.I18n.t("updateExistingSubscribersNo")})]})]})}function xl(e){let{selectedTags:t,setSelectedTags:n}=e;const r=(0,y.useCallback)((e=>{let{value:t}=e;n(t)}),[n]),a=x.x.tags.map((e=>e.name));return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("div",{className:"mailpoet-settings-label",children:[x.x.I18n.t("assignTagsLabel"),(0,_.jsx)("p",{className:"description",children:x.x.I18n.t("assignTagsDescription")})]}),(0,_.jsx)("div",{className:"mailpoet-settings-inputs mailpoet-import-tags",children:(0,_.jsx)(fe.T,{name:"tags",onChange:r,suggestedValues:a,selectedValues:t,placeholder:x.x.I18n.t("addNewTag")})})]})}function vl(e){let{history:t,stepMethodSelectionData:n,subscribersLimitForValidation:r,setStepDataManipulationData:a}=e;const[s,i]=(0,y.useState)([]),[o,l]=(0,y.useState)(!0),[c,d]=(0,y.useState)("subscribed"),[u,m]=(0,y.useState)("dontUpdate"),[h,f]=(0,y.useState)([]);return(0,y.useEffect)((()=>{void 0===n&&t.replace("step_method_selection")}),[n,t]),void 0===n?null:(0,_.jsxs)("div",{"data-automation-id":"import_data_manipulation_step",children:[(0,_.jsx)(il,{stepMethodSelectionData:n}),(0,_.jsx)(ul,{subscribersCount:n.subscribersCount,subscribers:n.subscribers,header:n.header}),(0,_.jsxs)("div",{className:"mailpoet-settings-grid",children:[(0,_.jsx)(pl,{setSelectedSegments:i}),(0,_.jsx)(hl,{newSubscribersStatus:c,setNewSubscribersStatus:d}),(0,_.jsx)(fl,{existingSubscribersStatus:u,setExistingSubscribersStatus:m}),(0,_.jsx)(gl,{setUpdateExistingSubscribers:l,updateExistingSubscribers:o}),(0,_.jsx)(xl,{selectedTags:h,setSelectedTags:f}),(0,_.jsx)(Vo,{canGoNext:s.length>0,onPreviousAction:()=>t.push(function(e,t){return void 0===e||void 0===e.subscribersCount||e.subscribersCount<t?"step_method_selection":"step_input_validation"}(n,r)),onNextAction:()=>{((e,n,r,s,i,o,l)=>{const c={},d=new(p().AsyncQueue);let u=0;const m=Date.now()/1e3,h={created:0,updated:0,errors:[],segments:[],tags:[]};x.x.Modal.loading(!0);const f=(2e3,e.reduce(((e,t,n)=>(n%2e3==0&&e.push([]),e[e.length-1].push(t),e)),[]));w.ZP.each(p()("select.mailpoet_subscribers_column_data_match"),((e,t)=>{const n=p()(e).data("column-id");"ignore"!==n&&(c[n]={index:t})})),w.ZP.each(f,(()=>{d.add((e=>{e.pause(),x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"ImportExport",action:"processImport",data:JSON.stringify({columns:c,subscribers:f[u],timestamp:m,segments:n,newSubscribersStatus:r,existingSubscribersStatus:s,updateSubscribers:i,tags:o})}).done((t=>{const n=t.data.added_to_segment_with_welcome_notification;h.created+=t.data.created,h.updated+=t.data.updated,h.segments=t.data.segments,h.added_to_segment_with_welcome_notification=n,e.run()})).fail((e=>{x.x.Modal.loading(!1),e.errors.length>0&&x.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})})),u+=1}))})),d.run(),d.onComplete((()=>{x.x.Modal.loading(!1),h.errors.length>0&&!h.updated&&!h.created?x.x.Notice.error(w.ZP.flatten(h.errors)):(h.segments=w.ZP.map(w.ZP.filter(h.segments,(e=>n.includes(e.id))),(e=>e.name)),a(h),t.push("step_results"))}))})(n.subscribers,s,c,u,o,h)},isLastStep:!0})]})]})}sl.propTypes={translation:h().string.isRequired,subscribers:h().arrayOf(h().string).isRequired},il.propTypes={stepMethodSelectionData:h().shape({duplicate:h().arrayOf(h().string),invalid:h().arrayOf(h().string),role:h().arrayOf(h().string)})},il.defaultProps={stepMethodSelectionData:{invalid:[],duplicate:[],role:[]}},ol.propTypes={subscribers:h().arrayOf(h().arrayOf(h().oneOfType([h().string,h().number]))).isRequired,header:h().arrayOf(h().string)},ol.defaultProps={header:[]},ll.propTypes={header:h().arrayOf(h().string).isRequired},cl.propTypes={subscriber:h().arrayOf(h().oneOfType([h().string,h().number])).isRequired,index:h().node.isRequired},dl.propTypes={subscribersCount:h().number.isRequired,subscribers:h().arrayOf(h().arrayOf(h().oneOfType([h().string,h().number]))).isRequired},ul.propTypes={subscribersCount:h().number,subscribers:h().arrayOf(h().arrayOf(h().oneOfType([h().string,h().number]))),header:h().arrayOf(h().string)},ul.defaultProps={subscribersCount:0,subscribers:[],header:[]},pl.propTypes={setSelectedSegments:h().func.isRequired},gl.propTypes={setUpdateExistingSubscribers:h().func.isRequired,updateExistingSubscribers:h().bool.isRequired},n(49868),vl.propTypes={history:h().shape({push:h().func.isRequired,replace:h().func.isRequired}).isRequired,stepMethodSelectionData:h().shape({duplicate:h().arrayOf(h().string),header:h().arrayOf(h().string),invalid:h().arrayOf(h().string),role:h().arrayOf(h().string),subscribersCount:h().number,subscribers:h().arrayOf(h().arrayOf(h().oneOfType([h().string,h().number])))}),subscribersLimitForValidation:h().number.isRequired,setStepDataManipulationData:h().func.isRequired},vl.defaultProps={stepMethodSelectionData:void 0};const bl=(0,l.EN)(vl);function yl(e){let{subscribersCount:t,segments:n,initialMessage:r}=e;if(t){let e=I()(r,"%1$s",(()=>(0,_.jsx)("strong",{children:t.toLocaleString()},"%1$s")));return e=I()(e,"%2$s",(()=>`"${n.join('", "')}"`)),(0,_.jsx)("p",{children:e})}return null}function wl(e){let{createdSubscribers:t,updatedSubscribers:n}=e;return t||n?null:(0,_.jsx)("p",{children:x.x.I18n.t("importNoAction")})}function _l(e){let{createdSubscribers:t,updatedSubscribers:n}=e;return t||n?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("p",{children:(0,_.jsx)("b",{children:x.x.I18n.t("congratulationResult")})}),(0,_.jsx)("p",{children:I()(x.x.I18n.t("suppressionListReminder"),/\[link](.*?)\[\/link]/,(e=>(0,_.jsx)("a",{className:"mailpoet-link",href:"https://kb.mailpoet.com/article/359-how-to-import-a-suppression-list","data-beacon-article":"6064973ce0324b5fdfd0650c",target:"_blank",rel:"noopener noreferrer",children:e},"kb-link")))})]}):null}function jl(e){let{addedToSegmentWithWelcomeNotification:t}=e;return t?(0,_.jsx)("p",{children:x.x.I18n.t("importNoWelcomeEmail")}):null}function Sl(e){let{errors:t,createdSubscribers:n,updatedSubscribers:r,segments:a,addedToSegmentWithWelcomeNotification:s,history:i}=e;return(0,y.useEffect)((()=>{void 0===a&&0===t.length&&void 0===n&&void 0===r&&i.replace("step_method_selection")}),[a,n,t.length,i,r]),t.length&&x.x.Notice.error(w.ZP.flatten(t)),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("div",{className:"updated",children:[(0,_.jsx)(yl,{subscribersCount:n,segments:a,initialMessage:x.x.I18n.t("subscribersCreated")}),(0,_.jsx)(yl,{subscribersCount:r,segments:a,initialMessage:x.x.I18n.t("subscribersUpdated")}),(0,_.jsx)(wl,{createdSubscribers:n,updatedSubscribers:r}),(0,_.jsx)(jl,{addedToSegmentWithWelcomeNotification:s})]}),(0,_.jsx)(_l,{createdSubscribers:n,updatedSubscribers:r}),(0,_.jsx)("div",{className:"mailpoet-settings-grid",children:(0,_.jsxs)("div",{className:"mailpoet-settings-save",children:[(0,_.jsx)(E.z,{variant:"secondary",type:"button",onClick:()=>i.push("step_method_selection"),children:x.x.I18n.t("importAgain")}),(0,_.jsx)(E.z,{type:"button",onClick:()=>{window.location.href="admin.php?page=mailpoet-subscribers"},children:x.x.I18n.t("viewSubscribers")})]})})]})}yl.propTypes={segments:h().arrayOf(h().string.isRequired),subscribersCount:h().number,initialMessage:h().string},yl.defaultProps={segments:[],subscribersCount:0,initialMessage:""},wl.propTypes={createdSubscribers:h().number,updatedSubscribers:h().number},wl.defaultProps={createdSubscribers:0,updatedSubscribers:0},_l.propTypes={createdSubscribers:h().number,updatedSubscribers:h().number},_l.defaultProps={createdSubscribers:0,updatedSubscribers:0},jl.propTypes={addedToSegmentWithWelcomeNotification:h().bool},jl.defaultProps={addedToSegmentWithWelcomeNotification:!1},Sl.propTypes={history:h().shape({push:h().func.isRequired,replace:h().func.isRequired}).isRequired,errors:h().arrayOf(h().string.isRequired),segments:h().arrayOf(h().string.isRequired),createdSubscribers:h().number,updatedSubscribers:h().number,addedToSegmentWithWelcomeNotification:h().bool},Sl.defaultProps={errors:[],segments:void 0,createdSubscribers:void 0,updatedSubscribers:void 0,addedToSegmentWithWelcomeNotification:void 0};const Il=(0,l.EN)(Sl);function Cl(e){let{history:t}=e;return(0,_.jsx)(Jo,{onProceed:()=>t.push("step_method_selection")})}const Tl=document.getElementById("import_container");function kl(){const[e,t]=(0,y.useState)(void 0),[n,r]=(0,y.useState)({}),a=(0,Te.S)(window);return(0,_.jsx)(Te.k.Provider,{value:a,children:(0,_.jsxs)(o.HashRouter,{children:[(0,_.jsx)(Le.w,{}),(0,_.jsx)(Uo,{children:(0,_.jsxs)(l.rs,{children:[(0,_.jsx)(l.AW,{path:"/step_clean_list",render:e=>(0,_.jsx)(Cl,{...e})}),(0,_.jsx)(l.AW,{path:"/step_method_selection",render:e=>(0,_.jsx)(Xo,{...e,setStepMethodSelectionData:t,subscribersLimitForValidation:100})}),(0,_.jsx)(l.AW,{path:"/step_input_validation",render:t=>(0,_.jsx)(al,{...t,stepMethodSelectionData:e})}),(0,_.jsx)(l.AW,{path:"/step_data_manipulation",render:t=>(0,_.jsx)(bl,{...t,stepMethodSelectionData:e,subscribersLimitForValidation:100,setStepDataManipulationData:r})}),(0,_.jsx)(l.AW,{path:"/step_results",render:e=>(0,_.jsx)(Il,{...e,errors:n.errors,createdSubscribers:n.created,updatedSubscribers:n.updated,segments:n.segments,addedToSegmentWithWelcomeNotification:n.added_to_segment_with_welcome_notification})}),(0,_.jsx)(l.AW,{path:"*",render:()=>(0,_.jsx)(l.l_,{to:"/step_clean_list"})})]})})]})})}Tl&&i.render((0,_.jsx)(kl,{}),Tl);var Nl=n(88525),Dl=n.n(Nl),El=n(73658);function Al(e){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(he.X,{level:1,children:x.x.I18n.t("welcomeWizardLetsStartTitle")}),(0,_.jsx)("div",{className:"mailpoet-gap"}),(0,_.jsx)("p",{children:x.x.I18n.t("welcomeWizardSenderText")}),(0,_.jsx)("div",{className:"mailpoet-gap"}),(0,_.jsxs)("form",{id:"mailpoet_sender_form",onSubmit:t=>{t.preventDefault(),p()("#mailpoet_sender_form").parsley().validate()&&e.submit_sender()},children:[(0,_.jsxs)(_t.Grid.TwoColumns,{children:[(0,_.jsxs)("label",{htmlFor:"senderName",children:[(0,_.jsx)("span",{className:"mailpoet-wizard-label",children:x.x.I18n.t("senderName")}),(0,_.jsx)(ee.I,{isFullWidth:!0,name:"senderName",type:"text",placeholder:"John Doe",value:e.sender?e.sender.name:"","data-parsley-required":!0,onChange:t=>e.update_sender({name:t.target.value})})]}),(0,_.jsxs)("label",{htmlFor:"senderAddress",children:[(0,_.jsx)("span",{className:"mailpoet-wizard-label",children:x.x.I18n.t("senderAddress")}),(0,_.jsx)(ee.I,{isFullWidth:!0,name:"senderAddress",type:"text",placeholder:"john@doe.com",value:e.sender?e.sender.address:"","data-parsley-required":!0,"data-parsley-type":"email",onChange:t=>e.update_sender({address:t.target.value})})]})]}),(0,_.jsx)("div",{className:"mailpoet-gap"}),(0,_.jsx)("div",{className:"mailpoet-gap"}),(0,_.jsx)(E.z,{isFullWidth:!0,type:"submit",withSpinner:e.loading,children:x.x.I18n.t("continue")}),(0,_.jsx)(E.z,{href:"#finish",isDisabled:e.loading,isFullWidth:!0,onClick:e.finish,variant:"tertiary",children:x.x.I18n.t("finishLater")})]})]})}p()(document).ready((()=>{let e;if(!p()("#mailpoet_subscribers_export").length)return;if(!window.exportData.segments)return;const t=Dl().compile(p()("#mailpoet_subscribers_export_template").html());function n(t){const n="mailpoet-disabled";"on"===t?e.removeClass(n):e.addClass(n)}p()("#mailpoet-export").html(t(window.exportData));const r=p()("#export_lists"),a=p()("#export_columns");function s(e){let t=`<span class="mailpoet-form-select2-text"><span>${e.name}</span></span>`;return void 0!==e.count&&(t+=`<span class="mailpoet-form-select2-count">${e.count}</span>`),t}function i(e,t){e.data("select2")&&e.html("").select2("destroy"),e.select2({data:t,width:"20em",dropdownCssClass:"mailpoet-form-select2-dropdown",escapeMarkup:e=>e,templateResult:s,templateSelection:s}).on("select2:selecting",(t=>{const n=t.params.args.data.id,r=["select","deselect"];let a;w.ZP.contains(r,n)&&(t.preventDefault(),"deselect"===n?p()(t.target).val("").trigger("change"):(a=[],w.ZP.each(e.find("option"),(e=>{const t=e.value;w.ZP.contains(r,t)||a.push(t)})),p()(t.target).val(a).trigger("change")),p()(t.target).select2("close"))})).on("change",(()=>{window.exportData.segments&&r.select2("data").length&&a.select2("data").length||!window.exportData.segments&&a.select2("data").length?n("on"):n("off")}))}e=p()("#mailpoet-export-button"),window.segments.forEach((e=>{r.append(p()("<option></option>").attr("value",e.id).text(e.name))})),window.subscriberFieldsSelect2.forEach((e=>{e.text=e.name,e.children.forEach((e=>{e.name=(0,El.r)(e.name),e.text=(0,El.r)(e.name)}))})),i(r,window.segments),i(a,window.subscriberFieldsSelect2),a.val(["email","first_name","last_name","list_status","global_status","subscribed_ip","created_at","confirmed_at","confirmed_ip"]).trigger("change"),e.on("click",(e=>{if(p()(e.target).hasClass("mailpoet-disabled"))return;x.x.Modal.loading(!0);const t=p()(':radio[name="option_format"]:checked').val();x.x.Ajax.post({api_version:x.x.apiVersion,endpoint:"ImportExport",action:"processExport",data:JSON.stringify({export_format_option:t,segments:!!window.exportData.segments&&r.val(),subscriber_fields:a.val()})}).always((()=>{x.x.Modal.loading(!1)})).done((e=>{const n=x.x.I18n.t("exportMessage").replace("%1$s",`<strong>${parseInt(e.data.totalExported,10).toLocaleString()}</strong>`).replace("[link]",`<a href="${e.data.exportFileURL}" target="_blank" >`).replace("[/link]","</a>");p()("#export_result_notice").html(`<p>${n}</p>`).show(),window.location.href=e.data.exportFileURL,x.x.trackEvent("Subscribers export completed",{"Total exported":e.data.totalExported,"File Format":t})})).fail((e=>{e.errors.length>0&&x.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}))})),Al.propTypes={finish:h().func.isRequired,loading:h().bool.isRequired,update_sender:h().func.isRequired,submit_sender:h().func.isRequired,sender:h().shape({name:h().string,address:h().string})},Al.defaultProps={sender:null};const Ol=(0,_.jsx)("svg",{width:"13",height:"11",viewBox:"0 0 13 11",children:(0,_.jsx)("path",{fill:"currentColor",d:"M9.967.638c.483-.698 1.405-.846 2.06-.33.654.515.793 1.499.31 2.197l-5.44 7.857c-.55.794-1.64.857-2.267.132l-3.4-3.928c-.552-.638-.515-1.632.083-2.22.598-.59 1.53-.55 2.082.088l2.19 2.532L9.968.638z"})}),Rl=(0,_.jsx)("svg",{width:"17",height:"16",viewBox:"0 0 17 16",children:(0,_.jsx)("path",{fill:"currentColor",d:"M12.407 3.31c.576.576.576 1.509 0 2.084L9.914 7.888l2.411 2.412c.586.585.586 1.535 0 2.121-.585.586-1.535.586-2.12 0l-2.413-2.412L5.3 12.503c-.576.575-1.509.575-2.084 0-.575-.575-.575-1.508 0-2.083l2.493-2.495-2.41-2.41c-.587-.587-.587-1.536 0-2.122.585-.586 1.535-.586 2.12 0L7.83 5.804l2.494-2.493c.575-.576 1.508-.576 2.083 0z"})});function Pl(e){let{onCheck:t,showError:n,checked:r,automationId:a,...s}=e;return(0,_.jsxs)("div",{className:d()({"mailpoet-form-yesno":!0,"mailpoet-form-yesno-error":n,"mailpoet-disabled":s.disabled}),"data-automation-id":a,children:[(0,_.jsxs)("label",{children:[(0,_.jsx)("input",{type:"radio",checked:!0===r,onChange:()=>t(!0),...s}),(0,_.jsx)("span",{className:"mailpoet-form-yesno-control mailpoet-form-yesno-yes",children:Ol})]}),(0,_.jsxs)("label",{children:[(0,_.jsx)("input",{type:"radio",checked:!1===r,onChange:()=>t(!1),...s}),(0,_.jsx)("span",{className:"mailpoet-form-yesno-control mailpoet-form-yesno-no",children:Rl})]})]})}const Ml=e=>null==e;function Ll(e){let{loading:t,submitForm:n}=e;const[r,a]=(0,y.useState)({tracking:void 0,libs3rdParty:void 0}),[s,i]=(0,y.useState)(!1);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(he.X,{level:1,children:x.x.I18n.t("welcomeWizardUsageTrackingStepTitle")}),(0,_.jsx)("div",{className:"mailpoet-gap"}),(0,_.jsxs)("form",{onSubmit:function(e){return e.preventDefault(),i(!0),Ml(r.libs3rdParty)||Ml(r.tracking)||n(r.tracking,r.libs3rdParty),!1},children:[(0,_.jsxs)("div",{className:"mailpoet-wizard-woocommerce-option",children:[(0,_.jsx)("div",{className:"mailpoet-wizard-woocommerce-toggle",children:(0,_.jsx)(Pl,{showError:s&&Ml(r.libs3rdParty),onCheck:e=>{const t={libs3rdParty:e};a((e=>({...e,...t})))},checked:r.libs3rdParty,name:"mailpoet_libs_3rdParty"})}),(0,_.jsxs)("div",{children:[(0,_.jsxs)("p",{children:[x.x.I18n.t("welcomeWizardUsageTrackingStepLibs3rdPartyLabel")," "]}),(0,_.jsxs)("div",{className:"mailpoet-wizard-note",children:[(0,_.jsx)("span",{children:x.x.I18n.t("welcomeWizardUsageTrackingStepLibs3rdPartyLabelNoteNote")}),I()(x.x.I18n.t("welcomeWizardUsageTrackingStepLibs3rdPartyLabelNote"),/\[link\](.*?)\[\/link\]/g,((e,t)=>(0,_.jsx)("a",{href:"https://kb.mailpoet.com/article/338-what-3rd-party-libraries-we-use","data-beacon-article":"5f7c7dd94cedfd0017dcece8",target:"_blank",rel:"noopener noreferrer",children:e},t)))]})]})]}),(0,_.jsx)("div",{className:"mailpoet-gap"}),(0,_.jsxs)("div",{className:"mailpoet-wizard-woocommerce-option",children:[(0,_.jsx)("div",{className:"mailpoet-wizard-woocommerce-toggle",children:(0,_.jsx)(Pl,{showError:s&&Ml(r.tracking),onCheck:e=>{const t={tracking:e};a((e=>({...e,...t})))},checked:r.tracking,name:"mailpoet_tracking"})}),(0,_.jsxs)("div",{children:[(0,_.jsxs)("p",{children:[x.x.I18n.t("welcomeWizardUsageTrackingStepTrackingLabel")," "]}),(0,_.jsxs)("div",{className:"mailpoet-wizard-note",children:[(0,_.jsx)("span",{children:x.x.I18n.t("welcomeWizardUsageTrackingStepTrackingLabelNoteNote")}),I()(x.x.I18n.t("welcomeWizardUsageTrackingStepTrackingLabelNote"),/\[link\](.*?)\[\/link\]/g,((e,t)=>(0,_.jsx)("a",{href:"https://kb.mailpoet.com/article/130-sharing-your-data-with-us","data-beacon-article":"57ce0aaac6979108399a0454",target:"_blank",rel:"noopener noreferrer",children:e},t)))]})]})]}),(0,_.jsx)("div",{className:"mailpoet-gap"}),(0,_.jsx)(E.z,{isFullWidth:!0,type:"submit",withSpinner:t,disabled:t,children:x.x.I18n.t("continue")})]})]})}function Fl(e){let{children:t}=e;return(0,_.jsx)("div",{className:"mailpoet-steps-content",children:t})}function ql(e){const[t,n]=(0,y.useState)(null),[r,a]=(0,y.useState)(!1===e.showCustomersImportSetting?"unsubscribed":null),[s,i]=(0,y.useState)(!1),o=e.isWizardStep?x.x.I18n.t("wooCommerceSetupFinishButtonTextWizard"):x.x.I18n.t("wooCommerceSetupFinishButtonTextStandalone");let l;return"subscribed"===r&&(l=!0),"unsubscribed"===r&&(l=!1),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(f.TypographyHeading,{level:1,children:x.x.I18n.t("wooCommerceSetupTitle")}),(0,_.jsx)("div",{className:"mailpoet-gap"}),(0,_.jsx)("p",{children:x.x.I18n.t("wooCommerceSetupInfo")}),(0,_.jsx)("div",{className:"mailpoet-gap"}),(0,_.jsxs)("form",{onSubmit:n=>(n.preventDefault(),i(!0),null===r||null===t||e.submitForm(r,"true"===t),!1),children:[e.showCustomersImportSetting?(0,_.jsxs)("div",{className:"mailpoet-wizard-woocommerce-option",children:[(0,_.jsx)("div",{className:"mailpoet-wizard-woocommerce-toggle",children:(0,_.jsx)(Pl,{showError:s&&null===r,checked:l,onCheck:e=>a(e?"subscribed":"unsubscribed"),name:"mailpoet_woocommerce_import_type",automationId:"woocommerce_import_type"})}),(0,_.jsxs)("div",{children:[(0,_.jsx)("p",{children:I()(x.x.I18n.t("wooCommerceSetupImportInfo"),/\[link\](.*?)\[\/link\]/,(e=>(0,_.jsx)("a",{href:"https://kb.mailpoet.com/article/284-import-old-customers-to-the-woocommerce-customers-list","data-beacon-article":"5d722c7104286364bc8ecf19",rel:"noopener noreferrer",target:"_blank",children:e},e)))}),(0,_.jsxs)("div",{className:"mailpoet-wizard-note",children:[(0,_.jsx)("span",{children:"GDPR"}),x.x.I18n.t("wooCommerceSetupImportGDPRInfo")]})]})]}):null,(0,_.jsxs)("div",{className:"mailpoet-wizard-woocommerce-option",children:[(0,_.jsx)("div",{className:"mailpoet-wizard-woocommerce-toggle",children:(0,_.jsx)(Pl,{showError:s&&null===t,checked:t,onCheck:e=>n(e),name:"mailpoet_woocommerce_tracking",automationId:"woocommerce_tracking"})}),(0,_.jsxs)("div",{children:[(0,_.jsx)("p",{children:I()(x.x.I18n.t("wooCommerceSetupTrackingInfo"),/\[link\](.*?)\[\/link\]/,(e=>(0,_.jsx)("a",{href:"https://kb.mailpoet.com/article/280-woocommerce-cookie-tracking","data-beacon-article":"5d5fa44c2c7d3a7a4d778906",rel:"noopener noreferrer",target:"_blank",children:e},e)))}),(0,_.jsxs)("div",{className:"mailpoet-wizard-note",children:[(0,_.jsx)("span",{children:"GDPR"}),x.x.I18n.t("wooCommerceSetupTrackingGDPRInfo")]})]})]}),(0,_.jsx)("div",{className:"mailpoet-gap"}),(0,_.jsx)(f.Button,{isFullWidth:!0,type:"submit",withSpinner:e.loading,disabled:e.loading,automationId:"submit_woocommerce_setup",children:o})]})]})}function $l(e){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("div",{className:"mailpoet-wizard-logo",children:(0,_.jsx)("img",{src:window.mailpoet_logo_url,width:"160",height:"50",alt:"MailPoet logo"})}),(0,_.jsx)(Bn,{illustrationUrl:e.illustrationUrl,children:e.children})]})}function Ul(e){let{isWizardStep:t=!1}=e;const[n,r]=(0,y.useState)(!1),a=e=>{r(!1),x.x.Notice.showApiErrorNotice(e,{scroll:!0})},s=()=>x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"importExport",action:"setupWooCommerceInitialImport"}).fail(a),i=()=>{window.location=window.finish_wizard_url},o=(0,_.jsx)($l,{illustrationUrl:window.wizard_woocommerce_illustration_url,children:(0,_.jsx)(ql,{loading:n,submitForm:(e,t)=>{r(!0);const n="basic"===x.x.trackingConfig.level?"basic":"partial";var o;(o={woocommerce_import_screen_displayed:1,"mailpoet_subscribe_old_woocommerce_customers.enabled":"subscribed"===e?1:0,"tracking.level":t?"full":n,"woocommerce.accept_cookie_revenue_tracking.set":1},x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"settings",action:"set",data:o}).fail(a)).then(s).then(i)},isWizardStep:t,showCustomersImportSetting:window.mailpoet_show_customers_import})});return t?o:(0,_.jsx)(Fl,{children:o})}Ll.propTypes={loading:h().bool.isRequired,submitForm:h().func.isRequired},ql.propTypes={submitForm:h().func.isRequired,loading:h().bool.isRequired,showCustomersImportSetting:h().bool.isRequired,isWizardStep:h().bool},ql.defaultProps={isWizardStep:!1},$l.propTypes={illustrationUrl:h().string.isRequired,children:h().oneOfType([h().arrayOf(h().node),h().node]).isRequired},Ul.propTypes={isWizardStep:h().bool},Ul.defaultProps={isWizardStep:!1};const Zl=e=>{let{name:t,address:n}=e;const r=n.split("@").pop().toLowerCase();return window.mailpoet_free_domains.indexOf(r)>-1?(e=>{let{name:t,address:n}=e;const r=`wordpress@${window.location.hostname.replace("www.","")}`;return{sender:{name:t,address:r},reply_to:{name:t,address:n},"signup_confirmation.from.address":r,"signup_confirmation.from.name":t,"signup_confirmation.reply_to.address":n,"signup_confirmation.reply_to.name":t}})({name:t,address:n}):(e=>{let{name:t,address:n}=e;return{sender:{name:t,address:n},reply_to:{name:t,address:n},"signup_confirmation.from.address":n,"signup_confirmation.from.name":t,"signup_confirmation.reply_to.address":n,"signup_confirmation.reply_to.name":t}})({name:t,address:n})},Vl=()=>{let e=2;return window.has_mss_key_specified||(e+=1),window.mailpoet_woocommerce_active&&(e+=1),e},Wl=(e,t,n)=>{n<Vl()?e.push(`/steps/${n+1}`):t()};var Yl=n(84113);function Bl(e){const t=Vl(),n=parseInt(e.match.params.step,10),[r,a]=(0,y.useState)(!1),[s,i]=(0,y.useState)(window.sender_data);function o(){a(!0),window.location=window.finish_wizard_url}(0,y.useEffect)((()=>{(n>t||n<1)&&e.history.push("/steps/1")}),[n,t,e.history]);const l=(0,w.r$)(Wl,e.history,o);function c(e){return a(!0),x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"settings",action:"set",data:e}).then((()=>a(!1))).fail((e=>{a(!1),e.errors.length>0&&x.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}const d=(0,y.useCallback)(((e,t)=>{a(!0),c({analytics:{enabled:e?"1":""},"3rd_party_libs":{enabled:t?"1":""}}).then((()=>l(n)))}),[l,n]),u=(0,y.useCallback)((e=>{i({...s,...e})}),[s]),p=(0,y.useCallback)((()=>{c(Zl(s)).then((()=>l(n)))}),[l,s,n]),m=(0,y.useCallback)((e=>{e.preventDefault(),a(!0),c(Zl({address:window.admin_email,name:""})).then((()=>{window.mailpoet_woocommerce_active?l(t-1):o()}))}),[l,t]),h=1===(f=n)?"WelcomeWizardSenderStep":2===f?"WelcomeWizardUsageTrackingStep":window.mailpoet_woocommerce_active&&f===Vl()?"WizardWooCommerceStep":"WelcomeWizardPitchMSSStep";var f;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(Yl.R,{count:t,current:n}),(0,_.jsxs)(Fl,{children:["WelcomeWizardSenderStep"===h?(0,_.jsx)($l,{illustrationUrl:window.wizard_sender_illustration_url,children:(0,_.jsx)(Al,{update_sender:u,submit_sender:p,finish:m,loading:r,sender:s})}):null,"WelcomeWizardUsageTrackingStep"===h?(0,_.jsx)($l,{illustrationUrl:window.wizard_tracking_illustration_url,children:(0,_.jsx)(Ll,{loading:r,submitForm:d})}):null,"WelcomeWizardPitchMSSStep"===h?(0,_.jsx)($l,{illustrationUrl:window.wizard_MSS_pitch_illustration_url,children:(0,_.jsx)(Jn,{next:()=>l(n),subscribersCount:window.mailpoet_subscribers_count,mailpoetAccountUrl:window.mailpoet_account_url,purchaseUrl:x.x.MailPoetComUrlFactory.getPurchasePlanUrl(x.x.subscribersCount,x.x.currentWpUserEmail,"business",{utm_medium:"onboarding",utm_campaign:"purchase"})})}):null,"WizardWooCommerceStep"===h?(0,_.jsx)(Ul,{isWizardStep:!0}):null]})]})}function Hl(){let e="/steps/1";window.location.search.includes("woocommerce-setup")&&(e="/woocommerce");const t=(0,Te.S)(window);return(0,_.jsx)(Te.k.Provider,{value:t,children:(0,_.jsxs)(o.HashRouter,{children:[(0,_.jsx)(Le.w,{}),(0,_.jsxs)(l.rs,{children:[(0,_.jsx)(l.AW,{path:"/steps/:step",component:Bl}),(0,_.jsx)(l.AW,{path:"/woocommerce",component:Ul}),(0,_.jsx)(l.AW,{render:()=>(0,_.jsx)(l.l_,{to:e})})]})]})})}Bl.propTypes={match:h().shape({params:h().shape({step:h().string}).isRequired}).isRequired,history:h().shape({push:h().func.isRequired}).isRequired};const zl=document.getElementById("mailpoet-wizard-container");function Gl(){const[e,t]=(0,y.useState)(null),n=(0,Te.S)(window),r=n.notices.error;function a(a){const s=a.target.name,i=a.target.checked;x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"featureFlags",action:"set",data:{[s]:i?1:0}}).done((()=>{const r=e[s];r.value=i,t({...e,[s]:r});const a=`Feature '${s}' was ${i?"enabled":"disabled"}.`;n.notices.success((0,_.jsx)("p",{children:a}))})).fail((e=>{e.errors.length>0&&r(e.errors.map((e=>(0,_.jsx)("p",{children:e.message},e.message))),{scroll:!0})}))}return(0,y.useEffect)((()=>{x.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"featureFlags",action:"getAll"}).done((e=>{const n=e.data.reduce(((e,t)=>({...e,[t.name]:t})),{});t(n)})).fail((e=>{e.errors.length>0&&r((0,_.jsx)(_.Fragment,{children:e.errors.map((e=>(0,_.jsx)("p",{children:e.message})))}),{scroll:!0})}))}),[r]),null===e?(0,_.jsx)("p",{children:"Loading experimental features..."}):0===Object.values(e).length?(0,_.jsx)("p",{children:"There are no experimental features at the moment."}):(0,_.jsx)(Te.k.Provider,{value:n,children:(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(Le.w,{}),Object.values(e).map((e=>{const t=`experimental-feature-${e.name}`;return(0,_.jsx)("div",{children:(0,_.jsxs)("label",{htmlFor:t,children:[(0,_.jsx)("input",{id:t,type:"checkbox",name:e.name,defaultChecked:e.value,onChange:a})," ",e.name]})},e.name)}))]})})}zl&&i.render((0,_.jsx)(Hl,{}),zl);const Kl=document.getElementById("experimental_features_container");Kl&&i.render((0,_.jsx)(Gl,{}),Kl);var Ql=n(54969);function Xl(e){let{message:t,editing:n}=e;return n?(0,_.jsx)("textarea",{value:t,className:"mailpoet-logs-full-message",readOnly:!0}):(0,_.jsx)(_.Fragment,{children:`${t.substr(0,150)}…`})}function Jl(e){let{log:t}=e;const[n,r]=(0,y.useState)(!1);return(0,_.jsxs)("tr",{children:[(0,_.jsx)("td",{role:"gridcell",children:t.name}),(0,_.jsx)("td",{onClick:function(e){(function(e){return(e.ctrlKey||e.metaKey)&&!e.altKey})(e)&&(n||r(!0))},role:"gridcell",children:(0,_.jsx)(Xl,{message:t.message,editing:n})}),(0,_.jsx)("td",{role:"gridcell",children:x.x.Date.full(t.created_at)})]},`log-row-${t.id}`)}function ec(e){let{logs:t,onFilter:n,originalFrom:r,originalTo:a,originalSearch:s,originalOffset:i,originalLimit:o}=e;const[l,c]=(0,y.useState)(r??void 0),[d,u]=(0,y.useState)(a??void 0),[p,m]=(0,y.useState)(i??""),[h,g]=(0,y.useState)(o??""),[v,b]=(0,y.useState)(s||""),w=(0,vt.curry)(((e,t)=>{e(null!==t?x.x.Date.format(t,{format:"Y-m-d"}):void 0)})),j=(0,y.useCallback)((()=>{const e={};l&&(e.from=l),d&&(e.to=d),p&&""!==p.trim()&&(e.offset=p),h&&""!==h.trim()&&(e.limit=h),v&&""!==v.trim()&&(e.search=v.trim()),n(e)}),[l,h,p,v,d,n]);return(0,_.jsxs)("div",{className:"mailpoet-listing mailpoet-logs",children:[(0,_.jsxs)("div",{className:"mailpoet-listing-header",children:[(0,_.jsxs)("div",{className:"mailpoet-listing-search",children:[(0,_.jsx)("label",{htmlFor:"search_input",className:"screen-reader-text",children:x.x.I18n.t("searchLabel")}),(0,_.jsx)(f.Input,{dimension:"small",iconStart:Ql.J,type:"search",id:"search_input",name:"s",onChange:e=>b(e.target.value),value:v,placeholder:x.x.I18n.t("searchLabel")})]}),(0,_.jsxs)("div",{className:"mailpoet-listing-filters",children:[`${x.x.I18n.t("from")}:`,(0,_.jsx)(kt,{dateFormat:"MMMM d, yyyy",onChange:w(c),maxDate:new Date,selected:l?(0,vs.default)(l):void 0,dimension:"small"}),`${x.x.I18n.t("to")}:`,(0,_.jsx)(kt,{dateFormat:"MMMM d, yyyy",onChange:w(u),maxDate:new Date,selected:d?(0,vs.default)(d):void 0,dimension:"small"})]}),(0,_.jsxs)("div",{className:"mailpoet-logs-limit",children:[(0,_.jsx)("label",{htmlFor:"offset_input",className:"screen-reader-text",children:x.x.I18n.t("offsetLabel")}),(0,_.jsx)(f.Input,{dimension:"small",id:"offset_input",name:"o",type:"number",onChange:e=>m(e.target.value),value:p,placeholder:x.x.I18n.t("offsetLabel")})]}),(0,_.jsxs)("div",{className:"mailpoet-logs-limit",children:[(0,_.jsx)("label",{htmlFor:"limit_input",className:"screen-reader-text",children:x.x.I18n.t("limitLabel")}),(0,_.jsx)(f.Input,{dimension:"small",id:"limit_input",name:"l",type:"number",onChange:e=>g(e.target.value),value:h,placeholder:x.x.I18n.t("limitLabel")})]}),(0,_.jsx)(f.Button,{dimension:"small",onClick:j,children:x.x.I18n.t("filter")})]}),(0,_.jsxs)("table",{className:"mailpoet-listing-table widefat striped",role:"grid",children:[(0,_.jsx)("thead",{children:(0,_.jsxs)("tr",{children:[(0,_.jsx)("th",{children:x.x.I18n.t("tableHeaderName")}),(0,_.jsx)("th",{children:x.x.I18n.t("tableHeaderMessage")}),(0,_.jsx)("th",{children:x.x.I18n.t("tableHeaderCreatedOn")})]})}),(0,_.jsx)("tbody",{children:t.map((e=>(0,_.jsx)(Jl,{log:e},`log-${e.id}`)))})]})]})}const tc=document.getElementById("mailpoet_logs_container");if(tc){const e=new URL(window.location.href);i.render((0,_.jsx)(ec,{logs:window.mailpoet_logs,originalFrom:e.searchParams.get("from"),originalTo:e.searchParams.get("to"),originalSearch:e.searchParams.get("search"),originalOffset:e.searchParams.get("offset"),originalLimit:e.searchParams.get("limit"),onFilter:t=>{e.searchParams.delete("from"),e.searchParams.delete("to"),e.searchParams.delete("search"),e.searchParams.delete("offset"),e.searchParams.delete("limit"),Object.entries(t).forEach((t=>{let[n,r]=t;e.searchParams.append(n,r)})),window.location.href=e.href}}),tc)}var nc=n(16468);function rc(e){let{onRequestClose:t}=e;const[n,r]=(0,y.useState)(!1);return p()((e=>{e(document).on("click",".notice .mailpoet-js-button-fix-this",(()=>{r(!0)}))})),(0,_.jsxs)(Te.k.Provider,{value:(0,Te.S)(window),children:[(0,_.jsx)(Le.w,{}),n&&(0,_.jsx)(nc.d,{onRequestClose:()=>{r(!1),t()}})]})}rc.defaultProps={onRequestClose:vt.noop};const ac=document.getElementById("mailpoet_set_from_address_modal");ac&&i.render((0,_.jsx)(rc,{onRequestClose:()=>{window.location.href.includes("?page=mailpoet-settings")&&window.location.reload()}}),ac);const sc=e=>(async e=>{if("MailPoet"!==x.x.mtaMethod)return!0;const t=await(async()=>"MailPoet"!==x.x.mtaMethod?[]:(await x.x.Ajax.post({api_version:x.x.apiVersion,endpoint:"mailer",action:"getVerifiedSenderDomains"})).data||[])(),n=(0,Mt.DA)(e);return-1!==t.indexOf(n)||-1!==(await(async()=>"MailPoet"!==x.x.mtaMethod?[]:(await x.x.Ajax.post({api_version:x.x.apiVersion,endpoint:"mailer",action:"getAuthorizedEmailAddresses"})).data||[])()).indexOf(e)})(e).then((e=>{if(!e)return x.x.Notice.error(x.x.I18n.t("mailerSendingNotResumedUnauthorized"),{scroll:!0}),x.x.trackEvent("Unauthorized email used",{"Unauthorized email source":"send"}),!1;x.x.Ajax.post({api_version:x.x.apiVersion,endpoint:"mailer",action:"resumeSending"}).done((()=>{x.x.Notice.success(x.x.I18n.t("mailerSendingResumedNotice"))})).fail((e=>{e.errors.length>0&&x.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}));p()((e=>{e(document).on("click",".notice .mailpoet-js-button-resume-sending",(e=>{sc(e.target.value)}))}));var ic=n(28438);const oc=e=>{const t=window.location.href.includes("?page=mailpoet-settings"),n=window.location.href.includes("?page=mailpoet-newsletters#/send");(e=>{const t=`${(0,Mt.HD)()||"some other"} page`;e&&e.type&&"email"===e.type?x.x.trackEvent("MSS in plugin authorize email",{"authorized email source":"modal","original page":t,wasSuccessful:"yes"}):e&&e.type&&"domain"===e.type&&x.x.trackEvent("MSS in plugin verify sender domain",{"verify sender domain source":"modal","original page":t,wasSuccessful:"yes"})})(e),(t||n)&&window.location.reload()};function lc(){const[e,t]=(0,y.useState)(""),[n,r]=(0,y.useState)("email");return(0,y.useEffect)((()=>{const e=e=>{var n,a,s,i;e.preventDefault();const o=String((null==e||null===(n=e.target)||void 0===n||null===(a=n.dataset)||void 0===a?void 0:a.email)||""),l=String((null==e||null===(s=e.target)||void 0===s||null===(i=s.dataset)||void 0===i?void 0:i.type)||"");r(l||"email"),t(o)};p()((t=>{t(document).on("click",".mailpoet-js-button-authorize-email-and-sender-domain",e)}))}),[]),(0,_.jsx)(_.Fragment,{children:e&&(0,_.jsx)(ic.h,{senderEmail:e,onRequestClose:()=>{t("")},onSuccessAction:oc,showSenderEmailTab:"email"===n,showSenderDomainTab:"domain"===n,initialTab:"domain"===n?"sender_domain":"sender_email"})})}const cc=document.getElementById("mailpoet_authorize_sender_email_modal");cc&&i.render((0,_.jsx)(lc,{}),cc)},87933:function(e,t){"use strict";function n(e,t){switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}}function r(e,t){switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}}var a={p:r,P:function(e,t){var a,s=e.match(/(P+)(p+)?/)||[],i=s[1],o=s[2];if(!o)return n(e,t);switch(i){case"P":a=t.dateTime({width:"short"});break;case"PP":a=t.dateTime({width:"medium"});break;case"PPP":a=t.dateTime({width:"long"});break;default:a=t.dateTime({width:"full"})}return a.replace("{{date}}",n(i,t)).replace("{{time}}",r(o,t))}};t.Z=a},78435:function(e,t,n){"use strict";function r(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}n.d(t,{Z:function(){return r}})},84327:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(78789),a=n(32275),s=n(4335),i=n(44438);function o(e){(0,i.Z)(1,arguments);var t=(0,s.Z)(e),n=new Date(0);n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0);var r=(0,a.Z)(n);return r}var l=6048e5;function c(e){(0,i.Z)(1,arguments);var t=(0,r.default)(e),n=(0,a.Z)(t).getTime()-o(t).getTime();return Math.round(n/l)+1}},4335:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(78789),a=n(44438),s=n(32275);function i(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getUTCFullYear(),i=new Date(0);i.setUTCFullYear(n+1,0,4),i.setUTCHours(0,0,0,0);var o=(0,s.Z)(i),l=new Date(0);l.setUTCFullYear(n,0,4),l.setUTCHours(0,0,0,0);var c=(0,s.Z)(l);return t.getTime()>=o.getTime()?n+1:t.getTime()>=c.getTime()?n:n-1}},27191:function(e,t,n){"use strict";n.d(t,{Z:function(){return d}});var r=n(78789),a=n(15290),s=n(40640),i=n(44438),o=n(66557);function l(e,t){(0,i.Z)(1,arguments);var n=t||{},r=n.locale,l=r&&r.options&&r.options.firstWeekContainsDate,c=null==l?1:(0,o.Z)(l),d=null==n.firstWeekContainsDate?c:(0,o.Z)(n.firstWeekContainsDate),u=(0,s.Z)(e,t),p=new Date(0);p.setUTCFullYear(u,0,d),p.setUTCHours(0,0,0,0);var m=(0,a.Z)(p,t);return m}var c=6048e5;function d(e,t){(0,i.Z)(1,arguments);var n=(0,r.default)(e),s=(0,a.Z)(n,t).getTime()-l(n,t).getTime();return Math.round(s/c)+1}},40640:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(78789),a=n(44438),s=n(15290),i=n(66557);function o(e,t){(0,a.Z)(1,arguments);var n=(0,r.default)(e),o=n.getUTCFullYear(),l=t||{},c=l.locale,d=c&&c.options&&c.options.firstWeekContainsDate,u=null==d?1:(0,i.Z)(d),p=null==l.firstWeekContainsDate?u:(0,i.Z)(l.firstWeekContainsDate);if(!(p>=1&&p<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var m=new Date(0);m.setUTCFullYear(o+1,0,p),m.setUTCHours(0,0,0,0);var h=(0,s.Z)(m,t),f=new Date(0);f.setUTCFullYear(o,0,p),f.setUTCHours(0,0,0,0);var g=(0,s.Z)(f,t);return n.getTime()>=h.getTime()?o+1:n.getTime()>=g.getTime()?o:o-1}},28135:function(e,t,n){"use strict";n.d(t,{Do:function(){return i},Iu:function(){return s},qp:function(){return o}});var r=["D","DD"],a=["YY","YYYY"];function s(e){return-1!==r.indexOf(e)}function i(e){return-1!==a.indexOf(e)}function o(e,t,n){if("YYYY"===e)throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://git.io/fxCyr"));if("YY"===e)throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://git.io/fxCyr"));if("D"===e)throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://git.io/fxCyr"));if("DD"===e)throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://git.io/fxCyr"))}},32275:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var r=n(78789),a=n(44438);function s(e){(0,a.Z)(1,arguments);var t=1,n=(0,r.default)(e),s=n.getUTCDay(),i=(s<t?7:0)+s-t;return n.setUTCDate(n.getUTCDate()-i),n.setUTCHours(0,0,0,0),n}},15290:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(78789),a=n(44438),s=n(66557);function i(e,t){(0,a.Z)(1,arguments);var n=t||{},i=n.locale,o=i&&i.options&&i.options.weekStartsOn,l=null==o?0:(0,s.Z)(o),c=null==n.weekStartsOn?l:(0,s.Z)(n.weekStartsOn);if(!(c>=0&&c<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var d=(0,r.default)(e),u=d.getUTCDay(),p=(u<c?7:0)+u-c;return d.setUTCDate(d.getUTCDate()-p),d.setUTCHours(0,0,0,0),d}},71050:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var r=n(66557),a=n(47010),s=n(44438),i=36e5;function o(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.Z)(e,n*i)}},47010:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(66557),a=n(78789),s=n(44438);function i(e,t){(0,s.Z)(2,arguments);var n=(0,a.default)(e).getTime(),i=(0,r.Z)(t);return new Date(n+i)}},94392:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(66557),a=n(47010),s=n(44438);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.Z)(e,6e4*n)}},84613:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(66557),a=n(78789),s=n(44438);function i(e,t){(0,s.Z)(2,arguments);var n=(0,a.default)(e),i=(0,r.Z)(t);if(isNaN(i))return new Date(NaN);if(!i)return n;var o=n.getDate(),l=new Date(n.getTime());l.setMonth(n.getMonth()+i+1,0);var c=l.getDate();return o>=c?l:(n.setFullYear(l.getFullYear(),l.getMonth(),o),n)}},90806:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(66557),a=n(63703),s=n(44438);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t),i=7*n;return(0,a.default)(e,i)}},31247:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(66557),a=n(84613),s=n(44438);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.default)(e,12*n)}},31213:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var r=n(78435),a=n(81793),s=n(44438),i=864e5;function o(e,t){(0,s.Z)(2,arguments);var n=(0,a.default)(e),o=(0,a.default)(t),l=n.getTime()-(0,r.Z)(n),c=o.getTime()-(0,r.Z)(o);return Math.round((l-c)/i)}},46418:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t),i=n.getFullYear()-s.getFullYear(),o=n.getMonth()-s.getMonth();return 12*i+o}},27088:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var r=n(72611),a=n(78435),s=n(44438),i=6048e5;function o(e,t,n){(0,s.Z)(2,arguments);var o=(0,r.default)(e,n),l=(0,r.default)(t,n),c=o.getTime()-(0,a.Z)(o),d=l.getTime()-(0,a.Z)(l);return Math.round((c-d)/i)}},86854:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t);return n.getFullYear()-s.getFullYear()}},68392:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e);return t.setHours(23,59,59,999),t}},48216:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}},82296:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(78789),a=n(66557),s=n(44438);function i(e,t){(0,s.Z)(1,arguments);var n=t||{},i=n.locale,o=i&&i.options&&i.options.weekStartsOn,l=null==o?0:(0,a.Z)(o),c=null==n.weekStartsOn?l:(0,a.Z)(n.weekStartsOn);if(!(c>=0&&c<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var d=(0,r.default)(e),u=d.getDay(),p=6+(u<c?-7:0)-(u-c);return d.setDate(d.getDate()+p),d.setHours(23,59,59,999),d}},95822:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return M}});var r=n(47612),a=n(60016),s=n(59719),i=n(78789),o=n(44438),l=864e5,c=n(84327),d=n(4335),u=n(27191),p=n(40640);function m(e,t){for(var n=e<0?"-":"",r=Math.abs(e).toString();r.length<t;)r="0"+r;return n+r}var h=function(e,t){var n=e.getUTCFullYear(),r=n>0?n:1-n;return m("yy"===t?r%100:r,t.length)},f=function(e,t){var n=e.getUTCMonth();return"M"===t?String(n+1):m(n+1,2)},g=function(e,t){return m(e.getUTCDate(),t.length)},x=function(e,t){return m(e.getUTCHours()%12||12,t.length)},v=function(e,t){return m(e.getUTCHours(),t.length)},b=function(e,t){return m(e.getUTCMinutes(),t.length)},y=function(e,t){return m(e.getUTCSeconds(),t.length)},w=function(e,t){var n=t.length,r=e.getUTCMilliseconds();return m(Math.floor(r*Math.pow(10,n-3)),t.length)},_={G:function(e,t,n){var r=e.getUTCFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if("yo"===t){var r=e.getUTCFullYear(),a=r>0?r:1-r;return n.ordinalNumber(a,{unit:"year"})}return h(e,t)},Y:function(e,t,n,r){var a=(0,p.Z)(e,r),s=a>0?a:1-a;return"YY"===t?m(s%100,2):"Yo"===t?n.ordinalNumber(s,{unit:"year"}):m(s,t.length)},R:function(e,t){return m((0,d.Z)(e),t.length)},u:function(e,t){return m(e.getUTCFullYear(),t.length)},Q:function(e,t,n){var r=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return m(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){var r=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return m(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){var r=e.getUTCMonth();switch(t){case"M":case"MM":return f(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){var r=e.getUTCMonth();switch(t){case"L":return String(r+1);case"LL":return m(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){var a=(0,u.Z)(e,r);return"wo"===t?n.ordinalNumber(a,{unit:"week"}):m(a,t.length)},I:function(e,t,n){var r=(0,c.Z)(e);return"Io"===t?n.ordinalNumber(r,{unit:"week"}):m(r,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getUTCDate(),{unit:"date"}):g(e,t)},D:function(e,t,n){var r=function(e){(0,o.Z)(1,arguments);var t=(0,i.default)(e),n=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var r=t.getTime(),a=n-r;return Math.floor(a/l)+1}(e);return"Do"===t?n.ordinalNumber(r,{unit:"dayOfYear"}):m(r,t.length)},E:function(e,t,n){var r=e.getUTCDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){var a=e.getUTCDay(),s=(a-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(s);case"ee":return m(s,2);case"eo":return n.ordinalNumber(s,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){var a=e.getUTCDay(),s=(a-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(s);case"cc":return m(s,t.length);case"co":return n.ordinalNumber(s,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,n){var r=e.getUTCDay(),a=0===r?7:r;switch(t){case"i":return String(a);case"ii":return m(a,t.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){var r=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(e,t,n){var r,a=e.getUTCHours();switch(r=12===a?"noon":0===a?"midnight":a/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(e,t,n){var r,a=e.getUTCHours();switch(r=a>=17?"evening":a>=12?"afternoon":a>=4?"morning":"night",t){case"B":case"BB":case"BBB":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){var r=e.getUTCHours()%12;return 0===r&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return x(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getUTCHours(),{unit:"hour"}):v(e,t)},K:function(e,t,n){var r=e.getUTCHours()%12;return"Ko"===t?n.ordinalNumber(r,{unit:"hour"}):m(r,t.length)},k:function(e,t,n){var r=e.getUTCHours();return 0===r&&(r=24),"ko"===t?n.ordinalNumber(r,{unit:"hour"}):m(r,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):b(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):y(e,t)},S:function(e,t){return w(e,t)},X:function(e,t,n,r){var a=(r._originalDate||e).getTimezoneOffset();if(0===a)return"Z";switch(t){case"X":return S(a);case"XXXX":case"XX":return I(a);default:return I(a,":")}},x:function(e,t,n,r){var a=(r._originalDate||e).getTimezoneOffset();switch(t){case"x":return S(a);case"xxxx":case"xx":return I(a);default:return I(a,":")}},O:function(e,t,n,r){var a=(r._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+j(a,":");default:return"GMT"+I(a,":")}},z:function(e,t,n,r){var a=(r._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+j(a,":");default:return"GMT"+I(a,":")}},t:function(e,t,n,r){var a=r._originalDate||e;return m(Math.floor(a.getTime()/1e3),t.length)},T:function(e,t,n,r){return m((r._originalDate||e).getTime(),t.length)}};function j(e,t){var n=e>0?"-":"+",r=Math.abs(e),a=Math.floor(r/60),s=r%60;if(0===s)return n+String(a);var i=t||"";return n+String(a)+i+m(s,2)}function S(e,t){return e%60==0?(e>0?"-":"+")+m(Math.abs(e)/60,2):I(e,t)}function I(e,t){var n=t||"",r=e>0?"-":"+",a=Math.abs(e);return r+m(Math.floor(a/60),2)+n+m(a%60,2)}var C=_,T=n(87933),k=n(78435),N=n(28135),D=n(66557),E=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,A=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,O=/^'([^]*?)'?$/,R=/''/g,P=/[a-zA-Z]/;function M(e,t,n){(0,o.Z)(2,arguments);var l=String(t),c=n||{},d=c.locale||a.Z,u=d.options&&d.options.firstWeekContainsDate,p=null==u?1:(0,D.Z)(u),m=null==c.firstWeekContainsDate?p:(0,D.Z)(c.firstWeekContainsDate);if(!(m>=1&&m<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var h=d.options&&d.options.weekStartsOn,f=null==h?0:(0,D.Z)(h),g=null==c.weekStartsOn?f:(0,D.Z)(c.weekStartsOn);if(!(g>=0&&g<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!d.localize)throw new RangeError("locale must contain localize property");if(!d.formatLong)throw new RangeError("locale must contain formatLong property");var x=(0,i.default)(e);if(!(0,r.default)(x))throw new RangeError("Invalid time value");var v=(0,k.Z)(x),b=(0,s.Z)(x,v),y={firstWeekContainsDate:m,weekStartsOn:g,locale:d,_originalDate:x},w=l.match(A).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,T.Z[t])(e,d.formatLong,y):e})).join("").match(E).map((function(n){if("''"===n)return"'";var r=n[0];if("'"===r)return L(n);var a=C[r];if(a)return!c.useAdditionalWeekYearTokens&&(0,N.Do)(n)&&(0,N.qp)(n,t,e),!c.useAdditionalDayOfYearTokens&&(0,N.Iu)(n)&&(0,N.qp)(n,t,e),a(b,n,d.localize,y);if(r.match(P))throw new RangeError("Format string contains an unescaped latin alphabet character `"+r+"`");return n})).join("");return w}function L(e){return e.match(O)[1].replace(R,"'")}},33184:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getDate();return n}},32097:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getDay();return n}},42370:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getHours();return n}},84097:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return d}});var r=n(78789),a=n(72611),s=n(44438);function i(e){return(0,s.Z)(1,arguments),(0,a.default)(e,{weekStartsOn:1})}function o(e){(0,s.Z)(1,arguments);var t=(0,r.default)(e),n=t.getFullYear(),a=new Date(0);a.setFullYear(n+1,0,4),a.setHours(0,0,0,0);var o=i(a),l=new Date(0);l.setFullYear(n,0,4),l.setHours(0,0,0,0);var c=i(l);return t.getTime()>=o.getTime()?n+1:t.getTime()>=c.getTime()?n:n-1}function l(e){(0,s.Z)(1,arguments);var t=o(e),n=new Date(0);n.setFullYear(t,0,4),n.setHours(0,0,0,0);var r=i(n);return r}var c=6048e5;function d(e){(0,s.Z)(1,arguments);var t=(0,r.default)(e),n=i(t).getTime()-l(t).getTime();return Math.round(n/c)+1}},91352:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getMinutes();return n}},66821:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getMonth();return n}},12838:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=Math.floor(t.getMonth()/3)+1;return n}},54909:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getSeconds();return n}},31359:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getTime();return n}},42384:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e){return(0,a.Z)(1,arguments),(0,r.default)(e).getFullYear()}},40538:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t);return n.getTime()>s.getTime()}},94326:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t);return n.getTime()<s.getTime()}},27930:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return a}});var r=n(44438);function a(e){return(0,r.Z)(1,arguments),e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e)}},4820:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t);return n.getTime()===s.getTime()}},72986:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(81793),a=n(44438);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t);return n.getTime()===s.getTime()}},51467:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t);return n.getFullYear()===s.getFullYear()&&n.getMonth()===s.getMonth()}},41667:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(27747),a=n(44438);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t);return n.getTime()===s.getTime()}},99114:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t);return n.getFullYear()===s.getFullYear()}},47612:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(27930),a=n(78789),s=n(44438);function i(e){if((0,s.Z)(1,arguments),!(0,r.default)(e)&&"number"!=typeof e)return!1;var t=(0,a.default)(e);return!isNaN(Number(t))}},34256:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e).getTime(),s=(0,r.default)(t.start).getTime(),i=(0,r.default)(t.end).getTime();if(!(s<=i))throw new RangeError("Invalid interval");return n>=s&&n<=i}},60016:function(e,t,n){"use strict";n.d(t,{Z:function(){return h}});var r={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function a(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth,r=e.formats[n]||e.formats[e.defaultWidth];return r}}var s={date:a({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:a({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:a({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},i={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function o(e){return function(t,n){var r,a=n||{};if("formatting"===(a.context?String(a.context):"standalone")&&e.formattingValues){var s=e.defaultFormattingWidth||e.defaultWidth,i=a.width?String(a.width):s;r=e.formattingValues[i]||e.formattingValues[s]}else{var o=e.defaultWidth,l=a.width?String(a.width):e.defaultWidth;r=e.values[l]||e.values[o]}return r[e.argumentCallback?e.argumentCallback(t):t]}}var l={ordinalNumber:function(e,t){var n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:o({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:o({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:function(e){return e-1}}),month:o({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:o({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:o({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})};function c(e){return function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.width,a=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],s=t.match(a);if(!s)return null;var i,o=s[0],l=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?u(l,(function(e){return e.test(o)})):d(l,(function(e){return e.test(o)}));i=e.valueCallback?e.valueCallback(c):c,i=n.valueCallback?n.valueCallback(i):i;var p=t.slice(o.length);return{value:i,rest:p}}}function d(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n}function u(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return n}var p,m={ordinalNumber:(p={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}},function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.match(p.matchPattern);if(!n)return null;var r=n[0],a=e.match(p.parsePattern);if(!a)return null;var s=p.valueCallback?p.valueCallback(a[0]):a[0];s=t.valueCallback?t.valueCallback(s):s;var i=e.slice(r.length);return{value:s,rest:i}}),era:c({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:c({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:c({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:c({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:c({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},h={code:"en-US",formatDistance:function(e,t,n){var a,s=r[e];return a="string"==typeof s?s:1===t?s.one:s.other.replace("{{count}}",t.toString()),null!=n&&n.addSuffix?n.comparison&&n.comparison>0?"in "+a:a+" ago":a},formatLong:s,formatRelative:function(e,t,n,r){return i[e]},localize:l,match:m,options:{weekStartsOn:0,firstWeekContainsDate:1}}},82399:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e){var t,n;if((0,a.Z)(1,arguments),e&&"function"==typeof e.forEach)t=e;else{if("object"!=typeof e||null===e)return new Date(NaN);t=Array.prototype.slice.call(e)}return t.forEach((function(e){var t=(0,r.default)(e);(void 0===n||n<t||isNaN(Number(t)))&&(n=t)})),n||new Date(NaN)}},1711:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e){var t,n;if((0,a.Z)(1,arguments),e&&"function"==typeof e.forEach)t=e;else{if("object"!=typeof e||null===e)return new Date(NaN);t=Array.prototype.slice.call(e)}return t.forEach((function(e){var t=(0,r.default)(e);(void 0===n||n>t||isNaN(t.getDate()))&&(n=t)})),n||new Date(NaN)}},84188:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return ie}});var r=n(60016),a=n(59719),s=n(78789);function i(e,t){if(null==e)throw new TypeError("assign requires that input parameter not be null or undefined");for(var n in t=t||{})Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}var o=n(87933),l=n(78435),c=n(28135),d=n(66557),u=n(40640),p=n(44438);function m(e,t,n){(0,p.Z)(2,arguments);var r=n||{},a=r.locale,i=a&&a.options&&a.options.weekStartsOn,o=null==i?0:(0,d.Z)(i),l=null==r.weekStartsOn?o:(0,d.Z)(r.weekStartsOn);if(!(l>=0&&l<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var c=(0,s.default)(e),u=(0,d.Z)(t),m=c.getUTCDay(),h=u%7,f=(h+7)%7,g=(f<l?7:0)+u-m;return c.setUTCDate(c.getUTCDate()+g),c}var h=n(84327),f=n(27191),g=n(32275),x=n(15290),v=/^(1[0-2]|0?\d)/,b=/^(3[0-1]|[0-2]?\d)/,y=/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,w=/^(5[0-3]|[0-4]?\d)/,_=/^(2[0-3]|[0-1]?\d)/,j=/^(2[0-4]|[0-1]?\d)/,S=/^(1[0-1]|0?\d)/,I=/^(1[0-2]|0?\d)/,C=/^[0-5]?\d/,T=/^[0-5]?\d/,k=/^\d/,N=/^\d{1,2}/,D=/^\d{1,3}/,E=/^\d{1,4}/,A=/^-?\d+/,O=/^-?\d/,R=/^-?\d{1,2}/,P=/^-?\d{1,3}/,M=/^-?\d{1,4}/,L=/^([+-])(\d{2})(\d{2})?|Z/,F=/^([+-])(\d{2})(\d{2})|Z/,q=/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,$=/^([+-])(\d{2}):(\d{2})|Z/,U=/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/;function Z(e,t,n){var r=t.match(e);if(!r)return null;var a=parseInt(r[0],10);return{value:n?n(a):a,rest:t.slice(r[0].length)}}function V(e,t){var n=t.match(e);return n?"Z"===n[0]?{value:0,rest:t.slice(1)}:{value:("+"===n[1]?1:-1)*(36e5*(n[2]?parseInt(n[2],10):0)+6e4*(n[3]?parseInt(n[3],10):0)+1e3*(n[5]?parseInt(n[5],10):0)),rest:t.slice(n[0].length)}:null}function W(e,t){return Z(A,e,t)}function Y(e,t,n){switch(e){case 1:return Z(k,t,n);case 2:return Z(N,t,n);case 3:return Z(D,t,n);case 4:return Z(E,t,n);default:return Z(new RegExp("^\\d{1,"+e+"}"),t,n)}}function B(e,t,n){switch(e){case 1:return Z(O,t,n);case 2:return Z(R,t,n);case 3:return Z(P,t,n);case 4:return Z(M,t,n);default:return Z(new RegExp("^-?\\d{1,"+e+"}"),t,n)}}function H(e){switch(e){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;default:return 0}}function z(e,t){var n,r=t>0,a=r?t:1-t;if(a<=50)n=e||100;else{var s=a+50;n=e+100*Math.floor(s/100)-(e>=s%100?100:0)}return r?n:1-n}var G=[31,28,31,30,31,30,31,31,30,31,30,31],K=[31,29,31,30,31,30,31,31,30,31,30,31];function Q(e){return e%400==0||e%4==0&&e%100!=0}var X={G:{priority:140,parse:function(e,t,n,r){switch(t){case"G":case"GG":case"GGG":return n.era(e,{width:"abbreviated"})||n.era(e,{width:"narrow"});case"GGGGG":return n.era(e,{width:"narrow"});default:return n.era(e,{width:"wide"})||n.era(e,{width:"abbreviated"})||n.era(e,{width:"narrow"})}},set:function(e,t,n,r){return t.era=n,e.setUTCFullYear(n,0,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["R","u","t","T"]},y:{priority:130,parse:function(e,t,n,r){var a=function(e){return{year:e,isTwoDigitYear:"yy"===t}};switch(t){case"y":return Y(4,e,a);case"yo":return n.ordinalNumber(e,{unit:"year",valueCallback:a});default:return Y(t.length,e,a)}},validate:function(e,t,n){return t.isTwoDigitYear||t.year>0},set:function(e,t,n,r){var a=e.getUTCFullYear();if(n.isTwoDigitYear){var s=z(n.year,a);return e.setUTCFullYear(s,0,1),e.setUTCHours(0,0,0,0),e}var i="era"in t&&1!==t.era?1-n.year:n.year;return e.setUTCFullYear(i,0,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","u","w","I","i","e","c","t","T"]},Y:{priority:130,parse:function(e,t,n,r){var a=function(e){return{year:e,isTwoDigitYear:"YY"===t}};switch(t){case"Y":return Y(4,e,a);case"Yo":return n.ordinalNumber(e,{unit:"year",valueCallback:a});default:return Y(t.length,e,a)}},validate:function(e,t,n){return t.isTwoDigitYear||t.year>0},set:function(e,t,n,r){var a=(0,u.Z)(e,r);if(n.isTwoDigitYear){var s=z(n.year,a);return e.setUTCFullYear(s,0,r.firstWeekContainsDate),e.setUTCHours(0,0,0,0),(0,x.Z)(e,r)}var i="era"in t&&1!==t.era?1-n.year:n.year;return e.setUTCFullYear(i,0,r.firstWeekContainsDate),e.setUTCHours(0,0,0,0),(0,x.Z)(e,r)},incompatibleTokens:["y","R","u","Q","q","M","L","I","d","D","i","t","T"]},R:{priority:130,parse:function(e,t,n,r){return B("R"===t?4:t.length,e)},set:function(e,t,n,r){var a=new Date(0);return a.setUTCFullYear(n,0,4),a.setUTCHours(0,0,0,0),(0,g.Z)(a)},incompatibleTokens:["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"]},u:{priority:130,parse:function(e,t,n,r){return B("u"===t?4:t.length,e)},set:function(e,t,n,r){return e.setUTCFullYear(n,0,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["G","y","Y","R","w","I","i","e","c","t","T"]},Q:{priority:120,parse:function(e,t,n,r){switch(t){case"Q":case"QQ":return Y(t.length,e);case"Qo":return n.ordinalNumber(e,{unit:"quarter"});case"QQQ":return n.quarter(e,{width:"abbreviated",context:"formatting"})||n.quarter(e,{width:"narrow",context:"formatting"});case"QQQQQ":return n.quarter(e,{width:"narrow",context:"formatting"});default:return n.quarter(e,{width:"wide",context:"formatting"})||n.quarter(e,{width:"abbreviated",context:"formatting"})||n.quarter(e,{width:"narrow",context:"formatting"})}},validate:function(e,t,n){return t>=1&&t<=4},set:function(e,t,n,r){return e.setUTCMonth(3*(n-1),1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"]},q:{priority:120,parse:function(e,t,n,r){switch(t){case"q":case"qq":return Y(t.length,e);case"qo":return n.ordinalNumber(e,{unit:"quarter"});case"qqq":return n.quarter(e,{width:"abbreviated",context:"standalone"})||n.quarter(e,{width:"narrow",context:"standalone"});case"qqqqq":return n.quarter(e,{width:"narrow",context:"standalone"});default:return n.quarter(e,{width:"wide",context:"standalone"})||n.quarter(e,{width:"abbreviated",context:"standalone"})||n.quarter(e,{width:"narrow",context:"standalone"})}},validate:function(e,t,n){return t>=1&&t<=4},set:function(e,t,n,r){return e.setUTCMonth(3*(n-1),1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"]},M:{priority:110,parse:function(e,t,n,r){var a=function(e){return e-1};switch(t){case"M":return Z(v,e,a);case"MM":return Y(2,e,a);case"Mo":return n.ordinalNumber(e,{unit:"month",valueCallback:a});case"MMM":return n.month(e,{width:"abbreviated",context:"formatting"})||n.month(e,{width:"narrow",context:"formatting"});case"MMMMM":return n.month(e,{width:"narrow",context:"formatting"});default:return n.month(e,{width:"wide",context:"formatting"})||n.month(e,{width:"abbreviated",context:"formatting"})||n.month(e,{width:"narrow",context:"formatting"})}},validate:function(e,t,n){return t>=0&&t<=11},set:function(e,t,n,r){return e.setUTCMonth(n,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]},L:{priority:110,parse:function(e,t,n,r){var a=function(e){return e-1};switch(t){case"L":return Z(v,e,a);case"LL":return Y(2,e,a);case"Lo":return n.ordinalNumber(e,{unit:"month",valueCallback:a});case"LLL":return n.month(e,{width:"abbreviated",context:"standalone"})||n.month(e,{width:"narrow",context:"standalone"});case"LLLLL":return n.month(e,{width:"narrow",context:"standalone"});default:return n.month(e,{width:"wide",context:"standalone"})||n.month(e,{width:"abbreviated",context:"standalone"})||n.month(e,{width:"narrow",context:"standalone"})}},validate:function(e,t,n){return t>=0&&t<=11},set:function(e,t,n,r){return e.setUTCMonth(n,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","Q","M","w","I","D","i","e","c","t","T"]},w:{priority:100,parse:function(e,t,n,r){switch(t){case"w":return Z(w,e);case"wo":return n.ordinalNumber(e,{unit:"week"});default:return Y(t.length,e)}},validate:function(e,t,n){return t>=1&&t<=53},set:function(e,t,n,r){return(0,x.Z)(function(e,t,n){(0,p.Z)(2,arguments);var r=(0,s.default)(e),a=(0,d.Z)(t),i=(0,f.Z)(r,n)-a;return r.setUTCDate(r.getUTCDate()-7*i),r}(e,n,r),r)},incompatibleTokens:["y","R","u","q","Q","M","L","I","d","D","i","t","T"]},I:{priority:100,parse:function(e,t,n,r){switch(t){case"I":return Z(w,e);case"Io":return n.ordinalNumber(e,{unit:"week"});default:return Y(t.length,e)}},validate:function(e,t,n){return t>=1&&t<=53},set:function(e,t,n,r){return(0,g.Z)(function(e,t){(0,p.Z)(2,arguments);var n=(0,s.default)(e),r=(0,d.Z)(t),a=(0,h.Z)(n)-r;return n.setUTCDate(n.getUTCDate()-7*a),n}(e,n,r),r)},incompatibleTokens:["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"]},d:{priority:90,subPriority:1,parse:function(e,t,n,r){switch(t){case"d":return Z(b,e);case"do":return n.ordinalNumber(e,{unit:"date"});default:return Y(t.length,e)}},validate:function(e,t,n){var r=Q(e.getUTCFullYear()),a=e.getUTCMonth();return r?t>=1&&t<=K[a]:t>=1&&t<=G[a]},set:function(e,t,n,r){return e.setUTCDate(n),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","Q","w","I","D","i","e","c","t","T"]},D:{priority:90,subPriority:1,parse:function(e,t,n,r){switch(t){case"D":case"DD":return Z(y,e);case"Do":return n.ordinalNumber(e,{unit:"date"});default:return Y(t.length,e)}},validate:function(e,t,n){return Q(e.getUTCFullYear())?t>=1&&t<=366:t>=1&&t<=365},set:function(e,t,n,r){return e.setUTCMonth(0,n),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"]},E:{priority:90,parse:function(e,t,n,r){switch(t){case"E":case"EE":case"EEE":return n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"EEEEE":return n.day(e,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});default:return n.day(e,{width:"wide",context:"formatting"})||n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"})}},validate:function(e,t,n){return t>=0&&t<=6},set:function(e,t,n,r){return(e=m(e,n,r)).setUTCHours(0,0,0,0),e},incompatibleTokens:["D","i","e","c","t","T"]},e:{priority:90,parse:function(e,t,n,r){var a=function(e){var t=7*Math.floor((e-1)/7);return(e+r.weekStartsOn+6)%7+t};switch(t){case"e":case"ee":return Y(t.length,e,a);case"eo":return n.ordinalNumber(e,{unit:"day",valueCallback:a});case"eee":return n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"eeeee":return n.day(e,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});default:return n.day(e,{width:"wide",context:"formatting"})||n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"})}},validate:function(e,t,n){return t>=0&&t<=6},set:function(e,t,n,r){return(e=m(e,n,r)).setUTCHours(0,0,0,0),e},incompatibleTokens:["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"]},c:{priority:90,parse:function(e,t,n,r){var a=function(e){var t=7*Math.floor((e-1)/7);return(e+r.weekStartsOn+6)%7+t};switch(t){case"c":case"cc":return Y(t.length,e,a);case"co":return n.ordinalNumber(e,{unit:"day",valueCallback:a});case"ccc":return n.day(e,{width:"abbreviated",context:"standalone"})||n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"});case"ccccc":return n.day(e,{width:"narrow",context:"standalone"});case"cccccc":return n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"});default:return n.day(e,{width:"wide",context:"standalone"})||n.day(e,{width:"abbreviated",context:"standalone"})||n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"})}},validate:function(e,t,n){return t>=0&&t<=6},set:function(e,t,n,r){return(e=m(e,n,r)).setUTCHours(0,0,0,0),e},incompatibleTokens:["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"]},i:{priority:90,parse:function(e,t,n,r){var a=function(e){return 0===e?7:e};switch(t){case"i":case"ii":return Y(t.length,e);case"io":return n.ordinalNumber(e,{unit:"day"});case"iii":return n.day(e,{width:"abbreviated",context:"formatting",valueCallback:a})||n.day(e,{width:"short",context:"formatting",valueCallback:a})||n.day(e,{width:"narrow",context:"formatting",valueCallback:a});case"iiiii":return n.day(e,{width:"narrow",context:"formatting",valueCallback:a});case"iiiiii":return n.day(e,{width:"short",context:"formatting",valueCallback:a})||n.day(e,{width:"narrow",context:"formatting",valueCallback:a});default:return n.day(e,{width:"wide",context:"formatting",valueCallback:a})||n.day(e,{width:"abbreviated",context:"formatting",valueCallback:a})||n.day(e,{width:"short",context:"formatting",valueCallback:a})||n.day(e,{width:"narrow",context:"formatting",valueCallback:a})}},validate:function(e,t,n){return t>=1&&t<=7},set:function(e,t,n,r){return e=function(e,t){(0,p.Z)(2,arguments);var n=(0,d.Z)(t);n%7==0&&(n-=7);var r=1,a=(0,s.default)(e),i=a.getUTCDay(),o=((n%7+7)%7<r?7:0)+n-i;return a.setUTCDate(a.getUTCDate()+o),a}(e,n,r),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"]},a:{priority:80,parse:function(e,t,n,r){switch(t){case"a":case"aa":case"aaa":return n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaaa":return n.dayPeriod(e,{width:"narrow",context:"formatting"});default:return n.dayPeriod(e,{width:"wide",context:"formatting"})||n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"})}},set:function(e,t,n,r){return e.setUTCHours(H(n),0,0,0),e},incompatibleTokens:["b","B","H","k","t","T"]},b:{priority:80,parse:function(e,t,n,r){switch(t){case"b":case"bb":case"bbb":return n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbbb":return n.dayPeriod(e,{width:"narrow",context:"formatting"});default:return n.dayPeriod(e,{width:"wide",context:"formatting"})||n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"})}},set:function(e,t,n,r){return e.setUTCHours(H(n),0,0,0),e},incompatibleTokens:["a","B","H","k","t","T"]},B:{priority:80,parse:function(e,t,n,r){switch(t){case"B":case"BB":case"BBB":return n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBBB":return n.dayPeriod(e,{width:"narrow",context:"formatting"});default:return n.dayPeriod(e,{width:"wide",context:"formatting"})||n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"})}},set:function(e,t,n,r){return e.setUTCHours(H(n),0,0,0),e},incompatibleTokens:["a","b","t","T"]},h:{priority:70,parse:function(e,t,n,r){switch(t){case"h":return Z(I,e);case"ho":return n.ordinalNumber(e,{unit:"hour"});default:return Y(t.length,e)}},validate:function(e,t,n){return t>=1&&t<=12},set:function(e,t,n,r){var a=e.getUTCHours()>=12;return a&&n<12?e.setUTCHours(n+12,0,0,0):a||12!==n?e.setUTCHours(n,0,0,0):e.setUTCHours(0,0,0,0),e},incompatibleTokens:["H","K","k","t","T"]},H:{priority:70,parse:function(e,t,n,r){switch(t){case"H":return Z(_,e);case"Ho":return n.ordinalNumber(e,{unit:"hour"});default:return Y(t.length,e)}},validate:function(e,t,n){return t>=0&&t<=23},set:function(e,t,n,r){return e.setUTCHours(n,0,0,0),e},incompatibleTokens:["a","b","h","K","k","t","T"]},K:{priority:70,parse:function(e,t,n,r){switch(t){case"K":return Z(S,e);case"Ko":return n.ordinalNumber(e,{unit:"hour"});default:return Y(t.length,e)}},validate:function(e,t,n){return t>=0&&t<=11},set:function(e,t,n,r){return e.getUTCHours()>=12&&n<12?e.setUTCHours(n+12,0,0,0):e.setUTCHours(n,0,0,0),e},incompatibleTokens:["h","H","k","t","T"]},k:{priority:70,parse:function(e,t,n,r){switch(t){case"k":return Z(j,e);case"ko":return n.ordinalNumber(e,{unit:"hour"});default:return Y(t.length,e)}},validate:function(e,t,n){return t>=1&&t<=24},set:function(e,t,n,r){var a=n<=24?n%24:n;return e.setUTCHours(a,0,0,0),e},incompatibleTokens:["a","b","h","H","K","t","T"]},m:{priority:60,parse:function(e,t,n,r){switch(t){case"m":return Z(C,e);case"mo":return n.ordinalNumber(e,{unit:"minute"});default:return Y(t.length,e)}},validate:function(e,t,n){return t>=0&&t<=59},set:function(e,t,n,r){return e.setUTCMinutes(n,0,0),e},incompatibleTokens:["t","T"]},s:{priority:50,parse:function(e,t,n,r){switch(t){case"s":return Z(T,e);case"so":return n.ordinalNumber(e,{unit:"second"});default:return Y(t.length,e)}},validate:function(e,t,n){return t>=0&&t<=59},set:function(e,t,n,r){return e.setUTCSeconds(n,0),e},incompatibleTokens:["t","T"]},S:{priority:30,parse:function(e,t,n,r){return Y(t.length,e,(function(e){return Math.floor(e*Math.pow(10,3-t.length))}))},set:function(e,t,n,r){return e.setUTCMilliseconds(n),e},incompatibleTokens:["t","T"]},X:{priority:10,parse:function(e,t,n,r){switch(t){case"X":return V(L,e);case"XX":return V(F,e);case"XXXX":return V(q,e);case"XXXXX":return V(U,e);default:return V($,e)}},set:function(e,t,n,r){return t.timestampIsSet?e:new Date(e.getTime()-n)},incompatibleTokens:["t","T","x"]},x:{priority:10,parse:function(e,t,n,r){switch(t){case"x":return V(L,e);case"xx":return V(F,e);case"xxxx":return V(q,e);case"xxxxx":return V(U,e);default:return V($,e)}},set:function(e,t,n,r){return t.timestampIsSet?e:new Date(e.getTime()-n)},incompatibleTokens:["t","T","X"]},t:{priority:40,parse:function(e,t,n,r){return W(e)},set:function(e,t,n,r){return[new Date(1e3*n),{timestampIsSet:!0}]},incompatibleTokens:"*"},T:{priority:20,parse:function(e,t,n,r){return W(e)},set:function(e,t,n,r){return[new Date(n),{timestampIsSet:!0}]},incompatibleTokens:"*"}},J=X,ee=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,te=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,ne=/^'([^]*?)'?$/,re=/''/g,ae=/\S/,se=/[a-zA-Z]/;function ie(e,t,n,u){(0,p.Z)(3,arguments);var m=String(e),h=String(t),f=u||{},g=f.locale||r.Z;if(!g.match)throw new RangeError("locale must contain match property");var x=g.options&&g.options.firstWeekContainsDate,v=null==x?1:(0,d.Z)(x),b=null==f.firstWeekContainsDate?v:(0,d.Z)(f.firstWeekContainsDate);if(!(b>=1&&b<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var y=g.options&&g.options.weekStartsOn,w=null==y?0:(0,d.Z)(y),_=null==f.weekStartsOn?w:(0,d.Z)(f.weekStartsOn);if(!(_>=0&&_<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(""===h)return""===m?(0,s.default)(n):new Date(NaN);var j,S={firstWeekContainsDate:b,weekStartsOn:_,locale:g},I=[{priority:10,subPriority:-1,set:oe,index:0}],C=h.match(te).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,o.Z[t])(e,g.formatLong,S):e})).join("").match(ee),T=[];for(j=0;j<C.length;j++){var k=C[j];!f.useAdditionalWeekYearTokens&&(0,c.Do)(k)&&(0,c.qp)(k,h,e),!f.useAdditionalDayOfYearTokens&&(0,c.Iu)(k)&&(0,c.qp)(k,h,e);var N=k[0],D=J[N];if(D){var E=D.incompatibleTokens;if(Array.isArray(E)){for(var A=void 0,O=0;O<T.length;O++){var R=T[O].token;if(-1!==E.indexOf(R)||R===N){A=T[O];break}}if(A)throw new RangeError("The format string mustn't contain `".concat(A.fullToken,"` and `").concat(k,"` at the same time"))}else if("*"===D.incompatibleTokens&&T.length)throw new RangeError("The format string mustn't contain `".concat(k,"` and any other token at the same time"));T.push({token:N,fullToken:k});var P=D.parse(m,k,g.match,S);if(!P)return new Date(NaN);I.push({priority:D.priority,subPriority:D.subPriority||0,set:D.set,validate:D.validate,value:P.value,index:I.length}),m=P.rest}else{if(N.match(se))throw new RangeError("Format string contains an unescaped latin alphabet character `"+N+"`");if("''"===k?k="'":"'"===N&&(k=le(k)),0!==m.indexOf(k))return new Date(NaN);m=m.slice(k.length)}}if(m.length>0&&ae.test(m))return new Date(NaN);var M=I.map((function(e){return e.priority})).sort((function(e,t){return t-e})).filter((function(e,t,n){return n.indexOf(e)===t})).map((function(e){return I.filter((function(t){return t.priority===e})).sort((function(e,t){return t.subPriority-e.subPriority}))})).map((function(e){return e[0]})),L=(0,s.default)(n);if(isNaN(L))return new Date(NaN);var F=(0,a.Z)(L,(0,l.Z)(L)),q={};for(j=0;j<M.length;j++){var $=M[j];if($.validate&&!$.validate(F,$.value,S))return new Date(NaN);var U=$.set(F,q,$.value,S);U[0]?(F=U[0],i(q,U[1])):F=U}return F}function oe(e,t){if(t.timestampIsSet)return e;var n=new Date(0);return n.setFullYear(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()),n.setHours(e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()),n}function le(e){return e.match(ne)[1].replace(re,"'")}},30091:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(61600),a=n(44438),s=n(66557);function i(e,t){(0,a.Z)(1,arguments);var n=t||{},r=null==n.additionalDigits?2:(0,s.Z)(n.additionalDigits);if(2!==r&&1!==r&&0!==r)throw new RangeError("additionalDigits must be 0, 1 or 2");if("string"!=typeof e&&"[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);var i,o=u(e);if(o.date){var l=p(o.date,r);i=m(l.restDateString,l.year)}if(!i||isNaN(i.getTime()))return new Date(NaN);var c,d=i.getTime(),h=0;if(o.time&&(h=f(o.time),isNaN(h)))return new Date(NaN);if(!o.timezone){var g=new Date(d+h),v=new Date(0);return v.setFullYear(g.getUTCFullYear(),g.getUTCMonth(),g.getUTCDate()),v.setHours(g.getUTCHours(),g.getUTCMinutes(),g.getUTCSeconds(),g.getUTCMilliseconds()),v}return c=x(o.timezone),isNaN(c)?new Date(NaN):new Date(d+h+c)}var o={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},l=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,c=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,d=/^([+-])(\d{2})(?::?(\d{2}))?$/;function u(e){var t,n={},r=e.split(o.dateTimeDelimiter);if(r.length>2)return n;if(/:/.test(r[0])?t=r[0]:(n.date=r[0],t=r[1],o.timeZoneDelimiter.test(n.date)&&(n.date=e.split(o.timeZoneDelimiter)[0],t=e.substr(n.date.length,e.length))),t){var a=o.timezone.exec(t);a?(n.time=t.replace(a[1],""),n.timezone=a[1]):n.time=t}return n}function p(e,t){var n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),r=e.match(n);if(!r)return{year:NaN,restDateString:""};var a=r[1]?parseInt(r[1]):null,s=r[2]?parseInt(r[2]):null;return{year:null===s?a:100*s,restDateString:e.slice((r[1]||r[2]).length)}}function m(e,t){if(null===t)return new Date(NaN);var n=e.match(l);if(!n)return new Date(NaN);var r=!!n[4],a=h(n[1]),s=h(n[2])-1,i=h(n[3]),o=h(n[4]),c=h(n[5])-1;if(r)return function(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}(0,o,c)?function(e,t,n){var r=new Date(0);r.setUTCFullYear(e,0,4);var a=7*(t-1)+n+1-(r.getUTCDay()||7);return r.setUTCDate(r.getUTCDate()+a),r}(t,o,c):new Date(NaN);var d=new Date(0);return function(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(v[t]||(b(e)?29:28))}(t,s,i)&&function(e,t){return t>=1&&t<=(b(e)?366:365)}(t,a)?(d.setUTCFullYear(t,s,Math.max(a,i)),d):new Date(NaN)}function h(e){return e?parseInt(e):1}function f(e){var t=e.match(c);if(!t)return NaN;var n=g(t[1]),a=g(t[2]),s=g(t[3]);return function(e,t,n){return 24===e?0===t&&0===n:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}(n,a,s)?n*r.vh+a*r.yJ+1e3*s:NaN}function g(e){return e&&parseFloat(e.replace(",","."))||0}function x(e){if("Z"===e)return 0;var t=e.match(d);if(!t)return 0;var n="+"===t[1]?-1:1,a=parseInt(t[2]),s=t[3]&&parseInt(t[3])||0;return function(e,t){return t>=0&&t<=59}(0,s)?n*(a*r.vh+s*r.yJ):NaN}var v=[31,null,31,30,31,30,31,31,30,31,30,31];function b(e){return e%400==0||e%4==0&&e%100!=0}},47067:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(66557),a=n(78789),s=n(44438);function i(e,t){(0,s.Z)(2,arguments);var n=(0,a.default)(e),i=(0,r.Z)(t);return n.setHours(i),n}},6257:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(66557),a=n(78789),s=n(44438);function i(e,t){(0,s.Z)(2,arguments);var n=(0,a.default)(e),i=(0,r.Z)(t);return n.setMinutes(i),n}},28208:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var r=n(66557),a=n(78789),s=n(44438);function i(e){(0,s.Z)(1,arguments);var t=(0,a.default)(e),n=t.getFullYear(),r=t.getMonth(),i=new Date(0);return i.setFullYear(n,r+1,0),i.setHours(0,0,0,0),i.getDate()}function o(e,t){(0,s.Z)(2,arguments);var n=(0,a.default)(e),o=(0,r.Z)(t),l=n.getFullYear(),c=n.getDate(),d=new Date(0);d.setFullYear(l,o,15),d.setHours(0,0,0,0);var u=i(d);return n.setMonth(o,Math.min(c,u)),n}},5042:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var r=n(66557),a=n(78789),s=n(28208),i=n(44438);function o(e,t){(0,i.Z)(2,arguments);var n=(0,a.default)(e),o=(0,r.Z)(t),l=Math.floor(n.getMonth()/3)+1,c=o-l;return(0,s.default)(n,n.getMonth()+3*c)}},14603:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(66557),a=n(78789),s=n(44438);function i(e,t){(0,s.Z)(2,arguments);var n=(0,a.default)(e),i=(0,r.Z)(t);return n.setSeconds(i),n}},57006:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(66557),a=n(78789),s=n(44438);function i(e,t){(0,s.Z)(2,arguments);var n=(0,a.default)(e),i=(0,r.Z)(t);return isNaN(n.getTime())?new Date(NaN):(n.setFullYear(i),n)}},81793:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e);return t.setHours(0,0,0,0),t}},13167:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e);return t.setDate(1),t.setHours(0,0,0,0),t}},27747:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getMonth(),s=n-n%3;return t.setMonth(s,1),t.setHours(0,0,0,0),t}},72611:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(78789),a=n(66557),s=n(44438);function i(e,t){(0,s.Z)(1,arguments);var n=t||{},i=n.locale,o=i&&i.options&&i.options.weekStartsOn,l=null==o?0:(0,a.Z)(o),c=null==n.weekStartsOn?l:(0,a.Z)(n.weekStartsOn);if(!(c>=0&&c<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var d=(0,r.default)(e),u=d.getDay(),p=(u<c?7:0)+u-c;return d.setDate(d.getDate()-p),d.setHours(0,0,0,0),d}},19752:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(78789),a=n(44438);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=new Date(0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}},22836:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(66557),a=n(63703),s=n(44438);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.default)(e,-n)}},76508:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(66557),a=n(71050),s=n(44438);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.default)(e,-n)}},59719:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(66557),a=n(47010),s=n(44438);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.Z)(e,-n)}},79605:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(66557),a=n(94392),s=n(44438);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.default)(e,-n)}},76136:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(66557),a=n(84613),s=n(44438);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.default)(e,-n)}},83538:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(66557),a=n(90806),s=n(44438);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.default)(e,-n)}},35865:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(66557),a=n(31247),s=n(44438);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.default)(e,-n)}},29514:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(t,n){var r,a=n||{};if("formatting"===(a.context?String(a.context):"standalone")&&e.formattingValues){var s=e.defaultFormattingWidth||e.defaultWidth,i=a.width?String(a.width):s;r=e.formattingValues[i]||e.formattingValues[s]}else{var o=e.defaultWidth,l=a.width?String(a.width):e.defaultWidth;r=e.values[l]||e.values[o]}return r[e.argumentCallback?e.argumentCallback(t):t]}},e.exports=t.default},71906:function(e,t){var n,r;n=function e(){"use strict";var t="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==t?t:{},n=!t.document&&!!t.postMessage,r=n&&/blob:/i.test((t.location||{}).protocol),a={},s=0,i={parse:function(n,r){var o=(r=r||{}).dynamicTyping||!1;if(w(o)&&(r.dynamicTypingFunction=o,o={}),r.dynamicTyping=o,r.transform=!!w(r.transform)&&r.transform,r.worker&&i.WORKERS_SUPPORTED){var l=function(){if(!i.WORKERS_SUPPORTED)return!1;var n,r,o=(n=t.URL||t.webkitURL||null,r=e.toString(),i.BLOB_URL||(i.BLOB_URL=n.createObjectURL(new Blob(["(",r,")();"],{type:"text/javascript"})))),l=new t.Worker(o);return l.onmessage=g,l.id=s++,a[l.id]=l}();return l.userStep=r.step,l.userChunk=r.chunk,l.userComplete=r.complete,l.userError=r.error,r.step=w(r.step),r.chunk=w(r.chunk),r.complete=w(r.complete),r.error=w(r.error),delete r.worker,void l.postMessage({input:n,config:r,workerId:l.id})}var m=null;return i.NODE_STREAM_INPUT,"string"==typeof n?m=r.download?new c(r):new u(r):!0===n.readable&&w(n.read)&&w(n.on)?m=new p(r):(t.File&&n instanceof File||n instanceof Object)&&(m=new d(r)),m.stream(n)},unparse:function(e,t){var n=!1,r=!0,a=",",s="\r\n",o='"',l=o+o,c=!1,d=null,u=!1;!function(){if("object"==typeof t){if("string"!=typeof t.delimiter||i.BAD_DELIMITERS.filter((function(e){return-1!==t.delimiter.indexOf(e)})).length||(a=t.delimiter),("boolean"==typeof t.quotes||"function"==typeof t.quotes||Array.isArray(t.quotes))&&(n=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(c=t.skipEmptyLines),"string"==typeof t.newline&&(s=t.newline),"string"==typeof t.quoteChar&&(o=t.quoteChar),"boolean"==typeof t.header&&(r=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw new Error("Option columns is empty");d=t.columns}void 0!==t.escapeChar&&(l=t.escapeChar+o),("boolean"==typeof t.escapeFormulae||t.escapeFormulae instanceof RegExp)&&(u=t.escapeFormulae instanceof RegExp?t.escapeFormulae:/^[=+\-@\t\r].*$/)}}();var p=new RegExp(h(o),"g");if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return m(null,e,c);if("object"==typeof e[0])return m(d||Object.keys(e[0]),e,c)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||d),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),m(e.fields||[],e.data||[],c);throw new Error("Unable to serialize unrecognized input");function m(e,t,n){var i="";"string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t));var o=Array.isArray(e)&&0<e.length,l=!Array.isArray(t[0]);if(o&&r){for(var c=0;c<e.length;c++)0<c&&(i+=a),i+=f(e[c],c);0<t.length&&(i+=s)}for(var d=0;d<t.length;d++){var u=o?e.length:t[d].length,p=!1,m=o?0===Object.keys(t[d]).length:0===t[d].length;if(n&&!o&&(p="greedy"===n?""===t[d].join("").trim():1===t[d].length&&0===t[d][0].length),"greedy"===n&&o){for(var h=[],g=0;g<u;g++){var x=l?e[g]:g;h.push(t[d][x])}p=""===h.join("").trim()}if(!p){for(var v=0;v<u;v++){0<v&&!m&&(i+=a);var b=o&&l?e[v]:v;i+=f(t[d][b],v)}d<t.length-1&&(!n||0<u&&!m)&&(i+=s)}}return i}function f(e,t){if(null==e)return"";if(e.constructor===Date)return JSON.stringify(e).slice(1,25);var r=!1;u&&"string"==typeof e&&u.test(e)&&(e="'"+e,r=!0);var s=e.toString().replace(p,l);return(r=r||!0===n||"function"==typeof n&&n(e,t)||Array.isArray(n)&&n[t]||function(e,t){for(var n=0;n<t.length;n++)if(-1<e.indexOf(t[n]))return!0;return!1}(s,i.BAD_DELIMITERS)||-1<s.indexOf(a)||" "===s.charAt(0)||" "===s.charAt(s.length-1))?o+s+o:s}}};if(i.RECORD_SEP=String.fromCharCode(30),i.UNIT_SEP=String.fromCharCode(31),i.BYTE_ORDER_MARK="\ufeff",i.BAD_DELIMITERS=["\r","\n",'"',i.BYTE_ORDER_MARK],i.WORKERS_SUPPORTED=!n&&!!t.Worker,i.NODE_STREAM_INPUT=1,i.LocalChunkSize=10485760,i.RemoteChunkSize=5242880,i.DefaultDelimiter=",",i.Parser=f,i.ParserHandle=m,i.NetworkStreamer=c,i.FileStreamer=d,i.StringStreamer=u,i.ReadableStreamStreamer=p,t.jQuery){var o=t.jQuery;o.fn.parse=function(e){var n=e.config||{},r=[];return this.each((function(e){if("INPUT"!==o(this).prop("tagName").toUpperCase()||"file"!==o(this).attr("type").toLowerCase()||!t.FileReader||!this.files||0===this.files.length)return!0;for(var a=0;a<this.files.length;a++)r.push({file:this.files[a],inputElem:this,instanceConfig:o.extend({},n)})})),a(),this;function a(){if(0!==r.length){var t,n,a,l=r[0];if(w(e.before)){var c=e.before(l.file,l.inputElem);if("object"==typeof c){if("abort"===c.action)return"AbortError",t=l.file,n=l.inputElem,a=c.reason,void(w(e.error)&&e.error({name:"AbortError"},t,n,a));if("skip"===c.action)return void s();"object"==typeof c.config&&(l.instanceConfig=o.extend(l.instanceConfig,c.config))}else if("skip"===c)return void s()}var d=l.instanceConfig.complete;l.instanceConfig.complete=function(e){w(d)&&d(e,l.file,l.inputElem),s()},i.parse(l.file,l.instanceConfig)}else w(e.complete)&&e.complete()}function s(){r.splice(0,1),a()}}}function l(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},function(e){var t=b(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new m(t),(this._handle.streamer=this)._config=t}.call(this,e),this.parseChunk=function(e,n){if(this.isFirstChunk&&w(this._config.beforeFirstChunk)){var a=this._config.beforeFirstChunk(e);void 0!==a&&(e=a)}this.isFirstChunk=!1,this._halted=!1;var s=this._partialLine+e;this._partialLine="";var o=this._handle.parse(s,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var l=o.meta.cursor;this._finished||(this._partialLine=s.substring(l-this._baseIndex),this._baseIndex=l),o&&o.data&&(this._rowCount+=o.data.length);var c=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(r)t.postMessage({results:o,workerId:i.WORKER_ID,finished:c});else if(w(this._config.chunk)&&!n){if(this._config.chunk(o,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);o=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(o.data),this._completeResults.errors=this._completeResults.errors.concat(o.errors),this._completeResults.meta=o.meta),this._completed||!c||!w(this._config.complete)||o&&o.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),c||o&&o.meta.paused||this._nextChunk(),o}this._halted=!0},this._sendError=function(e){w(this._config.error)?this._config.error(e):r&&this._config.error&&t.postMessage({workerId:i.WORKER_ID,error:e,finished:!1})}}function c(e){var t;(e=e||{}).chunkSize||(e.chunkSize=i.RemoteChunkSize),l.call(this,e),this._nextChunk=n?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),n||(t.onload=y(this._chunkLoaded,this),t.onerror=y(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!n),this._config.downloadRequestHeaders){var e=this._config.downloadRequestHeaders;for(var r in e)t.setRequestHeader(r,e[r])}if(this._config.chunkSize){var a=this._start+this._config.chunkSize-1;t.setRequestHeader("Range","bytes="+this._start+"-"+a)}try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}n&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:t.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(e){var t=e.getResponseHeader("Content-Range");return null===t?-1:parseInt(t.substring(t.lastIndexOf("/")+1))}(t),this.parseChunk(t.responseText)))},this._chunkError=function(e){var n=t.statusText||e;this._sendError(new Error(n))}}function d(e){var t,n;(e=e||{}).chunkSize||(e.chunkSize=i.LocalChunkSize),l.call(this,e);var r="undefined"!=typeof FileReader;this.stream=function(e){this._input=e,n=e.slice||e.webkitSlice||e.mozSlice,r?((t=new FileReader).onload=y(this._chunkLoaded,this),t.onerror=y(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var e=this._input;if(this._config.chunkSize){var a=Math.min(this._start+this._config.chunkSize,this._input.size);e=n.call(e,this._start,a)}var s=t.readAsText(e,this._config.encoding);r||this._chunkLoaded({target:{result:s}})},this._chunkLoaded=function(e){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function u(e){var t;l.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var e,n=this._config.chunkSize;return n?(e=t.substring(0,n),t=t.substring(n)):(e=t,t=""),this._finished=!t,this.parseChunk(e)}}}function p(e){l.call(this,e=e||{});var t=[],n=!0,r=!1;this.pause=function(){l.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){l.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){r&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):n=!0},this._streamData=y((function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),n&&(n=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}}),this),this._streamError=y((function(e){this._streamCleanUp(),this._sendError(e)}),this),this._streamEnd=y((function(){this._streamCleanUp(),r=!0,this._streamData("")}),this),this._streamCleanUp=y((function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)}),this)}function m(e){var t,n,r,a=Math.pow(2,53),s=-a,o=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,l=/^(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))$/,c=this,d=0,u=0,p=!1,m=!1,g=[],x={data:[],errors:[],meta:{}};if(w(e.step)){var v=e.step;e.step=function(t){if(x=t,j())_();else{if(_(),0===x.data.length)return;d+=t.data.length,e.preview&&d>e.preview?n.abort():(x.data=x.data[0],v(x,c))}}}function y(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function _(){return x&&r&&(I("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+i.DefaultDelimiter+"'"),r=!1),e.skipEmptyLines&&(x.data=x.data.filter((function(e){return!y(e)}))),j()&&function(){if(x)if(Array.isArray(x.data[0])){for(var t=0;j()&&t<x.data.length;t++)x.data[t].forEach(n);x.data.splice(0,1)}else x.data.forEach(n);function n(t,n){w(e.transformHeader)&&(t=e.transformHeader(t,n)),g.push(t)}}(),function(){if(!x||!e.header&&!e.dynamicTyping&&!e.transform)return x;function t(t,n){var r,a=e.header?{}:[];for(r=0;r<t.length;r++){var s=r,i=t[r];e.header&&(s=r>=g.length?"__parsed_extra":g[r]),e.transform&&(i=e.transform(i,s)),i=S(s,i),"__parsed_extra"===s?(a[s]=a[s]||[],a[s].push(i)):a[s]=i}return e.header&&(r>g.length?I("FieldMismatch","TooManyFields","Too many fields: expected "+g.length+" fields but parsed "+r,u+n):r<g.length&&I("FieldMismatch","TooFewFields","Too few fields: expected "+g.length+" fields but parsed "+r,u+n)),a}var n=1;return!x.data.length||Array.isArray(x.data[0])?(x.data=x.data.map(t),n=x.data.length):x.data=t(x.data,0),e.header&&x.meta&&(x.meta.fields=g),u+=n,x}()}function j(){return e.header&&0===g.length}function S(t,n){return r=t,e.dynamicTypingFunction&&void 0===e.dynamicTyping[r]&&(e.dynamicTyping[r]=e.dynamicTypingFunction(r)),!0===(e.dynamicTyping[r]||e.dynamicTyping)?"true"===n||"TRUE"===n||"false"!==n&&"FALSE"!==n&&(function(e){if(o.test(e)){var t=parseFloat(e);if(s<t&&t<a)return!0}return!1}(n)?parseFloat(n):l.test(n)?new Date(n):""===n?null:n):n;var r}function I(e,t,n,r){var a={type:e,code:t,message:n};void 0!==r&&(a.row=r),x.errors.push(a)}this.parse=function(a,s,o){var l=e.quoteChar||'"';if(e.newline||(e.newline=function(e,t){e=e.substring(0,1048576);var n=new RegExp(h(t)+"([^]*?)"+h(t),"gm"),r=(e=e.replace(n,"")).split("\r"),a=e.split("\n"),s=1<a.length&&a[0].length<r[0].length;if(1===r.length||s)return"\n";for(var i=0,o=0;o<r.length;o++)"\n"===r[o][0]&&i++;return i>=r.length/2?"\r\n":"\r"}(a,l)),r=!1,e.delimiter)w(e.delimiter)&&(e.delimiter=e.delimiter(a),x.meta.delimiter=e.delimiter);else{var c=function(t,n,r,a,s){var o,l,c,d;s=s||[",","\t","|",";",i.RECORD_SEP,i.UNIT_SEP];for(var u=0;u<s.length;u++){var p=s[u],m=0,h=0,g=0;c=void 0;for(var x=new f({comments:a,delimiter:p,newline:n,preview:10}).parse(t),v=0;v<x.data.length;v++)if(r&&y(x.data[v]))g++;else{var b=x.data[v].length;h+=b,void 0!==c?0<b&&(m+=Math.abs(b-c),c=b):c=b}0<x.data.length&&(h/=x.data.length-g),(void 0===l||m<=l)&&(void 0===d||d<h)&&1.99<h&&(l=m,o=p,d=h)}return{successful:!!(e.delimiter=o),bestDelimiter:o}}(a,e.newline,e.skipEmptyLines,e.comments,e.delimitersToGuess);c.successful?e.delimiter=c.bestDelimiter:(r=!0,e.delimiter=i.DefaultDelimiter),x.meta.delimiter=e.delimiter}var d=b(e);return e.preview&&e.header&&d.preview++,t=a,n=new f(d),x=n.parse(t,s,o),_(),p?{meta:{paused:!0}}:x||{meta:{paused:!1}}},this.paused=function(){return p},this.pause=function(){p=!0,n.abort(),t=w(e.chunk)?"":t.substring(n.getCharIndex())},this.resume=function(){c.streamer._halted?(p=!1,c.streamer.parseChunk(t,!0)):setTimeout(c.resume,3)},this.aborted=function(){return m},this.abort=function(){m=!0,n.abort(),x.meta.aborted=!0,w(e.complete)&&e.complete(x),t=""}}function h(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function f(e){var t,n=(e=e||{}).delimiter,r=e.newline,a=e.comments,s=e.step,o=e.preview,l=e.fastMode,c=t=void 0===e.quoteChar||null===e.quoteChar?'"':e.quoteChar;if(void 0!==e.escapeChar&&(c=e.escapeChar),("string"!=typeof n||-1<i.BAD_DELIMITERS.indexOf(n))&&(n=","),a===n)throw new Error("Comment character same as delimiter");!0===a?a="#":("string"!=typeof a||-1<i.BAD_DELIMITERS.indexOf(a))&&(a=!1),"\n"!==r&&"\r"!==r&&"\r\n"!==r&&(r="\n");var d=0,u=!1;this.parse=function(e,i,p){if("string"!=typeof e)throw new Error("Input must be a string");var m=e.length,f=n.length,g=r.length,x=a.length,v=w(s),b=[],y=[],_=[],j=d=0;if(!e)return M();if(l||!1!==l&&-1===e.indexOf(t)){for(var S=e.split(r),I=0;I<S.length;I++){if(_=S[I],d+=_.length,I!==S.length-1)d+=r.length;else if(p)return M();if(!a||_.substring(0,x)!==a){if(v){if(b=[],A(_.split(n)),L(),u)return M()}else A(_.split(n));if(o&&o<=I)return b=b.slice(0,o),M(!0)}}return M()}for(var C=e.indexOf(n,d),T=e.indexOf(r,d),k=new RegExp(h(c)+h(t),"g"),N=e.indexOf(t,d);;)if(e[d]!==t)if(a&&0===_.length&&e.substring(d,d+x)===a){if(-1===T)return M();d=T+g,T=e.indexOf(r,d),C=e.indexOf(n,d)}else if(-1!==C&&(C<T||-1===T))_.push(e.substring(d,C)),d=C+f,C=e.indexOf(n,d);else{if(-1===T)break;if(_.push(e.substring(d,T)),P(T+g),v&&(L(),u))return M();if(o&&b.length>=o)return M(!0)}else for(N=d,d++;;){if(-1===(N=e.indexOf(t,N+1)))return p||y.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:b.length,index:d}),R();if(N===m-1)return R(e.substring(d,N).replace(k,t));if(t!==c||e[N+1]!==c){if(t===c||0===N||e[N-1]!==c){-1!==C&&C<N+1&&(C=e.indexOf(n,N+1)),-1!==T&&T<N+1&&(T=e.indexOf(r,N+1));var D=O(-1===T?C:Math.min(C,T));if(e.substr(N+1+D,f)===n){_.push(e.substring(d,N).replace(k,t)),e[d=N+1+D+f]!==t&&(N=e.indexOf(t,d)),C=e.indexOf(n,d),T=e.indexOf(r,d);break}var E=O(T);if(e.substring(N+1+E,N+1+E+g)===r){if(_.push(e.substring(d,N).replace(k,t)),P(N+1+E+g),C=e.indexOf(n,d),N=e.indexOf(t,d),v&&(L(),u))return M();if(o&&b.length>=o)return M(!0);break}y.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:b.length,index:d}),N++}}else N++}return R();function A(e){b.push(e),j=d}function O(t){var n=0;if(-1!==t){var r=e.substring(N+1,t);r&&""===r.trim()&&(n=r.length)}return n}function R(t){return p||(void 0===t&&(t=e.substring(d)),_.push(t),d=m,A(_),v&&L()),M()}function P(t){d=t,A(_),_=[],T=e.indexOf(r,d)}function M(e){return{data:b,errors:y,meta:{delimiter:n,linebreak:r,aborted:u,truncated:!!e,cursor:j+(i||0)}}}function L(){s(M()),b=[],y=[]}},this.abort=function(){u=!0},this.getCharIndex=function(){return d}}function g(e){var t=e.data,n=a[t.workerId],r=!1;if(t.error)n.userError(t.error,t.file);else if(t.results&&t.results.data){var s={abort:function(){r=!0,x(t.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:v,resume:v};if(w(n.userStep)){for(var i=0;i<t.results.data.length&&(n.userStep({data:t.results.data[i],errors:t.results.errors,meta:t.results.meta},s),!r);i++);delete t.results}else w(n.userChunk)&&(n.userChunk(t.results,s,t.file),delete t.results)}t.finished&&!r&&x(t.workerId,t.results)}function x(e,t){var n=a[e];w(n.userComplete)&&n.userComplete(t),n.terminate(),delete a[e]}function v(){throw new Error("Not implemented.")}function b(e){if("object"!=typeof e||null===e)return e;var t=Array.isArray(e)?[]:{};for(var n in e)t[n]=b(e[n]);return t}function y(e,t){return function(){e.apply(t,arguments)}}function w(e){return"function"==typeof e}return r&&(t.onmessage=function(e){var n=e.data;if(void 0===i.WORKER_ID&&n&&(i.WORKER_ID=n.workerId),"string"==typeof n.input)t.postMessage({workerId:i.WORKER_ID,results:i.parse(n.input,n.config),finished:!0});else if(t.File&&n.input instanceof File||n.input instanceof Object){var r=i.parse(n.input,n.config);r&&t.postMessage({workerId:i.WORKER_ID,results:r,finished:!0})}}),(c.prototype=Object.create(l.prototype)).constructor=c,(d.prototype=Object.create(l.prototype)).constructor=d,(u.prototype=Object.create(u.prototype)).constructor=u,(p.prototype=Object.create(l.prototype)).constructor=p,i},void 0===(r=n.apply(t,[]))||(e.exports=r)},15325:function(e,t,n){!function(e,t,n,r,a,s,i,o,l,c,d,u,p,m,h,f,g,x,v,b,y,w,_,j,S,I,C,T,k,N,D,E,A,O,R,P,M,L,F,q,$,U,Z,V,W,Y,B,H,z,G,K,Q,X,J,ee,te,ne,re,ae,se,ie,oe,le){"use strict";function ce(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var de=ce(t),ue=ce(r),pe=ce(a),me=ce(s),he=ce(i),fe=ce(o),ge=ce(l),xe=ce(c),ve=ce(d),be=ce(u),ye=ce(p),we=ce(f),_e=ce(g),je=ce(x),Se=ce(v),Ie=ce(b),Ce=ce(y),Te=ce(w),ke=ce(_),Ne=ce(j),De=ce(S),Ee=ce(I),Ae=ce(C),Oe=ce(T),Re=ce(k),Pe=ce(N),Me=ce(D),Le=ce(E),Fe=ce(A),qe=ce(O),$e=ce(R),Ue=ce(P),Ze=ce(M),Ve=ce(L),We=ce(F),Ye=ce($),Be=ce(U),He=ce(Z),ze=ce(V),Ge=ce(W),Ke=ce(Y),Qe=ce(B),Xe=ce(G),Je=ce(K),et=ce(Q),tt=ce(X),nt=ce(J),rt=ce(ee),at=ce(te),st=ce(ne),it=ce(re),ot=ce(ae),lt=ce(se),ct=ce(ie),dt=ce(oe);function ut(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function pt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ut(Object(n),!0).forEach((function(t){xt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ut(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function mt(e){return(mt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ht(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ft(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function gt(e,t,n){return t&&ft(e.prototype,t),n&&ft(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function xt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vt(){return(vt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function bt(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");Object.defineProperty(e,"prototype",{value:Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),writable:!1}),t&&wt(e,t)}function yt(e){return(yt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function wt(e,t){return(wt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _t(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function jt(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _t(e)}function St(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=yt(e);if(t){var a=yt(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return jt(this,n)}}function It(e){return function(e){if(Array.isArray(e))return Ct(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Ct(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ct(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ct(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Tt(e,t){switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}}function kt(e,t){switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}}var Nt={p:kt,P:function(e,t){var n,r=e.match(/(P+)(p+)?/)||[],a=r[1],s=r[2];if(!s)return Tt(e,t);switch(a){case"P":n=t.dateTime({width:"short"});break;case"PP":n=t.dateTime({width:"medium"});break;case"PPP":n=t.dateTime({width:"long"});break;default:n=t.dateTime({width:"full"})}return n.replace("{{date}}",Tt(a,t)).replace("{{time}}",kt(s,t))}},Dt=12,Et=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;function At(e){var t=e?"string"==typeof e||e instanceof String?lt.default(e):it.default(e):new Date;return Rt(t)?t:null}function Ot(e,t,n,r,a){var s=null,i=Xt(n)||Xt(Qt()),o=!0;return Array.isArray(t)?(t.forEach((function(t){var l=ot.default(e,t,new Date,{locale:i});r&&(o=Rt(l,a)&&e===Pt(l,t,n)),Rt(l,a)&&o&&(s=l)})),s):(s=ot.default(e,t,new Date,{locale:i}),r?o=Rt(s)&&e===Pt(s,t,n):Rt(s)||(t=t.match(Et).map((function(e){var t=e[0];return"p"===t||"P"===t?i?(0,Nt[t])(e,i.formatLong):t:e})).join(""),e.length>0&&(s=ot.default(e,t.slice(0,e.length),new Date)),Rt(s)||(s=new Date(e))),Rt(s)&&o?s:null)}function Rt(e,t){return t=t||new Date("1/1/1000"),me.default(e)&&!at.default(e,t)}function Pt(e,t,n){if("en"===n)return he.default(e,t,{awareOfUnicodeTokens:!0});var r=Xt(n);return n&&!r&&console.warn('A locale object was not found for the provided string ["'.concat(n,'"].')),!r&&Qt()&&Xt(Qt())&&(r=Xt(Qt())),he.default(e,t,{locale:r||null,awareOfUnicodeTokens:!0})}function Mt(e,t){var n=t.dateFormat,r=t.locale;return e&&Pt(e,Array.isArray(n)?n[0]:n,r)||""}function Lt(e,t){var n=t.hour,r=void 0===n?0:n,a=t.minute,s=void 0===a?0:a,i=t.second,o=void 0===i?0:i;return Le.default(Me.default(Pe.default(e,o),s),r)}function Ft(e,t){var n=t&&Xt(t)||Qt()&&Xt(Qt());return De.default(e,n?{locale:n}:null)}function qt(e,t){return Pt(e,"ddd",t)}function $t(e){return Be.default(e)}function Ut(e,t,n){var r=Xt(t||Qt());return He.default(e,{locale:r,weekStartsOn:n})}function Zt(e){return ze.default(e)}function Vt(e){return Ke.default(e)}function Wt(e){return Ge.default(e)}function Yt(e,t){return e&&t?tt.default(e,t):!e&&!t}function Bt(e,t){return e&&t?et.default(e,t):!e&&!t}function Ht(e,t){return e&&t?nt.default(e,t):!e&&!t}function zt(e,t){return e&&t?Je.default(e,t):!e&&!t}function Gt(e,t){return e&&t?Xe.default(e,t):!e&&!t}function Kt(e,t,n){var r,a=Be.default(t),s=Qe.default(n);try{r=st.default(e,{start:a,end:s})}catch(e){r=!1}return r}function Qt(){return("undefined"!=typeof window?window:globalThis).__localeId__}function Xt(e){if("string"==typeof e){var t="undefined"!=typeof window?window:globalThis;return t.__localeData__?t.__localeData__[e]:null}return e}function Jt(e,t){return Pt(Fe.default(At(),e),"LLLL",t)}function en(e,t){return Pt(Fe.default(At(),e),"LLL",t)}function tn(e,t){return Pt(qe.default(At(),e),"QQQ",t)}function nn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,r=t.maxDate,a=t.excludeDates,s=t.excludeDateIntervals,i=t.includeDates,o=t.includeDateIntervals,l=t.filterDate;return dn(e,{minDate:n,maxDate:r})||a&&a.some((function(t){return zt(e,t)}))||s&&s.some((function(t){var n=t.start,r=t.end;return st.default(e,{start:n,end:r})}))||i&&!i.some((function(t){return zt(e,t)}))||o&&!o.some((function(t){var n=t.start,r=t.end;return st.default(e,{start:n,end:r})}))||l&&!l(At(e))||!1}function rn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.excludeDates,r=t.excludeDateIntervals;return r&&r.length>0?r.some((function(t){var n=t.start,r=t.end;return st.default(e,{start:n,end:r})})):n&&n.some((function(t){return zt(e,t)}))||!1}function an(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,r=t.maxDate,a=t.excludeDates,s=t.includeDates,i=t.filterDate;return dn(e,{minDate:n,maxDate:r})||a&&a.some((function(t){return Bt(e,t)}))||s&&!s.some((function(t){return Bt(e,t)}))||i&&!i(At(e))||!1}function sn(e,t,n,r){var a=Oe.default(e),s=Ee.default(e),i=Oe.default(t),o=Ee.default(t),l=Oe.default(r);return a===i&&a===l?s<=n&&n<=o:a<i?l===a&&s<=n||l===i&&o>=n||l<i&&l>a:void 0}function on(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,r=t.maxDate,a=t.excludeDates,s=t.includeDates,i=t.filterDate;return dn(e,{minDate:n,maxDate:r})||a&&a.some((function(t){return Ht(e,t)}))||s&&!s.some((function(t){return Ht(e,t)}))||i&&!i(At(e))||!1}function ln(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,r=t.maxDate;return dn(new Date(e,0,1),{minDate:n,maxDate:r})||!1}function cn(e,t,n,r){var a=Oe.default(e),s=Ae.default(e),i=Oe.default(t),o=Ae.default(t),l=Oe.default(r);return a===i&&a===l?s<=n&&n<=o:a<i?l===a&&s<=n||l===i&&o>=n||l<i&&l>a:void 0}function dn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,r=t.maxDate;return n&&Ve.default(e,n)<0||r&&Ve.default(e,r)>0}function un(e,t){return t.some((function(t){return Te.default(t)===Te.default(e)&&Ce.default(t)===Ce.default(e)}))}function pn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.excludeTimes,r=t.includeTimes,a=t.filterTime;return n&&un(e,n)||r&&!un(e,r)||a&&!a(e)||!1}function mn(e,t){var n=t.minTime,r=t.maxTime;if(!n||!r)throw new Error("Both minTime and maxTime props required");var a,s=At(),i=Le.default(Me.default(s,Ce.default(e)),Te.default(e)),o=Le.default(Me.default(s,Ce.default(n)),Te.default(n)),l=Le.default(Me.default(s,Ce.default(r)),Te.default(r));try{a=!st.default(i,{start:o,end:l})}catch(e){a=!1}return a}function hn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,r=t.includeDates,a=je.default(e,1);return n&&We.default(n,a)>0||r&&r.every((function(e){return We.default(e,a)>0}))||!1}function fn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.maxDate,r=t.includeDates,a=be.default(e,1);return n&&We.default(a,n)>0||r&&r.every((function(e){return We.default(a,e)>0}))||!1}function gn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,r=t.includeDates,a=Se.default(e,1);return n&&Ye.default(n,a)>0||r&&r.every((function(e){return Ye.default(e,a)>0}))||!1}function xn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.maxDate,r=t.includeDates,a=ye.default(e,1);return n&&Ye.default(a,n)>0||r&&r.every((function(e){return Ye.default(a,e)>0}))||!1}function vn(e){var t=e.minDate,n=e.includeDates;if(n&&t){var r=n.filter((function(e){return Ve.default(e,t)>=0}));return Ue.default(r)}return n?Ue.default(n):t}function bn(e){var t=e.maxDate,n=e.includeDates;if(n&&t){var r=n.filter((function(e){return Ve.default(e,t)<=0}));return Ze.default(r)}return n?Ze.default(n):t}function yn(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"react-datepicker__day--highlighted",n=new Map,r=0,a=e.length;r<a;r++){var s=e[r];if(pe.default(s)){var i=Pt(s,"MM.dd.yyyy"),o=n.get(i)||[];o.includes(t)||(o.push(t),n.set(i,o))}else if("object"===mt(s)){var l=Object.keys(s),c=l[0],d=s[l[0]];if("string"==typeof c&&d.constructor===Array)for(var u=0,p=d.length;u<p;u++){var m=Pt(d[u],"MM.dd.yyyy"),h=n.get(m)||[];h.includes(c)||(h.push(c),n.set(m,h))}}}return n}function wn(e,t,n,r,a){for(var s=a.length,i=[],o=0;o<s;o++){var l=fe.default(ge.default(e,Te.default(a[o])),Ce.default(a[o])),c=fe.default(e,(n+1)*r);rt.default(l,t)&&at.default(l,c)&&i.push(a[o])}return i}function _n(e){return e<10?"0".concat(e):"".concat(e)}function jn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Dt,n=Math.ceil(Oe.default(e)/t)*t;return{startPeriod:n-(t-1),endPeriod:n}}function Sn(e,t,n,r){for(var a=[],s=0;s<2*t+1;s++){var i=e+t-s,o=!0;n&&(o=Oe.default(n)<=i),r&&o&&(o=Oe.default(r)>=i),o&&a.push(i)}return a}var In=function(e){bt(r,e);var n=St(r);function r(e){var a;ht(this,r),xt(_t(a=n.call(this,e)),"renderOptions",(function(){var e=a.props.year,t=a.state.yearsList.map((function(t){return de.default.createElement("div",{className:e===t?"react-datepicker__year-option react-datepicker__year-option--selected_year":"react-datepicker__year-option",key:t,onClick:a.onChange.bind(_t(a),t),"aria-selected":e===t?"true":void 0},e===t?de.default.createElement("span",{className:"react-datepicker__year-option--selected"},"✓"):"",t)})),n=a.props.minDate?Oe.default(a.props.minDate):null,r=a.props.maxDate?Oe.default(a.props.maxDate):null;return r&&a.state.yearsList.find((function(e){return e===r}))||t.unshift(de.default.createElement("div",{className:"react-datepicker__year-option",key:"upcoming",onClick:a.incrementYears},de.default.createElement("a",{className:"react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-upcoming"}))),n&&a.state.yearsList.find((function(e){return e===n}))||t.push(de.default.createElement("div",{className:"react-datepicker__year-option",key:"previous",onClick:a.decrementYears},de.default.createElement("a",{className:"react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-previous"}))),t})),xt(_t(a),"onChange",(function(e){a.props.onChange(e)})),xt(_t(a),"handleClickOutside",(function(){a.props.onCancel()})),xt(_t(a),"shiftYears",(function(e){var t=a.state.yearsList.map((function(t){return t+e}));a.setState({yearsList:t})})),xt(_t(a),"incrementYears",(function(){return a.shiftYears(1)})),xt(_t(a),"decrementYears",(function(){return a.shiftYears(-1)}));var s=e.yearDropdownItemNumber,i=e.scrollableYearDropdown,o=s||(i?10:5);return a.state={yearsList:Sn(a.props.year,o,a.props.minDate,a.props.maxDate)},a.dropdownRef=t.createRef(),a}return gt(r,[{key:"componentDidMount",value:function(){var e=this.dropdownRef.current;e&&(e.scrollTop=e.scrollHeight/2-e.clientHeight/2)}},{key:"render",value:function(){var e=ue.default({"react-datepicker__year-dropdown":!0,"react-datepicker__year-dropdown--scrollable":this.props.scrollableYearDropdown});return de.default.createElement("div",{className:e,ref:this.dropdownRef},this.renderOptions())}}]),r}(de.default.Component),Cn=ct.default(In),Tn=function(e){bt(n,e);var t=St(n);function n(){var e;ht(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return xt(_t(e=t.call.apply(t,[this].concat(a))),"state",{dropdownVisible:!1}),xt(_t(e),"renderSelectOptions",(function(){for(var t=e.props.minDate?Oe.default(e.props.minDate):1900,n=e.props.maxDate?Oe.default(e.props.maxDate):2100,r=[],a=t;a<=n;a++)r.push(de.default.createElement("option",{key:a,value:a},a));return r})),xt(_t(e),"onSelectChange",(function(t){e.onChange(t.target.value)})),xt(_t(e),"renderSelectMode",(function(){return de.default.createElement("select",{value:e.props.year,className:"react-datepicker__year-select",onChange:e.onSelectChange},e.renderSelectOptions())})),xt(_t(e),"renderReadView",(function(t){return de.default.createElement("div",{key:"read",style:{visibility:t?"visible":"hidden"},className:"react-datepicker__year-read-view",onClick:function(t){return e.toggleDropdown(t)}},de.default.createElement("span",{className:"react-datepicker__year-read-view--down-arrow"}),de.default.createElement("span",{className:"react-datepicker__year-read-view--selected-year"},e.props.year))})),xt(_t(e),"renderDropdown",(function(){return de.default.createElement(Cn,{key:"dropdown",year:e.props.year,onChange:e.onChange,onCancel:e.toggleDropdown,minDate:e.props.minDate,maxDate:e.props.maxDate,scrollableYearDropdown:e.props.scrollableYearDropdown,yearDropdownItemNumber:e.props.yearDropdownItemNumber})})),xt(_t(e),"renderScrollMode",(function(){var t=e.state.dropdownVisible,n=[e.renderReadView(!t)];return t&&n.unshift(e.renderDropdown()),n})),xt(_t(e),"onChange",(function(t){e.toggleDropdown(),t!==e.props.year&&e.props.onChange(t)})),xt(_t(e),"toggleDropdown",(function(t){e.setState({dropdownVisible:!e.state.dropdownVisible},(function(){e.props.adjustDateOnChange&&e.handleYearChange(e.props.date,t)}))})),xt(_t(e),"handleYearChange",(function(t,n){e.onSelect(t,n),e.setOpen()})),xt(_t(e),"onSelect",(function(t,n){e.props.onSelect&&e.props.onSelect(t,n)})),xt(_t(e),"setOpen",(function(){e.props.setOpen&&e.props.setOpen(!0)})),e}return gt(n,[{key:"render",value:function(){var e;switch(this.props.dropdownMode){case"scroll":e=this.renderScrollMode();break;case"select":e=this.renderSelectMode()}return de.default.createElement("div",{className:"react-datepicker__year-dropdown-container react-datepicker__year-dropdown-container--".concat(this.props.dropdownMode)},e)}}]),n}(de.default.Component),kn=function(e){bt(n,e);var t=St(n);function n(){var e;ht(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return xt(_t(e=t.call.apply(t,[this].concat(a))),"isSelectedMonth",(function(t){return e.props.month===t})),xt(_t(e),"renderOptions",(function(){return e.props.monthNames.map((function(t,n){return de.default.createElement("div",{className:e.isSelectedMonth(n)?"react-datepicker__month-option react-datepicker__month-option--selected_month":"react-datepicker__month-option",key:t,onClick:e.onChange.bind(_t(e),n),"aria-selected":e.isSelectedMonth(n)?"true":void 0},e.isSelectedMonth(n)?de.default.createElement("span",{className:"react-datepicker__month-option--selected"},"✓"):"",t)}))})),xt(_t(e),"onChange",(function(t){return e.props.onChange(t)})),xt(_t(e),"handleClickOutside",(function(){return e.props.onCancel()})),e}return gt(n,[{key:"render",value:function(){return de.default.createElement("div",{className:"react-datepicker__month-dropdown"},this.renderOptions())}}]),n}(de.default.Component),Nn=ct.default(kn),Dn=function(e){bt(n,e);var t=St(n);function n(){var e;ht(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return xt(_t(e=t.call.apply(t,[this].concat(a))),"state",{dropdownVisible:!1}),xt(_t(e),"renderSelectOptions",(function(e){return e.map((function(e,t){return de.default.createElement("option",{key:t,value:t},e)}))})),xt(_t(e),"renderSelectMode",(function(t){return de.default.createElement("select",{value:e.props.month,className:"react-datepicker__month-select",onChange:function(t){return e.onChange(t.target.value)}},e.renderSelectOptions(t))})),xt(_t(e),"renderReadView",(function(t,n){return de.default.createElement("div",{key:"read",style:{visibility:t?"visible":"hidden"},className:"react-datepicker__month-read-view",onClick:e.toggleDropdown},de.default.createElement("span",{className:"react-datepicker__month-read-view--down-arrow"}),de.default.createElement("span",{className:"react-datepicker__month-read-view--selected-month"},n[e.props.month]))})),xt(_t(e),"renderDropdown",(function(t){return de.default.createElement(Nn,{key:"dropdown",month:e.props.month,monthNames:t,onChange:e.onChange,onCancel:e.toggleDropdown})})),xt(_t(e),"renderScrollMode",(function(t){var n=e.state.dropdownVisible,r=[e.renderReadView(!n,t)];return n&&r.unshift(e.renderDropdown(t)),r})),xt(_t(e),"onChange",(function(t){e.toggleDropdown(),t!==e.props.month&&e.props.onChange(t)})),xt(_t(e),"toggleDropdown",(function(){return e.setState({dropdownVisible:!e.state.dropdownVisible})})),e}return gt(n,[{key:"render",value:function(){var e,t=this,n=[0,1,2,3,4,5,6,7,8,9,10,11].map(this.props.useShortMonthInDropdown?function(e){return en(e,t.props.locale)}:function(e){return Jt(e,t.props.locale)});switch(this.props.dropdownMode){case"scroll":e=this.renderScrollMode(n);break;case"select":e=this.renderSelectMode(n)}return de.default.createElement("div",{className:"react-datepicker__month-dropdown-container react-datepicker__month-dropdown-container--".concat(this.props.dropdownMode)},e)}}]),n}(de.default.Component);function En(e,t){for(var n=[],r=Zt(e),a=Zt(t);!rt.default(r,a);)n.push(At(r)),r=be.default(r,1);return n}var An=function(e){bt(n,e);var t=St(n);function n(e){var r;return ht(this,n),xt(_t(r=t.call(this,e)),"renderOptions",(function(){return r.state.monthYearsList.map((function(e){var t=Re.default(e),n=Yt(r.props.date,e)&&Bt(r.props.date,e);return de.default.createElement("div",{className:n?"react-datepicker__month-year-option--selected_month-year":"react-datepicker__month-year-option",key:t,onClick:r.onChange.bind(_t(r),t),"aria-selected":n?"true":void 0},n?de.default.createElement("span",{className:"react-datepicker__month-year-option--selected"},"✓"):"",Pt(e,r.props.dateFormat,r.props.locale))}))})),xt(_t(r),"onChange",(function(e){return r.props.onChange(e)})),xt(_t(r),"handleClickOutside",(function(){r.props.onCancel()})),r.state={monthYearsList:En(r.props.minDate,r.props.maxDate)},r}return gt(n,[{key:"render",value:function(){var e=ue.default({"react-datepicker__month-year-dropdown":!0,"react-datepicker__month-year-dropdown--scrollable":this.props.scrollableMonthYearDropdown});return de.default.createElement("div",{className:e},this.renderOptions())}}]),n}(de.default.Component),On=ct.default(An),Rn=function(e){bt(n,e);var t=St(n);function n(){var e;ht(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return xt(_t(e=t.call.apply(t,[this].concat(a))),"state",{dropdownVisible:!1}),xt(_t(e),"renderSelectOptions",(function(){for(var t=Zt(e.props.minDate),n=Zt(e.props.maxDate),r=[];!rt.default(t,n);){var a=Re.default(t);r.push(de.default.createElement("option",{key:a,value:a},Pt(t,e.props.dateFormat,e.props.locale))),t=be.default(t,1)}return r})),xt(_t(e),"onSelectChange",(function(t){e.onChange(t.target.value)})),xt(_t(e),"renderSelectMode",(function(){return de.default.createElement("select",{value:Re.default(Zt(e.props.date)),className:"react-datepicker__month-year-select",onChange:e.onSelectChange},e.renderSelectOptions())})),xt(_t(e),"renderReadView",(function(t){var n=Pt(e.props.date,e.props.dateFormat,e.props.locale);return de.default.createElement("div",{key:"read",style:{visibility:t?"visible":"hidden"},className:"react-datepicker__month-year-read-view",onClick:function(t){return e.toggleDropdown(t)}},de.default.createElement("span",{className:"react-datepicker__month-year-read-view--down-arrow"}),de.default.createElement("span",{className:"react-datepicker__month-year-read-view--selected-month-year"},n))})),xt(_t(e),"renderDropdown",(function(){return de.default.createElement(On,{key:"dropdown",date:e.props.date,dateFormat:e.props.dateFormat,onChange:e.onChange,onCancel:e.toggleDropdown,minDate:e.props.minDate,maxDate:e.props.maxDate,scrollableMonthYearDropdown:e.props.scrollableMonthYearDropdown,locale:e.props.locale})})),xt(_t(e),"renderScrollMode",(function(){var t=e.state.dropdownVisible,n=[e.renderReadView(!t)];return t&&n.unshift(e.renderDropdown()),n})),xt(_t(e),"onChange",(function(t){e.toggleDropdown();var n=At(parseInt(t));Yt(e.props.date,n)&&Bt(e.props.date,n)||e.props.onChange(n)})),xt(_t(e),"toggleDropdown",(function(){return e.setState({dropdownVisible:!e.state.dropdownVisible})})),e}return gt(n,[{key:"render",value:function(){var e;switch(this.props.dropdownMode){case"scroll":e=this.renderScrollMode();break;case"select":e=this.renderSelectMode()}return de.default.createElement("div",{className:"react-datepicker__month-year-dropdown-container react-datepicker__month-year-dropdown-container--".concat(this.props.dropdownMode)},e)}}]),n}(de.default.Component),Pn=function(e){bt(n,e);var t=St(n);function n(){var e;ht(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return xt(_t(e=t.call.apply(t,[this].concat(a))),"dayEl",de.default.createRef()),xt(_t(e),"handleClick",(function(t){!e.isDisabled()&&e.props.onClick&&e.props.onClick(t)})),xt(_t(e),"handleMouseEnter",(function(t){!e.isDisabled()&&e.props.onMouseEnter&&e.props.onMouseEnter(t)})),xt(_t(e),"handleOnKeyDown",(function(t){" "===t.key&&(t.preventDefault(),t.key="Enter"),e.props.handleOnKeyDown(t)})),xt(_t(e),"isSameDay",(function(t){return zt(e.props.day,t)})),xt(_t(e),"isKeyboardSelected",(function(){return!e.props.disabledKeyboardNavigation&&!e.isSameDay(e.props.selected)&&e.isSameDay(e.props.preSelection)})),xt(_t(e),"isDisabled",(function(){return nn(e.props.day,e.props)})),xt(_t(e),"isExcluded",(function(){return rn(e.props.day,e.props)})),xt(_t(e),"getHighLightedClass",(function(t){var n=e.props,r=n.day,a=n.highlightDates;if(!a)return!1;var s=Pt(r,"MM.dd.yyyy");return a.get(s)})),xt(_t(e),"isInRange",(function(){var t=e.props,n=t.day,r=t.startDate,a=t.endDate;return!(!r||!a)&&Kt(n,r,a)})),xt(_t(e),"isInSelectingRange",(function(){var t,n=e.props,r=n.day,a=n.selectsStart,s=n.selectsEnd,i=n.selectsRange,o=n.selectsDisabledDaysInRange,l=n.startDate,c=n.endDate,d=null!==(t=e.props.selectingDate)&&void 0!==t?t:e.props.preSelection;return!(!(a||s||i)||!d||!o&&e.isDisabled())&&(a&&c&&(at.default(d,c)||Gt(d,c))?Kt(r,d,c):(s&&l&&(rt.default(d,l)||Gt(d,l))||!(!i||!l||c||!rt.default(d,l)&&!Gt(d,l)))&&Kt(r,l,d))})),xt(_t(e),"isSelectingRangeStart",(function(){var t;if(!e.isInSelectingRange())return!1;var n=e.props,r=n.day,a=n.startDate,s=n.selectsStart,i=null!==(t=e.props.selectingDate)&&void 0!==t?t:e.props.preSelection;return zt(r,s?i:a)})),xt(_t(e),"isSelectingRangeEnd",(function(){var t;if(!e.isInSelectingRange())return!1;var n=e.props,r=n.day,a=n.endDate,s=n.selectsEnd,i=null!==(t=e.props.selectingDate)&&void 0!==t?t:e.props.preSelection;return zt(r,s?i:a)})),xt(_t(e),"isRangeStart",(function(){var t=e.props,n=t.day,r=t.startDate,a=t.endDate;return!(!r||!a)&&zt(r,n)})),xt(_t(e),"isRangeEnd",(function(){var t=e.props,n=t.day,r=t.startDate,a=t.endDate;return!(!r||!a)&&zt(a,n)})),xt(_t(e),"isWeekend",(function(){var t=ke.default(e.props.day);return 0===t||6===t})),xt(_t(e),"isAfterMonth",(function(){return void 0!==e.props.month&&(e.props.month+1)%12===Ee.default(e.props.day)})),xt(_t(e),"isBeforeMonth",(function(){return void 0!==e.props.month&&(Ee.default(e.props.day)+1)%12===e.props.month})),xt(_t(e),"isCurrentDay",(function(){return e.isSameDay(At())})),xt(_t(e),"isSelected",(function(){return e.isSameDay(e.props.selected)})),xt(_t(e),"getClassNames",(function(t){var n=e.props.dayClassName?e.props.dayClassName(t):void 0;return ue.default("react-datepicker__day",n,"react-datepicker__day--"+qt(e.props.day),{"react-datepicker__day--disabled":e.isDisabled(),"react-datepicker__day--excluded":e.isExcluded(),"react-datepicker__day--selected":e.isSelected(),"react-datepicker__day--keyboard-selected":e.isKeyboardSelected(),"react-datepicker__day--range-start":e.isRangeStart(),"react-datepicker__day--range-end":e.isRangeEnd(),"react-datepicker__day--in-range":e.isInRange(),"react-datepicker__day--in-selecting-range":e.isInSelectingRange(),"react-datepicker__day--selecting-range-start":e.isSelectingRangeStart(),"react-datepicker__day--selecting-range-end":e.isSelectingRangeEnd(),"react-datepicker__day--today":e.isCurrentDay(),"react-datepicker__day--weekend":e.isWeekend(),"react-datepicker__day--outside-month":e.isAfterMonth()||e.isBeforeMonth()},e.getHighLightedClass("react-datepicker__day--highlighted"))})),xt(_t(e),"getAriaLabel",(function(){var t=e.props,n=t.day,r=t.ariaLabelPrefixWhenEnabled,a=void 0===r?"Choose":r,s=t.ariaLabelPrefixWhenDisabled,i=void 0===s?"Not available":s,o=e.isDisabled()||e.isExcluded()?i:a;return"".concat(o," ").concat(Pt(n,"PPPP",e.props.locale))})),xt(_t(e),"getTabIndex",(function(t,n){var r=t||e.props.selected,a=n||e.props.preSelection;return e.isKeyboardSelected()||e.isSameDay(r)&&zt(a,r)?0:-1})),xt(_t(e),"handleFocusDay",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=!1;0===e.getTabIndex()&&!t.isInputFocused&&e.isSameDay(e.props.preSelection)&&(document.activeElement&&document.activeElement!==document.body||(n=!0),e.props.inline&&!e.props.shouldFocusDayInline&&(n=!1),e.props.containerRef&&e.props.containerRef.current&&e.props.containerRef.current.contains(document.activeElement)&&document.activeElement.classList.contains("react-datepicker__day")&&(n=!0)),n&&e.dayEl.current.focus({preventScroll:!0})})),xt(_t(e),"renderDayContents",(function(){return e.props.monthShowsDuplicateDaysEnd&&e.isAfterMonth()||e.props.monthShowsDuplicateDaysStart&&e.isBeforeMonth()?null:e.props.renderDayContents?e.props.renderDayContents(Ne.default(e.props.day),e.props.day):Ne.default(e.props.day)})),xt(_t(e),"render",(function(){return de.default.createElement("div",{ref:e.dayEl,className:e.getClassNames(e.props.day),onKeyDown:e.handleOnKeyDown,onClick:e.handleClick,onMouseEnter:e.handleMouseEnter,tabIndex:e.getTabIndex(),"aria-label":e.getAriaLabel(),role:"option","aria-disabled":e.isDisabled(),"aria-current":e.isCurrentDay()?"date":void 0,"aria-selected":e.isSelected()},e.renderDayContents())})),e}return gt(n,[{key:"componentDidMount",value:function(){this.handleFocusDay()}},{key:"componentDidUpdate",value:function(e){this.handleFocusDay(e)}}]),n}(de.default.Component),Mn=function(e){bt(n,e);var t=St(n);function n(){var e;ht(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return xt(_t(e=t.call.apply(t,[this].concat(a))),"handleClick",(function(t){e.props.onClick&&e.props.onClick(t)})),e}return gt(n,[{key:"render",value:function(){var e=this.props,t=e.weekNumber,n=e.ariaLabelPrefix,r=void 0===n?"week ":n,a={"react-datepicker__week-number":!0,"react-datepicker__week-number--clickable":!!e.onClick};return de.default.createElement("div",{className:ue.default(a),"aria-label":"".concat(r," ").concat(this.props.weekNumber),onClick:this.handleClick},t)}}]),n}(de.default.Component),Ln=function(e){bt(n,e);var t=St(n);function n(){var e;ht(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return xt(_t(e=t.call.apply(t,[this].concat(a))),"handleDayClick",(function(t,n){e.props.onDayClick&&e.props.onDayClick(t,n)})),xt(_t(e),"handleDayMouseEnter",(function(t){e.props.onDayMouseEnter&&e.props.onDayMouseEnter(t)})),xt(_t(e),"handleWeekClick",(function(t,n,r){"function"==typeof e.props.onWeekSelect&&e.props.onWeekSelect(t,n,r),e.props.shouldCloseOnSelect&&e.props.setOpen(!1)})),xt(_t(e),"formatWeekNumber",(function(t){return e.props.formatWeekNumber?e.props.formatWeekNumber(t):Ft(t)})),xt(_t(e),"renderDays",(function(){var t=Ut(e.props.day,e.props.locale,e.props.calendarStartDay),n=[],r=e.formatWeekNumber(t);if(e.props.showWeekNumber){var a=e.props.onWeekSelect?e.handleWeekClick.bind(_t(e),t,r):void 0;n.push(de.default.createElement(Mn,{key:"W",weekNumber:r,onClick:a,ariaLabelPrefix:e.props.ariaLabelPrefix}))}return n.concat([0,1,2,3,4,5,6].map((function(n){var r=xe.default(t,n);return de.default.createElement(Pn,{ariaLabelPrefixWhenEnabled:e.props.chooseDayAriaLabelPrefix,ariaLabelPrefixWhenDisabled:e.props.disabledDayAriaLabelPrefix,key:r.valueOf(),day:r,month:e.props.month,onClick:e.handleDayClick.bind(_t(e),r),onMouseEnter:e.handleDayMouseEnter.bind(_t(e),r),minDate:e.props.minDate,maxDate:e.props.maxDate,excludeDates:e.props.excludeDates,excludeDateIntervals:e.props.excludeDateIntervals,includeDates:e.props.includeDates,includeDateIntervals:e.props.includeDateIntervals,highlightDates:e.props.highlightDates,selectingDate:e.props.selectingDate,filterDate:e.props.filterDate,preSelection:e.props.preSelection,selected:e.props.selected,selectsStart:e.props.selectsStart,selectsEnd:e.props.selectsEnd,selectsRange:e.props.selectsRange,selectsDisabledDaysInRange:e.props.selectsDisabledDaysInRange,startDate:e.props.startDate,endDate:e.props.endDate,dayClassName:e.props.dayClassName,renderDayContents:e.props.renderDayContents,disabledKeyboardNavigation:e.props.disabledKeyboardNavigation,handleOnKeyDown:e.props.handleOnKeyDown,isInputFocused:e.props.isInputFocused,containerRef:e.props.containerRef,inline:e.props.inline,shouldFocusDayInline:e.props.shouldFocusDayInline,monthShowsDuplicateDaysEnd:e.props.monthShowsDuplicateDaysEnd,monthShowsDuplicateDaysStart:e.props.monthShowsDuplicateDaysStart,locale:e.props.locale})})))})),e}return gt(n,[{key:"render",value:function(){return de.default.createElement("div",{className:"react-datepicker__week"},this.renderDays())}}],[{key:"defaultProps",get:function(){return{shouldCloseOnSelect:!0}}}]),n}(de.default.Component),Fn=function(e){bt(n,e);var t=St(n);function n(){var e;ht(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return xt(_t(e=t.call.apply(t,[this].concat(a))),"MONTH_REFS",It(Array(12)).map((function(){return de.default.createRef()}))),xt(_t(e),"isDisabled",(function(t){return nn(t,e.props)})),xt(_t(e),"isExcluded",(function(t){return rn(t,e.props)})),xt(_t(e),"handleDayClick",(function(t,n){e.props.onDayClick&&e.props.onDayClick(t,n,e.props.orderInDisplay)})),xt(_t(e),"handleDayMouseEnter",(function(t){e.props.onDayMouseEnter&&e.props.onDayMouseEnter(t)})),xt(_t(e),"handleMouseLeave",(function(){e.props.onMouseLeave&&e.props.onMouseLeave()})),xt(_t(e),"isRangeStartMonth",(function(t){var n=e.props,r=n.day,a=n.startDate,s=n.endDate;return!(!a||!s)&&Bt(Fe.default(r,t),a)})),xt(_t(e),"isRangeStartQuarter",(function(t){var n=e.props,r=n.day,a=n.startDate,s=n.endDate;return!(!a||!s)&&Ht(qe.default(r,t),a)})),xt(_t(e),"isRangeEndMonth",(function(t){var n=e.props,r=n.day,a=n.startDate,s=n.endDate;return!(!a||!s)&&Bt(Fe.default(r,t),s)})),xt(_t(e),"isRangeEndQuarter",(function(t){var n=e.props,r=n.day,a=n.startDate,s=n.endDate;return!(!a||!s)&&Ht(qe.default(r,t),s)})),xt(_t(e),"isWeekInMonth",(function(t){var n=e.props.day,r=xe.default(t,6);return Bt(t,n)||Bt(r,n)})),xt(_t(e),"isCurrentMonth",(function(e,t){return Oe.default(e)===Oe.default(At())&&t===Ee.default(At())})),xt(_t(e),"isSelectedMonth",(function(e,t,n){return Ee.default(e)===t&&Oe.default(e)===Oe.default(n)})),xt(_t(e),"isSelectedQuarter",(function(e,t,n){return Ae.default(e)===t&&Oe.default(e)===Oe.default(n)})),xt(_t(e),"renderWeeks",(function(){for(var t=[],n=e.props.fixedHeight,r=0,a=!1,s=Ut(Zt(e.props.day),e.props.locale,e.props.calendarStartDay);t.push(de.default.createElement(Ln,{ariaLabelPrefix:e.props.weekAriaLabelPrefix,chooseDayAriaLabelPrefix:e.props.chooseDayAriaLabelPrefix,disabledDayAriaLabelPrefix:e.props.disabledDayAriaLabelPrefix,key:r,day:s,month:Ee.default(e.props.day),onDayClick:e.handleDayClick,onDayMouseEnter:e.handleDayMouseEnter,onWeekSelect:e.props.onWeekSelect,formatWeekNumber:e.props.formatWeekNumber,locale:e.props.locale,minDate:e.props.minDate,maxDate:e.props.maxDate,excludeDates:e.props.excludeDates,excludeDateIntervals:e.props.excludeDateIntervals,includeDates:e.props.includeDates,includeDateIntervals:e.props.includeDateIntervals,inline:e.props.inline,shouldFocusDayInline:e.props.shouldFocusDayInline,highlightDates:e.props.highlightDates,selectingDate:e.props.selectingDate,filterDate:e.props.filterDate,preSelection:e.props.preSelection,selected:e.props.selected,selectsStart:e.props.selectsStart,selectsEnd:e.props.selectsEnd,selectsRange:e.props.selectsRange,selectsDisabledDaysInRange:e.props.selectsDisabledDaysInRange,showWeekNumber:e.props.showWeekNumbers,startDate:e.props.startDate,endDate:e.props.endDate,dayClassName:e.props.dayClassName,setOpen:e.props.setOpen,shouldCloseOnSelect:e.props.shouldCloseOnSelect,disabledKeyboardNavigation:e.props.disabledKeyboardNavigation,renderDayContents:e.props.renderDayContents,handleOnKeyDown:e.props.handleOnKeyDown,isInputFocused:e.props.isInputFocused,containerRef:e.props.containerRef,calendarStartDay:e.props.calendarStartDay,monthShowsDuplicateDaysEnd:e.props.monthShowsDuplicateDaysEnd,monthShowsDuplicateDaysStart:e.props.monthShowsDuplicateDaysStart})),!a;){r++,s=ve.default(s,1);var i=n&&r>=6,o=!n&&!e.isWeekInMonth(s);if(i||o){if(!e.props.peekNextMonth)break;a=!0}}return t})),xt(_t(e),"onMonthClick",(function(t,n){e.handleDayClick(Zt(Fe.default(e.props.day,n)),t)})),xt(_t(e),"handleMonthNavigation",(function(t,n){e.isDisabled(n)||e.isExcluded(n)||(e.props.setPreSelection(n),e.MONTH_REFS[t].current&&e.MONTH_REFS[t].current.focus())})),xt(_t(e),"onMonthKeyDown",(function(t,n){var r=t.key;if(!e.props.disabledKeyboardNavigation)switch(r){case"Enter":e.onMonthClick(t,n),e.props.setPreSelection(e.props.selected);break;case"ArrowRight":e.handleMonthNavigation(11===n?0:n+1,be.default(e.props.preSelection,1));break;case"ArrowLeft":e.handleMonthNavigation(0===n?11:n-1,je.default(e.props.preSelection,1))}})),xt(_t(e),"onQuarterClick",(function(t,n){e.handleDayClick(Wt(qe.default(e.props.day,n)),t)})),xt(_t(e),"getMonthClassNames",(function(t){var n=e.props,r=n.day,a=n.startDate,s=n.endDate,i=n.selected,o=n.minDate,l=n.maxDate,c=n.preSelection,d=n.monthClassName,u=d?d(r):void 0;return ue.default("react-datepicker__month-text","react-datepicker__month-".concat(t),u,{"react-datepicker__month--disabled":(o||l)&&an(Fe.default(r,t),e.props),"react-datepicker__month--selected":e.isSelectedMonth(r,t,i),"react-datepicker__month-text--keyboard-selected":Ee.default(c)===t,"react-datepicker__month--in-range":sn(a,s,t,r),"react-datepicker__month--range-start":e.isRangeStartMonth(t),"react-datepicker__month--range-end":e.isRangeEndMonth(t),"react-datepicker__month-text--today":e.isCurrentMonth(r,t)})})),xt(_t(e),"getTabIndex",(function(t){var n=Ee.default(e.props.preSelection);return e.props.disabledKeyboardNavigation||t!==n?"-1":"0"})),xt(_t(e),"getAriaLabel",(function(t){var n=e.props,r=n.ariaLabelPrefix,a=void 0===r?"Choose":r,s=n.disabledDayAriaLabelPrefix,i=void 0===s?"Not available":s,o=n.day,l=Fe.default(o,t),c=e.isDisabled(l)||e.isExcluded(l)?i:a;return"".concat(c," ").concat(Pt(l,"MMMM yyyy"))})),xt(_t(e),"getQuarterClassNames",(function(t){var n=e.props,r=n.day,a=n.startDate,s=n.endDate,i=n.selected,o=n.minDate,l=n.maxDate;return ue.default("react-datepicker__quarter-text","react-datepicker__quarter-".concat(t),{"react-datepicker__quarter--disabled":(o||l)&&on(qe.default(r,t),e.props),"react-datepicker__quarter--selected":e.isSelectedQuarter(r,t,i),"react-datepicker__quarter--in-range":cn(a,s,t,r),"react-datepicker__quarter--range-start":e.isRangeStartQuarter(t),"react-datepicker__quarter--range-end":e.isRangeEndQuarter(t)})})),xt(_t(e),"renderMonths",(function(){var t=e.props,n=t.showFullMonthYearPicker,r=t.showTwoColumnMonthYearPicker,a=t.showFourColumnMonthYearPicker,s=t.locale,i=t.day,o=t.selected;return(a?[[0,1,2,3],[4,5,6,7],[8,9,10,11]]:r?[[0,1],[2,3],[4,5],[6,7],[8,9],[10,11]]:[[0,1,2],[3,4,5],[6,7,8],[9,10,11]]).map((function(t,r){return de.default.createElement("div",{className:"react-datepicker__month-wrapper",key:r},t.map((function(t,r){return de.default.createElement("div",{ref:e.MONTH_REFS[t],key:r,onClick:function(n){e.onMonthClick(n,t)},onKeyDown:function(n){e.onMonthKeyDown(n,t)},tabIndex:e.getTabIndex(t),className:e.getMonthClassNames(t),role:"option","aria-label":e.getAriaLabel(t),"aria-current":e.isCurrentMonth(i,t)?"date":void 0,"aria-selected":e.isSelectedMonth(i,t,o)},n?Jt(t,s):en(t,s))})))}))})),xt(_t(e),"renderQuarters",(function(){var t=e.props,n=t.day,r=t.selected;return de.default.createElement("div",{className:"react-datepicker__quarter-wrapper"},[1,2,3,4].map((function(t,a){return de.default.createElement("div",{key:a,role:"option",onClick:function(n){e.onQuarterClick(n,t)},className:e.getQuarterClassNames(t),"aria-selected":e.isSelectedQuarter(n,t,r)},tn(t,e.props.locale))})))})),xt(_t(e),"getClassNames",(function(){var t=e.props;t.day;var n=t.selectingDate,r=t.selectsStart,a=t.selectsEnd,s=t.showMonthYearPicker,i=t.showQuarterYearPicker;return ue.default("react-datepicker__month",{"react-datepicker__month--selecting-range":n&&(r||a)},{"react-datepicker__monthPicker":s},{"react-datepicker__quarterPicker":i})})),e}return gt(n,[{key:"render",value:function(){var e=this.props,t=e.showMonthYearPicker,n=e.showQuarterYearPicker,r=e.day,a=e.ariaLabelPrefix,s=void 0===a?"month ":a;return de.default.createElement("div",{className:this.getClassNames(),onMouseLeave:this.handleMouseLeave,"aria-label":"".concat(s," ").concat(Pt(r,"yyyy-MM")),role:"listbox"},t?this.renderMonths():n?this.renderQuarters():this.renderWeeks())}}]),n}(de.default.Component),qn=function(e){bt(n,e);var t=St(n);function n(){var e;ht(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return xt(_t(e=t.call.apply(t,[this].concat(a))),"state",{height:null}),xt(_t(e),"handleClick",(function(t){(e.props.minTime||e.props.maxTime)&&mn(t,e.props)||(e.props.excludeTimes||e.props.includeTimes||e.props.filterTime)&&pn(t,e.props)||e.props.onChange(t)})),xt(_t(e),"isSelectedTime",(function(t,n,r){return e.props.selected&&n===Te.default(t)&&r===Ce.default(t)})),xt(_t(e),"liClasses",(function(t,n,r){var a=["react-datepicker__time-list-item",e.props.timeClassName?e.props.timeClassName(t,n,r):void 0];return e.isSelectedTime(t,n,r)&&a.push("react-datepicker__time-list-item--selected"),((e.props.minTime||e.props.maxTime)&&mn(t,e.props)||(e.props.excludeTimes||e.props.includeTimes||e.props.filterTime)&&pn(t,e.props))&&a.push("react-datepicker__time-list-item--disabled"),e.props.injectTimes&&(60*Te.default(t)+Ce.default(t))%e.props.intervals!=0&&a.push("react-datepicker__time-list-item--injected"),a.join(" ")})),xt(_t(e),"handleOnKeyDown",(function(t,n){" "===t.key&&(t.preventDefault(),t.key="Enter"),"Enter"===t.key&&e.handleClick(n),e.props.handleOnKeyDown(t)})),xt(_t(e),"renderTimes",(function(){for(var t=[],n=e.props.format?e.props.format:"p",r=e.props.intervals,a=$t(At(e.props.selected)),s=1440/r,i=e.props.injectTimes&&e.props.injectTimes.sort((function(e,t){return e-t})),o=e.props.selected||e.props.openToDate||At(),l=Te.default(o),c=Ce.default(o),d=Le.default(Me.default(a,c),l),u=0;u<s;u++){var p=fe.default(a,u*r);if(t.push(p),i){var m=wn(a,p,u,r,i);t=t.concat(m)}}return t.map((function(t,r){return de.default.createElement("li",{key:r,onClick:e.handleClick.bind(_t(e),t),className:e.liClasses(t,l,c),ref:function(n){(at.default(t,d)||Gt(t,d))&&(e.centerLi=n)},onKeyDown:function(n){e.handleOnKeyDown(n,t)},tabIndex:"0","aria-selected":e.isSelectedTime(t,l,c)?"true":void 0},Pt(t,n,e.props.locale))}))})),e}return gt(n,[{key:"componentDidMount",value:function(){this.list.scrollTop=n.calcCenterPosition(this.props.monthRef?this.props.monthRef.clientHeight-this.header.clientHeight:this.list.clientHeight,this.centerLi),this.props.monthRef&&this.header&&this.setState({height:this.props.monthRef.clientHeight-this.header.clientHeight})}},{key:"render",value:function(){var e=this,t=this.state.height;return de.default.createElement("div",{className:"react-datepicker__time-container ".concat(this.props.todayButton?"react-datepicker__time-container--with-today-button":"")},de.default.createElement("div",{className:"react-datepicker__header react-datepicker__header--time ".concat(this.props.showTimeSelectOnly?"react-datepicker__header--time--only":""),ref:function(t){e.header=t}},de.default.createElement("div",{className:"react-datepicker-time__header"},this.props.timeCaption)),de.default.createElement("div",{className:"react-datepicker__time"},de.default.createElement("div",{className:"react-datepicker__time-box"},de.default.createElement("ul",{className:"react-datepicker__time-list",ref:function(t){e.list=t},style:t?{height:t}:{},tabIndex:"0"},this.renderTimes()))))}}],[{key:"defaultProps",get:function(){return{intervals:30,onTimeChange:function(){},todayButton:null,timeCaption:"Time"}}}]),n}(de.default.Component);xt(qn,"calcCenterPosition",(function(e,t){return t.offsetTop-(e/2-t.clientHeight/2)}));var $n=function(e){bt(n,e);var t=St(n);function n(e){var r;return ht(this,n),xt(_t(r=t.call(this,e)),"YEAR_REFS",It(Array(r.props.yearItemNumber)).map((function(){return de.default.createRef()}))),xt(_t(r),"isDisabled",(function(e){return nn(e,r.props)})),xt(_t(r),"isExcluded",(function(e){return rn(e,r.props)})),xt(_t(r),"updateFocusOnPaginate",(function(e){var t=function(){this.YEAR_REFS[e].current.focus()}.bind(_t(r));window.requestAnimationFrame(t)})),xt(_t(r),"handleYearClick",(function(e,t){r.props.onDayClick&&r.props.onDayClick(e,t)})),xt(_t(r),"handleYearNavigation",(function(e,t){var n=r.props,a=n.date,s=n.yearItemNumber,i=jn(a,s).startPeriod;r.isDisabled(t)||r.isExcluded(t)||(r.props.setPreSelection(t),e-i==-1?r.updateFocusOnPaginate(s-1):e-i===s?r.updateFocusOnPaginate(0):r.YEAR_REFS[e-i].current.focus())})),xt(_t(r),"isSameDay",(function(e,t){return zt(e,t)})),xt(_t(r),"isCurrentYear",(function(e){return e===Oe.default(At())})),xt(_t(r),"isKeyboardSelected",(function(e){var t=Vt($e.default(r.props.date,e));return!r.props.disabledKeyboardNavigation&&!r.props.inline&&!zt(t,Vt(r.props.selected))&&zt(t,Vt(r.props.preSelection))})),xt(_t(r),"onYearClick",(function(e,t){var n=r.props.date;r.handleYearClick(Vt($e.default(n,t)),e)})),xt(_t(r),"onYearKeyDown",(function(e,t){var n=e.key;if(!r.props.disabledKeyboardNavigation)switch(n){case"Enter":r.onYearClick(e,t),r.props.setPreSelection(r.props.selected);break;case"ArrowRight":r.handleYearNavigation(t+1,ye.default(r.props.preSelection,1));break;case"ArrowLeft":r.handleYearNavigation(t-1,Se.default(r.props.preSelection,1))}})),xt(_t(r),"getYearClassNames",(function(e){var t=r.props,n=t.minDate,a=t.maxDate,s=t.selected;return ue.default("react-datepicker__year-text",{"react-datepicker__year-text--selected":e===Oe.default(s),"react-datepicker__year-text--disabled":(n||a)&&ln(e,r.props),"react-datepicker__year-text--keyboard-selected":r.isKeyboardSelected(e),"react-datepicker__year-text--today":r.isCurrentYear(e)})})),xt(_t(r),"getYearTabIndex",(function(e){return r.props.disabledKeyboardNavigation?"-1":e===Oe.default(r.props.preSelection)?"0":"-1"})),r}return gt(n,[{key:"render",value:function(){for(var e=this,t=[],n=this.props,r=jn(n.date,n.yearItemNumber),a=r.startPeriod,s=r.endPeriod,i=function(n){t.push(de.default.createElement("div",{ref:e.YEAR_REFS[n-a],onClick:function(t){e.onYearClick(t,n)},onKeyDown:function(t){e.onYearKeyDown(t,n)},tabIndex:e.getYearTabIndex(n),className:e.getYearClassNames(n),key:n,"aria-current":e.isCurrentYear(n)?"date":void 0},n))},o=a;o<=s;o++)i(o);return de.default.createElement("div",{className:"react-datepicker__year"},de.default.createElement("div",{className:"react-datepicker__year-wrapper"},t))}}]),n}(de.default.Component),Un=function(e){bt(n,e);var t=St(n);function n(e){var r;return ht(this,n),xt(_t(r=t.call(this,e)),"onTimeChange",(function(e){r.setState({time:e});var t=new Date;t.setHours(e.split(":")[0]),t.setMinutes(e.split(":")[1]),r.props.onChange(t)})),xt(_t(r),"renderTimeInput",(function(){var e=r.state.time,t=r.props,n=t.date,a=t.timeString,s=t.customTimeInput;return s?de.default.cloneElement(s,{date:n,value:e,onChange:r.onTimeChange}):de.default.createElement("input",{type:"time",className:"react-datepicker-time__input",placeholder:"Time",name:"time-input",required:!0,value:e,onChange:function(e){r.onTimeChange(e.target.value||a)}})})),r.state={time:r.props.timeString},r}return gt(n,[{key:"render",value:function(){return de.default.createElement("div",{className:"react-datepicker__input-time-container"},de.default.createElement("div",{className:"react-datepicker-time__caption"},this.props.timeInputLabel),de.default.createElement("div",{className:"react-datepicker-time__input-container"},de.default.createElement("div",{className:"react-datepicker-time__input"},this.renderTimeInput())))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return e.timeString!==t.time?{time:e.timeString}:null}}]),n}(de.default.Component);function Zn(e){var t=e.className,n=e.children,r=e.showPopperArrow,a=e.arrowProps,s=void 0===a?{}:a;return de.default.createElement("div",{className:t},r&&de.default.createElement("div",vt({className:"react-datepicker__triangle"},s)),n)}var Vn=["react-datepicker__year-select","react-datepicker__month-select","react-datepicker__month-year-select"],Wn=function(e){bt(n,e);var t=St(n);function n(e){var r;return ht(this,n),xt(_t(r=t.call(this,e)),"handleClickOutside",(function(e){r.props.onClickOutside(e)})),xt(_t(r),"setClickOutsideRef",(function(){return r.containerRef.current})),xt(_t(r),"handleDropdownFocus",(function(e){(function(){var e=((arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).className||"").split(/\s+/);return Vn.some((function(t){return e.indexOf(t)>=0}))})(e.target)&&r.props.onDropdownFocus()})),xt(_t(r),"getDateInView",(function(){var e=r.props,t=e.preSelection,n=e.selected,a=e.openToDate,s=vn(r.props),i=bn(r.props),o=At();return a||n||t||(s&&at.default(o,s)?s:i&&rt.default(o,i)?i:o)})),xt(_t(r),"increaseMonth",(function(){r.setState((function(e){var t=e.date;return{date:be.default(t,1)}}),(function(){return r.handleMonthChange(r.state.date)}))})),xt(_t(r),"decreaseMonth",(function(){r.setState((function(e){var t=e.date;return{date:je.default(t,1)}}),(function(){return r.handleMonthChange(r.state.date)}))})),xt(_t(r),"handleDayClick",(function(e,t,n){r.props.onSelect(e,t,n),r.props.setPreSelection&&r.props.setPreSelection(e)})),xt(_t(r),"handleDayMouseEnter",(function(e){r.setState({selectingDate:e}),r.props.onDayMouseEnter&&r.props.onDayMouseEnter(e)})),xt(_t(r),"handleMonthMouseLeave",(function(){r.setState({selectingDate:null}),r.props.onMonthMouseLeave&&r.props.onMonthMouseLeave()})),xt(_t(r),"handleYearChange",(function(e){r.props.onYearChange&&r.props.onYearChange(e),r.props.adjustDateOnChange&&(r.props.onSelect&&r.props.onSelect(e),r.props.setOpen&&r.props.setOpen(!0)),r.props.setPreSelection&&r.props.setPreSelection(e)})),xt(_t(r),"handleMonthChange",(function(e){r.props.onMonthChange&&r.props.onMonthChange(e),r.props.adjustDateOnChange&&(r.props.onSelect&&r.props.onSelect(e),r.props.setOpen&&r.props.setOpen(!0)),r.props.setPreSelection&&r.props.setPreSelection(e)})),xt(_t(r),"handleMonthYearChange",(function(e){r.handleYearChange(e),r.handleMonthChange(e)})),xt(_t(r),"changeYear",(function(e){r.setState((function(t){var n=t.date;return{date:$e.default(n,e)}}),(function(){return r.handleYearChange(r.state.date)}))})),xt(_t(r),"changeMonth",(function(e){r.setState((function(t){var n=t.date;return{date:Fe.default(n,e)}}),(function(){return r.handleMonthChange(r.state.date)}))})),xt(_t(r),"changeMonthYear",(function(e){r.setState((function(t){var n=t.date;return{date:$e.default(Fe.default(n,Ee.default(e)),Oe.default(e))}}),(function(){return r.handleMonthYearChange(r.state.date)}))})),xt(_t(r),"header",(function(){var e=Ut(arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.state.date,r.props.locale,r.props.calendarStartDay),t=[];return r.props.showWeekNumbers&&t.push(de.default.createElement("div",{key:"W",className:"react-datepicker__day-name"},r.props.weekLabel||"#")),t.concat([0,1,2,3,4,5,6].map((function(t){var n=xe.default(e,t),a=r.formatWeekday(n,r.props.locale),s=r.props.weekDayClassName?r.props.weekDayClassName(n):void 0;return de.default.createElement("div",{key:t,className:ue.default("react-datepicker__day-name",s)},a)})))})),xt(_t(r),"formatWeekday",(function(e,t){return r.props.formatWeekDay?function(e,t,n){return t(Pt(e,"EEEE",n))}(e,r.props.formatWeekDay,t):r.props.useWeekdaysShort?function(e,t){return Pt(e,"EEE",t)}(e,t):function(e,t){return Pt(e,"EEEEEE",t)}(e,t)})),xt(_t(r),"decreaseYear",(function(){r.setState((function(e){var t=e.date;return{date:Se.default(t,r.props.showYearPicker?r.props.yearItemNumber:1)}}),(function(){return r.handleYearChange(r.state.date)}))})),xt(_t(r),"renderPreviousButton",(function(){if(!r.props.renderCustomHeader){var e;switch(!0){case r.props.showMonthYearPicker:e=gn(r.state.date,r.props);break;case r.props.showYearPicker:e=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,r=t.yearItemNumber,a=void 0===r?Dt:r,s=jn(Vt(Se.default(e,a)),a).endPeriod,i=n&&Oe.default(n);return i&&i>s||!1}(r.state.date,r.props);break;default:e=hn(r.state.date,r.props)}if((r.props.forceShowMonthNavigation||r.props.showDisabledMonthNavigation||!e)&&!r.props.showTimeSelectOnly){var t=["react-datepicker__navigation","react-datepicker__navigation--previous"],n=r.decreaseMonth;(r.props.showMonthYearPicker||r.props.showQuarterYearPicker||r.props.showYearPicker)&&(n=r.decreaseYear),e&&r.props.showDisabledMonthNavigation&&(t.push("react-datepicker__navigation--previous--disabled"),n=null);var a=r.props.showMonthYearPicker||r.props.showQuarterYearPicker||r.props.showYearPicker,s=r.props,i=s.previousMonthButtonLabel,o=s.previousYearButtonLabel,l=r.props,c=l.previousMonthAriaLabel,d=void 0===c?"string"==typeof i?i:"Previous Month":c,u=l.previousYearAriaLabel,p=void 0===u?"string"==typeof o?o:"Previous Year":u;return de.default.createElement("button",{type:"button",className:t.join(" "),onClick:n,onKeyDown:r.props.handleOnKeyDown,"aria-label":a?p:d},de.default.createElement("span",{className:["react-datepicker__navigation-icon","react-datepicker__navigation-icon--previous"].join(" ")},a?r.props.previousYearButtonLabel:r.props.previousMonthButtonLabel))}}})),xt(_t(r),"increaseYear",(function(){r.setState((function(e){var t=e.date;return{date:ye.default(t,r.props.showYearPicker?r.props.yearItemNumber:1)}}),(function(){return r.handleYearChange(r.state.date)}))})),xt(_t(r),"renderNextButton",(function(){if(!r.props.renderCustomHeader){var e;switch(!0){case r.props.showMonthYearPicker:e=xn(r.state.date,r.props);break;case r.props.showYearPicker:e=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.maxDate,r=t.yearItemNumber,a=void 0===r?Dt:r,s=jn(ye.default(e,a),a).startPeriod,i=n&&Oe.default(n);return i&&i<s||!1}(r.state.date,r.props);break;default:e=fn(r.state.date,r.props)}if((r.props.forceShowMonthNavigation||r.props.showDisabledMonthNavigation||!e)&&!r.props.showTimeSelectOnly){var t=["react-datepicker__navigation","react-datepicker__navigation--next"];r.props.showTimeSelect&&t.push("react-datepicker__navigation--next--with-time"),r.props.todayButton&&t.push("react-datepicker__navigation--next--with-today-button");var n=r.increaseMonth;(r.props.showMonthYearPicker||r.props.showQuarterYearPicker||r.props.showYearPicker)&&(n=r.increaseYear),e&&r.props.showDisabledMonthNavigation&&(t.push("react-datepicker__navigation--next--disabled"),n=null);var a=r.props.showMonthYearPicker||r.props.showQuarterYearPicker||r.props.showYearPicker,s=r.props,i=s.nextMonthButtonLabel,o=s.nextYearButtonLabel,l=r.props,c=l.nextMonthAriaLabel,d=void 0===c?"string"==typeof i?i:"Next Month":c,u=l.nextYearAriaLabel,p=void 0===u?"string"==typeof o?o:"Next Year":u;return de.default.createElement("button",{type:"button",className:t.join(" "),onClick:n,onKeyDown:r.props.handleOnKeyDown,"aria-label":a?p:d},de.default.createElement("span",{className:["react-datepicker__navigation-icon","react-datepicker__navigation-icon--next"].join(" ")},a?r.props.nextYearButtonLabel:r.props.nextMonthButtonLabel))}}})),xt(_t(r),"renderCurrentMonth",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.state.date,t=["react-datepicker__current-month"];return r.props.showYearDropdown&&t.push("react-datepicker__current-month--hasYearDropdown"),r.props.showMonthDropdown&&t.push("react-datepicker__current-month--hasMonthDropdown"),r.props.showMonthYearDropdown&&t.push("react-datepicker__current-month--hasMonthYearDropdown"),de.default.createElement("div",{className:t.join(" ")},Pt(e,r.props.dateFormat,r.props.locale))})),xt(_t(r),"renderYearDropdown",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(r.props.showYearDropdown&&!e)return de.default.createElement(Tn,{adjustDateOnChange:r.props.adjustDateOnChange,date:r.state.date,onSelect:r.props.onSelect,setOpen:r.props.setOpen,dropdownMode:r.props.dropdownMode,onChange:r.changeYear,minDate:r.props.minDate,maxDate:r.props.maxDate,year:Oe.default(r.state.date),scrollableYearDropdown:r.props.scrollableYearDropdown,yearDropdownItemNumber:r.props.yearDropdownItemNumber})})),xt(_t(r),"renderMonthDropdown",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(r.props.showMonthDropdown&&!e)return de.default.createElement(Dn,{dropdownMode:r.props.dropdownMode,locale:r.props.locale,onChange:r.changeMonth,month:Ee.default(r.state.date),useShortMonthInDropdown:r.props.useShortMonthInDropdown})})),xt(_t(r),"renderMonthYearDropdown",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(r.props.showMonthYearDropdown&&!e)return de.default.createElement(Rn,{dropdownMode:r.props.dropdownMode,locale:r.props.locale,dateFormat:r.props.dateFormat,onChange:r.changeMonthYear,minDate:r.props.minDate,maxDate:r.props.maxDate,date:r.state.date,scrollableMonthYearDropdown:r.props.scrollableMonthYearDropdown})})),xt(_t(r),"renderTodayButton",(function(){if(r.props.todayButton&&!r.props.showTimeSelectOnly)return de.default.createElement("div",{className:"react-datepicker__today-button",onClick:function(e){return r.props.onSelect(Be.default(At()),e)}},r.props.todayButton)})),xt(_t(r),"renderDefaultHeader",(function(e){var t=e.monthDate,n=e.i;return de.default.createElement("div",{className:"react-datepicker__header ".concat(r.props.showTimeSelect?"react-datepicker__header--has-time-select":"")},r.renderCurrentMonth(t),de.default.createElement("div",{className:"react-datepicker__header__dropdown react-datepicker__header__dropdown--".concat(r.props.dropdownMode),onFocus:r.handleDropdownFocus},r.renderMonthDropdown(0!==n),r.renderMonthYearDropdown(0!==n),r.renderYearDropdown(0!==n)),de.default.createElement("div",{className:"react-datepicker__day-names"},r.header(t)))})),xt(_t(r),"renderCustomHeader",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.monthDate,n=e.i;if(r.props.showTimeSelect&&!r.state.monthContainer||r.props.showTimeSelectOnly)return null;var a=hn(r.state.date,r.props),s=fn(r.state.date,r.props),i=gn(r.state.date,r.props),o=xn(r.state.date,r.props),l=!r.props.showMonthYearPicker&&!r.props.showQuarterYearPicker&&!r.props.showYearPicker;return de.default.createElement("div",{className:"react-datepicker__header react-datepicker__header--custom",onFocus:r.props.onDropdownFocus},r.props.renderCustomHeader(pt(pt({},r.state),{},{customHeaderCount:n,monthDate:t,changeMonth:r.changeMonth,changeYear:r.changeYear,decreaseMonth:r.decreaseMonth,increaseMonth:r.increaseMonth,decreaseYear:r.decreaseYear,increaseYear:r.increaseYear,prevMonthButtonDisabled:a,nextMonthButtonDisabled:s,prevYearButtonDisabled:i,nextYearButtonDisabled:o})),l&&de.default.createElement("div",{className:"react-datepicker__day-names"},r.header(t)))})),xt(_t(r),"renderYearHeader",(function(){var e=r.state.date,t=r.props,n=t.showYearPicker,a=jn(e,t.yearItemNumber),s=a.startPeriod,i=a.endPeriod;return de.default.createElement("div",{className:"react-datepicker__header react-datepicker-year-header"},n?"".concat(s," - ").concat(i):Oe.default(e))})),xt(_t(r),"renderHeader",(function(e){switch(!0){case void 0!==r.props.renderCustomHeader:return r.renderCustomHeader(e);case r.props.showMonthYearPicker||r.props.showQuarterYearPicker||r.props.showYearPicker:return r.renderYearHeader(e);default:return r.renderDefaultHeader(e)}})),xt(_t(r),"renderMonths",(function(){if(!r.props.showTimeSelectOnly&&!r.props.showYearPicker){for(var e=[],t=r.props.showPreviousMonths?r.props.monthsShown-1:0,n=je.default(r.state.date,t),a=0;a<r.props.monthsShown;++a){var s=a-r.props.monthSelectedIn,i=be.default(n,s),o="month-".concat(a),l=a<r.props.monthsShown-1,c=a>0;e.push(de.default.createElement("div",{key:o,ref:function(e){r.monthContainer=e},className:"react-datepicker__month-container"},r.renderHeader({monthDate:i,i:a}),de.default.createElement(Fn,{chooseDayAriaLabelPrefix:r.props.chooseDayAriaLabelPrefix,disabledDayAriaLabelPrefix:r.props.disabledDayAriaLabelPrefix,weekAriaLabelPrefix:r.props.weekAriaLabelPrefix,onChange:r.changeMonthYear,day:i,dayClassName:r.props.dayClassName,calendarStartDay:r.props.calendarStartDay,monthClassName:r.props.monthClassName,onDayClick:r.handleDayClick,handleOnKeyDown:r.props.handleOnDayKeyDown,onDayMouseEnter:r.handleDayMouseEnter,onMouseLeave:r.handleMonthMouseLeave,onWeekSelect:r.props.onWeekSelect,orderInDisplay:a,formatWeekNumber:r.props.formatWeekNumber,locale:r.props.locale,minDate:r.props.minDate,maxDate:r.props.maxDate,excludeDates:r.props.excludeDates,excludeDateIntervals:r.props.excludeDateIntervals,highlightDates:r.props.highlightDates,selectingDate:r.state.selectingDate,includeDates:r.props.includeDates,includeDateIntervals:r.props.includeDateIntervals,inline:r.props.inline,shouldFocusDayInline:r.props.shouldFocusDayInline,fixedHeight:r.props.fixedHeight,filterDate:r.props.filterDate,preSelection:r.props.preSelection,setPreSelection:r.props.setPreSelection,selected:r.props.selected,selectsStart:r.props.selectsStart,selectsEnd:r.props.selectsEnd,selectsRange:r.props.selectsRange,selectsDisabledDaysInRange:r.props.selectsDisabledDaysInRange,showWeekNumbers:r.props.showWeekNumbers,startDate:r.props.startDate,endDate:r.props.endDate,peekNextMonth:r.props.peekNextMonth,setOpen:r.props.setOpen,shouldCloseOnSelect:r.props.shouldCloseOnSelect,renderDayContents:r.props.renderDayContents,disabledKeyboardNavigation:r.props.disabledKeyboardNavigation,showMonthYearPicker:r.props.showMonthYearPicker,showFullMonthYearPicker:r.props.showFullMonthYearPicker,showTwoColumnMonthYearPicker:r.props.showTwoColumnMonthYearPicker,showFourColumnMonthYearPicker:r.props.showFourColumnMonthYearPicker,showYearPicker:r.props.showYearPicker,show
|