403Webshell
Server IP : 104.21.14.103  /  Your IP : 3.15.25.159
Web Server : LiteSpeed
System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : giankuin ( 1871)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/self/root/proc/thread-self/root/proc/thread-self/root/home/giankuin/thietke365.net/wp-content/plugins/mailpoet/assets/dist/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/proc/thread-self/root/proc/thread-self/root/home/giankuin/thietke365.net/wp-content/plugins/mailpoet/assets/dist/js//admin.js
/*! For license information please see admin.js.LICENSE.txt */
(globalThis.webpackChunk=globalThis.webpackChunk||[]).push([[328],{49868:()=>{jQuery.AsyncQueue=function(){var e,t,n,a,s=this,r=[],o=!1;return a=function(){var e=r.shift();e?(e.apply(s,[s]),!1===o&&a()):t&&t.apply(s)},this.onFailure=function(t){e=t},this.onComplete=function(e){t=e},this.add=function(e){return r.push(e),this},this.storeData=function(e){return n=e,this},this.lastCallbackData=function(){return n},this.run=function(){o=!1,a()},this.pause=function(){return o=!0,this},this.failure=function(){if(o=!0,e){var t=[s];for(i=0;i<arguments.length;i++)t.push(arguments[i]);e.apply(s,t)}},this}},83653:(e,t,n)=>{e.exports={Experiment:n(54160).Z,Variant:n(95776).Z,emitter:n(91414).default,useExperiment:n(81116).default,experimentDebugger:n(11446),mixpanelHelper:n(80773).Z,segmentHelper:n(43013).Z}},82335:(e,t,n)=>{"use strict";function a(e){return a="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},a(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!==a(e)&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var i={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if("default"!==r&&Object.prototype.hasOwnProperty.call(e,r)){var o=s?Object.getOwnPropertyDescriptor(e,r):null;o&&(o.get||o.set)?Object.defineProperty(i,r,o):i[r]=e[r]}return i.default=e,n&&n.set(e,i),i}(n(70079)),s=l(n(39519)),r=l(n(81116)),o=l(n(91414));function l(e){return e&&e.__esModule?e:{default:e}}function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}var d=function(e){var t=(0,i.useMemo)((function(){return function(e,t){var n={};return i.default.Children.forEach(t,(function(t){if(!i.default.isValidElement(t)||"Pushtell.Variant"!==t.type.displayName){var a=new Error("Pushtell Experiment children must be Pushtell Variant components.");throw a.type="PUSHTELL_INVALID_CHILD",a}n[t.props.name]=t,o.default.addExperimentVariant(e,t.props.name)})),o.default.emit("variants-loaded",e),n}(e.name,e.children)}),[e.name,e.children]);return(0,(0,r.default)(e.name,e.userIdentifier,e.defaultVariantName).selectVariant)(t,[])};d.propTypes={name:s.default.string.isRequired,userIdentifier:s.default.string,defaultVariantName:s.default.string,children:s.default.node};var p=d;t.default=p},54160:(e,t,n)=>{"use strict";function a(e){return a="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},a(e)}t.Z=void 0;var i=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!==a(e)&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var i={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if("default"!==r&&Object.prototype.hasOwnProperty.call(e,r)){var o=s?Object.getOwnPropertyDescriptor(e,r):null;o&&(o.get||o.set)?Object.defineProperty(i,r,o):i[r]=e[r]}return i.default=e,n&&n.set(e,i),i}(n(70079)),s=c(n(39519)),r=c(n(82335)),o=c(n(91414)),l=c(n(70935));function c(e){return e&&e.__esModule?e:{default:e}}function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}function p(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function u(e,t){return u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},u(e,t)}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}o.default.addActiveVariantListener((function(e,t,n){n||l.default.setItem("PUSHTELL-"+e,t)}));var g=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t)}(d,e);var t,n,s,l,c=(s=d,l=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}}(),function(){var e,t=h(s);if(l){var n=h(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){return!t||"object"!==a(t)&&"function"!=typeof t?m(e):t}(this,e)});function d(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,d);for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return f(m(e=c.call.apply(c,[this].concat(n))),"win",(function(){o.default.emitWin(e.props.name)})),e}return t=d,(n=[{key:"render",value:function(){return i.default.createElement(r.default,this.props,this.props.children)}}])&&p(t.prototype,n),d}(i.Component);t.Z=g,f(g,"propTypes",{name:s.default.string.isRequired,defaultVariantName:s.default.string,userIdentifier:s.default.string,children:s.default.node}),f(g,"displayName","Pushtell.Experiment")},95776:(e,t,n)=>{"use strict";function a(e){return a="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},a(e)}t.Z=void 0;var i,s=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!==a(e)&&"function"!=typeof e)return{default:e};var n=o(t);if(n&&n.has(e))return n.get(e);var i={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if("default"!==r&&Object.prototype.hasOwnProperty.call(e,r)){var l=s?Object.getOwnPropertyDescriptor(e,r):null;l&&(l.get||l.set)?Object.defineProperty(i,r,l):i[r]=e[r]}return i.default=e,n&&n.set(e,i),i}(n(70079)),r=(i=n(39519))&&i.__esModule?i:{default:i};function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(o=function(e){return e?n:t})(e)}function l(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function c(e,t){return c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},c(e,t)}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function p(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var u=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&c(e,t)}(p,e);var t,n,i,r,o=(i=p,r=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}}(),function(){var e,t=d(i);if(r){var n=d(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){return!t||"object"!==a(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}(this,e)});function p(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,p),o.apply(this,arguments)}return t=p,(n=[{key:"render",value:function(){return s.default.isValidElement(this.props.children)?this.props.children:s.default.createElement("span",null,this.props.children)}}])&&l(t.prototype,n),p}(s.Component);t.Z=u,p(u,"propTypes",{name:r.default.string.isRequired}),p(u,"displayName","Pushtell.Variant")},49382:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=r(n(13003)),i=r(n(91414)),s=r(n(70935));function r(e){return e&&e.__esModule?e:{default:e}}var o=function(e,t){for(var n=i.default.getSortedVariants(e),s=i.default.getSortedVariantWeights(e),r=s.reduce((function(e,t){return e+t}),0),o="string"==typeof t?Math.abs((0,a.default)(t)%r):Math.floor(Math.random()*r),l=n[n.length-1],c=0;c<s.length;c++)if((o-=s[c])<0){l=n[c];break}return i.default.setActiveVariant(e,l),l};t.default=function(e,t,n){if("string"==typeof t)return o(e,t);var a=i.default.getActiveVariant(e);if("string"==typeof a)return a;var r=s.default.getItem("PUSHTELL-"+e);return"string"==typeof r?(i.default.setActiveVariant(e,r,!0),r):"string"==typeof n?(i.default.setActiveVariant(e,n),n):o(e)}},11446:(e,t,n)=>{"use strict";function a(e){return a="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},a(e)}var i=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!==a(e)&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var i={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if("default"!==r&&Object.prototype.hasOwnProperty.call(e,r)){var o=s?Object.getOwnPropertyDescriptor(e,r):null;o&&(o.get||o.set)?Object.defineProperty(i,r,o):i[r]=e[r]}return i.default=e,n&&n.set(e,i),i}(n(70079)),s=l(n(99581)),r=l(n(91414)),o=n(35245);function l(e){return e&&e.__esModule?e:{default:e}}function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}function d(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function p(e,t){return p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},p(e,t)}function u(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function m(e){return m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},m(e)}function h(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var f=!1,g=null,x=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}(c,e);var t,n,s,o,l=(s=c,o=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}}(),function(){var e,t=m(s);if(o){var n=m(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){return!t||"object"!==a(t)&&"function"!=typeof t?u(e):t}(this,e)});function c(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c);for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return h(u(e=l.call.apply(l,[this].concat(n))),"state",{experiments:r.default.getActiveExperiments(),visible:!1}),h(u(e),"toggleVisibility",(function(){e.setState({visible:!e.state.visible})})),h(u(e),"updateExperiments",(function(){e.setState({experiments:r.default.getActiveExperiments()})})),e}return t=c,(n=[{key:"setActiveVariant",value:function(e,t){r.default.setActiveVariant(e,t)}},{key:"componentDidMount",value:function(){this.activeSubscription=r.default.addListener("active",this.updateExperiments),this.inactiveSubscription=r.default.addListener("inactive",this.updateExperiments)}},{key:"componentWillUnmount",value:function(){this.activeSubscription.remove(),this.inactiveSubscription.remove()}},{key:"render",value:function(){var e=this,t=Object.keys(this.state.experiments);return this.state.visible?i.default.createElement("div",{className:"pushtell-container pushtell-panel"},i.default.createElement("div",{className:"pushtell-close",onClick:this.toggleVisibility},"×"),t.map((function(t){var n=Object.keys(e.state.experiments[t]);if(0!==n.length)return i.default.createElement("div",{className:"pushtell-experiment",key:t},i.default.createElement("div",{className:"pushtell-experiment-name"},t),i.default.createElement("ul",null,n.map((function(n){return i.default.createElement("li",{key:n},i.default.createElement("label",{className:e.state.experiments[t][n]?"active":null,onClick:e.setActiveVariant.bind(e,t,n)},i.default.createElement("input",{type:"radio",name:t,value:n,defaultChecked:e.state.experiments[t][n]}),n))}))))})),i.default.createElement("div",{className:"pushtell-production-build-note"},"This panel is hidden on production builds.")):t.length>0?i.default.createElement("div",{className:"pushtell-container pushtell-handle",onClick:this.toggleVisibility},t.length," Active Experiment",t.length>1?"s":""):null}}])&&d(t.prototype,n),c}(i.Component);e.exports={setDebuggerAvailable:function(e){f=e},enable:function(){if(f&&o.canUseDOM){!function(){function e(e,t){"insertRule"in g.sheet?g.sheet.insertRule(e+"{"+t+"}",0):"addRule"in g.sheet&&g.sheet.addRule(e,t,0)}(g=document.createElement("style")).appendChild(document.createTextNode("")),document.head.appendChild(g),e("#pushtell-debugger","z-index: 25000"),e("#pushtell-debugger","position: fixed"),e("#pushtell-debugger","transform: translateX(-50%)"),e("#pushtell-debugger","bottom: 0"),e("#pushtell-debugger","left: 50%"),e("#pushtell-debugger ul","margin: 0"),e("#pushtell-debugger ul","padding: 0 0 0 20px"),e("#pushtell-debugger li","margin: 0"),e("#pushtell-debugger li","padding: 0"),e("#pushtell-debugger li","font-size: 14px"),e("#pushtell-debugger li","line-height: 14px"),e("#pushtell-debugger input","float: left"),e("#pushtell-debugger input","margin: 0 10px 0 0"),e("#pushtell-debugger input","padding: 0"),e("#pushtell-debugger input","cursor: pointer"),e("#pushtell-debugger label","color: #999999"),e("#pushtell-debugger label","margin: 0 0 10px 0"),e("#pushtell-debugger label","cursor: pointer"),e("#pushtell-debugger label","font-weight: normal"),e("#pushtell-debugger label.active","color: #000000"),e("#pushtell-debugger .pushtell-experiment-name","font-size: 16px"),e("#pushtell-debugger .pushtell-experiment-name","color: #000000"),e("#pushtell-debugger .pushtell-experiment-name","margin: 0 0 10px 0"),e("#pushtell-debugger .pushtell-production-build-note","font-size: 10px"),e("#pushtell-debugger .pushtell-production-build-note","color: #999999"),e("#pushtell-debugger .pushtell-production-build-note","text-align: center"),e("#pushtell-debugger .pushtell-production-build-note","margin: 10px -40px 0 -10px"),e("#pushtell-debugger .pushtell-production-build-note","border-top: 1px solid #b3b3b3"),e("#pushtell-debugger .pushtell-production-build-note","padding: 10px 10px 5px 10px"),e("#pushtell-debugger .pushtell-handle","cursor: pointer"),e("#pushtell-debugger .pushtell-handle","padding: 5px 10px 5px 10px"),e("#pushtell-debugger .pushtell-panel","padding: 15px 40px 5px 10px"),e("#pushtell-debugger .pushtell-container","font-size: 11px"),e("#pushtell-debugger .pushtell-container","background-color: #ebebeb"),e("#pushtell-debugger .pushtell-container","color: #000000"),e("#pushtell-debugger .pushtell-container","box-shadow: 0px 0 5px rgba(0, 0, 0, 0.1)"),e("#pushtell-debugger .pushtell-container","border-top: 1px solid #b3b3b3"),e("#pushtell-debugger .pushtell-container","border-left: 1px solid #b3b3b3"),e("#pushtell-debugger .pushtell-container","border-right: 1px solid #b3b3b3"),e("#pushtell-debugger .pushtell-container","border-top-left-radius: 2px"),e("#pushtell-debugger .pushtell-container","border-top-right-radius: 2px"),e("#pushtell-debugger .pushtell-close","cursor: pointer"),e("#pushtell-debugger .pushtell-close","font-size: 16px"),e("#pushtell-debugger .pushtell-close","font-weight: bold"),e("#pushtell-debugger .pushtell-close","color: #CC0000"),e("#pushtell-debugger .pushtell-close","position: absolute"),e("#pushtell-debugger .pushtell-close","top: 0px"),e("#pushtell-debugger .pushtell-close","right: 7px"),e("#pushtell-debugger .pushtell-close:hover","color: #FF0000"),e("#pushtell-debugger .pushtell-close, #pushtell-debugger label","transition: all .25s")}();var e=document.getElementsByTagName("body")[0],t=document.createElement("div");t.id="pushtell-debugger",e.appendChild(t),s.default.render(i.default.createElement(x,null),t)}},disable:function(){if(f&&o.canUseDOM){null!==g&&(document.head.removeChild(g),g=null);var e=document.getElementsByTagName("body")[0],t=document.getElementById("pushtell-debugger");t&&(s.default.unmountComponentAtNode(t),e.removeChild(t))}}}},91414:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a,i=n(71248),s=(a=n(49382))&&a.__esModule?a:{default:a},r={},o={},l={},c={},d={},p={},u=void 0,m=new i.EventEmitter,h=function(){};h.prototype.emitWin=function(e){if("string"!=typeof e)throw new Error("Required argument 'experimentName' should have type 'string'");m.emit("win",e,r[e])},h.prototype._emitPlay=function(e,t){if("string"!=typeof e)throw new Error("Required argument 'experimentName' should have type 'string'");if("string"!=typeof t)throw new Error("Required argument 'variantName' should have type 'string'");p[e]||(m.emit("play",e,t),p[e]=!0)},h.prototype._resetPlayedExperiments=function(){r={},p={}},h.prototype._reset=function(){r={},o={},l={},c={},d={},p={},u=void 0},h.prototype.rewind=function(){this._reset(),m.removeAllListeners()},h.prototype._incrementActiveExperiments=function(e){c[e]=c[e]||0,c[e]+=1,m.emit("active",e)},h.prototype._decrementActiveExperiments=function(e){c[e]-=1,m.emit("inactive",e)},h.prototype.addActiveVariantListener=function(e,t){return"function"==typeof e?(t=e,m.addListener("active-variant",(function(e,n,a){t(e,n,a)}))):m.addListener("active-variant",(function(n,a,i){n===e&&t(n,a,i)}))},h.prototype.emit=function(){return m.emit.apply(m,arguments)},h.prototype.addListener=function(e,t){return m.addListener(e,t)},h.prototype.once=function(e,t){return m.once(e,t)},h.prototype.addPlayListener=function(e,t){return"function"==typeof e?(t=e,m.addListener("play",(function(e,n){t(e,n)}))):m.addListener("play",(function(n,a){n===e&&t(n,a)}))},h.prototype.addWinListener=function(e,t){return"function"==typeof e?(t=e,m.addListener("win",(function(e,n){t(e,n)}))):m.addListener("win",(function(n,a){n===e&&t(n,a)}))},h.prototype.setCustomDistributionAlgorithm=function(e){u=e},h.prototype.defineVariants=function(e,t,n){var a={},i={};if(t.forEach((function(e){a[e]=!0})),Array.isArray(n)){if(t.length!==n.length)throw new Error("Required argument 'variantNames' should have the same number of elements as optional argument 'variantWeights'");t.forEach((function(e,t){if("number"!=typeof n[t])throw new Error("Optional argument 'variantWeights' should be an array of numbers.");i[e]=n[t]}))}else t.forEach((function(e,t){i[e]=1}));l[e]=i,o[e]=a,d[e]=!0},h.prototype.getSortedVariants=function(e){var t=Object.keys(o[e]);return t.sort(),t},h.prototype.getSortedVariantWeights=function(e){return this.getSortedVariants(e).map((function(t){return l[e][t]}))},h.prototype.getActiveExperiments=function(){var e={};return Object.keys(c).forEach((function(t){0!==c[t]&&(e[t]={},Object.keys(o[t]).forEach((function(n){e[t][n]=r[t]===n})))})),e},h.prototype.calculateActiveVariant=function(e,t,n){return void 0!==u?u(e,t,n):(0,s.default)(e,t,n)},h.prototype.getActiveVariant=function(e){return r[e]},h.prototype.setActiveVariant=function(e,t,n){r[e]=t,m.emit("active-variant",e,t,n)},h.prototype.addExperimentVariant=function(e,t){if(o[e]=o[e]||{},l[e]=l[e]||{},!0!==o[e][t]){if(d[e]){var n=new Error("Experiment “"+e+"” added new variants after variants were defined.");throw n.type="PUSHTELL_INVALID_VARIANT",n}if(r[e]){var a=new Error("Experiment “"+e+"” added new variants after a variant was selected. Declare the variant names using emitter.defineVariants(experimentName, variantNames).");throw a.type="PUSHTELL_INVALID_VARIANT",a}l[e][t]=1}o[e][t]=!0};var f=new h;t.default=f},80773:(e,t,n)=>{"use strict";t.Z=void 0;var a,i,s,r=(a=n(91414))&&a.__esModule?a:{default:a},o=n(35245),l={enable:function(){if(o.canUseDOM){if("undefined"==typeof mixpanel){var e=new Error("React A/B Test Mixpanel Helper: 'mixpanel' global is not defined.");throw e.type="PUSHTELL_HELPER_MISSING_GLOBAL",e}i=r.default.addPlayListener((function(e,t){mixpanel.track("Experiment Play",{Experiment:e,Variant:t},(function(){r.default.emit("mixpanel-play",e,t)}))})),s=r.default.addWinListener((function(e,t){mixpanel.track("Experiment Win",{Experiment:e,Variant:t},(function(){r.default.emit("mixpanel-win",e,t)}))}))}},disable:function(){if(o.canUseDOM){if(!i||!s){var e=new Error("React A/B Test Mixpanel Helper: Helper was not enabled.");throw e.type="PUSHTELL_HELPER_INVALID_DISABLE",e}i.remove(),s.remove()}}};t.Z=l},43013:(e,t,n)=>{"use strict";t.Z=void 0;var a,i,s,r=(a=n(91414))&&a.__esModule?a:{default:a},o=n(35245),l={enable:function(){if(o.canUseDOM){if("undefined"==typeof analytics){var e=new Error("React A/B Test Segment Helper: 'analytics' global is not defined.");throw e.type="PUSHTELL_HELPER_MISSING_GLOBAL",e}i=r.default.addPlayListener((function(e,t){analytics.track("Experiment Viewed",{experimentName:e,variationName:t},(function(){r.default.emit("segment-play",e,t)}))})),s=r.default.addWinListener((function(e,t){analytics.track("Experiment Won",{experimentName:e,variationName:t},(function(){r.default.emit("segment-win",e,t)}))}))}},disable:function(){if(o.canUseDOM){if(!i||!s){var e=new Error("React A/B Test Segment Helper: Helper was not enabled.");throw e.type="PUSHTELL_HELPER_INVALID_DISABLE",e}i.remove(),s.remove()}}};t.Z=l},81116:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a,i=n(70079),s=(a=n(91414))&&a.__esModule?a:{default:a};function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}t.default=function(e,t,n){var a,o=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null!=n){var a,i,s=[],r=!0,o=!1;try{for(n=n.call(e);!(r=(a=n.next()).done)&&(s.push(a.value),!t||s.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==n.return||n.return()}finally{if(o)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return r(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)?r(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,i.useState)(s.default.calculateActiveVariant(e,t,n)),2),l=o[0],c=o[1];return(0,i.useEffect)((function(){s.default._incrementActiveExperiments(e),s.default.setActiveVariant(e,l),s.default._emitPlay(e,l);var t=s.default.addActiveVariantListener(e,(function(t,n){t===e&&n!==l&&c(n)}));return function(){t.remove(),s.default._decrementActiveExperiments(e)}}),[e,l]),{experimentName:e,activeVariant:l,emitWin:function(){return s.default.emitWin(e)},selectVariant:(a=l,function(e,t){return a in e?e[a]:t})}}},70935:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a={getItem:function(){},setItem:function(){}};if("undefined"!=typeof window&&"localStorage"in window)try{var i="__pushtell_react__";window.localStorage.setItem(i,i),window.localStorage.getItem(i)!==i?n=a:(window.localStorage.removeItem(i),n=window.localStorage)}catch(e){n=a}else n=a;var s=n;t.default=s},55684:(e,t,n)=>{"use strict";var a={};n.r(a),n.d(a,{hideProductDiscovery:()=>O,hideTaskList:()=>D,hideUpsell:()=>A});var i={};n.r(i),n.d(i,{getCanDisplayUpsell:()=>z,getCanImportWooCommerceSubscribers:()=>M,getCurrentTask:()=>Y,getGlobalSubscriberStatsChange:()=>W,getHasForms:()=>B,getHasImportedSubscribers:()=>F,getIsProductDiscoveryDone:()=>$,getIsProductDiscoveryHidden:()=>q,getIsTaskListHidden:()=>R,getIsUpsellHidden:()=>H,getIsWooCommerceActive:()=>U,getListsSubscriberStatsChange:()=>V,getProductDiscoveryTasksStatus:()=>L,getTasksStatus:()=>P});var s=n(99581),r=n(70079),o=n(83201),l=n(45833),c=n(33014),d=n(17816),p=n(33943),u=n(30533),m=n(35250);function h(e){let{mailpoetInstalledDaysAgo:t,sendTransactionalEmails:n,mtaMethod:a,noticeDismissed:i,apiVersion:s}=e;const[o,l]=(0,r.useState)(!1),c=()=>{d.x.Ajax.post({api_version:s,endpoint:"UserFlags",action:"set",data:{transactional_emails_opt_in_notice_dismissed:"1"}})};return t<30||n||"PHPMail"===a||i||o?null:(0,m.jsxs)(u.q,{type:"success",timeout:!1,onClose:c,children:[(0,m.jsx)("h3",{children:d.x.I18n.t("transactionalEmailNoticeTitle")}),(0,m.jsxs)("p",{children:[d.x.I18n.t("transactionalEmailNoticeBody")," ",(0,m.jsx)("a",{href:"https://kb.mailpoet.com/article/292-choose-how-to-send-your-wordpress-websites-emails",target:"_blank",rel:"noopener noreferrer",children:d.x.I18n.t("transactionalEmailNoticeBodyReadMore")})]}),(0,m.jsx)("p",{children:(0,m.jsx)("button",{type:"button",className:"button",onClick:()=>{l(!0),d.x.Ajax.post({api_version:s,endpoint:"settings",action:"set",data:{send_transactional_emails:"1"}}),c()},children:d.x.I18n.t("transactionalEmailNoticeCTA")})})]})}h.displayName="TransactionalEmailsProposeOptInNotice";var f=n(37784),g=n(34352),x=n.n(g);function _(){if(!d.x.subscribersLimitReached)return null;const e=d.x.hasValidApiKey,t=d.x.subscribersLimit.toLocaleString();let n=d.x.I18n.t("subscribersLimitNoticeTitleUnknownLimit"),a=d.x.I18n.t("subscribersLimitReachedUnknownLimit"),i="";d.x.subscribersLimit&&(n=d.x.I18n.t("subscribersLimitNoticeTitle").replace("[subscribersLimit]",t),i=d.x.I18n.t(e?"yourPlanLimit":"freeVersionLimit").replace("[subscribersLimit]",t),a=d.x.I18n.t("subscribersLimitReached").replace("[subscribersLimit]",t));const s=e?d.x.MailPoetComUrlFactory.getUpgradeUrl(d.x.pluginPartialKey):d.x.MailPoetComUrlFactory.getPurchasePlanUrl(d.x.subscribersCount+1),r=x()(d.x.I18n.t("checkHowToManageSubscribers"),/\[link](.*?)\[\/link]/g,(e=>(0,m.jsx)("a",{href:"https://kb.mailpoet.com/article/348-subscribers-limit-for-sending-plans",children:e},"checkManageSubscribers")));return(0,m.jsxs)(u.q,{type:"error",timeout:!1,closable:!1,renderInPlace:!0,children:[(0,m.jsx)("h3",{children:n}),(0,m.jsxs)("p",{children:[a," ",i," ",d.x.I18n.t("youNeedToUpgrade"),(0,m.jsx)("br",{}),"active"===d.x.wpSegmentState?r:null," ",d.x.I18n.t("actToSeamlessService")]}),(0,m.jsxs)("p",{children:[(0,m.jsx)("a",{target:"_blank",rel:"noopener noreferrer",className:"button button-primary",href:s,children:d.x.I18n.t("upgradeNow")}),e&&(0,m.jsxs)(m.Fragment,{children:[" ",(0,m.jsx)("button",{type:"button",className:"button",onClick:async()=>{await d.x.Ajax.post({api_version:d.x.apiVersion,endpoint:"services",action:"recheckKeys"}),window.location.reload()},children:d.x.I18n.t("refreshMySubscribers")})]})]})]})}_.displayName="SubscribersLimitNotice";var b=n(26973);function v(){if(!d.x.emailVolumeLimitReached)return null;let e=d.x.I18n.t("emailVolumeLimitNoticeTitleUnknownLimit"),t=d.x.I18n.t("youReachedEmailVolumeLimitUnknownLimit");d.x.emailVolumeLimit&&(e=d.x.I18n.t("emailVolumeLimitNoticeTitle").replace("[emailVolumeLimit]",d.x.emailVolumeLimit.toLocaleString()),t=d.x.I18n.t("youReachedEmailVolumeLimit").replace("[emailVolumeLimit]",d.x.emailVolumeLimit.toLocaleString()));const n=d.x.MailPoetComUrlFactory.getUpgradeUrl(d.x.pluginPartialKey),a=new Date,i=new Date(a.getFullYear(),a.getMonth()+1,1);let s=x()(d.x.I18n.t("toContinueUpgradeYourPlanOrWaitUntil"),/\[link](.*?)\[\/link]/g,(e=>(0,m.jsx)("a",{target:"_blank",rel:"noreferrer",href:n,children:e},e)));return s=x()(s,/<b>\[date]<\/b>\./g,(()=>(0,b.ZP)(`<b>${d.x.Date.short(i)}</b>.`))),(0,m.jsxs)(u.q,{type:"error",timeout:!1,closable:!1,renderInPlace:!0,children:[(0,m.jsx)("h3",{children:e}),(0,m.jsxs)("p",{children:[t,(0,m.jsx)("br",{}),s]}),(0,m.jsxs)("p",{children:[(0,m.jsx)("a",{target:"_blank",rel:"noopener noreferrer",className:"button button-primary",href:n,children:d.x.I18n.t("upgradeNow")})," ",(0,m.jsx)("button",{type:"button",className:"button",onClick:async()=>{await d.x.Ajax.post({api_version:d.x.apiVersion,endpoint:"services",action:"recheckKeys"}),window.location.reload()},children:d.x.I18n.t("refreshMyEmailVolumeLimit")})]})]})}v.displayName="EmailVolumeLimitNotice";const y=(0,o.withBoundary)(v);function w(e){let{mssKeyInvalid:t,subscribersCount:n}=e;return t?(0,m.jsxs)(u.q,{type:"error",timeout:!1,closable:!1,renderInPlace:!0,children:[(0,m.jsx)("h3",{children:d.x.I18n.t("allSendingPausedHeader")}),(0,m.jsx)("p",{children:x()(d.x.I18n.t("allSendingPausedBody"),/\[link\](.*?)\[\/link\]/g,(e=>(0,m.jsx)("a",{href:"?page=mailpoet-settings#premium",children:e},"check-sending")))}),(0,m.jsx)("p",{children:(0,m.jsx)("a",{href:`https://account.mailpoet.com?s=${n}`,className:"button button-primary",target:"_blank",rel:"noopener noreferrer",children:d.x.I18n.t("allSendingPausedLink")})})]}):null}function j(){return(0,m.jsxs)(o.ErrorBoundary,{children:[d.x.subscribersLimitReached&&(0,m.jsx)(_,{}),d.x.emailVolumeLimitReached&&(0,m.jsx)(y,{}),!d.x.subscribersLimitReached&&!d.x.emailVolumeLimitReached&&(0,m.jsx)(w,{mssKeyInvalid:d.x.hasInvalidMssApiKey,subscribersCount:d.x.subscribersCount})]})}function S(){return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(p.w,{}),(0,m.jsx)(j,{}),(0,m.jsx)(h,{mailpoetInstalledDaysAgo:d.x.installedDaysAgo,sendTransactionalEmails:d.x.transactionalEmailsEnabled,mtaMethod:d.x.mtaMethod,apiVersion:d.x.apiVersion,noticeDismissed:d.x.transactionalEmailsOptInNoticeDismissed}),(0,m.jsx)(f._,{mtaLog:d.x.mtaLog,mtaMethod:d.x.mtaMethod,isInline:!0})]})}w.displayName="InvalidMssKeyNotice";var k=n(10159),N=n(66510),C=n(74457),I=n(8263),T=n(81433),E=n(83602);function*D(){return yield(0,E.t)({endpoint:"settings",action:"set",method:"POST",data:{"homepage.task_list_dismissed":!0}}),{type:"SET_TASK_LIST_HIDDEN"}}function*O(){return yield(0,E.t)({endpoint:"settings",action:"set",method:"POST",data:{"homepage.product_discovery_dismissed":!0}}),{type:"SET_PRODUCT_DISCOVERY_HIDDEN"}}function*A(){return yield(0,E.t)({endpoint:"settings",action:"set",method:"POST",data:{"homepage.upsell_dismissed":!0}}),{type:"SET_UPSELL_HIDDEN"}}function R(e){return e.taskList.isTaskListHidden}function P(e){return e.taskList.tasksStatus}function L(e){return e.productDiscovery.tasksStatus}function M(e){return e.taskList.canImportWooCommerceSubscribers}function F(e){return e.taskList.hasImportedSubscribers}function B(e){return e.formsCount>0}function q(e){return e.productDiscovery.isHidden}function W(e){return e.subscribersStats.global}function V(e){return e.subscribersStats.lists}function $(e){const t=e.productDiscovery.tasksStatus;return e.isWooCommerceActive?t.addSubscriptionForm&&t.setUpWelcomeCampaign&&t.setUpAbandonedCartEmail&&t.brandWooEmails:t.setUpWelcomeCampaign&&t.addSubscriptionForm&&t.sendFirstNewsletter}function U(e){return e.isWooCommerceActive}function Y(e){return e.taskList.tasksStatus.senderSet?e.taskList.tasksStatus.mssConnected?!e.taskList.tasksStatus.wooSubscribersImported&&e.taskList.canImportWooCommerceSubscribers?"wooSubscribersImported":e.taskList.tasksStatus.subscribersAdded?null:"subscribersAdded":"mssConnected":"senderSet"}function H(e){return e.upsell.isHidden}function z(e){var t;return null===(t=e.upsell.upsellStatus)||void 0===t?void 0:t.canDisplay}function Z(e,t){switch(t.type){case"SET_TASK_LIST_HIDDEN":return{...e,taskList:{...e.taskList,isTaskListHidden:!0}};case"SET_PRODUCT_DISCOVERY_HIDDEN":return{...e,productDiscovery:{...e.productDiscovery,isHidden:!0}};case"SET_UPSELL_HIDDEN":return{...e,upsell:{...e.upsell,isHidden:!0}};default:return e}}const K="mailpoet/homepage",G={};var Q=n(82248),X=n(71458),J=n(65443),ee=n.n(J);function te(e,t,n){d.x.trackEvent(e,{ctaLabel:t},{send_immediately:!0},(()=>{window.location.href=n}))}function ne(e){let{title:t,titleCompleted:n="",slug:a,link:i,order:s,isCompleted:r,isActive:o,children:l=null}=e;const c=ee()("mailpoet-task-list__task",{"mailpoet-task-list__task--completed":r,"mailpoet-task-list__task--active":o}),d=()=>{te("Home Page Task",a,i)};return(0,m.jsxs)("li",{className:c,role:"row",onClick:r?void 0:d,tabIndex:r?void 0:0,onKeyDown:r?void 0:e=>"Enter"===e.key&&d(),children:[(0,m.jsx)("div",{className:"mailpoet-task-list__task-before",children:(0,m.jsx)("div",{className:"mailpoet-task-list__task-icon",children:r?(0,m.jsx)(Q.Z,{icon:X.Z}):s})}),(0,m.jsxs)("div",{className:"mailpoet-task-list__task-content",children:[(0,m.jsx)("div",{className:"mailpoet-task-list__task-title",children:r&&n?n:t}),l]})]})}function ae(e){let{onHide:t}=e;const{tasksStatus:n,currentTask:a,hasImportedSubscribers:i,canImportWooCommerceSubscribers:s}=(0,k.Z)((e=>({tasksStatus:e(K).getTasksStatus(),currentTask:e(K).getCurrentTask(),hasImportedSubscribers:e(K).getHasImportedSubscribers(),canImportWooCommerceSubscribers:e(K).getCanImportWooCommerceSubscribers()})),[]),r=[];return r.push((0,m.jsx)(ne,{slug:"set sender",title:d.x.I18n.t("senderSetTask"),titleCompleted:d.x.I18n.t("senderSetTaskDone"),link:"admin.php?page=mailpoet-settings#/basics",order:1,isCompleted:n.senderSet,isActive:"senderSet"===a},"senderSet")),r.push((0,m.jsx)(ne,{slug:"connect mss",title:d.x.I18n.t("mssConnectedTask"),titleCompleted:d.x.I18n.t("mssConnectedTaskDone"),link:"admin.php?page=mailpoet-settings#/premium",order:2,isCompleted:n.mssConnected,isActive:"mssConnected"===a},"mssConnected")),s&&r.push((0,m.jsx)(ne,{slug:"import woocommerce subscribers",title:d.x.I18n.t("wooSubscribersImportedTask"),titleCompleted:d.x.I18n.t("wooSubscribersImportedTaskDone"),link:"admin.php?page=mailpoet-woocommerce-setup",order:3,isCompleted:n.wooSubscribersImported,isActive:"wooSubscribersImported"===a},"wooSubscribersImported")),r.push((0,m.jsxs)(ne,{slug:"add subscribers",title:d.x.I18n.t("subscribersAddedTask"),titleCompleted:i?d.x.I18n.t("subscribersAddedTaskDoneByImport"):d.x.I18n.t("subscribersAddedTaskDoneByForm"),link:"admin.php?page=mailpoet-import",order:s?4:3,isCompleted:n.subscribersAdded,isActive:"subscribersAdded"===a,children:[!n.subscribersAdded&&(0,m.jsxs)("p",{children:[d.x.I18n.t("noSubscribersQuestion")," ",(0,m.jsx)("a",{href:"admin.php?page=mailpoet-form-editor-template-selection",onClick:o.stopLinkPropagation,children:d.x.I18n.t("setUpForm")})]}),n.subscribersAdded&&!i&&(0,m.jsxs)("p",{children:[d.x.I18n.t("haveSubscribersQuestion")," ",(0,m.jsx)("a",{href:"admin.php?page=mailpoet-import",children:d.x.I18n.t("import")})]})]},"subscribersAdded")),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("div",{className:"mailpoet-task-list__heading",children:[(0,m.jsx)("h1",{children:d.x.I18n.t("welcomeToMailPoet")}),(0,m.jsx)("p",{children:d.x.I18n.t("beginByCompletingSetup")}),(0,m.jsx)(N.Z,{label:d.x.I18n.t("hideList"),icon:C.Z,controls:[{title:d.x.I18n.t("hideList"),onClick:t,icon:null}]})]}),(0,m.jsx)("ul",{children:r.map((e=>e))}),!a&&(0,m.jsxs)("p",{className:"mailpoet-task-list__all-set",children:[d.x.I18n.t("youAreSet")," ",(0,m.jsx)("a",{href:"#",onClick:e=>{e.preventDefault(),t()},children:d.x.I18n.t("dismissList")})]})]})}function ie(e){let{title:t,slug:n,link:a,description:i,doneMessage:s,imgSrc:r,isDone:o}=e;const l=()=>{te("Home Page Task",n,a)};return(0,m.jsxs)("li",{className:ee()("mailpoet-product-discovery__task",{"mailpoet-product-discovery__task--completed":o}),role:"row",onClick:o?void 0:l,tabIndex:o?void 0:0,onKeyDown:o?void 0:e=>"Enter"===e.key&&l(),children:[(0,m.jsx)("img",{src:r,alt:t,width:124,height:72}),(0,m.jsx)("div",{className:"mailpoet-product-discovery__task-content",children:o?(0,m.jsx)("h3",{children:s}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("h3",{children:`${t} →`}),i&&(0,m.jsx)("p",{children:i})]})}),(0,m.jsx)("div",{className:"mailpoet-product-discovery__task-after",children:o&&(0,m.jsx)("div",{className:"mailpoet-task-list__task-icon",children:(0,m.jsx)(Q.Z,{icon:X.Z})})})]})}function se(e){let{heading:t,description:n,children:a,headingAfter:i,className:s=""}=e;return(0,m.jsxs)("section",{className:ee()("mailpoet-homepage-section__container",s),children:[(0,m.jsxs)("header",{className:"mailpoet-homepage-section__heading",children:[(0,m.jsxs)("h2",{children:[t,n&&(0,m.jsx)("span",{children:n})]}),(0,m.jsx)("div",{className:"mailpoet-homepage-section__heading-after",children:i})]}),a]})}function re(e){let{onHide:t}=e;const{tasksStatus:n,isWooCommerceActive:a,isDiscoveryDone:i}=(0,k.Z)((e=>({tasksStatus:e(K).getProductDiscoveryTasksStatus(),isWooCommerceActive:e(K).getIsWooCommerceActive(),isDiscoveryDone:e(K).getIsProductDiscoveryDone()})),[]),s=[];return s.push((0,m.jsx)(ie,{slug:"set up welcome campaign",title:d.x.I18n.t("setUpWelcomeCampaign"),description:d.x.I18n.t("setUpWelcomeCampaignDesc"),link:"admin.php?page=mailpoet-automation-templates",imgSrc:`${d.x.cdnUrl}homepage/welcome-email-illustration.png`,isDone:n.setUpWelcomeCampaign,doneMessage:d.x.I18n.t("setUpWelcomeCampaignDone")},"setUpWelcomeCampaign"),(0,m.jsx)(ie,{slug:"add subscription form",title:d.x.I18n.t("addSubscriptionForm"),description:d.x.I18n.t("addSubscriptionFormDesc"),link:"admin.php?page=mailpoet-form-editor-template-selection",imgSrc:`${d.x.cdnUrl}homepage/subscription-form-illustration.png`,isDone:n.addSubscriptionForm,doneMessage:d.x.I18n.t("addSubscriptionFormDone")},"addSubscriptionForm")),a?s.push((0,m.jsx)(ie,{slug:"set up abandoned cart email",title:d.x.I18n.t("setUpAbandonedCartEmail"),description:d.x.I18n.t("setUpAbandonedCartEmailDesc"),link:"admin.php?page=mailpoet-newsletters#/new/woocommerce/woocommerce_abandoned_shopping_cart/conditions",imgSrc:`${d.x.cdnUrl}homepage/woo-cart-email-illustration.png`,isDone:n.setUpAbandonedCartEmail,doneMessage:d.x.I18n.t("setUpAbandonedCartEmailDone")},"setUpAbandonedCartEmail"),(0,m.jsx)(ie,{slug:"brand woocommerce emails",title:d.x.I18n.t("brandWooEmails"),description:d.x.I18n.t("brandWooEmailsDesc"),link:"admin.php?page=mailpoet-settings#/woocommerce",imgSrc:`${d.x.cdnUrl}homepage/woo-transactional-email-illustration.png`,isDone:n.brandWooEmails,doneMessage:d.x.I18n.t("brandWooEmailsDone")},"brandWooEmails")):s.push((0,m.jsx)(ie,{slug:"send first newsletter",title:d.x.I18n.t("sendFirstNewsletter"),description:d.x.I18n.t("sendFirstNewsletterDesc"),link:"admin.php?page=mailpoet-newsletters#/new",imgSrc:`${d.x.cdnUrl}homepage/newsletter-illustration.png`,isDone:n.sendFirstNewsletter,doneMessage:d.x.I18n.t("sendFirstNewsletterDone")},"sendFirstNewsletter")),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(se,{className:"mailpoet-homepage-product-discovery",heading:d.x.I18n.t("startEngagingWithYourCustomers"),headingAfter:(0,m.jsx)(N.Z,{label:d.x.I18n.t("hideList"),icon:C.Z,controls:[{title:d.x.I18n.t("hideList"),onClick:t,icon:null}]}),children:(0,m.jsx)("ul",{children:s.map((e=>e))})}),i&&(0,m.jsxs)("p",{className:"mailpoet-task-list__all-set",children:[d.x.I18n.t("allDone")," ",(0,m.jsx)("a",{href:"#",onClick:e=>{e.preventDefault(),t()},children:d.x.I18n.t("dismissTasks")})]})]})}var oe=n(15128),le=n(18822),ce=n(43981),de=n(31347),pe=n(42238),ue=n(3939);function me(e){let{closable:t,onHide:n}=e;return(0,m.jsx)(se,{className:"mailpoet-homepage-upsell",heading:d.x.I18n.t("accelerateYourGrowth"),headingAfter:t&&n?(0,m.jsx)(ue.ZP,{icon:oe.Z,onClick:n,label:d.x.I18n.t("close")}):null,children:(0,m.jsxs)("div",{className:"mailpoet-homepage-upsell__content",children:[(0,m.jsxs)("ul",{children:[(0,m.jsxs)("li",{children:[(0,m.jsx)(Q.Z,{icon:le.Z}),(0,m.jsx)("span",{children:d.x.I18n.t("detailedAnalytics")})]}),(0,m.jsxs)("li",{children:[(0,m.jsx)(Q.Z,{icon:ce.Z}),(0,m.jsx)("span",{children:d.x.I18n.t("advancedSubscriberSegmentation")})]}),(0,m.jsxs)("li",{children:[(0,m.jsx)(Q.Z,{icon:de.Z}),(0,m.jsx)("span",{children:d.x.I18n.t("emailMarketingAutomations")})]}),(0,m.jsxs)("li",{children:[(0,m.jsx)(Q.Z,{icon:pe.Z}),(0,m.jsx)("span",{children:d.x.I18n.t("prioritySupport")})]})]}),(0,m.jsx)(ue.ZP,{variant:"primary",href:d.x.MailPoetComUrlFactory.getPurchasePlanUrl(d.x.subscribersCount,d.x.currentWpUserEmail,"business",{utm_source:"plugin",utm_medium:"homepage",utm_campaign:"upsell"}),children:d.x.I18n.t("upgradePlan")})]})})}var he=n(48405),fe=n(86885);function ge(e){let{id:t,engagementScore:n}=e;const a={unknown:{name:d.x.I18n.t("unknownBadgeName"),type:"unknown",tooltipTitle:d.x.I18n.t("unknownBadgeTooltip"),tooltipText:d.x.I18n.t("tooltipUnknown")},excellent:{name:d.x.I18n.t("excellentBadgeName"),type:"excellent",tooltipTitle:d.x.I18n.t("excellentBadgeTooltip"),tooltipText:d.x.I18n.t("tooltipExcellent")},good:{name:d.x.I18n.t("goodBadgeName"),type:"good",tooltipTitle:d.x.I18n.t("goodBadgeTooltip"),tooltipText:d.x.I18n.t("tooltipGood")},average:{name:d.x.I18n.t("averageBadgeName"),type:"average",tooltipTitle:d.x.I18n.t("averageBadgeTooltip"),tooltipText:d.x.I18n.t("tooltipAverage")}},i=`badge-${t}`;let s;s=null==n?a.unknown:n<20?a.average:n<50?a.good:a.excellent;const r=(0,m.jsxs)("div",{children:[(0,m.jsx)("div",{className:"mailpoet-listing-stats-tooltip-title",children:s.tooltipTitle.toUpperCase()}),(0,m.jsx)("div",{className:"mailpoet-listing-stats-tooltip-description",children:d.x.I18n.t("engagementScoreDescription")}),(0,m.jsxs)("div",{className:"mailpoet-listing-stats-tooltip-content",children:[(0,m.jsx)(fe.C,{type:"unknown",name:d.x.I18n.t("unknownBadgeName")})," : ",a.unknown.tooltipText,(0,m.jsx)("br",{}),(0,m.jsx)(fe.C,{type:"excellent",name:d.x.I18n.t("excellentBadgeName")})," : ",a.excellent.tooltipText,(0,m.jsx)("br",{}),(0,m.jsx)(fe.C,{type:"good",name:d.x.I18n.t("goodBadgeName")})," : ",a.good.tooltipText,(0,m.jsx)("br",{}),(0,m.jsx)(fe.C,{type:"average",name:d.x.I18n.t("averageBadgeName")})," : ",a.average.tooltipText]})]},`tooltip-${i}`);return(0,m.jsxs)("div",{className:"mailpoet-listing-stats-opened-clicked",children:[null!=n&&(0,m.jsxs)("div",{className:"mailpoet-listing-stats-percentages",children:[n.toLocaleString(void 0,{minimumFractionDigits:1,maximumFractionDigits:1}),"%"]}),(0,m.jsx)("div",{children:(0,m.jsx)(fe.C,{isInverted:!0,type:s.type,name:s.name,tooltip:r,tooltipId:i,tooltipPlace:"top"})})]})}const xe=(e,t,n)=>{e.preventDefault(),te("Home Page Statistics Click",t,n)};function _e(){const{globalChange:e,listsChange:t,hasForms:n}=(0,k.Z)((e=>({globalChange:e(K).getGlobalSubscriberStatsChange(),listsChange:e(K).getListsSubscriberStatsChange(),hasForms:e(K).getHasForms()})),[]),a=0===t.length&&0===e.subscribed&&0===e.unsubscribed;return(0,m.jsx)(se,{className:"mailpoet-subscribers-stats",heading:d.x.I18n.t("subscribersHeading"),description:d.x.I18n.t("subscribersSectionDescription"),headingAfter:!a&&(0,m.jsxs)("span",{className:ee()({"mailpoet-decrease":e.changePercent<0}),children:[(0,m.jsx)(Q.Z,{icon:le.Z}),e.changePercent<0&&"-",Math.abs(e.changePercent)>1e3?"∞%":`${Math.abs(e.changePercent)}%`]}),children:a?(0,m.jsxs)("div",{className:"mailpoet-subscribers-stats-empty",children:[(0,m.jsx)(Q.Z,{icon:le.Z,viewBox:"-4 -4 32 32"}),n?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("p",{children:d.x.I18n.t("subscriberCountHasNotChangeLongTime")}),(0,m.jsx)("a",{href:"admin.php?page=mailpoet-newsletters#/new",onClick:e=>xe(e,"campaigns","admin.php?page=mailpoet-newsletters#/new"),children:d.x.I18n.t("exploreCampaigns")})]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("p",{children:[d.x.I18n.t("changesWillAppear"),(0,m.jsx)("br",{}),d.x.I18n.t("starBySettingUpForm")]}),(0,m.jsx)("a",{href:"admin.php?page=mailpoet-form-editor-template-selection",onClick:e=>xe(e,"new form","admin.php?page=mailpoet-form-editor-template-selection"),children:d.x.I18n.t("createForm")})]})]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("div",{className:"mailpoet-subscribers-stats-global-change",children:[(0,m.jsxs)("div",{children:[d.x.I18n.t("newSubscribers"),(0,m.jsx)("br",{}),(0,m.jsx)("span",{children:e.subscribed})]}),(0,m.jsxs)("div",{children:[d.x.I18n.t("unsubscribedSubscribers"),(0,m.jsx)("br",{}),(0,m.jsx)("span",{children:e.unsubscribed})]})]}),!!t.length&&(0,m.jsxs)("table",{className:"mailpoet-subscribers-stats-list-change-table",children:[(0,m.jsx)("thead",{children:(0,m.jsxs)("tr",{children:[(0,m.jsx)("th",{children:d.x.I18n.t("listName")}),(0,m.jsx)("th",{children:d.x.I18n.t("listScore")}),(0,m.jsx)("th",{children:d.x.I18n.t("subscribedSubscribers")}),(0,m.jsx)("th",{children:d.x.I18n.t("unsubscribedSubscribers")})]})}),(0,m.jsx)("tbody",{children:t.map((e=>(0,m.jsxs)("tr",{children:[(0,m.jsx)("td",{children:(0,m.jsx)("a",{href:`admin.php?page=mailpoet-subscribers#/page[1]/sort_by[created_at]/sort_order[desc]/group[all]/filter[segment=${e.id}]`,children:e.name})}),(0,m.jsx)("td",{children:(0,m.jsx)("div",{className:"mailpoet-listing-stats",children:(0,m.jsx)(ge,{id:e.id,engagementScore:e.averageEngagementScore})})}),(0,m.jsx)("td",{children:e.subscribed}),(0,m.jsx)("td",{children:e.unsubscribed})]},e.id)))})]})]})})}var be=n(74193),ve=n(83158);function ye(e){let{link:t,abstract:n,title:a,imgSrc:i}=e;return(0,m.jsxs)("a",{className:"mailpoet-resource-post",href:t,target:"_blank",rel:"noreferrer",children:[(0,m.jsx)("img",{src:i,alt:a,width:"292",height:"166"}),(0,m.jsx)("h3",{children:a}),(0,m.jsx)("p",{children:n})]})}function we(){const[e,t]=(0,r.useState)(1),n=[(0,m.jsx)(ye,{link:"https://kb.mailpoet.com/article/141-create-an-email-types-of-campaigns?utm_source=plugin&utm_medium=homepage&utm_campaign=resources",abstract:d.x.I18n.t("createAnEmailAbstract"),title:d.x.I18n.t("createAnEmailTitle"),imgSrc:`${d.x.cdnUrl}homepage/resources/add_email.png`},"createAnEmail"),(0,m.jsx)(ye,{link:"https://kb.mailpoet.com/article/297-create-a-form-with-our-new-editor?utm_source=plugin&utm_medium=homepage&utm_campaign=resources",abstract:d.x.I18n.t("createAFormAbstract"),title:d.x.I18n.t("createAFormTitle"),imgSrc:`${d.x.cdnUrl}homepage/resources/add_form.png`},"createAForm"),(0,m.jsx)(ye,{link:"https://www.mailpoet.com/blog/email-segmentation/?utm_source=plugin&utm_medium=homepage&utm_campaign=resources",abstract:d.x.I18n.t("segmentationGuideAbstract"),title:d.x.I18n.t("segmentationGuideTitle"),imgSrc:`${d.x.cdnUrl}homepage/resources/segmentation.png`},"segmentationGuide"),(0,m.jsx)(ye,{link:"https://www.mailpoet.com/blog/re-engagement-emails/?utm_source=plugin&utm_medium=homepage&utm_campaign=resources",abstract:d.x.I18n.t("reEngagementAbstract"),title:d.x.I18n.t("reEngagementTitle"),imgSrc:`${d.x.cdnUrl}homepage/resources/reengagement.png`},"reEngagement"),(0,m.jsx)(ye,{link:"https://www.mailpoet.com/blog/newsletter-marketing-strategy/?utm_source=plugin&utm_medium=homepage&utm_campaign=resources",abstract:d.x.I18n.t("marketingStrategyAbstract"),title:d.x.I18n.t("marketingStrategyTitle"),imgSrc:`${d.x.cdnUrl}homepage/resources/marketing.png`},"marketingStrategy"),(0,m.jsx)(ye,{link:"https://www.mailpoet.com/blog/how-to-promote-your-sales-with-email-marketing-mailpoet-woocommerce-segmentation/?utm_source=plugin&utm_medium=homepage&utm_campaign=resources",abstract:d.x.I18n.t("promotingSalesAbstract"),title:d.x.I18n.t("promotingSalesTitle"),imgSrc:`${d.x.cdnUrl}homepage/resources/sales.png`},"promotingSales")],a=(0,r.useCallback)((n=>{n.preventDefault(),t(e+1)}),[e]),i=(0,r.useCallback)((n=>{n.preventDefault(),t(e-1)}),[e]);return(0,m.jsxs)(se,{className:"mailpoet-homepage-resources",heading:d.x.I18n.t("learnMoreAboutEmailMarketing"),children:[(0,m.jsx)("div",{className:"mailpoet-homepage-resources__posts",children:n.filter(((t,n)=>n+1===2*e||n+1===2*e-1)).map((e=>e))}),(0,m.jsxs)("div",{className:"mailpoet-homepage-resources__pagination",children:[d.x.I18n.t("pageOf").replace("%1$d",e.toString()).replace("%2$d",Math.ceil(n.length/2).toString()),e>1?(0,m.jsx)("a",{href:"#",onClick:i,title:d.x.I18n.t("previousPostsPage"),children:(0,m.jsx)(Q.Z,{icon:be.Z})}):(0,m.jsx)(Q.Z,{icon:be.Z}),e<Math.ceil(n.length/2)?(0,m.jsx)("a",{href:"#",onClick:a,title:d.x.I18n.t("nextPostsPage"),children:(0,m.jsx)(Q.Z,{icon:ve.Z})}):(0,m.jsx)(Q.Z,{icon:ve.Z})]})]})}function je(){const{isTaskListHidden:e,isProductDiscoveryHidden:t,isUpsellHidden:n,canDisplayUpsell:a}=(0,k.Z)((e=>({isTaskListHidden:e(K).getIsTaskListHidden(),isProductDiscoveryHidden:e(K).getIsProductDiscoveryHidden(),isUpsellHidden:e(K).getIsUpsellHidden(),canDisplayUpsell:e(K).getCanDisplayUpsell()})),[]),{hideTaskList:i}=(0,he.Z)(K),{hideProductDiscovery:s}=(0,he.Z)(K),{hideUpsell:r}=(0,he.Z)(K);return(0,m.jsxs)("div",{className:"mailpoet-homepage__container",children:[!e&&(0,m.jsx)(o.ErrorBoundary,{children:(0,m.jsx)(ae,{onHide:i})}),!t&&(0,m.jsx)(o.ErrorBoundary,{children:(0,m.jsx)(re,{onHide:s})}),e&&t&&a&&!n&&(0,m.jsx)(o.ErrorBoundary,{children:(0,m.jsx)(me,{closable:!0,onHide:r})}),(0,m.jsx)(o.ErrorBoundary,{children:(0,m.jsx)(_e,{})}),(0,m.jsx)(o.ErrorBoundary,{children:(0,m.jsx)(we,{})})]})}function Se(){const[e,t]=(0,r.useState)(!1);return(0,r.useEffect)((()=>{(()=>{const e=(0,I.Z)(K,{actions:a,controls:G,selectors:i,reducer:Z,initialState:{taskList:{isTaskListHidden:window.mailpoet_homepage_data.taskListDismissed,tasksStatus:window.mailpoet_homepage_data.taskListStatus,canImportWooCommerceSubscribers:window.mailpoet_homepage_data.wooCustomersCount>0,hasImportedSubscribers:window.mailpoet_homepage_data.subscribersCount>10},productDiscovery:{isHidden:window.mailpoet_homepage_data.productDiscoveryDismissed,tasksStatus:window.mailpoet_homepage_data.productDiscoveryStatus},upsell:{isHidden:window.mailpoet_homepage_data.upsellDismissed,upsellStatus:window.mailpoet_homepage_data.upsellStatus},isWooCommerceActive:d.x.isWoocommerceActive,subscribersStats:window.mailpoet_homepage_data.subscribersStats,formsCount:window.mailpoet_homepage_data.formsCount}});(0,T.register)(e)})(),t(!0)}),[]),(0,m.jsxs)(l.k.Provider,{value:(0,l.S)(window),children:[(0,m.jsx)(c.Q,{}),(0,m.jsx)(S,{}),e?(0,m.jsx)(je,{}):null]})}const ke=document.getElementById("mailpoet_homepage_container");ke&&((0,o.registerTranslations)(),s.render((0,m.jsx)(o.ErrorBoundary,{children:(0,m.jsx)(Se,{})}),ke));var Ne=n(26952),Ce=n(59040),Ie=n(65311),Te=n.n(Ie),Ee=n(39519),De=n.n(Ee),Oe=n(28986),Ae=n(98707),Re=n(79846),Pe=n(7936),Le=n(371);function Me(e){let{cacheCalculation:t}=e;const[n,a]=(0,r.useState)(!1),[i,s]=(0,r.useState)([]),o=(new Date).getTime()-new Date(t).getTime(),l=Math.floor(o/1e3/60);return(0,m.jsxs)("div",{className:"mailpoet-subscribers-cache-notice",children:[x()((0,Pe.__)("Lists and Segments subscribers counts were calculated <abbr>{$mins} minutes ago</abbr>","mailpoet"),/<abbr>(.*?)<\/abbr>/,((e,n)=>(0,m.jsx)("abbr",{title:t,children:e.replace(/(\{\$mins\}|\$mins)/i,String(l))},n))),(0,m.jsx)(Le.z,{className:"mailpoet-subscribers-cache-notice-button",type:"button",variant:"secondary",dimension:"small",onClick:()=>{a(!0),d.x.Ajax.post({api_version:d.x.apiVersion,endpoint:"settings",action:"recalculateSubscribersCountsCache"}).done((()=>{window.location.reload()})).fail((e=>{s(e.errors.map((e=>e.message))),a(!1)}))},withSpinner:n,children:(0,Pe.__)("Recalculate now","mailpoet")}),(0,m.jsx)("div",{className:"mailpoet-gap"}),i.length>0&&(0,m.jsx)(u.q,{type:"error",children:i.map((e=>(0,m.jsx)("p",{children:e},e)))})]})}var Fe=n(19613);function Be(e){let{subscribersInPlan:t,subscribersInPlanLimit:n}=e;if(!1===t)return null;const a=n?(0,m.jsx)("b",{children:(0,Pe._x)("%1$d / %2$d","count / total subscribers","mailpoet").replace("%1$d",t.toLocaleString()).replace("%2$d",n.toLocaleString())},"subscribers_count"):(0,m.jsx)("b",{children:t},"subscribers_count");return(0,m.jsxs)("div",{className:"mailpoet-subscribers-in-plan",children:[x()((0,Pe._x)("%s subscribers in your plan","number of subscribers in a sending plan","mailpoet"),"%s",(()=>a))," ",(0,m.jsx)(Fe.Tooltip,{tooltip:(0,Pe.__)("This is the total of subscribed, unconfirmed and inactive subscribers we count when you are sending with MailPoet Sending Service. The count excludes unsubscribed and bounced (invalid) email addresses.","mailpoet"),place:"right"}),(0,m.jsx)("span",{className:"mailpoet-subscribers-in-plan-spacer",children:" "})]})}var qe=n(73478);function We(e){let{location:t}=e;return(0,m.jsxs)(c.Q,{children:[(0,m.jsxs)(Ne.Link,{className:"mailpoet-button button-secondary",to:{pathname:"/new",state:{backUrl:null==t?void 0:t.pathname}},children:[qe.R,(0,m.jsx)("span",{"data-automation-id":"add-new-subscribers-button",children:d.x.I18n.t("new")})]}),(0,m.jsx)("a",{className:"mailpoet-button not-small-screen button-secondary",href:"?page=mailpoet-import","data-automation-id":"import-subscribers-button",children:d.x.I18n.t("import")}),(0,m.jsx)("a",{id:"mailpoet_export_button",className:"mailpoet-button not-small-screen button-secondary",href:"?page=mailpoet-export",children:d.x.I18n.t("export")})]})}We.propTypes={location:De().object.isRequired};const Ve=(0,Ce.EN)(We),$e=d.x.trackingConfig.emailTrackingEnabled,Ue=[{name:"email",label:d.x.I18n.t("subscriber"),sortable:!0},{name:"status",label:d.x.I18n.t("status"),sortable:!0},{name:"segments",label:d.x.I18n.t("lists")},{name:"tags",label:d.x.I18n.t("tags")},{name:"statistics",label:d.x.I18n.t("statisticsColumn"),display:$e},{name:"created_at",label:d.x.I18n.t("subscribedOn"),sortable:!0}],Ye={onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?d.x.I18n.t("oneSubscriberTrashed"):d.x.I18n.t("multipleSubscribersTrashed").replace("%1$d",t.toLocaleString()),d.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?d.x.I18n.t("oneSubscriberDeleted"):d.x.I18n.t("multipleSubscribersDeleted").replace("%1$d",t.toLocaleString()),d.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?d.x.I18n.t("oneSubscriberRestored"):d.x.I18n.t("multipleSubscribersRestored").replace("%1$d",t.toLocaleString()),d.x.Notice.success(n)},onNoItemsFound:e=>"bounced"===e&&!window.mailpoet_premium_active&&!window.mailpoet_mss_active&&(0,m.jsxs)("div",{children:[(0,m.jsx)("p",{children:d.x.I18n.t("bouncedSubscribersHelp")}),(0,m.jsx)("p",{children:(0,m.jsx)("a",{href:"admin.php?page=mailpoet-upgrade",className:"button-primary",children:d.x.I18n.t("bouncedSubscribersPremiumButtonText")})})]})},He=(e,t,n,a)=>(0,m.jsxs)(Ae.u,{title:a,onRequestClose:t,isDismissible:!0,children:[(0,m.jsx)(Re.Y,{field:n}),(0,m.jsx)("span",{className:"mailpoet-gap-half"}),(0,m.jsx)(o.Button,{onClick:e,dimension:"small",variant:"secondary",children:d.x.I18n.t("apply")})]}),ze=[{name:"moveToList",label:d.x.I18n.t("moveToList"),onSelect:function(e,t){return He(e,t,{id:"move_to_segment",name:"move_to_segment",endpoint:"segments",filter:function(e){return!(e.deleted_at||"default"!==e.type)}},d.x.I18n.t("moveToList"))},getData:function(){return{segment_id:Number(Te()("#move_to_segment").val())}},onSuccess:function(e){d.x.Notice.success(d.x.I18n.t("multipleSubscribersMovedToList").replace("%1$d",Number(e.meta.count).toLocaleString()).replace("%2$s",e.meta.segment))}},{name:"addToList",label:d.x.I18n.t("addToList"),onSelect:function(e,t){return He(e,t,{id:"add_to_segment",name:"add_to_segment",endpoint:"segments",filter:function(e){return!(e.deleted_at||"default"!==e.type)}},d.x.I18n.t("addToList"))},getData:function(){return{segment_id:Number(Te()("#add_to_segment").val())}},onSuccess:function(e){d.x.Notice.success(d.x.I18n.t("multipleSubscribersAddedToList").replace("%1$d",Number(e.meta.count).toLocaleString()).replace("%2$s",e.meta.segment))}},{name:"removeFromList",label:d.x.I18n.t("removeFromList"),onSelect:function(e,t){return He(e,t,{id:"remove_from_segment",name:"remove_from_segment",endpoint:"segments",filter:function(e){return!("default"!==e.type)}},d.x.I18n.t("removeFromList"))},getData:function(){return{segment_id:Number(Te()("#remove_from_segment").val())}},onSuccess:function(e){d.x.Notice.success(d.x.I18n.t("multipleSubscribersRemovedFromList").replace("%1$d",Number(e.meta.count).toLocaleString()).replace("%2$s",e.meta.segment))}},{name:"removeFromAllLists",label:d.x.I18n.t("removeFromAllLists"),onSuccess:function(e){d.x.Notice.success(d.x.I18n.t("multipleSubscribersRemovedFromAllLists").replace("%1$d",Number(e.meta.count).toLocaleString()))}},{name:"trash",label:d.x.I18n.t("moveToTrash"),onSuccess:Ye.onTrash},{name:"unsubscribe",label:d.x.I18n.t("unsubscribe"),onSelect:(e,t,n)=>{const a="all"!==n.selection?n.selected_ids.length:n.count;return(0,m.jsxs)(Ae.u,{title:d.x.I18n.t("unsubscribe"),onRequestClose:t,isDismissible:!0,children:[(0,m.jsx)("p",{children:d.x.I18n.t("unsubscribeConfirm").replace("%s",Number(a).toLocaleString())}),(0,m.jsx)("span",{className:"mailpoet-gap-half"}),(0,m.jsx)(o.Button,{onClick:e,dimension:"small",variant:"secondary",automationId:"bulk-unsubscribe-confirm",children:d.x.I18n.t("apply")})]})}},{name:"addTag",label:d.x.I18n.t("addTag"),onSelect:function(e,t){return He(e,t,{id:"add_tag",name:"add_tag",endpoint:"tags"},d.x.I18n.t("addTag"))},getData:function(){return{tag_id:Number(Te()("#add_tag").val())}},onSuccess:function(e){d.x.Notice.success(d.x.I18n.t("tagAddedToMultipleSubscribers").replace("%1$s",e.meta.tag).replace("%2$d",Number(e.meta.count).toLocaleString()))}},{name:"removeTag",label:d.x.I18n.t("removeTag"),onSelect:function(e,t){return He(e,t,{id:"remove_tag",name:"remove_tag",endpoint:"tags"},d.x.I18n.t("removeTag"))},getData:function(){return{tag_id:Number(Te()("#remove_tag").val())}},onSuccess:function(e){d.x.Notice.success(d.x.I18n.t("tagRemovedFromMultipleSubscribers").replace("%1$s",e.meta.tag).replace("%2$d",Number(e.meta.count).toLocaleString()))}}],Ze=[{name:"statistics",label:d.x.I18n.t("statsListingActionTitle"),link:function(e,t){return(0,m.jsx)(Ne.Link,{to:{pathname:`/stats/${e.id}`,state:{backUrl:null==t?void 0:t.pathname}},children:d.x.I18n.t("statsListingActionTitle")})}},{name:"edit",label:d.x.I18n.t("edit"),link:function(e,t){return(0,m.jsx)(Ne.Link,{to:{pathname:`/edit/${e.id}`,state:{backUrl:null==t?void 0:t.pathname}},children:d.x.I18n.t("edit")})}},{name:"sendConfirmationEmail",className:"mailpoet-hide-on-mobile",label:d.x.I18n.t("resendConfirmationEmail"),display:function(e){return"unconfirmed"===e.status&&e.count_confirmations<window.mailpoet_max_confirmation_emails},onClick:function(e){return d.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"subscribers",action:"sendConfirmationEmail",data:{id:e.id}}).done((()=>d.x.Notice.success(d.x.I18n.t("oneConfirmationEmailSent")))).fail((e=>d.x.Notice.showApiErrorNotice(e)))}},{name:"trash",className:"mailpoet-hide-on-mobile"}],Ke=e=>0===Number(e.wp_user_id)&&0===Number(e.is_woocommerce_user),Ge=e=>{let t=null;return window.mailpoet_segments.forEach((n=>{n.id===e&&(t=n)})),t};function Qe(e){let{match:t}=e;const n=(0,Ce.TH)();return(0,m.jsxs)("div",{children:[(0,m.jsx)(Ve,{}),(0,m.jsx)(Be,{subscribersInPlan:d.x.subscribersCount,subscribersInPlanLimit:d.x.subscribersLimit}),(0,m.jsx)(j,{}),(0,m.jsx)(Me,{cacheCalculation:window.mailpoet_subscribers_counts_cache_created_at}),(0,m.jsx)(Oe.N,{limit:window.mailpoet_listing_per_page,location:n,params:t.params,endpoint:"subscribers",onRenderItem:(e,t)=>{const a=ee()("manage-column","column-primary","has-row-actions","column-username");let i="";switch(e.status){case"subscribed":i=d.x.I18n.t("subscribed");break;case"unconfirmed":i=d.x.I18n.t("unconfirmed");break;case"unsubscribed":i=d.x.I18n.t("unsubscribed");break;case"inactive":i=d.x.I18n.t("inactive");break;case"bounced":i=d.x.I18n.t("bounced");break;default:i="Invalid"}const s=[];return e.subscriptions.length>0&&e.subscriptions.forEach((e=>{const t=Ge(e.segment_id);null!==t&&"subscribed"===e.status&&s.push(t)})),(0,m.jsxs)("div",{children:[(0,m.jsxs)("td",{className:a,children:[(0,m.jsx)(Ne.Link,{className:"mailpoet-listing-title",to:{pathname:`/edit/${e.id}`,state:{backUrl:null==n?void 0:n.pathname}},children:e.email}),(0,m.jsxs)("div",{className:"mailpoet-listing-subtitle",children:[e.first_name," ",e.last_name]}),t]}),(0,m.jsx)("td",{className:"column","data-colname":d.x.I18n.t("status"),children:i}),(0,m.jsx)("td",{className:"column","data-colname":d.x.I18n.t("lists"),children:(0,m.jsx)(o.SegmentTags,{segments:s,dimension:"large"})}),(0,m.jsx)("td",{className:"column","data-colname":d.x.I18n.t("tags"),children:(0,m.jsx)(o.SubscriberTags,{subscribers:e.tags,variant:"wordpress",isInverted:!0})}),!0===$e?(0,m.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":d.x.I18n.t("statisticsColumn"),children:(0,m.jsx)("div",{className:"mailpoet-listing-stats",children:(0,m.jsx)("a",{href:`#/stats/${e.id}`,children:(0,m.jsx)(ge,{id:e.id,engagementScore:e.engagement_score})},`stats-link-${e.id}`)})}):null,(0,m.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":d.x.I18n.t("subscribedOn"),children:[d.x.Date.short(e.created_at),(0,m.jsx)("br",{}),d.x.Date.time(e.created_at)]})]})},columns:Ue,bulk_actions:ze,item_actions:Ze,messages:Ye,sort_by:"created_at",sort_order:"desc",isItemDeletable:Ke})]})}Qe.propTypes={match:De().shape({params:De().object}).isRequired},Qe.displayName="SubscriberList";var Xe=n(73136),Je=n.n(Xe),et=n(56762),tt=n(12447),nt=n.n(tt),at=n(33498);class it extends r.Component{render(){const e=this.props.field.name||null,t=this.props.item||{};let n,a;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&&(a=this.props.field.defaultValue);let i=this.props.field.id||null;!i&&this.props.field.name&&(i=`field_${this.props.field.name}`);let s=this.props.field.className||null;return s||this.props.field.size||(s="regular-text"),(0,m.jsx)(at.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:i,value:n,defaultValue:a,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})}}it.propTypes={onValueChange:De().func,onBlurEvent:De().func,field:De().shape({name:De().string.isRequired,defaultValue:De().string,id:De().string,className:De().string,size:De().oneOfType([De().string,De().number]),disabled:De().func,placeholder:De().string,validation:De().shape({"data-parsley-required":De().bool,"data-parsley-required-message":De().string,"data-parsley-type":De().string,"data-parsley-errors-container":De().string,maxLength:De().number}),customLabel:De().string,tooltip:De().string}).isRequired,item:De().object.isRequired},it.defaultProps={onValueChange:function(){},onBlurEvent:function(){}};var st=n(36102);function rt(e){return(0,m.jsx)(st.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})}rt.propTypes={item:De().object.isRequired,field:De().shape({name:De().string,placeholder:De().string,defaultValue:De().string,validation:De().shape({"data-parsley-required":De().bool,"data-parsley-required-message":De().string,"data-parsley-type":De().string,"data-parsley-errors-container":De().string,maxLength:De().number}),className:De().string,customLabel:De().string,tooltip:De().string}).isRequired,onValueChange:De().func.isRequired};var ot=n(35614),lt=n(96727);class ct extends r.Component{render(){if(void 0===this.props.field.values)return!1;let e,t=!1,n=!1,a=!1;void 0!==this.props.field.placeholder&&(n=(0,m.jsx)("option",{value:"",children:this.props.field.placeholder})),void 0!==this.props.field.filter&&(t=this.props.field.filter),ot.ZP.isFunction(this.props.field.sortBy)&&(a=this.props.field.sortBy),e=a?ot.ZP.map(ot.ZP.sortBy(ot.ZP.pairs(this.props.field.values),(e=>a(e[0],e[1]))),(e=>e[0])):Object.keys(this.props.field.values);const i=e.filter((e=>!1===t||t(this.props.item,e))).map((e=>(0,m.jsx)("option",{value:e,children:this.props.field.values[e]},`option-${e}`)));return(0,m.jsxs)(lt.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,i]})}}ct.propTypes={onValueChange:De().func,field:De().shape({name:De().string.isRequired,values:De().objectOf(De().string),placeholder:De().string,filter:De().func,sortBy:De().func,validation:De().shape({"data-parsley-required":De().bool,"data-parsley-required-message":De().string,"data-parsley-type":De().string,"data-parsley-errors-container":De().string,maxLength:De().number})}).isRequired,item:De().object.isRequired,automationId:De().string},ct.defaultProps={automationId:"",onValueChange:function(){}};var dt=n(49493);class pt extends r.Component{constructor(e){super(e),this.onValueChange=this.onValueChange.bind(this)}onValueChange=(e,t)=>this.props.onValueChange(t);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,m.jsx)("p",{children:(0,m.jsx)(dt.Y,{checked:e===t,value:t,onCheck:this.onValueChange,name:this.props.field.name,children:this.props.field.values[t]})},`radio-${t}`)));return(0,m.jsx)("div",{children:t})}}pt.propTypes={onValueChange:De().func,field:De().shape({name:De().string.isRequired,values:De().objectOf(De().string)}).isRequired,item:De().object.isRequired},pt.defaultProps={onValueChange:function(){}};var ut=n(94321);class mt extends r.Component{constructor(e){super(e),this.onValueChange=this.onValueChange.bind(this)}onValueChange=(e,t)=>(t.target.value=e?"1":"0",this.props.onValueChange(t));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,m.jsx)("p",{children:(0,m.jsx)(ut.X,{value:"1",checked:e,name:this.props.field.name,onCheck:this.onValueChange,children:this.props.field.values[t]})},`checkbox-${t}`)));return(0,m.jsx)("div",{children:t})}}function ht(e){const t=[];void 0!==e.placeholder&&t.push((0,m.jsx)("option",{value:"",children:e.placeholder},0));const n=Je()().year();for(let e=n;e>=n-100;e-=1)t.push((0,m.jsx)("option",{value:e,children:e},e));return(0,m.jsx)(o.Select,{isMinWidth:!0,name:`${e.name}[year]`,value:e.year,onChange:e.onValueChange,children:t})}function ft(e){const t=[];void 0!==e.placeholder&&t.push((0,m.jsx)("option",{value:"",children:e.placeholder},0));for(let n=1;n<=12;n+=1)t.push((0,m.jsx)("option",{value:n,children:e.monthNames[n-1]},n));return(0,m.jsx)(o.Select,{isMinWidth:!0,name:`${e.name}[month]`,value:e.month,onChange:e.onValueChange,children:t})}function gt(e){const t=[];void 0!==e.placeholder&&t.push((0,m.jsx)("option",{value:"",children:e.placeholder},0));for(let e=1;e<=31;e+=1)t.push((0,m.jsx)("option",{value:e,children:e},e));return(0,m.jsx)(o.Select,{isMinWidth:!0,name:`${e.name}[day]`,value:e.day,onChange:e.onValueChange,children:t})}mt.propTypes={onValueChange:De().func.isRequired,field:De().shape({name:De().string.isRequired,values:De().objectOf(De().string)}).isRequired,item:De().object.isRequired},ht.propTypes={name:De().string.isRequired,placeholder:De().string.isRequired,onValueChange:De().func.isRequired,year:De().oneOfType([De().string,De().number]).isRequired},ft.propTypes={name:De().string.isRequired,placeholder:De().string.isRequired,onValueChange:De().func.isRequired,month:De().oneOfType([De().string,De().number]).isRequired,monthNames:De().arrayOf(De().string).isRequired},gt.propTypes={name:De().string.isRequired,placeholder:De().string.isRequired,onValueChange:De().func.isRequired,day:De().oneOfType([De().string,De().number]).isRequired};class xt extends r.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,a=null;if(null!==t&&3===t.length){[,n,a]=t;const i=Number(e.target.value);this.setState({[`${a}`]:i},(()=>{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=Je()(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,m.jsx)(ht,{onValueChange:this.onValueChange,name:this.props.field.name,year:this.state.year,placeholder:this.props.field.year_placeholder},"year");case"MM":return(0,m.jsx)(ft,{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,m.jsx)(gt,{onValueChange:this.onValueChange,name:this.props.field.name,day:this.state.day,placeholder:this.props.field.day_placeholder},"day");default:return(0,m.jsx)("div",{children:"Invalid date type"})}}));return(0,m.jsx)("div",{children:n})}}xt.propTypes={item:De().object.isRequired,field:De().shape({name:De().string,day_placeholder:De().string,month_placeholder:De().string,year_placeholder:De().string,params:De().object}).isRequired,onValueChange:De().func.isRequired};var _t=n(19786),bt=n(7765);function vt(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,m.jsx)(bt.T,{label:e.field.label,name:e.field.name,placeholder:e.field.placeholder,selectedValues:t,suggestedValues:n,onChange:e.onValueChange})}class yt extends r.Component{renderField=e=>{let t,n=!1;e.field.description&&(n=(0,m.jsx)("p",{className:"description",children:e.field.description}));let a=e.field;switch(void 0!==e.field.field&&(a=Te().merge(a,e.field.field)),a.type){case"text":t=(0,m.jsx)(it,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"textarea":t=(0,m.jsx)(rt,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"select":t=(0,m.jsx)(ct,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"radio":t=(0,m.jsx)(pt,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"checkbox":t=(0,m.jsx)(mt,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"selection":t=(0,m.jsx)(Re.Y,{onValueChange:e.onValueChange,field:e.field,automationId:e.automationId,inline:e.inline,description:e.description,item:e.item},`selection-field-${a.name}`);break;case"date":t=(0,m.jsx)(xt,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"reactComponent":t=(0,m.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,m.jsx)(vt,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,description:e.description});break;case"empty":break;default:t="invalid"}const i="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,m.jsxs)("div",{className:ee()("mailpoet-form-field",{"mailpoet-form-field-disabled":i}),...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,m.jsx)(_t.X,{level:4,children:(0,m.jsx)("label",{htmlFor:`field_${this.props.field.name}`,children:this.props.field.label})}));let n=!1;return this.props.field.tip&&(n=(0,m.jsx)("p",{className:"mailpoet-form-description",children:this.props.field.tip})),(0,m.jsxs)("div",{className:`mailpoet-form-field-${this.props.field.name} form-field-row-${this.props.field.name}`,children:[t,n,e]})}}yt.propTypes={onValueChange:De().func,field:De().shape({name:De().string.isRequired,values:De().objectOf(De().string),tip:De().oneOfType([De().array,De().string]),label:De().string,fields:De().arrayOf(De().object),description:De().string,onWrapperClick:De().func,disabled:De().oneOfType([De().func,De().bool])}).isRequired,item:De().object.isRequired},yt.defaultProps={onValueChange:function(){}},(0,o.registerTranslations)();class wt extends r.Component{constructor(e){super(e),this.formRef=(0,r.createRef)(),this.state={loading:!1,errors:[],item:{}}}componentDidMount(){void 0!==this.props.params.id?this.loadItem(this.props.params.id):nt()((()=>{const e=Te()(".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&&(nt()((()=>{this.setState({loading:!1,item:{}})})),void 0===this.props.item&&this.formRef.current.reset())}getValues=()=>this.props.item||this.state.item;getErrors=()=>this.props.errors||this.state.errors;loadItem=e=>{this.setState({loading:!0}),this.props.endpoint&&d.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")}))}))};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&&d.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})}))};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 a=e.item;return a[t]=n,{item:a}})),!0)};render(){let e;void 0!==this.getErrors()&&(e=this.getErrors().map((e=>(0,m.jsx)("div",{className:"mailpoet_notice notice inline error is-dismissible",children:(0,m.jsx)("p",{children:e.message})},`error-${e.message}`))));const t=ee()("mailpoet_form",{mailpoet_form_loading:this.state.loading||this.props.loading});let n=!1,a=!1;void 0!==this.props.beforeFormContent&&(n=this.props.beforeFormContent(this.getValues())),void 0!==this.props.afterFormContent&&(a=this.props.afterFormContent(this.getValues()));const i=this.props.fields.map((e=>{let t=this.handleValueChange;return e.onBeforeChange&&(t=t=>(e.onBeforeChange(t),this.handleValueChange(t))),(0,m.jsx)(yt,{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,m.jsx)(o.Button,{type:"submit",isDisabled:this.state.loading,children:(0,Pe.__)("Save","mailpoet")}),(0,m.jsxs)("div",{children:[(0,m.jsx)("div",{className:"mailpoet-form-content-around",children:n}),(0,m.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,m.jsxs)("div",{className:"mailpoet-form-grid",children:[i,(0,m.jsx)("div",{className:"mailpoet-form-actions",children:s})]})]}),(0,m.jsx)("div",{className:"mailpoet-form-content-around",children:a})]})}}wt.propTypes={params:De().shape({id:De().string}),location:De().shape({pathname:De().string}),item:De().object,errors:De().arrayOf(De().object),endpoint:De().string,fields:De().arrayOf(De().object),messages:De().shape({onUpdate:De().func,onCreate:De().func}),loading:De().bool,children:De().array,id:De().string,automationId:De().string,beforeFormContent:De().func,afterFormContent:De().func,onItemLoad:De().func,isValid:De().func,onChange:De().func,onSubmit:De().func,onSuccess:De().func,history:De().shape({push:De().func.isRequired}).isRequired},wt.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 jt=(0,Ce.EN)(wt);var St=n(69825);const kt=[{name:"email",label:d.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:d.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:d.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:d.x.I18n.t("status"),type:"select",automationId:"subscriber-status",values:{subscribed:d.x.I18n.t("subscribed"),unconfirmed:d.x.I18n.t("unconfirmed"),unsubscribed:d.x.I18n.t("unsubscribed"),inactive:d.x.I18n.t("inactive"),bounced:d.x.I18n.t("bounced")}},{name:"segments",label:d.x.I18n.t("lists"),type:"selection",placeholder:d.x.I18n.t("selectList"),tip:d.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=d.x.Date.format(t.updated_at);n+=" (%1$s)".replace("%1$s",d.x.I18n.t("unsubscribedOn").replace("%1$s",e))}})),n}},{name:"tags",label:d.x.I18n.t("tags"),type:"tokenField",placeholder:d.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=d.x.I18n.t("year"),t.month_placeholder=d.x.I18n.t("month"),t.day_placeholder=d.x.I18n.t("day");break;case"select":t.placeholder="-";break;default:t.placeholder=""}kt.push(t)}));const Nt={onUpdate:function(){d.x.Notice.success(d.x.I18n.t("subscriberUpdated"))},onCreate:function(){d.x.Notice.success(d.x.I18n.t("subscriberAdded")),d.x.trackEvent("Subscribers > Add new")}};function Ct(e){if(Number(e.wp_user_id)>0)return(0,m.jsx)("p",{className:"description",children:x()(d.x.I18n.t("WPUserEditNotice"),/\[link\](.*?)\[\/link\]/g,((t,n)=>(0,m.jsx)("a",{href:`user-edit.php?user_id=${e.wp_user_id}`,children:t},n)))})}function It(e){var t;return(0,m.jsxs)(m.Fragment,{children:[null==e||null===(t=e.unsubscribes)||void 0===t?void 0:t.map((e=>{const t=Je()(e.createdAt.date).format("dddd MMMM Do YYYY [at] h:mm:ss a");let n;return n="admin"===e.source?d.x.I18n.t("unsubscribedAdmin").replace("%1$d",t).replace("%2$d",e.meta):"manage"===e.source?d.x.I18n.t("unsubscribedManage").replace("%1$d",t):"newsletter"===e.source?x()(d.x.I18n.t("unsubscribedNewsletter").replace("%1$d",t),/\[link\]/g,((t,n)=>(0,m.jsx)("a",{href:`admin.php?page=mailpoet-newsletter-editor&id=${e.newsletterId}`,children:e.newsletterSubject},n))):"mp_api"===e.source?d.x.I18n.t("unsubscribedMpApi").replace("%1$d",t):d.x.I18n.t("unsubscribedUnknown").replace("%1$d",t),(0,m.jsx)("p",{className:"description",children:n},n)})),(0,m.jsxs)("p",{className:"description",children:[(0,m.jsx)("strong",{children:d.x.I18n.t("tip")})," ",d.x.I18n.t("customFieldsTip")]})]})}function Tt(e){var t;let{match:n}=e;const a=(0,Ce.TH)(),i=(0,Ce.k6)(),s=(null===(t=a.state)||void 0===t?void 0:t.backUrl)||"/";return(0,m.jsxs)("div",{children:[(0,m.jsx)(et.A,{color:"#fff"}),(0,m.jsx)(St.B,{}),(0,m.jsxs)(_t.X,{level:1,className:"mailpoet-title",children:[(0,m.jsx)("span",{children:d.x.I18n.t("subscriber")}),(0,m.jsx)(Ne.Link,{className:"mailpoet-button button button-secondary button-small",to:s,children:d.x.I18n.t("backToList")})]}),(0,m.jsx)(_,{}),(0,m.jsx)(jt,{automationId:"subscriber_edit_form",endpoint:"subscribers",fields:kt,params:n.params,messages:Nt,beforeFormContent:Ct,afterFormContent:It,onSuccess:()=>i.push(s)})]})}Tt.propTypes={match:De().shape({params:De().shape({id:De().string}).isRequired}).isRequired},Tt.displayName="SubscriberForm";var Et=n(45235);function Dt(e){var t;let{email:n}=e;const a=(null===(t=(0,Ce.TH)().state)||void 0===t?void 0:t.backUrl)||"/";return(0,m.jsxs)(_t.X,{level:1,className:"mailpoet-title",children:[(0,m.jsx)("span",{children:d.x.I18n.t("statsHeading").replace("%s",n)}),(0,m.jsx)(Ne.Link,{className:"mailpoet-button button button-secondary button-small",to:a,children:d.x.I18n.t("backToList")})]})}var Ot=n(10645);function At(e){let{totalSent:t,open:n,machineOpen:a,click:i,subscriber:s}=e,r=0,o=0,l=0,c=0;const p=t-(n+a),u=t>0;return u&&(r=Math.round(n/t*100),o=Math.round(a/t*100),l=Math.round(i/t*100),c=Math.round(p/t*100)),(0,m.jsx)("div",{className:"mailpoet-tab-content mailpoet-subscriber-stats-summary",children:(0,m.jsx)("div",{className:"mailpoet-listing",children:(0,m.jsx)("table",{className:"mailpoet-listing-table",children:(0,m.jsxs)("tbody",{children:[(0,m.jsxs)("tr",{children:[(0,m.jsx)("td",{children:d.x.I18n.t("statsSentEmail")}),(0,m.jsx)("td",{children:(0,m.jsx)("b",{children:t.toLocaleString()})}),(0,m.jsx)("td",{})]}),(0,m.jsxs)("tr",{children:[(0,m.jsx)("td",{children:(0,m.jsx)(Ot.V,{children:d.x.I18n.t("statsOpened")})}),(0,m.jsx)("td",{children:(0,m.jsx)("b",{children:n.toLocaleString()})}),(0,m.jsx)("td",{children:u&&(0,m.jsxs)(m.Fragment,{children:[r,"%"]})})]}),(0,m.jsxs)("tr",{children:[(0,m.jsxs)("td",{children:[(0,m.jsx)(Ot.V,{children:d.x.I18n.t("statsMachineOpened")}),(0,m.jsx)(Fe.Tooltip,{tooltip:x()(d.x.I18n.t("statsMachineOpenedTooltip"),/\[link](.*?)\[\/link]/,(e=>(0,m.jsx)("span",{style:{pointerEvents:"all"},children:(0,m.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,m.jsx)("td",{children:(0,m.jsx)("b",{children:a.toLocaleString()})}),(0,m.jsx)("td",{children:u&&(0,m.jsxs)(m.Fragment,{children:[o,"%"]})})]}),(0,m.jsxs)("tr",{children:[(0,m.jsx)("td",{children:(0,m.jsx)(Ot.V,{isInverted:!0,children:d.x.I18n.t("statsClicked")})}),(0,m.jsx)("td",{children:(0,m.jsx)("b",{children:i.toLocaleString()})}),(0,m.jsx)("td",{children:u&&(0,m.jsxs)(m.Fragment,{children:[l,"%"]})})]}),(0,m.jsxs)("tr",{children:[(0,m.jsx)("td",{children:d.x.I18n.t("statsNotClicked")}),(0,m.jsx)("td",{children:(0,m.jsx)("b",{children:p.toLocaleString()})}),(0,m.jsx)("td",{children:u&&(0,m.jsxs)(m.Fragment,{children:[c,"%"]})})]}),(0,m.jsxs)("tr",{children:[(0,m.jsx)("td",{children:d.x.I18n.t("statisticsColumn")}),(0,m.jsx)("td",{children:(0,m.jsx)("div",{className:"mailpoet-listing-stats",children:(0,m.jsx)(ge,{id:s.id,engagementScore:s.engagement_score})})}),(0,m.jsx)("td",{})]})]})})})})}function Rt(e){let{revenueValue:t,count:n,averageRevenueValue:a}=e;return(0,m.jsx)("div",{className:"mailpoet-tab-content mailpoet-subscriber-stats-summary",children:(0,m.jsx)("div",{className:"mailpoet-listing",children:(0,m.jsx)("table",{className:"mailpoet-listing-table",children:(0,m.jsxs)("tbody",{children:[(0,m.jsxs)("tr",{children:[(0,m.jsx)("td",{children:"Orders created"}),(0,m.jsx)("td",{children:(0,m.jsx)("b",{children:n.toLocaleString()})})]}),(0,m.jsxs)("tr",{children:[(0,m.jsx)("td",{children:"Total revenue"}),(0,m.jsx)("td",{children:(0,m.jsx)("b",{children:t})})]}),(0,m.jsxs)("tr",{children:[(0,m.jsx)("td",{children:"Average revenue"}),(0,m.jsx)("td",{children:(0,m.jsx)("b",{children:a})})]})]})})})})}var Pt=n(97442),Lt=n(44761);function Mt(e){let{limitReached:t,limitValue:n,subscribersCountTowardsLimit:a,premiumActive:i,hasValidApiKey:s,hasPremiumSupport:r}=e;return(0,m.jsxs)("table",{className:"mailpoet-listing-table","data-automation-id":"subscriber-stats-no-access",children:[(0,m.jsx)("thead",{children:(0,m.jsxs)("tr",{children:[(0,m.jsx)("th",{children:d.x.I18n.t("email")}),(0,m.jsx)("th",{children:d.x.I18n.t("columnAction")}),(0,m.jsx)("th",{children:d.x.I18n.t("columnCount")}),(0,m.jsx)("th",{children:d.x.I18n.t("columnActionOn")})]})}),(0,m.jsx)("tbody",{children:(0,m.jsx)("tr",{children:(0,m.jsx)("td",{colSpan:4,children:(0,m.jsx)("div",{className:"mailpoet-subscriber-stats-no-access-content",children:(0,m.jsx)(Lt.K,{title:i&&t?d.x.I18n.t("upgradeRequired"):d.x.I18n.t("premiumFeature"),message:(()=>{let e=d.x.I18n.t("premiumRequired");return i?(e=r?d.x.I18n.t("planLimitReached"):d.x.I18n.t("freeLimitReached"),(0,m.jsx)("p",{children:x()(e,/(\[subscribersCount]|\[subscribersLimit])/g,(e=>"[subscribersCount]"===e?a:n))})):(0,m.jsx)("p",{children:x()(e,/\[link](.*?)\[\/link]/g,(e=>(0,m.jsx)("a",{href:d.x.premiumLink,children:e},e)))})})(),actionButton:i&&t?(0,m.jsx)(Le.z,{href:s?d.x.MailPoetComUrlFactory.getUpgradeUrl():d.x.MailPoetComUrlFactory.getPurchasePlanUrl(a+1),children:d.x.I18n.t("premiumBannerCtaUpgrade")}):(0,m.jsx)(Le.z,{href:d.x.MailPoetComUrlFactory.getPurchasePlanUrl(d.x.subscribersCount,d.x.currentWpUserEmail,null,{utm_medium:"stats",utm_campaign:"signup"}),children:d.x.I18n.t("premiumBannerCtaFree")})})})})})})]})}function Ft(e){let{params:t,location:n}=e;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(_t.X,{level:4,children:d.x.I18n.t("openedEmailsHeading")}),!d.x.premiumActive||d.x.subscribersLimitReached?(0,m.jsx)(Mt,{limitReached:d.x.subscribersLimitReached,limitValue:d.x.subscribersLimit,subscribersCountTowardsLimit:d.x.subscribersCount,premiumActive:d.x.premiumActive,hasValidApiKey:d.x.hasValidApiKey,hasPremiumSupport:d.x.hasPremiumSupport}):Pt.Hooks.applyFilters("mailpoet_subscribers_opened_emails_stats",t,n)]})}function Bt(e){return"string"==typeof e?d.x.Date.format(e):(0,Pe.__)("never","mailpoet")}function qt(e){let{stats:t}=e;const n=[{label:(0,Pe.__)("Last click","mailpoet"),date:t.last_click||null},{label:(0,Pe.__)("Last engagement","mailpoet"),date:t.last_engagement||null},{label:(0,Pe.__)("Last open","mailpoet"),date:t.last_open||null},{label:(0,Pe.__)("Last page view","mailpoet"),date:t.last_page_view||null},{label:(0,Pe.__)("Last sending","mailpoet"),date:t.last_sending||null}];return t.woocommerce&&n.push({label:(0,Pe.__)("Last purchase","mailpoet"),date:t.last_purchase||null}),n.sort(((e,t)=>e.date===t.date?0:e.date?t.date?t.date.localeCompare(e.date):-1:1)),(0,m.jsx)("div",{className:"mailpoet-tab-content mailpoet-subscriber-stats-summary",children:(0,m.jsx)("div",{className:"mailpoet-listing",children:(0,m.jsx)("table",{className:"mailpoet-listing-table",children:(0,m.jsx)("tbody",{children:n.map((e=>{let{label:t,date:n}=e;return(0,m.jsxs)("tr",{children:[(0,m.jsx)("td",{children:t}),(0,m.jsx)("td",{children:(0,m.jsx)("b",{children:Bt(n)})})]},t)}))})})})})}function Wt(){const e=(0,Ce.$B)(),t=(0,Ce.TH)(),[n,a]=(0,r.useState)(null),[i,s]=(0,r.useState)(!0),c=(0,l.S)(window).notices.error;return(0,r.useEffect)((()=>{d.x.Ajax.post({api_version:d.x.apiVersion,endpoint:"subscriberStats",action:"get",data:{subscriber_id:e.params.id}}).done((e=>{a(e.data),s(!1)})).fail((e=>{s(!1),e.errors.length>0&&c((0,m.jsx)(m.Fragment,{children:e.errors.map((e=>(0,m.jsx)("p",{children:e.message},e.message)))}),{scroll:!0})}))}),[e.params.id,c]),i?(0,m.jsx)(Et.g,{}):(0,m.jsxs)("div",{className:"mailpoet-subscriber-stats",children:[(0,m.jsx)(Dt,{email:n.email}),(0,m.jsx)(o.Heading,{level:4,children:d.x.I18n.t("engagementPeriodHeading")}),(0,m.jsxs)("div",{className:"mailpoet-subscriber-stats-summary-grid",children:[(0,m.jsx)(At,{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}}),(0,m.jsx)(qt,{stats:n}),n.woocommerce&&(0,m.jsx)(Rt,{averageRevenueValue:n.woocommerce.formatted_average,count:n.woocommerce.count,revenueValue:n.woocommerce.formatted})]}),(0,m.jsx)(Ft,{params:e.params,location:t})]})}function Vt(){return(0,m.jsx)(l.k.Provider,{value:(0,l.S)(window),children:(0,m.jsxs)(Ne.HashRouter,{children:[(0,m.jsx)(p.w,{}),(0,m.jsxs)(Ce.rs,{children:[(0,m.jsx)(Ce.AW,{path:"/new",render:(0,o.withBoundary)(Tt)}),(0,m.jsx)(Ce.AW,{path:"/edit/:id",render:(0,o.withBoundary)(Tt)}),(0,m.jsx)(Ce.AW,{path:"/stats/:id/(.*)?",component:(0,o.withBoundary)(Wt)}),(0,m.jsx)(Ce.AW,{path:"*",component:(0,o.withBoundary)(Qe)})]})]})})}Wt.displayName="SubscriberStats";const $t=document.getElementById("subscribers_container");$t&&((0,o.registerTranslations)(),s.render((0,m.jsx)(Vt,{}),$t));var Ut=n(44137),Yt=n(85336);class Ht extends r.PureComponent{render(){const e=this.props.event,t=e.soon;let n;if(this.props.premium)n=(0,m.jsx)("a",{href:"?page=mailpoet-premium",target:"_blank",children:(0,Pe.__)("This is a Premium feature","mailpoet")});else if(e.actionButtonLink&&e.actionButtonTitle)n=(0,m.jsx)("a",{href:e.actionButtonLink,target:"_blank",rel:"noopener noreferrer",children:e.actionButtonTitle});else{const a=t?null:ot.ZP.partial(this.props.eventsConfigurator,e.slug);n=(0,m.jsx)(Le.z,{disabled:t,onClick:a,role:"presentation",automationId:`create_${e.slug}`,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),a())},children:e.actionButtonTitle||(0,Pe.__)("Set up","mailpoet")})}return(0,m.jsxs)("div",{"data-type":e.slug,className:"mailpoet-newsletter-type",children:[(0,m.jsx)("div",{className:"mailpoet-newsletter-type-image",children:e.badge&&(0,m.jsx)(Yt.C,{title:e.badge.text})}),(0,m.jsxs)("div",{className:"mailpoet-newsletter-type-content",children:[(0,m.jsxs)(_t.X,{level:4,children:[e.title," ",e.soon&&`(${(0,Pe.__)("Soon","mailpoet")})`]}),(0,m.jsx)("p",{children:e.description}),(0,m.jsx)("div",{className:"mailpoet-flex-grow"}),(0,m.jsx)("div",{className:"mailpoet-newsletter-type-action",children:n})]})]})}}Ht.defaultProps={premium:!1},Ht.propTypes={premium:De().bool,eventsConfigurator:De().func.isRequired,event:De().shape({slug:De().string.isRequired,actionButtonLink:De().string,title:De().string.isRequired,soon:De().bool,badge:De().shape({style:De().string,text:De().string}),description:De().string.isRequired,actionButtonTitle:De().string}).isRequired};class zt extends r.Component{constructor(e){super(e),this.email=this.props.email,this.emailEvents=this.email.events,this.eventsConfigurator=this.eventsConfigurator.bind(this)}eventsConfigurator(e){d.x.trackEvent("Emails > Automatic Type selected",{"Email type":e}),this.props.history.push(`/new/${this.email.slug}/${e}/conditions`)}render(){return ot.ZP.map(this.emailEvents,((e,t)=>(0,m.jsx)(Ht,{premium:this.email.premium,event:e,eventsConfigurator:this.eventsConfigurator},t)))}}zt.propTypes={email:De().shape({title:De().string.isRequired,slug:De().string.isRequired,premium:De().bool}).isRequired,history:De().shape({push:De().func.isRequired}).isRequired};const Zt=(0,Ce.EN)(zt),Kt={woocommerce:(0,m.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,m.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,m.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 Gt=n(80809);function Qt(e){let{errors:t}=e;return t.length<1?null:(0,m.jsx)(u.q,{type:"error",closable:!1,children:t.map((e=>(0,m.jsx)("p",{children:e.message},e.message)))})}var Xt=n(89483);function Jt(e){let{filter:t,history:n,hideClosingButton:a=!1,hideScreenOptions:i=!0}=e;const[s,o]=(0,r.useState)(!1),l=e=>{void 0!==e&&(n.push(`/new/${e}`),d.x.trackEvent("Emails > Type selected",{"Email type":e}))},c=async()=>{d.x.trackEvent("Emails > Type selected",{"Email type":"wc_transactional"});let e=window.mailpoet_woocommerce_transactional_email_id;if(!e)try{e=(await d.x.Ajax.post({api_version:d.x.apiVersion,endpoint:"settings",action:"set",data:{"woocommerce.use_mailpoet_editor":1}})).data.woocommerce.transactional_email_id,d.x.trackEvent("Emails > WooCommerce email customizer enabled")}catch(e){return(0,Xt.q)(e)&&e.errors.length>0?(0,m.jsx)(Qt,{errors:e.errors}):null}return window.location.href=`?page=mailpoet-newsletter-editor&id=${e}`,null},p=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,m.jsxs)("div",{"data-type":e.slug,className:"mailpoet-newsletter-type",children:[(0,m.jsx)("div",{className:"mailpoet-newsletter-type-image"}),(0,m.jsxs)("div",{className:"mailpoet-newsletter-type-content",children:[(0,m.jsxs)(_t.X,{level:4,children:[e.title," ",e.beta?`(${(0,Pe.__)("Beta","mailpoet")})`:""]}),(0,m.jsx)("p",{children:e.description}),e.videoGuide&&(0,m.jsxs)("a",{className:t,href:e.videoGuide,"data-beacon-article":e.videoGuideBeacon,target:"_blank",rel:"noopener noreferrer",children:[(0,m.jsx)("span",{className:"dashicons dashicons-format-video"}),(0,Pe.__)("See video guide","mailpoet")]}),(0,m.jsx)("div",{className:"mailpoet-flex-grow"}),(0,m.jsx)("div",{className:"mailpoet-newsletter-type-action",children:e.action})]})]},e.slug)},u=()=>{if(!d.x.isWoocommerceActive)return[];const e=[{slug:"wc_transactional",title:(0,Pe.__)("WooCommerce Emails Customizer","mailpoet"),description:(0,Pe.__)("Customize the template used for your WooCommerce emails using MailPoet's editor. Example of WooCommerce email: Order processing notification, Order failed notification, ...","mailpoet"),action:(0,m.jsx)(Le.z,{automationId:"customize_woocommerce",onClick:c,tabIndex:0,onKeyDown:async e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),await c())},children:(0,Pe.__)("Customize","mailpoet")})}];return d.x.hideAutomations&&e.push((()=>{const e=()=>{d.x.trackEvent("Emails > Type selected",{"Email type":"woocommerce_automatewoo"},{send_immediately:!0},(()=>{window.location.href="edit.php?post_type=aw_workflow#presets"}))};return{slug:"woocommerce_automatewoo",title:(0,Pe.__)("Automations","mailpoet"),description:(0,Pe.__)("Convert and retain customers with automated marketing that does the hard work for you. AutomateWoo has the tools you need to grow your store and make more money.","mailpoet"),action:(0,m.jsx)(Le.z,{automationId:"woocommerce_automatewoo",onClick:e,tabIndex:0,onKeyDown:t=>{["keydown","keypress"].includes(t.type)&&["Enter"," "].includes(t.key)&&(t.preventDefault(),e())},children:(0,Pe.__)("Set up","mailpoet")})}})()),e},h=ot.ZP.partial((e=>{o(!0),d.x.trackEvent("Emails > Type selected",{"Email type":e}),d.x.Ajax.post({api_version:d.x.apiVersion,endpoint:"newsletters",action:"create",data:{type:e,subject:(0,Pe.__)("Subject","mailpoet")}}).done((e=>{n.push(`/template/${e.data.id}`)})).fail((e=>(o(!1),e.errors.length>0?(0,m.jsx)(Qt,{errors:e.errors}):null)))}),"standard"),f=ot.ZP.partial(l,"notification"),g=ot.ZP.partial(l,"welcome"),x=ot.ZP.partial(l,"re-engagement"),_=[{slug:"standard",title:(0,Pe.__)("Newsletter","mailpoet"),description:(0,Pe.__)("Send a newsletter with images, buttons, dividers, and social bookmarks. Or, just send a basic text email.","mailpoet"),action:(0,m.jsx)(Le.z,{automationId:"create_standard",onClick:h,tabIndex:0,withSpinner:s,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),h())},children:(0,Pe.__)("Create","mailpoet")})},{slug:"welcome",title:(0,Pe.__)("Welcome Email","mailpoet"),description:(0,Pe.__)("Automatically send an email (or series of emails) to new subscribers or WordPress users. Send a day, a week, or a month after they sign up.","mailpoet"),videoGuide:"https://kb.mailpoet.com/article/254-video-guide-to-welcome-emails",videoGuideBeacon:"5b05ebf20428635ba8b2aa53",action:(0,m.jsx)(Le.z,{onClick:g,automationId:"create_welcome",withSpinner:s,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),g())},tabIndex:0,children:(0,Pe.__)("Set up","mailpoet")})},{slug:"notification",title:(0,Pe.__)("Latest Post Notifications","mailpoet"),description:(0,Pe.__)("Let MailPoet email your subscribers with your latest content. You can send daily, weekly, monthly, or even immediately after publication.","mailpoet"),videoGuide:"https://kb.mailpoet.com/article/210-video-guide-to-post-notifications",videoGuideBeacon:"59ba6fb3042863033a1cd5a5",action:(0,m.jsx)(Le.z,{automationId:"create_notification",onClick:f,withSpinner:s,tabIndex:0,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),f())},children:(0,Pe.__)("Set up","mailpoet")})},{slug:"re_engagement",title:(0,Pe.__)("Re-engagement Emails","mailpoet"),description:(0,Pe.__)("Automatically email and win back subscribers who have recently lost interest and stopped engaging with your emails.","mailpoet"),action:(0,m.jsx)(Le.z,{automationId:"create_notification",onClick:x,withSpinner:s,tabIndex:0,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),x())},children:(0,Pe.__)("Set up","mailpoet")})}];let b=Pt.Hooks.applyFilters("mailpoet_newsletters_types",[..._],this);t&&(b=b.filter(t));const v=d.x.Ajax.constructGetUrl({api_version:d.x.apiVersion,endpoint:"newsletterTemplates",action:"getAll"});return(0,m.jsxs)(m.Fragment,{children:[i&&(0,m.jsx)(St.B,{}),(0,m.jsx)("link",{rel:"prefetch",href:window.mailpoet_editor_javascript_url,as:"script"}),(0,m.jsxs)("div",{className:"mailpoet-newsletter-types",children:[!a&&(0,m.jsx)("div",{className:"mailpoet-newsletter-types-close",children:(0,m.jsx)("button",{type:"button",onClick:()=>n.push("/"),className:"mailpoet-modal-close",children:Gt.X})}),b.map((e=>p(e)),this),(()=>{if(!window.mailpoet_woocommerce_automatic_emails)return[];let e=window.mailpoet_woocommerce_automatic_emails;return t&&(e=ot.ZP.filter(e,t)),ot.ZP.map(e,(e=>{const a=e;return(0,m.jsxs)(r.Fragment,{children:[!t&&(0,m.jsxs)("div",{className:"mailpoet-newsletter-types-separator",children:[(0,m.jsx)("div",{className:"mailpoet-newsletter-types-separator-line"}),(0,m.jsx)("div",{className:"mailpoet-newsletter-types-separator-logo",children:Kt[a.slug]||null}),(0,m.jsx)("div",{className:"mailpoet-newsletter-types-separator-line"})]}),"woocommerce"===a.slug&&!d.x.hideAutomations&&(0,m.jsx)(Zt,{email:a,history:n}),"woocommerce"===a.slug&&u().map((e=>p(e)),this)]},a.slug)}))})()]}),(0,m.jsx)("link",{rel:"prefetch",href:v,as:"fetch"})]})}Jt.defaultProps={filter:null,hideScreenOptions:!0,hideClosingButton:!1};const en=(0,Ce.EN)(Jt);var tn=n(87236);function nn(e){let{newsletter:t,isSent:n,currentTime:a}=e,i=n;if(void 0===i&&(i=t.statistics&&t.queue&&"scheduled"!==t.queue.status),!i)return null;const s={link:`/stats/${t.id}`,onClick:Pt.Hooks.applyFilters("mailpoet_newsletters_listing_stats_tracking",Ut.gP)},r=Number(t.total_sent||t.queue.count_processed);let l,c,d,p,u,h=0,f=0,g=null;r>0&&(h=100*t.statistics.clicked/r,f=100*t.statistics.opened/r,g=t.statistics.revenue),void 0!==a?(l=6,c=t.queue.scheduled_at||t.queue.created_at,d=Je()(a).diff(Je()(c),"hours"),p=d<l,u=!0):(p=!1,u=!1);const x=r>=20&&t.statistics.opened>=5&&!p,_=(e,n)=>((e,t,n,a)=>a<=0||!t.link?e:t.externalLink?(0,m.jsx)("a",{href:t.link,onClick:t.onClick||null,children:e},`stats-${n}`):(0,m.jsx)(Ne.Link,{to:t.link,onClick:t.onClick||null,children:e},`stats-${n}`))(e,s,`${n}-${t.id}`,r),b=(0,m.jsx)(tn.M,{opened:f,clicked:h,revenues:g&&g.value>0?g.formatted:null,hideBadges:!x,newsletterId:t.id,wrapContentInLink:_}),v=(0,m.jsxs)(m.Fragment,{children:[b,p&&_((0,m.jsx)(o.Tag,{className:"mailpoet-listing-stats-too-early",dimension:"large",variant:"excellent",isInverted:!0,children:(0,Pe.__)("Nice job! Check back in %1$d hour(s) for more stats.","mailpoet").replace("%1$d",l-d)}),"check-back")]});let y;return u&&f<5&&d>=24&&r>=10&&(y=(0,m.jsx)("div",{children:(0,m.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:(0,Pe.__)("What can I do to improve this?","mailpoet")})})),(0,m.jsxs)(m.Fragment,{children:[v,y]})}const an=De().shape({clicked:De().number,opened:De().number,unsubscribed:De().number,revenue:De().shape({count:De().number,currency:De().string,formatted:De().string,value:De().number})}),sn=De().shape({status:De().string,count_processed:De().string.isRequired,count_total:De().string.isRequired,created_at:De().string,scheduled_at:De().string});nn.propTypes={newsletter:De().shape({id:De().number.isRequired,queue:De().oneOfType([sn,De().bool]),total_sent:De().number,statistics:De().oneOfType([an,De().bool])}).isRequired,isSent:De().bool,currentTime:De().string},nn.defaultProps={isSent:void 0,currentTime:void 0},nn.displayName="NewsletterStatistics";const rn=(0,o.withBoundary)(nn),on=d.x.trackingConfig.emailTrackingEnabled,ln=window.mailpoet_woocommerce_automatic_emails||{},cn={onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?(0,Pe.__)("1 email was moved to the trash.","mailpoet"):(0,Pe.__)("%1$d emails were moved to the trash.","mailpoet").replace("%1$d",t.toLocaleString()),d.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?(0,Pe.__)("1 email was permanently deleted.","mailpoet"):(0,Pe.__)("%1$d emails were permanently deleted.","mailpoet").replace("%1$d",t.toLocaleString()),d.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?(0,Pe.__)("1 email has been restored from the Trash.","mailpoet"):(0,Pe.__)("%1$d emails have been restored from the Trash.","mailpoet").replace("%1$d",t.toLocaleString()),d.x.Notice.success(n)}},dn=[{name:"subject",label:(0,Pe.__)("Subject","mailpoet"),sortable:!0},{name:"settings",label:(0,Pe.__)("Settings","mailpoet")},{name:"statistics",label:(0,Pe.__)("Clicked, Opened","mailpoet"),display:on},{name:"status",label:(0,Pe.__)("Status","mailpoet"),width:145},{name:"updated_at",label:(0,Pe.__)("Last modified on","mailpoet"),sortable:!0}],pn=[{name:"trash",label:(0,Pe.__)("Move to trash","mailpoet"),onSuccess:cn.onTrash}];let un=[{name:"view",link:function(e){return(0,m.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:(0,Pe.__)("Preview","mailpoet")})}},{name:"edit",className:"mailpoet-hide-on-mobile",label:(0,Pe.__)("Edit","mailpoet"),onClick:Ut.Q2},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:(0,Pe.__)("Duplicate","mailpoet"),onClick:(e,t)=>d.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{d.x.Notice.success((0,Pe.__)('Email "%1$s" has been duplicated.',"mailpoet").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&d.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},{name:"trash",className:"mailpoet-hide-on-mobile"}];un=(0,Ut.y8)(un);class mn extends r.Component{constructor(e){super(e),this.state={eventCounts:{},newslettersCount:void 0},this.afterGetItems=this.afterGetItems.bind(this)}updateStatus=(e,t)=>{t.persist(),d.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=ln[e];d.x.Notice.success((0,Pe.__)("Your %1s Automatic Email is now activated!","mailpoet").replace("%1s",n.title))}this.forceUpdate()})).fail((n=>{d.x.Notice.showApiErrorNotice(n),t.target.checked=!e}))};renderStatus=e=>{const t=parseInt(e.total_sent,10)>-1?(0,Pe.__)("Sent to %1$d customers","mailpoet").replace("%1$d",e.total_sent.toLocaleString()):null;return(0,m.jsxs)("div",{children:[(0,m.jsx)(o.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,m.jsxs)("p",{className:"mailpoet-listing-notification-status",children:[t&&(0,m.jsx)(Ne.Link,{to:`/sending-status/${e.id}`,children:t}),!t&&(0,m.jsx)("span",{className:"mailpoet-listing-status-unknown mailpoet-font-extra-small",children:(0,Pe.__)("Not sent yet","mailpoet")})]})]})};renderSettings=e=>{const t=ln[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 a=n&&n.option?ot.ZP.pluck(n.option,"name"):[];if(n&&ot.ZP.isEmpty(a))return(0,m.jsx)("span",{className:"mailpoet-listing-error",children:(0,Pe.__)("You need to configure email options before this email can be sent.","mailpoet")});let i,s;if(i=a.length>1&&"listingScheduleDisplayTextPlural"in t?x()(t.listingScheduleDisplayTextPlural,"%s",((e,t)=>(0,m.jsx)(o.StringTags,{strings:a},t))):x()(t.listingScheduleDisplayText,"%s",((e,t)=>(0,m.jsx)(o.StringTags,{strings:a},t))),i&&"immediate"!==e.options.afterTimeType)switch(e.options.afterTimeType){case"minutes":s=(0,Pe.__)("%1$d minute(s) later","mailpoet").replace("%1$d",e.options.afterTimeNumber);break;case"hours":s=(0,Pe.__)("%1$d hour(s) later","mailpoet").replace("%1$d",e.options.afterTimeNumber);break;case"days":s=(0,Pe.__)("%1$d day(s) later","mailpoet").replace("%1$d",e.options.afterTimeNumber);break;case"weeks":s=(0,Pe.__)("%1$d week(s) later","mailpoet").replace("%1$d",e.options.afterTimeNumber);break;default:s=(0,Pe.__)("Invalid sending delay.","mailpoet")}return(0,m.jsxs)("span",{children:[i,s&&(0,m.jsxs)("div",{className:"mailpoet-listing-schedule",children:[(0,m.jsx)("div",{className:"mailpoet-listing-schedule-icon",children:(0,m.jsx)(o.ScheduledIcon,{})}),s]})]})};renderItem=(e,t)=>{const n=ee()("manage-column","column-primary","has-row-actions");return(0,m.jsxs)("div",{children:[(0,m.jsxs)("td",{className:n,children:[(0,m.jsx)("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`,onClick:t=>{t.preventDefault(),(0,Ut.Q2)(e)},children:e.subject}),t]}),(0,m.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":(0,Pe.__)("Settings","mailpoet"),children:this.renderSettings(e)}),!0===on?(0,m.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":(0,Pe.__)("Clicked, Opened","mailpoet"),children:(0,m.jsx)(rn,{newsletter:e,isSent:e.total_sent>0&&!!e.statistics})}):null,(0,m.jsx)("td",{className:"column","data-colname":(0,Pe.__)("Status","mailpoet"),children:this.renderStatus(e)}),(0,m.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":(0,Pe.__)("Last modified on","mailpoet"),children:[d.x.Date.short(e.updated_at),(0,m.jsx)("br",{}),d.x.Date.time(e.updated_at)]})]})};isItemInactive=e=>"draft"===e.status;afterGetItems(e){(0,Ut._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,m.jsxs)("div",{className:"notice error",children:[(0,m.jsx)("p",{children:(0,Pe.__)("WooCommerce emails won’t be sent to new customers because the opt-in on checkout is disabled. Enable it so they can immediately get your emails after their first purchase.","mailpoet")}),(0,m.jsx)("p",{children:(0,m.jsx)("a",{href:"?page=mailpoet-settings#woocommerce",children:(0,Pe.__)("Edit WooCommerce settings","mailpoet")})})]}):null}render(){const{match:e,location:t}=this.props;return(0,m.jsxs)(m.Fragment,{children:[this.renderWarning(),0===this.state.newslettersCount&&(0,m.jsx)(en,{filter:e=>"woocommerce"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&(0,m.jsx)(Oe.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:dn,bulk_actions:pn,item_actions:un,messages:cn,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)}})]})}}mn.propTypes={match:De().shape({params:De().shape({tab:De().string}).isRequired}).isRequired,location:De().object.isRequired},mn.displayName="ListingsComponent";const hn=(0,Ce.EN)((0,o.withBoundary)(mn));var fn=n(97184),gn=n(4611);const xn=(0,Ce.EN)((e=>(0,m.jsx)(gn.b,{...e})));var _n=n(95662),bn=n(77997);class vn extends r.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:a}=this.props;(0,bn._)({message:(0,Pe.__)('You are about to delete the template named "%1$s".',"mailpoet").replace("%1$s",t),onConfirm:()=>{n(),d.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"delete",data:{id:e}}).done((()=>{a(!0,e)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,m.jsx)("p",{children:e.message},e.message))),{scroll:!0}),a(!1)}))}})}onPreview(){d.x.Modal.popup({title:this.props.name,template:'<img src="{{ thumbnail }}" />',data:this.props})}onSelect(){const{newsletterId:e,name:t,beforeSelect:n,afterSelect:a}=this.props;n(),d.x.trackEvent("Emails > Template selected",{"Email name":t}),d.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"save",data:{id:e,template_id:this.props.id}}).done((e=>{a(!0,e.data.id)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,m.jsx)("p",{children:e.message},e.message))),{scroll:!0}),a(!1)}))}render(){const{index:e,name:t,thumbnail:n,readonly:a}=this.props;let i="";return"string"==typeof n&&n.length>0&&(i=(0,m.jsxs)("a",{className:"mailpoet-template-preview",href:"#",onClick:e=>{e.preventDefault(),this.onPreview(e)},children:[(0,m.jsx)("div",{className:"mailpoet-template-thumbnail",children:n?(0,m.jsx)("img",{src:n,alt:(0,Pe.__)("Template preview","mailpoet"),loading:"lazy"}):""}),(0,m.jsx)("div",{className:"mailpoet-template-preview-overlay",children:(0,m.jsx)(Le.z,{children:(0,Pe.__)("Preview","mailpoet")})})]})),(0,m.jsx)(_n.G,{label:t,onSelect:this.onSelect,onDelete:!1===a?this.onDelete:void 0,automationId:`select_template_${e}`,className:"mailpoet-template-two-lines",children:i})}}vn.contextType=l.k,vn.propTypes={index:De().number.isRequired,id:De().number.isRequired,newsletterId:De().string.isRequired,name:De().string.isRequired,thumbnail:De().string,readonly:De().bool.isRequired,beforeDelete:De().func.isRequired,afterDelete:De().func.isRequired,beforeSelect:De().func.isRequired,afterSelect:De().func.isRequired},vn.defaultProps={thumbnail:null},vn.displayName="TemplateBox";class yn extends r.Component{constructor(e){super(e),this.fileRef=(0,r.createRef)(),this.handleSubmit=this.handleSubmit.bind(this)}handleSubmit(e){if(e.preventDefault(),ot.ZP.size(this.fileRef.current.files)<=0)return!1;const t=ot.ZP.first(this.fileRef.current.files),n=new FileReader;return n.onload=e=>{try{this.saveTemplate(JSON.parse(e.target.result)),d.x.trackEvent("Emails > Template imported")}catch(e){this.context.notices.error((0,m.jsx)("p",{children:(0,Pe.__)("This template file appears to be damaged. Please try another one.","mailpoet")}))}},n.readAsText(t),!0}saveTemplate(e){const t=e,{beforeImport:n,afterImport:a}=this.props;ot.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(),d.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"save",data:t}).done((e=>{a(!0,e.data)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,m.jsx)("p",{children:e.message},e.message))),{scroll:!0}),a(!1)}))}render(){return(0,m.jsxs)("div",{className:"mailpoet-template-import",children:[(0,m.jsxs)("h4",{children:[(0,Pe.__)("Import a template","mailpoet"),(0,m.jsx)(Fe.Tooltip,{tooltip:(0,Pe.__)("You can only upload .json templates that were originally created with MailPoet.","mailpoet"),place:"right",className:"tooltip-help-import-template"})]}),(0,m.jsxs)("form",{onSubmit:this.handleSubmit,children:[(0,m.jsx)("input",{type:"file",placeholder:(0,Pe.__)("Select a .json file to upload","mailpoet"),ref:this.fileRef}),(0,m.jsx)("p",{className:"submit",children:(0,m.jsx)("input",{className:"button button-primary",type:"submit",value:(0,Pe.__)("Upload","mailpoet")})})]})]})}}yn.contextType=l.k,yn.propTypes={beforeImport:De().func.isRequired,afterImport:De().func.isRequired};const wn=[];window.mailpoet_newsletters_templates_recently_sent_count&&wn.push({name:"recent",label:(0,Pe.__)("Recently sent","mailpoet")}),wn.push({name:"standard",label:(0,Pe.__)("Newsletters","mailpoet")},{name:"welcome",label:(0,Pe.__)("Welcome Emails","mailpoet")},{name:"notification",label:(0,Pe.__)("Post Notifications","mailpoet")},{name:"re_engagement",label:(0,Pe.__)("Re-engagement Emails","mailpoet")},{name:"blank",label:(0,Pe.__)("Simple text","mailpoet")}),window.mailpoet_woocommerce_active&&wn.push({name:"woocommerce",label:(0,Pe.__)("WooCommerce Emails","mailpoet")}),wn.push({name:"saved",label:(0,Pe.__)("Your saved templates","mailpoet")});class jn extends r.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(){d.x.Ajax.get({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"getAll"}).done((e=>{0===e.data.length&&(e.data=[{name:(0,Pe.__)("MailPoet's Guide","mailpoet"),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,m.jsx)("p",{children:e.message},e.message))),{scroll:!0})})).always((()=>{this.selectInitialTab()}))}addTemplate(e){const t=wn.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,a)=>{if(e.includes(t)){if(n.categories.includes('"blank"')&&!a.categories.includes('"blank"'))return-1;if(!n.categories.includes('"blank"')&&a.categories.includes('"blank"'))return 1}return n.id<a.id?1:-1}))}))}selectInitialTab(){let e,t,n="standard";d.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"get",data:{id:this.props.match.params.id}}).done((a=>{e=a.data.type,t=a.data.options,"automatic"===e&&(e=a.data.options.group||e),window.mailpoet_newsletters_templates_recently_sent_count?n="recent":ot.ZP.findWhere(wn,{name:a.data.type})?n=a.data.type:"automatic"===a.data.type&&ot.ZP.findWhere(wn,{name:a.data.options.group})&&(n=a.data.options.group)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,m.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=>{const t=new URLSearchParams(window.location.search).get("context"),n=`admin.php?page=mailpoet-newsletter-editor&id=${e}`;return t?`${n}&context=${t}`:n})(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,m.jsx)(Et.g,{});const e=wn.concat({name:"import",label:(0,Pe._x)("Import","Importing template tab title","mailpoet")}).map((e=>Object.assign(e,{automationId:`templates-${e.name.replace(/\s+/g,"-").toLowerCase()}`})));let t=null;if("import"===this.state.selectedTab)t=(0,m.jsx)(yn,{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,m.jsx)("p",{children:(0,Pe.__)("This category does not contain any template yet!","mailpoet")}):e.map(((e,t)=>(0,m.jsx)(vn,{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,a=null;if("automation"===this.state.emailType){var i;const e=null===(i=this.state.emailOptions)||void 0===i?void 0:i.automationId,t=e?`admin.php?page=mailpoet-automation-editor&id=${e}`:"admin.php?page=mailpoet-automation";n=()=>{window.location=t},a=(0,m.jsx)("input",{type:"button",className:"button link-button",onClick:n,value:"Cancel"})}return(0,m.jsxs)("div",{children:[(0,m.jsx)(et.A,{color:"#fff"}),(0,m.jsx)(xn,{emailType:this.state.emailType,automationId:"email_template_selection_heading",buttons:a,onLogoClick:n}),(0,m.jsxs)("div",{className:"mailpoet-templates",children:[(0,m.jsx)(o.ErrorBoundary,{children:(0,m.jsx)(fn.R,{categories:e,active:this.state.selectedTab,onSelect:e=>this.setState({selectedTab:e})})}),(0,m.jsx)(o.ErrorBoundary,{children:t})]})]})}}jn.contextType=l.k,jn.propTypes={match:De().shape({params:De().shape({id:De().string}).isRequired}).isRequired},jn.display="NewsletterTemplates";var Sn=n(61888),kn=n.n(Sn),Nn=n(88245),Cn=n.n(Nn),In=n(44827),Tn=n(81677),En=n.n(Tn),Dn=n(60016),On=n(29514),An=n.n(On),Rn=n(77766);function Pn(e){let{dimension:t,isFullWidth:n,iconStart:a,iconEnd:i,...s}=e;return(0,m.jsxs)("div",{className:ee()("mailpoet-datepicker mailpoet-form-input",{[`mailpoet-form-input-${t}`]:t,"mailpoet-disabled":s.disabled,"mailpoet-full-width":n}),children:[a,(0,m.jsx)(En(),{useWeekdaysShort:!0,calendarStartDay:s.calendarStartDay??d.x.wpWeekStartsOn,...s}),i]})}Pn.displayName="Datepicker";const Ln=(0,Rn.lV)(Pn),Mn={abbreviated:[(0,Pe.__)("Jan","mailpoet"),(0,Pe.__)("Feb","mailpoet"),(0,Pe.__)("Mar","mailpoet"),(0,Pe.__)("Apr","mailpoet"),(0,Pe.__)("May","mailpoet"),(0,Pe.__)("Jun","mailpoet"),(0,Pe.__)("Jul","mailpoet"),(0,Pe.__)("Aug","mailpoet"),(0,Pe.__)("Sep","mailpoet"),(0,Pe.__)("Oct","mailpoet"),(0,Pe.__)("Nov","mailpoet"),(0,Pe.__)("Dec","mailpoet")],wide:[(0,Pe.__)("January","mailpoet"),(0,Pe.__)("February","mailpoet"),(0,Pe.__)("March","mailpoet"),(0,Pe.__)("April","mailpoet"),(0,Pe.__)("May","mailpoet"),(0,Pe.__)("June","mailpoet"),(0,Pe.__)("July","mailpoet"),(0,Pe.__)("August","mailpoet"),(0,Pe.__)("September","mailpoet"),(0,Pe.__)("October","mailpoet"),(0,Pe.__)("November","mailpoet"),(0,Pe.__)("December","mailpoet")]},Fn={narrow:[(0,Pe._x)("S","Sunday - one letter abbreviation","mailpoet"),(0,Pe._x)("M","Monday - one letter abbreviation","mailpoet"),(0,Pe._x)("T","Tuesday - one letter abbreviation","mailpoet"),(0,Pe._x)("W","Wednesday - one letter abbreviation","mailpoet"),(0,Pe._x)("T","Thursday - one letter abbreviation","mailpoet"),(0,Pe._x)("F","Friday - one letter abbreviation","mailpoet"),(0,Pe._x)("S","Saturday - one letter abbreviation","mailpoet")],abbreviated:[(0,Pe.__)("Sun","mailpoet"),(0,Pe.__)("Mon","mailpoet"),(0,Pe.__)("Tue","mailpoet"),(0,Pe.__)("Wed","mailpoet"),(0,Pe.__)("Thu","mailpoet"),(0,Pe.__)("Fri","mailpoet"),(0,Pe.__)("Sat","mailpoet")],wide:[(0,Pe.__)("Sunday","mailpoet"),(0,Pe.__)("Monday","mailpoet"),(0,Pe.__)("Tuesday","mailpoet"),(0,Pe.__)("Wednesday","mailpoet"),(0,Pe.__)("Thursday","mailpoet"),(0,Pe.__)("Friday","mailpoet"),(0,Pe.__)("Saturday","mailpoet")]};Dn.Z.localize.month=An()({values:Mn,defaultWidth:"wide"}),Dn.Z.localize.day=An()({values:Fn,defaultWidth:"wide"}),Dn.Z.options.weekStartsOn=void 0!==d.x.wpWeekStartsOn?d.x.wpWeekStartsOn:1,(0,Tn.registerLocale)("mailpoet",Dn.Z);class Bn extends r.Component{onChange=(e,t)=>{const n=t,a=this.getStorageDate(e);n.target.name=this.getFieldName(),n.target.value=a,this.props.onChange(n)};getFieldName=()=>this.props.name||"date";getDisplayDateFormat=e=>d.x.Date.convertFormat(e).replace(/D/g,"d").replace(/Y/g,"y").replace(/A/g,"a").replace(/o/g,"Y").replace(/\[/g,"").replace(/\]/g,"");getDate=e=>{const t={parseFormat:this.props.storageFormat};return d.x.Date.toDate(e,t)};getStorageDate=e=>{const t={format:this.props.storageFormat};return d.x.Date.format(e,t)};render(){return(0,m.jsx)(Ln,{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})}}class qn extends r.Component{render(){const e=Object.keys(this.props.timeOfDayItems).map((e=>(0,m.jsx)("option",{value:e,children:this.props.timeOfDayItems[e]},`option-${this.props.timeOfDayItems[e]}`)));return(0,m.jsx)(lt.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})}}qn.propTypes={timeOfDayItems:De().objectOf(De().string).isRequired,name:De().string,value:De().string.isRequired,disabled:De().bool,onChange:De().func.isRequired,validation:De().object},qn.defaultProps={name:"time",disabled:!1,validation:{}},qn.displayName="TimeSelect";class Wn extends r.Component{DATE_TIME_SEPARATOR=" ";constructor(e){super(e),this.state=this.buildStateFromProps(e)}componentDidUpdate(e){this.props.value===e.value&&this.props.defaultDateTime===e.defaultDateTime||nt()((()=>{this.setState(this.buildStateFromProps(this.props))}))}getDateTime=()=>[this.state.date,this.state.time].join(this.DATE_TIME_SEPARATOR);buildStateFromProps=e=>{const t=e.value||this.props.defaultDateTime,[n,a]=t.split(this.DATE_TIME_SEPARATOR);return{date:n,time:a}};handleChange=e=>{const t={};t[e.target.name]=e.target.value,this.setState(t,this.propagateChange)};propagateChange=()=>{this.props.onChange&&this.props.onChange({target:{name:this.props.name||"",value:this.getDateTime()}})};render(){return(0,m.jsx)(In.Grid.Column,{className:"mailpoet-datetime-container",children:(0,m.jsxs)(o.ErrorBoundary,{children:[(0,m.jsx)(Bn,{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,m.jsx)(qn,{name:"time",value:this.state.time,onChange:this.handleChange,disabled:this.props.disabled,validation:this.props.timeValidation,timeOfDayItems:this.props.timeOfDayItems})]})})}}Wn.propTypes={value:De().string,defaultDateTime:De().string.isRequired,dateDisplayFormat:De().string.isRequired,dateStorageFormat:De().string.isRequired,onChange:De().func,name:De().string,disabled:De().bool,dateValidation:De().object.isRequired,timeValidation:De().any,timeOfDayItems:De().objectOf(De().string).isRequired,maxDate:De().instanceOf(Date)},Wn.defaultProps={onChange:void 0,name:"",disabled:!1,timeValidation:void 0,value:void 0,maxDate:null};var Vn=n(58300),$n=n(38007),Un=n(78041),Yn=n(99202);class Hn extends r.Component{constructor(e){super(e),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,$n.dy)(this.domElementSelector,this.parsleyFieldName)}onBlur(){this.validateEmailAddress()}isEmailAddressAuthorized=e=>(window.mailpoet_authorized_emails||[]).includes(e);showInvalidFromAddressError=()=>{(0,$n.Ib)(this.domElementSelector,this.parsleyFieldName," "),this.setState({showAuthEmailsError:!0})};showSenderFieldError=(e,t)=>{window.mailpoet_mss_active&&((0,$n.dy)(this.domElementSelector,this.parsleyFieldName),(0,$n.K0)(this.domElementSelector)?e||this.showInvalidFromAddressError(t):(0,$n.OP)(this.domElementSelector))};showSenderDomainError=e=>{e&&this.setState({showSenderDomainWarning:!0})};validateEmailAddress(){if(!window.mailpoet_mss_active)return;const e=this.state.emailAddress,t=(0,Un.DA)(e);if(window.mailpoet_verified_sender_domains.includes(t))return;const n=this.isEmailAddressAuthorized(e);this.showSenderFieldError(n,e),d.x.freeMailDomains.indexOf(t)>-1||(0,Yn.g)(e).then((t=>{this.showSenderDomainError(t,e)})).catch((()=>{}))}render(){return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(it,{item:{...this.props.item,sender_address:this.state.emailAddress},field:this.props.field,onValueChange:this.onChange,onBlurEvent:this.onBlur}),(0,m.jsx)("div",{className:"regular-text regular-text-full-width",children:(0,m.jsx)(Vn.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}),d.x.trackEvent("MSS in plugin authorize email",{"authorized email source":"newsletter",wasSuccessful:"yes"})),"domain"===e.type&&(this.setState({showSenderDomainWarning:!1}),d.x.trackEvent("MSS in plugin verify sender domain",{"verify sender domain source":"newsletter",wasSuccessful:"yes"})),(0,$n.dy)(this.domElementSelector,this.parsleyFieldName)}})})]})}}Hn.propTypes={field:De().object.isRequired,item:De().shape({sender_address:De().string.isRequired}).isRequired,onValueChange:De().func},Hn.defaultProps={onValueChange:function(){}},Hn.displayName="SenderField";const zn=ot.ZP.once((()=>d.x.trackEvent("User has typed a GA campaign name"))),Zn=x()((0,Pe.__)("For example, “Spring email”. [link]Read the guide.[/link]","mailpoet"),/\[link\](.*?)\[\/link\]/g,((e,t)=>(0,m.jsxs)("span",{children:[(0,m.jsx)("br",{}),(0,m.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))),Kn={name:"ga_campaign",label:(0,Pe.__)("Google Analytics Campaign","mailpoet"),tip:Zn,type:"text",onBeforeChange:zn};var Gn=n(27099),Qn=n(67912);const Xn=window.mailpoet_current_time||"00:00",Jn=`${window.mailpoet_tomorrow_date} 08:00:00`,ea=window.mailpoet_schedule_time_of_day,ta=window.mailpoet_date_format,na=window.mailpoet_date_storage_format;class aa extends r.Component{getCurrentValue=()=>{var e;return{isScheduled:"0",scheduledAt:Jn,...(null===(e=this.props.item)||void 0===e?void 0:e[this.props.field.name])??{}}};getDateValidation=()=>({"data-parsley-required":!0,"data-parsley-required-message":(0,Pe.__)("Please enter the scheduled date.","mailpoet"),"data-parsley-errors-container":"#mailpoet_scheduling"});isScheduled=()=>"1"===this.getCurrentValue().isScheduled;handleCheckboxChange=(e,t)=>{const n={...t};n.target.value=t.target.checked?"1":"0",this.handleValueChange(n)};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,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("span",{className:"mailpoet-form-schedule-time",children:[(0,Pe.__)("Your website’s time is","mailpoet")," ",Xn]}),(0,m.jsx)("div",{className:"mailpoet-gap"}),(0,m.jsx)("div",{id:"mailpoet_scheduling",children:(0,m.jsx)(Wn,{name:"scheduledAt",value:this.getCurrentValue().scheduledAt,onChange:this.handleValueChange,disabled:this.props.field.disabled,dateValidation:this.getDateValidation(),defaultDateTime:Jn,timeOfDayItems:ea,dateDisplayFormat:ta,dateStorageFormat:na,maxDate:t})})]})),(0,m.jsxs)("div",{children:[(0,m.jsx)(Gn.Z,{checked:this.isScheduled(),disabled:this.props.field.disabled,name:"isScheduled",onCheck:this.handleCheckboxChange,automationId:"email-schedule-checkbox"}),e]})}}let ia=[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:(0,Pe.__)("Subject","mailpoet"),className:"mailpoet-form-field-subject",placeholder:(0,Pe.__)("Type newsletter subject","mailpoet"),tooltip:(0,Pe.__)("Be creative! It's the first thing that your subscribers see. Tempt them to open your email.","mailpoet"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":(0,Pe.__)("Please specify a subject","mailpoet"),maxLength:250}},{name:"preheader",customLabel:(0,Pe.__)("Preview text","mailpoet"),className:"mailpoet-form-field-preheader",placeholder:(0,Pe.__)("Type preview text (usually displayed underneath the subject line in the inbox)","mailpoet"),tooltip:`${(0,Pe.__)("This optional text will appear in your subscribers' inboxes, beside the subject line. Write something enticing!","mailpoet")} ${(0,Pe.__)("Max length is 250 characters, however, we recommend 80 characters on a single line.","mailpoet")}`,type:"textarea",validation:{maxLength:250}}]},{name:"segments",label:(0,Pe.__)("Lists","mailpoet"),tip:(0,Pe.__)("Subscribers in multiple lists will only receive one email.","mailpoet"),type:"selection",placeholder:(0,Pe.__)("Select a list","mailpoet"),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":(0,Pe.__)("Please select a list","mailpoet"),"data-parsley-segments-with-subscribers":(0,Pe.__)("Please select a list with subscribers.","mailpoet")}},{name:"options",label:(0,Pe.__)("Schedule it","mailpoet"),type:"reactComponent",component:(0,o.withBoundary)(aa)},{name:"sender",label:(0,Pe.__)("Sender","mailpoet"),tip:(0,Pe.__)("Your name and email","mailpoet"),fields:[{name:"sender_name",type:"text",placeholder:(0,Pe.__)("John Doe","mailpoet"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:(0,o.withBoundary)(Hn),placeholder:(0,Pe.__)("[email protected]","mailpoet"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},Kn,{name:"reply-to",label:(0,Pe.__)("Reply-to","mailpoet"),tip:(0,Pe.__)("When your subscribers reply to your emails, their emails will go to this address.","mailpoet"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:(0,Pe.__)("John Doe","mailpoet")},{name:"reply_to_address",type:"text",placeholder:(0,Pe.__)("[email protected]","mailpoet"),validation:{"data-parsley-type":"email"}}]}];ia=Pt.Hooks.applyFilters("mailpoet_newsletters_3rd_step_fields",ia);const sa={getFields:()=>ia,getSendButtonOptions:function(){var e,t;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const a=Je()(window.mailpoet_current_date_time),i={value:"object"==typeof n.options&&"1"===(null===(e=n.options)||void 0===e?void 0:e.isScheduled)&&d.x.Date.isInFuture(null===(t=n.options)||void 0===t?void 0:t.scheduledAt,a)?(0,Pe.__)("Schedule","mailpoet"):(0,Pe.__)("Send","mailpoet")};return n.status!==Qn.sj.Sent&&n.status!==Qn.sj.Sending||(i.disabled="disabled"),i}},ra=window.mailpoet_time_format||"H:i",oa={immediate:(0,Pe.__)("immediately","mailpoet"),minutes:(0,Pe.__)("minute(s) later","mailpoet"),hours:(0,Pe.__)("hour(s) later","mailpoet"),days:(0,Pe.__)("day(s) later","mailpoet"),weeks:(0,Pe.__)("week(s) later","mailpoet")},la={daily:(0,Pe.__)("Once a day at...","mailpoet"),weekly:(0,Pe.__)("Weekly on...","mailpoet"),monthly:(0,Pe.__)("Monthly on the...","mailpoet"),nthWeekDay:(0,Pe.__)("Monthly every...","mailpoet"),immediately:(0,Pe.__)("Immediately","mailpoet")},ca=ot.ZP.object(ot.ZP.map(ot.ZP.times(96,(e=>900*e)),(e=>{const t=new Date(null);return t.setSeconds(e),[e,d.x.Date.format(t,{format:ra,offset:0})]}))),da={0:(0,Pe.__)("Sunday","mailpoet"),1:(0,Pe.__)("Monday","mailpoet"),2:(0,Pe.__)("Tuesday","mailpoet"),3:(0,Pe.__)("Wednesday","mailpoet"),4:(0,Pe.__)("Thursday","mailpoet"),5:(0,Pe.__)("Friday","mailpoet"),6:(0,Pe.__)("Saturday","mailpoet")},pa=ot.ZP.object(ot.ZP.map(ot.ZP.times(28,(e=>e)),(e=>{const t={0:(0,Pe.__)("1st","mailpoet"),1:(0,Pe.__)("2nd","mailpoet"),2:(0,Pe.__)("3rd","mailpoet")};let n;return n=void 0!==t[e]?t[e]:(0,Pe.__)("%1$dth","mailpoet").replace("%1$d",e+1),[e+1,n]}))),ua={1:(0,Pe.__)("1st","mailpoet"),2:(0,Pe.__)("2nd","mailpoet"),3:(0,Pe.__)("3rd","mailpoet"),L:(0,Pe._x)("last","e.g. monthly every last Monday","mailpoet")},ma={name:"intervalType",values:la},ha={name:"timeOfDay",values:ca},fa={name:"weekDay",values:da},ga={name:"monthDay",values:pa},xa={name:"nthWeekDay",values:ua};class _a extends r.Component{getCurrentValue=()=>this.props.item[this.props.field.name]||{};handleValueChanges=e=>{const t=this.getCurrentValue();return this.props.onValueChange({target:{name:this.props.field.name,value:ot.ZP.extend({},t,e)}})};handleIntervalChange=e=>{const t=e.target.value,n={};n.intervalType=t,"monthly"===t&&(n.monthDay="1"),this.handleValueChanges(n)};handleTimeOfDayChange=e=>this.handleValueChanges({timeOfDay:e.target.value});handleWeekDayChange=e=>this.handleValueChanges({weekDay:e.target.value});handleMonthDayChange=e=>this.handleValueChanges({monthDay:e.target.value});handleNthWeekDayChange=e=>this.handleValueChanges({nthWeekDay:e.target.value});render(){const e=this.getCurrentValue();let t,n,a,i;return"immediately"!==e.intervalType&&(t=(0,m.jsx)(ct,{field:ha,item:this.getCurrentValue(),onValueChange:this.handleTimeOfDayChange})),"weekly"!==e.intervalType&&"nthWeekDay"!==e.intervalType||(n=(0,m.jsx)(ct,{field:fa,item:this.getCurrentValue(),onValueChange:this.handleWeekDayChange})),"monthly"===e.intervalType&&(a=(0,m.jsx)(ct,{field:ga,item:this.getCurrentValue(),onValueChange:this.handleMonthDayChange})),"nthWeekDay"===e.intervalType&&(i=(0,m.jsx)(ct,{field:xa,item:this.getCurrentValue(),onValueChange:this.handleNthWeekDayChange})),(0,m.jsxs)("div",{children:[(0,m.jsxs)(In.Grid.CenteredRow,{children:[(0,m.jsx)(ct,{field:ma,item:this.getCurrentValue(),onValueChange:this.handleIntervalChange,automationId:"newsletter_interval_type"}),"immediately"===e.intervalType&&(0,m.jsx)("div",{children:(0,m.jsx)("p",{children:(0,Pe.__)("after publishing a post","mailpoet")})})]}),(0,m.jsx)("div",{className:"mailpoet-gap"}),(0,m.jsxs)("div",{className:"mailpoet-grid-column mailpoet-flex",children:[i,a,n,t]}),"immediately"!==e.intervalType&&(0,m.jsx)("div",{className:"mailpoet-gap"})]})}}_a.propTypes={item:De().object.isRequired,field:De().shape({name:De().string}).isRequired,onValueChange:De().func.isRequired};let ba=[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:(0,Pe.__)("Subject","mailpoet"),className:"mailpoet-form-field-subject",placeholder:(0,Pe.__)("Type newsletter subject","mailpoet"),tooltip:(0,Pe.__)("Be creative! It's the first thing that your subscribers see. Tempt them to open your email.","mailpoet"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":(0,Pe.__)("Please specify a subject","mailpoet"),maxLength:250}},{name:"preheader",customLabel:(0,Pe.__)("Preview text","mailpoet"),className:"mailpoet-form-field-preheader",placeholder:(0,Pe.__)("Type preview text (usually displayed underneath the subject line in the inbox)","mailpoet"),tooltip:`${(0,Pe.__)("This optional text will appear in your subscribers' inboxes, beside the subject line. Write something enticing!","mailpoet")} ${(0,Pe.__)("Max length is 250 characters, however, we recommend 80 characters on a single line.","mailpoet")}`,type:"textarea",validation:{maxLength:250}}]},{name:"options",label:(0,Pe.__)("Select a frequency","mailpoet"),type:"reactComponent",component:_a},{name:"segments",label:(0,Pe.__)("Lists","mailpoet"),tip:(0,Pe.__)("Subscribers in multiple lists will only receive one email.","mailpoet"),type:"selection",placeholder:(0,Pe.__)("Select a list","mailpoet"),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 ot.ZP.map(e,(e=>ot.ZP.find(t,(t=>t.id===e))))},validation:{"data-parsley-required":!0,"data-parsley-required-message":(0,Pe.__)("Please select a list","mailpoet")}},{name:"sender",label:(0,Pe.__)("Sender","mailpoet"),tip:(0,Pe.__)("Your name and email","mailpoet"),fields:[{name:"sender_name",type:"text",placeholder:(0,Pe.__)("John Doe","mailpoet"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:(0,o.withBoundary)(Hn),placeholder:(0,Pe.__)("[email protected]","mailpoet"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},Kn,{name:"reply-to",label:(0,Pe.__)("Reply-to","mailpoet"),tip:(0,Pe.__)("When your subscribers reply to your emails, their emails will go to this address.","mailpoet"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:(0,Pe.__)("John Doe","mailpoet")},{name:"reply_to_address",type:"text",placeholder:(0,Pe.__)("[email protected]","mailpoet"),validation:{"data-parsley-type":"email"}}]}];ba=Pt.Hooks.applyFilters("mailpoet_newsletters_3rd_step_fields",ba);const va={getFields:function(){return ba},getSendButtonOptions:function(){return{value:(0,Pe.__)("Activate","mailpoet")}}},ya=window.mailpoet_roles||{},wa=ot.ZP.filter(window.mailpoet_segments||[],(e=>"default"===e.type)),ja={name:"event",values:{segment:(0,Pe.__)("When someone subscribes to the list...","mailpoet"),user:(0,Pe.__)("When a new WordPress user is added to your site...","mailpoet")}},Sa={name:"segment",placeholder:(0,Pe.__)("Select a list","mailpoet"),forceSelect2:!0,values:wa,getCount:e=>parseInt(e.subscribers,10).toLocaleString(),getLabel:e=>e.name,getValue:e=>e.id},ka={name:"role",values:ya},Na={name:"afterTimeNumber",size:3,validation:{"data-parsley-required":!0,"data-parsley-errors-container":".mailpoet-form-errors","data-parsley-scheduled-at":(0,Pe.__)("An email can only be scheduled up to 5 years in the future. Please choose a shorter period.","mailpoet")}},Ca={name:"afterTimeType",values:oa};class Ia extends r.Component{getCurrentValue=()=>this.props.item[this.props.field.name]||{};handleValueChange=(e,t)=>{const n=this.getCurrentValue(),a={};let i=t;return"afterTimeNumber"===e&&(i=parseInt(t,10),i=Number.isNaN(i)?"":i),a[e]=i,this.props.onValueChange({target:{name:this.props.field.name,value:ot.ZP.extend({},n,a)}})};handleEventChange=e=>this.handleValueChange("event",e.target.value);handleSegmentChange=e=>this.handleValueChange("segment",e.target.value);handleRoleChange=e=>this.handleValueChange("role",e.target.value);handleAfterTimeNumberChange=e=>this.handleValueChange("afterTimeNumber",e.target.value);handleAfterTimeTypeChange=e=>this.handleValueChange("afterTimeType",e.target.value);render(){const e=this.getCurrentValue();let t,n;return t="user"===e.event?(0,m.jsx)(ct,{field:ka,item:this.getCurrentValue(),onValueChange:this.handleRoleChange}):(0,m.jsx)(Re.Y,{field:Sa,item:this.getCurrentValue(),onValueChange:this.handleSegmentChange}),"immediate"!==e.afterTimeType&&(n=(0,m.jsx)(it,{field:Na,item:this.getCurrentValue(),onValueChange:this.handleAfterTimeNumberChange})),(0,m.jsxs)("div",{children:[(0,m.jsx)(ct,{field:ja,item:this.getCurrentValue(),onValueChange:this.handleEventChange}),(0,m.jsx)("div",{className:"mailpoet-gap"}),t,(0,m.jsx)("div",{className:"mailpoet-gap"}),(0,m.jsxs)("div",{className:"mailpoet-grid-column mailpoet-flex",children:[n,(0,m.jsx)(ct,{field:Ca,item:this.getCurrentValue(),onValueChange:this.handleAfterTimeTypeChange})]}),(0,m.jsx)("div",{className:"mailpoet-form-errors"}),(0,m.jsx)("div",{className:"mailpoet-gap"})]})}}Ia.propTypes={history:De().shape({push:De().func.isRequired}).isRequired,item:De().object.isRequired,field:De().shape({name:De().string}).isRequired,onValueChange:De().func.isRequired},Ia.displayName="WelcomeScheduling";const Ta=(0,Ce.EN)(Ia);let Ea=[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:(0,Pe.__)("Subject","mailpoet"),className:"mailpoet-form-field-subject",placeholder:(0,Pe.__)("Type newsletter subject","mailpoet"),tooltip:(0,Pe.__)("Be creative! It's the first thing that your subscribers see. Tempt them to open your email.","mailpoet"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":(0,Pe.__)("Please specify a subject","mailpoet"),maxLength:250}},{name:"preheader",customLabel:(0,Pe.__)("Preview text","mailpoet"),className:"mailpoet-form-field-preheader",placeholder:(0,Pe.__)("Type preview text (usually displayed underneath the subject line in the inbox)","mailpoet"),tooltip:`${(0,Pe.__)("This optional text will appear in your subscribers' inboxes, beside the subject line. Write something enticing!","mailpoet")} ${(0,Pe.__)("Max length is 250 characters, however, we recommend 80 characters on a single line.","mailpoet")}`,type:"textarea",validation:{maxLength:250}}]},{name:"options",label:(0,Pe.__)("When to send this welcome email?","mailpoet"),type:"reactComponent",component:(0,o.withBoundary)(Ta)},Kn,{name:"sender",label:(0,Pe.__)("Sender","mailpoet"),tip:(0,Pe.__)("Your name and email","mailpoet"),fields:[{name:"sender_name",type:"text",placeholder:(0,Pe.__)("John Doe","mailpoet"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:(0,o.withBoundary)(Hn),placeholder:(0,Pe.__)("[email protected]","mailpoet"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},{name:"empty",type:"empty"},{name:"reply-to",label:(0,Pe.__)("Reply-to","mailpoet"),tip:(0,Pe.__)("When your subscribers reply to your emails, their emails will go to this address.","mailpoet"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:(0,Pe.__)("John Doe","mailpoet")},{name:"reply_to_address",type:"text",placeholder:(0,Pe.__)("[email protected]","mailpoet"),validation:{"data-parsley-type":"email"}}]}];Ea=Pt.Hooks.applyFilters("mailpoet_newsletters_3rd_step_fields",Ea);const Da={getFields:function(){return Ea},getSendButtonOptions:function(){return{value:(0,Pe.__)("Activate","mailpoet")}}};class Oa extends r.Component{constructor(e){super(e);const{item:t,event:n}=this.props;this.handleChange=this.handleChange.bind(this);const a=t.afterTimeType||n.defaultAfterTimeType||"immediate",i="minutes"===a?30:1,s=t.afterTimeNumber||i;this.state={afterTimeType:a,afterTimeNumber:s},t.afterTimeNumber===s&&t.afterTimeType===a||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 a={[t]:n},{afterTimeType:i}=this.state;"afterTimeType"===t&&i!==n&&("minutes"===i&&(a.afterTimeNumber=1),"minutes"===n&&(a.afterTimeNumber=30)),this.setState(a,this.propagateChange(a))}displayAfterTimeTypeOptions(){const{event:e}=this.props;let t=oa;e.timeDelayValues&&(t=Object.entries(e.timeDelayValues).reduce(((e,t)=>{let[n,a]=t;return e[n]=a.text,e}),{}));const{afterTimeType:n}=this.state,a={field:{id:"scheduling_time_interval",name:"scheduling_time_interval",forceSelect2:!0,values:ot.ZP.map(t,((e,t)=>({name:e,id:t}))),extendSelect2Options:{minimumResultsForSearch:1/0},selected:()=>n},onValueChange:ot.ZP.partial(this.handleChange,ot.ZP,"afterTimeType")};return(0,m.jsx)(Re.Y,{field:a.field,onValueChange:a.onValueChange})}displayAfterTimeNumberField(){const{afterTimeNumberSize:e,event:t}=this.props,{afterTimeType:n,afterTimeNumber:a}=this.state;if("immediate"===n)return null;if(t.timeDelayValues&&t.timeDelayValues[n]&&!t.timeDelayValues[n].displayAfterTimeNumberField)return null;const i={field:{id:"scheduling_time_duration",name:"scheduling_time_duration",className:"mailpoet-form-input-small",defaultValue:a?a.toString():"",size:e,validation:{"data-parsley-required":!0,"data-parsley-errors-container":".mailpoet-form-errors","data-parsley-scheduled-at":(0,Pe.__)("An email can only be scheduled up to 5 years in the future. Please choose a shorter period.","mailpoet")}},item:{},onValueChange:ot.ZP.partial(this.handleChange,ot.ZP,"afterTimeNumber")};return(0,m.jsx)(it,{field:i.field,item:i.item,onValueChange:i.onValueChange})}propagateChange(e){const{onValueChange:t}=this.props;t&&t(e)}render(){const{event:e}=this.props;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("h4",{children:[" ",(0,Pe.__)("When to send this email?","mailpoet")," "]}),(0,m.jsxs)(In.Grid.CenteredRow,{className:"mailpoet-re-engagement-scheduling",children:[this.displayAfterTimeNumberField(),this.displayAfterTimeTypeOptions(),e.afterDelayText&&(0,m.jsx)("p",{children:e.afterDelayText})]}),(0,m.jsx)("div",{className:"mailpoet-form-errors"}),(0,m.jsx)("div",{className:"mailpoet-gap"}),e.schedulingReadMoreLink&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("a",{href:e.schedulingReadMoreLink.link,target:"_blank",rel:"noopener noreferrer",className:"event-scheduling-read-more-link",children:e.schedulingReadMoreLink.text}),(0,m.jsx)("div",{className:"mailpoet-gap"})]})]})}}function Aa(e){const t=e&&e.values?e.values:[];return t?t.map((e=>({id:e.id,name:e.name}))):t}function Ra(e){let{eventOptions:t,eventSlug:n,selected:a,onValueChange:i}=e;function s(e){i&&i({eventOptionValue:e.target.value})}return(0,m.jsx)("div",{children:(0,m.jsx)("div",{className:"event-option-selection",children:function(){if(!t)return null;const e={field:{name:`event_options_${n}`,forceSelect2:!0,endpoint:t.endpoint,resetSelect2OnUpdate:!0,values:Aa(t),multiple:t.multiple||!1,placeholder:t.placeholder||!1,transformChangedValue:(e,t)=>ot.ZP.map(t,(e=>({id:e.id,name:e.text}))),selected:()=>a,getLabel:ot.ZP.property("name"),getValue:ot.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,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(Re.Y,{field:e.field,onValueChange:e.onValueChange,item:e.item}),(0,m.jsx)("div",{className:"mailpoet-gap"})]})}()})})}Oa.propTypes={item:De().shape({afterTimeType:De().string.isRequired,afterTimeNumber:De().number}).isRequired,afterTimeNumberSize:De().number,onValueChange:De().func,event:De().shape({defaultAfterTimeType:De().string,afterDelayText:De().string,timeDelayValues:De().objectOf(De().shape({text:De().string,displayAfterTimeNumberField:De().bool})),schedulingReadMoreLink:De().shape({link:De().string.isRequired,text:De().string.isRequired})}).isRequired},Oa.defaultProps={afterTimeNumberSize:3,onValueChange:null},Oa.displayName="EventScheduling",Ra.displayName="EventOptions";const Pa=(0,o.withBoundary)(Ra);class La extends r.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=ot.ZP.indexBy(this.email.events,"slug"),this.segments=ot.ZP.filter(window.mailpoet_segments,(e=>null===e.deleted_at));const n=this.events[this.emailOptions.event],a=this.emailOptions.afterTimeType||n.defaultAfterTimeType||"immediate";this.state={event:n,afterTimeType:a,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,a={item:{afterTimeNumber:e,afterTimeType:t},event:n,onValueChange:this.handleChange};return(0,m.jsx)(Oa,{item:a.item,event:a.event,onValueChange:a.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,m.jsx)("div",{className:"event-segment-selection",children:(0,m.jsx)(Re.Y,{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 a={emailSlug:this.email.slug,eventSlug:t,onValueChange:this.handleChange,eventOptions:e.options||null};return n&&n.option&&("remote"===a.eventOptions.type&&(a.eventOptions.values=n.option),a.selected=ot.ZP.map(n.option,(e=>e.id))),(0,m.jsx)(Pa,{emailSlug:a.emailSlug,eventSlug:a.eventSlug,eventOptions:a.eventOptions,onValueChange:a.onValueChange,selected:a.selected})}displayHeader(){const{event:e}=this.state;return e.title}propagateChange(){const{eventSlug:e,afterTimeType:t,afterTimeNumber:n,segment:a,eventOptionValue:i}=this.state,{onValueChange:s}=this.props;if(!s)return;const r={group:this.email.slug,event:e,afterTimeType:t};n&&(r.afterTimeNumber=n),a&&(r.segment=a),i&&(r.meta=JSON.stringify({option:this.state.eventOptionValue})),s({target:{name:"options",value:r}})}render(){return(0,m.jsxs)("div",{children:[(0,m.jsx)(_t.X,{level:5,children:this.displayHeader()}),this.displayEventOptions(),this.displaySegments(),this.displayScheduling()]})}}La.propTypes={field:De().shape({email:De().shape({events:De().object.isRequired}).isRequired,emailOptions:De().object.isRequired}).isRequired,onValueChange:De().func},La.defaultProps={onValueChange:null},La.displayName="SendEventConditions";const Ma=window.mailpoet_woocommerce_automatic_emails||[],Fa={getFields:function(e){return(e=>{const t=Ma[e.options.group];if(!t)return!1;const n=e.options;return[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:(0,Pe.__)("Subject","mailpoet"),className:"mailpoet-form-field-subject",placeholder:(0,Pe.__)("Type newsletter subject","mailpoet"),tooltip:(0,Pe.__)("Be creative! It's the first thing that your subscribers see. Tempt them to open your email.","mailpoet"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":(0,Pe.__)("Please specify a subject","mailpoet"),maxLength:250}},{name:"preheader",customLabel:(0,Pe.__)("Preview text","mailpoet"),className:"mailpoet-form-field-preheader",placeholder:(0,Pe.__)("Type preview text (usually displayed underneath the subject line in the inbox)","mailpoet"),tooltip:`${(0,Pe.__)("This optional text will appear in your subscribers' inboxes, beside the subject line. Write something enticing!","mailpoet")} ${(0,Pe.__)("Max length is 250 characters, however, we recommend 80 characters on a single line.","mailpoet")}`,type:"textarea",validation:{maxLength:250}}]},{name:"options",label:(0,Pe.__)("Send this %1s Automatic Email when...","mailpoet").replace("%1s",t.title),type:"reactComponent",component:(0,o.withBoundary)(La),email:t,emailOptions:n},Kn,{name:"sender",label:(0,Pe.__)("Sender","mailpoet"),tip:(0,Pe.__)("Your name and email","mailpoet"),fields:[{name:"sender_name",type:"text",placeholder:(0,Pe.__)("John Doe","mailpoet"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"text",placeholder:(0,Pe.__)("[email protected]","mailpoet"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},{name:"empty",type:"empty"},{name:"reply-to",label:(0,Pe.__)("Reply-to","mailpoet"),tip:(0,Pe.__)("When your subscribers reply to your emails, their emails will go to this address.","mailpoet"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:(0,Pe.__)("John Doe","mailpoet")},{name:"reply_to_address",type:"text",placeholder:(0,Pe.__)("[email protected]","mailpoet"),validation:{"data-parsley-type":"email"}}]}]})(e)},getSendButtonOptions:function(){return{value:(0,Pe.__)("Activate","mailpoet")}}};var Ba=n(30211);function qa(e){let{afterTimeNumber:t,afterTimeType:n,updateAfterTimeNumber:a,updateAfterTimeType:i,inactiveSubscribersPeriod:s}=e;const r="weeks"===n?7:30,o=Number(t)*r;let l=s;return 365===s&&(l=360),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(_t.X,{level:4,children:(0,Pe.__)("When to send this re-engagement email?","mailpoet")}),(0,m.jsxs)(In.Grid.CenteredRow,{className:"mailpoet-re-engagement-scheduling",children:[(0,m.jsx)("p",{children:(0,Pe.__)("After no activity for","mailpoet")}),(0,m.jsx)(at.I,{type:"text",placeholder:(0,Pe.__)("count","mailpoet"),value:t,onChange:(0,Un.z2)(a)}),(0,m.jsxs)(lt.Select,{value:n,onChange:(0,Un.z2)(i),children:[(0,m.jsx)("option",{value:"weeks",children:"weeks"}),(0,m.jsx)("option",{value:"months",children:"months"})]})]}),!!s&&l<=o&&(0,m.jsx)("p",{className:"mailpoet-re-engagement-scheduling-note",children:x()((0,Pe.__)("Disengaged subscribers will [link]become inactive[/link] after {$months} months and won’t receive this email. Please select a shorter period.","mailpoet").replace("{$months}",`${Math.floor(s/30)}`),/\[link\](.*?)\[\/link\]/g,(e=>(0,m.jsx)("a",{href:"https://kb.mailpoet.com/article/264-inactive-subscribers",target:"_blank",rel:"noopener noreferrer","data-beacon-article":"5cbf19622c7d3a026fd3efe1",children:e},"link")))})]})}const Wa=[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:(0,Pe.__)("Subject","mailpoet"),className:"mailpoet-form-field-subject",placeholder:(0,Pe.__)("Type newsletter subject","mailpoet"),tooltip:(0,Pe.__)("Be creative! It's the first thing that your subscribers see. Tempt them to open your email.","mailpoet"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":(0,Pe.__)("Please specify a subject","mailpoet"),maxLength:250}},{name:"preheader",customLabel:(0,Pe.__)("Preview text","mailpoet"),className:"mailpoet-form-field-preheader",placeholder:(0,Pe.__)("Type preview text (usually displayed underneath the subject line in the inbox)","mailpoet"),tooltip:`${(0,Pe.__)("This optional text will appear in your subscribers' inboxes, beside the subject line. Write something enticing!","mailpoet")} ${(0,Pe.__)("Max length is 250 characters, however, we recommend 80 characters on a single line.","mailpoet")}`,type:"textarea",validation:{maxLength:250}}]},{name:"options",type:"reactComponent",component:function(e){return(0,m.jsx)(qa,{afterTimeNumber:e.item.options.afterTimeNumber.toString(),afterTimeType:e.item.options.afterTimeType,inactiveSubscribersPeriod:Number(d.x.deactivateSubscriberAfterInactiveDays),updateAfterTimeNumber:t=>{e.onValueChange({target:{name:"options",value:(0,Ba.assoc)("afterTimeNumber",t,e.item.options)}})},updateAfterTimeType:t=>{e.onValueChange({target:{name:"options",value:(0,Ba.assoc)("afterTimeType",t,e.item.options)}})}})}},{name:"segments",label:(0,Pe.__)("Lists","mailpoet"),tip:(0,Pe.__)("Subscribers in multiple lists will only receive one email.","mailpoet"),type:"selection",placeholder:(0,Pe.__)("Select a list","mailpoet"),id:"mailpoet_segments",api_version:d.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,Ba.map)((e=>(0,Ba.find)((t=>t.id===e),t)),e)},validation:{"data-parsley-required":!0,"data-parsley-required-message":(0,Pe.__)("Please select a list","mailpoet")}},{name:"sender",label:(0,Pe.__)("Sender","mailpoet"),tip:(0,Pe.__)("Your name and email","mailpoet"),fields:[{name:"sender_name",type:"text",placeholder:(0,Pe.__)("John Doe","mailpoet"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:Hn,placeholder:(0,Pe.__)("[email protected]","mailpoet"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},{name:"reply-to",label:(0,Pe.__)("Reply-to","mailpoet"),tip:(0,Pe.__)("When your subscribers reply to your emails, their emails will go to this address.","mailpoet"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:(0,Pe.__)("John Doe","mailpoet")},{name:"reply_to_address",type:"text",placeholder:(0,Pe.__)("[email protected]","mailpoet"),validation:{"data-parsley-type":"email"}}]},Kn],Va={getFields:()=>Wa,getSendButtonOptions:()=>({value:(0,Pe.__)("Activate","mailpoet")})};var $a=n(45238);let Ua=null;var Ya=n(12266);function Ha(e){let{toggleLoadingState:t,updatePendingState:n}=e;const a=(0,r.useCallback)((async()=>{try{const{success:e,res:t}=await(0,o.callApi)({endpoint:"services",action:"refreshMSSKeyStatus"});!0===e?n(!(0,o.isTruthy)(t.data.result.data.is_approved)):d.x.Notice.showApiErrorNotice(t)}catch(e){d.x.Notice.showApiErrorNotice(e)}}),[n]),[i,s]=(0,r.useState)(!0),l=async e=>{e.preventDefault(),t(!0),await a(),s(!1),t(!1)};return(0,m.jsxs)("div",{className:"mailpoet_error",children:[x()((0,Pe.__)("You’ll soon be able to send once our team reviews your account. In the meantime, you can send previews to [link]your authorized emails[/link].","mailpoet"),(0,o.getLinkRegex)(),(e=>(0,m.jsx)("a",{href:"https://account.mailpoet.com/authorization",target:"_blank",rel:"noopener noreferrer",children:e})))," ",i&&x()((0,Pe.__)("If you have already received approval email, click [link]here[/link] to update the status.","mailpoet"),(0,o.getLinkRegex)(),(e=>(0,m.jsx)("a",{href:"#",onClick:l,children:e})))]})}Ha.displayName="PendingNewsletterMessage";const za=(0,o.withBoundary)(Ha),Za=window.mailpoet_woocommerce_automatic_emails||{},Ka=(e,t)=>`${Cn()(t,{strict:!0,lower:!0})||"email"}-${e}`,Ga=e=>"immediate"===e.afterTimeType?"immediate":`${e.afterTimeNumber} ${e.afterTimeType}`;function Qa(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)?(0,Pe.__)("Poet, please add prose to your masterpiece before you send it to your followers.","mailpoet"):window.mailpoet_mss_active&&t.indexOf("[link:subscription_unsubscribe_url]")<0&&t.indexOf("[link:subscription_unsubscribe]")<0?(0,Pe.__)('All emails must include an "Unsubscribe" link. Add a footer widget to your email to continue.',"mailpoet"):"re_engagement"===e.type&&t.indexOf("[link:subscription_re_engage_url]")<0?(0,Pe.__)("A re-engagement email must include a link with [link:subscription_re_engage_url] shortcode.","mailpoet"):"notification"===e.type&&t.indexOf('"type":"automatedLatestContent"')<0&&t.indexOf('"type":"automatedLatestContentLayout"')<0?(0,Pe._x)("Please add an “Automatic Latest Content” widget to the email from the right sidebar.","(Please reuse the current translation used for the string “Automatic Latest Content”) This Error message is displayed when a user tries to send a “Post Notification” email without any “Automatic Latest Content” widget inside","mailpoet"):"standard"===e.type&&"sent"===e.status?(0,Pe.__)("This email has already been sent. It can be edited, but not sent again. Duplicate this email if you want to send it again.","mailpoet"):"re_engagement"!==e.type||d.x.trackingConfig.emailTrackingEnabled?void 0:(0,m.jsx)("span",{style:{pointerEvents:"all"},children:x()((0,Pe.__)("Re-engagement emails are disabled because [link]open and click tracking[/link] is disabled.","mailpoet"),/\[link\](.*?)\[\/link\]/g,(e=>(0,m.jsx)("a",{href:"?page=mailpoet-settings#/advanced",rel:"noopener noreferrer",children:e},"advancedSettingsTabLink")))})}class Xa extends r.Component{constructor(e){super(e),this.state={fields:[],item:{},loading:!0,thumbnailPromise:null,showPremiumModal:!1,mssKeyPendingApproval:window.mailpoet_mss_key_pending_approval}}componentDidMount(){this.loadItem(this.props.match.params.id).always((()=>{this.setState({loading:!1})})),Te()("#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})}))}getFieldsByNewsletter=e=>this.getSubtype(e).getFields(e);getSendButtonOptions=()=>this.getSubtype(this.state.item).getSendButtonOptions(this.state.item);getSubtype=e=>{if(e.type===Qn.j9.Automatic&&Za[e.options.group])return Fa;switch(e.type){case"notification":return va;case"welcome":return Da;case"re_engagement":return Va;default:return sa}};getThumbnailPromise=e=>{var t;return(null===(t=this.state)||void 0===t?void 0:t.thumbnailPromise)??(0,$a.W0)(e)};isValid=()=>Te()("#mailpoet_newsletter").parsley().isValid();isValidFromAddress=async()=>{if("MailPoet"!==window.mailpoet_mta_method)return!0;const e=await this.loadVerifiedSenderDomains(),t=(0,Un.DA)(this.state.item.sender_address);if(-1!==e.indexOf(t))return!0;const n=await this.loadAuthorizedEmailAddresses(),a=this.state.item.sender_address;return-1!==n.indexOf(a)};isGaFieldDisabled=()=>!window.mailpoet_premium_active;loadItem=e=>(this.setState({loading:!0}),d.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(n.type===Qn.j9.Automation){var a;const e=null===(a=n.options)||void 0===a?void 0:a.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=Ka(n.id,n.subject)),this.setState({item:e.data,fields:this.getFieldsByNewsletter(e.data),thumbnailPromise:t,validationError:Qa(e.data)}),!0})).fail((()=>{this.setState({item:{}},(()=>{this.props.history.push("/new")}))})));saveTemplate=(e,t)=>{this.getThumbnailPromise(e.meta.preview_url).then((n=>{d.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}),d.x.Modal.loading(!1)})),t()})).catch((e=>{this.showError({errors:[e]})}))};loadAuthorizedEmailAddresses=async()=>{if("MailPoet"!==window.mailpoet_mta_method)return[];const e=(await d.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"mailer",action:"getAuthorizedEmailAddresses"})).data||[];return window.mailpoet_authorized_emails=e,e};loadVerifiedSenderDomains=async()=>"MailPoet"!==window.mailpoet_mta_method?[]:(await d.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"mailer",action:"getVerifiedSenderDomains"})).data||[];handleSend=e=>(e.preventDefault(),this.isValid()?(d.x.Modal.loading(!0),this.isValidFromAddress().then((e=>{e?this.saveNewsletter().done((()=>{this.setState({loading:!0})})).done((e=>{switch(e.data.type){case"notification":case"welcome":case"automatic":case"re_engagement":this.activateNewsletter(e);break;default:this.sendNewsletter(e)}})).fail((e=>{this.showError(e),this.setState({loading:!1}),d.x.Modal.loading(!1)})):(window.mailpoet_sender_address_field_blur(),d.x.Modal.loading(!1))}))):Te()("#mailpoet_newsletter").parsley().validate());sendNewsletter=e=>d.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 d.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=kn().uniqWith(n,((e,t)=>e.action===t.action&&e.type===t.type));const a=n.map((e=>function(e){const t=e.action,n=e.type;if("email"===n)switch(t){case"machineOpensAbsoluteCount":return"number of machine-opens";case"opensAbsoluteCount":return"number of opens";case"numberOfOrders":return"number 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,m.jsx)("p",{children:(0,Pe.__)("The newsletter has been scheduled.","mailpoet")})),d.x.trackEvent("Emails > Newsletter sent",{scheduled:!0,segments:a})):(this.context.notices.success((0,m.jsx)("p",{children:(0,Pe.__)("The newsletter is being sent...","mailpoet")}),{id:"mailpoet_notice_being_sent"}),d.x.trackEvent("Emails > Newsletter sent",{scheduled:!1,segments:a})),d.x.Modal.loading(!1)}))})).fail((e=>{this.showError(e),this.setState({loading:!1}),d.x.Modal.loading(!1)}));activateNewsletter=e=>d.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 d.x.Modal.loading(!1),void this.props.history.push(`/send/congratulate/${this.state.item.id}`);const e=this.state.item.options;var n;this.props.history.push("automatic"===this.state.item.type?`/${e.group}`:`/${this.state.item.type||""}`),"automatic"===this.state.item.type&&Za[e.group]?(this.context.notices.success((0,m.jsx)("p",{children:(0,Pe.sprintf)((0,Pe.__)("Your %1s Automatic Email is now activated!","mailpoet"),(null===(n=Za[e.group])||void 0===n?void 0:n.title)??"")})),d.x.trackEvent("Emails > Automatic email activated",{Type:Cn()(`${e.group}-${e.event}`),Delay:Ga(e)})):"welcome"===t.data.type?(this.context.notices.success((0,m.jsx)("p",{children:(0,Pe.__)("Your Welcome Email is now activated!","mailpoet")})),d.x.trackEvent("Emails > Welcome email activated",{"List type":e.event,Delay:Ga(e)})):"re_engagement"===t.data.type?(this.context.notices.success((0,m.jsx)("p",{children:(0,Pe.__)("Your Re-engagement Email is now activated!","mailpoet")})),d.x.trackEvent("Emails > Re-engagement email activated",{Inactivity:Ga(e)})):"notification"===t.data.type&&(this.context.notices.success((0,m.jsx)("p",{children:(0,Pe.__)("Your post notification is now active!","mailpoet")})),d.x.trackEvent("Emails > Post notifications activated",{Frequency:e.intervalType})),d.x.Modal.loading(!1)}))})).fail((e=>{this.showError(e),this.setState({loading:!1}),d.x.Modal.loading(!1)}));handleResume=e=>(e.preventDefault(),this.isValid()?this.saveNewsletter().done((()=>{this.setState({loading:!0})})).done((()=>{d.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,m.jsx)("p",{children:(0,Pe.__)("The newsletter sending has been resumed.","mailpoet")}))})).fail((e=>{this.showError(e)}))})).fail((e=>{this.showError(e)})).always((()=>{this.setState({loading:!1})})):Te()("#mailpoet_newsletter").parsley().validate(),!1);handleSave=e=>{e.preventDefault(),this.saveNewsletter().done((()=>{this.context.notices.success((0,m.jsx)("p",{children:(0,Pe.__)("Email was updated successfully!","mailpoet")}))})).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)}))};handleRedirectToDesign=e=>{e.preventDefault();const t=e.target.href;this.saveNewsletter().done((()=>{this.context.notices.success((0,m.jsx)("p",{children:(0,Pe.__)("Email was updated successfully!","mailpoet")}))})).done((()=>{window.location=t})).fail((e=>{this.showError(e)}))};saveNewsletter=()=>{const e=this.state.item;e.queue=void 0,this.setState({loading:!0});const t=kn().omit(e,["body","created_at","deleted_at","hash","status","updated_at","type"]);return d.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"save",data:t})};showError=e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,m.jsx)("p",{children:e.message},e.message))),{scroll:!0,timeout:!1})};handleFormChange=e=>{const t=e.target.name,n=e.target.value;return this.setState((e=>{const a=e.item,i=a.subject,s=a.ga_campaign;return a[t]=n,"subject"===t&&s===Ka(a.id,i)&&(a.ga_campaign=Ka(a.id,n)),"reply_to_address"===t&&(a[t]=n.toLowerCase()),{item:a}})),!0};handleSaveDraft=()=>{Te()("#mailpoet_newsletter").parsley().destroy()};disableSegmentsSelectorWhenPaused=e=>t=>"segments"===t.name||"options"===t.name?{...t,disabled:e}:t;disableGAIfPremiumInactive=e=>t=>{if("ga_campaign"===t.name){let n=()=>{};return e()&&(n=()=>this.setState({showPremiumModal:!0})),{...t,disabled:e,onWrapperClick:n}}return t};getPreparedFields=(e,t)=>Array.isArray(this.state.fields)?this.state.fields.map(this.disableSegmentsSelectorWhenPaused(e)).map(this.disableGAIfPremiumInactive(t)):[];closePremiumModal=()=>this.setState({showPremiumModal:!1});toggleLoadingState=e=>this.setState({loading:e});updatePendingApprovalState=e=>this.setState({mssKeyPendingApproval:e});render(){const{showPremiumModal:e,item:{status:t,queue:n,type:a,options:i},mssKeyPendingApproval:s}=this.state,r="sending"===t&&n&&"paused"===n.status,l=this.getSendButtonOptions(),c=this.getPreparedFields(r,this.isGaFieldDisabled),d=!(!window.mailpoet_subscribers_limit_reached&&!s&&void 0===this.state.validationError);let p=a;return p===Qn.j9.Automatic&&(p=i.group||p),(0,m.jsxs)("div",{className:"mailpoet-form-send-email",children:[(0,m.jsx)(et.A,{color:"#fff"}),(0,m.jsx)(xn,{emailType:p,automationId:"newsletter_send_heading"}),(0,m.jsx)(o.ErrorBoundary,{children:(0,m.jsxs)(jt,{id:"mailpoet_newsletter",fields:c,automationId:"newsletter_send_form",item:this.state.item,loading:this.state.loading,onChange:this.handleFormChange,onSubmit:this.handleSave,children:[(0,m.jsxs)(In.Grid.CenteredRow,{className:"send-newsletter-buttons",children:[(0,m.jsx)(o.Button,{variant:"secondary",type:"submit",automationId:"email-save-draft",onClick:this.handleSaveDraft,isDisabled:this.state.loading,children:(0,Pe.__)("Save as draft and close","mailpoet")}),r?(0,m.jsx)(o.Button,{type:"button",onClick:this.handleResume,isDisabled:d||this.state.loading,automationId:"email-resume",children:(0,Pe.__)("Resume","mailpoet")}):(0,m.jsx)(o.Button,{type:"button",onClick:this.handleSend,...l,isDisabled:d||this.state.loading,automationId:"email-submit",children:l.value||(0,Pe.__)("Send","mailpoet")}),void 0!==this.state.validationError&&(0,m.jsx)(Fe.Tooltip,{tooltip:(0,m.jsx)("div",{children:this.state.validationError}),tooltipId:"helpTooltipSendEmail"})]}),(0,m.jsxs)("p",{children:[(0,Pe.__)("or simply","mailpoet")," ",(0,m.jsx)("a",{className:"mailpoet-link",href:`?page=mailpoet-newsletter-editor&id=${this.props.match.params.id}`,onClick:this.handleRedirectToDesign,children:(0,Pe.__)("go back to the Design page","mailpoet")}),"."]}),s&&(0,m.jsx)(za,{toggleLoadingState:this.toggleLoadingState,updatePendingState:this.updatePendingApprovalState}),e&&(0,m.jsx)(Ya.ZG,{onRequestClose:this.closePremiumModal,children:(0,Pe.__)("Google Analytics tracking is not available in the free version of the MailPoet plugin.","mailpoet")})]})})]})}}Xa.contextType=l.k;const Ja=(0,Ce.EN)(Xa);function ei(e){const[t,n]=(0,r.useState)(!1);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(_t.X,{level:0,children:(0,Pe.__)("Congratulations!","mailpoet")}),(0,m.jsx)(_t.X,{level:3,children:(a=e.newsletter,"welcome"===a.type?(0,Pe.__)("Your Welcome Email is now active.","mailpoet"):"notification"===a.type?(0,Pe.__)("Your Post Notification is now active.","mailpoet"):"automatic"===a.type?(0,Pe.__)("Your WooCommerce email has been activated.","mailpoet"):"scheduled"===a.status?(0,Pe.__)("Your newsletter is scheduled to be sent.","mailpoet"):(0,Pe.__)("Your newsletter is being sent!","mailpoet"))}),(0,m.jsx)("div",{className:"mailpoet-gap-large"}),(0,m.jsx)("div",{className:"mailpoet-gap-large"}),(0,m.jsx)("img",{src:e.illustrationImageUrl,alt:"",width:"500"}),(0,m.jsx)("div",{className:"mailpoet-gap-large"}),(0,m.jsx)(o.Button,{type:"button",dimension:"small",onClick:()=>{e.successClicked(),n(!0)},withSpinner:t,children:(0,Pe.__)("Close","mailpoet")})]});var a}function ti(e){return(0,m.jsxs)("div",{className:"mailpoet-wizard-step",children:[(0,m.jsx)("div",{className:"mailpoet-wizard-step-illustration",children:(0,m.jsx)("img",{src:e.illustrationUrl,width:"500",alt:""})}),(0,m.jsx)("div",{className:"mailpoet-wizard-step-content",children:e.children})]})}function ni(){return(0,m.jsxs)(o.List,{children:[(0,m.jsx)("li",{children:(0,Pe.__)("Reliable marketing and transactional email delivery. Reach inboxes, not spam boxes","mailpoet")}),(0,m.jsx)("li",{children:(0,Pe.__)("Send your emails super fast (up to 50,000 emails per hour)","mailpoet")}),(0,m.jsx)("li",{children:(0,Pe.__)("Maintain your sender reputation and improve engagement levels with automated bounce and complaint handling. Stop sending to non-deliverable and complaining addresses, automatically","mailpoet")}),(0,m.jsx)("li",{children:(0,Pe.__)("Authenticate your emails (with SPF and DKIM) to improve deliverability and avoid spam boxes","mailpoet")})]})}function ai(e){const[t,n]=(0,r.useState)(!1),a=()=>{e.onFinish(),n(!0)};return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(o.Heading,{level:1,children:(i=e.newsletter.type,{standard:(0,Pe.__)("Your email has been sent!","mailpoet"),welcome:(0,Pe.__)("You are all set up and ready to go!","mailpoet"),notification:(0,Pe.__)("You are all set up and ready to go!","mailpoet"),woocommerce:(0,Pe.__)("You are all set up and ready to go!","mailpoet")}[i]||(0,Pe.__)("You are all set up and ready to go!","mailpoet"))}),(0,m.jsx)(ti,{illustrationUrl:e.MSSPitchIllustrationUrl,children:(0,m.jsxs)("div",{className:"mailpoet-welcome-wizard-step-content",children:[(0,m.jsx)(o.Heading,{level:4,children:(0,Pe.__)("What’s next? Sign up to the MailPoet Starter plan for fast and reliable email delivery","mailpoet")}),(0,m.jsx)("p",{children:e.subscribersCount<1e3?(0,Pe._x)("Did you know? Users with 1,000 subscribers or less get the Starter plan for free.","Promotion for our email sending service: Paragraph","mailpoet"):(0,Pe._x)("Starting at only $10 per month, MailPoet Business offers the following features","Promotion for our email sending service: Paragraph","mailpoet")}),(0,m.jsxs)(o.Heading,{level:5,children:[(0,Pe._x)("You’ll get","Promotion for our email sending service: Paragraph","mailpoet"),":"]}),(0,m.jsx)(ni,{}),(0,m.jsx)("p",{children:x()((0,Pe.__)("Please enter your key in [link]the Settings[/link] if you have already purchased it.","mailpoet"),/\[link\](.*?)\[\/link\]/g,((e,t)=>(0,m.jsx)("a",{href:"admin.php?page=mailpoet-settings#/premium",children:e},t)))}),(0,m.jsx)("div",{className:"mailpoet-gap"}),(0,m.jsx)("div",{className:"mailpoet-gap"}),(0,m.jsx)(o.Button,{isFullWidth:!0,href:e.purchaseUrl,target:"_blank",rel:"noopener noreferrer",onClick:t=>{t.preventDefault(),window.open(e.purchaseUrl),a()},children:(0,Pe._x)("Sign up for free","Promotion for our email sending service: Button","mailpoet")}),(0,m.jsx)(o.Button,{isFullWidth:!0,variant:"tertiary",onClick:a,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),a())},withSpinner:t,children:(0,Pe._x)("No thanks!","Promotion for our email sending service: Skip link","mailpoet")})]})})]});var i}function ii(e){return window.has_mss_key_specified?(0,m.jsx)(ei,{successClicked:e.successClicked,illustrationImageUrl:e.illustrationImageUrl,newsletter:e.newsletter}):(0,m.jsx)(ai,{MSSPitchIllustrationUrl:e.MSSPitchIllustrationUrl,onFinish:e.successClicked,subscribersCount:e.subscribersCount,purchaseUrl:e.purchaseUrl,newsletter:e.newsletter})}function si(e){const[t,n]=(0,r.useState)(!1);return(0,m.jsxs)("div",{children:[(0,m.jsx)(_t.X,{level:1,children:(0,Pe.__)("Oops! We can’t send your newsletter","mailpoet")}),(0,m.jsx)(_t.X,{level:3,children:x()((0,Pe.__)("Rest assured, this is fairly common and is usually fixed quickly. [link]See our quick guide[/link] to help you solve this and get your website sending.","mailpoet"),/\[link\](.*?)\[\/link\]/g,((e,t)=>(0,m.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,m.jsx)("div",{className:"mailpoet-gap-large"}),(0,m.jsx)("div",{className:"mailpoet-gap-large"}),(0,m.jsx)("img",{src:window.mailpoet_congratulations_error_image,alt:"",width:"500"}),(0,m.jsx)("div",{className:"mailpoet-gap-large"}),(0,m.jsx)(o.Button,{dimension:"small",type:"button",onClick:()=>{e.failClicked(),n(!0)},withSpinner:t,children:(0,Pe.__)("Close","mailpoet")})]})}ei.propTypes={successClicked:De().func.isRequired,illustrationImageUrl:De().string.isRequired,newsletter:De().shape({status:De().string.isRequired,type:De().string.isRequired}).isRequired},ti.propTypes={illustrationUrl:De().string.isRequired,children:De().oneOfType([De().arrayOf(De().node),De().node]).isRequired},ii.propTypes={successClicked:De().func.isRequired,illustrationImageUrl:De().string.isRequired,MSSPitchIllustrationUrl:De().string.isRequired,newsletter:De().shape({status:De().string.isRequired,type:De().string.isRequired}).isRequired,subscribersCount:De().number.isRequired,purchaseUrl:De().string.isRequired},si.propTypes={failClicked:De().func.isRequired};var ri=n(4378);function oi(e){return(0,m.jsx)("div",{className:"mailpoet-congratulate-loading",children:e.showRichLoadingScreen&&(0,m.jsxs)("div",{children:[(0,m.jsx)(_t.X,{level:0,children:(0,Pe.__)("Verification","mailpoet")}),(0,m.jsx)(_t.X,{level:3,children:(0,Pe.__)("Congrats, you’re sending your first newsletter! We’re doing a quick verification to make sure everything works fine.","mailpoet")}),(0,m.jsx)("div",{className:"mailpoet-gap-large"}),(0,m.jsx)("div",{className:"mailpoet-gap-large"}),(0,m.jsx)(ri.a,{size:64})]})})}oi.propTypes={showRichLoadingScreen:De().bool.isRequired};const li=Math.floor(4*Math.random());function ci(){return d.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_emails_page}))}class di extends r.Component{constructor(e){super(e),this.state={loading:!0,newsletter:null,testingPassed:!1,timeStart:Je()(),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(){Je()().subtract(20,"second").isAfter(this.state.timeStart)&&this.setState({error:!0,loading:!1}),this.state.loading&&this.loadNewsletter(this.props.match.params.id),Je()().subtract(6,"seconds").isAfter(this.state.timeStart)&&this.setState({minimumLoadingTimePassed:!0}),!this.state.loading&&this.state.minimumLoadingTimePassed||setTimeout(this.tick,2e3)}loadNewsletter(e){d.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,m.jsx)(oi,{illustrationImageUrl:window.mailpoet_congratulations_loading_image,successClicked:ci,showRichLoadingScreen:e})):this.state.error?(d.x.trackEvent("Cron testing done",{"Cron is working":"false"}),(0,m.jsx)(si,{failClicked:()=>{window.location=window.mailpoet_emails_page}})):(t=this.state.newsletter,this.state.testingPassed&&d.x.trackEvent("Cron testing done",{"Cron is working":"true"}),(0,m.jsx)(ii,{illustrationImageUrl:window.mailpoet_congratulations_success_images[li],MSSPitchIllustrationUrl:window.mailpoet_congratulations_success_images[li],successClicked:ci,newsletter:t,isWoocommerceActive:window.mailpoet_woocommerce_active,subscribersCount:window.mailpoet_subscribers_count,purchaseUrl:d.x.MailPoetComUrlFactory.getPurchasePlanUrl(d.x.subscribersCount,d.x.currentWpUserEmail,"starter",{utm_medium:"first-newsletter-congratulations",utm_campaign:"purchase"})}));var e,t}render(){return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("style",{dangerouslySetInnerHTML:{__html:"body { background: #fff; overflow-x: hidden; }"}}),(0,m.jsxs)("div",{className:"mailpoet-congratulate",children:[(0,m.jsx)("div",{className:"mailpoet-gap-large"}),this.renderContent()]})]})}}di.propTypes={match:De().shape({params:De().shape({id:De().string}).isRequired}).isRequired},di.displayName="Congratulate";class pi extends r.Component{componentDidMount(){d.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,m.jsx)("p",{children:e.message},e.message))),{scroll:!0})}))}showTemplateSelection=e=>{this.props.history.push(`/template/${e}`)};render(){return(0,m.jsx)("div",{children:(0,m.jsx)(xn,{emailType:"standard",automationId:"standard_newsletter_creation_heading"})})}}pi.contextType=l.k,pi.propTypes={history:De().shape({push:De().func.isRequired}).isRequired},pi.displayName="NewsletterStandard";const ui=(0,Ce.EN)(pi),mi={name:"options",type:"reactComponent",component:_a};class hi extends r.Component{constructor(e){super(e),this.state={options:{intervalType:"daily",timeOfDay:0,weekDay:1,monthDay:0,nthWeekDay:1}}}handleValueChange=e=>{const t=this.state;t[e.target.name]=e.target.value,this.setState(t)};handleNext=()=>{d.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:ot.ZP.extend({},this.state,{type:"notification",subject:(0,Pe.__)("The last [newsletter:total] posts from our blog","mailpoet")})}).done((e=>{this.showTemplateSelection(e.data.id)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,m.jsx)("p",{children:e.message},e.message))),{scroll:!0})}))};showTemplateSelection=e=>{this.props.history.push(`/template/${e}`)};render(){return(0,m.jsxs)("div",{children:[(0,m.jsx)(et.A,{color:"#fff"}),(0,m.jsx)(xn,{emailType:"notification",automationId:"post_notification_creation_heading"}),(0,m.jsxs)(In.Grid.Column,{align:"center",className:"mailpoet-schedule-email",children:[(0,m.jsx)(_t.X,{level:4,children:(0,Pe.__)("When to send this post notification email?","mailpoet")}),(0,m.jsx)(_a,{item:this.state,field:mi,onValueChange:this.handleValueChange}),(0,m.jsx)(Le.z,{isFullWidth:!0,onClick:this.handleNext,type:"button",children:(0,Pe.__)("Next","mailpoet")})]})]})}}hi.contextType=l.k,hi.propTypes={history:De().shape({push:De().func.isRequired}).isRequired},hi.displayName="NewsletterNotification";const fi=(0,Ce.EN)(hi),gi={name:"options",label:"Event",type:"reactComponent",component:Ta};class xi extends r.Component{constructor(e){super(e);let t=window.mailpoet_segments||[],n=1;t=t.filter((e=>"default"===e.type)),ot.ZP.size(t)>0&&(n=ot.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()?d.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:ot.ZP.extend({},this.state,{type:"welcome",subject:(0,Pe.__)("Subject","mailpoet")})}).done((e=>{this.showTemplateSelection(e.data.id)})).fail((e=>{e.errors.length>0&&d.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})})):this.validate()}isValid=()=>Te()("#welcome_scheduling").parsley().isValid();validate=()=>Te()("#welcome_scheduling").parsley().validate();showTemplateSelection(e){this.props.history.push(`/template/${e}`)}render(){return(0,m.jsxs)("div",{children:[(0,m.jsx)(et.A,{color:"#fff"}),(0,m.jsx)(xn,{emailType:"welcome",automationId:"welcome_email_creation_heading"}),(0,m.jsxs)(In.Grid.Column,{align:"center",className:"mailpoet-schedule-email",children:[(0,m.jsx)(_t.X,{level:4,children:(0,Pe.__)("When to send this welcome email?","mailpoet")}),(0,m.jsxs)("form",{id:"welcome_scheduling",children:[(0,m.jsx)(Ta,{item:this.state,field:gi,onValueChange:this.handleValueChange}),(0,m.jsx)(Le.z,{isFullWidth:!0,type:"submit",onClick:this.handleNext,children:(0,Pe.__)("Next","mailpoet")})]})]})]})}}function _i(){let e="";d.x.deactivateSubscriberAfterInactiveDays&&(e=(Math.floor(Number(d.x.deactivateSubscriberAfterInactiveDays)/30)-1).toString());const[t,n]=(0,r.useState)({afterTimeNumber:e,afterTimeType:"months"}),[a,i]=(0,r.useState)([]),[s,o]=(0,r.useState)(!1),l=(0,Ce.k6)();return(0,m.jsxs)("div",{children:[(0,m.jsx)(et.A,{color:"#fff"}),a&&(0,m.jsx)(Qt,{errors:a}),(0,m.jsx)(xn,{emailType:"re_engagement",automationId:"re_engagement_heading_creation_heading"}),(0,m.jsxs)(In.Grid.Column,{align:"center",className:"mailpoet-schedule-email",children:[(0,m.jsx)(qa,{afterTimeNumber:t.afterTimeNumber,afterTimeType:t.afterTimeType,inactiveSubscribersPeriod:Number(d.x.deactivateSubscriberAfterInactiveDays),updateAfterTimeNumber:(0,Ba.compose)([n,(0,Ba.assoc)("afterTimeNumber",Ba.__,t)]),updateAfterTimeType:(0,Ba.compose)([n,(0,Ba.assoc)("afterTimeType",Ba.__,t)])}),(0,m.jsx)(Le.z,{isFullWidth:!0,onClick:()=>(i([]),o(!0),void d.x.Ajax.post({api_version:d.x.apiVersion,endpoint:"newsletters",action:"create",data:{type:"re_engagement",subject:(0,Pe.__)("Subject","mailpoet"),options:t}}).done((e=>{var t;t=e.data.id,l.push(`/template/${t}`)})).fail((e=>{o(!1),e.errors&&i(e.errors)}))),type:"button",isDisabled:!t.afterTimeNumber||s,withSpinner:s,children:(0,Pe.__)("Next","mailpoet")})]})]})}xi.propTypes={history:De().shape({push:De().func.isRequired}).isRequired},xi.displayName="NewsletterWelcome",_i.displayName="NewsletterTypeReEngagement";class bi extends r.Component{static getEventOptions(e){return e.options||null}static getEventOptionsFirstValue(e){return e&&ot.ZP.isArray(e.values)&&e.values[0].id?e.values[0].id:null}constructor(e){super(e);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=ot.ZP.filter(window.mailpoet_segments,(e=>null===e.deleted_at));const a=this.getEvent(n),i=this.constructor.getEventOptions(a),s=this.constructor.getEventOptionsFirstValue(i);this.state={event:a,eventSlug:a.slug,eventOptionValue:s,segment:a.sendToLists?this.getFirstSegment():null,afterTimeType:a.defaultAfterTimeType||"immediate",afterTimeNumber:null}}handleChange(e){const{segment:t,afterTimeNumber:n}=this.state,a=e;if(a.eventSlug){a.event=this.getEvent(a.eventSlug),a.segment=a.event.sendToLists?t||this.getFirstSegment():null;const e=this.constructor.getEventOptions(a.event);a.eventOptionValue=e?this.constructor.getEventOptionsFirstValue(e):null}a.afterTimeType&&"immediate"===a.afterTimeType?a.afterTimeNumber=null:!a.afterTimeType||a.afterTimeNumber||n||(a.afterTimeNumber=1),this.setState(a),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:a,afterTimeNumber:i,event:s,segment:r,eventOptionValue:o}=this.state,l={group:this.email.slug,event:n,afterTimeType:a};i&&(l.afterTimeNumber=i),l.sendTo=s.sendToLists?"segment":"user",r&&(l.segment=r),o&&(l.meta=JSON.stringify({option:o})),d.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:{type:"automatic",subject:(0,Pe.__)("Subject","mailpoet"),options:l}}).done((e=>{d.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,m.jsx)("p",{children:e.message},e.message))),{scroll:!0})}))}getEvent(e){return this.emailEvents[e]}getFirstSegment(){return ot.ZP.isArray(this.segments)&&this.segments[0].id?this.segments[0].id:null}isValid=()=>!Te()("#newsletter_scheduling").parsley()||Te()("#newsletter_scheduling").parsley().isValid();validate=()=>{Te()("#newsletter_scheduling").parsley()&&Te()("#newsletter_scheduling").parsley().validate()};resetValidationErrors=()=>{Te()("#newsletter_scheduling").parsley()&&Te()("#newsletter_scheduling").parsley().reset()};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,m.jsx)(Pa,{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,m.jsx)("div",{className:"event-segment-selection",children:(0,m.jsx)(Re.Y,{field:t.field,onValueChange:t.onValueChange})})}displayScheduling(){const{afterTimeNumber:e,afterTimeType:t,event:n}=this.state,a={item:{afterTimeNumber:e,afterTimeType:t},event:n,onValueChange:this.handleChange};return(0,m.jsx)(o.ErrorBoundary,{children:(0,m.jsx)(Oa,{item:a.item,event:a.event,onValueChange:a.onValueChange})})}displayEventTip(){const{event:e}=this.state;return e.tip?(0,m.jsxs)("p",{className:"description",children:[(0,m.jsx)("strong",{children:(0,Pe.__)("Tip:","mailpoet")})," ",e.tip]}):null}render(){return(0,m.jsxs)("div",{children:[(0,m.jsx)(et.A,{color:"#fff"}),(0,m.jsx)(xn,{emailType:"woocommerce",automationId:"woocommerce_email_creation_heading"}),(0,m.jsx)(In.Grid.Column,{align:"center",className:"mailpoet-schedule-email",children:(0,m.jsxs)("form",{id:"newsletter_scheduling",children:[(0,m.jsx)(_t.X,{level:4,children:this.displayHeader()}),(0,m.jsx)("div",{children:this.displayEventOptions()}),(0,m.jsx)("div",{children:this.displaySegments()}),(0,m.jsx)("div",{children:this.displayScheduling()}),(0,m.jsx)(Le.z,{isFullWidth:!0,onClick:this.handleNextStep,type:"submit",children:(0,Pe._x)("Next","Button label: Next step","mailpoet")})]})}),this.displayEventTip()]})}}bi.contextType=l.k,bi.propTypes={history:De().shape({push:De().func.isRequired}).isRequired,name:De().string.isRequired,email:De().shape({title:De().string.isRequired,slug:De().string.isRequired}).isRequired},bi.displayName="EventsConditions";var vi=n(22251),yi=n(20522),wi=n(67206);function ji(e){let{newsletter:t}=e;const[n,a]=(0,r.useState)("paused"===t.queue.status),[i,s]=(0,r.useState)([]),l=async()=>{s([]),await(async()=>{await d.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sendingQueue",action:"resume",data:{newsletter_id:t.id}}).done((()=>a(!1))).fail((e=>s(e.errors)))})()};return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(Qt,{errors:i}),n&&(0,m.jsx)(Le.z,{dimension:"small",onClick:t.status===Qn.sj.Corrupt?async()=>{(0,o.confirmAlert)({message:(0,Pe.__)("The was an issue sending this email before, please confirm the issues are fixed to proceed."),onConfirm:l})}:l,children:(0,Pe.__)("Resume","mailpoet")}),!n&&(0,m.jsx)(Le.z,{dimension:"small",onClick:async()=>{s([]),await d.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sendingQueue",action:"pause",data:{newsletter_id:t.id}}).done((()=>a(!0))).fail((e=>s(e.errors)))},children:(0,Pe.__)("Pause","mailpoet")})]})}function Si(e){let{newsletter:t,mailerLog:n}=e;const a=t.sent_at||t.queue.scheduled_at,i=a?(0,yi.default)(a,"yyyy-MM-dd HH:mm:ss",new Date):void 0,s=t.queue&&"scheduled"!==t.queue.status,r="paused"===n.status,o=(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(Ne.Link,{to:`/sending-status/${t.id}`,"data-automation-id":`sending_status_${t.id}`,children:(0,m.jsx)(wi.sj,{processed:parseInt(t.queue.count_processed,10),scheduledFor:i,total:parseInt(t.queue.count_total,10),isPaused:r,status:t.status,logs:t.logs})}),"completed"!==t.queue.status&&!r&&(0,m.jsx)(ji,{newsletter:t})]}),l=(0,m.jsx)(wi.sj,{scheduledFor:i,isPaused:"scheduled"===t.queue.status&&r,status:t.status,logs:t.logs});return(0,m.jsxs)(m.Fragment,{children:[s&&o,!s&&l]})}Si.displayName="QueueStatus";const ki=(0,o.withBoundary)(Si),Ni=d.x.trackingConfig.emailTrackingEnabled,Ci={onNoItemsFound:(e,t)=>t?(0,Pe.__)("No emails found.","mailpoet"):(0,Pe.__)("Nothing here yet! But, don't fret - there's no reason to get upset. Pretty soon, you’ll be sending emails faster than a turbo-jet.","mailpoet"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?(0,Pe.__)("1 email was moved to the trash.","mailpoet"):(0,Pe.__)("%1$d emails were moved to the trash.","mailpoet").replace("%1$d",t.toLocaleString()),d.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?(0,Pe.__)("1 email was permanently deleted.","mailpoet"):(0,Pe.__)("%1$d emails were permanently deleted.","mailpoet").replace("%1$d",t.toLocaleString()),d.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?(0,Pe.__)("1 email has been restored from the Trash.","mailpoet"):(0,Pe.__)("%1$d emails have been restored from the Trash.","mailpoet").replace("%1$d",t.toLocaleString()),d.x.Notice.success(n)}},Ii=[{name:"subject",label:(0,Pe.__)("Subject","mailpoet"),sortable:!0},{name:"status",label:(0,Pe.__)("Status","mailpoet")},{name:"segments",label:(0,Pe.__)("Lists","mailpoet")},{name:"statistics",label:(0,Pe.__)("Clicked, Opened","mailpoet"),display:Ni},{name:"sent_at",label:(0,Pe.__)("Sent on","mailpoet"),sortable:!0}],Ti=[{name:"trash",label:(0,Pe.__)("Move to trash","mailpoet"),onSuccess:Ci.onTrash}],Ei=e=>{const t=`?page=mailpoet-newsletter-editor&id=${e.id}`;e.queue&&"sending"===e.status&&null===e.queue.status?(0,bn._)({message:(0,Pe.__)("Sending is in progress. Do you want to pause sending and edit the newsletter?","mailpoet"),onConfirm:()=>{window.location.href=`${t}&pauseConfirmed=yes`}}):window.location.href=t};let Di=[{name:"view",link:function(e){return(0,m.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:(0,Pe.__)("Preview","mailpoet")})}},{name:"edit",className:"mailpoet-hide-on-mobile",label:(0,Pe.__)("Edit","mailpoet"),onClick:Ei},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:(0,Pe.__)("Duplicate","mailpoet"),onClick:function(e,t){return d.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{d.x.Notice.success((0,Pe.__)('Email "%1$s" has been duplicated.',"mailpoet").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&d.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}},{name:"trash",className:"mailpoet-hide-on-mobile"}];Di=(0,Ut.y8)(Di);class Oi extends r.Component{constructor(e){super(e),this.state={newslettersCount:void 0}}renderItem=(e,t,n)=>{const a=ee()("manage-column","column-primary","has-row-actions");return(0,m.jsxs)("div",{children:[(0,m.jsxs)("td",{className:a,children:[(0,m.jsx)("a",{className:"mailpoet-listing-title",href:"#",onClick:t=>{t.preventDefault(),Ei(e)},children:e.queue.newsletter_rendered_subject||e.subject}),t]}),(0,m.jsx)("td",{className:"column mailpoet-listing-status-column","data-colname":(0,Pe.__)("Status","mailpoet"),children:(0,m.jsx)(ki,{newsletter:e,mailerLog:n.mta_log})}),(0,m.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":(0,Pe.__)("Lists","mailpoet"),children:(0,m.jsx)(o.ErrorBoundary,{children:(0,m.jsx)(vi.Eg,{segments:e.segments,dimension:"large"})})}),!0===Ni?(0,m.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":(0,Pe.__)("Clicked, Opened","mailpoet"),children:(0,m.jsx)(rn,{newsletter:e,currentTime:n.current_time})}):null,(0,m.jsx)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":(0,Pe.__)("Sent on","mailpoet"),children:e.sent_at?(0,m.jsxs)(m.Fragment,{children:[d.x.Date.short(e.sent_at),(0,m.jsx)("br",{}),d.x.Date.time(e.sent_at)]}):null})]})};isItemInactive=e=>"draft"===e.status;render(){return(0,m.jsxs)(m.Fragment,{children:[0===this.state.newslettersCount&&(0,m.jsx)(en,{filter:e=>"standard"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&(0,m.jsx)(Oe.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:Ii,bulk_actions:Ti,item_actions:Di,messages:Ci,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,Ut._X)(e),(0,Ut.bF)(e)}})]})}}Oi.contextType=l.k,Oi.propTypes={location:De().object.isRequired,match:De().shape({params:De().object}).isRequired},Oi.displayName="NewsletterListStandard";const Ai=(0,Ce.EN)((0,o.withBoundary)(Oi));var Ri=n(13726);const Pi=window.mailpoet_roles||{},Li=window.mailpoet_segments||{},Mi=d.x.trackingConfig.emailTrackingEnabled,Fi={onNoItemsFound:(e,t)=>t?(0,Pe.__)("No emails found.","mailpoet"):(0,Pe.__)("Nothing here yet! But, don't fret - there's no reason to get upset. Pretty soon, you’ll be sending emails faster than a turbo-jet.","mailpoet"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?(0,Pe.__)("1 email was moved to the trash.","mailpoet"):(0,Pe.__)("%1$d emails were moved to the trash.","mailpoet").replace("%1$d",t.toLocaleString()),d.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?(0,Pe.__)("1 email was permanently deleted.","mailpoet"):(0,Pe.__)("%1$d emails were permanently deleted.","mailpoet").replace("%1$d",t.toLocaleString()),d.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?(0,Pe.__)("1 email has been restored from the Trash.","mailpoet"):(0,Pe.__)("%1$d emails have been restored from the Trash.","mailpoet").replace("%1$d",t.toLocaleString()),d.x.Notice.success(n)}},Bi=[{name:"subject",label:(0,Pe.__)("Subject","mailpoet"),sortable:!0},{name:"settings",label:(0,Pe.__)("Settings","mailpoet")},{name:"statistics",label:(0,Pe.__)("Statistics","mailpoet"),display:Mi},{name:"status",label:(0,Pe.__)("Status","mailpoet"),width:145},{name:"updated_at",label:(0,Pe.__)("Last modified on","mailpoet"),sortable:!0}],qi=[{name:"trash",label:(0,Pe.__)("Move to trash","mailpoet"),onSuccess:Fi.onTrash}];let Wi=[{name:"view",link:function(e){return(0,m.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:(0,Pe.__)("Preview","mailpoet")})}},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:(0,Pe.__)("Duplicate","mailpoet"),onClick:(e,t)=>d.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{d.x.Notice.success((0,Pe.__)('Email "%1$s" has been duplicated.',"mailpoet").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&d.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},{name:"edit",className:"mailpoet-hide-on-mobile",label:(0,Pe.__)("Edit","mailpoet"),onClick:Ut.Q2},{name:"trash",className:"mailpoet-hide-on-mobile"}];Wi=(0,Ut.y8)(Wi);class Vi extends r.Component{constructor(e){super(e),this.state={newslettersCount:void 0}}updateStatus=(e,t)=>{t.persist(),d.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&&d.x.Notice.success((0,Pe.__)("Your Welcome Email is now activated!","mailpoet")),this.forceUpdate()})).fail((n=>{d.x.Notice.showApiErrorNotice(n),t.target.checked=!e}))};renderStatus=e=>{const t=(0,Pe._x)("%1$d sent","number of welcome emails sent","mailpoet").replace("%1$d",e.total_sent.toLocaleString()),n=(0,Pe._x)("%1$d scheduled","number of welcome emails scheduled to be sent","mailpoet").replace("%1$d",e.total_scheduled.toLocaleString());return(0,m.jsxs)("div",{children:[(0,m.jsx)(Gn.Z,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"active"===e.status}),(0,m.jsxs)("p",{className:"mailpoet-listing-stats-description",children:[(0,m.jsx)(Ne.Link,{to:`/sending-status/${e.id}`,"data-automation-id":`sending_status_${e.id}`,children:t})," ",(0,m.jsx)("br",{}),n]})]})};renderSettings=e=>{let t,n,a;if("user"===e.options.event)t="mailpoet_all"===e.options.role?(0,Pe.__)("Sent when a new WordPress user is added to your site.","mailpoet"):x()((0,Pe.__)("Sent when a new WordPress user with the role %1$s is added to your site.","mailpoet"),"%1$s",((t,n)=>(0,m.jsx)(Ot.V,{variant:"list",children:Pi[e.options.role]},n)));else{if(a=ot.ZP.find(Li,(t=>Number(t.id)===Number(e.options.segment))),void 0===a)return(0,m.jsx)(Ne.Link,{className:"mailpoet-listing-error",to:`/send/${e.id}`,children:(0,Pe.__)("You need to select a list to send to.","mailpoet")});t=x()((0,Pe.__)("Sent when someone subscribes to the list: %1$s.","mailpoet"),"%1$s",((e,t)=>(0,m.jsx)(Ot.V,{variant:"list",children:a.name},t)))}if(t&&"immediate"!==e.options.afterTimeType)switch(e.options.afterTimeType){case"minutes":n=(0,Pe.__)("%1$d minute(s) later","mailpoet").replace("%1$d",e.options.afterTimeNumber);break;case"hours":n=(0,Pe.__)("%1$d hour(s) later","mailpoet").replace("%1$d",e.options.afterTimeNumber);break;case"days":n=(0,Pe.__)("%1$d day(s) later","mailpoet").replace("%1$d",e.options.afterTimeNumber);break;case"weeks":n=(0,Pe.__)("%1$d week(s) later","mailpoet").replace("%1$d",e.options.afterTimeNumber);break;default:n=(0,Pe.__)("Invalid sending delay.","mailpoet")}return(0,m.jsxs)("span",{children:[t,n&&(0,m.jsxs)("div",{className:"mailpoet-listing-schedule",children:[(0,m.jsx)("div",{className:"mailpoet-listing-schedule-icon",children:(0,m.jsx)(Ri.P,{})}),n]})]})};renderItem=(e,t)=>{const n=ee()("manage-column","column-primary","has-row-actions");return(0,m.jsxs)("div",{children:[(0,m.jsxs)("td",{className:n,children:[(0,m.jsx)("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`,onClick:t=>{t.preventDefault(),(0,Ut.Q2)(e)},children:e.subject}),t]}),(0,m.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":(0,Pe.__)("Settings","mailpoet"),children:this.renderSettings(e)}),!0===Mi?(0,m.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":(0,Pe.__)("Clicked, Opened","mailpoet"),children:(0,m.jsx)(rn,{newsletter:e,isSent:e.total_sent>0&&!!e.statistics})}):null,(0,m.jsx)("td",{className:"column","data-colname":(0,Pe.__)("Status","mailpoet"),children:this.renderStatus(e)}),(0,m.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":(0,Pe.__)("Last modified on","mailpoet"),children:[d.x.Date.short(e.updated_at),(0,m.jsx)("br",{}),d.x.Date.time(e.updated_at)]})]})};isItemInactive=e=>"draft"===e.status;render(){return(0,m.jsxs)(m.Fragment,{children:[0===this.state.newslettersCount&&(0,m.jsx)(en,{filter:e=>"welcome"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&(0,m.jsx)(Oe.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:Bi,bulk_actions:qi,item_actions:Wi,messages:Fi,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,Ut._X)(e),(0,Ut.bF)(e)}})]})}}Vi.propTypes={location:De().object.isRequired,match:De().shape({params:De().object}).isRequired},Vi.displayName="NewsletterListWelcome";const $i=(0,Ce.EN)((0,o.withBoundary)(Vi)),Ui={onNoItemsFound:(e,t)=>t?(0,Pe.__)("No emails found.","mailpoet"):(0,Pe.__)("Nothing here yet! But, don't fret - there's no reason to get upset. Pretty soon, you’ll be sending emails faster than a turbo-jet.","mailpoet"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?(0,Pe.__)("1 email was moved to the trash.","mailpoet"):(0,Pe.__)("%1$d emails were moved to the trash.","mailpoet").replace("%1$d",t.toLocaleString()),d.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?(0,Pe.__)("1 email was permanently deleted.","mailpoet"):(0,Pe.__)("%1$d emails were permanently deleted.","mailpoet").replace("%1$d",t.toLocaleString()),d.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?(0,Pe.__)("1 email has been restored from the Trash.","mailpoet"):(0,Pe.__)("%1$d emails have been restored from the Trash.","mailpoet").replace("%1$d",t.toLocaleString()),d.x.Notice.success(n)}},Yi=[{name:"subject",label:(0,Pe.__)("Subject","mailpoet"),sortable:!0},{name:"settings",label:(0,Pe.__)("Settings","mailpoet")},{name:"history",label:(0,Pe.__)("History","mailpoet"),width:100},{name:"status",label:(0,Pe.__)("Status","mailpoet"),width:100},{name:"updated_at",label:(0,Pe.__)("Last modified on","mailpoet"),sortable:!0}],Hi=[{name:"trash",label:(0,Pe.__)("Move to trash","mailpoet"),onSuccess:Ui.onTrash}],zi=[{name:"view",link:function(e){return(0,m.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:(0,Pe.__)("Preview","mailpoet")})}},{name:"edit",className:"mailpoet-hide-on-mobile",label:(0,Pe.__)("Edit","mailpoet"),onClick:Ut.Q2},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:(0,Pe.__)("Duplicate","mailpoet"),onClick:function(e,t){return d.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{d.x.Notice.success((0,Pe.__)('Email "%1$s" has been duplicated.',"mailpoet").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&d.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}},{name:"trash",className:"mailpoet-hide-on-mobile"}];class Zi extends r.Component{constructor(e){super(e),this.state={newslettersCount:void 0}}updateStatus=(e,t)=>{t.persist(),d.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&&d.x.Notice.success((0,Pe.__)("Your post notification is now active!","mailpoet")),this.forceUpdate()})).fail((n=>{d.x.Notice.showApiErrorNotice(n),t.target.checked=!e}))};renderStatus=e=>(0,m.jsx)(Gn.Z,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"active"===e.status});renderSettings=e=>{let t;if(0===e.segments.length)return(0,m.jsx)(Ne.Link,{className:"mailpoet-listing-error",to:`/send/${e.id}`,children:(0,Pe.__)("You need to select a list to send to.","mailpoet")});const n=x()((0,Pe.__)("Send to %1$s","mailpoet"),"%1$s",((t,n)=>(0,m.jsx)(vi.Eg,{segments:e.segments},n)));switch(e.options.intervalType){case"daily":t=(0,Pe.__)("Daily at %1$s","mailpoet").replace("%1$s",ca[e.options.timeOfDay]);break;case"weekly":t=(0,Pe.__)("Weekly on %1$s at %2$s","mailpoet").replace("%1$s",da[e.options.weekDay]).replace("%2$s",ca[e.options.timeOfDay]);break;case"monthly":t=(0,Pe.__)("Monthly on the %1$s at %2$s","mailpoet").replace("%1$s",pa[e.options.monthDay]).replace("%2$s",ca[e.options.timeOfDay]);break;case"nthWeekDay":t=(0,Pe.__)("Every %1$s %2$s of the month at %3$s","mailpoet").replace("%1$s",ua[e.options.nthWeekDay]).replace("%2$s",da[e.options.weekDay]).replace("%3$s",ca[e.options.timeOfDay]);break;case"immediately":t=(0,Pe.__)("Immediately","mailpoet");break;default:t="Invalid sending frequency"}return(0,m.jsxs)("span",{children:[n,(0,m.jsxs)("div",{className:"mailpoet-listing-schedule",children:[(0,m.jsx)("div",{className:"mailpoet-listing-schedule-icon",children:(0,m.jsx)(Ri.P,{})}),t]})]})};renderHistoryLink=e=>0===Number(e.children_count)?(0,m.jsx)("span",{className:"mailpoet-listing-status-unknown mailpoet-font-extra-small mailpoet-listing-notification-status",children:(0,Pe.__)("Not sent yet","mailpoet")}):(0,m.jsxs)(Ne.Link,{className:"mailpoet-nowrap","data-automation-id":`history-${e.id}`,to:`/notification/history/${e.id}`,children:[(0,m.jsx)(Le.z,{className:"mailpoet-hide-on-mobile",dimension:"small",children:(0,Pe.__)("View history","mailpoet")}),(0,m.jsx)(Le.z,{className:"mailpoet-show-on-mobile mailpoet-listing-notification-status",dimension:"small",variant:"secondary",children:(0,Pe.__)("View history","mailpoet")})]});renderItem=(e,t)=>{const n=ee()("manage-column","column-primary","has-row-actions");return(0,m.jsxs)("div",{children:[(0,m.jsxs)("td",{className:n,children:[(0,m.jsx)("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`,onClick:t=>{t.preventDefault(),(0,Ut.Q2)(e)},children:e.subject}),t]}),(0,m.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":(0,Pe.__)("Settings","mailpoet"),children:this.renderSettings(e)}),(0,m.jsx)("td",{className:"column","data-colname":(0,Pe.__)("History","mailpoet"),children:this.renderHistoryLink(e)}),(0,m.jsx)("td",{className:"column","data-colname":(0,Pe.__)("Status","mailpoet"),children:this.renderStatus(e)}),(0,m.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":(0,Pe.__)("Last modified on","mailpoet"),children:[d.x.Date.short(e.updated_at),(0,m.jsx)("br",{}),d.x.Date.time(e.updated_at)]})]})};isItemInactive=e=>"draft"===e.status;render(){return(0,m.jsxs)(m.Fragment,{children:[0===this.state.newslettersCount&&(0,m.jsx)(en,{filter:e=>"notification"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&(0,m.jsx)(Oe.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:Yi,bulk_actions:Hi,item_actions:zi,messages:Ui,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,Ut._X)(e),(0,Ut.bF)(e)}})]})}}Zi.propTypes={location:De().object.isRequired,match:De().shape({params:De().object}).isRequired},Zi.displayName="NewsletterListNotification";const Ki=(0,Ce.EN)((0,o.withBoundary)(Zi)),Gi=d.x.trackingConfig.emailTrackingEnabled,Qi={onNoItemsFound:(e,t)=>t?(0,Pe.__)("No emails found.","mailpoet"):(0,Pe.__)("Nothing here yet! But, don't fret - there's no reason to get upset. Pretty soon, you’ll be sending emails faster than a turbo-jet.","mailpoet"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?(0,Pe.__)("1 email was moved to the trash.","mailpoet"):(0,Pe.__)("%1$d emails were moved to the trash.","mailpoet").replace("%1$d",t.toLocaleString()),d.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?(0,Pe.__)("1 email was permanently deleted.","mailpoet"):(0,Pe.__)("%1$d emails were permanently deleted.","mailpoet").replace("%1$d",t.toLocaleString()),d.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?(0,Pe.__)("1 email has been restored from the Trash.","mailpoet"):(0,Pe.__)("%1$d emails have been restored from the Trash.","mailpoet").replace("%1$d",t.toLocaleString()),d.x.Notice.success(n)}},Xi=[{name:"subject",label:(0,Pe.__)("Subject","mailpoet"),sortable:!0},{name:"settings",label:(0,Pe.__)("Settings","mailpoet")},{name:"statistics",label:(0,Pe.__)("Clicked, Opened","mailpoet"),display:Gi},{name:"status",label:(0,Pe.__)("Status","mailpoet"),width:145},{name:"updated_at",label:(0,Pe.__)("Last modified on","mailpoet"),sortable:!0}],Ji=[{name:"trash",label:(0,Pe.__)("Move to trash","mailpoet"),onSuccess:Qi.onTrash}];let es=[{name:"view",link:function(e){return(0,m.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:(0,Pe.__)("Preview","mailpoet")})}},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:(0,Pe.__)("Duplicate","mailpoet"),onClick:(e,t)=>d.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{d.x.Notice.success((0,Pe.__)('Email "%1$s" has been duplicated.',"mailpoet").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&d.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},{name:"edit",className:"mailpoet-hide-on-mobile",label:(0,Pe.__)("Edit","mailpoet"),onClick:Ut.Q2},{name:"trash",className:"mailpoet-hide-on-mobile"}];es=(0,Ut.y8)(es);class ts extends r.Component{constructor(e){super(e),this.state={newslettersCount:void 0}}updateStatus=(e,t)=>{t.persist(),d.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&&d.x.Notice.success((0,Pe.__)("Your Re-engagement Email is now activated!","mailpoet")),this.forceUpdate()})).fail((n=>{d.x.Notice.showApiErrorNotice(n),t.target.checked=!e}))};renderStatus=e=>{const t=(0,Pe._x)("%1$d sent","number of welcome emails sent","mailpoet").replace("%1$d",e.total_sent.toLocaleString());return(0,m.jsxs)("div",{children:[(0,m.jsx)(Gn.Z,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"active"===e.status}),(0,m.jsx)("p",{className:"mailpoet-listing-stats-description",children:(0,m.jsx)(Ne.Link,{to:`/sending-status/${e.id}`,"data-automation-id":`sending_status_${e.id}`,children:t})})]})};renderSettings=e=>{if(0===e.segments.length)return(0,m.jsx)(Ne.Link,{className:"mailpoet-listing-error",to:`/send/${e.id}`,children:(0,Pe.__)("You need to select a list to send to.","mailpoet")});const t=x()((0,Pe.__)("Send to %1$s","mailpoet"),"%1$s",((t,n)=>(0,m.jsx)(vi.Eg,{segments:e.segments},n)));let n=(0,Pe._x)("month",'month in the sentence "1 month after inactivity"',"mailpoet");e.options.afterTimeNumber>1&&"months"===e.options.afterTimeType?n=(0,Pe._x)("months",'months in the sentence "5 months after inactivity"',"mailpoet"):e.options.afterTimeNumber>1&&"weeks"===e.options.afterTimeType?n=(0,Pe._x)("weeks",'weeks in the sentence "5 weeks after inactivity"',"mailpoet"):1===e.options.afterTimeNumber&&"weeks"===e.options.afterTimeType&&(n=(0,Pe._x)("week",'week in the sentence "1 week after inactivity"',"mailpoet"));const a=(0,Pe._x)("{$count} {$frequency} after inactivity",'example: "5 months after inactivity"',"mailpoet").replace("{$count}",e.options.afterTimeNumber).replace("{$frequency}",n);return(0,m.jsxs)("span",{children:[t,(0,m.jsxs)("div",{className:"mailpoet-listing-schedule",children:[(0,m.jsx)("div",{className:"mailpoet-listing-schedule-icon",children:(0,m.jsx)(Ri.P,{})}),a]})]})};renderItem=(e,t)=>{const n=ee()("manage-column","column-primary","has-row-actions");return(0,m.jsxs)("div",{children:[(0,m.jsxs)("td",{className:n,children:[(0,m.jsx)("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`,onClick:t=>{t.preventDefault(),(0,Ut.Q2)(e)},children:e.subject}),t]}),(0,m.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":(0,Pe.__)("Settings","mailpoet"),children:this.renderSettings(e)}),!0===Gi?(0,m.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":(0,Pe.__)("Clicked, Opened","mailpoet"),children:(0,m.jsx)(rn,{newsletter:e,isSent:e.total_sent>0&&!!e.statistics})}):null,(0,m.jsx)("td",{className:"column","data-colname":(0,Pe.__)("Status","mailpoet"),children:this.renderStatus(e)}),(0,m.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":(0,Pe.__)("Last modified on","mailpoet"),children:[d.x.Date.short(e.updated_at),(0,m.jsx)("br",{}),d.x.Date.time(e.updated_at)]})]})};isItemInactive=e=>"draft"===e.status;render(){return(0,m.jsxs)(m.Fragment,{children:[0===this.state.newslettersCount&&(0,m.jsx)(en,{filter:e=>"re_engagement"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&(0,m.jsx)(Oe.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:Xi,bulk_actions:Ji,item_actions:es,messages:Qi,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,Ut._X)(e),(0,Ut.bF)(e)}})]})}}ts.propTypes={location:De().object.isRequired,match:De().shape({params:De().object}).isRequired},ts.displayName="NewsletterListReEngagement";const ns=(0,Ce.EN)((0,o.withBoundary)(ts)),as=d.x.trackingConfig.emailTrackingEnabled,is=[{name:"subject",label:(0,Pe.__)("Subject","mailpoet")},{name:"status",label:(0,Pe.__)("Status","mailpoet")},{name:"segments",label:(0,Pe.__)("Lists","mailpoet")},{name:"statistics",label:(0,Pe.__)("Clicked, Opened","mailpoet"),display:as},{name:"sent_at",label:(0,Pe.__)("Sent on","mailpoet"),sortable:!0}],ss={onNoItemsFound:(e,t)=>t?(0,Pe.__)("No emails found.","mailpoet"):(0,Pe.__)("Nothing here yet! But, don't fret - there's no reason to get upset. Pretty soon, you’ll be sending emails faster than a turbo-jet.","mailpoet"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?(0,Pe.__)("1 email was moved to the trash.","mailpoet"):(0,Pe.__)("%1$d emails were moved to the trash.","mailpoet").replace("%1$d",t.toLocaleString()),d.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?(0,Pe.__)("1 email was permanently deleted.","mailpoet"):(0,Pe.__)("%1$d emails were permanently deleted.","mailpoet").replace("%1$d",t.toLocaleString()),d.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?(0,Pe.__)("1 email has been restored from the Trash.","mailpoet"):(0,Pe.__)("%1$d emails have been restored from the Trash.","mailpoet").replace("%1$d",t.toLocaleString()),d.x.Notice.success(n)}},rs=[{name:"trash",label:(0,Pe.__)("Move to trash","mailpoet"),onSuccess:ss.onTrash}],os=(0,Ut.y8)([{name:"view",link:function(e){return(0,m.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:(0,Pe.__)("Preview","mailpoet")})}},{name:"trash",className:"mailpoet-hide-on-mobile"}]),ls=(e,t,n)=>{const a=ee()("manage-column","column-primary","has-row-actions");return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("td",{className:a,children:[(0,m.jsx)("strong",{children:(0,m.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:e.queue.newsletter_rendered_subject||e.subject})}),t]}),(0,m.jsx)("td",{className:"column mailpoet-listing-status-column","data-colname":(0,Pe.__)("Status","mailpoet"),children:(0,m.jsx)(ki,{newsletter:e,mailerLog:n.mta_log})}),(0,m.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":(0,Pe.__)("Lists","mailpoet"),children:(0,m.jsx)(vi.Eg,{segments:e.segments,dimension:"large"})}),!0===as?(0,m.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":(0,Pe.__)("Clicked, Opened","mailpoet"),children:(0,m.jsx)(rn,{newsletter:e,currentTime:n.current_time})}):null,(0,m.jsx)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":(0,Pe.__)("Sent on","mailpoet"),children:e.sent_at?(0,m.jsxs)(m.Fragment,{children:[d.x.Date.short(e.sent_at),(0,m.jsx)("br",{}),d.x.Date.time(e.sent_at)]}):null})]})};function cs(e){return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(Ne.Link,{className:"mailpoet-button button button-secondary button-small",to:"/notification",children:(0,Pe.__)("Back to Post notifications","mailpoet")}),(0,m.jsx)(Oe.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:ls,columns:is,messages:ss,item_actions:os,bulk_actions:rs,auto_refresh:!0,sort_by:"sent_at",sort_order:"desc",afterGetItems:e=>{(0,Ut._X)(e),(0,Ut.bF)(e)}})]})}cs.propTypes={parentId:De().string.isRequired,location:De().shape({pathname:De().string}).isRequired,match:De().shape({params:De().shape({id:De().node}).isRequired}).isRequired},cs.displayName="NewsletterListNotificationHistory";const ds=(0,Ce.EN)((0,o.withBoundary)(cs)),ps=[{name:"subscriber_id",label:(0,Pe.__)("Subscriber","mailpoet"),sortable:!0},{name:"status",label:(0,Pe._x)("Sending status","an email sending status: unprocessed, sent or failed.","mailpoet")},{name:"failureReason",label:(0,Pe.__)("Failure reason (if applicable)","mailpoet")}],us={onNoItemsFound:()=>(0,Pe.__)("No sending task found.","mailpoet")};function ms(e){const[t,n]=(0,r.useState)({id:e.match.params.id,subject:"",sent:!1});return(0,r.useEffect)((()=>{d.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=>d.x.Notice.showApiErrorNotice(e)))}),[t.id]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("h1",{children:(0,Pe._x)("Sending status","Page title. This page displays a list of emails along with their sending status: unprocessed, sent or failed.","mailpoet")}),(0,m.jsx)(xs,{newsletter:t}),(0,m.jsx)(gs,{location:e.location,params:e.match.params})]})}ms.propTypes={location:De().shape({pathname:De().string}).isRequired,match:De().shape({params:De().shape({id:De().string.isRequired}).isRequired}).isRequired},ms.displayName="SendingStatus";const hs=(e,t)=>e.location.pathname===t.location.pathname&&e.params.id===t.params.id,fs=e=>(0,m.jsx)("div",{children:(0,m.jsx)(_s,{...e})}),gs=(0,r.memo)((e=>{let{location:t,params:n}=e;return(0,m.jsx)(Oe.N,{limit:window.mailpoet_listing_per_page,location:t,params:n,endpoint:"sending_task_subscribers",base_url:"sending-status/:id",onRenderItem:fs,getListingItemKey:e=>`${e.taskId}-${e.subscriberId}`,columns:ps,messages:us,auto_refresh:!0,sort_by:"failed",sort_order:"desc",afterGetItems:e=>{(0,Ut._X)(e),(0,Ut.bF)(e)}})}),hs);function xs(e){let{newsletter:t}=e;return t.id&&t.subject&&t.sent?(0,m.jsx)("p",{children:(0,m.jsx)(Ne.Link,{to:`/stats/${t.id}`,children:t.subject})}):null}function _s(e){let{error:t,failed:n,taskId:a,processed:i,email:s,subscriberId:r,lastName:o,firstName:l}=e;const c=ee()("manage-column","column-primary","has-row-actions");let p=(0,Pe._x)("Unprocessed","status when the sending of a newsletter has not been processed","mailpoet");return i&&(p=n?(0,m.jsxs)("span",{children:[(0,Pe._x)("Failed","status when the sending of a newsletter has failed","mailpoet"),(0,m.jsx)("br",{}),(0,m.jsx)("a",{className:"button",href:"#",onClick:e=>{e.preventDefault(),d.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sending_task_subscribers",action:"resend",data:{taskId:a,subscriberId:r}}).done((()=>window.mailpoet_listing.forceUpdate())).fail((e=>d.x.Notice.showApiErrorNotice(e)))},children:(0,Pe.__)("Resend","mailpoet")})]}):(0,Pe._x)("Sent","status when a newsletter has been sent","mailpoet")),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("td",{"data-automation-id":`name_${a}_${r}`,className:c,children:[(0,m.jsx)("a",{className:"mailpoet-listing-title",href:`admin.php?page=mailpoet-subscribers#/edit/${r}`,children:s}),(0,m.jsx)("div",{className:"mailpoet-listing-subtitle",children:`${l} ${o}`})]}),(0,m.jsx)("td",{className:"column","data-automation-id":`status_${a}_${r}`,"data-colname":(0,Pe._x)("Sending status","an email sending status: unprocessed, sent or failed.","mailpoet"),children:p}),(0,m.jsx)("td",{className:"column","data-automation-id":`error_${a}_${r}`,"data-colname":(0,Pe.__)("Failure reason (if applicable)","mailpoet"),children:t})]})}gs.propTypes={location:De().shape({pathname:De().string}).isRequired,params:De().shape({id:De().string.isRequired}).isRequired},xs.propTypes={newsletter:De().shape({id:De().string,subject:De().string,sent:De().bool})},xs.defaultProps={newsletter:{id:null,subject:null,sent:!1}},_s.propTypes={error:De().string,email:De().string.isRequired,failed:De().number.isRequired,taskId:De().number.isRequired,lastName:De().string.isRequired,firstName:De().string.isRequired,processed:De().number.isRequired,subscriberId:De().number.isRequired},_s.defaultProps={error:""},_s.displayName="ListingItem",ms.displayName="SendingStatus";var bs=n(68583),vs=n(52249),ys=n(23064),ws=n.n(ys);function js(e){const t=e.installedDaysAgo,n=t>30?d.x.I18n.t("reviewRequestUsingForMonths").replace("[months]",Math.round(t/30)):d.x.I18n.t("reviewRequestUsingForDays").replace("[days]",t);return(0,m.jsxs)("div",{className:"mailpoet_review_request",children:[(0,m.jsx)("img",{src:e.reviewRequestIllustrationUrl,height:"280",width:"280",alt:""}),(0,m.jsx)("h2",{children:d.x.I18n.t("reviewRequestHeading")}),(0,m.jsx)("p",{children:d.x.I18n.t("reviewRequestDidYouKnow").replace("[username]",e.username)}),(0,m.jsx)("p",{children:n}),(0,m.jsx)("p",{children:(0,m.jsx)("a",{href:"http://bit.ly/2Bi124o",target:"_blank",rel:"noopener noreferrer",className:"button button-primary",children:d.x.I18n.t("reviewRequestRateUsNow")})}),(0,m.jsx)("p",{children:(0,m.jsx)("a",{id:"mailpoet_review_request_not_now",children:d.x.I18n.t("reviewRequestNotNow")})})]})}js.propTypes={installedDaysAgo:De().number.isRequired,reviewRequestIllustrationUrl:De().string.isRequired,username:De().string.isRequired};const Ss=()=>((0,r.useLayoutEffect)((()=>{window.mailpoet_display_nps_poll&&d.x.libs3rdPartyEnabled&&(Ua||(Ua=d.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"analytics",action:"getTrackingData"})),Ua).then((e=>{let{data:t}=e;return(e=>{let t;t=window.mailpoet_display_nps_form?"EqOgKsgZd832Sz9w":window.mailpoet_is_new_user?"6L479eVPXk7pBn6S":"k0aJAsQAWI2ERyGv",ws()({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&&d.x.Modal.popup({width:800,template:vs.renderToString(js({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",(()=>d.x.Modal.close()))}})}}})})(t)}))}),[]),null),ks=e=>function(t){return Ss(),(0,m.jsx)(e,{...t})};function Ns(){return(0,m.jsx)(c.Q,{children:(0,m.jsxs)(Ne.Link,{id:"mailpoet-new-email",className:"mailpoet-button button-secondary",to:"/new",onClick:()=>d.x.trackEvent("Emails > Add New"),"data-automation-id":"new_email",children:[qe.R,(0,m.jsx)("span",{children:(0,Pe.__)("New email","mailpoet")})]})})}function Cs(e){let{children:t,location:n}=e;return null!==(0,gn.X)(n)||(e=>e.hash.match(/^#\/new/)||e.pathname.match(/^\/new/))(n)?null:t}Cs.propTypes={location:De().string.isRequired,children:De().node.isRequired};const Is=(0,Ce.EN)(Cs);function Ts(){return(0,m.jsx)("style",{dangerouslySetInnerHTML:{__html:".wrap { margin: 0 !important; }"}})}var Es=n(53293),Ds=n(24152),Os=n(21748);const As=20,Rs=5,Ps=5,Ls=5,Ms=100,Fs=e=>{const t=e<.1?2:1;return d.x.Num.toLocaleFixed(e,t)},Bs=e=>+(+e).toFixed(1);function qs(e){let{newsletter:t,isWoocommerceActive:n}=e;const a=t.total_sent||0;let i=0,s=0,r=0,o=0,l=0;a>0&&(i=100*t.statistics.clicked/a,s=100*t.statistics.opened/a,r=100*t.statistics.machineOpened/a,o=100*t.statistics.unsubscribed/a,l=100*t.statistics.bounced/a);const c=Fs(i),d=Fs(s),p=Fs(r),u=Fs(o),h=Fs(l),f=a>=As&&t.statistics.opened>=Rs,g=t.statistics.unsubscribed>=Ps&&a>=Ms,_=t.statistics.bounced>=Ls&&a>=Ms,b=(0,Os.y)("opened",s)||"",v=(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("div",{className:"mailpoet-statistics-value-small",children:[(0,m.jsxs)("span",{className:`mailpoet-statistics-value-number mailpoet-statistics-value-number-${b}`,children:[d,"% "]}),(0,Pe._x)("opened","Percentage of subscribers that opened a newsletter link","mailpoet")]}),f&&(0,m.jsx)(Os.$,{isInverted:!1,stat:"opened",rate:s,tooltipId:`opened-${t.id||"0"}`,tooltipPlace:"right"})]}),y=(0,m.jsxs)("div",{className:"mailpoet-statistics-value-small",children:[(0,m.jsxs)("span",{className:"mailpoet-statistics-value-number",children:[p,"% "]}),(0,Pe._x)("machine-opened","Percentage of newsletters that were opened by a machine","mailpoet"),(0,m.jsx)(Fe.Tooltip,{tooltip:x()((0,Pe.__)("A machine-opened email is an email opened by a computer in the background without the user’s explicit request or knowledge. [link]Read more[/link]","mailpoet"),/\[link](.*?)\[\/link]/,(e=>(0,m.jsx)("span",{style:{pointerEvents:"all"},children:(0,m.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=Bs(o),j=g?(0,Os.y)("unsubscribed",w):"",S=(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("div",{className:"mailpoet-statistics-value-small",children:[(0,m.jsxs)("span",{className:`mailpoet-statistics-value-number mailpoet-statistics-value-number-${j}`,children:[u,"% "]}),(0,Pe._x)("unsubscribed","Percentage of subscribers that unsubscribed from a newsletter","mailpoet")]}),g&&(0,m.jsx)(Os.$,{isInverted:!1,stat:"unsubscribed",rate:w,tooltipId:`unsubscribed-${t.id||"0"}`,tooltipPlace:"right"})]}),k=Bs(l),N=_?(0,Os.y)("bounced",k):"",C=(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("div",{className:"mailpoet-statistics-value-small",children:[(0,m.jsxs)("span",{className:`mailpoet-statistics-value-number mailpoet-statistics-value-number-${N}`,children:[h,"% "]}),(0,Pe._x)("bounced","Percentage of subscribers that bounced from a newsletter","mailpoet")]}),_&&(0,m.jsx)(Os.$,{isInverted:!1,stat:"bounced",rate:k,tooltipId:`bounced-${t.id||"0"}`,tooltipPlace:"right"})]}),I=(0,Os.y)("clicked",i),T=(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("div",{className:"mailpoet-statistics-value",children:[(0,m.jsxs)("span",{className:`mailpoet-statistics-value-number mailpoet-statistics-value-number-${I}`,children:[c,"% "]}),(0,Pe._x)("clicked","Percentage of subscribers that clicked a newsletter link","mailpoet")]}),f&&(0,m.jsx)(Os.$,{isInverted:!1,stat:"clicked",rate:i,tooltipId:`clicked-${t.id||"0"}`,tooltipPlace:"right"})]});return(0,m.jsxs)("div",{className:"mailpoet-stats-general",children:[(0,m.jsxs)(In.Grid.ThreeColumns,{className:"mailpoet-stats-general-top-row",children:[(0,m.jsx)("div",{children:(0,m.jsxs)("div",{className:"mailpoet-statistics-value-small",children:[(0,Pe.__)("Sent to","mailpoet"),": ",(0,m.jsx)("span",{className:"mailpoet-statistics-value-number",children:a.toLocaleString()})]})}),(0,m.jsx)("div",{className:"mailpoet-statistics-with-left-separator",children:S}),(0,m.jsx)("div",{className:"mailpoet-statistics-with-left-separator",children:C})]}),(0,m.jsxs)(In.Grid.ThreeColumns,{children:[(0,m.jsx)("div",{children:T}),(0,m.jsxs)("div",{className:"mailpoet-statistics-with-left-separator",children:[v,y]}),n&&(0,m.jsx)("div",{className:"mailpoet-statistics-with-left-separator",children:Pt.Hooks.applyFilters("mailpoet_newsletters_revenues_stats",null,t.statistics.revenue)}),!n&&(0,m.jsx)("div",{})]}),(0,m.jsx)("p",{className:"mailpoet-stats-general-read-more",children:(0,m.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:(0,Pe.__)("Read more on stats.","mailpoet")})})]})}function Ws(e){let{newsletter:t}=e;const n=t.queue.scheduled_at||t.queue.created_at;return(0,m.jsxs)(In.Grid.ThreeColumns,{className:"mailpoet-stats-info",children:[(0,m.jsxs)("div",{className:"mailpoet-grid-span-two-columns",children:[(0,m.jsx)(_t.X,{level:1,children:t.subject}),(0,m.jsx)("div",{children:(0,m.jsxs)("b",{children:[d.x.Date.short(n)," • ",d.x.Date.time(n)]})}),Array.isArray(t.segments)&&t.segments.length&&(0,m.jsxs)("div",{children:[(0,m.jsx)("span",{className:"mailpoet-stats-info-key",children:(0,Pe.__)("To","mailpoet")}),": ",(0,m.jsx)(o.SegmentTags,{dimension:"large",segments:t.segments})]})]}),(0,m.jsxs)("div",{className:"mailpoet-stats-info-sender-preview",children:[(0,m.jsxs)("div",{children:[(0,m.jsxs)("div",{className:"mailpoet-stats-info-key-value",children:[(0,m.jsxs)("span",{className:"mailpoet-stats-info-key",children:[(0,Pe.__)("From","mailpoet"),": "]}),t.sender_address?t.sender_address:"-"]}),(0,m.jsxs)("div",{className:"mailpoet-stats-info-key-value",children:[(0,m.jsxs)("span",{className:"mailpoet-stats-info-key",children:[(0,Pe.__)("Reply-to","mailpoet"),": "]}),t.reply_to_address?t.reply_to_address:"-"]}),(0,m.jsxs)("div",{className:"mailpoet-stats-info-key-value",children:[(0,m.jsxs)("span",{className:"mailpoet-stats-info-key",children:[(0,Pe.__)("GA campaign","mailpoet"),": "]}),t.ga_campaign?t.ga_campaign:"-"]})]}),(0,m.jsx)("div",{children:(0,m.jsx)(o.Button,{href:t.preview_url,target:"_blank",rel:"noopener noreferrer",children:(0,Pe.__)("Preview","mailpoet")})})]})]})}qs.displayName="NewsletterGeneralStats",Ws.displayName="NewsletterStatsInfo";const{adminPluginsUrl:Vs,subscribersLimitReached:$s,subscribersLimit:Us,subscribersCount:Ys,premiumActive:Hs,hasValidApiKey:zs,hasValidPremiumKey:Zs,isPremiumPluginInstalled:Ks,premiumPluginDownloadUrl:Gs,premiumPluginActivationUrl:Qs,pluginPartialKey:Xs}=d.x,Js=zs||Zs,er=e=>(0,m.jsx)("p",{children:x()(e,/(\[subscribersCount]|\[subscribersLimit])/g,(e=>"[subscribersCount]"===e?Ys:Us))}),tr=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"_blank";return(0,m.jsx)(Le.z,{href:t,target:n,rel:"noopener noreferrer",children:e})};function nr(e){let t,n,{message:a,actionButton:i}=e;const[s,o]=(0,r.useState)(!1);if(!Zs||Ks&&Hs)if($s){t=er((0,Pe.__)("Congratulations, you now have [subscribersCount] subscribers! Your plan is limited to [subscribersLimit] subscribers. You need to upgrade now to be able to continue using MailPoet.","mailpoet"));const e=Js?d.x.MailPoetComUrlFactory.getUpgradeUrl(Xs):d.x.MailPoetComUrlFactory.getPurchasePlanUrl(+Ys+1);n=tr((0,Pe.__)("Upgrade your plan","mailpoet"),e)}else t=a,n=i;else t=er((0,Pe.__)("Your current MailPoet plan includes advanced features, but they require the MailPoet Premium plugin to be installed and activated.","mailpoet")),n=Ks?(0,m.jsx)(Le.z,{withSpinner:s,href:Qs,rel:"noopener noreferrer",onClick:e=>{e.preventDefault(),o(!0),Te().get(Qs).then((e=>{e.includes("Plugin activated")&&window.location.reload()})).catch((()=>{o(!1),d.x.Notice.error(x()((0,Pe.__)("We were unable to activate the premium plugin, please try visiting the [link]plugin page link[/link] to activate it manually.","mailpoet"),/\[link\](.*?)\[\/link\]/g,(e=>`<a rel="noreferrer" href=${Vs}>${e}</a>`)).join(""),{isDismissible:!1})}))},children:s?(0,Pe.__)("Activating MailPoet premium...","mailpoet"):(0,Pe.__)("Activate MailPoet Premium plugin","mailpoet")}):tr((0,Pe.__)("Download MailPoet Premium plugin","mailpoet"),Gs);return(0,m.jsx)(Lt.K,{title:(0,Pe.__)("This is a Premium feature","mailpoet"),message:t,actionButton:n})}function ar(){const e=(0,m.jsx)(Le.z,{href:d.x.MailPoetComUrlFactory.getPurchasePlanUrl(d.x.subscribersCount,d.x.currentWpUserEmail,"starter",{utm_medium:"stats",utm_campaign:"signup"}),target:"_blank",rel:"noopener noreferrer",children:(0,Pe.__)("Upgrade","mailpoet")}),t=(0,m.jsxs)("p",{children:[(0,Pe.__)("Learn more about your subscribers and optimize your campaigns. See who opened your emails, which links they clicked, and then use the data to make your emails even better. And if you run a WooCommerce store, you’ll also see the revenue earned per email. All starting $10 per month.","mailpoet")," ",(0,m.jsx)("a",{href:"admin.php?page=mailpoet-upgrade",children:(0,Pe.__)("Learn more","mailpoet")}),"."]});return(0,m.jsx)("div",{className:"mailpoet-stats-premium-required",children:(0,m.jsx)(nr,{message:t,actionButton:e})})}function ir(){if(!window.mailpoet_display_detailed_stats)return(0,m.jsx)(ar,{});if(window.mailpoet_subscribers_limit_reached){const e=window.mailpoet_has_valid_api_key,t=(0,Pe.__)("Upgrade required","mailpoet"),n=e?(0,Pe.__)("Congratulations, you now have [subscribersCount] subscribers! Your plan is limited to [subscribersLimit] subscribers. You need to upgrade now to be able to continue using MailPoet.","mailpoet"):(0,Pe.__)("Congratulations, you now have [subscribersCount] subscribers! Our free version is limited to [subscribersLimit] subscribers. You need to upgrade now to be able to continue using MailPoet.","mailpoet").replace("[subscribersLimit]",d.x.subscribersLimit.toString()).replace("[subscribersCount]",d.x.subscribersCount.toString()),a=e?d.x.MailPoetComUrlFactory.getUpgradeUrl(d.x.pluginPartialKey):d.x.MailPoetComUrlFactory.getPurchasePlanUrl(window.mailpoet_subscribers_count+1);return(0,m.jsx)("div",{className:"mailpoet-stats-premium-required",children:(0,m.jsx)(Lt.K,{title:t,message:(0,m.jsx)("p",{children:n}),actionButton:(0,m.jsx)(Le.z,{target:"_blank",rel:"noopener noreferrer",href:a,children:(0,Pe.__)("Upgrade Now","mailpoet")})})})}return null}ir.displayName="PremiumBanner";const sr=(0,o.withBoundary)(ir);function rr(e){let{match:t,history:n,location:a}=e;const[i,s]=(0,r.useState)({item:void 0,loading:!0}),l=(0,r.useCallback)((e=>{s({loading:!0,item:i.item}),d.x.Modal.loading(!0),d.x.Ajax.post({api_version:d.x.apiVersion,endpoint:window.mailpoet_display_detailed_stats?"stats":"newsletters",action:window.mailpoet_display_detailed_stats?"get":"getWithStats",data:{id:e}}).always((()=>{d.x.Modal.loading(!1)})).done((e=>{s({loading:!1,item:e.data})})).fail((e=>{d.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0}),s({loading:!1}),n.push("/")}))}),[n,i.item]);(0,r.useEffect)((()=>{var e;window.scrollTo(0,0),(null===(e=i.item)||void 0===e?void 0:e.id)!==t.params.id&&l(t.params.id)}),[t.params.id,l,i.item]);const{item:p,loading:u}=i,h=p;return u?null:null==h||!h.subject||null!=h&&h.queue?h?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(St.B,{}),(0,m.jsx)(Ts,{}),(0,m.jsx)(c.Q,{}),(0,m.jsxs)("div",{className:"mailpoet-stats-page",children:[(0,m.jsx)(j,{}),(0,m.jsx)(o.ErrorBoundary,{children:(0,m.jsx)(Ws,{newsletter:h})}),(0,m.jsx)(o.ErrorBoundary,{children:(0,m.jsx)(qs,{newsletter:h,isWoocommerceActive:d.x.isWoocommerceActive})}),(0,m.jsxs)(Es.m,{activeKey:"clicked",children:[(0,m.jsx)(Ds.O,{title:(0,Pe.__)("Clicked Links","mailpoet"),children:Pt.Hooks.applyFilters("mailpoet_newsletters_clicked_links_table",(0,m.jsx)(sr,{}),h.clicked_links)},"clicked"),Pt.Hooks.applyFilters("mailpoet_newsletters_purchased_products",null,h),(0,m.jsx)(Ds.O,{title:(0,Pe.__)("Subscriber Engagement","mailpoet"),automationId:"engagement-tab",children:Pt.Hooks.applyFilters("mailpoet_newsletters_subscriber_engagement",(0,m.jsx)(sr,{}),a,t.params,h)},"engagement"),(0,m.jsx)(Ds.O,{title:(0,Pe._x)("Bounces","A tab title for the list of bounces (w.wiki/45Qc)","mailpoet"),automationId:"bounces-tab",children:Pt.Hooks.applyFilters("mailpoet_newsletters_bounces",(0,m.jsx)(sr,{}),a,t.params)},"bounces")]})]})]}):(0,m.jsxs)("h3",{children:[" ",(0,Pe.__)("This email does not exist.","mailpoet")," "]}):(0,m.jsx)("div",{children:(0,m.jsx)(_t.X,{level:1,children:h.subject})})}rr.displayName="CampaignStatsPage";const or=(0,Ce.EN)(rr);function lr(e){let{newsletters:t}=e;return(0,m.jsxs)(u.q,{type:"error",timeout:!1,closable:!1,renderInPlace:!0,children:[(0,m.jsx)("h3",{children:(0,Pe.__)("Paused emails","mailpoet")}),(0,m.jsx)("p",{children:(0,Pe.__)("There was problem sending the following email(s), please fix the issues described for each email and resume.","mailpoet")}),(0,m.jsx)("ul",{children:t.map((e=>{let{id:t,subject:n}=e;return(0,m.jsx)("li",{children:n},t)}))})]})}lr.displayName="CorruptEmailNotice";const cr=window.mailpoet_woocommerce_automatic_emails||[],dr=ks((()=>{const{parentId:e}=(0,Ce.UO)();return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(Is,{children:(0,m.jsx)(Ns,{})}),d.x.corrupt_newsletters.length>0&&(0,m.jsx)(lr,{newsletters:d.x.corrupt_newsletters}),(0,m.jsxs)(bs.t,{activeKey:"standard",routerType:"switch-only",onSwitch:e=>(e=>d.x.trackEvent(`Tab Emails > ${e} clicked`))(e),automationId:"newsletters_listing_tabs",children:[(0,m.jsx)(o.Tab,{route:"standard/(.*)?",title:(0,Pe.__)("Newsletters","mailpoet"),automationId:`tab-${(0,Pe.__)("Newsletters","mailpoet")}`,children:(0,m.jsx)(Ai,{})},"standard"),(0,m.jsx)(o.Tab,{route:"welcome/(.*)?",title:(0,Pe.__)("Welcome Emails","mailpoet"),automationId:`tab-${(0,Pe.__)("Welcome Emails","mailpoet")}`,children:(0,m.jsx)($i,{})},"welcome"),(0,m.jsx)(o.Tab,{route:"notification/(.*)?",title:(0,Pe.__)("Post Notifications","mailpoet"),automationId:`tab-${(0,Pe.__)("Post Notifications","mailpoet")}`,children:e?(0,m.jsx)(ds,{parentId:e}):(0,m.jsx)(Ki,{})},"notification"),(0,m.jsx)(o.Tab,{route:"re_engagement/(.*)?",title:(0,Pe.__)("Re-engagement Emails","mailpoet"),automationId:`tab-${(0,Pe.__)("Re-engagement Emails","mailpoet")}`,children:(0,m.jsx)(ns,{})},"re_engagement"),window.mailpoet_woocommerce_active&&!d.x.hideAutomations&&ot.ZP.map(cr,(e=>(0,m.jsx)(o.Tab,{route:`${e.slug}/(.*)?`,title:e.title,automationId:`tab-${e.title}`,children:(0,m.jsx)(hn,{})},e.slug)))]})]})}));function pr(e){let{history:t}=e;return(0,m.jsx)(o.ErrorBoundary,{children:(0,m.jsx)(en,{history:t,hideClosingButton:0===window.mailpoet_newsletters_count})})}dr.displayName="NewsletterTabs",pr.propTypes={history:De().shape({push:De().func.isRequired}).isRequired},pr.displayName="NewNewsletter";const ur=[...(()=>{const e=[];return ot.ZP.each(cr,(t=>{e.push({path:`/${t.slug}/(.*)?`,component:(0,o.withBoundary)(dr)});const{events:n}=t;ot.ZP.isObject(n)&&ot.ZP.each(n,(n=>{e.push({path:`/new/${t.slug}/${n.slug}/conditions`,render:e=>{const a={...e,email:t,name:n.slug};return(0,m.jsx)(o.ErrorBoundary,{children:(0,m.jsx)(bi,{...a})})}})})),e.push({path:`/new/${t.slug}`,render:e=>{const n={...e,email:t};return(0,m.jsx)(o.ErrorBoundary,{children:(0,m.jsx)(Zt,{...n})})}})})),e})(),{path:"/notification/history/:parentId/(.*)?",render:(0,o.withBoundary)(dr)},{path:"/(standard|welcome|notification|re_engagement)/(.*)?",render:(0,o.withBoundary)(dr)},{path:"/new/standard",render:(0,o.withBoundary)(ui)},{path:"/new/notification",render:(0,o.withBoundary)(fi)},{path:"/new/welcome",render:(0,o.withBoundary)(xi)},{path:"/new/re-engagement",render:(0,o.withBoundary)(_i)},{path:"/new",render:(0,o.withBoundary)(pr)},{name:"template",path:"/template/:id",render:(0,o.withBoundary)(jn)},{path:"/send/congratulate/:id",render:(0,o.withBoundary)(di)},{path:"/send/:id",render:(0,o.withBoundary)(Ja)},{path:"/sending-status/:id/(.*)?",render:(0,o.withBoundary)(ms)},{path:"/stats/:id/(.*)?",render:(0,o.withBoundary)(or)}];function mr(){return(0,m.jsx)(l.k.Provider,{value:(0,l.S)(window),children:(0,m.jsxs)(Ne.HashRouter,{children:[(0,m.jsx)(p.w,{}),(0,m.jsx)(o.ErrorBoundary,{children:(0,m.jsx)(h,{mailpoetInstalledDaysAgo:d.x.installedDaysAgo,sendTransactionalEmails:d.x.transactionalEmailsEnabled,mtaMethod:d.x.mtaMethod,apiVersion:d.x.apiVersion,noticeDismissed:d.x.transactionalEmailsOptInNoticeDismissed})}),(0,m.jsx)(o.ErrorBoundary,{children:(0,m.jsx)(j,{})}),(0,m.jsxs)(Ce.rs,{children:[(0,m.jsx)(Ce.AW,{exact:!0,path:"/",render:()=>(0,m.jsx)(Ce.l_,{to:0===window.mailpoet_newsletters_count?"/new":"/standard"})}),ur.map((e=>(0,m.jsx)(Ce.AW,{path:e.path,component:e.component,name:e.name||null,data:e.data||null,render:e.render},e.path)))]})]})})}const hr=document.getElementById("newsletters_container");hr&&((0,o.registerTranslations)(),window.mailpoet_listing=s.render((0,m.jsx)(mr,{}),hr));var fr=n(7969);function gr(e){let{segmentType:t}=e;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(c.Q,{children:["static"===t&&(0,m.jsxs)(Ne.Link,{className:"mailpoet-button button-secondary",to:"/new","data-automation-id":"new-list",children:[qe.R,(0,m.jsx)("span",{children:d.x.I18n.t("new")})]}),"dynamic"===t&&(0,m.jsxs)(Ne.Link,{className:"mailpoet-button button-secondary",to:"/new-segment","data-automation-id":"new-segment",children:[qe.R,(0,m.jsx)("span",{children:d.x.I18n.t("newSegment")})]})]}),(0,m.jsx)(Be,{subscribersInPlan:d.x.subscribersCount,subscribersInPlanLimit:d.x.subscribersLimit}),(0,m.jsx)(Me,{cacheCalculation:window.mailpoet_subscribers_counts_cache_created_at}),(0,m.jsx)(j,{})]})}const xr=e=>"wp_users"===e.type,_r=e=>"woocommerce_users"===e.type,br=e=>xr(e)||_r(e),vr=d.x.trackingConfig.emailTrackingEnabled,yr=[{name:"name",label:d.x.I18n.t("name"),sortable:!0},{name:"description",label:d.x.I18n.t("description")},{name:"average_subscriber_score",label:d.x.I18n.t("listScore"),display:vr},{name:"subscribed",label:d.x.I18n.t("subscribed"),className:"mailpoet-listing-column-narrow"},{name:"unconfirmed",label:d.x.I18n.t("unconfirmed"),className:"mailpoet-listing-column-narrow"},{name:"unsubscribed",label:d.x.I18n.t("unsubscribed"),className:"mailpoet-listing-column-narrow"},{name:"inactive",label:d.x.I18n.t("inactive"),className:"mailpoet-listing-column-narrow"},{name:"bounced",label:d.x.I18n.t("bounced"),className:"mailpoet-listing-column-narrow"},{name:"created_at",label:d.x.I18n.t("createdOn"),sortable:!0}],wr={onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?d.x.I18n.t("oneSegmentTrashed"):d.x.I18n.t("multipleSegmentsTrashed").replace("%1$d",t.toLocaleString()),d.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?d.x.I18n.t("oneSegmentDeleted"):d.x.I18n.t("multipleSegmentsDeleted").replace("%1$d",t.toLocaleString()),d.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?d.x.I18n.t("oneSegmentRestored"):d.x.I18n.t("multipleSegmentsRestored").replace("%1$d",t.toLocaleString()),d.x.Notice.success(n)}},jr=[{name:"trash",label:d.x.I18n.t("moveToTrash"),onSuccess:wr.onTrash}],Sr=e=>!br(e),kr=[{name:"edit",className:"mailpoet-hide-on-mobile",link:function(e){return(0,m.jsx)(Ne.Link,{to:`/edit/${e.id}`,children:d.x.I18n.t("edit")})},display:function(e){return!br(e)}},{name:"duplicate_segment",className:"mailpoet-hide-on-mobile",label:d.x.I18n.t("duplicate"),onClick:(e,t)=>d.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"segments",action:"duplicate",data:{id:e.id}}).done((e=>{d.x.Notice.success(d.x.I18n.t("listDuplicated").replace("%1$s",(0,fr.escapeHTML)(e.data.name))),t()})).fail((e=>{d.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})})),display:function(e){return!br(e)}},{name:"read_more",className:"mailpoet-hide-on-mobile",link:function(){return(0,m.jsx)("a",{href:"https://kb.mailpoet.com/article/133-the-wordpress-users-list",target:"_blank",rel:"noopener noreferrer",children:d.x.I18n.t("readMore")})},display:function(e){return xr(e)}},{name:"synchronize_segment",label:d.x.I18n.t("forceSync"),onClick:async function(e,t){d.x.Modal.loading(!0),await d.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"segments",action:"synchronize",data:{type:e.type}}).done((()=>{let n=d.x.I18n.t("listSynchronized").replace("%1$s",e.name);"woocommerce_users"===e.type&&(n=d.x.I18n.t("listSynchronizationWasScheduled").replace("%1$s",e.name)),d.x.Modal.loading(!1),d.x.Notice.success(n),t()})).fail((e=>{d.x.Modal.loading(!1),e.errors.length>0&&d.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},display:function(e){return xr(e)||_r(e)}},{name:"view_subscribers",link:function(e){return(0,m.jsx)("a",{href:e.subscribers_url,"data-automation-id":`view_subscribers_${e.name}`,children:d.x.I18n.t("viewSubscribers")})}},{name:"trash",className:"mailpoet-hide-on-mobile",display:function(e){return!_r(e)}}];class Nr extends r.Component{renderItem=(e,t)=>{const n=ee()("manage-column","column-primary","has-row-actions"),a=Number(e.subscribers_count.subscribed||0),i=Number(e.subscribers_count.unconfirmed||0),s=Number(e.subscribers_count.unsubscribed||0),r=Number(e.subscribers_count.inactive||0),o=Number(e.subscribers_count.bounced||0);let l;return l=br(e)?(0,m.jsx)("span",{className:"mailpoet-listing-title",children:(0,fr.escapeHTML)(e.name)}):(0,m.jsx)(Ne.Link,{className:"mailpoet-listing-title",to:`/edit/${e.id}`,children:(0,fr.escapeHTML)(e.name)}),(0,m.jsxs)("div",{children:[(0,m.jsxs)("td",{className:n,"data-automation-id":`segment_name_${(0,fr.escapeAttribute)(e.name)}`,children:[l,t]}),(0,m.jsx)("td",{"data-colname":d.x.I18n.t("description"),children:(0,m.jsx)("abbr",{children:(0,fr.escapeHTML)(e.description)})}),vr?(0,m.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":d.x.I18n.t("averageScore"),children:(0,m.jsx)("div",{className:"mailpoet-listing-stats",children:(0,m.jsx)(ge,{id:e.id,engagementScore:e.average_engagement_score})})}):null,(0,m.jsx)("td",{className:"mailpoet-hide-on-mobile","data-colname":d.x.I18n.t("subscribed"),children:(0,m.jsx)("abbr",{children:a.toLocaleString()})}),(0,m.jsx)("td",{className:"mailpoet-hide-on-mobile","data-colname":d.x.I18n.t("unconfirmed"),children:(0,m.jsx)("abbr",{children:i.toLocaleString()})}),(0,m.jsx)("td",{className:"mailpoet-hide-on-mobile","data-colname":d.x.I18n.t("unsubscribed"),children:(0,m.jsx)("abbr",{children:s.toLocaleString()})}),(0,m.jsx)("td",{className:"mailpoet-hide-on-mobile","data-colname":d.x.I18n.t("inactive"),children:(0,m.jsx)("abbr",{children:r.toLocaleString()})}),(0,m.jsx)("td",{className:"mailpoet-hide-on-mobile","data-colname":d.x.I18n.t("bounced"),children:(0,m.jsx)("abbr",{children:o.toLocaleString()})}),(0,m.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":d.x.I18n.t("createdOn"),children:[d.x.Date.short(e.created_at),(0,m.jsx)("br",{}),d.x.Date.time(e.created_at)]})]})};render(){return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(gr,{segmentType:"static"}),(0,m.jsx)("div",{className:"mailpoet-segments-listing",children:(0,m.jsx)(Oe.N,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,messages:wr,search:!1,endpoint:"segments",base_url:"lists",onRenderItem:this.renderItem,columns:yr,bulk_actions:jr,item_actions:kr,sort_by:"name",sort_order:"asc",isItemDeletable:Sr,isItemToggleable:xr})})]})}}const Cr=(0,Ce.EN)(Nr),Ir=[{name:"name",label:d.x.I18n.t("name"),type:"text"},{name:"description",label:d.x.I18n.t("description"),type:"textarea",tip:d.x.I18n.t("segmentDescriptionTip")},{name:"showInManageSubscriptionPage",label:d.x.I18n.t("showInManageSubscriptionPage"),type:"checkbox",values:{showInManageSubscriptionPage:d.x.I18n.t("showInManageSubscriptionPageTip")},isChecked:!0}],Tr={onUpdate:function(){d.x.Notice.success(d.x.I18n.t("segmentUpdated"))},onCreate:function(){d.x.Notice.success(d.x.I18n.t("segmentAdded")),d.x.trackEvent("Lists > Add new")}};function Er(e){let{match:t}=e;return(0,m.jsxs)("div",{children:[(0,m.jsx)(et.A,{color:"#fff"}),(0,m.jsx)(St.B,{}),(0,m.jsxs)(_t.X,{level:1,className:"mailpoet-title",children:[(0,m.jsx)("span",{children:d.x.I18n.t("segment")}),(0,m.jsx)(Ne.Link,{className:"mailpoet-button button button-secondary button-small",to:"/",children:d.x.I18n.t("backToList")})]}),(0,m.jsx)(_,{}),(0,m.jsx)(jt,{endpoint:"segments",fields:Ir,params:t.params,messages:Tr})]})}Er.displayName="SegmentForm";const Dr=document.getElementById("static_segments_container");function Or(){return(0,m.jsx)(l.k.Provider,{value:(0,l.S)(window),children:(0,m.jsxs)(Ne.HashRouter,{children:[(0,m.jsx)(p.w,{}),(0,m.jsxs)(Ce.rs,{children:[(0,m.jsx)(Ce.AW,{path:"/new",component:(0,o.withBoundary)(Er)}),(0,m.jsx)(Ce.AW,{path:"/edit/:id",component:(0,o.withBoundary)(Er)}),(0,m.jsx)(Ce.AW,{path:"*",component:(0,o.withBoundary)(Cr)})]})]})})}Dr&&((0,o.registerTranslations)(),s.render((0,m.jsx)(Or,{}),Dr));var Ar=n(18550),Rr=n(68086),Pr=n(42536),Lr=n(51921);function Mr(e){let{filterIndex:t}=e;const n=(0,k.Z)((e=>e(Pr.t).getSegmentFilter(t)),[t]),a=(0,k.Z)((e=>e(Pr.t).getAutomations()),[]),{updateSegmentFilter:i,updateSegmentFilterFromEvent:s}=(0,he.Z)(Pr.t);(0,r.useEffect)((()=>{n.operator!==Rr.f5.ANY&&n.operator!==Rr.f5.ALL&&n.operator!==Rr.f5.NONE&&i({operator:Rr.f5.ANY},t)}),[i,n,t]);const o=a.map((e=>({value:e.id,label:e.name})));return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(In.Grid.CenteredRow,{children:(0,m.jsxs)(lt.Select,{isFullWidth:!0,value:n.operator,onChange:e=>{s("operator",t,e)},children:[(0,m.jsx)("option",{value:Rr.f5.ANY,children:d.x.I18n.t("anyOf")}),(0,m.jsx)("option",{value:Rr.f5.ALL,children:d.x.I18n.t("allOf")}),(0,m.jsx)("option",{value:Rr.f5.NONE,children:d.x.I18n.t("noneOf")})]},"select")}),(0,m.jsx)(In.Grid.CenteredRow,{children:(0,m.jsx)(Ar.ReactSelect,{dimension:"small",isFullWidth:!0,isMulti:!0,placeholder:d.x.I18n.t("searchAutomations"),options:o,value:o.filter((e=>{if(!n.automation_ids)return;const t=e.value;return-1!==n.automation_ids.indexOf(t)})),onChange:e=>{i({automation_ids:e.map((e=>e.value))},t)}})})]})}const Fr={[Lr.Z.ENTERED_AUTOMATION]:Mr,[Lr.Z.EXITED_AUTOMATION]:Mr};function Br(e){let{filterIndex:t}=e;const n=(0,k.Z)((e=>e(Pr.t).getSegmentFilter(t)),[t]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:i}=(0,he.Z)(Pr.t),s=(0,k.Z)((e=>e(Pr.t).getNewslettersList()),[]),o=null==s?void 0:s.map((e=>{const t=e.sent_at?d.x.Date.format(e.sent_at):d.x.I18n.t("notSentYet");return{label:e.subject,tag:t,value:Number(e.id)}}));return(0,r.useEffect)((()=>{n.operator!==Rr.f5.ANY&&n.operator!==Rr.f5.ALL&&n.operator!==Rr.f5.NONE&&a({operator:Rr.f5.ANY},t),n.action===Rr.zd.MACHINE_OPENED&&n.operator===Rr.f5.NONE&&a({operator:Rr.f5.ANY},t)}),[n.action,n.operator,t,a]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(In.Grid.CenteredRow,{children:(0,m.jsxs)(lt.Select,{isFullWidth:!0,automationId:"segment-email-opens-condition",value:n.operator,onChange:e=>{i("operator",t,e)},children:[(0,m.jsx)("option",{value:Rr.f5.ANY,children:d.x.I18n.t("anyOf")}),(0,m.jsx)("option",{value:Rr.f5.ALL,children:d.x.I18n.t("allOf")}),n.action!==Rr.zd.MACHINE_OPENED?(0,m.jsx)("option",{value:Rr.f5.NONE,children:d.x.I18n.t("noneOf")}):null]},"select")}),(0,m.jsx)(In.Grid.CenteredRow,{children:(0,m.jsx)(Ar.ReactSelect,{dimension:"small",isFullWidth:!0,isMulti:!0,placeholder:d.x.I18n.t("selectNewsletterPlaceholder"),options:o,automationId:"segment-email",value:(0,Ba.filter)((e=>{if(!n.newsletters)return;const t=e.value;return-1!==n.newsletters.indexOf(t)}),o),onChange:e=>{a({newsletters:(0,Ba.map)((0,Ba.parseInt)(10),(0,Ba.map)("value",e))},t)}})})]})}const qr=e=>!!e;function Wr(e,t){return Object.values(t).includes(e)}function Vr(e){let{filterIndex:t}=e;const n=(0,k.Z)((e=>e(Pr.t).getSegmentFilter(t)),[t]),{updateSegmentFilterFromEvent:a,updateSegmentFilter:i}=(0,he.Z)(Pr.t);(0,r.useEffect)((()=>{Wr(n.timeframe,Rr.u4)||i({timeframe:Rr.u4.IN_THE_LAST},t)}),[n,i,t]);const s=n.timeframe===Rr.u4.IN_THE_LAST;return(0,m.jsx)(m.Fragment,{children:(l=e=>s&&"{days}"===e?(0,m.jsx)(o.Input,{type:"number",value:n.days||"","data-automation-id":"segment-number-of-days",onChange:e=>{a("days",t,e)},min:1,step:1,placeholder:d.x.I18n.t("daysPlaceholder")},"input"):"{timeframe}"===e?(0,m.jsxs)(lt.Select,{value:n.timeframe,onChange:e=>{a("timeframe",t,e)},children:[(0,m.jsx)("option",{value:"inTheLast",children:d.x.I18n.t("inTheLast")}),(0,m.jsx)("option",{value:"allTime",children:d.x.I18n.t("overAllTime")})]},"timeframe-select"):s&&"string"==typeof e&&e.trim().length>1?(0,m.jsx)("div",{children:e},e):null,d.x.I18n.t("emailActionOpensDaysSentence").split(/({days})|({timeframe})/gim).map(l))});var l}function $r(e){return e.timeframe===Rr.u4.ALL_TIME||!!e.days}function Ur(e){let{filterIndex:t}=e;const n=(0,k.Z)((e=>e(Pr.t).getSegmentFilter(t)),[t]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:i}=(0,he.Z)(Pr.t);return(0,r.useEffect)((()=>{void 0===n.operator&&a({operator:"more"},t)}),[a,n,t]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(In.Grid.CenteredRow,{children:(s=e=>"{condition}"===e?(0,m.jsxs)(lt.Select,{value:n.operator,onChange:e=>{i("operator",t,e)},children:[(0,m.jsx)("option",{value:"more",children:d.x.I18n.t("moreThan")}),(0,m.jsx)("option",{value:"less",children:d.x.I18n.t("lessThan")}),(0,m.jsx)("option",{value:"equals",children:d.x.I18n.t("equals")}),(0,m.jsx)("option",{value:"not_equals",children:d.x.I18n.t("notEquals")})]},"select"):"{opens}"===e?(0,m.jsx)(at.I,{type:"number",value:n.opens||"","data-automation-id":"segment-number-of-opens",onChange:e=>{i("opens",t,e)},min:"0",placeholder:d.x.I18n.t("emailActionOpens")},"input"):"string"==typeof e&&e.trim().length>1?(0,m.jsx)("div",{children:e},"opens"):null,d.x.I18n.t("emailActionOpensSentence").split(/({condition})|({opens})|(\b[a-zA-Z]+\b)/gim).map(s))}),(0,m.jsx)(In.Grid.CenteredRow,{children:(0,m.jsx)(Vr,{filterIndex:t})})]});var s}const Yr={[Rr.zd.OPENS_ABSOLUTE_COUNT]:Ur,[Rr.zd.MACHINE_OPENS_ABSOLUTE_COUNT]:Ur,[Rr.zd.CLICKED]:function(e){let{filterIndex:t}=e;const n=(0,k.Z)((e=>e(Pr.t).getSegmentFilter(t)),[t]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:i}=(0,he.Z)(Pr.t),s=(0,k.Z)((e=>e(Pr.t).getNewslettersList()),[]),[o,l]=(0,r.useState)([]),[c,p]=(0,r.useState)([]),[u,h]=(0,r.useState)(!1),f=null==s?void 0:s.map((e=>{const t=e.sent_at?d.x.Date.format(e.sent_at):(0,Pe.__)("Not sent yet","mailpoet");return{label:e.subject,tag:t,value:Number(e.id)}})),g=(0,r.useCallback)((()=>{var e;qr(n.newsletter_id)&&(p([]),e=n.newsletter_id,l([]),h(!0),d.x.Ajax.post({api_version:d.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})));h(!1),p(n)})).fail((e=>{l(e.errors)})))}),[n.newsletter_id]);return(0,r.useEffect)((()=>{g()}),[g,n.newsletter_id]),(0,r.useEffect)((()=>{n.operator!==Rr.f5.ANY&&n.operator!==Rr.f5.ALL&&n.operator!==Rr.f5.NONE&&a({operator:Rr.f5.ANY},t)}),[n.operator,t,a]),(0,m.jsxs)(m.Fragment,{children:[o.length>0&&(0,m.jsx)(Qt,{errors:o}),(0,m.jsx)(In.Grid.CenteredRow,{children:(0,m.jsx)(Ar.ReactSelect,{dimension:"small",isFullWidth:!0,placeholder:d.x.I18n.t("selectNewsletterPlaceholder"),options:f,value:(0,Ba.find)(["value",n.newsletter_id],f),onChange:e=>{a({newsletter_id:e.value,link_ids:[]},t)},automationId:"segment-email"})}),(0,m.jsxs)(In.Grid.CenteredRow,{children:[(0,m.jsxs)(lt.Select,{isMinWidth:!0,value:n.operator,onChange:e=>i("operator",t,e),automationId:"select-operator",children:[(0,m.jsx)("option",{value:Rr.f5.ANY,children:d.x.I18n.t("anyOf")}),(0,m.jsx)("option",{value:Rr.f5.ALL,children:d.x.I18n.t("allOf")}),(0,m.jsx)("option",{value:Rr.f5.NONE,children:d.x.I18n.t("noneOf")})]},"select-operator"),u&&(0,m.jsx)("span",{children:d.x.I18n.t("loadingDynamicSegmentItems")}),!u&&qr(n.newsletter_id)&&(0,m.jsx)(Ar.ReactSelect,{isMulti:!0,dimension:"small",isFullWidth:!0,automationId:"segment-link-select",placeholder:d.x.I18n.t("allLinksPlaceholder"),options:c.length?c:[{value:0,label:d.x.I18n.t("noLinksHint"),isDisabled:!0}],value:(0,Ba.filter)((e=>!!n.link_ids&&-1!==n.link_ids.indexOf(e.value)),c),onChange:e=>{a({link_ids:(e||[]).map((e=>e.value))},t)}})]})]})},[Rr.zd.OPENED]:Br,[Rr.zd.WAS_SENT]:Br,[Rr.zd.MACHINE_OPENED]:Br,[Rr.zd.CLICKED_ANY]:null};var Hr=n(30091),zr=n(47612);let Zr;!function(e){e.BEFORE="before",e.AFTER="after",e.ON="on",e.ON_OR_BEFORE="onOrBefore",e.ON_OR_AFTER="onOrAfter",e.NOT_ON="notOn",e.IN_THE_LAST="inTheLast",e.NOT_IN_THE_LAST="notInTheLast"}(Zr||(Zr={}));const Kr=[Zr.BEFORE,Zr.AFTER,Zr.ON,Zr.ON_OR_AFTER,Zr.ON_OR_BEFORE,Zr.NOT_ON,Zr.IN_THE_LAST,Zr.NOT_IN_THE_LAST],Gr=e=>{if(null!==e){if(Array.isArray(e))throw new Error("convertDateToString can process only single date array given");return d.x.Date.format(e,{format:"Y-m-d"})}},Qr=e=>{const t=(0,Hr.default)(e);if((0,zr.default)(t))return t};function Xr(e){let{filterIndex:t,defaultOperator:n}=e;const a=(0,k.Z)((e=>e(Pr.t).getSegmentFilter(t)),[t]),{updateSegmentFilter:i,updateSegmentFilterFromEvent:s}=(0,he.Z)(Pr.t);return(0,r.useEffect)((()=>{Kr.includes(a.operator)||i({operator:n},t),a.operator!==Zr.BEFORE&&a.operator!==Zr.AFTER&&a.operator!==Zr.ON&&a.operator!==Zr.ON_OR_AFTER&&a.operator!==Zr.ON_OR_BEFORE&&a.operator!==Zr.NOT_ON||void 0!==Qr(a.value)&&/^\d+-\d+-\d+$/.test(a.value)||i({value:Gr(new Date)},t),a.operator!==Zr.IN_THE_LAST&&a.operator!==Zr.NOT_IN_THE_LAST||"string"!=typeof a.value||/^\d*$/.exec(a.value)||i({value:""},t)}),[i,a,t,n]),(0,m.jsxs)(In.Grid.CenteredRow,{children:[(0,m.jsxs)(lt.Select,{value:a.operator,onChange:e=>{s("operator",t,e)},children:[(0,m.jsx)("option",{value:Zr.BEFORE,children:d.x.I18n.t("before")}),(0,m.jsx)("option",{value:Zr.ON_OR_BEFORE,children:d.x.I18n.t("onOrBefore")}),(0,m.jsx)("option",{value:Zr.ON,children:d.x.I18n.t("on")}),(0,m.jsx)("option",{value:Zr.NOT_ON,children:d.x.I18n.t("notOn")}),(0,m.jsx)("option",{value:Zr.ON_OR_AFTER,children:d.x.I18n.t("onOrAfter")}),(0,m.jsx)("option",{value:Zr.AFTER,children:d.x.I18n.t("after")}),(0,m.jsx)("option",{value:Zr.IN_THE_LAST,children:d.x.I18n.t("inTheLast")}),(0,m.jsx)("option",{value:Zr.NOT_IN_THE_LAST,children:d.x.I18n.t("notInTheLast")})]},"select"),(a.operator===Zr.BEFORE||a.operator===Zr.AFTER||a.operator===Zr.ON||a.operator===Zr.ON_OR_AFTER||a.operator===Zr.ON_OR_BEFORE||a.operator===Zr.NOT_ON)&&(0,m.jsx)(Ln,{dateFormat:"MMM d, yyyy",onChange:e=>{i({value:Gr(e)},t)},selected:a.value?Qr(a.value):void 0}),(a.operator===Zr.IN_THE_LAST||a.operator===Zr.NOT_IN_THE_LAST)&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(at.I,{type:"number",value:a.value,onChange:e=>{s("value",t,e)},min:"1",placeholder:d.x.I18n.t("daysPlaceholder")},"input"),(0,m.jsx)("span",{children:d.x.I18n.t("daysPlaceholder")})]})]})}function Jr(e){return!(!e.operator||!e.value)&&([Zr.BEFORE,Zr.AFTER,Zr.ON,Zr.NOT_ON,Zr.ON_OR_BEFORE,Zr.ON_OR_AFTER].includes(e.operator)?/^\d+-\d+-\d+$/.test(e.value):!![Zr.IN_THE_LAST,Zr.NOT_IN_THE_LAST].includes(e.operator)&&(/^\d+$/.test(e.value)&&Number(e.value)>0))}function eo(e){return function(t){return(0,m.jsx)(Xr,{...t,defaultOperator:e})}}const to=eo(Zr.BEFORE),no=eo(Zr.IN_THE_LAST);var ao=n(36390);const io=["is","isNot","contains","notContains","startsWith","notStartsWith","endsWith","notEndsWith"];function so(e){return!!io.includes(e.operator)&&"string"==typeof e.value&&e.value.length>0}function ro(e){let{filterIndex:t}=e;const n=(0,k.Z)((e=>e(Pr.t).getSegmentFilter(t)),[t]),{updateSegmentFilterFromEvent:a,updateSegmentFilter:i}=(0,he.Z)(Pr.t);return(0,r.useEffect)((()=>{io.includes(n.operator)||i({operator:"is",value:""},t)}),[i,n,t]),(0,m.jsxs)(In.Grid.CenteredRow,{children:[(0,m.jsxs)(lt.Select,{automationId:"subscriber-text-field-select",value:n.operator,onChange:e=>{a("operator",t,e)},children:[(0,m.jsx)("option",{value:"is",children:d.x.I18n.t("is")}),(0,m.jsx)("option",{value:"isNot",children:d.x.I18n.t("isNot")}),(0,m.jsx)("option",{value:"contains",children:d.x.I18n.t("contains")}),(0,m.jsx)("option",{value:"notContains",children:d.x.I18n.t("notContains")}),(0,m.jsx)("option",{value:"startsWith",children:d.x.I18n.t("startsWith")}),(0,m.jsx)("option",{value:"notStartsWith",children:d.x.I18n.t("notStartsWith")}),(0,m.jsx)("option",{value:"endsWith",children:d.x.I18n.t("endsWith")}),(0,m.jsx)("option",{value:"notEndsWith",children:d.x.I18n.t("notEndsWith")})]},"select"),(0,m.jsx)(at.I,{"data-automation-id":"text-custom-field-value",value:n.value||"",onChange:e=>{a("value",t,e)},placeholder:d.x.I18n.t("value")},"input")]})}const oo={[ao.wq.CUSTOMER_IN_COUNTRY]:function(e){let{filterIndex:t}=e;const n=(0,k.Z)((e=>e(Pr.t).getSegmentFilter(t)),[t]),{updateSegmentFilter:a}=(0,he.Z)(Pr.t),i=(0,k.Z)((e=>e(Pr.t).getWooCommerceCountries()),[]).map((e=>({value:e.code,label:e.name})));return(0,r.useEffect)((()=>{n.operator!==Rr.f5.ANY&&n.operator!==Rr.f5.NONE&&a({operator:Rr.f5.ANY},t)}),[a,n,t]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(In.Grid.CenteredRow,{children:(0,m.jsxs)(lt.Select,{value:n.operator,onChange:e=>{a({operator:e.target.value},t)},automationId:"select-operator-country",children:[(0,m.jsx)("option",{value:Rr.f5.ANY,children:d.x.I18n.t("anyOf")}),(0,m.jsx)("option",{value:Rr.f5.NONE,children:d.x.I18n.t("noneOf")})]},"select-operator-country")}),(0,m.jsx)(In.Grid.CenteredRow,{children:(0,m.jsx)(Ar.ReactSelect,{dimension:"small",isFullWidth:!0,isMulti:!0,placeholder:d.x.I18n.t("selectWooCountry"),options:i,value:(0,Ba.filter)((e=>{if(n.country_code)return-1!==n.country_code.indexOf(e.value)}),i),onChange:e=>{a({country_code:(e||[]).map((e=>e.value))},t)},automationId:"select-segment-country"},"select-segment-country")})]})},[ao.wq.CUSTOMER_IN_CITY]:ro,[ao.wq.CUSTOMER_IN_POSTAL_CODE]:ro,[ao.wq.NUMBER_OF_ORDERS]:function(e){let{filterIndex:t}=e;const n=(0,k.Z)((e=>e(Pr.t).getSegmentFilter(t)),[t]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:i}=(0,he.Z)(Pr.t);return(0,r.useEffect)((()=>{void 0===n.number_of_orders_type&&a({number_of_orders_type:"="},t)}),[a,n,t]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(In.Grid.CenteredRow,{children:[(0,m.jsxs)(o.Select,{value:n.number_of_orders_type,onChange:e=>{i("number_of_orders_type",t,e)},automationId:"select-number-of-orders-type",children:[(0,m.jsx)("option",{value:"=",children:d.x.I18n.t("equals")}),(0,m.jsx)("option",{value:"!=",children:d.x.I18n.t("notEquals")}),(0,m.jsx)("option",{value:">",children:d.x.I18n.t("moreThan")}),(0,m.jsx)("option",{value:"<",children:d.x.I18n.t("lessThan")})]},"select"),(0,m.jsx)(o.Input,{"data-automation-id":"input-number-of-orders-count",type:"number",min:0,value:n.number_of_orders_count||"",placeholder:d.x.I18n.t("wooNumberOfOrdersCount"),onChange:e=>{i("number_of_orders_count",t,e)}}),(0,m.jsx)("div",{children:d.x.I18n.t("wooNumberOfOrdersOrders")})]}),(0,m.jsx)(In.Grid.CenteredRow,{children:(0,m.jsx)(Vr,{filterIndex:t})})]})},[ao.wq.NUMBER_OF_REVIEWS]:function(e){let{filterIndex:t}=e;const n=(0,k.Z)((e=>e(Pr.t).getSegmentFilter(t)),[t]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:i}=(0,he.Z)(Pr.t);return(0,r.useEffect)((()=>{Wr(n.count_type,Rr.Si)||a({count_type:Rr.Si.EQUALS},t),Wr(n.rating,Rr.Nj)||a({rating:Rr.Nj.ANY},t),Wr(n.timeframe,Rr.u4)||a({timeframe:Rr.u4.IN_THE_LAST},t)}),[a,n,t]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(In.Grid.CenteredRow,{children:[(0,m.jsxs)(o.Select,{value:n.rating,onChange:e=>{i("rating",t,e)},children:[(0,m.jsx)("option",{value:Rr.Nj.ANY,children:d.x.I18n.t("wooAnyStarRating")}),(0,m.jsx)("option",{value:Rr.Nj.ONE,children:d.x.I18n.t("wooOneStarRating")}),(0,m.jsx)("option",{value:Rr.Nj.TWO,children:d.x.I18n.t("wooTwoStarRating")}),(0,m.jsx)("option",{value:Rr.Nj.THREE,children:d.x.I18n.t("wooThreeStarRating")}),(0,m.jsx)("option",{value:Rr.Nj.FOUR,children:d.x.I18n.t("wooFourStarRating")}),(0,m.jsx)("option",{value:Rr.Nj.FIVE,children:d.x.I18n.t("wooFiveStarRating")})]},"rating-select"),(0,m.jsxs)(o.Select,{value:n.count_type,onChange:e=>{i("count_type",t,e)},automationId:"select-number-of-reviews-type",children:[(0,m.jsx)("option",{value:Rr.Si.EQUALS,children:d.x.I18n.t("equals")}),(0,m.jsx)("option",{value:Rr.Si.NOT_EQUALS,children:d.x.I18n.t("notEquals")}),(0,m.jsx)("option",{value:Rr.Si.MORE_THAN,children:d.x.I18n.t("moreThan")}),(0,m.jsx)("option",{value:Rr.Si.LESS_THAN,children:d.x.I18n.t("lessThan")})]},"select"),(0,m.jsx)(o.Input,{"data-automation-id":"input-number-of-reviews-count",type:"number",min:0,value:n.count||"",placeholder:d.x.I18n.t("wooNumberOfOrdersCount"),onChange:e=>{i("count",t,e)}}),(0,m.jsx)("div",{children:d.x.I18n.t("wooNumberOfReviewsReviews")})]}),(0,m.jsx)(In.Grid.CenteredRow,{children:(0,m.jsx)(Vr,{filterIndex:t})})]})},[ao.wq.PURCHASE_DATE]:to,[ao.wq.PURCHASED_PRODUCT]:function(e){let{filterIndex:t}=e;const n=(0,k.Z)((e=>e(Pr.t).getSegmentFilter(t)),[t]),{updateSegmentFilter:a}=(0,he.Z)(Pr.t),i=(0,k.Z)((e=>e(Pr.t).getProducts()),[]).map((e=>({value:e.id,label:e.name})));return(0,r.useEffect)((()=>{n.operator!==Rr.f5.ALL&&n.operator!==Rr.f5.ANY&&n.operator!==Rr.f5.NONE&&a({operator:Rr.f5.ANY},t)}),[a,n,t]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(In.Grid.CenteredRow,{children:(0,m.jsxs)(lt.Select,{value:n.operator,onChange:e=>{a({operator:e.target.value},t)},automationId:"select-operator",children:[(0,m.jsx)("option",{value:Rr.f5.ANY,children:d.x.I18n.t("anyOf")}),(0,m.jsx)("option",{value:Rr.f5.ALL,children:d.x.I18n.t("allOf")}),(0,m.jsx)("option",{value:Rr.f5.NONE,children:d.x.I18n.t("noneOf")})]},"select-operator")}),(0,m.jsx)(In.Grid.CenteredRow,{children:(0,m.jsx)(Ar.ReactSelect,{isMulti:!0,dimension:"small",isFullWidth:!0,placeholder:d.x.I18n.t("selectWooPurchasedProduct"),options:i,value:(0,Ba.filter)((e=>{if(void 0!==n.product_ids&&0!==n.product_ids.length)return-1!==n.product_ids.indexOf(e.value)}),i),onChange:e=>{a({product_ids:(e||[]).map((e=>e.value))},t)},automationId:"select-segment-products"},"select-segment-products")})]})},[ao.wq.PURCHASED_CATEGORY]:function(e){let{filterIndex:t}=e;const n=(0,k.Z)((e=>e(Pr.t).getSegmentFilter(t)),[t]),{updateSegmentFilter:a}=(0,he.Z)(Pr.t),i=(0,k.Z)((e=>e(Pr.t).getProductCategories()),[]).map((e=>({value:e.id,label:e.name})));return(0,r.useEffect)((()=>{n.operator!==Rr.f5.ALL&&n.operator!==Rr.f5.ANY&&n.operator!==Rr.f5.NONE&&a({operator:Rr.f5.ANY},t)}),[a,n,t]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(In.Grid.CenteredRow,{children:(0,m.jsxs)(lt.Select,{value:n.operator,onChange:e=>{a({operator:e.target.value},t)},automationId:"select-operator",children:[(0,m.jsx)("option",{value:Rr.f5.ANY,children:d.x.I18n.t("anyOf")}),(0,m.jsx)("option",{value:Rr.f5.ALL,children:d.x.I18n.t("allOf")}),(0,m.jsx)("option",{value:Rr.f5.NONE,children:d.x.I18n.t("noneOf")})]},"select-operator")}),(0,m.jsx)(In.Grid.CenteredRow,{children:(0,m.jsx)(Ar.ReactSelect,{isMulti:!0,dimension:"small",isFullWidth:!0,placeholder:d.x.I18n.t("selectWooPurchasedCategory"),options:i,value:(0,Ba.filter)((e=>{if(void 0!==n.category_ids&&0!==n.category_ids.length)return-1!==n.category_ids.indexOf(e.value)}),i),onChange:e=>{a({category_ids:(e||[]).map((e=>e.value))},t)},automationId:"select-segment-category"},"select-segment-category")})]})},[ao.wq.SINGLE_ORDER_VALUE]:function(e){let{filterIndex:t}=e;const n=(0,k.Z)((e=>e(Pr.t).getSegmentFilter(t)),[t]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:i}=(0,he.Z)(Pr.t),s=(0,k.Z)((e=>e(Pr.t).getWooCommerceCurrencySymbol()),[]);return(0,r.useEffect)((()=>{void 0===n.single_order_value_type&&a({single_order_value_type:">"},t)}),[a,n,t]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(In.Grid.CenteredRow,{children:[(0,m.jsxs)(o.Select,{value:n.single_order_value_type,onChange:e=>{i("single_order_value_type",t,e)},automationId:"select-single-order-value-type",children:[(0,m.jsx)("option",{value:">",children:d.x.I18n.t("moreThan")}),(0,m.jsx)("option",{value:">=",children:d.x.I18n.t("moreThanOrEqual")}),(0,m.jsx)("option",{value:"=",children:d.x.I18n.t("equals")}),(0,m.jsx)("option",{value:"!=",children:d.x.I18n.t("notEquals")}),(0,m.jsx)("option",{value:"<=",children:d.x.I18n.t("lessThanOrEqual")}),(0,m.jsx)("option",{value:"<",children:d.x.I18n.t("lessThan")})]},"select"),(0,m.jsx)(o.Input,{"data-automation-id":"input-single-order-value-amount",type:"number",min:0,step:.01,value:n.single_order_value_amount||"",placeholder:d.x.I18n.t("wooSpentAmount"),onChange:e=>{i("single_order_value_amount",t,e)}}),(0,m.jsx)("div",{children:s})]}),(0,m.jsx)(In.Grid.CenteredRow,{children:(0,m.jsx)(Vr,{filterIndex:t})})]})},[ao.wq.TOTAL_SPENT]:function(e){let{filterIndex:t}=e;const n=(0,k.Z)((e=>e(Pr.t).getSegmentFilter(t)),[t]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:i}=(0,he.Z)(Pr.t),s=(0,k.Z)((e=>e(Pr.t).getWooCommerceCurrencySymbol()),[]);return(0,r.useEffect)((()=>{void 0===n.total_spent_type&&a({total_spent_type:">"},t)}),[a,n,t]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(In.Grid.CenteredRow,{children:[(0,m.jsxs)(o.Select,{value:n.total_spent_type,onChange:e=>{i("total_spent_type",t,e)},automationId:"select-total-spent-type",children:[(0,m.jsx)("option",{value:"=",children:d.x.I18n.t("equals")}),(0,m.jsx)("option",{value:"!=",children:d.x.I18n.t("notEquals")}),(0,m.jsx)("option",{value:">",children:d.x.I18n.t("moreThan")}),(0,m.jsx)("option",{value:"<",children:d.x.I18n.t("lessThan")})]},"select"),(0,m.jsx)(o.Input,{"data-automation-id":"input-total-spent-amount",type:"number",min:0,step:.01,value:n.total_spent_amount||"",placeholder:d.x.I18n.t("wooSpentAmount"),onChange:e=>{i("total_spent_amount",t,e)}}),(0,m.jsx)("div",{children:s})]}),(0,m.jsx)(In.Grid.CenteredRow,{children:(0,m.jsx)(Vr,{filterIndex:t})})]})},[ao.wq.AVERAGE_SPENT]:function(e){let{filterIndex:t}=e;const n=(0,k.Z)((e=>e(Pr.t).getSegmentFilter(t)),[t]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:i}=(0,he.Z)(Pr.t),s=(0,k.Z)((e=>e(Pr.t).getWooCommerceCurrencySymbol()),[]);return(0,r.useEffect)((()=>{[">",">=","=","!=","<=","<"].includes(n.average_spent_type)||a({average_spent_type:">"},t)}),[a,n,t]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(In.Grid.CenteredRow,{children:[(0,m.jsxs)(o.Select,{value:n.average_spent_type,onChange:e=>{i("average_spent_type",t,e)},automationId:"select-average-spent-type",children:[(0,m.jsx)("option",{value:">",children:d.x.I18n.t("moreThan")}),(0,m.jsx)("option",{value:">=",children:d.x.I18n.t("moreThanOrEqual")}),(0,m.jsx)("option",{value:"=",children:d.x.I18n.t("equals")}),(0,m.jsx)("option",{value:"!=",children:d.x.I18n.t("notEquals")}),(0,m.jsx)("option",{value:"<=",children:d.x.I18n.t("lessThanOrEqual")}),(0,m.jsx)("option",{value:"<",children:d.x.I18n.t("lessThan")})]},"select"),(0,m.jsx)(o.Input,{"data-automation-id":"input-average-spent-amount",type:"number",min:0,step:.01,value:n.average_spent_amount||"",placeholder:d.x.I18n.t("wooSpentAmount"),onChange:e=>{i("average_spent_amount",t,e)}}),(0,m.jsx)("div",{children:s})]}),(0,m.jsx)(In.Grid.CenteredRow,{children:(0,m.jsx)(Vr,{filterIndex:t})})]})},[ao.wq.USED_COUPON_CODE]:function(e){let{filterIndex:t}=e;const n=(0,k.Z)((e=>e(Pr.t).getSegmentFilter(t)),[t]),{updateSegmentFilter:a}=(0,he.Z)(Pr.t);(0,r.useEffect)((()=>{Array.isArray(n.coupon_code_ids)||a({coupon_code_ids:[]},t),Wr(n.operator,Rr.f5)||a({operator:Rr.f5.ANY},t)}),[a,n,t]);const i=(0,k.Z)((e=>e(Pr.t).getCoupons()),[]).map((e=>({value:e.id,label:e.name})));return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(In.Grid.CenteredRow,{children:[(0,m.jsxs)(o.Select,{isMaxContentWidth:!0,value:n.operator,onChange:e=>{a({operator:e.target.value},t)},automationId:"select-operator-used-coupon-code",children:[(0,m.jsx)("option",{value:Rr.f5.ANY,children:d.x.I18n.t("anyOf")}),(0,m.jsx)("option",{value:Rr.f5.ALL,children:d.x.I18n.t("allOf")}),(0,m.jsx)("option",{value:Rr.f5.NONE,children:d.x.I18n.t("noneOf")})]},"select-operator-used-coupon-codes"),(0,m.jsx)(Ar.ReactSelect,{isFullWidth:!0,isMulti:!0,placeholder:d.x.I18n.t("selectWooCouponCodes"),options:i,value:(0,Ba.filter)((e=>{if(n.coupon_code_ids)return-1!==n.coupon_code_ids.indexOf(e.value)}),i),onChange:e=>{a({coupon_code_ids:(e||[]).map((e=>e.value))},t)},automationId:"select-shipping-methods"},"select-coupon-codes")]}),(0,m.jsx)(In.Grid.CenteredRow,{children:(0,m.jsx)(Vr,{filterIndex:t})})]})},[ao.wq.USED_PAYMENT_METHOD]:function(e){let{filterIndex:t}=e;const n=(0,k.Z)((e=>e(Pr.t).getSegmentFilter(t)),[t]),{updateSegmentFilter:a}=(0,he.Z)(Pr.t),i=(0,k.Z)((e=>e(Pr.t).getPaymentMethods()),[]).map((e=>({value:e.id,label:e.name})));return(0,r.useEffect)((()=>{n.operator!==Rr.f5.ANY&&n.operator!==Rr.f5.ALL&&n.operator!==Rr.f5.NONE&&a({operator:Rr.f5.ANY},t)}),[a,n,t]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(In.Grid.CenteredRow,{children:[(0,m.jsxs)(o.Select,{isMaxContentWidth:!0,value:n.operator,onChange:e=>{a({operator:e.target.value},t)},automationId:"select-operator-used-payment-methods",children:[(0,m.jsx)("option",{value:Rr.f5.ANY,children:d.x.I18n.t("anyOf")}),(0,m.jsx)("option",{value:Rr.f5.ALL,children:d.x.I18n.t("allOf")}),(0,m.jsx)("option",{value:Rr.f5.NONE,children:d.x.I18n.t("noneOf")})]},"select-operator-used-payment-methods"),(0,m.jsx)(Ar.ReactSelect,{isFullWidth:!0,isMulti:!0,placeholder:d.x.I18n.t("selectWooPaymentMethods"),options:i,value:(0,Ba.filter)((e=>{if(n.payment_methods)return-1!==n.payment_methods.indexOf(e.value)}),i),onChange:e=>{a({payment_methods:(e||[]).map((e=>e.value))},t)},automationId:"select-payment-methods"},"select-payment-methods")]}),(0,m.jsx)(In.Grid.CenteredRow,{children:(0,m.jsx)(Vr,{filterIndex:t})})]})},[ao.wq.USED_SHIPPING_METHOD]:function(e){let{filterIndex:t}=e;const n=(0,k.Z)((e=>e(Pr.t).getSegmentFilter(t)),[t]),{updateSegmentFilter:a}=(0,he.Z)(Pr.t),i=(0,k.Z)((e=>e(Pr.t).getShippingMethods()),[]).map((e=>({value:e.instanceId,label:e.name})));return(0,r.useEffect)((()=>{n.operator!==Rr.f5.ANY&&n.operator!==Rr.f5.ALL&&n.operator!==Rr.f5.NONE&&a({operator:Rr.f5.ANY},t)}),[a,n,t]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(In.Grid.CenteredRow,{children:[(0,m.jsxs)(o.Select,{isMaxContentWidth:!0,value:n.operator,onChange:e=>{a({operator:e.target.value},t)},automationId:"select-operator-used-shipping-methods",children:[(0,m.jsx)("option",{value:Rr.f5.ANY,children:d.x.I18n.t("anyOf")}),(0,m.jsx)("option",{value:Rr.f5.ALL,children:d.x.I18n.t("allOf")}),(0,m.jsx)("option",{value:Rr.f5.NONE,children:d.x.I18n.t("noneOf")})]},"select-operator-used-shipping-methods"),(0,m.jsx)(Ar.ReactSelect,{isFullWidth:!0,isMulti:!0,placeholder:d.x.I18n.t("selectWooShippingMethods"),options:i,value:(0,Ba.filter)((e=>{if(n.shipping_methods)return-1!==n.shipping_methods.indexOf(e.value)}),i),onChange:e=>{a({shipping_methods:(e||[]).map((e=>e.value))},t)},automationId:"select-shipping-methods"},"select-shipping-methods")]}),(0,m.jsx)(In.Grid.CenteredRow,{children:(0,m.jsx)(Vr,{filterIndex:t})})]})}};function lo(e){let{filterIndex:t}=e;const n=(0,k.Z)((e=>e(Pr.t).getSegmentFilter(t)),[t]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:i}=(0,he.Z)(Pr.t);(0,r.useEffect)((()=>{n.action===Rr.jx.WORDPRESS_ROLE&&n.operator!==Rr.f5.ANY&&n.operator!==Rr.f5.ALL&&n.operator!==Rr.f5.NONE&&a({operator:Rr.f5.ANY},t)}),[a,n,t]);const s=(0,k.Z)((e=>e(Pr.t).getWordpressRoles()),[]).map((e=>({value:e.role_id,label:e.role_name})));return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(In.Grid.CenteredRow,{children:(0,m.jsxs)(lt.Select,{isFullWidth:!0,automationId:"segment-wordpress-role-condition",value:n.operator,onChange:e=>{i("operator",t,e)},children:[(0,m.jsx)("option",{value:Rr.f5.ANY,children:d.x.I18n.t("anyOf")}),(0,m.jsx)("option",{value:Rr.f5.ALL,children:d.x.I18n.t("allOf")}),(0,m.jsx)("option",{value:Rr.f5.NONE,children:d.x.I18n.t("noneOf")})]},"select")}),(0,m.jsx)(In.Grid.CenteredRow,{children:(0,m.jsx)(Ar.ReactSelect,{dimension:"small",isFullWidth:!0,isMulti:!0,automationId:"segment-wordpress-role",placeholder:d.x.I18n.t("selectUserRolePlaceholder"),options:s,value:(0,Ba.filter)((e=>{if(n.wordpressRole)return-1!==n.wordpressRole.indexOf(e.value)}),s),onChange:e=>{a({wordpressRole:(0,Ba.map)("value",e)},t)}})})]})}let co;!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"}(co||(co={}));const po=[co.HIGHER_THAN,co.LOWER_THAN,co.EQUALS,co.NOT_EQUALS,co.UNKNOWN,co.NOT_UNKNOWN];function uo(e){return!!(0,Rr.F3)(e.operator)||"string"==typeof e.value&&e.value.length>0&&("equals"===e.operator||"contains"===e.operator||"not_contains"===e.operator||"not_equals"===e.operator||"more_than"===e.operator||"less_than"===e.operator)}function mo(e){let{filterIndex:t}=e;const n=(0,k.Z)((e=>e(Pr.t).getSegmentFilter(t)),[t]),{updateSegmentFilterFromEvent:a,updateSegmentFilter:i}=(0,he.Z)(Pr.t);return(0,r.useEffect)((()=>{void 0===n.operator&&i({operator:"equals",value:""},t)}),[i,n,t]),(0,m.jsxs)(In.Grid.CenteredRow,{children:[(0,m.jsxs)(lt.Select,{automationId:"text-custom-field-operator",value:n.operator,onChange:e=>{a("operator",t,e)},children:[(0,m.jsx)("option",{value:"equals",children:d.x.I18n.t("is")}),(0,m.jsx)("option",{value:"not_equals",children:d.x.I18n.t("isNot")}),(0,m.jsx)("option",{value:"contains",children:d.x.I18n.t("contains")}),(0,m.jsx)("option",{value:"not_contains",children:d.x.I18n.t("notContains")}),(0,m.jsx)("option",{value:"more_than",children:d.x.I18n.t("moreThan")}),(0,m.jsx)("option",{value:"less_than",children:d.x.I18n.t("lessThan")}),(0,m.jsx)("option",{value:"is_blank",children:d.x.I18n.t("isBlank")}),(0,m.jsx)("option",{value:"is_not_blank",children:d.x.I18n.t("isNotBlank")})]},"select"),!(0,Rr.F3)(n.operator)&&(0,m.jsx)(at.I,{"data-automation-id":"text-custom-field-value",value:n.value||"",onChange:e=>{a("value",t,e)},placeholder:d.x.I18n.t("value")},"input")]})}function ho(e){return!!(0,Rr.F3)(e.operator)||"string"==typeof e.value&&e.value.length>0}function fo(e){var t;let{filterIndex:n}=e;const a=(0,k.Z)((e=>e(Pr.t).getSegmentFilter(n)),[n]),{updateSegmentFilter:i,updateSegmentFilterFromEvent:s}=(0,he.Z)(Pr.t),r=(0,k.Z)((e=>e(Pr.t).getCustomFieldsList()),[]),o=(0,Ba.find)({id:Number(a.custom_field_id)},r);if(!o)return null;const l=o.params;if(!l||!Array.isArray(l.values))return null;const c=l.values.map((e=>({value:e.value,label:e.value}))),p=null===(t=c.find((e=>e.value===a.value)))||void 0===t?void 0:t.label;return(0,m.jsxs)(In.Grid.CenteredRow,{children:[(0,m.jsxs)(lt.Select,{automationId:"text-custom-field-operator",value:a.operator,onChange:e=>{s("operator",n,e)},children:[(0,m.jsx)("option",{value:"equals",children:d.x.I18n.t("is")}),(0,m.jsx)("option",{value:Rr.DB.BLANK,children:d.x.I18n.t("isBlank")}),(0,m.jsx)("option",{value:Rr.DB.NOT_BLANK,children:d.x.I18n.t("isNotBlank")})]},"select"),!(0,Rr.F3)(a.operator)&&(0,m.jsx)(Ar.ReactSelect,{dimension:"small",placeholder:d.x.I18n.t("selectValue"),options:c,value:a.value&&p?{value:a.value,label:p}:null,onChange:e=>{i({value:e.value},n)},automationId:"segment-wordpress-role"})]})}var go=n(42384),xo=n(39156);function _o(e){return!!(0,Rr.F3)(e.operator)||("month"===e.date_type||!("string"!=typeof e.operator||e.operator.length<1))&&"string"==typeof e.value&&e.value.length>1}const bo=e=>{if(null!==e){if(Array.isArray(e))throw new Error("convertDateToString can process only single date array given");return(0,xo.default)(e,"yyyy-MM-dd 00:00:00")}},vo=e=>{const t=(0,Hr.default)(e);if((0,zr.default)(t))return t},yo={month:function(e){let{onChange:t,item:n,filterIndex:a}=e;return(0,r.useEffect)((()=>{_o(n)||t((0,Ba.assign)(n,{value:"2017-01-01 00:00:00"}),a),void 0===n.operator&&t((0,Ba.assign)(n,{operator:"equals"}),a)}),[t,n,a]),(0,m.jsxs)(In.Grid.CenteredRow,{children:[(0,m.jsxs)(lt.Select,{value:n.operator,onChange:e=>{t((0,Ba.assign)(n,{operator:e.target.value}),a)},children:[(0,m.jsx)("option",{value:"equals",children:(0,Pe.__)("is","mailpoet")}),(0,m.jsx)("option",{value:Rr.DB.BLANK,children:(0,Pe.__)("is blank","mailpoet")}),(0,m.jsx)("option",{value:Rr.DB.NOT_BLANK,children:(0,Pe.__)("is not blank","mailpoet")})]},"select-operator"),!(0,Rr.F3)(n.operator)&&(0,m.jsxs)(lt.Select,{value:n.value,onChange:e=>{t((0,Ba.assign)(n,{value:e.target.value}),a)},children:[(0,m.jsx)("option",{value:"2017-01-01 00:00:00",children:(0,Pe.__)("january","mailpoet")}),(0,m.jsx)("option",{value:"2017-02-01 00:00:00",children:(0,Pe.__)("february","mailpoet")}),(0,m.jsx)("option",{value:"2017-03-01 00:00:00",children:(0,Pe.__)("march","mailpoet")}),(0,m.jsx)("option",{value:"2017-04-01 00:00:00",children:(0,Pe.__)("april","mailpoet")}),(0,m.jsx)("option",{value:"2017-05-01 00:00:00",children:(0,Pe.__)("may","mailpoet")}),(0,m.jsx)("option",{value:"2017-06-01 00:00:00",children:(0,Pe.__)("june","mailpoet")}),(0,m.jsx)("option",{value:"2017-07-01 00:00:00",children:(0,Pe.__)("july","mailpoet")}),(0,m.jsx)("option",{value:"2017-08-01 00:00:00",children:(0,Pe.__)("august","mailpoet")}),(0,m.jsx)("option",{value:"2017-09-01 00:00:00",children:(0,Pe.__)("september","mailpoet")}),(0,m.jsx)("option",{value:"2017-10-01 00:00:00",children:(0,Pe.__)("october","mailpoet")}),(0,m.jsx)("option",{value:"2017-11-01 00:00:00",children:(0,Pe.__)("november","mailpoet")}),(0,m.jsx)("option",{value:"2017-12-01 00:00:00",children:(0,Pe.__)("december","mailpoet")})]},"select")]})},year:function(e){let{onChange:t,item:n,filterIndex:a}=e;const i=(0,go.default)(new Date);return(0,r.useEffect)((()=>{_o(n)||t((0,Ba.assign)(n,{value:`${i}-01-01 00:00:00`,operator:"equals"}),a)}),[i,t,n,a]),(0,m.jsxs)(In.Grid.CenteredRow,{children:[(0,m.jsxs)(lt.Select,{value:n.operator,onChange:e=>{t((0,Ba.assign)(n,{operator:e.target.value}),a)},children:[(0,m.jsx)("option",{value:"equals",children:(0,Pe.__)("is","mailpoet")}),(0,m.jsx)("option",{value:"before",children:(0,Pe._x)("before",'Meaning: "Subscriber subscribed before April"',"mailpoet")}),(0,m.jsx)("option",{value:"after",children:(0,Pe._x)("after",'Meaning: "Subscriber subscribed after April',"mailpoet")}),(0,m.jsx)("option",{value:Rr.DB.BLANK,children:(0,Pe.__)("is blank","mailpoet")}),(0,m.jsx)("option",{value:Rr.DB.NOT_BLANK,children:(0,Pe.__)("is not blank","mailpoet")})]},"select-operator"),(0,m.jsx)(lt.Select,{value:n.value,onChange:e=>{t((0,Ba.assign)(n,{value:e.target.value}),a)},children:(0,Ba.range)(0,100).map((e=>(0,m.jsx)("option",{value:i-e+"-01-01 00:00:00",children:i-e},i-e)))},"select-year")]})},year_month:function(e){let{onChange:t,item:n,filterIndex:a}=e;return(0,r.useEffect)((()=>{void 0!==n.value&&""!==n.value||t((0,Ba.assign)(n,{value:`${(0,xo.default)(new Date,"yyyy-MM-dd")} 00:00:00`,operator:"equals"}),a)}),[t,n,a]),(0,m.jsxs)(In.Grid.CenteredRow,{children:[(0,m.jsxs)(lt.Select,{value:n.operator,onChange:e=>{t((0,Ba.assign)(n,{operator:e.target.value}),a)},children:[(0,m.jsx)("option",{value:"equals",children:(0,Pe.__)("is","mailpoet")}),(0,m.jsx)("option",{value:"before",children:(0,Pe._x)("before",'Meaning: "Subscriber subscribed before April"',"mailpoet")}),(0,m.jsx)("option",{value:"after",children:(0,Pe._x)("after",'Meaning: "Subscriber subscribed after April',"mailpoet")}),(0,m.jsx)("option",{value:Rr.DB.BLANK,children:(0,Pe.__)("is blank","mailpoet")}),(0,m.jsx)("option",{value:Rr.DB.NOT_BLANK,children:(0,Pe.__)("is not blank","mailpoet")})]},"select-operator"),!(0,Rr.F3)(n.operator)&&(0,m.jsx)(Ln,{onChange:e=>t((0,Ba.assign)(n,{value:bo(e)}),a),selected:n.value?vo(n.value):void 0,dateFormat:"MM/yyyy",showMonthYearPicker:!0})]})},year_month_day:function(e){let{onChange:t,item:n,filterIndex:a}=e;return(0,r.useEffect)((()=>{_o(n)||t((0,Ba.assign)(n,{value:`${(0,xo.default)(new Date,"yyyy-MM-dd")} 00:00:00`,operator:"equals"}),a)}),[t,n,a]),(0,m.jsxs)(In.Grid.CenteredRow,{children:[(0,m.jsxs)(lt.Select,{value:n.operator,onChange:e=>{t((0,Ba.assign)(n,{operator:e.target.value}),a)},children:[(0,m.jsx)("option",{value:"equals",children:(0,Pe.__)("is","mailpoet")}),(0,m.jsx)("option",{value:"before",children:(0,Pe._x)("before",'Meaning: "Subscriber subscribed before April"',"mailpoet")}),(0,m.jsx)("option",{value:"after",children:(0,Pe._x)("after",'Meaning: "Subscriber subscribed after April',"mailpoet")}),(0,m.jsx)("option",{value:Rr.DB.BLANK,children:(0,Pe.__)("is blank","mailpoet")}),(0,m.jsx)("option",{value:Rr.DB.NOT_BLANK,children:(0,Pe.__)("is not blank","mailpoet")})]},"select-operator"),!(0,Rr.F3)(n.operator)&&(0,m.jsx)(Ln,{dateFormat:"MMM d, yyyy",onChange:e=>t((0,Ba.assign)(n,{value:bo(e)}),a),selected:n.value?vo(n.value):void 0})]})}};var wo;!function(e){e.DATE="date",e.TEXT="text",e.TEXTAREA="textarea",e.RADIO="radio",e.CHECKBOX="checkbox",e.SELECT="select"}(wo||(wo={}));const jo={[wo.TEXT]:uo,[wo.TEXTAREA]:uo,[wo.RADIO]:ho,[wo.SELECT]:ho,[wo.CHECKBOX]:function(e){return!!(0,Rr.F3)(e.operator)||["1","0"].includes(e.value)},[wo.DATE]:_o},So={[wo.TEXT]:mo,[wo.TEXTAREA]:mo,[wo.RADIO]:fo,[wo.SELECT]:fo,[wo.CHECKBOX]:function(e){let{filterIndex:t}=e;const n=(0,k.Z)((e=>e(Pr.t).getSegmentFilter(t)),[t]),{updateSegmentFilterFromEvent:a,updateSegmentFilter:i}=(0,he.Z)(Pr.t);return(0,r.useEffect)((()=>{void 0===n.operator?i({operator:"equals",value:"1"},t):"equals"!==n.operator||["1","0"].includes(n.value)||i({value:"1"},t)}),[i,n,t]),(0,m.jsxs)(In.Grid.CenteredRow,{children:[(0,m.jsxs)(lt.Select,{value:n.operator,onChange:e=>{a("operator",t,e)},children:[(0,m.jsx)("option",{value:"equals",children:(0,Pe.__)("is","mailpoet")}),(0,m.jsx)("option",{value:Rr.DB.BLANK,children:(0,Pe.__)("is blank","mailpoet")}),(0,m.jsx)("option",{value:Rr.DB.NOT_BLANK,children:(0,Pe.__)("is not blank","mailpoet")})]},"select-operator"),!(0,Rr.F3)(n.operator)&&(0,m.jsxs)(lt.Select,{value:n.value,onChange:e=>a("value",t,e),children:[(0,m.jsx)("option",{value:"1",children:(0,Pe.__)("checked","mailpoet")}),(0,m.jsx)("option",{value:"0",children:(0,Pe.__)("unchecked","mailpoet")})]},"select")]})},[wo.DATE]:function(e){let{customField:t,filterIndex:n}=e;const a=(0,k.Z)((e=>e(Pr.t).getSegmentFilter(n)),[n]),{updateSegmentFilter:i}=(0,he.Z)(Pr.t);(0,r.useEffect)((()=>{a.date_type!==t.params.date_type&&i({date_type:t.params.date_type,value:""},n)}),[a.date_type,i,t.params.date_type,n]);const s=yo[t.params.date_type];return s?(0,m.jsx)(s,{item:a,onChange:i,filterIndex:n}):null}};function ko(){return(0,m.jsx)(nr,{message:(()=>{const e=d.x.I18n.t("premiumFeatureMultipleConditions");return(0,m.jsx)("p",{children:x()(e,/\[link](.*?)\[\/link]/g,(e=>(0,m.jsx)("a",{href:d.x.premiumLink,target:"_blank",rel:"noopener noreferrer",children:e},e)))})})(),actionButton:(0,m.jsx)(Le.z,{href:d.x.MailPoetComUrlFactory.getPurchasePlanUrl(d.x.subscribersCount,d.x.currentWpUserEmail,null,{utm_medium:"segments",utm_campaign:"signup"}),target:"_blank",rel:"noopener noreferrer",children:d.x.I18n.t("premiumBannerCtaFree")})})}const No={[Rr.jx.WORDPRESS_ROLE]:lo,[Rr.jx.SUBSCRIBER_SCORE]:function(e){let{filterIndex:t}=e;const n=(0,k.Z)((e=>e(Pr.t).getSegmentFilter(t)),[t]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:i}=(0,he.Z)(Pr.t);return(0,r.useEffect)((()=>{po.includes(n.operator)||a({operator:co.HIGHER_THAN},t),n.operator!==co.HIGHER_THAN&&n.operator!==co.LOWER_THAN&&n.operator!==co.EQUALS&&n.operator!==co.NOT_EQUALS||void 0!==n.value||a({value:""},t),n.operator!==co.UNKNOWN&&n.operator!==co.NOT_UNKNOWN||a({value:null},t)}),[a,n,t]),(0,m.jsx)(In.Grid.CenteredRow,{children:(s=e=>"{condition}"===e?(0,m.jsxs)(lt.Select,{value:n.operator,automationId:"segment-subscriber-score-operator",onChange:e=>{i("operator",t,e)},children:[(0,m.jsx)("option",{value:co.HIGHER_THAN,children:d.x.I18n.t("higherThan")}),(0,m.jsx)("option",{value:co.LOWER_THAN,children:d.x.I18n.t("lowerThan")}),(0,m.jsx)("option",{value:co.EQUALS,children:d.x.I18n.t("equals")}),(0,m.jsx)("option",{value:co.NOT_EQUALS,children:d.x.I18n.t("notEquals")}),(0,m.jsx)("option",{value:co.UNKNOWN,children:d.x.I18n.t("unknown")}),(0,m.jsx)("option",{value:co.NOT_UNKNOWN,children:d.x.I18n.t("notUnknown")})]},"select"):"{score}"===e?(n.operator===co.HIGHER_THAN||n.operator===co.LOWER_THAN||n.operator===co.EQUALS||n.operator===co.NOT_EQUALS)&&(0,m.jsx)(at.I,{type:"number",value:n.value||"","data-automation-id":"segment-subscriber-score-value",onChange:e=>{i("value",t,e)},min:"0",placeholder:d.x.I18n.t("subscriberScorePlaceholder")},"input"):"string"==typeof e&&e.trim().length>0?n.operator!==co.UNKNOWN&&n.operator!==co.NOT_UNKNOWN&&(0,m.jsx)("div",{children:e},"score"):null,d.x.I18n.t("subscriberScoreSentence").split(/({condition})|({score})|(\b%\b)/gim).map(s))});var s},[Rr.jx.SUBSCRIBED_DATE]:to,[Rr.jx.MAILPOET_CUSTOM_FIELD]:function(e){let{filterIndex:t}=e;const n=(0,k.Z)((e=>e(Pr.t).getSegmentFilter(t)),[t]),{updateSegmentFilter:a}=(0,he.Z)(Pr.t),i=(0,k.Z)((e=>e(Pr.t).getCustomFieldsList()),[]),s=(0,Ba.find)({id:Number(n.custom_field_id)},i),r=i.map((e=>({value:e.id.toString(),label:e.name}))),o=So[n.custom_field_type];return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("div",{children:(0,m.jsx)(Ar.ReactSelect,{dimension:"small",isFullWidth:!0,placeholder:d.x.I18n.t("selectCustomFieldPlaceholder"),options:r,automationId:"select-custom-field",value:(0,Ba.find)((e=>{if(n.custom_field_id)return n.custom_field_id===e.value}),r),onChange:e=>{const n=(0,Ba.find)({id:Number(e.value)},i);n&&a({custom_field_id:e.value,custom_field_type:n.type,operator:void 0,value:void 0},t)}})}),(0,m.jsx)("div",{children:o&&(0,m.jsx)(o,{customField:s,filterIndex:t})})]})},[Rr.jx.SUBSCRIBED_TO_LIST]:function(e){let{filterIndex:t}=e;const n=(0,k.Z)((e=>e(Pr.t).getSegmentFilter(t)),[t]),a=(0,k.Z)((e=>e(Pr.t).getStaticSegmentsList()),[]),{updateSegmentFilter:i,updateSegmentFilterFromEvent:s}=(0,he.Z)(Pr.t);(0,r.useEffect)((()=>{n.operator!==Rr.f5.ANY&&n.operator!==Rr.f5.ALL&&n.operator!==Rr.f5.NONE&&i({operator:Rr.f5.ANY},t)}),[i,n,t]);const o=a.map((e=>({value:e.id,label:e.name})));return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(In.Grid.CenteredRow,{children:(0,m.jsxs)(lt.Select,{isFullWidth:!0,value:n.operator,onChange:e=>{s("operator",t,e)},children:[(0,m.jsx)("option",{value:Rr.f5.ANY,children:d.x.I18n.t("anyOf")}),(0,m.jsx)("option",{value:Rr.f5.ALL,children:d.x.I18n.t("allOf")}),(0,m.jsx)("option",{value:Rr.f5.NONE,children:d.x.I18n.t("noneOf")})]},"select")}),(0,m.jsx)(In.Grid.CenteredRow,{children:(0,m.jsx)(Ar.ReactSelect,{dimension:"small",isFullWidth:!0,isMulti:!0,placeholder:d.x.I18n.t("searchLists"),options:o,value:(0,Ba.filter)((e=>{if(!n.segments)return;const t=e.value;return-1!==n.segments.indexOf(t)}),o),onChange:e=>{i({segments:(0,Ba.map)((0,Ba.parseInt)(10),(0,Ba.map)("value",e))},t)}})})]})},[Rr.jx.SUBSCRIBER_TAG]:function(e){let{filterIndex:t}=e;return Pt.Hooks.applyFilters("mailpoet_dynamic_segments_filter_subscriber_tag",(0,m.jsx)(ko,{}),t)},[Rr.jx.SUBSCRIBER_FIRST_NAME]:ro,[Rr.jx.SUBSCRIBER_LAST_NAME]:ro,[Rr.jx.SUBSCRIBER_EMAIL]:ro,[Rr.jx.SUBSCRIBED_VIA_FORM]:function(e){let{filterIndex:t}=e;const n=(0,k.Z)((e=>e(Pr.t).getSegmentFilter(t)),[t]),a=(0,k.Z)((e=>e(Pr.t).getSignupForms()),[]),{updateSegmentFilter:i,updateSegmentFilterFromEvent:s}=(0,he.Z)(Pr.t);(0,r.useEffect)((()=>{n.operator!==Rr.f5.ANY&&n.operator!==Rr.f5.NONE&&i({operator:Rr.f5.ANY},t)}),[i,n,t]);const o=a.map((e=>({value:e.id,label:e.name})));return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(In.Grid.CenteredRow,{children:(0,m.jsxs)(lt.Select,{isFullWidth:!0,value:n.operator,onChange:e=>{s("operator",t,e)},children:[(0,m.jsx)("option",{value:Rr.f5.ANY,children:d.x.I18n.t("anyOf")}),(0,m.jsx)("option",{value:Rr.f5.NONE,children:d.x.I18n.t("noneOf")})]},"select")}),(0,m.jsx)(In.Grid.CenteredRow,{children:(0,m.jsx)(Ar.ReactSelect,{dimension:"small",isFullWidth:!0,isMulti:!0,placeholder:d.x.I18n.t("searchForms"),options:o,value:o.filter((e=>{if(!n.form_ids)return;const t=e.value;return-1!==n.form_ids.indexOf(t)})),onChange:e=>{i({form_ids:e.map((e=>e.value))},t)}})})]})},[Rr.jx.SUBSCRIBER_LAST_ENGAGEMENT_DATE]:no,[Rr.jx.SUBSCRIBER_LAST_PURCHASE_DATE]:no,[Rr.jx.SUBSCRIBER_LAST_OPEN_DATE]:no,[Rr.jx.SUBSCRIBER_LAST_CLICK_DATE]:no,[Rr.jx.SUBSCRIBER_LAST_PAGE_VIEW_DATE]:no,[Rr.jx.SUBSCRIBER_LAST_SENDING_DATE]:no},Co={[Rr.Bt.Automations]:function(e){return!!Object.values(Lr.Z).some((t=>t===e.action))&&(e.action!==Lr.Z.ENTERED_AUTOMATION||function(e){return(e.operator===Rr.f5.ANY||e.operator===Rr.f5.NONE||e.operator===Rr.f5.ALL)&&Array.isArray(e.automation_ids)&&e.automation_ids.length>0}(e))},[Rr.Bt.Email]:function(e){return!!Object.values(Rr.zd).some((t=>t===e.action))&&(e.action===Rr.zd.CLICKED_ANY||(e.action===Rr.zd.CLICKED?!!e.newsletter_id:e.action!==Rr.zd.OPENS_ABSOLUTE_COUNT&&e.action!==Rr.zd.MACHINE_OPENS_ABSOLUTE_COUNT?Array.isArray(e.newsletters)&&e.newsletters.length>0:$r(e)&&!!e.opens&&!!e.operator))},[Rr.Bt.WooCommerce]:function(e){return!!Object.values(ao.wq).some((t=>t===e.action))&&(e.action===ao.wq.PURCHASED_CATEGORY?function(e){return!(void 0===e.category_ids||0===e.category_ids.length||!e.operator)}(e):e.action===ao.wq.PURCHASED_PRODUCT?function(e){return!(void 0===e.product_ids||0===e.product_ids.length||!e.operator)}(e):e.action===ao.wq.CUSTOMER_IN_COUNTRY?function(e){return!(void 0===e.country_code||0===e.country_code.length)}(e):e.action===ao.wq.NUMBER_OF_ORDERS?function(e){return!(!e.number_of_orders_count||!$r(e)||!e.number_of_orders_type)}(e):e.action===ao.wq.TOTAL_SPENT?function(e){return!(!e.total_spent_amount||!$r(e)||!e.total_spent_type)}(e):e.action===ao.wq.SINGLE_ORDER_VALUE?function(e){return!(!e.single_order_value_amount||!$r(e)||!e.single_order_value_type)}(e):e.action===ao.wq.AVERAGE_SPENT?function(e){return!(!e.average_spent_amount||!e.average_spent_type||!$r(e))}(e):e.action===ao.wq.USED_PAYMENT_METHOD?function(e){return!(!e.payment_methods||e.payment_methods.length<1||!e.operator||!$r(e))}(e):e.action===ao.wq.USED_SHIPPING_METHOD?function(e){return!(!e.shipping_methods||e.shipping_methods.length<1||!e.operator||!$r(e))}(e):e.action===ao.wq.PURCHASE_DATE?Jr(e):e.action===ao.wq.NUMBER_OF_REVIEWS?function(e){return!!(e.count&&e.count_type&&e.rating&&$r(e))}(e):e.action===ao.wq.USED_COUPON_CODE?function(e){return!(!e.coupon_code_ids||e.coupon_code_ids.length<1||!Wr(e.operator,Rr.f5)||!$r(e))}(e):![ao.wq.CUSTOMER_IN_POSTAL_CODE,ao.wq.CUSTOMER_IN_CITY].includes(e.action)||so(e))},[Rr.Bt.WordPressRole]:function(e){return e.action&&e.action!==Rr.jx.WORDPRESS_ROLE?e.action===Rr.jx.MAILPOET_CUSTOM_FIELD?function(e){const t=jo[e.custom_field_type];return!!t&&t(e)}(e):e.action===Rr.jx.SUBSCRIBER_SCORE?function(e){if(e.operator===co.HIGHER_THAN||e.operator===co.LOWER_THAN||e.operator===co.EQUALS||e.operator===co.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===co.UNKNOWN||e.operator===co.NOT_UNKNOWN}(e):e.action===Rr.jx.SUBSCRIBED_TO_LIST?function(e){return(e.operator===Rr.f5.ANY||e.operator===Rr.f5.ALL||e.operator===Rr.f5.NONE)&&Array.isArray(e.segments)&&e.segments.length>0}(e):e.action===Rr.jx.SUBSCRIBER_TAG?function(e){return Pt.Hooks.applyFilters("mailpoet_dynamic_segments_filter_subscriber_tag_validate",!1,e)}(e):[Rr.jx.SUBSCRIBER_FIRST_NAME,Rr.jx.SUBSCRIBER_LAST_NAME,Rr.jx.SUBSCRIBER_EMAIL].includes(e.action)?so(e):[Rr.jx.SUBSCRIBER_LAST_ENGAGEMENT_DATE,Rr.jx.SUBSCRIBER_LAST_PURCHASE_DATE,Rr.jx.SUBSCRIBER_LAST_OPEN_DATE,Rr.jx.SUBSCRIBER_LAST_CLICK_DATE,Rr.jx.SUBSCRIBER_LAST_PAGE_VIEW_DATE,Rr.jx.SUBSCRIBER_LAST_SENDING_DATE].includes(e.action)?Jr(e):e.action===Rr.jx.SUBSCRIBED_VIA_FORM?function(e){return(e.operator===Rr.f5.ANY||e.operator===Rr.f5.NONE)&&Array.isArray(e.form_ids)&&e.form_ids.length>0}(e):!(!e.operator||!e.value)&&!!Object.values(Zr).includes(e.operator)&&Jr(e):Array.isArray(e.wordpressRole)&&e.wordpressRole.length>0},[Rr.Bt.WooCommerceMembership]:function(e){const t=!e.plan_ids||!e.plan_ids.length||!e.operator;return e.action!==ao.hs.MEMBER_OF||!t},[Rr.Bt.WooCommerceSubscription]:function(e){const t=!e.product_ids||!e.product_ids.length||!e.operator;return e.action!==ao.ht.ACTIVE_SUBSCRIPTIONS||!t}};function Io(e){return!(e.length<1)&&0===e.map((e=>void 0!==Co[e.segmentType]&&Co[e.segmentType](e))).filter((e=>!1===e)).length}let To,Eo;function Do(){const e=(0,k.Z)((e=>e(Pr.t).getSegment()),[]),t=(0,k.Z)((e=>e(Pr.t).getSubscriberCount()),[]),{updateSubscriberCount:n}=(0,he.Z)(Pr.t),a=JSON.stringify(e),i=(0,r.useRef)(1),s=(0,r.useRef)(null),o=(0,r.useRef)(!1),l=(0,r.useRef)((0,Sn.debounce)((function e(t){if(o.current)return void(s.current=t);s.current=null,i.current+=1;const a=i.current;o.current=!0,function(e){const t={filters:e.filters,filters_connect:e.filters_connect};return kn().isEqual(t,To)?Promise.resolve(Eo):(To={filters:[...e.filters],filters_connect:e.filters_connect},d.x.Ajax.post({api_version:d.x.apiVersion,endpoint:"dynamic_segments",action:"getCount",data:e,timeout:2e4}).then((e=>{const{data:t}=e;return Eo={count:t.count,errors:void 0},Eo})))}(t).then((t=>{if(o.current=!1,s.current)return void e(s.current);if(a!==i.current)return;const r={loading:!1};t&&(r.count=t.count,r.errors=t.errors),n(r)}),(e=>{o.current=!1;const t={},a=e.errors.map((e=>e.message));t.loading=!1,t.count=void 0,t.errors=a,n(t)}))}),2e3,{trailing:!0}));return(0,r.useEffect)((()=>{Io(e.filters)?(n({loading:!0,count:void 0,errors:void 0}),(0,l.current)(e)):n({count:void 0,loading:!1})}),[e,a,n]),t.errors?(0,m.jsx)("div",{className:"mailpoet-form-field",children:(0,m.jsxs)("span",{className:"mailpoet-form-error-message",children:[d.x.I18n.t("dynamicSegmentSizeCalculatingTimeout")," ",(0,m.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:d.x.I18n.t("learnMore")})]})}):t.loading||void 0!==t.count?t.loading?(0,m.jsx)("div",{className:"mailpoet-form-field",children:(0,m.jsx)("span",{className:"mailpoet-form-notice-message",children:d.x.I18n.t("dynamicSegmentSizeIsCalculated")})}):(0,m.jsx)("div",{className:"mailpoet-form-field",children:(0,m.jsx)("span",{className:"mailpoet-form-notice-message",children:d.x.I18n.t("dynamicSegmentSize").replace("%1$d",t.count.toLocaleString())})}):(0,m.jsx)("span",{})}const Oo={[Rr.Bt.Automations]:function(e){let{filterIndex:t}=e;const n=(0,k.Z)((e=>e(Pr.t).getSegmentFilter(t)),[t]),a=Fr[n.action];return(0,m.jsx)(a,{filterIndex:t})},[Rr.Bt.Email]:function(e){let{filterIndex:t}=e;const n=(0,k.Z)((e=>e(Pr.t).getSegmentFilter(t)),[t]),a=Yr[n.action];return a?(0,m.jsx)(a,{filterIndex:t}):null},[Rr.Bt.WooCommerce]:function(e){let{filterIndex:t}=e;const n=(0,k.Z)((e=>e(Pr.t).getSegmentFilter(t)),[t]),a=oo[n.action];return(0,m.jsx)(a,{filterIndex:t})},[Rr.Bt.WordPressRole]:function(e){let{filterIndex:t}=e;const n=(0,k.Z)((e=>e(Pr.t).getSegmentFilter(t)),[t]);let a;return a=n.action?No[n.action]:lo,a?(0,m.jsx)(a,{filterIndex:t}):null},[Rr.Bt.WooCommerceMembership]:function(e){let{filterIndex:t}=e;const n=(0,k.Z)((e=>e(Pr.t).getSegmentFilter(t)),[t]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:i}=(0,he.Z)(Pr.t),s=(0,k.Z)((e=>e(Pr.t).getMembershipPlans()),[]).map((e=>({value:e.id,label:e.name})));return(0,r.useEffect)((()=>{n.action===ao.hs.MEMBER_OF&&n.operator!==Rr.f5.ANY&&n.operator!==Rr.f5.ALL&&n.operator!==Rr.f5.NONE&&a({operator:Rr.f5.ANY},t)}),[a,n,t]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(In.Grid.CenteredRow,{children:(0,m.jsxs)(lt.Select,{value:n.operator,onChange:e=>i("operator",t,e),automationId:"select-operator",children:[(0,m.jsx)("option",{value:Rr.f5.ANY,children:d.x.I18n.t("anyOf")}),(0,m.jsx)("option",{value:Rr.f5.ALL,children:d.x.I18n.t("allOf")}),(0,m.jsx)("option",{value:Rr.f5.NONE,children:d.x.I18n.t("noneOf")})]},"select-operator")}),(0,m.jsx)(In.Grid.CenteredRow,{children:(0,m.jsx)(Ar.ReactSelect,{isMulti:!0,dimension:"small",isFullWidth:!0,placeholder:d.x.I18n.t("selectWooMembership"),options:s,value:(0,Ba.filter)((e=>!!n.plan_ids&&-1!==n.plan_ids.indexOf(e.value)),s),onChange:e=>{a({plan_ids:(e||[]).map((e=>e.value))},t)},automationId:"select-segment-plans"},"select-segment-membership-plan")})]})},[Rr.Bt.WooCommerceSubscription]:function(e){let{filterIndex:t}=e;const n=(0,k.Z)((e=>e(Pr.t).getSegmentFilter(t)),[t]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:i}=(0,he.Z)(Pr.t),s=(0,k.Z)((e=>e(Pr.t).getSubscriptionProducts()),[]).map((e=>({value:e.id,label:e.name})));return(0,r.useEffect)((()=>{n.action===ao.ht.ACTIVE_SUBSCRIPTIONS&&n.operator!==Rr.f5.ANY&&n.operator!==Rr.f5.ALL&&n.operator!==Rr.f5.NONE&&a({operator:Rr.f5.ANY},t)}),[a,n,t]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(In.Grid.CenteredRow,{children:(0,m.jsxs)(lt.Select,{value:n.operator,onChange:e=>i("operator",t,e),automationId:"select-operator",children:[(0,m.jsx)("option",{value:Rr.f5.ANY,children:d.x.I18n.t("anyOf")}),(0,m.jsx)("option",{value:Rr.f5.ALL,children:d.x.I18n.t("allOf")}),(0,m.jsx)("option",{value:Rr.f5.NONE,children:d.x.I18n.t("noneOf")})]},"select-operator")}),(0,m.jsx)(In.Grid.CenteredRow,{children:(0,m.jsx)(Ar.ReactSelect,{isMulti:!0,dimension:"small",isFullWidth:!0,placeholder:d.x.I18n.t("selectWooSubscription"),options:s,value:(0,Ba.filter)((e=>!!n.product_ids&&-1!==n.product_ids.indexOf(e.value)),s),onChange:e=>{a({product_ids:(e||[]).map((e=>e.value))},t)},automationId:"select-segment-products"},"select-segment-category")})]})}};function Ao(e){let{filterIndex:t}=e;const n=(0,k.Z)((e=>e(Pr.t).getSegmentFilter(t)),[t]);if(void 0===n||void 0===Oo[n.segmentType])return null;const a=Oo[n.segmentType];return(0,m.jsx)(a,{filterIndex:t})}function Ro(){const e=(0,k.Z)((e=>e(Pr.t).getSegment()),[]),t=[Rr.zd.OPENED,Rr.zd.OPENS_ABSOLUTE_COUNT,Rr.zd.MACHINE_OPENED,Rr.zd.MACHINE_OPENS_ABSOLUTE_COUNT];let n=!1;return e.filters.forEach((e=>{t.includes(e.action)&&(n=!0)})),n?(0,m.jsx)("div",{className:"mailpoet-form-field",children:(0,m.jsx)("span",{className:"mailpoet-form-notice-message",children:d.x.I18n.t("privacyProtectionNotice")})}):(0,m.jsx)("span",{})}const Po=Pt.Hooks.applyFilters("mailpoet_dynamic_segments_form_filters_before",(()=>null)),Lo=Pt.Hooks.applyFilters("mailpoet_dynamic_filters_filter_before",(()=>null)),Mo=Pt.Hooks.applyFilters("mailpoet_dynamic_filters_filter_after",(()=>(0,m.jsx)("div",{className:"mailpoet-gap"})));function Fo(e){let{segmentId:t}=e;const n=(0,k.Z)((e=>e(Pr.t).getSegment()),[]),a=(0,k.Z)((e=>e(Pr.t).getAvailableFilters()),[]),i=(0,k.Z)((e=>e(Pr.t).findFiltersValueForSegment(n)),[n]),s=(0,k.Z)((e=>e(Pr.t).getSubscriberCount()),[]),o=(0,k.Z)((e=>e(Pr.t).getErrors()),[]),{updateSegment:l,updateSegmentFilter:c,handleSave:p}=(0,he.Z)(Pr.t),[u,h]=(0,r.useState)(!1),f=Pt.Hooks.applyFilters("mailpoet_dynamic_segments_form_add_condition_action",(()=>{h(!0)}));return(0,m.jsxs)("form",{className:"mailpoet_form",children:[o.length>0&&(0,m.jsx)(Qt,{errors:o.map((e=>({message:e})))}),(0,m.jsxs)("div",{className:"mailpoet-form-grid",children:[(0,m.jsxs)("div",{className:"mailpoet-form-field-name form-field-row-name mailpoet-segments-name-section",children:[(0,m.jsx)(_t.X,{level:4,children:(0,m.jsx)("label",{htmlFor:"field_name",children:d.x.I18n.t("name")})}),(0,m.jsx)("div",{className:"mailpoet-form-field",children:(0,m.jsx)(at.I,{isFullWidth:!0,type:"text",name:"name",id:"field_name",defaultValue:n.name,"data-automation-id":"input-name",onChange:e=>{l({name:e.target.value})}})})]}),(0,m.jsxs)("div",{className:"mailpoet-form-field-description form-field-row-description mailpoet-segments-description-section",children:[(0,m.jsx)(_t.X,{level:4,children:(0,m.jsx)("label",{htmlFor:"field_description",children:d.x.I18n.t("description")})}),(0,m.jsx)("p",{className:"mailpoet-form-description",children:d.x.I18n.t("segmentDescriptionTip")}),(0,m.jsx)("div",{className:"mailpoet-form-field",children:(0,m.jsx)(st.g,{isFullWidth:!0,name:"description",id:"field_description",value:n.description,"data-automation-id":"input-description",onChange:e=>{l({description:e.target.value})}})})]}),(0,m.jsxs)("div",{className:"mailpoet-segments-segments-section",children:[(0,m.jsx)(_t.X,{level:4,children:(0,m.jsx)("label",{htmlFor:"field_filters",children:d.x.I18n.t("formPageTitle")})}),(0,m.jsx)(Po,{}),Array.isArray(i)&&i.map(((e,t)=>(0,m.jsxs)(r.Fragment,{children:[(0,m.jsxs)(In.Grid.ThreeColumns,{className:"mailpoet-segments-grid",automationId:`filter-row-${t}`,children:[(0,m.jsx)(Lo,{filterRows:i,index:t}),(0,m.jsx)(In.Grid.CenteredRow,{children:(0,m.jsx)(Ar.ReactSelect,{dimension:"small",placeholder:d.x.I18n.t("selectActionPlaceholder"),options:a,value:e.filterValue,onChange:e=>{c({segmentType:e.group,action:e.value},t)},automationId:"select-segment-action",isFullWidth:!0})}),void 0!==e.index&&(0,m.jsx)(Ao,{filterIndex:e.index})]}),(0,m.jsx)(Mo,{index:t})]},e.index))),(0,m.jsx)(Le.z,{type:"button",variant:"tertiary",iconStart:qe.R,onClick:e=>{e.preventDefault(),f(n,l)},children:d.x.I18n.t("addCondition")})]}),u&&(0,m.jsx)("div",{className:"mailpoet-grid-span-two-columns",children:(0,m.jsx)(ko,{})}),(0,m.jsxs)("div",{className:"mailpoet-segments-counter-section",children:[(0,m.jsx)(Do,{}),(0,m.jsx)(Ro,{})]}),(0,m.jsx)("div",{className:"mailpoet-form-actions",children:(0,m.jsx)(Le.z,{type:"submit",onClick:e=>{e.preventDefault(),p(t)},isDisabled:!Io(n.filters)||void 0===s.count,children:d.x.I18n.t("save")})})]})]})}function Bo(){const e=(0,Ce.$B)();(0,Pr.M)();const{pageLoaded:t}=(0,he.Z)(Pr.t);return(0,r.useEffect)((()=>{t(e.params.id)}),[e.params.id,t]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(et.A,{color:"#fff"}),(0,m.jsx)(St.B,{}),(0,m.jsxs)(_t.X,{level:1,className:"mailpoet-title",children:[(0,m.jsx)("span",{children:d.x.I18n.t("formPageTitle")}),(0,m.jsx)(Ne.Link,{className:"mailpoet-button button button-secondary button-small",to:"/segments",children:d.x.I18n.t("backToList")})]}),(0,m.jsx)(Fo,{segmentId:Number(e.params.id)})]})}Bo.displayName="SegmentEditor";const qo=[{name:"name",label:d.x.I18n.t("nameColumn"),sortable:!0},{name:"description",label:d.x.I18n.t("description"),sortable:!1},{name:"count",label:d.x.I18n.t("subscribersCountColumn"),sortable:!1},{name:"subscribed",label:d.x.I18n.t("subscribed"),sortable:!1},{name:"updated_at",label:d.x.I18n.t("updatedAtColumn"),sortable:!0}],Wo={onLoadingItems:()=>d.x.I18n.t("loadingDynamicSegmentItems"),onNoItemsFound:()=>d.x.I18n.t("noDynamicSegmentItemsFound"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?d.x.I18n.t("oneDynamicSegmentTrashed"):d.x.I18n.t("multipleDynamicSegmentsTrashed").replace("%1$d",t.toLocaleString()),d.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?d.x.I18n.t("oneDynamicSegmentDeleted"):d.x.I18n.t("multipleDynamicSegmentsDeleted").replace("%1$d",t.toLocaleString()),d.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?d.x.I18n.t("oneDynamicSegmentRestored"):d.x.I18n.t("multipleDynamicSegmentsRestored").replace("%1$d",t.toLocaleString()),d.x.Notice.success(n)}},Vo=[{name:"edit",className:"mailpoet-hide-on-mobile",link:e=>(0,m.jsx)(Ne.Link,{to:`/edit-segment/${e.id}`,children:d.x.I18n.t("edit")}),display:e=>!e.is_plugin_missing},{name:"duplicate_segment",className:"mailpoet-hide-on-mobile",label:d.x.I18n.t("duplicate"),onClick:(e,t)=>d.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"dynamic_segments",action:"duplicate",data:{id:e.id}}).done((e=>{d.x.Notice.success(d.x.I18n.t("segmentDuplicated").replace("%1$s",(0,fr.escapeHTML)(e.data.name)),{scroll:!0}),t()})).fail((e=>{d.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},{name:"edit_disabled",className:"mailpoet-hide-on-mobile mailpoet-disabled",link:e=>(0,m.jsx)(Ne.Link,{to:`/edit-segment/${e.id}`,children:d.x.I18n.t("edit")}),display:e=>e.is_plugin_missing},{name:"view_subscribers",link:e=>(0,m.jsx)("a",{href:e.subscribers_url,children:d.x.I18n.t("viewSubscribers")})},{name:"trash",className:"mailpoet-hide-on-mobile"}],$o=[{name:"trash",label:d.x.I18n.t("moveToTrash"),onSuccess:Wo.onTrash}];function Uo(e,t){return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("td",{className:"column-primary","data-colname":d.x.I18n.t("nameColumn"),children:[(0,m.jsx)("span",{className:"mailpoet-listing-title",children:e.name}),t]}),(0,m.jsx)("td",{"data-colname":d.x.I18n.t("description"),children:(0,m.jsx)("abbr",{children:e.description})}),e.is_plugin_missing?(0,m.jsx)("td",{colSpan:2,className:"column mailpoet-hide-on-mobile","data-colname":d.x.I18n.t("missingPluginMessageColumn"),children:e.missing_plugin_message&&e.missing_plugin_message.message&&e.missing_plugin_message.link?x()(e.missing_plugin_message.message,/\[link](.*?)\[\/link]/g,(t=>(0,m.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.message}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":d.x.I18n.t("subscribersCountColumn"),children:parseInt(e.count_all,10).toLocaleString()}),(0,m.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":d.x.I18n.t("subscribed"),children:parseInt(e.count_subscribed,10).toLocaleString()})]}),(0,m.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":d.x.I18n.t("updatedAtColumn"),children:[d.x.Date.short(e.created_at),(0,m.jsx)("br",{}),d.x.Date.time(e.created_at)]})]})}const Yo=(0,Ce.EN)((function(e){return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(gr,{segmentType:"dynamic"}),(0,m.jsx)(Oe.N,{limit:window.mailpoet_listing_per_page,location:e.location,params:e.match.params,search:!0,onRenderItem:Uo,endpoint:"dynamic_segments",base_url:"segments",columns:qo,messages:Wo,sort_by:"created_at",sort_order:"desc",item_actions:Vo,bulk_actions:$o}),(0,m.jsxs)("p",{className:"mailpoet_sending_methods_help help",children:[(0,m.jsxs)("b",{children:[d.x.I18n.t("segmentsTip"),":"]})," ",d.x.I18n.t("segmentsTipText")," ",(0,m.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:d.x.I18n.t("segmentsTipLink")})]})]})})),Ho=document.getElementById("dynamic_segments_container");function zo(){return(0,m.jsx)(l.k.Provider,{value:(0,l.S)(window),children:(0,m.jsxs)(Ne.HashRouter,{children:[(0,m.jsx)(p.w,{}),(0,m.jsxs)(Ce.rs,{children:[(0,m.jsx)(Ce.AW,{path:"/new-segment",component:(0,o.withBoundary)(Bo)}),(0,m.jsx)(Ce.AW,{path:"/edit-segment/:id",component:(0,o.withBoundary)(Bo)}),(0,m.jsx)(Ce.AW,{path:"*",component:(0,o.withBoundary)(Yo)})]})]})})}Ho&&((0,o.registerTranslations)(),s.render((0,m.jsx)(zo,{}),Ho));const Zo=()=>{d.x.trackEvent("Forms > Add New"),setTimeout((()=>{window.location=window.mailpoet_form_template_selection_url}),200)};function Ko(){const[e,t]=(0,r.useState)(!1);return(0,m.jsx)(c.Q,{children:(0,m.jsx)(Le.z,{onClick:()=>{t(!0),Zo()},withSpinner:e,automationId:"create_new_form",variant:"secondary",iconStart:qe.R,children:d.x.I18n.t("new")})})}Ko.displayName="FormsHeading";const Go=[{name:"name",label:d.x.I18n.t("formName"),sortable:!0},{name:"segments",label:d.x.I18n.t("segments")},{name:"type",label:d.x.I18n.t("type")},{name:"status",label:d.x.I18n.t("status")},{name:"updated_at",label:d.x.I18n.t("updatedAt"),sortable:!0}],Qo={onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?d.x.I18n.t("oneFormTrashed"):d.x.I18n.t("multipleFormsTrashed").replace("%1$d",t.toLocaleString()),d.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?d.x.I18n.t("oneFormDeleted"):d.x.I18n.t("multipleFormsDeleted").replace("%1$d",t.toLocaleString()),d.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?d.x.I18n.t("oneFormRestored"):d.x.I18n.t("multipleFormsRestored").replace("%1$d",t.toLocaleString()),d.x.Notice.success(n)},onNoItemsFound:()=>(0,m.jsxs)("div",{className:"mailpoet-forms-add-new-row",children:[(0,m.jsx)("p",{children:d.x.I18n.t("noItemsFound")}),(0,m.jsx)(o.Button,{onClick:Zo,automationId:"add_new_form",iconStart:qe.R,children:d.x.I18n.t("new")})]})},Xo=[{name:"trash",label:d.x.I18n.t("moveToTrash"),onSuccess:Qo.onTrash}],Jo=[{name:"edit",className:"mailpoet-hide-on-mobile",label:d.x.I18n.t("edit"),link:function(e){return(0,m.jsx)("a",{href:`admin.php?page=mailpoet-form-editor&id=${e.id}`,children:d.x.I18n.t("edit")})}},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:d.x.I18n.t("duplicate"),onClick:function(e,t){return d.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:d.x.I18n.t("noName");d.x.Notice.success(d.x.I18n.t("formDuplicated").replace("%1$s",(0,fr.escapeHTML)(n))),t()})).fail((e=>{e.errors.length>0&&d.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}},{name:"trash",className:"mailpoet-hide-on-mobile"}];class el extends r.Component{updateStatus=(e,t)=>{t.persist(),d.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&&d.x.Notice.success(d.x.I18n.t("formActivated"))})).fail((n=>{d.x.Notice.showApiErrorNotice(n),t.target.checked=!e}))};isItemInactive=e=>"disabled"===e.status;renderStatus(e){return(0,m.jsxs)("div",{children:[(0,m.jsx)(Gn.Z,{onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"enabled"===e.status}),(0,m.jsxs)("p",{children:[d.x.I18n.t("signups"),": ",e.signups.toLocaleString()]})]})}renderItem=(e,t)=>{var n;null===e.settings&&d.x.Notice.error(d.x.I18n.t("formSettingsCorrupted").replace("%1$s",(0,fr.escapeHTML)(e.name)).replace("[link]",`<a class="mailpoet-link" href="admin.php?page=mailpoet-form-editor&id=${parseInt(e.id,10)}">`).replace("[/link]","</a>"));const a=ee()("manage-column","column-primary","has-row-actions"),i=window.mailpoet_segments.filter((t=>-1!==Te().inArray(t.id,e.segments))),s=function(e){var t,n,a,i,s,r,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(d.x.I18n.t("placeFixedBarFormOnPages")),"1"===(null==e||null===(a=e.form_placement)||void 0===a||null===(i=a.below_posts)||void 0===i?void 0:i.enabled)&&c.push(d.x.I18n.t("placeFormBellowPages")),"1"===(null==e||null===(s=e.form_placement)||void 0===s||null===(r=s.popup)||void 0===r?void 0:r.enabled)&&c.push(d.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(d.x.I18n.t("placeSlideInFormOnPages")),c.length>0?c.join(", "):d.x.I18n.t("placeFormOthers")}(e.settings);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("td",{className:a,children:[(0,m.jsx)("a",{className:"mailpoet-listing-title",href:`admin.php?page=mailpoet-form-editor&id=${e.id}`,children:e.name?e.name:`(${d.x.I18n.t("noName")})`}),t]}),(0,m.jsx)("td",{className:"column","data-colname":d.x.I18n.t("segments"),children:(0,m.jsx)(vi.Eg,{segments:i,dimension:"large",children:"user"===(null===(n=e.settings)||void 0===n?void 0:n.segments_selected_by)&&(0,m.jsx)("span",{className:"mailpoet-tags-prefix",children:d.x.I18n.t("userChoice")})})}),(0,m.jsx)("td",{className:"column","data-colname":d.x.I18n.t("type"),children:s}),(0,m.jsx)("td",{className:"column","data-colname":d.x.I18n.t("status"),children:this.renderStatus(e)}),(0,m.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":d.x.I18n.t("updatedAt"),children:[d.x.Date.short(e.updated_at),(0,m.jsx)("br",{}),d.x.Date.time(e.updated_at)]})]})};render(){return(0,m.jsxs)("div",{className:"mailpoet-listing-no-actions-on-mobile",children:[(0,m.jsx)(Ko,{}),(0,m.jsx)(Oe.N,{limit:window.mailpoet_listing_per_page,className:"mailpoet-forms-listing",location:this.props.location,params:this.props.match.params,messages:Qo,search:!1,endpoint:"forms",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:Go,bulk_actions:Xo,item_actions:Jo})]})}}el.propTypes={location:De().object.isRequired,match:De().shape({params:De().object}).isRequired},el.displayName="FormList";const tl=ks(el);function nl(){return(0,m.jsx)(l.k.Provider,{value:(0,l.S)(window),children:(0,m.jsxs)(Ne.HashRouter,{children:[(0,m.jsx)(p.w,{}),(0,m.jsx)(Ce.AW,{path:"*",render:(0,o.withBoundary)(tl)})]})})}const al=document.getElementById("forms_container");function il(){return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("p",{children:d.x.I18n.t("knowledgeBaseIntro")}),(0,m.jsxs)("ul",{className:"mailpoet-text-links",children:[(0,m.jsx)("li",{children:(0,m.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/116-common-problems",children:"Common Problems"})}),(0,m.jsx)("li",{children:(0,m.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/165-newsletters",children:"Newsletters"})}),(0,m.jsx)("li",{children:(0,m.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/156-migration-questions",children:"Migration Questions"})}),(0,m.jsx)("li",{children:(0,m.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/149-sending-methods",children:"Sending Methods"})}),(0,m.jsx)("li",{children:(0,m.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/139-subscription-forms",children:"Subscription Forms"})}),(0,m.jsx)("li",{children:(0,m.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/114-getting-started",children:"Getting Started"})}),(0,m.jsx)("li",{children:(0,m.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/123-newsletter-designer",children:"Newsletter Designer"})}),(0,m.jsx)("li",{children:(0,m.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/121-subscribers-and-lists",children:"Subscribers and Lists"})})]}),(0,m.jsx)(Le.z,{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/",children:d.x.I18n.t("knowledgeBaseButton")})]})}function sl(e){e.target.select()}function rl(e,t){if(ot.ZP.isObject(e)){const n=Object.keys(e).map((t=>`${t}: ${e[t]}`));return(0,m.jsx)("textarea",{readOnly:!0,id:t,onFocus:sl,value:n.join("\n"),style:{width:"100%",height:"400px"}})}return(0,m.jsx)("p",{children:d.x.I18n.t("systemInfoDataError")})}function ol(){const[e,t]=(0,r.useState)(null),n="mailpoet-system-info",a=window.systemInfoData;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("div",{className:"mailpoet_notice notice inline",children:(0,m.jsx)("p",{children:d.x.I18n.t("systemInfoIntro")})}),rl(a,n),(0,m.jsx)(o.Button,{variant:"secondary",onClick:()=>{!async function(e,t){const n=document.querySelector(`#${e}`);if(n){if(navigator.clipboard){const e=n.value;return await navigator.clipboard.writeText(e),void t(!0)}n.focus(),n.select(),document.execCommand("copy")?t(!0):t(!1)}else t(!1)}(n,t)},children:d.x.I18n.t("copyToClipboard")}),!0===e&&(0,m.jsx)(u.q,{type:"info",children:(0,m.jsx)("p",{children:d.x.I18n.t("copyToClipboardSuccess")})}),!1===e&&(0,m.jsx)(u.q,{type:"warning",children:(0,m.jsx)("p",{children:d.x.I18n.t("copyToClipboardFailure")})})]})}function ll(e){return(0,m.jsx)("table",{className:"widefat fixed",style:{maxWidth:e.max_width},children:(0,m.jsx)("tbody",{children:e.rows.map((e=>(0,m.jsxs)("tr",{children:[(0,m.jsx)("td",{className:"row-title",children:e.key}),(0,m.jsx)("td",{children:e.value})]},`row_${e.key}`)))})})}function cl(e){return(0,m.jsx)("span",{children:!0===e.children&&e.truthy||!1===e.children&&e.falsy||e.unknown})}function dl(e){const t=e.status_data,n={active:d.x.I18n.t("running"),inactive:d.x.I18n.t("cronWaiting")},a=Array.isArray(t.last_error)?(0,m.jsx)(m.Fragment,{children:t.last_error.map((e=>(0,m.jsxs)("div",{children:[e.worker,": ",(0,m.jsx)("i",{children:e.message})]},e.worker)))}):t.last_error;return(0,m.jsxs)("div",{children:[(0,m.jsx)("h4",{children:d.x.I18n.t("systemStatusCronStatusTitle")}),(0,m.jsx)(ll,{max_width:"400px",rows:[{key:d.x.I18n.t("accessible"),value:(0,m.jsx)(cl,{children:t.accessible})},{key:d.x.I18n.t("status"),value:n[t.status]?n[t.status]:d.x.I18n.t("unknown")},{key:d.x.I18n.t("lastUpdated"),value:t.updated_at?d.x.Date.full(1e3*t.updated_at):d.x.I18n.t("unknown")},{key:d.x.I18n.t("lastRunStarted"),value:t.run_accessed_at?d.x.Date.full(1e3*t.run_started_at):d.x.I18n.t("unknown")},{key:d.x.I18n.t("lastRunCompleted"),value:t.run_completed_at?d.x.Date.full(1e3*t.run_completed_at):d.x.I18n.t("unknown")},{key:d.x.I18n.t("lastSeenError"),value:a||d.x.I18n.t("none")},{key:d.x.I18n.t("lastSeenErrorDate"),value:t.last_error_date?d.x.Date.full(1e3*t.last_error_date):d.x.I18n.t("unknown")}]})]})}function pl(e){let t=e.task.scheduled_at;t&&(t=(0,yi.default)(t,"yyyy-MM-dd HH:mm:ss",new Date));const n=(0,yi.default)(e.task.updated_at,"yyyy-MM-dd HH:mm:ss",new Date);return(0,m.jsxs)("tr",{children:[(0,m.jsx)("td",{className:"column column-primary",children:e.task.id}),(0,m.jsx)("td",{className:"column",children:e.task.type}),(0,m.jsx)("td",{className:"column",children:e.task.newsletter?(0,m.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||d.x.I18n.t("preview")}):d.x.I18n.t("none")}),(0,m.jsx)("td",{className:"column",children:e.task.priority}),e.show_scheduled_at?(0,m.jsx)("td",{className:"column-date",children:(0,m.jsx)("abbr",{children:`${d.x.Date.short(t)} ${d.x.Date.time(t)}`})}):null,(0,m.jsx)("td",{className:"column-date",children:(0,m.jsx)("abbr",{children:`${d.x.Date.short(n)} ${d.x.Date.time(n)}`})})]})}function ul(e){return(0,m.jsxs)("tr",{children:[(0,m.jsx)("th",{className:"row-title",children:"Id"}),(0,m.jsx)("th",{className:"row-title",children:d.x.I18n.t("type")}),(0,m.jsx)("th",{className:"row-title",children:d.x.I18n.t("email")}),(0,m.jsx)("th",{className:"row-title",children:d.x.I18n.t("priority")}),e.show_scheduled_at?(0,m.jsx)("th",{className:"row-title",children:d.x.I18n.t("scheduledAt")}):null,(0,m.jsx)("th",{className:"row-title",children:d.x.I18n.t("updatedAt")})]})}function ml(e){const t=e.show_scheduled_at?6:5;return(0,m.jsxs)("table",{className:"widefat fixed striped",children:[(0,m.jsx)("thead",{children:(0,m.jsx)(ul,{show_scheduled_at:e.show_scheduled_at})}),(0,m.jsx)("tbody",{children:e.tasks.length?e.tasks.map((t=>(0,m.jsx)(pl,{task:t,show_scheduled_at:e.show_scheduled_at},t.id))):(0,m.jsx)("tr",{className:"mailpoet-listing-no-items",children:(0,m.jsx)("td",{colSpan:t,children:d.x.I18n.t("nothingToShow")})})}),(0,m.jsx)("tfoot",{children:(0,m.jsx)(ul,{show_scheduled_at:e.show_scheduled_at})})]})}function hl(e){const t=e.status_data;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("h4",{children:d.x.I18n.t("systemStatusQueueTitle")}),(0,m.jsx)(ll,{max_width:"400px",rows:[{key:d.x.I18n.t("status"),value:"paused"===t.status?d.x.I18n.t("paused"):d.x.I18n.t("running")},{key:d.x.I18n.t("startedAt"),value:t.started?d.x.Date.full(1e3*t.started):d.x.I18n.t("unknown")},{key:d.x.I18n.t("sentEmails"),value:t.sent||0},{key:d.x.I18n.t("retryAttempt"),value:t.retry_attempt||d.x.I18n.t("none")},{key:d.x.I18n.t("retryAt"),value:t.retry_at?d.x.Date.full(1e3*t.retry_at):d.x.I18n.t("none")},{key:d.x.I18n.t("error"),value:t.error?t.error.error_message:d.x.I18n.t("none")},{key:d.x.I18n.t("totalCompletedTasks"),value:t.tasksStatusCounts.completed},{key:d.x.I18n.t("totalRunningTasks"),value:t.tasksStatusCounts.running},{key:d.x.I18n.t("totalPausedTasks"),value:t.tasksStatusCounts.paused},{key:d.x.I18n.t("totalScheduledTasks"),value:t.tasksStatusCounts.scheduled}]}),(0,m.jsx)("h5",{children:d.x.I18n.t("scheduledTasks")}),(0,m.jsx)(ml,{show_scheduled_at:!0,tasks:t.latestTasks.filter((e=>"scheduled"===e.status))}),(0,m.jsx)("h5",{children:d.x.I18n.t("runningTasks")}),(0,m.jsx)(ml,{tasks:t.latestTasks.filter((e=>null===e.status))}),(0,m.jsx)("h5",{children:d.x.I18n.t("completedTasks")}),(0,m.jsx)(ml,{tasks:t.latestTasks.filter((e=>"completed"===e.status))})]})}function fl(e){let{version:t,storage:n,latestTrigger:a,latestCompletedTrigger:i,latestCompletedRun:s}=e;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("h4",{children:d.x.I18n.t("actionSchedulerStatus")}),(0,m.jsx)(ll,{max_width:"400px",rows:[{key:d.x.I18n.t("version"),value:t},{key:d.x.I18n.t("storage"),value:n},{key:d.x.I18n.t("latestActionSchedulerTrigger"),value:d.x.Date.full(Je().utc(a).local())},{key:d.x.I18n.t("latestActionSchedulerCompletedTrigger"),value:d.x.Date.full(Je().utc(i).local())},{key:d.x.I18n.t("latestActionSchedulerCompletedRun"),value:d.x.Date.full(Je().utc(s).local())}]})]})}function gl(e,t,n,a,i,s){const r=e?"success":"error";let o=e?t:n;return a&&(o=x()(o,/\[link\](.*?)\[\/link\]/g,(e=>(0,m.jsx)("a",{className:"mailpoet-text-link",href:a,"data-beacon-article":i,children:e},"kb-link")))),(0,m.jsxs)("div",{className:`mailpoet_notice notice inline notice-${r}`,children:[(0,m.jsx)("p",{children:o}),s?(0,m.jsx)("p",{children:(0,m.jsx)("i",{children:s})}):null]})}function xl(e){const t=e.cron.isReachable,n=e.cron.url,a=`${d.x.I18n.t("systemStatusConnectionUnsuccessful")} ${d.x.I18n.t("systemStatusCronConnectionUnsuccessfulInfo")}`,i=d.x.I18n.t("systemStatusConnectionSuccessful"),s=t?null:e.cron.pingResponse;return(0,m.jsxs)("div",{children:[(0,m.jsx)("h4",{children:d.x.I18n.t("systemStatusCronTitle")}),(0,m.jsx)("p",{children:(0,m.jsx)("a",{className:"mailpoet-text-link",href:n,target:"_blank",rel:"noopener noreferrer",children:n})}),gl(t,i,a,"https://kb.mailpoet.com/article/231-sending-does-not-work","5a0257ac2c7d3a272c0d7ad6",s)]})}function _l(e){const t=e.mss.enabled?`${d.x.I18n.t("systemStatusConnectionUnsuccessful")} ${d.x.I18n.t("systemStatusMSSConnectionUnsuccessfulInfo")}`:d.x.I18n.t("systemStatusMSSConnectionCanNotConnect"),n=e.mss.enabled?d.x.I18n.t("systemStatusConnectionSuccessful"):d.x.I18n.t("systemStatusMSSConnectionCanConnect");return(0,m.jsxs)("div",{children:[(0,m.jsx)("h4",{children:d.x.I18n.t("systemStatusMSSTitle")}),gl(e.mss.isReachable,n,t,"https://kb.mailpoet.com/article/319-known-errors-when-validating-a-mailpoet-key","5ef1da9d2c7d3a10cba966c5",null)]})}function bl(){const e=window.systemStatusData,t=window.actionSchedulerData;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("div",{className:"mailpoet_notice notice inline",children:(0,m.jsx)("p",{children:e.mss.enabled?d.x.I18n.t("systemStatusIntroCronMSS"):d.x.I18n.t("systemStatusIntroCron")})}),xl(e),_l(e),(0,m.jsx)(dl,{status_data:e.cronStatus}),(0,m.jsx)(fl,{...t}),t?(0,m.jsx)(hl,{status_data:e.queueStatus}):null]})}function vl(){return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("p",{children:d.x.I18n.t("yourPrivacyContent1")}),(0,m.jsx)("p",{children:d.x.I18n.t("yourPrivacyContent2")}),(0,m.jsx)("p",{children:d.x.I18n.t("yourPrivacyContent3")}),(0,m.jsx)(Le.z,{target:"_blank",rel:"noreferrer noopener",href:"https://www.mailpoet.com/privacy-notice/",children:d.x.I18n.t("yourPrivacyButton")})]})}function yl(){return(0,m.jsxs)(l.k.Provider,{value:(0,l.S)(window),children:[(0,m.jsx)(c.D,{}),(0,m.jsx)(p.w,{}),(0,m.jsxs)(bs.t,{activeKey:"knowledgeBase",children:[(0,m.jsx)(o.Tab,{title:d.x.I18n.t("tabKnowledgeBaseTitle"),children:(0,m.jsx)(il,{})},"knowledgeBase"),(0,m.jsx)(o.Tab,{title:d.x.I18n.t("tabSystemStatusTitle"),children:(0,m.jsx)(bl,{})},"systemStatus"),(0,m.jsx)(o.Tab,{title:d.x.I18n.t("tabSystemInfoTitle"),children:(0,m.jsx)(ol,{})},"systemInfo"),(0,m.jsx)(o.Tab,{title:d.x.I18n.t("tabYourPrivacyTitle"),children:(0,m.jsx)(vl,{})},"yourPrivacy")]})]})}al&&((0,o.registerTranslations)(),s.render((0,m.jsx)(nl,{}),al)),ll.propTypes={max_width:De().string,rows:De().arrayOf(De().shape({key:De().string.isRequired,value:De().oneOfType([De().string,De().number,De().element]).isRequired})).isRequired},ll.defaultProps={max_width:"auto"},cl.propTypes={truthy:De().string,falsy:De().string,unknown:De().string,children:De().bool},cl.defaultProps={truthy:(0,Pe.__)("Yes","mailpoet"),falsy:(0,Pe.__)("No","mailpoet"),unknown:(0,Pe.__)("Unknown","mailpoet"),children:null},dl.propTypes={status_data:De().shape({accessible:De().bool,last_error_date:De().string,status:De().string,updated_at:De().number,run_accessed_at:De().number,run_completed_at:De().number,run_started_at:De().number,last_error:De().oneOfType([De().string,De().array])}).isRequired},pl.propTypes={show_scheduled_at:De().bool,task:De().shape({id:De().number.isRequired,type:De().string.isRequired,priority:De().number.isRequired,updated_at:De().string.isRequired,scheduled_at:De().string,status:De().string,newsletter:De().shape({newsletter_id:De().number.isRequired,queue_id:De().number.isRequired,preview_url:De().string.isRequired,subject:De().string})}).isRequired},pl.defaultProps={show_scheduled_at:!1},ul.propTypes={show_scheduled_at:De().bool},ul.defaultProps={show_scheduled_at:!1},ml.propTypes={show_scheduled_at:De().bool,tasks:De().arrayOf(pl.propTypes.task).isRequired},ml.defaultProps={show_scheduled_at:!1},hl.propTypes={status_data:De().shape({status:De().string,started:De().number,sent:De().number,retry_attempt:De().number,retry_at:De().number,error:De().shape({operation:De().string,error_message:De().string}),tasksStatusCounts:De().shape({completed:De().number.isRequired,running:De().number.isRequired,paused:De().number.isRequired,scheduled:De().number.isRequired}).isRequired,latestTasks:De().arrayOf(pl.propTypes.task).isRequired}).isRequired};const wl=document.getElementById("help_container");function jl(e){let{children:t,location:{pathname:n}}=e;return(0,r.useEffect)((()=>{window.scrollTo(0,0)}),[n]),t||null}wl&&((0,o.registerTranslations)(),s.render((0,m.jsx)(yl,{}),wl)),jl.propTypes={location:De().shape({pathname:De().string.isRequired}).isRequired,children:De().node.isRequired},jl.displayName="ScrollToTopComponent";const Sl=(0,Ce.EN)((0,Rn.lV)(jl));function kl(e){let{activeMethod:t,onMethodChange:n}=e;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("div",{className:"mailpoet-settings-label",children:[(0,m.jsx)("span",{className:"mailpoet_import_heading",children:d.x.I18n.t("methodSelectionHead")}),(0,m.jsx)("div",{className:"mailpoet-settings-inputs-row",children:(0,m.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,m.jsx)(Ot.V,{dimension:"large",variant:"excellent",isInverted:!0,children:d.x.I18n.t("seeVideo")})})})]}),(0,m.jsxs)("div",{className:"mailpoet-settings-inputs",children:[(0,m.jsxs)("div",{className:"mailpoet-settings-inputs-row",children:[(0,m.jsx)(dt.Y,{name:"select_method",automationId:"import-paste-method",id:"import-paste-method",checked:"paste-method"===t,value:"paste-method",onCheck:n}),(0,m.jsx)("label",{htmlFor:"import-paste-method",children:d.x.I18n.t("methodPaste")})]}),(0,m.jsxs)("div",{className:"mailpoet-settings-inputs-row",children:[(0,m.jsx)(dt.Y,{name:"select_method",automationId:"import-csv-method",id:"import-csv-method",checked:"file-method"===t,value:"file-method",onCheck:n}),(0,m.jsx)("label",{htmlFor:"import-csv-method",children:d.x.I18n.t("methodUpload")})]}),(0,m.jsxs)("div",{className:"mailpoet-settings-inputs-row",children:[(0,m.jsx)(dt.Y,{name:"select_method",automationId:"import-mailchimp-method",id:"import-mailchimp-method",checked:"mailchimp-method"===t,value:"mailchimp-method",onCheck:n}),(0,m.jsx)("label",{htmlFor:"import-mailchimp-method",children:d.x.I18n.t("methodMailChimp")})]})]})]})}function Nl(e){let{hidePrevious:t,isLastStep:n,canGoNext:a,onPreviousAction:i,onNextAction:s}=e;return(0,m.jsxs)("div",{className:"mailpoet-settings-save",children:[!t&&(0,m.jsx)(Le.z,{type:"button",variant:"secondary",onClick:i,children:d.x.I18n.t("previousStep")}),(0,m.jsx)(Le.z,{type:"button",automationId:"import-next-step",isDisabled:!a,onClick:()=>{a&&s()},children:d.x.I18n.t(n?"import":"nextStep")})]})}kl.propTypes={activeMethod:De().string,onMethodChange:De().func.isRequired},kl.defaultProps={activeMethod:void 0},kl.displayName="SelectImportMethod",Nl.propTypes={canGoNext:De().bool,hidePrevious:De().bool,isLastStep:De().bool,onPreviousAction:De().func,onNextAction:De().func},Nl.defaultProps={hidePrevious:!1,isLastStep:!1,canGoNext:!0,onPreviousAction:()=>{},onNextAction:()=>{}},Nl.displayName="PreviousNextStepButtons";const Cl="https://kb.mailpoet.com/article/126-importing-subscribers-with-csv-files",Il="Email, First Name, Last Name\[email protected], John, Doe\[email protected], Mary, Smith\[email protected], Johnny, Walker";function Tl(e){let{onValueChange:t,canFinish:n,onFinish:a,data:i,onPrevious:s}=e;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("div",{className:"mailpoet-settings-label",children:[(0,m.jsx)("label",{htmlFor:"paste_input",children:d.x.I18n.t("pasteLabel")}),(0,m.jsx)("p",{className:"description",children:x()(d.x.I18n.t("pasteDescription"),/\[link\](.*?)\[\/link\]/,(e=>(0,m.jsx)("a",{className:"mailpoet-link",href:`${Cl}`,"data-beacon-article":"57ce079f903360649f6e56fc",target:"_blank",rel:"noopener noreferrer",children:e},"kb-link")))})]}),(0,m.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,m.jsx)(st.g,{id:"paste_input",rows:"15",placeholder:Il,isCode:!0,onChange:e=>{t(e.target.value)},defaultValue:i})}),(0,m.jsx)(Nl,{canGoNext:n,onPreviousAction:s,onNextAction:a})]})}Tl.propTypes={onFinish:De().func,onPrevious:De().func,canFinish:De().bool.isRequired,onValueChange:De().func.isRequired,data:De().string},Tl.defaultProps={onFinish:()=>{},onPrevious:()=>{},data:""},Tl.displayName="MethodPaste";const El="https://kb.mailpoet.com/article/126-importing-subscribers-with-csv-files";function Dl(e){let{onValueChange:t,canFinish:n,onFinish:a,onPrevious:i}=e;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("div",{className:"mailpoet-settings-label",children:[(0,m.jsx)("label",{htmlFor:"file_local",children:d.x.I18n.t("methodUpload")}),(0,m.jsx)("p",{className:"description",children:x()(d.x.I18n.t("pasteDescription"),/\[link\](.*?)\[\/link\]/,(e=>(0,m.jsx)("a",{className:"mailpoet-link",href:`${El}`,"data-beacon-article":"57ce079f903360649f6e56fc",target:"_blank",rel:"noopener noreferrer",children:e},"kb-link")))})]}),(0,m.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,m.jsx)(at.I,{type:"file",id:"file_local",accept:".csv","data-automation-id":"import-file-upload-input",onChange:e=>{const n=e.target.value.match(/[^.]+$/);d.x.Notice.hide(),null===n||"csv"!==n[0].toLowerCase()?(d.x.Notice.error(d.x.I18n.t("wrongFileFormat")),t("")):t(e.target.files[0])}})}),(0,m.jsx)(Nl,{canGoNext:n,onPreviousAction:i,onNextAction:a})]})}function Ol(e){let{onFinish:t,onPrevious:n}=e;const[a,i]=(0,r.useState)(""),[s,o]=(0,r.useState)(void 0),[l,c]=(0,r.useState)([]);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("div",{className:"mailpoet-settings-label",children:(0,m.jsxs)("label",{htmlFor:"mailpoet_mailchimp_key_input",children:[(0,m.jsx)("span",{className:"mailpoet_import_heading",children:d.x.I18n.t("methodMailChimpLabel")}),(0,m.jsx)("p",{className:"description",children:x()(d.x.I18n.t("methodMailChimpDescription"),/\[link\](.*?)\[\/link\]/,(e=>(0,m.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,m.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,m.jsxs)("div",{className:"mailpoet-settings-inputs-row mailpoet-settings-inputs-row-centered",children:[(0,m.jsx)(at.I,{dimension:"small",id:"mailpoet_mailchimp_key_input",type:"text",onChange:e=>{i(e.target.value),""===e.target.value.trim()&&o(void 0)}}),(0,m.jsx)("span",{className:"mailpoet-gap"}),(0,m.jsx)(Le.z,{type:"button",dimension:"small",onClick:()=>{d.x.Modal.loading(!0),d.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"importExport",action:"getMailChimpLists",data:{api_key:a}}).always((()=>{d.x.Modal.loading(!1)})).done((e=>o(e.data))).fail((e=>{e.errors.length>0&&d.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},children:d.x.I18n.t("methodMailChimpVerify")}),(0,m.jsx)("span",{className:"mailpoet-gap"}),(0,m.jsx)("span",{children:Array.isArray(s)&&0===s.length?d.x.I18n.t("noMailChimpLists"):null})]})}),s?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("div",{className:"mailpoet-settings-label",children:d.x.I18n.t("methodMailChimpSelectList")}),(0,m.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,m.jsx)(Re.Y,{field:{id:"segments",name:"list-selection",multiple:!0,placeholder:d.x.I18n.t("methodMailChimpSelectPlaceholder"),forceSelect2:!0,values:s},onValueChange:e=>c(e.target.value)})})]}):null,(0,m.jsx)(Nl,{canGoNext:Array.isArray(l)&&l.length>0,onPreviousAction:n,onNextAction:()=>{d.x.Modal.loading(!0),d.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"importExport",action:"getMailChimpSubscribers",data:{api_key:a,lists:l}}).always((()=>{d.x.Modal.loading(!1)})).done((e=>t(e.data))).fail((e=>{e.errors.length>0&&d.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}})]})}Dl.propTypes={canFinish:De().bool.isRequired,onFinish:De().func,onPrevious:De().func,onValueChange:De().func.isRequired},Dl.defaultProps={onFinish:()=>{},onPrevious:()=>{}},Dl.displayName="MethodUpload",Ol.propTypes={onFinish:De().func,onPrevious:De().func},Ol.defaultProps={onFinish:()=>{},onPrevious:()=>{}},Ol.displayName="MethodMailChimp";var Al=n(71906),Rl=n.n(Al);const Pl=e=>window.roleBasedEmails.findIndex((t=>e.startsWith(`${t}@`)))>=0,Ll=e=>{let t,n=ot.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)&&!Pl(n)&&n};function Ml(e){let{history:t,setStepMethodSelectionData:n,subscribersLimitForValidation:a}=e;const[i,s]=(0,r.useState)(void 0),[l,c]=(0,r.useState)(""),[p,u]=(0,r.useState)(void 0),h=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,a,i))},f=()=>{t.push("/step_clean_list")},g=()=>{((e,t)=>{const n=encodeURI(e).split(/%..|./).length-1;d.x.Notice.hide(),n>window.maxPostSizeBytes?d.x.Notice.error(d.x.I18n.t("maxPostSizeNotice")):(d.x.Modal.loading(!0),Rl().parse(e,function(e){return{skipEmptyLines:!0,error(){d.x.Notice.hide(),d.x.Notice.error(d.x.I18n.t("dataProcessingError"))},complete(t){const n=function(e){let t=[];const n=[],a=[],i=[],s=[];let r,o,l,c,d=null,p=null,u=!1;return Object.keys(e).forEach((m=>{l=e[m].map((e=>e.trim())),c=l.length,null===p&&(p=c),c===p&&(null===d?(Object.keys(l).forEach((e=>{o=Ll(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)&&(u=!0,t[0]=l)):""!==l[d]&&(r=Ll(l[d]),ot.ZP.has(n,r)?a.push(r):Pl(l[d])?s.push(l[d]):window.mailpoet_email_regex.test(r)?(n[r]=!0,l[d]=r,t[r]=l):i.push(l[d])))})),t=ot.ZP.values(t),t&&(u&&t.length>=2||!u&&t.length>=1)?{header:window.mailpoet_email_regex.test(t[0][d])?null:t.shift(),subscribers:t,subscribersCount:t.length,duplicate:ot.ZP.uniq(a),invalid:ot.ZP.uniq(i),role:ot.ZP.uniq(s)}:null}(t.data);if(n)e(n);else{let e=d.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>"),d.x.Notice.error(e)}d.x.Modal.loading(!1)}}}((e=>{d.x.trackEvent("Subscribers import started",{source:"file-method"===i?"file upload":"pasted data"}),h(e)}))))})("paste-method"===i?l:p)};return(0,m.jsxs)("div",{className:"mailpoet-settings-grid",children:[(0,m.jsx)(o.ErrorBoundary,{children:(0,m.jsx)(kl,{activeMethod:i,onMethodChange:s})}),"paste-method"===i&&(0,m.jsx)(o.ErrorBoundary,{children:(0,m.jsx)(Tl,{onPrevious:f,onValueChange:c,onFinish:g,canFinish:!!l.trim(),data:l})}),"file-method"===i&&(0,m.jsx)(o.ErrorBoundary,{children:(0,m.jsx)(Dl,{onPrevious:f,onValueChange:u,onFinish:g,canFinish:!!p,data:p})}),"mailchimp-method"===i&&(0,m.jsx)(o.ErrorBoundary,{children:(0,m.jsx)(Ol,{onPrevious:f,onFinish:e=>{d.x.trackEvent("Subscribers import started",{source:"MailChimp"}),h(e)}})}),void 0===i&&(0,m.jsx)(o.ErrorBoundary,{children:(0,m.jsx)(Nl,{canGoNext:!1,onPreviousAction:f})})]})}Ml.propTypes={history:De().shape({push:De().func.isRequired}).isRequired,setStepMethodSelectionData:De().func.isRequired,subscribersLimitForValidation:De().number.isRequired},Ml.diplayName="StepMethodSelection";const Fl=(0,Ce.EN)(Ml);function Bl(e){let{onProceed:t}=e;return(0,m.jsxs)("div",{className:"mailpoet-clean-list-step-container",children:[(0,m.jsx)("p",{children:d.x.I18n.t("cleanListText1")}),(0,m.jsx)("p",{children:d.x.I18n.t("cleanListText2")}),(0,m.jsxs)("p",{children:[t&&(0,m.jsx)(Le.z,{onClick:t,variant:"tertiary",children:d.x.I18n.t("listCleaningGotIt")}),(0,m.jsx)(Le.z,{target:"_blank",href:"https://kb.mailpoet.com/article/287-list-cleaning-services",children:d.x.I18n.t("tryListCleaning")})]})]})}function ql(e){let{onSubmit:t,history:n}=e;const[a,i]=(0,r.useState)(void 0);return(0,m.jsxs)("div",{className:"mailpoet-settings-grid",children:[(0,m.jsx)("div",{className:"mailpoet-settings-label",children:d.x.I18n.t("validationStepHeading")}),(0,m.jsxs)("div",{className:"mailpoet-settings-inputs",children:[(0,m.jsxs)("div",{className:"mailpoet-settings-inputs-row",children:[(0,m.jsx)(dt.Y,{automationId:"mailpoet_import_validation_step_option1",id:"existing-list",checked:"existing-list"===a,value:"existing-list",onCheck:i}),(0,m.jsx)("label",{htmlFor:"existing-list",children:d.x.I18n.t("validationStepRadio1")})]}),(0,m.jsxs)("div",{className:"mailpoet-settings-inputs-row",children:[(0,m.jsx)(dt.Y,{automationId:"mailpoet_import_validation_step_option2",id:"address-book",checked:"address-book"===a,value:"address-book",onCheck:i}),(0,m.jsx)("label",{htmlFor:"address-book",children:d.x.I18n.t("validationStepRadio2")})]})]}),(0,m.jsx)(Nl,{canGoNext:void 0!==a,onPreviousAction:()=>n.push("step_method_selection"),onNextAction:()=>t(a)})]})}function Wl(){return(0,m.jsxs)("div",{className:"mailpoet-clean-list-step-container","data-automation-id":"import_wrong_source_block",children:[(0,m.jsx)("p",{children:d.x.I18n.t("validationStepBlock1")}),(0,m.jsx)("p",{children:d.x.I18n.t("validationStepBlock2")}),(0,m.jsx)("p",{children:(0,m.jsx)(Le.z,{href:"https://kb.mailpoet.com/article/269-reconfirm-subscribers-to-your-list",target:"_blank",rel:"noopener noreferrer",children:d.x.I18n.t("validationStepBlockButton")})})]})}function Vl(e){let{onSubmit:t}=e;const[n,a]=(0,r.useState)("over2years"),i=(0,r.useCallback)((e=>{a(e.target.value)}),[a]),s=(0,r.useCallback)((()=>{t("over2years"===n||"1to2years"===n?"notRecently":"recently")}),[t,n]);return(0,m.jsxs)("div",{className:"mailpoet-settings-grid",children:[(0,m.jsx)("div",{className:"mailpoet-settings-label",children:d.x.I18n.t("validationStepLastSentHeading")}),(0,m.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,m.jsxs)(lt.Select,{defaultValue:n,onChange:i,automationId:"last_sent_to_list",children:[(0,m.jsx)("option",{value:"over2years",children:d.x.I18n.t("validationStepLastSentOption1")}),(0,m.jsx)("option",{value:"1to2years",children:d.x.I18n.t("validationStepLastSentOption2")}),(0,m.jsx)("option",{value:"less1year",children:d.x.I18n.t("validationStepLastSentOption3")}),(0,m.jsx)("option",{value:"less3months",children:d.x.I18n.t("validationStepLastSentOption4")})]})}),(0,m.jsx)("div",{className:"mailpoet-settings-save",children:(0,m.jsx)(Le.z,{type:"button",automationId:"last_sent_to_list_next",onClick:s,children:d.x.I18n.t("validationStepLastSentNext")})})]})}function $l(e){let{stepMethodSelectionData:t,history:n}=e;const[a,i]=(0,r.useState)(void 0),[s,l]=(0,r.useState)(void 0);(0,r.useEffect)((()=>{void 0===t&&n.replace("step_method_selection")}),[t,n]);const c=(0,r.useCallback)((e=>{l(e),"recently"===e&&n.push("step_data_manipulation")}),[n,l]);return(0,m.jsxs)(m.Fragment,{children:[void 0===a&&(0,m.jsx)(o.ErrorBoundary,{children:(0,m.jsx)(ql,{onSubmit:i,history:n})}),"address-book"===a&&(0,m.jsx)(Wl,{}),"existing-list"===a&&void 0===s&&(0,m.jsx)(o.ErrorBoundary,{children:(0,m.jsx)(Vl,{onSubmit:c})}),"existing-list"===a&&"notRecently"===s&&(0,m.jsx)(o.ErrorBoundary,{children:(0,m.jsx)(Bl,{})})]})}Bl.displayName="CleanList",ql.propTypes={history:De().shape({push:De().func.isRequired}).isRequired,onSubmit:De().func.isRequired},ql.displayName="InitialQuestion",Vl.propTypes={onSubmit:De().func.isRequired},Vl.displayName="LastSentQuestion",$l.propTypes={history:De().shape({push:De().func.isRequired,replace:De().func.isRequired}).isRequired,stepMethodSelectionData:De().shape({duplicate:De().arrayOf(De().string),header:De().arrayOf(De().string),invalid:De().arrayOf(De().string),role:De().arrayOf(De().string),subscribersCount:De().number,subscribers:De().arrayOf(De().arrayOf(De().string))})},$l.defaultProps={stepMethodSelectionData:void 0};const Ul=(0,Ce.EN)($l);function Yl(e){let{translation:t,subscribers:n}=e,a="";return n.length&&(a=x()(t.replace("%2$s",n.join(", ")),"%1$s",(()=>(0,m.jsx)("strong",{children:n.length.toLocaleString()},t))),a=(0,m.jsx)("p",{children:a})),a}function Hl(e){let{stepMethodSelectionData:t}=e;const{invalid:n,duplicate:a,role:i}=t,[s,o]=(0,r.useState)(!1),l=ee()("mailpoet_subscribers_data_parse_results_details",{mailpoet_hidden:!s}),c=(0,m.jsx)(Yl,{translation:d.x.I18n.t("importNoticeInvalid"),subscribers:n}),p=(0,m.jsx)(Yl,{translation:d.x.I18n.t("importNoticeDuplicate"),subscribers:a});let u="";if(i.length&&(u=x()(d.x.I18n.t("importNoticeRoleBased"),/(%1\$s|\[link\].*\[\/link\]|%2\$s)/,(e=>"%1$s"===e?(0,m.jsx)("strong",{children:i.length.toLocaleString()},"role-length"):"%2$s"===e?i.join(", "):(0,m.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,m.jsx)("p",{children:u})),n.length||a.length||i.length){const e=n.length+a.length+i.length;return(0,m.jsxs)("div",{className:"error",children:[(0,m.jsxs)("p",{children:[x()(d.x.I18n.t("importNoticeSkipped"),"%1$s",(()=>(0,m.jsx)("strong",{children:e.toLocaleString()},"lengths")))," ",(0,m.jsx)("a",{className:"mailpoet_subscribers_data_parse_results_details_show","data-automation-id":"show-more-details",onClick:()=>o(!s),role:"button",tabIndex:0,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),o(!s))},children:d.x.I18n.t("showMoreDetails")})]}),(0,m.jsxs)("div",{className:l,children:[(0,m.jsx)("hr",{}),c,p,u]})]})}return null}Yl.propTypes={translation:De().string.isRequired,subscribers:De().arrayOf(De().string).isRequired},Hl.propTypes={stepMethodSelectionData:De().shape({duplicate:De().arrayOf(De().string),invalid:De().arrayOf(De().string),role:De().arrayOf(De().string)})},Hl.defaultProps={stepMethodSelectionData:{invalid:[],duplicate:[],role:[]}};const zl=()=>{const e={data:window.mailpoetColumnsSelect2,width:"15em"};Te()("select.mailpoet_subscribers_column_data_match").select2(e).on("select2:selecting",(t=>{const n=t.currentTarget,a=t.params.args.data.id;"create"===a?(t.preventDefault(),Te()(n).select2("close"),d.x.Modal.popup({title:d.x.I18n.t("addNewField"),template:Te()("#form_template_field_form").html()}),Te()("#form_field_new").parsley().on("form:submit",(()=>{const t=Te()("#form_field_new").mailpoetSerializeObject();return d.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"customFields",action:"save",data:t}).done((t=>{const a={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:d.x.I18n.t("userColumns"),children:[]}),window.mailpoetColumnsSelect2[2].children.push(a),window.mailpoetColumns.push(a),Te()("select.mailpoet_subscribers_column_data_match").each((()=>{Te()(n).html("").select2("destroy").select2(e)})),Te()(n).data("column-id",a.id),d.x.Modal.close()})).fail((e=>{e.errors.length>0&&d.x.Notice.error(e.errors.map((e=>e.message)),{positionAfter:"#field_name"})})),!1}))):Te()("select.mailpoet_subscribers_column_data_match").each((()=>{const e=n,i=Te()(e).val();i===a&&"ignore"!==i&&(confirm(`${d.x.I18n.t("selectedValueAlreadyMatched")} ${d.x.I18n.t("confirmCorrespondingColumn")}`)?Te()(e).data("column-id","ignore"):(t.preventDefault(),Te()(n).select2("close")))}))})).on("select2:select",(e=>{const t=e.currentTarget,n=e.params.data.id;Te()(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()})),Te().map(Te()(".mailpoet_subscribers_column_data_match"),(e=>{const t=Te()(e).data("column-id");Te()(e).val(t).trigger("change")}))},Zl=(e,t)=>{const n=[],a=[];let i,s,r,o;return Object.keys(e[0]).forEach((l=>{i=e[0][l],s="ignore",i%1!=0&&window.mailpoet_email_regex.test(i)?s="email":t&&(r=t[l],o=window.mailpoetColumns.map((e=>e.name)).indexOf(r),-1!==o?s=window.mailpoetColumns[o].id:r&&(/first|first name|given name/i.test(r)?s="first_name":/last|last name/i.test(r)&&(s="last_name"))),s="ignore"!==s&&-1===a.indexOf(s)?s:"ignore",n[l]={column_id:s},a.push(s)})),n},Kl=10;function Gl(e){let{header:t,subscribers:n}=e;const a=Zl(n,t);return(0,m.jsxs)("tr",{children:[(0,m.jsx)("th",{children:d.x.I18n.t("matchData")}),a.map(((e,t)=>(0,m.jsx)("th",{children:(0,m.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 Ql(e){let{header:t}=e;return(0,m.jsxs)("tr",{className:"mailpoet_header",children:[(0,m.jsx)("td",{}),t.map((e=>(0,m.jsx)("td",{children:e},e)))]})}function Xl(e){let{subscriber:t,index:n}=e;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("td",{children:n}),t.map(((e,t)=>(0,m.jsx)("td",{children:e},`${e}-${n}-${t}`)))]})}function Jl(e){let{subscribers:t,subscribersCount:n}=e;const a=". . .",i=Array(t[0].length).fill(a);return(0,m.jsxs)(m.Fragment,{children:[t.slice(0,Kl).map(((e,t)=>(0,m.jsx)("tr",{children:(0,m.jsx)(Xl,{subscriber:e,index:t+1})},`${e[0]}-${t}`))),n>Kl+1?(0,m.jsx)("tr",{children:(0,m.jsx)(Xl,{subscriber:i,index:a})},"filler"):null,n>Kl?(0,m.jsx)("tr",{children:(0,m.jsx)(Xl,{subscriber:t[n-1],index:n})},t[n-1][0]):null]})}function ec(e){let{subscribersCount:t,subscribers:n,header:a}=e;return(0,r.useLayoutEffect)((()=>{zl()})),(0,m.jsx)("div",{className:"subscribers_data",children:(0,m.jsxs)("table",{className:"mailpoet_subscribers widefat fixed",children:[(0,m.jsx)("thead",{children:(0,m.jsx)(Gl,{header:a,subscribers:n})}),(0,m.jsxs)("tbody",{children:[a?(0,m.jsx)(Ql,{header:a}):null,(0,m.jsx)(Jl,{subscribers:n,subscribersCount:t})]})]})})}Gl.propTypes={subscribers:De().arrayOf(De().arrayOf(De().oneOfType([De().string,De().number]))).isRequired,header:De().arrayOf(De().string)},Gl.defaultProps={header:[]},Ql.propTypes={header:De().arrayOf(De().string).isRequired},Xl.propTypes={subscriber:De().arrayOf(De().oneOfType([De().string,De().number])).isRequired,index:De().node.isRequired},Jl.propTypes={subscribersCount:De().number.isRequired,subscribers:De().arrayOf(De().arrayOf(De().oneOfType([De().string,De().number]))).isRequired},ec.propTypes={subscribersCount:De().number,subscribers:De().arrayOf(De().arrayOf(De().oneOfType([De().string,De().number]))),header:De().arrayOf(De().string)},ec.defaultProps={subscribersCount:0,subscribers:[],header:[]};const tc=e=>{d.x.Modal.popup({title:d.x.I18n.t("addNewList"),template:Te()("#new_segment_template").html()}),Te()("#new_segment_name").on("keypress",(e=>{13===e.which&&Te()("#new_segment_process").trigger("click")})),Te()("#new_segment_process").on("click",(()=>{const t=Te()("#new_segment_name").val().trim(),n=Te()("#new_segment_description").val().trim();d.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}),d.x.Modal.close()})).fail((e=>{e.errors.length>0&&(d.x.Notice.hide(),d.x.Notice.error(e.errors.map((e=>e.message)),{positionAfter:"#new_segment_name"}))}))})),Te()("#new_segment_cancel").on("click",(()=>{d.x.Modal.close()}))};function nc(e){let{setSelectedSegments:t}=e;const{segments:n}=(0,r.useContext)(l.k),{all:a,updateAll:i}=n,[s,o]=(0,r.useState)(a);(0,r.useLayoutEffect)((()=>{!function(e,n){const a=Te()("select#mailpoet_segments_select");if(a.data("select2"))return;const i=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};a.html(""),a.select2({data:e.map((e=>({...e,text:e.name}))),dropdownCssClass:"mailpoet-form-select2-dropdown",escapeMarkup:e=>e,templateResult:i,templateSelection:i}).on("change",(e=>{const n=Te()('[data-id="notice_segmentSelection"]');e.currentTarget.value?Te()('[data-id="notice_segmentSelection"]').remove():n.length||d.x.Notice.error(d.x.I18n.t("segmentSelectionRequired"),{static:!0,scroll:!0,id:"notice_segmentSelection",hideClose:!0});(e=>{t(e)})(ot.ZP.pluck(a.select2("data"),"id"))}))}(s)}),[s,t]);const c=e=>{!function(){const e=Te()("select#mailpoet_segments_select");e.data("select2")&&(e.select2("destroy"),e.find("option").remove(),e.off("select2:unselecting").off("change").off("select2:opening"))}(),t([]),o([...s,e]),i([...s,e])};return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("div",{className:"mailpoet-settings-label",children:(0,m.jsxs)("label",{htmlFor:"mailpoet_segments_select",children:[d.x.I18n.t("pickLists"),(0,m.jsx)("p",{className:"description",children:d.x.I18n.t("pickListsDescription")})]})}),(0,m.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,m.jsxs)("div",{className:"mailpoet-settings-inputs-row mailpoet-settings-inputs-row-centered",children:[(0,m.jsx)("div",{className:"mailpoet-form-select mailpoet-form-input",children:(0,m.jsx)("select",{id:"mailpoet_segments_select","data-placeholder":d.x.I18n.t("select"),multiple:"multiple",children:(0,m.jsx)("option",{})})}),(0,m.jsx)(Le.z,{variant:"tertiary",onClick:()=>tc(c),children:d.x.I18n.t("createANewList")})]})})]})}function ac(){return(0,m.jsx)("p",{className:"description",children:x()(d.x.I18n.t("consentSubscribed"),/\[link](.*?)\[\/link]/,(e=>(0,m.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 ic(e){let{newSubscribersStatus:t,setNewSubscribersStatus:n}=e;const a=(0,r.useCallback)((e=>{n(e.target.value)}),[n]);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("div",{className:"mailpoet-settings-label",children:[(0,m.jsx)("label",{htmlFor:"new_subscribers_status",children:d.x.I18n.t("newSubscribersStatus")}),(0,m.jsx)(ac,{})]}),(0,m.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,m.jsxs)(lt.Select,{id:"new_subscribers_status",placeholder:d.x.I18n.t("select"),name:"new_subscribers_status",onChange:a,defaultValue:t,children:[(0,m.jsx)("option",{value:"subscribed",children:d.x.I18n.t("subscribed")}),(0,m.jsx)("option",{value:"inactive",children:d.x.I18n.t("inactive")}),(0,m.jsx)("option",{value:"unsubscribed",children:d.x.I18n.t("unsubscribed")})]})})]})}function sc(e){let{existingSubscribersStatus:t,setExistingSubscribersStatus:n}=e;const a=(0,r.useCallback)((e=>{n(e.target.value)}),[n]);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("div",{className:"mailpoet-settings-label",children:[(0,m.jsx)("label",{htmlFor:"existing_subscribers_status",children:d.x.I18n.t("existingSubscribersStatus")}),(0,m.jsx)(ac,{})]}),(0,m.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,m.jsxs)(lt.Select,{id:"existing_subscribers_status",placeholder:d.x.I18n.t("select"),name:"existing_subscribers_status",onChange:a,defaultValue:t,children:[(0,m.jsx)("option",{value:"dont_update",children:d.x.I18n.t("dontUpdate")}),(0,m.jsx)("option",{value:"subscribed",children:d.x.I18n.t("subscribed")}),(0,m.jsx)("option",{value:"inactive",children:d.x.I18n.t("inactive")}),(0,m.jsx)("option",{value:"unsubscribed",children:d.x.I18n.t("unsubscribed")})]})})]})}function rc(e){let{updateExistingSubscribers:t,setUpdateExistingSubscribers:n}=e;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("div",{className:"mailpoet-settings-label",children:d.x.I18n.t("updateExistingSubscribers")}),(0,m.jsxs)("div",{className:"mailpoet-settings-inputs",children:[(0,m.jsx)(dt.Y,{id:"update_existing_subscribers",name:"update_existing_subscribers",value:"1",checked:t,onCheck:()=>n(!0)}),(0,m.jsx)("label",{htmlFor:"update_existing_subscribers",children:d.x.I18n.t("updateExistingSubscribersYes")}),(0,m.jsx)("span",{className:"mailpoet-gap"}),(0,m.jsx)(dt.Y,{id:"dont_update_existing_subscribers",name:"update_existing_subscribers",value:"",checked:!t,onCheck:()=>n(!1)}),(0,m.jsx)("label",{htmlFor:"dont_update_existing_subscribers",children:d.x.I18n.t("updateExistingSubscribersNo")})]})]})}nc.propTypes={setSelectedSegments:De().func.isRequired},rc.propTypes={setUpdateExistingSubscribers:De().func.isRequired,updateExistingSubscribers:De().bool.isRequired},n(49868);function oc(e){let{selectedTags:t,setSelectedTags:n}=e;const a=(0,r.useCallback)((e=>{let{value:t}=e;n(t)}),[n]),i=d.x.tags.map((e=>e.name));return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("div",{className:"mailpoet-settings-label",children:[d.x.I18n.t("assignTagsLabel"),(0,m.jsx)("p",{className:"description",children:d.x.I18n.t("assignTagsDescription")})]}),(0,m.jsx)("div",{className:"mailpoet-settings-inputs mailpoet-import-tags",children:(0,m.jsx)(bt.T,{name:"tags",onChange:a,suggestedValues:i,selectedValues:t,placeholder:d.x.I18n.t("addNewTag")})})]})}function lc(e){let{history:t,stepMethodSelectionData:n,subscribersLimitForValidation:a,setStepDataManipulationData:i}=e;const[s,o]=(0,r.useState)([]),[l,c]=(0,r.useState)(!0),[p,u]=(0,r.useState)("subscribed"),[h,f]=(0,r.useState)("dontUpdate"),[g,x]=(0,r.useState)([]);return(0,r.useEffect)((()=>{void 0===n&&t.replace("step_method_selection")}),[n,t]),void 0===n?null:(0,m.jsxs)("div",{"data-automation-id":"import_data_manipulation_step",children:[(0,m.jsx)(Hl,{stepMethodSelectionData:n}),(0,m.jsx)(ec,{subscribersCount:n.subscribersCount,subscribers:n.subscribers,header:n.header}),(0,m.jsxs)("div",{className:"mailpoet-settings-grid",children:[(0,m.jsx)(nc,{setSelectedSegments:o}),(0,m.jsx)(ic,{newSubscribersStatus:p,setNewSubscribersStatus:u}),(0,m.jsx)(sc,{existingSubscribersStatus:h,setExistingSubscribersStatus:f}),(0,m.jsx)(rc,{setUpdateExistingSubscribers:c,updateExistingSubscribers:l}),(0,m.jsx)(oc,{selectedTags:g,setSelectedTags:x}),(0,m.jsx)(Nl,{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,a)),onNextAction:()=>{((e,t,n,a,i,s,r)=>{const o={},l=new(Te().AsyncQueue);let c=0;const p=Date.now()/1e3,u={created:0,updated:0,errors:[],segments:[],tags:[]};d.x.Modal.progress(!0);const m=e.reduce(((e,t,n)=>(n%2e3==0&&e.push([]),e[e.length-1].push(t),e)),[]);ot.ZP.each(Te()("select.mailpoet_subscribers_column_data_match"),((e,t)=>{const n=Te()(e).data("column-id");"ignore"!==n&&(o[n]={index:t})})),ot.ZP.each(m,(()=>{l.add((r=>{r.pause(),d.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"ImportExport",action:"processImport",data:JSON.stringify({columns:o,subscribers:m[c],timestamp:p,segments:t,newSubscribersStatus:n,existingSubscribersStatus:a,updateSubscribers:i,tags:s})}).done((t=>{const n=t.data.added_to_segment_with_welcome_notification;var a,i;u.created+=t.data.created,u.updated+=t.data.updated,u.segments=t.data.segments,u.added_to_segment_with_welcome_notification=n,d.x.Modal.setProgress((a=u,i=e,Math.floor((a.created+a.updated)/i.length*100))),r.run()})).fail((e=>{d.x.Modal.progress(!1),e.errors.length>0&&d.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})})),c+=1}))})),l.run(),l.onComplete((()=>{d.x.Modal.progress(!1),u.errors.length>0&&!u.updated&&!u.created?d.x.Notice.error(ot.ZP.flatten(u.errors)):(u.segments=ot.ZP.map(ot.ZP.filter(u.segments,(e=>t.includes(e.id))),(e=>e.name)),r(u))}))})(n.subscribers,s,p,h,l,g,(e=>{i(e),t.push("step_results")}))},isLastStep:!0})]})]})}lc.propTypes={history:De().shape({push:De().func.isRequired,replace:De().func.isRequired}).isRequired,stepMethodSelectionData:De().shape({duplicate:De().arrayOf(De().string),header:De().arrayOf(De().string),invalid:De().arrayOf(De().string),role:De().arrayOf(De().string),subscribersCount:De().number,subscribers:De().arrayOf(De().arrayOf(De().oneOfType([De().string,De().number])))}),subscribersLimitForValidation:De().number.isRequired,setStepDataManipulationData:De().func.isRequired},lc.defaultProps={stepMethodSelectionData:void 0};const cc=(0,Ce.EN)(lc);function dc(e){let{subscribersCount:t,segments:n,initialMessage:a}=e;if(t){let e=x()(a,"%1$s",(()=>(0,m.jsx)("strong",{children:t.toLocaleString()},"%1$s")));return e=x()(e,"%2$s",(()=>`"${n.join('", "')}"`)),(0,m.jsx)("p",{children:e})}return null}function pc(e){let{createdSubscribers:t,updatedSubscribers:n}=e;return t||n?null:(0,m.jsx)("p",{children:d.x.I18n.t("importNoAction")})}function uc(e){let{createdSubscribers:t,updatedSubscribers:n}=e;return t||n?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("p",{children:(0,m.jsx)("b",{children:d.x.I18n.t("congratulationResult")})}),(0,m.jsx)("p",{children:x()(d.x.I18n.t("suppressionListReminder"),/\[link](.*?)\[\/link]/,(e=>(0,m.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 mc(e){let{addedToSegmentWithWelcomeNotification:t}=e;return t?(0,m.jsx)("p",{children:d.x.I18n.t("importNoWelcomeEmail")}):null}function hc(e){let{errors:t,createdSubscribers:n,updatedSubscribers:a,segments:i,addedToSegmentWithWelcomeNotification:s,history:l}=e;return(0,r.useEffect)((()=>{void 0===i&&0===t.length&&void 0===n&&void 0===a&&l.replace("step_method_selection")}),[i,n,t.length,l,a]),t.length&&d.x.Notice.error(ot.ZP.flatten(t)),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(o.ErrorBoundary,{children:(0,m.jsxs)("div",{className:"updated",children:[(0,m.jsx)(dc,{subscribersCount:n,segments:i,initialMessage:d.x.I18n.t("subscribersCreated")}),(0,m.jsx)(dc,{subscribersCount:a,segments:i,initialMessage:d.x.I18n.t("subscribersUpdated")}),(0,m.jsx)(pc,{createdSubscribers:n,updatedSubscribers:a}),(0,m.jsx)(mc,{addedToSegmentWithWelcomeNotification:s})]})}),(0,m.jsx)(o.ErrorBoundary,{children:(0,m.jsx)(uc,{createdSubscribers:n,updatedSubscribers:a})}),(0,m.jsx)("div",{className:"mailpoet-settings-grid",children:(0,m.jsxs)("div",{className:"mailpoet-settings-save",children:[(0,m.jsx)(Le.z,{variant:"secondary",type:"button",onClick:()=>l.push("step_method_selection"),children:d.x.I18n.t("importAgain")}),(0,m.jsx)(Le.z,{type:"button",onClick:()=>{window.location.href="admin.php?page=mailpoet-subscribers"},children:d.x.I18n.t("viewSubscribers")})]})})]})}dc.propTypes={segments:De().arrayOf(De().string.isRequired),subscribersCount:De().number,initialMessage:De().string},dc.defaultProps={segments:[],subscribersCount:0,initialMessage:""},dc.displayName="ResultMessage",pc.propTypes={createdSubscribers:De().number,updatedSubscribers:De().number},pc.defaultProps={createdSubscribers:0,updatedSubscribers:0},pc.displayName="NoAction",uc.propTypes={createdSubscribers:De().number,updatedSubscribers:De().number},uc.defaultProps={createdSubscribers:0,updatedSubscribers:0},uc.displayName="SuppressionListReminder",mc.propTypes={addedToSegmentWithWelcomeNotification:De().bool},mc.defaultProps={addedToSegmentWithWelcomeNotification:!1},mc.diplayName="NoWelcomeEmail",hc.propTypes={history:De().shape({push:De().func.isRequired,replace:De().func.isRequired}).isRequired,errors:De().arrayOf(De().string.isRequired),segments:De().arrayOf(De().string.isRequired),createdSubscribers:De().number,updatedSubscribers:De().number,addedToSegmentWithWelcomeNotification:De().bool},hc.defaultProps={errors:[],segments:void 0,createdSubscribers:void 0,updatedSubscribers:void 0,addedToSegmentWithWelcomeNotification:void 0},hc.displayName="StepResultsComponent";const fc=(0,Ce.EN)(hc);function gc(e){let{history:t}=e;return(0,m.jsx)(Bl,{onProceed:()=>t.push("step_method_selection")})}gc.displayName="StepCleanList";const xc=document.getElementById("import_container");function _c(){const[e,t]=(0,r.useState)(void 0),[n,a]=(0,r.useState)({}),i=(0,l.S)(window);return(0,m.jsx)(l.k.Provider,{value:i,children:(0,m.jsxs)(Ne.HashRouter,{children:[(0,m.jsx)(p.w,{}),(0,m.jsx)(Sl,{children:(0,m.jsxs)(Ce.rs,{children:[(0,m.jsx)(Ce.AW,{path:"/step_clean_list",render:(0,o.withBoundary)(gc)}),(0,m.jsx)(Ce.AW,{path:"/step_method_selection",render:e=>(0,m.jsx)(Fl,{...e,setStepMethodSelectionData:t,subscribersLimitForValidation:100})}),(0,m.jsx)(Ce.AW,{path:"/step_input_validation",render:t=>(0,m.jsx)(Ul,{...t,stepMethodSelectionData:e})}),(0,m.jsx)(Ce.AW,{path:"/step_data_manipulation",render:t=>(0,m.jsx)(cc,{...t,stepMethodSelectionData:e,subscribersLimitForValidation:100,setStepDataManipulationData:a})}),(0,m.jsx)(Ce.AW,{path:"/step_results",render:e=>(0,m.jsx)(fc,{...e,errors:n.errors,createdSubscribers:n.created,updatedSubscribers:n.updated,segments:n.segments,addedToSegmentWithWelcomeNotification:n.added_to_segment_with_welcome_notification})}),(0,m.jsx)(Ce.AW,{path:"*",render:()=>(0,m.jsx)(Ce.l_,{to:"/step_clean_list"})})]})})]})})}xc&&((0,o.registerTranslations)(),s.render((0,m.jsx)(_c,{}),xc));var bc=n(88525),vc=n.n(bc);Te()(document).ready((()=>{let e;if(!Te()("#mailpoet_subscribers_export").length)return;if(!window.exportData.segments)return;const t=vc().compile(Te()("#mailpoet_subscribers_export_template").html());function n(t){const n="mailpoet-disabled";"on"===t?e.removeClass(n):e.addClass(n)}Te()("#mailpoet-export").html(t(window.exportData));const a=Te()("#export_lists"),i=Te()("#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 r(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,a=["select","deselect"];let i;ot.ZP.contains(a,n)&&(t.preventDefault(),"deselect"===n?Te()(t.target).val("").trigger("change"):(i=[],ot.ZP.each(e.find("option"),(e=>{const t=e.value;ot.ZP.contains(a,t)||i.push(t)})),Te()(t.target).val(i).trigger("change")),Te()(t.target).select2("close"))})).on("change",(()=>{window.exportData.segments&&a.select2("data").length&&i.select2("data").length||!window.exportData.segments&&i.select2("data").length?n("on"):n("off")}))}e=Te()("#mailpoet-export-button"),window.segments.forEach((e=>{a.append(Te()("<option></option>").attr("value",e.id).text(e.name))})),window.subscriberFieldsSelect2.forEach((e=>{e.text=e.name,e.children.forEach((e=>{e.name=(0,fr.escapeHTML)(e.name),e.text=(0,fr.escapeHTML)(e.name)}))})),r(a,window.segments),r(i,window.subscriberFieldsSelect2),i.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(Te()(e.target).hasClass("mailpoet-disabled"))return;d.x.Modal.loading(!0);const t=Te()(':radio[name="option_format"]:checked').val();d.x.Ajax.post({api_version:d.x.apiVersion,endpoint:"ImportExport",action:"processExport",data:JSON.stringify({export_format_option:t,segments:!!window.exportData.segments&&a.val(),subscriber_fields:i.val()})}).always((()=>{d.x.Modal.loading(!1)})).done((e=>{const n=d.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>");Te()("#export_result_notice").html(`<p>${n}</p>`).show(),window.location.href=e.data.exportFileURL,d.x.trackEvent("Subscribers export completed",{"Total exported":e.data.totalExported,"File Format":t})})).fail((e=>{e.errors.length>0&&d.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}))}));var yc=n(66376),wc=n(56426);function jc(e){let{children:t}=e;return(0,m.jsx)("div",{className:"mailpoet-steps-content",children:t})}const Sc=(0,m.jsx)("svg",{width:"13",height:"11",viewBox:"0 0 13 11",children:(0,m.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"})}),kc=(0,m.jsx)("svg",{width:"17",height:"16",viewBox:"0 0 17 16",children:(0,m.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 Nc(e){let{onCheck:t,showError:n,checked:a,automationId:i,...s}=e;return(0,m.jsxs)("div",{className:ee()({"mailpoet-form-yesno":!0,"mailpoet-form-yesno-error":n,"mailpoet-disabled":s.disabled}),"data-automation-id":i,children:[(0,m.jsxs)("label",{children:[(0,m.jsx)("input",{type:"radio",checked:!0===a,onChange:()=>t(!0),...s}),(0,m.jsx)("span",{className:"mailpoet-form-yesno-control mailpoet-form-yesno-yes",children:Sc})]}),(0,m.jsxs)("label",{children:[(0,m.jsx)("input",{type:"radio",checked:!1===a,onChange:()=>t(!1),...s}),(0,m.jsx)("span",{className:"mailpoet-form-yesno-control mailpoet-form-yesno-no",children:kc})]})]})}function Cc(e){let{submitForm:t,loading:n,showCustomersImportSetting:a,isWizardStep:i=!1}=e;const[s,l]=(0,r.useState)(null),[c,d]=(0,r.useState)(!1===a?"unsubscribed":null),[p,u]=(0,r.useState)(!1),h=i?(0,Pe._x)("Continue","A label on a button","mailpoet"):(0,Pe._x)("Start using WooCommerce features","Submit button caption on the standalone WooCommerce setup page","mailpoet");let f;return"subscribed"===c&&(f=!0),"unsubscribed"===c&&(f=!1),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(o.TypographyHeading,{level:1,children:(0,Pe._x)("Power up your WooCommerce store","Title on the WooCommerce setup page","mailpoet")}),(0,m.jsx)("div",{className:"mailpoet-gap"}),(0,m.jsx)("p",{children:(0,Pe.__)("MailPoet comes with powerful features for WooCommerce. Select features that you would like to use with your store.","mailpoet")}),(0,m.jsx)("div",{className:"mailpoet-gap"}),(0,m.jsxs)("form",{onSubmit:e=>(e.preventDefault(),u(!0),null===c||null===s||t(c,s),!1),children:[(0,m.jsxs)("div",{children:[a?(0,m.jsxs)("div",{className:"mailpoet-wizard-woocommerce-option",children:[(0,m.jsx)("div",{className:"mailpoet-wizard-woocommerce-toggle",children:(0,m.jsx)(Nc,{showError:p&&null===c,checked:f,onCheck:e=>d(e?"subscribed":"unsubscribed"),name:"mailpoet_woocommerce_import_type",automationId:"woocommerce_import_type"})}),(0,m.jsxs)("div",{children:[(0,m.jsx)("p",{children:x()((0,Pe.__)("Do you want to import your WooCommerce customers as subscribed? [link]Learn more[/link].","mailpoet"),/\[link\](.*?)\[\/link\]/,(e=>(0,m.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,m.jsxs)("div",{className:"mailpoet-wizard-note",children:[(0,m.jsx)("span",{children:"GDPR"}),(0,Pe._x)("To be compliant with privacy regulations, your customers must have explicitly accepted to receive your marketing emails.","GDPR compliance information","mailpoet")]})]})]}):null,(0,m.jsxs)("div",{className:"mailpoet-wizard-woocommerce-option",children:[(0,m.jsx)("div",{className:"mailpoet-wizard-woocommerce-toggle",children:(0,m.jsx)(Nc,{showError:p&&null===s,checked:s,onCheck:e=>l(e),name:"mailpoet_woocommerce_tracking",automationId:"woocommerce_tracking"})}),(0,m.jsxs)("div",{children:[(0,m.jsx)("p",{children:x()((0,Pe.__)("Collect more precise email and site engagement, and e-commerce metrics by enabling cookie tracking. [link]Learn more[/link].","mailpoet"),/\[link\](.*?)\[\/link\]/,(e=>(0,m.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,m.jsxs)("div",{className:"mailpoet-wizard-note",children:[(0,m.jsx)("span",{children:"GDPR"}),(0,Pe._x)("To be compliant, you should display a cookie tracking banner on your website.","GDPR compliance information","mailpoet")]})]})]})]}),(0,m.jsx)("div",{className:"mailpoet-gap"}),(0,m.jsx)(o.Button,{className:"mailpoet-wizard-continue-button",isFullWidth:!0,type:"submit",withSpinner:n,disabled:n,automationId:"submit_woocommerce_setup",children:h})]})]})}function Ic(e){return(0,m.jsx)(ti,{illustrationUrl:e.illustrationUrl,children:e.children})}function Tc(e){let{isWizardStep:t=!1,redirectToNextStep:n=null}=e;const[a,i]=(0,r.useState)(!1),[s,l]=(0,wc.yu)("woocommerce"),c=(0,wc.yu)("tracking")[1],p=(0,wc.yu)("woocommerce_import_screen_displayed")[1],u=(0,wc.yu)("mailpoet_subscribe_old_woocommerce_customers")[1],h=e=>{i(!1),d.x.Notice.showApiErrorNotice(e,{scroll:!0})},f=e=>d.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"settings",action:"set",data:e}).fail(h),g=(0,m.jsx)(Ic,{illustrationUrl:window.wizard_woocommerce_illustration_url,children:(0,m.jsx)(o.ErrorBoundary,{children:(0,m.jsx)(Cc,{loading:a,submitForm:async(e,a)=>{i(!0);const r="basic"===d.x.trackingConfig.level?"basic":"partial",o={level:a?"full":r},m={enabled:"subscribed"===e?"1":""},g={woocommerce_import_screen_displayed:1,"mailpoet_subscribe_old_woocommerce_customers.enabled":m.enabled,"tracking.level":o.level,"woocommerce.accept_cookie_revenue_tracking.set":"1"};await f(g),c(o),u(m),l({...s,accept_cookie_revenue_tracking:{...s.accept_cookie_revenue_tracking||{},set:"1"}}),p("1"),await d.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"importExport",action:"setupWooCommerceInitialImport"}).fail(h),t?n():await(async()=>{t?await f({version:window.mailpoet_version}).then((()=>{window.location.href=window.finish_wizard_url})):window.location.href=window.finish_wizard_url})()},isWizardStep:t,showCustomersImportSetting:window.mailpoet_show_customers_import})})});return t?g:(0,m.jsx)(jc,{children:g})}function Ec(e){let{skipStep:t,loading:n,update_sender:a,submit_sender:i,sender:s=null}=e;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(_t.X,{level:1,children:(0,Pe.__)("Start by configuring your sender information","mailpoet")}),(0,m.jsx)("div",{className:"mailpoet-gap"}),(0,m.jsxs)("p",{children:[(0,m.jsx)("b",{children:(0,Pe.__)("Default sender","mailpoet")}),(0,m.jsx)("br",{}),(0,Pe.__)("Enter details of the person or brand your subscribers expect to receive emails from","mailpoet")]}),(0,m.jsx)("div",{className:"mailpoet-gap"}),(0,m.jsxs)("form",{id:"mailpoet_sender_form",onSubmit:e=>{e.preventDefault(),Te()("#mailpoet_sender_form").parsley().validate()&&i()},children:[(0,m.jsxs)(In.Grid.TwoColumns,{children:[(0,m.jsxs)("label",{htmlFor:"senderName",children:[(0,m.jsx)("span",{className:"mailpoet-wizard-label",children:(0,Pe._x)("From Name","A form field label","mailpoet")}),(0,m.jsx)(o.Input,{isFullWidth:!0,name:"senderName",type:"text",placeholder:"John Doe",value:s?s.name:"","data-parsley-required":!0,onChange:e=>a({name:e.target.value})})]}),(0,m.jsxs)("label",{htmlFor:"senderAddress",children:[(0,m.jsx)("span",{className:"mailpoet-wizard-label",children:(0,Pe._x)("From Address","A form field label","mailpoet")}),(0,m.jsx)(o.Input,{isFullWidth:!0,name:"senderAddress",type:"text",placeholder:"[email protected]",value:s?s.address:"","data-parsley-required":!0,"data-parsley-type":"email",onChange:e=>a({address:e.target.value})})]})]}),(0,m.jsx)("div",{className:"mailpoet-gap"}),(0,m.jsx)("div",{className:"mailpoet-gap"}),(0,m.jsx)(o.Button,{className:"mailpoet-wizard-continue-button",isFullWidth:!0,type:"submit",withSpinner:n,children:(0,Pe._x)("Continue","A label on a button","mailpoet")}),(0,m.jsx)(o.Button,{href:"#skipStep",isDisabled:n,isFullWidth:!0,onClick:t,variant:"tertiary",children:(0,Pe._x)("Skip this step","A label on a skip button","mailpoet")})]})]})}Ic.propTypes={illustrationUrl:De().string.isRequired,children:De().oneOfType([De().arrayOf(De().node),De().node]).isRequired},Tc.displayName="WooCommerceController",Ec.displayName="WelcomeWizardSenderStep";const Dc=e=>null==e;function Oc(e){let{loading:t,submitForm:n}=e;const[a,i]=(0,r.useState)({tracking:void 0,libs3rdParty:void 0}),[s,o]=(0,r.useState)(!1);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(_t.X,{level:1,children:(0,Pe.__)("Confirm privacy and data settings","mailpoet")}),(0,m.jsx)("div",{className:"mailpoet-gap"}),(0,m.jsxs)("form",{onSubmit:function(e){return e.preventDefault(),o(!0),Dc(a.libs3rdParty)||Dc(a.tracking)||n(a.tracking,a.libs3rdParty),!1},children:[(0,m.jsxs)("div",{children:[(0,m.jsxs)("div",{id:"mailpoet-wizard-3rd-party-libs",className:"mailpoet-wizard-woocommerce-option",children:[(0,m.jsx)("div",{className:"mailpoet-wizard-woocommerce-toggle",children:(0,m.jsx)(Nc,{showError:s&&Dc(a.libs3rdParty),onCheck:e=>{const t={libs3rdParty:e};i((e=>({...e,...t})))},checked:a.libs3rdParty,name:"mailpoet_libs_3rdParty"})}),(0,m.jsxs)("div",{children:[(0,m.jsx)("p",{children:(0,Pe.__)("Enable modern text fonts in emails and show contextual help articles in MailPoet","mailpoet")}),(0,m.jsx)("div",{className:"mailpoet-wizard-note",children:x()((0,Pe.__)("MailPoet may load Google Fonts, DocsBot and other [link]3rd party libraries[/link].","mailpoet"),/\[link\](.*?)\[\/link\]/g,((e,t)=>(0,m.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,m.jsx)("div",{className:"mailpoet-gap"}),(0,m.jsxs)("div",{id:"mailpoet-wizard-tracking",className:"mailpoet-wizard-woocommerce-option",children:[(0,m.jsx)("div",{className:"mailpoet-wizard-woocommerce-toggle",children:(0,m.jsx)(Nc,{showError:s&&Dc(a.tracking),onCheck:e=>{const t={tracking:e};i((e=>({...e,...t})))},checked:a.tracking,name:"mailpoet_tracking"})}),(0,m.jsxs)("div",{children:[(0,m.jsx)("p",{children:(0,Pe.__)("Help improve MailPoet","mailpoet")}),(0,m.jsx)("div",{className:"mailpoet-wizard-note",children:x()((0,Pe.__)("Get improved features and fixes faster by sharing with us [link]non-sensitive data about how you use MailPoet[/link]. No personal data is tracked or stored.","mailpoet"),/\[link\](.*?)\[\/link\]/g,((e,t)=>(0,m.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,m.jsx)("div",{className:"mailpoet-gap"}),(0,m.jsx)(Le.z,{className:"mailpoet-wizard-continue-button",isFullWidth:!0,type:"submit",withSpinner:t,disabled:t,children:(0,Pe._x)("Continue","A label on a button","mailpoet")})]})]})}Oc.propTypes={loading:De().bool.isRequired,submitForm:De().func.isRequired},Oc.displayName="WelcomeWizardUsageTrackingStep";var Ac=n(85180),Rc=n(6198),Pc=n(14134);async function Lc(e){await d.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"settings",action:"set",data:e}).fail((e=>{e.errors.length>0&&d.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}async function Mc(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;await Lc({version:window.mailpoet_version}),window.location.href=e||window.finish_wizard_url}function Fc(){const[e,t]=(0,r.useState)(!1),n=e=>{e.preventDefault(),t(!0)},a=()=>t(!1);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("p",{children:x()(d.x.I18n.t("welcomeWizardMSSAdvancedUsers"),/\[link](.*?)\[\/link]/g,((e,t)=>(0,m.jsx)("a",{onClick:n,href:"#",children:e},t)))}),e&&(0,m.jsxs)(Pc.Z,{className:"mailpoet-welcome-wizard-confirmation-modal",title:d.x.I18n.t("welcomeWizardMSSConfirmationModalTitle"),onRequestClose:a,children:[(0,m.jsx)("p",{children:d.x.mailFunctionEnabled?d.x.I18n.t("welcomeWizardMSSConfirmationModalFirstParagraph"):d.x.I18n.t("welcomeWizardMSSConfirmationModalFirstParagraphWithoutMailFunction")}),(0,m.jsx)("p",{children:d.x.I18n.t("welcomeWizardMSSConfirmationModalSecondParagraph")}),(0,m.jsxs)("div",{className:"mailpoet-welcome-wizard-confirmation-modal-buttons",children:[(0,m.jsx)(o.Button,{variant:"secondary",onClick:a,children:d.x.I18n.t("welcomeWizardMSSConfirmationModalGoBackButton")}),(0,m.jsx)(o.Button,{onClick:async e=>{e.preventDefault(),await Mc("admin.php?page=mailpoet-settings#/mta/other")},children:d.x.I18n.t("welcomeWizardMSSConfirmationModalOkButton")})]})]})]})}const Bc="https://account.mailpoet.com/?ref=plugin-wizard&utm_source=plugin&utm_medium=onboarding&utm_campaign=purchase";function qc(){const e=(0,Ce.k6)(),{step:t}=(0,Ce.UO)(),n=(0,wc.v9)("getKeyActivationState")();return(0,r.useEffect)((()=>{!0===n.isKeyValid&&e.replace(`/steps/${t}/part/3`)}),[n.isKeyValid,e,t]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(_t.X,{level:1,children:d.x.I18n.t("welcomeWizardMSSFirstPartTitle")}),(0,m.jsx)("div",{className:"mailpoet-gap"}),(0,m.jsx)("p",{children:d.x.I18n.t("welcomeWizardMSSFirstPartSubtitle")}),(0,m.jsx)("div",{className:"mailpoet-gap"}),(0,m.jsx)("div",{className:"mailpoet-welcome-wizard-mss-list",children:(0,m.jsxs)(o.List,{children:[(0,m.jsx)("li",{children:d.x.I18n.t("welcomeWizardMSSList1")}),(0,m.jsx)("li",{children:d.x.I18n.t("welcomeWizardMSSList2")}),d.x.subscribersCount<1e3?(0,m.jsx)("li",{children:d.x.I18n.t("welcomeWizardMSSList3Free")}):(0,m.jsx)("li",{children:d.x.I18n.t("welcomeWizardMSSList3Paid")})]})}),(0,m.jsx)("div",{className:"mailpoet-gap"}),(0,m.jsx)("div",{className:"mailpoet-gap"}),(0,m.jsx)(o.Button,{className:"mailpoet-wizard-continue-button",isFullWidth:!0,href:Bc,target:"_blank",rel:"noopener noreferrer",onClick:n=>function(e,t,n){e.preventDefault(),window.open(Bc),t.push(`/steps/${n}/part/2`)}(n,e,t),iconEnd:(0,m.jsx)(Ac.Z,{icon:Rc.Z}),children:d.x.I18n.t("welcomeWizardMSSFirstPartButton")}),(0,m.jsx)("div",{className:"mailpoet-gap"}),(0,m.jsx)("div",{className:"mailpoet-gap"}),(0,m.jsx)(Fc,{})]})}var Wc=n(717),Vc=n(9605);function $c(){const e=(0,Ce.k6)(),{step:t}=(0,Ce.UO)(),n=(0,wc.v9)("getKeyActivationState")();return(0,r.useEffect)((()=>{!0===n.isKeyValid&&e.push(`/steps/${t}/part/3`)}),[n.isKeyValid,e,t]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(o.Heading,{level:1,children:d.x.I18n.t("welcomeWizardMSSSecondPartTitle")}),(0,m.jsx)("div",{className:"mailpoet-gap"}),(0,m.jsx)("p",{children:d.x.I18n.t("welcomeWizardMSSSecondPartEnterKey")}),(0,m.jsx)("p",{children:x()(d.x.I18n.t("welcomeWizardMSSSecondPartNoAccount"),/\[link](.*?)\[\/link]/g,((e,t)=>(0,m.jsx)("a",{target:"_blank",rel:"noreferrer",href:"https://account.mailpoet.com/?ref=plugin-wizard&utm_source=plugin&utm_medium=onboarding&utm_campaign=purchase",children:e},t)))}),(0,m.jsx)("div",{className:"mailpoet-gap"}),(0,m.jsxs)("label",{htmlFor:"mailpoet_premium_key",children:[(0,m.jsx)("span",{className:"mailpoet-wizard-label",children:d.x.I18n.t("welcomeWizardMSSSecondPartInputLabel")}),(0,m.jsx)(Vc.c,{placeholder:d.x.I18n.t("welcomeWizardMSSSecondPartInputPlaceholder"),isFullWidth:!0})]}),(0,m.jsx)("div",{className:"mailpoet-gap"}),(0,m.jsx)("div",{className:"mailpoet-gap"}),(0,m.jsx)(Wc.X,{label:d.x.I18n.t("welcomeWizardMSSSecondPartButton"),isFullWidth:!0}),(0,m.jsx)("div",{className:"mailpoet-gap"}),(0,m.jsx)("div",{className:"mailpoet-gap"}),(0,m.jsx)(Fc,{})]})}function Uc(){return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(_t.X,{level:1,children:d.x.I18n.t("welcomeWizardMSSThirdPartTitle")}),(0,m.jsx)("div",{className:"mailpoet-gap"}),(0,m.jsx)("p",{children:d.x.I18n.t("welcomeWizardMSSThirdPartFirstParagraph")}),(0,m.jsx)("p",{children:d.x.I18n.t("welcomeWizardMSSThirdPartSecondParagraph")}),(0,m.jsx)("div",{className:"mailpoet-gap"}),(0,m.jsx)("div",{className:"mailpoet-gap"}),(0,m.jsx)(o.Button,{className:"mailpoet-wizard-continue-button",type:"button",onClick:()=>Mc(),isFullWidth:!0,children:d.x.I18n.t("welcomeWizardMSSThirdPartButton")})]})}function Yc(){const{path:e}=(0,Ce.$B)(),{step:t}=(0,Ce.UO)();return(0,m.jsxs)(Ce.rs,{children:[(0,m.jsx)(Ce.AW,{exact:!0,path:`${e}`,children:(0,m.jsx)(Ce.l_,{to:`/steps/${t}/part/1`})}),(0,m.jsx)(Ce.AW,{path:`${e}/part/1`,children:(0,m.jsx)(qc,{})}),(0,m.jsx)(Ce.AW,{path:`${e}/part/2`,children:(0,m.jsx)($c,{})}),(0,m.jsx)(Ce.AW,{path:`${e}/part/3`,children:(0,m.jsx)(Uc,{})})]})}const Hc=e=>{let{name:t,address:n}=e;const a=n.split("@").pop().toLowerCase();return window.mailpoet_free_domains.indexOf(a)>-1?(e=>{let{name:t,address:n}=e;const a=`wordpress@${window.location.hostname.replace("www.","")}`;return{sender:{name:t,address:a},reply_to:{name:t,address:n},"signup_confirmation.from.address":a,"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})},zc=()=>{let e=3;return window.mailpoet_woocommerce_active&&(e+=1),e},Zc=(e,t,n)=>{n<zc()?e.push(`/steps/${n+1}`):t()},Kc=e=>1===e?"WelcomeWizardSenderStep":2===e?"WelcomeWizardUsageTrackingStep":window.mailpoet_woocommerce_active&&3===e?"WizardWooCommerceStep":"WelcomeWizardPitchMSSStep";var Gc=n(1268);function Qc(e){let{match:t,history:n}=e;const a=zc(),i=parseInt(t.params.step,10),[s,l]=(0,r.useState)(!1),[d,p]=(0,wc.yu)("sender"),u=(0,wc.yu)("analytics")[1],h=(0,wc.yu)("3rd_party_libs")[1];(0,r.useEffect)((()=>{(i>a||i<1)&&n.push("/steps/1")}),[i,a,n]);const f=(0,ot.r$)(Zc,n,Mc),g=(0,r.useCallback)((async(e,t)=>{l(!0);const n={enabled:e?"1":""},a={enabled:t?"1":""},s={analytics:n,"3rd_party_libs":a};await Lc(s),u(n),h(a),f(i),l(!1)}),[f,i,u,h]),x=(0,r.useCallback)((e=>{p({...d,...e})}),[d,p]),_=(0,r.useCallback)((async()=>{l(!0),await Lc(Hc(d)).then((()=>f(i))),l(!1)}),[f,d,i]),b=(0,r.useCallback)((async e=>{e.preventDefault(),l(!0);const t={address:window.admin_email,name:""};await Lc(Hc(t)).then((()=>{p(t),f(i)})),l(!1)}),[f,i,p]),v=Kc(i);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(St.B,{}),(0,m.jsx)(c.D,{logoWithLink:!1,children:(0,m.jsx)(Gc.R,{count:a,current:i})}),(0,m.jsxs)(jc,{children:["WelcomeWizardSenderStep"===v?(0,m.jsx)(Ic,{illustrationUrl:window.wizard_sender_illustration_url,children:(0,m.jsx)(o.ErrorBoundary,{children:(0,m.jsx)(Ec,{update_sender:x,submit_sender:_,skipStep:b,loading:s,sender:d})})}):null,"WelcomeWizardUsageTrackingStep"===v?(0,m.jsx)(Ic,{illustrationUrl:window.wizard_tracking_illustration_url,children:(0,m.jsx)(o.ErrorBoundary,{children:(0,m.jsx)(Oc,{loading:s,submitForm:g})})}):null,"WelcomeWizardPitchMSSStep"===v?(0,m.jsx)(Ic,{illustrationUrl:window.wizard_MSS_pitch_illustration_url,children:(0,m.jsx)(o.ErrorBoundary,{children:(0,m.jsx)(Yc,{})})}):null,"WizardWooCommerceStep"===v?(0,m.jsx)(o.ErrorBoundary,{children:(0,m.jsx)(Tc,{isWizardStep:!0,redirectToNextStep:()=>f(i)})}):null]})]})}function Xc(){let e="/steps/1";window.location.search.includes("woocommerce-setup")&&(e="/woocommerce");const t=(0,l.S)(window);return(0,m.jsx)(l.k.Provider,{value:t,children:(0,m.jsxs)(Ne.HashRouter,{children:[(0,m.jsx)(p.w,{}),(0,m.jsxs)(Ce.rs,{children:[(0,m.jsx)(Ce.AW,{path:"/steps/:step",component:(0,o.withBoundary)(Qc)}),(0,m.jsx)(Ce.AW,{path:"/woocommerce",component:(0,o.withBoundary)(Tc)}),(0,m.jsx)(Ce.AW,{render:()=>(0,m.jsx)(Ce.l_,{to:e})})]})]})})}Qc.displayName="WelcomeWizardStepsController";const Jc=document.getElementById("mailpoet-wizard-container");function ed(){const[e,t]=(0,r.useState)(null),n=(0,l.S)(window),a=n.notices.error;function i(i){const s=i.target.name,r=i.target.checked;d.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"featureFlags",action:"set",data:{[s]:r?1:0}}).done((()=>{const a=e[s];a.value=r,t({...e,[s]:a});const i=`Feature '${s}' was ${r?"enabled":"disabled"}.`;n.notices.success((0,m.jsx)("p",{children:i}))})).fail((e=>{e.errors.length>0&&a(e.errors.map((e=>(0,m.jsx)("p",{children:e.message},e.message))),{scroll:!0})}))}return(0,r.useEffect)((()=>{d.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&&a((0,m.jsx)(m.Fragment,{children:e.errors.map((e=>(0,m.jsx)("p",{children:e.message})))}),{scroll:!0})}))}),[a]),null===e?(0,m.jsx)("p",{children:"Loading experimental features..."}):0===Object.values(e).length?(0,m.jsx)("p",{children:"There are no experimental features at the moment."}):(0,m.jsx)(l.k.Provider,{value:n,children:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(p.w,{}),Object.values(e).map((e=>{const t=`experimental-feature-${e.name}`;return(0,m.jsx)("div",{children:(0,m.jsxs)("label",{htmlFor:t,children:[(0,m.jsx)("input",{id:t,type:"checkbox",name:e.name,defaultChecked:e.value,onChange:i})," ",e.name]})},e.name)}))]})})}Jc&&((0,o.registerTranslations)(),(0,yc.N)(),s.render((0,m.jsx)(Xc,{}),Jc));const td=document.getElementById("experimental_features_container");ed.displayName="ExperimentalFeatures",td&&((0,o.registerTranslations)(),s.render((0,m.jsx)(o.ErrorBoundary,{children:(0,m.jsx)(ed,{})}),td));var nd=n(8321);function ad(e){let{message:t,editing:n}=e;return n?(0,m.jsx)("textarea",{value:t,className:"mailpoet-logs-full-message",readOnly:!0}):(0,m.jsx)(m.Fragment,{children:`${t.substr(0,150)}…`})}function id(e){let{log:t}=e;const[n,a]=(0,r.useState)(!1);return(0,m.jsxs)("tr",{children:[(0,m.jsx)("td",{role:"gridcell",children:t.name}),(0,m.jsx)("td",{onClick:function(e){(function(e){return(e.ctrlKey||e.metaKey)&&!e.altKey})(e)&&(n||a(!0))},role:"gridcell",children:(0,m.jsx)(ad,{message:t.message,editing:n})}),(0,m.jsx)("td",{role:"gridcell",children:d.x.Date.full(t.created_at)})]},`log-row-${t.id}`)}function sd(e){let{logs:t,onFilter:n,originalFrom:a,originalTo:i,originalSearch:s,originalOffset:l,originalLimit:c}=e;const[p,u]=(0,r.useState)(a??void 0),[h,f]=(0,r.useState)(i??void 0),[g,x]=(0,r.useState)(l??""),[_,b]=(0,r.useState)(c??""),[v,y]=(0,r.useState)(s||""),w=(0,Sn.curry)(((e,t)=>{e(null!==t?d.x.Date.format(t,{format:"Y-m-d"}):void 0)})),j=(0,r.useCallback)((()=>{const e={};p&&(e.from=p),h&&(e.to=h),g&&""!==g.trim()&&(e.offset=g),_&&""!==_.trim()&&(e.limit=_),v&&""!==v.trim()&&(e.search=v.trim()),n(e)}),[p,_,g,v,h,n]);return(0,m.jsxs)("div",{className:"mailpoet-listing mailpoet-logs",children:[(0,m.jsxs)("div",{className:"mailpoet-listing-header",children:[(0,m.jsxs)("div",{className:"mailpoet-listing-search",children:[(0,m.jsx)("label",{htmlFor:"search_input",className:"screen-reader-text",children:d.x.I18n.t("searchLabel")}),(0,m.jsx)(o.Input,{dimension:"small",iconStart:nd.J,type:"search",id:"search_input",name:"s",onChange:e=>y(e.target.value),value:v,placeholder:d.x.I18n.t("searchLabel")})]}),(0,m.jsxs)("div",{className:"mailpoet-listing-filters",children:[`${d.x.I18n.t("from")}:`,(0,m.jsxs)(o.ErrorBoundary,{children:[(0,m.jsx)(Ln,{dateFormat:"MMMM d, yyyy",onChange:w(u),maxDate:new Date,selected:p?(0,Hr.default)(p):void 0,dimension:"small"}),`${d.x.I18n.t("to")}:`,(0,m.jsx)(Ln,{dateFormat:"MMMM d, yyyy",onChange:w(f),maxDate:new Date,selected:h?(0,Hr.default)(h):void 0,dimension:"small"})]})]}),(0,m.jsxs)("div",{className:"mailpoet-logs-limit",children:[(0,m.jsx)("label",{htmlFor:"offset_input",className:"screen-reader-text",children:d.x.I18n.t("offsetLabel")}),(0,m.jsx)(o.Input,{dimension:"small",id:"offset_input",name:"o",type:"number",onChange:e=>x(e.target.value),value:g,placeholder:d.x.I18n.t("offsetLabel")})]}),(0,m.jsxs)("div",{className:"mailpoet-logs-limit",children:[(0,m.jsx)("label",{htmlFor:"limit_input",className:"screen-reader-text",children:d.x.I18n.t("limitLabel")}),(0,m.jsx)(o.Input,{dimension:"small",id:"limit_input",name:"l",type:"number",onChange:e=>b(e.target.value),value:_,placeholder:d.x.I18n.t("limitLabel")})]}),(0,m.jsx)(o.Button,{dimension:"small",onClick:j,children:d.x.I18n.t("filter")})]}),(0,m.jsxs)("table",{className:"mailpoet-listing-table widefat striped",role:"grid",children:[(0,m.jsx)("thead",{children:(0,m.jsxs)("tr",{children:[(0,m.jsx)("th",{children:d.x.I18n.t("tableHeaderName")}),(0,m.jsx)("th",{children:d.x.I18n.t("tableHeaderMessage")}),(0,m.jsx)("th",{children:d.x.I18n.t("tableHeaderCreatedOn")})]})}),(0,m.jsx)("tbody",{children:(0,m.jsx)(o.ErrorBoundary,{children:t.map((e=>(0,m.jsx)(id,{log:e},`log-${e.id}`)))})})]})]})}id.displayName="Log",sd.displayName="LogsList";const rd=document.getElementById("mailpoet_logs_container");if(rd){const e=new URL(window.location.href);s.render((0,m.jsx)(o.ErrorBoundary,{children:(0,m.jsx)(sd,{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,a]=t;e.searchParams.append(n,a)})),window.location.href=e.href}})}),rd)}var od=n(35671);function ld(e){let{onRequestClose:t}=e;const[n,a]=(0,r.useState)(!1);return Te()((e=>{e(document).on("click",".notice .mailpoet-js-button-fix-this",(()=>{a(!0)}))})),(0,m.jsxs)(l.k.Provider,{value:(0,l.S)(window),children:[(0,m.jsx)(p.w,{}),n&&(0,m.jsx)(od.d,{onRequestClose:()=>{a(!1),t()}})]})}ld.defaultProps={onRequestClose:Sn.noop};const cd=document.getElementById("mailpoet_set_from_address_modal");cd&&s.render((0,m.jsx)(ld,{onRequestClose:()=>{window.location.href.includes("?page=mailpoet-settings")&&window.location.reload()}}),cd);const dd=e=>(async e=>{if("MailPoet"!==d.x.mtaMethod)return!0;const t=await(async()=>"MailPoet"!==d.x.mtaMethod?[]:(await d.x.Ajax.post({api_version:d.x.apiVersion,endpoint:"mailer",action:"getVerifiedSenderDomains"})).data||[])(),n=(0,Un.DA)(e);return-1!==t.indexOf(n)||-1!==(await(async()=>"MailPoet"!==d.x.mtaMethod?[]:(await d.x.Ajax.post({api_version:d.x.apiVersion,endpoint:"mailer",action:"getAuthorizedEmailAddresses"})).data||[])()).indexOf(e)})(e).then((e=>{if(!e)return d.x.Notice.error(d.x.I18n.t("mailerSendingNotResumedUnauthorized"),{scroll:!0}),d.x.trackEvent("Unauthorized email used",{"Unauthorized email source":"send"}),!1;d.x.Ajax.post({api_version:d.x.apiVersion,endpoint:"mailer",action:"resumeSending"}).done((()=>{d.x.Notice.success(d.x.I18n.t("mailerSendingResumedNotice"))})).fail((e=>{e.errors.length>0&&d.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}));Te()((e=>{e(document).on("click",".notice .mailpoet-js-button-resume-sending",(e=>{dd(e.target.value)}))}));var pd=n(43678);const ud=e=>{const t=window.location.href.includes("?page=mailpoet-settings"),n=window.location.href.includes("?page=mailpoet-newsletters#/send");(e=>{const t=`${(0,Un.HD)()||"some other"} page`;e&&e.type&&"email"===e.type?d.x.trackEvent("MSS in plugin authorize email",{"authorized email source":"modal","original page":t,wasSuccessful:"yes"}):e&&e.type&&"domain"===e.type&&d.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 md(){const[e,t]=(0,r.useState)(""),[n,a]=(0,r.useState)("email");return(0,r.useEffect)((()=>{const e=e=>{var n,i,s,r;e.preventDefault();const o=String((null==e||null===(n=e.target)||void 0===n||null===(i=n.dataset)||void 0===i?void 0:i.email)||""),l=String((null==e||null===(s=e.target)||void 0===s||null===(r=s.dataset)||void 0===r?void 0:r.type)||"");a(l||"email"),t(o)};Te()((t=>{t(document).on("click",".mailpoet-js-button-authorize-email-and-sender-domain",e)}))}),[]),(0,m.jsx)(m.Fragment,{children:e&&(0,m.jsx)(pd.h,{senderEmail:e,onRequestClose:()=>{t("")},onSuccessAction:ud,showSenderEmailTab:"email"===n,showSenderDomainTab:"domain"===n,initialTab:"domain"===n?"sender_domain":"sender_email"})})}const hd=document.getElementById("mailpoet_authorize_sender_email_modal");hd&&s.render((0,m.jsx)(md,{}),hd);var fd=n(83653),gd=n(33308);const xd=()=>{window.location.href=window.mailpoet_welcome_wizard_url},_d="landing_page_cta_display",bd="landing_page_cta_display_variant_begin_setup",vd="landing_page_cta_display_variant_get_started_for_free";function yd(){return(0,m.jsxs)(fd.Experiment,{name:_d,children:[(0,m.jsx)(fd.Variant,{name:bd,children:(0,m.jsx)(o.Button,{onClick:()=>{fd.emitter.emitWin(_d)},children:(0,Pe.__)("Begin setup","mailpoet")})}),(0,m.jsx)(fd.Variant,{name:vd,children:(0,m.jsx)(o.Button,{onClick:()=>{fd.emitter.emitWin(_d)},children:(0,Pe.__)("Get started for free","mailpoet")})})]})}function wd(){return(0,m.jsx)("section",{className:"landing-header",children:(0,m.jsxs)("div",{className:"mailpoet-content-center",children:[(0,m.jsx)(_t.X,{level:0,children:(0,Pe.__)("Better email — without leaving WordPress","mailpoet")}),(0,m.jsx)("p",{children:(0,Pe.__)("Whether you’re just starting out or have already established your business, we’ve got what you need to reach customers where they are.","mailpoet")}),(0,m.jsx)(yd,{})]})})}function jd(){return(0,m.jsx)("section",{className:"landing-footer",children:(0,m.jsxs)("div",{className:"landing-footer-content mailpoet-content-center",children:[(0,m.jsxs)(_t.X,{level:4,children:[" ",(0,Pe.__)("Ready to start using MailPoet?","mailpoet")," "]}),(0,m.jsx)(yd,{})]})})}function Sd(){const e=[{slug:"item-1",title:(0,Pe.__)("What types of campaigns can I create with MailPoet?","mailpoet"),text:(0,Pe.__)("MailPoet allows you to create five different types of emails: Newsletter, Welcome Email, Latest Post Notifications, Re-engagement Emails and WooCommerce.","mailpoet"),readMoreText:(0,Pe.__)("Read More","mailpoet"),readMoreLink:"https://kb.mailpoet.com/article/141-create-an-email-types-of-campaigns"},{slug:"item-2",title:(0,Pe.__)("How do I send a newsletter?","mailpoet"),text:(0,Pe.__)("You can manually create a standard newsletter to be sent immediately or scheduled to be sent at a later time. Simply go to MailPoet > Emails and click on the “+ New Email” button to select “Newsletter”.","mailpoet"),readMoreText:(0,Pe.__)("Read More","mailpoet"),readMoreLink:"https://kb.mailpoet.com/article/344-create-a-standard-newsletter"},{slug:"item-3",title:(0,Pe.__)("Do I need a paid plan?","mailpoet"),text:(0,Pe.__)("When you install the MailPoet plugin, you can use it for free up to 1,000 subscribers. If you have more than 1,000 subscribers, you'll need one of our paid plans: Creator, Business, or Agency. The best choice of plan type will depend on whether you want to send with our MailPoet Sending Service or your own sending method, as well as the number of sites you will be using MailPoet on.","mailpoet"),readMoreText:(0,Pe.__)("Read More","mailpoet"),readMoreLink:"https://kb.mailpoet.com/article/349-choosing-your-mailpoet-plan"},{slug:"item-4",title:(0,Pe.__)("How do I import my customers from WooCommerce?","mailpoet"),text:(0,Pe.__)('The WooCommerce Customers list is a list automatically created by MailPoet with all of your WooCommerce customers. It also includes “Guest" customers. If WooCommerce is active, users that installed or updated the plugin should have chosen if they wanted to add the customers as “Subscribed” or “Unsubscribed” to the WooCommerce Customers list.',"mailpoet"),readMoreText:(0,Pe.__)("Read More","mailpoet"),readMoreLink:"https://kb.mailpoet.com/article/284-import-old-customers-to-the-woocommerce-customers-list"},{slug:"item-5",title:(0,Pe.__)("How do I customize emails for my store?","mailpoet"),text:(0,Pe.__)("You can create and send the following 4 WooCommerce Automatic emails with MailPoet: Abandoned Shopping Cart, First Purchase, Purchased In This Category, Purchased This Product. You can read more about each in our article.","mailpoet"),readMoreText:(0,Pe.__)("Read More","mailpoet"),readMoreLink:"https://kb.mailpoet.com/article/277-woocommerce-automatic-emails"}];return(0,m.jsxs)("section",{className:"landing-faq",children:[(0,m.jsxs)("div",{className:"mailpoet-content-center landing-faq-header",children:[(0,m.jsxs)(_t.X,{level:2,children:[" ",(0,Pe.__)("Frequently asked questions","mailpoet")," "]}),(0,m.jsx)("p",{children:x()((0,Pe.__)("Here are some common questions on getting started. Can't find what you're looking for? [link]View all resources[/link]","mailpoet"),/\[link\](.*?)\[\/link\]/,(e=>(0,m.jsx)("a",{href:"https://kb.mailpoet.com/",rel:"noopener noreferrer",target:"_blank",children:e},e)))})]}),(0,m.jsx)("div",{className:"mailpoet-content-center landing-faq-mobile",children:(0,m.jsx)(_t.X,{level:2,children:(0,Pe.__)("FAQ","mailpoet")})}),(0,m.jsx)("div",{className:"mailpoet-faq-accordion",children:e.map((e=>(0,m.jsxs)("details",{children:[(0,m.jsxs)("summary",{children:[" ",(0,m.jsxs)("strong",{children:[" ",e.title," "]})," "]}),(0,m.jsxs)("div",{className:"content",children:[(0,m.jsx)("p",{children:e.text}),(0,m.jsx)("p",{children:(0,m.jsx)("a",{href:e.readMoreLink,rel:"noopener noreferrer",target:"_blank",children:e.readMoreText})})]})]},e.slug)))}),(0,m.jsxs)("div",{className:"mailpoet-content-center landing-faq-mobile",children:[(0,m.jsx)("p",{children:(0,Pe.__)("Can’t find what you’re looking for?","mailpoet")}),(0,m.jsx)("p",{children:x()((0,Pe.__)("[link]View all resources[/link]","mailpoet"),/\[link\](.*?)\[\/link\]/,(e=>(0,m.jsx)("a",{href:"https://kb.mailpoet.com/",rel:"noopener noreferrer",target:"_blank",children:e},e)))})]})]})}fd.emitter.addPlayListener(((e,t)=>{(0,gd.KN)("Experiment Display",{experiment:e,variant:t},gd.BY)})),fd.emitter.addWinListener(((e,t)=>{(0,gd.KN)("Experiment Win",{experiment:e,variant:t},gd.BY,xd)})),fd.emitter.defineVariants(_d,[bd,vd],[50,50]),fd.experimentDebugger.setDebuggerAvailable(d.x.FeaturesController.isSupported("landingpage_ab_test_debugger")),fd.experimentDebugger.enable(),yd.displayName="Landingpage Ab Test",wd.displayName="Landingpage Header",jd.displayName="Landingpage Footer",Sd.displayName="Landingpage FAQ";const kd={heroImage:`${d.x.cdnUrl}landingpage/landingpage-hero-image.png`,featureImages:{icon_1:`${d.x.cdnUrl}landingpage/feature_icon_1.png`,icon_2:`${d.x.cdnUrl}landingpage/feature_icon_2.png`,icon_3:`${d.x.cdnUrl}landingpage/feature_icon_3.png`},wooCommerceFeatureImages:{feature_1:`${d.x.cdnUrl}landingpage/woo_feature_automate_your_marketing.png`,feature_2:`${d.x.cdnUrl}landingpage/woo_feature_measure_revenue_per_email.png`,feature_3:`${d.x.cdnUrl}landingpage/woo_feature_let_your_brand_shine.png`}};function Nd(){return(0,m.jsxs)("section",{className:"landing-content",children:[(0,m.jsxs)("div",{className:"hero-section mailpoet-content-center",children:[(0,m.jsx)("img",{src:kd.heroImage,alt:"",className:"hero-image landingpage-images"}),(0,m.jsx)("br",{}),(0,m.jsx)("br",{}),(0,m.jsx)(_t.X,{level:4,children:(0,Pe.__)("Powering email marketing for 600,000+ websites","mailpoet")}),(0,m.jsx)("br",{}),(0,m.jsxs)(In.Grid.ThreeColumns,{className:"landingpage-general-features",children:[(0,m.jsxs)("div",{children:[(0,m.jsx)("img",{src:kd.featureImages.icon_1,alt:"",className:"landingpage-feature-icon"}),(0,m.jsx)("strong",{children:(0,Pe.__)("Deliver beautiful emails","mailpoet")}),(0,m.jsx)("p",{children:(0,Pe.__)("Choose from our pre-built templates or create your own with our drag-and-drop email builder.","mailpoet")})]}),(0,m.jsxs)("div",{children:[(0,m.jsx)("img",{src:kd.featureImages.icon_2,alt:"",className:"landingpage-feature-icon"}),(0,m.jsx)("strong",{children:(0,Pe.__)("Grow your mailing list","mailpoet")}),(0,m.jsx)("p",{children:(0,Pe.__)("Use our custom sign-up forms to reach more subscribers while you deliver engaging content.","mailpoet")})]}),(0,m.jsxs)("div",{children:[(0,m.jsx)("img",{src:kd.featureImages.icon_3,alt:"",className:"landingpage-feature-icon"}),(0,m.jsx)("strong",{children:(0,Pe.__)("Reach the right people","mailpoet")}),(0,m.jsx)("p",{children:(0,Pe.__)("From the first hello to repeated purchases, send emails to the right people at the right time.","mailpoet")})]})]})]}),(0,m.jsx)("div",{className:"mailpoet-gap"}),(0,m.jsxs)("div",{className:"landingpage-wooCommerce-features",children:[(0,m.jsxs)("div",{className:"mailpoet-content-center",children:[(0,m.jsx)(_t.X,{level:2,children:(0,Pe.__)("MailPoet + WooCommerce","mailpoet")}),(0,m.jsx)("p",{children:(0,Pe.__)("Hyper-relevant content for every stage of the customer’s journey","mailpoet")})]}),(0,m.jsx)("br",{}),(0,m.jsxs)(In.Grid.TwoColumns,{className:"landingpage-wooCommerce-feature-item",children:[(0,m.jsx)("div",{children:(0,m.jsx)("img",{src:kd.wooCommerceFeatureImages.feature_1,alt:(0,Pe.__)("Automate your marketing feature Image","mailpoet"),className:"landingpage-images"})}),(0,m.jsxs)("div",{children:[(0,m.jsx)("strong",{children:(0,Pe.__)("Automate your marketing","mailpoet")}),(0,m.jsx)("p",{children:(0,Pe.__)("Drive sales and build loyalty through automated marketing messages that respond to your customer’s purchase data.","mailpoet")})]})]}),(0,m.jsxs)(In.Grid.TwoColumns,{className:"landingpage-wooCommerce-feature-item",children:[(0,m.jsx)("div",{children:(0,m.jsx)("img",{src:kd.wooCommerceFeatureImages.feature_2,alt:(0,Pe.__)("Measure revenue per email feature Image","mailpoet"),className:"landingpage-images"})}),(0,m.jsxs)("div",{children:[(0,m.jsx)("strong",{children:(0,Pe.__)("Measure revenue per email","mailpoet")}),(0,m.jsx)("p",{children:(0,Pe.__)("See how much revenue your campaign is bringing and make improvements based on auto-generated email statistics.","mailpoet")})]})]}),(0,m.jsxs)(In.Grid.TwoColumns,{className:"landingpage-wooCommerce-feature-item",children:[(0,m.jsx)("div",{children:(0,m.jsx)("img",{src:kd.wooCommerceFeatureImages.feature_3,alt:(0,Pe.__)("Let your brand shine feature Image","mailpoet"),className:"landingpage-images"})}),(0,m.jsxs)("div",{children:[(0,m.jsx)("strong",{children:(0,Pe.__)("Let your brand shine","mailpoet")}),(0,m.jsx)("p",{children:(0,Pe.__)("Use our inbuilt WooCommerce email customizer to design your store's transactional emails and build customer confidence.","mailpoet")})]})]})]})]})}function Cd(){return(0,m.jsx)(l.k.Provider,{value:(0,l.S)(window),children:(0,m.jsxs)("main",{children:[(0,m.jsx)(St.B,{}),(0,m.jsx)(c.Q,{}),(0,m.jsx)(et.A,{color:"#fff"}),(0,m.jsx)(wd,{}),(0,m.jsx)("div",{className:"mailpoet-gap"}),(0,m.jsx)(Nd,{}),(0,m.jsx)("div",{className:"mailpoet-gap"}),(0,m.jsx)(Sd,{}),(0,m.jsx)(jd,{})]})})}Nd.displayName="Landingpage Content",Cd.displayName="Landingpage";const Id=document.getElementById("mailpoet_landingpage_container");Id&&((0,o.registerTranslations)(),s.render((0,m.jsx)(o.ErrorBoundary,{children:(0,m.jsx)(Cd,{})}),Id)),n(58731)},58731:()=>{document.addEventListener("DOMContentLoaded",(function(){window.mailpoet_track_wizard_loaded_via_woocommerce&&(window.MailPoet.trackEvent("User opened the MailPoet setup task in WooCommerce > Home",{"WooCommerce version":window.mailpoet_woocommerce_version}),window.MailPoet.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"settings",action:"delete",data:"send_event_that_wizard_was_loaded_via_woocommerce"}))}))},29514:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(t,n){var a,i=n||{};if("formatting"===(i.context?String(i.context):"standalone")&&e.formattingValues){var s=e.defaultFormattingWidth||e.defaultWidth,r=i.width?String(i.width):s;a=e.formattingValues[r]||e.formattingValues[s]}else{var o=e.defaultWidth,l=i.width?String(i.width):e.defaultWidth;a=e.values[l]||e.values[o]}return a[e.argumentCallback?e.argumentCallback(t):t]}},e.exports=t.default},71248:(e,t,n)=>{var a={EventEmitter:n(71793),EmitterSubscription:n(10777)};e.exports=a},71793:(e,t,n)=>{"use strict";var a=n(10777),i=n(31073),s=n(53101),r=n(73928),o=function(){function e(){this._subscriber=new i,this._currentSubscription=null}var t=e.prototype;return t.addListener=function(e,t,n){return this._subscriber.addSubscription(e,new a(this._subscriber,t,n))},t.once=function(e,t,n){var a=this;return this.addListener(e,(function(){a.removeCurrentListener(),t.apply(n,arguments)}))},t.removeAllListeners=function(e){this._subscriber.removeAllSubscriptions(e)},t.removeCurrentListener=function(){this._currentSubscription||s(!1),this._subscriber.removeSubscription(this._currentSubscription)},t.listeners=function(e){var t=this._subscriber.getSubscriptionsForType(e);return t?t.filter(r.thatReturnsTrue).map((function(e){return e.listener})):[]},t.emit=function(e){var t=this._subscriber.getSubscriptionsForType(e);if(t){for(var n=Object.keys(t),a=0;a<n.length;a++){var i=t[n[a]];i&&(this._currentSubscription=i,this.__emitToSubscription.apply(this,[i].concat(Array.prototype.slice.call(arguments))))}this._currentSubscription=null}},t.__emitToSubscription=function(e,t){var n=Array.prototype.slice.call(arguments,2);e.listener.apply(e.context,n)},e}();e.exports=o},10777:(e,t,n)=>{"use strict";var a=function(e){var t,n;function a(t,n,a){var i;return(i=e.call(this,t)||this).listener=n,i.context=a,i}return n=e,(t=a).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n,a}(n(56447));e.exports=a},56447:e=>{"use strict";var t=function(){function e(e){this.subscriber=e}return e.prototype.remove=function(){this.subscriber&&(this.subscriber.removeSubscription(this),this.subscriber=null)},e}();e.exports=t},31073:(e,t,n)=>{"use strict";var a=n(53101),i=function(){function e(){this._subscriptionsForType={},this._currentSubscription=null}var t=e.prototype;return t.addSubscription=function(e,t){t.subscriber!==this&&a(!1),this._subscriptionsForType[e]||(this._subscriptionsForType[e]=[]);var n=this._subscriptionsForType[e].length;return this._subscriptionsForType[e].push(t),t.eventType=e,t.key=n,t},t.removeAllSubscriptions=function(e){void 0===e?this._subscriptionsForType={}:delete this._subscriptionsForType[e]},t.removeSubscription=function(e){var t=e.eventType,n=e.key,a=this._subscriptionsForType[t];a&&delete a[n]},t.getSubscriptionsForType=function(e){return this._subscriptionsForType[e]},e}();e.exports=i},35245:e=>{"use strict";var t=!("undefined"==typeof window||!window.document||!window.document.createElement),n={canUseDOM:t,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:t&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:t&&!!window.screen,isInWorker:!t};e.exports=n},13003:(e,t,n)=>{"use strict";var a=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];void 0!==n.g.Int32Array&&(a=new Int32Array(a)),e.exports=function(e){for(var t=-1,n=0,i=e.length;n<i;n++)t=t>>>8^a[255&(t^e.charCodeAt(n))];return~t}},73928:e=>{"use strict";function t(e){return function(){return e}}var n=function(){};n.thatReturns=t,n.thatReturnsFalse=t(!1),n.thatReturnsTrue=t(!0),n.thatReturnsNull=t(null),n.thatReturnsThis=function(){return this},n.thatReturnsArgument=function(e){return e},e.exports=n},53101:e=>{"use strict";e.exports=function(e,t){for(var n=arguments.length,a=new Array(n>2?n-2:0),i=2;i<n;i++)a[i-2]=arguments[i];if(!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var r=0;(s=new Error(t.replace(/%s/g,(function(){return String(a[r++])})))).name="Invariant Violation"}throw s.framesToPop=1,s}}},71906:function(e,t){var n,a;n=function e(){"use strict";var t="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==t?t:{},n=!t.document&&!!t.postMessage,a=n&&/blob:/i.test((t.location||{}).protocol),i={},s=0,r={parse:function(n,a){var o=(a=a||{}).dynamicTyping||!1;if(y(o)&&(a.dynamicTypingFunction=o,o={}),a.dynamicTyping=o,a.transform=!!y(a.transform)&&a.transform,a.worker&&r.WORKERS_SUPPORTED){var l=function(){if(!r.WORKERS_SUPPORTED)return!1;var n,a,o=(n=t.URL||t.webkitURL||null,a=e.toString(),r.BLOB_URL||(r.BLOB_URL=n.createObjectURL(new Blob(["(",a,")();"],{type:"text/javascript"})))),l=new t.Worker(o);return l.onmessage=g,l.id=s++,i[l.id]=l}();return l.userStep=a.step,l.userChunk=a.chunk,l.userComplete=a.complete,l.userError=a.error,a.step=y(a.step),a.chunk=y(a.chunk),a.complete=y(a.complete),a.error=y(a.error),delete a.worker,void l.postMessage({input:n,config:a,workerId:l.id})}var m=null;return r.NODE_STREAM_INPUT,"string"==typeof n?m=a.download?new c(a):new p(a):!0===n.readable&&y(n.read)&&y(n.on)?m=new u(a):(t.File&&n instanceof File||n instanceof Object)&&(m=new d(a)),m.stream(n)},unparse:function(e,t){var n=!1,a=!0,i=",",s="\r\n",o='"',l=o+o,c=!1,d=null,p=!1;!function(){if("object"==typeof t){if("string"!=typeof t.delimiter||r.BAD_DELIMITERS.filter((function(e){return-1!==t.delimiter.indexOf(e)})).length||(i=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&&(a=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)&&(p=t.escapeFormulae instanceof RegExp?t.escapeFormulae:/^[=+\-@\t\r].*$/)}}();var u=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 r="";"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&&a){for(var c=0;c<e.length;c++)0<c&&(r+=i),r+=f(e[c],c);0<t.length&&(r+=s)}for(var d=0;d<t.length;d++){var p=o?e.length:t[d].length,u=!1,m=o?0===Object.keys(t[d]).length:0===t[d].length;if(n&&!o&&(u="greedy"===n?""===t[d].join("").trim():1===t[d].length&&0===t[d][0].length),"greedy"===n&&o){for(var h=[],g=0;g<p;g++){var x=l?e[g]:g;h.push(t[d][x])}u=""===h.join("").trim()}if(!u){for(var _=0;_<p;_++){0<_&&!m&&(r+=i);var b=o&&l?e[_]:_;r+=f(t[d][b],_)}d<t.length-1&&(!n||0<p&&!m)&&(r+=s)}}return r}function f(e,t){if(null==e)return"";if(e.constructor===Date)return JSON.stringify(e).slice(1,25);var a=!1;p&&"string"==typeof e&&p.test(e)&&(e="'"+e,a=!0);var s=e.toString().replace(u,l);return(a=a||!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,r.BAD_DELIMITERS)||-1<s.indexOf(i)||" "===s.charAt(0)||" "===s.charAt(s.length-1))?o+s+o:s}}};if(r.RECORD_SEP=String.fromCharCode(30),r.UNIT_SEP=String.fromCharCode(31),r.BYTE_ORDER_MARK="\ufeff",r.BAD_DELIMITERS=["\r","\n",'"',r.BYTE_ORDER_MARK],r.WORKERS_SUPPORTED=!n&&!!t.Worker,r.NODE_STREAM_INPUT=1,r.LocalChunkSize=10485760,r.RemoteChunkSize=5242880,r.DefaultDelimiter=",",r.Parser=f,r.ParserHandle=m,r.NetworkStreamer=c,r.FileStreamer=d,r.StringStreamer=p,r.ReadableStreamStreamer=u,t.jQuery){var o=t.jQuery;o.fn.parse=function(e){var n=e.config||{},a=[];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 i=0;i<this.files.length;i++)a.push({file:this.files[i],inputElem:this,instanceConfig:o.extend({},n)})})),i(),this;function i(){if(0!==a.length){var t,n,i,l=a[0];if(y(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,i=c.reason,void(y(e.error)&&e.error({name:"AbortError"},t,n,i));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){y(d)&&d(e,l.file,l.inputElem),s()},r.parse(l.file,l.instanceConfig)}else y(e.complete)&&e.complete()}function s(){a.splice(0,1),i()}}}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&&y(this._config.beforeFirstChunk)){var i=this._config.beforeFirstChunk(e);void 0!==i&&(e=i)}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(a)t.postMessage({results:o,workerId:r.WORKER_ID,finished:c});else if(y(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||!y(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){y(this._config.error)?this._config.error(e):a&&this._config.error&&t.postMessage({workerId:r.WORKER_ID,error:e,finished:!1})}}function c(e){var t;(e=e||{}).chunkSize||(e.chunkSize=r.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=v(this._chunkLoaded,this),t.onerror=v(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!n),this._config.downloadRequestHeaders){var e=this._config.downloadRequestHeaders;for(var a in e)t.setRequestHeader(a,e[a])}if(this._config.chunkSize){var i=this._start+this._config.chunkSize-1;t.setRequestHeader("Range","bytes="+this._start+"-"+i)}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=r.LocalChunkSize),l.call(this,e);var a="undefined"!=typeof FileReader;this.stream=function(e){this._input=e,n=e.slice||e.webkitSlice||e.mozSlice,a?((t=new FileReader).onload=v(this._chunkLoaded,this),t.onerror=v(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 i=Math.min(this._start+this._config.chunkSize,this._input.size);e=n.call(e,this._start,i)}var s=t.readAsText(e,this._config.encoding);a||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 p(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 u(e){l.call(this,e=e||{});var t=[],n=!0,a=!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(){a&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):n=!0},this._streamData=v((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=v((function(e){this._streamCleanUp(),this._sendError(e)}),this),this._streamEnd=v((function(){this._streamCleanUp(),a=!0,this._streamData("")}),this),this._streamCleanUp=v((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,a,i=Math.pow(2,53),s=-i,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,p=0,u=!1,m=!1,g=[],x={data:[],errors:[],meta:{}};if(y(e.step)){var _=e.step;e.step=function(t){if(x=t,j())w();else{if(w(),0===x.data.length)return;d+=t.data.length,e.preview&&d>e.preview?n.abort():(x.data=x.data[0],_(x,c))}}}function v(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function w(){return x&&a&&(k("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+r.DefaultDelimiter+"'"),a=!1),e.skipEmptyLines&&(x.data=x.data.filter((function(e){return!v(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){y(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 a,i=e.header?{}:[];for(a=0;a<t.length;a++){var s=a,r=t[a];e.header&&(s=a>=g.length?"__parsed_extra":g[a]),e.transform&&(r=e.transform(r,s)),r=S(s,r),"__parsed_extra"===s?(i[s]=i[s]||[],i[s].push(r)):i[s]=r}return e.header&&(a>g.length?k("FieldMismatch","TooManyFields","Too many fields: expected "+g.length+" fields but parsed "+a,p+n):a<g.length&&k("FieldMismatch","TooFewFields","Too few fields: expected "+g.length+" fields but parsed "+a,p+n)),i}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),p+=n,x}()}function j(){return e.header&&0===g.length}function S(t,n){return a=t,e.dynamicTypingFunction&&void 0===e.dynamicTyping[a]&&(e.dynamicTyping[a]=e.dynamicTypingFunction(a)),!0===(e.dynamicTyping[a]||e.dynamicTyping)?"true"===n||"TRUE"===n||"false"!==n&&"FALSE"!==n&&(function(e){if(o.test(e)){var t=parseFloat(e);if(s<t&&t<i)return!0}return!1}(n)?parseFloat(n):l.test(n)?new Date(n):""===n?null:n):n;var a}function k(e,t,n,a){var i={type:e,code:t,message:n};void 0!==a&&(i.row=a),x.errors.push(i)}this.parse=function(i,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"),a=(e=e.replace(n,"")).split("\r"),i=e.split("\n"),s=1<i.length&&i[0].length<a[0].length;if(1===a.length||s)return"\n";for(var r=0,o=0;o<a.length;o++)"\n"===a[o][0]&&r++;return r>=a.length/2?"\r\n":"\r"}(i,l)),a=!1,e.delimiter)y(e.delimiter)&&(e.delimiter=e.delimiter(i),x.meta.delimiter=e.delimiter);else{var c=function(t,n,a,i,s){var o,l,c,d;s=s||[",","\t","|",";",r.RECORD_SEP,r.UNIT_SEP];for(var p=0;p<s.length;p++){var u=s[p],m=0,h=0,g=0;c=void 0;for(var x=new f({comments:i,delimiter:u,newline:n,preview:10}).parse(t),_=0;_<x.data.length;_++)if(a&&v(x.data[_]))g++;else{var b=x.data[_].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=u,d=h)}return{successful:!!(e.delimiter=o),bestDelimiter:o}}(i,e.newline,e.skipEmptyLines,e.comments,e.delimitersToGuess);c.successful?e.delimiter=c.bestDelimiter:(a=!0,e.delimiter=r.DefaultDelimiter),x.meta.delimiter=e.delimiter}var d=b(e);return e.preview&&e.header&&d.preview++,t=i,n=new f(d),x=n.parse(t,s,o),w(),u?{meta:{paused:!0}}:x||{meta:{paused:!1}}},this.paused=function(){return u},this.pause=function(){u=!0,n.abort(),t=y(e.chunk)?"":t.substring(n.getCharIndex())},this.resume=function(){c.streamer._halted?(u=!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,y(e.complete)&&e.complete(x),t=""}}function h(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function f(e){var t,n=(e=e||{}).delimiter,a=e.newline,i=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<r.BAD_DELIMITERS.indexOf(n))&&(n=","),i===n)throw new Error("Comment character same as delimiter");!0===i?i="#":("string"!=typeof i||-1<r.BAD_DELIMITERS.indexOf(i))&&(i=!1),"\n"!==a&&"\r"!==a&&"\r\n"!==a&&(a="\n");var d=0,p=!1;this.parse=function(e,r,u){if("string"!=typeof e)throw new Error("Input must be a string");var m=e.length,f=n.length,g=a.length,x=i.length,_=y(s),b=[],v=[],w=[],j=d=0;if(!e)return L();if(l||!1!==l&&-1===e.indexOf(t)){for(var S=e.split(a),k=0;k<S.length;k++){if(w=S[k],d+=w.length,k!==S.length-1)d+=a.length;else if(u)return L();if(!i||w.substring(0,x)!==i){if(_){if(b=[],O(w.split(n)),M(),p)return L()}else O(w.split(n));if(o&&o<=k)return b=b.slice(0,o),L(!0)}}return L()}for(var N=e.indexOf(n,d),C=e.indexOf(a,d),I=new RegExp(h(c)+h(t),"g"),T=e.indexOf(t,d);;)if(e[d]!==t)if(i&&0===w.length&&e.substring(d,d+x)===i){if(-1===C)return L();d=C+g,C=e.indexOf(a,d),N=e.indexOf(n,d)}else if(-1!==N&&(N<C||-1===C))w.push(e.substring(d,N)),d=N+f,N=e.indexOf(n,d);else{if(-1===C)break;if(w.push(e.substring(d,C)),P(C+g),_&&(M(),p))return L();if(o&&b.length>=o)return L(!0)}else for(T=d,d++;;){if(-1===(T=e.indexOf(t,T+1)))return u||v.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:b.length,index:d}),R();if(T===m-1)return R(e.substring(d,T).replace(I,t));if(t!==c||e[T+1]!==c){if(t===c||0===T||e[T-1]!==c){-1!==N&&N<T+1&&(N=e.indexOf(n,T+1)),-1!==C&&C<T+1&&(C=e.indexOf(a,T+1));var E=A(-1===C?N:Math.min(N,C));if(e.substr(T+1+E,f)===n){w.push(e.substring(d,T).replace(I,t)),e[d=T+1+E+f]!==t&&(T=e.indexOf(t,d)),N=e.indexOf(n,d),C=e.indexOf(a,d);break}var D=A(C);if(e.substring(T+1+D,T+1+D+g)===a){if(w.push(e.substring(d,T).replace(I,t)),P(T+1+D+g),N=e.indexOf(n,d),T=e.indexOf(t,d),_&&(M(),p))return L();if(o&&b.length>=o)return L(!0);break}v.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:b.length,index:d}),T++}}else T++}return R();function O(e){b.push(e),j=d}function A(t){var n=0;if(-1!==t){var a=e.substring(T+1,t);a&&""===a.trim()&&(n=a.length)}return n}function R(t){return u||(void 0===t&&(t=e.substring(d)),w.push(t),d=m,O(w),_&&M()),L()}function P(t){d=t,O(w),w=[],C=e.indexOf(a,d)}function L(e){return{data:b,errors:v,meta:{delimiter:n,linebreak:a,aborted:p,truncated:!!e,cursor:j+(r||0)}}}function M(){s(L()),b=[],v=[]}},this.abort=function(){p=!0},this.getCharIndex=function(){return d}}function g(e){var t=e.data,n=i[t.workerId],a=!1;if(t.error)n.userError(t.error,t.file);else if(t.results&&t.results.data){var s={abort:function(){a=!0,x(t.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:_,resume:_};if(y(n.userStep)){for(var r=0;r<t.results.data.length&&(n.userStep({data:t.results.data[r],errors:t.results.errors,meta:t.results.meta},s),!a);r++);delete t.results}else y(n.userChunk)&&(n.userChunk(t.results,s,t.file),delete t.results)}t.finished&&!a&&x(t.workerId,t.results)}function x(e,t){var n=i[e];y(n.userComplete)&&n.userComplete(t),n.terminate(),delete i[e]}function _(){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 v(e,t){return function(){e.apply(t,arguments)}}function y(e){return"function"==typeof e}return a&&(t.onmessage=function(e){var n=e.data;if(void 0===r.WORKER_ID&&n&&(r.WORKER_ID=n.workerId),"string"==typeof n.input)t.postMessage({workerId:r.WORKER_ID,results:r.parse(n.input,n.config),finished:!0});else if(t.File&&n.input instanceof File||n.input instanceof Object){var a=r.parse(n.input,n.config);a&&t.postMessage({workerId:r.WORKER_ID,results:a,finished:!0})}}),(c.prototype=Object.create(l.prototype)).constructor=c,(d.prototype=Object.create(l.prototype)).constructor=d,(p.prototype=Object.create(p.prototype)).constructor=p,(u.prototype=Object.create(l.prototype)).constructor=u,r},void 0===(a=n.apply(t,[]))||(e.exports=a)},81677:function(e,t,n){!function(e,t,n,a,i,s,r,o,l,c,d,p,u,m,h,f,g,x,_,b,v,y,w,j,S,k,N,C,I,T,E,D,O,A,R,P,L,M,F,B,q,W,V,$,U,Y,H,z,Z,K,G,Q,X,J,ee,te,ne,ae,ie,se,re,oe,le){"use strict";function ce(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var de=ce(t),pe=ce(a),ue=ce(i),me=ce(s),he=ce(r),fe=ce(o),ge=ce(l),xe=ce(c),_e=ce(d),be=ce(p),ve=ce(u),ye=ce(f),we=ce(g),je=ce(x),Se=ce(_),ke=ce(b),Ne=ce(v),Ce=ce(y),Ie=ce(w),Te=ce(j),Ee=ce(S),De=ce(k),Oe=ce(N),Ae=ce(C),Re=ce(I),Pe=ce(T),Le=ce(E),Me=ce(D),Fe=ce(O),Be=ce(A),qe=ce(R),We=ce(P),Ve=ce(L),$e=ce(M),Ue=ce(F),Ye=ce(q),He=ce(W),ze=ce(V),Ze=ce($),Ke=ce(U),Ge=ce(Y),Qe=ce(H),Xe=ce(K),Je=ce(G),et=ce(Q),tt=ce(X),nt=ce(J),at=ce(ee),it=ce(te),st=ce(ne),rt=ce(ae),ot=ce(ie),lt=ce(se),ct=ce(re),dt=ce(oe);function pt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function ut(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?pt(Object(n),!0).forEach((function(t){xt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pt(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 a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}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 _t(){return(_t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}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&&yt(e,t)}function vt(e){return(vt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function yt(e,t){return(yt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function wt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function jt(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,a=vt(e);if(t){var i=vt(this).constructor;n=Reflect.construct(a,arguments,i)}else n=a.apply(this,arguments);return function(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 wt(e)}(this,n)}}function St(e){return function(e){if(Array.isArray(e))return kt(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 kt(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)?kt(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 kt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function Nt(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 Ct(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 It={p:Ct,P:function(e,t){var n,a=e.match(/(P+)(p+)?/)||[],i=a[1],s=a[2];if(!s)return Nt(e,t);switch(i){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}}",Nt(i,t)).replace("{{time}}",Ct(s,t))}},Tt=12,Et=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;function Dt(e){var t=e?"string"==typeof e||e instanceof String?lt.default(e):rt.default(e):new Date;return Ot(t)?t:null}function Ot(e,t){return t=t||new Date("1/1/1000"),me.default(e)&&!it.default(e,t)}function At(e,t,n){if("en"===n)return he.default(e,t,{awareOfUnicodeTokens:!0});var a=Ht(n);return n&&!a&&console.warn('A locale object was not found for the provided string ["'.concat(n,'"].')),!a&&Yt()&&Ht(Yt())&&(a=Ht(Yt())),he.default(e,t,{locale:a||null,awareOfUnicodeTokens:!0})}function Rt(e,t){var n=t.dateFormat,a=t.locale;return e&&At(e,Array.isArray(n)?n[0]:n,a)||""}function Pt(e,t){var n=t.hour,a=void 0===n?0:n,i=t.minute,s=void 0===i?0:i,r=t.second,o=void 0===r?0:r;return Me.default(Le.default(Pe.default(e,o),s),a)}function Lt(e,t,n){var a=Ht(t||Yt());return ze.default(e,{locale:a,weekStartsOn:n})}function Mt(e){return Ze.default(e)}function Ft(e){return Ge.default(e)}function Bt(e,t){return e&&t?tt.default(e,t):!e&&!t}function qt(e,t){return e&&t?et.default(e,t):!e&&!t}function Wt(e,t){return e&&t?nt.default(e,t):!e&&!t}function Vt(e,t){return e&&t?Je.default(e,t):!e&&!t}function $t(e,t){return e&&t?Xe.default(e,t):!e&&!t}function Ut(e,t,n){var a,i=He.default(t),s=Qe.default(n);try{a=st.default(e,{start:i,end:s})}catch(e){a=!1}return a}function Yt(){return("undefined"!=typeof window?window:globalThis).__localeId__}function Ht(e){if("string"==typeof e){var t="undefined"!=typeof window?window:globalThis;return t.__localeData__?t.__localeData__[e]:null}return e}function zt(e,t){return At(Fe.default(Dt(),e),"LLLL",t)}function Zt(e,t){return At(Fe.default(Dt(),e),"LLL",t)}function Kt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,a=t.maxDate,i=t.excludeDates,s=t.excludeDateIntervals,r=t.includeDates,o=t.includeDateIntervals,l=t.filterDate;return nn(e,{minDate:n,maxDate:a})||i&&i.some((function(t){return Vt(e,t)}))||s&&s.some((function(t){var n=t.start,a=t.end;return st.default(e,{start:n,end:a})}))||r&&!r.some((function(t){return Vt(e,t)}))||o&&!o.some((function(t){var n=t.start,a=t.end;return st.default(e,{start:n,end:a})}))||l&&!l(Dt(e))||!1}function Gt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.excludeDates,a=t.excludeDateIntervals;return a&&a.length>0?a.some((function(t){var n=t.start,a=t.end;return st.default(e,{start:n,end:a})})):n&&n.some((function(t){return Vt(e,t)}))||!1}function Qt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,a=t.maxDate,i=t.excludeDates,s=t.includeDates,r=t.filterDate;return nn(e,{minDate:n,maxDate:a})||i&&i.some((function(t){return qt(e,t)}))||s&&!s.some((function(t){return qt(e,t)}))||r&&!r(Dt(e))||!1}function Xt(e,t,n,a){var i=Ae.default(e),s=De.default(e),r=Ae.default(t),o=De.default(t),l=Ae.default(a);return i===r&&i===l?s<=n&&n<=o:i<r?l===i&&s<=n||l===r&&o>=n||l<r&&l>i:void 0}function Jt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,a=t.maxDate,i=t.excludeDates,s=t.includeDates,r=t.filterDate;return nn(e,{minDate:n,maxDate:a})||i&&i.some((function(t){return Wt(e,t)}))||s&&!s.some((function(t){return Wt(e,t)}))||r&&!r(Dt(e))||!1}function en(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,a=t.maxDate;return nn(new Date(e,0,1),{minDate:n,maxDate:a})||!1}function tn(e,t,n,a){var i=Ae.default(e),s=Oe.default(e),r=Ae.default(t),o=Oe.default(t),l=Ae.default(a);return i===r&&i===l?s<=n&&n<=o:i<r?l===i&&s<=n||l===r&&o>=n||l<r&&l>i:void 0}function nn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,a=t.maxDate;return n&&$e.default(e,n)<0||a&&$e.default(e,a)>0}function an(e,t){return t.some((function(t){return Ce.default(t)===Ce.default(e)&&Ne.default(t)===Ne.default(e)}))}function sn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.excludeTimes,a=t.includeTimes,i=t.filterTime;return n&&an(e,n)||a&&!an(e,a)||i&&!i(e)||!1}function rn(e,t){var n=t.minTime,a=t.maxTime;if(!n||!a)throw new Error("Both minTime and maxTime props required");var i,s=Dt(),r=Me.default(Le.default(s,Ne.default(e)),Ce.default(e)),o=Me.default(Le.default(s,Ne.default(n)),Ce.default(n)),l=Me.default(Le.default(s,Ne.default(a)),Ce.default(a));try{i=!st.default(r,{start:o,end:l})}catch(e){i=!1}return i}function on(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,a=t.includeDates,i=je.default(e,1);return n&&Ue.default(n,i)>0||a&&a.every((function(e){return Ue.default(e,i)>0}))||!1}function ln(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.maxDate,a=t.includeDates,i=be.default(e,1);return n&&Ue.default(i,n)>0||a&&a.every((function(e){return Ue.default(i,e)>0}))||!1}function cn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,a=t.includeDates,i=Se.default(e,1);return n&&Ye.default(n,i)>0||a&&a.every((function(e){return Ye.default(e,i)>0}))||!1}function dn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.maxDate,a=t.includeDates,i=ve.default(e,1);return n&&Ye.default(i,n)>0||a&&a.every((function(e){return Ye.default(i,e)>0}))||!1}function pn(e){var t=e.minDate,n=e.includeDates;if(n&&t){var a=n.filter((function(e){return $e.default(e,t)>=0}));return We.default(a)}return n?We.default(n):t}function un(e){var t=e.maxDate,n=e.includeDates;if(n&&t){var a=n.filter((function(e){return $e.default(e,t)<=0}));return Ve.default(a)}return n?Ve.default(n):t}function mn(){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,a=0,i=e.length;a<i;a++){var s=e[a];if(ue.default(s)){var r=At(s,"MM.dd.yyyy"),o=n.get(r)||[];o.includes(t)||(o.push(t),n.set(r,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 p=0,u=d.length;p<u;p++){var m=At(d[p],"MM.dd.yyyy"),h=n.get(m)||[];h.includes(c)||(h.push(c),n.set(m,h))}}}return n}function hn(e,t,n,a,i){for(var s=i.length,r=[],o=0;o<s;o++){var l=fe.default(ge.default(e,Ce.default(i[o])),Ne.default(i[o])),c=fe.default(e,(n+1)*a);at.default(l,t)&&it.default(l,c)&&r.push(i[o])}return r}function fn(e){return e<10?"0".concat(e):"".concat(e)}function gn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Tt,n=Math.ceil(Ae.default(e)/t)*t;return{startPeriod:n-(t-1),endPeriod:n}}function xn(e,t,n,a){for(var i=[],s=0;s<2*t+1;s++){var r=e+t-s,o=!0;n&&(o=Ae.default(n)<=r),a&&o&&(o=Ae.default(a)>=r),o&&i.push(r)}return i}var _n=function(e){bt(a,e);var n=jt(a);function a(e){var i;ht(this,a),xt(wt(i=n.call(this,e)),"renderOptions",(function(){var e=i.props.year,t=i.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:i.onChange.bind(wt(i),t),"aria-selected":e===t?"true":void 0},e===t?de.default.createElement("span",{className:"react-datepicker__year-option--selected"},"✓"):"",t)})),n=i.props.minDate?Ae.default(i.props.minDate):null,a=i.props.maxDate?Ae.default(i.props.maxDate):null;return a&&i.state.yearsList.find((function(e){return e===a}))||t.unshift(de.default.createElement("div",{className:"react-datepicker__year-option",key:"upcoming",onClick:i.incrementYears},de.default.createElement("a",{className:"react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-upcoming"}))),n&&i.state.yearsList.find((function(e){return e===n}))||t.push(de.default.createElement("div",{className:"react-datepicker__year-option",key:"previous",onClick:i.decrementYears},de.default.createElement("a",{className:"react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-previous"}))),t})),xt(wt(i),"onChange",(function(e){i.props.onChange(e)})),xt(wt(i),"handleClickOutside",(function(){i.props.onCancel()})),xt(wt(i),"shiftYears",(function(e){var t=i.state.yearsList.map((function(t){return t+e}));i.setState({yearsList:t})})),xt(wt(i),"incrementYears",(function(){return i.shiftYears(1)})),xt(wt(i),"decrementYears",(function(){return i.shiftYears(-1)}));var s=e.yearDropdownItemNumber,r=e.scrollableYearDropdown,o=s||(r?10:5);return i.state={yearsList:xn(i.props.year,o,i.props.minDate,i.props.maxDate)},i.dropdownRef=t.createRef(),i}return gt(a,[{key:"componentDidMount",value:function(){var e=this.dropdownRef.current;e&&(e.scrollTop=e.scrollHeight/2-e.clientHeight/2)}},{key:"render",value:function(){var e=pe.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())}}]),a}(de.default.Component),bn=ct.default(_n),vn=function(e){bt(n,e);var t=jt(n);function n(){var e;ht(this,n);for(var a=arguments.length,i=new Array(a),s=0;s<a;s++)i[s]=arguments[s];return xt(wt(e=t.call.apply(t,[this].concat(i))),"state",{dropdownVisible:!1}),xt(wt(e),"renderSelectOptions",(function(){for(var t=e.props.minDate?Ae.default(e.props.minDate):1900,n=e.props.maxDate?Ae.default(e.props.maxDate):2100,a=[],i=t;i<=n;i++)a.push(de.default.createElement("option",{key:i,value:i},i));return a})),xt(wt(e),"onSelectChange",(function(t){e.onChange(t.target.value)})),xt(wt(e),"renderSelectMode",(function(){return de.default.createElement("select",{value:e.props.year,className:"react-datepicker__year-select",onChange:e.onSelectChange},e.renderSelectOptions())})),xt(wt(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(wt(e),"renderDropdown",(function(){return de.default.createElement(bn,{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(wt(e),"renderScrollMode",(function(){var t=e.state.dropdownVisible,n=[e.renderReadView(!t)];return t&&n.unshift(e.renderDropdown()),n})),xt(wt(e),"onChange",(function(t){e.toggleDropdown(),t!==e.props.year&&e.props.onChange(t)})),xt(wt(e),"toggleDropdown",(function(t){e.setState({dropdownVisible:!e.state.dropdownVisible},(function(){e.props.adjustDateOnChange&&e.handleYearChange(e.props.date,t)}))})),xt(wt(e),"handleYearChange",(function(t,n){e.onSelect(t,n),e.setOpen()})),xt(wt(e),"onSelect",(function(t,n){e.props.onSelect&&e.props.onSelect(t,n)})),xt(wt(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),yn=function(e){bt(n,e);var t=jt(n);function n(){var e;ht(this,n);for(var a=arguments.length,i=new Array(a),s=0;s<a;s++)i[s]=arguments[s];return xt(wt(e=t.call.apply(t,[this].concat(i))),"isSelectedMonth",(function(t){return e.props.month===t})),xt(wt(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(wt(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(wt(e),"onChange",(function(t){return e.props.onChange(t)})),xt(wt(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),wn=ct.default(yn),jn=function(e){bt(n,e);var t=jt(n);function n(){var e;ht(this,n);for(var a=arguments.length,i=new Array(a),s=0;s<a;s++)i[s]=arguments[s];return xt(wt(e=t.call.apply(t,[this].concat(i))),"state",{dropdownVisible:!1}),xt(wt(e),"renderSelectOptions",(function(e){return e.map((function(e,t){return de.default.createElement("option",{key:t,value:t},e)}))})),xt(wt(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(wt(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(wt(e),"renderDropdown",(function(t){return de.default.createElement(wn,{key:"dropdown",month:e.props.month,monthNames:t,onChange:e.onChange,onCancel:e.toggleDropdown})})),xt(wt(e),"renderScrollMode",(function(t){var n=e.state.dropdownVisible,a=[e.renderReadView(!n,t)];return n&&a.unshift(e.renderDropdown(t)),a})),xt(wt(e),"onChange",(function(t){e.toggleDropdown(),t!==e.props.month&&e.props.onChange(t)})),xt(wt(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 Zt(e,t.props.locale)}:function(e){return zt(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 Sn(e,t){for(var n=[],a=Mt(e),i=Mt(t);!at.default(a,i);)n.push(Dt(a)),a=be.default(a,1);return n}var kn=function(e){bt(n,e);var t=jt(n);function n(e){var a;return ht(this,n),xt(wt(a=t.call(this,e)),"renderOptions",(function(){return a.state.monthYearsList.map((function(e){var t=Re.default(e),n=Bt(a.props.date,e)&&qt(a.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:a.onChange.bind(wt(a),t),"aria-selected":n?"true":void 0},n?de.default.createElement("span",{className:"react-datepicker__month-year-option--selected"},"✓"):"",At(e,a.props.dateFormat,a.props.locale))}))})),xt(wt(a),"onChange",(function(e){return a.props.onChange(e)})),xt(wt(a),"handleClickOutside",(function(){a.props.onCancel()})),a.state={monthYearsList:Sn(a.props.minDate,a.props.maxDate)},a}return gt(n,[{key:"render",value:function(){var e=pe.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),Nn=ct.default(kn),Cn=function(e){bt(n,e);var t=jt(n);function n(){var e;ht(this,n);for(var a=arguments.length,i=new Array(a),s=0;s<a;s++)i[s]=arguments[s];return xt(wt(e=t.call.apply(t,[this].concat(i))),"state",{dropdownVisible:!1}),xt(wt(e),"renderSelectOptions",(function(){for(var t=Mt(e.props.minDate),n=Mt(e.props.maxDate),a=[];!at.default(t,n);){var i=Re.default(t);a.push(de.default.createElement("option",{key:i,value:i},At(t,e.props.dateFormat,e.props.locale))),t=be.default(t,1)}return a})),xt(wt(e),"onSelectChange",(function(t){e.onChange(t.target.value)})),xt(wt(e),"renderSelectMode",(function(){return de.default.createElement("select",{value:Re.default(Mt(e.props.date)),className:"react-datepicker__month-year-select",onChange:e.onSelectChange},e.renderSelectOptions())})),xt(wt(e),"renderReadView",(function(t){var n=At(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(wt(e),"renderDropdown",(function(){return de.default.createElement(Nn,{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(wt(e),"renderScrollMode",(function(){var t=e.state.dropdownVisible,n=[e.renderReadView(!t)];return t&&n.unshift(e.renderDropdown()),n})),xt(wt(e),"onChange",(function(t){e.toggleDropdown();var n=Dt(parseInt(t));Bt(e.props.date,n)&&qt(e.props.date,n)||e.props.onChange(n)})),xt(wt(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),In=function(e){bt(n,e);var t=jt(n);function n(){var e;ht(this,n);for(var a=arguments.length,i=new Array(a),s=0;s<a;s++)i[s]=arguments[s];return xt(wt(e=t.call.apply(t,[this].concat(i))),"dayEl",de.default.createRef()),xt(wt(e),"handleClick",(function(t){!e.isDisabled()&&e.props.onClick&&e.props.onClick(t)})),xt(wt(e),"handleMouseEnter",(function(t){!e.isDisabled()&&e.props.onMouseEnter&&e.props.onMouseEnter(t)})),xt(wt(e),"handleOnKeyDown",(function(t){" "===t.key&&(t.preventDefault(),t.key="Enter"),e.props.handleOnKeyDown(t)})),xt(wt(e),"isSameDay",(function(t){return Vt(e.props.day,t)})),xt(wt(e),"isKeyboardSelected",(function(){return!e.props.disabledKeyboardNavigation&&!e.isSameDay(e.props.selected)&&e.isSameDay(e.props.preSelection)})),xt(wt(e),"isDisabled",(function(){return Kt(e.props.day,e.props)})),xt(wt(e),"isExcluded",(function(){return Gt(e.props.day,e.props)})),xt(wt(e),"getHighLightedClass",(function(t){var n=e.props,a=n.day,i=n.highlightDates;if(!i)return!1;var s=At(a,"MM.dd.yyyy");return i.get(s)})),xt(wt(e),"isInRange",(function(){var t=e.props,n=t.day,a=t.startDate,i=t.endDate;return!(!a||!i)&&Ut(n,a,i)})),xt(wt(e),"isInSelectingRange",(function(){var t,n=e.props,a=n.day,i=n.selectsStart,s=n.selectsEnd,r=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!(!(i||s||r)||!d||!o&&e.isDisabled())&&(i&&c&&(it.default(d,c)||$t(d,c))?Ut(a,d,c):(s&&l&&(at.default(d,l)||$t(d,l))||!(!r||!l||c||!at.default(d,l)&&!$t(d,l)))&&Ut(a,l,d))})),xt(wt(e),"isSelectingRangeStart",(function(){var t;if(!e.isInSelectingRange())return!1;var n=e.props,a=n.day,i=n.startDate,s=n.selectsStart,r=null!==(t=e.props.selectingDate)&&void 0!==t?t:e.props.preSelection;return Vt(a,s?r:i)})),xt(wt(e),"isSelectingRangeEnd",(function(){var t;if(!e.isInSelectingRange())return!1;var n=e.props,a=n.day,i=n.endDate,s=n.selectsEnd,r=null!==(t=e.props.selectingDate)&&void 0!==t?t:e.props.preSelection;return Vt(a,s?r:i)})),xt(wt(e),"isRangeStart",(function(){var t=e.props,n=t.day,a=t.startDate,i=t.endDate;return!(!a||!i)&&Vt(a,n)})),xt(wt(e),"isRangeEnd",(function(){var t=e.props,n=t.day,a=t.startDate,i=t.endDate;return!(!a||!i)&&Vt(i,n)})),xt(wt(e),"isWeekend",(function(){var t=Ie.default(e.props.day);return 0===t||6===t})),xt(wt(e),"isAfterMonth",(function(){return void 0!==e.props.month&&(e.props.month+1)%12===De.default(e.props.day)})),xt(wt(e),"isBeforeMonth",(function(){return void 0!==e.props.month&&(De.default(e.props.day)+1)%12===e.props.month})),xt(wt(e),"isCurrentDay",(function(){return e.isSameDay(Dt())})),xt(wt(e),"isSelected",(function(){return e.isSameDay(e.props.selected)})),xt(wt(e),"getClassNames",(function(t){var n=e.props.dayClassName?e.props.dayClassName(t):void 0;return pe.default("react-datepicker__day",n,"react-datepicker__day--"+function(e,t){return At(e,"ddd",t)}(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(wt(e),"getAriaLabel",(function(){var t=e.props,n=t.day,a=t.ariaLabelPrefixWhenEnabled,i=void 0===a?"Choose":a,s=t.ariaLabelPrefixWhenDisabled,r=void 0===s?"Not available":s,o=e.isDisabled()||e.isExcluded()?r:i;return"".concat(o," ").concat(At(n,"PPPP",e.props.locale))})),xt(wt(e),"getTabIndex",(function(t,n){var a=t||e.props.selected,i=n||e.props.preSelection;return e.isKeyboardSelected()||e.isSameDay(a)&&Vt(i,a)?0:-1})),xt(wt(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(wt(e),"renderDayContents",(function(){return e.props.monthShowsDuplicateDaysEnd&&e.isAfterMonth()||e.props.monthShowsDuplicateDaysStart&&e.isBeforeMonth()?null:e.props.renderDayContents?e.props.renderDayContents(Te.default(e.props.day),e.props.day):Te.default(e.props.day)})),xt(wt(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),Tn=function(e){bt(n,e);var t=jt(n);function n(){var e;ht(this,n);for(var a=arguments.length,i=new Array(a),s=0;s<a;s++)i[s]=arguments[s];return xt(wt(e=t.call.apply(t,[this].concat(i))),"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,a=void 0===n?"week ":n,i={"react-datepicker__week-number":!0,"react-datepicker__week-number--clickable":!!e.onClick};return de.default.createElement("div",{className:pe.default(i),"aria-label":"".concat(a," ").concat(this.props.weekNumber),onClick:this.handleClick},t)}}]),n}(de.default.Component),En=function(e){bt(n,e);var t=jt(n);function n(){var e;ht(this,n);for(var a=arguments.length,i=new Array(a),s=0;s<a;s++)i[s]=arguments[s];return xt(wt(e=t.call.apply(t,[this].concat(i))),"handleDayClick",(function(t,n){e.props.onDayClick&&e.props.onDayClick(t,n)})),xt(wt(e),"handleDayMouseEnter",(function(t){e.props.onDayMouseEnter&&e.props.onDayMouseEnter(t)})),xt(wt(e),"handleWeekClick",(function(t,n,a){"function"==typeof e.props.onWeekSelect&&e.props.onWeekSelect(t,n,a),e.props.shouldCloseOnSelect&&e.props.setOpen(!1)})),xt(wt(e),"formatWeekNumber",(function(t){return e.props.formatWeekNumber?e.props.formatWeekNumber(t):function(e,t){var n=t&&Ht(t)||Yt()&&Ht(Yt());return Ee.default(e,n?{locale:n}:null)}(t)})),xt(wt(e),"renderDays",(function(){var t=Lt(e.props.day,e.props.locale,e.props.calendarStartDay),n=[],a=e.formatWeekNumber(t);if(e.props.showWeekNumber){var i=e.props.onWeekSelect?e.handleWeekClick.bind(wt(e),t,a):void 0;n.push(de.default.createElement(Tn,{key:"W",weekNumber:a,onClick:i,ariaLabelPrefix:e.props.ariaLabelPrefix}))}return n.concat([0,1,2,3,4,5,6].map((function(n){var a=xe.default(t,n);return de.default.createElement(In,{ariaLabelPrefixWhenEnabled:e.props.chooseDayAriaLabelPrefix,ariaLabelPrefixWhenDisabled:e.props.disabledDayAriaLabelPrefix,key:a.valueOf(),day:a,month:e.props.month,onClick:e.handleDayClick.bind(wt(e),a),onMouseEnter:e.handleDayMouseEnter.bind(wt(e),a),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),Dn=function(e){bt(n,e);var t=jt(n);function n(){var e;ht(this,n);for(var a=arguments.length,i=new Array(a),s=0;s<a;s++)i[s]=arguments[s];return xt(wt(e=t.call.apply(t,[this].concat(i))),"MONTH_REFS",St(Array(12)).map((function(){return de.default.createRef()}))),xt(wt(e),"isDisabled",(function(t){return Kt(t,e.props)})),xt(wt(e),"isExcluded",(function(t){return Gt(t,e.props)})),xt(wt(e),"handleDayClick",(function(t,n){e.props.onDayClick&&e.props.onDayClick(t,n,e.props.orderInDisplay)})),xt(wt(e),"handleDayMouseEnter",(function(t){e.props.onDayMouseEnter&&e.props.onDayMouseEnter(t)})),xt(wt(e),"handleMouseLeave",(function(){e.props.onMouseLeave&&e.props.onMouseLeave()})),xt(wt(e),"isRangeStartMonth",(function(t){var n=e.props,a=n.day,i=n.startDate,s=n.endDate;return!(!i||!s)&&qt(Fe.default(a,t),i)})),xt(wt(e),"isRangeStartQuarter",(function(t){var n=e.props,a=n.day,i=n.startDate,s=n.endDate;return!(!i||!s)&&Wt(Be.default(a,t),i)})),xt(wt(e),"isRangeEndMonth",(function(t){var n=e.props,a=n.day,i=n.startDate,s=n.endDate;return!(!i||!s)&&qt(Fe.default(a,t),s)})),xt(wt(e),"isRangeEndQuarter",(function(t){var n=e.props,a=n.day,i=n.startDate,s=n.endDate;return!(!i||!s)&&Wt(Be.default(a,t),s)})),xt(wt(e),"isWeekInMonth",(function(t){var n=e.props.day,a=xe.default(t,6);return qt(t,n)||qt(a,n)})),xt(wt(e),"isCurrentMonth",(function(e,t){return Ae.default(e)===Ae.default(Dt())&&t===De.default(Dt())})),xt(wt(e),"isSelectedMonth",(function(e,t,n){return De.default(e)===t&&Ae.default(e)===Ae.default(n)})),xt(wt(e),"isSelectedQuarter",(function(e,t,n){return Oe.default(e)===t&&Ae.default(e)===Ae.default(n)})),xt(wt(e),"renderWeeks",(function(){for(var t=[],n=e.props.fixedHeight,a=0,i=!1,s=Lt(Mt(e.props.day),e.props.locale,e.props.calendarStartDay);t.push(de.default.createElement(En,{ariaLabelPrefix:e.props.weekAriaLabelPrefix,chooseDayAriaLabelPrefix:e.props.chooseDayAriaLabelPrefix,disabledDayAriaLabelPrefix:e.props.disabledDayAriaLabelPrefix,key:a,day:s,month:De.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})),!i;){a++,s=_e.default(s,1);var r=n&&a>=6,o=!n&&!e.isWeekInMonth(s);if(r||o){if(!e.props.peekNextMonth)break;i=!0}}return t})),xt(wt(e),"onMonthClick",(function(t,n){e.handleDayClick(Mt(Fe.default(e.props.day,n)),t)})),xt(wt(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(wt(e),"onMonthKeyDown",(function(t,n){var a=t.key;if(!e.props.disabledKeyboardNavigation)switch(a){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(wt(e),"onQuarterClick",(function(t,n){e.handleDayClick(function(e){return Ke.default(e)}(Be.default(e.props.day,n)),t)})),xt(wt(e),"getMonthClassNames",(function(t){var n=e.props,a=n.day,i=n.startDate,s=n.endDate,r=n.selected,o=n.minDate,l=n.maxDate,c=n.preSelection,d=n.monthClassName,p=d?d(a):void 0;return pe.default("react-datepicker__month-text","react-datepicker__month-".concat(t),p,{"react-datepicker__month--disabled":(o||l)&&Qt(Fe.default(a,t),e.props),"react-datepicker__month--selected":e.isSelectedMonth(a,t,r),"react-datepicker__month-text--keyboard-selected":De.default(c)===t,"react-datepicker__month--in-range":Xt(i,s,t,a),"react-datepicker__month--range-start":e.isRangeStartMonth(t),"react-datepicker__month--range-end":e.isRangeEndMonth(t),"react-datepicker__month-text--today":e.isCurrentMonth(a,t)})})),xt(wt(e),"getTabIndex",(function(t){var n=De.default(e.props.preSelection);return e.props.disabledKeyboardNavigation||t!==n?"-1":"0"})),xt(wt(e),"getAriaLabel",(function(t){var n=e.props,a=n.ariaLabelPrefix,i=void 0===a?"Choose":a,s=n.disabledDayAriaLabelPrefix,r=void 0===s?"Not available":s,o=n.day,l=Fe.default(o,t),c=e.isDisabled(l)||e.isExcluded(l)?r:i;return"".concat(c," ").concat(At(l,"MMMM yyyy"))})),xt(wt(e),"getQuarterClassNames",(function(t){var n=e.props,a=n.day,i=n.startDate,s=n.endDate,r=n.selected,o=n.minDate,l=n.maxDate;return pe.default("react-datepicker__quarter-text","react-datepicker__quarter-".concat(t),{"react-datepicker__quarter--disabled":(o||l)&&Jt(Be.default(a,t),e.props),"react-datepicker__quarter--selected":e.isSelectedQuarter(a,t,r),"react-datepicker__quarter--in-range":tn(i,s,t,a),"react-datepicker__quarter--range-start":e.isRangeStartQuarter(t),"react-datepicker__quarter--range-end":e.isRangeEndQuarter(t)})})),xt(wt(e),"renderMonths",(function(){var t=e.props,n=t.showFullMonthYearPicker,a=t.showTwoColumnMonthYearPicker,i=t.showFourColumnMonthYearPicker,s=t.locale,r=t.day,o=t.selected;return(i?[[0,1,2,3],[4,5,6,7],[8,9,10,11]]:a?[[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,a){return de.default.createElement("div",{className:"react-datepicker__month-wrapper",key:a},t.map((function(t,a){return de.default.createElement("div",{ref:e.MONTH_REFS[t],key:a,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(r,t)?"date":void 0,"aria-selected":e.isSelectedMonth(r,t,o)},n?zt(t,s):Zt(t,s))})))}))})),xt(wt(e),"renderQuarters",(function(){var t=e.props,n=t.day,a=t.selected;return de.default.createElement("div",{className:"react-datepicker__quarter-wrapper"},[1,2,3,4].map((function(t,i){return de.default.createElement("div",{key:i,role:"option",onClick:function(n){e.onQuarterClick(n,t)},className:e.getQuarterClassNames(t),"aria-selected":e.isSelectedQuarter(n,t,a)},function(e,t){return At(Be.default(Dt(),e),"QQQ",t)}(t,e.props.locale))})))})),xt(wt(e),"getClassNames",(function(){var t=e.props;t.day;var n=t.selectingDate,a=t.selectsStart,i=t.selectsEnd,s=t.showMonthYearPicker,r=t.showQuarterYearPicker;return pe.default("react-datepicker__month",{"react-datepicker__month--selecting-range":n&&(a||i)},{"react-datepicker__monthPicker":s},{"react-datepicker__quarterPicker":r})})),e}return gt(n,[{key:"render",value:function(){var e=this.props,t=e.showMonthYearPicker,n=e.showQuarterYearPicker,a=e.day,i=e.ariaLabelPrefix,s=void 0===i?"month ":i;return de.default.createElement("div",{className:this.getClassNames(),onMouseLeave:this.handleMouseLeave,"aria-label":"".concat(s," ").concat(At(a,"yyyy-MM")),role:"listbox"},t?this.renderMonths():n?this.renderQuarters():this.renderWeeks())}}]),n}(de.default.Component),On=function(e){bt(n,e);var t=jt(n);function n(){var e;ht(this,n);for(var a=arguments.length,i=new Array(a),s=0;s<a;s++)i[s]=arguments[s];return xt(wt(e=t.call.apply(t,[this].concat(i))),"state",{height:null}),xt(wt(e),"handleClick",(function(t){(e.props.minTime||e.props.maxTime)&&rn(t,e.props)||(e.props.excludeTimes||e.props.includeTimes||e.props.filterTime)&&sn(t,e.props)||e.props.onChange(t)})),xt(wt(e),"isSelectedTime",(function(t,n,a){return e.props.selected&&n===Ce.default(t)&&a===Ne.default(t)})),xt(wt(e),"liClasses",(function(t,n,a){var i=["react-datepicker__time-list-item",e.props.timeClassName?e.props.timeClassName(t,n,a):void 0];return e.isSelectedTime(t,n,a)&&i.push("react-datepicker__time-list-item--selected"),((e.props.minTime||e.props.maxTime)&&rn(t,e.props)||(e.props.excludeTimes||e.props.includeTimes||e.props.filterTime)&&sn(t,e.props))&&i.push("react-datepicker__time-list-item--disabled"),e.props.injectTimes&&(60*Ce.default(t)+Ne.default(t))%e.props.intervals!=0&&i.push("react-datepicker__time-list-item--injected"),i.join(" ")})),xt(wt(e),"handleOnKeyDown",(function(t,n){" "===t.key&&(t.preventDefault(),t.key="Enter"),"Enter"===t.key&&e.handleClick(n),e.props.handleOnKeyDown(t)})),xt(wt(e),"renderTimes",(function(){for(var t=[],n=e.props.format?e.props.format:"p",a=e.props.intervals,i=function(e){return He.default(e)}(Dt(e.props.selected)),s=1440/a,r=e.props.injectTimes&&e.props.injectTimes.sort((function(e,t){return e-t})),o=e.props.selected||e.props.openToDate||Dt(),l=Ce.default(o),c=Ne.default(o),d=Me.default(Le.default(i,c),l),p=0;p<s;p++){var u=fe.default(i,p*a);if(t.push(u),r){var m=hn(i,u,p,a,r);t=t.concat(m)}}return t.map((function(t,a){return de.default.createElement("li",{key:a,onClick:e.handleClick.bind(wt(e),t),className:e.liClasses(t,l,c),ref:function(n){(it.default(t,d)||$t(t,d))&&(e.centerLi=n)},onKeyDown:function(n){e.handleOnKeyDown(n,t)},tabIndex:"0","aria-selected":e.isSelectedTime(t,l,c)?"true":void 0},At(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(On,"calcCenterPosition",(function(e,t){return t.offsetTop-(e/2-t.clientHeight/2)}));var An=function(e){bt(n,e);var t=jt(n);function n(e){var a;return ht(this,n),xt(wt(a=t.call(this,e)),"YEAR_REFS",St(Array(a.props.yearItemNumber)).map((function(){return de.default.createRef()}))),xt(wt(a),"isDisabled",(function(e){return Kt(e,a.props)})),xt(wt(a),"isExcluded",(function(e){return Gt(e,a.props)})),xt(wt(a),"updateFocusOnPaginate",(function(e){var t=function(){this.YEAR_REFS[e].current.focus()}.bind(wt(a));window.requestAnimationFrame(t)})),xt(wt(a),"handleYearClick",(function(e,t){a.props.onDayClick&&a.props.onDayClick(e,t)})),xt(wt(a),"handleYearNavigation",(function(e,t){var n=a.props,i=n.date,s=n.yearItemNumber,r=gn(i,s).startPeriod;a.isDisabled(t)||a.isExcluded(t)||(a.props.setPreSelection(t),e-r==-1?a.updateFocusOnPaginate(s-1):e-r===s?a.updateFocusOnPaginate(0):a.YEAR_REFS[e-r].current.focus())})),xt(wt(a),"isSameDay",(function(e,t){return Vt(e,t)})),xt(wt(a),"isCurrentYear",(function(e){return e===Ae.default(Dt())})),xt(wt(a),"isKeyboardSelected",(function(e){var t=Ft(qe.default(a.props.date,e));return!a.props.disabledKeyboardNavigation&&!a.props.inline&&!Vt(t,Ft(a.props.selected))&&Vt(t,Ft(a.props.preSelection))})),xt(wt(a),"onYearClick",(function(e,t){var n=a.props.date;a.handleYearClick(Ft(qe.default(n,t)),e)})),xt(wt(a),"onYearKeyDown",(function(e,t){var n=e.key;if(!a.props.disabledKeyboardNavigation)switch(n){case"Enter":a.onYearClick(e,t),a.props.setPreSelection(a.props.selected);break;case"ArrowRight":a.handleYearNavigation(t+1,ve.default(a.props.preSelection,1));break;case"ArrowLeft":a.handleYearNavigation(t-1,Se.default(a.props.preSelection,1))}})),xt(wt(a),"getYearClassNames",(function(e){var t=a.props,n=t.minDate,i=t.maxDate,s=t.selected;return pe.default("react-datepicker__year-text",{"react-datepicker__year-text--selected":e===Ae.default(s),"react-datepicker__year-text--disabled":(n||i)&&en(e,a.props),"react-datepicker__year-text--keyboard-selected":a.isKeyboardSelected(e),"react-datepicker__year-text--today":a.isCurrentYear(e)})})),xt(wt(a),"getYearTabIndex",(function(e){return a.props.disabledKeyboardNavigation?"-1":e===Ae.default(a.props.preSelection)?"0":"-1"})),a}return gt(n,[{key:"render",value:function(){for(var e=this,t=[],n=this.props,a=gn(n.date,n.yearItemNumber),i=a.startPeriod,s=a.endPeriod,r=function(n){t.push(de.default.createElement("div",{ref:e.YEAR_REFS[n-i],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=i;o<=s;o++)r(o);return de.default.createElement("div",{className:"react-datepicker__year"},de.default.createElement("div",{className:"react-datepicker__year-wrapper"},t))}}]),n}(de.default.Component),Rn=function(e){bt(n,e);var t=jt(n);function n(e){var a;return ht(this,n),xt(wt(a=t.call(this,e)),"onTimeChange",(function(e){a.setState({time:e});var t=new Date;t.setHours(e.split(":")[0]),t.setMinutes(e.split(":")[1]),a.props.onChange(t)})),xt(wt(a),"renderTimeInput",(function(){var e=a.state.time,t=a.props,n=t.date,i=t.timeString,s=t.customTimeInput;return s?de.default.cloneElement(s,{date:n,value:e,onChange:a.onTimeChange}):de.default.createElement("input",{type:"time",className:"react-datepicker-time__input",placeholder:"Time",name:"time-input",required:!0,value:e,onChange:function(e){a.onTimeChange(e.target.value||i)}})})),a.state={time:a.props.timeString},a}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 Pn(e){var t=e.className,n=e.children,a=e.showPopperArrow,i=e.arrowProps,s=void 0===i?{}:i;return de.default.createElement("div",{className:t},a&&de.default.createElement("div",_t({className:"react-datepicker__triangle"},s)),n)}var Ln=["react-datepicker__year-select","react-datepicker__month-select","react-datepicker__month-year-select"],Mn=function(e){bt(n,e);var t=jt(n);function n(e){var a;return ht(this,n),xt(wt(a=t.call(this,e)),"handleClickOutside",(function(e){a.props.onClickOutside(e)})),xt(wt(a),"setClickOutsideRef",(function(){return a.containerRef.current})),xt(wt(a),"handleDropdownFocus",(function(e){(function(){var e=((arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).className||"").split(/\s+/);return Ln.some((function(t){return e.indexOf(t)>=0}))})(e.target)&&a.props.onDropdownFocus()})),xt(wt(a),"getDateInView",(function(){var e=a.props,t=e.preSelection,n=e.selected,i=e.openToDate,s=pn(a.props),r=un(a.props),o=Dt();return i||n||t||(s&&it.default(o,s)?s:r&&at.default(o,r)?r:o)})),xt(wt(a),"increaseMonth",(function(){a.setState((function(e){var t=e.date;return{date:be.default(t,1)}}),(function(){return a.handleMonthChange(a.state.date)}))})),xt(wt(a),"decreaseMonth",(function(){a.setState((function(e){var t=e.date;return{date:je.default(t,1)}}),(function(){return a.handleMonthChange(a.state.date)}))})),xt(wt(a),"handleDayClick",(function(e,t,n){a.props.onSelect(e,t,n),a.props.setPreSelection&&a.props.setPreSelection(e)})),xt(wt(a),"handleDayMouseEnter",(function(e){a.setState({selectingDate:e}),a.props.onDayMouseEnter&&a.props.onDayMouseEnter(e)})),xt(wt(a),"handleMonthMouseLeave",(function(){a.setState({selectingDate:null}),a.props.onMonthMouseLeave&&a.props.onMonthMouseLeave()})),xt(wt(a),"handleYearChange",(function(e){a.props.onYearChange&&a.props.onYearChange(e),a.props.adjustDateOnChange&&(a.props.onSelect&&a.props.onSelect(e),a.props.setOpen&&a.props.setOpen(!0)),a.props.setPreSelection&&a.props.setPreSelection(e)})),xt(wt(a),"handleMonthChange",(function(e){a.props.onMonthChange&&a.props.onMonthChange(e),a.props.adjustDateOnChange&&(a.props.onSelect&&a.props.onSelect(e),a.props.setOpen&&a.props.setOpen(!0)),a.props.setPreSelection&&a.props.setPreSelection(e)})),xt(wt(a),"handleMonthYearChange",(function(e){a.handleYearChange(e),a.handleMonthChange(e)})),xt(wt(a),"changeYear",(function(e){a.setState((function(t){var n=t.date;return{date:qe.default(n,e)}}),(function(){return a.handleYearChange(a.state.date)}))})),xt(wt(a),"changeMonth",(function(e){a.setState((function(t){var n=t.date;return{date:Fe.default(n,e)}}),(function(){return a.handleMonthChange(a.state.date)}))})),xt(wt(a),"changeMonthYear",(function(e){a.setState((function(t){var n=t.date;return{date:qe.default(Fe.default(n,De.default(e)),Ae.default(e))}}),(function(){return a.handleMonthYearChange(a.state.date)}))})),xt(wt(a),"header",(function(){var e=Lt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:a.state.date,a.props.locale,a.props.calendarStartDay),t=[];return a.props.showWeekNumbers&&t.push(de.default.createElement("div",{key:"W",className:"react-datepicker__day-name"},a.props.weekLabel||"#")),t.concat([0,1,2,3,4,5,6].map((function(t){var n=xe.default(e,t),i=a.formatWeekday(n,a.props.locale),s=a.props.weekDayClassName?a.props.weekDayClassName(n):void 0;return de.default.createElement("div",{key:t,className:pe.default("react-datepicker__day-name",s)},i)})))})),xt(wt(a),"formatWeekday",(function(e,t){return a.props.formatWeekDay?function(e,t,n){return t(At(e,"EEEE",n))}(e,a.props.formatWeekDay,t):a.props.useWeekdaysShort?function(e,t){return At(e,"EEE",t)}(e,t):function(e,t){return At(e,"EEEEEE",t)}(e,t)})),xt(wt(a),"decreaseYear",(function(){a.setState((function(e){var t=e.date;return{date:Se.default(t,a.props.showYearPicker?a.props.yearItemNumber:1)}}),(function(){return a.handleYearChange(a.state.date)}))})),xt(wt(a),"renderPreviousButton",(function(){if(!a.props.renderCustomHeader){var e;switch(!0){case a.props.showMonthYearPicker:e=cn(a.state.date,a.props);break;case a.props.showYearPicker:e=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,a=t.yearItemNumber,i=void 0===a?Tt:a,s=gn(Ft(Se.default(e,i)),i).endPeriod,r=n&&Ae.default(n);return r&&r>s||!1}(a.state.date,a.props);break;default:e=on(a.state.date,a.props)}if((a.props.forceShowMonthNavigation||a.props.showDisabledMonthNavigation||!e)&&!a.props.showTimeSelectOnly){var t=["react-datepicker__navigation","react-datepicker__navigation--previous"],n=a.decreaseMonth;(a.props.showMonthYearPicker||a.props.showQuarterYearPicker||a.props.showYearPicker)&&(n=a.decreaseYear),e&&a.props.showDisabledMonthNavigation&&(t.push("react-datepicker__navigation--previous--disabled"),n=null);var i=a.props.showMonthYearPicker||a.props.showQuarterYearPicker||a.props.showYearPicker,s=a.props,r=s.previousMonthButtonLabel,o=s.previousYearButtonLabel,l=a.props,c=l.previousMonthAriaLabel,d=void 0===c?"string"==typeof r?r:"Previous Month":c,p=l.previousYearAriaLabel,u=void 0===p?"string"==typeof o?o:"Previous Year":p;return de.default.createElement("button",{type:"button",className:t.join(" "),onClick:n,onKeyDown:a.props.handleOnKeyDown,"aria-label":i?u:d},de.default.createElement("span",{className:["react-datepicker__navigation-icon","react-datepicker__navigation-icon--previous"].join(" ")},i?a.props.previousYearButtonLabel:a.props.previousMonthButtonLabel))}}})),xt(wt(a),"increaseYear",(function(){a.setState((function(e){var t=e.date;return{date:ve.default(t,a.props.showYearPicker?a.props.yearItemNumber:1)}}),(function(){return a.handleYearChange(a.state.date)}))})),xt(wt(a),"renderNextButton",(function(){if(!a.props.renderCustomHeader){var e;switch(!0){case a.props.showMonthYearPicker:e=dn(a.state.date,a.props);break;case a.props.showYearPicker:e=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.maxDate,a=t.yearItemNumber,i=void 0===a?Tt:a,s=gn(ve.default(e,i),i).startPeriod,r=n&&Ae.default(n);return r&&r<s||!1}(a.state.date,a.props);break;default:e=ln(a.state.date,a.props)}if((a.props.forceShowMonthNavigation||a.props.showDisabledMonthNavigation||!e)&&!a.props.showTimeSelectOnly){var t=["react-datepicker__navigation","react-datepicker__navigation--next"];a.props.showTimeSelect&&t.push("react-datepicker__navigation--next--with-time"),a.props.todayButton&&t.push("react-datepicker__navigation--next--with-today-button");var n=a.increaseMonth;(a.props.showMonthYearPicker||a.props.showQuarterYearPicker||a.props.showYearPicker)&&(n=a.increaseYear),e&&a.props.showDisabledMonthNavigation&&(t.push("react-datepicker__navigation--next--disabled"),n=null);var i=a.props.showMonthYearPicker||a.props.showQuarterYearPicker||a.props.showYearPicker,s=a.props,r=s.nextMonthButtonLabel,o=s.nextYearButtonLabel,l=a.props,c=l.nextMonthAriaLabel,d=void 0===c?"string"==typeof r?r:"Next Month":c,p=l.nextYearAriaLabel,u=void 0===p?"string"==typeof o?o:"Next Year":p;return de.default.createElement("button",{type:"button",className:t.join(" "),onClick:n,onKeyDown:a.props.handleOnKeyDown,"aria-label":i?u:d},de.default.createElement("span",{className:["react-datepicker__navigation-icon","react-datepicker__navigation-icon--next"].join(" ")},i?a.props.nextYearButtonLabel:a.props.nextMonthButtonLabel))}}})),xt(wt(a),"renderCurrentMonth",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a.state.date,t=["react-datepicker__current-month"];return a.props.showYearDropdown&&t.push("react-datepicker__current-month--hasYearDropdown"),a.props.showMonthDropdown&&t.push("react-datepicker__current-month--hasMonthDropdown"),a.props.showMonthYearDropdown&&t.push("react-datepicker__current-month--hasMonthYearDropdown"),de.default.createElement("div",{className:t.join(" ")},At(e,a.props.dateFormat,a.props.locale))})),xt(wt(a),"renderYearDropdown",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(a.props.showYearDropdown&&!e)return de.default.createElement(vn,{adjustDateOnChange:a.props.adjustDateOnChange,date:a.state.date,onSelect:a.props.onSelect,setOpen:a.props.setOpen,dropdownMode:a.props.dropdownMode,onChange:a.changeYear,minDate:a.props.minDate,maxDate:a.props.maxDate,year:Ae.default(a.state.date),scrollableYearDropdown:a.props.scrollableYearDropdown,yearDropdownItemNumber:a.props.yearDropdownItemNumber})})),xt(wt(a),"renderMonthDropdown",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(a.props.showMonthDropdown&&!e)return de.default.createElement(jn,{dropdownMode:a.props.dropdownMode,locale:a.props.locale,onChange:a.changeMonth,month:De.default(a.state.date),useShortMonthInDropdown:a.props.useShortMonthInDropdown})})),xt(wt(a),"renderMonthYearDropdown",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(a.props.showMonthYearDropdown&&!e)return de.default.createElement(Cn,{dropdownMode:a.props.dropdownMode,locale:a.props.locale,dateFormat:a.props.dateFormat,onChange:a.changeMonthYear,minDate:a.props.minDate,maxDate:a.props.maxDate,date:a.state.date,scrollableMonthYearDropdown:a.props.scrollableMonthYearDropdown})})),xt(wt(a),"renderTodayButton",(function(){if(a.props.todayButton&&!a.props.showTimeSelectOnly)return de.default.createElement("div",{className:"react-datepicker__today-button",onClick:function(e){return a.props.onSelect(He.default(Dt()),e)}},a.props.todayButton)})),xt(wt(a),"renderDefaultHeader",(function(e){var t=e.monthDate,n=e.i;return de.default.createElement("div",{className:"react-datepicker__header ".concat(a.props.showTimeSelect?"react-datepicker__header--has-time-select":"")},a.renderCurrentMonth(t),de.default.createElement("div",{className:"react-datepicker__header__dropdown react-datepicker__header__dropdown--".concat(a.props.dropdownMode),onFocus:a.handleDropdownFocus},a.renderMonthDropdown(0!==n),a.renderMonthYearDropdown(0!==n),a.renderYearDropdown(0!==n)),de.default.createElement("div",{className:"react-datepicker__day-names"},a.header(t)))})),xt(wt(a),"renderCustomHeader",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.monthDate,n=e.i;if(a.props.showTimeSelect&&!a.state.monthContainer||a.props.showTimeSelectOnly)return null;var i=on(a.state.date,a.props),s=ln(a.state.date,a.props),r=cn(a.state.date,a.props),o=dn(a.state.date,a.props),l=!a.props.showMonthYearPicker&&!a.props.showQuarterYearPicker&&!a.props.showYearPicker;return de.default.createElement("div",{className:"react-datepicker__header react-datepicker__header--custom",onFocus:a.props.onDropdownFocus},a.props.renderCustomHeader(ut(ut({},a.state),{},{customHeaderCount:n,monthDate:t,changeMonth:a.changeMonth,changeYear:a.changeYear,decreaseMonth:a.decreaseMonth,increaseMonth:a.increaseMonth,decreaseYear:a.decreaseYear,increaseYear:a.increaseYear,prevMonthButtonDisabled:i,nextMonthButtonDisabled:s,prevYearButtonDisabled:r,nextYearButtonDisabled:o})),l&&de.default.createElement("div",{className:"react-datepicker__day-names"},a.header(t)))})),xt(wt(a),"renderYearHeader",(function(){var e=a.state.date,t=a.props,n=t.showYearPicker,i=gn(e,t.yearItemNumber),s=i.startPeriod,r=i.endPeriod;return de.default.createElement("div",{className:"react-datepicker__header react-datepicker-year-header"},n?"".concat(s," - ").concat(r):Ae.default(e))})),xt(wt(a),"renderHeader",(function(e){switch(!0){case void 0!==a.props.renderCustomHeader:return a.renderCustomHeader(e);case a.props.showMonthYearPicker||a.props.showQuarterYearPicker||a.props.showYearPicker:return a.renderYearHeader(e);default:return a.renderDefaultHeader(e)}})),xt(wt(a),"renderMonths",(function(){if(!a.props.showTimeSelectOnly&&!a.props.showYearPicker){for(var e=[],t=a.props.showPreviousMonths?a.props.monthsShown-1:0,n=je.default(a.state.date,t),i=0;i<a.props.monthsShown;++i){var s=i-a.props.monthSelectedIn,r=be.default(n,s),o="month-".concat(i),l=i<a.props.monthsShown-1,c=i>0;e.push(de.default.createElement("div",{key:o,ref:function(e){a.monthContainer=e},className:"react-datepicker__month-container"},a.renderHeader({monthDate:r,i}),de.default.createElement(Dn,{chooseDayAriaLabelPrefix:a.props.chooseDayAriaLabelPrefix,disabledDayAriaLabelPrefix:a.props.disabledDayAriaLabelPrefix,weekAriaLabelPrefix:a.props.weekAriaLabelPrefix,onChange:a.changeMonthYear,day:r,dayClassName:a.props.dayClassName,calendarStartDay:a.props.calendarStartDay,monthClassName:a.props.monthClassName,onDayClick:a.handleDayClick,handleOnKeyDown:a.props.handleOnDayKeyDown,onDayMouseEnter:a.handleDayMouseEnter,onMouseLeave:a.handleMonthMouseLeave,onWeekSelect:a.props.onWeekSelect,orderInDisplay:i,formatWeekNumber:a.props.formatWeekNumber,locale:a.props.locale,minDate:a.props.minDate,maxDate:a.props.maxDate,excludeDates:a.props.excludeDates,excludeDateIntervals:a.props.excludeDateIntervals,highlightDates:a.props.highlightDates,selectingDate:a.state.selectingDate,includeDates:a.props.includeDates,includeDateIntervals:a.props.includeDateIntervals,inline:a.props.inline,shouldFocusDayInline:a.props.shouldFocusDayInline,fixedHeight:a.props.fixedHeight,filterDate:a.props.filterDate,preSelection:a.props.preSelection,setPreSelection:a.props.setPreSelection,selected:a.props.selected,selectsStart:a.props.selectsStart,selectsEnd:a.props.selectsEnd,selectsRange:a.props.selectsRange,selectsDisabledDaysInRange:a.props.selectsDisabledDaysInRange,showWeekNumbers:a.props.showWeekNumbers,startDate:a.props.startDate,endDate:a.props.endDate,peekNextMonth:a.props.peekNextMonth,setOpen:a.props.setOpen,shouldCloseOnSelect:a.props.shouldCloseOnSelect,renderDayContents:a.props.renderDayContents,disabledKeyboardNavigation:a.props.disabledKeyboardNavigation,showMonthYearPicker:a.props.showMonthYearPicker,showFullMonthYearPicker:a.props.showFullMonthYearPicker,showTwoColumnMonthYearPicker:a.props.showTwoColumnMonthYearPicker,showFourColumnMonthYearPicker:a.props.showFourColumnMonthYearPicker,showYearPicker:a.props.showYearPicker,showQuarterYearPicker:a.props.showQuarterYearPicker,isInputFocused:a.props.isInputFocused,containerRef:a.containerRef,monthShowsDuplicateDaysEnd:l,monthShowsDuplicateDaysStart:c})))}return e}})),xt(wt(a),"renderYears",(function(){if(!a.props.showTimeSelectOnly)return a.props.showYearPicker?de.default.createElement("div",{className:"react-datepicker__year--container"},a.renderHeader(),de.default.createElement(An,_t({onDayClick:a.handleDayClick,date:a.state.date},a.props))):void 0})),xt(wt(a),"renderTimeSection",(function(){if(a.props.showTimeSelect&&(a.state.monthContainer||a.props.showTimeSelectOnly))return de.default.createElement(On,{selected:a.props.selected,openToDate:a.props.openToDate,onChange:a.props.onTimeChange,timeClassName:a.props.timeClassName,format:a.props.timeFormat,includeTimes:a.props.includeTimes,intervals:a.props.timeIntervals,minTime:a.props.minTime,maxTime:a.props.maxTime,excludeTimes:a.props.excludeTimes,filterTime:a.props.filterTime,timeCaption:a.props.timeCaption,todayButton:a.props.todayButton,showMonthDropdown:a.props.showMonthDropdown,showMonthYearDropdown:a.props.showMonthYearDropdown,showYearDropdown:a.props.showYearDropdown,withPortal:a.props.withPortal,monthRef:a.state.monthContainer,injectTimes:a.props.injectTimes,locale:a.props.locale,handleOnKeyDown:a.props.handleOnKeyDown,showTimeSelectOnly:a.props.showTimeSelectOnly})})),xt(wt(a),"renderInputTimeSection",(function(){var e=new Date(a.props.selected),t=Ot(e)&&Boolean(a.props.selected)?"".concat(fn(e.getHours()),":").concat(fn(e.getMinutes())):"";if(a.props.showTimeInput)return de.default.createElement(Rn,{date:e,timeString:t,timeInputLabel:a.props.timeInputLabel,onChange:a.props.onTimeChange,customTimeInput:a.props.customTimeInput})})),a.containerRef=de.default.createRef(),a.state={date:a.getDateInView(),selectingDate:null,monthContainer:null},a}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&&!Vt(this.props.preSelection,e.preSelection)?this.setState({date:this.props.preSelection}):this.props.openToDate&&!Vt(this.props.openToDate,e.openToDate)&&this.setState({date:this.props.openToDate})}},{key:"render",value:function(){var e=this.props.container||Pn;return de.default.createElement("div",{ref:this.containerRef},de.default.createElement(e,{className:pe.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:Tt}}}]),n}(de.default.Component),Fn=function(e){bt(n,e);var t=jt(n);function n(e){var a;return ht(this,n),(a=t.call(this,e)).el=document.createElement("div"),a}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},qn=function(e){bt(n,e);var t=jt(n);function n(e){var a;return ht(this,n),xt(wt(a=t.call(this,e)),"getTabChildren",(function(){return Array.prototype.slice.call(a.tabLoopRef.current.querySelectorAll("[tabindex], a, button, input, select, textarea"),1,-1).filter(Bn)})),xt(wt(a),"handleFocusStart",(function(e){var t=a.getTabChildren();t&&t.length>1&&t[t.length-1].focus()})),xt(wt(a),"handleFocusEnd",(function(e){var t=a.getTabChildren();t&&t.length>1&&t[0].focus()})),a.tabLoopRef=de.default.createRef(),a}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),Wn=function(e){bt(n,e);var t=jt(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,a=t.wrapperClassName,i=t.hidePopper,s=t.popperComponent,r=t.popperModifiers,o=t.popperPlacement,l=t.popperProps,c=t.targetComponent,d=t.enableTabLoop,p=t.popperOnKeyDown,u=t.portalId,m=t.portalHost;if(!i){var h=pe.default("react-datepicker-popper",n);e=de.default.createElement(le.Popper,_t({modifiers:r,placement:o},l),(function(e){var t=e.ref,n=e.style,a=e.placement,i=e.arrowProps;return de.default.createElement(qn,{enableTabLoop:d},de.default.createElement("div",{ref:t,style:n,className:h,"data-placement":a,onKeyDown:p},de.default.cloneElement(s,{arrowProps:i})))}))}this.props.popperContainer&&(e=de.default.createElement(this.props.popperContainer,{},e)),u&&!i&&(e=de.default.createElement(Fn,{portalId:u,portalHost:m},e));var f=pe.default("react-datepicker-wrapper",a);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),Vn="react-datepicker-ignore-onclickoutside",$n=ct.default(Mn),Un="Date input not valid.",Yn=function(e){bt(n,e);var t=jt(n);function n(e){var a;return ht(this,n),xt(wt(a=t.call(this,e)),"getPreSelection",(function(){return a.props.openToDate?a.props.openToDate:a.props.selectsEnd&&a.props.startDate?a.props.startDate:a.props.selectsStart&&a.props.endDate?a.props.endDate:Dt()})),xt(wt(a),"calcInitialState",(function(){var e,t=a.getPreSelection(),n=pn(a.props),i=un(a.props),s=n&&it.default(t,He.default(n))?n:i&&at.default(t,Qe.default(i))?i:t;return{open:a.props.startOpen||!1,preventFocus:!1,preSelection:null!==(e=a.props.selectsRange?a.props.startDate:a.props.selected)&&void 0!==e?e:s,highlightDates:mn(a.props.highlightDates),focused:!1,shouldFocusDayInline:!1}})),xt(wt(a),"clearPreventFocusTimeout",(function(){a.preventFocusTimeout&&clearTimeout(a.preventFocusTimeout)})),xt(wt(a),"setFocus",(function(){a.input&&a.input.focus&&a.input.focus({preventScroll:!0})})),xt(wt(a),"setBlur",(function(){a.input&&a.input.blur&&a.input.blur(),a.cancelFocusInput()})),xt(wt(a),"setOpen",(function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];a.setState({open:e,preSelection:e&&a.state.open?a.state.preSelection:a.calcInitialState().preSelection,lastPreSelectChange:zn},(function(){e||a.setState((function(e){return{focused:!!t&&e.focused}}),(function(){!t&&a.setBlur(),a.setState({inputValue:null})}))}))})),xt(wt(a),"inputOk",(function(){return ue.default(a.state.preSelection)})),xt(wt(a),"isCalendarOpen",(function(){return void 0===a.props.open?a.state.open&&!a.props.disabled&&!a.props.readOnly:a.props.open})),xt(wt(a),"handleFocus",(function(e){a.state.preventFocus||(a.props.onFocus(e),a.props.preventOpenOnFocus||a.props.readOnly||a.setOpen(!0)),a.setState({focused:!0})})),xt(wt(a),"cancelFocusInput",(function(){clearTimeout(a.inputFocusTimeout),a.inputFocusTimeout=null})),xt(wt(a),"deferFocusInput",(function(){a.cancelFocusInput(),a.inputFocusTimeout=setTimeout((function(){return a.setFocus()}),1)})),xt(wt(a),"handleDropdownFocus",(function(){a.cancelFocusInput()})),xt(wt(a),"handleBlur",(function(e){(!a.state.open||a.props.withPortal||a.props.showTimeInput)&&a.props.onBlur(e),a.setState({focused:!1})})),xt(wt(a),"handleCalendarClickOutside",(function(e){a.props.inline||a.setOpen(!1),a.props.onClickOutside(e),a.props.withPortal&&e.preventDefault()})),xt(wt(a),"handleChange",(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var i=t[0];if(!a.props.onChangeRaw||(a.props.onChangeRaw.apply(wt(a),t),"function"==typeof i.isDefaultPrevented&&!i.isDefaultPrevented())){a.setState({inputValue:i.target.value,lastPreSelectChange:Hn});var s=function(e,t,n,a,i){var s=null,r=Ht(n)||Ht(Yt()),o=!0;return Array.isArray(t)?(t.forEach((function(t){var l=ot.default(e,t,new Date,{locale:r});a&&(o=Ot(l,i)&&e===At(l,t,n)),Ot(l,i)&&o&&(s=l)})),s):(s=ot.default(e,t,new Date,{locale:r}),a?o=Ot(s)&&e===At(s,t,n):Ot(s)||(t=t.match(Et).map((function(e){var t=e[0];return"p"===t||"P"===t?r?(0,It[t])(e,r.formatLong):t:e})).join(""),e.length>0&&(s=ot.default(e,t.slice(0,e.length),new Date)),Ot(s)||(s=new Date(e))),Ot(s)&&o?s:null)}(i.target.value,a.props.dateFormat,a.props.locale,a.props.strictParsing,a.props.minDate);!s&&i.target.value||a.setSelected(s,i,!0)}})),xt(wt(a),"handleSelect",(function(e,t,n){if(a.setState({preventFocus:!0},(function(){return a.preventFocusTimeout=setTimeout((function(){return a.setState({preventFocus:!1})}),50),a.preventFocusTimeout})),a.props.onChangeRaw&&a.props.onChangeRaw(t),a.setSelected(e,t,!1,n),!a.props.shouldCloseOnSelect||a.props.showTimeSelect)a.setPreSelection(e);else if(!a.props.inline){a.props.selectsRange||a.setOpen(!1);var i=a.props,s=i.startDate,r=i.endDate;!s||r||it.default(e,s)||a.setOpen(!1)}})),xt(wt(a),"setSelected",(function(e,t,n,i){var s=e;if(null===s||!Kt(s,a.props)){var r=a.props,o=r.onChange,l=r.selectsRange,c=r.startDate,d=r.endDate;if(!$t(a.props.selected,s)||a.props.allowSameDay||l)if(null!==s&&(!a.props.selected||n&&(a.props.showTimeSelect||a.props.showTimeSelectOnly||a.props.showTimeInput)||(s=Pt(s,{hour:Ce.default(a.props.selected),minute:Ne.default(a.props.selected),second:ke.default(a.props.selected)})),a.props.inline||a.setState({preSelection:s}),a.props.focusSelectedMonth||a.setState({monthSelectedIn:i})),l){var p=c&&d;c||d?c&&!d&&(it.default(s,c)?o([s,null],t):o([c,s],t)):o([s,null],t),p&&o([s,null],t)}else o(s,t);n||(a.props.onSelect(s,t),a.setState({inputValue:null}))}})),xt(wt(a),"setPreSelection",(function(e){var t=void 0!==a.props.minDate,n=void 0!==a.props.maxDate,i=!0;if(e){var s=He.default(e);if(t&&n)i=Ut(e,a.props.minDate,a.props.maxDate);else if(t){var r=He.default(a.props.minDate);i=at.default(e,r)||$t(s,r)}else if(n){var o=Qe.default(a.props.maxDate);i=it.default(e,o)||$t(s,o)}}i&&a.setState({preSelection:e})})),xt(wt(a),"handleTimeChange",(function(e){var t=Pt(a.props.selected?a.props.selected:a.getPreSelection(),{hour:Ce.default(e),minute:Ne.default(e)});a.setState({preSelection:t}),a.props.onChange(t),a.props.shouldCloseOnSelect&&a.setOpen(!1),a.props.showTimeInput&&a.setOpen(!0),a.setState({inputValue:null})})),xt(wt(a),"onInputClick",(function(){a.props.disabled||a.props.readOnly||a.setOpen(!0),a.props.onInputClick()})),xt(wt(a),"onInputKeyDown",(function(e){a.props.onKeyDown(e);var t=e.key;if(a.state.open||a.props.inline||a.props.preventOpenOnFocus){if(a.state.open){if("ArrowDown"===t||"ArrowUp"===t){e.preventDefault();var n=a.calendar.componentNode&&a.calendar.componentNode.querySelector('.react-datepicker__day[tabindex="0"]');return void(n&&n.focus({preventScroll:!0}))}var i=Dt(a.state.preSelection);"Enter"===t?(e.preventDefault(),a.inputOk()&&a.state.lastPreSelectChange===zn?(a.handleSelect(i,e),!a.props.shouldCloseOnSelect&&a.setPreSelection(i)):a.setOpen(!1)):"Escape"===t&&(e.preventDefault(),a.setOpen(!1)),a.inputOk()||a.props.onInputError({code:1,msg:Un})}}else"ArrowDown"!==t&&"ArrowUp"!==t&&"Enter"!==t||a.onInputClick()})),xt(wt(a),"onDayKeyDown",(function(e){a.props.onKeyDown(e);var t=e.key,n=Dt(a.state.preSelection);if("Enter"===t)e.preventDefault(),a.handleSelect(n,e),!a.props.shouldCloseOnSelect&&a.setPreSelection(n);else if("Escape"===t)e.preventDefault(),a.setOpen(!1),a.inputOk()||a.props.onInputError({code:1,msg:Un});else if(!a.props.disabledKeyboardNavigation){var i;switch(t){case"ArrowLeft":i=ye.default(n,1);break;case"ArrowRight":i=xe.default(n,1);break;case"ArrowUp":i=we.default(n,1);break;case"ArrowDown":i=_e.default(n,1);break;case"PageUp":i=je.default(n,1);break;case"PageDown":i=be.default(n,1);break;case"Home":i=Se.default(n,1);break;case"End":i=ve.default(n,1)}if(!i)return void(a.props.onInputError&&a.props.onInputError({code:1,msg:Un}));if(e.preventDefault(),a.setState({lastPreSelectChange:zn}),a.props.adjustDateOnChange&&a.setSelected(i),a.setPreSelection(i),a.props.inline){var s=De.default(n),r=De.default(i),o=Ae.default(n),l=Ae.default(i);s!==r||o!==l?a.setState({shouldFocusDayInline:!0}):a.setState({shouldFocusDayInline:!1})}}})),xt(wt(a),"onPopperKeyDown",(function(e){"Escape"===e.key&&(e.preventDefault(),a.setState({preventFocus:!0},(function(){a.setOpen(!1),setTimeout((function(){a.setFocus(),a.setState({preventFocus:!1})}))})))})),xt(wt(a),"onClearClick",(function(e){e&&e.preventDefault&&e.preventDefault(),a.props.selectsRange?a.props.onChange([null,null],e):a.props.onChange(null,e),a.setState({inputValue:null})})),xt(wt(a),"clear",(function(){a.onClearClick()})),xt(wt(a),"onScroll",(function(e){"boolean"==typeof a.props.closeOnScroll&&a.props.closeOnScroll?e.target!==document&&e.target!==document.documentElement&&e.target!==document.body||a.setOpen(!1):"function"==typeof a.props.closeOnScroll&&a.props.closeOnScroll(e)&&a.setOpen(!1)})),xt(wt(a),"renderCalendar",(function(){return a.props.inline||a.isCalendarOpen()?de.default.createElement($n,{ref:function(e){a.calendar=e},locale:a.props.locale,calendarStartDay:a.props.calendarStartDay,chooseDayAriaLabelPrefix:a.props.chooseDayAriaLabelPrefix,disabledDayAriaLabelPrefix:a.props.disabledDayAriaLabelPrefix,weekAriaLabelPrefix:a.props.weekAriaLabelPrefix,adjustDateOnChange:a.props.adjustDateOnChange,setOpen:a.setOpen,shouldCloseOnSelect:a.props.shouldCloseOnSelect,dateFormat:a.props.dateFormatCalendar,useWeekdaysShort:a.props.useWeekdaysShort,formatWeekDay:a.props.formatWeekDay,dropdownMode:a.props.dropdownMode,selected:a.props.selected,preSelection:a.state.preSelection,onSelect:a.handleSelect,onWeekSelect:a.props.onWeekSelect,openToDate:a.props.openToDate,minDate:a.props.minDate,maxDate:a.props.maxDate,selectsStart:a.props.selectsStart,selectsEnd:a.props.selectsEnd,selectsRange:a.props.selectsRange,startDate:a.props.startDate,endDate:a.props.endDate,excludeDates:a.props.excludeDates,excludeDateIntervals:a.props.excludeDateIntervals,filterDate:a.props.filterDate,onClickOutside:a.handleCalendarClickOutside,formatWeekNumber:a.props.formatWeekNumber,highlightDates:a.state.highlightDates,includeDates:a.props.includeDates,includeDateIntervals:a.props.includeDateIntervals,includeTimes:a.props.includeTimes,injectTimes:a.props.injectTimes,inline:a.props.inline,shouldFocusDayInline:a.state.shouldFocusDayInline,peekNextMonth:a.props.peekNextMonth,showMonthDropdown:a.props.showMonthDropdown,showPreviousMonths:a.props.showPreviousMonths,useShortMonthInDropdown:a.props.useShortMonthInDropdown,showMonthYearDropdown:a.props.showMonthYearDropdown,showWeekNumbers:a.props.showWeekNumbers,showYearDropdown:a.props.showYearDropdown,withPortal:a.props.withPortal,forceShowMonthNavigation:a.props.forceShowMonthNavigation,showDisabledMonthNavigation:a.props.showDisabledMonthNavigation,scrollableYearDropdown:a.props.scrollableYearDropdown,scrollableMonthYearDropdown:a.props.scrollableMonthYearDropdown,todayButton:a.props.todayButton,weekLabel:a.props.weekLabel,outsideClickIgnoreClass:Vn,fixedHeight:a.props.fixedHeight,monthsShown:a.props.monthsShown,monthSelectedIn:a.state.monthSelectedIn,onDropdownFocus:a.handleDropdownFocus,onMonthChange:a.props.onMonthChange,onYearChange:a.props.onYearChange,dayClassName:a.props.dayClassName,weekDayClassName:a.props.weekDayClassName,monthClassName:a.props.monthClassName,timeClassName:a.props.timeClassName,showTimeSelect:a.props.showTimeSelect,showTimeSelectOnly:a.props.showTimeSelectOnly,onTimeChange:a.handleTimeChange,timeFormat:a.props.timeFormat,timeIntervals:a.props.timeIntervals,minTime:a.props.minTime,maxTime:a.props.maxTime,excludeTimes:a.props.excludeTimes,filterTime:a.props.filterTime,timeCaption:a.props.timeCaption,className:a.props.calendarClassName,container:a.props.calendarContainer,yearItemNumber:a.props.yearItemNumber,yearDropdownItemNumber:a.props.yearDropdownItemNumber,previousMonthAriaLabel:a.props.previousMonthAriaLabel,previousMonthButtonLabel:a.props.previousMonthButtonLabel,nextMonthAriaLabel:a.props.nextMonthAriaLabel,nextMonthButtonLabel:a.props.nextMonthButtonLabel,previousYearAriaLabel:a.props.previousYearAriaLabel,previousYearButtonLabel:a.props.previousYearButtonLabel,nextYearAriaLabel:a.props.nextYearAriaLabel,nextYearButtonLabel:a.props.nextYearButtonLabel,timeInputLabel:a.props.timeInputLabel,disabledKeyboardNavigation:a.props.disabledKeyboardNavigation,renderCustomHeader:a.props.renderCustomHeader,popperProps:a.props.popperProps,renderDayContents:a.props.renderDayContents,onDayMouseEnter:a.props.onDayMouseEnter,onMonthMouseLeave:a.props.onMonthMouseLeave,selectsDisabledDaysInRange:a.props.selectsDisabledDaysInRange,showTimeInput:a.props.showTimeInput,showMonthYearPicker:a.props.showMonthYearPicker,showFullMonthYearPicker:a.props.showFullMonthYearPicker,showTwoColumnMonthYearPicker:a.props.showTwoColumnMonthYearPicker,showFourColumnMonthYearPicker:a.props.showFourColumnMonthYearPicker,showYearPicker:a.props.showYearPicker,showQuarterYearPicker:a.props.showQuarterYearPicker,showPopperArrow:a.props.showPopperArrow,excludeScrollbar:a.props.excludeScrollbar,handleOnKeyDown:a.props.onKeyDown,handleOnDayKeyDown:a.onDayKeyDown,isInputFocused:a.state.focused,customTimeInput:a.props.customTimeInput,setPreSelection:a.setPreSelection},a.props.children):null})),xt(wt(a),"renderDateInput",(function(){var e,t=pe.default(a.props.className,xt({},Vn,a.state.open)),n=a.props.customInput||de.default.createElement("input",{type:"text"}),i=a.props.customInputRef||"ref",s="string"==typeof a.props.value?a.props.value:"string"==typeof a.state.inputValue?a.state.inputValue:a.props.selectsRange?function(e,t,n){if(!e)return"";var a=Rt(e,n),i=t?Rt(t,n):"";return"".concat(a," - ").concat(i)}(a.props.startDate,a.props.endDate,a.props):Rt(a.props.selected,a.props);return de.default.cloneElement(n,(xt(e={},i,(function(e){a.input=e})),xt(e,"value",s),xt(e,"onBlur",a.handleBlur),xt(e,"onChange",a.handleChange),xt(e,"onClick",a.onInputClick),xt(e,"onFocus",a.handleFocus),xt(e,"onKeyDown",a.onInputKeyDown),xt(e,"id",a.props.id),xt(e,"name",a.props.name),xt(e,"autoFocus",a.props.autoFocus),xt(e,"placeholder",a.props.placeholderText),xt(e,"disabled",a.props.disabled),xt(e,"autoComplete",a.props.autoComplete),xt(e,"className",pe.default(n.props.className,t)),xt(e,"title",a.props.title),xt(e,"readOnly",a.props.readOnly),xt(e,"required",a.props.required),xt(e,"tabIndex",a.props.tabIndex),xt(e,"aria-describedby",a.props.ariaDescribedBy),xt(e,"aria-invalid",a.props.ariaInvalid),xt(e,"aria-labelledby",a.props.ariaLabelledBy),xt(e,"aria-required",a.props.ariaRequired),e))})),xt(wt(a),"renderClearButton",(function(){var e=a.props,t=e.isClearable,n=e.selected,i=e.startDate,s=e.endDate,r=e.clearButtonTitle,o=e.clearButtonClassName,l=void 0===o?"":o,c=e.ariaLabelClose,d=void 0===c?"Close":c;return!t||null==n&&null==i&&null==s?null:de.default.createElement("button",{type:"button",className:"react-datepicker__close-icon ".concat(l).trim(),"aria-label":d,onClick:a.onClearClick,title:r,tabIndex:-1})})),a.state=a.calcInitialState(),a}return gt(n,[{key:"componentDidMount",value:function(){window.addEventListener("scroll",this.onScroll,!0)}},{key:"componentDidUpdate",value:function(e,t){var n,a;e.inline&&(n=e.selected,a=this.props.selected,n&&a?De.default(n)!==De.default(a)||Ae.default(n)!==Ae.default(a):n!==a)&&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:mn(this.props.highlightDates)}),t.focused||$t(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(Fn,{portalId:this.props.portalId,portalHost:this.props.portalHost},t)),de.default.createElement("div",null,this.renderInputContainer(),t)}return de.default.createElement(Wn,{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:Tt,renderDayContents:function(e){return e},focusSelectedMonth:!1,showPopperArrow:!0,excludeScrollbar:!0,customTimeInput:null,calendarStartDay:void 0}}}]),n}(de.default.Component),Hn="input",zn="navigate";e.CalendarContainer=Pn,e.default=Yn,e.getDefaultLocale=Yt,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(70079),n(39519),n(65443),n(27930),n(47612),n(39156),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(78054),n(66821),n(12838),n(42384),n(31359),n(14603),n(6257),n(47067),n(74435),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(20522),n(30091),n(70850),n(99581),n(69274))},82330:e=>{var t="undefined"!=typeof Element,n="function"==typeof Map,a="function"==typeof Set,i="function"==typeof ArrayBuffer&&!!ArrayBuffer.isView;function s(e,r){if(e===r)return!0;if(e&&r&&"object"==typeof e&&"object"==typeof r){if(e.constructor!==r.constructor)return!1;var o,l,c,d;if(Array.isArray(e)){if((o=e.length)!=r.length)return!1;for(l=o;0!=l--;)if(!s(e[l],r[l]))return!1;return!0}if(n&&e instanceof Map&&r instanceof Map){if(e.size!==r.size)return!1;for(d=e.entries();!(l=d.next()).done;)if(!r.has(l.value[0]))return!1;for(d=e.entries();!(l=d.next()).done;)if(!s(l.value[1],r.get(l.value[0])))return!1;return!0}if(a&&e instanceof Set&&r instanceof Set){if(e.size!==r.size)return!1;for(d=e.entries();!(l=d.next()).done;)if(!r.has(l.value[0]))return!1;return!0}if(i&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(r)){if((o=e.length)!=r.length)return!1;for(l=o;0!=l--;)if(e[l]!==r[l])return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if((o=(c=Object.keys(e)).length)!==Object.keys(r).length)return!1;for(l=o;0!=l--;)if(!Object.prototype.hasOwnProperty.call(r,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]],r[c[l]]))return!1;return!0}return e!=e&&r!=r}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}}},70850:(e,t,n)=>{"use strict";n.r(t),n.d(t,{IGNORE_CLASS_NAME:()=>h,default:()=>g});var a=n(70079),i=n(99581);function s(e,t){return s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},s(e,t)}function r(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}),p={},u={},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}const g=function(e,t){var n,l,m=e.displayName||e.name||"Component";return l=n=function(n){var l,h;function g(e){var a;return(a=n.call(this,e)||this).__outsideClickHandler=function(e){if("function"!=typeof a.__clickOutsideHandlerProp){var t=a.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 a.__clickOutsideHandlerProp(e)},a.__getComponentNode=function(){var e=a.getInstance();return t&&"function"==typeof t.setClickOutsideRef?t.setClickOutsideRef()(e):"function"==typeof e.setClickOutsideRef?e.setClickOutsideRef():(0,i.findDOMNode)(e)},a.enableOnClickOutside=function(){if("undefined"!=typeof document&&!u[a._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}}()),u[a._uid]=!0;var e=a.props.eventTypes;e.forEach||(e=[e]),p[a._uid]=function(e){var t;null!==a.componentNode&&(a.props.preventDefault&&e.preventDefault(),a.props.stopPropagation&&e.stopPropagation(),a.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,a.componentNode,a.props.outsideClickIgnoreClass)===document&&a.__outsideClickHandler(e))},e.forEach((function(e){document.addEventListener(e,p[a._uid],f(r(a),e))}))}},a.disableOnClickOutside=function(){delete u[a._uid];var e=p[a._uid];if(e&&"undefined"!=typeof document){var t=a.props.eventTypes;t.forEach||(t=[t]),t.forEach((function(t){return document.removeEventListener(t,e,f(r(a),t))})),delete p[a._uid]}},a.getRef=function(e){return a.instanceRef=e},a._uid=d(),a}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,a,i={},s=Object.keys(e);for(a=0;a<s.length;a++)n=s[a],t.indexOf(n)>=0||(i[n]=e[n]);return i}(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,a.createElement)(e,n)},g}(a.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}},69274:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Manager:()=>r,Popper:()=>v,Reference:()=>j,usePopper:()=>g});var a=n(70079),i=a.createContext(),s=a.createContext();function r(e){var t=e.children,n=a.useState(null),r=n[0],o=n[1],l=a.useRef(!1);a.useEffect((function(){return function(){l.current=!0}}),[]);var c=a.useCallback((function(e){l.current||o(e)}),[]);return a.createElement(i.Provider,{value:r},a.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),a=1;a<t;a++)n[a-1]=arguments[a];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],a=t[1];return e[n]=a,e}),{})},p="undefined"!=typeof window&&window.document&&window.document.createElement?a.useLayoutEffect:a.useEffect,u=n(27087),m=n(82330),h=n.n(m),f=[],g=function(e,t,n){void 0===n&&(n={});var i=a.useRef(null),s={onFirstUpdate:n.onFirstUpdate,placement:n.placement||"bottom",strategy:n.strategy||"absolute",modifiers:n.modifiers||f},r=a.useState({styles:{popper:{position:s.strategy,left:"0",top:"0"},arrow:{position:"absolute"}},attributes:{}}),o=r[0],l=r[1],c=a.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=a.useMemo((function(){var e={onFirstUpdate:s.onFirstUpdate,placement:s.placement,strategy:s.strategy,modifiers:[].concat(s.modifiers,[c,{name:"applyStyles",enabled:!1}])};return h()(i.current,e)?i.current||e:(i.current=e,e)}),[s.onFirstUpdate,s.placement,s.strategy,s.modifiers,c]),g=a.useRef();return p((function(){g.current&&g.current.setOptions(m)}),[m]),p((function(){if(null!=e&&null!=t){var a=(n.createPopper||u.fi)(e,t,m);return g.current=a,function(){a.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(){},_=function(){return Promise.resolve(null)},b=[];function v(e){var t=e.placement,n=void 0===t?"bottom":t,s=e.strategy,r=void 0===s?"absolute":s,l=e.modifiers,d=void 0===l?b:l,p=e.referenceElement,u=e.onFirstUpdate,m=e.innerRef,h=e.children,f=a.useContext(i),v=a.useState(null),y=v[0],w=v[1],j=a.useState(null),S=j[0],k=j[1];a.useEffect((function(){c(m,y)}),[m,y]);var N=a.useMemo((function(){return{placement:n,strategy:r,onFirstUpdate:u,modifiers:[].concat(d,[{name:"arrow",enabled:null!=S,options:{element:S}}])}}),[n,r,u,d,S]),C=g(p||f,y,N),I=C.state,T=C.styles,E=C.forceUpdate,D=C.update,O=a.useMemo((function(){return{ref:w,style:T.popper,placement:I?I.placement:n,hasPopperEscaped:I&&I.modifiersData.hide?I.modifiersData.hide.hasPopperEscaped:null,isReferenceHidden:I&&I.modifiersData.hide?I.modifiersData.hide.isReferenceHidden:null,arrowProps:{style:T.arrow,ref:k},forceUpdate:E||x,update:D||_}}),[w,k,n,I,T,D,E]);return o(h)(O)}var y=n(20282),w=n.n(y);function j(e){var t=e.children,n=e.innerRef,i=a.useContext(s),r=a.useCallback((function(e){c(n,e),l(i,e)}),[n,i]);return a.useEffect((function(){return function(){return c(n,null)}})),a.useEffect((function(){w()(Boolean(i),"`Reference` should not be used outside of a `Manager` component.")}),[i]),o(t)({ref:r})}},23064: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)}},20282:e=>{"use strict";e.exports=function(){}},65311:e=>{"use strict";e.exports=jQuery}},e=>{e.O(0,[351],(()=>(55684,e(e.s=55684)))),e.O()}]);

Youez - 2016 - github.com/yon3zu
LinuXploit