MailPoet Newsletters (New) - Version 3.23.2

Version Description

  • 2019-04-16 =
  • Improved: UI clarity and user-friendliness;
  • Improved: security of the plugin. Thanks to Jan van der Put and Harm Blankers of REQON Security for the report!
  • Improved: UX for stats reporting emails;
  • Fixed: subscription confirmation email to include a plain text version of the email. Thanks Mathieu!
Download this release

Release Info

Developer wysija
Plugin Icon 128x128 MailPoet Newsletters (New)
Version 3.23.2
Comparing to
See all releases

Code changes from version 3.23.1 to 3.23.2

Files changed (110) hide show
  1. assets/dist/css/manifest.json +1 -1
  2. assets/dist/css/{newsletterEditor.5473165b.css → newsletterEditor.c7984640.css} +5 -7
  3. assets/dist/js/{admin.1ea54d89.chunk.js → admin.64becc03.chunk.js} +1 -1
  4. assets/dist/js/{admin_vendor.1ea54d89.chunk.js → admin_vendor.64becc03.chunk.js} +0 -0
  5. assets/dist/js/{admin_vendor_chunk.1ea54d89.chunk.js → admin_vendor_chunk.64becc03.chunk.js} +0 -0
  6. assets/dist/js/{form_editor.1ea54d89.chunk.js → form_editor.64becc03.chunk.js} +0 -0
  7. assets/dist/js/{mailpoet.1ea54d89.chunk.js → mailpoet.64becc03.chunk.js} +0 -0
  8. assets/dist/js/manifest.json +7 -7
  9. assets/dist/js/newsletter_editor.1ea54d89.chunk.js +0 -8
  10. assets/dist/js/newsletter_editor.64becc03.chunk.js +8 -0
  11. assets/dist/js/{vendor.1ea54d89.js → vendor.64becc03.js} +0 -0
  12. lang/mailpoet-ar.mo +0 -0
  13. lang/mailpoet-cs_CZ.mo +0 -0
  14. lang/mailpoet-da_DK.mo +0 -0
  15. lang/mailpoet-de_DE.mo +0 -0
  16. lang/mailpoet-el.mo +0 -0
  17. lang/mailpoet-es_ES.mo +0 -0
  18. lang/mailpoet-es_MX.mo +0 -0
  19. lang/mailpoet-fr_CA.mo +0 -0
  20. lang/mailpoet-fr_FR.mo +0 -0
  21. lang/mailpoet-hu_HU.mo +0 -0
  22. lang/mailpoet-it_IT.mo +0 -0
  23. lang/mailpoet-ja.mo +0 -0
  24. lang/mailpoet-nb_NO.mo +0 -0
  25. lang/mailpoet-nl_NL.mo +0 -0
  26. lang/mailpoet-pl_PL.mo +0 -0
  27. lang/mailpoet-pt_BR.mo +0 -0
  28. lang/mailpoet-pt_PT.mo +0 -0
  29. lang/mailpoet-ro_RO.mo +0 -0
  30. lang/mailpoet-ru_RU.mo +0 -0
  31. lang/mailpoet-sq.mo +0 -0
  32. lang/mailpoet-sr_RS.mo +0 -0
  33. lang/mailpoet-sv_SE.mo +0 -0
  34. lang/mailpoet-tr_TR.mo +0 -0
  35. lang/mailpoet-zh_CN.mo +0 -0
  36. lang/mailpoet.pot +130 -93
  37. lib/API/JSON/v1/CustomFields.php +12 -14
  38. lib/API/JSON/v1/Forms.php +48 -45
  39. lib/API/JSON/v1/ImportExport.php +3 -3
  40. lib/API/JSON/v1/NewsletterTemplates.php +13 -11
  41. lib/API/JSON/v1/Newsletters.php +67 -48
  42. lib/API/JSON/v1/Segments.php +34 -26
  43. lib/API/JSON/v1/SendingQueue.php +12 -12
  44. lib/API/JSON/v1/Subscribers.php +21 -17
  45. lib/API/MP/v1/API.php +3 -0
  46. lib/Config/Capabilities.php +3 -2
  47. lib/Config/Menu.php +1 -1
  48. lib/Config/Renderer.php +7 -3
  49. lib/Config/RequirementsChecker.php +4 -1
  50. lib/Config/Updater.php +2 -2
  51. lib/Cron/Workers/SendingQueue/Tasks/Newsletter.php +3 -1
  52. lib/Cron/Workers/StatsNotifications/Worker.php +5 -1
  53. lib/Listing/BulkActionController.php +7 -4
  54. lib/Models/Model.php +3 -3
  55. lib/Models/ModelValidator.php +4 -1
  56. lib/Models/Newsletter.php +2 -0
  57. lib/Models/Subscriber.php +25 -9
  58. lib/Models/SubscriberCustomField.php +3 -3
  59. lib/Newsletter/Links/Links.php +1 -1
  60. lib/Newsletter/Renderer/Blocks/Button.php +14 -11
  61. lib/Newsletter/Renderer/Blocks/Divider.php +9 -7
  62. lib/Newsletter/Renderer/Blocks/Footer.php +5 -2
  63. lib/Newsletter/Renderer/Blocks/Header.php +5 -2
  64. lib/Newsletter/Renderer/Blocks/Image.php +5 -4
  65. lib/Newsletter/Renderer/Blocks/Social.php +8 -5
  66. lib/Newsletter/Renderer/Blocks/Spacer.php +4 -2
  67. lib/Newsletter/Renderer/Blocks/Text.php +7 -4
  68. lib/Newsletter/Renderer/Columns/Renderer.php +17 -4
  69. lib/Newsletter/Renderer/EscapeHelper.php +50 -0
  70. lib/Newsletter/Renderer/Renderer.php +9 -20
  71. lib/Newsletter/Renderer/StylesHelper.php +1 -1
  72. lib/Router/Router.php +7 -7
  73. lib/Segments/BulkAction.php +2 -2
  74. lib/Segments/SubscribersListings.php +1 -1
  75. lib/Settings/SettingsController.php +3 -1
  76. lib/Subscribers/ConfirmationEmailMailer.php +7 -3
  77. lib/Subscribers/ImportExport/Export/Export.php +8 -6
  78. lib/Subscribers/ImportExport/Import/MailChimp.php +3 -2
  79. lib/Subscription/Pages.php +3 -3
  80. lib/Tasks/Sending.php +4 -1
  81. lib/Tasks/State.php +1 -1
  82. lib/Twig/I18n.php +1 -1
  83. lib/Util/CSS.php +15 -13
  84. lib/Util/FreeDomains.php +2 -1
  85. lib/Util/ProgressBar.php +6 -4
  86. lib/Util/Sudzy/Engine.php +4 -1
  87. lib/Util/XLSXWriter.php +1 -1
  88. lib/Util/pQuery/DomNode.php +15 -0
  89. lib/Util/pQuery/Html5Parser.php +8 -0
  90. lib/Util/pQuery/pQuery.php +0 -17
  91. lib/WP/Functions.php +6 -2
  92. mailpoet.php +2 -2
  93. readme.txt +7 -1
  94. vendor-prefixed/autoload.php +1 -1
  95. vendor/autoload.php +1 -1
  96. vendor/composer/autoload_psr4.php +1 -0
  97. vendor/composer/autoload_real.php +7 -7
  98. vendor/composer/autoload_static.php +10 -5
  99. views/emails/statsNotification.html +7 -7
  100. views/emails/statsNotification.txt +2 -2
  101. views/newsletter/editor.html +1 -1
  102. views/newsletter/templates/blocks/divider/block.hbs +2 -2
  103. views/newsletter/templates/blocks/divider/settings.hbs +1 -1
  104. views/newsletter/templates/blocks/footer/block.hbs +1 -1
  105. views/newsletter/templates/blocks/footer/settings.hbs +1 -1
  106. views/newsletter/templates/blocks/header/block.hbs +1 -1
  107. views/newsletter/templates/blocks/header/settings.hbs +1 -1
  108. views/newsletter/templates/blocks/spacer/block.hbs +2 -2
  109. views/newsletter/templates/blocks/spacer/settings.hbs +1 -1
  110. views/settings/advanced.html +81 -1
assets/dist/css/manifest.json CHANGED
@@ -2,7 +2,7 @@
2
"admin.css": "admin.d5bf8e54.css",
3
"adminGlobal.css": "adminGlobal.23524fe1.css",
4
"importExport.css": "importExport.44183941.css",
5
- "newsletterEditor.css": "newsletterEditor.5473165b.css",
6
"public.css": "public.82ef7cbc.css",
7
"rtl.css": "rtl.c2536d81.css"
8
}
2
"admin.css": "admin.d5bf8e54.css",
3
"adminGlobal.css": "adminGlobal.23524fe1.css",
4
"importExport.css": "importExport.44183941.css",
5
+ "newsletterEditor.css": "newsletterEditor.c7984640.css",
6
"public.css": "public.82ef7cbc.css",
7
"rtl.css": "rtl.c2536d81.css"
8
}
assets/dist/css/{newsletterEditor.5473165b.css → newsletterEditor.c7984640.css} RENAMED
@@ -794,11 +794,11 @@ span.select2-container--open > span.select2-dropdown li.select2-results__option
794
795
.mailpoet_resize_handle_container { left: 50%; margin-top: -16px; position: absolute; top: 100%; transform: translateX(-50%); z-index: 2; }
796
797
- .mailpoet_resize_handle { align-items: center; background: #0078A2; border-radius: 10px; cursor: ns-resize; display: flex; justify-content: space-between; min-width: 60px; padding: 7px 10px; z-index: 2; }
798
799
.mailpoet_resize_handle .mailpoet_resize_handle_text, .mailpoet_resize_handle .mailpoet_resize_handle_icon { pointer-events: none; }
800
801
- .mailpoet_resize_active .mailpoet_resize_handle { display: flex !important; }
802
803
.mailpoet_resize_handle_text { color: white; font-size: 11px; font-weight: bold; line-height: 1.5em; text-align: center; }
804
@@ -806,13 +806,11 @@ span.select2-container--open > span.select2-dropdown li.select2-results__option
806
807
.mailpoet_resize_handle_icon > svg { fill: white; height: 15px; vertical-align: top; width: 15px; }
808
809
- .mailpoet_block.mailpoet_resize_active > .mailpoet_block_highlight { border: 2px solid #0078A2; }
810
-
811
- .mailpoet_block.mailpoet_resize_active > .mailpoet_block_highlight .mailpoet_resize_handle { display: inline-block; }
812
-
813
.mailpoet_image_resize_handle_container { bottom: 0; height: 24px; position: absolute; right: 0; width: 24px; }
814
815
- .mailpoet_image_resize_handle { background: #0078A2; border-radius: 6px 0 0 0; cursor: nwse-resize; display: inline-block; height: 24px; position: relative; width: 24px; z-index: 2; }
816
817
.mailpoet_image_resize_handle .mailpoet_image_resize_handle_text, .mailpoet_image_resize_handle .mailpoet_image_resize_handle_icon { pointer-events: none; }
818
794
795
.mailpoet_resize_handle_container { left: 50%; margin-top: -16px; position: absolute; top: 100%; transform: translateX(-50%); z-index: 2; }
796
797
+ .mailpoet_resize_handle { align-items: center; background: #0078A2; border-radius: 10px; cursor: ns-resize; display: none; justify-content: space-between; min-width: 60px; padding: 7px 10px; z-index: 2; }
798
799
.mailpoet_resize_handle .mailpoet_resize_handle_text, .mailpoet_resize_handle .mailpoet_resize_handle_icon { pointer-events: none; }
800
801
+ .mailpoet_resizable_block.mailpoet_highlight .mailpoet_resize_handle { display: flex; }
802
803
.mailpoet_resize_handle_text { color: white; font-size: 11px; font-weight: bold; line-height: 1.5em; text-align: center; }
804
806
807
.mailpoet_resize_handle_icon > svg { fill: white; height: 15px; vertical-align: top; width: 15px; }
808
809
.mailpoet_image_resize_handle_container { bottom: 0; height: 24px; position: absolute; right: 0; width: 24px; }
810
811
+ .mailpoet_image_resize_handle { background: #0078A2; border-radius: 6px 0 0 0; cursor: nwse-resize; display: none; height: 24px; position: relative; width: 24px; z-index: 2; }
812
+
813
+ .mailpoet_resizable_block.mailpoet_highlight .mailpoet_image_resize_handle { display: inline-block; }
814
815
.mailpoet_image_resize_handle .mailpoet_image_resize_handle_text, .mailpoet_image_resize_handle .mailpoet_image_resize_handle_icon { pointer-events: none; }
816
assets/dist/js/{admin.1ea54d89.chunk.js → admin.64becc03.chunk.js} RENAMED
@@ -31,4 +31,4 @@ var n;n=function(){return function(e){var t={};function a(n){if(t[n])return t[n]
31
v4.1.1
32
https://github.com/mholt/PapaParse
33
*/
34
- !function(t){"use strict";function a(e){this._handle=null,this._paused=!1,this._finished=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this._completeResults={data:[],errors:[],meta:{}},function(e){var t=p(e);t.chunkSize=parseInt(t.chunkSize),this._handle=new s(t),this._handle.streamer=this,this._config=t}.call(this,e),this.parseChunk=function(e){var a=this._partialLine+e;this._partialLine="";var n=this._handle.parse(a,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var r=n.meta.cursor;this._finished||(this._partialLine=a.substring(r-this._baseIndex),this._baseIndex=r),n&&n.data&&(this._rowCount+=n.data.length);var i=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(f)t.postMessage({results:n,workerId:b.WORKER_ID,finished:i});else if(m(this._config.chunk)){if(this._config.chunk(n,this._handle),this._paused)return;n=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(n.data),this._completeResults.errors=this._completeResults.errors.concat(n.errors),this._completeResults.meta=n.meta),!i||!m(this._config.complete)||n&&n.meta.aborted||this._config.complete(this._completeResults),i||n&&n.meta.paused||this._nextChunk(),n}},this._sendError=function(e){m(this._config.error)?this._config.error(e):f&&this._config.error&&t.postMessage({workerId:b.WORKER_ID,error:e,finished:!1})}}function n(e){var t;(e=e||{}).chunkSize||(e.chunkSize=b.RemoteChunkSize),a.call(this,e),this._nextChunk=f?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,f||(t.onload=d(this._chunkLoaded,this),t.onerror=d(this._chunkError,this)),t.open("GET",this._input,!f),this._config.chunkSize){var e=this._start+this._config.chunkSize-1;t.setRequestHeader("Range","bytes="+this._start+"-"+e),t.setRequestHeader("If-None-Match","webkit-no-cache")}try{t.send()}catch(e){this._chunkError(e.message)}f&&0==t.status?this._chunkError():this._start+=this._config.chunkSize}},this._chunkLoaded=function(){if(4==t.readyState){if(t.status<200||t.status>=400)return void this._chunkError();this._finished=!this._config.chunkSize||this._start>function(e){var t=e.getResponseHeader("Content-Range");return parseInt(t.substr(t.lastIndexOf("/")+1))}(t),this.parseChunk(t.responseText)}},this._chunkError=function(e){var a=t.statusText||e;this._sendError(a)}}function r(e){(e=e||{}).chunkSize||(e.chunkSize=b.LocalChunkSize),a.call(this,e);var t,n,r="undefined"!=typeof FileReader;this.stream=function(e){this._input=e,n=e.slice||e.webkitSlice||e.mozSlice,r?((t=new FileReader).onload=d(this._chunkLoaded,this),t.onerror=d(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var e=this._input;if(this._config.chunkSize){var a=Math.min(this._start+this._config.chunkSize,this._input.size);e=n.call(e,this._start,a)}var i=t.readAsText(e,this._config.encoding);r||this._chunkLoaded({target:{result:i}})},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 i(e){var t;e=e||{},a.call(this,e),this.stream=function(e){return e,t=e,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var e=this._config.chunkSize,a=e?t.substr(0,e):t;return t=e?t.substr(e):"",this._finished=!t,this.parseChunk(a)}}}function s(e){function t(){if(_&&l&&(r("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+b.DefaultDelimiter+"'"),l=!1),e.skipEmptyLines)for(var t=0;t<_.data.length;t++)1==_.data[t].length&&""==_.data[t][0]&&_.data.splice(t--,1);return a()&&function(){if(_){for(var e=0;a()&&e<_.data.length;e++)for(var t=0;t<_.data[e].length;t++)g.push(_.data[e][t]);_.data.splice(0,1)}}(),function(){if(!_||!e.header&&!e.dynamicTyping)return _;for(var t=0;t<_.data.length;t++){for(var a={},i=0;i<_.data[t].length;i++){if(e.dynamicTyping){var s=_.data[t][i];_.data[t][i]="true"==s||"TRUE"==s||"false"!=s&&"FALSE"!=s&&n(s)}e.header&&(i>=g.length?(a.__parsed_extra||(a.__parsed_extra=[]),a.__parsed_extra.push(_.data[t][i])):a[g[i]]=_.data[t][i])}e.header&&(_.data[t]=a,i>g.length?r("FieldMismatch","TooManyFields","Too many fields: expected "+g.length+" fields but parsed "+i,t):i<g.length&&r("FieldMismatch","TooFewFields","Too few fields: expected "+g.length+" fields but parsed "+i,t))}return e.header&&_.meta&&(_.meta.fields=g),_}()}function a(){return e.header&&0==g.length}function n(e){return c.test(e)?parseFloat(e):e}function r(e,t,a,n){_.errors.push({type:e,code:t,message:a,row:n})}var i,s,l,c=/^\s*-?(\d*\.?\d+|\d+\.?\d*)(e[-+]?\d+)?\s*#x2F;i,u=this,d=0,h=!1,f=!1,g=[],_={data:[],errors:[],meta:{}};if(m(e.step)){var v=e.step;e.step=function(n){if(_=n,a())t();else{if(t(),0==_.data.length)return;d+=n.data.length,e.preview&&d>e.preview?s.abort():v(_,u)}}}this.parse=function(a,n,r){if(e.newline||(e.newline=function(e){var t=(e=e.substr(0,1048576)).split("\r");if(1==t.length)return"\n";for(var a=0,n=0;n<t.length;n++)"\n"==t[n][0]&&a++;return a>=t.length/2?"\r\n":"\r"}(a)),l=!1,!e.delimiter){var c=function(t){for(var a,n,r,i=[",","\t","|",";",b.RECORD_SEP,b.UNIT_SEP],s=0;s<i.length;s++){var l=i[s],c=0,u=0;r=void 0;for(var p=new o({delimiter:l,preview:10}).parse(t),d=0;d<p.data.length;d++){var m=p.data[d].length;u+=m,void 0!==r?m>1&&(c+=Math.abs(m-r),r=m):r=m}u/=p.data.length,(void 0===n||n>c)&&u>1.99&&(n=c,a=l)}return e.delimiter=a,{successful:!!a,bestDelimiter:a}}(a);c.successful?e.delimiter=c.bestDelimiter:(l=!0,e.delimiter=b.DefaultDelimiter),_.meta.delimiter=e.delimiter}var u=p(e);return e.preview&&e.header&&u.preview++,i=a,s=new o(u),_=s.parse(i,n,r),t(),h?{meta:{paused:!0}}:_||{meta:{paused:!1}}},this.paused=function(){return h},this.pause=function(){h=!0,s.abort(),i=i.substr(s.getCharIndex())},this.resume=function(){h=!1,u.streamer.parseChunk(i)},this.aborted=function(){return f},this.abort=function(){f=!0,s.abort(),_.meta.aborted=!0,m(e.complete)&&e.complete(_),i=""}}function o(e){var t=(e=e||{}).delimiter,a=e.newline,n=e.comments,r=e.step,i=e.preview,s=e.fastMode;if(("string"!=typeof t||b.BAD_DELIMITERS.indexOf(t)>-1)&&(t=","),n===t)throw"Comment character same as delimiter";!0===n?n="#":("string"!=typeof n||b.BAD_DELIMITERS.indexOf(n)>-1)&&(n=!1),"\n"!=a&&"\r"!=a&&"\r\n"!=a&&(a="\n");var o=0,l=!1;this.parse=function(e,c,u){function p(e){w.push(e),I=o}function d(t){return u?h():(t||(t=e.substr(o)),k.push(t),o=g,p(k),y&&f(),h())}function m(t){o=t,p(k),k=[],C=e.indexOf(a,o)}function h(e){return{data:w,errors:E,meta:{delimiter:t,linebreak:a,aborted:l,truncated:!!e,cursor:I+(c||0)}}}function f(){r(h()),w=[],E=[]}if("string"!=typeof e)throw"Input must be a string";var g=e.length,_=t.length,v=a.length,b=n.length,y="function"==typeof r;o=0;var w=[],E=[],k=[],I=0;if(!e)return h();if(s||!1!==s&&-1===e.indexOf('"')){for(var S=e.split(a),N=0;N<S.length;N++){k=S[N];if(o+=k.length,N!==S.length-1)o+=a.length;else if(u)return h();if(!n||k.substr(0,b)!=n){if(y){if(w=[],p(k.split(t)),f(),l)return h()}else p(k.split(t));if(i&&N>=i)return w=w.slice(0,i),h(!0)}}return h()}for(var x=e.indexOf(t,o),C=e.indexOf(a,o);;)if('"'!=e[o])if(n&&0===k.length&&e.substr(o,b)===n){if(-1==C)return h();o=C+v,C=e.indexOf(a,o),x=e.indexOf(t,o)}else if(-1!==x&&(C>x||-1===C))k.push(e.substring(o,x)),o=x+_,x=e.indexOf(t,o);else{if(-1===C)break;if(k.push(e.substring(o,C)),m(C+v),y&&(f(),l))return h();if(i&&w.length>=i)return h(!0)}else{var T=o;for(o++;;){if(-1===(T=e.indexOf('"',T+1)))return u||E.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:w.length,index:o}),d();if(T===g-1)return d(e.substring(o,T).replace(/""/g,'"'));if('"'!=e[T+1]){if(e[T+1]==t){k.push(e.substring(o,T).replace(/""/g,'"')),o=T+1+_,x=e.indexOf(t,o),C=e.indexOf(a,o);break}if(e.substr(T+1,v)===a){if(k.push(e.substring(o,T).replace(/""/g,'"')),m(T+1+v),x=e.indexOf(t,o),y&&(f(),l))return h();if(i&&w.length>=i)return h(!0);break}}else T++}}return d()},this.abort=function(){l=!0},this.getCharIndex=function(){return o}}function l(e){var t=e.data,a=_[t.workerId],n=!1;if(t.error)a.userError(t.error,t.file);else if(t.results&&t.results.data){var r={abort:function(){n=!0,c(t.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:u,resume:u};if(m(a.userStep)){for(var i=0;i<t.results.data.length&&(a.userStep({data:[t.results.data[i]],errors:t.results.errors,meta:t.results.meta},r),!n);i++);delete t.results}else m(a.userChunk)&&(a.userChunk(t.results,r,t.file),delete t.results)}t.finished&&!n&&c(t.workerId,t.results)}function c(e,t){var a=_[e];m(a.userComplete)&&a.userComplete(t),a.terminate(),delete _[e]}function u(){throw"Not implemented."}function p(e){if("object"!=typeof e)return e;var t=e instanceof Array?[]:{};for(var a in e)t[a]=p(e[a]);return t}function d(e,t){return function(){e.apply(t,arguments)}}function m(e){return"function"==typeof e}var h,f=!t.document&&!!t.postMessage,g=!1,_={},v=0,b={};if(b.parse=function(e,a){if((a=a||{}).worker&&b.WORKERS_SUPPORTED){var s=function(){if(!b.WORKERS_SUPPORTED)return!1;if(!g&&null===b.SCRIPT_PATH)throw new Error("Script path cannot be determined automatically when Papa Parse is loaded asynchronously. You need to set Papa.SCRIPT_PATH manually.");var e=new t.Worker(b.SCRIPT_PATH||h);return e.onmessage=l,e.id=v++,_[e.id]=e,e}();return s.userStep=a.step,s.userChunk=a.chunk,s.userComplete=a.complete,s.userError=a.error,a.step=m(a.step),a.chunk=m(a.chunk),a.complete=m(a.complete),a.error=m(a.error),delete a.worker,void s.postMessage({input:e,config:a,workerId:s.id})}var o=null;return"string"==typeof e?o=a.download?new n(a):new i(a):(t.File&&e instanceof File||e instanceof Object)&&(o=new r(a)),o.stream(e)},b.unparse=function(e,t){function a(e){if("object"!=typeof e)return[];var t=[];for(var a in e)t.push(a);return t}function n(e,t){var a="";"string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t));var n=e instanceof Array&&e.length>0,i=!(t[0]instanceof Array);if(n){for(var l=0;l<e.length;l++)l>0&&(a+=s),a+=r(e[l],l);t.length>0&&(a+=o)}for(var c=0;c<t.length;c++){for(var u=n?e.length:t[c].length,p=0;u>p;p++){p>0&&(a+=s);var d=n&&i?e[p]:p;a+=r(t[c][d],p)}c<t.length-1&&(a+=o)}return a}function r(e,t){return null==e?"":(e=e.toString().replace(/"/g,'""'),"boolean"==typeof i&&i||i instanceof Array&&i[t]||function(e,t){for(var a=0;a<t.length;a++)if(e.indexOf(t[a])>-1)return!0;return!1}(e,b.BAD_DELIMITERS)||e.indexOf(s)>-1||" "==e.charAt(0)||" "==e.charAt(e.length-1)?'"'+e+'"':e)}var i=!1,s=",",o="\r\n";if("object"==typeof t&&("string"==typeof t.delimiter&&1==t.delimiter.length&&-1==b.BAD_DELIMITERS.indexOf(t.delimiter)&&(s=t.delimiter),("boolean"==typeof t.quotes||t.quotes instanceof Array)&&(i=t.quotes),"string"==typeof t.newline&&(o=t.newline)),"string"==typeof e&&(e=JSON.parse(e)),e instanceof Array){if(!e.length||e[0]instanceof Array)return n(null,e);if("object"==typeof e[0])return n(a(e[0]),e)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),e.data instanceof Array&&(e.fields||(e.fields=e.data[0]instanceof Array?e.fields:a(e.data[0])),e.data[0]instanceof Array||"object"==typeof e.data[0]||(e.data=[e.data])),n(e.fields||[],e.data||[]);throw"exception: Unable to serialize unrecognized input"},b.RECORD_SEP=String.fromCharCode(30),b.UNIT_SEP=String.fromCharCode(31),b.BYTE_ORDER_MARK="\ufeff",b.BAD_DELIMITERS=["\r","\n",'"',b.BYTE_ORDER_MARK],b.WORKERS_SUPPORTED=!!t.Worker,b.SCRIPT_PATH=null,b.LocalChunkSize=10485760,b.RemoteChunkSize=5242880,b.DefaultDelimiter=",",b.Parser=o,b.ParserHandle=s,b.NetworkStreamer=n,b.FileStreamer=r,b.StringStreamer=i,e.exports?e.exports=b:m(t.define)&&t.define.amd?t.define(function(){return b}):t.Papa=b,t.jQuery){var y=t.jQuery;y.fn.parse=function(e){function a(){if(0!=i.length){var t=i[0];if(m(e.before)){var a=e.before(t.file,t.inputElem);if("object"==typeof a){if("abort"==a.action)return void function(t,a,n,r){m(e.error)&&e.error({name:t},a,n,r)}("AbortError",t.file,t.inputElem,a.reason);if("skip"==a.action)return void n();"object"==typeof a.config&&(t.instanceConfig=y.extend(t.instanceConfig,a.config))}else if("skip"==a)return void n()}var r=t.instanceConfig.complete;t.instanceConfig.complete=function(e){m(r)&&r(e,t.file,t.inputElem),n()},b.parse(t.file,t.instanceConfig)}else m(e.complete)&&e.complete()}function n(){i.splice(0,1),a()}var r=e.config||{},i=[];return this.each(function(){if(!("INPUT"==y(this).prop("tagName").toUpperCase()&&"file"==y(this).attr("type").toLowerCase()&&t.FileReader)||!this.files||0==this.files.length)return!0;for(var e=0;e<this.files.length;e++)i.push({file:this.files[e],inputElem:this,instanceConfig:y.extend({},r)})}),a(),this}}f?t.onmessage=function(e){var a=e.data;if(void 0===b.WORKER_ID&&a&&(b.WORKER_ID=a.workerId),"string"==typeof a.input)t.postMessage({workerId:b.WORKER_ID,results:b.parse(a.input,a.config),finished:!0});else if(t.File&&a.input instanceof File||a.input instanceof Object){var n=b.parse(a.input,a.config);n&&t.postMessage({workerId:b.WORKER_ID,results:n,finished:!0})}}:b.WORKERS_SUPPORTED&&(h=function(){var e=document.getElementsByTagName("script");return e.length?e[e.length-1].src:""}(),document.body?document.addEventListener("DOMContentLoaded",function(){g=!0},!0):g=!0),n.prototype=Object.create(a.prototype),n.prototype.constructor=n,r.prototype=Object.create(a.prototype),r.prototype.constructor=r,i.prototype=Object.create(i.prototype),i.prototype.constructor=i}("undefined"!=typeof window?window:this)},394:function(e,t,a){var n=a(488),r=a(491),i=a(22),s=a(7);e.exports=function(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{},o=i(a);"function"==typeof r&&(o=o.concat(r(a).filter(function(e){return n(a,e).enumerable}))),o.forEach(function(t){s(e,t,a[t])})}return e}},463:function(e,t,a){"use strict";a.r(t);var n=a(8),r=a.n(n),i=a(9),s=a.n(i),o=a(10),l=a.n(o),c=a(11),u=a.n(c),p=a(12),d=a.n(p),m=a(62),h=a.n(m),f=a(1),g=a.n(f),_=a(267),v=a(0),b=a(2),y=a.n(b),w=a(89),E=a.n(w),k=a(27),I=a.n(k),S=[{name:"email",label:v.a.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:v.a.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:v.a.I18n.t("lastname"),type:"text",disabled:function(e){return Number(e.wp_user_id>0)||1===Number(e.is_woocommerce_user)}},{name:"status",label:v.a.I18n.t("status"),type:"select",values:{subscribed:v.a.I18n.t("subscribed"),unconfirmed:v.a.I18n.t("unconfirmed"),unsubscribed:v.a.I18n.t("unsubscribed"),bounced:v.a.I18n.t("bounced")},filter:function(e,t){return!(Number(e.wp_user_id)>0||1===Number(e.is_woocommerce_user))||"unconfirmed"!==t}},{name:"segments",label:v.a.I18n.t("lists"),type:"selection",placeholder:v.a.I18n.t("selectList"),tip:v.a.I18n.t("welcomeEmailTip"),api_version:window.mailpoet_api_version,endpoint:"segments",multiple:!0,selected:function(e){return!1===h()(e.subscriptions)?null:e.subscriptions.filter(function(e){return"subscribed"===e.status}).map(function(e){return e.segment_id})},filter:function(e){return!e.deleted_at&&"default"===e.type},getLabel:function(e){return"".concat(e.name," (").concat(e.subscribers,")")},getSearchLabel:function(e,t){var a="";return void 0!==t.subscriptions&&t.subscriptions.forEach(function(t){if(e.id===t.segment_id&&(a=e.name,"unsubscribed"===t.status)){var n=v.a.Date.format(t.updated_at);a+=" (%$1s)".replace("%$1s",v.a.I18n.t("unsubscribedOn").replace("%$1s",n))}}),a}}];(window.mailpoet_custom_fields||[]).forEach(function(e){var t={name:"cf_".concat(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=v.a.I18n.t("year"),t.month_placeholder=v.a.I18n.t("month"),t.day_placeholder=v.a.I18n.t("day");break;case"select":t.placeholder="-";break;default:t.placeholder=""}S.push(t)});var N={onUpdate:function(){v.a.Notice.success(v.a.I18n.t("subscriberUpdated"))},onCreate:function(){v.a.Notice.success(v.a.I18n.t("subscriberAdded")),v.a.trackEvent("Subscribers > Add new",{"MailPoet Free version":window.mailpoet_version})}};function x(e){if(Number(e.wp_user_id)>0)return g.a.createElement("p",{className:"description"},I()(v.a.I18n.t("WPUserEditNotice"),/\[link\](.*?)\[\/link\]/g,function(t,a){return g.a.createElement("a",{key:a,href:"user-edit.php?user_id=".concat(e.wp_user_id)},t)}))}function C(){return g.a.createElement("p",{className:"description"},g.a.createElement("strong",null,v.a.I18n.t("tip"))," ",v.a.I18n.t("customFieldsTip"))}var T=function(e){function t(){return r()(this,t),l()(this,u()(t).apply(this,arguments))}return d()(t,e),s()(t,[{key:"render",value:function(){return g.a.createElement("div",null,g.a.createElement("h1",{className:"title"},v.a.I18n.t("subscriber"),g.a.createElement(_.a,{className:"page-title-action",to:"/"},v.a.I18n.t("backToList"))),g.a.createElement(E.a,{automationId:"subscriber_edit_form",endpoint:"subscribers",fields:S,params:this.props.match.params,messages:N,beforeFormContent:x,afterFormContent:C}))}}]),t}(g.a.Component);T.propTypes={match:y.a.shape({params:y.a.shape({id:y.a.string}).isRequired}).isRequired},t.default=T},464:function(e,t,a){var n=a(62);e.exports=function(e){if(n(e)){for(var t=0,a=new Array(e.length);t<e.length;t++)a[t]=e[t];return a}}},465:function(e,t,a){var n=a(466),r=a(470);e.exports=function(e){if(r(Object(e))||"[object Arguments]"===Object.prototype.toString.call(e))return n(e)}},466:function(e,t,a){e.exports=a(467)},467:function(e,t,a){a(80),a(468),e.exports=a(18).Array.from},468:function(e,t,a){"use strict";var n=a(53),r=a(24),i=a(70),s=a(382),o=a(383),l=a(226),c=a(469),u=a(367);r(r.S+r.F*!a(384)(function(e){Array.from(e)}),"Array",{from:function(e){var t,a,r,p,d=i(e),m="function"==typeof this?this:Array,h=arguments.length,f=h>1?arguments[1]:void 0,g=void 0!==f,_=0,v=u(d);if(g&&(f=n(f,h>2?arguments[2]:void 0,2)),null==v||m==Array&&o(v))for(a=new m(t=l(d.length));t>_;_++)c(a,_,g?f(d[_],_):d[_]);else for(p=v.call(d),a=new m;!(r=p.next()).done;_++)c(a,_,g?s(p,f,[r.value,_],!0):r.value);return a.length=_,a}})},469:function(e,t,a){"use strict";var n=a(33),r=a(50);e.exports=function(e,t,a){t in e?n.f(e,t,r(0,a)):e[t]=a}},470:function(e,t,a){e.exports=a(471)},471:function(e,t,a){a(94),a(80),e.exports=a(472)},472:function(e,t,a){var n=a(368),r=a(28)("iterator"),i=a(57);e.exports=a(18).isIterable=function(e){var t=Object(e);return void 0!==t[r]||"@@iterator"in t||i.hasOwnProperty(n(t))}},473:function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},485:function(e,t,a){"use strict";a.r(t);var n=a(1),r=a.n(n),i=a(267),s=a(0),o=a(89),l=a.n(o),c=a(2),u=a.n(c),p=[{name:"name",label:s.a.I18n.t("name"),type:"text"},{name:"description",label:s.a.I18n.t("description"),type:"textarea",tip:s.a.I18n.t("segmentDescriptionTip")}],d={onUpdate:function(){s.a.Notice.success(s.a.I18n.t("segmentUpdated"))},onCreate:function(){s.a.Notice.success(s.a.I18n.t("segmentAdded")),s.a.trackEvent("Lists > Add new",{"MailPoet Free version":window.mailpoet_version})}},m=function(e){return r.a.createElement("div",null,r.a.createElement("h1",{className:"title"},s.a.I18n.t("segment"),r.a.createElement(i.a,{className:"page-title-action",to:"/"},s.a.I18n.t("backToList"))),r.a.createElement(l.a,{endpoint:"segments",fields:p,params:e.match.params,messages:d}))};m.propTypes={match:u.a.shape({params:u.a.shape({id:u.a.string}).isRequired}).isRequired},t.default=m},487:function(e,t){jQuery.AsyncQueue=function(){var e,t,a,n,r=this,s=[],o=!1;return n=function(){var e=s.shift();e?(e.apply(r,[r]),!1===o&&n()):t&&t.apply(r)},this.onFailure=function(t){e=t},this.onComplete=function(e){t=e},this.add=function(e){return s.push(e),this},this.storeData=function(e){return a=e,this},this.lastCallbackData=function(){return a},this.run=function(){o=!1,n()},this.pause=function(){return o=!0,this},this.failure=function(){if(o=!0,e){var t=[r];for(i=0;i<arguments.length;i++)t.push(arguments[i]);e.apply(r,t)}},this}},488:function(e,t,a){e.exports=a(489)},489:function(e,t,a){a(490);var n=a(18).Object;e.exports=function(e,t){return n.getOwnPropertyDescriptor(e,t)}},490:function(e,t,a){var n=a(48),r=a(232).f;a(227)("getOwnPropertyDescriptor",function(){return function(e,t){return r(n(e),t)}})},491:function(e,t,a){e.exports=a(492)},492:function(e,t,a){a(258),e.exports=a(18).Object.getOwnPropertySymbols},506:function(e,t,a){"use strict";a.r(t);var n=a(1),r=a.n(n),i=a(21),s=a.n(i),o=a(260),l=a.n(o),c=a(2),u=a.n(c),p=a(87),d=a(32),m=a.n(d),h=a(35),f=a.n(h),g=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e};function _(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var v=function(e){function t(){var a,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var r=arguments.length,i=Array(r),s=0;s<r;s++)i[s]=arguments[s];return a=n=_(this,e.call.apply(e,[this].concat(i))),n.state={match:n.computeMatch(n.props.history.location.pathname)},_(n,a)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.getChildContext=function(){return{router:g({},this.context.router,{history:this.props.history,route:{location:this.props.history.location,match:this.state.match}})}},t.prototype.computeMatch=function(e){return{path:"/",url:"/",params:{},isExact:"/"===e}},t.prototype.componentWillMount=function(){var e=this,t=this.props,a=t.children,n=t.history;f()(null==a||1===r.a.Children.count(a),"A <Router> may have only one child element"),this.unlisten=n.listen(function(){e.setState({match:e.computeMatch(n.location.pathname)})})},t.prototype.componentWillReceiveProps=function(e){m()(this.props.history===e.history,"You cannot change <Router history>")},t.prototype.componentWillUnmount=function(){this.unlisten()},t.prototype.render=function(){var e=this.props.children;return e?r.a.Children.only(e):null},t}(r.a.Component);v.propTypes={history:u.a.object.isRequired,children:u.a.node},v.contextTypes={router:u.a.object},v.childContextTypes={router:u.a.object.isRequired};var b=v;function y(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var w=function(e){function t(){var a,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var r=arguments.length,i=Array(r),s=0;s<r;s++)i[s]=arguments[s];return a=n=y(this,e.call.apply(e,[this].concat(i))),n.history=Object(p.createHashHistory)(n.props),y(n,a)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.componentWillMount=function(){l()(!this.props.history,"<HashRouter> ignores the history prop. To use a custom history, use `import { Router }` instead of `import { HashRouter as Router }`.")},t.prototype.render=function(){return r.a.createElement(b,{history:this.history,children:this.props.children})},t}(r.a.Component);w.propTypes={basename:u.a.string,getUserConfirmation:u.a.func,hashType:u.a.oneOf(["hashbang","noslash","slash"]),children:u.a.node};var E=w,k=a(264);var I=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.componentWillMount=function(){f()(this.context.router,"You should not use <Switch> outside a <Router>")},t.prototype.componentWillReceiveProps=function(e){m()(!(e.location&&!this.props.location),'<Switch> elements should not change from uncontrolled to controlled (or vice versa). You initially used no "location" prop and then provided one on a subsequent render.'),m()(!(!e.location&&this.props.location),'<Switch> elements should not change from controlled to uncontrolled (or vice versa). You provided a "location" prop initially but omitted it on a subsequent render.')},t.prototype.render=function(){var e=this.context.router.route,t=this.props.children,a=this.props.location||e.location,n=void 0,i=void 0;return r.a.Children.forEach(t,function(t){if(null==n&&r.a.isValidElement(t)){var s=t.props,o=s.path,l=s.exact,c=s.strict,u=s.sensitive,p=s.from,d=o||p;i=t,n=Object(k.a)(a.pathname,{path:d,exact:l,strict:c,sensitive:u},e.match)}}),n?r.a.cloneElement(i,{location:a,computedMatch:n}):null},t}(r.a.Component);I.contextTypes={router:u.a.shape({route:u.a.object.isRequired}).isRequired},I.propTypes={children:u.a.node,location:u.a.object};var S=I,N=a(263).a,x=a(8),C=a.n(x),T=a(9),P=a.n(T),R=a(10),A=a.n(R),D=a(11),j=a.n(D),L=a(12),O=a.n(L),M=a(6),q=a.n(M),F=a(7),B=a.n(F),$=a(267),H=a(3),V=a.n(H),W=a(0),z=a(16),U=a.n(z),Y=a(47),K=a.n(Y),G=a(100),J=a.n(G),Q=[{name:"email",label:W.a.I18n.t("subscriber"),sortable:!0},{name:"status",label:W.a.I18n.t("status"),sortable:!0},{name:"segments",label:W.a.I18n.t("lists")},{name:"created_at",label:W.a.I18n.t("subscribedOn"),sortable:!0},{name:"updated_at",label:W.a.I18n.t("lastModifiedOn"),sortable:!0}],X={onTrash:function(e){var t=Number(e.meta.count),a=null;a=1===t?W.a.I18n.t("oneSubscriberTrashed"):W.a.I18n.t("multipleSubscribersTrashed").replace("%$1d",t.toLocaleString()),W.a.Notice.success(a)},onDelete:function(e){var t=Number(e.meta.count),a=null;a=1===t?W.a.I18n.t("oneSubscriberDeleted"):W.a.I18n.t("multipleSubscribersDeleted").replace("%$1d",t.toLocaleString()),W.a.Notice.success(a)},onRestore:function(e){var t=Number(e.meta.count),a=null;a=1===t?W.a.I18n.t("oneSubscriberRestored"):W.a.I18n.t("multipleSubscribersRestored").replace("%$1d",t.toLocaleString()),W.a.Notice.success(a)},onNoItemsFound:function(e){return"bounced"===e&&!window.mailpoet_premium_active&&!window.mss_active&&r.a.createElement("div",null,r.a.createElement("p",null,W.a.I18n.t("bouncedSubscribersHelp")),r.a.createElement("p",null,r.a.createElement("a",{href:"admin.php?page=mailpoet-premium",className:"button-primary"},W.a.I18n.t("bouncedSubscribersPremiumButtonText"))))}},Z=[{name:"moveToList",label:W.a.I18n.t("moveToList"),onSelect:function(){return r.a.createElement(J.a,{field:{id:"move_to_segment",name:"move_to_segment",endpoint:"segments",filter:function(e){return!(e.deleted_at||"default"!==e.type)}}})},getData:function(){return{segment_id:Number(V()("#move_to_segment").val())}},onSuccess:function(e){W.a.Notice.success(W.a.I18n.t("multipleSubscribersMovedToList").replace("%$1d",Number(e.meta.count).toLocaleString()).replace("%$2s",e.meta.segment))}},{name:"addToList",label:W.a.I18n.t("addToList"),onSelect:function(){return r.a.createElement(J.a,{field:{id:"add_to_segment",name:"add_to_segment",endpoint:"segments",filter:function(e){return!(e.deleted_at||"default"!==e.type)}}})},getData:function(){return{segment_id:Number(V()("#add_to_segment").val())}},onSuccess:function(e){W.a.Notice.success(W.a.I18n.t("multipleSubscribersAddedToList").replace("%$1d",Number(e.meta.count).toLocaleString()).replace("%$2s",e.meta.segment))}},{name:"removeFromList",label:W.a.I18n.t("removeFromList"),onSelect:function(){return r.a.createElement(J.a,{field:{id:"remove_from_segment",name:"remove_from_segment",endpoint:"segments",filter:function(e){return!("default"!==e.type)}}})},getData:function(){return{segment_id:Number(V()("#remove_from_segment").val())}},onSuccess:function(e){W.a.Notice.success(W.a.I18n.t("multipleSubscribersRemovedFromList").replace("%$1d",Number(e.meta.count).toLocaleString()).replace("%$2s",e.meta.segment))}},{name:"removeFromAllLists",label:W.a.I18n.t("removeFromAllLists"),onSuccess:function(e){W.a.Notice.success(W.a.I18n.t("multipleSubscribersRemovedFromAllLists").replace("%$1d",Number(e.meta.count).toLocaleString()))}},{name:"sendConfirmationEmail",label:W.a.I18n.t("resendConfirmationEmail"),onSuccess:function(e){W.a.Notice.success(W.a.I18n.t("multipleConfirmationEmailsSent").replace("%$1d",Number(e.meta.count).toLocaleString()))}},{name:"trash",label:W.a.I18n.t("moveToTrash"),onSuccess:X.onTrash}],ee=[{name:"edit",label:W.a.I18n.t("edit"),link:function(e){return r.a.createElement($.a,{to:"/edit/".concat(e.id)},W.a.I18n.t("edit"))}},{name:"trash",display:function(e){return 0===Number(e.wp_user_id)&&0===Number(e.is_woocommerce_user)}}],te=function(e){function t(){var e,a;C()(this,t);for(var n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return a=A()(this,(e=j()(t)).call.apply(e,[this].concat(i))),B()(q()(q()(a)),"getSegmentFromId",function(e){var t=!1;return window.mailpoet_segments.forEach(function(a){a.id===e&&(t=a)}),t}),B()(q()(q()(a)),"renderItem",function(e,t){var n=U()("manage-column","column-primary","has-row-actions","column-username"),i="";switch(e.status){case"subscribed":i=W.a.I18n.t("subscribed");break;case"unconfirmed":i=W.a.I18n.t("unconfirmed");break;case"unsubscribed":i=W.a.I18n.t("unsubscribed");break;case"bounced":i=W.a.I18n.t("bounced");break;default:i="Invalid"}var s=!1;if(e.subscriptions.length>0){var o=[];e.subscriptions.forEach(function(e){var t=a.getSegmentFromId(e.segment_id);!1!==t&&"subscribed"===e.status&&o.push(t.name)}),s=r.a.createElement("span",null,o.join(", "))}return r.a.createElement("div",null,r.a.createElement("td",{className:n},r.a.createElement("strong",null,r.a.createElement($.a,{className:"row-title",to:"/edit/".concat(e.id)},e.email)),r.a.createElement("p",{style:{margin:0}},e.first_name," ",e.last_name),t),r.a.createElement("td",{className:"column","data-colname":W.a.I18n.t("status")},i),r.a.createElement("td",{className:"column","data-colname":W.a.I18n.t("lists")},s),r.a.createElement("td",{className:"column-date","data-colname":W.a.I18n.t("subscribedOn")},r.a.createElement("abbr",null,W.a.Date.format(e.created_at))),r.a.createElement("td",{className:"column-date","data-colname":W.a.I18n.t("lastModifiedOn")},r.a.createElement("abbr",null,W.a.Date.format(e.updated_at))))}),a}return O()(t,e),P()(t,[{key:"render",value:function(){return r.a.createElement("div",null,r.a.createElement("h1",{className:"title"},W.a.I18n.t("pageTitle")," ",r.a.createElement($.a,{className:"page-title-action",to:"/new"},W.a.I18n.t("new")),r.a.createElement("a",{className:"page-title-action",href:"?page=mailpoet-import","data-automation-id":"import-subscribers-button"},W.a.I18n.t("import")),r.a.createElement("a",{id:"mailpoet_export_button",className:"page-title-action",href:"?page=mailpoet-export"},W.a.I18n.t("export"))),r.a.createElement(K.a,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,endpoint:"subscribers",onRenderItem:this.renderItem,columns:Q,bulk_actions:Z,item_actions:ee,messages:X,sort_by:"created_at",sort_order:"desc"}))}}]),t}(r.a.Component);te.propTypes={location:u.a.object.isRequired,match:u.a.shape({params:u.a.object}).isRequired};var ae=te,ne=a(374),re=a.n(ne),ie=document.getElementById("subscribers_container");ie&&s.a.render(r.a.createElement(E,null,r.a.createElement(S,null,r.a.createElement(N,{path:"/new",component:re.a}),r.a.createElement(N,{path:"/edit/:id",component:re.a}),r.a.createElement(N,{path:"*",component:ae}))),ie);var se=a(67),oe=a.n(se),le=a(91),ce=a(96),ue=a.n(ce),pe={},de=0,me=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"/"===e?e:function(e){var t=e,a=pe[t]||(pe[t]={});if(a[e])return a[e];var n=ue.a.compile(e);return de<1e4&&(a[e]=n,de++),n}(e)(t,{pretty:!0})},he=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e};var fe=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.isStatic=function(){return this.context.router&&this.context.router.staticContext},t.prototype.componentWillMount=function(){f()(this.context.router,"You should not use <Redirect> outside a <Router>"),this.isStatic()&&this.perform()},t.prototype.componentDidMount=function(){this.isStatic()||this.perform()},t.prototype.componentDidUpdate=function(e){var t=Object(le.createLocation)(e.to),a=Object(le.createLocation)(this.props.to);Object(le.locationsAreEqual)(t,a)?m()(!1,"You tried to redirect to the same route you're currently on: \""+a.pathname+a.search+'"'):this.perform()},t.prototype.computeTo=function(e){var t=e.computedMatch,a=e.to;return t?"string"==typeof a?me(a,t.params):he({},a,{pathname:me(a.pathname,t.params)}):a},t.prototype.perform=function(){var e=this.context.router.history,t=this.props.push,a=this.computeTo(this.props);t?e.push(a):e.replace(a)},t.prototype.render=function(){return null},t}(r.a.Component);fe.propTypes={computedMatch:u.a.object,push:u.a.bool,from:u.a.string,to:u.a.oneOfType([u.a.string,u.a.object]).isRequired},fe.defaultProps={push:!1},fe.contextTypes={router:u.a.shape({history:u.a.shape({push:u.a.func.isRequired,replace:u.a.func.isRequired}).isRequired,staticContext:u.a.object}).isRequired};var ge=fe,_e=a(19),ve=a.n(_e),be=a(4),ye=a.n(be),we=a(42),Ee=a.n(we),ke=a(515),Ie=function(e){function t(){var e,a;C()(this,t);for(var n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return a=A()(this,(e=j()(t)).call.apply(e,[this].concat(i))),B()(q()(q()(a)),"setupNewsletter",function(e){void 0!==e&&(a.props.history.push("/new/".concat(e)),W.a.trackEvent("Emails > Type selected",{"MailPoet Free version":window.mailpoet_version,"Email type":e}))}),B()(q()(q()(a)),"getAutomaticEmails",function(){return window.mailpoet_automatic_emails?ye.a.map(window.mailpoet_automatic_emails,function(e){var t=e,n=window.mailpoet_premium_active?ye.a.partial(a.setupNewsletter,e.slug):void 0;return t.action=r.a.createElement("div",null,r.a.createElement("a",{className:"button button-primary",onClick:n,role:"button",tabIndex:0,disabled:!window.mailpoet_premium_active,onKeyDown:function(e){["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),a.onClick())}},W.a.I18n.t("setUp"))),t}):[]}),B()(q()(q()(a)),"createNewsletter",function(e){W.a.trackEvent("Emails > Type selected",{"MailPoet Free version":window.mailpoet_version,"Email type":e}),W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:{type:e,subject:W.a.I18n.t("draftNewsletterTitle")}}).done(function(e){a.props.history.push("/template/".concat(e.data.id))}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})})}),a}return O()(t,e),P()(t,[{key:"render",value:function(){var e=ye.a.partial(this.createNewsletter,"standard"),t=ye.a.partial(this.setupNewsletter,"notification"),a=ye.a.partial(this.setupNewsletter,"welcome"),n=[{slug:"standard",title:W.a.I18n.t("regularNewsletterTypeTitle"),description:W.a.I18n.t("regularNewsletterTypeDescription"),action:r.a.createElement("a",{className:"button button-primary","data-automation-id":"create_standard",onClick:e,role:"button",tabIndex:0,onKeyDown:function(t){["keydown","keypress"].includes(t.type)&&["Enter"," "].includes(t.key)&&(t.preventDefault(),e())}},W.a.I18n.t("create"))},{slug:"welcome",title:W.a.I18n.t("welcomeNewsletterTypeTitle"),description:W.a.I18n.t("welcomeNewsletterTypeDescription"),videoGuide:"https://beta.docs.mailpoet.com/article/254-video-guide-to-welcome-emails",action:r.a.createElement("a",{className:"button button-primary",onClick:a,"data-automation-id":"create_welcome",onKeyDown:function(e){["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),a())},role:"button",tabIndex:0},W.a.I18n.t("setUp"))},{slug:"notification",title:W.a.I18n.t("postNotificationNewsletterTypeTitle"),description:W.a.I18n.t("postNotificationNewsletterTypeDescription"),videoGuide:"https://beta.docs.mailpoet.com/article/210-video-guide-to-post-notifications",action:r.a.createElement("a",{className:"button button-primary","data-automation-id":"create_notification",onClick:t,role:"button",tabIndex:0,onKeyDown:function(e){["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),t())}},W.a.I18n.t("setUp"))}],i=ve.a.applyFilters("mailpoet_newsletters_types",n.concat(oe()(this.getAutomaticEmails())),this),s=!0===window.mailpoet_is_new_user?"mailpoet_badge mailpoet_badge_video":"mailpoet_badge mailpoet_badge_video mailpoet_badge_video_grey";return r.a.createElement("div",null,r.a.createElement("h1",null,W.a.I18n.t("pickCampaignType")),r.a.createElement(Ee.a,{step:"type"}),r.a.createElement("ul",{className:"mailpoet_boxes mailpoet_boxes_types"},i.map(function(e){return r.a.createElement("li",{key:e.slug,"data-type":e.slug,className:"mailpoet_newsletter_types"},r.a.createElement("div",{className:"mailpoet_thumbnail"},e.thumbnailImage?r.a.createElement("img",{src:e.thumbnailImage,alt:""}):null),r.a.createElement("div",{className:"mailpoet_boxes_content"},r.a.createElement("div",{className:"mailpoet_description"},r.a.createElement("h3",null,e.title," ",e.beta?"(".concat(W.a.I18n.t("beta"),")"):""),r.a.createElement("p",null,e.description),e.videoGuide&&r.a.createElement("a",{className:s,href:e.videoGuide,target:"_blank",rel:"noopener noreferrer"},r.a.createElement("span",{className:"dashicons dashicons-format-video"}),W.a.I18n.t("seeVideoGuide"))),r.a.createElement("div",{className:"mailpoet_actions"},e.action)))},this)))}}]),t}(r.a.Component);B()(Ie,"propTypes",{history:u.a.shape({push:u.a.func.isRequired}).isRequired});var Se=Object(ke.a)(Ie),Ne=a(36),xe=a.n(Ne),Ce=a(15),Te=a.n(Ce),Pe=a(22),Re=a.n(Pe),Ae=function(e){function t(){return C()(this,t),A()(this,j()(t).apply(this,arguments))}return O()(t,e),P()(t,[{key:"componentWillMount",value:function(){W.a.Modal.loading(!0)}},{key:"componentWillUnmount",value:function(){W.a.Modal.loading(!1)}},{key:"render",value:function(){return null}}]),t}(r.a.Component),De=function(e){var t=e.tabs,a=e.selected,n=e.select;return r.a.createElement("div",{className:"wp-filter hide-if-no-js"},r.a.createElement("ul",{className:"filter-links"},t.map(function(e){var t=e.name,i=e.label;return r.a.createElement("li",{key:t},r.a.createElement("a",{href:"javascript:",className:a===t?"current":"",onClick:function(){return n(t)}}," ",i))})))};De.propTypes={selected:u.a.string.isRequired,select:u.a.func.isRequired,tabs:u.a.arrayOf(u.a.shape({label:u.a.string.isRequired,name:u.a.string.isRequired}).isRequired).isRequired};var je=De,Le=a(247),Oe=a.n(Le),Me=function(e){return W.a.Modal.popup({title:e.title,template:Oe.a.renderToString(r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,e.message),r.a.createElement("button",{id:"mailpoet_alert_cancel",className:"button button-secondary",type:"button"},e.cancelLabel),r.a.createElement("button",{id:"mailpoet_alert_confirm",className:"button button-primary",type:"submit"},e.confirmLabel))),onInit:function(){document.getElementById("mailpoet_alert_confirm").addEventListener("click",function(){W.a.Modal.close(),e.onConfirm()}),document.getElementById("mailpoet_alert_cancel").addEventListener("click",function(){return W.a.Modal.close()})}}),null};function qe(e){Oe.a.renderToString(r.a.createElement(Me,e))}Me.propTypes={title:u.a.string,message:u.a.string.isRequired,cancelLabel:u.a.string,confirmLabel:u.a.string,onConfirm:u.a.func.isRequired},Me.defaultProps={title:W.a.I18n.t("confirmTitle"),cancelLabel:W.a.I18n.t("cancelLabel"),confirmLabel:W.a.I18n.t("confirmLabel")};var Fe=function(e){function t(e){var a;return C()(this,t),(a=A()(this,j()(t).call(this,e))).onPreview=a.onPreview.bind(q()(q()(a))),a.onDelete=a.onDelete.bind(q()(q()(a))),a.onSelect=a.onSelect.bind(q()(q()(a))),a}return O()(t,e),P()(t,[{key:"onDelete",value:function(){var e=this.props,t=e.id,a=e.name,n=e.beforeDelete,r=e.afterDelete;qe({message:W.a.I18n.t("confirmTemplateDeletion").replace("%$1s",a),onConfirm:function(){n(),W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"delete",data:{id:t}}).done(function(){r(!0,t)}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0}),r(!1)})}})}},{key:"onPreview",value:function(){W.a.Modal.popup({title:this.props.name,template:'<div class="mailpoet_boxes_preview" style="background-color: {{ body.globalStyles.body.backgroundColor }}"><img src="{{ thumbnail }}" /></div>',data:this.props})}},{key:"onSelect",value:function(){var e=this.props,t=e.newsletterId,a=e.name,n=e.beforeSelect,r=e.afterSelect;n(),W.a.trackEvent("Emails > Template selected",{"MailPoet Free version":window.mailpoet_version,"Email name":a}),W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"save",data:{id:t,template_id:this.props.id}}).done(function(e){r(!0,e.data.id)}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0}),r(!1)})}},{key:"render",value:function(){var e=this,t=this.props,a=t.index,n=t.name,i=t.thumbnail,s=t.readonly,o=r.a.createElement("button",{className:"mailpoet_delete button button-secondary",onClick:this.onDelete,type:"button"},W.a.I18n.t("delete")),l="";return"string"==typeof i&&i.length>0&&(l=r.a.createElement("a",{href:"javascript:;",onClick:this.onPreview},r.a.createElement("img",{src:i,alt:W.a.I18n.t("templatePreview")}),r.a.createElement("div",{className:"mailpoet_overlay"},r.a.createElement("p",{className:"mailpoet_more_details"},W.a.I18n.t("zoom"))))),r.a.createElement("li",{className:"mailpoet_template_boxes","data-automation-id":"select_template_box"},r.a.createElement("div",{className:"mailpoet_thumbnail"},l),r.a.createElement("div",{className:"mailpoet_template_content"},r.a.createElement("div",{className:"mailpoet_description"},r.a.createElement("h3",null,n)),r.a.createElement("div",{className:"mailpoet_actions"},"1"!==s&&o,r.a.createElement("a",{className:"button button-primary","data-automation-id":"select_template_".concat(a),onClick:this.onSelect,role:"button",tabIndex:0,onKeyDown:function(t){["keydown","keypress"].includes(t.type)&&["Enter"," "].includes(t.key)&&(t.preventDefault(),e.onSelect())}}," ",W.a.I18n.t("select")," "))))}}]),t}(r.a.Component);Fe.propTypes={index:u.a.number.isRequired,id:u.a.string.isRequired,newsletterId:u.a.string.isRequired,name:u.a.string.isRequired,thumbnail:u.a.string.isRequired,readonly:u.a.string.isRequired,beforeDelete:u.a.func.isRequired,afterDelete:u.a.func.isRequired,beforeSelect:u.a.func.isRequired,afterSelect:u.a.func.isRequired};var Be=Fe,$e=a(20),He=a.n($e),Ve=a(63),We=function(e){function t(e){var a;return C()(this,t),(a=A()(this,j()(t).call(this,e))).fileRef=r.a.createRef(),a.handleSubmit=a.handleSubmit.bind(q()(q()(a))),a}return O()(t,e),P()(t,[{key:"saveTemplate",value:function(e){var t=e,a=this.props,n=a.beforeImport,r=a.afterImport;ye.a.isUndefined(t.body)||(t.body=He()(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=He()(t.categories),n(),W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"save",data:t}).done(function(e){r(!0,e.data)}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0}),r(!1)})}},{key:"handleSubmit",value:function(e){var t=this;if(e.preventDefault(),ye.a.size(this.fileRef.current.files)<=0)return!1;var a=ye.a.first(this.fileRef.current.files),n=new FileReader;return n.onload=function(e){try{t.saveTemplate(JSON.parse(e.target.result)),W.a.trackEvent("Emails > Template imported",{"MailPoet Free version":window.mailpoet_version})}catch(e){W.a.Notice.error(W.a.I18n.t("templateFileMalformedError"))}},n.readAsText(a),!0}},{key:"render",value:function(){return r.a.createElement("div",null,r.a.createElement("h2",null,W.a.I18n.t("importTemplateTitle"),r.a.createElement(Ve.a,{tooltip:W.a.I18n.t("helpTooltipTemplateUpload"),place:"right",className:"tooltip-help-import-template"})),r.a.createElement("form",{onSubmit:this.handleSubmit},r.a.createElement("input",{type:"file",placeholder:W.a.I18n.t("selectJsonFileToUpload"),ref:this.fileRef}),r.a.createElement("p",{className:"submit"},r.a.createElement("input",{className:"button button-primary",type:"submit",value:W.a.I18n.t("upload")}))))}}]),t}(r.a.Component);We.propTypes={beforeImport:u.a.func.isRequired,afterImport:u.a.func.isRequired};var ze=We,Ue=[{name:"standard",label:W.a.I18n.t("tabStandardTitle")},{name:"welcome",label:W.a.I18n.t("tabWelcomeTitle")},{name:"notification",label:W.a.I18n.t("tabNotificationTitle")}];window.mailpoet_woocommerce_active&&Ue.push({name:"woocommerce",label:W.a.I18n.t("tabWoocommerceTitle")}),Ue.push.apply(Ue,[{name:"all",label:W.a.I18n.t("allTemplates")},{name:"recent",label:W.a.I18n.t("recentlySent")},{name:"saved",label:W.a.I18n.t("savedTemplates")}]);var Ye=function(e){function t(e){var a;return C()(this,t),(a=A()(this,j()(t).call(this,e))).state={loading:!0,templates:{},emailType:null,selectedTab:""},a.templates={},a.addTemplate=a.addTemplate.bind(q()(q()(a))),a.afterTemplateDelete=a.afterTemplateDelete.bind(q()(q()(a))),a.afterTemplateSelect=a.afterTemplateSelect.bind(q()(q()(a))),a.afterTemplateImport=a.afterTemplateImport.bind(q()(q()(a))),a}return O()(t,e),P()(t,[{key:"componentWillMount",value:function(){var e=this;W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"getAll"}).done(function(t){0===t.data.length&&(t.data=[{name:W.a.I18n.t("mailpoetGuideTemplateTitle"),categories:'["welcome", "notification", "standard", "woocommerce"]',readonly:"1"}]),t.data.forEach(e.addTemplate),e.sortTemplates()}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})}).always(function(){e.selectInitialTab()})}},{key:"addTemplate",value:function(e){var t,a=this,n=Ue.map(function(e){return e.name});try{t=JSON.parse(e.categories).filter(function(e){return-1!==n.indexOf(e)})}catch(e){t=[]}0===t.length&&t.push("saved"),t.forEach(function(t){void 0===a.templates[t]&&(a.templates[t]=[]),a.templates[t].unshift(e)})}},{key:"sortTemplates",value:function(){var e=this;Re()(this.templates).forEach(function(t){e.templates[t].sort(function(e,t){return Te()(e.id,10)<Te()(t.id,10)?1:-1})})}},{key:"selectInitialTab",value:function(){var e,t=this,a="standard";W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"get",data:{id:this.props.match.params.id}}).done(function(t){e=t.data.type,ye.a.findWhere(Ue,{name:t.data.type})?a=t.data.type:"automatic"===t.data.type&&ye.a.findWhere(Ue,{name:t.data.options.group})&&(a=t.data.options.group)}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})}).always(function(){t.setState({templates:t.templates,emailType:e,selectedTab:a,loading:!1})})}},{key:"afterTemplateDelete",value:function(e,t){var a=this;e&&Re()(this.templates).forEach(function(e){a.templates[e]=a.templates[e].filter(function(e){return e.id!==t})}),this.setState({templates:this.templates,loading:!1})}},{key:"afterTemplateSelect",value:function(e,t){e?window.location=function(e){return"admin.php?page=mailpoet-newsletter-editor&id=".concat(e)}(t):this.setState({loading:!1})}},{key:"afterTemplateImport",value:function(e,t){e&&this.addTemplate(t),this.setState({templates:this.templates,selectedTab:e?"saved":"import",loading:!1})}},{key:"render",value:function(){var e=this;if(this.state.loading)return r.a.createElement(Ae,null);var t=Ue.concat({name:"import",label:W.a.I18n.t("tabImportTitle")}),a=null;if("import"===this.state.selectedTab)a=r.a.createElement(ze,{beforeImport:function(){return e.setState({loading:!0})},afterImport:this.afterTemplateImport});else{var n=this.state.templates[this.state.selectedTab]||[];n=0===n.length?this.state.loading?null:r.a.createElement("p",null,W.a.I18n.t("noTemplates")):n.map(function(t,a){return r.a.createElement(Be,xe()({key:t.id,index:a,newsletterId:e.props.match.params.id,beforeDelete:function(){return e.setState({loading:!0})},afterDelete:e.afterTemplateDelete,beforeSelect:function(){return e.setState({loading:!0})},afterSelect:e.afterTemplateSelect},t))}),a=r.a.createElement("ul",{className:"mailpoet_boxes clearfix"},n)}var i=ve.a.applyFilters("mailpoet_newsletters_template_breadcrumb",r.a.createElement(Ee.a,{step:"template"}),this.state.emailType,"template");return r.a.createElement("div",null,r.a.createElement("h1",null,W.a.I18n.t("selectTemplateTitle")),i,r.a.createElement(je,{tabs:t,selected:this.state.selectedTab,select:function(t){return e.setState({selectedTab:t})}}),a)}}]),t}(r.a.Component);Ye.propTypes={match:u.a.shape({params:u.a.shape({id:u.a.string}).isRequired}).isRequired};var Ke=Ye,Ge=a(51),Je=a.n(Ge),Qe=a(89),Xe=a.n(Qe),Ze=a(45),et=a.n(Ze),tt=a(58),at=a.n(tt),nt={closeText:W.a.I18n.t("close"),currentText:W.a.I18n.t("today"),nextText:W.a.I18n.t("next"),prevText:W.a.I18n.t("previous"),monthNames:[W.a.I18n.t("january"),W.a.I18n.t("february"),W.a.I18n.t("march"),W.a.I18n.t("april"),W.a.I18n.t("may"),W.a.I18n.t("june"),W.a.I18n.t("july"),W.a.I18n.t("august"),W.a.I18n.t("september"),W.a.I18n.t("october"),W.a.I18n.t("november"),W.a.I18n.t("december")],monthNamesShort:[W.a.I18n.t("januaryShort"),W.a.I18n.t("februaryShort"),W.a.I18n.t("marchShort"),W.a.I18n.t("aprilShort"),W.a.I18n.t("mayShort"),W.a.I18n.t("juneShort"),W.a.I18n.t("julyShort"),W.a.I18n.t("augustShort"),W.a.I18n.t("septemberShort"),W.a.I18n.t("octoberShort"),W.a.I18n.t("novemberShort"),W.a.I18n.t("decemberShort")],dayNames:[W.a.I18n.t("sunday"),W.a.I18n.t("monday"),W.a.I18n.t("tuesday"),W.a.I18n.t("wednesday"),W.a.I18n.t("thursday"),W.a.I18n.t("friday"),W.a.I18n.t("saturday")],dayNamesShort:[W.a.I18n.t("sundayShort"),W.a.I18n.t("mondayShort"),W.a.I18n.t("tuesdayShort"),W.a.I18n.t("wednesdayShort"),W.a.I18n.t("thursdayShort"),W.a.I18n.t("fridayShort"),W.a.I18n.t("saturdayShort")],dayNamesMin:[W.a.I18n.t("sundayMin"),W.a.I18n.t("mondayMin"),W.a.I18n.t("tuesdayMin"),W.a.I18n.t("wednesdayMin"),W.a.I18n.t("thursdayMin"),W.a.I18n.t("fridayMin"),W.a.I18n.t("saturdayMin")]},rt=function(e){function t(e){var a;return C()(this,t),a=A()(this,j()(t).call(this,e)),B()(q()(q()(a)),"onChange",function(e){var t=e,n=t.target.value,r=a.getStorageDate(n);t.target.value=r,a.props.onChange(t)}),B()(q()(q()(a)),"getFieldName",function(){return a.props.name||"date"}),B()(q()(q()(a)),"getDisplayDate",function(e){var t={parseFormat:a.props.storageFormat,format:a.props.displayFormat};return W.a.Date.format(e,t)}),B()(q()(q()(a)),"getStorageDate",function(e){var t={parseFormat:a.props.displayFormat,format:a.props.storageFormat};return W.a.Date.format(e,t)}),a.dateInput=r.a.createRef(),a}return O()(t,e),P()(t,[{key:"componentDidMount",value:function(){var e=V()(this.dateInput.current),t=this;e.datepicker&&(V.a.datepicker.parseDate=function(e,t){return W.a.Date.toDate(t,{parseFormat:this.props.displayFormat,format:e})},V.a.datepicker.formatDate=function(e,t){return W.a.Date.format(t,{format:e})},e.datepicker(ye.a.extend({dateFormat:this.props.displayFormat,isRTL:!1,onSelect:function(e){t.onChange({target:{name:t.getFieldName(),value:e}})}},nt)),this.datepickerInitialized=!0)}},{key:"componentWillUnmount",value:function(){this.datepickerInitialized&&V()(this.dateInput.current).datepicker("destroy")}},{key:"render",value:function(){return r.a.createElement("input",xe()({type:"text",size:"30",name:this.getFieldName(),value:this.getDisplayDate(this.props.value),readOnly:!0,disabled:this.props.disabled,onChange:this.onChange,ref:this.dateInput},this.props.validation))}}]),t}(r.a.Component);rt.propTypes={displayFormat:u.a.string.isRequired,onChange:u.a.func.isRequired,name:u.a.string,storageFormat:u.a.string.isRequired,value:u.a.string.isRequired,disabled:u.a.bool.isRequired,validation:u.a.object.isRequired},rt.defaultProps={name:"date"};var it=rt,st=function(e){function t(){return C()(this,t),A()(this,j()(t).apply(this,arguments))}return O()(t,e),P()(t,[{key:"render",value:function(){var e=this,t=Re()(this.props.timeOfDayItems).map(function(t){return r.a.createElement("option",{key:"option-".concat(e.props.timeOfDayItems[t]),value:t},e.props.timeOfDayItems[t])});return r.a.createElement("select",xe()({name:this.props.name||"time",value:this.props.value,disabled:this.props.disabled,onChange:this.props.onChange},this.props.validation),t)}}]),t}(r.a.Component);st.propTypes={timeOfDayItems:u.a.objectOf(u.a.string).isRequired,name:u.a.string,value:u.a.string.isRequired,disabled:u.a.bool,onChange:u.a.func.isRequired,validation:u.a.object},st.defaultProps={name:"time",disabled:!1,validation:{}};var ot=st,lt=function(e){function t(e){var a;return C()(this,t),a=A()(this,j()(t).call(this,e)),B()(q()(q()(a)),"DATE_TIME_SEPARATOR"," "),B()(q()(q()(a)),"getDateTime",function(){return[a.state.date,a.state.time].join(a.DATE_TIME_SEPARATOR)}),B()(q()(q()(a)),"buildStateFromProps",function(e){var t=(e.value||a.props.defaultDateTime).split(a.DATE_TIME_SEPARATOR),n=at()(t,2);return{date:n[0],time:n[1]}}),B()(q()(q()(a)),"handleChange",function(e){var t={};t[e.target.name]=e.target.value,a.setState(t,a.propagateChange)}),B()(q()(q()(a)),"propagateChange",function(){a.props.onChange&&a.props.onChange({target:{name:a.props.name||"",value:a.getDateTime()}})}),a.state=a.buildStateFromProps(e),a}return O()(t,e),P()(t,[{key:"componentWillReceiveProps",value:function(e){this.setState(this.buildStateFromProps(e))}},{key:"render",value:function(){return r.a.createElement("span",null,r.a.createElement(it,{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}),r.a.createElement(ot,{name:"time",value:this.state.time,onChange:this.handleChange,disabled:this.props.disabled,validation:this.props.timeValidation,timeOfDayItems:this.props.timeOfDayItems}))}}]),t}(r.a.Component);lt.propTypes={defaultDateTime:u.a.string.isRequired,dateDisplayFormat:u.a.string.isRequired,dateStorageFormat:u.a.string.isRequired,onChange:u.a.func,name:u.a.string,disabled:u.a.bool,dateValidation:u.a.object.isRequired,timeValidation:u.a.any,timeOfDayItems:u.a.objectOf(u.a.string).isRequired},lt.defaultProps={onChange:void 0,name:"",disabled:!1,timeValidation:void 0};var ct=lt,ut=a(97),pt=a.n(ut),dt=a(5),mt=a.n(dt),ht=a(27),ft=a.n(ht),gt=window.location.hostname.replace("www.",""),_t="contact@".concat(gt),vt=function(e){var t=e.emailAddress;return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",{className:"sender_email_address_warning","data-acceptance-id":"freemail-sender-warning-new-installation"},ft()(W.a.I18n.t("senderEmailAddressNewInstallWarning1"),"%originalSender",function(){return r.a.createElement("em",{key:"reply-to"},t)})),r.a.createElement("p",{className:"sender_email_address_warning"},ft()(W.a.I18n.t("senderEmailAddressNewInstallWarning2"),/(%suggested|%originalSender)/,function(e){return"%suggested"===e?r.a.createElement("em",{key:"suggested-email"},_t):r.a.createElement("em",{key:"sender-email"},t)})),r.a.createElement("p",{className:"sender_email_address_warning"},W.a.I18n.t("senderEmailAddressNewInstallWarning3")," ",r.a.createElement("a",{href:"https://account.mailpoet.com/authorization",target:"_blank",rel:"noopener noreferrer"},W.a.I18n.t("senderEmailAddressNewInstallWarning4"))),r.a.createElement("p",{className:"sender_email_address_warning"},r.a.createElement("a",{href:"https://kb.mailpoet.com/article/263-how-to-add-an-authorized-email-address",target:"_blank",rel:"noopener noreferrer"},W.a.I18n.t("senderEmailAddressWarning3"))))};vt.propTypes={emailAddress:u.a.string.isRequired};var bt=function(e){var t=e.emailAddress;return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",{className:"sender_email_address_warning","data-acceptance-id":"freemail-sender-warning-old-installation"},W.a.I18n.t("senderEmailAddressWarning1")),r.a.createElement("p",{className:"sender_email_address_warning"},ft()(W.a.I18n.t("senderEmailAddressWarning2"),/(%suggested|%originalSender|<em>.*<\/em>)/,function(e){return"%suggested"===e?_t:"%originalSender"===e?r.a.createElement("em",{key:"sender-email"},t):r.a.createElement("em",{key:"reply-to"},e.replace(/<\/?em>/g,""))})),r.a.createElement("p",{className:"sender_email_address_warning"},r.a.createElement("a",{href:"https://kb.mailpoet.com/article/259-your-from-address-cannot-be-yahoo-com-gmail-com-outlook-com",target:"_blank",rel:"noopener noreferrer"},W.a.I18n.t("senderEmailAddressWarning3"))))};bt.propTypes={emailAddress:u.a.string.isRequired};var yt=function(e){var t=e.emailAddress,a=e.mssActive,n=e.pluginInstalledAt,i=t.split("@").pop().toLowerCase();return window.mailpoet_free_domains.indexOf(i)>-1?a&&mt()(n).isAfter("2019-03-05")?r.a.createElement(vt,{emailAddress:t}):r.a.createElement(bt,{emailAddress:t}):null};yt.propTypes={emailAddress:u.a.string.isRequired,mssActive:u.a.bool.isRequired,pluginInstalledAt:u.a.string.isRequired};var wt=yt,Et=function(e){function t(e){var a;return C()(this,t),(a=A()(this,j()(t).call(this,e))).state={emailAddress:e.item.sender_address},a.onChange=a.onChange.bind(q()(q()(a))),a}return O()(t,e),P()(t,[{key:"onChange",value:function(e){this.setState({emailAddress:e.target.value}),this.props.onValueChange(e)}},{key:"render",value:function(){return r.a.createElement(r.a.Fragment,null,r.a.createElement(pt.a,xe()({},this.props,{onValueChange:this.onChange})),r.a.createElement("div",{className:"regular-text"},r.a.createElement(wt,{emailAddress:this.state.emailAddress,mssActive:window.mailpoet_mss_active,pluginInstalledAt:window.mailpoet_installed_at})))}}]),t}(r.a.Component);Et.propTypes={item:u.a.shape({sender_address:u.a.string.isRequired}).isRequired,onValueChange:u.a.func},Et.defaultProps={onValueChange:function(){}};var kt=Et,It=window.mailpoet_current_time||"00:00",St="".concat(window.mailpoet_current_date," 00:00:00"),Nt=window.mailpoet_schedule_time_of_day,xt=window.mailpoet_date_display_format,Ct=window.mailpoet_date_storage_format,Tt=function(e){function t(){var e,a;C()(this,t);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return a=A()(this,(e=j()(t)).call.apply(e,[this].concat(r))),B()(q()(q()(a)),"getCurrentValue",function(){var e={isScheduled:"0",scheduledAt:St};return ye.a.defaults(a.props.item[a.props.field.name]||{},e)}),B()(q()(q()(a)),"getDateValidation",function(){return{"data-parsley-required":!0,"data-parsley-required-message":W.a.I18n.t("noScheduledDateError"),"data-parsley-errors-container":"#mailpoet_scheduling"}}),B()(q()(q()(a)),"isScheduled",function(){return"1"===a.getCurrentValue().isScheduled}),B()(q()(q()(a)),"handleCheckboxChange",function(e){var t=e;return t.target.value=e.target.checked?"1":"0",a.handleValueChange(t)}),B()(q()(q()(a)),"handleValueChange",function(e){var t=a.getCurrentValue(),n={};return n[e.target.name]=e.target.value,a.props.onValueChange({target:{name:a.props.field.name,value:ye.a.extend({},t,n)}})}),a}return O()(t,e),P()(t,[{key:"render",value:function(){var e;return this.isScheduled()&&(e=r.a.createElement("span",{id:"mailpoet_scheduling"},r.a.createElement(ct,{name:"scheduledAt",value:this.getCurrentValue().scheduledAt,onChange:this.handleValueChange,disabled:this.props.field.disabled,dateValidation:this.getDateValidation(),defaultDateTime:St,timeOfDayItems:Nt,dateDisplayFormat:xt,dateStorageFormat:Ct})," ",r.a.createElement("span",null,W.a.I18n.t("websiteTimeIs")," ",r.a.createElement("code",null,It)))),r.a.createElement("div",null,r.a.createElement("input",{type:"checkbox",value:"1",checked:this.isScheduled(),disabled:this.props.field.disabled,name:"isScheduled",onChange:this.handleCheckboxChange}),e)}}]),t}(r.a.Component);Tt.propTypes={item:u.a.object,field:u.a.shape({name:u.a.string.isRequired,disabled:u.a.bool}).isRequired,onValueChange:u.a.func.isRequired},Tt.defaultProps={item:{}};var Pt=[{name:"subject",label:W.a.I18n.t("subjectLine"),tip:W.a.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":W.a.I18n.t("emptySubjectLineError")}},{name:"segments",label:W.a.I18n.t("segments"),tip:W.a.I18n.t("segmentsTip"),type:"selection",placeholder:W.a.I18n.t("selectSegmentPlaceholder"),id:"mailpoet_segments",api_version:window.mailpoet_api_version,endpoint:"segments",multiple:!0,filter:function(e){return!e.deleted_at},getLabel:function(e){return"".concat(e.name," (").concat(Te()(e.subscribers,10).toLocaleString(),")")},transformChangedValue:function(e){var t=this.getItems();return ye.a.map(e,function(e){return ye.a.find(t,function(t){return t.id===e})})},validation:{"data-parsley-required":!0,"data-parsley-required-message":W.a.I18n.t("noSegmentsSelectedError")}},{name:"sender",label:W.a.I18n.t("sender"),tip:W.a.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:W.a.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:kt,placeholder:W.a.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},{name:"reply-to",label:W.a.I18n.t("replyTo"),tip:W.a.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:W.a.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:W.a.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]},{name:"options",label:W.a.I18n.t("scheduleIt"),type:"reactComponent",component:Tt}];Pt=ve.a.applyFilters("mailpoet_newsletters_3rd_step_fields",Pt);var Rt={getFields:function(){return Pt},getSendButtonOptions:function(e){var t=e||{},a={value:"object"===et()(t.options)&&"1"===t.options.isScheduled?W.a.I18n.t("schedule"):W.a.I18n.t("send")};return"sent"!==t.status&&"sending"!==t.status||(a.disabled="disabled"),a}},At=a(49),Dt=a(43),jt={name:"intervalType",values:Dt.intervalValues},Lt={name:"timeOfDay",values:Dt.timeOfDayValues},Ot={name:"weekDay",values:Dt.weekDayValues},Mt={name:"monthDay",values:Dt.monthDayValues},qt={name:"nthWeekDay",values:Dt.nthWeekDayValues},Ft=function(e){function t(){var e,a;C()(this,t);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return a=A()(this,(e=j()(t)).call.apply(e,[this].concat(r))),B()(q()(q()(a)),"getCurrentValue",function(){return a.props.item[a.props.field.name]||{}}),B()(q()(q()(a)),"handleValueChanges",function(e){var t=a.getCurrentValue();return a.props.onValueChange({target:{name:a.props.field.name,value:ye.a.extend({},t,e)}})}),B()(q()(q()(a)),"handleIntervalChange",function(e){var t=e.target.value,n={};n.intervalType=t,"monthly"===t&&(n.monthDay="1"),a.handleValueChanges(n)}),B()(q()(q()(a)),"handleTimeOfDayChange",function(e){return a.handleValueChanges({timeOfDay:e.target.value})}),B()(q()(q()(a)),"handleWeekDayChange",function(e){return a.handleValueChanges({weekDay:e.target.value})}),B()(q()(q()(a)),"handleMonthDayChange",function(e){return a.handleValueChanges({monthDay:e.target.value})}),B()(q()(q()(a)),"handleNthWeekDayChange",function(e){return a.handleValueChanges({nthWeekDay:e.target.value})}),a}return O()(t,e),P()(t,[{key:"render",value:function(){var e,t,a,n,i=this.getCurrentValue();return"immediately"!==i.intervalType&&(e=r.a.createElement(At.a,{field:Lt,item:this.getCurrentValue(),onValueChange:this.handleTimeOfDayChange})),"weekly"!==i.intervalType&&"nthWeekDay"!==i.intervalType||(t=r.a.createElement(At.a,{field:Ot,item:this.getCurrentValue(),onValueChange:this.handleWeekDayChange})),"monthly"===i.intervalType&&(a=r.a.createElement(At.a,{field:Mt,item:this.getCurrentValue(),onValueChange:this.handleMonthDayChange})),"nthWeekDay"===i.intervalType&&(n=r.a.createElement(At.a,{field:qt,item:this.getCurrentValue(),onValueChange:this.handleNthWeekDayChange})),r.a.createElement("div",null,r.a.createElement(At.a,{field:jt,item:this.getCurrentValue(),onValueChange:this.handleIntervalChange,automationId:"newsletter_interval_type"}),n,a,t,e)}}]),t}(r.a.Component);Ft.propTypes={item:u.a.object.isRequired,field:u.a.shape({name:u.a.string}).isRequired,onValueChange:u.a.func.isRequired};var Bt=Ft,$t=[{name:"subject",label:W.a.I18n.t("subjectLine"),tip:W.a.I18n.t("postNotificationSubjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":W.a.I18n.t("emptySubjectLineError")}},{name:"options",label:W.a.I18n.t("selectFrequency"),type:"reactComponent",component:Bt},{name:"segments",label:W.a.I18n.t("segments"),tip:W.a.I18n.t("segmentsTip"),type:"selection",placeholder:W.a.I18n.t("selectSegmentPlaceholder"),id:"mailpoet_segments",api_version:window.mailpoet_api_version,endpoint:"segments",multiple:!0,filter:function(e){return!e.deleted_at},getLabel:function(e){return"".concat(e.name," (").concat(Te()(e.subscribers,10).toLocaleString(),")")},transformChangedValue:function(e){var t=this.getItems();return ye.a.map(e,function(e){return ye.a.find(t,function(t){return t.id===e})})},validation:{"data-parsley-required":!0,"data-parsley-required-message":W.a.I18n.t("noSegmentsSelectedError")}},{name:"sender",label:W.a.I18n.t("sender"),tip:W.a.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:W.a.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:kt,placeholder:W.a.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},{name:"reply-to",label:W.a.I18n.t("replyTo"),tip:W.a.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:W.a.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:W.a.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]}];$t=ve.a.applyFilters("mailpoet_newsletters_3rd_step_fields",$t);var Ht={getFields:function(){return $t},getSendButtonOptions:function(){return{value:W.a.I18n.t("activate")}}},Vt=a(98),Wt=[{name:"subject",label:W.a.I18n.t("subjectLine"),tip:W.a.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":W.a.I18n.t("emptySubjectLineError")}},{name:"options",label:W.a.I18n.t("sendWelcomeEmailWhen"),type:"reactComponent",component:Vt.default},{name:"sender",label:W.a.I18n.t("sender"),tip:W.a.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:W.a.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:kt,placeholder:W.a.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},{name:"reply-to",label:W.a.I18n.t("replyTo"),tip:W.a.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:W.a.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:W.a.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]}];Wt=ve.a.applyFilters("mailpoet_newsletters_3rd_step_fields",Wt);var zt={getFields:function(){return Wt},getSendButtonOptions:function(){return{value:W.a.I18n.t("activate")}}},Ut=a(248),Yt=Je()({displayName:"NewsletterSend",propTypes:{match:u.a.shape({params:u.a.shape({id:u.a.string}).isRequired}).isRequired,history:u.a.shape({push:u.a.func.isRequired}).isRequired},getInitialState:function(){return{fields:[],item:{},loading:!0,thumbnailPromise:null}},componentDidMount:function(){this.loadItem(this.props.match.params.id),V()("#mailpoet_newsletter").parsley()},componentWillReceiveProps:function(e){this.loadItem(e.match.params.id)},getFieldsByNewsletter:function(e){return this.getSubtype(e).getFields(e)},getSendButtonOptions:function(){return this.getSubtype(this.state.item).getSendButtonOptions(this.state.item)},getSubtype:function(e){switch(e.type){case"notification":return Ht;case"welcome":return zt;default:return ve.a.applyFilters("mailpoet_newsletters_send_newsletter_fields",Rt,e)}},getThumbnailPromise:function(e){return this.state.thumbnailPromise?this.state.thumbnailPromise:Object(Ut.b)(e)},isValid:function(){return V()("#mailpoet_newsletter").parsley().isValid()},loadItem:function(e){var t=this;this.setState({loading:!0}),W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"get",data:{id:e}}).done(function(e){var a="draft"===e.data.status?t.getThumbnailPromise(e.meta.preview_url):null;t.setState({loading:!1,item:e.data,fields:t.getFieldsByNewsletter(e.data),thumbnailPromise:a})}).fail(function(){t.setState({loading:!1,item:{}},function(){t.props.history.push("/new")})})},saveTemplate:function(e,t){var a=this;this.getThumbnailPromise(e.meta.preview_url).then(function(n){W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"save",data:{newsletter_id:e.data.id,name:e.data.subject,thumbnail:n,body:He()(e.data.body),categories:'["recent"]'}}).fail(function(e){a.showError(e),a.setState({loading:!1}),W.a.Modal.loading(!1)}),t()}).catch(function(e){a.showError({errors:[e]})})},handleSend:function(e){var t=this;return e.preventDefault(),this.isValid()?(W.a.Modal.loading(!0),this.saveNewsletter(e).done(function(){t.setState({loading:!0})}).done(function(e){switch(e.data.type){case"notification":case"welcome":return t.activateNewsletter(e);default:return t.sendNewsletter(e)}}).fail(function(e){t.showError(e),t.setState({loading:!1}),W.a.Modal.loading(!1)})):V()("#mailpoet_newsletter").parsley().validate()},sendNewsletter:function(e){var t=this;return W.a.Ajax.post(ve.a.applyFilters("mailpoet_newsletters_send_server_request_parameters",{api_version:window.mailpoet_api_version,endpoint:"sendingQueue",action:"add",data:{newsletter_id:this.state.item.id}},this.state.item)).done(function(a){t.saveTemplate(e,function(){if(window.mailpoet_show_congratulate_after_first_newsletter)return W.a.Modal.loading(!1),void t.props.history.push("/send/congratulate/".concat(t.state.item.id));t.props.history.push(ve.a.applyFilters("mailpoet_newsletters_send_server_request_response_redirect","/".concat(t.state.item.type||""),t.state.item));var e=ve.a.applyFilters("mailpoet_newsletters_send_server_request_response",t.state.item,a);ye.a.isFunction(e)?e():"scheduled"===a.data.status?(W.a.Notice.success(W.a.I18n.t("newsletterHasBeenScheduled")),W.a.trackEvent("Emails > Newsletter sent",{scheduled:!0,"MailPoet Free version":window.mailpoet_version})):(W.a.Notice.success(W.a.I18n.t("newsletterBeingSent"),{id:"mailpoet_notice_being_sent"}),W.a.trackEvent("Emails > Newsletter sent",{scheduled:!1,"MailPoet Free version":window.mailpoet_version})),W.a.Modal.loading(!1)})}).fail(function(e){t.showError(e),t.setState({loading:!1}),W.a.Modal.loading(!1)})},activateNewsletter:function(e){var t=this;return W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"setStatus",data:{id:this.props.match.params.id,status:"active"}}).done(function(a){t.saveTemplate(e,function(){if(window.mailpoet_show_congratulate_after_first_newsletter)return W.a.Modal.loading(!1),void t.props.history.push("/send/congratulate/".concat(t.state.item.id));t.props.history.push("/".concat(t.state.item.type||""));var e=t.state.item.options;"welcome"===a.data.type?(W.a.Notice.success(W.a.I18n.t("welcomeEmailActivated")),W.a.trackEvent("Emails > Welcome email activated",{"MailPoet Free version":window.mailpoet_version,"List type":e.event,Delay:"".concat(e.afterTimeNumber," ").concat(e.afterTimeType)})):"notification"===a.data.type&&(W.a.Notice.success(W.a.I18n.t("postNotificationActivated")),W.a.trackEvent("Emails > Post notifications activated",{"MailPoet Free version":window.mailpoet_version,Frequency:e.intervalType})),W.a.Modal.loading(!1)})}).fail(function(e){t.showError(e),t.setState({loading:!1}),W.a.Modal.loading(!1)})},handleResume:function(e){var t=this;return e.preventDefault(),this.isValid()?this.saveNewsletter(e).done(function(){t.setState({loading:!0})}).done(function(){W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sendingQueue",action:"resume",data:{newsletter_id:t.state.item.id}}).done(function(){t.props.history.push("/".concat(t.state.item.type||"")),W.a.Notice.success(W.a.I18n.t("newsletterSendingHasBeenResumed"))}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})})}).fail(function(e){t.showError(e)}).always(function(){t.setState({loading:!1})}):V()("#mailpoet_newsletter").parsley().validate(),!1},handleSave:function(e){var t=this;e.preventDefault(),this.saveNewsletter(e).done(function(){W.a.Notice.success(W.a.I18n.t("newsletterUpdated"))}).done(function(){var e="automatic"===t.state.item.type?t.state.item.options.group:t.state.item.type;t.props.history.push("/".concat(e||""))}).fail(function(e){t.showError(e)})},handleRedirectToDesign:function(e){var t=this;e.preventDefault();var a=e.target.href;this.saveNewsletter(e).done(function(){W.a.Notice.success(W.a.I18n.t("newsletterUpdated"))}).done(function(){window.location=a}).fail(function(e){t.showError(e)})},saveNewsletter:function(){var e=this.state.item;e.queue=void 0,this.setState({loading:!0});var t=ye.a.omit(e,["preheader","body","created_at","deleted_at","hash","status","updated_at","type"]);return W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"save",data:t})},showError:function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})},handleFormChange:function(e){var t=e.target.name,a=e.target.value;return this.setState(function(e){var n=e.item;return n[t]=a,{item:n}}),!0},render:function(){var e="sending"===this.state.item.status&&this.state.item.queue&&"paused"===this.state.item.queue.status,t=this.state.fields.map(function(t){var a=t;return"segments"!==t.name&&"options"!==t.name||(a.disabled=e),a}),a=this.getSendButtonOptions(),n=ve.a.applyFilters("mailpoet_newsletters_send_breadcrumb",r.a.createElement(Ee.a,{step:"send"}),this.state.item.type,"send");return r.a.createElement("div",null,r.a.createElement("h1",null,W.a.I18n.t("finalNewsletterStep")),n,r.a.createElement(Xe.a,{id:"mailpoet_newsletter",fields:t,automationId:"newsletter_send_form",item:this.state.item,loading:this.state.loading,onChange:this.handleFormChange,onSubmit:this.handleSave},r.a.createElement("p",{className:"submit"},e?r.a.createElement("input",{className:"button button-primary",type:"button",onClick:this.handleResume,value:W.a.I18n.t("resume")}):r.a.createElement("input",xe()({className:"button button-primary",type:"button",onClick:this.handleSend,value:W.a.I18n.t("send")},a))," ",r.a.createElement("input",{className:"button button-secondary",type:"submit",value:W.a.I18n.t("saveDraftAndClose")})," ",W.a.I18n.t("orSimply")," ",r.a.createElement("a",{href:"?page=mailpoet-newsletter-editor&id=".concat(this.props.match.params.id),onClick:this.handleRedirectToDesign},W.a.I18n.t("goBackToDesign")),"."),!e&&a.disabled&&"disabled"===a.disabled&&r.a.createElement(Ve.a,{tooltip:W.a.I18n.t("helpTooltipSendEmail"),tooltipId:"helpTooltipSendEmail"})))}}),Kt=Object(ke.a)(Yt);function Gt(e){var t,a="standard"===e.newsletter.type&&"scheduled"!==e.newsletter.status;return a&&W.a.Poll.successDelivery.initTypeformScript(),r.a.createElement("div",{className:"mailpoet_congratulate_success"},r.a.createElement("h1",null,"welcome"===(t=e.newsletter).type?W.a.I18n.t("congratulationsWelcomeEmailSuccessHeader"):"notification"===t.type?W.a.I18n.t("congratulationsPostNotificationSuccessHeader"):"automatic"===t.type?W.a.I18n.t("congratulationsWooSuccessHeader"):"scheduled"===t.status?W.a.I18n.t("congratulationsScheduleSuccessHeader"):W.a.I18n.t("congratulationsSendSuccessHeader")),r.a.createElement("img",{src:e.illustrationImageUrl,alt:"",width:"750",height:"250"}),a&&r.a.createElement("div",{className:"typeform-widget","data-url":"https://mailpoet.typeform.com/to/ciWID6","data-transparency":"100","data-hide-headers":"true","data-hide-footer":"true"}),r.a.createElement("button",{type:"button",className:"button",onClick:e.successClicked},W.a.I18n.t("close")))}Gt.propTypes={successClicked:u.a.func.isRequired,illustrationImageUrl:u.a.string.isRequired,newsletter:u.a.shape({status:u.a.string.isRequired,type:u.a.string.isRequired}).isRequired};var Jt=Gt;function Qt(e){return r.a.createElement("div",{className:"mailpoet_centered"},r.a.createElement("h1",null,W.a.I18n.t("congratulationsSendFailHeader")),r.a.createElement("p",null,ft()(W.a.I18n.t("congratulationsSendFailExplain"),/\[link\](.*?)\[\/link\]/g,function(e,t){return r.a.createElement("a",{key:t,target:"_blank",rel:"noopener noreferrer",href:"https://kb.mailpoet.com/article/231-sending-does-not-work"},e)})),r.a.createElement("button",{type:"button",className:"button",onClick:e.failClicked},W.a.I18n.t("close")))}Qt.propTypes={failClicked:u.a.func.isRequired};var Xt=Qt;var Zt=function(){return r.a.createElement("div",{className:"mailpoet_loading"},r.a.createElement("div",{className:"mailpoet_modal_loading mailpoet_modal_loading_1"}),r.a.createElement("div",{className:"mailpoet_modal_loading mailpoet_modal_loading_2"}),r.a.createElement("div",{className:"mailpoet_modal_loading mailpoet_modal_loading_3"}))};function ea(e){return r.a.createElement("div",{className:"mailpoet_newsletter_loading"},r.a.createElement(Zt,null),(t=e.showRichLoadingScreen,a=e.illustrationImageUrl,t?r.a.createElement("div",null,r.a.createElement("h1",{className:"mailpoet_newsletter_loading_header"},W.a.I18n.t("congratulationsLoadingHeader")),r.a.createElement("img",{src:a,alt:"",width:"800px",height:"266px"})):r.a.createElement("div",null)));var t,a}ea.propTypes={illustrationImageUrl:u.a.string.isRequired,showRichLoadingScreen:u.a.bool.isRequired};var ta=ea;function aa(){return W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"settings",action:"set",data:{show_congratulate_after_first_newsletter:!1}}).always(function(){window.location=window.mailpoet_main_page})}var na=function(e){function t(e){var a;return C()(this,t),(a=A()(this,j()(t).call(this,e))).state={loading:!0,newsletter:null,testingPassed:!1,timeStart:mt()(),minimumLoadingTimePassed:!1},a.tick=a.tick.bind(q()(q()(a))),a}return O()(t,e),P()(t,[{key:"componentDidMount",value:function(){this.loadNewsletter(this.props.match.params.id),this.tick()}},{key:"componentWillReceiveProps",value:function(e){this.loadNewsletter(e.match.params.id)}},{key:"tick",value:function(){mt()().subtract(20,"second").isAfter(this.state.timeStart)&&this.setState({error:!0,loading:!1}),this.state.loading&&this.loadNewsletter(this.props.match.params.id),mt()().subtract(6,"seconds").isAfter(this.state.timeStart)&&this.setState({minimumLoadingTimePassed:!0}),!this.state.loading&&this.state.minimumLoadingTimePassed||setTimeout(this.tick,2e3)}},{key:"loadNewsletter",value:function(e){var t=this;W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"get",data:{id:e}}).done(function(e){return t.newsletterLoaded(e.data)})}},{key:"newsletterLoaded",value:function(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})}},{key:"renderContent",value:function(){return this.state.loading||!this.state.minimumLoadingTimePassed?(e=!!this.state.newsletter,r.a.createElement(ta,{illustrationImageUrl:window.mailpoet_congratulations_loading_image,successClicked:aa,showRichLoadingScreen:e})):this.state.error?(W.a.trackEvent("Cron testing done",{"Cron is working":"false"}),r.a.createElement(Xt,{failClicked:function(){window.location=window.mailpoet_main_page}})):(t=this.state.newsletter,this.state.testingPassed&&W.a.trackEvent("Cron testing done",{"Cron is working":"true"}),r.a.createElement(Jt,{illustrationImageUrl:window.mailpoet_congratulations_success_image,successClicked:aa,newsletter:t}));var e,t}},{key:"render",value:function(){return r.a.createElement("div",{className:"newsletter_congratulate_page"},this.renderContent())}}]),t}(r.a.Component);na.propTypes={match:u.a.shape({params:u.a.shape({id:u.a.string}).isRequired}).isRequired};var ra=na,ia=function(e){function t(){var e,a;C()(this,t);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return a=A()(this,(e=j()(t)).call.apply(e,[this].concat(r))),B()(q()(q()(a)),"showTemplateSelection",function(e){a.props.history.push("/template/".concat(e))}),a}return O()(t,e),P()(t,[{key:"componentDidMount",value:function(){var e=this;W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:{type:"standard"}}).done(function(t){e.showTemplateSelection(t.data.id)}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})})}},{key:"render",value:function(){return r.a.createElement("div",null,r.a.createElement("h1",null,W.a.I18n.t("regularNewsletterTypeTitle")),r.a.createElement(Ee.a,{step:"type"}))}}]),t}(r.a.Component);B()(ia,"propTypes",{history:u.a.shape({push:u.a.func.isRequired}).isRequired});var sa=Object(ke.a)(ia),oa={name:"options",type:"reactComponent",component:Bt},la=function(e){function t(){var e,a;C()(this,t);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return a=A()(this,(e=j()(t)).call.apply(e,[this].concat(r))),B()(q()(q()(a)),"state",{options:{intervalType:"daily",timeOfDay:0,weekDay:1,monthDay:0,nthWeekDay:1}}),B()(q()(q()(a)),"handleValueChange",function(e){var t=a.state;t[e.target.name]=e.target.value,a.setState(t)}),B()(q()(q()(a)),"handleNext",function(){W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:ye.a.extend({},a.state,{type:"notification",subject:W.a.I18n.t("draftPostNotificationTitle")})}).done(function(e){a.showTemplateSelection(e.data.id)}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})})}),B()(q()(q()(a)),"showTemplateSelection",function(e){a.props.history.push("/template/".concat(e))}),a}return O()(t,e),P()(t,[{key:"render",value:function(){return r.a.createElement("div",null,r.a.createElement("h1",null,W.a.I18n.t("postNotificationNewsletterTypeTitle")),r.a.createElement(Ee.a,{step:"type"}),r.a.createElement("h3",null,W.a.I18n.t("selectFrequency")),r.a.createElement(Bt,{item:this.state,field:oa,onValueChange:this.handleValueChange}),r.a.createElement("p",{className:"submit"},r.a.createElement("input",{className:"button button-primary",type:"button",onClick:this.handleNext,value:W.a.I18n.t("next")})))}}]),t}(r.a.Component);B()(la,"propTypes",{history:u.a.shape({push:u.a.func.isRequired}).isRequired});var ca=Object(ke.a)(la),ua={name:"options",label:"Event",type:"reactComponent",component:Vt.default},pa=function(e){function t(e){var a;C()(this,t),a=A()(this,j()(t).call(this,e));var n=window.mailpoet_segments||[],r=1;return n=n.filter(function(e){return"default"===e.type}),ye.a.size(n)>0&&(r=ye.a.first(n).id),a.state={options:{event:"segment",segment:r,role:"subscriber",afterTimeNumber:1,afterTimeType:"immediate"}},a.handleValueChange=a.handleValueChange.bind(q()(q()(a))),a.handleNext=a.handleNext.bind(q()(q()(a))),a}return O()(t,e),P()(t,[{key:"handleValueChange",value:function(e){var t=this.state;t[e.target.name]=e.target.value,this.setState(t)}},{key:"handleNext",value:function(){var e=this;W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:ye.a.extend({},this.state,{type:"welcome",subject:W.a.I18n.t("draftNewsletterTitle")})}).done(function(t){e.showTemplateSelection(t.data.id)}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})})}},{key:"showTemplateSelection",value:function(e){this.props.history.push("/template/".concat(e))}},{key:"render",value:function(){return r.a.createElement("div",null,r.a.createElement("h1",null,W.a.I18n.t("welcomeNewsletterTypeTitle")),r.a.createElement(Ee.a,{step:"type"}),r.a.createElement("h3",null,W.a.I18n.t("selectEventToSendWelcomeEmail")),r.a.createElement(Vt.default,{item:this.state,field:ua,onValueChange:this.handleValueChange}),r.a.createElement("p",{className:"submit"},r.a.createElement("input",{className:"button button-primary",type:"button",onClick:this.handleNext,value:W.a.I18n.t("next")})))}}]),t}(r.a.Component);pa.propTypes={history:u.a.shape({push:u.a.func.isRequired}).isRequired};var da=pa,ma=a(371),ha=a.n(ma),fa=a(64),ga=a.n(fa),_a=a(65),va=a.n(_a),ba=a(66),ya=a.n(ba),wa=a(29),Ea=!!window.mailpoet_tracking_enabled,ka={onTrash:function(e){var t=Number(e.meta.count),a=null;a=1===t?W.a.I18n.t("oneNewsletterTrashed"):W.a.I18n.t("multipleNewslettersTrashed").replace("%$1d",t.toLocaleString()),W.a.Notice.success(a)},onDelete:function(e){var t=Number(e.meta.count),a=null;a=1===t?W.a.I18n.t("oneNewsletterDeleted"):W.a.I18n.t("multipleNewslettersDeleted").replace("%$1d",t.toLocaleString()),W.a.Notice.success(a)},onRestore:function(e){var t=Number(e.meta.count),a=null;a=1===t?W.a.I18n.t("oneNewsletterRestored"):W.a.I18n.t("multipleNewslettersRestored").replace("%$1d",t.toLocaleString()),W.a.Notice.success(a)}},Ia=[{name:"subject",label:W.a.I18n.t("subject"),sortable:!0},{name:"status",label:W.a.I18n.t("status")},{name:"segments",label:W.a.I18n.t("lists")},{name:"statistics",label:W.a.I18n.t("statistics"),display:Ea},{name:"sent_at",label:W.a.I18n.t("sentOn"),sortable:!0}],Sa=[{name:"trash",label:W.a.I18n.t("moveToTrash"),onSuccess:ka.onTrash}],Na=function(e){var t=function(){window.location.href="?page=mailpoet-newsletter-editor&id=".concat(e.id)};e.queue&&"sending"===e.status&&null===e.queue.status?qe({message:W.a.I18n.t("confirmEdit"),onConfirm:t}):t()},xa=[{name:"view",link:function(e){return r.a.createElement("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer"},W.a.I18n.t("preview"))}},{name:"edit",label:W.a.I18n.t("edit"),onClick:Na},{name:"duplicate",label:W.a.I18n.t("duplicate"),onClick:function(e,t){return W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done(function(e){W.a.Notice.success(W.a.I18n.t("newsletterDuplicated").replace("%$1s",e.data.subject)),t()}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})})}},{name:"trash"}];ve.a.addFilter("mailpoet_newsletters_listings_standard_actions",wa.StatisticsMixin.addStatsCTAAction),xa=ve.a.applyFilters("mailpoet_newsletters_listings_standard_actions",xa);var Ca=Je()({displayName:"NewsletterListStandard",propTypes:{location:u.a.object.isRequired,match:u.a.shape({params:u.a.object}).isRequired},mixins:[wa.QueueMixin,wa.StatisticsMixin,wa.MailerMixin,wa.CronMixin],renderItem:function(e,t,a){var n=U()("manage-column","column-primary","has-row-actions"),i=e.segments.map(function(e){return e.name}).join(", ");return r.a.createElement("div",null,r.a.createElement("td",{className:n},r.a.createElement("strong",null,r.a.createElement("a",{className:"row-title",href:"javascript:;",onClick:function(){return Na(e)}},e.queue.newsletter_rendered_subject||e.subject)),t),r.a.createElement("td",{className:"column","data-colname":W.a.I18n.t("status")},this.renderQueueStatus(e,a.mta_log)),r.a.createElement("td",{className:"column","data-colname":W.a.I18n.t("lists")},i),!0===Ea?r.a.createElement("td",{className:"column","data-colname":W.a.I18n.t("statistics")},this.renderStatistics(e,void 0,a.current_time)):null,r.a.createElement("td",{className:"column-date","data-colname":W.a.I18n.t("sentOn")},r.a.createElement("abbr",null,e.sent_at?W.a.Date.format(e.sent_at):W.a.I18n.t("notSentYet"))))},render:function(){var e=this;return r.a.createElement("div",null,r.a.createElement(va.a,null),r.a.createElement(ya.a,{hasNews:window.mailpoet_feature_announcement_has_news}),r.a.createElement(ga.a,{tab:"standard"}),r.a.createElement(K.a,{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,columns:Ia,bulk_actions:Sa,item_actions:xa,messages:ka,auto_refresh:!0,sort_by:"sent_at",sort_order:"desc",afterGetItems:function(t){e.checkMailerStatus(t),e.checkCronStatus(t)}}))}}),Ta=window.mailpoet_roles||{},Pa=window.mailpoet_segments||{},Ra=!!window.mailpoet_tracking_enabled,Aa={onTrash:function(e){var t=Number(e.meta.count),a=null;a=1===t?W.a.I18n.t("oneNewsletterTrashed"):W.a.I18n.t("multipleNewslettersTrashed").replace("%$1d",t.toLocaleString()),W.a.Notice.success(a)},onDelete:function(e){var t=Number(e.meta.count),a=null;a=1===t?W.a.I18n.t("oneNewsletterDeleted"):W.a.I18n.t("multipleNewslettersDeleted").replace("%$1d",t.toLocaleString()),W.a.Notice.success(a)},onRestore:function(e){var t=Number(e.meta.count),a=null;a=1===t?W.a.I18n.t("oneNewsletterRestored"):W.a.I18n.t("multipleNewslettersRestored").replace("%$1d",t.toLocaleString()),W.a.Notice.success(a)}},Da=[{name:"subject",label:W.a.I18n.t("subject"),sortable:!0},{name:"status",label:W.a.I18n.t("status"),width:145},{name:"settings",label:W.a.I18n.t("settings")},{name:"statistics",label:W.a.I18n.t("statistics"),display:Ra},{name:"updated_at",label:W.a.I18n.t("lastModifiedOn"),sortable:!0}],ja=[{name:"trash",label:W.a.I18n.t("moveToTrash"),onSuccess:Aa.onTrash}],La=[{name:"view",link:function(e){return r.a.createElement("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer"},W.a.I18n.t("preview"))}},{name:"duplicate",label:W.a.I18n.t("duplicate"),onClick:function(e,t){return W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done(function(e){W.a.Notice.success(W.a.I18n.t("newsletterDuplicated").replace("%$1s",e.data.subject)),t()}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})})}},{name:"edit",link:function(e){return r.a.createElement("a",{href:"?page=mailpoet-newsletter-editor&id=".concat(e.id)},W.a.I18n.t("edit"))}},{name:"trash"}];ve.a.addFilter("mailpoet_newsletters_listings_welcome_notification_actions",wa.StatisticsMixin.addStatsCTAAction),La=ve.a.applyFilters("mailpoet_newsletters_listings_welcome_notification_actions",La);var Oa=Je()({displayName:"NewsletterListWelcome",propTypes:{location:u.a.object.isRequired,match:u.a.shape({params:u.a.object}).isRequired},mixins:[wa.StatisticsMixin,wa.MailerMixin,wa.CronMixin],updateStatus:function(e){var t=this;e.persist(),W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"setStatus",data:{id:Number(e.target.getAttribute("data-id")),status:e.target.value}}).done(function(e){"active"===e.data.status&&W.a.Notice.success(W.a.I18n.t("welcomeEmailActivated")),t.forceUpdate()}).fail(function(t){W.a.Notice.error(W.a.I18n.t("welcomeEmailActivationFailed")),e.target.value=t.status})},renderStatus:function(e){var t=W.a.I18n.t("sentToXSubscribers").replace("%$1d",e.total_sent.toLocaleString()),a=W.a.I18n.t("scheduledToXSubscribers").replace("%$1d",e.total_scheduled.toLocaleString());return r.a.createElement("div",null,r.a.createElement("p",null,r.a.createElement("select",{"data-id":e.id,defaultValue:e.status,onChange:this.updateStatus},r.a.createElement("option",{value:"active"},W.a.I18n.t("active")),r.a.createElement("option",{value:"draft"},W.a.I18n.t("inactive")))),r.a.createElement("p",null,t," ",r.a.createElement("br",null),a))},renderSettings:function(e){var t,a,n;switch(e.options.event){case"user":t="mailpoet_all"===e.options.role?W.a.I18n.t("welcomeEventWPUserAnyRole"):W.a.I18n.t("welcomeEventWPUserWithRole").replace("%$1s",Ta[e.options.role]);break;default:if(void 0===(n=ye.a.find(Pa,function(t){return Number(t.id)===Number(e.options.segment)})))return r.a.createElement("span",{className:"mailpoet_error"},W.a.I18n.t("sendingToSegmentsNotSpecified"));t=W.a.I18n.t("welcomeEventSegment").replace("%$1s",n.name)}if(t&&"immediate"!==e.options.afterTimeType){switch(e.options.afterTimeType){case"hours":a=W.a.I18n.t("sendingDelayHours").replace("%$1d",e.options.afterTimeNumber);break;case"days":a=W.a.I18n.t("sendingDelayDays").replace("%$1d",e.options.afterTimeNumber);break;case"weeks":a=W.a.I18n.t("sendingDelayWeeks").replace("%$1d",e.options.afterTimeNumber);break;default:a=W.a.I18n.t("sendingDelayInvalid")}t+=" [".concat(a,"].")}return r.a.createElement("span",null,t)},renderItem:function(e,t){var a=U()("manage-column","column-primary","has-row-actions");return r.a.createElement("div",null,r.a.createElement("td",{className:a},r.a.createElement("strong",null,r.a.createElement("a",{className:"row-title",href:"?page=mailpoet-newsletter-editor&id=".concat(e.id)},e.subject)),t),r.a.createElement("td",{className:"column","data-colname":W.a.I18n.t("status")},this.renderStatus(e)),r.a.createElement("td",{className:"column","data-colname":W.a.I18n.t("settings")},this.renderSettings(e)),!0===Ra?r.a.createElement("td",{className:"column","data-colname":W.a.I18n.t("statistics")},this.renderStatistics(e,e.total_sent>0&&e.statistics)):null,r.a.createElement("td",{className:"column-date","data-colname":W.a.I18n.t("lastModifiedOn")},r.a.createElement("abbr",null,W.a.Date.format(e.updated_at))))},render:function(){var e=this;return r.a.createElement("div",null,r.a.createElement(va.a,null),r.a.createElement(ya.a,{hasNews:window.mailpoet_feature_announcement_has_news}),r.a.createElement(ga.a,{tab:"welcome"}),r.a.createElement(K.a,{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,columns:Da,bulk_actions:ja,item_actions:La,messages:Aa,auto_refresh:!0,sort_by:"updated_at",sort_order:"desc",afterGetItems:function(t){e.checkMailerStatus(t),e.checkCronStatus(t)}}))}}),Ma={onTrash:function(e){var t=Number(e.meta.count),a=null;a=1===t?W.a.I18n.t("oneNewsletterTrashed"):W.a.I18n.t("multipleNewslettersTrashed").replace("%$1d",t.toLocaleString()),W.a.Notice.success(a)},onDelete:function(e){var t=Number(e.meta.count),a=null;a=1===t?W.a.I18n.t("oneNewsletterDeleted"):W.a.I18n.t("multipleNewslettersDeleted").replace("%$1d",t.toLocaleString()),W.a.Notice.success(a)},onRestore:function(e){var t=Number(e.meta.count),a=null;a=1===t?W.a.I18n.t("oneNewsletterRestored"):W.a.I18n.t("multipleNewslettersRestored").replace("%$1d",t.toLocaleString()),W.a.Notice.success(a)}},qa=[{name:"subject",label:W.a.I18n.t("subject"),sortable:!0},{name:"status",label:W.a.I18n.t("status"),width:100},{name:"settings",label:W.a.I18n.t("settings")},{name:"history",label:W.a.I18n.t("history"),width:100},{name:"updated_at",label:W.a.I18n.t("lastModifiedOn"),sortable:!0}],Fa=[{name:"trash",label:W.a.I18n.t("moveToTrash"),onSuccess:Ma.onTrash}],Ba=[{name:"view",link:function(e){return r.a.createElement("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer"},W.a.I18n.t("preview"))}},{name:"edit",link:function(e){return r.a.createElement("a",{href:"?page=mailpoet-newsletter-editor&id=".concat(e.id)},W.a.I18n.t("edit"))}},{name:"duplicate",label:W.a.I18n.t("duplicate"),onClick:function(e,t){return W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done(function(e){W.a.Notice.success(W.a.I18n.t("newsletterDuplicated").replace("%$1s",e.data.subject)),t()}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})})}},{name:"trash"}],$a=Je()({displayName:"NewsletterListNotification",propTypes:{location:u.a.object.isRequired,match:u.a.shape({params:u.a.object}).isRequired},mixins:[wa.MailerMixin,wa.CronMixin],updateStatus:function(e){var t=this;e.persist(),W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"setStatus",data:{id:Number(e.target.getAttribute("data-id")),status:e.target.value}}).done(function(e){"active"===e.data.status&&W.a.Notice.success(W.a.I18n.t("postNotificationActivated")),t.forceUpdate()}).fail(function(t){W.a.Notice.error(W.a.I18n.t("postNotificationActivationFailed")),e.target.value=t.status})},renderStatus:function(e){return r.a.createElement("select",{"data-id":e.id,defaultValue:e.status,onChange:this.updateStatus},r.a.createElement("option",{value:"active"},W.a.I18n.t("active")),r.a.createElement("option",{value:"draft"},W.a.I18n.t("inactive")))},renderSettings:function(e){var t,a=e.segments.map(function(e){return e.name}),n=W.a.I18n.t("ifNewContentToSegments").replace("%$1s",a.join(", "));if(0===a.length)return r.a.createElement("span",{className:"mailpoet_error"},W.a.I18n.t("sendingToSegmentsNotSpecified"));switch(e.options.intervalType){case"daily":t=W.a.I18n.t("sendDaily").replace("%$1s",Dt.timeOfDayValues[e.options.timeOfDay]);break;case"weekly":t=W.a.I18n.t("sendWeekly").replace("%$1s",Dt.weekDayValues[e.options.weekDay]).replace("%$2s",Dt.timeOfDayValues[e.options.timeOfDay]);break;case"monthly":t=W.a.I18n.t("sendMonthly").replace("%$1s",Dt.monthDayValues[e.options.monthDay]).replace("%$2s",Dt.timeOfDayValues[e.options.timeOfDay]);break;case"nthWeekDay":t=W.a.I18n.t("sendNthWeekDay").replace("%$1s",Dt.nthWeekDayValues[e.options.nthWeekDay]).replace("%$2s",Dt.weekDayValues[e.options.weekDay]).replace("%$3s",Dt.timeOfDayValues[e.options.timeOfDay]);break;case"immediately":t=W.a.I18n.t("sendImmediately");break;default:t="Invalid sending frequency"}return r.a.createElement("span",null,t," ",n)},renderHistoryLink:function(e){return 0===Number(e.children_count)?W.a.I18n.t("notSentYet"):r.a.createElement($.a,{"data-automation-id":"history-".concat(e.id),to:"/notification/history/".concat(e.id)},W.a.I18n.t("viewHistory"))},renderItem:function(e,t){var a=U()("manage-column","column-primary","has-row-actions");return r.a.createElement("div",null,r.a.createElement("td",{className:a},r.a.createElement("strong",null,r.a.createElement("a",{className:"row-title",href:"?page=mailpoet-newsletter-editor&id=".concat(e.id)},e.subject)),t),r.a.createElement("td",{className:"column","data-colname":W.a.I18n.t("status")},this.renderStatus(e)),r.a.createElement("td",{className:"column","data-colname":W.a.I18n.t("settings")},this.renderSettings(e)),r.a.createElement("td",{className:"column","data-colname":W.a.I18n.t("history")},this.renderHistoryLink(e)),r.a.createElement("td",{className:"column-date","data-colname":W.a.I18n.t("lastModifiedOn")},r.a.createElement("abbr",null,W.a.Date.format(e.updated_at))))},render:function(){var e=this;return r.a.createElement("div",null,r.a.createElement(va.a,null),r.a.createElement(ya.a,{hasNews:window.mailpoet_feature_announcement_has_news}),r.a.createElement(ga.a,{tab:"notification"}),r.a.createElement(K.a,{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,columns:qa,bulk_actions:Fa,item_actions:Ba,messages:Ma,auto_refresh:!0,sort_by:"updated_at",sort_order:"desc",afterGetItems:function(t){e.checkMailerStatus(t),e.checkCronStatus(t)}}))}}),Ha=!!window.mailpoet_tracking_enabled,Va=[{name:"subject",label:W.a.I18n.t("subject")},{name:"status",label:W.a.I18n.t("status")},{name:"segments",label:W.a.I18n.t("lists")},{name:"statistics",label:W.a.I18n.t("statistics"),display:Ha},{name:"sent_at",label:W.a.I18n.t("sentOn")}],Wa=[{name:"view",link:function(e){return r.a.createElement("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer"},W.a.I18n.t("preview"))}}];ve.a.addFilter("mailpoet_newsletters_listings_notification_history_actions",wa.StatisticsMixin.addStatsCTAAction),Wa=ve.a.applyFilters("mailpoet_newsletters_listings_notification_history_actions",Wa);var za=Je()({displayName:"NewsletterListNotificationHistory",propTypes:{location:u.a.object.isRequired,match:u.a.shape({params:u.a.object}).isRequired},mixins:[wa.QueueMixin,wa.StatisticsMixin,wa.MailerMixin,wa.CronMixin],renderItem:function(e,t,a){var n=U()("manage-column","column-primary","has-row-actions"),i=e.segments.map(function(e){return e.name}).join(", ");return r.a.createElement("div",null,r.a.createElement("td",{className:n},r.a.createElement("strong",null,r.a.createElement("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer"},e.queue.newsletter_rendered_subject||e.subject)),t),r.a.createElement("td",{className:"column","data-colname":W.a.I18n.t("status")},this.renderQueueStatus(e,a.mta_log)),r.a.createElement("td",{className:"column","data-colname":W.a.I18n.t("lists")},i),!0===Ha?r.a.createElement("td",{className:"column","data-colname":W.a.I18n.t("statistics")},this.renderStatistics(e,void 0,a.current_time)):null,r.a.createElement("td",{className:"column-date","data-colname":W.a.I18n.t("sentOn")},e.sent_at?W.a.Date.format(e.sent_at):W.a.I18n.t("notSentYet")))},render:function(){var e=this;return r.a.createElement("div",null,r.a.createElement(va.a,null),r.a.createElement(ya.a,{hasNews:window.mailpoet_feature_announcement_has_news}),r.a.createElement(ga.a,{tab:"notification"}),r.a.createElement($.a,{className:"page-title-action",to:"/notification"},W.a.I18n.t("backToPostNotifications")),r.a.createElement(K.a,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,endpoint:"newsletters",type:"notification_history",base_url:"notification/history/:parent_id",onRenderItem:this.renderItem,columns:Va,item_actions:Wa,auto_refresh:!0,sort_by:"sent_at",sort_order:"desc",afterGetItems:function(t){e.checkMailerStatus(t),e.checkCronStatus(t)}}))}});(function(e){function t(){return C()(this,t),A()(this,j()(t).apply(this,arguments))}return O()(t,e),P()(t,[{key:"render",value:function(){return this.props.children}}]),t}(r.a.Component)).propTypes={children:u.a.element.isRequired};var Ua=document.getElementById("newsletters_container");if(Ua){var Ya=[{path:"/standard/(.*)?",component:Ca},{path:"/welcome/(.*)?",component:Oa},{path:"/notification/history/:parent_id/(.*)?",component:za},{path:"/notification/(.*)?",component:$a},{path:"/new/standard",component:sa},{path:"/new/notification",component:ca},{path:"/new/welcome",component:da},{path:"/new",component:Se},{name:"template",path:"/template/:id",component:Ke},{path:"/send/congratulate/:id",component:ra},{path:"/send/:id",component:Kt}];Ya=ve.a.applyFilters("mailpoet_newsletters_before_router",oe()(Ya).concat(oe()(window.mailpoet_automatic_emails?ye.a.map(window.mailpoet_automatic_emails,function(e){return{path:"new/".concat(e.slug),name:e.slug,component:ha.a,data:{email:e}}}):null))),window.mailpoet_listing=s.a.render(r.a.createElement(E,null,r.a.createElement(S,null,r.a.createElement(N,{exact:!0,path:"/",render:function(){return r.a.createElement(ge,{to:"/standard"})}}),Ya.map(function(e){return r.a.createElement(N,{key:e.path,path:e.path,component:e.component,name:e.name||null,data:e.data||null,render:e.render})}))),Ua)}var Ka=function(e){return"wp_users"===e.type},Ga=function(e){return"woocommerce_users"===e.type},Ja=function(e){return Ka(e)||Ga(e)},Qa=[{name:"name",label:W.a.I18n.t("name"),sortable:!0},{name:"description",label:W.a.I18n.t("description")},{name:"subscribed",label:W.a.I18n.t("subscribed")},{name:"unconfirmed",label:W.a.I18n.t("unconfirmed")},{name:"unsubscribed",label:W.a.I18n.t("unsubscribed")},{name:"bounced",label:W.a.I18n.t("bounced")},{name:"created_at",label:W.a.I18n.t("createdOn"),sortable:!0}],Xa={onTrash:function(e){var t=Number(e.meta.count),a=null;a=1===t?W.a.I18n.t("oneSegmentTrashed"):W.a.I18n.t("multipleSegmentsTrashed").replace("%$1d",t.toLocaleString()),W.a.Notice.success(a)},onDelete:function(e){var t=Number(e.meta.count),a=null;a=1===t?W.a.I18n.t("oneSegmentDeleted"):W.a.I18n.t("multipleSegmentsDeleted").replace("%$1d",t.toLocaleString()),W.a.Notice.success(a)},onRestore:function(e){var t=Number(e.meta.count),a=null;a=1===t?W.a.I18n.t("oneSegmentRestored"):W.a.I18n.t("multipleSegmentsRestored").replace("%$1d",t.toLocaleString()),W.a.Notice.success(a)}},Za=[{name:"trash",label:W.a.I18n.t("moveToTrash"),onSuccess:Xa.onTrash}],en=[{name:"edit",link:function(e){return r.a.createElement($.a,{to:"/edit/".concat(e.id)},W.a.I18n.t("edit"))},display:function(e){return!Ja(e)}},{name:"duplicate_segment",label:W.a.I18n.t("duplicate"),onClick:function(e,t){return W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"segments",action:"duplicate",data:{id:e.id}}).done(function(e){W.a.Notice.success(W.a.I18n.t("listDuplicated").replace("%$1s",e.data.name)),t()}).fail(function(e){W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})})},display:function(e){return!Ja(e)}},{name:"read_more",link:function(){return r.a.createElement("a",{href:"http://docs.mailpoet.com/article/133-the-wordpress-users-list",target:"_blank",rel:"noopener noreferrer"},W.a.I18n.t("readMore"))},display:function(e){return Ka(e)}},{name:"synchronize_segment",label:W.a.I18n.t("forceSync"),onClick:function(e,t){W.a.Modal.loading(!0),W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"segments",action:"synchronize",data:{type:e.type}}).done(function(){W.a.Modal.loading(!1),W.a.Notice.success(W.a.I18n.t("listSynchronized").replace("%$1s",e.name)),t()}).fail(function(e){W.a.Modal.loading(!1),e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})})},display:function(e){return Ka(e)||Ga(e)}},{name:"view_subscribers",link:function(e){return r.a.createElement("a",{href:e.subscribers_url},W.a.I18n.t("viewSubscribers"))}},{name:"trash",display:function(e){return!Ja(e)}}],tn=function(e){function t(){var e,a;C()(this,t);for(var n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return a=A()(this,(e=j()(t)).call.apply(e,[this].concat(i))),B()(q()(q()(a)),"renderItem",function(e,t){var a,n=U()("manage-column","column-primary","has-row-actions"),i=Number(e.subscribers_count.subscribed||0),s=Number(e.subscribers_count.unconfirmed||0),o=Number(e.subscribers_count.unsubscribed||0),l=Number(e.subscribers_count.bounced||0);return a=Ja(e)?r.a.createElement("span",{className:"row-title"},e.name):r.a.createElement($.a,{className:"row-title",to:"/edit/".concat(e.id)},e.name),r.a.createElement("div",null,r.a.createElement("td",{className:n},r.a.createElement("strong",null,a),t),r.a.createElement("td",{className:"column-date","data-colname":W.a.I18n.t("description")},r.a.createElement("abbr",null,e.description)),r.a.createElement("td",{className:"column-date","data-colname":W.a.I18n.t("subscribed")},r.a.createElement("abbr",null,i.toLocaleString())),r.a.createElement("td",{className:"column-date","data-colname":W.a.I18n.t("unconfirmed")},r.a.createElement("abbr",null,s.toLocaleString())),r.a.createElement("td",{className:"column-date","data-colname":W.a.I18n.t("unsubscribed")},r.a.createElement("abbr",null,o.toLocaleString())),r.a.createElement("td",{className:"column-date","data-colname":W.a.I18n.t("bounced")},r.a.createElement("abbr",null,l.toLocaleString())),r.a.createElement("td",{className:"column-date","data-colname":W.a.I18n.t("createdOn")},r.a.createElement("abbr",null,W.a.Date.format(e.created_at))))}),a}return O()(t,e),P()(t,[{key:"render",value:function(){return r.a.createElement("div",null,r.a.createElement("h1",{className:"title"},W.a.I18n.t("pageTitle")," ",r.a.createElement($.a,{className:"page-title-action",to:"/new"},W.a.I18n.t("new"))),r.a.createElement(K.a,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,messages:Xa,search:!1,endpoint:"segments",onRenderItem:this.renderItem,columns:Qa,bulk_actions:Za,item_actions:en,sort_by:"name",sort_order:"asc"}))}}]),t}(r.a.Component);tn.propTypes={location:u.a.object.isRequired,match:u.a.shape({params:u.a.object}).isRequired};var an=tn,nn=a(375),rn=a.n(nn),sn=document.getElementById("segments_container");sn&&s.a.render(r.a.createElement(E,null,r.a.createElement(S,null,r.a.createElement(N,{path:"/new",component:rn.a}),r.a.createElement(N,{path:"/edit/:id",component:rn.a}),r.a.createElement(N,{path:"*",component:an}))),sn);var on=function(e){function t(e){var a;return C()(this,t),(a=A()(this,j()(t).call(this,e))).state={senderAddress:e.senderAddress,senderName:e.senderName,replyToName:e.replyToName,replyToAddress:e.replyToAddress},a.onChange=a.onChange.bind(q()(q()(a))),a}return O()(t,e),P()(t,[{key:"onChange",value:function(e,t){var a={};a[e]=t.target.value,this.setState(a)}},{key:"render",value:function(){return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,r.a.createElement("label",{htmlFor:"settings[from_name]"},W.a.I18n.t("from")),r.a.createElement("input",{type:"text",id:"settings[from_name]","data-automation-id":"settings-page-from-name-field",name:"sender[name]",value:this.state.senderName,onChange:Object(be.partial)(this.onChange,"senderName"),placeholder:W.a.I18n.t("yourName")}),r.a.createElement("input",{type:"email",id:"settings[from_email]",name:"sender[address]","data-automation-id":"settings-page-from-email-field",value:this.state.senderAddress,onChange:Object(be.partial)(this.onChange,"senderAddress"),placeholder:"from@mydomain.com"})),r.a.createElement("p",null,r.a.createElement("label",{htmlFor:"settings[reply_name]"},W.a.I18n.t("replyTo")),r.a.createElement("input",{type:"text",id:"settings[reply_name]",name:"reply_to[name]",value:this.state.replyToName,onChange:Object(be.partial)(this.onChange,"replyToName"),placeholder:W.a.I18n.t("yourName")}),r.a.createElement("input",{type:"email",id:"settings[reply_email]",name:"reply_to[address]",value:this.state.replyToAddress,onChange:Object(be.partial)(this.onChange,"replyToAddress"),placeholder:"reply_to@mydomain.com"})),r.a.createElement("div",{className:"regular-text"},r.a.createElement(wt,{emailAddress:this.state.senderAddress,mssActive:this.props.mssActive,pluginInstalledAt:this.props.pluginInstalledAt})))}}]),t}(r.a.Component);on.propTypes={senderAddress:u.a.string.isRequired,senderName:u.a.string.isRequired,replyToAddress:u.a.string.isRequired,replyToName:u.a.string.isRequired,mssActive:u.a.bool.isRequired,pluginInstalledAt:u.a.string.isRequired};var ln=on,cn=function(e){function t(e){var a;return C()(this,t),(a=A()(this,j()(t).call(this,e))).state={senderAddress:e.senderAddress,senderName:e.senderName},a.onChange=a.onChange.bind(q()(q()(a))),a}return O()(t,e),P()(t,[{key:"onChange",value:function(e,t){var a={};a[e]=t.target.value,this.setState(a)}},{key:"render",value:function(){return r.a.createElement(r.a.Fragment,null,r.a.createElement("th",{scope:"row"},r.a.createElement("label",{htmlFor:"settings[signup_confirmation_from_name]"},W.a.I18n.t("from"))),r.a.createElement("td",null,r.a.createElement("p",null,r.a.createElement("input",{type:"text",id:"settings[signup_confirmation_from_name]",name:"signup_confirmation[from][name]","data-automation-id":"signup_confirmation_email_from_name",value:this.state.senderName,onChange:Object(be.partial)(this.onChange,"senderName"),placeholder:W.a.I18n.t("yourName")}),r.a.createElement("input",{type:"email",id:"settings[signup_confirmation_from_email]",name:"signup_confirmation[from][address]","data-automation-id":"signup_confirmation_email_from_email",value:this.state.senderAddress,onChange:Object(be.partial)(this.onChange,"senderAddress"),placeholder:"confirmation@mydomain.com",size:"28"})),r.a.createElement("div",{className:"regular-text"},r.a.createElement(wt,{emailAddress:this.state.senderAddress,mssActive:this.props.mssActive,pluginInstalledAt:this.props.pluginInstalledAt}))))}}]),t}(r.a.Component);cn.propTypes={senderAddress:u.a.string.isRequired,senderName:u.a.string.isRequired,mssActive:u.a.bool.isRequired,pluginInstalledAt:u.a.string.isRequired};var un=cn,pn=document.getElementById("settings_sender_container");pn&&s.a.render(r.a.createElement(ln,{senderAddress:window.mailpoet_settings_sender_adddress,senderName:window.mailpoet_settings_sender_name,replyToAddress:window.mailpoet_settings_reply_to_address,replyToName:window.mailpoet_settings_reply_to_name,pluginInstalledAt:window.mailpoet_installed_at,mssActive:window.mailpoet_mss_active}),pn);var dn=document.getElementById("settings_signup_confirmation_sender_container");dn&&s.a.render(r.a.createElement(un,{senderAddress:window.mailpoet_settings_sender_adddress,senderName:window.mailpoet_settings_sender_name,pluginInstalledAt:window.mailpoet_installed_at,mssActive:window.mailpoet_mss_active}),dn);var mn=[{name:"name",label:W.a.I18n.t("formName"),sortable:!0},{name:"segments",label:W.a.I18n.t("segments")},{name:"signups",label:W.a.I18n.t("signups")},{name:"created_at",label:W.a.I18n.t("createdOn"),sortable:!0}],hn={onTrash:function(e){var t=Number(e.meta.count),a=null;a=1===t?W.a.I18n.t("oneFormTrashed"):W.a.I18n.t("multipleFormsTrashed").replace("%$1d",t.toLocaleString()),W.a.Notice.success(a)},onDelete:function(e){var t=Number(e.meta.count),a=null;a=1===t?W.a.I18n.t("oneFormDeleted"):W.a.I18n.t("multipleFormsDeleted").replace("%$1d",t.toLocaleString()),W.a.Notice.success(a)},onRestore:function(e){var t=Number(e.meta.count),a=null;a=1===t?W.a.I18n.t("oneFormRestored"):W.a.I18n.t("multipleFormsRestored").replace("%$1d",t.toLocaleString()),W.a.Notice.success(a)}},fn=[{name:"trash",label:W.a.I18n.t("moveToTrash"),onSuccess:hn.onTrash}],gn=[{name:"edit",label:W.a.I18n.t("edit"),link:function(e){return r.a.createElement("a",{href:"admin.php?page=mailpoet-form-editor&id=".concat(e.id)},W.a.I18n.t("edit"))}},{name:"duplicate",label:W.a.I18n.t("duplicate"),onClick:function(e,t){return W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"forms",action:"duplicate",data:{id:e.id}}).done(function(e){W.a.Notice.success(W.a.I18n.t("formDuplicated").replace("%$1s",e.data.name)),t()}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})})}},{name:"trash"}],_n=function(e){function t(){var e,a;C()(this,t);for(var n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return a=A()(this,(e=j()(t)).call.apply(e,[this].concat(i))),B()(q()(q()(a)),"createForm",function(){W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"forms",action:"create"}).done(function(e){window.location=window.mailpoet_form_edit_url+e.data.id}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})})}),B()(q()(q()(a)),"renderItem",function(e,t){var a=U()("manage-column","column-primary","has-row-actions"),n=window.mailpoet_segments.filter(function(t){return-1!==V.a.inArray(t.id,e.segments)}).map(function(e){return e.name}).join(", ");return"user"===e.settings.segments_selected_by&&(n="".concat(W.a.I18n.t("userChoice")," ").concat(n)),r.a.createElement("div",null,r.a.createElement("td",{className:a},r.a.createElement("strong",null,r.a.createElement("a",{className:"row-title",href:"admin.php?page=mailpoet-form-editor&id=".concat(e.id)},e.name)),t),r.a.createElement("td",{className:"column","data-colname":W.a.I18n.t("segments")},n),r.a.createElement("td",{className:"column","data-colname":W.a.I18n.t("signups")},e.signups),r.a.createElement("td",{className:"column-date","data-colname":W.a.I18n.t("createdOn")},r.a.createElement("abbr",null,W.a.Date.format(e.created_at))))}),a}return O()(t,e),P()(t,[{key:"render",value:function(){return r.a.createElement("div",null,r.a.createElement("h1",{className:"title"},W.a.I18n.t("pageTitle")," ",r.a.createElement("button",{className:"page-title-action",href:"javascript:;",onClick:this.createForm,"data-automation-id":"create_new_form",type:"button"},W.a.I18n.t("new"))),r.a.createElement(K.a,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,messages:hn,search:!1,endpoint:"forms",onRenderItem:this.renderItem,columns:mn,bulk_actions:fn,item_actions:gn}))}}]),t}(r.a.Component);_n.propTypes={location:u.a.object.isRequired,match:u.a.shape({params:u.a.object}).isRequired};var vn=_n,bn=document.getElementById("forms_container");bn&&s.a.render(r.a.createElement(E,null,r.a.createElement(N,{path:"*",component:vn})),bn);var yn=a(26),wn=a.n(yn),En=W.a;V()("#mailpoet_settings").length>0&&(En.Router=new(wn.a.Router.extend({routes:{"":"defaultRoute","mta(/:group)":"sendingMethodGroup","(:tab)":"tabs"},defaultRoute:function(){this.tabs("basics")},sendingMethodGroup:function(e){this.tabs("mta"),V()("#mailpoet_sending_method_setup, .mailpoet_sending_method").hide(),V()(".mailpoet_settings_submit").hide(),null===e?V()(".mailpoet_sending_methods, .mailpoet_sending_methods_help").fadeIn():(V()("#mailpoet_mta_spf")["mailpoet"===e?"hide":"show"](),V()(".mailpoet_sending_methods, .mailpoet_sending_methods_help").hide(),V()('.mailpoet_sending_method[data-group="'+e+'"]').show(),V()("#mailpoet_sending_method_setup").fadeIn())},tabs:function(e){V()(".nav-tab-wrapper a").removeClass("nav-tab-active"),V()(".mailpoet_tab_panel, .mailpoet_section").hide(),V()('a.nav-tab[href="#'+e+'"]').addClass("nav-tab-active").blur(),V()('.mailpoet_tab_panel[data-tab="'+e+'"]').length>0&&V()('.mailpoet_tab_panel[data-tab="'+e+'"]').show(),V()(".mailpoet_settings_submit").show(),En.trackEvent("User has clicked a tab in Settings",{"MailPoet Free version":window.mailpoet_version,"Tab ID":e})}})),V()(document).ready(function(){wn.a.History.started||wn.a.history.start()}));var kn=[{name:"knowledgeBase",label:W.a.I18n.t("tabKnowledgeBaseTitle"),link:"/knowledgeBase"},{name:"systemStatus",label:W.a.I18n.t("tabSystemStatusTitle"),link:"/systemStatus"},{name:"systemInfo",label:W.a.I18n.t("tabSystemInfoTitle"),link:"/systemInfo"},{name:"yourPrivacy",label:W.a.I18n.t("tabYourPrivacyTitle"),link:"/yourPrivacy"}];function In(e){var t=kn.map(function(t){var a=U()("nav-tab",{"nav-tab-active":e.tab===t.name});return r.a.createElement($.a,{key:"tab-".concat(t.name),className:a,to:t.link},t.label)});return r.a.createElement("h2",{className:"nav-tab-wrapper"},t)}In.propTypes={tab:u.a.string},In.defaultProps={tab:"knowledgeBase"};var Sn=In;var Nn=function(){return r.a.createElement("div",null,r.a.createElement(Sn,{tab:"knowledgeBase"}),r.a.createElement("p",null,W.a.I18n.t("knowledgeBaseIntro")),r.a.createElement("ul",null,r.a.createElement("li",null,r.a.createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"http://beta.docs.mailpoet.com/category/116-common-problems"},"Common Problems")),r.a.createElement("li",null,r.a.createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"http://beta.docs.mailpoet.com/category/165-newsletters"},"Newsletters")),r.a.createElement("li",null,r.a.createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"http://beta.docs.mailpoet.com/category/156-migration-questions"},"Migration Questions")),r.a.createElement("li",null,r.a.createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"http://beta.docs.mailpoet.com/category/149-sending-methods"},"Sending Methods")),r.a.createElement("li",null,r.a.createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"http://beta.docs.mailpoet.com/category/139-subscription-forms"},"Subscription Forms")),r.a.createElement("li",null,r.a.createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"http://beta.docs.mailpoet.com/category/114-getting-started"},"Getting Started")),r.a.createElement("li",null,r.a.createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"http://beta.docs.mailpoet.com/category/123-newsletter-designer"},"Newsletter Designer")),r.a.createElement("li",null,r.a.createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"http://beta.docs.mailpoet.com/category/121-subscribers-and-lists"},"Subscribers and Lists"))),r.a.createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"http://beta.docs.mailpoet.com/",className:"button button-primary"},W.a.I18n.t("knowledgeBaseButton")))};function xn(e){e.target.select()}var Cn=function(){var e=window.systemInfoData;return r.a.createElement("div",null,r.a.createElement(Sn,{tab:"systemInfo"}),r.a.createElement("div",{className:"mailpoet_notice notice inline",style:{marginTop:"1em"}},r.a.createElement("p",null,W.a.I18n.t("systemInfoIntro"))),function(e){if(ye.a.isObject(e)){var t=Re()(e).map(function(t){return"".concat(t,": ").concat(e[t])});return r.a.createElement("textarea",{readOnly:!0,onFocus:xn,value:t.join("\n"),style:{width:"100%",height:"400px"}})}return r.a.createElement("p",null,W.a.I18n.t("systemInfoDataError"))}(e))},Tn=function(e){return r.a.createElement("table",{className:"widefat fixed",style:{maxWidth:e.max_width}},r.a.createElement("tbody",null,e.rows.map(function(e){return r.a.createElement("tr",{key:"row_".concat(e.key)},r.a.createElement("td",{className:"row-title"},e.key),r.a.createElement("td",null,e.value))})))};Tn.propTypes={max_width:u.a.string,rows:u.a.arrayOf(u.a.shape({key:u.a.string.isRequired,value:u.a.oneOfType([u.a.string,u.a.number,u.a.element]).isRequired})).isRequired},Tn.defaultProps={max_width:"auto"};var Pn=Tn,Rn=function(e){return r.a.createElement("span",null,!0===e.children&&e.truthy||!1===e.children&&e.falsy||e.unknown)};Rn.propTypes={truthy:u.a.string,falsy:u.a.string,unknown:u.a.string,children:u.a.bool},Rn.defaultProps={truthy:W.a.I18n.t("yes"),falsy:W.a.I18n.t("no"),unknown:W.a.I18n.t("unknown"),children:null};var An=Rn,Dn=function(e){var t=e.status_data,a={active:W.a.I18n.t("running"),inactive:W.a.I18n.t("cronWaiting")};return r.a.createElement("div",null,r.a.createElement("h2",null,W.a.I18n.t("systemStatusCronStatusTitle")),r.a.createElement(Pn,{max_width:"400px",rows:[{key:W.a.I18n.t("accessible"),value:r.a.createElement(An,null,t.accessible)},{key:W.a.I18n.t("status"),value:a[t.status]?a[t.status]:W.a.I18n.t("unknown")},{key:W.a.I18n.t("lastUpdated"),value:t.updated_at?W.a.Date.full(1e3*t.updated_at):W.a.I18n.t("unknown")},{key:W.a.I18n.t("lastRunStarted"),value:t.run_accessed_at?W.a.Date.full(1e3*t.run_started_at):W.a.I18n.t("unknown")},{key:W.a.I18n.t("lastRunCompleted"),value:t.run_completed_at?W.a.Date.full(1e3*t.run_completed_at):W.a.I18n.t("unknown")},{key:W.a.I18n.t("lastSeenError"),value:t.last_error||W.a.I18n.t("none")}]}))};Dn.propTypes={status_data:u.a.shape({accessible:u.a.bool,status:u.a.string,updated_at:u.a.number,run_accessed_at:u.a.number,run_completed_at:u.a.number}).isRequired};var jn=Dn,Ln=function(e){return r.a.createElement("tr",null,r.a.createElement("td",{className:"column column-primary"},e.task.id),r.a.createElement("td",{className:"column"},e.task.type),r.a.createElement("td",{className:"column"},e.task.newsletter?r.a.createElement("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"},e.task.newsletter.subject||W.a.I18n.t("preview")):W.a.I18n.t("none")),r.a.createElement("td",{className:"column"},e.task.priority),e.show_scheduled_at?r.a.createElement("td",{className:"column-date"},r.a.createElement("abbr",null,W.a.Date.format(1e3*e.task.scheduled_at))):null,r.a.createElement("td",{className:"column-date"},r.a.createElement("abbr",null,W.a.Date.format(1e3*e.task.updated_at))))};Ln.propTypes={show_scheduled_at:u.a.bool,task:u.a.shape({id:u.a.number.isRequired,type:u.a.string.isRequired,priority:u.a.number.isRequired,updated_at:u.a.number.isRequired,scheduled_at:u.a.number,status:u.a.string,newsletter:u.a.shape({newsletter_id:u.a.number.isRequired,queue_id:u.a.number.isRequired,preview_url:u.a.string.isRequired,subject:u.a.string})}).isRequired},Ln.defaultProps={show_scheduled_at:!1};var On=Ln,Mn=function(e){return r.a.createElement("tr",null,r.a.createElement("th",{className:"row-title"},"Id"),r.a.createElement("th",{className:"row-title"},W.a.I18n.t("type")),r.a.createElement("th",{className:"row-title"},W.a.I18n.t("email")),r.a.createElement("th",{className:"row-title"},W.a.I18n.t("priority")),e.show_scheduled_at?r.a.createElement("th",{className:"row-title"},W.a.I18n.t("scheduledAt")):null,r.a.createElement("th",{className:"row-title"},W.a.I18n.t("updatedAt")))};Mn.propTypes={show_scheduled_at:u.a.bool},Mn.defaultProps={show_scheduled_at:!1};var qn=Mn,Fn=function(e){var t=e.show_scheduled_at?6:5;return r.a.createElement("table",{className:"widefat fixed striped"},r.a.createElement("thead",null,r.a.createElement(qn,{show_scheduled_at:e.show_scheduled_at})),r.a.createElement("tbody",null,e.tasks.length?e.tasks.map(function(t){return r.a.createElement(On,{key:t.id,task:t,show_scheduled_at:e.show_scheduled_at})}):r.a.createElement("tr",{className:"no-items"},r.a.createElement("td",{colSpan:t},W.a.I18n.t("nothingToShow")))),r.a.createElement("tfoot",null,r.a.createElement(qn,{show_scheduled_at:e.show_scheduled_at})))};Fn.propTypes={show_scheduled_at:u.a.bool,tasks:u.a.arrayOf(On.propTypes.task).isRequired},Fn.defaultProps={show_scheduled_at:!1};var Bn=Fn,$n=function(e){var t=e.status_data;return r.a.createElement("div",null,r.a.createElement("h2",null,W.a.I18n.t("systemStatusQueueTitle")),r.a.createElement(Pn,{max_width:"400px",rows:[{key:W.a.I18n.t("status"),value:"paused"===t.status?W.a.I18n.t("paused"):W.a.I18n.t("running")},{key:W.a.I18n.t("startedAt"),value:t.started?W.a.Date.full(1e3*t.started):W.a.I18n.t("unknown")},{key:W.a.I18n.t("sentEmails"),value:t.sent||0},{key:W.a.I18n.t("retryAttempt"),value:t.retry_attempt||W.a.I18n.t("none")},{key:W.a.I18n.t("retryAt"),value:t.retry_at?W.a.Date.full(1e3*t.retry_at):W.a.I18n.t("none")},{key:W.a.I18n.t("error"),value:t.error?t.error.error_message:W.a.I18n.t("none")},{key:W.a.I18n.t("totalCompletedTasks"),value:t.tasksStatusCounts.completed},{key:W.a.I18n.t("totalRunningTasks"),value:t.tasksStatusCounts.running},{key:W.a.I18n.t("totalPausedTasks"),value:t.tasksStatusCounts.paused},{key:W.a.I18n.t("totalScheduledTasks"),value:t.tasksStatusCounts.scheduled}]}),r.a.createElement("h4",null,W.a.I18n.t("scheduledTasks")),r.a.createElement(Bn,{show_scheduled_at:!0,tasks:t.latestTasks.filter(function(e){return"scheduled"===e.status})}),r.a.createElement("h4",null,W.a.I18n.t("runningTasks")),r.a.createElement(Bn,{tasks:t.latestTasks.filter(function(e){return null===e.status})}),r.a.createElement("h4",null,W.a.I18n.t("completedTasks")),r.a.createElement(Bn,{tasks:t.latestTasks.filter(function(e){return"completed"===e.status})}))};$n.propTypes={status_data:u.a.shape({status:u.a.string,started:u.a.number,sent:u.a.number,retry_attempt:u.a.number,retry_at:u.a.number,error:u.a.shape({operation:u.a.string,error_message:u.a.string}),tasksStatusCounts:u.a.shape({completed:u.a.number.isRequired,running:u.a.number.isRequired,paused:u.a.number.isRequired,scheduled:u.a.number.isRequired}).isRequired,latestTasks:u.a.arrayOf(On.propTypes.task).isRequired}).isRequired};var Hn=$n;function Vn(e,t,a){var n=e?"success":"error",i=e?W.a.I18n.t("systemStatusConnectionSuccessful"):"".concat(W.a.I18n.t("systemStatusConnectionUnsuccessful")," ").concat(t);return a&&(i=ft()(i,/\[link\](.*?)\[\/link\]/g,function(e){return r.a.createElement("a",{href:"".concat(a),key:"kb-link"},e)})),r.a.createElement("div",{className:"mailpoet_notice notice inline notice-".concat(n),style:{marginTop:"1em"}},r.a.createElement("p",null,i))}var Wn=function(){var e,t,a,n=window.systemStatusData;return r.a.createElement("div",null,r.a.createElement(Sn,{tab:"systemStatus"}),r.a.createElement("div",{className:"mailpoet_notice notice inline",style:{marginTop:"1em"}},r.a.createElement("p",null,n.mss.enabled?W.a.I18n.t("systemStatusIntroCronMSS"):W.a.I18n.t("systemStatusIntroCron"))),(t=(e=n).cron.isReachable,a=e.cron.url,r.a.createElement("div",null,r.a.createElement("h2",null,W.a.I18n.t("systemStatusCronTitle")),r.a.createElement("p",null,r.a.createElement("a",{href:a,target:"_blank",rel:"noopener noreferrer"},a)),Vn(t,W.a.I18n.t("systemStatusCronConnectionUnsuccessfulInfo"),"//beta.docs.mailpoet.com/article/231-sending-does-not-work"))),function(e){if(e.mss.enabled){var t=e.mss.enabled.isReachable;return r.a.createElement("div",null,r.a.createElement("h2",null,W.a.I18n.t("systemStatusMSSTitle")),Vn(t,W.a.I18n.t("systemStatusMSSConnectionUnsuccessfulInfo"),!1))}}(n),r.a.createElement(jn,{status_data:n.cronStatus}),r.a.createElement(Hn,{status_data:n.queueStatus}))};var zn=function(){return r.a.createElement("div",null,r.a.createElement(Sn,{tab:"yourPrivacy"}),r.a.createElement("p",null,W.a.I18n.t("yourPrivacyContent1")),r.a.createElement("p",null,W.a.I18n.t("yourPrivacyContent2")),r.a.createElement("p",null,W.a.I18n.t("yourPrivacyContent3")),r.a.createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://www.mailpoet.com/privacy-notice/",className:"button button-primary"},W.a.I18n.t("yourPrivacyButton")))},Un=document.getElementById("help_container");Un&&s.a.render(r.a.createElement(E,null,r.a.createElement(S,null,r.a.createElement(N,{exact:!0,path:"/",render:function(){return r.a.createElement(ge,{to:"/knowledgeBase"})}}),r.a.createElement(N,{path:"/knowledgeBase",component:Nn}),r.a.createElement(N,{path:"/systemStatus",component:Wn}),r.a.createElement(N,{path:"/systemInfo",component:Cn}),r.a.createElement(N,{path:"/yourPrivacy",component:zn}))),Un);var Yn=a(392),Kn=a.n(Yn),Gn=[{element:document.querySelector("#toplevel_page_mailpoet-newsletters > ul > li > a[href*=mailpoet-segments]").parentNode,intro:W.a.I18n.t("introLists")},{element:document.querySelector("#toplevel_page_mailpoet-newsletters > ul > li > a[href*=mailpoet-forms]").parentNode,intro:W.a.I18n.t("introForms")},{element:".mailpoet-chat",intro:W.a.I18n.t("introChat")},{element:"#mailpoet-new-email",intro:W.a.I18n.t("introEmails")}],Jn=!1;W.a.showIntro=function(){if(!(Jn||window.innerWidth<=960)){var e=Kn()();e.setOptions({steps:Gn,nextLabel:"".concat(W.a.I18n.t("introNext")," →"),prevLabel:"← ".concat(W.a.I18n.t("introBack")),skipLabel:W.a.I18n.t("introSkip"),doneLabel:W.a.I18n.t("introDone"),positionPrecedence:["right","left","bottom","top"],buttonClass:"button",hidePrev:!0,hideNext:!0,helperElementPadding:12,scrollToElement:!1,showStepNumbers:!1,tooltipPosition:"auto"}),e.onafterchange(function(e){if("fixed"===getComputedStyle(e).getPropertyValue("position")){var t=document.querySelector(".introjs-helperLayer"),a=document.querySelector(".introjs-tooltipReferenceLayer");a.style.top="".concat(Te()(a.style.top,10)-window.pageYOffset,"px"),t.style.top="".concat(Te()(t.style.top,10)-window.pageYOffset,"px")}}),e.onexit(function(){Jn=!1,document.body.classList.remove("mailpoet-intro-active")}),e.onskip(function(){W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"settings",action:"set",data:{show_intro:0}})}),e.start(),Jn=!0,document.body.classList.add("mailpoet-intro-active")}};var Qn,Xn=function(e){return"show_poll_success_delivery_".concat(e)},Zn=function(){if(!document.getElementById("typef_orm")){var e=document.createElement("script");e.id="typef_orm",e.src="https://embed.typeform.com/embed.js";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)}},er={successDelivery:{canShow:function(e,t){return"en"===window.mailpoet_locale&&"1"===window.mailpoet_polls_visibility[Xn(e)]&&(t||"PHPMail"===window.mailpoet_polls_data.mta_method)},initTypeformScript:Zn,setPollShown:function(e){var t={};t[Xn(e)]="0",W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"settings",action:"set",data:t}),window.mailpoet_polls_visibility[Xn(e)]="0"},showModal:function(e,t){W.a.Modal.popup({onInit:Zn,template:'\n <div class="typeform-widget"\n data-url="https://mailpoet.typeform.com/to/'.concat(t,'"\n data-transparency="100"\n data-hide-headers="true"\n data-hide-footer="true"\n style="width: 500px; height: 500px; max-width: 100%; max-height: 100%;"\n ></div>\n ')})}}};W.a.Poll=er,(Qn=document.getElementById("mailpoet_reinstall"))&&Qn.addEventListener("click",function(){return confirm(W.a.I18n.t("reinstallConfirmation"))&&(W.a.trackEvent("User has reinstalled MailPoet via Settings",{"MailPoet Free version":window.mailpoet_version}),W.a.Modal.loading(!0),W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"setup",action:"reset"}).always(function(){W.a.Modal.loading(!1)}).done(function(){window.location="admin.php?page=mailpoet-newsletters"}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})})),!1},!1);var tr=a(266),ar=a.n(tr),nr=(a(487),a(14)),rr=a.n(nr),ir=a(393),sr=a.n(ir),or=function(e){var t,a=V()("<div />").html(e).text();return a=a.toLowerCase().replace(/^["';.,\s]+|[^\x20-\x7E]+$|["';.,_\s]+#x2F;g,"").replace(/\s+|%\d+|,+/g,""),(t=/<(.*?)>/.exec(a))&&(a=t[1].trim()),(t=/mailto:(?:\s+)?(.*)/.exec(a))&&(a=t[1].trim()),!!window.mailpoet_email_regex.test(a)&&a};var lr=function(e){var t,a,n,r,i=[],s=[],o=[],l=[],c=null,u=null,p=!1;return Re()(e).forEach(function(d){n=e[d].map(function(e){return e.trim()}),r=n.length,null===u&&(u=r),r===u&&(null===c?(Re()(n).forEach(function(e){a=or(n[e]),null===c&&window.mailpoet_email_regex.test(a)&&(c=e,s[a]=!0,n[e]=a,i[a]=n)}),null===c&&0===Te()(d,10)&&(p=!0,i[0]=n)):""!==n[c]&&(t=or(n[c]),ye.a.has(s,t)?o.push(t):window.mailpoet_email_regex.test(t)?(s[t]=!0,n[c]=t,i[t]=n):l.push(n[c])))}),(i=ye.a.values(i))&&(p&&i.length>=2||!p&&i.length>=1)?{header:window.mailpoet_email_regex.test(i[0][c])?null:i.shift(),subscribers:i,subscribersCount:i.length,duplicate:o,invalid:l}:null},cr=function(e){var t=e.canGoNext,a=e.onPreviousAction,n=e.onNextAction,i=U()("button-primary","wysija",{"button-disabled":!t});return r.a.createElement("div",{className:"mailpoet_import_step_buttons"},r.a.createElement("button",{className:"button-primary wysija button",type:"button",onClick:function(){return a()}},W.a.I18n.t("previousStep")),"  ",r.a.createElement("button",{type:"button","data-automation-id":"import-next-step",className:i,onClick:function(){t&&n()}},W.a.I18n.t("nextStep")))};cr.propTypes={canGoNext:u.a.bool.isRequired,onPreviousAction:u.a.func.isRequired,onNextAction:u.a.func.isRequired};var ur=cr,pr=function(e){function t(e){var a;return C()(this,t),(a=A()(this,j()(t).call(this,e))).state={subscribersAgreed:!1,sentOnceLastYear:!1,understand:!1},a}return O()(t,e),P()(t,[{key:"isFormValid",value:function(){return this.state.subscribersAgreed&&this.state.sentOnceLastYear&&this.state.understand}},{key:"render",value:function(){var e,t=this;return r.a.createElement("div",{className:"mailpoet_import_validation_step"},r.a.createElement("label",{htmlFor:"subscribers_agreed"},r.a.createElement("input",{type:"checkbox",checked:this.state.subscribersAgreed,onChange:function(e){return t.setState({subscribersAgreed:e.target.checked})},name:"subscribers_agreed",id:"subscribers_agreed","data-automation-id":"subscribers_agreed"}),W.a.I18n.t("subscribersAgreed")),r.a.createElement("p",{className:"description"},W.a.I18n.t("dontEmailSubscribers")," ",r.a.createElement("a",{href:"https://kb.mailpoet.com/article/127-checklist-before-importing-subscribers",target:"_blank",rel:"noreferrer noopener"},W.a.I18n.t("readSupportArticle"))),r.a.createElement("label",{htmlFor:"sent_once_last_year"},r.a.createElement("input",{type:"checkbox",checked:this.state.sentOnceLastYear,onChange:function(e){return t.setState({sentOnceLastYear:e.target.checked})},name:"sent_once_last_year",id:"sent_once_last_year","data-automation-id":"sent_once_last_year"}),W.a.I18n.t("sentOnceYear")),r.a.createElement("p",{className:"description"},W.a.I18n.t("emailAddressesWillBounce")),r.a.createElement("p",{className:"description"},(e=ft()(W.a.I18n.t("useServices"),"%1$s",function(){return r.a.createElement("a",{href:"https://www.briteverify.com",target:"_blank",rel:"noreferrer noopener",key:"BriteVerify"},"BriteVerify")}),e=ft()(e,"%2$s",function(){return r.a.createElement("a",{href:"https://www.datavalidation.com/",target:"_blank",rel:"noreferrer noopener",key:"DataValidation"},"DataValidation")}),e=ft()(e,"%3$s",function(){return r.a.createElement("a",{href:"https://neverbounce.com/",target:"_blank",rel:"noreferrer noopener",key:"NeverBounce"},"NeverBounce")}))),r.a.createElement("label",{htmlFor:"understand"},r.a.createElement("input",{type:"checkbox",checked:this.state.understand,onChange:function(e){return t.setState({understand:e.target.checked})},name:"understand",id:"understand","data-automation-id":"input_understand"}),W.a.I18n.t("youUnderstand")),r.a.createElement("p",{className:"description"},W.a.I18n.t("weWillSuspend")),r.a.createElement(ur,{canGoNext:this.isFormValid(),onPreviousAction:function(){return t.props.navigate("step_method_selection",{trigger:!0})},onNextAction:function(){return t.props.navigate("step_data_manipulation",{trigger:!0})}}))}}]),t}(n.Component);pr.propTypes={navigate:u.a.func.isRequired};var dr=pr;function mr(e){var t=e.subscribersCount,a=e.segments,n=e.initialMessage;if(t){var i=ft()(n,"%1$s",function(){return r.a.createElement("strong",{key:"%1$s"},t.toLocaleString())});return i=ft()(i,"%2$s",function(){return'"'.concat(a.join('", "'),'"')}),r.a.createElement("p",null,i)}return null}function hr(e){var t=e.createdSubscribers,a=e.updatedSubscribers;return t||a?null:r.a.createElement("p",null,W.a.I18n.t("importNoAction"))}function fr(e){return e.addedToSegmentWithWelcomeNotification?r.a.createElement("p",null,W.a.I18n.t("importNoWelcomeEmail")):null}function gr(e){var t=e.errors,a=e.createdSubscribers,n=e.updatedSubscribers,i=e.segments,s=e.addedToSegmentWithWelcomeNotification,o=e.navigate;return t.length&&W.a.Notice.error(ye.a.flatten(t)),r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:"updated"},r.a.createElement(mr,{subscribersCount:a,segments:i,initialMessage:W.a.I18n.t("subscribersCreated")}),r.a.createElement(mr,{subscribersCount:n,segments:i,initialMessage:W.a.I18n.t("subscribersUpdated")}),r.a.createElement(hr,{createdSubscribers:a,updatedSubscribers:n}),r.a.createElement(fr,{addedToSegmentWithWelcomeNotification:s})),r.a.createElement("button",{type:"button",className:"button-primary wysija",onClick:function(){return o("step_method_selection",{trigger:!0})}},W.a.I18n.t("importAgain")),"  ",r.a.createElement("button",{type:"button",className:"button-primary wysija",onClick:function(){window.location.href="admin.php?page=mailpoet-subscribers"}},W.a.I18n.t("viewSubscribers")))}mr.propTypes={segments:u.a.arrayOf(u.a.string.isRequired).isRequired,subscribersCount:u.a.number.isRequired,initialMessage:u.a.string.isRequired},hr.propTypes={createdSubscribers:u.a.number.isRequired,updatedSubscribers:u.a.number.isRequired},fr.propTypes={addedToSegmentWithWelcomeNotification:u.a.bool.isRequired},gr.propTypes={errors:u.a.arrayOf(u.a.string.isRequired),segments:u.a.arrayOf(u.a.string.isRequired).isRequired,createdSubscribers:u.a.number.isRequired,updatedSubscribers:u.a.number.isRequired,addedToSegmentWithWelcomeNotification:u.a.bool.isRequired,navigate:u.a.func.isRequired},gr.defaultProps={errors:[]};var _r=gr,vr=500;V()(document).ready(function(){if(V()("#mailpoet_subscribers_import").length){V()('input[name="select_method"]').attr("checked",!1);var e=new(wn.a.Router.extend({routes:{"":"home",step_method_selection:"step_method_selection",step_input_validation:"step_input_validation",step_data_manipulation:"step_data_manipulation",step_results:"step_results"},home:function(){this.navigate("step_method_selection",{trigger:!0})}}));e.on("route:step_method_selection",function(){if(window.mailpoetColumns=V.a.map(window.mailpoetColumns,function(e){var t=e;return t.validation_rule=!1,t}),void 0===window.importData.step_method_selection){var a=rr.a.compile(V()("#method_process_template").html());V()(".mailpoet_method_process").html(a());var n=V()(window.location.hash),r=V()("#select_method"),i=V()("#paste_input"),s=i.data("placeholder").replace(/\\n/g,"\n"),o=V()("#method_paste > div.mailpoet_method_process").find("a.mailpoet_process"),l=V()("#mailchimp_key"),c=V()("#mailchimp_key_verify"),u=V()("#mailchimp_lists"),p=V()("#method_mailchimp > div.mailpoet_method_process").find("a.mailpoet_process"),d=V()("#file_local"),m=V()("#method_file > div.mailpoet_method_process").find("a.mailpoet_process");r.change(function(){var e=V()(':radio[name="select_method"]'),t=e.index(e.filter(":checked"));W.a.Notice.hide(),n.find(".inside").children('div[id^="method_"]').hide(),n.find(".inside").children('div[id^="method_"]:eq('.concat(t,")")).show().find("table").show()}),t(),i.attr("value",s).css("color","#999").focus(function(e){V()(e.currentTarget).val()===s&&V()(e.currentTarget).attr("value","").css("color","#222")}).blur(function(e){""===V()(e.currentTarget).val()&&V()(e.currentTarget).attr("value",s).css("color","#999"),h(o,""!==e.currentTarget.value.trim()?"on":"off")}).keyup(function(e){h(o,""!==e.currentTarget.value.trim()?"on":"off")}),o.click(function(){var e=encodeURI(i.val()).split(/%..|./).length-1;W.a.Notice.hide(),e>window.maxPostSizeBytes?W.a.Notice.error(W.a.I18n.t("maxPostSizeNotice")):(W.a.Modal.loading(!0),setTimeout(function(){sr.a.parse(i.val(),f(!1))},10))}),d.change(function(e){var t=e.currentTarget.value.match(/[^.]+#x2F;);W.a.Notice.hide(),null!==t&&"csv"===t[0].toLowerCase()||(e.currentTarget.value.val(""),W.a.Notice.error(W.a.I18n.t("wrongFileFormat"))),h(m,""!==e.currentTarget.value.trim()?"on":"off")}),m.click(function(){""!==d.val().trim()&&(W.a.Modal.loading(!0),setTimeout(function(){d.parse({config:f(!0)})},10))}),l.keyup(function(e){""!==e.currentTarget.value.trim()&&/[a-zA-Z0-9]{32}-/.exec(e.currentTarget.value.trim())||(u.hide(),V()(".mailpoet_mailchimp-key-status").html("").removeClass("mailpoet_mailchimp-ok mailpoet_mailchimp-error"),h(p,"off"))}),c.click(function(){W.a.Modal.loading(!0),W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"importExport",action:"getMailChimpLists",data:{api_key:l.val()}}).always(function(){W.a.Modal.loading(!1)}).done(function(e){var t,a;V()(".mailpoet_mailchimp-key-status").html("").removeClass().addClass("mailpoet_mailchimp-key-status mailpoet_mailchimp-ok"),0===e.data.length?(V()(".mailpoet_mailchimp-key-status").html(W.a.I18n.t("noMailChimpLists")),u.hide(),h(p,"off")):(t=e.data,(a=u.find("select")).data("select2")?(a.select2("data",t),a.trigger("change")):a.select2({data:t,width:"20em",templateResult:function(e){return e.name},templateSelection:function(e){return e.name}}).change(function(e){null!==V()(e.currentTarget).val()?h(p,"on"):h(p,"off")}).trigger("change"),u.show())}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})})}),p.click(function(){p.closest("table a").hasClass("button-disabled")||(W.a.Modal.loading(!0),W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"importExport",action:"getMailChimpSubscribers",data:{api_key:l.val(),lists:u.find("select").val()}}).always(function(){W.a.Modal.loading(!1)}).done(function(t){window.importData.step_method_selection=t.data,W.a.trackEvent("Subscribers import started",{source:"MailChimp","MailPoet Free version":window.mailpoet_version}),e.navigate("step_data_manipulation",{trigger:!0})}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})}))})}else t();function h(e,t){"on"!==t?e.closest("table a").addClass("button-disabled"):e.closest("table a").removeClass("button-disabled")}function f(t){return{skipEmptyLines:!0,error:function(){W.a.Notice.hide(),W.a.Notice.error(W.a.I18n.t("dataProcessingError"))},complete:function(a){var n,r=lr(a.data);if(r)window.importData.step_method_selection=r,W.a.trackEvent("Subscribers import started",{source:t?"file upload":"pasted data","MailPoet Free version":window.mailpoet_version}),e.navigate(void 0===(n=window.importData.step_method_selection)?"step_data_manipulation":void 0===n.subscribersCount?"step_data_manipulation":n.subscribersCount<vr?"step_data_manipulation":"step_input_validation",{trigger:!0});else{W.a.Modal.loading(!1);var i=W.a.I18n.t("noValidRecords");i=(i=i.replace("[link]",W.a.I18n.t("csvKBLink"))).replace("[/link]","</a>"),W.a.Notice.error(i)}}}}}),e.on("route:step_input_validation",function(){if(void 0!==window.importData.step_method_selection){t();var a=document.getElementById("step_input_validation");a&&s.a.render(r.a.createElement(dr,{navigate:e.navigate,importData:window.importData.step_method_selection}),a)}else e.navigate("step_method_selection",{trigger:!0})}),e.on("route:step_data_manipulation",function(){var a,n,r;if(void 0!==window.importData.step_method_selection){var i=V()("#next_step"),s=V()("#return_to_previous"),o=V.a.extend(!0,{},window.importData.step_method_selection),l=rr.a.compile(V()("#subscribers_data_template").html()),c=rr.a.compile(V()("#subscribers_data_template_partial").html()),u=rr.a.compile(V()("#subscribers_data_parse_results_template").html()),p=V()("#mailpoet_segments_select"),d=Array.apply(void 0,oe()(new Array(o.subscribers[0].length))).map(String.prototype.valueOf,". . .");t(),V()("#subscribers_data_parse_results:visible").html(""),V()("#subscribers_data_import_results:visible").hide(),(o.invalid.length||o.duplicate.length)&&(r={},o.duplicate.forEach(function(e){r[e]=(r[e]||0)+1}),o.duplicate=[],Re()(r).forEach(function(e){r[e]>1?o.duplicate.push("".concat(e," (x").concat(r[e],")")):o.duplicate.push(e)}),n={notice:W.a.I18n.t("importNoticeSkipped").replace("%1$s","<strong>".concat(o.invalid.length+o.duplicate.length,"</strong>")),invalid:o.invalid.length?W.a.I18n.t("importNoticeInvalid").replace("%1$s","<strong>".concat(o.invalid.length.toLocaleString(),"</strong>")).replace("%2$s",o.invalid.join(", ")):null,duplicate:o.duplicate.length?W.a.I18n.t("importNoticeDuplicate").replace("%1$s","<strong>".concat(o.duplicate.length,"</strong>")).replace("%2$s",o.duplicate.join(", ")):null},V()("#subscribers_data_parse_results").html(u(n))),V()(".mailpoet_subscribers_data_parse_results_details_show").click(function(e){var t=V()(".mailpoet_subscribers_data_parse_results_details");V()(t).toggle(),e.currentTarget.text(V()(t).is(":visible")?W.a.I18n.t("hideDetails"):W.a.I18n.t("showDetails"))}),window.mailpoetSegments.length?V()(".mailpoet_segments").show():V()(".mailpoet_no_segments").show(),V()(".mailpoet_create_segment").click(function(){W.a.Modal.popup({title:W.a.I18n.t("addNewList"),template:V()("#new_segment_template").html()}),V()("#new_segment_name").keypress(function(e){13===e.which&&V()("#new_segment_process").click()}),V()("#new_segment_process").click(function(){var e=V()("#new_segment_name").val().trim(),t=V()("#new_segment_description").val().trim();W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"ImportExport",action:"addSegment",data:{name:e,description:t}}).done(function(e){var t;window.mailpoetSegments.push({id:e.data.id,name:e.data.name,subscriberCount:0}),null===(t=p.val())?t=[e.data.id]:t.push(e.data.id),h(window.mailpoetSegments),p.val(t).trigger("change"),V()(".mailpoet_segments:hidden").show(),V()(".mailpoet_no_segments:visible").hide(),W.a.Modal.close()}).fail(function(e){e.errors.length>0&&(W.a.Notice.hide(),W.a.Notice.error(e.errors.map(function(e){return e.message}),{positionAfter:"#new_segment_name"}))})}),V()("#new_segment_cancel").click(function(){W.a.Modal.close()})}),rr.a.registerPartial("subscribers_data_template_partial",c),rr.a.registerHelper("show_and_match_columns",function(e,t){var a,n,r,i,s=[],o=[];return Re()(e.subscribers[0]).forEach(function(t){a=e.subscribers[0][t],n="ignore",a%1!=0&&window.mailpoet_email_regex.test(a)?n="email":e.header&&(r=e.header[t],-1!==(i=window.mailpoetColumns.map(function(e){return e.name}).indexOf(r))?n=window.mailpoetColumns[i].id:r&&(/first|first name|given name/i.test(r)?n="first_name":/last|last name/i.test(r)&&(n="last_name"))),n="ignore"!==n&&-1===o.indexOf(n)?n:"ignore",s[t]={column_id:n},o.push(n)}),t.fn(s)}),rr.a.registerHelper("sanitize_data",function(e){return e instanceof rr.a.SafeString?e:new rr.a.SafeString(rr.a.Utils.escapeExpression(e))}),rr.a.registerHelper("calculate_index",function(e){var t=Te()(e,10);return 10===t&&o.subscribersCount>11?(a=t,". . ."):t===o.subscribers.length-1?o.subscribersCount.toLocaleString():t+1}),o.subscribersCount>11&&o.subscribers.splice(10,o.subscribersCount-11,d),V()("#subscribers_data > table").html(l(o)),V()("select.mailpoet_subscribers_column_data_match").select2({data:window.mailpoetColumnsSelect2,width:"15em",templateResult:function(e){return e.name},templateSelection:function(e){return e.name}}).on("select2:selecting",function(e){var t=e.currentTarget,a=e.params.args.data.id;"create"===a?(e.preventDefault(),V()(t).select2("close"),W.a.Modal.popup({title:W.a.I18n.t("addNewField"),template:V()("#form_template_field_form").html()}),V()("#form_field_new").parsley().on("form:submit",function(){var e=V()("#form_field_new").mailpoetSerializeObject();return W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"customFields",action:"save",data:e}).done(function(e){var a={id:e.data.id,name:e.data.name,type:e.data.type,params:e.data.params,custom:!0};2===window.mailpoetColumnsSelect2.length&&window.mailpoetColumnsSelect2.push({name:W.a.I18n.t("userColumns"),children:[]}),window.mailpoetColumnsSelect2[2].children.push(a),window.mailpoetColumns.push(a),V()("select.mailpoet_subscribers_column_data_match").each(function(){V()(t).html("").select2("destroy").select2({data:window.mailpoetColumnsSelect2,width:"15em",templateResult:function(e){return e.name},templateSelection:function(e){return e.name}})}),V()(t).data("column-id",a.id),V()(t).data("validation-rule",!1),f(),W.a.Modal.close()}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{positionAfter:"#field_name"})}),!1})):V()("select.mailpoet_subscribers_column_data_match").each(function(){var n=t,r=V()(n).val();r===a&&"ignore"!==r&&(confirm("".concat(W.a.I18n.t("selectedValueAlreadyMatched")," ").concat(W.a.I18n.t("confirmCorrespondingColumn")))?V()(n).data("column-id","ignore"):(e.preventDefault(),V()(t).select2("close")))})}).on("select2:select",function(e){var t=e.currentTarget,a=e.params.data.id;V()(t).data("column-id",a),f()}),s.off().on("click",function(){var t;e.navigate(void 0===(t=window.importData.step_method_selection)?"step_method_selection":void 0===t.subscribersCount?"step_method_selection":t.subscribersCount<vr?"step_method_selection":"step_input_validation",{trigger:!0})}),i.off().on("click",function(t){var a={},n=new V.a.AsyncQueue,r=0,i=ar()()/1e3,s={created:0,updated:0,errors:[],segments:[]};if(!V()(t.currentTarget).hasClass("button-disabled")){W.a.Modal.loading(!0);var o,l,c=(o=window.importData.step_method_selection.subscribers,l=2e3,o.reduce(function(e,t,a){return a%l==0&&e.push([]),e[e.length-1].push(t),e},[]));ye.a.each(V()("select.mailpoet_subscribers_column_data_match"),function(e,t){var n=V()(e).data("column-id"),r=V()(e).data("validation-rule");"ignore"!==n&&(a[n]={index:t,validation_rule:r})}),ye.a.each(c,function(){n.add(function(e){e.pause(),W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"ImportExport",action:"processImport",data:He()({columns:a,subscribers:c[r],timestamp:i,segments:p.val(),updateSubscribers:"yes"===V()(':radio[name="subscriber_update_option"]:checked').val()})}).done(function(t){var a=t.data.added_to_segment_with_welcome_notification;s.created+=t.data.created,s.updated+=t.data.updated,s.segments=t.data.segments,s.added_to_segment_with_welcome_notification=a,e.run()}).fail(function(e){W.a.Modal.loading(!1),e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})}),r+=1})}),n.run(),n.onComplete(function(){W.a.Modal.loading(!1),s.errors.length>0&&!s.updated&&!s.created?W.a.Notice.error(ye.a.flatten(s.errors)):(window.mailpoetSegments=s.segments,s.segments=ye.a.map(p.select2("data"),function(e){return e.name}),window.importData.step_data_manipulation=s,h(window.mailpoetSegments),e.navigate("step_results",{trigger:!0}))})}}),f(),h(window.mailpoetSegments)}else e.navigate("step_method_selection",{trigger:!0});function m(e){"on"!==e?i.addClass("button-disabled"):i.removeClass("button-disabled")}function h(e){p.data("select2")&&(p.html("").select2("destroy"),m("off")),p.select2({data:e,width:"20em",templateResult:function(e){var t=e;return t.subscriberCount=Te()(t.subscriberCount,10),"".concat(t.name," (").concat(t.subscriberCount.toLocaleString(),")")},templateSelection:function(e){var t=e;return t.subscriberCount=Te()(t.subscriberCount,10),"".concat(t.name," (").concat(t.subscriberCount.toLocaleString(),")")}}).change(function(e){var t=V()('[data-id="notice_segmentSelection"]');e.currentTarget.value?(V()('[data-id="notice_segmentSelection"]').remove(),V()(".mailpoet_notice.error:visible").length||m("on")):(t.length||W.a.Notice.error(W.a.I18n.t("segmentSelectionRequired"),{static:!0,scroll:!0,id:"notice_segmentSelection",hideClose:!0}),m("off"))})}function f(){var e=V.a.extend(!0,{},o),t=!1;V()('[data-id="notice_invalidEmail"], [data-id="notice_invalidDate"]').remove();var n=V.a.map(V()(".mailpoet_subscribers_column_data_match"),function(e,t){var a=V()(e).data("column-id"),n=V()(e).data("validation-rule");return V()(e).val(a).trigger("change"),{id:a,index:t,validationRule:n,element:e}});V.a.map(window.mailpoetColumns,function(r){var i,s,o,l,c=ye.a.find(n,function(e){return e.id===r.id});"email"===r.id&&(window.mailpoet_email_regex.test(e.subscribers[0][c.index])?W.a.Notice.hide("invalidEmail"):(t=!0,V()('[data-id="notice_invalidEmail"]').length||W.a.Notice.error(W.a.I18n.t("columnContainsInvalidElement"),{static:!0,scroll:!0,hideClose:!0,id:"invalidEmail"}))),"date"===r.type&&c&&(l=[mt.a.ISO_8601,"YYYY/MM/DD","MM/DD/YYYY","DD/MM/YYYY","YYYY/MM/DD","YYYY/DD/MM","MM/YYYY","YYYY/MM","YYYY"],i=e.subscribers[0][c.index],s=!1,""===i.trim()?(e.subscribers[0][c.index]='<span class="mailpoet_data_match mailpoet_import_error" title="'.concat(W.a.I18n.t("noDateFieldMatch"),'">').concat(W.a.I18n.t("emptyFirstRowDate"),"</span> "),t=!0):Re()(l).forEach(function(e){if(o=l[e],mt()(i,o,!0).isValid())return s="function"==typeof o?"datetime":o,void V()(c.element).data("validation-rule",s);"datetime"===s&&(s=mt.a.ISO_8601)}),V.a.map(e.subscribers,function(e,n){var r=e,i=r[c.index],s=mt()(i,o,!0);n!==a&&""!==i.trim()&&(s.isValid()?r[c.index]=new rr.a.SafeString("".concat(rr.a.Utils.escapeExpression(r[c.index]),'<span class="mailpoet_data_match" title="').concat(W.a.I18n.t("verifyDateMatch"),'">').concat(W.a.Date.format(s),"</span> ")):(r[c.index]=new rr.a.SafeString("".concat(rr.a.Utils.escapeExpression(r[c.index]),'<span class="mailpoet_data_match mailpoet_import_error" title="').concat(W.a.I18n.t("noDateFieldMatch"),'">').concat(new rr.a.SafeString(W.a.I18n.t("dateMatchError")),"</span> ")),t=!0))}),t&&!V()(".mailpoet_invalidDate").length&&W.a.Notice.error(W.a.I18n.t("columnContainsInvalidDate"),{static:!0,scroll:!0,hideClose:!0,id:"invalidDate"}))}),V()("#subscribers_data > table > tbody").html(c(e)),t?m("off"):!V()(".mailpoet_notice.error:visible").length&&p.val()&&m("on")}}),e.on("route:step_results",function(){if(void 0!==window.importData.step_data_manipulation){t(),W.a.trackEvent("Subscribers import finished",{"Subscribers created":window.importData.step_data_manipulation.created,"Subscribers updated":window.importData.step_data_manipulation.updated,"MailPoet Free version":window.mailpoet_version});var a=document.getElementById("step_results");a&&s.a.render(r.a.createElement(_r,{navigate:e.navigate,errors:window.importData.step_data_manipulation.errors,createdSubscribers:window.importData.step_data_manipulation.created,updatedSubscribers:window.importData.step_data_manipulation.updated,segments:window.importData.step_data_manipulation.segments,addedToSegmentWithWelcomeNotification:window.importData.step_data_manipulation.added_to_segment_with_welcome_notification}),a),window.importData.step_method_selection=void 0,window.importData.step_data_manipulation=void 0}else e.navigate("step_data_manipulation",{trigger:!0})}),wn.a.History.started||wn.a.history.start()}function t(){W.a.Notice.hide(),W.a.Modal.loading(!1),V()('#mailpoet_subscribers_import > div[id^="step"]').hide(),V()(window.location.hash).show()}}),V()(document).ready(function(){var e,t,a,n,r;function i(e){"on"===e?a.removeClass("button-disabled"):a.addClass("button-disabled")}V()("#mailpoet_subscribers_export").length&&window.exportData.segments&&(r=rr.a.compile(V()("#mailpoet_subscribers_export_template").html()),V()("#mailpoet_subscribers_export > div.inside").html(r(window.exportData)),e=V()("#export_lists"),t=V()("#export_columns"),a=V()("a.mailpoet_export_process"),n=function(a,n){a.data("select2")&&a.html("").select2("destroy"),a.select2({data:n,width:"20em",templateResult:function(e){return e.subscriberCount>0?e.name+" ("+Te()(e.subscriberCount,10).toLocaleString()+")":e.name},templateSelection:function(e){return e.subscriberCount>0?e.name+" ("+Te()(e.subscriberCount,10).toLocaleString()+")":e.name}}).on("select2:selecting",function(e){var t,n=e.params.args.data.id,r=["select","deselect"];ye.a.contains(r,n)&&(e.preventDefault(),"deselect"===n?V()(this).val("").trigger("change"):(t=[],ye.a.each(a.find("option"),function(e){ye.a.contains(r,e.value)||t.push(e.value)}),V()(this).val(t).trigger("change")),V()(this).select2("close"))}).on("change",function(){window.exportData.segments&&e.select2("data").length&&t.select2("data").length||!window.exportData.segments&&t.select2("data").length?i("on"):i("off")})},window.segments.forEach(function(t){e.append(V()("<option></option>").attr("value",t.id).text(t.name))}),n(e,window.segments),n(t,window.subscriberFieldsSelect2),t.val(["email","first_name","last_name","list_status","global_status"]).trigger("change"),a.click(function(){var a;V()(this).hasClass("button-disabled")||(W.a.Modal.loading(!0),a=V()(':radio[name="option_format"]:checked').val(),W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"ImportExport",action:"processExport",data:He()({export_format_option:a,segments:!!window.exportData.segments&&e.val(),subscriber_fields:t.val()})}).always(function(){W.a.Modal.loading(!1)}).done(function(e){var t=W.a.I18n.t("exportMessage").replace("%1$s","<strong>"+Te()(e.data.totalExported,10).toLocaleString()+"</strong>").replace("[link]",'<a href="'+e.data.exportFileURL+'" target="_blank" >').replace("[/link]","</a>");V()("#export_result_notice").html("<p>"+t+"</p>").show(),window.location.href=e.data.exportFileURL,W.a.trackEvent("Subscribers export completed",{"Total exported":e.data.totalExported,"File Format":a,"MailPoet Free version":window.mailpoet_version})}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})}))}))});var br=a(394),yr=a.n(br),wr=function(e){return e.step>e.steps_count?null:r.a.createElement("div",{className:"mailpoet_stepped_progress_bar"},oe()(Array(e.steps_count).keys()).map(function(t){return r.a.createElement("div",{className:"mailpoet_stepped_progress_bar_step ".concat(t<e.step?"active":""),key:"step_".concat(t),style:{width:"".concat(Math.floor(100/e.steps_count),"%")}})}))};wr.propTypes={steps_count:u.a.number.isRequired,step:u.a.number.isRequired};var Er=wr,kr=function(e){return r.a.createElement("div",{className:"mailpoet_welcome_wizard_centered_column mailpoet_welcome_wizard_header"},r.a.createElement("img",{src:e.logo_src,width:"200",height:"87",alt:"MailPoet logo"}),e.current_step<=e.steps_count?r.a.createElement(Er,{steps_count:e.steps_count,step:e.current_step}):null)};kr.propTypes={current_step:u.a.number.isRequired,steps_count:u.a.number.isRequired,logo_src:u.a.string.isRequired};var Ir=kr,Sr=function(e){return r.a.createElement("div",{className:"mailpoet_welcome_wizard_step_content mailpoet_welcome_wizard_centered_column"},r.a.createElement("h1",null,W.a.I18n.t("welcomeWizardLetsStartTitle")),r.a.createElement("p",null,W.a.I18n.t("welcomeWizardSenderText")),r.a.createElement("form",{id:"mailpoet_sender_form",className:"mailpoet_welcome_wizard_centered_column ".concat(e.loading?"mailpoet_sender_form_loading":""),onSubmit:function(t){t.preventDefault(),V()("#mailpoet_sender_form").parsley().validate()&&e.submit_sender()}},r.a.createElement("label",{htmlFor:"senderName"},W.a.I18n.t("senderName"),":",r.a.createElement("input",{name:"senderName",type:"text",placeholder:"John Doe",value:e.sender?e.sender.name:"","data-parsley-required":!0,onChange:function(t){return e.update_sender({name:t.target.value})}})),r.a.createElement("label",{htmlFor:"senderAddress"},W.a.I18n.t("senderAddress"),":",r.a.createElement("input",{name:"senderAddress",type:"text",placeholder:"john@doe.com",value:e.sender?e.sender.address:"","data-parsley-required":!0,"data-parsley-type":"email",onChange:function(t){return e.update_sender({address:t.target.value})}})),r.a.createElement("input",{className:"button button-primary",type:"submit",value:W.a.I18n.t("next")}),r.a.createElement("a",{onClick:e.finish,href:"#finish",className:"sender_form_small"},W.a.I18n.t("noThanksSkip"))))};Sr.propTypes={finish:u.a.func.isRequired,loading:u.a.bool.isRequired,update_sender:u.a.func.isRequired,submit_sender:u.a.func.isRequired,sender:u.a.shape({name:u.a.string,address:u.a.string})},Sr.defaultProps={sender:null};var Nr=Sr,xr=function(e){return r.a.createElement("div",{className:"mailpoet_welcome_wizard_step_content mailpoet_welcome_wizard_centered_column"},r.a.createElement("h1",null,W.a.I18n.t("welcomeWizardLetsStartTitle")),r.a.createElement("p",null,W.a.I18n.t("welcomeWizardSenderMigratedUserText")),r.a.createElement("div",{className:"mailpoet_welcome_wizard_step_controls"},r.a.createElement("button",{type:"button",className:"button button-primary",onClick:e.next},W.a.I18n.t("next"))))};xr.propTypes={next:u.a.func.isRequired};var Cr=xr,Tr=function(e){return r.a.createElement("div",{className:"mailpoet_welcome_wizard_step_content mailpoet_welcome_wizard_centered_column"},r.a.createElement("h1",null,W.a.I18n.t("welcomeWizardEmailCourseTitle")),r.a.createElement("p",null,W.a.I18n.t("welcomeWizardEmailCourseText")),r.a.createElement("div",{className:"mailpoet_welcome_wizard_course_form_box"},r.a.createElement("img",{src:e.illustration_url,alt:"",width:"155",height:"155"}),r.a.createElement("iframe",{id:"mailpoet_form_iframe",width:"100%",scrolling:"no",frameBorder:"0",title:"Apply to course",src:"https://newsletters.mailpoet.com?mailpoet_form_iframe=13",className:"mailpoet_form_iframe",marginWidth:"0",marginHeight:"0"})),r.a.createElement("button",{type:"button",className:"button button-primary",onClick:e.next},W.a.I18n.t("next")))};Tr.propTypes={next:u.a.func.isRequired,illustration_url:u.a.string.isRequired};var Pr=Tr,Rr=function(e){return r.a.createElement("div",{className:"mailpoet_welcome_wizard_step_content mailpoet_welcome_wizard_centered_column"},r.a.createElement("h1",null,W.a.I18n.t("welcomeWizardUsageTrackingStepTitle")),r.a.createElement("p",null,W.a.I18n.t("welcomeWizardTrackingText")),r.a.createElement("h2",{className:"welcome_wizard_tracking_sub_title"},W.a.I18n.t("welcomeWizardUsageTrackingStepSubTitle")),r.a.createElement("ul",{className:"welcome_wizard_tracking_list"},r.a.createElement("li",null,W.a.I18n.t("welcomeWizardTrackingList1")),r.a.createElement("li",null,W.a.I18n.t("welcomeWizardTrackingList2")),r.a.createElement("li",null,W.a.I18n.t("welcomeWizardTrackingList3")),r.a.createElement("li",null,W.a.I18n.t("welcomeWizardTrackingList4")),r.a.createElement("li",null,W.a.I18n.t("welcomeWizardTrackingList5"))),r.a.createElement("a",{href:" https://kb.mailpoet.com/article/130-sharing-your-data-with-us",target:"_blank",rel:"noopener noreferrer"},W.a.I18n.t("welcomeWizardTrackingLink")),r.a.createElement("div",{className:"mailpoet_welcome_wizard_step_controls\n ".concat(e.loading?"mailpoet_welcome_wizard_step_controls_loading":"")},r.a.createElement("button",{type:"button",className:"button",onClick:e.skip_action,disabled:e.loading},W.a.I18n.t("skip")),r.a.createElement("button",{type:"button",className:"button button-primary",onClick:e.allow_action,disabled:e.loading},e.allow_text)))};Rr.propTypes={allow_action:u.a.func.isRequired,allow_text:u.a.string.isRequired,skip_action:u.a.func.isRequired,loading:u.a.bool.isRequired};var Ar=Rr,Dr=function(e){return r.a.createElement("div",{className:"mailpoet_welcome_wizard_step_content mailpoet_welcome_wizard_centered_column"},r.a.createElement("h1",null,W.a.I18n.t("welcomeWizardWooCommerceStepTitle")),r.a.createElement("p",null,W.a.I18n.t("welcomeWizardHelpingShopOwnersText")),r.a.createElement("p",null,W.a.I18n.t("welcomeWizardWooCommerceEmailsText")),r.a.createElement("img",{src:e.screenshot_src,className:"mailpoet_welcome_wizard_woo_screenshot",alt:"WooCommerce email"}),r.a.createElement("div",{className:"mailpoet_welcome_wizard_step_controls\n ".concat(e.loading?"mailpoet_welcome_wizard_step_controls_loading":"")},r.a.createElement("button",{type:"button",className:"button button-primary",onClick:e.next,disabled:e.loading},W.a.I18n.t("gotIt"))))};Dr.propTypes={next:u.a.func.isRequired,screenshot_src:u.a.string.isRequired,loading:u.a.bool.isRequired};var jr=Dr,Lr=function(e){var t=e.name,a=e.address,n=a.split("@").pop().toLowerCase();return window.mailpoet_free_domains.indexOf(n)>-1?function(e){var t=e.name,a=e.address,n=window.location.hostname.replace("www.",""),r="wordpress@".concat(n);return{sender:{name:t,address:r},reply_to:{name:t,address:a},"signup_confirmation.from.address":r,"signup_confirmation.from.name":t,"signup_confirmation.reply_to.address":a,"signup_confirmation.reply_to.name":t}}({name:t,address:a}):function(e){var t=e.name,a=e.address;return{sender:{name:t,address:a},reply_to:{name:t,address:a},"signup_confirmation.from.address":a,"signup_confirmation.from.name":t,"signup_confirmation.reply_to.address":a,"signup_confirmation.reply_to.name":t}}({name:t,address:a})},Or=function(e){var t=window.is_woocommerce_active?4:3,a=!window.is_mp2_migration_complete,i=Te()(e.match.params.step,10),s=Object(n.useState)(!1),o=at()(s,2),l=o[0],c=o[1],u=Object(n.useState)(window.sender_data),p=at()(u,2),d=p[0],m=p[1];function h(){c(!0),window.location=window.finish_wizard_url}function f(){4===t?e.history.push("/steps/4"):h()}function g(e){return c(!0),W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"settings",action:"set",data:e}).then(function(){return c(!1)}).fail(function(e){c(!1),e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})})}return Object(n.useEffect)(function(){(i>t||i<1)&&e.history.push("/steps/1")},[i,t,e.history]),r.a.createElement("div",{className:"mailpoet_welcome_wizard_steps mailpoet_welcome_wizard_centered_column"},r.a.createElement(Ir,{current_step:i,steps_count:t,logo_src:window.mailpoet_logo_url}),1===i&&a?r.a.createElement(Nr,{update_sender:function(e){m(yr()({},d,e))},submit_sender:function(){g(Lr(d)).then(function(){return e.history.push("/steps/2")})},finish:function(){c(!0),g(Lr({address:window.admin_email,name:""})).then(h)},loading:l,sender:d}):null,1!==i||a?null:r.a.createElement(Cr,{next:function(){return e.history.push("/steps/2")}}),2===i?r.a.createElement(Pr,{next:function(){return e.history.push("/steps/3")},illustration_url:window.email_course_illustration}):null,3===i?r.a.createElement(Ar,{skip_action:f,allow_action:function(){g({analytics:{enabled:!0}}).then(function(){return f()})},allow_text:4===t?W.a.I18n.t("allowAndContinue"):W.a.I18n.t("allowAndFinish"),loading:l}):null,4===i?r.a.createElement(jr,{next:h,screenshot_src:window.woocommerce_screenshot_url,loading:l}):null)};Or.propTypes={match:u.a.shape({params:u.a.shape({step:u.a.string}).isRequired}).isRequired,history:u.a.shape({push:u.a.func.isRequired}).isRequired};var Mr=Or,qr=document.getElementById("welcome_wizard_container");qr&&s.a.render(r.a.createElement(E,null,r.a.createElement("div",null,r.a.createElement(N,{exact:!0,path:"/",render:function(){return r.a.createElement(ge,{to:"/steps/1"})}}),r.a.createElement(N,{path:"/steps/:step",component:Mr}))),qr)},67:function(e,t,a){var n=a(464),r=a(465),i=a(473);e.exports=function(e){return n(e)||r(e)||i()}}},[[506,0,1]]]);
31
v4.1.1
32
https://github.com/mholt/PapaParse
33
*/
34
+ !function(t){"use strict";function a(e){this._handle=null,this._paused=!1,this._finished=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this._completeResults={data:[],errors:[],meta:{}},function(e){var t=p(e);t.chunkSize=parseInt(t.chunkSize),this._handle=new s(t),this._handle.streamer=this,this._config=t}.call(this,e),this.parseChunk=function(e){var a=this._partialLine+e;this._partialLine="";var n=this._handle.parse(a,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var r=n.meta.cursor;this._finished||(this._partialLine=a.substring(r-this._baseIndex),this._baseIndex=r),n&&n.data&&(this._rowCount+=n.data.length);var i=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(f)t.postMessage({results:n,workerId:b.WORKER_ID,finished:i});else if(m(this._config.chunk)){if(this._config.chunk(n,this._handle),this._paused)return;n=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(n.data),this._completeResults.errors=this._completeResults.errors.concat(n.errors),this._completeResults.meta=n.meta),!i||!m(this._config.complete)||n&&n.meta.aborted||this._config.complete(this._completeResults),i||n&&n.meta.paused||this._nextChunk(),n}},this._sendError=function(e){m(this._config.error)?this._config.error(e):f&&this._config.error&&t.postMessage({workerId:b.WORKER_ID,error:e,finished:!1})}}function n(e){var t;(e=e||{}).chunkSize||(e.chunkSize=b.RemoteChunkSize),a.call(this,e),this._nextChunk=f?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,f||(t.onload=d(this._chunkLoaded,this),t.onerror=d(this._chunkError,this)),t.open("GET",this._input,!f),this._config.chunkSize){var e=this._start+this._config.chunkSize-1;t.setRequestHeader("Range","bytes="+this._start+"-"+e),t.setRequestHeader("If-None-Match","webkit-no-cache")}try{t.send()}catch(e){this._chunkError(e.message)}f&&0==t.status?this._chunkError():this._start+=this._config.chunkSize}},this._chunkLoaded=function(){if(4==t.readyState){if(t.status<200||t.status>=400)return void this._chunkError();this._finished=!this._config.chunkSize||this._start>function(e){var t=e.getResponseHeader("Content-Range");return parseInt(t.substr(t.lastIndexOf("/")+1))}(t),this.parseChunk(t.responseText)}},this._chunkError=function(e){var a=t.statusText||e;this._sendError(a)}}function r(e){(e=e||{}).chunkSize||(e.chunkSize=b.LocalChunkSize),a.call(this,e);var t,n,r="undefined"!=typeof FileReader;this.stream=function(e){this._input=e,n=e.slice||e.webkitSlice||e.mozSlice,r?((t=new FileReader).onload=d(this._chunkLoaded,this),t.onerror=d(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var e=this._input;if(this._config.chunkSize){var a=Math.min(this._start+this._config.chunkSize,this._input.size);e=n.call(e,this._start,a)}var i=t.readAsText(e,this._config.encoding);r||this._chunkLoaded({target:{result:i}})},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 i(e){var t;e=e||{},a.call(this,e),this.stream=function(e){return e,t=e,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var e=this._config.chunkSize,a=e?t.substr(0,e):t;return t=e?t.substr(e):"",this._finished=!t,this.parseChunk(a)}}}function s(e){function t(){if(_&&l&&(r("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+b.DefaultDelimiter+"'"),l=!1),e.skipEmptyLines)for(var t=0;t<_.data.length;t++)1==_.data[t].length&&""==_.data[t][0]&&_.data.splice(t--,1);return a()&&function(){if(_){for(var e=0;a()&&e<_.data.length;e++)for(var t=0;t<_.data[e].length;t++)g.push(_.data[e][t]);_.data.splice(0,1)}}(),function(){if(!_||!e.header&&!e.dynamicTyping)return _;for(var t=0;t<_.data.length;t++){for(var a={},i=0;i<_.data[t].length;i++){if(e.dynamicTyping){var s=_.data[t][i];_.data[t][i]="true"==s||"TRUE"==s||"false"!=s&&"FALSE"!=s&&n(s)}e.header&&(i>=g.length?(a.__parsed_extra||(a.__parsed_extra=[]),a.__parsed_extra.push(_.data[t][i])):a[g[i]]=_.data[t][i])}e.header&&(_.data[t]=a,i>g.length?r("FieldMismatch","TooManyFields","Too many fields: expected "+g.length+" fields but parsed "+i,t):i<g.length&&r("FieldMismatch","TooFewFields","Too few fields: expected "+g.length+" fields but parsed "+i,t))}return e.header&&_.meta&&(_.meta.fields=g),_}()}function a(){return e.header&&0==g.length}function n(e){return c.test(e)?parseFloat(e):e}function r(e,t,a,n){_.errors.push({type:e,code:t,message:a,row:n})}var i,s,l,c=/^\s*-?(\d*\.?\d+|\d+\.?\d*)(e[-+]?\d+)?\s*#x2F;i,u=this,d=0,h=!1,f=!1,g=[],_={data:[],errors:[],meta:{}};if(m(e.step)){var v=e.step;e.step=function(n){if(_=n,a())t();else{if(t(),0==_.data.length)return;d+=n.data.length,e.preview&&d>e.preview?s.abort():v(_,u)}}}this.parse=function(a,n,r){if(e.newline||(e.newline=function(e){var t=(e=e.substr(0,1048576)).split("\r");if(1==t.length)return"\n";for(var a=0,n=0;n<t.length;n++)"\n"==t[n][0]&&a++;return a>=t.length/2?"\r\n":"\r"}(a)),l=!1,!e.delimiter){var c=function(t){for(var a,n,r,i=[",","\t","|",";",b.RECORD_SEP,b.UNIT_SEP],s=0;s<i.length;s++){var l=i[s],c=0,u=0;r=void 0;for(var p=new o({delimiter:l,preview:10}).parse(t),d=0;d<p.data.length;d++){var m=p.data[d].length;u+=m,void 0!==r?m>1&&(c+=Math.abs(m-r),r=m):r=m}u/=p.data.length,(void 0===n||n>c)&&u>1.99&&(n=c,a=l)}return e.delimiter=a,{successful:!!a,bestDelimiter:a}}(a);c.successful?e.delimiter=c.bestDelimiter:(l=!0,e.delimiter=b.DefaultDelimiter),_.meta.delimiter=e.delimiter}var u=p(e);return e.preview&&e.header&&u.preview++,i=a,s=new o(u),_=s.parse(i,n,r),t(),h?{meta:{paused:!0}}:_||{meta:{paused:!1}}},this.paused=function(){return h},this.pause=function(){h=!0,s.abort(),i=i.substr(s.getCharIndex())},this.resume=function(){h=!1,u.streamer.parseChunk(i)},this.aborted=function(){return f},this.abort=function(){f=!0,s.abort(),_.meta.aborted=!0,m(e.complete)&&e.complete(_),i=""}}function o(e){var t=(e=e||{}).delimiter,a=e.newline,n=e.comments,r=e.step,i=e.preview,s=e.fastMode;if(("string"!=typeof t||b.BAD_DELIMITERS.indexOf(t)>-1)&&(t=","),n===t)throw"Comment character same as delimiter";!0===n?n="#":("string"!=typeof n||b.BAD_DELIMITERS.indexOf(n)>-1)&&(n=!1),"\n"!=a&&"\r"!=a&&"\r\n"!=a&&(a="\n");var o=0,l=!1;this.parse=function(e,c,u){function p(e){w.push(e),I=o}function d(t){return u?h():(t||(t=e.substr(o)),k.push(t),o=g,p(k),y&&f(),h())}function m(t){o=t,p(k),k=[],C=e.indexOf(a,o)}function h(e){return{data:w,errors:E,meta:{delimiter:t,linebreak:a,aborted:l,truncated:!!e,cursor:I+(c||0)}}}function f(){r(h()),w=[],E=[]}if("string"!=typeof e)throw"Input must be a string";var g=e.length,_=t.length,v=a.length,b=n.length,y="function"==typeof r;o=0;var w=[],E=[],k=[],I=0;if(!e)return h();if(s||!1!==s&&-1===e.indexOf('"')){for(var S=e.split(a),N=0;N<S.length;N++){k=S[N];if(o+=k.length,N!==S.length-1)o+=a.length;else if(u)return h();if(!n||k.substr(0,b)!=n){if(y){if(w=[],p(k.split(t)),f(),l)return h()}else p(k.split(t));if(i&&N>=i)return w=w.slice(0,i),h(!0)}}return h()}for(var x=e.indexOf(t,o),C=e.indexOf(a,o);;)if('"'!=e[o])if(n&&0===k.length&&e.substr(o,b)===n){if(-1==C)return h();o=C+v,C=e.indexOf(a,o),x=e.indexOf(t,o)}else if(-1!==x&&(C>x||-1===C))k.push(e.substring(o,x)),o=x+_,x=e.indexOf(t,o);else{if(-1===C)break;if(k.push(e.substring(o,C)),m(C+v),y&&(f(),l))return h();if(i&&w.length>=i)return h(!0)}else{var T=o;for(o++;;){if(-1===(T=e.indexOf('"',T+1)))return u||E.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:w.length,index:o}),d();if(T===g-1)return d(e.substring(o,T).replace(/""/g,'"'));if('"'!=e[T+1]){if(e[T+1]==t){k.push(e.substring(o,T).replace(/""/g,'"')),o=T+1+_,x=e.indexOf(t,o),C=e.indexOf(a,o);break}if(e.substr(T+1,v)===a){if(k.push(e.substring(o,T).replace(/""/g,'"')),m(T+1+v),x=e.indexOf(t,o),y&&(f(),l))return h();if(i&&w.length>=i)return h(!0);break}}else T++}}return d()},this.abort=function(){l=!0},this.getCharIndex=function(){return o}}function l(e){var t=e.data,a=_[t.workerId],n=!1;if(t.error)a.userError(t.error,t.file);else if(t.results&&t.results.data){var r={abort:function(){n=!0,c(t.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:u,resume:u};if(m(a.userStep)){for(var i=0;i<t.results.data.length&&(a.userStep({data:[t.results.data[i]],errors:t.results.errors,meta:t.results.meta},r),!n);i++);delete t.results}else m(a.userChunk)&&(a.userChunk(t.results,r,t.file),delete t.results)}t.finished&&!n&&c(t.workerId,t.results)}function c(e,t){var a=_[e];m(a.userComplete)&&a.userComplete(t),a.terminate(),delete _[e]}function u(){throw"Not implemented."}function p(e){if("object"!=typeof e)return e;var t=e instanceof Array?[]:{};for(var a in e)t[a]=p(e[a]);return t}function d(e,t){return function(){e.apply(t,arguments)}}function m(e){return"function"==typeof e}var h,f=!t.document&&!!t.postMessage,g=!1,_={},v=0,b={};if(b.parse=function(e,a){if((a=a||{}).worker&&b.WORKERS_SUPPORTED){var s=function(){if(!b.WORKERS_SUPPORTED)return!1;if(!g&&null===b.SCRIPT_PATH)throw new Error("Script path cannot be determined automatically when Papa Parse is loaded asynchronously. You need to set Papa.SCRIPT_PATH manually.");var e=new t.Worker(b.SCRIPT_PATH||h);return e.onmessage=l,e.id=v++,_[e.id]=e,e}();return s.userStep=a.step,s.userChunk=a.chunk,s.userComplete=a.complete,s.userError=a.error,a.step=m(a.step),a.chunk=m(a.chunk),a.complete=m(a.complete),a.error=m(a.error),delete a.worker,void s.postMessage({input:e,config:a,workerId:s.id})}var o=null;return"string"==typeof e?o=a.download?new n(a):new i(a):(t.File&&e instanceof File||e instanceof Object)&&(o=new r(a)),o.stream(e)},b.unparse=function(e,t){function a(e){if("object"!=typeof e)return[];var t=[];for(var a in e)t.push(a);return t}function n(e,t){var a="";"string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t));var n=e instanceof Array&&e.length>0,i=!(t[0]instanceof Array);if(n){for(var l=0;l<e.length;l++)l>0&&(a+=s),a+=r(e[l],l);t.length>0&&(a+=o)}for(var c=0;c<t.length;c++){for(var u=n?e.length:t[c].length,p=0;u>p;p++){p>0&&(a+=s);var d=n&&i?e[p]:p;a+=r(t[c][d],p)}c<t.length-1&&(a+=o)}return a}function r(e,t){return null==e?"":(e=e.toString().replace(/"/g,'""'),"boolean"==typeof i&&i||i instanceof Array&&i[t]||function(e,t){for(var a=0;a<t.length;a++)if(e.indexOf(t[a])>-1)return!0;return!1}(e,b.BAD_DELIMITERS)||e.indexOf(s)>-1||" "==e.charAt(0)||" "==e.charAt(e.length-1)?'"'+e+'"':e)}var i=!1,s=",",o="\r\n";if("object"==typeof t&&("string"==typeof t.delimiter&&1==t.delimiter.length&&-1==b.BAD_DELIMITERS.indexOf(t.delimiter)&&(s=t.delimiter),("boolean"==typeof t.quotes||t.quotes instanceof Array)&&(i=t.quotes),"string"==typeof t.newline&&(o=t.newline)),"string"==typeof e&&(e=JSON.parse(e)),e instanceof Array){if(!e.length||e[0]instanceof Array)return n(null,e);if("object"==typeof e[0])return n(a(e[0]),e)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),e.data instanceof Array&&(e.fields||(e.fields=e.data[0]instanceof Array?e.fields:a(e.data[0])),e.data[0]instanceof Array||"object"==typeof e.data[0]||(e.data=[e.data])),n(e.fields||[],e.data||[]);throw"exception: Unable to serialize unrecognized input"},b.RECORD_SEP=String.fromCharCode(30),b.UNIT_SEP=String.fromCharCode(31),b.BYTE_ORDER_MARK="\ufeff",b.BAD_DELIMITERS=["\r","\n",'"',b.BYTE_ORDER_MARK],b.WORKERS_SUPPORTED=!!t.Worker,b.SCRIPT_PATH=null,b.LocalChunkSize=10485760,b.RemoteChunkSize=5242880,b.DefaultDelimiter=",",b.Parser=o,b.ParserHandle=s,b.NetworkStreamer=n,b.FileStreamer=r,b.StringStreamer=i,e.exports?e.exports=b:m(t.define)&&t.define.amd?t.define(function(){return b}):t.Papa=b,t.jQuery){var y=t.jQuery;y.fn.parse=function(e){function a(){if(0!=i.length){var t=i[0];if(m(e.before)){var a=e.before(t.file,t.inputElem);if("object"==typeof a){if("abort"==a.action)return void function(t,a,n,r){m(e.error)&&e.error({name:t},a,n,r)}("AbortError",t.file,t.inputElem,a.reason);if("skip"==a.action)return void n();"object"==typeof a.config&&(t.instanceConfig=y.extend(t.instanceConfig,a.config))}else if("skip"==a)return void n()}var r=t.instanceConfig.complete;t.instanceConfig.complete=function(e){m(r)&&r(e,t.file,t.inputElem),n()},b.parse(t.file,t.instanceConfig)}else m(e.complete)&&e.complete()}function n(){i.splice(0,1),a()}var r=e.config||{},i=[];return this.each(function(){if(!("INPUT"==y(this).prop("tagName").toUpperCase()&&"file"==y(this).attr("type").toLowerCase()&&t.FileReader)||!this.files||0==this.files.length)return!0;for(var e=0;e<this.files.length;e++)i.push({file:this.files[e],inputElem:this,instanceConfig:y.extend({},r)})}),a(),this}}f?t.onmessage=function(e){var a=e.data;if(void 0===b.WORKER_ID&&a&&(b.WORKER_ID=a.workerId),"string"==typeof a.input)t.postMessage({workerId:b.WORKER_ID,results:b.parse(a.input,a.config),finished:!0});else if(t.File&&a.input instanceof File||a.input instanceof Object){var n=b.parse(a.input,a.config);n&&t.postMessage({workerId:b.WORKER_ID,results:n,finished:!0})}}:b.WORKERS_SUPPORTED&&(h=function(){var e=document.getElementsByTagName("script");return e.length?e[e.length-1].src:""}(),document.body?document.addEventListener("DOMContentLoaded",function(){g=!0},!0):g=!0),n.prototype=Object.create(a.prototype),n.prototype.constructor=n,r.prototype=Object.create(a.prototype),r.prototype.constructor=r,i.prototype=Object.create(i.prototype),i.prototype.constructor=i}("undefined"!=typeof window?window:this)},394:function(e,t,a){var n=a(488),r=a(491),i=a(22),s=a(7);e.exports=function(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{},o=i(a);"function"==typeof r&&(o=o.concat(r(a).filter(function(e){return n(a,e).enumerable}))),o.forEach(function(t){s(e,t,a[t])})}return e}},463:function(e,t,a){"use strict";a.r(t);var n=a(8),r=a.n(n),i=a(9),s=a.n(i),o=a(10),l=a.n(o),c=a(11),u=a.n(c),p=a(12),d=a.n(p),m=a(62),h=a.n(m),f=a(1),g=a.n(f),_=a(267),v=a(0),b=a(2),y=a.n(b),w=a(89),E=a.n(w),k=a(27),I=a.n(k),S=[{name:"email",label:v.a.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:v.a.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:v.a.I18n.t("lastname"),type:"text",disabled:function(e){return Number(e.wp_user_id>0)||1===Number(e.is_woocommerce_user)}},{name:"status",label:v.a.I18n.t("status"),type:"select",values:{subscribed:v.a.I18n.t("subscribed"),unconfirmed:v.a.I18n.t("unconfirmed"),unsubscribed:v.a.I18n.t("unsubscribed"),bounced:v.a.I18n.t("bounced")},filter:function(e,t){return!(Number(e.wp_user_id)>0||1===Number(e.is_woocommerce_user))||"unconfirmed"!==t}},{name:"segments",label:v.a.I18n.t("lists"),type:"selection",placeholder:v.a.I18n.t("selectList"),tip:v.a.I18n.t("welcomeEmailTip"),api_version:window.mailpoet_api_version,endpoint:"segments",multiple:!0,selected:function(e){return!1===h()(e.subscriptions)?null:e.subscriptions.filter(function(e){return"subscribed"===e.status}).map(function(e){return e.segment_id})},filter:function(e){return!e.deleted_at&&"default"===e.type},getLabel:function(e){return"".concat(e.name," (").concat(e.subscribers,")")},getSearchLabel:function(e,t){var a="";return void 0!==t.subscriptions&&t.subscriptions.forEach(function(t){if(e.id===t.segment_id&&(a=e.name,"unsubscribed"===t.status)){var n=v.a.Date.format(t.updated_at);a+=" (%$1s)".replace("%$1s",v.a.I18n.t("unsubscribedOn").replace("%$1s",n))}}),a}}];(window.mailpoet_custom_fields||[]).forEach(function(e){var t={name:"cf_".concat(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=v.a.I18n.t("year"),t.month_placeholder=v.a.I18n.t("month"),t.day_placeholder=v.a.I18n.t("day");break;case"select":t.placeholder="-";break;default:t.placeholder=""}S.push(t)});var N={onUpdate:function(){v.a.Notice.success(v.a.I18n.t("subscriberUpdated"))},onCreate:function(){v.a.Notice.success(v.a.I18n.t("subscriberAdded")),v.a.trackEvent("Subscribers > Add new",{"MailPoet Free version":window.mailpoet_version})}};function x(e){if(Number(e.wp_user_id)>0)return g.a.createElement("p",{className:"description"},I()(v.a.I18n.t("WPUserEditNotice"),/\[link\](.*?)\[\/link\]/g,function(t,a){return g.a.createElement("a",{key:a,href:"user-edit.php?user_id=".concat(e.wp_user_id)},t)}))}function C(){return g.a.createElement("p",{className:"description"},g.a.createElement("strong",null,v.a.I18n.t("tip"))," ",v.a.I18n.t("customFieldsTip"))}var T=function(e){function t(){return r()(this,t),l()(this,u()(t).apply(this,arguments))}return d()(t,e),s()(t,[{key:"render",value:function(){return g.a.createElement("div",null,g.a.createElement("h1",{className:"title"},v.a.I18n.t("subscriber"),g.a.createElement(_.a,{className:"page-title-action",to:"/"},v.a.I18n.t("backToList"))),g.a.createElement(E.a,{automationId:"subscriber_edit_form",endpoint:"subscribers",fields:S,params:this.props.match.params,messages:N,beforeFormContent:x,afterFormContent:C}))}}]),t}(g.a.Component);T.propTypes={match:y.a.shape({params:y.a.shape({id:y.a.string}).isRequired}).isRequired},t.default=T},464:function(e,t,a){var n=a(62);e.exports=function(e){if(n(e)){for(var t=0,a=new Array(e.length);t<e.length;t++)a[t]=e[t];return a}}},465:function(e,t,a){var n=a(466),r=a(470);e.exports=function(e){if(r(Object(e))||"[object Arguments]"===Object.prototype.toString.call(e))return n(e)}},466:function(e,t,a){e.exports=a(467)},467:function(e,t,a){a(80),a(468),e.exports=a(18).Array.from},468:function(e,t,a){"use strict";var n=a(53),r=a(24),i=a(70),s=a(382),o=a(383),l=a(226),c=a(469),u=a(367);r(r.S+r.F*!a(384)(function(e){Array.from(e)}),"Array",{from:function(e){var t,a,r,p,d=i(e),m="function"==typeof this?this:Array,h=arguments.length,f=h>1?arguments[1]:void 0,g=void 0!==f,_=0,v=u(d);if(g&&(f=n(f,h>2?arguments[2]:void 0,2)),null==v||m==Array&&o(v))for(a=new m(t=l(d.length));t>_;_++)c(a,_,g?f(d[_],_):d[_]);else for(p=v.call(d),a=new m;!(r=p.next()).done;_++)c(a,_,g?s(p,f,[r.value,_],!0):r.value);return a.length=_,a}})},469:function(e,t,a){"use strict";var n=a(33),r=a(50);e.exports=function(e,t,a){t in e?n.f(e,t,r(0,a)):e[t]=a}},470:function(e,t,a){e.exports=a(471)},471:function(e,t,a){a(94),a(80),e.exports=a(472)},472:function(e,t,a){var n=a(368),r=a(28)("iterator"),i=a(57);e.exports=a(18).isIterable=function(e){var t=Object(e);return void 0!==t[r]||"@@iterator"in t||i.hasOwnProperty(n(t))}},473:function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},485:function(e,t,a){"use strict";a.r(t);var n=a(1),r=a.n(n),i=a(267),s=a(0),o=a(89),l=a.n(o),c=a(2),u=a.n(c),p=[{name:"name",label:s.a.I18n.t("name"),type:"text"},{name:"description",label:s.a.I18n.t("description"),type:"textarea",tip:s.a.I18n.t("segmentDescriptionTip")}],d={onUpdate:function(){s.a.Notice.success(s.a.I18n.t("segmentUpdated"))},onCreate:function(){s.a.Notice.success(s.a.I18n.t("segmentAdded")),s.a.trackEvent("Lists > Add new",{"MailPoet Free version":window.mailpoet_version})}},m=function(e){return r.a.createElement("div",null,r.a.createElement("h1",{className:"title"},s.a.I18n.t("segment"),r.a.createElement(i.a,{className:"page-title-action",to:"/"},s.a.I18n.t("backToList"))),r.a.createElement(l.a,{endpoint:"segments",fields:p,params:e.match.params,messages:d}))};m.propTypes={match:u.a.shape({params:u.a.shape({id:u.a.string}).isRequired}).isRequired},t.default=m},487:function(e,t){jQuery.AsyncQueue=function(){var e,t,a,n,r=this,s=[],o=!1;return n=function(){var e=s.shift();e?(e.apply(r,[r]),!1===o&&n()):t&&t.apply(r)},this.onFailure=function(t){e=t},this.onComplete=function(e){t=e},this.add=function(e){return s.push(e),this},this.storeData=function(e){return a=e,this},this.lastCallbackData=function(){return a},this.run=function(){o=!1,n()},this.pause=function(){return o=!0,this},this.failure=function(){if(o=!0,e){var t=[r];for(i=0;i<arguments.length;i++)t.push(arguments[i]);e.apply(r,t)}},this}},488:function(e,t,a){e.exports=a(489)},489:function(e,t,a){a(490);var n=a(18).Object;e.exports=function(e,t){return n.getOwnPropertyDescriptor(e,t)}},490:function(e,t,a){var n=a(48),r=a(232).f;a(227)("getOwnPropertyDescriptor",function(){return function(e,t){return r(n(e),t)}})},491:function(e,t,a){e.exports=a(492)},492:function(e,t,a){a(258),e.exports=a(18).Object.getOwnPropertySymbols},506:function(e,t,a){"use strict";a.r(t);var n=a(1),r=a.n(n),i=a(21),s=a.n(i),o=a(260),l=a.n(o),c=a(2),u=a.n(c),p=a(87),d=a(32),m=a.n(d),h=a(35),f=a.n(h),g=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e};function _(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var v=function(e){function t(){var a,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var r=arguments.length,i=Array(r),s=0;s<r;s++)i[s]=arguments[s];return a=n=_(this,e.call.apply(e,[this].concat(i))),n.state={match:n.computeMatch(n.props.history.location.pathname)},_(n,a)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.getChildContext=function(){return{router:g({},this.context.router,{history:this.props.history,route:{location:this.props.history.location,match:this.state.match}})}},t.prototype.computeMatch=function(e){return{path:"/",url:"/",params:{},isExact:"/"===e}},t.prototype.componentWillMount=function(){var e=this,t=this.props,a=t.children,n=t.history;f()(null==a||1===r.a.Children.count(a),"A <Router> may have only one child element"),this.unlisten=n.listen(function(){e.setState({match:e.computeMatch(n.location.pathname)})})},t.prototype.componentWillReceiveProps=function(e){m()(this.props.history===e.history,"You cannot change <Router history>")},t.prototype.componentWillUnmount=function(){this.unlisten()},t.prototype.render=function(){var e=this.props.children;return e?r.a.Children.only(e):null},t}(r.a.Component);v.propTypes={history:u.a.object.isRequired,children:u.a.node},v.contextTypes={router:u.a.object},v.childContextTypes={router:u.a.object.isRequired};var b=v;function y(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var w=function(e){function t(){var a,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var r=arguments.length,i=Array(r),s=0;s<r;s++)i[s]=arguments[s];return a=n=y(this,e.call.apply(e,[this].concat(i))),n.history=Object(p.createHashHistory)(n.props),y(n,a)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.componentWillMount=function(){l()(!this.props.history,"<HashRouter> ignores the history prop. To use a custom history, use `import { Router }` instead of `import { HashRouter as Router }`.")},t.prototype.render=function(){return r.a.createElement(b,{history:this.history,children:this.props.children})},t}(r.a.Component);w.propTypes={basename:u.a.string,getUserConfirmation:u.a.func,hashType:u.a.oneOf(["hashbang","noslash","slash"]),children:u.a.node};var E=w,k=a(264);var I=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.componentWillMount=function(){f()(this.context.router,"You should not use <Switch> outside a <Router>")},t.prototype.componentWillReceiveProps=function(e){m()(!(e.location&&!this.props.location),'<Switch> elements should not change from uncontrolled to controlled (or vice versa). You initially used no "location" prop and then provided one on a subsequent render.'),m()(!(!e.location&&this.props.location),'<Switch> elements should not change from controlled to uncontrolled (or vice versa). You provided a "location" prop initially but omitted it on a subsequent render.')},t.prototype.render=function(){var e=this.context.router.route,t=this.props.children,a=this.props.location||e.location,n=void 0,i=void 0;return r.a.Children.forEach(t,function(t){if(null==n&&r.a.isValidElement(t)){var s=t.props,o=s.path,l=s.exact,c=s.strict,u=s.sensitive,p=s.from,d=o||p;i=t,n=Object(k.a)(a.pathname,{path:d,exact:l,strict:c,sensitive:u},e.match)}}),n?r.a.cloneElement(i,{location:a,computedMatch:n}):null},t}(r.a.Component);I.contextTypes={router:u.a.shape({route:u.a.object.isRequired}).isRequired},I.propTypes={children:u.a.node,location:u.a.object};var S=I,N=a(263).a,x=a(8),C=a.n(x),T=a(9),P=a.n(T),R=a(10),A=a.n(R),D=a(11),j=a.n(D),L=a(12),O=a.n(L),M=a(6),q=a.n(M),F=a(7),B=a.n(F),$=a(267),H=a(3),V=a.n(H),W=a(0),z=a(16),U=a.n(z),Y=a(47),K=a.n(Y),G=a(100),J=a.n(G),Q=[{name:"email",label:W.a.I18n.t("subscriber"),sortable:!0},{name:"status",label:W.a.I18n.t("status"),sortable:!0},{name:"segments",label:W.a.I18n.t("lists")},{name:"created_at",label:W.a.I18n.t("subscribedOn"),sortable:!0},{name:"updated_at",label:W.a.I18n.t("lastModifiedOn"),sortable:!0}],X={onTrash:function(e){var t=Number(e.meta.count),a=null;a=1===t?W.a.I18n.t("oneSubscriberTrashed"):W.a.I18n.t("multipleSubscribersTrashed").replace("%$1d",t.toLocaleString()),W.a.Notice.success(a)},onDelete:function(e){var t=Number(e.meta.count),a=null;a=1===t?W.a.I18n.t("oneSubscriberDeleted"):W.a.I18n.t("multipleSubscribersDeleted").replace("%$1d",t.toLocaleString()),W.a.Notice.success(a)},onRestore:function(e){var t=Number(e.meta.count),a=null;a=1===t?W.a.I18n.t("oneSubscriberRestored"):W.a.I18n.t("multipleSubscribersRestored").replace("%$1d",t.toLocaleString()),W.a.Notice.success(a)},onNoItemsFound:function(e){return"bounced"===e&&!window.mailpoet_premium_active&&!window.mss_active&&r.a.createElement("div",null,r.a.createElement("p",null,W.a.I18n.t("bouncedSubscribersHelp")),r.a.createElement("p",null,r.a.createElement("a",{href:"admin.php?page=mailpoet-premium",className:"button-primary"},W.a.I18n.t("bouncedSubscribersPremiumButtonText"))))}},Z=[{name:"moveToList",label:W.a.I18n.t("moveToList"),onSelect:function(){return r.a.createElement(J.a,{field:{id:"move_to_segment",name:"move_to_segment",endpoint:"segments",filter:function(e){return!(e.deleted_at||"default"!==e.type)}}})},getData:function(){return{segment_id:Number(V()("#move_to_segment").val())}},onSuccess:function(e){W.a.Notice.success(W.a.I18n.t("multipleSubscribersMovedToList").replace("%$1d",Number(e.meta.count).toLocaleString()).replace("%$2s",e.meta.segment))}},{name:"addToList",label:W.a.I18n.t("addToList"),onSelect:function(){return r.a.createElement(J.a,{field:{id:"add_to_segment",name:"add_to_segment",endpoint:"segments",filter:function(e){return!(e.deleted_at||"default"!==e.type)}}})},getData:function(){return{segment_id:Number(V()("#add_to_segment").val())}},onSuccess:function(e){W.a.Notice.success(W.a.I18n.t("multipleSubscribersAddedToList").replace("%$1d",Number(e.meta.count).toLocaleString()).replace("%$2s",e.meta.segment))}},{name:"removeFromList",label:W.a.I18n.t("removeFromList"),onSelect:function(){return r.a.createElement(J.a,{field:{id:"remove_from_segment",name:"remove_from_segment",endpoint:"segments",filter:function(e){return!("default"!==e.type)}}})},getData:function(){return{segment_id:Number(V()("#remove_from_segment").val())}},onSuccess:function(e){W.a.Notice.success(W.a.I18n.t("multipleSubscribersRemovedFromList").replace("%$1d",Number(e.meta.count).toLocaleString()).replace("%$2s",e.meta.segment))}},{name:"removeFromAllLists",label:W.a.I18n.t("removeFromAllLists"),onSuccess:function(e){W.a.Notice.success(W.a.I18n.t("multipleSubscribersRemovedFromAllLists").replace("%$1d",Number(e.meta.count).toLocaleString()))}},{name:"sendConfirmationEmail",label:W.a.I18n.t("resendConfirmationEmail"),onSuccess:function(e){W.a.Notice.success(W.a.I18n.t("multipleConfirmationEmailsSent").replace("%$1d",Number(e.meta.count).toLocaleString()))}},{name:"trash",label:W.a.I18n.t("moveToTrash"),onSuccess:X.onTrash}],ee=[{name:"edit",label:W.a.I18n.t("edit"),link:function(e){return r.a.createElement($.a,{to:"/edit/".concat(e.id)},W.a.I18n.t("edit"))}},{name:"trash",display:function(e){return 0===Number(e.wp_user_id)&&0===Number(e.is_woocommerce_user)}}],te=function(e){function t(){var e,a;C()(this,t);for(var n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return a=A()(this,(e=j()(t)).call.apply(e,[this].concat(i))),B()(q()(q()(a)),"getSegmentFromId",function(e){var t=!1;return window.mailpoet_segments.forEach(function(a){a.id===e&&(t=a)}),t}),B()(q()(q()(a)),"renderItem",function(e,t){var n=U()("manage-column","column-primary","has-row-actions","column-username"),i="";switch(e.status){case"subscribed":i=W.a.I18n.t("subscribed");break;case"unconfirmed":i=W.a.I18n.t("unconfirmed");break;case"unsubscribed":i=W.a.I18n.t("unsubscribed");break;case"bounced":i=W.a.I18n.t("bounced");break;default:i="Invalid"}var s=!1;if(e.subscriptions.length>0){var o=[];e.subscriptions.forEach(function(e){var t=a.getSegmentFromId(e.segment_id);!1!==t&&"subscribed"===e.status&&o.push(t.name)}),s=r.a.createElement("span",null,o.join(", "))}return r.a.createElement("div",null,r.a.createElement("td",{className:n},r.a.createElement("strong",null,r.a.createElement($.a,{className:"row-title",to:"/edit/".concat(e.id)},e.email)),r.a.createElement("p",{style:{margin:0}},e.first_name," ",e.last_name),t),r.a.createElement("td",{className:"column","data-colname":W.a.I18n.t("status")},i),r.a.createElement("td",{className:"column","data-colname":W.a.I18n.t("lists")},s),r.a.createElement("td",{className:"column-date","data-colname":W.a.I18n.t("subscribedOn")},r.a.createElement("abbr",null,W.a.Date.format(e.created_at))),r.a.createElement("td",{className:"column-date","data-colname":W.a.I18n.t("lastModifiedOn")},r.a.createElement("abbr",null,W.a.Date.format(e.updated_at))))}),a}return O()(t,e),P()(t,[{key:"render",value:function(){return r.a.createElement("div",null,r.a.createElement("h1",{className:"title"},W.a.I18n.t("pageTitle")," ",r.a.createElement($.a,{className:"page-title-action",to:"/new"},W.a.I18n.t("new")),r.a.createElement("a",{className:"page-title-action",href:"?page=mailpoet-import","data-automation-id":"import-subscribers-button"},W.a.I18n.t("import")),r.a.createElement("a",{id:"mailpoet_export_button",className:"page-title-action",href:"?page=mailpoet-export"},W.a.I18n.t("export"))),r.a.createElement(K.a,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,endpoint:"subscribers",onRenderItem:this.renderItem,columns:Q,bulk_actions:Z,item_actions:ee,messages:X,sort_by:"created_at",sort_order:"desc"}))}}]),t}(r.a.Component);te.propTypes={location:u.a.object.isRequired,match:u.a.shape({params:u.a.object}).isRequired};var ae=te,ne=a(374),re=a.n(ne),ie=document.getElementById("subscribers_container");ie&&s.a.render(r.a.createElement(E,null,r.a.createElement(S,null,r.a.createElement(N,{path:"/new",component:re.a}),r.a.createElement(N,{path:"/edit/:id",component:re.a}),r.a.createElement(N,{path:"*",component:ae}))),ie);var se=a(67),oe=a.n(se),le=a(91),ce=a(96),ue=a.n(ce),pe={},de=0,me=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"/"===e?e:function(e){var t=e,a=pe[t]||(pe[t]={});if(a[e])return a[e];var n=ue.a.compile(e);return de<1e4&&(a[e]=n,de++),n}(e)(t,{pretty:!0})},he=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e};var fe=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.isStatic=function(){return this.context.router&&this.context.router.staticContext},t.prototype.componentWillMount=function(){f()(this.context.router,"You should not use <Redirect> outside a <Router>"),this.isStatic()&&this.perform()},t.prototype.componentDidMount=function(){this.isStatic()||this.perform()},t.prototype.componentDidUpdate=function(e){var t=Object(le.createLocation)(e.to),a=Object(le.createLocation)(this.props.to);Object(le.locationsAreEqual)(t,a)?m()(!1,"You tried to redirect to the same route you're currently on: \""+a.pathname+a.search+'"'):this.perform()},t.prototype.computeTo=function(e){var t=e.computedMatch,a=e.to;return t?"string"==typeof a?me(a,t.params):he({},a,{pathname:me(a.pathname,t.params)}):a},t.prototype.perform=function(){var e=this.context.router.history,t=this.props.push,a=this.computeTo(this.props);t?e.push(a):e.replace(a)},t.prototype.render=function(){return null},t}(r.a.Component);fe.propTypes={computedMatch:u.a.object,push:u.a.bool,from:u.a.string,to:u.a.oneOfType([u.a.string,u.a.object]).isRequired},fe.defaultProps={push:!1},fe.contextTypes={router:u.a.shape({history:u.a.shape({push:u.a.func.isRequired,replace:u.a.func.isRequired}).isRequired,staticContext:u.a.object}).isRequired};var ge=fe,_e=a(19),ve=a.n(_e),be=a(4),ye=a.n(be),we=a(42),Ee=a.n(we),ke=a(515),Ie=function(e){function t(){var e,a;C()(this,t);for(var n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return a=A()(this,(e=j()(t)).call.apply(e,[this].concat(i))),B()(q()(q()(a)),"setupNewsletter",function(e){void 0!==e&&(a.props.history.push("/new/".concat(e)),W.a.trackEvent("Emails > Type selected",{"MailPoet Free version":window.mailpoet_version,"Email type":e}))}),B()(q()(q()(a)),"getAutomaticEmails",function(){return window.mailpoet_automatic_emails?ye.a.map(window.mailpoet_automatic_emails,function(e){var t=e,n=window.mailpoet_premium_active?ye.a.partial(a.setupNewsletter,e.slug):void 0;return t.action=r.a.createElement("div",null,r.a.createElement("a",{className:"button button-primary",onClick:n,role:"button",tabIndex:0,disabled:!window.mailpoet_premium_active,onKeyDown:function(e){["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),a.onClick())}},W.a.I18n.t("setUp"))),t}):[]}),B()(q()(q()(a)),"createNewsletter",function(e){W.a.trackEvent("Emails > Type selected",{"MailPoet Free version":window.mailpoet_version,"Email type":e}),W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:{type:e,subject:W.a.I18n.t("draftNewsletterTitle")}}).done(function(e){a.props.history.push("/template/".concat(e.data.id))}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})})}),a}return O()(t,e),P()(t,[{key:"render",value:function(){var e=ye.a.partial(this.createNewsletter,"standard"),t=ye.a.partial(this.setupNewsletter,"notification"),a=ye.a.partial(this.setupNewsletter,"welcome"),n=[{slug:"standard",title:W.a.I18n.t("regularNewsletterTypeTitle"),description:W.a.I18n.t("regularNewsletterTypeDescription"),action:r.a.createElement("a",{className:"button button-primary","data-automation-id":"create_standard",onClick:e,role:"button",tabIndex:0,onKeyDown:function(t){["keydown","keypress"].includes(t.type)&&["Enter"," "].includes(t.key)&&(t.preventDefault(),e())}},W.a.I18n.t("create"))},{slug:"welcome",title:W.a.I18n.t("welcomeNewsletterTypeTitle"),description:W.a.I18n.t("welcomeNewsletterTypeDescription"),videoGuide:"https://beta.docs.mailpoet.com/article/254-video-guide-to-welcome-emails",action:r.a.createElement("a",{className:"button button-primary",onClick:a,"data-automation-id":"create_welcome",onKeyDown:function(e){["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),a())},role:"button",tabIndex:0},W.a.I18n.t("setUp"))},{slug:"notification",title:W.a.I18n.t("postNotificationNewsletterTypeTitle"),description:W.a.I18n.t("postNotificationNewsletterTypeDescription"),videoGuide:"https://beta.docs.mailpoet.com/article/210-video-guide-to-post-notifications",action:r.a.createElement("a",{className:"button button-primary","data-automation-id":"create_notification",onClick:t,role:"button",tabIndex:0,onKeyDown:function(e){["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),t())}},W.a.I18n.t("setUp"))}],i=ve.a.applyFilters("mailpoet_newsletters_types",n.concat(oe()(this.getAutomaticEmails())),this),s=!0===window.mailpoet_is_new_user?"mailpoet_badge mailpoet_badge_video":"mailpoet_badge mailpoet_badge_video mailpoet_badge_video_grey";return r.a.createElement("div",null,r.a.createElement("h1",null,W.a.I18n.t("pickCampaignType")),r.a.createElement(Ee.a,{step:"type"}),r.a.createElement("ul",{className:"mailpoet_boxes mailpoet_boxes_types"},i.map(function(e){return r.a.createElement("li",{key:e.slug,"data-type":e.slug,className:"mailpoet_newsletter_types"},r.a.createElement("div",{className:"mailpoet_thumbnail"},e.thumbnailImage?r.a.createElement("img",{src:e.thumbnailImage,alt:""}):null),r.a.createElement("div",{className:"mailpoet_boxes_content"},r.a.createElement("div",{className:"mailpoet_description"},r.a.createElement("h3",null,e.title," ",e.beta?"(".concat(W.a.I18n.t("beta"),")"):""),r.a.createElement("p",null,e.description),e.videoGuide&&r.a.createElement("a",{className:s,href:e.videoGuide,target:"_blank",rel:"noopener noreferrer"},r.a.createElement("span",{className:"dashicons dashicons-format-video"}),W.a.I18n.t("seeVideoGuide"))),r.a.createElement("div",{className:"mailpoet_actions"},e.action)))},this)))}}]),t}(r.a.Component);B()(Ie,"propTypes",{history:u.a.shape({push:u.a.func.isRequired}).isRequired});var Se=Object(ke.a)(Ie),Ne=a(36),xe=a.n(Ne),Ce=a(15),Te=a.n(Ce),Pe=a(22),Re=a.n(Pe),Ae=function(e){function t(){return C()(this,t),A()(this,j()(t).apply(this,arguments))}return O()(t,e),P()(t,[{key:"componentWillMount",value:function(){W.a.Modal.loading(!0)}},{key:"componentWillUnmount",value:function(){W.a.Modal.loading(!1)}},{key:"render",value:function(){return null}}]),t}(r.a.Component),De=function(e){var t=e.tabs,a=e.selected,n=e.select;return r.a.createElement("div",{className:"wp-filter hide-if-no-js"},r.a.createElement("ul",{className:"filter-links"},t.map(function(e){var t=e.name,i=e.label;return r.a.createElement("li",{key:t},r.a.createElement("a",{href:"javascript:",className:a===t?"current":"",onClick:function(){return n(t)}}," ",i))})))};De.propTypes={selected:u.a.string.isRequired,select:u.a.func.isRequired,tabs:u.a.arrayOf(u.a.shape({label:u.a.string.isRequired,name:u.a.string.isRequired}).isRequired).isRequired};var je=De,Le=a(247),Oe=a.n(Le),Me=function(e){return W.a.Modal.popup({title:e.title,template:Oe.a.renderToString(r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,e.message),r.a.createElement("button",{id:"mailpoet_alert_cancel",className:"button button-secondary",type:"button"},e.cancelLabel),r.a.createElement("button",{id:"mailpoet_alert_confirm",className:"button button-primary",type:"submit"},e.confirmLabel))),onInit:function(){document.getElementById("mailpoet_alert_confirm").addEventListener("click",function(){W.a.Modal.close(),e.onConfirm()}),document.getElementById("mailpoet_alert_cancel").addEventListener("click",function(){return W.a.Modal.close()})}}),null};function qe(e){Oe.a.renderToString(r.a.createElement(Me,e))}Me.propTypes={title:u.a.string,message:u.a.string.isRequired,cancelLabel:u.a.string,confirmLabel:u.a.string,onConfirm:u.a.func.isRequired},Me.defaultProps={title:W.a.I18n.t("confirmTitle"),cancelLabel:W.a.I18n.t("cancelLabel"),confirmLabel:W.a.I18n.t("confirmLabel")};var Fe=function(e){function t(e){var a;return C()(this,t),(a=A()(this,j()(t).call(this,e))).onPreview=a.onPreview.bind(q()(q()(a))),a.onDelete=a.onDelete.bind(q()(q()(a))),a.onSelect=a.onSelect.bind(q()(q()(a))),a}return O()(t,e),P()(t,[{key:"onDelete",value:function(){var e=this.props,t=e.id,a=e.name,n=e.beforeDelete,r=e.afterDelete;qe({message:W.a.I18n.t("confirmTemplateDeletion").replace("%$1s",a),onConfirm:function(){n(),W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"delete",data:{id:t}}).done(function(){r(!0,t)}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0}),r(!1)})}})}},{key:"onPreview",value:function(){W.a.Modal.popup({title:this.props.name,template:'<div class="mailpoet_boxes_preview" style="background-color: {{ body.globalStyles.body.backgroundColor }}"><img src="{{ thumbnail }}" /></div>',data:this.props})}},{key:"onSelect",value:function(){var e=this.props,t=e.newsletterId,a=e.name,n=e.beforeSelect,r=e.afterSelect;n(),W.a.trackEvent("Emails > Template selected",{"MailPoet Free version":window.mailpoet_version,"Email name":a}),W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"save",data:{id:t,template_id:this.props.id}}).done(function(e){r(!0,e.data.id)}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0}),r(!1)})}},{key:"render",value:function(){var e=this,t=this.props,a=t.index,n=t.name,i=t.thumbnail,s=t.readonly,o=r.a.createElement("button",{className:"mailpoet_delete button button-secondary",onClick:this.onDelete,type:"button"},W.a.I18n.t("delete")),l="";return"string"==typeof i&&i.length>0&&(l=r.a.createElement("a",{href:"javascript:;",onClick:this.onPreview},r.a.createElement("img",{src:i,alt:W.a.I18n.t("templatePreview")}),r.a.createElement("div",{className:"mailpoet_overlay"},r.a.createElement("p",{className:"mailpoet_more_details"},W.a.I18n.t("zoom"))))),r.a.createElement("li",{className:"mailpoet_template_boxes","data-automation-id":"select_template_box"},r.a.createElement("div",{className:"mailpoet_thumbnail"},l),r.a.createElement("div",{className:"mailpoet_template_content"},r.a.createElement("div",{className:"mailpoet_description"},r.a.createElement("h3",null,n)),r.a.createElement("div",{className:"mailpoet_actions"},"1"!==s&&o,r.a.createElement("a",{className:"button button-primary","data-automation-id":"select_template_".concat(a),onClick:this.onSelect,role:"button",tabIndex:0,onKeyDown:function(t){["keydown","keypress"].includes(t.type)&&["Enter"," "].includes(t.key)&&(t.preventDefault(),e.onSelect())}}," ",W.a.I18n.t("select")," "))))}}]),t}(r.a.Component);Fe.propTypes={index:u.a.number.isRequired,id:u.a.string.isRequired,newsletterId:u.a.string.isRequired,name:u.a.string.isRequired,thumbnail:u.a.string.isRequired,readonly:u.a.string.isRequired,beforeDelete:u.a.func.isRequired,afterDelete:u.a.func.isRequired,beforeSelect:u.a.func.isRequired,afterSelect:u.a.func.isRequired};var Be=Fe,$e=a(20),He=a.n($e),Ve=a(63),We=function(e){function t(e){var a;return C()(this,t),(a=A()(this,j()(t).call(this,e))).fileRef=r.a.createRef(),a.handleSubmit=a.handleSubmit.bind(q()(q()(a))),a}return O()(t,e),P()(t,[{key:"saveTemplate",value:function(e){var t=e,a=this.props,n=a.beforeImport,r=a.afterImport;ye.a.isUndefined(t.body)||(t.body=He()(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=He()(t.categories),n(),W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"save",data:t}).done(function(e){r(!0,e.data)}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0}),r(!1)})}},{key:"handleSubmit",value:function(e){var t=this;if(e.preventDefault(),ye.a.size(this.fileRef.current.files)<=0)return!1;var a=ye.a.first(this.fileRef.current.files),n=new FileReader;return n.onload=function(e){try{t.saveTemplate(JSON.parse(e.target.result)),W.a.trackEvent("Emails > Template imported",{"MailPoet Free version":window.mailpoet_version})}catch(e){W.a.Notice.error(W.a.I18n.t("templateFileMalformedError"))}},n.readAsText(a),!0}},{key:"render",value:function(){return r.a.createElement("div",null,r.a.createElement("h2",null,W.a.I18n.t("importTemplateTitle"),r.a.createElement(Ve.a,{tooltip:W.a.I18n.t("helpTooltipTemplateUpload"),place:"right",className:"tooltip-help-import-template"})),r.a.createElement("form",{onSubmit:this.handleSubmit},r.a.createElement("input",{type:"file",placeholder:W.a.I18n.t("selectJsonFileToUpload"),ref:this.fileRef}),r.a.createElement("p",{className:"submit"},r.a.createElement("input",{className:"button button-primary",type:"submit",value:W.a.I18n.t("upload")}))))}}]),t}(r.a.Component);We.propTypes={beforeImport:u.a.func.isRequired,afterImport:u.a.func.isRequired};var ze=We,Ue=[{name:"standard",label:W.a.I18n.t("tabStandardTitle")},{name:"welcome",label:W.a.I18n.t("tabWelcomeTitle")},{name:"notification",label:W.a.I18n.t("tabNotificationTitle")}];window.mailpoet_woocommerce_active&&Ue.push({name:"woocommerce",label:W.a.I18n.t("tabWoocommerceTitle")}),Ue.push.apply(Ue,[{name:"all",label:W.a.I18n.t("allTemplates")},{name:"recent",label:W.a.I18n.t("recentlySent")},{name:"saved",label:W.a.I18n.t("savedTemplates")}]);var Ye=function(e){function t(e){var a;return C()(this,t),(a=A()(this,j()(t).call(this,e))).state={loading:!0,templates:{},emailType:null,selectedTab:""},a.templates={},a.addTemplate=a.addTemplate.bind(q()(q()(a))),a.afterTemplateDelete=a.afterTemplateDelete.bind(q()(q()(a))),a.afterTemplateSelect=a.afterTemplateSelect.bind(q()(q()(a))),a.afterTemplateImport=a.afterTemplateImport.bind(q()(q()(a))),a}return O()(t,e),P()(t,[{key:"componentWillMount",value:function(){var e=this;W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"getAll"}).done(function(t){0===t.data.length&&(t.data=[{name:W.a.I18n.t("mailpoetGuideTemplateTitle"),categories:'["welcome", "notification", "standard", "woocommerce"]',readonly:"1"}]),t.data.forEach(e.addTemplate),e.sortTemplates()}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})}).always(function(){e.selectInitialTab()})}},{key:"addTemplate",value:function(e){var t,a=this,n=Ue.map(function(e){return e.name});try{t=JSON.parse(e.categories).filter(function(e){return-1!==n.indexOf(e)})}catch(e){t=[]}0===t.length&&t.push("saved"),t.forEach(function(t){void 0===a.templates[t]&&(a.templates[t]=[]),a.templates[t].unshift(e)})}},{key:"sortTemplates",value:function(){var e=this;Re()(this.templates).forEach(function(t){e.templates[t].sort(function(e,t){return Te()(e.id,10)<Te()(t.id,10)?1:-1})})}},{key:"selectInitialTab",value:function(){var e,t=this,a="standard";W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"get",data:{id:this.props.match.params.id}}).done(function(t){e=t.data.type,ye.a.findWhere(Ue,{name:t.data.type})?a=t.data.type:"automatic"===t.data.type&&ye.a.findWhere(Ue,{name:t.data.options.group})&&(a=t.data.options.group)}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})}).always(function(){t.setState({templates:t.templates,emailType:e,selectedTab:a,loading:!1})})}},{key:"afterTemplateDelete",value:function(e,t){var a=this;e&&Re()(this.templates).forEach(function(e){a.templates[e]=a.templates[e].filter(function(e){return e.id!==t})}),this.setState({templates:this.templates,loading:!1})}},{key:"afterTemplateSelect",value:function(e,t){e?window.location=function(e){return"admin.php?page=mailpoet-newsletter-editor&id=".concat(e)}(t):this.setState({loading:!1})}},{key:"afterTemplateImport",value:function(e,t){e&&this.addTemplate(t),this.setState({templates:this.templates,selectedTab:e?"saved":"import",loading:!1})}},{key:"render",value:function(){var e=this;if(this.state.loading)return r.a.createElement(Ae,null);var t=Ue.concat({name:"import",label:W.a.I18n.t("tabImportTitle")}),a=null;if("import"===this.state.selectedTab)a=r.a.createElement(ze,{beforeImport:function(){return e.setState({loading:!0})},afterImport:this.afterTemplateImport});else{var n=this.state.templates[this.state.selectedTab]||[];n=0===n.length?this.state.loading?null:r.a.createElement("p",null,W.a.I18n.t("noTemplates")):n.map(function(t,a){return r.a.createElement(Be,xe()({key:t.id,index:a,newsletterId:e.props.match.params.id,beforeDelete:function(){return e.setState({loading:!0})},afterDelete:e.afterTemplateDelete,beforeSelect:function(){return e.setState({loading:!0})},afterSelect:e.afterTemplateSelect},t))}),a=r.a.createElement("ul",{className:"mailpoet_boxes clearfix"},n)}var i=ve.a.applyFilters("mailpoet_newsletters_template_breadcrumb",r.a.createElement(Ee.a,{step:"template"}),this.state.emailType,"template");return r.a.createElement("div",null,r.a.createElement("h1",null,W.a.I18n.t("selectTemplateTitle")),i,r.a.createElement(je,{tabs:t,selected:this.state.selectedTab,select:function(t){return e.setState({selectedTab:t})}}),a)}}]),t}(r.a.Component);Ye.propTypes={match:u.a.shape({params:u.a.shape({id:u.a.string}).isRequired}).isRequired};var Ke=Ye,Ge=a(51),Je=a.n(Ge),Qe=a(89),Xe=a.n(Qe),Ze=a(45),et=a.n(Ze),tt=a(58),at=a.n(tt),nt={closeText:W.a.I18n.t("close"),currentText:W.a.I18n.t("today"),nextText:W.a.I18n.t("next"),prevText:W.a.I18n.t("previous"),monthNames:[W.a.I18n.t("january"),W.a.I18n.t("february"),W.a.I18n.t("march"),W.a.I18n.t("april"),W.a.I18n.t("may"),W.a.I18n.t("june"),W.a.I18n.t("july"),W.a.I18n.t("august"),W.a.I18n.t("september"),W.a.I18n.t("october"),W.a.I18n.t("november"),W.a.I18n.t("december")],monthNamesShort:[W.a.I18n.t("januaryShort"),W.a.I18n.t("februaryShort"),W.a.I18n.t("marchShort"),W.a.I18n.t("aprilShort"),W.a.I18n.t("mayShort"),W.a.I18n.t("juneShort"),W.a.I18n.t("julyShort"),W.a.I18n.t("augustShort"),W.a.I18n.t("septemberShort"),W.a.I18n.t("octoberShort"),W.a.I18n.t("novemberShort"),W.a.I18n.t("decemberShort")],dayNames:[W.a.I18n.t("sunday"),W.a.I18n.t("monday"),W.a.I18n.t("tuesday"),W.a.I18n.t("wednesday"),W.a.I18n.t("thursday"),W.a.I18n.t("friday"),W.a.I18n.t("saturday")],dayNamesShort:[W.a.I18n.t("sundayShort"),W.a.I18n.t("mondayShort"),W.a.I18n.t("tuesdayShort"),W.a.I18n.t("wednesdayShort"),W.a.I18n.t("thursdayShort"),W.a.I18n.t("fridayShort"),W.a.I18n.t("saturdayShort")],dayNamesMin:[W.a.I18n.t("sundayMin"),W.a.I18n.t("mondayMin"),W.a.I18n.t("tuesdayMin"),W.a.I18n.t("wednesdayMin"),W.a.I18n.t("thursdayMin"),W.a.I18n.t("fridayMin"),W.a.I18n.t("saturdayMin")]},rt=function(e){function t(e){var a;return C()(this,t),a=A()(this,j()(t).call(this,e)),B()(q()(q()(a)),"onChange",function(e){var t=e,n=t.target.value,r=a.getStorageDate(n);t.target.value=r,a.props.onChange(t)}),B()(q()(q()(a)),"getFieldName",function(){return a.props.name||"date"}),B()(q()(q()(a)),"getDisplayDate",function(e){var t={parseFormat:a.props.storageFormat,format:a.props.displayFormat};return W.a.Date.format(e,t)}),B()(q()(q()(a)),"getStorageDate",function(e){var t={parseFormat:a.props.displayFormat,format:a.props.storageFormat};return W.a.Date.format(e,t)}),a.dateInput=r.a.createRef(),a}return O()(t,e),P()(t,[{key:"componentDidMount",value:function(){var e=V()(this.dateInput.current),t=this;e.datepicker&&(V.a.datepicker.parseDate=function(e,t){return W.a.Date.toDate(t,{parseFormat:this.props.displayFormat,format:e})},V.a.datepicker.formatDate=function(e,t){return W.a.Date.format(t,{format:e})},e.datepicker(ye.a.extend({dateFormat:this.props.displayFormat,isRTL:!1,onSelect:function(e){t.onChange({target:{name:t.getFieldName(),value:e}})}},nt)),this.datepickerInitialized=!0)}},{key:"componentWillUnmount",value:function(){this.datepickerInitialized&&V()(this.dateInput.current).datepicker("destroy")}},{key:"render",value:function(){return r.a.createElement("input",xe()({type:"text",size:"30",name:this.getFieldName(),value:this.getDisplayDate(this.props.value),readOnly:!0,disabled:this.props.disabled,onChange:this.onChange,ref:this.dateInput},this.props.validation))}}]),t}(r.a.Component);rt.propTypes={displayFormat:u.a.string.isRequired,onChange:u.a.func.isRequired,name:u.a.string,storageFormat:u.a.string.isRequired,value:u.a.string.isRequired,disabled:u.a.bool.isRequired,validation:u.a.object.isRequired},rt.defaultProps={name:"date"};var it=rt,st=function(e){function t(){return C()(this,t),A()(this,j()(t).apply(this,arguments))}return O()(t,e),P()(t,[{key:"render",value:function(){var e=this,t=Re()(this.props.timeOfDayItems).map(function(t){return r.a.createElement("option",{key:"option-".concat(e.props.timeOfDayItems[t]),value:t},e.props.timeOfDayItems[t])});return r.a.createElement("select",xe()({name:this.props.name||"time",value:this.props.value,disabled:this.props.disabled,onChange:this.props.onChange},this.props.validation),t)}}]),t}(r.a.Component);st.propTypes={timeOfDayItems:u.a.objectOf(u.a.string).isRequired,name:u.a.string,value:u.a.string.isRequired,disabled:u.a.bool,onChange:u.a.func.isRequired,validation:u.a.object},st.defaultProps={name:"time",disabled:!1,validation:{}};var ot=st,lt=function(e){function t(e){var a;return C()(this,t),a=A()(this,j()(t).call(this,e)),B()(q()(q()(a)),"DATE_TIME_SEPARATOR"," "),B()(q()(q()(a)),"getDateTime",function(){return[a.state.date,a.state.time].join(a.DATE_TIME_SEPARATOR)}),B()(q()(q()(a)),"buildStateFromProps",function(e){var t=(e.value||a.props.defaultDateTime).split(a.DATE_TIME_SEPARATOR),n=at()(t,2);return{date:n[0],time:n[1]}}),B()(q()(q()(a)),"handleChange",function(e){var t={};t[e.target.name]=e.target.value,a.setState(t,a.propagateChange)}),B()(q()(q()(a)),"propagateChange",function(){a.props.onChange&&a.props.onChange({target:{name:a.props.name||"",value:a.getDateTime()}})}),a.state=a.buildStateFromProps(e),a}return O()(t,e),P()(t,[{key:"componentWillReceiveProps",value:function(e){this.setState(this.buildStateFromProps(e))}},{key:"render",value:function(){return r.a.createElement("span",null,r.a.createElement(it,{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}),r.a.createElement(ot,{name:"time",value:this.state.time,onChange:this.handleChange,disabled:this.props.disabled,validation:this.props.timeValidation,timeOfDayItems:this.props.timeOfDayItems}))}}]),t}(r.a.Component);lt.propTypes={defaultDateTime:u.a.string.isRequired,dateDisplayFormat:u.a.string.isRequired,dateStorageFormat:u.a.string.isRequired,onChange:u.a.func,name:u.a.string,disabled:u.a.bool,dateValidation:u.a.object.isRequired,timeValidation:u.a.any,timeOfDayItems:u.a.objectOf(u.a.string).isRequired},lt.defaultProps={onChange:void 0,name:"",disabled:!1,timeValidation:void 0};var ct=lt,ut=a(97),pt=a.n(ut),dt=a(5),mt=a.n(dt),ht=a(27),ft=a.n(ht),gt=window.location.hostname.replace("www.",""),_t="contact@".concat(gt),vt=function(e){var t=e.emailAddress;return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",{className:"sender_email_address_warning","data-acceptance-id":"freemail-sender-warning-new-installation"},ft()(W.a.I18n.t("senderEmailAddressNewInstallWarning1"),"%originalSender",function(){return r.a.createElement("em",{key:"reply-to"},t)})),r.a.createElement("p",{className:"sender_email_address_warning"},ft()(W.a.I18n.t("senderEmailAddressNewInstallWarning2"),/(%suggested|%originalSender)/,function(e){return"%suggested"===e?r.a.createElement("em",{key:"suggested-email"},_t):r.a.createElement("em",{key:"sender-email"},t)})),r.a.createElement("p",{className:"sender_email_address_warning"},W.a.I18n.t("senderEmailAddressNewInstallWarning3")," ",r.a.createElement("a",{href:"https://account.mailpoet.com/authorization",target:"_blank",rel:"noopener noreferrer"},W.a.I18n.t("senderEmailAddressNewInstallWarning4"))),r.a.createElement("p",{className:"sender_email_address_warning"},r.a.createElement("a",{href:"https://kb.mailpoet.com/article/263-how-to-add-an-authorized-email-address",target:"_blank",rel:"noopener noreferrer"},W.a.I18n.t("senderEmailAddressWarning3"))))};vt.propTypes={emailAddress:u.a.string.isRequired};var bt=function(e){var t=e.emailAddress;return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",{className:"sender_email_address_warning","data-acceptance-id":"freemail-sender-warning-old-installation"},W.a.I18n.t("senderEmailAddressWarning1")),r.a.createElement("p",{className:"sender_email_address_warning"},ft()(W.a.I18n.t("senderEmailAddressWarning2"),/(%suggested|%originalSender|<em>.*<\/em>)/,function(e){return"%suggested"===e?_t:"%originalSender"===e?r.a.createElement("em",{key:"sender-email"},t):r.a.createElement("em",{key:"reply-to"},e.replace(/<\/?em>/g,""))})),r.a.createElement("p",{className:"sender_email_address_warning"},r.a.createElement("a",{href:"https://kb.mailpoet.com/article/259-your-from-address-cannot-be-yahoo-com-gmail-com-outlook-com",target:"_blank",rel:"noopener noreferrer"},W.a.I18n.t("senderEmailAddressWarning3"))))};bt.propTypes={emailAddress:u.a.string.isRequired};var yt=function(e){var t=e.emailAddress,a=e.mssActive,n=e.pluginInstalledAt,i=t.split("@").pop().toLowerCase();return window.mailpoet_free_domains.indexOf(i)>-1?a&&mt()(n).isAfter("2019-03-05")?r.a.createElement(vt,{emailAddress:t}):r.a.createElement(bt,{emailAddress:t}):null};yt.propTypes={emailAddress:u.a.string.isRequired,mssActive:u.a.bool.isRequired,pluginInstalledAt:u.a.string.isRequired};var wt=yt,Et=function(e){function t(e){var a;return C()(this,t),(a=A()(this,j()(t).call(this,e))).state={emailAddress:e.item.sender_address},a.onChange=a.onChange.bind(q()(q()(a))),a}return O()(t,e),P()(t,[{key:"onChange",value:function(e){this.setState({emailAddress:e.target.value}),this.props.onValueChange(e)}},{key:"render",value:function(){return r.a.createElement(r.a.Fragment,null,r.a.createElement(pt.a,xe()({},this.props,{onValueChange:this.onChange})),r.a.createElement("div",{className:"regular-text"},r.a.createElement(wt,{emailAddress:this.state.emailAddress,mssActive:window.mailpoet_mss_active,pluginInstalledAt:window.mailpoet_installed_at})))}}]),t}(r.a.Component);Et.propTypes={item:u.a.shape({sender_address:u.a.string.isRequired}).isRequired,onValueChange:u.a.func},Et.defaultProps={onValueChange:function(){}};var kt=Et,It=window.mailpoet_current_time||"00:00",St="".concat(window.mailpoet_current_date," 00:00:00"),Nt=window.mailpoet_schedule_time_of_day,xt=window.mailpoet_date_display_format,Ct=window.mailpoet_date_storage_format,Tt=function(e){function t(){var e,a;C()(this,t);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return a=A()(this,(e=j()(t)).call.apply(e,[this].concat(r))),B()(q()(q()(a)),"getCurrentValue",function(){var e={isScheduled:"0",scheduledAt:St};return ye.a.defaults(a.props.item[a.props.field.name]||{},e)}),B()(q()(q()(a)),"getDateValidation",function(){return{"data-parsley-required":!0,"data-parsley-required-message":W.a.I18n.t("noScheduledDateError"),"data-parsley-errors-container":"#mailpoet_scheduling"}}),B()(q()(q()(a)),"isScheduled",function(){return"1"===a.getCurrentValue().isScheduled}),B()(q()(q()(a)),"handleCheckboxChange",function(e){var t=e;return t.target.value=e.target.checked?"1":"0",a.handleValueChange(t)}),B()(q()(q()(a)),"handleValueChange",function(e){var t=a.getCurrentValue(),n={};return n[e.target.name]=e.target.value,a.props.onValueChange({target:{name:a.props.field.name,value:ye.a.extend({},t,n)}})}),a}return O()(t,e),P()(t,[{key:"render",value:function(){var e;return this.isScheduled()&&(e=r.a.createElement("span",{id:"mailpoet_scheduling"},r.a.createElement(ct,{name:"scheduledAt",value:this.getCurrentValue().scheduledAt,onChange:this.handleValueChange,disabled:this.props.field.disabled,dateValidation:this.getDateValidation(),defaultDateTime:St,timeOfDayItems:Nt,dateDisplayFormat:xt,dateStorageFormat:Ct})," ",r.a.createElement("span",null,W.a.I18n.t("websiteTimeIs")," ",r.a.createElement("code",null,It)))),r.a.createElement("div",null,r.a.createElement("input",{type:"checkbox",value:"1",checked:this.isScheduled(),disabled:this.props.field.disabled,name:"isScheduled",onChange:this.handleCheckboxChange}),e)}}]),t}(r.a.Component);Tt.propTypes={item:u.a.object,field:u.a.shape({name:u.a.string.isRequired,disabled:u.a.bool}).isRequired,onValueChange:u.a.func.isRequired},Tt.defaultProps={item:{}};var Pt=[{name:"subject",label:W.a.I18n.t("subjectLine"),tip:W.a.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":W.a.I18n.t("emptySubjectLineError")}},{name:"segments",label:W.a.I18n.t("segments"),tip:W.a.I18n.t("segmentsTip"),type:"selection",placeholder:W.a.I18n.t("selectSegmentPlaceholder"),id:"mailpoet_segments",api_version:window.mailpoet_api_version,endpoint:"segments",multiple:!0,filter:function(e){return!e.deleted_at},getLabel:function(e){return"".concat(e.name," (").concat(Te()(e.subscribers,10).toLocaleString(),")")},transformChangedValue:function(e){var t=this.getItems();return ye.a.map(e,function(e){return ye.a.find(t,function(t){return t.id===e})})},validation:{"data-parsley-required":!0,"data-parsley-required-message":W.a.I18n.t("noSegmentsSelectedError")}},{name:"sender",label:W.a.I18n.t("sender"),tip:W.a.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:W.a.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:kt,placeholder:W.a.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},{name:"reply-to",label:W.a.I18n.t("replyTo"),tip:W.a.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:W.a.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:W.a.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]},{name:"options",label:W.a.I18n.t("scheduleIt"),type:"reactComponent",component:Tt}];Pt=ve.a.applyFilters("mailpoet_newsletters_3rd_step_fields",Pt);var Rt={getFields:function(){return Pt},getSendButtonOptions:function(e){var t=e||{},a={value:"object"===et()(t.options)&&"1"===t.options.isScheduled?W.a.I18n.t("schedule"):W.a.I18n.t("send")};return"sent"!==t.status&&"sending"!==t.status||(a.disabled="disabled"),a}},At=a(49),Dt=a(43),jt={name:"intervalType",values:Dt.intervalValues},Lt={name:"timeOfDay",values:Dt.timeOfDayValues},Ot={name:"weekDay",values:Dt.weekDayValues},Mt={name:"monthDay",values:Dt.monthDayValues},qt={name:"nthWeekDay",values:Dt.nthWeekDayValues},Ft=function(e){function t(){var e,a;C()(this,t);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return a=A()(this,(e=j()(t)).call.apply(e,[this].concat(r))),B()(q()(q()(a)),"getCurrentValue",function(){return a.props.item[a.props.field.name]||{}}),B()(q()(q()(a)),"handleValueChanges",function(e){var t=a.getCurrentValue();return a.props.onValueChange({target:{name:a.props.field.name,value:ye.a.extend({},t,e)}})}),B()(q()(q()(a)),"handleIntervalChange",function(e){var t=e.target.value,n={};n.intervalType=t,"monthly"===t&&(n.monthDay="1"),a.handleValueChanges(n)}),B()(q()(q()(a)),"handleTimeOfDayChange",function(e){return a.handleValueChanges({timeOfDay:e.target.value})}),B()(q()(q()(a)),"handleWeekDayChange",function(e){return a.handleValueChanges({weekDay:e.target.value})}),B()(q()(q()(a)),"handleMonthDayChange",function(e){return a.handleValueChanges({monthDay:e.target.value})}),B()(q()(q()(a)),"handleNthWeekDayChange",function(e){return a.handleValueChanges({nthWeekDay:e.target.value})}),a}return O()(t,e),P()(t,[{key:"render",value:function(){var e,t,a,n,i=this.getCurrentValue();return"immediately"!==i.intervalType&&(e=r.a.createElement(At.a,{field:Lt,item:this.getCurrentValue(),onValueChange:this.handleTimeOfDayChange})),"weekly"!==i.intervalType&&"nthWeekDay"!==i.intervalType||(t=r.a.createElement(At.a,{field:Ot,item:this.getCurrentValue(),onValueChange:this.handleWeekDayChange})),"monthly"===i.intervalType&&(a=r.a.createElement(At.a,{field:Mt,item:this.getCurrentValue(),onValueChange:this.handleMonthDayChange})),"nthWeekDay"===i.intervalType&&(n=r.a.createElement(At.a,{field:qt,item:this.getCurrentValue(),onValueChange:this.handleNthWeekDayChange})),r.a.createElement("div",null,r.a.createElement(At.a,{field:jt,item:this.getCurrentValue(),onValueChange:this.handleIntervalChange,automationId:"newsletter_interval_type"}),n,a,t,e)}}]),t}(r.a.Component);Ft.propTypes={item:u.a.object.isRequired,field:u.a.shape({name:u.a.string}).isRequired,onValueChange:u.a.func.isRequired};var Bt=Ft,$t=[{name:"subject",label:W.a.I18n.t("subjectLine"),tip:W.a.I18n.t("postNotificationSubjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":W.a.I18n.t("emptySubjectLineError")}},{name:"options",label:W.a.I18n.t("selectFrequency"),type:"reactComponent",component:Bt},{name:"segments",label:W.a.I18n.t("segments"),tip:W.a.I18n.t("segmentsTip"),type:"selection",placeholder:W.a.I18n.t("selectSegmentPlaceholder"),id:"mailpoet_segments",api_version:window.mailpoet_api_version,endpoint:"segments",multiple:!0,filter:function(e){return!e.deleted_at},getLabel:function(e){return"".concat(e.name," (").concat(Te()(e.subscribers,10).toLocaleString(),")")},transformChangedValue:function(e){var t=this.getItems();return ye.a.map(e,function(e){return ye.a.find(t,function(t){return t.id===e})})},validation:{"data-parsley-required":!0,"data-parsley-required-message":W.a.I18n.t("noSegmentsSelectedError")}},{name:"sender",label:W.a.I18n.t("sender"),tip:W.a.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:W.a.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:kt,placeholder:W.a.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},{name:"reply-to",label:W.a.I18n.t("replyTo"),tip:W.a.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:W.a.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:W.a.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]}];$t=ve.a.applyFilters("mailpoet_newsletters_3rd_step_fields",$t);var Ht={getFields:function(){return $t},getSendButtonOptions:function(){return{value:W.a.I18n.t("activate")}}},Vt=a(98),Wt=[{name:"subject",label:W.a.I18n.t("subjectLine"),tip:W.a.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":W.a.I18n.t("emptySubjectLineError")}},{name:"options",label:W.a.I18n.t("sendWelcomeEmailWhen"),type:"reactComponent",component:Vt.default},{name:"sender",label:W.a.I18n.t("sender"),tip:W.a.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:W.a.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:kt,placeholder:W.a.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},{name:"reply-to",label:W.a.I18n.t("replyTo"),tip:W.a.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:W.a.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:W.a.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]}];Wt=ve.a.applyFilters("mailpoet_newsletters_3rd_step_fields",Wt);var zt={getFields:function(){return Wt},getSendButtonOptions:function(){return{value:W.a.I18n.t("activate")}}},Ut=a(248),Yt=Je()({displayName:"NewsletterSend",propTypes:{match:u.a.shape({params:u.a.shape({id:u.a.string}).isRequired}).isRequired,history:u.a.shape({push:u.a.func.isRequired}).isRequired},getInitialState:function(){return{fields:[],item:{},loading:!0,thumbnailPromise:null}},componentDidMount:function(){this.loadItem(this.props.match.params.id),V()("#mailpoet_newsletter").parsley()},componentWillReceiveProps:function(e){this.loadItem(e.match.params.id)},getFieldsByNewsletter:function(e){return this.getSubtype(e).getFields(e)},getSendButtonOptions:function(){return this.getSubtype(this.state.item).getSendButtonOptions(this.state.item)},getSubtype:function(e){switch(e.type){case"notification":return Ht;case"welcome":return zt;default:return ve.a.applyFilters("mailpoet_newsletters_send_newsletter_fields",Rt,e)}},getThumbnailPromise:function(e){return this.state.thumbnailPromise?this.state.thumbnailPromise:Object(Ut.b)(e)},isValid:function(){return V()("#mailpoet_newsletter").parsley().isValid()},loadItem:function(e){var t=this;this.setState({loading:!0}),W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"get",data:{id:e}}).done(function(e){var a="draft"===e.data.status?t.getThumbnailPromise(e.meta.preview_url):null;t.setState({loading:!1,item:e.data,fields:t.getFieldsByNewsletter(e.data),thumbnailPromise:a})}).fail(function(){t.setState({loading:!1,item:{}},function(){t.props.history.push("/new")})})},saveTemplate:function(e,t){var a=this;this.getThumbnailPromise(e.meta.preview_url).then(function(n){W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"save",data:{newsletter_id:e.data.id,name:e.data.subject,thumbnail:n,body:He()(e.data.body),categories:'["recent"]'}}).fail(function(e){a.showError(e),a.setState({loading:!1}),W.a.Modal.loading(!1)}),t()}).catch(function(e){a.showError({errors:[e]})})},handleSend:function(e){var t=this;return e.preventDefault(),this.isValid()?(W.a.Modal.loading(!0),this.saveNewsletter(e).done(function(){t.setState({loading:!0})}).done(function(e){switch(e.data.type){case"notification":case"welcome":return t.activateNewsletter(e);default:return t.sendNewsletter(e)}}).fail(function(e){t.showError(e),t.setState({loading:!1}),W.a.Modal.loading(!1)})):V()("#mailpoet_newsletter").parsley().validate()},sendNewsletter:function(e){var t=this;return W.a.Ajax.post(ve.a.applyFilters("mailpoet_newsletters_send_server_request_parameters",{api_version:window.mailpoet_api_version,endpoint:"sendingQueue",action:"add",data:{newsletter_id:this.state.item.id}},this.state.item)).done(function(a){t.saveTemplate(e,function(){if(window.mailpoet_show_congratulate_after_first_newsletter)return W.a.Modal.loading(!1),void t.props.history.push("/send/congratulate/".concat(t.state.item.id));t.props.history.push(ve.a.applyFilters("mailpoet_newsletters_send_server_request_response_redirect","/".concat(t.state.item.type||""),t.state.item));var e=ve.a.applyFilters("mailpoet_newsletters_send_server_request_response",t.state.item,a);ye.a.isFunction(e)?e():"scheduled"===a.data.status?(W.a.Notice.success(W.a.I18n.t("newsletterHasBeenScheduled")),W.a.trackEvent("Emails > Newsletter sent",{scheduled:!0,"MailPoet Free version":window.mailpoet_version})):(W.a.Notice.success(W.a.I18n.t("newsletterBeingSent"),{id:"mailpoet_notice_being_sent"}),W.a.trackEvent("Emails > Newsletter sent",{scheduled:!1,"MailPoet Free version":window.mailpoet_version})),W.a.Modal.loading(!1)})}).fail(function(e){t.showError(e),t.setState({loading:!1}),W.a.Modal.loading(!1)})},activateNewsletter:function(e){var t=this;return W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"setStatus",data:{id:this.props.match.params.id,status:"active"}}).done(function(a){t.saveTemplate(e,function(){if(window.mailpoet_show_congratulate_after_first_newsletter)return W.a.Modal.loading(!1),void t.props.history.push("/send/congratulate/".concat(t.state.item.id));t.props.history.push("/".concat(t.state.item.type||""));var e=t.state.item.options;"welcome"===a.data.type?(W.a.Notice.success(W.a.I18n.t("welcomeEmailActivated")),W.a.trackEvent("Emails > Welcome email activated",{"MailPoet Free version":window.mailpoet_version,"List type":e.event,Delay:"".concat(e.afterTimeNumber," ").concat(e.afterTimeType)})):"notification"===a.data.type&&(W.a.Notice.success(W.a.I18n.t("postNotificationActivated")),W.a.trackEvent("Emails > Post notifications activated",{"MailPoet Free version":window.mailpoet_version,Frequency:e.intervalType})),W.a.Modal.loading(!1)})}).fail(function(e){t.showError(e),t.setState({loading:!1}),W.a.Modal.loading(!1)})},handleResume:function(e){var t=this;return e.preventDefault(),this.isValid()?this.saveNewsletter(e).done(function(){t.setState({loading:!0})}).done(function(){W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sendingQueue",action:"resume",data:{newsletter_id:t.state.item.id}}).done(function(){t.props.history.push("/".concat(t.state.item.type||"")),W.a.Notice.success(W.a.I18n.t("newsletterSendingHasBeenResumed"))}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})})}).fail(function(e){t.showError(e)}).always(function(){t.setState({loading:!1})}):V()("#mailpoet_newsletter").parsley().validate(),!1},handleSave:function(e){var t=this;e.preventDefault(),this.saveNewsletter(e).done(function(){W.a.Notice.success(W.a.I18n.t("newsletterUpdated"))}).done(function(){var e="automatic"===t.state.item.type?t.state.item.options.group:t.state.item.type;t.props.history.push("/".concat(e||""))}).fail(function(e){t.showError(e)})},handleRedirectToDesign:function(e){var t=this;e.preventDefault();var a=e.target.href;this.saveNewsletter(e).done(function(){W.a.Notice.success(W.a.I18n.t("newsletterUpdated"))}).done(function(){window.location=a}).fail(function(e){t.showError(e)})},saveNewsletter:function(){var e=this.state.item;e.queue=void 0,this.setState({loading:!0});var t=ye.a.omit(e,["preheader","body","created_at","deleted_at","hash","status","updated_at","type"]);return W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"save",data:t})},showError:function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})},handleFormChange:function(e){var t=e.target.name,a=e.target.value;return this.setState(function(e){var n=e.item;return n[t]=a,{item:n}}),!0},render:function(){var e="sending"===this.state.item.status&&this.state.item.queue&&"paused"===this.state.item.queue.status,t=this.state.fields.map(function(t){var a=t;return"segments"!==t.name&&"options"!==t.name||(a.disabled=e),a}),a=this.getSendButtonOptions(),n=ve.a.applyFilters("mailpoet_newsletters_send_breadcrumb",r.a.createElement(Ee.a,{step:"send"}),this.state.item.type,"send");return r.a.createElement("div",null,r.a.createElement("h1",null,W.a.I18n.t("finalNewsletterStep")),n,r.a.createElement(Xe.a,{id:"mailpoet_newsletter",fields:t,automationId:"newsletter_send_form",item:this.state.item,loading:this.state.loading,onChange:this.handleFormChange,onSubmit:this.handleSave},r.a.createElement("p",{className:"submit"},e?r.a.createElement("input",{className:"button button-primary",type:"button",onClick:this.handleResume,value:W.a.I18n.t("resume")}):r.a.createElement("input",xe()({className:"button button-primary",type:"button",onClick:this.handleSend,value:W.a.I18n.t("send")},a))," ",r.a.createElement("input",{className:"button button-secondary",type:"submit",value:W.a.I18n.t("saveDraftAndClose")})," ",W.a.I18n.t("orSimply")," ",r.a.createElement("a",{href:"?page=mailpoet-newsletter-editor&id=".concat(this.props.match.params.id),onClick:this.handleRedirectToDesign},W.a.I18n.t("goBackToDesign")),"."),!e&&a.disabled&&"disabled"===a.disabled&&r.a.createElement(Ve.a,{tooltip:W.a.I18n.t("helpTooltipSendEmail"),tooltipId:"helpTooltipSendEmail"})))}}),Kt=Object(ke.a)(Yt);function Gt(e){var t,a="standard"===e.newsletter.type&&"scheduled"!==e.newsletter.status;return a&&W.a.Poll.successDelivery.initTypeformScript(),r.a.createElement("div",{className:"mailpoet_congratulate_success"},r.a.createElement("h1",null,"welcome"===(t=e.newsletter).type?W.a.I18n.t("congratulationsWelcomeEmailSuccessHeader"):"notification"===t.type?W.a.I18n.t("congratulationsPostNotificationSuccessHeader"):"automatic"===t.type?W.a.I18n.t("congratulationsWooSuccessHeader"):"scheduled"===t.status?W.a.I18n.t("congratulationsScheduleSuccessHeader"):W.a.I18n.t("congratulationsSendSuccessHeader")),r.a.createElement("img",{src:e.illustrationImageUrl,alt:"",width:"750",height:"250"}),a&&r.a.createElement("div",{className:"typeform-widget","data-url":"https://mailpoet.typeform.com/to/ciWID6","data-transparency":"100","data-hide-headers":"true","data-hide-footer":"true"}),r.a.createElement("button",{type:"button",className:"button",onClick:e.successClicked},W.a.I18n.t("close")))}Gt.propTypes={successClicked:u.a.func.isRequired,illustrationImageUrl:u.a.string.isRequired,newsletter:u.a.shape({status:u.a.string.isRequired,type:u.a.string.isRequired}).isRequired};var Jt=Gt;function Qt(e){return r.a.createElement("div",{className:"mailpoet_centered"},r.a.createElement("h1",null,W.a.I18n.t("congratulationsSendFailHeader")),r.a.createElement("p",null,ft()(W.a.I18n.t("congratulationsSendFailExplain"),/\[link\](.*?)\[\/link\]/g,function(e,t){return r.a.createElement("a",{key:t,target:"_blank",rel:"noopener noreferrer",href:"https://kb.mailpoet.com/article/231-sending-does-not-work"},e)})),r.a.createElement("button",{type:"button",className:"button",onClick:e.failClicked},W.a.I18n.t("close")))}Qt.propTypes={failClicked:u.a.func.isRequired};var Xt=Qt;var Zt=function(){return r.a.createElement("div",{className:"mailpoet_loading"},r.a.createElement("div",{className:"mailpoet_modal_loading mailpoet_modal_loading_1"}),r.a.createElement("div",{className:"mailpoet_modal_loading mailpoet_modal_loading_2"}),r.a.createElement("div",{className:"mailpoet_modal_loading mailpoet_modal_loading_3"}))};function ea(e){return r.a.createElement("div",{className:"mailpoet_newsletter_loading"},r.a.createElement(Zt,null),(t=e.showRichLoadingScreen,a=e.illustrationImageUrl,t?r.a.createElement("div",null,r.a.createElement("h1",{className:"mailpoet_newsletter_loading_header"},W.a.I18n.t("congratulationsLoadingHeader")),r.a.createElement("img",{src:a,alt:"",width:"800px",height:"266px"})):r.a.createElement("div",null)));var t,a}ea.propTypes={illustrationImageUrl:u.a.string.isRequired,showRichLoadingScreen:u.a.bool.isRequired};var ta=ea;function aa(){return W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"settings",action:"set",data:{show_congratulate_after_first_newsletter:!1}}).always(function(){window.location=window.mailpoet_main_page})}var na=function(e){function t(e){var a;return C()(this,t),(a=A()(this,j()(t).call(this,e))).state={loading:!0,newsletter:null,testingPassed:!1,timeStart:mt()(),minimumLoadingTimePassed:!1},a.tick=a.tick.bind(q()(q()(a))),a}return O()(t,e),P()(t,[{key:"componentDidMount",value:function(){this.loadNewsletter(this.props.match.params.id),this.tick()}},{key:"componentWillReceiveProps",value:function(e){this.loadNewsletter(e.match.params.id)}},{key:"tick",value:function(){mt()().subtract(20,"second").isAfter(this.state.timeStart)&&this.setState({error:!0,loading:!1}),this.state.loading&&this.loadNewsletter(this.props.match.params.id),mt()().subtract(6,"seconds").isAfter(this.state.timeStart)&&this.setState({minimumLoadingTimePassed:!0}),!this.state.loading&&this.state.minimumLoadingTimePassed||setTimeout(this.tick,2e3)}},{key:"loadNewsletter",value:function(e){var t=this;W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"get",data:{id:e}}).done(function(e){return t.newsletterLoaded(e.data)})}},{key:"newsletterLoaded",value:function(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})}},{key:"renderContent",value:function(){return this.state.loading||!this.state.minimumLoadingTimePassed?(e=!!this.state.newsletter,r.a.createElement(ta,{illustrationImageUrl:window.mailpoet_congratulations_loading_image,successClicked:aa,showRichLoadingScreen:e})):this.state.error?(W.a.trackEvent("Cron testing done",{"Cron is working":"false"}),r.a.createElement(Xt,{failClicked:function(){window.location=window.mailpoet_main_page}})):(t=this.state.newsletter,this.state.testingPassed&&W.a.trackEvent("Cron testing done",{"Cron is working":"true"}),r.a.createElement(Jt,{illustrationImageUrl:window.mailpoet_congratulations_success_image,successClicked:aa,newsletter:t}));var e,t}},{key:"render",value:function(){return r.a.createElement("div",{className:"newsletter_congratulate_page"},this.renderContent())}}]),t}(r.a.Component);na.propTypes={match:u.a.shape({params:u.a.shape({id:u.a.string}).isRequired}).isRequired};var ra=na,ia=function(e){function t(){var e,a;C()(this,t);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return a=A()(this,(e=j()(t)).call.apply(e,[this].concat(r))),B()(q()(q()(a)),"showTemplateSelection",function(e){a.props.history.push("/template/".concat(e))}),a}return O()(t,e),P()(t,[{key:"componentDidMount",value:function(){var e=this;W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:{type:"standard"}}).done(function(t){e.showTemplateSelection(t.data.id)}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})})}},{key:"render",value:function(){return r.a.createElement("div",null,r.a.createElement("h1",null,W.a.I18n.t("regularNewsletterTypeTitle")),r.a.createElement(Ee.a,{step:"type"}))}}]),t}(r.a.Component);B()(ia,"propTypes",{history:u.a.shape({push:u.a.func.isRequired}).isRequired});var sa=Object(ke.a)(ia),oa={name:"options",type:"reactComponent",component:Bt},la=function(e){function t(){var e,a;C()(this,t);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return a=A()(this,(e=j()(t)).call.apply(e,[this].concat(r))),B()(q()(q()(a)),"state",{options:{intervalType:"daily",timeOfDay:0,weekDay:1,monthDay:0,nthWeekDay:1}}),B()(q()(q()(a)),"handleValueChange",function(e){var t=a.state;t[e.target.name]=e.target.value,a.setState(t)}),B()(q()(q()(a)),"handleNext",function(){W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:ye.a.extend({},a.state,{type:"notification",subject:W.a.I18n.t("draftPostNotificationTitle")})}).done(function(e){a.showTemplateSelection(e.data.id)}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})})}),B()(q()(q()(a)),"showTemplateSelection",function(e){a.props.history.push("/template/".concat(e))}),a}return O()(t,e),P()(t,[{key:"render",value:function(){return r.a.createElement("div",null,r.a.createElement("h1",null,W.a.I18n.t("postNotificationNewsletterTypeTitle")),r.a.createElement(Ee.a,{step:"type"}),r.a.createElement("h3",null,W.a.I18n.t("selectFrequency")),r.a.createElement(Bt,{item:this.state,field:oa,onValueChange:this.handleValueChange}),r.a.createElement("p",{className:"submit"},r.a.createElement("input",{className:"button button-primary",type:"button",onClick:this.handleNext,value:W.a.I18n.t("next")})))}}]),t}(r.a.Component);B()(la,"propTypes",{history:u.a.shape({push:u.a.func.isRequired}).isRequired});var ca=Object(ke.a)(la),ua={name:"options",label:"Event",type:"reactComponent",component:Vt.default},pa=function(e){function t(e){var a;C()(this,t),a=A()(this,j()(t).call(this,e));var n=window.mailpoet_segments||[],r=1;return n=n.filter(function(e){return"default"===e.type}),ye.a.size(n)>0&&(r=ye.a.first(n).id),a.state={options:{event:"segment",segment:r,role:"subscriber",afterTimeNumber:1,afterTimeType:"immediate"}},a.handleValueChange=a.handleValueChange.bind(q()(q()(a))),a.handleNext=a.handleNext.bind(q()(q()(a))),a}return O()(t,e),P()(t,[{key:"handleValueChange",value:function(e){var t=this.state;t[e.target.name]=e.target.value,this.setState(t)}},{key:"handleNext",value:function(){var e=this;W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:ye.a.extend({},this.state,{type:"welcome",subject:W.a.I18n.t("draftNewsletterTitle")})}).done(function(t){e.showTemplateSelection(t.data.id)}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})})}},{key:"showTemplateSelection",value:function(e){this.props.history.push("/template/".concat(e))}},{key:"render",value:function(){return r.a.createElement("div",null,r.a.createElement("h1",null,W.a.I18n.t("welcomeNewsletterTypeTitle")),r.a.createElement(Ee.a,{step:"type"}),r.a.createElement("h3",null,W.a.I18n.t("selectEventToSendWelcomeEmail")),r.a.createElement(Vt.default,{item:this.state,field:ua,onValueChange:this.handleValueChange}),r.a.createElement("p",{className:"submit"},r.a.createElement("input",{className:"button button-primary",type:"button",onClick:this.handleNext,value:W.a.I18n.t("next")})))}}]),t}(r.a.Component);pa.propTypes={history:u.a.shape({push:u.a.func.isRequired}).isRequired};var da=pa,ma=a(371),ha=a.n(ma),fa=a(64),ga=a.n(fa),_a=a(65),va=a.n(_a),ba=a(66),ya=a.n(ba),wa=a(29),Ea=!!window.mailpoet_tracking_enabled,ka={onTrash:function(e){var t=Number(e.meta.count),a=null;a=1===t?W.a.I18n.t("oneNewsletterTrashed"):W.a.I18n.t("multipleNewslettersTrashed").replace("%$1d",t.toLocaleString()),W.a.Notice.success(a)},onDelete:function(e){var t=Number(e.meta.count),a=null;a=1===t?W.a.I18n.t("oneNewsletterDeleted"):W.a.I18n.t("multipleNewslettersDeleted").replace("%$1d",t.toLocaleString()),W.a.Notice.success(a)},onRestore:function(e){var t=Number(e.meta.count),a=null;a=1===t?W.a.I18n.t("oneNewsletterRestored"):W.a.I18n.t("multipleNewslettersRestored").replace("%$1d",t.toLocaleString()),W.a.Notice.success(a)}},Ia=[{name:"subject",label:W.a.I18n.t("subject"),sortable:!0},{name:"status",label:W.a.I18n.t("status")},{name:"segments",label:W.a.I18n.t("lists")},{name:"statistics",label:W.a.I18n.t("statistics"),display:Ea},{name:"sent_at",label:W.a.I18n.t("sentOn"),sortable:!0}],Sa=[{name:"trash",label:W.a.I18n.t("moveToTrash"),onSuccess:ka.onTrash}],Na=function(e){var t=function(){window.location.href="?page=mailpoet-newsletter-editor&id=".concat(e.id)};e.queue&&"sending"===e.status&&null===e.queue.status?qe({message:W.a.I18n.t("confirmEdit"),onConfirm:t}):t()},xa=[{name:"view",link:function(e){return r.a.createElement("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer"},W.a.I18n.t("preview"))}},{name:"edit",label:W.a.I18n.t("edit"),onClick:Na},{name:"duplicate",label:W.a.I18n.t("duplicate"),onClick:function(e,t){return W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done(function(e){W.a.Notice.success(W.a.I18n.t("newsletterDuplicated").replace("%$1s",e.data.subject)),t()}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})})}},{name:"trash"}];ve.a.addFilter("mailpoet_newsletters_listings_standard_actions",wa.StatisticsMixin.addStatsCTAAction),xa=ve.a.applyFilters("mailpoet_newsletters_listings_standard_actions",xa);var Ca=Je()({displayName:"NewsletterListStandard",propTypes:{location:u.a.object.isRequired,match:u.a.shape({params:u.a.object}).isRequired},mixins:[wa.QueueMixin,wa.StatisticsMixin,wa.MailerMixin,wa.CronMixin],renderItem:function(e,t,a){var n=U()("manage-column","column-primary","has-row-actions"),i=e.segments.map(function(e){return e.name}).join(", ");return r.a.createElement("div",null,r.a.createElement("td",{className:n},r.a.createElement("strong",null,r.a.createElement("a",{className:"row-title",href:"javascript:;",onClick:function(){return Na(e)}},e.queue.newsletter_rendered_subject||e.subject)),t),r.a.createElement("td",{className:"column","data-colname":W.a.I18n.t("status")},this.renderQueueStatus(e,a.mta_log)),r.a.createElement("td",{className:"column","data-colname":W.a.I18n.t("lists")},i),!0===Ea?r.a.createElement("td",{className:"column","data-colname":W.a.I18n.t("statistics")},this.renderStatistics(e,void 0,a.current_time)):null,r.a.createElement("td",{className:"column-date","data-colname":W.a.I18n.t("sentOn")},r.a.createElement("abbr",null,e.sent_at?W.a.Date.format(e.sent_at):W.a.I18n.t("notSentYet"))))},render:function(){var e=this;return r.a.createElement("div",null,r.a.createElement(va.a,null),r.a.createElement(ya.a,{hasNews:window.mailpoet_feature_announcement_has_news}),r.a.createElement(ga.a,{tab:"standard"}),r.a.createElement(K.a,{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,columns:Ia,bulk_actions:Sa,item_actions:xa,messages:ka,auto_refresh:!0,sort_by:"sent_at",sort_order:"desc",afterGetItems:function(t){e.checkMailerStatus(t),e.checkCronStatus(t)}}))}}),Ta=window.mailpoet_roles||{},Pa=window.mailpoet_segments||{},Ra=!!window.mailpoet_tracking_enabled,Aa={onTrash:function(e){var t=Number(e.meta.count),a=null;a=1===t?W.a.I18n.t("oneNewsletterTrashed"):W.a.I18n.t("multipleNewslettersTrashed").replace("%$1d",t.toLocaleString()),W.a.Notice.success(a)},onDelete:function(e){var t=Number(e.meta.count),a=null;a=1===t?W.a.I18n.t("oneNewsletterDeleted"):W.a.I18n.t("multipleNewslettersDeleted").replace("%$1d",t.toLocaleString()),W.a.Notice.success(a)},onRestore:function(e){var t=Number(e.meta.count),a=null;a=1===t?W.a.I18n.t("oneNewsletterRestored"):W.a.I18n.t("multipleNewslettersRestored").replace("%$1d",t.toLocaleString()),W.a.Notice.success(a)}},Da=[{name:"subject",label:W.a.I18n.t("subject"),sortable:!0},{name:"status",label:W.a.I18n.t("status"),width:145},{name:"settings",label:W.a.I18n.t("settings")},{name:"statistics",label:W.a.I18n.t("statistics"),display:Ra},{name:"updated_at",label:W.a.I18n.t("lastModifiedOn"),sortable:!0}],ja=[{name:"trash",label:W.a.I18n.t("moveToTrash"),onSuccess:Aa.onTrash}],La=[{name:"view",link:function(e){return r.a.createElement("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer"},W.a.I18n.t("preview"))}},{name:"duplicate",label:W.a.I18n.t("duplicate"),onClick:function(e,t){return W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done(function(e){W.a.Notice.success(W.a.I18n.t("newsletterDuplicated").replace("%$1s",e.data.subject)),t()}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})})}},{name:"edit",link:function(e){return r.a.createElement("a",{href:"?page=mailpoet-newsletter-editor&id=".concat(e.id)},W.a.I18n.t("edit"))}},{name:"trash"}];ve.a.addFilter("mailpoet_newsletters_listings_welcome_notification_actions",wa.StatisticsMixin.addStatsCTAAction),La=ve.a.applyFilters("mailpoet_newsletters_listings_welcome_notification_actions",La);var Oa=Je()({displayName:"NewsletterListWelcome",propTypes:{location:u.a.object.isRequired,match:u.a.shape({params:u.a.object}).isRequired},mixins:[wa.StatisticsMixin,wa.MailerMixin,wa.CronMixin],updateStatus:function(e){var t=this;e.persist(),W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"setStatus",data:{id:Number(e.target.getAttribute("data-id")),status:e.target.value}}).done(function(e){"active"===e.data.status&&W.a.Notice.success(W.a.I18n.t("welcomeEmailActivated")),t.forceUpdate()}).fail(function(t){W.a.Notice.error(W.a.I18n.t("welcomeEmailActivationFailed")),e.target.value=t.status})},renderStatus:function(e){var t=W.a.I18n.t("sentToXSubscribers").replace("%$1d",e.total_sent.toLocaleString()),a=W.a.I18n.t("scheduledToXSubscribers").replace("%$1d",e.total_scheduled.toLocaleString());return r.a.createElement("div",null,r.a.createElement("p",null,r.a.createElement("select",{"data-id":e.id,defaultValue:e.status,onChange:this.updateStatus},r.a.createElement("option",{value:"active"},W.a.I18n.t("active")),r.a.createElement("option",{value:"draft"},W.a.I18n.t("inactive")))),r.a.createElement("p",null,t," ",r.a.createElement("br",null),a))},renderSettings:function(e){var t,a,n;switch(e.options.event){case"user":t="mailpoet_all"===e.options.role?W.a.I18n.t("welcomeEventWPUserAnyRole"):W.a.I18n.t("welcomeEventWPUserWithRole").replace("%$1s",Ta[e.options.role]);break;default:if(void 0===(n=ye.a.find(Pa,function(t){return Number(t.id)===Number(e.options.segment)})))return r.a.createElement("span",{className:"mailpoet_error"},W.a.I18n.t("sendingToSegmentsNotSpecified"));t=W.a.I18n.t("welcomeEventSegment").replace("%$1s",n.name)}if(t&&"immediate"!==e.options.afterTimeType){switch(e.options.afterTimeType){case"hours":a=W.a.I18n.t("sendingDelayHours").replace("%$1d",e.options.afterTimeNumber);break;case"days":a=W.a.I18n.t("sendingDelayDays").replace("%$1d",e.options.afterTimeNumber);break;case"weeks":a=W.a.I18n.t("sendingDelayWeeks").replace("%$1d",e.options.afterTimeNumber);break;default:a=W.a.I18n.t("sendingDelayInvalid")}t+=" [".concat(a,"].")}return r.a.createElement("span",null,t)},renderItem:function(e,t){var a=U()("manage-column","column-primary","has-row-actions");return r.a.createElement("div",null,r.a.createElement("td",{className:a},r.a.createElement("strong",null,r.a.createElement("a",{className:"row-title",href:"?page=mailpoet-newsletter-editor&id=".concat(e.id)},e.subject)),t),r.a.createElement("td",{className:"column","data-colname":W.a.I18n.t("status")},this.renderStatus(e)),r.a.createElement("td",{className:"column","data-colname":W.a.I18n.t("settings")},this.renderSettings(e)),!0===Ra?r.a.createElement("td",{className:"column","data-colname":W.a.I18n.t("statistics")},this.renderStatistics(e,e.total_sent>0&&e.statistics)):null,r.a.createElement("td",{className:"column-date","data-colname":W.a.I18n.t("lastModifiedOn")},r.a.createElement("abbr",null,W.a.Date.format(e.updated_at))))},render:function(){var e=this;return r.a.createElement("div",null,r.a.createElement(va.a,null),r.a.createElement(ya.a,{hasNews:window.mailpoet_feature_announcement_has_news}),r.a.createElement(ga.a,{tab:"welcome"}),r.a.createElement(K.a,{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,columns:Da,bulk_actions:ja,item_actions:La,messages:Aa,auto_refresh:!0,sort_by:"updated_at",sort_order:"desc",afterGetItems:function(t){e.checkMailerStatus(t),e.checkCronStatus(t)}}))}}),Ma={onTrash:function(e){var t=Number(e.meta.count),a=null;a=1===t?W.a.I18n.t("oneNewsletterTrashed"):W.a.I18n.t("multipleNewslettersTrashed").replace("%$1d",t.toLocaleString()),W.a.Notice.success(a)},onDelete:function(e){var t=Number(e.meta.count),a=null;a=1===t?W.a.I18n.t("oneNewsletterDeleted"):W.a.I18n.t("multipleNewslettersDeleted").replace("%$1d",t.toLocaleString()),W.a.Notice.success(a)},onRestore:function(e){var t=Number(e.meta.count),a=null;a=1===t?W.a.I18n.t("oneNewsletterRestored"):W.a.I18n.t("multipleNewslettersRestored").replace("%$1d",t.toLocaleString()),W.a.Notice.success(a)}},qa=[{name:"subject",label:W.a.I18n.t("subject"),sortable:!0},{name:"status",label:W.a.I18n.t("status"),width:100},{name:"settings",label:W.a.I18n.t("settings")},{name:"history",label:W.a.I18n.t("history"),width:100},{name:"updated_at",label:W.a.I18n.t("lastModifiedOn"),sortable:!0}],Fa=[{name:"trash",label:W.a.I18n.t("moveToTrash"),onSuccess:Ma.onTrash}],Ba=[{name:"view",link:function(e){return r.a.createElement("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer"},W.a.I18n.t("preview"))}},{name:"edit",link:function(e){return r.a.createElement("a",{href:"?page=mailpoet-newsletter-editor&id=".concat(e.id)},W.a.I18n.t("edit"))}},{name:"duplicate",label:W.a.I18n.t("duplicate"),onClick:function(e,t){return W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done(function(e){W.a.Notice.success(W.a.I18n.t("newsletterDuplicated").replace("%$1s",e.data.subject)),t()}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})})}},{name:"trash"}],$a=Je()({displayName:"NewsletterListNotification",propTypes:{location:u.a.object.isRequired,match:u.a.shape({params:u.a.object}).isRequired},mixins:[wa.MailerMixin,wa.CronMixin],updateStatus:function(e){var t=this;e.persist(),W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"setStatus",data:{id:Number(e.target.getAttribute("data-id")),status:e.target.value}}).done(function(e){"active"===e.data.status&&W.a.Notice.success(W.a.I18n.t("postNotificationActivated")),t.forceUpdate()}).fail(function(t){W.a.Notice.error(W.a.I18n.t("postNotificationActivationFailed")),e.target.value=t.status})},renderStatus:function(e){return r.a.createElement("select",{"data-id":e.id,defaultValue:e.status,onChange:this.updateStatus},r.a.createElement("option",{value:"active"},W.a.I18n.t("active")),r.a.createElement("option",{value:"draft"},W.a.I18n.t("inactive")))},renderSettings:function(e){var t,a=e.segments.map(function(e){return e.name}),n=W.a.I18n.t("ifNewContentToSegments").replace("%$1s",a.join(", "));if(0===a.length)return r.a.createElement("span",{className:"mailpoet_error"},W.a.I18n.t("sendingToSegmentsNotSpecified"));switch(e.options.intervalType){case"daily":t=W.a.I18n.t("sendDaily").replace("%$1s",Dt.timeOfDayValues[e.options.timeOfDay]);break;case"weekly":t=W.a.I18n.t("sendWeekly").replace("%$1s",Dt.weekDayValues[e.options.weekDay]).replace("%$2s",Dt.timeOfDayValues[e.options.timeOfDay]);break;case"monthly":t=W.a.I18n.t("sendMonthly").replace("%$1s",Dt.monthDayValues[e.options.monthDay]).replace("%$2s",Dt.timeOfDayValues[e.options.timeOfDay]);break;case"nthWeekDay":t=W.a.I18n.t("sendNthWeekDay").replace("%$1s",Dt.nthWeekDayValues[e.options.nthWeekDay]).replace("%$2s",Dt.weekDayValues[e.options.weekDay]).replace("%$3s",Dt.timeOfDayValues[e.options.timeOfDay]);break;case"immediately":t=W.a.I18n.t("sendImmediately");break;default:t="Invalid sending frequency"}return r.a.createElement("span",null,t," ",n)},renderHistoryLink:function(e){return 0===Number(e.children_count)?W.a.I18n.t("notSentYet"):r.a.createElement($.a,{"data-automation-id":"history-".concat(e.id),to:"/notification/history/".concat(e.id)},W.a.I18n.t("viewHistory"))},renderItem:function(e,t){var a=U()("manage-column","column-primary","has-row-actions");return r.a.createElement("div",null,r.a.createElement("td",{className:a},r.a.createElement("strong",null,r.a.createElement("a",{className:"row-title",href:"?page=mailpoet-newsletter-editor&id=".concat(e.id)},e.subject)),t),r.a.createElement("td",{className:"column","data-colname":W.a.I18n.t("status")},this.renderStatus(e)),r.a.createElement("td",{className:"column","data-colname":W.a.I18n.t("settings")},this.renderSettings(e)),r.a.createElement("td",{className:"column","data-colname":W.a.I18n.t("history")},this.renderHistoryLink(e)),r.a.createElement("td",{className:"column-date","data-colname":W.a.I18n.t("lastModifiedOn")},r.a.createElement("abbr",null,W.a.Date.format(e.updated_at))))},render:function(){var e=this;return r.a.createElement("div",null,r.a.createElement(va.a,null),r.a.createElement(ya.a,{hasNews:window.mailpoet_feature_announcement_has_news}),r.a.createElement(ga.a,{tab:"notification"}),r.a.createElement(K.a,{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,columns:qa,bulk_actions:Fa,item_actions:Ba,messages:Ma,auto_refresh:!0,sort_by:"updated_at",sort_order:"desc",afterGetItems:function(t){e.checkMailerStatus(t),e.checkCronStatus(t)}}))}}),Ha=!!window.mailpoet_tracking_enabled,Va=[{name:"subject",label:W.a.I18n.t("subject")},{name:"status",label:W.a.I18n.t("status")},{name:"segments",label:W.a.I18n.t("lists")},{name:"statistics",label:W.a.I18n.t("statistics"),display:Ha},{name:"sent_at",label:W.a.I18n.t("sentOn")}],Wa=[{name:"view",link:function(e){return r.a.createElement("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer"},W.a.I18n.t("preview"))}}];ve.a.addFilter("mailpoet_newsletters_listings_notification_history_actions",wa.StatisticsMixin.addStatsCTAAction),Wa=ve.a.applyFilters("mailpoet_newsletters_listings_notification_history_actions",Wa);var za=Je()({displayName:"NewsletterListNotificationHistory",propTypes:{location:u.a.object.isRequired,match:u.a.shape({params:u.a.object}).isRequired},mixins:[wa.QueueMixin,wa.StatisticsMixin,wa.MailerMixin,wa.CronMixin],renderItem:function(e,t,a){var n=U()("manage-column","column-primary","has-row-actions"),i=e.segments.map(function(e){return e.name}).join(", ");return r.a.createElement("div",null,r.a.createElement("td",{className:n},r.a.createElement("strong",null,r.a.createElement("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer"},e.queue.newsletter_rendered_subject||e.subject)),t),r.a.createElement("td",{className:"column","data-colname":W.a.I18n.t("status")},this.renderQueueStatus(e,a.mta_log)),r.a.createElement("td",{className:"column","data-colname":W.a.I18n.t("lists")},i),!0===Ha?r.a.createElement("td",{className:"column","data-colname":W.a.I18n.t("statistics")},this.renderStatistics(e,void 0,a.current_time)):null,r.a.createElement("td",{className:"column-date","data-colname":W.a.I18n.t("sentOn")},e.sent_at?W.a.Date.format(e.sent_at):W.a.I18n.t("notSentYet")))},render:function(){var e=this;return r.a.createElement("div",null,r.a.createElement(va.a,null),r.a.createElement(ya.a,{hasNews:window.mailpoet_feature_announcement_has_news}),r.a.createElement(ga.a,{tab:"notification"}),r.a.createElement($.a,{className:"page-title-action",to:"/notification"},W.a.I18n.t("backToPostNotifications")),r.a.createElement(K.a,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,endpoint:"newsletters",type:"notification_history",base_url:"notification/history/:parent_id",onRenderItem:this.renderItem,columns:Va,item_actions:Wa,auto_refresh:!0,sort_by:"sent_at",sort_order:"desc",afterGetItems:function(t){e.checkMailerStatus(t),e.checkCronStatus(t)}}))}});(function(e){function t(){return C()(this,t),A()(this,j()(t).apply(this,arguments))}return O()(t,e),P()(t,[{key:"render",value:function(){return this.props.children}}]),t}(r.a.Component)).propTypes={children:u.a.element.isRequired};var Ua=document.getElementById("newsletters_container");if(Ua){var Ya=[{path:"/standard/(.*)?",component:Ca},{path:"/welcome/(.*)?",component:Oa},{path:"/notification/history/:parent_id/(.*)?",component:za},{path:"/notification/(.*)?",component:$a},{path:"/new/standard",component:sa},{path:"/new/notification",component:ca},{path:"/new/welcome",component:da},{path:"/new",component:Se},{name:"template",path:"/template/:id",component:Ke},{path:"/send/congratulate/:id",component:ra},{path:"/send/:id",component:Kt}];Ya=ve.a.applyFilters("mailpoet_newsletters_before_router",oe()(Ya).concat(oe()(window.mailpoet_automatic_emails?ye.a.map(window.mailpoet_automatic_emails,function(e){return{path:"new/".concat(e.slug),name:e.slug,component:ha.a,data:{email:e}}}):null))),window.mailpoet_listing=s.a.render(r.a.createElement(E,null,r.a.createElement(S,null,r.a.createElement(N,{exact:!0,path:"/",render:function(){return r.a.createElement(ge,{to:"/standard"})}}),Ya.map(function(e){return r.a.createElement(N,{key:e.path,path:e.path,component:e.component,name:e.name||null,data:e.data||null,render:e.render})}))),Ua)}var Ka=function(e){return"wp_users"===e.type},Ga=function(e){return"woocommerce_users"===e.type},Ja=function(e){return Ka(e)||Ga(e)},Qa=[{name:"name",label:W.a.I18n.t("name"),sortable:!0},{name:"description",label:W.a.I18n.t("description")},{name:"subscribed",label:W.a.I18n.t("subscribed")},{name:"unconfirmed",label:W.a.I18n.t("unconfirmed")},{name:"unsubscribed",label:W.a.I18n.t("unsubscribed")},{name:"bounced",label:W.a.I18n.t("bounced")},{name:"created_at",label:W.a.I18n.t("createdOn"),sortable:!0}],Xa={onTrash:function(e){var t=Number(e.meta.count),a=null;a=1===t?W.a.I18n.t("oneSegmentTrashed"):W.a.I18n.t("multipleSegmentsTrashed").replace("%$1d",t.toLocaleString()),W.a.Notice.success(a)},onDelete:function(e){var t=Number(e.meta.count),a=null;a=1===t?W.a.I18n.t("oneSegmentDeleted"):W.a.I18n.t("multipleSegmentsDeleted").replace("%$1d",t.toLocaleString()),W.a.Notice.success(a)},onRestore:function(e){var t=Number(e.meta.count),a=null;a=1===t?W.a.I18n.t("oneSegmentRestored"):W.a.I18n.t("multipleSegmentsRestored").replace("%$1d",t.toLocaleString()),W.a.Notice.success(a)}},Za=[{name:"trash",label:W.a.I18n.t("moveToTrash"),onSuccess:Xa.onTrash}],en=[{name:"edit",link:function(e){return r.a.createElement($.a,{to:"/edit/".concat(e.id)},W.a.I18n.t("edit"))},display:function(e){return!Ja(e)}},{name:"duplicate_segment",label:W.a.I18n.t("duplicate"),onClick:function(e,t){return W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"segments",action:"duplicate",data:{id:e.id}}).done(function(e){W.a.Notice.success(W.a.I18n.t("listDuplicated").replace("%$1s",e.data.name)),t()}).fail(function(e){W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})})},display:function(e){return!Ja(e)}},{name:"read_more",link:function(){return r.a.createElement("a",{href:"http://docs.mailpoet.com/article/133-the-wordpress-users-list",target:"_blank",rel:"noopener noreferrer"},W.a.I18n.t("readMore"))},display:function(e){return Ka(e)}},{name:"synchronize_segment",label:W.a.I18n.t("forceSync"),onClick:function(e,t){W.a.Modal.loading(!0),W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"segments",action:"synchronize",data:{type:e.type}}).done(function(){W.a.Modal.loading(!1),W.a.Notice.success(W.a.I18n.t("listSynchronized").replace("%$1s",e.name)),t()}).fail(function(e){W.a.Modal.loading(!1),e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})})},display:function(e){return Ka(e)||Ga(e)}},{name:"view_subscribers",link:function(e){return r.a.createElement("a",{href:e.subscribers_url},W.a.I18n.t("viewSubscribers"))}},{name:"trash",display:function(e){return!Ja(e)}}],tn=function(e){function t(){var e,a;C()(this,t);for(var n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return a=A()(this,(e=j()(t)).call.apply(e,[this].concat(i))),B()(q()(q()(a)),"renderItem",function(e,t){var a,n=U()("manage-column","column-primary","has-row-actions"),i=Number(e.subscribers_count.subscribed||0),s=Number(e.subscribers_count.unconfirmed||0),o=Number(e.subscribers_count.unsubscribed||0),l=Number(e.subscribers_count.bounced||0);return a=Ja(e)?r.a.createElement("span",{className:"row-title"},e.name):r.a.createElement($.a,{className:"row-title",to:"/edit/".concat(e.id)},e.name),r.a.createElement("div",null,r.a.createElement("td",{className:n},r.a.createElement("strong",null,a),t),r.a.createElement("td",{className:"column-date","data-colname":W.a.I18n.t("description")},r.a.createElement("abbr",null,e.description)),r.a.createElement("td",{className:"column-date","data-colname":W.a.I18n.t("subscribed")},r.a.createElement("abbr",null,i.toLocaleString())),r.a.createElement("td",{className:"column-date","data-colname":W.a.I18n.t("unconfirmed")},r.a.createElement("abbr",null,s.toLocaleString())),r.a.createElement("td",{className:"column-date","data-colname":W.a.I18n.t("unsubscribed")},r.a.createElement("abbr",null,o.toLocaleString())),r.a.createElement("td",{className:"column-date","data-colname":W.a.I18n.t("bounced")},r.a.createElement("abbr",null,l.toLocaleString())),r.a.createElement("td",{className:"column-date","data-colname":W.a.I18n.t("createdOn")},r.a.createElement("abbr",null,W.a.Date.format(e.created_at))))}),a}return O()(t,e),P()(t,[{key:"render",value:function(){return r.a.createElement("div",null,r.a.createElement("h1",{className:"title"},W.a.I18n.t("pageTitle")," ",r.a.createElement($.a,{className:"page-title-action",to:"/new"},W.a.I18n.t("new"))),r.a.createElement(K.a,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,messages:Xa,search:!1,endpoint:"segments",onRenderItem:this.renderItem,columns:Qa,bulk_actions:Za,item_actions:en,sort_by:"name",sort_order:"asc"}))}}]),t}(r.a.Component);tn.propTypes={location:u.a.object.isRequired,match:u.a.shape({params:u.a.object}).isRequired};var an=tn,nn=a(375),rn=a.n(nn),sn=document.getElementById("segments_container");sn&&s.a.render(r.a.createElement(E,null,r.a.createElement(S,null,r.a.createElement(N,{path:"/new",component:rn.a}),r.a.createElement(N,{path:"/edit/:id",component:rn.a}),r.a.createElement(N,{path:"*",component:an}))),sn);var on=function(e){function t(e){var a;return C()(this,t),(a=A()(this,j()(t).call(this,e))).state={senderAddress:e.senderAddress,senderName:e.senderName,replyToName:e.replyToName,replyToAddress:e.replyToAddress},a.onChange=a.onChange.bind(q()(q()(a))),a}return O()(t,e),P()(t,[{key:"onChange",value:function(e,t){var a={};a[e]=t.target.value,this.setState(a)}},{key:"render",value:function(){return r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,r.a.createElement("label",{htmlFor:"settings[from_name]"},W.a.I18n.t("from")),r.a.createElement("input",{type:"text",id:"settings[from_name]","data-automation-id":"settings-page-from-name-field",name:"sender[name]",value:this.state.senderName,onChange:Object(be.partial)(this.onChange,"senderName"),placeholder:W.a.I18n.t("yourName")}),r.a.createElement("input",{type:"email",id:"settings[from_email]",name:"sender[address]","data-automation-id":"settings-page-from-email-field",value:this.state.senderAddress,onChange:Object(be.partial)(this.onChange,"senderAddress"),placeholder:"from@mydomain.com"})),r.a.createElement("div",{className:"regular-text"},r.a.createElement(wt,{emailAddress:this.state.senderAddress,mssActive:this.props.mssActive,pluginInstalledAt:this.props.pluginInstalledAt})),r.a.createElement("p",null,r.a.createElement("label",{htmlFor:"settings[reply_name]"},W.a.I18n.t("replyTo")),r.a.createElement("input",{type:"text",id:"settings[reply_name]",name:"reply_to[name]",value:this.state.replyToName,onChange:Object(be.partial)(this.onChange,"replyToName"),placeholder:W.a.I18n.t("yourName")}),r.a.createElement("input",{type:"email",id:"settings[reply_email]",name:"reply_to[address]",value:this.state.replyToAddress,onChange:Object(be.partial)(this.onChange,"replyToAddress"),placeholder:"reply_to@mydomain.com"})))}}]),t}(r.a.Component);on.propTypes={senderAddress:u.a.string.isRequired,senderName:u.a.string.isRequired,replyToAddress:u.a.string.isRequired,replyToName:u.a.string.isRequired,mssActive:u.a.bool.isRequired,pluginInstalledAt:u.a.string.isRequired};var ln=on,cn=function(e){function t(e){var a;return C()(this,t),(a=A()(this,j()(t).call(this,e))).state={senderAddress:e.senderAddress,senderName:e.senderName},a.onChange=a.onChange.bind(q()(q()(a))),a}return O()(t,e),P()(t,[{key:"onChange",value:function(e,t){var a={};a[e]=t.target.value,this.setState(a)}},{key:"render",value:function(){return r.a.createElement(r.a.Fragment,null,r.a.createElement("th",{scope:"row"},r.a.createElement("label",{htmlFor:"settings[signup_confirmation_from_name]"},W.a.I18n.t("from"))),r.a.createElement("td",null,r.a.createElement("p",null,r.a.createElement("input",{type:"text",id:"settings[signup_confirmation_from_name]",name:"signup_confirmation[from][name]","data-automation-id":"signup_confirmation_email_from_name",value:this.state.senderName,onChange:Object(be.partial)(this.onChange,"senderName"),placeholder:W.a.I18n.t("yourName")}),r.a.createElement("input",{type:"email",id:"settings[signup_confirmation_from_email]",name:"signup_confirmation[from][address]","data-automation-id":"signup_confirmation_email_from_email",value:this.state.senderAddress,onChange:Object(be.partial)(this.onChange,"senderAddress"),placeholder:"confirmation@mydomain.com",size:"28"})),r.a.createElement("div",{className:"regular-text"},r.a.createElement(wt,{emailAddress:this.state.senderAddress,mssActive:this.props.mssActive,pluginInstalledAt:this.props.pluginInstalledAt}))))}}]),t}(r.a.Component);cn.propTypes={senderAddress:u.a.string.isRequired,senderName:u.a.string.isRequired,mssActive:u.a.bool.isRequired,pluginInstalledAt:u.a.string.isRequired};var un=cn,pn=document.getElementById("settings_sender_container");pn&&s.a.render(r.a.createElement(ln,{senderAddress:window.mailpoet_settings_sender_adddress,senderName:window.mailpoet_settings_sender_name,replyToAddress:window.mailpoet_settings_reply_to_address,replyToName:window.mailpoet_settings_reply_to_name,pluginInstalledAt:window.mailpoet_installed_at,mssActive:window.mailpoet_mss_active}),pn);var dn=document.getElementById("settings_signup_confirmation_sender_container");dn&&s.a.render(r.a.createElement(un,{senderAddress:window.mailpoet_settings_sender_adddress,senderName:window.mailpoet_settings_sender_name,pluginInstalledAt:window.mailpoet_installed_at,mssActive:window.mailpoet_mss_active}),dn);var mn=[{name:"name",label:W.a.I18n.t("formName"),sortable:!0},{name:"segments",label:W.a.I18n.t("segments")},{name:"signups",label:W.a.I18n.t("signups")},{name:"created_at",label:W.a.I18n.t("createdOn"),sortable:!0}],hn={onTrash:function(e){var t=Number(e.meta.count),a=null;a=1===t?W.a.I18n.t("oneFormTrashed"):W.a.I18n.t("multipleFormsTrashed").replace("%$1d",t.toLocaleString()),W.a.Notice.success(a)},onDelete:function(e){var t=Number(e.meta.count),a=null;a=1===t?W.a.I18n.t("oneFormDeleted"):W.a.I18n.t("multipleFormsDeleted").replace("%$1d",t.toLocaleString()),W.a.Notice.success(a)},onRestore:function(e){var t=Number(e.meta.count),a=null;a=1===t?W.a.I18n.t("oneFormRestored"):W.a.I18n.t("multipleFormsRestored").replace("%$1d",t.toLocaleString()),W.a.Notice.success(a)}},fn=[{name:"trash",label:W.a.I18n.t("moveToTrash"),onSuccess:hn.onTrash}],gn=[{name:"edit",label:W.a.I18n.t("edit"),link:function(e){return r.a.createElement("a",{href:"admin.php?page=mailpoet-form-editor&id=".concat(e.id)},W.a.I18n.t("edit"))}},{name:"duplicate",label:W.a.I18n.t("duplicate"),onClick:function(e,t){return W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"forms",action:"duplicate",data:{id:e.id}}).done(function(e){W.a.Notice.success(W.a.I18n.t("formDuplicated").replace("%$1s",e.data.name)),t()}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})})}},{name:"trash"}],_n=function(e){function t(){var e,a;C()(this,t);for(var n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return a=A()(this,(e=j()(t)).call.apply(e,[this].concat(i))),B()(q()(q()(a)),"createForm",function(){W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"forms",action:"create"}).done(function(e){window.location=window.mailpoet_form_edit_url+e.data.id}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})})}),B()(q()(q()(a)),"renderItem",function(e,t){var a=U()("manage-column","column-primary","has-row-actions"),n=window.mailpoet_segments.filter(function(t){return-1!==V.a.inArray(t.id,e.segments)}).map(function(e){return e.name}).join(", ");return"user"===e.settings.segments_selected_by&&(n="".concat(W.a.I18n.t("userChoice")," ").concat(n)),r.a.createElement("div",null,r.a.createElement("td",{className:a},r.a.createElement("strong",null,r.a.createElement("a",{className:"row-title",href:"admin.php?page=mailpoet-form-editor&id=".concat(e.id)},e.name)),t),r.a.createElement("td",{className:"column","data-colname":W.a.I18n.t("segments")},n),r.a.createElement("td",{className:"column","data-colname":W.a.I18n.t("signups")},e.signups),r.a.createElement("td",{className:"column-date","data-colname":W.a.I18n.t("createdOn")},r.a.createElement("abbr",null,W.a.Date.format(e.created_at))))}),a}return O()(t,e),P()(t,[{key:"render",value:function(){return r.a.createElement("div",null,r.a.createElement("h1",{className:"title"},W.a.I18n.t("pageTitle")," ",r.a.createElement("button",{className:"page-title-action",href:"javascript:;",onClick:this.createForm,"data-automation-id":"create_new_form",type:"button"},W.a.I18n.t("new"))),r.a.createElement(K.a,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,messages:hn,search:!1,endpoint:"forms",onRenderItem:this.renderItem,columns:mn,bulk_actions:fn,item_actions:gn}))}}]),t}(r.a.Component);_n.propTypes={location:u.a.object.isRequired,match:u.a.shape({params:u.a.object}).isRequired};var vn=_n,bn=document.getElementById("forms_container");bn&&s.a.render(r.a.createElement(E,null,r.a.createElement(N,{path:"*",component:vn})),bn);var yn=a(26),wn=a.n(yn),En=W.a;V()("#mailpoet_settings").length>0&&(En.Router=new(wn.a.Router.extend({routes:{"":"defaultRoute","mta(/:group)":"sendingMethodGroup","(:tab)":"tabs"},defaultRoute:function(){this.tabs("basics")},sendingMethodGroup:function(e){this.tabs("mta"),V()("#mailpoet_sending_method_setup, .mailpoet_sending_method").hide(),V()(".mailpoet_settings_submit").hide(),null===e?V()(".mailpoet_sending_methods, .mailpoet_sending_methods_help").fadeIn():(V()("#mailpoet_mta_spf")["mailpoet"===e?"hide":"show"](),V()(".mailpoet_sending_methods, .mailpoet_sending_methods_help").hide(),V()('.mailpoet_sending_method[data-group="'+e+'"]').show(),V()("#mailpoet_sending_method_setup").fadeIn())},tabs:function(e){V()(".nav-tab-wrapper a").removeClass("nav-tab-active"),V()(".mailpoet_tab_panel, .mailpoet_section").hide(),V()('a.nav-tab[href="#'+e+'"]').addClass("nav-tab-active").blur(),V()('.mailpoet_tab_panel[data-tab="'+e+'"]').length>0&&V()('.mailpoet_tab_panel[data-tab="'+e+'"]').show(),V()(".mailpoet_settings_submit").show(),En.trackEvent("User has clicked a tab in Settings",{"MailPoet Free version":window.mailpoet_version,"Tab ID":e})}})),V()(document).ready(function(){wn.a.History.started||wn.a.history.start()}));var kn=[{name:"knowledgeBase",label:W.a.I18n.t("tabKnowledgeBaseTitle"),link:"/knowledgeBase"},{name:"systemStatus",label:W.a.I18n.t("tabSystemStatusTitle"),link:"/systemStatus"},{name:"systemInfo",label:W.a.I18n.t("tabSystemInfoTitle"),link:"/systemInfo"},{name:"yourPrivacy",label:W.a.I18n.t("tabYourPrivacyTitle"),link:"/yourPrivacy"}];function In(e){var t=kn.map(function(t){var a=U()("nav-tab",{"nav-tab-active":e.tab===t.name});return r.a.createElement($.a,{key:"tab-".concat(t.name),className:a,to:t.link},t.label)});return r.a.createElement("h2",{className:"nav-tab-wrapper"},t)}In.propTypes={tab:u.a.string},In.defaultProps={tab:"knowledgeBase"};var Sn=In;var Nn=function(){return r.a.createElement("div",null,r.a.createElement(Sn,{tab:"knowledgeBase"}),r.a.createElement("p",null,W.a.I18n.t("knowledgeBaseIntro")),r.a.createElement("ul",null,r.a.createElement("li",null,r.a.createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"http://beta.docs.mailpoet.com/category/116-common-problems"},"Common Problems")),r.a.createElement("li",null,r.a.createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"http://beta.docs.mailpoet.com/category/165-newsletters"},"Newsletters")),r.a.createElement("li",null,r.a.createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"http://beta.docs.mailpoet.com/category/156-migration-questions"},"Migration Questions")),r.a.createElement("li",null,r.a.createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"http://beta.docs.mailpoet.com/category/149-sending-methods"},"Sending Methods")),r.a.createElement("li",null,r.a.createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"http://beta.docs.mailpoet.com/category/139-subscription-forms"},"Subscription Forms")),r.a.createElement("li",null,r.a.createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"http://beta.docs.mailpoet.com/category/114-getting-started"},"Getting Started")),r.a.createElement("li",null,r.a.createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"http://beta.docs.mailpoet.com/category/123-newsletter-designer"},"Newsletter Designer")),r.a.createElement("li",null,r.a.createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"http://beta.docs.mailpoet.com/category/121-subscribers-and-lists"},"Subscribers and Lists"))),r.a.createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"http://beta.docs.mailpoet.com/",className:"button button-primary"},W.a.I18n.t("knowledgeBaseButton")))};function xn(e){e.target.select()}var Cn=function(){var e=window.systemInfoData;return r.a.createElement("div",null,r.a.createElement(Sn,{tab:"systemInfo"}),r.a.createElement("div",{className:"mailpoet_notice notice inline",style:{marginTop:"1em"}},r.a.createElement("p",null,W.a.I18n.t("systemInfoIntro"))),function(e){if(ye.a.isObject(e)){var t=Re()(e).map(function(t){return"".concat(t,": ").concat(e[t])});return r.a.createElement("textarea",{readOnly:!0,onFocus:xn,value:t.join("\n"),style:{width:"100%",height:"400px"}})}return r.a.createElement("p",null,W.a.I18n.t("systemInfoDataError"))}(e))},Tn=function(e){return r.a.createElement("table",{className:"widefat fixed",style:{maxWidth:e.max_width}},r.a.createElement("tbody",null,e.rows.map(function(e){return r.a.createElement("tr",{key:"row_".concat(e.key)},r.a.createElement("td",{className:"row-title"},e.key),r.a.createElement("td",null,e.value))})))};Tn.propTypes={max_width:u.a.string,rows:u.a.arrayOf(u.a.shape({key:u.a.string.isRequired,value:u.a.oneOfType([u.a.string,u.a.number,u.a.element]).isRequired})).isRequired},Tn.defaultProps={max_width:"auto"};var Pn=Tn,Rn=function(e){return r.a.createElement("span",null,!0===e.children&&e.truthy||!1===e.children&&e.falsy||e.unknown)};Rn.propTypes={truthy:u.a.string,falsy:u.a.string,unknown:u.a.string,children:u.a.bool},Rn.defaultProps={truthy:W.a.I18n.t("yes"),falsy:W.a.I18n.t("no"),unknown:W.a.I18n.t("unknown"),children:null};var An=Rn,Dn=function(e){var t=e.status_data,a={active:W.a.I18n.t("running"),inactive:W.a.I18n.t("cronWaiting")};return r.a.createElement("div",null,r.a.createElement("h2",null,W.a.I18n.t("systemStatusCronStatusTitle")),r.a.createElement(Pn,{max_width:"400px",rows:[{key:W.a.I18n.t("accessible"),value:r.a.createElement(An,null,t.accessible)},{key:W.a.I18n.t("status"),value:a[t.status]?a[t.status]:W.a.I18n.t("unknown")},{key:W.a.I18n.t("lastUpdated"),value:t.updated_at?W.a.Date.full(1e3*t.updated_at):W.a.I18n.t("unknown")},{key:W.a.I18n.t("lastRunStarted"),value:t.run_accessed_at?W.a.Date.full(1e3*t.run_started_at):W.a.I18n.t("unknown")},{key:W.a.I18n.t("lastRunCompleted"),value:t.run_completed_at?W.a.Date.full(1e3*t.run_completed_at):W.a.I18n.t("unknown")},{key:W.a.I18n.t("lastSeenError"),value:t.last_error||W.a.I18n.t("none")}]}))};Dn.propTypes={status_data:u.a.shape({accessible:u.a.bool,status:u.a.string,updated_at:u.a.number,run_accessed_at:u.a.number,run_completed_at:u.a.number}).isRequired};var jn=Dn,Ln=function(e){return r.a.createElement("tr",null,r.a.createElement("td",{className:"column column-primary"},e.task.id),r.a.createElement("td",{className:"column"},e.task.type),r.a.createElement("td",{className:"column"},e.task.newsletter?r.a.createElement("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"},e.task.newsletter.subject||W.a.I18n.t("preview")):W.a.I18n.t("none")),r.a.createElement("td",{className:"column"},e.task.priority),e.show_scheduled_at?r.a.createElement("td",{className:"column-date"},r.a.createElement("abbr",null,W.a.Date.format(1e3*e.task.scheduled_at))):null,r.a.createElement("td",{className:"column-date"},r.a.createElement("abbr",null,W.a.Date.format(1e3*e.task.updated_at))))};Ln.propTypes={show_scheduled_at:u.a.bool,task:u.a.shape({id:u.a.number.isRequired,type:u.a.string.isRequired,priority:u.a.number.isRequired,updated_at:u.a.number.isRequired,scheduled_at:u.a.number,status:u.a.string,newsletter:u.a.shape({newsletter_id:u.a.number.isRequired,queue_id:u.a.number.isRequired,preview_url:u.a.string.isRequired,subject:u.a.string})}).isRequired},Ln.defaultProps={show_scheduled_at:!1};var On=Ln,Mn=function(e){return r.a.createElement("tr",null,r.a.createElement("th",{className:"row-title"},"Id"),r.a.createElement("th",{className:"row-title"},W.a.I18n.t("type")),r.a.createElement("th",{className:"row-title"},W.a.I18n.t("email")),r.a.createElement("th",{className:"row-title"},W.a.I18n.t("priority")),e.show_scheduled_at?r.a.createElement("th",{className:"row-title"},W.a.I18n.t("scheduledAt")):null,r.a.createElement("th",{className:"row-title"},W.a.I18n.t("updatedAt")))};Mn.propTypes={show_scheduled_at:u.a.bool},Mn.defaultProps={show_scheduled_at:!1};var qn=Mn,Fn=function(e){var t=e.show_scheduled_at?6:5;return r.a.createElement("table",{className:"widefat fixed striped"},r.a.createElement("thead",null,r.a.createElement(qn,{show_scheduled_at:e.show_scheduled_at})),r.a.createElement("tbody",null,e.tasks.length?e.tasks.map(function(t){return r.a.createElement(On,{key:t.id,task:t,show_scheduled_at:e.show_scheduled_at})}):r.a.createElement("tr",{className:"no-items"},r.a.createElement("td",{colSpan:t},W.a.I18n.t("nothingToShow")))),r.a.createElement("tfoot",null,r.a.createElement(qn,{show_scheduled_at:e.show_scheduled_at})))};Fn.propTypes={show_scheduled_at:u.a.bool,tasks:u.a.arrayOf(On.propTypes.task).isRequired},Fn.defaultProps={show_scheduled_at:!1};var Bn=Fn,$n=function(e){var t=e.status_data;return r.a.createElement("div",null,r.a.createElement("h2",null,W.a.I18n.t("systemStatusQueueTitle")),r.a.createElement(Pn,{max_width:"400px",rows:[{key:W.a.I18n.t("status"),value:"paused"===t.status?W.a.I18n.t("paused"):W.a.I18n.t("running")},{key:W.a.I18n.t("startedAt"),value:t.started?W.a.Date.full(1e3*t.started):W.a.I18n.t("unknown")},{key:W.a.I18n.t("sentEmails"),value:t.sent||0},{key:W.a.I18n.t("retryAttempt"),value:t.retry_attempt||W.a.I18n.t("none")},{key:W.a.I18n.t("retryAt"),value:t.retry_at?W.a.Date.full(1e3*t.retry_at):W.a.I18n.t("none")},{key:W.a.I18n.t("error"),value:t.error?t.error.error_message:W.a.I18n.t("none")},{key:W.a.I18n.t("totalCompletedTasks"),value:t.tasksStatusCounts.completed},{key:W.a.I18n.t("totalRunningTasks"),value:t.tasksStatusCounts.running},{key:W.a.I18n.t("totalPausedTasks"),value:t.tasksStatusCounts.paused},{key:W.a.I18n.t("totalScheduledTasks"),value:t.tasksStatusCounts.scheduled}]}),r.a.createElement("h4",null,W.a.I18n.t("scheduledTasks")),r.a.createElement(Bn,{show_scheduled_at:!0,tasks:t.latestTasks.filter(function(e){return"scheduled"===e.status})}),r.a.createElement("h4",null,W.a.I18n.t("runningTasks")),r.a.createElement(Bn,{tasks:t.latestTasks.filter(function(e){return null===e.status})}),r.a.createElement("h4",null,W.a.I18n.t("completedTasks")),r.a.createElement(Bn,{tasks:t.latestTasks.filter(function(e){return"completed"===e.status})}))};$n.propTypes={status_data:u.a.shape({status:u.a.string,started:u.a.number,sent:u.a.number,retry_attempt:u.a.number,retry_at:u.a.number,error:u.a.shape({operation:u.a.string,error_message:u.a.string}),tasksStatusCounts:u.a.shape({completed:u.a.number.isRequired,running:u.a.number.isRequired,paused:u.a.number.isRequired,scheduled:u.a.number.isRequired}).isRequired,latestTasks:u.a.arrayOf(On.propTypes.task).isRequired}).isRequired};var Hn=$n;function Vn(e,t,a){var n=e?"success":"error",i=e?W.a.I18n.t("systemStatusConnectionSuccessful"):"".concat(W.a.I18n.t("systemStatusConnectionUnsuccessful")," ").concat(t);return a&&(i=ft()(i,/\[link\](.*?)\[\/link\]/g,function(e){return r.a.createElement("a",{href:"".concat(a),key:"kb-link"},e)})),r.a.createElement("div",{className:"mailpoet_notice notice inline notice-".concat(n),style:{marginTop:"1em"}},r.a.createElement("p",null,i))}var Wn=function(){var e,t,a,n=window.systemStatusData;return r.a.createElement("div",null,r.a.createElement(Sn,{tab:"systemStatus"}),r.a.createElement("div",{className:"mailpoet_notice notice inline",style:{marginTop:"1em"}},r.a.createElement("p",null,n.mss.enabled?W.a.I18n.t("systemStatusIntroCronMSS"):W.a.I18n.t("systemStatusIntroCron"))),(t=(e=n).cron.isReachable,a=e.cron.url,r.a.createElement("div",null,r.a.createElement("h2",null,W.a.I18n.t("systemStatusCronTitle")),r.a.createElement("p",null,r.a.createElement("a",{href:a,target:"_blank",rel:"noopener noreferrer"},a)),Vn(t,W.a.I18n.t("systemStatusCronConnectionUnsuccessfulInfo"),"//beta.docs.mailpoet.com/article/231-sending-does-not-work"))),function(e){if(e.mss.enabled){var t=e.mss.enabled.isReachable;return r.a.createElement("div",null,r.a.createElement("h2",null,W.a.I18n.t("systemStatusMSSTitle")),Vn(t,W.a.I18n.t("systemStatusMSSConnectionUnsuccessfulInfo"),!1))}}(n),r.a.createElement(jn,{status_data:n.cronStatus}),r.a.createElement(Hn,{status_data:n.queueStatus}))};var zn=function(){return r.a.createElement("div",null,r.a.createElement(Sn,{tab:"yourPrivacy"}),r.a.createElement("p",null,W.a.I18n.t("yourPrivacyContent1")),r.a.createElement("p",null,W.a.I18n.t("yourPrivacyContent2")),r.a.createElement("p",null,W.a.I18n.t("yourPrivacyContent3")),r.a.createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://www.mailpoet.com/privacy-notice/",className:"button button-primary"},W.a.I18n.t("yourPrivacyButton")))},Un=document.getElementById("help_container");Un&&s.a.render(r.a.createElement(E,null,r.a.createElement(S,null,r.a.createElement(N,{exact:!0,path:"/",render:function(){return r.a.createElement(ge,{to:"/knowledgeBase"})}}),r.a.createElement(N,{path:"/knowledgeBase",component:Nn}),r.a.createElement(N,{path:"/systemStatus",component:Wn}),r.a.createElement(N,{path:"/systemInfo",component:Cn}),r.a.createElement(N,{path:"/yourPrivacy",component:zn}))),Un);var Yn=a(392),Kn=a.n(Yn),Gn=[{element:document.querySelector("#toplevel_page_mailpoet-newsletters > ul > li > a[href*=mailpoet-segments]").parentNode,intro:W.a.I18n.t("introLists")},{element:document.querySelector("#toplevel_page_mailpoet-newsletters > ul > li > a[href*=mailpoet-forms]").parentNode,intro:W.a.I18n.t("introForms")},{element:".mailpoet-chat",intro:W.a.I18n.t("introChat")},{element:"#mailpoet-new-email",intro:W.a.I18n.t("introEmails")}],Jn=!1;W.a.showIntro=function(){if(!(Jn||window.innerWidth<=960)){var e=Kn()();e.setOptions({steps:Gn,nextLabel:"".concat(W.a.I18n.t("introNext")," →"),prevLabel:"← ".concat(W.a.I18n.t("introBack")),skipLabel:W.a.I18n.t("introSkip"),doneLabel:W.a.I18n.t("introDone"),positionPrecedence:["right","left","bottom","top"],buttonClass:"button",hidePrev:!0,hideNext:!0,helperElementPadding:12,scrollToElement:!1,showStepNumbers:!1,tooltipPosition:"auto"}),e.onafterchange(function(e){if("fixed"===getComputedStyle(e).getPropertyValue("position")){var t=document.querySelector(".introjs-helperLayer"),a=document.querySelector(".introjs-tooltipReferenceLayer");a.style.top="".concat(Te()(a.style.top,10)-window.pageYOffset,"px"),t.style.top="".concat(Te()(t.style.top,10)-window.pageYOffset,"px")}}),e.onexit(function(){Jn=!1,document.body.classList.remove("mailpoet-intro-active")}),e.onskip(function(){W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"settings",action:"set",data:{show_intro:0}})}),e.start(),Jn=!0,document.body.classList.add("mailpoet-intro-active")}};var Qn,Xn=function(e){return"show_poll_success_delivery_".concat(e)},Zn=function(){if(!document.getElementById("typef_orm")){var e=document.createElement("script");e.id="typef_orm",e.src="https://embed.typeform.com/embed.js";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)}},er={successDelivery:{canShow:function(e,t){return"en"===window.mailpoet_locale&&"1"===window.mailpoet_polls_visibility[Xn(e)]&&(t||"PHPMail"===window.mailpoet_polls_data.mta_method)},initTypeformScript:Zn,setPollShown:function(e){var t={};t[Xn(e)]="0",W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"settings",action:"set",data:t}),window.mailpoet_polls_visibility[Xn(e)]="0"},showModal:function(e,t){W.a.Modal.popup({onInit:Zn,template:'\n <div class="typeform-widget"\n data-url="https://mailpoet.typeform.com/to/'.concat(t,'"\n data-transparency="100"\n data-hide-headers="true"\n data-hide-footer="true"\n style="width: 500px; height: 500px; max-width: 100%; max-height: 100%;"\n ></div>\n ')})}}};W.a.Poll=er,(Qn=document.getElementById("mailpoet_reinstall"))&&Qn.addEventListener("click",function(){return confirm(W.a.I18n.t("reinstallConfirmation"))&&(W.a.trackEvent("User has reinstalled MailPoet via Settings",{"MailPoet Free version":window.mailpoet_version}),W.a.Modal.loading(!0),W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"setup",action:"reset"}).always(function(){W.a.Modal.loading(!1)}).done(function(){window.location="admin.php?page=mailpoet-newsletters"}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})})),!1},!1);var tr=a(266),ar=a.n(tr),nr=(a(487),a(14)),rr=a.n(nr),ir=a(393),sr=a.n(ir),or=function(e){var t,a=V()("<div />").html(e).text();return a=a.toLowerCase().replace(/^["';.,\s]+|[^\x20-\x7E]+$|["';.,_\s]+#x2F;g,"").replace(/\s+|%\d+|,+/g,""),(t=/<(.*?)>/.exec(a))&&(a=t[1].trim()),(t=/mailto:(?:\s+)?(.*)/.exec(a))&&(a=t[1].trim()),!!window.mailpoet_email_regex.test(a)&&a};var lr=function(e){var t,a,n,r,i=[],s=[],o=[],l=[],c=null,u=null,p=!1;return Re()(e).forEach(function(d){n=e[d].map(function(e){return e.trim()}),r=n.length,null===u&&(u=r),r===u&&(null===c?(Re()(n).forEach(function(e){a=or(n[e]),null===c&&window.mailpoet_email_regex.test(a)&&(c=e,s[a]=!0,n[e]=a,i[a]=n)}),null===c&&0===Te()(d,10)&&(p=!0,i[0]=n)):""!==n[c]&&(t=or(n[c]),ye.a.has(s,t)?o.push(t):window.mailpoet_email_regex.test(t)?(s[t]=!0,n[c]=t,i[t]=n):l.push(n[c])))}),(i=ye.a.values(i))&&(p&&i.length>=2||!p&&i.length>=1)?{header:window.mailpoet_email_regex.test(i[0][c])?null:i.shift(),subscribers:i,subscribersCount:i.length,duplicate:o,invalid:l}:null},cr=function(e){var t=e.canGoNext,a=e.onPreviousAction,n=e.onNextAction,i=U()("button-primary","wysija",{"button-disabled":!t});return r.a.createElement("div",{className:"mailpoet_import_step_buttons"},r.a.createElement("button",{className:"button-primary wysija button",type:"button",onClick:function(){return a()}},W.a.I18n.t("previousStep")),"  ",r.a.createElement("button",{type:"button","data-automation-id":"import-next-step",className:i,onClick:function(){t&&n()}},W.a.I18n.t("nextStep")))};cr.propTypes={canGoNext:u.a.bool.isRequired,onPreviousAction:u.a.func.isRequired,onNextAction:u.a.func.isRequired};var ur=cr,pr=function(e){function t(e){var a;return C()(this,t),(a=A()(this,j()(t).call(this,e))).state={subscribersAgreed:!1,sentOnceLastYear:!1,understand:!1},a}return O()(t,e),P()(t,[{key:"isFormValid",value:function(){return this.state.subscribersAgreed&&this.state.sentOnceLastYear&&this.state.understand}},{key:"render",value:function(){var e,t=this;return r.a.createElement("div",{className:"mailpoet_import_validation_step"},r.a.createElement("label",{htmlFor:"subscribers_agreed"},r.a.createElement("input",{type:"checkbox",checked:this.state.subscribersAgreed,onChange:function(e){return t.setState({subscribersAgreed:e.target.checked})},name:"subscribers_agreed",id:"subscribers_agreed","data-automation-id":"subscribers_agreed"}),W.a.I18n.t("subscribersAgreed")),r.a.createElement("p",{className:"description"},W.a.I18n.t("dontEmailSubscribers")," ",r.a.createElement("a",{href:"https://kb.mailpoet.com/article/127-checklist-before-importing-subscribers",target:"_blank",rel:"noreferrer noopener"},W.a.I18n.t("readSupportArticle"))),r.a.createElement("label",{htmlFor:"sent_once_last_year"},r.a.createElement("input",{type:"checkbox",checked:this.state.sentOnceLastYear,onChange:function(e){return t.setState({sentOnceLastYear:e.target.checked})},name:"sent_once_last_year",id:"sent_once_last_year","data-automation-id":"sent_once_last_year"}),W.a.I18n.t("sentOnceYear")),r.a.createElement("p",{className:"description"},W.a.I18n.t("emailAddressesWillBounce")),r.a.createElement("p",{className:"description"},(e=ft()(W.a.I18n.t("useServices"),"%1$s",function(){return r.a.createElement("a",{href:"https://www.briteverify.com",target:"_blank",rel:"noreferrer noopener",key:"BriteVerify"},"BriteVerify")}),e=ft()(e,"%2$s",function(){return r.a.createElement("a",{href:"https://www.datavalidation.com/",target:"_blank",rel:"noreferrer noopener",key:"DataValidation"},"DataValidation")}),e=ft()(e,"%3$s",function(){return r.a.createElement("a",{href:"https://neverbounce.com/",target:"_blank",rel:"noreferrer noopener",key:"NeverBounce"},"NeverBounce")}))),r.a.createElement("label",{htmlFor:"understand"},r.a.createElement("input",{type:"checkbox",checked:this.state.understand,onChange:function(e){return t.setState({understand:e.target.checked})},name:"understand",id:"understand","data-automation-id":"input_understand"}),W.a.I18n.t("youUnderstand")),r.a.createElement("p",{className:"description"},W.a.I18n.t("weWillSuspend")),r.a.createElement(ur,{canGoNext:this.isFormValid(),onPreviousAction:function(){return t.props.navigate("step_method_selection",{trigger:!0})},onNextAction:function(){return t.props.navigate("step_data_manipulation",{trigger:!0})}}))}}]),t}(n.Component);pr.propTypes={navigate:u.a.func.isRequired};var dr=pr;function mr(e){var t=e.subscribersCount,a=e.segments,n=e.initialMessage;if(t){var i=ft()(n,"%1$s",function(){return r.a.createElement("strong",{key:"%1$s"},t.toLocaleString())});return i=ft()(i,"%2$s",function(){return'"'.concat(a.join('", "'),'"')}),r.a.createElement("p",null,i)}return null}function hr(e){var t=e.createdSubscribers,a=e.updatedSubscribers;return t||a?null:r.a.createElement("p",null,W.a.I18n.t("importNoAction"))}function fr(e){return e.addedToSegmentWithWelcomeNotification?r.a.createElement("p",null,W.a.I18n.t("importNoWelcomeEmail")):null}function gr(e){var t=e.errors,a=e.createdSubscribers,n=e.updatedSubscribers,i=e.segments,s=e.addedToSegmentWithWelcomeNotification,o=e.navigate;return t.length&&W.a.Notice.error(ye.a.flatten(t)),r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:"updated"},r.a.createElement(mr,{subscribersCount:a,segments:i,initialMessage:W.a.I18n.t("subscribersCreated")}),r.a.createElement(mr,{subscribersCount:n,segments:i,initialMessage:W.a.I18n.t("subscribersUpdated")}),r.a.createElement(hr,{createdSubscribers:a,updatedSubscribers:n}),r.a.createElement(fr,{addedToSegmentWithWelcomeNotification:s})),r.a.createElement("button",{type:"button",className:"button-primary wysija",onClick:function(){return o("step_method_selection",{trigger:!0})}},W.a.I18n.t("importAgain")),"  ",r.a.createElement("button",{type:"button",className:"button-primary wysija",onClick:function(){window.location.href="admin.php?page=mailpoet-subscribers"}},W.a.I18n.t("viewSubscribers")))}mr.propTypes={segments:u.a.arrayOf(u.a.string.isRequired).isRequired,subscribersCount:u.a.number.isRequired,initialMessage:u.a.string.isRequired},hr.propTypes={createdSubscribers:u.a.number.isRequired,updatedSubscribers:u.a.number.isRequired},fr.propTypes={addedToSegmentWithWelcomeNotification:u.a.bool.isRequired},gr.propTypes={errors:u.a.arrayOf(u.a.string.isRequired),segments:u.a.arrayOf(u.a.string.isRequired).isRequired,createdSubscribers:u.a.number.isRequired,updatedSubscribers:u.a.number.isRequired,addedToSegmentWithWelcomeNotification:u.a.bool.isRequired,navigate:u.a.func.isRequired},gr.defaultProps={errors:[]};var _r=gr,vr=500;V()(document).ready(function(){if(V()("#mailpoet_subscribers_import").length){V()('input[name="select_method"]').attr("checked",!1);var e=new(wn.a.Router.extend({routes:{"":"home",step_method_selection:"step_method_selection",step_input_validation:"step_input_validation",step_data_manipulation:"step_data_manipulation",step_results:"step_results"},home:function(){this.navigate("step_method_selection",{trigger:!0})}}));e.on("route:step_method_selection",function(){if(window.mailpoetColumns=V.a.map(window.mailpoetColumns,function(e){var t=e;return t.validation_rule=!1,t}),void 0===window.importData.step_method_selection){var a=rr.a.compile(V()("#method_process_template").html());V()(".mailpoet_method_process").html(a());var n=V()(window.location.hash),r=V()("#select_method"),i=V()("#paste_input"),s=i.data("placeholder").replace(/\\n/g,"\n"),o=V()("#method_paste > div.mailpoet_method_process").find("a.mailpoet_process"),l=V()("#mailchimp_key"),c=V()("#mailchimp_key_verify"),u=V()("#mailchimp_lists"),p=V()("#method_mailchimp > div.mailpoet_method_process").find("a.mailpoet_process"),d=V()("#file_local"),m=V()("#method_file > div.mailpoet_method_process").find("a.mailpoet_process");r.change(function(){var e=V()(':radio[name="select_method"]'),t=e.index(e.filter(":checked"));W.a.Notice.hide(),n.find(".inside").children('div[id^="method_"]').hide(),n.find(".inside").children('div[id^="method_"]:eq('.concat(t,")")).show().find("table").show()}),t(),i.attr("value",s).css("color","#999").focus(function(e){V()(e.currentTarget).val()===s&&V()(e.currentTarget).attr("value","").css("color","#222")}).blur(function(e){""===V()(e.currentTarget).val()&&V()(e.currentTarget).attr("value",s).css("color","#999"),h(o,""!==e.currentTarget.value.trim()?"on":"off")}).keyup(function(e){h(o,""!==e.currentTarget.value.trim()?"on":"off")}),o.click(function(){var e=encodeURI(i.val()).split(/%..|./).length-1;W.a.Notice.hide(),e>window.maxPostSizeBytes?W.a.Notice.error(W.a.I18n.t("maxPostSizeNotice")):(W.a.Modal.loading(!0),setTimeout(function(){sr.a.parse(i.val(),f(!1))},10))}),d.change(function(e){var t=e.currentTarget.value.match(/[^.]+#x2F;);W.a.Notice.hide(),null!==t&&"csv"===t[0].toLowerCase()||(e.currentTarget.value.val(""),W.a.Notice.error(W.a.I18n.t("wrongFileFormat"))),h(m,""!==e.currentTarget.value.trim()?"on":"off")}),m.click(function(){""!==d.val().trim()&&(W.a.Modal.loading(!0),setTimeout(function(){d.parse({config:f(!0)})},10))}),l.keyup(function(e){""!==e.currentTarget.value.trim()&&/[a-zA-Z0-9]{32}-/.exec(e.currentTarget.value.trim())||(u.hide(),V()(".mailpoet_mailchimp-key-status").html("").removeClass("mailpoet_mailchimp-ok mailpoet_mailchimp-error"),h(p,"off"))}),c.click(function(){W.a.Modal.loading(!0),W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"importExport",action:"getMailChimpLists",data:{api_key:l.val()}}).always(function(){W.a.Modal.loading(!1)}).done(function(e){var t,a;V()(".mailpoet_mailchimp-key-status").html("").removeClass().addClass("mailpoet_mailchimp-key-status mailpoet_mailchimp-ok"),0===e.data.length?(V()(".mailpoet_mailchimp-key-status").html(W.a.I18n.t("noMailChimpLists")),u.hide(),h(p,"off")):(t=e.data,(a=u.find("select")).data("select2")?(a.select2("data",t),a.trigger("change")):a.select2({data:t,width:"20em",templateResult:function(e){return e.name},templateSelection:function(e){return e.name}}).change(function(e){null!==V()(e.currentTarget).val()?h(p,"on"):h(p,"off")}).trigger("change"),u.show())}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})})}),p.click(function(){p.closest("table a").hasClass("button-disabled")||(W.a.Modal.loading(!0),W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"importExport",action:"getMailChimpSubscribers",data:{api_key:l.val(),lists:u.find("select").val()}}).always(function(){W.a.Modal.loading(!1)}).done(function(t){window.importData.step_method_selection=t.data,W.a.trackEvent("Subscribers import started",{source:"MailChimp","MailPoet Free version":window.mailpoet_version}),e.navigate("step_data_manipulation",{trigger:!0})}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})}))})}else t();function h(e,t){"on"!==t?e.closest("table a").addClass("button-disabled"):e.closest("table a").removeClass("button-disabled")}function f(t){return{skipEmptyLines:!0,error:function(){W.a.Notice.hide(),W.a.Notice.error(W.a.I18n.t("dataProcessingError"))},complete:function(a){var n,r=lr(a.data);if(r)window.importData.step_method_selection=r,W.a.trackEvent("Subscribers import started",{source:t?"file upload":"pasted data","MailPoet Free version":window.mailpoet_version}),e.navigate(void 0===(n=window.importData.step_method_selection)?"step_data_manipulation":void 0===n.subscribersCount?"step_data_manipulation":n.subscribersCount<vr?"step_data_manipulation":"step_input_validation",{trigger:!0});else{W.a.Modal.loading(!1);var i=W.a.I18n.t("noValidRecords");i=(i=i.replace("[link]",W.a.I18n.t("csvKBLink"))).replace("[/link]","</a>"),W.a.Notice.error(i)}}}}}),e.on("route:step_input_validation",function(){if(void 0!==window.importData.step_method_selection){t();var a=document.getElementById("step_input_validation");a&&s.a.render(r.a.createElement(dr,{navigate:e.navigate,importData:window.importData.step_method_selection}),a)}else e.navigate("step_method_selection",{trigger:!0})}),e.on("route:step_data_manipulation",function(){var a,n,r;if(void 0!==window.importData.step_method_selection){var i=V()("#next_step"),s=V()("#return_to_previous"),o=V.a.extend(!0,{},window.importData.step_method_selection),l=rr.a.compile(V()("#subscribers_data_template").html()),c=rr.a.compile(V()("#subscribers_data_template_partial").html()),u=rr.a.compile(V()("#subscribers_data_parse_results_template").html()),p=V()("#mailpoet_segments_select"),d=Array.apply(void 0,oe()(new Array(o.subscribers[0].length))).map(String.prototype.valueOf,". . .");t(),V()("#subscribers_data_parse_results:visible").html(""),V()("#subscribers_data_import_results:visible").hide(),(o.invalid.length||o.duplicate.length)&&(r={},o.duplicate.forEach(function(e){r[e]=(r[e]||0)+1}),o.duplicate=[],Re()(r).forEach(function(e){r[e]>1?o.duplicate.push("".concat(e," (x").concat(r[e],")")):o.duplicate.push(e)}),n={notice:W.a.I18n.t("importNoticeSkipped").replace("%1$s","<strong>".concat(o.invalid.length+o.duplicate.length,"</strong>")),invalid:o.invalid.length?W.a.I18n.t("importNoticeInvalid").replace("%1$s","<strong>".concat(o.invalid.length.toLocaleString(),"</strong>")).replace("%2$s",o.invalid.join(", ")):null,duplicate:o.duplicate.length?W.a.I18n.t("importNoticeDuplicate").replace("%1$s","<strong>".concat(o.duplicate.length,"</strong>")).replace("%2$s",o.duplicate.join(", ")):null},V()("#subscribers_data_parse_results").html(u(n))),V()(".mailpoet_subscribers_data_parse_results_details_show").click(function(e){var t=V()(".mailpoet_subscribers_data_parse_results_details");V()(t).toggle(),e.currentTarget.text(V()(t).is(":visible")?W.a.I18n.t("hideDetails"):W.a.I18n.t("showDetails"))}),window.mailpoetSegments.length?V()(".mailpoet_segments").show():V()(".mailpoet_no_segments").show(),V()(".mailpoet_create_segment").click(function(){W.a.Modal.popup({title:W.a.I18n.t("addNewList"),template:V()("#new_segment_template").html()}),V()("#new_segment_name").keypress(function(e){13===e.which&&V()("#new_segment_process").click()}),V()("#new_segment_process").click(function(){var e=V()("#new_segment_name").val().trim(),t=V()("#new_segment_description").val().trim();W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"ImportExport",action:"addSegment",data:{name:e,description:t}}).done(function(e){var t;window.mailpoetSegments.push({id:e.data.id,name:e.data.name,subscriberCount:0}),null===(t=p.val())?t=[e.data.id]:t.push(e.data.id),h(window.mailpoetSegments),p.val(t).trigger("change"),V()(".mailpoet_segments:hidden").show(),V()(".mailpoet_no_segments:visible").hide(),W.a.Modal.close()}).fail(function(e){e.errors.length>0&&(W.a.Notice.hide(),W.a.Notice.error(e.errors.map(function(e){return e.message}),{positionAfter:"#new_segment_name"}))})}),V()("#new_segment_cancel").click(function(){W.a.Modal.close()})}),rr.a.registerPartial("subscribers_data_template_partial",c),rr.a.registerHelper("show_and_match_columns",function(e,t){var a,n,r,i,s=[],o=[];return Re()(e.subscribers[0]).forEach(function(t){a=e.subscribers[0][t],n="ignore",a%1!=0&&window.mailpoet_email_regex.test(a)?n="email":e.header&&(r=e.header[t],-1!==(i=window.mailpoetColumns.map(function(e){return e.name}).indexOf(r))?n=window.mailpoetColumns[i].id:r&&(/first|first name|given name/i.test(r)?n="first_name":/last|last name/i.test(r)&&(n="last_name"))),n="ignore"!==n&&-1===o.indexOf(n)?n:"ignore",s[t]={column_id:n},o.push(n)}),t.fn(s)}),rr.a.registerHelper("sanitize_data",function(e){return e instanceof rr.a.SafeString?e:new rr.a.SafeString(rr.a.Utils.escapeExpression(e))}),rr.a.registerHelper("calculate_index",function(e){var t=Te()(e,10);return 10===t&&o.subscribersCount>11?(a=t,". . ."):t===o.subscribers.length-1?o.subscribersCount.toLocaleString():t+1}),o.subscribersCount>11&&o.subscribers.splice(10,o.subscribersCount-11,d),V()("#subscribers_data > table").html(l(o)),V()("select.mailpoet_subscribers_column_data_match").select2({data:window.mailpoetColumnsSelect2,width:"15em",templateResult:function(e){return e.name},templateSelection:function(e){return e.name}}).on("select2:selecting",function(e){var t=e.currentTarget,a=e.params.args.data.id;"create"===a?(e.preventDefault(),V()(t).select2("close"),W.a.Modal.popup({title:W.a.I18n.t("addNewField"),template:V()("#form_template_field_form").html()}),V()("#form_field_new").parsley().on("form:submit",function(){var e=V()("#form_field_new").mailpoetSerializeObject();return W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"customFields",action:"save",data:e}).done(function(e){var a={id:e.data.id,name:e.data.name,type:e.data.type,params:e.data.params,custom:!0};2===window.mailpoetColumnsSelect2.length&&window.mailpoetColumnsSelect2.push({name:W.a.I18n.t("userColumns"),children:[]}),window.mailpoetColumnsSelect2[2].children.push(a),window.mailpoetColumns.push(a),V()("select.mailpoet_subscribers_column_data_match").each(function(){V()(t).html("").select2("destroy").select2({data:window.mailpoetColumnsSelect2,width:"15em",templateResult:function(e){return e.name},templateSelection:function(e){return e.name}})}),V()(t).data("column-id",a.id),V()(t).data("validation-rule",!1),f(),W.a.Modal.close()}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{positionAfter:"#field_name"})}),!1})):V()("select.mailpoet_subscribers_column_data_match").each(function(){var n=t,r=V()(n).val();r===a&&"ignore"!==r&&(confirm("".concat(W.a.I18n.t("selectedValueAlreadyMatched")," ").concat(W.a.I18n.t("confirmCorrespondingColumn")))?V()(n).data("column-id","ignore"):(e.preventDefault(),V()(t).select2("close")))})}).on("select2:select",function(e){var t=e.currentTarget,a=e.params.data.id;V()(t).data("column-id",a),f()}),s.off().on("click",function(){var t;e.navigate(void 0===(t=window.importData.step_method_selection)?"step_method_selection":void 0===t.subscribersCount?"step_method_selection":t.subscribersCount<vr?"step_method_selection":"step_input_validation",{trigger:!0})}),i.off().on("click",function(t){var a={},n=new V.a.AsyncQueue,r=0,i=ar()()/1e3,s={created:0,updated:0,errors:[],segments:[]};if(!V()(t.currentTarget).hasClass("button-disabled")){W.a.Modal.loading(!0);var o,l,c=(o=window.importData.step_method_selection.subscribers,l=2e3,o.reduce(function(e,t,a){return a%l==0&&e.push([]),e[e.length-1].push(t),e},[]));ye.a.each(V()("select.mailpoet_subscribers_column_data_match"),function(e,t){var n=V()(e).data("column-id"),r=V()(e).data("validation-rule");"ignore"!==n&&(a[n]={index:t,validation_rule:r})}),ye.a.each(c,function(){n.add(function(e){e.pause(),W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"ImportExport",action:"processImport",data:He()({columns:a,subscribers:c[r],timestamp:i,segments:p.val(),updateSubscribers:"yes"===V()(':radio[name="subscriber_update_option"]:checked').val()})}).done(function(t){var a=t.data.added_to_segment_with_welcome_notification;s.created+=t.data.created,s.updated+=t.data.updated,s.segments=t.data.segments,s.added_to_segment_with_welcome_notification=a,e.run()}).fail(function(e){W.a.Modal.loading(!1),e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})}),r+=1})}),n.run(),n.onComplete(function(){W.a.Modal.loading(!1),s.errors.length>0&&!s.updated&&!s.created?W.a.Notice.error(ye.a.flatten(s.errors)):(window.mailpoetSegments=s.segments,s.segments=ye.a.map(p.select2("data"),function(e){return e.name}),window.importData.step_data_manipulation=s,h(window.mailpoetSegments),e.navigate("step_results",{trigger:!0}))})}}),f(),h(window.mailpoetSegments)}else e.navigate("step_method_selection",{trigger:!0});function m(e){"on"!==e?i.addClass("button-disabled"):i.removeClass("button-disabled")}function h(e){p.data("select2")&&(p.html("").select2("destroy"),m("off")),p.select2({data:e,width:"20em",templateResult:function(e){var t=e;return t.subscriberCount=Te()(t.subscriberCount,10),"".concat(t.name," (").concat(t.subscriberCount.toLocaleString(),")")},templateSelection:function(e){var t=e;return t.subscriberCount=Te()(t.subscriberCount,10),"".concat(t.name," (").concat(t.subscriberCount.toLocaleString(),")")}}).change(function(e){var t=V()('[data-id="notice_segmentSelection"]');e.currentTarget.value?(V()('[data-id="notice_segmentSelection"]').remove(),V()(".mailpoet_notice.error:visible").length||m("on")):(t.length||W.a.Notice.error(W.a.I18n.t("segmentSelectionRequired"),{static:!0,scroll:!0,id:"notice_segmentSelection",hideClose:!0}),m("off"))})}function f(){var e=V.a.extend(!0,{},o),t=!1;V()('[data-id="notice_invalidEmail"], [data-id="notice_invalidDate"]').remove();var n=V.a.map(V()(".mailpoet_subscribers_column_data_match"),function(e,t){var a=V()(e).data("column-id"),n=V()(e).data("validation-rule");return V()(e).val(a).trigger("change"),{id:a,index:t,validationRule:n,element:e}});V.a.map(window.mailpoetColumns,function(r){var i,s,o,l,c=ye.a.find(n,function(e){return e.id===r.id});"email"===r.id&&(window.mailpoet_email_regex.test(e.subscribers[0][c.index])?W.a.Notice.hide("invalidEmail"):(t=!0,V()('[data-id="notice_invalidEmail"]').length||W.a.Notice.error(W.a.I18n.t("columnContainsInvalidElement"),{static:!0,scroll:!0,hideClose:!0,id:"invalidEmail"}))),"date"===r.type&&c&&(l=[mt.a.ISO_8601,"YYYY/MM/DD","MM/DD/YYYY","DD/MM/YYYY","YYYY/MM/DD","YYYY/DD/MM","MM/YYYY","YYYY/MM","YYYY"],i=e.subscribers[0][c.index],s=!1,""===i.trim()?(e.subscribers[0][c.index]='<span class="mailpoet_data_match mailpoet_import_error" title="'.concat(W.a.I18n.t("noDateFieldMatch"),'">').concat(W.a.I18n.t("emptyFirstRowDate"),"</span> "),t=!0):Re()(l).forEach(function(e){if(o=l[e],mt()(i,o,!0).isValid())return s="function"==typeof o?"datetime":o,void V()(c.element).data("validation-rule",s);"datetime"===s&&(s=mt.a.ISO_8601)}),V.a.map(e.subscribers,function(e,n){var r=e,i=r[c.index],s=mt()(i,o,!0);n!==a&&""!==i.trim()&&(s.isValid()?r[c.index]=new rr.a.SafeString("".concat(rr.a.Utils.escapeExpression(r[c.index]),'<span class="mailpoet_data_match" title="').concat(W.a.I18n.t("verifyDateMatch"),'">').concat(W.a.Date.format(s),"</span> ")):(r[c.index]=new rr.a.SafeString("".concat(rr.a.Utils.escapeExpression(r[c.index]),'<span class="mailpoet_data_match mailpoet_import_error" title="').concat(W.a.I18n.t("noDateFieldMatch"),'">').concat(new rr.a.SafeString(W.a.I18n.t("dateMatchError")),"</span> ")),t=!0))}),t&&!V()(".mailpoet_invalidDate").length&&W.a.Notice.error(W.a.I18n.t("columnContainsInvalidDate"),{static:!0,scroll:!0,hideClose:!0,id:"invalidDate"}))}),V()("#subscribers_data > table > tbody").html(c(e)),t?m("off"):!V()(".mailpoet_notice.error:visible").length&&p.val()&&m("on")}}),e.on("route:step_results",function(){if(void 0!==window.importData.step_data_manipulation){t(),W.a.trackEvent("Subscribers import finished",{"Subscribers created":window.importData.step_data_manipulation.created,"Subscribers updated":window.importData.step_data_manipulation.updated,"MailPoet Free version":window.mailpoet_version});var a=document.getElementById("step_results");a&&s.a.render(r.a.createElement(_r,{navigate:e.navigate,errors:window.importData.step_data_manipulation.errors,createdSubscribers:window.importData.step_data_manipulation.created,updatedSubscribers:window.importData.step_data_manipulation.updated,segments:window.importData.step_data_manipulation.segments,addedToSegmentWithWelcomeNotification:window.importData.step_data_manipulation.added_to_segment_with_welcome_notification}),a),window.importData.step_method_selection=void 0,window.importData.step_data_manipulation=void 0}else e.navigate("step_data_manipulation",{trigger:!0})}),wn.a.History.started||wn.a.history.start()}function t(){W.a.Notice.hide(),W.a.Modal.loading(!1),V()('#mailpoet_subscribers_import > div[id^="step"]').hide(),V()(window.location.hash).show()}}),V()(document).ready(function(){var e,t,a,n,r;function i(e){"on"===e?a.removeClass("button-disabled"):a.addClass("button-disabled")}V()("#mailpoet_subscribers_export").length&&window.exportData.segments&&(r=rr.a.compile(V()("#mailpoet_subscribers_export_template").html()),V()("#mailpoet_subscribers_export > div.inside").html(r(window.exportData)),e=V()("#export_lists"),t=V()("#export_columns"),a=V()("a.mailpoet_export_process"),n=function(a,n){a.data("select2")&&a.html("").select2("destroy"),a.select2({data:n,width:"20em",templateResult:function(e){return e.subscriberCount>0?e.name+" ("+Te()(e.subscriberCount,10).toLocaleString()+")":e.name},templateSelection:function(e){return e.subscriberCount>0?e.name+" ("+Te()(e.subscriberCount,10).toLocaleString()+")":e.name}}).on("select2:selecting",function(e){var t,n=e.params.args.data.id,r=["select","deselect"];ye.a.contains(r,n)&&(e.preventDefault(),"deselect"===n?V()(this).val("").trigger("change"):(t=[],ye.a.each(a.find("option"),function(e){ye.a.contains(r,e.value)||t.push(e.value)}),V()(this).val(t).trigger("change")),V()(this).select2("close"))}).on("change",function(){window.exportData.segments&&e.select2("data").length&&t.select2("data").length||!window.exportData.segments&&t.select2("data").length?i("on"):i("off")})},window.segments.forEach(function(t){e.append(V()("<option></option>").attr("value",t.id).text(t.name))}),n(e,window.segments),n(t,window.subscriberFieldsSelect2),t.val(["email","first_name","last_name","list_status","global_status"]).trigger("change"),a.click(function(){var a;V()(this).hasClass("button-disabled")||(W.a.Modal.loading(!0),a=V()(':radio[name="option_format"]:checked').val(),W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"ImportExport",action:"processExport",data:He()({export_format_option:a,segments:!!window.exportData.segments&&e.val(),subscriber_fields:t.val()})}).always(function(){W.a.Modal.loading(!1)}).done(function(e){var t=W.a.I18n.t("exportMessage").replace("%1$s","<strong>"+Te()(e.data.totalExported,10).toLocaleString()+"</strong>").replace("[link]",'<a href="'+e.data.exportFileURL+'" target="_blank" >').replace("[/link]","</a>");V()("#export_result_notice").html("<p>"+t+"</p>").show(),window.location.href=e.data.exportFileURL,W.a.trackEvent("Subscribers export completed",{"Total exported":e.data.totalExported,"File Format":a,"MailPoet Free version":window.mailpoet_version})}).fail(function(e){e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})}))}))});var br=a(394),yr=a.n(br),wr=function(e){return e.step>e.steps_count?null:r.a.createElement("div",{className:"mailpoet_stepped_progress_bar"},oe()(Array(e.steps_count).keys()).map(function(t){return r.a.createElement("div",{className:"mailpoet_stepped_progress_bar_step ".concat(t<e.step?"active":""),key:"step_".concat(t),style:{width:"".concat(Math.floor(100/e.steps_count),"%")}})}))};wr.propTypes={steps_count:u.a.number.isRequired,step:u.a.number.isRequired};var Er=wr,kr=function(e){return r.a.createElement("div",{className:"mailpoet_welcome_wizard_centered_column mailpoet_welcome_wizard_header"},r.a.createElement("img",{src:e.logo_src,width:"200",height:"87",alt:"MailPoet logo"}),e.current_step<=e.steps_count?r.a.createElement(Er,{steps_count:e.steps_count,step:e.current_step}):null)};kr.propTypes={current_step:u.a.number.isRequired,steps_count:u.a.number.isRequired,logo_src:u.a.string.isRequired};var Ir=kr,Sr=function(e){return r.a.createElement("div",{className:"mailpoet_welcome_wizard_step_content mailpoet_welcome_wizard_centered_column"},r.a.createElement("h1",null,W.a.I18n.t("welcomeWizardLetsStartTitle")),r.a.createElement("p",null,W.a.I18n.t("welcomeWizardSenderText")),r.a.createElement("form",{id:"mailpoet_sender_form",className:"mailpoet_welcome_wizard_centered_column ".concat(e.loading?"mailpoet_sender_form_loading":""),onSubmit:function(t){t.preventDefault(),V()("#mailpoet_sender_form").parsley().validate()&&e.submit_sender()}},r.a.createElement("label",{htmlFor:"senderName"},W.a.I18n.t("senderName"),":",r.a.createElement("input",{name:"senderName",type:"text",placeholder:"John Doe",value:e.sender?e.sender.name:"","data-parsley-required":!0,onChange:function(t){return e.update_sender({name:t.target.value})}})),r.a.createElement("label",{htmlFor:"senderAddress"},W.a.I18n.t("senderAddress"),":",r.a.createElement("input",{name:"senderAddress",type:"text",placeholder:"john@doe.com",value:e.sender?e.sender.address:"","data-parsley-required":!0,"data-parsley-type":"email",onChange:function(t){return e.update_sender({address:t.target.value})}})),r.a.createElement("input",{className:"button button-primary",type:"submit",value:W.a.I18n.t("next")}),r.a.createElement("a",{onClick:e.finish,href:"#finish",className:"sender_form_small"},W.a.I18n.t("noThanksSkip"))))};Sr.propTypes={finish:u.a.func.isRequired,loading:u.a.bool.isRequired,update_sender:u.a.func.isRequired,submit_sender:u.a.func.isRequired,sender:u.a.shape({name:u.a.string,address:u.a.string})},Sr.defaultProps={sender:null};var Nr=Sr,xr=function(e){return r.a.createElement("div",{className:"mailpoet_welcome_wizard_step_content mailpoet_welcome_wizard_centered_column"},r.a.createElement("h1",null,W.a.I18n.t("welcomeWizardLetsStartTitle")),r.a.createElement("p",null,W.a.I18n.t("welcomeWizardSenderMigratedUserText")),r.a.createElement("div",{className:"mailpoet_welcome_wizard_step_controls"},r.a.createElement("button",{type:"button",className:"button button-primary",onClick:e.next},W.a.I18n.t("next"))))};xr.propTypes={next:u.a.func.isRequired};var Cr=xr,Tr=function(e){return r.a.createElement("div",{className:"mailpoet_welcome_wizard_step_content mailpoet_welcome_wizard_centered_column"},r.a.createElement("h1",null,W.a.I18n.t("welcomeWizardEmailCourseTitle")),r.a.createElement("p",null,W.a.I18n.t("welcomeWizardEmailCourseText")),r.a.createElement("div",{className:"mailpoet_welcome_wizard_course_form_box"},r.a.createElement("img",{src:e.illustration_url,alt:"",width:"155",height:"155"}),r.a.createElement("iframe",{id:"mailpoet_form_iframe",width:"100%",scrolling:"no",frameBorder:"0",title:"Apply to course",src:"https://newsletters.mailpoet.com?mailpoet_form_iframe=13",className:"mailpoet_form_iframe",marginWidth:"0",marginHeight:"0"})),r.a.createElement("button",{type:"button",className:"button button-primary",onClick:e.next},W.a.I18n.t("next")))};Tr.propTypes={next:u.a.func.isRequired,illustration_url:u.a.string.isRequired};var Pr=Tr,Rr=function(e){return r.a.createElement("div",{className:"mailpoet_welcome_wizard_step_content mailpoet_welcome_wizard_centered_column"},r.a.createElement("h1",null,W.a.I18n.t("welcomeWizardUsageTrackingStepTitle")),r.a.createElement("p",null,W.a.I18n.t("welcomeWizardTrackingText")),r.a.createElement("h2",{className:"welcome_wizard_tracking_sub_title"},W.a.I18n.t("welcomeWizardUsageTrackingStepSubTitle")),r.a.createElement("ul",{className:"welcome_wizard_tracking_list"},r.a.createElement("li",null,W.a.I18n.t("welcomeWizardTrackingList1")),r.a.createElement("li",null,W.a.I18n.t("welcomeWizardTrackingList2")),r.a.createElement("li",null,W.a.I18n.t("welcomeWizardTrackingList3")),r.a.createElement("li",null,W.a.I18n.t("welcomeWizardTrackingList4")),r.a.createElement("li",null,W.a.I18n.t("welcomeWizardTrackingList5"))),r.a.createElement("a",{href:" https://kb.mailpoet.com/article/130-sharing-your-data-with-us",target:"_blank",rel:"noopener noreferrer"},W.a.I18n.t("welcomeWizardTrackingLink")),r.a.createElement("div",{className:"mailpoet_welcome_wizard_step_controls\n ".concat(e.loading?"mailpoet_welcome_wizard_step_controls_loading":"")},r.a.createElement("button",{type:"button",className:"button",onClick:e.skip_action,disabled:e.loading},W.a.I18n.t("skip")),r.a.createElement("button",{type:"button",className:"button button-primary",onClick:e.allow_action,disabled:e.loading},e.allow_text)))};Rr.propTypes={allow_action:u.a.func.isRequired,allow_text:u.a.string.isRequired,skip_action:u.a.func.isRequired,loading:u.a.bool.isRequired};var Ar=Rr,Dr=function(e){return r.a.createElement("div",{className:"mailpoet_welcome_wizard_step_content mailpoet_welcome_wizard_centered_column"},r.a.createElement("h1",null,W.a.I18n.t("welcomeWizardWooCommerceStepTitle")),r.a.createElement("p",null,W.a.I18n.t("welcomeWizardHelpingShopOwnersText")),r.a.createElement("p",null,W.a.I18n.t("welcomeWizardWooCommerceEmailsText")),r.a.createElement("img",{src:e.screenshot_src,className:"mailpoet_welcome_wizard_woo_screenshot",alt:"WooCommerce email"}),r.a.createElement("div",{className:"mailpoet_welcome_wizard_step_controls\n ".concat(e.loading?"mailpoet_welcome_wizard_step_controls_loading":"")},r.a.createElement("button",{type:"button",className:"button button-primary",onClick:e.next,disabled:e.loading},W.a.I18n.t("gotIt"))))};Dr.propTypes={next:u.a.func.isRequired,screenshot_src:u.a.string.isRequired,loading:u.a.bool.isRequired};var jr=Dr,Lr=function(e){var t=e.name,a=e.address,n=a.split("@").pop().toLowerCase();return window.mailpoet_free_domains.indexOf(n)>-1?function(e){var t=e.name,a=e.address,n=window.location.hostname.replace("www.",""),r="wordpress@".concat(n);return{sender:{name:t,address:r},reply_to:{name:t,address:a},"signup_confirmation.from.address":r,"signup_confirmation.from.name":t,"signup_confirmation.reply_to.address":a,"signup_confirmation.reply_to.name":t}}({name:t,address:a}):function(e){var t=e.name,a=e.address;return{sender:{name:t,address:a},reply_to:{name:t,address:a},"signup_confirmation.from.address":a,"signup_confirmation.from.name":t,"signup_confirmation.reply_to.address":a,"signup_confirmation.reply_to.name":t}}({name:t,address:a})},Or=function(e){var t=window.is_woocommerce_active?4:3,a=!window.is_mp2_migration_complete,i=Te()(e.match.params.step,10),s=Object(n.useState)(!1),o=at()(s,2),l=o[0],c=o[1],u=Object(n.useState)(window.sender_data),p=at()(u,2),d=p[0],m=p[1];function h(){c(!0),window.location=window.finish_wizard_url}function f(){4===t?e.history.push("/steps/4"):h()}function g(e){return c(!0),W.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"settings",action:"set",data:e}).then(function(){return c(!1)}).fail(function(e){c(!1),e.errors.length>0&&W.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})})}return Object(n.useEffect)(function(){(i>t||i<1)&&e.history.push("/steps/1")},[i,t,e.history]),r.a.createElement("div",{className:"mailpoet_welcome_wizard_steps mailpoet_welcome_wizard_centered_column"},r.a.createElement(Ir,{current_step:i,steps_count:t,logo_src:window.mailpoet_logo_url}),1===i&&a?r.a.createElement(Nr,{update_sender:function(e){m(yr()({},d,e))},submit_sender:function(){g(Lr(d)).then(function(){return e.history.push("/steps/2")})},finish:function(){c(!0),g(Lr({address:window.admin_email,name:""})).then(h)},loading:l,sender:d}):null,1!==i||a?null:r.a.createElement(Cr,{next:function(){return e.history.push("/steps/2")}}),2===i?r.a.createElement(Pr,{next:function(){return e.history.push("/steps/3")},illustration_url:window.email_course_illustration}):null,3===i?r.a.createElement(Ar,{skip_action:f,allow_action:function(){g({analytics:{enabled:!0}}).then(function(){return f()})},allow_text:4===t?W.a.I18n.t("allowAndContinue"):W.a.I18n.t("allowAndFinish"),loading:l}):null,4===i?r.a.createElement(jr,{next:h,screenshot_src:window.woocommerce_screenshot_url,loading:l}):null)};Or.propTypes={match:u.a.shape({params:u.a.shape({step:u.a.string}).isRequired}).isRequired,history:u.a.shape({push:u.a.func.isRequired}).isRequired};var Mr=Or,qr=document.getElementById("welcome_wizard_container");qr&&s.a.render(r.a.createElement(E,null,r.a.createElement("div",null,r.a.createElement(N,{exact:!0,path:"/",render:function(){return r.a.createElement(ge,{to:"/steps/1"})}}),r.a.createElement(N,{path:"/steps/:step",component:Mr}))),qr)},67:function(e,t,a){var n=a(464),r=a(465),i=a(473);e.exports=function(e){return n(e)||r(e)||i()}}},[[506,0,1]]]);
assets/dist/js/{admin_vendor.1ea54d89.chunk.js → admin_vendor.64becc03.chunk.js} RENAMED
File without changes
assets/dist/js/{admin_vendor_chunk.1ea54d89.chunk.js → admin_vendor_chunk.64becc03.chunk.js} RENAMED
File without changes
assets/dist/js/{form_editor.1ea54d89.chunk.js → form_editor.64becc03.chunk.js} RENAMED
File without changes
assets/dist/js/{mailpoet.1ea54d89.chunk.js → mailpoet.64becc03.chunk.js} RENAMED
File without changes
assets/dist/js/manifest.json CHANGED
@@ -1,11 +1,11 @@
1
{
2
"mp2migrator.js": "mp2migrator.65e1b491.js",
3
"public.js": "public.70d9ace1.js",
4
- "vendor.js": "vendor.1ea54d89.js",
5
- "admin_vendor_chunk.js": "admin_vendor_chunk.1ea54d89.chunk.js",
6
- "admin.js": "admin.1ea54d89.chunk.js",
7
- "admin_vendor.js": "admin_vendor.1ea54d89.chunk.js",
8
- "form_editor.js": "form_editor.1ea54d89.chunk.js",
9
- "mailpoet.js": "mailpoet.1ea54d89.chunk.js",
10
- "newsletter_editor.js": "newsletter_editor.1ea54d89.chunk.js"
11
}
1
{
2
"mp2migrator.js": "mp2migrator.65e1b491.js",
3
"public.js": "public.70d9ace1.js",
4
+ "vendor.js": "vendor.64becc03.js",
5
+ "admin_vendor_chunk.js": "admin_vendor_chunk.64becc03.chunk.js",
6
+ "admin.js": "admin.64becc03.chunk.js",
7
+ "admin_vendor.js": "admin_vendor.64becc03.chunk.js",
8
+ "form_editor.js": "form_editor.64becc03.chunk.js",
9
+ "mailpoet.js": "mailpoet.64becc03.chunk.js",
10
+ "newsletter_editor.js": "newsletter_editor.64becc03.chunk.js"
11
}
assets/dist/js/newsletter_editor.1ea54d89.chunk.js DELETED
@@ -1,8 +0,0 @@
1
- (window.mailpoetJsonp=window.mailpoetJsonp||[]).push([[6,3],{13:function(e,t,i){e.exports=function(e,t,i){"use strict";e="default"in e?e.default:e,t="default"in t?t.default:t,i="default"in i?i.default:i;var o=function(e){return function(t){for(var i=arguments.length,o=Array(i>1?i-1:0),n=1;n<i;n++)o[n-1]=arguments[n];return e.apply(t,o)}},n=e.Model.extend,s=function e(i,o){t.isObject(i)&&(i=i.prev+" is going to be removed in the future. Please use "+i.next+" instead."+(i.url?" See: "+i.url:"")),Se.DEV_MODE&&(void 0!==o&&o||e._cache[i]||(e._warn("Deprecation warning: "+i),e._cache[i]=!0))};s._console="undefined"!=typeof console?console:{},s._warn=function(){var e=s._console.warn||s._console.log||t.noop;return e.apply(s._console,arguments)},s._cache={};var r=function(e){return document.documentElement.contains(e&&e.parentNode)},a=function(e,i){var o=this;e&&t.each(i,function(t){var i=e[t];void 0!==i&&(o[t]=i)})},l=function(e){if(e)return this.options&&void 0!==this.options[e]?this.options[e]:this[e]},c=function(e){var i=this;return t.reduce(e,function(e,o,n){return t.isFunction(o)||(o=i[o]),o&&(e[n]=o),e},{})},d=/(^|:)(\w)/gi;function h(e,t,i){return i.toUpperCase()}var p=t.memoize(function(e){return"on"+e.replace(d,h)});function u(e){for(var i=arguments.length,o=Array(i>1?i-1:0),n=1;n<i;n++)o[n-1]=arguments[n];var s=p(e),r=l.call(this,s),a=void 0;return t.isFunction(r)&&(a=r.apply(this,o)),this.trigger.apply(this,arguments),a}function g(e){for(var i=arguments.length,o=Array(i>1?i-1:0),n=1;n<i;n++)o[n-1]=arguments[n];return t.isFunction(e.triggerMethod)?e.triggerMethod.apply(e,o):u.apply(e,o)}function f(e,i,o){e._getImmediateChildren&&t.each(e._getImmediateChildren(),function(e){o(e)&&g(e,i,e)})}function m(e){return!e._isAttached}function _(e){return!!m(e)&&(e._isAttached=!0,!0)}function v(e){return e._isAttached}function w(e){return!!v(e)&&(e._isAttached=!1,!0)}function y(e){e._isAttached&&e._isRendered&&g(e,"dom:refresh",e)}function b(){f(this,"before:attach",m)}function x(){f(this,"attach",_),y(this)}function k(){f(this,"before:detach",v)}function C(){f(this,"detach",w)}function S(){y(this)}function V(e){e._areViewEventsMonitored||(e._areViewEventsMonitored=!0,e.on({"before:attach":b,attach:x,"before:detach":k,detach:C,render:S}))}var T=["description","fileName","lineNumber","name","message","number"],B=n.call(Error,{urlRoot:"http://marionettejs.com/docs/v3.2.0/",constructor:function(e,i){t.isObject(e)?e=(i=e).message:i||(i={});var o=Error.call(this,e);t.extend(this,t.pick(o,T),t.pick(i,T)),this.captureStackTrace(),i.url&&(this.url=this.urlRoot+i.url)},captureStackTrace:function(){Error.captureStackTrace&&Error.captureStackTrace(this,B)},toString:function(){return this.name+": "+this.message+(this.url?" See: "+this.url:"")}});function E(e,i,o,n){if(i&&o){if(!t.isObject(o))throw new B({message:"Bindings must be an object.",url:"marionette.functions.html#marionettebindevents"});t.each(o,function(o,s){t.isString(o)?function(e,i,o,n,s){var r=n.split(/\s+/);t.each(r,function(t){var n=e[t];if(!n)throw new B('Method "'+t+'" was configured as an event handler, but does not exist.');e[s](i,o,n)})}(e,i,s,o,n):e[n](i,s,o)})}}function P(e,t){return E(this,e,t,"listenTo"),this}function M(e,t){return E(this,e,t,"stopListening"),this}function A(e,i,o,n){if(i&&o){if(!t.isObject(o))throw new B({message:"Bindings must be an object.",url:"marionette.functions.html#marionettebindrequests"});var s=c.call(e,o);i[n](s,e)}}function D(e,t){return A(this,e,t,"reply"),this}function R(e,t){return A(this,e,t,"stopReplying"),this}B.extend=n;var F={normalizeMethods:c,_setOptions:function(){for(var e=arguments.length,i=Array(e),o=0;o<e;o++)i[o]=arguments[o];this.options=t.extend.apply(t,[{},t.result(this,"options")].concat(i))},mergeOptions:a,getOption:l,bindEvents:P,unbindEvents:M},O={_initRadio:function(){var e=t.result(this,"channelName");if(e){if(!i)throw new B({name:"BackboneRadioMissing",message:'The dependency "backbone.radio" is missing.'});var o=this._channel=i.channel(e),n=t.result(this,"radioEvents");this.bindEvents(o,n);var s=t.result(this,"radioRequests");this.bindRequests(o,s),this.on("destroy",this._destroyRadio)}},_destroyRadio:function(){this._channel.stopReplying(null,null,this)},getChannel:function(){return this._channel},bindEvents:P,unbindEvents:M,bindRequests:D,unbindRequests:R},z=["channelName","radioEvents","radioRequests"],I=function(e){this._setOptions(e),this.mergeOptions(e,z),this.cid=t.uniqueId(this.cidPrefix),this._initRadio(),this.initialize.apply(this,arguments)};I.extend=n,t.extend(I.prototype,e.Events,F,O,{cidPrefix:"mno",_isDestroyed:!1,isDestroyed:function(){return this._isDestroyed},initialize:function(){},destroy:function(){if(this._isDestroyed)return this;for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];return this.triggerMethod.apply(this,["before:destroy",this].concat(t)),this._isDestroyed=!0,this.triggerMethod.apply(this,["destroy",this].concat(t)),this.stopListening(),this},triggerMethod:u});var N={createBuffer:function(){return document.createDocumentFragment()},appendChildren:function(t,i){e.$(t).append(i)},beforeEl:function(t,i){e.$(t).before(i)},replaceEl:function(e,t){if(e!==t){var i=t.parentNode;i&&i.replaceChild(e,t)}},detachContents:function(t){e.$(t).contents().detach()},setInnerContent:function(t,i){e.$(t).html(i)},removeEl:function(t){e.$(t).remove()},findEls:function(t,i){return e.$(t,i)}},$=function(e){this.templateId=e};t.extend($,{templateCaches:{},get:function(e,t){var i=this.templateCaches[e];return i||(i=new $(e),this.templateCaches[e]=i),i.load(t)},clear:function(){for(var e=void 0,t=arguments.length,i=Array(t),o=0;o<t;o++)i[o]=arguments[o];var n=i.length;if(n>0)for(e=0;e<n;e++)delete this.templateCaches[i[e]];else this.templateCaches={}}}),t.extend($.prototype,N,{load:function(e){if(this.compiledTemplate)return this.compiledTemplate;var t=this.loadTemplate(this.templateId,e);return this.compiledTemplate=this.compileTemplate(t,e),this.compiledTemplate},loadTemplate:function(e,t){var i=this.findEls(e);if(!i.length)throw new B({name:"NoTemplateError",message:'Could not find template: "'+e+'"'});return i.html()},compileTemplate:function(e,i){return t.template(e,i)}});var L=t.invokeMap||t.invoke;function W(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t<e.length;t++)i[t]=e[t];return i}return Array.from(e)}function H(e,i){return t.chain(i).map(function(i,o){var n=function(e,i){return e.behaviorClass?e.behaviorClass:t.isFunction(e)?e:t.isFunction(Se.Behaviors.behaviorsLookup)?Se.Behaviors.behaviorsLookup(e,i)[i]:Se.Behaviors.behaviorsLookup[i]}(i,o),s=i===n?{}:i,r=new n(s,e),a=H(e,t.result(r,"behaviors"));return[r].concat(a)}).flatten().value()}var j={_initBehaviors:function(){this._behaviors=this._getBehaviors()},_getBehaviors:function(){var e=t.result(this,"behaviors");return t.isObject(e)?H(this,e):{}},_getBehaviorTriggers:function(){var e=L(this._behaviors,"getTriggers");return t.extend.apply(t,[{}].concat(W(e)))},_getBehaviorEvents:function(){var e=L(this._behaviors,"getEvents");return t.extend.apply(t,[{}].concat(W(e)))},_proxyBehaviorViewProperties:function(){L(this._behaviors,"proxyViewProperties")},_delegateBehaviorEntityEvents:function(){L(this._behaviors,"delegateEntityEvents")},_undelegateBehaviorEntityEvents:function(){L(this._behaviors,"undelegateEntityEvents")},_destroyBehaviors:function(e){L.apply(void 0,[this._behaviors,"destroy"].concat(W(e)))},_bindBehaviorUIElements:function(){L(this._behaviors,"bindUIElements")},_unbindBehaviorUIElements:function(){L(this._behaviors,"unbindUIElements")},_triggerEventOnBehaviors:function(){for(var e=this._behaviors,t=0,i=e&&e.length;t<i;t++)u.apply(e[t],arguments)}},U={_delegateEntityEvents:function(e,i){this._undelegateEntityEvents(e,i);var o=t.result(this,"modelEvents");P.call(this,e,o);var n=t.result(this,"collectionEvents");P.call(this,i,n)},_undelegateEntityEvents:function(e,i){var o=t.result(this,"modelEvents");M.call(this,e,o);var n=t.result(this,"collectionEvents");M.call(this,i,n)}},q=/^(\S+)\s*(.*)#x2F;,Y=function(e){var i=e.match(q);return function(e,i){return[e+t.uniqueId(".evt"),i].join(" ")}(i[1],i[2])},X={triggersStopPropagation:!0,triggersPreventDefault:!0};function J(e){return!!X[e]}var G={_getViewTriggers:function(e,i){return t.reduce(i,function(i,o,n){return n=Y(n),i[n]=function(e,i){t.isString(i)&&(i={event:i});var o=i.event,n=!!i.preventDefault;J("triggersPreventDefault")&&(n=!1!==i.preventDefault);var s=!!i.stopPropagation;return J("triggersStopPropagation")&&(s=!1!==i.stopPropagation),function(t){n&&t.preventDefault(),s&&t.stopPropagation(),e.triggerMethod(o,e,t)}}(e,o),i},{})}},Q=function(e,t){return e.replace(/@ui\.[a-zA-Z-_$0-9]*/g,function(e){return t[e.slice(4)]})},K={normalizeUIKeys:function(e){var i=this._getUIBindings();return function(e,i){return t.reduce(e,function(e,t,o){var n=Q(o,i);return e[n]=t,e},{})}(e,i)},normalizeUIString:function(e){var t=this._getUIBindings();return Q(e,t)},normalizeUIValues:function(e,i){var o=this._getUIBindings();return function e(i,o,n){return t.each(i,function(s,r){t.isString(s)?i[r]=Q(s,o):t.isObject(s)&&t.isArray(n)&&(t.extend(s,e(t.pick(s,n),o)),t.each(n,function(e){var i=s[e];t.isString(i)&&(s[e]=Q(i,o))}))}),i}(e,o,i)},_getUIBindings:function(){var e=t.result(this,"_uiBindings"),i=t.result(this,"ui");return e||i},_bindUIElements:function(){var e=this;if(this.ui){this._uiBindings||(this._uiBindings=this.ui);var i=t.result(this,"_uiBindings");this._ui={},t.each(i,function(t,i){e._ui[i]=e.$(t)}),this.ui=this._ui}},_unbindUIElements:function(){var e=this;this.ui&&this._uiBindings&&(t.each(this.ui,function(t,i){delete e.ui[i]}),this.ui=this._uiBindings,delete this._uiBindings,delete this._ui)},_getUI:function(e){return this._ui[e]}},Z={supportsRenderLifecycle:!0,supportsDestroyLifecycle:!0,_isDestroyed:!1,isDestroyed:function(){return!!this._isDestroyed},_isRendered:!1,isRendered:function(){return!!this._isRendered},_isAttached:!1,isAttached:function(){return!!this._isAttached},delegateEvents:function(i){this._proxyBehaviorViewProperties(),this._buildEventProxies();var o=this._getEvents(i);void 0===i&&(this.events=o);var n=t.extend({},this._getBehaviorEvents(),o,this._getBehaviorTriggers(),this.getTriggers());return e.View.prototype.delegateEvents.call(this,n),this},_getEvents:function(e){var i=e||this.events;return t.isFunction(i)?this.normalizeUIKeys(i.call(this)):this.normalizeUIKeys(i)},getTriggers:function(){if(this.triggers){var e=this.normalizeUIKeys(t.result(this,"triggers"));return this._getViewTriggers(this,e)}},delegateEntityEvents:function(){return this._delegateEntityEvents(this.model,this.collection),this._delegateBehaviorEntityEvents(),this},undelegateEntityEvents:function(){return this._undelegateEntityEvents(this.model,this.collection),this._undelegateBehaviorEntityEvents(),this},destroy:function(){if(this._isDestroyed)return this;for(var e=!!this._isAttached,t=arguments.length,i=Array(t),o=0;o<t;o++)i[o]=arguments[o];return this.triggerMethod.apply(this,["before:destroy",this].concat(i)),e&&this.triggerMethod("before:detach",this),this.unbindUIElements(),this.removeEl(this.el),e&&(this._isAttached=!1,this.triggerMethod("detach",this)),this._removeChildren(),this._destroyBehaviors(i),this._isDestroyed=!0,this._isRendered=!1,this.triggerMethod.apply(this,["destroy",this].concat(i)),this.stopListening(),this},bindUIElements:function(){return this._bindUIElements(),this._bindBehaviorUIElements(),this},unbindUIElements:function(){return this._unbindUIElements(),this._unbindBehaviorUIElements(),this},getUI:function(e){return this._getUI(e)},childViewEventPrefix:"childview",triggerMethod:function(){var e=u.apply(this,arguments);return this._triggerEventOnBehaviors.apply(this,arguments),e},_buildEventProxies:function(){this._childViewEvents=t.result(this,"childViewEvents"),this._childViewTriggers=t.result(this,"childViewTriggers")},_proxyChildViewEvents:function(e){this.listenTo(e,"all",this._childViewEventHandler)},_childViewEventHandler:function(e){for(var i=this.normalizeMethods(this._childViewEvents),o=arguments.length,n=Array(o>1?o-1:0),s=1;s<o;s++)n[s-1]=arguments[s];void 0!==i&&t.isFunction(i[e])&&i[e].apply(this,n);var r=this._childViewTriggers;r&&t.isString(r[e])&&this.triggerMethod.apply(this,[r[e]].concat(n));var a=t.result(this,"childViewEventPrefix");if(!1!==a){var l=a+":"+e;this.triggerMethod.apply(this,[l].concat(n))}}};function ee(e){e.supportsDestroyLifecycle||g(e,"before:destroy",e);var t=!!e._isAttached;t&&g(e,"before:detach",e),e.remove(),t&&(e._isAttached=!1,g(e,"detach",e)),e._isDestroyed=!0,e.supportsDestroyLifecycle||g(e,"destroy",e)}t.extend(Z,N,j,F,U,G,K);var te=["allowMissingEl","parentEl","replaceElement"],ie=I.extend({cidPrefix:"mnr",replaceElement:!1,_isReplaced:!1,constructor:function(t){if(this._setOptions(t),this.mergeOptions(t,te),this._initEl=this.el=this.getOption("el"),this.el=this.el instanceof e.$?this.el[0]:this.el,!this.el)throw new B({name:"NoElError",message:'An "el" must be specified for a region.'});this.$el=this.getEl(this.el),I.call(this,t)},show:function(e,t){if(this._ensureElement(t))return(e=this._getView(e,t))===this.currentView?this:(this.triggerMethod("before:show",this,e,t),e._isAttached||this.empty(t),this._setupChildView(e),this._renderView(e),this._attachView(e,t),this.currentView=e,this.triggerMethod("show",this,e,t),this)},_setupChildView:function(e){V(e),this._proxyChildViewEvents(e),e.on("destroy",this._empty,this)},_proxyChildViewEvents:function(e){var t=this._parentView;t&&t._proxyChildViewEvents(e)},_renderView:function(e){e._isRendered||(e.supportsRenderLifecycle||g(e,"before:render",e),e.render(),e.supportsRenderLifecycle||(e._isRendered=!0,g(e,"render",e)))},_attachView:function(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=!e._isAttached&&r(this.el),n=void 0===i.replaceElement?!!t.result(this,"replaceElement"):!!i.replaceElement;o&&g(e,"before:attach",e),n?this._replaceEl(e):this.attachHtml(e),o&&(e._isAttached=!0,g(e,"attach",e))},_ensureElement:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isObject(this.el)||(this.$el=this.getEl(this.el),this.el=this.$el[0]),!this.$el||0===this.$el.length){var i=void 0===e.allowMissingEl?!!t.result(this,"allowMissingEl"):!!e.allowMissingEl;if(i)return!1;throw new B('An "el" must exist in DOM for this region '+this.cid)}return!0},_getView:function(t){if(!t)throw new B({name:"ViewNotValid",message:"The view passed is undefined and therefore invalid. You must pass a view instance to show."});if(t._isDestroyed)throw new B({name:"ViewDestroyedError",message:'View (cid: "'+t.cid+'") has already been destroyed and cannot be used.'});if(t instanceof e.View)return t;var i=this._getViewOptions(t);return new le(i)},_getViewOptions:function(e){return t.isFunction(e)?{template:e}:t.isObject(e)?e:{template:function(){return e}}},getEl:function(e){return this.findEls(e,t.result(this,"parentEl"))},_replaceEl:function(e){this._restoreEl(),e.on("before:destroy",this._restoreEl,this),this.replaceEl(e.el,this.el),this._isReplaced=!0},_restoreEl:function(){if(this._isReplaced){var e=this.currentView;e&&(this.replaceEl(this.el,e.el),this._isReplaced=!1)}},isReplaced:function(){return!!this._isReplaced},attachHtml:function(e){this.appendChildren(this.el,e.el)},empty:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{allowMissingEl:!0},t=this.currentView;if(!t)return this._ensureElement(e)&&this.detachHtml(),this;var i=!e.preventDestroy;return i||s("The preventDestroy option is deprecated. Use Region#detachView"),this._empty(t,i),this},_empty:function(e,t){e.off("destroy",this._empty,this),this.triggerMethod("before:empty",this,e),this._restoreEl(),delete this.currentView,e._isDestroyed||(this._removeView(e,t),this._stopChildViewEvents(e)),this.triggerMethod("empty",this,e)},_stopChildViewEvents:function(e){var t=this._parentView;t&&this._parentView.stopListening(e)},_removeView:function(e,t){t?e.destroy?e.destroy():ee(e):this._detachView(e)},detachView:function(){var e=this.currentView;if(e)return this._empty(e),e},_detachView:function(e){var t=!!e._isAttached;t&&g(e,"before:detach",e),this.detachHtml(),t&&(e._isAttached=!1,g(e,"detach",e))},detachHtml:function(){this.detachContents(this.el)},hasView:function(){return!!this.currentView},reset:function(e){return this.empty(e),this.$el&&(this.el=this._initEl),delete this.$el,this},destroy:function(e){return this.reset(e),I.prototype.destroy.apply(this,arguments)}});t.extend(ie.prototype,N);var oe=function(e,i){return e instanceof ie?e:function(e,i){var o=t.extend({},i);if(t.isString(e))return t.extend(o,{el:e}),ne(o);if(t.isFunction(e))return t.extend(o,{regionClass:e}),ne(o);if(t.isObject(e))return e.selector&&s("The selector option on a Region definition object is deprecated. Use el to pass a selector string"),t.extend(o,{el:e.selector},e),ne(o);throw new B({message:"Improper region configuration type.",url:"marionette.region.html#region-configuration-types"})}(e,i)};function ne(e){var i=e.regionClass,o=t.omit(e,"regionClass");return new i(o)}var se={regionClass:ie,_initRegions:function(){this.regions=this.regions||{},this._regions={},this.addRegions(t.result(this,"regions"))},_reInitRegions:function(){L(this._regions,"reset")},addRegion:function(e,t){var i={};return i[e]=t,this.addRegions(i)[e]},addRegions:function(e){if(!t.isEmpty(e))return e=this.normalizeUIValues(e,["selector","el"]),this.regions=t.extend({},this.regions,e),this._addRegions(e)},_addRegions:function(e){var i=this,o={regionClass:this.regionClass,parentEl:t.partial(t.result,this,"el")};return t.reduce(e,function(e,t,n){return e[n]=oe(t,o),i._addRegion(e[n],n),e},{})},_addRegion:function(e,t){this.triggerMethod("before:add:region",this,t,e),e._parentView=this,this._regions[t]=e,this.triggerMethod("add:region",this,t,e)},removeRegion:function(e){var t=this._regions[e];return this._removeRegion(t,e),t},removeRegions:function(){var e=this.getRegions();return t.each(this._regions,t.bind(this._removeRegion,this)),e},_removeRegion:function(e,t){this.triggerMethod("before:remove:region",this,t,e),e.destroy(),delete this.regions[t],delete this._regions[t],this.triggerMethod("remove:region",this,t,e)},emptyRegions:function(){var e=this.getRegions();return L(e,"empty"),e},hasRegion:function(e){return!!this.getRegion(e)},getRegion:function(e){return this._regions[e]},getRegions:function(){return t.clone(this._regions)},showChildView:function(e,t){for(var i=this.getRegion(e),o=arguments.length,n=Array(o>2?o-2:0),s=2;s<o;s++)n[s-2]=arguments[s];return i.show.apply(i,[t].concat(n))},detachChildView:function(e){return this.getRegion(e).detachView()},getChildView:function(e){return this.getRegion(e).currentView}},re={render:function(e,i){if(!e)throw new B({name:"TemplateNotFoundError",message:"Cannot render the template since its false, null or undefined."});var o=t.isFunction(e)?e:$.get(e);return o(i)}},ae=["behaviors","childViewEventPrefix","childViewEvents","childViewTriggers","collectionEvents","events","modelEvents","regionClass","regions","template","templateContext","triggers","ui"],le=e.View.extend({constructor:function(i){this.render=t.bind(this.render,this),this._setOptions(i),this.mergeOptions(i,ae),V(this),this._initBehaviors(),this._initRegions();var o=Array.prototype.slice.call(arguments);o[0]=this.options,e.View.prototype.constructor.apply(this,o),this.delegateEntityEvents()},serializeData:function(){return this.model||this.collection?this.model?this.serializeModel():{items:this.serializeCollection()}:{}},serializeModel:function(){return this.model?t.clone(this.model.attributes):{}},serializeCollection:function(){return this.collection?this.collection.map(function(e){return t.clone(e.attributes)}):{}},setElement:function(){var t=!!this.el;return e.View.prototype.setElement.apply(this,arguments),t&&(this._isRendered=!!this.$el.length,this._isAttached=r(this.el)),this._isRendered&&this.bindUIElements(),this},render:function(){return this._isDestroyed?this:(this.triggerMethod("before:render",this),this._isRendered&&this._reInitRegions(),this._renderTemplate(),this.bindUIElements(),this._isRendered=!0,this.triggerMethod("render",this),this)},_renderTemplate:function(){var e=this.getTemplate();if(!1!==e){var t=this.mixinTemplateContext(this.serializeData()),i=re.render(e,t,this);this.attachElContent(i)}},getTemplate:function(){return this.template},mixinTemplateContext:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.result(this,"templateContext");return t.extend(e,i)},attachElContent:function(e){return this.setInnerContent(this.el,e),this},_removeChildren:function(){this.removeRegions()},_getImmediateChildren:function(){return t.chain(this.getRegions()).map("currentView").compact().value()}});t.extend(le.prototype,Z,se);var ce,de,he=["forEach","each","map","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","toArray","first","initial","rest","last","without","isEmpty","pluck","reduce"],pe=function(e){this._views={},this._indexByModel={},this._indexByCustom={},this._updateLength(),t.each(e,t.bind(this.add,this))};ce=pe.prototype,de="_views",t.each(he,function(e){ce[e]=function(){var i=t.values(t.result(this,de)),o=[i].concat(t.toArray(arguments));return t[e].apply(t,o)}}),t.extend(pe.prototype,{add:function(e,t){return this._add(e,t)._updateLength()},_add:function(e,t){var i=e.cid;return this._views[i]=e,e.model&&(this._indexByModel[e.model.cid]=i),t&&(this._indexByCustom[t]=i),this},findByModel:function(e){return this.findByModelCid(e.cid)},findByModelCid:function(e){var t=this._indexByModel[e];return this.findByCid(t)},findByCustom:function(e){var t=this._indexByCustom[e];return this.findByCid(t)},findByIndex:function(e){return t.values(this._views)[e]},findByCid:function(e){return this._views[e]},remove:function(e){return this._remove(e)._updateLength()},_remove:function(e){var i=e.cid;return e.model&&delete this._indexByModel[e.model.cid],t.some(this._indexByCustom,t.bind(function(e,t){if(e===i)return delete this._indexByCustom[t],!0},this)),delete this._views[i],this},_updateLength:function(){return this.length=t.size(this._views),this}});var ue=["behaviors","childView","childViewEventPrefix","childViewEvents","childViewOptions","childViewTriggers","collectionEvents","events","filter","emptyView","emptyViewOptions","modelEvents","reorderOnSort","sort","triggers","ui","viewComparator"],ge=e.View.extend({sort:!0,constructor:function(i){this.render=t.bind(this.render,this),this._setOptions(i),this.mergeOptions(i,ue),V(this),this._initBehaviors(),this.once("render",this._initialEvents),this._initChildViewStorage(),this._bufferedChildren=[];var o=Array.prototype.slice.call(arguments);o[0]=this.options,e.View.prototype.constructor.apply(this,o),this.delegateEntityEvents()},_startBuffering:function(){this._isBuffering=!0},_endBuffering:function(){var e=!!this._isAttached,i=e?this._getImmediateChildren():[];this._isBuffering=!1,t.each(i,function(e){g(e,"before:attach",e)}),this.attachBuffer(this,this._createBuffer()),t.each(i,function(e){e._isAttached=!0,g(e,"attach",e)}),this._bufferedChildren=[]},_getImmediateChildren:function(){return t.values(this.children._views)},_initialEvents:function(){this.collection&&(this.listenTo(this.collection,"add",this._onCollectionAdd),this.listenTo(this.collection,"update",this._onCollectionUpdate),this.listenTo(this.collection,"reset",this.render),this.sort&&this.listenTo(this.collection,"sort",this._sortViews))},_onCollectionAdd:function(e,i,o){var n=void 0!==o.at&&(o.index||i.indexOf(e));(this.filter||!1===n)&&(n=t.indexOf(this._filteredSortedModels(n),e)),this._shouldAddChild(e,n)&&(this._destroyEmptyView(),this._addChild(e,n))},_onCollectionUpdate:function(e,t){var i=t.changes;this._removeChildModels(i.removed)},_removeChildModels:function(e){var t=this._getRemovedViews(e);t.length&&(this.children._updateLength(),this._updateIndices(t,!1),this.isEmpty()&&this._showEmptyView())},_getRemovedViews:function(e){var i=this;return t.reduce(e,function(e,t){var o=t&&i.children.findByModel(t);return!o||o._isDestroyed?e:(i._removeChildView(o),e.push(o),e)},[])},_removeChildView:function(e){this.triggerMethod("before:remove:child",this,e),this.children._remove(e),e.destroy?e.destroy():ee(e),this.stopListening(e),this.triggerMethod("remove:child",this,e)},setElement:function(){var t=!!this.el;return e.View.prototype.setElement.apply(this,arguments),t&&(this._isAttached=r(this.el)),this},render:function(){return this._isDestroyed?this:(this.triggerMethod("before:render",this),this._renderChildren(),this._isRendered=!0,this.triggerMethod("render",this),this)},setFilter:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=t.preventRender,o=this._isRendered&&!this._isDestroyed,n=this.filter!==e,s=o&&n&&!i;if(s){var r=this._filteredSortedModels();this.filter=e;var a=this._filteredSortedModels();this._applyModelDeltas(a,r)}else this.filter=e;return this},removeFilter:function(e){return this.setFilter(null,e)},_applyModelDeltas:function(e,i){var o=this,n={};t.each(e,function(e,t){var i=!o.children.findByModel(e);i&&o._onCollectionAdd(e,o.collection,{at:t}),n[e.cid]=!0});var s=t.filter(i,function(e){return!n[e.cid]&&o.children.findByModel(e)});this._removeChildModels(s)},reorder:function(){var e=this,i=this.children,o=this._filteredSortedModels();if(!o.length&&this._showingEmptyView)return this;var n,s,r=t.some(o,function(e){return!i.findByModel(e)});return r?this.render():(n=[],s=i.reduce(function(e,i){var s=t.indexOf(o,i.model);return-1===s?(n.push(i.model),e):(i._index=s,e[s]=i.el,e)},new Array(o.length)),e.triggerMethod("before:reorder",e),e._appendReorderedChildren(s),e._removeChildModels(n),e.triggerMethod("reorder",e)),this},resortView:function(){return this.reorderOnSort?this.reorder():this._renderChildren(),this},_sortViews:function(){var e=this,i=this._filteredSortedModels(),o=t.find(i,function(t,i){var o=e.children.findByModel(t);return!o||o._index!==i});o&&this.resortView()},_emptyViewIndex:-1,_appendReorderedChildren:function(e){this.appendChildren(this.el,e)},_renderChildren:function(){this._isRendered&&(this._destroyEmptyView(),this._destroyChildren());var e=this._filteredSortedModels();this.isEmpty({processedModels:e})?this._showEmptyView():(this.triggerMethod("before:render:children",this),this._startBuffering(),this._showCollection(e),this._endBuffering(),this.triggerMethod("render:children",this))},_createView:function(e,t){var i=this._getChildView(e),o=this._getChildViewOptions(e,t),n=this.buildChildView(e,i,o);return n},_setupChildView:function(e,t){V(e),this._proxyChildViewEvents(e),this.sort&&(e._index=t)},_showCollection:function(e){t.each(e,t.bind(this._addChild,this)),this.children._updateLength()},_filteredSortedModels:function(e){if(!this.collection||!this.collection.length)return[];var t=this.getViewComparator(),i=this.collection.models;if(e=Math.min(Math.max(e,0),i.length-1),t){var o=void 0;e&&(o=i[e],i=i.slice(0,e).concat(i.slice(e+1))),i=this._sortModelsBy(i,t),o&&i.splice(e,0,o)}return i=this._filterModels(i)},getViewComparator:function(){return this.viewComparator},_filterModels:function(e){var i=this;return this.filter&&(e=t.filter(e,function(e,t){return i._shouldAddChild(e,t)})),e},_sortModelsBy:function(e,i){return"string"==typeof i?t.sortBy(e,function(e){return e.get(i)}):1===i.length?t.sortBy(e,t.bind(i,this)):t.clone(e).sort(t.bind(i,this))},_showEmptyView:function(){var i=this._getEmptyView();if(i&&!this._showingEmptyView){this._showingEmptyView=!0;var o=new e.Model,n=this.emptyViewOptions||this.childViewOptions;t.isFunction(n)&&(n=n.call(this,o,this._emptyViewIndex));var s=this.buildChildView(o,i,n);this.triggerMethod("before:render:empty",this,s),this.addChildView(s,0),this.triggerMethod("render:empty",this,s)}},_destroyEmptyView:function(){this._showingEmptyView&&(this.triggerMethod("before:remove:empty",this),this._destroyChildren(),delete this._showingEmptyView,this.triggerMethod("remove:empty",this))},_getEmptyView:function(){var e=this.emptyView;if(e)return this._getView(e)},_getChildView:function(e){var t=this.childView;if(!t)throw new B({name:"NoChildViewError",message:'A "childView" must be specified'});if(!(t=this._getView(t,e)))throw new B({name:"InvalidChildViewError",message:'"childView" must be a view class or a function that returns a view class'});return t},_getView:function(i,o){return i.prototype instanceof e.View||i===e.View?i:t.isFunction(i)?i.call(this,o):void 0},_addChild:function(e,t){var i=this._createView(e,t);return this.addChildView(i,t),i},_getChildViewOptions:function(e,i){return t.isFunction(this.childViewOptions)?this.childViewOptions(e,i):this.childViewOptions},addChildView:function(e,t){return this.triggerMethod("before:add:child",this,e),this._setupChildView(e,t),this._isBuffering?this.children._add(e):(this._updateIndices(e,!0),this.children.add(e)),this._renderView(e),this._attachView(e,t),this.triggerMethod("add:child",this,e),e},_updateIndices:function(e,i){if(this.sort)if(i){var o=t.isArray(e)?t.max(e,"_index"):e;t.isObject(o)&&this.children.each(function(e){e._index>=o._index&&(e._index+=1)})}else t.each(t.sortBy(this.children._views,"_index"),function(e,t){e._index=t})},_renderView:function(e){e._isRendered||(e.supportsRenderLifecycle||g(e,"before:render",e),e.render(),e.supportsRenderLifecycle||(e._isRendered=!0,g(e,"render",e)))},_attachView:function(e,t){var i=!e._isAttached&&!this._isBuffering&&this._isAttached;i&&g(e,"before:attach",e),this.attachHtml(this,e,t),i&&(e._isAttached=!0,g(e,"attach",e))},buildChildView:function(e,i,o){var n=t.extend({model:e},o);return new i(n)},removeChildView:function(e){return!e||e._isDestroyed?e:(this._removeChildView(e),this.children._updateLength(),this._updateIndices(e,!1),e)},isEmpty:function(e){var i=void 0;return t.result(e,"processedModels")?i=e.processedModels:(i=this.collection?this.collection.models:[],i=this._filterModels(i)),0===i.length},attachBuffer:function(e,t){this.appendChildren(e.el,t)},_createBuffer:function(){var e=this,i=this.createBuffer();return t.each(this._bufferedChildren,function(t){e.appendChildren(i,t.el)}),i},attachHtml:function(e,t,i){e._isBuffering?e._bufferedChildren.splice(i,0,t):e._insertBefore(t,i)||e._insertAfter(t)},_insertBefore:function(e,t){var i=void 0,o=this.sort&&t<this.children.length-1;return o&&(i=this.children.find(function(e){return e._index===t+1})),!!i&&(this.beforeEl(i.el,e.el),!0)},_insertAfter:function(e){this.appendChildren(this.el,e.el)},_initChildViewStorage:function(){this.children=new pe},_removeChildren:function(){this._destroyChildren()},_destroyChildren:function(e){this.children.length&&(this.triggerMethod("before:destroy:children",this),this.children.each(t.bind(this._removeChildView,this)),this.children._updateLength(),this.triggerMethod("destroy:children",this))},_shouldAddChild:function(e,i){var o=this.filter;return!t.isFunction(o)||o.call(this,e,i,this.collection)}});t.extend(ge.prototype,Z);var fe=["childViewContainer","template","templateContext"],me=ge.extend({constructor:function(e){s("CompositeView is deprecated. Convert to View at your earliest convenience"),this.mergeOptions(e,fe),ge.prototype.constructor.apply(this,arguments)},_initialEvents:function(){this.collection&&(this.listenTo(this.collection,"add",this._onCollectionAdd),this.listenTo(this.collection,"update",this._onCollectionUpdate),this.listenTo(this.collection,"reset",this.renderChildren),this.sort&&this.listenTo(this.collection,"sort",this._sortViews))},_getChildView:function(e){var t=this.childView;if(!t)return this.constructor;if(!(t=this._getView(t,e)))throw new B({name:"InvalidChildViewError",message:'"childView" must be a view class or a function that returns a view class'});return t},serializeData:function(){return this.serializeModel()},render:function(){return this._isDestroyed?this:(this._isRendering=!0,this.resetChildViewContainer(),this.triggerMethod("before:render",this),this._renderTemplate(),this.bindUIElements(),this.renderChildren(),this._isRendering=!1,this._isRendered=!0,this.triggerMethod("render",this),this)},renderChildren:function(){(this._isRendered||this._isRendering)&&ge.prototype._renderChildren.call(this)},attachBuffer:function(e,t){var i=this.getChildViewContainer(e);this.appendChildren(i,t)},_insertAfter:function(e){var t=this.getChildViewContainer(this,e);this.appendChildren(t,e.el)},_appendReorderedChildren:function(e){var t=this.getChildViewContainer(this);this.appendChildren(t,e)},getChildViewContainer:function(e,i){if(e.$childViewContainer)return e.$childViewContainer;var o=void 0,n=e.childViewContainer;if(n){var s=t.result(e,"childViewContainer");if((o="@"===s.charAt(0)&&e.ui?e.ui[s.substr(4)]:this.findEls(s,e.$el)).length<=0)throw new B({name:"ChildViewContainerMissingError",message:'The specified "childViewContainer" was not found: '+e.childViewContainer})}else o=e.$el;return e.$childViewContainer=o,o},resetChildViewContainer:function(){this.$childViewContainer&&(this.$childViewContainer=void 0)}}),_e=t.pick(le.prototype,"serializeModel","getTemplate","_renderTemplate","mixinTemplateContext","attachElContent");t.extend(me.prototype,_e);var ve=["collectionEvents","events","modelEvents","triggers","ui"],we=I.extend({cidPrefix:"mnb",constructor:function(e,i){this.view=i,this.defaults=t.clone(t.result(this,"defaults",{})),this._setOptions(this.defaults,e),this.mergeOptions(this.options,ve),this.ui=t.extend({},t.result(this,"ui"),t.result(i,"ui")),I.apply(this,arguments)},$:function(){return this.view.$.apply(this.view,arguments)},destroy:function(){return this.stopListening(),this},proxyViewProperties:function(){return this.$el=this.view.$el,this.el=this.view.el,this},bindUIElements:function(){return this._bindUIElements(),this},unbindUIElements:function(){return this._unbindUIElements(),this},getUI:function(e){return this._getUI(e)},delegateEntityEvents:function(){return this._delegateEntityEvents(this.view.model,this.view.collection),this},undelegateEntityEvents:function(){return this._undelegateEntityEvents(this.view.model,this.view.collection),this},getEvents:function(){var e=this,i=this.normalizeUIKeys(t.result(this,"events"));return t.reduce(i,function(i,o,n){if(t.isFunction(o)||(o=e[o]),o)return n=Y(n),i[n]=t.bind(o,e),i},{})},getTriggers:function(){if(this.triggers){var e=this.normalizeUIKeys(t.result(this,"triggers"));return this._getViewTriggers(this.view,e)}}});t.extend(we.prototype,U,G,K);var ye=["region","regionClass"],be=I.extend({cidPrefix:"mna",constructor:function(e){this._setOptions(e),this.mergeOptions(e,ye),this._initRegion(),I.prototype.constructor.apply(this,arguments)},regionClass:ie,_initRegion:function(){var e=this.region;if(e){var t={regionClass:this.regionClass};this._region=oe(e,t)}},getRegion:function(){return this._region},showView:function(e){for(var t=this.getRegion(),i=arguments.length,o=Array(i>1?i-1:0),n=1;n<i;n++)o[n-1]=arguments[n];return t.show.apply(t,[e].concat(o))},getView:function(){return this.getRegion().currentView},start:function(e){return this.triggerMethod("before:start",this,e),this.triggerMethod("start",this,e),this}}),xe=["appRoutes","controller"],ke=e.Router.extend({constructor:function(t){this._setOptions(t),this.mergeOptions(t,xe),e.Router.apply(this,arguments);var i=this.appRoutes,o=this._getController();this.processAppRoutes(o,i),this.on("route",this._processOnRoute,this)},appRoute:function(e,t){var i=this._getController();return this._addAppRoute(i,e,t),this},_processOnRoute:function(e,i){if(t.isFunction(this.onRoute)){var o=t.invert(this.appRoutes)[e];this.onRoute(e,o,i)}},processAppRoutes:function(e,i){var o=this;if(!i)return this;var n=t.keys(i).reverse();return t.each(n,function(t){o._addAppRoute(e,t,i[t])}),this},_getController:function(){return this.controller},_addAppRoute:function(e,i,o){var n=e[o];if(!n)throw new B('Method "'+o+'" was not found on the controller');this.route(i,o,t.bind(n,e))},triggerMethod:u});t.extend(ke.prototype,F);var Ce=e.Marionette,Se=e.Marionette={};return Se.noConflict=function(){return e.Marionette=Ce,this},Se.bindEvents=o(P),Se.unbindEvents=o(M),Se.bindRequests=o(D),Se.unbindRequests=o(R),Se.mergeOptions=o(a),Se.getOption=o(l),Se.normalizeMethods=o(c),Se.extend=n,Se.isNodeAttached=r,Se.deprecate=s,Se.triggerMethod=o(u),Se.triggerMethodOn=g,Se.isEnabled=J,Se.setEnabled=function(e,t){return X[e]=t},Se.monitorViewEvents=V,Se.Behaviors={},Se.Behaviors.behaviorsLookup=function(){throw new B({message:"You must define where your behaviors are stored.",url:"marionette.behaviors.md#behaviorslookup"})},Se.Application=be,Se.AppRouter=ke,Se.Renderer=re,Se.TemplateCache=$,Se.View=le,Se.CollectionView=ge,Se.CompositeView=me,Se.Behavior=we,Se.Region=ie,Se.Error=B,Se.Object=I,Se.DEV_MODE=!1,Se.FEATURES=X,Se.VERSION="3.2.0",Se}(i(26),i(4),i(90))},250:function(e,t,i){e.exports=i(503)},3:function(e,t){e.exports=jQuery},30:function(e,t){Backbone.SuperModel=function(e,t){var i=function(t){return e.isString(t)&&(t=t.split(".")),t},o=function(e,t,o){t=i(t),lastKeyIndex=t.length-1;for(var n=0;n<lastKeyIndex;++n)key=t[n],key in e||(e[key]={}),e=e[key];o(e,t[lastKeyIndex])},n=function(o,s,r){s=i(s);var a=e.first(s),l=o.get(a);l instanceof t.Model&&n(l,e.rest(s),r),r(o,s)},s=function(t,i,o){var n;i&&(n=e.result(t,"relations")[i]);return o&&!n&&(n=a),null==n&&(n=a),n},r=function(t,i,o){var n=e.result(t,"name");return n&&!i[n]&&(i[n]=t),i},a=t.Model.extend({relations:{},unsafeAttributes:[],name:null,_valueForCollection:function(t){return!!e.isArray(t)&&(!(t.length>=1)||e.isObject(t[0]))},_nestedSet:function(i,o,n){for(var c=(i=i.split(".")).length-1,d=this,h=0;h<c;++h){var p=i[h];if(!d.attributes[p]){var u=new(s(d,p,o));d.attributes[p]=r(d,u)}d=d.attributes[p]}var g=i[c];if(!e.isArray(o)&&e.isObject(o)&&function(e){return e.constructor===Object}(o))if(0===e.size(o))d.attributes[g]=new a;else for(var f in o){var m=g+"."+f;d._nestedSet(m,o[f],n)}else if(this._valueForCollection(o)){var _=s(d,g,o);_.prototype instanceof t.Model&&(_=l);var v=new _(o);v=r(d,v),d.attributes[g]=v}else 1==i.length?d.attributes[g]=o:d.set(g,o,e.extend({skipNested:!0,forceChange:!0},n));n.silent||function(t){for(var i=t.length-1;i>=0;i--){var o=t.slice(0,i),n=t.slice(i);if(1!=n.length){var s=this;(o=o.join(".")).length>0&&(s=this.get(o));for(var r=e.first(n),a=e.rest(n),l=[r],c=0;c<a.length;c++)r=[r,a[c]].join("."),l.push(r);for(var d=0;d<l.length;d++){var h=l[d],p=s.trigger;p&&e.isFunction(p)&&p.call(s,"change:"+h,s,s.get(h))}}}}.call(this,i)},_setChanging:function(){this._previousAttributes=this.toJSON(),this.changed={}},_triggerChanges:function(e,t,i){e.length&&(this._pending=!0);for(var o=0,n=e.length;o<n;o++)i||(i=this.get(e[o])),1==e[o].split(".").length&&this.trigger("change:"+e[o],this,i,t)},_setChange:function(t,i,n){var s,r,a=this.get(t);return t=t.split("."),!e.isEqual(a,i)||n.forceChange?(s=this.changed,r=i,o(s,t,function(e,t){e[t]=r}),!0):(function(e,t){o(e,t,function(e,t){delete e[t]})}(this.changed,t),!1)},set:function(e,t,i){var o,s,r,a,l,c,d;if(null==e)return this;if("object"==typeof e?(s=e,i=t):(s={})[e]=t,i=i||{},!this._validate(s,i))return!1;r=i.unset,l=i.silent,a=[],c=this._changing,d=i.skipNested,this._changing=!0,c||this._setChanging(),this.idAttribute in s&&(this.id=s[this.idAttribute]);var h=function(e,t){delete e.attributes[t]};for(o in s)t=s[o],this._setChange(o,t,i)&&a.push(o),r?n(this,o,h):d?this.attributes[o]=t:this._nestedSet(o,t,i);if(l||this._triggerChanges(a,i),c)return this;if(!l)for(;this._pending;)this._pending=!1,this.trigger("change",this,i);return this._pending=!1,this._changing=!1,this},get:function(t){var i=t?t.split("."):[];if(i.length>1){var o=this.attributes[e.first(i)];if(!o)return;var n=e.rest(i).join(".");return e.isFunction(o.get)?o.get(n):o[n]}return this.attributes[t]},toJSON:function(t){t=t||{};var i=e.result(this,"unsafeAttributes");t.except&&(i=e.union(i,t.except));var o=e.clone(this.attributes);return e.each(i,function(e){delete o[e]}),e.each(o,function(t,i){t&&e.isFunction(t.toJSON)&&(o[i]=t.toJSON())}),o},hasChanged:function(t){return null==t?!e.isEmpty(this.changed):(i=this.changed,n=!1,o(i,t,function(t,i){n=e.has(t,i)}),n);var i,n},previous:function(e){return null!=e&&this._previousAttributes?function(e,t,o){for(var n=(t=i(t)).length,s=0;s<n;s++){if(!e||"object"!=typeof e)return o;e=e[t[s]]}return void 0===e?o:e}(this._previousAttributes,e):null},clear:function(e){for(var i in this.id=void 0,this.attributes){var o=this.attributes[i];o instanceof t.Model?o.clear():o instanceof t.Collection?o.reset():this.unset(i)}return this}}),l=t.Collection.extend({model:a});return a}(_,Backbone),e.exports=Backbone.SuperModel},395:function(e,t){
2
- /*! @source http://purl.eligrey.com/github/Blob.js/blob/master/Blob.js */
3
- !function(e){"use strict";if(e.URL=e.URL||e.webkitURL,e.Blob&&e.URL)try{return void new Blob}catch(e){}var t=e.BlobBuilder||e.WebKitBlobBuilder||e.MozBlobBuilder||function(e){var t=function(e){return Object.prototype.toString.call(e).match(/^\[object\s(.*)\]#x2F;)[1]},i=function(){this.data=[]},o=function(e,t,i){this.data=e,this.size=e.length,this.type=t,this.encoding=i},n=i.prototype,s=o.prototype,r=e.FileReaderSync,a=function(e){this.code=this[this.name=e]},l="NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR".split(" "),c=l.length,d=e.URL||e.webkitURL||e,h=d.createObjectURL,p=d.revokeObjectURL,u=d,g=e.btoa,f=e.atob,m=e.ArrayBuffer,_=e.Uint8Array,v=/^[\w-]+:\/*\[?[\w\.:-]+\]?(?::[0-9]+)?/;for(o.fake=s.fake=!0;c--;)a.prototype[l[c]]=c+1;return d.createObjectURL||(u=e.URL=function(e){var t,i=document.createElementNS("http://www.w3.org/1999/xhtml","a");return i.href=e,"origin"in i||("data:"===i.protocol.toLowerCase()?i.origin=null:(t=e.match(v),i.origin=t&&t[1])),i}),u.createObjectURL=function(e){var t,i=e.type;return null===i&&(i="application/octet-stream"),e instanceof o?(t="data:"+i,"base64"===e.encoding?t+";base64,"+e.data:"URI"===e.encoding?t+","+decodeURIComponent(e.data):g?t+";base64,"+g(e.data):t+","+encodeURIComponent(e.data)):h?h.call(d,e):void 0},u.revokeObjectURL=function(e){"data:"!==e.substring(0,5)&&p&&p.call(d,e)},n.append=function(e){var i=this.data;if(_&&(e instanceof m||e instanceof _)){for(var n="",s=new _(e),l=0,c=s.length;l<c;l++)n+=String.fromCharCode(s[l]);i.push(n)}else if("Blob"===t(e)||"File"===t(e)){if(!r)throw new a("NOT_READABLE_ERR");var d=new r;i.push(d.readAsBinaryString(e))}else e instanceof o?"base64"===e.encoding&&f?i.push(f(e.data)):"URI"===e.encoding?i.push(decodeURIComponent(e.data)):"raw"===e.encoding&&i.push(e.data):("string"!=typeof e&&(e+=""),i.push(unescape(encodeURIComponent(e))))},n.getBlob=function(e){return arguments.length||(e=null),new o(this.data.join(""),e,"raw")},n.toString=function(){return"[object BlobBuilder]"},s.slice=function(e,t,i){var n=arguments.length;return n<3&&(i=null),new o(this.data.slice(e,n>1?t:this.data.length),i,this.encoding)},s.toString=function(){return"[object Blob]"},s.close=function(){this.size=0,delete this.data},i}(e);e.Blob=function(e,i){var o=i&&i.type||"",n=new t;if(e)for(var s=0,r=e.length;s<r;s++)Uint8Array&&e[s]instanceof Uint8Array?n.append(e[s].buffer):n.append(e[s]);var a=n.getBlob(o);return!a.slice&&a.webkitSlice&&(a.slice=a.webkitSlice),a};var i=Object.getPrototypeOf||function(e){return e.__proto__};e.Blob.prototype=i(new e.Blob)}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||this.content||this),e.exports=window.Blob},396:function(e,t,i){var o,n=n||function(e){"use strict";if(!(void 0===e||"undefined"!=typeof navigator&&/MSIE [1-9]\./.test(navigator.userAgent))){var t=e.document,i=function(){return e.URL||e.webkitURL||e},o=t.createElementNS("http://www.w3.org/1999/xhtml","a"),n="download"in o,s=/constructor/i.test(e.HTMLElement)||e.safari,r=/CriOS\/[\d]+/.test(navigator.userAgent),a=function(t){(e.setImmediate||e.setTimeout)(function(){throw t},0)},l=function(e){setTimeout(function(){"string"==typeof e?i().revokeObjectURL(e):e.remove()},4e4)},c=function(e){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e},d=function(t,d,h){h||(t=c(t));var p,u=this,g="application/octet-stream"===t.type,f=function(){!function(e,t,i){for(var o=(t=[].concat(t)).length;o--;){var n=e["on"+t[o]];if("function"==typeof n)try{n.call(e,i||e)}catch(e){a(e)}}}(u,"writestart progress write writeend".split(" "))};if(u.readyState=u.INIT,n)return p=i().createObjectURL(t),void setTimeout(function(){var e,t;o.href=p,o.download=d,e=o,t=new MouseEvent("click"),e.dispatchEvent(t),f(),l(p),u.readyState=u.DONE});!function(){if((r||g&&s)&&e.FileReader){var o=new FileReader;return o.onloadend=function(){var t=r?o.result:o.result.replace(/^data:[^;]*;/,"data:attachment/file;");e.open(t,"_blank")||(e.location.href=t),t=void 0,u.readyState=u.DONE,f()},o.readAsDataURL(t),void(u.readyState=u.INIT)}p||(p=i().createObjectURL(t)),g?e.location.href=p:e.open(p,"_blank")||(e.location.href=p);u.readyState=u.DONE,f(),l(p)}()},h=d.prototype;return"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob?function(e,t,i){return t=t||e.name||"download",i||(e=c(e)),navigator.msSaveOrOpenBlob(e,t)}:(h.abort=function(){},h.readyState=h.INIT=0,h.WRITING=1,h.DONE=2,h.error=h.onwritestart=h.onprogress=h.onwrite=h.onabort=h.onerror=h.onwriteend=null,function(e,t,i){return new d(e,t||e.name||"download",i)})}}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||this.content);
4
- /*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */e.exports?e.exports.saveAs=n:null!==i(500)&&null!==i(501)&&(void 0===(o=function(){return n}.call(t,i,t,e))||(e.exports=o))},498:function(e,t){
5
- /**
6
- @license Sticky-kit v1.1.2 | WTFPL | Leaf Corcoran 2015 | http://leafo.net
7
- */
8
- (function(){var e,t;e=this.jQuery||window.jQuery,t=e(window),e.fn.stick_in_parent=function(i){var o,n,s,r,a,l,c,d,h,p,u,g,f;for(null==i&&(i={}),f=i.sticky_class,l=i.inner_scrolling,g=i.recalc_every,u=i.parent,h=i.offset_top,d=i.spacer,s=i.bottoming,null==h&&(h=0),null==u&&(u=void 0),null==l&&(l=!0),null==f&&(f="is_stuck"),o=e(document),null==s&&(s=!0),p=function(e){var t,i;return window.getComputedStyle?(e[0],t=window.getComputedStyle(e[0]),i=parseFloat(t.getPropertyValue("width"))+parseFloat(t.getPropertyValue("margin-left"))+parseFloat(t.getPropertyValue("margin-right")),"border-box"!==t.getPropertyValue("box-sizing")&&(i+=parseFloat(t.getPropertyValue("border-left-width"))+parseFloat(t.getPropertyValue("border-right-width"))+parseFloat(t.getPropertyValue("padding-left"))+parseFloat(t.getPropertyValue("padding-right"))),i):e.outerWidth(!0)},r=function(i,n,r,a,c,m,_,v){var w,y,b,x,k,C,S,V,T,B,E,P;if(!i.data("sticky_kit")){if(i.data("sticky_kit",!0),k=o.height(),S=i.parent(),null!=u&&(S=S.closest(u)),!S.length)throw"failed to find stick parent";return b=!1,w=!1,(E=null!=d?d&&i.closest(d):e("<div />"))&&E.css("position",i.css("position")),(V=function(){var e,t,s;if(!v)return k=o.height(),e=parseInt(S.css("border-top-width"),10),t=parseInt(S.css("padding-top"),10),n=parseInt(S.css("padding-bottom"),10),r=S.offset().top+e+t,a=S.height(),b&&(b=!1,w=!1,null==d&&(i.insertAfter(E),E.detach()),i.css({position:"",top:"",width:"",bottom:""}).removeClass(f),s=!0),c=i.offset().top-(parseInt(i.css("margin-top"),10)||0)-h,m=i.outerHeight(!0),_=i.css("float"),E&&E.css({width:p(i),height:m,display:i.css("display"),"vertical-align":i.css("vertical-align"),float:_}),s?P():void 0})(),x=void 0,C=h,B=g,P=function(){var e,p,u,y,T,P;if(!v)return u=!1,null!=B&&(B-=1)<=0&&(B=g,V(),u=!0),u||o.height()===k||(V(),u=!0),y=t.scrollTop(),null!=x&&(p=y-x),x=y,b?(s&&(T=y+m+C>a+r,w&&!T&&(w=!1,i.css({position:"fixed",bottom:"",top:C}).trigger("sticky_kit:unbottom"))),y<c&&(b=!1,C=h,null==d&&("left"!==_&&"right"!==_||i.insertAfter(E),E.detach()),e={position:"",width:"",top:""},i.css(e).removeClass(f).trigger("sticky_kit:unstick")),l&&(P=t.height(),m+h>P&&(w||(C-=p,C=Math.max(P-m,C),C=Math.min(h,C),b&&i.css({top:C+"px"}))))):y>c&&(b=!0,(e={position:"fixed",top:C}).width="border-box"===i.css("box-sizing")?i.outerWidth()+"px":i.width()+"px",i.css(e).addClass(f),null==d&&(i.after(E),"left"!==_&&"right"!==_||E.append(i)),i.trigger("sticky_kit:stick")),b&&s&&(null==T&&(T=y+m+C>a+r),!w&&T)?(w=!0,"static"===S.css("position")&&S.css({position:"relative"}),i.css({position:"absolute",bottom:n,top:"auto"}).trigger("sticky_kit:bottom")):void 0},T=function(){return V(),P()},y=function(){if(v=!0,t.off("touchmove",P),t.off("scroll",P),t.off("resize",T),e(document.body).off("sticky_kit:recalc",T),i.off("sticky_kit:detach",y),i.removeData("sticky_kit"),i.css({position:"",bottom:"",top:"",width:""}),S.position("position",""),b)return null==d&&("left"!==_&&"right"!==_||i.insertAfter(E),E.remove()),i.removeClass(f)},t.on("touchmove",P),t.on("scroll",P),t.on("resize",T),e(document.body).on("sticky_kit:recalc",T),i.on("sticky_kit:detach",y),setTimeout(P,0)}},a=0,c=this.length;a<c;a++)n=this[a],r(e(n));return this}}).call(this)},499:function(e,t,i){var o,n,s,r=i(3);!function(e){if(!e.jQuery){var t=function(e,i){return new t.fn.init(e,i)};t.isWindow=function(e){return null!=e&&e==e.window},t.type=function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?o[s.call(e)]||"object":typeof e},t.isArray=Array.isArray||function(e){return"array"===t.type(e)},t.isPlainObject=function(e){var i;if(!e||"object"!==t.type(e)||e.nodeType||t.isWindow(e))return!1;try{if(e.constructor&&!n.call(e,"constructor")&&!n.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(e){return!1}for(i in e);return void 0===i||n.call(e,i)},t.each=function(e,t,i){var o=0,n=e.length,s=l(e);if(i){if(s)for(;o<n&&!1!==t.apply(e[o],i);o++);else for(o in e)if(!1===t.apply(e[o],i))break}else if(s)for(;o<n&&!1!==t.call(e[o],o,e[o]);o++);else for(o in e)if(!1===t.call(e[o],o,e[o]))break;return e},t.data=function(e,o,n){if(void 0===n){var s=(r=e[t.expando])&&i[r];if(void 0===o)return s;if(s&&o in s)return s[o]}else if(void 0!==o){var r=e[t.expando]||(e[t.expando]=++t.uuid);return i[r]=i[r]||{},i[r][o]=n,n}},t.removeData=function(e,o){var n=e[t.expando],s=n&&i[n];s&&t.each(o,function(e,t){delete s[t]})},t.extend=function(){var e,i,o,n,s,r,a=arguments[0]||{},l=1,c=arguments.length,d=!1;for("boolean"==typeof a&&(d=a,a=arguments[l]||{},l++),"object"!=typeof a&&"function"!==t.type(a)&&(a={}),l===c&&(a=this,l--);l<c;l++)if(null!=(s=arguments[l]))for(n in s)e=a[n],a!==(o=s[n])&&(d&&o&&(t.isPlainObject(o)||(i=t.isArray(o)))?(i?(i=!1,r=e&&t.isArray(e)?e:[]):r=e&&t.isPlainObject(e)?e:{},a[n]=t.extend(d,r,o)):void 0!==o&&(a[n]=o));return a},t.queue=function(e,i,o){if(e){i=(i||"fx")+"queue";var n,s,r,a=t.data(e,i);return o?(!a||t.isArray(o)?a=t.data(e,i,(r=s||[],null!=(n=o)&&(l(Object(n))?function(e,t){for(var i=+t.length,o=0,n=e.length;o<i;)e[n++]=t[o++];if(i!=i)for(;void 0!==t[o];)e[n++]=t[o++];e.length=n}(r,"string"==typeof n?[n]:n):[].push.call(r,n)),r)):a.push(o),a):a||[]}},t.dequeue=function(e,i){t.each(e.nodeType?[e]:e,function(e,o){i=i||"fx";var n=t.queue(o,i),s=n.shift();"inprogress"===s&&(s=n.shift()),s&&("fx"===i&&n.unshift("inprogress"),s.call(o,function(){t.dequeue(o,i)}))})},t.fn=t.prototype={init:function(e){if(e.nodeType)return this[0]=e,this;throw new Error("Not a DOM node.")},offset:function(){var t=this[0].getBoundingClientRect?this[0].getBoundingClientRect():{top:0,left:0};return{top:t.top+(e.pageYOffset||document.scrollTop||0)-(document.clientTop||0),left:t.left+(e.pageXOffset||document.scrollLeft||0)-(document.clientLeft||0)}},position:function(){function e(){for(var e=this.offsetParent||document;e&&"html"===!e.nodeType.toLowerCase&&"static"===e.style.position;)e=e.offsetParent;return e||document}var i=this[0],e=e.apply(i),o=this.offset(),n=/^(?:body|html)#x2F;i.test(e.nodeName)?{top:0,left:0}:t(e).offset();return o.top-=parseFloat(i.style.marginTop)||0,o.left-=parseFloat(i.style.marginLeft)||0,e.style&&(n.top+=parseFloat(e.style.borderTopWidth)||0,n.left+=parseFloat(e.style.borderLeftWidth)||0),{top:o.top-n.top,left:o.left-n.left}}};var i={};t.expando="velocity"+(new Date).getTime(),t.uuid=0;for(var o={},n=o.hasOwnProperty,s=o.toString,r="Boolean Number String Function Array Date RegExp Object Error".split(" "),a=0;a<r.length;a++)o["[object "+r[a]+"]"]=r[a].toLowerCase();t.fn.init.prototype=t.fn,e.Velocity={Utilities:t}}function l(e){var i=e.length,o=t.type(e);return"function"!==o&&!t.isWindow(e)&&(!(1!==e.nodeType||!i)||("array"===o||0===i||"number"==typeof i&&i>0&&i-1 in e))}}(window),s=function(){return function(e,t,i,o){var n,s=function(){if(i.documentMode)return i.documentMode;for(var e=7;e>4;e--){var t=i.createElement("div");if(t.innerHTML="\x3c!--[if IE "+e+"]><span></span><![endif]--\x3e",t.getElementsByTagName("span").length)return t=null,e}return o}(),a=(n=0,t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||function(e){var t,i=(new Date).getTime();return t=Math.max(0,16-(i-n)),n=i+t,setTimeout(function(){e(i+t)},t)});function l(e){return d.isWrapped(e)?e=[].slice.call(e):d.isNode(e)&&(e=[e]),e}var c,d={isString:function(e){return"string"==typeof e},isArray:Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},isFunction:function(e){return"[object Function]"===Object.prototype.toString.call(e)},isNode:function(e){return e&&e.nodeType},isNodeList:function(e){return"object"==typeof e&&/^\[object (HTMLCollection|NodeList|Object)\]#x2F;.test(Object.prototype.toString.call(e))&&e.length!==o&&(0===e.length||"object"==typeof e[0]&&e[0].nodeType>0)},isWrapped:function(e){return e&&(e.jquery||t.Zepto&&t.Zepto.zepto.isZ(e))},isSVG:function(e){return t.SVGElement&&e instanceof t.SVGElement},isEmptyObject:function(e){for(var t in e)return!1;return!0}},h=!1;if(e.fn&&e.fn.jquery?(c=e,h=!0):c=t.Velocity.Utilities,s<=8&&!h)throw new Error("Velocity: IE8 and below require jQuery to be loaded before Velocity.");if(!(s<=7)){var p=400,u="swing",g={State:{isMobile:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),isAndroid:/Android/i.test(navigator.userAgent),isGingerbread:/Android 2\.3\.[3-7]/i.test(navigator.userAgent),isChrome:t.chrome,isFirefox:/Firefox/i.test(navigator.userAgent),prefixElement:i.createElement("div"),prefixMatches:{},scrollAnchor:null,scrollPropertyLeft:null,scrollPropertyTop:null,isTicking:!1,calls:[]},CSS:{},Utilities:c,Redirects:{},Easings:{},Promise:t.Promise,defaults:{queue:"",duration:p,easing:u,begin:o,complete:o,progress:o,display:o,visibility:o,loop:!1,delay:!1,mobileHA:!0,_cacheValues:!0},init:function(e){c.data(e,"velocity",{isSVG:d.isSVG(e),isAnimating:!1,computedStyle:null,tweensContainer:null,rootPropertyValueCache:{},transformCache:{}})},hook:null,mock:!1,version:{major:1,minor:2,patch:2},debug:!1};t.pageYOffset!==o?(g.State.scrollAnchor=t,g.State.scrollPropertyLeft="pageXOffset",g.State.scrollPropertyTop="pageYOffset"):(g.State.scrollAnchor=i.documentElement||i.body.parentNode||i.body,g.State.scrollPropertyLeft="scrollLeft",g.State.scrollPropertyTop="scrollTop");var f=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t,i,o){var n={x:t.x+o.dx*i,v:t.v+o.dv*i,tension:t.tension,friction:t.friction};return{dx:n.v,dv:e(n)}}function i(i,o){var n={dx:i.v,dv:e(i)},s=t(i,.5*o,n),r=t(i,.5*o,s),a=t(i,o,r),l=1/6*(n.dx+2*(s.dx+r.dx)+a.dx),c=1/6*(n.dv+2*(s.dv+r.dv)+a.dv);return i.x=i.x+l*o,i.v=i.v+c*o,i}return function e(t,o,n){var s,r,a,l={x:-1,v:0,tension:null,friction:null},c=[0],d=0;for(t=parseFloat(t)||500,o=parseFloat(o)||20,n=n||null,l.tension=t,l.friction=o,r=(s=null!==n)?(d=e(t,o))/n*.016:.016;a=i(a||l,r),c.push(1+a.x),d+=16,Math.abs(a.x)>1e-4&&Math.abs(a.v)>1e-4;);return s?function(e){return c[e*(c.length-1)|0]}:d}}();g.Easings={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},spring:function(e){return 1-Math.cos(4.5*e*Math.PI)*Math.exp(6*-e)}},c.each([["ease",[.25,.1,.25,1]],["ease-in",[.42,0,1,1]],["ease-out",[0,0,.58,1]],["ease-in-out",[.42,0,.58,1]],["easeInSine",[.47,0,.745,.715]],["easeOutSine",[.39,.575,.565,1]],["easeInOutSine",[.445,.05,.55,.95]],["easeInQuad",[.55,.085,.68,.53]],["easeOutQuad",[.25,.46,.45,.94]],["easeInOutQuad",[.455,.03,.515,.955]],["easeInCubic",[.55,.055,.675,.19]],["easeOutCubic",[.215,.61,.355,1]],["easeInOutCubic",[.645,.045,.355,1]],["easeInQuart",[.895,.03,.685,.22]],["easeOutQuart",[.165,.84,.44,1]],["easeInOutQuart",[.77,0,.175,1]],["easeInQuint",[.755,.05,.855,.06]],["easeOutQuint",[.23,1,.32,1]],["easeInOutQuint",[.86,0,.07,1]],["easeInExpo",[.95,.05,.795,.035]],["easeOutExpo",[.19,1,.22,1]],["easeInOutExpo",[1,0,0,1]],["easeInCirc",[.6,.04,.98,.335]],["easeOutCirc",[.075,.82,.165,1]],["easeInOutCirc",[.785,.135,.15,.86]]],function(e,t){g.Easings[t[0]]=y.apply(null,t[1])});var m=g.CSS={RegEx:{isHex:/^#([A-f\d]{3}){1,2}#x2F;i,valueUnwrap:/^[A-z]+\((.*)\)#x2F;i,wrappedValueAlreadyExtracted:/[0-9.]+ [0-9.]+ [0-9.]+( [0-9.]+)?/,valueSplit:/([A-z]+\(.+\))|(([A-z0-9#-.]+?)(?=\s|$))/gi},Lists:{colors:["fill","stroke","stopColor","color","backgroundColor","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","outlineColor"],transformsBase:["translateX","translateY","scale","scaleX","scaleY","skewX","skewY","rotateZ"],transforms3D:["transformPerspective","translateZ","scaleZ","rotateX","rotateY"]},Hooks:{templates:{textShadow:["Color X Y Blur","black 0px 0px 0px"],boxShadow:["Color X Y Blur Spread","black 0px 0px 0px 0px"],clip:["Top Right Bottom Left","0px 0px 0px 0px"],backgroundPosition:["X Y","0% 0%"],transformOrigin:["X Y Z","50% 50% 0px"],perspectiveOrigin:["X Y","50% 50%"]},registered:{},register:function(){for(var e=0;e<m.Lists.colors.length;e++){var t="color"===m.Lists.colors[e]?"0 0 0 1":"255 255 255 1";m.Hooks.templates[m.Lists.colors[e]]=["Red Green Blue Alpha",t]}var i,o,n;if(s)for(i in m.Hooks.templates){n=(o=m.Hooks.templates[i])[0].split(" ");var r=o[1].match(m.RegEx.valueSplit);"Color"===n[0]&&(n.push(n.shift()),r.push(r.shift()),m.Hooks.templates[i]=[n.join(" "),r.join(" ")])}for(i in m.Hooks.templates)for(var e in n=(o=m.Hooks.templates[i])[0].split(" ")){var a=i+n[e],l=e;m.Hooks.registered[a]=[i,l]}},getRoot:function(e){var t=m.Hooks.registered[e];return t?t[0]:e},cleanRootPropertyValue:function(e,t){return m.RegEx.valueUnwrap.test(t)&&(t=t.match(m.RegEx.valueUnwrap)[1]),m.Values.isCSSNullValue(t)&&(t=m.Hooks.templates[e][1]),t},extractValue:function(e,t){var i=m.Hooks.registered[e];if(i){var o=i[0],n=i[1];return(t=m.Hooks.cleanRootPropertyValue(o,t)).toString().match(m.RegEx.valueSplit)[n]}return t},injectValue:function(e,t,i){var o=m.Hooks.registered[e];if(o){var n,s=o[0],r=o[1];return(n=(i=m.Hooks.cleanRootPropertyValue(s,i)).toString().match(m.RegEx.valueSplit))[r]=t,n.join(" ")}return i}},Normalizations:{registered:{clip:function(e,t,i){switch(e){case"name":return"clip";case"extract":var o;return o=m.RegEx.wrappedValueAlreadyExtracted.test(i)?i:(o=i.toString().match(m.RegEx.valueUnwrap))?o[1].replace(/,(\s+)?/g," "):i;case"inject":return"rect("+i+")"}},blur:function(e,t,i){switch(e){case"name":return g.State.isFirefox?"filter":"-webkit-filter";case"extract":var o=parseFloat(i);if(!o&&0!==o){var n=i.toString().match(/blur\(([0-9]+[A-z]+)\)/i);o=n?n[1]:0}return o;case"inject":return parseFloat(i)?"blur("+i+")":"none"}},opacity:function(e,t,i){if(s<=8)switch(e){case"name":return"filter";case"extract":var o=i.toString().match(/alpha\(opacity=(.*)\)/i);return i=o?o[1]/100:1;case"inject":return t.style.zoom=1,parseFloat(i)>=1?"":"alpha(opacity="+parseInt(100*parseFloat(i),10)+")"}else switch(e){case"name":return"opacity";case"extract":case"inject":return i}}},register:function(){s<=9||g.State.isGingerbread||(m.Lists.transformsBase=m.Lists.transformsBase.concat(m.Lists.transforms3D));for(var e=0;e<m.Lists.transformsBase.length;e++)!function(){var t=m.Lists.transformsBase[e];m.Normalizations.registered[t]=function(e,i,n){switch(e){case"name":return"transform";case"extract":return w(i)===o||w(i).transformCache[t]===o?/^scale/i.test(t)?1:0:w(i).transformCache[t].replace(/[()]/g,"");case"inject":var s=!1;switch(t.substr(0,t.length-1)){case"translate":s=!/(%|px|em|rem|vw|vh|\d)#x2F;i.test(n);break;case"scal":case"scale":g.State.isAndroid&&w(i).transformCache[t]===o&&n<1&&(n=1),s=!/(\d)#x2F;i.test(n);break;case"skew":case"rotate":s=!/(deg|\d)#x2F;i.test(n)}return s||(w(i).transformCache[t]="("+n+")"),w(i).transformCache[t]}}}();for(e=0;e<m.Lists.colors.length;e++)!function(){var t=m.Lists.colors[e];m.Normalizations.registered[t]=function(e,i,n){switch(e){case"name":return t;case"extract":var r;if(m.RegEx.wrappedValueAlreadyExtracted.test(n))r=n;else{var a,l={black:"rgb(0, 0, 0)",blue:"rgb(0, 0, 255)",gray:"rgb(128, 128, 128)",green:"rgb(0, 128, 0)",red:"rgb(255, 0, 0)",white:"rgb(255, 255, 255)"};/^[A-z]+#x2F;i.test(n)?a=l[n]!==o?l[n]:l.black:m.RegEx.isHex.test(n)?a="rgb("+m.Values.hexToRgb(n).join(" ")+")":/^rgba?\(/i.test(n)||(a=l.black),r=(a||n).toString().match(m.RegEx.valueUnwrap)[1].replace(/,(\s+)?/g," ")}return s<=8||3!==r.split(" ").length||(r+=" 1"),r;case"inject":return s<=8?4===n.split(" ").length&&(n=n.split(/\s+/).slice(0,3).join(" ")):3===n.split(" ").length&&(n+=" 1"),(s<=8?"rgb":"rgba")+"("+n.replace(/\s+/g,",").replace(/\.(\d)+(?=,)/g,"")+")"}}}()}},Names:{camelCase:function(e){return e.replace(/-(\w)/g,function(e,t){return t.toUpperCase()})},SVGAttribute:function(e){var t="width|height|x|y|cx|cy|r|rx|ry|x1|x2|y1|y2";return(s||g.State.isAndroid&&!g.State.isChrome)&&(t+="|transform"),new RegExp("^("+t+")quot;,"i").test(e)},prefixCheck:function(e){if(g.State.prefixMatches[e])return[g.State.prefixMatches[e],!0];for(var t=["","Webkit","Moz","ms","O"],i=0,o=t.length;i<o;i++){var n;if(n=0===i?e:t[i]+e.replace(/^\w/,function(e){return e.toUpperCase()}),d.isString(g.State.prefixElement.style[n]))return g.State.prefixMatches[e]=n,[n,!0]}return[e,!1]}},Values:{hexToRgb:function(e){var t;return e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])#x2F;i,function(e,t,i,o){return t+t+i+i+o+o}),(t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})#x2F;i.exec(e))?[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]:[0,0,0]},isCSSNullValue:function(e){return 0==e||/^(none|auto|transparent|(rgba\(0, ?0, ?0, ?0\)))#x2F;i.test(e)},getUnitType:function(e){return/^(rotate|skew)/i.test(e)?"deg":/(^(scale|scaleX|scaleY|scaleZ|alpha|flexGrow|flexHeight|zIndex|fontWeight)$)|((opacity|red|green|blue|alpha)$)/i.test(e)?"":"px"},getDisplayType:function(e){var t=e&&e.tagName.toString().toLowerCase();return/^(b|big|i|small|tt|abbr|acronym|cite|code|dfn|em|kbd|strong|samp|var|a|bdo|br|img|map|object|q|script|span|sub|sup|button|input|label|select|textarea)#x2F;i.test(t)?"inline":/^(li)#x2F;i.test(t)?"list-item":/^(tr)#x2F;i.test(t)?"table-row":/^(table)#x2F;i.test(t)?"table":/^(tbody)#x2F;i.test(t)?"table-row-group":"block"},addClass:function(e,t){e.classList?e.classList.add(t):e.className+=(e.className.length?" ":"")+t},removeClass:function(e,t){e.classList?e.classList.remove(t):e.className=e.className.toString().replace(new RegExp("(^|\\s)"+t.split(" ").join("|")+"(\\s|$)","gi")," ")}},getPropertyValue:function(e,i,n,r){function a(e,i){var n=0;if(s<=8)n=c.css(e,i);else{var l,d=!1;function h(){d&&m.setPropertyValue(e,"display","none")}if(/^(width|height)#x2F;.test(i)&&0===m.getPropertyValue(e,"display")&&(d=!0,m.setPropertyValue(e,"display",m.Values.getDisplayType(e))),!r){if("height"===i&&"border-box"!==m.getPropertyValue(e,"boxSizing").toString().toLowerCase()){var p=e.offsetHeight-(parseFloat(m.getPropertyValue(e,"borderTopWidth"))||0)-(parseFloat(m.getPropertyValue(e,"borderBottomWidth"))||0)-(parseFloat(m.getPropertyValue(e,"paddingTop"))||0)-(parseFloat(m.getPropertyValue(e,"paddingBottom"))||0);return h(),p}if("width"===i&&"border-box"!==m.getPropertyValue(e,"boxSizing").toString().toLowerCase()){var u=e.offsetWidth-(parseFloat(m.getPropertyValue(e,"borderLeftWidth"))||0)-(parseFloat(m.getPropertyValue(e,"borderRightWidth"))||0)-(parseFloat(m.getPropertyValue(e,"paddingLeft"))||0)-(parseFloat(m.getPropertyValue(e,"paddingRight"))||0);return h(),u}}l=w(e)===o?t.getComputedStyle(e,null):w(e).computedStyle?w(e).computedStyle:w(e).computedStyle=t.getComputedStyle(e,null),"borderColor"===i&&(i="borderTopColor"),""!==(n=9===s&&"filter"===i?l.getPropertyValue(i):l[i])&&null!==n||(n=e.style[i]),h()}if("auto"===n&&/^(top|right|bottom|left)#x2F;i.test(i)){var g=a(e,"position");("fixed"===g||"absolute"===g&&/top|left/i.test(i))&&(n=c(e).position()[i]+"px")}return n}var l;if(m.Hooks.registered[i]){var d=i,h=m.Hooks.getRoot(d);n===o&&(n=m.getPropertyValue(e,m.Names.prefixCheck(h)[0])),m.Normalizations.registered[h]&&(n=m.Normalizations.registered[h]("extract",e,n)),l=m.Hooks.extractValue(d,n)}else if(m.Normalizations.registered[i]){var p,u;"transform"!==(p=m.Normalizations.registered[i]("name",e))&&(u=a(e,m.Names.prefixCheck(p)[0]),m.Values.isCSSNullValue(u)&&m.Hooks.templates[i]&&(u=m.Hooks.templates[i][1])),l=m.Normalizations.registered[i]("extract",e,u)}if(!/^[\d-]/.test(l))if(w(e)&&w(e).isSVG&&m.Names.SVGAttribute(i))if(/^(height|width)#x2F;i.test(i))try{l=e.getBBox()[i]}catch(e){l=0}else l=e.getAttribute(i);else l=a(e,m.Names.prefixCheck(i)[0]);return m.Values.isCSSNullValue(l)&&(l=0),g.debug>=2&&console.log("Get "+i+": "+l),l},setPropertyValue:function(e,i,o,n,r){var a=i;if("scroll"===i)r.container?r.container["scroll"+r.direction]=o:"Left"===r.direction?t.scrollTo(o,r.alternateValue):t.scrollTo(r.alternateValue,o);else if(m.Normalizations.registered[i]&&"transform"===m.Normalizations.registered[i]("name",e))m.Normalizations.registered[i]("inject",e,o),a="transform",o=w(e).transformCache[i];else{if(m.Hooks.registered[i]){var l=i,c=m.Hooks.getRoot(i);n=n||m.getPropertyValue(e,c),o=m.Hooks.injectValue(l,o,n),i=c}if(m.Normalizations.registered[i]&&(o=m.Normalizations.registered[i]("inject",e,o),i=m.Normalizations.registered[i]("name",e)),a=m.Names.prefixCheck(i)[0],s<=8)try{e.style[a]=o}catch(e){g.debug&&console.log("Browser does not support ["+o+"] for ["+a+"]")}else w(e)&&w(e).isSVG&&m.Names.SVGAttribute(i)?e.setAttribute(i,o):e.style[a]=o;g.debug>=2&&console.log("Set "+i+" ("+a+"): "+o)}return[a,o]},flushTransformCache:function(e){var t="";if((s||g.State.isAndroid&&!g.State.isChrome)&&w(e).isSVG){function i(t){return parseFloat(m.getPropertyValue(e,t))}var o={translate:[i("translateX"),i("translateY")],skewX:[i("skewX")],skewY:[i("skewY")],scale:1!==i("scale")?[i("scale"),i("scale")]:[i("scaleX"),i("scaleY")],rotate:[i("rotateZ"),0,0]};c.each(w(e).transformCache,function(e){/^translate/i.test(e)?e="translate":/^scale/i.test(e)?e="scale":/^rotate/i.test(e)&&(e="rotate"),o[e]&&(t+=e+"("+o[e].join(" ")+") ",delete o[e])})}else{var n,r;c.each(w(e).transformCache,function(i){if(n=w(e).transformCache[i],"transformPerspective"===i)return r=n,!0;9===s&&"rotateZ"===i&&(i="rotate"),t+=i+n+" "}),r&&(t="perspective"+r+" "+t)}m.setPropertyValue(e,"transform",t)}};m.Hooks.register(),m.Normalizations.register(),g.hook=function(e,t,i){var n=o;return e=l(e),c.each(e,function(e,s){if(w(s)===o&&g.init(s),i===o)n===o&&(n=g.CSS.getPropertyValue(s,t));else{var r=g.CSS.setPropertyValue(s,t,i);"transform"===r[0]&&g.CSS.flushTransformCache(s),n=r}}),n};var _=function(){function e(){return n?V.promise||null:s}var n,s,r,a,h,u,f=arguments[0]&&(arguments[0].p||c.isPlainObject(arguments[0].properties)&&!arguments[0].properties.names||d.isString(arguments[0].properties));if(d.isWrapped(this)?(n=!1,r=0,a=this,s=this):(n=!0,r=1,a=f?arguments[0].elements||arguments[0].e:arguments[0]),a=l(a)){f?(h=arguments[0].properties||arguments[0].p,u=arguments[0].options||arguments[0].o):(h=arguments[r],u=arguments[r+1]);var v=a.length,y=0;if(!/^(stop|finish|finishAll)#x2F;i.test(h)&&!c.isPlainObject(u)){u={};for(var C=r+1;C<arguments.length;C++)d.isArray(arguments[C])||!/^(fast|normal|slow)#x2F;i.test(arguments[C])&&!/^\d/.test(arguments[C])?d.isString(arguments[C])||d.isArray(arguments[C])?u.easing=arguments[C]:d.isFunction(arguments[C])&&(u.complete=arguments[C]):u.duration=arguments[C]}var S,V={promise:null,resolver:null,rejecter:null};switch(n&&g.Promise&&(V.promise=new g.Promise(function(e,t){V.resolver=e,V.rejecter=t})),h){case"scroll":S="scroll";break;case"reverse":S="reverse";break;case"finish":case"finishAll":case"stop":c.each(a,function(e,t){w(t)&&w(t).delayTimer&&(clearTimeout(w(t).delayTimer.setTimeout),w(t).delayTimer.next&&w(t).delayTimer.next(),delete w(t).delayTimer),"finishAll"!==h||!0!==u&&!d.isString(u)||(c.each(c.queue(t,d.isString(u)?u:""),function(e,t){d.isFunction(t)&&t()}),c.queue(t,d.isString(u)?u:"",[]))});var T=[];return c.each(g.State.calls,function(e,t){t&&c.each(t[1],function(i,n){var s=u===o?"":u;if(!0!==s&&t[2].queue!==s&&(u!==o||!1!==t[2].queue))return!0;c.each(a,function(i,o){o===n&&((!0===u||d.isString(u))&&(c.each(c.queue(o,d.isString(u)?u:""),function(e,t){d.isFunction(t)&&t(null,!0)}),c.queue(o,d.isString(u)?u:"",[])),"stop"===h?(w(o)&&w(o).tweensContainer&&!1!==s&&c.each(w(o).tweensContainer,function(e,t){t.endValue=t.currentValue}),T.push(e)):"finish"!==h&&"finishAll"!==h||(t[2].duration=1))})})}),"stop"===h&&(c.each(T,function(e,t){k(t,!0)}),V.promise&&V.resolver(a)),e();default:if(!c.isPlainObject(h)||d.isEmptyObject(h)){if(d.isString(h)&&g.Redirects[h]){var B=(M=c.extend({},u)).duration,E=M.delay||0;return!0===M.backwards&&(a=c.extend(!0,[],a).reverse()),c.each(a,function(e,t){parseFloat(M.stagger)?M.delay=E+parseFloat(M.stagger)*e:d.isFunction(M.stagger)&&(M.delay=E+M.stagger.call(t,e,v)),M.drag&&(M.duration=parseFloat(B)||(/^(callout|transition)/.test(h)?1e3:p),M.duration=Math.max(M.duration*(M.backwards?1-e/v:(e+1)/v),.75*M.duration,200)),g.Redirects[h].call(t,t,M||{},e,v,a,V.promise?V:o)}),e()}var P="Velocity: First argument ("+h+") was not a property map, a known action, or a registered redirect. Aborting.";return V.promise?V.rejecter(new Error(P)):console.log(P),e()}S="start"}var M,A,D={lastParent:null,lastPosition:null,lastFontSize:null,lastPercentToPxWidth:null,lastPercentToPxHeight:null,lastEmToPx:null,remToPx:null,vwToPx:null,vhToPx:null},R=[];if(c.each(a,function(e,n){d.isNode(n)&&function(){var e,n=this,s=c.extend({},g.defaults,u),r={};switch(w(n)===o&&g.init(n),parseFloat(s.delay)&&!1!==s.queue&&c.queue(n,s.queue,function(e){g.velocityQueueEntryFlag=!0,w(n).delayTimer={setTimeout:setTimeout(e,parseFloat(s.delay)),next:e}}),s.duration.toString().toLowerCase()){case"fast":s.duration=200;break;case"normal":s.duration=p;break;case"slow":s.duration=600;break;default:s.duration=parseFloat(s.duration)||1}function l(l){if(s.begin&&0===y)try{s.begin.call(a,a)}catch(e){setTimeout(function(){throw e},1)}if("scroll"===S){var p,f,_,k=/^x#x2F;i.test(s.axis)?"Left":"Top",C=parseFloat(s.offset)||0;s.container?d.isWrapped(s.container)||d.isNode(s.container)?(s.container=s.container[0]||s.container,_=(p=s.container["scroll"+k])+c(n).position()[k.toLowerCase()]+C):s.container=null:(p=g.State.scrollAnchor[g.State["scrollProperty"+k]],f=g.State.scrollAnchor[g.State["scrollProperty"+("Left"===k?"Top":"Left")]],_=c(n).offset()[k.toLowerCase()]+C),r={scroll:{rootPropertyValue:!1,startValue:p,currentValue:p,endValue:_,unitType:"",easing:s.easing,scrollData:{container:s.container,direction:k,alternateValue:f}},element:n},g.debug&&console.log("tweensContainer (scroll): ",r.scroll,n)}else if("reverse"===S){if(!w(n).tweensContainer)return void c.dequeue(n,s.queue);"none"===w(n).opts.display&&(w(n).opts.display="auto"),"hidden"===w(n).opts.visibility&&(w(n).opts.visibility="visible"),w(n).opts.loop=!1,w(n).opts.begin=null,w(n).opts.complete=null,u.easing||delete s.easing,u.duration||delete s.duration,s=c.extend({},w(n).opts,s);var T=c.extend(!0,{},w(n).tweensContainer);for(var B in T)if("element"!==B){var E=T[B].startValue;T[B].startValue=T[B].currentValue=T[B].endValue,T[B].endValue=E,d.isEmptyObject(u)||(T[B].easing=s.easing),g.debug&&console.log("reverse tweensContainer ("+B+"): "+JSON.stringify(T[B]),n)}r=T}else if("start"===S){function P(e,t){var i=o,r=o,a=o;return d.isArray(e)?(i=e[0],!d.isArray(e[1])&&/^[\d-]/.test(e[1])||d.isFunction(e[1])||m.RegEx.isHex.test(e[1])?a=e[1]:(d.isString(e[1])&&!m.RegEx.isHex.test(e[1])||d.isArray(e[1]))&&(r=t?e[1]:b(e[1],s.duration),e[2]!==o&&(a=e[2]))):i=e,t||(r=r||s.easing),d.isFunction(i)&&(i=i.call(n,y,v)),d.isFunction(a)&&(a=a.call(n,y,v)),[i||0,r,a]}for(var M in w(n).tweensContainer&&!0===w(n).isAnimating&&(T=w(n).tweensContainer),c.each(h,function(e,t){if(RegExp("^"+m.Lists.colors.join("$|^")+"quot;).test(e)){var i=P(t,!0),n=i[0],s=i[1],r=i[2];if(m.RegEx.isHex.test(n)){for(var a=["Red","Green","Blue"],l=m.Values.hexToRgb(n),c=r?m.Values.hexToRgb(r):o,d=0;d<a.length;d++){var p=[l[d]];s&&p.push(s),c!==o&&p.push(c[d]),h[e+a[d]]=p}delete h[e]}}}),h){var A=P(h[M]),F=A[0],O=A[1],z=A[2];M=m.Names.camelCase(M);var I=m.Hooks.getRoot(M),N=!1;if(w(n).isSVG||"tween"===I||!1!==m.Names.prefixCheck(I)[1]||m.Normalizations.registered[I]!==o){(s.display!==o&&null!==s.display&&"none"!==s.display||s.visibility!==o&&"hidden"!==s.visibility)&&/opacity|filter/.test(M)&&!z&&0!==F&&(z=0),s._cacheValues&&T&&T[M]?(z===o&&(z=T[M].endValue+T[M].unitType),N=w(n).rootPropertyValueCache[I]):m.Hooks.registered[M]?z===o?(N=m.getPropertyValue(n,I),z=m.getPropertyValue(n,M,N)):N=m.Hooks.templates[I][1]:z===o&&(z=m.getPropertyValue(n,M));var $,L,W,H=!1;if(z=($=U(M,z))[0],W=$[1],F=($=U(M,F))[0].replace(/^([+-\/*])=/,function(e,t){return H=t,""}),L=$[1],z=parseFloat(z)||0,F=parseFloat(F)||0,"%"===L&&(/^(fontSize|lineHeight)#x2F;.test(M)?(F/=100,L="em"):/^scale/.test(M)?(F/=100,L=""):/(Red|Green|Blue)#x2F;i.test(M)&&(F=F/100*255,L="")),/[\/*]/.test(H))L=W;else if(W!==L&&0!==z)if(0===F)L=W;else{e=e||q();var j=/margin|padding|left|right|width|text|word|letter/i.test(M)||/X#x2F;.test(M)||"x"===M?"x":"y";switch(W){case"%":z*="x"===j?e.percentToPxWidth:e.percentToPxHeight;break;case"px":break;default:z*=e[W+"ToPx"]}switch(L){case"%":z*=1/("x"===j?e.percentToPxWidth:e.percentToPxHeight);break;case"px":break;default:z*=1/e[L+"ToPx"]}}switch(H){case"+":F=z+F;break;case"-":F=z-F;break;case"*":F*=z;break;case"/":F=z/F}r[M]={rootPropertyValue:N,startValue:z,currentValue:z,endValue:F,unitType:L,easing:O},g.debug&&console.log("tweensContainer ("+M+"): "+JSON.stringify(r[M]),n)}else g.debug&&console.log("Skipping ["+I+"] due to a lack of browser support.");function U(e,t){var i,o;return o=(t||"0").toString().toLowerCase().replace(/[%A-z]+#x2F;,function(e){return i=e,""}),i||(i=m.Values.getUnitType(e)),[o,i]}function q(){var e={myParent:n.parentNode||i.body,position:m.getPropertyValue(n,"position"),fontSize:m.getPropertyValue(n,"fontSize")},o=e.position===D.lastPosition&&e.myParent===D.lastParent,s=e.fontSize===D.lastFontSize;D.lastParent=e.myParent,D.lastPosition=e.position,D.lastFontSize=e.fontSize;var r={};if(s&&o)r.emToPx=D.lastEmToPx,r.percentToPxWidth=D.lastPercentToPxWidth,r.percentToPxHeight=D.lastPercentToPxHeight;else{var a=w(n).isSVG?i.createElementNS("http://www.w3.org/2000/svg","rect"):i.createElement("div");g.init(a),e.myParent.appendChild(a),c.each(["overflow","overflowX","overflowY"],function(e,t){g.CSS.setPropertyValue(a,t,"hidden")}),g.CSS.setPropertyValue(a,"position",e.position),g.CSS.setPropertyValue(a,"fontSize",e.fontSize),g.CSS.setPropertyValue(a,"boxSizing","content-box"),c.each(["minWidth","maxWidth","width","minHeight","maxHeight","height"],function(e,t){g.CSS.setPropertyValue(a,t,"100%")}),g.CSS.setPropertyValue(a,"paddingLeft","100em"),r.percentToPxWidth=D.lastPercentToPxWidth=(parseFloat(m.getPropertyValue(a,"width",null,!0))||1)/100,r.percentToPxHeight=D.lastPercentToPxHeight=(parseFloat(m.getPropertyValue(a,"height",null,!0))||1)/100,r.emToPx=D.lastEmToPx=(parseFloat(m.getPropertyValue(a,"paddingLeft"))||1)/100,e.myParent.removeChild(a)}return null===D.remToPx&&(D.remToPx=parseFloat(m.getPropertyValue(i.body,"fontSize"))||16),null===D.vwToPx&&(D.vwToPx=parseFloat(t.innerWidth)/100,D.vhToPx=parseFloat(t.innerHeight)/100),r.remToPx=D.remToPx,r.vwToPx=D.vwToPx,r.vhToPx=D.vhToPx,g.debug>=1&&console.log("Unit ratios: "+JSON.stringify(r),n),r}}r.element=n}r.element&&(m.Values.addClass(n,"velocity-animating"),R.push(r),""===s.queue&&(w(n).tweensContainer=r,w(n).opts=s),w(n).isAnimating=!0,y===v-1?(g.State.calls.push([R,a,s,null,V.resolver]),!1===g.State.isTicking&&(g.State.isTicking=!0,x())):y++)}!1!==g.mock&&(!0===g.mock?s.duration=s.delay=1:(s.duration*=parseFloat(g.mock)||1,s.delay*=parseFloat(g.mock)||1)),s.easing=b(s.easing,s.duration),s.begin&&!d.isFunction(s.begin)&&(s.begin=null),s.progress&&!d.isFunction(s.progress)&&(s.progress=null),s.complete&&!d.isFunction(s.complete)&&(s.complete=null),s.display!==o&&null!==s.display&&(s.display=s.display.toString().toLowerCase(),"auto"===s.display&&(s.display=g.CSS.Values.getDisplayType(n))),s.visibility!==o&&null!==s.visibility&&(s.visibility=s.visibility.toString().toLowerCase()),s.mobileHA=s.mobileHA&&g.State.isMobile&&!g.State.isGingerbread,!1===s.queue?s.delay?setTimeout(l,s.delay):l():c.queue(n,s.queue,function(e,t){if(!0===t)return V.promise&&V.resolver(a),!0;g.velocityQueueEntryFlag=!0,l()}),""!==s.queue&&"fx"!==s.queue||"inprogress"===c.queue(n)[0]||c.dequeue(n)}.call(n)}),(M=c.extend({},g.defaults,u)).loop=parseInt(M.loop),A=2*M.loop-1,M.loop)for(var F=0;F<A;F++){var O={delay:M.delay,progress:M.progress};F===A-1&&(O.display=M.display,O.visibility=M.visibility,O.complete=M.complete),_(a,"reverse",O)}return e()}};(g=c.extend(_,g)).animate=_;var v=t.requestAnimationFrame||a;return g.State.isMobile||i.hidden===o||i.addEventListener("visibilitychange",function(){i.hidden?(v=function(e){return setTimeout(function(){e(!0)},16)},x()):v=t.requestAnimationFrame||a}),e.Velocity=g,e!==t&&(e.fn.velocity=_,e.fn.velocity.defaults=g.defaults),c.each(["Down","Up"],function(e,t){g.Redirects["slide"+t]=function(e,i,n,s,r,a){var l=c.extend({},i),d=l.begin,h=l.complete,p={height:"",marginTop:"",marginBottom:"",paddingTop:"",paddingBottom:""},u={};l.display===o&&(l.display="Down"===t?"inline"===g.CSS.Values.getDisplayType(e)?"inline-block":"block":"none"),l.begin=function(){for(var i in d&&d.call(r,r),p){u[i]=e.style[i];var o=g.CSS.getPropertyValue(e,i);p[i]="Down"===t?[o,0]:[0,o]}u.overflow=e.style.overflow,e.style.overflow="hidden"},l.complete=function(){for(var t in u)e.style[t]=u[t];h&&h.call(r,r),a&&a.resolver(r)},g(e,p,l)}}),c.each(["In","Out"],function(e,t){g.Redirects["fade"+t]=function(e,i,n,s,r,a){var l=c.extend({},i),d={opacity:"In"===t?1:0},h=l.complete;l.complete=n!==s-1?l.begin=null:function(){h&&h.call(r,r),a&&a.resolver(r)},l.display===o&&(l.display="In"===t?"auto":"none"),g(this,d,l)}}),g}function w(e){var t=c.data(e,"velocity");return null===t?o:t}function y(e,i,o,n){var s=4,r=.001,a=1e-7,l=10,c=11,d=1/(c-1),h="Float32Array"in t;if(4!==arguments.length)return!1;for(var p=0;p<4;++p)if("number"!=typeof arguments[p]||isNaN(arguments[p])||!isFinite(arguments[p]))return!1;e=Math.min(e,1),o=Math.min(o,1),e=Math.max(e,0),o=Math.max(o,0);var u=h?new Float32Array(c):new Array(c);function g(e,t){return 1-3*t+3*e}function f(e,t){return 3*t-6*e}function m(e){return 3*e}function _(e,t,i){return((g(t,i)*e+f(t,i))*e+m(t))*e}function v(e,t,i){return 3*g(t,i)*e*e+2*f(t,i)*e+m(t)}function w(t){for(var i=0,n=1,h=c-1;n!=h&&u[n]<=t;++n)i+=d;var p=i+(t-u[--n])/(u[n+1]-u[n])*d,g=v(p,e,o);return g>=r?function(t,i){for(var n=0;n<s;++n){var r=v(i,e,o);if(0===r)return i;i-=(_(i,e,o)-t)/r}return i}(t,p):0==g?p:function(t,i,n){var s,r,c=0;do{(s=_(r=i+(n-i)/2,e,o)-t)>0?n=r:i=r}while(Math.abs(s)>a&&++c<l);return r}(t,i,i+d)}var y=!1;function b(){y=!0,e==i&&o==n||function(){for(var t=0;t<c;++t)u[t]=_(t*d,e,o)}()}var x=function(t){return y||b(),e===i&&o===n?t:0===t?0:1===t?1:_(w(t),i,n)};x.getControlPoints=function(){return[{x:e,y:i},{x:o,y:n}]};var k="generateBezier("+[e,i,o,n]+")";return x.toString=function(){return k},x}function b(e,t){var i=e;return d.isString(e)?g.Easings[e]||(i=!1):i=d.isArray(e)&&1===e.length?function(e){return function(t){return Math.round(t*e)*(1/e)}}.apply(null,e):d.isArray(e)&&2===e.length?f.apply(null,e.concat([t])):!(!d.isArray(e)||4!==e.length)&&y.apply(null,e),!1===i&&(i=g.Easings[g.defaults.easing]?g.defaults.easing:u),i}function x(e){if(e){var t=(new Date).getTime(),i=g.State.calls.length;i>1e4&&(g.State.calls=function(e){for(var t=-1,i=e?e.length:0,o=[];++t<i;){var n=e[t];n&&o.push(n)}return o}(g.State.calls));for(var n=0;n<i;n++)if(g.State.calls[n]){var s=g.State.calls[n],r=s[0],a=s[2],l=s[3],h=!!l,p=null;l||(l=g.State.calls[n][3]=t-16);for(var u=Math.min((t-l)/a.duration,1),f=0,_=r.length;f<_;f++){var y=r[f],b=y.element;if(w(b)){var C=!1;if(a.display!==o&&null!==a.display&&"none"!==a.display){if("flex"===a.display){c.each(["-webkit-box","-moz-box","-ms-flexbox","-webkit-flex"],function(e,t){m.setPropertyValue(b,"display",t)})}m.setPropertyValue(b,"display",a.display)}for(var S in a.visibility!==o&&"hidden"!==a.visibility&&m.setPropertyValue(b,"visibility",a.visibility),y)if("element"!==S){var V,T=y[S],B=d.isString(T.easing)?g.Easings[T.easing]:T.easing;if(1===u)V=T.endValue;else{var E=T.endValue-T.startValue;if(V=T.startValue+E*B(u,a,E),!h&&V===T.currentValue)continue}if(T.currentValue=V,"tween"===S)p=V;else{if(m.Hooks.registered[S]){var P=m.Hooks.getRoot(S),M=w(b).rootPropertyValueCache[P];M&&(T.rootPropertyValue=M)}var A=m.setPropertyValue(b,S,T.currentValue+(0===parseFloat(V)?"":T.unitType),T.rootPropertyValue,T.scrollData);m.Hooks.registered[S]&&(m.Normalizations.registered[P]?w(b).rootPropertyValueCache[P]=m.Normalizations.registered[P]("extract",null,A[1]):w(b).rootPropertyValueCache[P]=A[1]),"transform"===A[0]&&(C=!0)}}a.mobileHA&&w(b).transformCache.translate3d===o&&(w(b).transformCache.translate3d="(0px, 0px, 0px)",C=!0),C&&m.flushTransformCache(b)}}a.display!==o&&"none"!==a.display&&(g.State.calls[n][2].display=!1),a.visibility!==o&&"hidden"!==a.visibility&&(g.State.calls[n][2].visibility=!1),a.progress&&a.progress.call(s[1],s[1],u,Math.max(0,l+a.duration-t),l,p),1===u&&k(n)}}g.State.isTicking&&v(x)}function k(e,t){if(!g.State.calls[e])return!1;for(var i=g.State.calls[e][0],n=g.State.calls[e][1],s=g.State.calls[e][2],r=g.State.calls[e][4],a=!1,l=0,d=i.length;l<d;l++){var h=i[l].element;if(t||s.loop||("none"===s.display&&m.setPropertyValue(h,"display",s.display),"hidden"===s.visibility&&m.setPropertyValue(h,"visibility",s.visibility)),!0!==s.loop&&(c.queue(h)[1]===o||!/\.velocityQueueEntryFlag/i.test(c.queue(h)[1]))&&w(h)){w(h).isAnimating=!1,w(h).rootPropertyValueCache={};var p=!1;c.each(m.Lists.transforms3D,function(e,t){var i=/^scale/.test(t)?1:0,n=w(h).transformCache[t];w(h).transformCache[t]!==o&&new RegExp("^\\("+i+"[^.]").test(n)&&(p=!0,delete w(h).transformCache[t])}),s.mobileHA&&(p=!0,delete w(h).transformCache.translate3d),p&&m.flushTransformCache(h),m.Values.removeClass(h,"velocity-animating")}if(!t&&s.complete&&!s.loop&&l===d-1)try{s.complete.call(n,n)}catch(e){setTimeout(function(){throw e},1)}r&&!0!==s.loop&&r(n),w(h)&&!0===s.loop&&!t&&(c.each(w(h).tweensContainer,function(e,t){/^rotate/.test(e)&&360===parseFloat(t.endValue)&&(t.endValue=0,t.startValue=360),/^backgroundPosition/.test(e)&&100===parseFloat(t.endValue)&&"%"===t.unitType&&(t.endValue=0,t.startValue=100)}),g(h,"reverse",{loop:!0,delay:s.delay})),!1!==s.queue&&c.dequeue(h,s.queue)}g.State.calls[e]=!1;for(var u=0,f=g.State.calls.length;u<f;u++)if(!1!==g.State.calls[u]){a=!0;break}!1===a&&(g.State.isTicking=!1,delete g.State.calls,g.State.calls=[])}r.fn.velocity=r.fn.animate}(window.jQuery||window.Zepto||window,window,document)},"object"==typeof e.exports?e.exports=s():void 0===(n="function"==typeof(o=s)?o.call(t,i,t,e):o)||(e.exports=n)},500:function(e,t){e.exports=function(){throw new Error("define cannot be used indirect")}},501:function(e,t){(function(t){e.exports=t}).call(this,{})},502:function(e,t,i){var o,n,s;!function(r){"use strict";n=[i(3)],void 0===(s="function"==typeof(o=function(e,t){var i={beforeShow:d,move:d,change:d,show:d,hide:d,color:!1,flat:!1,showInput:!1,allowEmpty:!1,showButtons:!0,clickoutFiresChange:!0,showInitial:!1,showPalette:!1,showPaletteOnly:!1,hideAfterPaletteSelect:!1,togglePaletteOnly:!1,showSelectionPalette:!0,localStorageKey:!1,appendTo:"body",maxSelectionSize:7,cancelText:"cancel",chooseText:"choose",togglePaletteMoreText:"more",togglePaletteLessText:"less",clearText:"Clear Color Selection",noColorSelectedText:"No Color Selected",preferredFormat:!1,className:"",containerClassName:"",replacerClassName:"",showAlpha:!1,theme:"sp-light",palette:[["#ffffff","#000000","#ff0000","#ff8000","#ffff00","#008000","#0000ff","#4b0082","#9400d3"]],selectionPalette:[],disabled:!1,offset:null},o=[],n=!!/msie/i.exec(window.navigator.userAgent),s=function(){function e(e,t){return!!~(""+e).indexOf(t)}var t=document.createElement("div"),i=t.style;return i.cssText="background-color:rgba(0,0,0,.5)",e(i.backgroundColor,"rgba")||e(i.backgroundColor,"hsla")}(),r=["<div class='sp-replacer'>","<div class='sp-preview'><div class='sp-preview-inner'></div></div>","<div class='sp-dd'>&#9660;</div>","</div>"].join(""),a=function(){var e="";if(n)for(var t=1;t<=6;t++)e+="<div class='sp-"+t+"'></div>";return["<div class='sp-container sp-hidden'>","<div class='sp-palette-container'>","<div class='sp-palette sp-thumb sp-cf'></div>","<div class='sp-palette-button-container sp-cf'>","<button type='button' class='sp-palette-toggle'></button>","</div>","</div>","<div class='sp-picker-container'>","<div class='sp-top sp-cf'>","<div class='sp-fill'></div>","<div class='sp-top-inner'>","<div class='sp-color'>","<div class='sp-sat'>","<div class='sp-val'>","<div class='sp-dragger'></div>","</div>","</div>","</div>","<div class='sp-clear sp-clear-display'>","</div>","<div class='sp-hue'>","<div class='sp-slider'></div>",e,"</div>","</div>","<div class='sp-alpha'><div class='sp-alpha-inner'><div class='sp-alpha-handle'></div></div></div>","</div>","<div class='sp-input-container sp-cf'>","<input class='sp-input' type='text' spellcheck='false' />","</div>","<div class='sp-initial sp-thumb sp-cf'></div>","<div class='sp-button-container sp-cf'>","<a class='sp-cancel' href='#'></a>","<button type='button' class='sp-choose'></button>","</div>","</div>","</div>"].join("")}();function l(t,i,o,n){for(var r=[],a=0;a<t.length;a++){var l=t[a];if(l){var c=tinycolor(l),d=c.toHsl().l<.5?"sp-thumb-el sp-thumb-dark":"sp-thumb-el sp-thumb-light";d+=tinycolor.equals(i,l)?" sp-thumb-active":"";var h=c.toString(n.preferredFormat||"rgb"),p=s?"background-color:"+c.toRgbString():"filter:"+c.toFilter();r.push('<span title="'+h+'" data-color="'+c.toRgbString()+'" class="'+d+'"><span class="sp-thumb-inner" style="'+p+';" /></span>')}else{r.push(e("<div />").append(e('<span data-color="" style="background-color:transparent;" class="sp-clear-display"></span>').attr("title",n.noColorSelectedText)).html())}}return"<div class='sp-cf "+o+"'>"+r.join("")+"</div>"}function c(c,d){var f,m,_,v,w=function(t,o){var n=e.extend({},i,t);return n.callbacks={move:p(n.move,o),change:p(n.change,o),show:p(n.show,o),hide:p(n.hide,o),beforeShow:p(n.beforeShow,o)},n}(d,c),y=w.flat,b=w.showSelectionPalette,x=w.localStorageKey,k=w.theme,C=w.callbacks,S=(f=He,m=10,function(){var e=this,t=arguments;_&&clearTimeout(v),!_&&v||(v=setTimeout(function(){v=null,f.apply(e,t)},m))}),V=!1,T=!1,B=0,E=0,P=0,M=0,A=0,D=0,R=0,F=0,O=0,z=0,I=1,N=[],$=[],L={},W=w.selectionPalette.slice(0),H=w.maxSelectionSize,j="sp-dragging",U=null,q=c.ownerDocument,Y=(q.body,e(c)),X=!1,J=e(a,q).addClass(k),G=J.find(".sp-picker-container"),Q=J.find(".sp-color"),K=J.find(".sp-dragger"),Z=J.find(".sp-hue"),ee=J.find(".sp-slider"),te=J.find(".sp-alpha-inner"),ie=J.find(".sp-alpha"),oe=J.find(".sp-alpha-handle"),ne=J.find(".sp-input"),se=J.find(".sp-palette"),re=J.find(".sp-initial"),ae=J.find(".sp-cancel"),le=J.find(".sp-clear"),ce=J.find(".sp-choose"),de=J.find(".sp-palette-toggle"),he=Y.is("input"),pe=he&&"color"===Y.attr("type")&&g(),ue=he&&!y,ge=ue?e(r).addClass(k).addClass(w.className).addClass(w.replacerClassName):e([]),fe=ue?ge:Y,me=ge.find(".sp-preview-inner"),_e=w.color||he&&Y.val(),ve=!1,we=w.preferredFormat,ye=!w.showButtons||w.clickoutFiresChange,be=!_e,xe=w.allowEmpty&&!pe;function ke(){if(w.showPaletteOnly&&(w.showPalette=!0),de.text(w.showPaletteOnly?w.togglePaletteMoreText:w.togglePaletteLessText),w.palette){N=w.palette.slice(0),$=e.isArray(N[0])?N:[N],L={};for(var t=0;t<$.length;t++)for(var i=0;i<$[t].length;i++){var o=tinycolor($[t][i]).toRgbString();L[o]=!0}}J.toggleClass("sp-flat",y),J.toggleClass("sp-input-disabled",!w.showInput),J.toggleClass("sp-alpha-enabled",w.showAlpha),J.toggleClass("sp-clear-enabled",xe),J.toggleClass("sp-buttons-disabled",!w.showButtons),J.toggleClass("sp-palette-buttons-disabled",!w.togglePaletteOnly),J.toggleClass("sp-palette-disabled",!w.showPalette),J.toggleClass("sp-palette-only",w.showPaletteOnly),J.toggleClass("sp-initial-disabled",!w.showInitial),J.addClass(w.className).addClass(w.containerClassName),He()}function Ce(){if(x&&window.localStorage){try{var t=window.localStorage[x].split(",#");t.length>1&&(delete window.localStorage[x],e.each(t,function(e,t){Se(t)}))}catch(e){}try{W=window.localStorage[x].split(";")}catch(e){}}}function Se(t){if(b){var i=tinycolor(t).toRgbString();if(!L[i]&&-1===e.inArray(i,W))for(W.push(i);W.length>H;)W.shift();if(x&&window.localStorage)try{window.localStorage[x]=W.join(";")}catch(e){}}}function Ve(){var t=Ie(),i=e.map($,function(e,i){return l(e,t,"sp-palette-row sp-palette-row-"+i,w)});Ce(),W&&i.push(l(function(){var e=[];if(w.showPalette)for(var t=0;t<W.length;t++){var i=tinycolor(W[t]).toRgbString();L[i]||e.push(W[t])}return e.reverse().slice(0,w.maxSelectionSize)}(),t,"sp-palette-row sp-palette-row-selection",w)),se.html(i.join(""))}function Te(){if(w.showInitial){var e=ve,t=Ie();re.html(l([e,t],t,"sp-palette-row-initial",w))}}function Be(){(E<=0||B<=0||M<=0)&&He(),T=!0,J.addClass(j),U=null,Y.trigger("dragstart.spectrum",[Ie()])}function Ee(){T=!1,J.removeClass(j),Y.trigger("dragstop.spectrum",[Ie()])}function Pe(){var e=ne.val();if(null!==e&&""!==e||!xe){var t=tinycolor(e);t.isValid()?(ze(t),We(!0)):ne.addClass("sp-validation-error")}else ze(null),We(!0)}function Me(){V?Fe():Ae()}function Ae(){var t=e.Event("beforeShow.spectrum");V?He():(Y.trigger(t,[Ie()]),!1===C.beforeShow(Ie())||t.isDefaultPrevented()||(!function(){for(var e=0;e<o.length;e++)o[e]&&o[e].hide()}(),V=!0,e(q).bind("keydown.spectrum",De),e(q).bind("click.spectrum",Re),e(window).bind("resize.spectrum",S),ge.addClass("sp-active"),J.removeClass("sp-hidden"),He(),$e(),ve=Ie(),Te(),C.show(ve),Y.trigger("show.spectrum",[ve])))}function De(e){27===e.keyCode&&Fe()}function Re(e){2!=e.button&&(T||(ye?We(!0):Oe(),Fe()))}function Fe(){V&&!y&&(V=!1,e(q).unbind("keydown.spectrum",De),e(q).unbind("click.spectrum",Re),e(window).unbind("resize.spectrum",S),ge.removeClass("sp-active"),J.addClass("sp-hidden"),C.hide(Ie()),Y.trigger("hide.spectrum",[Ie()]))}function Oe(){ze(ve,!0)}function ze(e,t){var i,o;tinycolor.equals(e,Ie())?$e():(!e&&xe?be=!0:(be=!1,i=tinycolor(e),o=i.toHsv(),F=o.h%360/360,O=o.s,z=o.v,I=o.a),$e(),i&&i.isValid()&&!t&&(we=w.preferredFormat||i.getFormat()))}function Ie(e){return e=e||{},xe&&be?null:tinycolor.fromRatio({h:F,s:O,v:z,a:Math.round(100*I)/100},{format:e.format||we})}function Ne(){$e(),C.move(Ie()),Y.trigger("move.spectrum",[Ie()])}function $e(){ne.removeClass("sp-validation-error"),Le();var e=tinycolor.fromRatio({h:F,s:1,v:1});Q.css("background-color",e.toHexString());var t=we;I<1&&(0!==I||"name"!==t)&&("hex"!==t&&"hex3"!==t&&"hex6"!==t&&"name"!==t||(t="rgb"));var i=Ie({format:t}),o="";if(me.removeClass("sp-clear-display"),me.css("background-color","transparent"),!i&&xe)me.addClass("sp-clear-display");else{var r=i.toHexString(),a=i.toRgbString();if(s||1===i.alpha?me.css("background-color",a):(me.css("background-color","transparent"),me.css("filter",i.toFilter())),w.showAlpha){var l=i.toRgb();l.a=0;var c=tinycolor(l).toRgbString(),d="linear-gradient(left, "+c+", "+r+")";n?te.css("filter",tinycolor(c).toFilter({gradientType:1},r)):(te.css("background","-webkit-"+d),te.css("background","-moz-"+d),te.css("background","-ms-"+d),te.css("background","linear-gradient(to right, "+c+", "+r+")"))}o=i.toString(t)}w.showInput&&ne.val(o),w.showPalette&&Ve(),Te()}function Le(){var e=O,t=z;if(xe&&be)oe.hide(),ee.hide(),K.hide();else{oe.show(),ee.show(),K.show();var i=e*B,o=E-t*E;i=Math.max(-P,Math.min(B-P,i-P)),o=Math.max(-P,Math.min(E-P,o-P)),K.css({top:o+"px",left:i+"px"});var n=I*A;oe.css({left:n-D/2+"px"});var s=F*M;ee.css({top:s-R+"px"})}}function We(e){var t=Ie(),i="",o=!tinycolor.equals(t,ve);t&&(i=t.toString(we),Se(t)),he&&Y.val(i),e&&o&&(C.change(t),Y.trigger("change",[t]))}function He(){var t,i,o,n,s,r,a,l,c,d;V&&(B=Q.width(),E=Q.height(),P=K.height(),Z.width(),M=Z.height(),R=ee.height(),A=ie.width(),D=oe.width(),y||(J.css("position","absolute"),w.offset?J.offset(w.offset):J.offset((i=fe,o=(t=J).outerWidth(),n=t.outerHeight(),s=i.outerHeight(),r=t[0].ownerDocument,a=r.documentElement,l=a.clientWidth+e(r).scrollLeft(),c=a.clientHeight+e(r).scrollTop(),(d=i.offset()).top+=s,d.left-=Math.min(d.left,d.left+o>l&&l>o?Math.abs(d.left+o-l):0),d.top-=Math.min(d.top,d.top+n>c&&c>n?Math.abs(n+s-0):0),d))),Le(),w.showPalette&&Ve(),Y.trigger("reflow.spectrum"))}function je(){Fe(),X=!0,Y.attr("disabled",!0),fe.addClass("sp-disabled")}!function(){n&&J.find("*:not(input)").attr("unselectable","on");ke(),ue&&Y.after(ge).hide();xe||le.hide();if(y)Y.after(J).hide();else{var t="parent"===w.appendTo?Y.parent():e(w.appendTo);1!==t.length&&(t=e("body")),t.append(J)}Ce(),fe.bind("click.spectrum touchstart.spectrum",function(t){X||Me(),t.stopPropagation(),e(t.target).is("input")||t.preventDefault()}),(Y.is(":disabled")||!0===w.disabled)&&je();J.click(h),ne.change(Pe),ne.bind("paste",function(){setTimeout(Pe,1)}),ne.keydown(function(e){13==e.keyCode&&Pe()}),ae.text(w.cancelText),ae.bind("click.spectrum",function(e){e.stopPropagation(),e.preventDefault(),Oe(),Fe()}),le.attr("title",w.clearText),le.bind("click.spectrum",function(e){e.stopPropagation(),e.preventDefault(),be=!0,Ne(),y&&We(!0)}),ce.text(w.chooseText),ce.bind("click.spectrum",function(e){e.stopPropagation(),e.preventDefault(),n&&ne.is(":focus")&&ne.trigger("change"),ne.hasClass("sp-validation-error")||(We(!0),Fe())}),de.text(w.showPaletteOnly?w.togglePaletteMoreText:w.togglePaletteLessText),de.bind("click.spectrum",function(e){e.stopPropagation(),e.preventDefault(),w.showPaletteOnly=!w.showPaletteOnly,w.showPaletteOnly||y||J.css("left","-="+(G.outerWidth(!0)+5)),ke()}),u(ie,function(e,t,i){I=e/A,be=!1,i.shiftKey&&(I=Math.round(10*I)/10),Ne()},Be,Ee),u(Z,function(e,t){F=parseFloat(t/M),be=!1,w.showAlpha||(I=1),Ne()},Be,Ee),u(Q,function(e,t,i){if(i.shiftKey){if(!U){var o=O*B,n=E-z*E,s=Math.abs(e-o)>Math.abs(t-n);U=s?"x":"y"}}else U=null;var r=!U||"y"===U;(!U||"x"===U)&&(O=parseFloat(e/B)),r&&(z=parseFloat((E-t)/E)),be=!1,w.showAlpha||(I=1),Ne()},Be,Ee),_e?(ze(_e),$e(),we=w.preferredFormat||tinycolor(_e).format,Se(_e)):$e();y&&Ae();function i(t){return t.data&&t.data.ignore?(ze(e(t.target).closest(".sp-thumb-el").data("color")),Ne()):(ze(e(t.target).closest(".sp-thumb-el").data("color")),Ne(),We(!0),w.hideAfterPaletteSelect&&Fe()),!1}var o=n?"mousedown.spectrum":"click.spectrum touchstart.spectrum";se.delegate(".sp-thumb-el",o,i),re.delegate(".sp-thumb-el:nth-child(1)",o,{ignore:!0},i)}();var Ue={show:Ae,hide:Fe,toggle:Me,reflow:He,option:function(i,o){if(i===t)return e.extend({},w);if(o===t)return w[i];w[i]=o,"preferredFormat"===i&&(we=w.preferredFormat);ke()},enable:function(){X=!1,Y.attr("disabled",!1),fe.removeClass("sp-disabled")},disable:je,offset:function(e){w.offset=e,He()},set:function(e){ze(e),We()},get:Ie,destroy:function(){Y.show(),fe.unbind("click.spectrum touchstart.spectrum"),J.remove(),ge.remove(),o[Ue.id]=null},container:J};return Ue.id=o.push(Ue)-1,Ue}function d(){}function h(e){e.stopPropagation()}function p(e,t){var i=Array.prototype.slice,o=i.call(arguments,2);return function(){return e.apply(t,o.concat(i.call(arguments)))}}function u(t,i,o,s){i=i||function(){},o=o||function(){},s=s||function(){};var r=document,a=!1,l={},c=0,d=0,h="ontouchstart"in window,p={};function u(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault(),e.returnValue=!1}function g(e){if(a){if(n&&r.documentMode<9&&!e.button)return f();var o=e.originalEvent&&e.originalEvent.touches&&e.originalEvent.touches[0],s=o&&o.pageX||e.pageX,p=o&&o.pageY||e.pageY,g=Math.max(0,Math.min(s-l.left,d)),m=Math.max(0,Math.min(p-l.top,c));h&&u(e),i.apply(t,[g,m,e])}}function f(){a&&(e(r).unbind(p),e(r.body).removeClass("sp-dragging"),setTimeout(function(){s.apply(t,arguments)},0)),a=!1}p.selectstart=u,p.dragstart=u,p["touchmove mousemove"]=g,p["touchend mouseup"]=f,e(t).bind("touchstart mousedown",function(i){(i.which?3==i.which:2==i.button)||a||!1!==o.apply(t,arguments)&&(a=!0,c=e(t).height(),d=e(t).width(),l=e(t).offset(),e(r).bind(p),e(r.body).addClass("sp-dragging"),g(i),u(i))})}function g(){return e.fn.spectrum.inputTypeColorSupport()}e.fn.spectrum=function(t,i){if("string"==typeof t){var n=this,s=Array.prototype.slice.call(arguments,1);return this.each(function(){var i=o[e(this).data("spectrum.id")];if(i){var r=i[t];if(!r)throw new Error("Spectrum: no such method: '"+t+"'");"get"==t?n=i.get():"container"==t?n=i.container:"option"==t?n=i.option.apply(i,s):"destroy"==t?(i.destroy(),e(this).removeData("spectrum.id")):r.apply(i,s)}}),n}return this.spectrum("destroy").each(function(){var i=e.extend({},t,e(this).data()),o=c(this,i);e(this).data("spectrum.id",o.id)})},e.fn.spectrum.load=!0,e.fn.spectrum.loadOpts={},e.fn.spectrum.draggable=u,e.fn.spectrum.defaults=i,e.fn.spectrum.inputTypeColorSupport=function t(){if(void 0===t._cachedResult){var i=e("<input type='color'/>")[0];t._cachedResult="color"===i.type&&""!==i.value}return t._cachedResult},e.spectrum={},e.spectrum.localization={},e.spectrum.palettes={},e.fn.spectrum.processNativeColorInputs=function(){var t=e("input[type=color]");t.length&&!g()&&t.spectrum({preferredFormat:"hex6"})},function(){var e=/^[\s,#]+/,t=/\s+#x2F;,i=0,o=Math,n=o.round,s=o.min,r=o.max,a=o.random,l=function(a,c){if(c=c||{},(a=a||"")instanceof l)return a;if(!(this instanceof l))return new l(a,c);var d=function(i){var n={r:0,g:0,b:0},a=1,l=!1,c=!1;"string"==typeof i&&(i=function(i){i=i.replace(e,"").replace(t,"").toLowerCase();var o,n=!1;if(V[i])i=V[i],n=!0;else if("transparent"==i)return{r:0,g:0,b:0,a:0,format:"name"};if(o=z.rgb.exec(i))return{r:o[1],g:o[2],b:o[3]};if(o=z.rgba.exec(i))return{r:o[1],g:o[2],b:o[3],a:o[4]};if(o=z.hsl.exec(i))return{h:o[1],s:o[2],l:o[3]};if(o=z.hsla.exec(i))return{h:o[1],s:o[2],l:o[3],a:o[4]};if(o=z.hsv.exec(i))return{h:o[1],s:o[2],v:o[3]};if(o=z.hsva.exec(i))return{h:o[1],s:o[2],v:o[3],a:o[4]};if(o=z.hex8.exec(i))return{a:(s=o[1],M(s)/255),r:M(o[2]),g:M(o[3]),b:M(o[4]),format:n?"name":"hex8"};var s;if(o=z.hex6.exec(i))return{r:M(o[1]),g:M(o[2]),b:M(o[3]),format:n?"name":"hex"};if(o=z.hex3.exec(i))return{r:M(o[1]+""+o[1]),g:M(o[2]+""+o[2]),b:M(o[3]+""+o[3]),format:n?"name":"hex"};return!1}(i));"object"==typeof i&&(i.hasOwnProperty("r")&&i.hasOwnProperty("g")&&i.hasOwnProperty("b")?(d=i.r,h=i.g,p=i.b,n={r:255*E(d,255),g:255*E(h,255),b:255*E(p,255)},l=!0,c="%"===String(i.r).substr(-1)?"prgb":"rgb"):i.hasOwnProperty("h")&&i.hasOwnProperty("s")&&i.hasOwnProperty("v")?(i.s=D(i.s),i.v=D(i.v),n=function(e,t,i){e=6*E(e,360),t=E(t,100),i=E(i,100);var n=o.floor(e),s=e-n,r=i*(1-t),a=i*(1-s*t),l=i*(1-(1-s)*t),c=n%6;return{r:255*[i,a,r,r,l,i][c],g:255*[l,i,i,a,r,r][c],b:255*[r,r,l,i,i,a][c]}}(i.h,i.s,i.v),l=!0,c="hsv"):i.hasOwnProperty("h")&&i.hasOwnProperty("s")&&i.hasOwnProperty("l")&&(i.s=D(i.s),i.l=D(i.l),n=function(e,t,i){var o,n,s;function r(e,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+6*(t-e)*i:i<.5?t:i<2/3?e+(t-e)*(2/3-i)*6:e}if(e=E(e,360),t=E(t,100),i=E(i,100),0===t)o=n=s=i;else{var a=i<.5?i*(1+t):i+t-i*t,l=2*i-a;o=r(l,a,e+1/3),n=r(l,a,e),s=r(l,a,e-1/3)}return{r:255*o,g:255*n,b:255*s}}(i.h,i.s,i.l),l=!0,c="hsl"),i.hasOwnProperty("a")&&(a=i.a));var d,h,p;return a=B(a),{ok:l,format:i.format||c,r:s(255,r(n.r,0)),g:s(255,r(n.g,0)),b:s(255,r(n.b,0)),a:a}}(a);this._originalInput=a,this._r=d.r,this._g=d.g,this._b=d.b,this._a=d.a,this._roundA=n(100*this._a)/100,this._format=c.format||d.format,this._gradientType=c.gradientType,this._r<1&&(this._r=n(this._r)),this._g<1&&(this._g=n(this._g)),this._b<1&&(this._b=n(this._b)),this._ok=d.ok,this._tc_id=i++};function c(e,t,i){e=E(e,255),t=E(t,255),i=E(i,255);var o,n,a=r(e,t,i),l=s(e,t,i),c=(a+l)/2;if(a==l)o=n=0;else{var d=a-l;switch(n=c>.5?d/(2-a-l):d/(a+l),a){case e:o=(t-i)/d+(t<i?6:0);break;case t:o=(i-e)/d+2;break;case i:o=(e-t)/d+4}o/=6}return{h:o,s:n,l:c}}function d(e,t,i){e=E(e,255),t=E(t,255),i=E(i,255);var o,n,a=r(e,t,i),l=s(e,t,i),c=a,d=a-l;if(n=0===a?0:d/a,a==l)o=0;else{switch(a){case e:o=(t-i)/d+(t<i?6:0);break;case t:o=(i-e)/d+2;break;case i:o=(e-t)/d+4}o/=6}return{h:o,s:n,v:c}}function h(e,t,i,o){var s=[A(n(e).toString(16)),A(n(t).toString(16)),A(n(i).toString(16))];return o&&s[0].charAt(0)==s[0].charAt(1)&&s[1].charAt(0)==s[1].charAt(1)&&s[2].charAt(0)==s[2].charAt(1)?s[0].charAt(0)+s[1].charAt(0)+s[2].charAt(0):s.join("")}function p(e,t,i,o){var s,r=[A((s=o,Math.round(255*parseFloat(s)).toString(16))),A(n(e).toString(16)),A(n(t).toString(16)),A(n(i).toString(16))];return r.join("")}function u(e,t){t=0===t?0:t||10;var i=l(e).toHsl();return i.s-=t/100,i.s=P(i.s),l(i)}function g(e,t){t=0===t?0:t||10;var i=l(e).toHsl();return i.s+=t/100,i.s=P(i.s),l(i)}function f(e){return l(e).desaturate(100)}function m(e,t){t=0===t?0:t||10;var i=l(e).toHsl();return i.l+=t/100,i.l=P(i.l),l(i)}function _(e,t){t=0===t?0:t||10;var i=l(e).toRgb();return i.r=r(0,s(255,i.r-n(-t/100*255))),i.g=r(0,s(255,i.g-n(-t/100*255))),i.b=r(0,s(255,i.b-n(-t/100*255))),l(i)}function v(e,t){t=0===t?0:t||10;var i=l(e).toHsl();return i.l-=t/100,i.l=P(i.l),l(i)}function w(e,t){var i=l(e).toHsl(),o=(n(i.h)+t)%360;return i.h=o<0?360+o:o,l(i)}function y(e){var t=l(e).toHsl();return t.h=(t.h+180)%360,l(t)}function b(e){var t=l(e).toHsl(),i=t.h;return[l(e),l({h:(i+120)%360,s:t.s,l:t.l}),l({h:(i+240)%360,s:t.s,l:t.l})]}function x(e){var t=l(e).toHsl(),i=t.h;return[l(e),l({h:(i+90)%360,s:t.s,l:t.l}),l({h:(i+180)%360,s:t.s,l:t.l}),l({h:(i+270)%360,s:t.s,l:t.l})]}function k(e){var t=l(e).toHsl(),i=t.h;return[l(e),l({h:(i+72)%360,s:t.s,l:t.l}),l({h:(i+216)%360,s:t.s,l:t.l})]}function C(e,t,i){t=t||6,i=i||30;var o=l(e).toHsl(),n=360/i,s=[l(e)];for(o.h=(o.h-(n*t>>1)+720)%360;--t;)o.h=(o.h+n)%360,s.push(l(o));return s}function S(e,t){t=t||6;for(var i=l(e).toHsv(),o=i.h,n=i.s,s=i.v,r=[],a=1/t;t--;)r.push(l({h:o,s:n,v:s})),s=(s+a)%1;return r}l.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},setAlpha:function(e){return this._a=B(e),this._roundA=n(100*this._a)/100,this},toHsv:function(){var e=d(this._r,this._g,this._b);return{h:360*e.h,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=d(this._r,this._g,this._b),t=n(360*e.h),i=n(100*e.s),o=n(100*e.v);return 1==this._a?"hsv("+t+", "+i+"%, "+o+"%)":"hsva("+t+", "+i+"%, "+o+"%, "+this._roundA+")"},toHsl:function(){var e=c(this._r,this._g,this._b);return{h:360*e.h,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=c(this._r,this._g,this._b),t=n(360*e.h),i=n(100*e.s),o=n(100*e.l);return 1==this._a?"hsl("+t+", "+i+"%, "+o+"%)":"hsla("+t+", "+i+"%, "+o+"%, "+this._roundA+")"},toHex:function(e){return h(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(){return p(this._r,this._g,this._b,this._a)},toHex8String:function(){return"#"+this.toHex8()},toRgb:function(){return{r:n(this._r),g:n(this._g),b:n(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+n(this._r)+", "+n(this._g)+", "+n(this._b)+")":"rgba("+n(this._r)+", "+n(this._g)+", "+n(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:n(100*E(this._r,255))+"%",g:n(100*E(this._g,255))+"%",b:n(100*E(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+n(100*E(this._r,255))+"%, "+n(100*E(this._g,255))+"%, "+n(100*E(this._b,255))+"%)":"rgba("+n(100*E(this._r,255))+"%, "+n(100*E(this._g,255))+"%, "+n(100*E(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(T[h(this._r,this._g,this._b,!0)]||!1)},toFilter:function(e){var t="#"+p(this._r,this._g,this._b,this._a),i=t,o=this._gradientType?"GradientType = 1, ":"";if(e){var n=l(e);i=n.toHex8String()}return"progid:DXImageTransform.Microsoft.gradient("+o+"startColorstr="+t+",endColorstr="+i+")"},toString:function(e){var t=!!e;e=e||this._format;var i=!1,o=this._a<1&&this._a>=0,n=!t&&o&&("hex"===e||"hex6"===e||"hex3"===e||"name"===e);return n?"name"===e&&0===this._a?this.toName():this.toRgbString():("rgb"===e&&(i=this.toRgbString()),"prgb"===e&&(i=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(i=this.toHexString()),"hex3"===e&&(i=this.toHexString(!0)),"hex8"===e&&(i=this.toHex8String()),"name"===e&&(i=this.toName()),"hsl"===e&&(i=this.toHslString()),"hsv"===e&&(i=this.toHsvString()),i||this.toHexString())},_applyModification:function(e,t){var i=e.apply(null,[this].concat([].slice.call(t)));return this._r=i._r,this._g=i._g,this._b=i._b,this.setAlpha(i._a),this},lighten:function(){return this._applyModification(m,arguments)},brighten:function(){return this._applyModification(_,arguments)},darken:function(){return this._applyModification(v,arguments)},desaturate:function(){return this._applyModification(u,arguments)},saturate:function(){return this._applyModification(g,arguments)},greyscale:function(){return this._applyModification(f,arguments)},spin:function(){return this._applyModification(w,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(C,arguments)},complement:function(){return this._applyCombination(y,arguments)},monochromatic:function(){return this._applyCombination(S,arguments)},splitcomplement:function(){return this._applyCombination(k,arguments)},triad:function(){return this._applyCombination(b,arguments)},tetrad:function(){return this._applyCombination(x,arguments)}},l.fromRatio=function(e,t){if("object"==typeof e){var i={};for(var o in e)e.hasOwnProperty(o)&&(i[o]="a"===o?e[o]:D(e[o]));e=i}return l(e,t)},l.equals=function(e,t){return!(!e||!t)&&l(e).toRgbString()==l(t).toRgbString()},l.random=function(){return l.fromRatio({r:a(),g:a(),b:a()})},l.mix=function(e,t,i){i=0===i?0:i||50;var o,n=l(e).toRgb(),s=l(t).toRgb(),r=i/100,a=2*r-1,c=s.a-n.a,d=1-(o=((o=a*c==-1?a:(a+c)/(1+a*c))+1)/2),h={r:s.r*o+n.r*d,g:s.g*o+n.g*d,b:s.b*o+n.b*d,a:s.a*r+n.a*(1-r)};return l(h)},l.readability=function(e,t){var i=l(e),o=l(t),n=i.toRgb(),s=o.toRgb(),r=i.getBrightness(),a=o.getBrightness(),c=Math.max(n.r,s.r)-Math.min(n.r,s.r)+Math.max(n.g,s.g)-Math.min(n.g,s.g)+Math.max(n.b,s.b)-Math.min(n.b,s.b);return{brightness:Math.abs(r-a),color:c}},l.isReadable=function(e,t){var i=l.readability(e,t);return i.brightness>125&&i.color>500},l.mostReadable=function(e,t){for(var i=null,o=0,n=!1,s=0;s<t.length;s++){var r=l.readability(e,t[s]),a=r.brightness>125&&r.color>500,c=r.brightness/125*3+r.color/500;(a&&!n||a&&n&&c>o||!a&&!n&&c>o)&&(n=a,o=c,i=l(t[s]))}return i};var V=l.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},T=l.hexNames=function(e){var t={};for(var i in e)e.hasOwnProperty(i)&&(t[e[i]]=i);return t}(V);function B(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function E(e,t){(function(e){return"string"==typeof e&&-1!=e.indexOf(".")&&1===parseFloat(e)})(e)&&(e="100%");var i=function(e){return"string"==typeof e&&-1!=e.indexOf("%")}(e);return e=s(t,r(0,parseFloat(e))),i&&(e=parseInt(e*t,10)/100),o.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function P(e){return s(1,r(0,e))}function M(e){return parseInt(e,16)}function A(e){return 1==e.length?"0"+e:""+e}function D(e){return e<=1&&(e=100*e+"%"),e}var R,F,O,z=(F="[\\s|\\(]+("+(R="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+R+")[,|\\s]+("+R+")\\s*\\)?",O="[\\s|\\(]+("+R+")[,|\\s]+("+R+")[,|\\s]+("+R+")[,|\\s]+("+R+")\\s*\\)?",{rgb:new RegExp("rgb"+F),rgba:new RegExp("rgba"+O),hsl:new RegExp("hsl"+F),hsla:new RegExp("hsla"+O),hsv:new RegExp("hsv"+F),hsva:new RegExp("hsva"+O),hex3:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})#x2F;,hex6:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})#x2F;,hex8:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})#x2F;});window.tinycolor=l}(),e(function(){e.fn.spectrum.load&&e.fn.spectrum.processNativeColorInputs()})})?o.apply(t,n):o)||(e.exports=s)}()},503:function(e,t,i){i(504),e.exports=i(18).parseFloat},504:function(e,t,i){var o=i(24),n=i(505);o(o.G+o.F*(parseFloat!=n),{parseFloat:n})},505:function(e,t,i){var o=i(23).parseFloat,n=i(251).trim;e.exports=1/o(i(92)+"-0")!=-1/0?function(e){var t=n(String(e),3),i=o(t);return 0===i&&"-"==t.charAt(0)?-0:i}:o},507:function(e,t,i){"use strict";i.r(t);i(498),i(499);var o=i(249),n=i.n(o),s=i(19),r=i.n(s),a=i(42),l=i.n(a),c=i(0),d=i(1),h=i.n(d),p=i(21),u=i.n(p),g=i(5),f=i.n(g),m=function(){window.config.dragDemoUrlSettings||f()(window.config.installedAt).isBefore(f()().subtract(7,"days"))||c.a.Modal.popup({title:c.a.I18n.t("tutorialVideoTitle"),template:'<div class="mailpoet_drag_and_drop_tutorial"><video style="height:640px;" src="'.concat(window.config.dragDemoUrl,'" controls autoplay></video></div>'),onCancel:function(){c.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"user_flags",action:"set",data:{editor_tutorial_seen:1}})}})};r.a.addAction("mailpoet_newsletters_editor_initialize",function(e){var t;document.getElementById("mailpoet_editor")&&window.EditorApplication&&(c.a.Modal.loading(!0),c.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"get",data:{id:(t="id",(document.location.search.split("".concat(t,"="))[1]||"").split("&")[0])}}).always(function(){return c.a.Modal.loading(!1)}).always(function(){return m()}).done(function(t){var i,o,s,a=t.data;n.a.resolve(r.a.applyFilters("mailpoet_newsletters_editor_extend_config",e,a)).then(function(e){window.EditorApplication.start({newsletter:a,config:e})}).catch(function(){window.EditorApplication.start({newsletter:a,config:e})}),i=a.type,o=document.getElementById("mailpoet_editor_breadcrumb"),s=r.a.applyFilters("mailpoet_newsletters_editor_breadcrumb",h.a.createElement(l.a,{step:"editor"}),i,"editor"),u.a.render(s,o),"sending"===a.status&&a.queue&&null===a.queue.status&&c.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sending_queue",action:"pause",data:{newsletter_id:a.id}}).done(function(){return c.a.Notice.success(c.a.I18n.t("newsletterIsPaused"))}).fail(function(e){e.errors.length>0&&c.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0,static:!0})})}).fail(function(e){e.errors.length>0&&c.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0,static:!0})}))});var _=i(13),v=i.n(_),w=i(90),y=i.n(w),b=y.a,x=v.a.View.extend({el:"#mailpoet_editor",regions:{stylesRegion:"#mailpoet_editor_styles",contentRegion:"#mailpoet_editor_content",sidebarRegion:"#mailpoet_editor_sidebar",bottomRegion:"#mailpoet_editor_bottom",headingRegion:"#mailpoet_editor_heading",topRegion:"#mailpoet_editor_top"}}),k=new(v.a.Application.extend({region:"#mailpoet_editor",onStart:function(){this._appView=new x,this.showView(this._appView)},getChannel:function(e){return void 0===e?b.channel("global"):b.channel(e)}}));window.EditorApplication=k;var C=k,S=i(30),V=i.n(S),T=i(4),B=i.n(T),E={};E.ConfigModel=V.a.extend({defaults:{availableStyles:{},socialIcons:{},blockDefaults:{},sidepanelWidth:"331px",validation:{},urls:{}}}),E._config={},E.getConfig=function(){return E._config},E.setConfig=function(e){return E._config=new E.ConfigModel(e,{parse:!0}),E._config},C.on("before:start",function(e,t){var i=e,o=B.a.clone(t.config);i.getConfig=E.getConfig,i.setConfig=E.setConfig,o.blockDefaults=B.a.extend(o.blockDefaults,t.newsletter.body.blockDefaults||{}),i.setConfig(o)});var P=i(3),M=i.n(P),A={};A.StylesModel=V.a.extend({defaults:{text:{fontColor:"#000000",fontFamily:"Arial",fontSize:"16px",lineHeight:"1.6"},h1:{fontColor:"#111111",fontFamily:"Arial",fontSize:"40px",lineHeight:"1.6"},h2:{fontColor:"#222222",fontFamily:"Tahoma",fontSize:"32px",lineHeight:"1.6"},h3:{fontColor:"#333333",fontFamily:"Verdana",fontSize:"24px",lineHeight:"1.6"},link:{fontColor:"#21759B",textDecoration:"underline"},wrapper:{backgroundColor:"#ffffff"},body:{backgroundColor:"#cccccc"}},initialize:function(e){this.set(M.a.extend(!0,{},this.defaults,e)),this.on("change",function(){C.getChannel().trigger("autoSave")})}}),A.StylesView=v.a.View.extend({getTemplate:function(){return window.templates.styles},modelEvents:{change:"render"},serializeData:function(){return this.model.toJSON()}}),A._globalStyles=new V.a,A.getGlobalStyles=function(){return A._globalStyles},A.setGlobalStyles=function(e){return A._globalStyles=new A.StylesModel(e),A._globalStyles},A.getAvailableStyles=function(){return C.getConfig().get("availableStyles")},C.on("before:start",function(e,t){var i,o,n=e;n.getGlobalStyles=A.getGlobalStyles,n.setGlobalStyles=A.setGlobalStyles,n.getAvailableStyles=A.getAvailableStyles,i=t.newsletter.body,o=B.a.has(i,"globalStyles")?i.globalStyles:{},this.setGlobalStyles(o)}),C.on("start",function(e){var t=new A.StylesView({model:e.getGlobalStyles()});e._appView.showChildView("stylesRegion",t)});var D=i(20),R=i.n(D),F=(i(252),{_query:function(e){return c.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"automatedLatestContent",action:e.action,data:e.options||{}})}});F._cachedQuery=B.a.memoize(F._query,R.a),F.getNewsletter=function(e){return F._query({action:"get",options:e})},F.getPostTypes=function(){return F._cachedQuery({action:"getPostTypes",options:{}}).then(function(e){return B.a.values(e.data)})},F.getTaxonomies=function(e){return F._cachedQuery({action:"getTaxonomies",options:{postType:e}}).then(function(e){return e.data})},F.getTerms=function(e){return F._cachedQuery({action:"getTerms",options:e}).then(function(e){return e.data})},F.getPosts=function(e){return F._cachedQuery({action:"getPosts",options:e}).then(function(e){return e.data})},F.getTransformedPosts=function(e){return F._cachedQuery({action:"getTransformedPosts",options:e}).then(function(e){return e.data})},F.getBulkTransformedPosts=function(e){return F._query({action:"getBulkTransformedPosts",options:e}).then(function(e){return e.data})},F.saveNewsletter=function(e){return c.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"save",data:e||{}})},F.previewNewsletter=function(e){return c.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"sendPreview",data:e||{}})},C.on("start",function(){F.getPostTypes()});var O,z=F,I=i(26),N=i.n(I),$={};$._contentWidgets=new(N.a.Collection.extend({model:V.a.extend({defaults:{name:"",priority:100,widgetView:void 0}}),comparator:"priority"})),$.registerWidget=function(e){return $._contentWidgets.add(e)},$.getWidgets=function(){return $._contentWidgets},$._layoutWidgets=new(N.a.Collection.extend({model:V.a.extend({defaults:{name:"",priority:100,widgetView:void 0}}),comparator:"priority"})),$.registerLayoutWidget=function(e){return $._layoutWidgets.add(e)},$.getLayoutWidgets=function(){return $._layoutWidgets},O=v.a.View.extend({getTemplate:function(){return window.templates.sidebar},regions:{contentRegion:".mailpoet_content_region",layoutRegion:".mailpoet_layout_region",stylesRegion:".mailpoet_styles_region",previewRegion:".mailpoet_preview_region"},events:{"click .mailpoet_sidebar_region h3, .mailpoet_sidebar_region .handlediv":function(e){var t=this.$el.find(".mailpoet_sidebar_region:not(.closed)"),i=this.$el.find(e.target).closest(".mailpoet_sidebar_region");t.find(".mailpoet_region_content").velocity("slideUp",{duration:250,easing:"easeOut",complete:function(){t.addClass("closed")}}),t.get(0)!==i.get(0)&&i.find(".mailpoet_region_content").velocity("slideDown",{duration:250,easing:"easeIn",complete:function(){i.removeClass("closed")}})}},initialize:function(){M()(window).on("resize",this.updateHorizontalScroll.bind(this)).on("scroll",this.updateHorizontalScroll.bind(this))},onRender:function(){this.showChildView("contentRegion",new $.SidebarWidgetsView(C.getWidgets())),this.showChildView("layoutRegion",new $.SidebarLayoutWidgetsView(C.getLayoutWidgets())),this.showChildView("stylesRegion",new $.SidebarStylesView({model:C.getGlobalStyles(),availableStyles:C.getAvailableStyles()})),this.showChildView("previewRegion",new $.SidebarPreviewView)},updateHorizontalScroll:function(){this.$el.parent().each(function(){var e,t=M()(this);"fixed"===t.css("position")?(e=t.parent().offset().left-M()(window).scrollLeft(),t.css("left",e+"px")):t.css("left","")})},onDomRefresh:function(){this.$el.parent().stick_in_parent({offset_top:32}),this.$el.parent().on("sticky_kit:stick",this.updateHorizontalScroll.bind(this)),this.$el.parent().on("sticky_kit:unstick",this.updateHorizontalScroll.bind(this)),this.$el.parent().on("sticky_kit:bottom",this.updateHorizontalScroll.bind(this)),this.$el.parent().on("sticky_kit:unbottom",this.updateHorizontalScroll.bind(this))}}),$.SidebarWidgetsCollectionView=v.a.CollectionView.extend({childView:function(e){return e.get("widgetView")}}),$.SidebarWidgetsView=v.a.View.extend({getTemplate:function(){return window.templates.sidebarContent},regions:{widgets:".mailpoet_region_content"},initialize:function(e){this.widgets=e},onRender:function(){this.showChildView("widgets",new $.SidebarWidgetsCollectionView({collection:this.widgets}))}}),$.SidebarLayoutWidgetsView=$.SidebarWidgetsView.extend({getTemplate:function(){return window.templates.sidebarLayout}}),$.SidebarStylesView=v.a.View.extend({getTemplate:function(){return window.templates.sidebarStyles},behaviors:{ColorPickerBehavior:{}},events:function(){return{"change #mailpoet_text_font_color":B.a.partial(this.changeColorField,"text.fontColor"),"change #mailpoet_text_font_family":function(e){this.model.set("text.fontFamily",e.target.value)},"change #mailpoet_text_font_size":function(e){this.model.set("text.fontSize",e.target.value)},"change #mailpoet_h1_font_color":B.a.partial(this.changeColorField,"h1.fontColor"),"change #mailpoet_h1_font_family":function(e){this.model.set("h1.fontFamily",e.target.value)},"change #mailpoet_h1_font_size":function(e){this.model.set("h1.fontSize",e.target.value)},"change #mailpoet_h2_font_color":B.a.partial(this.changeColorField,"h2.fontColor"),"change #mailpoet_h2_font_family":function(e){this.model.set("h2.fontFamily",e.target.value)},"change #mailpoet_h2_font_size":function(e){this.model.set("h2.fontSize",e.target.value)},"change #mailpoet_h3_font_color":B.a.partial(this.changeColorField,"h3.fontColor"),"change #mailpoet_h3_font_family":function(e){this.model.set("h3.fontFamily",e.target.value)},"change #mailpoet_h3_font_size":function(e){this.model.set("h3.fontSize",e.target.value)},"change #mailpoet_a_font_color":B.a.partial(this.changeColorField,"link.fontColor"),"change #mailpoet_a_font_underline":function(e){this.model.set("link.textDecoration",e.target.checked?e.target.value:"none")},"change #mailpoet_text_line_height":function(e){this.model.set("text.lineHeight",e.target.value)},"change #mailpoet_heading_line_height":function(e){this.model.set("h1.lineHeight",e.target.value),this.model.set("h2.lineHeight",e.target.value),this.model.set("h3.lineHeight",e.target.value)},"change #mailpoet_newsletter_background_color":B.a.partial(this.changeColorField,"wrapper.backgroundColor"),"change #mailpoet_background_color":B.a.partial(this.changeColorField,"body.backgroundColor")}},templateContext:function(){return{model:this.model.toJSON(),availableStyles:this.availableStyles.toJSON()}},initialize:function(e){this.availableStyles=e.availableStyles},changeField:function(e,t){this.model.set(e,M()(t.target).val())},changeColorField:function(e,t){var i=M()(t.target).val();""===i&&(i="transparent"),this.model.set(e,i)}}),$.SidebarPreviewView=v.a.View.extend({getTemplate:function(){return window.templates.sidebarPreview},events:{"click .mailpoet_show_preview":"showPreview","click #mailpoet_send_preview":"sendPreview"},onBeforeDestroy:function(){this.previewView&&(this.previewView.destroy(),this.previewView=null)},showPreview:function(){var e=C.toJSON();B.a.isUndefined(e.body)||(e.body=R()(e.body)),c.a.Modal.loading(!0),c.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"showPreview",data:e}).always(function(){c.a.Modal.loading(!1)}).done(function(e){this.previewView=new $.NewsletterPreviewView({previewType:window.localStorage.getItem(C.getConfig().get("newsletterPreview.previewTypeLocalStorageKey")),previewUrl:e.meta.preview_url}),this.previewView.render(),c.a.Modal.popup({template:"",element:this.previewView.$el,minWidth:"95%",height:"100%",title:c.a.I18n.t("newsletterPreview"),onCancel:function(){this.previewView.destroy(),this.previewView=null}.bind(this)}),c.a.trackEvent("Editor > Browser Preview",{"MailPoet Free version":window.mailpoet_version})}.bind(this)).fail(function(e){e.errors.length>0&&c.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})})},sendPreview:function(){var e=this.$("#mailpoet_preview_to_email"),t={subscriber:e.val(),id:C.getNewsletter().get("id")};if(t.subscriber.length<=0)return c.a.Notice.error(c.a.I18n.t("newsletterPreviewEmailMissing"),{positionAfter:e,scroll:!0}),!1;c.a.Modal.loading(!0),C.getChannel().request("save").always(function(){z.previewNewsletter(t).always(function(){c.a.Modal.loading(!1)}).done(function(){c.a.Notice.success(c.a.I18n.t("newsletterPreviewSent"),{scroll:!0}),c.a.trackEvent("Editor > Preview sent",{"MailPoet Free version":window.mailpoet_version,"Domain name":t.subscriber.substring(t.subscriber.indexOf("@")+1)}),c.a.Poll.successDelivery.canShow("preview")&&(c.a.Poll.successDelivery.showModal("preview","IHedf1"),c.a.Poll.successDelivery.setPollShown("preview"))}).fail(function(e){e.errors.length>0&&c.a.Notice.error(e.errors.map(function(e){var t="\n <p>\n ".concat(c.a.I18n.t("newsletterPreviewErrorNotice").replace("%$1s",window.config.mtaMethod),":\n <i>").concat(e.message,"</i>\n </p>\n ");if("PHPMail"===window.config.mtaMethod)t+="\n <p>".concat(c.a.I18n.t("newsletterPreviewErrorCheckConfiguration"),"</p>\n <br />\n <p>").concat(c.a.I18n.t("newsletterPreviewErrorUseSendingService"),'</p>\n <p>\n <a\n href="https://www.mailpoet.com/free-plan/?utm_source=plugin&utm_campaign=sending-error"\n target="_blank"\n rel="noopener noreferrer"\n >\n ').concat(c.a.I18n.t("newsletterPreviewErrorSignUpForSendingService"),"\n </a>\n </p>\n ");else{var i=c.a.I18n.t("newsletterPreviewErrorCheckSettingsNotice").replace(/\[link\](.*?)\[\/link\]/g,'<a href="?page=mailpoet-settings#mta" key="check-sending">$1</a>');t+="<p>".concat(i,"</p>")}return t}),{scroll:!0,static:!0})})})}}),$.NewsletterPreviewView=v.a.View.extend({className:"mailpoet_browser_preview_wrapper",getTemplate:function(){return window.templates.newsletterPreview},events:function(){return{"change .mailpoet_browser_preview_type":"changeBrowserPreviewType"}},initialize:function(e){this.previewType=e.previewType,this.previewUrl=e.previewUrl,this.width="100%",this.height="100%"},templateContext:function(){return{previewType:this.previewType,previewUrl:this.previewUrl,width:this.width,height:this.height}},changeBrowserPreviewType:function(e){var t=M()(e.target).val();"mobile"===t?(this.$(".mailpoet_browser_preview_container").removeClass("mailpoet_browser_preview_container_desktop"),this.$(".mailpoet_browser_preview_container").addClass("mailpoet_browser_preview_container_mobile")):(this.$(".mailpoet_browser_preview_container").addClass("mailpoet_browser_preview_container_desktop"),this.$(".mailpoet_browser_preview_container").removeClass("mailpoet_browser_preview_container_mobile")),window.localStorage.setItem(C.getConfig().get("newsletterPreview.previewTypeLocalStorageKey"),t),this.previewType=t}}),C.on("before:start",function(e){var t=e;t.registerWidget=$.registerWidget,t.getWidgets=$.getWidgets,t.registerLayoutWidget=$.registerLayoutWidget,t.getLayoutWidgets=$.getLayoutWidgets}),C.on("start",function(e){var t=new O;e._appView.showChildView("sidebarRegion",t),c.a.helpTooltip.show(document.getElementById("tooltip-send-preview"),{tooltipId:"tooltip-editor-send-preview",tooltip:c.a.I18n.t("helpTooltipSendPreview")})});var L={};L.NewsletterModel=V.a.extend({whitelisted:["id","subject","preheader","type"],initialize:function(){this.on("change",function(){C.getChannel().trigger("autoSave")})},toJSON:function(){return B.a.pick(V.a.prototype.toJSON.call(this),this.whitelisted)}}),L._blockTypes={},L.registerBlockType=function(e,t){L._blockTypes[e]=t},L.getBlockTypeModel=function(e){if(e in L._blockTypes)return L._blockTypes[e].blockModel;throw new Error("Block type not supported: "+e)},L.getBlockTypeView=function(e){if(e in L._blockTypes)return L._blockTypes[e].blockView;throw new Error("Block type not supported: "+e)},L.getBody=function(){return{content:C._contentContainer.toJSON(),globalStyles:C.getGlobalStyles().toJSON(),blockDefaults:B.a.omit(C.getConfig().toJSON().blockDefaults,"text","image")}},L.toJSON=function(){return B.a.extend({body:L.getBody()},C.getNewsletter().toJSON())},L.getNewsletter=function(){return L.newsletter},L.findModels=function(e){var t=C._contentContainer.getChildren();return B.a.filter(t,e)},C.on("before:start",function(e,t){var i=e;i.registerBlockType=L.registerBlockType,i.getBlockTypeModel=L.getBlockTypeModel,i.getBlockTypeView=L.getBlockTypeView,i.toJSON=L.toJSON,i.getBody=L.getBody,i.getNewsletter=L.getNewsletter,i.findModels=L.findModels,L.newsletter=new L.NewsletterModel(B.a.omit(B.a.clone(t.newsletter),["body"]))}),C.on("start",function(e,t){var i=e,o=t.newsletter.body,n=B.a.has(o,"content")?o.content:{};B.a.has(t.newsletter,"body")&&B.a.isObject(t.newsletter.body)||c.a.Notice.error(c.a.I18n.t("newsletterBodyIsCorrupted"),{static:!0}),i._contentContainer=new(i.getBlockTypeModel("container"))(n,{parse:!0}),i._contentContainerView=new(i.getBlockTypeView("container"))({model:i._contentContainer,renderOptions:{depth:0}}),i._appView.showChildView("contentRegion",i._contentContainerView)});var W={};W.HeadingView=v.a.View.extend({getTemplate:function(){return window.templates.heading},templateContext:function(){return{model:this.model.toJSON()}},events:function(){return{"keyup .mailpoet_input_title":B.a.partial(this.changeField,"subject"),"keyup .mailpoet_input_preheader":B.a.partial(this.changeField,"preheader")}},changeField:function(e,t){this.model.set(e,M()(t.target).val())}}),C.on("start",function(e){e._appView.showChildView("headingRegion",new W.HeadingView({model:e.getNewsletter()})),c.a.helpTooltip.show(document.getElementById("tooltip-designer-subject-line"),{tooltipId:"tooltip-designer-subject-line-ti",tooltip:c.a.I18n.t("helpTooltipDesignerSubjectLine"),place:"right"}),c.a.helpTooltip.show(document.getElementById("tooltip-designer-preheader"),{tooltipId:"tooltip-designer-preheader-ti",tooltip:c.a.I18n.t("helpTooltipDesignerPreheader")})});var H,j=i(395),U=i.n(j),q=i(396),Y=i.n(q),X=i(248),J={};J.save=function(){var e=C.toJSON(),t=M()("#mailpoet_editor_top");return B.a.isUndefined(e.body)||(e.body=R()(e.body)),C.getChannel().trigger("beforeEditorSave",e),z.saveNewsletter(e).done(function(i){void 0!==i.success&&!0===i.success||void 0!==i.error&&(0===i.error.length?c.a.Notice.error(c.a.I18n.t("templateSaveFailed"),{positionAfter:t,scroll:!0}):M()(i.error).each(function(e,i){c.a.Notice.error(i,{positionAfter:t,scroll:!0})})),B.a.isUndefined(e.body)||(e.body=JSON.parse(e.body)),C.getChannel().trigger("afterEditorSave",e,i)}).fail(function(e){C.getChannel().trigger("afterEditorSave",{},e)})},J.saveTemplate=function(e){return X.a(C.toJSON()).then(function(t){var i=B.a.extend(e||{},{thumbnail:t,body:R()(C.getBody()),categories:R()(["saved",C.getNewsletter().get("type")])});return c.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"save",data:i})})},J.exportTemplate=function(e){return X.a(C.toJSON()).then(function(t){var i=B.a.extend(e||{},{thumbnail:t,body:C.getBody(),categories:R()(["saved",C.getNewsletter().get("type")])}),o=new U.a([R()(i)],{type:"application/json;charset=utf-8"});Y.a.saveAs(o,"template.json"),c.a.trackEvent("Editor > Template exported",{"MailPoet Free version":window.mailpoet_version})})},J.SaveView=v.a.View.extend({getTemplate:function(){return window.templates.save},templateContext:function(){return{wrapperClass:this.wrapperClass}},events:{"click .mailpoet_save_button":"save","click .mailpoet_save_show_options":"toggleSaveOptions","click .mailpoet_save_next":"next","click .mailpoet_save_template":"showSaveAsTemplate","click .mailpoet_save_as_template":"saveAsTemplate","click .mailpoet_save_export":"showExportTemplate","click .mailpoet_export_template":"exportTemplate"},initialize:function(){this.setDropdownDirectionDown(),C.getChannel().on("beforeEditorSave",this.beforeSave,this),C.getChannel().on("afterEditorSave",this.afterSave,this)},setDropdownDirectionDown:function(){this.wrapperClass="mailpoet_save_dropdown_down"},setDropdownDirectionUp:function(){this.wrapperClass="mailpoet_save_dropdown_up"},onRender:function(){this.validateNewsletter(C.toJSON())},save:function(){this.hideSaveOptions(),C.getChannel().request("save")},beforeSave:function(){this.$(".mailpoet_autosaved_at").text(c.a.I18n.t("saving"))},afterSave:function(e){this.validateNewsletter(e),this.$(".mailpoet_editor_last_saved").removeClass("mailpoet_hidden"),this.$(".mailpoet_autosaved_at").text("")},showSaveOptions:function(){this.$(".mailpoet_save_show_options").addClass("mailpoet_save_show_options_active"),this.$(".mailpoet_save_options").removeClass("mailpoet_hidden"),this.hideSaveAsTemplate(),this.hideExportTemplate()},hideSaveOptions:function(){this.$(".mailpoet_save_show_options").removeClass("mailpoet_save_show_options_active"),this.$(".mailpoet_save_options").addClass("mailpoet_hidden"),this.hideSaveAsTemplate(),this.hideExportTemplate()},toggleSaveOptions:function(){this.$(".mailpoet_save_show_options").hasClass("mailpoet_save_show_options_active")?this.hideSaveOptions():this.showSaveOptions()},showSaveAsTemplate:function(){this.$(".mailpoet_save_as_template_container").removeClass("mailpoet_hidden")},hideSaveAsTemplate:function(){this.$(".mailpoet_save_as_template_container").addClass("mailpoet_hidden")},saveAsTemplate:function(){var e=this.$(".mailpoet_save_as_template_name").val(),t=M()("#mailpoet_editor_top");""===e?c.a.Notice.error(c.a.I18n.t("templateNameMissing"),{positionAfter:t,scroll:!0}):(J.saveTemplate({name:e}).then(function(){c.a.Notice.success(c.a.I18n.t("templateSaved"),{positionAfter:t,scroll:!0}),c.a.trackEvent("Editor > Template saved",{"MailPoet Free version":window.mailpoet_version})}).catch(function(){c.a.Notice.error(c.a.I18n.t("templateSaveFailed"),{positionAfter:t,scroll:!0})}),this.hideSaveOptions())},showExportTemplate:function(){this.$(".mailpoet_export_template_container").removeClass("mailpoet_hidden")},hideExportTemplate:function(){this.$(".mailpoet_export_template_container").addClass("mailpoet_hidden")},exportTemplate:function(){var e=this.$(".mailpoet_export_template_name").val(),t=M()("#mailpoet_editor_top");""===e?c.a.Notice.error(c.a.I18n.t("templateNameMissing"),{positionAfter:t,scroll:!0}):(J.exportTemplate({name:e}),this.hideExportTemplate())},next:function(){this.hideSaveOptions(),this.$(".mailpoet_save_next").hasClass("button-disabled")||(J._cancelAutosave(),J.save().done(function(){window.location.href=C.getConfig().get("urls.send")}))},validateNewsletter:function(e){var t="";C._contentContainer.isValid()?(e&&e.body&&e.body.content&&(t=R()(e.body.content)),C.getConfig().get("validation.validateUnsubscribeLinkPresent")&&t.indexOf("[link:subscription_unsubscribe_url]")<0&&t.indexOf("[link:subscription_unsubscribe]")<0?this.showValidationError(c.a.I18n.t("unsubscribeLinkMissing")):"notification"===C.getNewsletter().get("type")&&t.indexOf('"type":"automatedLatestContent"')<0&&t.indexOf('"type":"automatedLatestContentLayout"')<0?this.showValidationError(c.a.I18n.t("automatedLatestContentMissing")):this.hideValidationError()):this.showValidationError(C._contentContainer.validationError)},showValidationError:function(e){var t=this.$(".mailpoet_save_error");t.text(e),t.removeClass("mailpoet_hidden"),this.$(".mailpoet_save_next").addClass("button-disabled")},hideValidationError:function(){this.$(".mailpoet_save_error").addClass("mailpoet_hidden"),this.$(".mailpoet_save_next").removeClass("button-disabled")}}),J.autoSave=function(){J._cancelAutosave(),H=setTimeout(function(){C.getChannel().request("save").always(function(){J._cancelAutosave()})},1e3)},J._cancelAutosave=function(){H&&(clearTimeout(H),H=void 0)},J.beforeExitWithUnsavedChanges=function(e){var t,i;if(H)return t=c.a.I18n.t("unsavedChangesWillBeLost"),(i=e||window.event)&&(i.returnValue=t),t},C.on("before:start",function(e){var t=e;t.save=J.save,t.getChannel().on("autoSave",J.autoSave),window.onbeforeunload=J.beforeExitWithUnsavedChanges,t.getChannel().reply("save",t.save)}),C.on("start",function(e){var t=new J.SaveView,i=new J.SaveView;i.setDropdownDirectionUp(),e._appView.showChildView("topRegion",t),e._appView.showChildView("bottomRegion",i)});var G=v.a,Q={};G.Behaviors.behaviorsLookup=function(){return Q},window.BehaviorsLookup=Q;var K=Q;i(502);K.ColorPickerBehavior=v.a.Behavior.extend({onRender:function(){var e=this;this.view.$(".mailpoet_color").each(function(){var t=e.view.$(this),i=function(e){e&&e.getAlpha()>0?t.val(e.toString("hex6")):t.val(""),t.trigger("change")};t.spectrum({clickoutFiresChange:!0,showInput:!0,showInitial:!0,showPalette:!0,showSelectionPalette:!0,palette:[],localStorageKey:"newsletter_editor.spectrum.palette",preferredFormat:"hex6",allowEmpty:!0,chooseText:c.a.I18n.t("selectColor"),cancelText:c.a.I18n.t("cancelColorSelection"),change:i,move:i,hide:i})})}});var Z=i(45),ee=i.n(Z),te=i(99),ie=i.n(te);K.ContainerDropZoneBehavior=v.a.Behavior.extend({defaults:{columnLimit:3},onRender:function(){B.a.isObject(this.view.options.renderOptions)&&!0===this.view.options.renderOptions.disableDragAndDrop||this.addDropZone()},addDropZone:function(){var e,t=this,i=this.view,o=t.$el.get(0);if(0===this.view.renderOptions.depth)e=".mailpoet_droppable_block.mailpoet_droppable_layout_block";else{if(2!==this.view.renderOptions.depth)return;e=".mailpoet_droppable_block:not(.mailpoet_droppable_layout_block)"}ie()(o).dropzone({accept:e,overlap:"pointer",ondragenter:function(){i.$el.addClass("mailpoet_drop_active")},ondragleave:function(){t.cleanup()},ondropmove:function(e){var o,n,s,r,a,l,c,d=t.getDropPosition(e.dragmove.pageX,e.dragmove.pageY,i.$el,i.model.get("orientation"),i.model.get("blocks").length),h=i.$el,p="",u="",g=h.offset(),f=t.getCollection();void 0!==d&&(h.find(".mailpoet_drop_marker").remove(),f.isEmpty()||(0===f.length?(r=(s=h.find(i.childViewContainer)).offset().top-h.offset().top,a=s.offset().left-h.offset().left,p=s.width(),u=s.height()):(n=t.getCollection().length===d.index?f.at(d.index-1):f.at(d.index),r=(s=t.getChildren().findByModel(n).$el).offset().top-g.top,a=s.offset().left-g.left,"normal"===d.insertionType?("after"===d.position&&("vertical"===i.model.get("orientation")?r+=s.outerHeight(!0):a+=s.outerWidth()),"vertical"===i.model.get("orientation")?p=s.outerWidth():u=s.outerHeight()):("after"===d.position&&("vertical"===i.model.get("orientation")?a+=s.outerWidth():r+=s.outerHeight()),"vertical"===i.model.get("orientation")?u=s.outerHeight(!0):p=s.outerWidth(!0))),o=M()('<div class="mailpoet_drop_marker"></div>'),0===d.index&&o.addClass("mailpoet_drop_marker_first"),f.length-1===d.index&&o.addClass("mailpoet_drop_marker_last"),d.index>0&&f.length-1>d.index&&o.addClass("mailpoet_drop_marker_middle"),o.addClass("mailpoet_drop_marker_"+d.position),c=(l="before"===d.position?t.getChildren().findByModel(f.at(d.index-1)).$el:t.getChildren().findByModel(f.at(d.index)).$el).outerHeight(!0)-l.outerHeight(),o.css("top",r-c/2),o.css("left",a),o.css("width",p),o.css("height",u),h.append(o)))},ondrop:function(e){var o,n,s,r,a,l=t.getDropPosition(e.dragEvent.pageX,e.dragEvent.pageY,i.$el,i.model.get("orientation"),i.model.get("blocks").length),c=e.draggable.getDropModel(),d=t.getCollection();void 0!==l&&("normal"===l.insertionType?(n="after"===l.position?l.index+1:l.index,"horizontal"===i.model.get("orientation")&&"container"!==c.get("type")?((s=new(window.EditorApplication.getBlockTypeModel("container"))({orientation:"vertical"})).get("blocks").add(c),d.add(s,{at:n})):d.add(c,{at:n}),o=t.getChildren().findByModel(c)):(a=d.at(l.index),s=new(window.EditorApplication.getBlockTypeModel("container"))({orientation:"vertical"===i.model.get("orientation")?"horizontal":"vertical"}),d.remove(a),"horizontal"===s.get("orientation")?("before"===l.position&&((r=new(window.EditorApplication.getBlockTypeModel("container"))({orientation:"vertical"})).get("blocks").add(c),s.get("blocks").add(r)),(r=new(window.EditorApplication.getBlockTypeModel("container"))({orientation:"vertical"})).get("blocks").add(a),s.get("blocks").add(r),"after"===l.position&&((r=new(window.EditorApplication.getBlockTypeModel("container"))({orientation:"vertical"})).get("blocks").add(c),s.get("blocks").add(r))):("before"===l.position&&s.get("blocks").add(c),s.get("blocks").add(a),"after"===l.position&&s.get("blocks").add(c)),d.add(s,{at:l.index}),o=t.getChildren().findByModel(s).children.findByModel(c)),e.draggable.onDrop({dropBehavior:t,droppedModel:c,droppedView:o}),t.cleanup())}})},cleanup:function(){this.view.$el.removeClass("mailpoet_drop_active"),this.view.$(".mailpoet_drop_marker").remove()},getDropPosition:function(e,t,i){var o,n,s,r,a,l,c=0,d=this.view.$el,h=this.view.model.get("orientation"),p=d.offset(),u=p.left,g=p.top,f=d.outerWidth(!0),m=d.outerHeight(!0),_=e-u,v=t-g,w=this._canAcceptNormalInsertion(),y=this._canAcceptSpecialInsertion(),b=!!i;return 0===this.getCollection().length?{insertionType:"normal",index:0,position:"inside"}:("vertical"===h?(o=_,n=f):(o=v,n=m),y&&!w&&(c=.5),o<=n*c&&(b||y)?(s="special",a="before",r=this._computeSpecialIndex(e,t)):o>n*(1-c)&&(b||y)?(s="special",a="after",r=this._computeSpecialIndex(e,t)):(s="normal",a=(l=this._computeNormalIndex(e,t)).position,r=l.index),b||"vertical"!==h||"special"!==s||"horizontal"!==this.getCollection().at(r).get("orientation")||(s="normal",a=(l=this._computeNormalIndex(e,t)).position,r=l.index),"horizontal"!==h||"special"!==s?{insertionType:s,index:r,position:a}:void 0)},_computeNormalIndex:function(e,t){var i,o,n,s=this._computeCellIndex(e,t),r=this.getChildren().findByModel(this.getCollection().at(s)),a=this.view.model.get("orientation"),l=r.$el;return"vertical"===a?(i=t,o=l.offset().top,n=l.outerHeight(!0)):(i=e,o=l.offset().left,n=l.outerWidth(!0)),i<=o+n/2?{index:s,position:"before"}:{index:s,position:"after"}},_computeSpecialIndex:function(e,t){return this._computeCellIndex(e,t)},_computeCellIndex:function(e,t){var i=this.view.model.get("orientation"),o="vertical"===i?t:e,n=this.getChildren().find(function(e){var t,n,s=e.$el;return"vertical"===i?(t=s.offset().top,n=s.outerHeight(!0)):(t=s.offset().left,n=s.outerWidth(!0)),n+=t,t<=o&&o<=n});return"object"===ee()(n)?n._index:0},_canAcceptNormalInsertion:function(){var e=this.view.model.get("orientation"),t=this.view.renderOptions.depth,i=this.getChildren().length;return"vertical"===e||"horizontal"===e&&1===t&&i<this.options.columnLimit},_canAcceptSpecialInsertion:function(){var e=this.view.model.get("orientation"),t=this.view.renderOptions.depth,i=this.getChildren().length;return 0===t||1===t&&"horizontal"===e&&i<=this.options.columnLimit},getCollectionView:function(){return this.view.getChildView("blocks")},getChildren:function(){return this.getCollectionView().children},getCollection:function(){return this.getCollectionView().collection}});var oe=i(250),ne=i.n(oe);K.DraggableBehavior=v.a.Behavior.extend({defaults:{cloneOriginal:!1,hideOriginal:!1,ignoreSelector:".mailpoet_ignore_drag, .mailpoet_ignore_drag *",onDragSubstituteBy:void 0,getDropModel:function(){throw new Error("Missing 'drop' function for DraggableBehavior")},onDrop:function(){},testAttachToInstance:function(){return!0}},onRender:function(){var e,t=this;this.options.testAttachToInstance(this.view.model,this.view)&&(e=ie()(this.$el.get(0),{ignoreFrom:this.options.ignoreSelector}).draggable({max:1/0,autoScroll:!0,onstart:function(e){var i,o,n,s,r,a=e;!0===t.options.cloneOriginal&&(B.a.isFunction(t.options.onDragSubstituteBy)&&(n=t.options.onDragSubstituteBy(t)),s=n||a.target.cloneNode(!0),M()(a.target),(r=M()(s)).addClass("mailpoet_droppable_active"),r.css("position","absolute"),r.css("top",0),r.css("left",0),document.body.appendChild(s),i=r.width()/2,o=r.height()/2,r.css("top",a.pageY-o),r.css("left",a.pageX-i),a.interaction.element=s,!0===t.options.hideOriginal&&t.view.$el.addClass("mailpoet_hidden"),C.getChannel().trigger("dragStart"))},onmove:function(e){var t=e.target,i=(ne()(t.getAttribute("data-x"))||0)+e.dx,o=(ne()(t.getAttribute("data-y"))||0)+e.dy;t.style.transform="translate("+i+"px, "+o+"px)",t.style.webkitTransform=t.style.transform,t.setAttribute("data-x",i),t.setAttribute("data-y",o)},onend:function(e){var i=e.target;i.style.transform="",i.style.webkitTransform=i.style.transform,i.removeAttribute("data-x"),i.removeAttribute("data-y"),M()(e.interaction.element).addClass("mailpoet_droppable_active"),!0===t.options.cloneOriginal&&(M()(i).remove(),!0===t.options.hideOriginal&&t.view.$el.removeClass("mailpoet_hidden"))}}).preventDefault("auto").styleCursor(!1).actionChecker(function(e,t,i){return 0!==t.button?null:i}),void 0!==this.options.drop?e.getDropModel=this.options.drop:e.getDropModel=this.view.getDropFunc(),e.onDrop=function(e){var i=e;B.a.isObject(i)&&(i.dragBehavior=t),t.options.onDrop.apply(t,[i])})}});var se=function(e,t){var i=t.offset(),o=t.height(),n=t.width();return!(e.pageX<i.left||e.pageX>i.left+n||e.pageY<i.top||e.pageY>i.top+o)};K.HighlightEditingBehavior=v.a.Behavior.extend({modelEvents:{startEditing:"onStartEditing",stopEditing:"onStopEditing",startResizing:"onStartResizing",stopResizing:"onStopResizing"},events:{mouseenter:"onMouseEnter",mouseleave:"onMouseLeave"},onMouseEnter:function(e){this.isFocusedByPointer=!0,e&&e.buttons>0||this.view.addHighlight()},onMouseLeave:function(){this.isFocusedByPointer=!1,this.isBeingEdited||this.view.removeHighlight()},onStartEditing:function(){this.isBeingEdited=!0,this.view.addHighlight()},onStopEditing:function(){this.isBeingEdited=!1,this.isFocusedByPointer||this.view.removeHighlight()},onStartResizing:function(){this.onStartEditing(),this.view.triggerMethod("resizeStart")},onStopResizing:function(e){this.isFocusedByPointer=se(e,this.view.$el),this.onStopEditing(),this.view.triggerMethod("resizeStop",e)},onDomRefresh:function(){this.isBeingEdited&&this.view.addHighlight()},onChildviewResizeStart:function(){this.onStartEditing(),this.view.triggerMethod("resizeStart")},onChildviewResizeStop:function(e){this.isFocusedByPointer=se(e,this.view.$el),this.onStopEditing(),this.view.triggerMethod("resizeStop",e)}}),K.MediaManagerBehavior=v.a.Behavior.extend({ui:{"select-image":".mailpoet_field_image_select_image","address-input":".mailpoet_field_image_address"},events:{"click @ui.select-image":"showMediaManager","input @ui.address-input":"changeAddress"},initialize:function(){this.view.options.showImageManager&&this.showMediaManager()},changeAddress:function(e){var t=M()(e.target).val(),i=new Image;t||!this.options.onSelect?(i.onload=function(){this.options.onSelect&&this.view[this.options.onSelect]({src:t,width:i.naturalWidth+"px",height:i.naturalHeight+"px"})}.bind(this),i.src=t):this.view[this.options.onSelect]({src:null,width:null,height:null})},showMediaManager:function(){var e,t,i=this;if(this._mediaManager)return this._mediaManager.resetSelections(),void this._mediaManager.open();e=window.wp.media.view.MediaFrame.Select.extend({initialize:function(){window.wp.media.view.MediaFrame.prototype.initialize.apply(this,arguments),B.a.defaults(this.options,{multiple:!0,editing:!1,state:"insert"}),this.createSelection(),this.createStates(),this.bindHandlers(),this.createIframeStates(),this.$el.addClass("hide-title")},resetSelections:function(){this.state().get("selection").reset()},createQuery:function(e){return window.wp.media.query(e)},createStates:function(){var e=this.options;this.states.add([new window.wp.media.controller.Library({id:"insert",title:"Add images",priority:20,toolbar:"main-insert",filterable:"image",library:this.createQuery(e.library),multiple:!!e.multiple&&"reset",editable:!1,allowLocalEdits:!1,displaySettings:!1,displayUserSettings:!1})]),window.wp.media.view.settings.post.featuredImageId&&this.states.add(new window.wp.media.controller.FeaturedImage)},bindHandlers:function(){var e;this.on("router:create:browse",this.createRouter,this),this.on("router:render:browse",this.browseRouter,this),this.on("content:create:browse",this.browseContent,this),this.on("content:render:upload",this.uploadContent,this),this.on("toolbar:create:select",this.createSelectToolbar,this),this.on("menu:create:gallery",this.createMenu,this),this.on("toolbar:create:main-insert",this.createToolbar,this),this.on("toolbar:create:main-gallery",this.createToolbar,this),this.on("toolbar:create:main-embed",this.mainEmbedToolbar,this),this.on("updateExcluded",this.browseContent,this),e={content:{embed:"embedContent","edit-selection":"editSelectionContent"},toolbar:{"main-insert":"mainInsertToolbar"}},B.a.each(e,function(e,t){B.a.each(e,function(e,i){this.on(t+":render:"+i,this[e],this)},this)},this)},uploadContent:function(){window.wp.media.view.MediaFrame.Select.prototype.uploadContent.apply(this,arguments),this.$el.addClass("hide-toolbar")},embedContent:function(){var e=new window.wp.media.view.Embed({controller:this,model:this.state()}).render();this.content.set(e),e.url.focus()},editSelectionContent:function(){var e,t=this.state(),i=t.get("selection");(e=new window.wp.media.view.AttachmentsBrowser({controller:this,collection:i,selection:i,model:t,sortable:!0,search:!1,dragInfo:!0,AttachmentView:window.wp.media.view.Attachment.EditSelection}).render()).toolbar.set("backToLibrary",{text:"Return to library",priority:-100,click:function(){this.controller.content.mode("browse")}}),this.content.set(e)},selectionStatusToolbar:function(e){var t=this.state().get("editable");e.set("selection",new window.wp.media.view.Selection({controller:this,collection:this.state().get("selection"),priority:-40,editable:t&&function(){this.controller.content.mode("edit-selection")}}).render())},mainInsertToolbar:function(e){var t=this;this.selectionStatusToolbar(e),e.set("insert",{style:"primary",priority:80,text:"Select Image",requires:{selection:!0},click:function(){var e=t.state(),i=e.get("selection");t.close(),e.trigger("insert",i).reset()}})},mainEmbedToolbar:function(e){e.view=new window.wp.media.view.Toolbar.Embed({controller:this,text:"Add images"})}}),t=new e({id:"mailpoet-media-manager",frame:"select",title:"Select image",editing:!1,multiple:!1,library:{type:"image"},displaySettings:!1,button:{text:"Select"}}),this._mediaManager=t,this._mediaManager.on("insert",function(){t.state().get("selection").each(function(e){var t=e.get("sizes"),o=B.a.sortBy(B.a.keys(t),function(e){return Math.abs(1320-t[e].width)}),n=t[B.a.first(o)].width,s=B.a.filter(B.a.values(t),function(e){return e.width===n}),r=B.a.max(s,function(e){return e.height});i.options.onSelect&&i.view[i.options.onSelect]({height:r.height+"px",width:r.width+"px",src:r.url,alt:""!==e.get("alt")&&void 0!==e.get("alt")?e.get("alt"):e.get("title")})})}),this._mediaManager.open()},onBeforeDestroy:function(){"object"===ee()(this._mediaManager)&&this._mediaManager.remove()}}),K.ResizableBehavior=v.a.Behavior.extend({defaults:{elementSelector:null,resizeHandleSelector:!0,transformationFunction:function(e){return e},minLength:0,maxLength:1/0,modelField:"styles.block.height",onResize:function(e){var t=ne()(this.view.model.get(this.options.modelField))+this.options.transformationFunction(e.dy);t=Math.min(this.options.maxLength,Math.max(this.options.minLength,t)),this.view.model.set(this.options.modelField,t+"px")}},events:{mouseenter:"showResizeHandle",mouseleave:"hideResizeHandle"},onRender:function(){this.attachResize(),!0!==this.isBeingResized&&this.hideResizeHandle()},attachResize:function(){var e,t=this;e=null===this.options.elementSelector?this.view.$el.get(0):this.view.$(this.options.elementSelector).get(0),ie()(e).resizable({edges:{top:!1,left:!1,right:!1,bottom:"string"==typeof this.options.resizeHandleSelector?this.view.$(this.options.resizeHandleSelector).get(0):this.options.resizeHandleSelector}}).on("resizestart",function(){t.view.model.trigger("startResizing"),t.isBeingResized=!0,t.$el.addClass("mailpoet_resize_active")}).on("resizemove",function(e){return t.options.onResize.bind(t)(e)}).on("resizeend",function(e){t.view.model.trigger("stopResizing",e),t.isBeingResized=null,se(e,t.view.$el)||t.hideResizeHandle(),t.$el.removeClass("mailpoet_resize_active")})},showResizeHandle:function(e){!this.isBeingResized&&e&&e.buttons>0||"string"==typeof this.options.resizeHandleSelector&&this.view.$(this.options.resizeHandleSelector).removeClass("mailpoet_hidden")},hideResizeHandle:function(){"string"==typeof this.options.resizeHandleSelector&&this.view.$(this.options.resizeHandleSelector).addClass("mailpoet_hidden")}}),K.SortableBehavior=v.a.Behavior.extend({onRender:function(){var e=this.view.collection;B.a.isFunction(this.$el.sortable)&&this.$el.sortable({cursor:"move",start:function(e,t){t.item.data("previousIndex",t.item.index())},end:function(e,t){t.item.removeData("previousIndex")},update:function(t,i){var o=i.item.data("previousIndex"),n=i.item.index(),s=e.at(o);e.remove(s),e.add(s,{at:n})},items:this.options.items})}}),K.ShowSettingsBehavior=v.a.Behavior.extend({defaults:{ignoreFrom:""},events:{"click .mailpoet_content":"showSettings"},showSettings:function(e){this.isIgnoredElement(e.target)||this.view.triggerMethod("showSettings")},isIgnoredElement:function(e){return this.options.ignoreFrom&&this.options.ignoreFrom.length>0&&M()(e).is(this.options.ignoreFrom)}}),K.TextEditorBehavior=v.a.Behavior.extend({defaults:{selector:".mailpoet_content",toolbar1:"bold italic link unlink forecolor mailpoet_shortcodes",toolbar2:"",validElements:"p[class|style],span[class|style],a[href|class|title|target|style],strong[class|style],em[class|style],strike,br",invalidElements:"script",blockFormats:"Paragraph=p",plugins:"link textcolor colorpicker mailpoet_shortcodes",configurationFilter:function(e){return e}},initialize:function(){this.listenTo(C.getChannel(),"dragStart",this.hideEditor)},hideEditor:function(){this.tinymceEditor&&this.tinymceEditor.fire("blur")},onDomRefresh:function(){var e=this;!0!==this.view.disableTextEditor&&this.$(this.options.selector).tinymce(this.options.configurationFilter({inline:!0,menubar:!1,toolbar1:this.options.toolbar1,toolbar2:this.options.toolbar2,browser_spellcheck:!0,valid_elements:this.options.validElements,invalid_elements:this.options.invalidElements,block_formats:this.options.blockFormats,relative_urls:!1,remove_script_host:!1,convert_urls:!0,urlconverter_callback:function(e){return e.match(/\[.+\]/g)?e:this.documentBaseURI.toAbsolute(e,this.settings.remove_script_host)},plugins:this.options.plugins,setup:function(t){e.tinymceEditor=t,t.on("change",function(){e.view.triggerMethod("text:editor:change",t.getContent())}),t.on("click",function(e){document.activeElement!==t.targetElm&&t.selection.placeCaretAt(e.clientX,e.clientY)}),t.on("focus",function(){e.view.triggerMethod("text:editor:focus")}),t.on("blur",function(){e.view.triggerMethod("text:editor:blur")})}}))}});i(254);var re={},ae=v.a.View.extend({});re.BlockModel=V.a.extend({stale:[],initialize:function(){this.on("change",function(){this._updateDefaults(),C.getChannel().trigger("autoSave")})},_getDefaults:function(e,t){var i;return i=B.a.isObject(t)&&B.a.isFunction(t.toJSON)?t.toJSON():t,JSON.parse(R()(M.a.extend(e,i||{})))},_updateDefaults:function(){var e=this.get("context")||this.get("type");C.getConfig().set("blockDefaults."+e,this.toJSON())},toJSON:function(){return B.a.omit(V.a.prototype.toJSON.call(this),this.stale)},getChildren:function(){return[]}}),re.BlockView=ae.extend({regions:{toolsRegion:"> .mailpoet_tools"},modelEvents:{change:"render",delete:"deleteBlock",duplicate:"duplicateBlock"},behaviors:{DraggableBehavior:{cloneOriginal:!0,hideOriginal:!0,onDrop:function(e){e.dragBehavior.view.model.destroy()},onDragSubstituteBy:function(e){var t,i;if(B.a.isFunction(e.view.onDragSubstituteBy))return(t=new(e.view.onDragSubstituteBy())).render(),i=t.$el.get(0).cloneNode(!0),t.destroy(),i}},HighlightEditingBehavior:{}},templateContext:function(){return{model:this.model.toJSON(),viewCid:this.cid}},constructor:function(){ae.apply(this,arguments),this.$el.addClass("mailpoet_editor_view_"+this.cid)},initialize:function(){this.on("showSettings",this.showSettings,this),this.on("dom:refresh",this.showBlock,this),this._isFirstRender=!0},addHighlight:function(){this.$el.addClass("mailpoet_highlight"),this.showingToolsDisabled||(this.$("> .mailpoet_tools").addClass("mailpoet_display_tools"),this.toolsView.triggerMethod("showTools"))},removeHighlight:function(){this.$el.removeClass("mailpoet_highlight"),this.hideTools()},hideTools:function(){this.$("> .mailpoet_tools").removeClass("mailpoet_display_tools"),this.toolsView.triggerMethod("hideTools")},enableShowingTools:function(){this.showingToolsDisabled=!1},disableShowingTools:function(){this.showingToolsDisabled=!0,this.hideTools()},showSettings:function(e){this.toolsView.triggerMethod("showSettings",e)},getDropFunc:function(){return function(){return this.model.clone()}.bind(this)},disableDragging:function(){this.$el.addClass("mailpoet_ignore_drag")},enableDragging:function(){this.$el.removeClass("mailpoet_ignore_drag")},showBlock:function(){this._isFirstRender&&(this.transitionIn(),this._isFirstRender=!1)},deleteBlock:function(){this.transitionOut().then(function(){this.model.destroy()}.bind(this))},duplicateBlock:function(){this.model.collection.add(this.model.toJSON(),{at:this.model.collection.findIndex(this.model)})},transitionIn:function(){return this._transition("slideDown","fadeIn","easeOut")},transitionOut:function(){return this._transition("slideUp","fadeOut","easeIn")},_transition:function(e,t,i){var o=M.a.Deferred();return this.$el.velocity(e,{duration:250,easing:i,complete:function(){o.resolve()}}).velocity(t,{duration:250,easing:i,queue:!1}),o}}),re.BlockToolsView=ae.extend({getTemplate:function(){return window.templates.genericBlockTools},events:{"click .mailpoet_edit_block":"changeSettings","click .mailpoet_delete_block_activate":"showDeletionConfirmation","click .mailpoet_delete_block_cancel":"hideDeletionConfirmation","click .mailpoet_delete_block_confirm":"deleteBlock","click .mailpoet_duplicate_block":"duplicateBlock"},tools:{settings:!0,delete:!0,duplicate:!0,move:!0},getSettingsView:function(){return re.BlockSettingsView},initialize:function(e){var t=e||{};B.a.isUndefined(t.tools)||(this.tools=M.a.extend({},this.tools,t.tools||{})),this.on("hideTools",this.hideDeletionConfirmation,this),this.on("showSettings",this.changeSettings)},templateContext:function(){return{model:this.model.toJSON(),viewCid:this.cid,tools:this.tools}},changeSettings:function(e){new(this.getSettingsView())(B.a.extend({model:this.model},e||{})).render()},showDeletionConfirmation:function(){this.$(".mailpoet_delete_block").closest(".mailpoet_block").find("> .mailpoet_block_highlight").css({background:"#E64047",opacity:.5}),this.$(".mailpoet_delete_block").addClass("mailpoet_delete_block_activated")},hideDeletionConfirmation:function(){this.$(".mailpoet_delete_block").closest(".mailpoet_block").find("> .mailpoet_block_highlight").css({background:"transparent",opacity:1}),this.$(".mailpoet_delete_block").removeClass("mailpoet_delete_block_activated")},deleteBlock:function(e){return e.preventDefault(),this.model.trigger("delete"),!1},duplicateBlock:function(e){return e.preventDefault(),this.model.trigger("duplicate"),!1}}),re.BlockSettingsView=v.a.View.extend({className:"mailpoet_editor_settings",behaviors:{ColorPickerBehavior:{}},initialize:function(e){var t;this.model.trigger("startEditing"),t={element:this.$el,template:"",position:"right",width:C.getConfig().get("sidepanelWidth"),onCancel:function(){this.destroy()}.bind(this)},this.renderOptions=e.renderOptions||{},"subpanel"===this.renderOptions.displayFormat?c.a.Modal.subpanel(t):c.a.Modal.panel(t)},templateContext:function(){return{model:this.model.toJSON()}},close:function(){this.destroy()},changeField:function(e,t){this.model.set(e,M()(t.target).val())},changePixelField:function(e,t){this.changeFieldWithSuffix(e,t,"px")},changeFieldWithSuffix:function(e,t,i){this.model.set(e,M()(t.target).val()+i)},changeBoolField:function(e,t){this.model.set(e,"true"===M()(t.target).val())},changeBoolCheckboxField:function(e,t){this.model.set(e,!!M()(t.target).prop("checked"))},changeColorField:function(e,t){var i=M()(t.target).val();""===i&&(i="transparent"),this.model.set(e,i)},onBeforeDestroy:function(){c.a.Modal.close(),this.model.trigger("stopEditing")}}),re.WidgetView=v.a.View.extend({className:"mailpoet_widget mailpoet_droppable_block mailpoet_droppable_widget",behaviors:{DraggableBehavior:{drop:function(){throw new Error("Unsupported operation")}}}});var le,ce=re,de={},he=ce;le=N.a.Collection.extend({model:he.BlockModel,initialize:function(){this.on("add change remove",function(){C.getChannel().trigger("autoSave")})},parse:function(e){return B.a.map(e,function(e){return new(C.getBlockTypeModel(e.type))(e,{parse:!0})})}}),de.ContainerBlockModel=he.BlockModel.extend({relations:{blocks:le},defaults:function(){return this._getDefaults({type:"container",columnLayout:!1,orientation:"vertical",image:{src:null,display:"scale"},styles:{block:{backgroundColor:"transparent"}},blocks:new le},C.getConfig().get("blockDefaults.container"))},_updateDefaults:function(){},validate:function(){var e=this.get("blocks").find(function(e){return!e.isValid()});if(e)return e.validationError},parse:function(e){return"container"===e.type&&B.a.has(e,"blocks")&&e.blocks.constructor===Array&&(e.blocks=new le(e.blocks,{parse:!0})),e},getChildren:function(){var e=this.get("blocks").map(function(e){return[e,e.getChildren()]});return B.a.flatten(e)}}),de.ContainerBlocksView=v.a.CollectionView.extend({className:"mailpoet_container",childView:function(e){return C.getBlockTypeView(e.get("type"))},childViewOptions:function(){var e=B.a.clone(this.renderOptions);return void 0!==e.depth&&(e.depth+=1),{renderOptions:e}},emptyView:function(){return de.ContainerBlockEmptyView},emptyViewOptions:function(){return{renderOptions:this.renderOptions}},initialize:function(e){this.renderOptions=e.renderOptions},onChildviewResizeStart:function(){this.triggerMethod("resizeStart")},onChildviewResizeStop:function(e){this.triggerMethod("resizeStop",e)}}),de.ContainerBlockView=he.BlockView.extend({regions:B.a.extend({},he.BlockView.prototype.regions,{blocks:{el:"> .mailpoet_container",replaceElement:!0}}),className:"mailpoet_block mailpoet_container_block mailpoet_droppable_block mailpoet_droppable_layout_block",getTemplate:function(){return window.templates.containerBlock},events:B.a.extend({},he.BlockView.prototype.events,{"click .mailpoet_newsletter_layer_selector":"toggleEditingLayer"}),ui:{tools:"> .mailpoet_tools"},behaviors:B.a.extend({},he.BlockView.prototype.behaviors,{ContainerDropZoneBehavior:{},DraggableBehavior:{cloneOriginal:!0,hideOriginal:!0,onDrop:function(e){e.dragBehavior.view.model.destroy()},onDragSubstituteBy:function(e){var t,i;if(B.a.isFunction(e.view.onDragSubstituteBy))return(t=new(e.view.onDragSubstituteBy())).render(),i=t.$el.get(0).cloneNode(!0),t.destroy(),i},testAttachToInstance:function(e,t){return 1===t.renderOptions.depth}},HighlightEditingBehavior:{}}),onDragSubstituteBy:function(){if(1===this.renderOptions.depth){if(3===this.model.get("blocks").length)return de.ThreeColumnContainerWidgetView;if(2===this.model.get("blocks").length)return de.TwoColumnContainerWidgetView}return de.OneColumnContainerWidgetView},initialize:function(e){he.BlockView.prototype.initialize.apply(this,arguments),this.renderOptions=B.a.defaults(e.renderOptions||{},{})},onRender:function(){var e,t="";this.toolsView=new de.ContainerBlockToolsView({model:this.model,tools:{settings:1===this.renderOptions.depth,delete:1===this.renderOptions.depth,duplicate:!0,move:1===this.renderOptions.depth,layerSelector:!1}}),this.showChildView("toolsRegion",this.toolsView),this.showChildView("blocks",new de.ContainerBlocksView({collection:this.model.get("blocks"),renderOptions:this.renderOptions})),"string"==typeof(e=this.model.get("columnLayout"))&&(t="mailpoet_irregular_width_contents_container column_layout_"+e),this.$("> .mailpoet_container").attr("class","mailpoet_container mailpoet_container_"+this.model.get("orientation")+" "+t)},addHighlight:function(){1!==this.renderOptions.depth||this.$el.hasClass("mailpoet_container_layer_active")||(this.$(this.ui.tools).addClass("mailpoet_display_tools"),this.$el.addClass("mailpoet_highlight"),this.toolsView.triggerMethod("showTools"))},removeHighlight:function(){1!==this.renderOptions.depth||this.$el.hasClass("mailpoet_container_layer_active")||(this.$(this.ui.tools).removeClass("mailpoet_display_tools"),this.$el.removeClass("mailpoet_highlight"),this.toolsView.triggerMethod("hideTools"))},toggleEditingLayer:function(e){var t=this,i=this.$("> .mailpoet_tools .mailpoet_newsletter_layer_selector"),o=M()(".mailpoet_layer_overlay"),n=this.$("> .mailpoet_container"),s=function(){t.$el.removeClass("mailpoet_container_layer_active"),i.removeClass("mailpoet_container_layer_active"),n.removeClass("mailpoet_layer_highlight"),o.hide(),o.off("click")};i.hasClass("mailpoet_container_layer_active")?s():(t.$el.addClass("mailpoet_container_layer_active"),i.addClass("mailpoet_container_layer_active"),n.addClass("mailpoet_layer_highlight"),o.click(s),o.show()),e.stopPropagation()}}),de.ContainerBlockEmptyView=v.a.View.extend({getTemplate:function(){return window.templates.containerEmpty},initialize:function(e){this.renderOptions=B.a.defaults(e.renderOptions||{},{})},templateContext:function(){return{isRoot:0===this.renderOptions.depth,emptyContainerMessage:this.renderOptions.emptyContainerMessage||""}}}),de.ContainerBlockToolsView=he.BlockToolsView.extend({getSettingsView:function(){return de.ContainerBlockSettingsView}}),de.ContainerBlockSettingsView=he.BlockSettingsView.extend({behaviors:B.a.extend({},he.BlockSettingsView.prototype.behaviors,{MediaManagerBehavior:{onSelect:"onImageSelect"}}),getTemplate:function(){return window.templates.containerBlockSettings},events:function(){return{"change .mailpoet_field_container_background_color":B.a.partial(this.changeColorField,"styles.block.backgroundColor"),"click .mailpoet_done_editing":"close","change .mailpoet_field_display_type":"changeDisplayType"}},initialize:function(){he.BlockSettingsView.prototype.initialize.apply(this,arguments),this.model.trigger("startEditing"),this._columnsSettingsView=new de.ContainerBlockColumnsSettingsView({collection:this.model.get("blocks")})},changeDisplayType:function(e){this.model.get("image").set("display",e.target.value),this.model.trigger("change")},onImageSelect:function(e){this.model.set("image.src",e.src),this.model.trigger("change"),this.render()}}),de.ContainerBlockColumnsSettingsView=v.a.CollectionView.extend({childView:function(){return de.ContainerBlockColumnSettingsView},childViewOptions:function(e,t){return{columnIndex:t}}}),de.ContainerBlockColumnSettingsView=v.a.View.extend({getTemplate:function(){return window.templates.containerBlockColumnSettings},initialize:function(e){this.columnNumber=(e.columnIndex||0)+1},templateContext:function(){return{model:this.model.toJSON(),columnNumber:this.columnNumber}}}),de.OneColumnContainerWidgetView=he.WidgetView.extend({className:he.WidgetView.prototype.className+" mailpoet_droppable_layout_block",getTemplate:function(){return window.templates.oneColumnLayoutInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new de.ContainerBlockModel({orientation:"horizontal",blocks:[new de.ContainerBlockModel]})}}}}),de.TwoColumnContainerWidgetView=he.WidgetView.extend({className:he.WidgetView.prototype.className+" mailpoet_droppable_layout_block",getTemplate:function(){return window.templates.twoColumnLayoutInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new de.ContainerBlockModel({orientation:"horizontal",blocks:[new de.ContainerBlockModel,new de.ContainerBlockModel]})}}}}),de.ThreeColumnContainerWidgetView=he.WidgetView.extend({className:he.WidgetView.prototype.className+" mailpoet_droppable_layout_block",getTemplate:function(){return window.templates.threeColumnLayoutInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new de.ContainerBlockModel({orientation:"horizontal",blocks:[new de.ContainerBlockModel,new de.ContainerBlockModel,new de.ContainerBlockModel]})}}}}),de.TwoColumn12ContainerWidgetView=he.WidgetView.extend({className:he.WidgetView.prototype.className+" mailpoet_droppable_layout_block",getTemplate:function(){return window.templates.twoColumn12LayoutInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){var e=new de.ContainerBlockModel({orientation:"horizontal",blocks:[new de.ContainerBlockModel,new de.ContainerBlockModel]});return e.set("columnLayout","1_2"),e}}}}),de.TwoColumn21ContainerWidgetView=he.WidgetView.extend({className:he.WidgetView.prototype.className+" mailpoet_droppable_layout_block",getTemplate:function(){return window.templates.twoColumn21LayoutInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){var e=new de.ContainerBlockModel({orientation:"horizontal",blocks:[new de.ContainerBlockModel,new de.ContainerBlockModel]});return e.set("columnLayout","2_1"),e}}}}),C.on("before:start",function(e){e.registerBlockType("container",{blockModel:de.ContainerBlockModel,blockView:de.ContainerBlockView}),e.registerLayoutWidget({name:"oneColumnLayout",priority:100,widgetView:de.OneColumnContainerWidgetView}),e.registerLayoutWidget({name:"twoColumnLayout",priority:100,widgetView:de.TwoColumnContainerWidgetView}),e.registerLayoutWidget({name:"threeColumnLayout",priority:100,widgetView:de.ThreeColumnContainerWidgetView}),e.registerLayoutWidget({name:"twoColumn12Layout",priority:100,widgetView:de.TwoColumn12ContainerWidgetView}),e.registerLayoutWidget({name:"twoColumn21Layout",priority:100,widgetView:de.TwoColumn21ContainerWidgetView})});var pe={},ue=ce;pe.ButtonBlockModel=ue.BlockModel.extend({defaults:function(){return this._getDefaults({type:"button",text:"Button",url:"",styles:{block:{backgroundColor:"#ff0000",borderColor:"#cccccc",borderWidth:"1px",borderRadius:"4px",borderStyle:"solid",width:"200px",lineHeight:"40px",fontColor:"#000000",fontFamily:"Arial",fontSize:"16px",fontWeight:"normal",textAlign:"center"}}},C.getConfig().get("blockDefaults.button"))}}),pe.ButtonBlockView=ue.BlockView.extend({className:"mailpoet_block mailpoet_button_block mailpoet_droppable_block",getTemplate:function(){return window.templates.buttonBlock},onDragSubstituteBy:function(){return pe.ButtonWidgetView},behaviors:B.a.extend({},ue.BlockView.prototype.behaviors,{ShowSettingsBehavior:{}}),initialize:function(){ue.BlockView.prototype.initialize.apply(this,arguments),this._replaceButtonStylesHandler=function(e){this.model.set(e)}.bind(this),C.getChannel().on("replaceAllButtonStyles",this._replaceButtonStylesHandler)},onRender:function(){this.toolsView=new pe.ButtonBlockToolsView({model:this.model}),this.showChildView("toolsRegion",this.toolsView)}}),pe.ButtonBlockToolsView=ue.BlockToolsView.extend({getSettingsView:function(){return pe.ButtonBlockSettingsView}}),pe.ButtonBlockSettingsView=ue.BlockSettingsView.extend({getTemplate:function(){return window.templates.buttonBlockSettings},events:function(){return{"input .mailpoet_field_button_text":B.a.partial(this.changeField,"text"),"input .mailpoet_field_button_url":B.a.partial(this.changeField,"url"),"change .mailpoet_field_button_alignment":B.a.partial(this.changeField,"styles.block.textAlign"),"change .mailpoet_field_button_font_color":B.a.partial(this.changeColorField,"styles.block.fontColor"),"change .mailpoet_field_button_font_family":B.a.partial(this.changeField,"styles.block.fontFamily"),"change .mailpoet_field_button_font_size":B.a.partial(this.changeField,"styles.block.fontSize"),"change .mailpoet_field_button_background_color":B.a.partial(this.changeColorField,"styles.block.backgroundColor"),"change .mailpoet_field_button_border_color":B.a.partial(this.changeColorField,"styles.block.borderColor"),"change .mailpoet_field_button_font_weight":"changeFontWeight","input .mailpoet_field_button_border_width":B.a.partial(this.updateValueAndCall,".mailpoet_field_button_border_width_input",B.a.partial(this.changePixelField,"styles.block.borderWidth").bind(this)),"change .mailpoet_field_button_border_width":B.a.partial(this.updateValueAndCall,".mailpoet_field_button_border_width_input",B.a.partial(this.changePixelField,"styles.block.borderWidth").bind(this)),"input .mailpoet_field_button_border_width_input":B.a.partial(this.updateValueAndCall,".mailpoet_field_button_border_width",B.a.partial(this.changePixelField,"styles.block.borderWidth").bind(this)),"input .mailpoet_field_button_border_radius":B.a.partial(this.updateValueAndCall,".mailpoet_field_button_border_radius_input",B.a.partial(this.changePixelField,"styles.block.borderRadius").bind(this)),"change .mailpoet_field_button_border_radius":B.a.partial(this.updateValueAndCall,".mailpoet_field_button_border_radius_input",B.a.partial(this.changePixelField,"styles.block.borderRadius").bind(this)),"input .mailpoet_field_button_border_radius_input":B.a.partial(this.updateValueAndCall,".mailpoet_field_button_border_radius",B.a.partial(this.changePixelField,"styles.block.borderRadius").bind(this)),"input .mailpoet_field_button_width":B.a.partial(this.updateValueAndCall,".mailpoet_field_button_width_input",B.a.partial(this.changePixelField,"styles.block.width").bind(this)),"change .mailpoet_field_button_width":B.a.partial(this.updateValueAndCall,".mailpoet_field_button_width_input",B.a.partial(this.changePixelField,"styles.block.width").bind(this)),"input .mailpoet_field_button_width_input":B.a.partial(this.updateValueAndCall,".mailpoet_field_button_width",B.a.partial(this.changePixelField,"styles.block.width").bind(this)),"input .mailpoet_field_button_line_height":B.a.partial(this.updateValueAndCall,".mailpoet_field_button_line_height_input",B.a.partial(this.changePixelField,"styles.block.lineHeight").bind(this)),"change .mailpoet_field_button_line_height":B.a.partial(this.updateValueAndCall,".mailpoet_field_button_line_height_input",B.a.partial(this.changePixelField,"styles.block.lineHeight").bind(this)),"input .mailpoet_field_button_line_height_input":B.a.partial(this.updateValueAndCall,".mailpoet_field_button_line_height",B.a.partial(this.changePixelField,"styles.block.lineHeight").bind(this)),"click .mailpoet_field_button_replace_all_styles":"applyToAll","click .mailpoet_done_editing":"close"}},templateContext:function(){return B.a.extend({},ue.BlockView.prototype.templateContext.apply(this,arguments),{availableStyles:C.getAvailableStyles().toJSON(),renderOptions:this.renderOptions})},applyToAll:function(){C.getChannel().trigger("replaceAllButtonStyles",B.a.pick(this.model.toJSON(),"styles","type"))},updateValueAndCall:function(e,t,i){this.$(e).val(M()(i.target).val()),t(i)},changeFontWeight:function(e){var t=!!M()(e.target).prop("checked");this.model.set("styles.block.fontWeight",t?M()(e.target).val():"normal")}}),pe.ButtonWidgetView=ue.WidgetView.extend({getTemplate:function(){return window.templates.buttonInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new pe.ButtonBlockModel}}}}),C.on("before:start",function(e){e.registerBlockType("button",{blockModel:pe.ButtonBlockModel,blockView:pe.ButtonBlockView}),e.registerWidget({name:"button",widgetView:pe.ButtonWidgetView,priority:92})});var ge,fe=pe,me=i(15),_e=i.n(me),ve={},we=ce;ve.ImageBlockModel=we.BlockModel.extend({defaults:function(){return this._getDefaults({type:"image",link:"",src:"",alt:"An image of...",fullWidth:!0,width:"64px",height:"64px",styles:{block:{textAlign:"center"}}},C.getConfig().get("blockDefaults.image"))},_updateDefaults:function(){}}),ve.ImageBlockView=we.BlockView.extend({className:"mailpoet_block mailpoet_image_block mailpoet_droppable_block",getTemplate:function(){return window.templates.imageBlock},onDragSubstituteBy:function(){return ve.ImageWidgetView},templateContext:function(){return B.a.extend({imageMissingSrc:C.getConfig().get("urls.imageMissing")},we.BlockView.prototype.templateContext.apply(this))},behaviors:B.a.extend({},we.BlockView.prototype.behaviors,{ResizableBehavior:{elementSelector:".mailpoet_image",resizeHandleSelector:".mailpoet_image_resize_handle",onResize:function(e){var t=this.$(".mailpoet_image").offset(),i=e.pageX-t.left;this.view.model.set("width",i+"px")}},ShowSettingsBehavior:{ignoreFrom:".mailpoet_image_resize_handle"}}),onRender:function(){var e=this;this.toolsView=new ve.ImageBlockToolsView({model:this.model}),this.showChildView("toolsRegion",this.toolsView),this.model.get("fullWidth")?this.$el.addClass("mailpoet_full_image"):this.$el.removeClass("mailpoet_full_image"),this.model.get("width")&&"auto"!==this.model.get("width")||this.$el.find("img").on("load",function(){e.model.set("width",this.width),e.model.set("height",this.height)}),this.$(".mailpoet_content").css("width",this.model.get("width"))}}),ve.ImageBlockToolsView=we.BlockToolsView.extend({getSettingsView:function(){return ve.ImageBlockSettingsView}}),ve.ImageBlockSettingsView=we.BlockSettingsView.extend({behaviors:B.a.extend({},we.BlockSettingsView.prototype.behaviors,{MediaManagerBehavior:{onSelect:"onImageSelect"}}),onRender:function(){c.a.helpTooltip.show(document.getElementById("tooltip-designer-full-width"),{tooltipId:"tooltip-editor-full-width",tooltip:c.a.I18n.t("helpTooltipDesignerFullWidth")}),c.a.helpTooltip.show(document.getElementById("tooltip-designer-ideal-width"),{tooltipId:"tooltip-editor-ideal-width",tooltip:c.a.I18n.t("helpTooltipDesignerIdealWidth")})},getTemplate:function(){return window.templates.imageBlockSettings},events:function(){return{"input .mailpoet_field_image_link":B.a.partial(this.changeField,"link"),"input .mailpoet_field_image_alt_text":B.a.partial(this.changeField,"alt"),"change .mailpoet_field_image_full_width":B.a.partial(this.changeBoolCheckboxField,"fullWidth"),"change .mailpoet_field_image_alignment":B.a.partial(this.changeField,"styles.block.textAlign"),"click .mailpoet_done_editing":"close","input .mailpoet_field_image_width":B.a.partial(this.updateValueAndCall,".mailpoet_field_image_width_input",B.a.partial(this.changePixelField,"width").bind(this)),"change .mailpoet_field_image_width":B.a.partial(this.updateValueAndCall,".mailpoet_field_image_width_input",B.a.partial(this.changePixelField,"width").bind(this)),"input .mailpoet_field_image_width_input":B.a.partial(this.updateValueAndCall,".mailpoet_field_image_width",B.a.partial(this.changePixelField,"width").bind(this))}},modelEvents:function(){return{"change:maxWidth":"updateMaxWidth","change:width":"updateWidth"}},updateValueAndCall:function(e,t,i){this.$(e).val(M()(i.target).val()),t(i)},updateMaxWidth:function(){var e=_e()(this.model.get("maxWidth"),10);this.$(".mailpoet_field_image_width").attr("max",e),this.$(".mailpoet_field_image_width_input").attr("max",e)},updateWidth:function(){var e=_e()(this.model.get("width"),10);this.$(".mailpoet_field_image_width").val(e),this.$(".mailpoet_field_image_width_input").val(e)},onImageSelect:function(e){null===e.src?this.model.set({src:""}):this.model.set(e),this.render()}}),ge=we.WidgetView.extend({id:"automation_editor_block_image",getTemplate:function(){return window.templates.imageInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new ve.ImageBlockModel},onDrop:function(e){e.droppedView.triggerMethod("showSettings",{showImageManager:!0})}}}}),ve.ImageWidgetView=ge,C.on("before:start",function(e){e.registerBlockType("image",{blockModel:ve.ImageBlockModel,blockView:ve.ImageBlockView}),e.registerWidget({name:"image",widgetView:ve.ImageWidgetView,priority:91})});var ye={},be=ce;ye.DividerBlockModel=be.BlockModel.extend({defaults:function(){return this._getDefaults({type:"divider",styles:{block:{backgroundColor:"transparent",padding:"12px",borderStyle:"solid",borderWidth:"1px",borderColor:"#000000"}}},C.getConfig().get("blockDefaults.divider"))}}),ye.DividerBlockView=be.BlockView.extend({className:"mailpoet_block mailpoet_divider_block mailpoet_droppable_block",getTemplate:function(){return window.templates.dividerBlock},modelEvents:B.a.omit(be.BlockView.prototype.modelEvents,"change"),behaviors:B.a.defaults({ResizableBehavior:{elementSelector:".mailpoet_content",resizeHandleSelector:".mailpoet_resize_handle",transformationFunction:function(e){return e/2},minLength:0,modelField:"styles.block.padding"},ShowSettingsBehavior:{ignoreFrom:".mailpoet_resize_handle"}},be.BlockView.prototype.behaviors),onDragSubstituteBy:function(){return ye.DividerWidgetView},initialize:function(){var e=this;be.BlockView.prototype.initialize.apply(this,arguments),this._replaceDividerHandler=function(t){e.model.set(t),e.model.trigger("applyToAll")},C.getChannel().on("replaceAllDividers",this._replaceDividerHandler),this.listenTo(this.model,"change:src change:styles.block.backgroundColor change:styles.block.borderStyle change:styles.block.borderWidth change:styles.block.borderColor applyToAll",this.render),this.listenTo(this.model,"change:styles.block.padding",this.changePadding)},templateContext:function(){return B.a.extend({totalHeight:2*_e()(this.model.get("styles.block.padding"),10)+_e()(this.model.get("styles.block.borderWidth"),10)+"px"},be.BlockView.prototype.templateContext.apply(this))},onRender:function(){this.toolsView=new ye.DividerBlockToolsView({model:this.model}),this.showChildView("toolsRegion",this.toolsView)},onBeforeDestroy:function(){C.getChannel().off("replaceAllDividers",this._replaceDividerHandler),this.stopListening(this.model)},changePadding:function(){this.$(".mailpoet_content").css("padding-top",this.model.get("styles.block.padding")),this.$(".mailpoet_content").css("padding-bottom",this.model.get("styles.block.padding")),this.$(".mailpoet_resize_handle_text").text(2*_e()(this.model.get("styles.block.padding"),10)+_e()(this.model.get("styles.block.borderWidth"),10)+"px")}}),ye.DividerBlockToolsView=be.BlockToolsView.extend({getSettingsView:function(){return ye.DividerBlockSettingsView}}),ye.DividerBlockSettingsView=be.BlockSettingsView.extend({getTemplate:function(){return window.templates.dividerBlockSettings},events:function(){return{"click .mailpoet_field_divider_style":"changeStyle","input .mailpoet_field_divider_border_width":B.a.partial(this.updateValueAndCall,".mailpoet_field_divider_border_width_input",B.a.partial(this.changePixelField,"styles.block.borderWidth").bind(this)),"change .mailpoet_field_divider_border_width":B.a.partial(this.updateValueAndCall,".mailpoet_field_divider_border_width_input",B.a.partial(this.changePixelField,"styles.block.borderWidth").bind(this)),"input .mailpoet_field_divider_border_width_input":B.a.partial(this.updateValueAndCall,".mailpoet_field_divider_border_width",B.a.partial(this.changePixelField,"styles.block.borderWidth").bind(this)),"change .mailpoet_field_divider_border_color":B.a.partial(this.changeColorField,"styles.block.borderColor"),"change .mailpoet_field_divider_background_color":B.a.partial(this.changeColorField,"styles.block.backgroundColor"),"click .mailpoet_button_divider_apply_to_all":"applyToAll","click .mailpoet_done_editing":"close"}},modelEvents:function(){return{"change:styles.block.borderColor":"repaintDividerStyleOptions"}},templateContext:function(){return B.a.extend({},be.BlockView.prototype.templateContext.apply(this,arguments),{availableStyles:C.getAvailableStyles().toJSON(),renderOptions:this.renderOptions})},changeStyle:function(e){var t=M()(e.currentTarget).data("style");this.model.set("styles.block.borderStyle",t),this.$(".mailpoet_field_divider_style").removeClass("mailpoet_active_divider_style"),this.$('.mailpoet_field_divider_style[data-style="'+t+'"]').addClass("mailpoet_active_divider_style")},repaintDividerStyleOptions:function(){this.$(".mailpoet_field_divider_style > div").css("border-top-color",this.model.get("styles.block.borderColor"))},applyToAll:function(){C.getChannel().trigger("replaceAllDividers",this.model.toJSON())},updateValueAndCall:function(e,t,i){this.$(e).val(M()(i.target).val()),t(i)}}),ye.DividerWidgetView=be.WidgetView.extend({getTemplate:function(){return window.templates.dividerInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new ye.DividerBlockModel}}}}),C.on("before:start",function(e){e.registerBlockType("divider",{blockModel:ye.DividerBlockModel,blockView:ye.DividerBlockView}),e.registerWidget({name:"divider",widgetView:ye.DividerWidgetView,priority:93})});var xe=ye,ke={},Ce=ce;ke.TextBlockModel=Ce.BlockModel.extend({defaults:function(){return this._getDefaults({type:"text",text:"Edit this to insert text"},C.getConfig().get("blockDefaults.text"))},_updateDefaults:function(){}}),ke.TextBlockView=Ce.BlockView.extend({className:"mailpoet_block mailpoet_text_block mailpoet_droppable_block",getTemplate:function(){return window.templates.textBlock},modelEvents:B.a.omit(Ce.BlockView.prototype.modelEvents,"change"),behaviors:B.a.extend({},Ce.BlockView.prototype.behaviors,{TextEditorBehavior:{toolbar1:"formatselect bold italic forecolor | link unlink",toolbar2:"alignleft aligncenter alignright alignjustify | bullist numlist blockquote | code mailpoet_shortcodes",validElements:"p[class|style],span[class|style],a[href|class|title|target|style],h1[class|style],h2[class|style],h3[class|style],ol[class|style],ul[class|style],li[class|style],strong[class|style],em[class|style],strike,br,blockquote[class|style],table[class|style],tr[class|style],th[class|style],td[class|style]",invalidElements:"script",blockFormats:"Heading 1=h1;Heading 2=h2;Heading 3=h3;Paragraph=p",plugins:"link lists code textcolor colorpicker mailpoet_shortcodes paste",configurationFilter:function(e){return B.a.extend({},e,{mailpoet_shortcodes:C.getConfig().get("shortcodes").toJSON(),mailpoet_shortcodes_window_title:c.a.I18n.t("shortcodesWindowTitle")})}}}),initialize:function(e){Ce.BlockView.prototype.initialize.apply(this,arguments),this.renderOptions=B.a.defaults(e.renderOptions||{},{disableTextEditor:!1}),this.disableTextEditor=this.renderOptions.disableTextEditor},onDragSubstituteBy:function(){return ke.TextWidgetView},onRender:function(){this.toolsView=new ke.TextBlockToolsView({model:this.model,tools:{settings:!1}}),this.showChildView("toolsRegion",this.toolsView)},onTextEditorChange:function(e){this.model.set("text",e)},onTextEditorFocus:function(){this.disableDragging(),this.disableShowingTools()},onTextEditorBlur:function(){this.enableDragging(),this.enableShowingTools()}}),ke.TextBlockToolsView=Ce.BlockToolsView.extend({getSettingsView:function(){return ke.TextBlockSettingsView}}),ke.TextBlockSettingsView=Ce.BlockSettingsView.extend({getTemplate:function(){return window.templates.textBlockSettings}}),ke.TextWidgetView=Ce.WidgetView.extend({getTemplate:function(){return window.templates.textInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new ke.TextBlockModel}}}}),C.on("before:start",function(e){e.registerBlockType("text",{blockModel:ke.TextBlockModel,blockView:ke.TextBlockView}),e.registerWidget({name:"text",widgetView:ke.TextWidgetView,priority:90})});var Se={},Ve=ce;Se.SpacerBlockModel=Ve.BlockModel.extend({defaults:function(){return this._getDefaults({type:"spacer",styles:{block:{backgroundColor:"transparent",height:"40px"}}},C.getConfig().get("blockDefaults.spacer"))}}),Se.SpacerBlockView=Ve.BlockView.extend({className:"mailpoet_block mailpoet_spacer_block mailpoet_droppable_block",getTemplate:function(){return window.templates.spacerBlock},behaviors:B.a.defaults({ResizableBehavior:{elementSelector:".mailpoet_spacer",resizeHandleSelector:".mailpoet_resize_handle",minLength:20,modelField:"styles.block.height"},ShowSettingsBehavior:{ignoreFrom:".mailpoet_resize_handle"}},Ve.BlockView.prototype.behaviors),modelEvents:B.a.omit(Ve.BlockView.prototype.modelEvents,"change"),onDragSubstituteBy:function(){return Se.SpacerWidgetView},initialize:function(){Ve.BlockView.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change:styles.block.backgroundColor",this.render),this.listenTo(this.model,"change:styles.block.height",this.changeHeight)},onRender:function(){this.toolsView=new Se.SpacerBlockToolsView({model:this.model}),this.showChildView("toolsRegion",this.toolsView)},changeHeight:function(){this.$(".mailpoet_spacer").css("height",this.model.get("styles.block.height")),this.$(".mailpoet_resize_handle_text").text(this.model.get("styles.block.height"))},onBeforeDestroy:function(){this.stopListening(this.model)}}),Se.SpacerBlockToolsView=Ve.BlockToolsView.extend({getSettingsView:function(){return Se.SpacerBlockSettingsView}}),Se.SpacerBlockSettingsView=Ve.BlockSettingsView.extend({getTemplate:function(){return window.templates.spacerBlockSettings},events:function(){return{"change .mailpoet_field_spacer_background_color":B.a.partial(this.changeColorField,"styles.block.backgroundColor"),"click .mailpoet_done_editing":"close"}}}),Se.SpacerWidgetView=Ve.WidgetView.extend({getTemplate:function(){return window.templates.spacerInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new Se.SpacerBlockModel}}}}),C.on("before:start",function(e){e.registerBlockType("spacer",{blockModel:Se.SpacerBlockModel,blockView:Se.SpacerBlockView}),e.registerWidget({name:"spacer",widgetView:Se.SpacerWidgetView,priority:94})});var Te={},Be=ce;Te.FooterBlockModel=Be.BlockModel.extend({defaults:function(){return this._getDefaults({type:"footer",text:'<a href="[link:subscription_unsubscribe_url]">Unsubscribe</a> | <a href="[link:subscription_manage_url]">Manage subscription</a><br /><b>Add your postal address here!</b>',styles:{block:{backgroundColor:"transparent"},text:{fontColor:"#000000",fontFamily:"Arial",fontSize:"12px",textAlign:"center"},link:{fontColor:"#0000ff",textDecoration:"none"}}},C.getConfig().get("blockDefaults.footer"))},_updateDefaults:function(){C.getConfig().set("blockDefaults.footer",B.a.omit(this.toJSON(),"text"))}}),Te.FooterBlockView=Be.BlockView.extend({className:"mailpoet_block mailpoet_footer_block mailpoet_droppable_block",getTemplate:function(){return window.templates.footerBlock},modelEvents:B.a.extend({"change:styles.block.backgroundColor change:styles.text.fontColor change:styles.text.fontFamily change:styles.text.fontSize change:styles.text.textAlign change:styles.link.fontColor change:styles.link.textDecoration":"render"},B.a.omit(Be.BlockView.prototype.modelEvents,"change")),behaviors:B.a.extend({},Be.BlockView.prototype.behaviors,{TextEditorBehavior:{configurationFilter:function(e){return B.a.extend({},e,{mailpoet_shortcodes:C.getConfig().get("shortcodes").toJSON(),mailpoet_shortcodes_window_title:c.a.I18n.t("shortcodesWindowTitle")})}}}),onDragSubstituteBy:function(){return Te.FooterWidgetView},onRender:function(){this.toolsView=new Te.FooterBlockToolsView({model:this.model}),this.showChildView("toolsRegion",this.toolsView)},onTextEditorChange:function(e){this.model.set("text",e)},onTextEditorFocus:function(){this.disableDragging(),this.disableShowingTools()},onTextEditorBlur:function(){this.enableDragging(),this.enableShowingTools()}}),Te.FooterBlockToolsView=Be.BlockToolsView.extend({getSettingsView:function(){return Te.FooterBlockSettingsView}}),Te.FooterBlockSettingsView=Be.BlockSettingsView.extend({getTemplate:function(){return window.templates.footerBlockSettings},events:function(){return{"change .mailpoet_field_footer_text_color":B.a.partial(this.changeColorField,"styles.text.fontColor"),"change .mailpoet_field_footer_text_font_family":B.a.partial(this.changeField,"styles.text.fontFamily"),"change .mailpoet_field_footer_text_size":B.a.partial(this.changeField,"styles.text.fontSize"),"change #mailpoet_field_footer_link_color":B.a.partial(this.changeColorField,"styles.link.fontColor"),"change #mailpoet_field_footer_link_underline":function(e){this.model.set("styles.link.textDecoration",e.target.checked?e.target.value:"none")},"change .mailpoet_field_footer_background_color":B.a.partial(this.changeColorField,"styles.block.backgroundColor"),"change .mailpoet_field_footer_alignment":B.a.partial(this.changeField,"styles.text.textAlign"),"click .mailpoet_done_editing":"close"}},templateContext:function(){return B.a.extend({},Be.BlockView.prototype.templateContext.apply(this,arguments),{availableStyles:C.getAvailableStyles().toJSON()})}}),Te.FooterWidgetView=Be.WidgetView.extend({getTemplate:function(){return window.templates.footerInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new Te.FooterBlockModel}}}}),C.on("before:start",function(e){e.registerBlockType("footer",{blockModel:Te.FooterBlockModel,blockView:Te.FooterBlockView}),e.registerWidget({name:"footer",widgetView:Te.FooterWidgetView,priority:100})});var Ee={},Pe=ce;Ee.HeaderBlockModel=Pe.BlockModel.extend({defaults:function(){return this._getDefaults({type:"header",text:'Display problems? <a href="[link:newsletter_view_in_browser_url]">View it in your browser</a>',styles:{block:{backgroundColor:"transparent"},text:{fontColor:"#000000",fontFamily:"Arial",fontSize:"12px",textAlign:"center"},link:{fontColor:"#0000ff",textDecoration:"underline"}}},C.getConfig().get("blockDefaults.header"))},_updateDefaults:function(){C.getConfig().set("blockDefaults.header",B.a.omit(this.toJSON(),"text"))}}),Ee.HeaderBlockView=Pe.BlockView.extend({className:"mailpoet_block mailpoet_header_block mailpoet_droppable_block",getTemplate:function(){return window.templates.headerBlock},modelEvents:B.a.extend({"change:styles.block.backgroundColor change:styles.text.fontColor change:styles.text.fontFamily change:styles.text.fontSize change:styles.text.textAlign change:styles.link.fontColor change:styles.link.textDecoration":"render"},B.a.omit(Pe.BlockView.prototype.modelEvents,"change")),behaviors:B.a.extend({},Pe.BlockView.prototype.behaviors,{TextEditorBehavior:{configurationFilter:function(e){return B.a.extend({},e,{mailpoet_shortcodes:C.getConfig().get("shortcodes").toJSON(),mailpoet_shortcodes_window_title:c.a.I18n.t("shortcodesWindowTitle")})}}}),onDragSubstituteBy:function(){return Ee.HeaderWidgetView},onRender:function(){this.toolsView=new Ee.HeaderBlockToolsView({model:this.model}),this.showChildView("toolsRegion",this.toolsView)},onTextEditorChange:function(e){this.model.set("text",e)},onTextEditorFocus:function(){this.disableDragging(),this.disableShowingTools()},onTextEditorBlur:function(){this.enableDragging(),this.enableShowingTools()}}),Ee.HeaderBlockToolsView=Pe.BlockToolsView.extend({getSettingsView:function(){return Ee.HeaderBlockSettingsView}}),Ee.HeaderBlockSettingsView=Pe.BlockSettingsView.extend({getTemplate:function(){return window.templates.headerBlockSettings},events:function(){return{"change .mailpoet_field_header_text_color":B.a.partial(this.changeColorField,"styles.text.fontColor"),"change .mailpoet_field_header_text_font_family":B.a.partial(this.changeField,"styles.text.fontFamily"),"change .mailpoet_field_header_text_size":B.a.partial(this.changeField,"styles.text.fontSize"),"change #mailpoet_field_header_link_color":B.a.partial(this.changeColorField,"styles.link.fontColor"),"change #mailpoet_field_header_link_underline":function(e){this.model.set("styles.link.textDecoration",e.target.checked?e.target.value:"none")},"change .mailpoet_field_header_background_color":B.a.partial(this.changeColorField,"styles.block.backgroundColor"),"change .mailpoet_field_header_alignment":B.a.partial(this.changeField,"styles.text.textAlign"),"click .mailpoet_done_editing":"close"}},templateContext:function(){return B.a.extend({},Pe.BlockView.prototype.templateContext.apply(this,arguments),{availableStyles:C.getAvailableStyles().toJSON()})}}),Ee.HeaderWidgetView=Pe.WidgetView.extend({getTemplate:function(){return window.templates.headerInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new Ee.HeaderBlockModel}}}}),C.on("before:start",function(e){e.registerBlockType("header",{blockModel:Ee.HeaderBlockModel,blockView:Ee.HeaderBlockView}),e.registerWidget({name:"header",widgetView:Ee.HeaderWidgetView,priority:99})});var Me={},Ae=ce;Me.ALCSupervisor=V.a.extend({initialize:function(){this.listenTo(C.getChannel(),"automatedLatestContentRefresh",B.a.debounce(this.refresh,500))},refresh:function(){var e,t=C.findModels(function(e){return"automatedLatestContent"===e.get("type")})||[];0!==t.length&&(e=B.a.map(t,function(e){return e.toJSON()}),z.getBulkTransformedPosts({blocks:e}).then(B.a.partial(this.refreshBlocks,t)))},refreshBlocks:function(e,t){B.a.each(B.a.zip(e,t),function(e){var t=e[0],i=e[1];t.trigger("refreshPosts",i)})}}),Me.AutomatedLatestContentBlockModel=Ae.BlockModel.extend({stale:["_container"],defaults:function(){return this._getDefaults({type:"automatedLatestContent",withLayout:!1,amount:"5",contentType:"post",terms:[],inclusionType:"include",displayType:"excerpt",titleFormat:"h1",titleAlignment:"left",titleIsLink:!1,imageFullWidth:!1,featuredImagePosition:"belowTitle",showAuthor:"no",authorPrecededBy:"Author:",showCategories:"no",categoriesPrecededBy:"Categories:",readMoreType:"button",readMoreText:"Read more",readMoreButton:{text:"Read more",url:"[postLink]"},sortBy:"newest",showDivider:!0,divider:{},_container:new(C.getBlockTypeModel("container"))},C.getConfig().get("blockDefaults.automatedLatestContent"))},relations:function(){return{readMoreButton:C.getBlockTypeModel("button"),divider:C.getBlockTypeModel("divider"),_container:C.getBlockTypeModel("container")}},initialize:function(){Ae.BlockView.prototype.initialize.apply(this,arguments),this.on("change:amount change:contentType change:terms change:inclusionType change:displayType change:titleFormat change:featuredImagePosition change:titleAlignment change:titleIsLink change:imageFullWidth change:showAuthor change:authorPrecededBy change:showCategories change:categoriesPrecededBy change:readMoreType change:readMoreText change:sortBy change:showDivider",this._handleChanges,this),this.listenTo(this.get("readMoreButton"),"change",this._handleChanges),this.listenTo(this.get("divider"),"change",this._handleChanges),this.on("add remove update reset",this._handleChanges),this.on("refreshPosts",this.updatePosts,this)},updatePosts:function(e){this.get("_container.blocks").reset(e,{parse:!0})},_handleChanges:function(){this._updateDefaults(),C.getChannel().trigger("automatedLatestContentRefresh")}}),Me.AutomatedLatestContentBlockView=Ae.BlockView.extend({className:"mailpoet_block mailpoet_automated_latest_content_block mailpoet_droppable_block",initialize:function(){C.getChannel().on("replaceAllButtonStyles",function(e){this.model.set({readMoreButton:e})}.bind(this))},getTemplate:function(){return window.templates.automatedLatestContentBlock},regions:{toolsRegion:".mailpoet_tools",postsRegion:".mailpoet_automated_latest_content_block_posts"},modelEvents:B.a.extend(B.a.omit(Ae.BlockView.prototype.modelEvents,"change"),{postsChanged:"render"}),events:{"click .mailpoet_automated_latest_content_block_overlay":"showSettings"},onDragSubstituteBy:function(){return Me.AutomatedLatestContentWidgetView},onRender:function(){var e=C.getBlockTypeView("container"),t={disableTextEditor:!0,disableDragAndDrop:!0,emptyContainerMessage:c.a.I18n.t("noPostsToDisplay")};this.toolsView=new Me.AutomatedLatestContentBlockToolsView({model:this.model}),this.showChildView("toolsRegion",this.toolsView),this.showChildView("postsRegion",new e({model:this.model.get("_container"),renderOptions:t}))}}),Me.AutomatedLatestContentBlockToolsView=Ae.BlockToolsView.extend({getSettingsView:function(){return Me.AutomatedLatestContentBlockSettingsView}}),Me.AutomatedLatestContentBlockSettingsView=Ae.BlockSettingsView.extend({getTemplate:function(){return window.templates.automatedLatestContentBlockSettings},events:function(){return{"click .mailpoet_automated_latest_content_hide_display_options":"toggleDisplayOptions","click .mailpoet_automated_latest_content_show_display_options":"toggleDisplayOptions","click .mailpoet_automated_latest_content_select_button":"showButtonSettings","click .mailpoet_automated_latest_content_select_divider":"showDividerSettings","change .mailpoet_automated_latest_content_read_more_type":"changeReadMoreType","change .mailpoet_automated_latest_content_display_type":"changeDisplayType","change .mailpoet_automated_latest_content_title_format":"changeTitleFormat","change .mailpoet_automated_latest_content_title_as_links":B.a.partial(this.changeBoolField,"titleIsLink"),"change .mailpoet_automated_latest_content_show_divider":B.a.partial(this.changeBoolField,"showDivider"),"input .mailpoet_automated_latest_content_show_amount":B.a.partial(this.changeField,"amount"),"change .mailpoet_automated_latest_content_content_type":B.a.partial(this.changeField,"contentType"),"change .mailpoet_automated_latest_content_include_or_exclude":B.a.partial(this.changeField,"inclusionType"),"change .mailpoet_automated_latest_content_title_alignment":B.a.partial(this.changeField,"titleAlignment"),"change .mailpoet_automated_latest_content_image_full_width":B.a.partial(this.changeBoolField,"imageFullWidth"),"change .mailpoet_automated_latest_content_featured_image_position":B.a.partial(this.changeField,"featuredImagePosition"),"change .mailpoet_automated_latest_content_show_author":B.a.partial(this.changeField,"showAuthor"),"input .mailpoet_automated_latest_content_author_preceded_by":B.a.partial(this.changeField,"authorPrecededBy"),"change .mailpoet_automated_latest_content_show_categories":B.a.partial(this.changeField,"showCategories"),"input .mailpoet_automated_latest_content_categories":B.a.partial(this.changeField,"categoriesPrecededBy"),"input .mailpoet_automated_latest_content_read_more_text":B.a.partial(this.changeField,"readMoreText"),"change .mailpoet_automated_latest_content_sort_by":B.a.partial(this.changeField,"sortBy"),"click .mailpoet_done_editing":"close"}},onRender:function(){var e=this;z.getPostTypes().done(B.a.bind(this._updateContentTypes,this)),this.$(".mailpoet_automated_latest_content_categories_and_tags").select2({multiple:!0,allowClear:!0,placeholder:c.a.I18n.t("categoriesAndTags"),ajax:{data:function(e){return{term:e.term,page:e.page||1}},transport:function(t,i,o){var n,s=z.getTaxonomies(e.model.get("contentType")).then(function(e){return n=e,z.getTerms({search:t.data.term,page:t.data.page,taxonomies:B.a.keys(n)}).then(function(e){return{taxonomies:n,terms:e}})});return s.then(i),s.fail(o),s},processResults:function(e){return{results:B.a.map(e.terms,function(t){return B.a.defaults({text:e.taxonomies[t.taxonomy].labels.singular_name+": "+t.name,id:t.term_id},t)}),pagination:{more:100===e.terms.length}}}}}).on({"select2:select":function(t){var i=e.model.get("terms");i.add(t.params.data),e.model.set("terms",i.toJSON())},"select2:unselect":function(t){var i=e.model.get("terms");i.remove(t.params.data),e.model.set("terms",i.toJSON())}}).trigger("change")},toggleDisplayOptions:function(){var e=this.$(".mailpoet_automated_latest_content_display_options"),t=this.$(".mailpoet_automated_latest_content_show_display_options");e.hasClass("mailpoet_closed")?(e.removeClass("mailpoet_closed"),t.addClass("mailpoet_hidden")):(e.addClass("mailpoet_closed"),t.removeClass("mailpoet_hidden"))},showButtonSettings:function(){new fe.ButtonBlockSettingsView({model:this.model.get("readMoreButton"),renderOptions:{displayFormat:"subpanel",hideLink:!0,hideApplyToAll:!0}}).render()},showDividerSettings:function(){new xe.DividerBlockSettingsView({model:this.model.get("divider"),renderOptions:{displayFormat:"subpanel",hideApplyToAll:!0}}).render()},changeReadMoreType:function(e){var t=M()(e.target).val();"link"===t?(this.$(".mailpoet_automated_latest_content_read_more_text").removeClass("mailpoet_hidden"),this.$(".mailpoet_automated_latest_content_select_button").addClass("mailpoet_hidden")):"button"===t&&(this.$(".mailpoet_automated_latest_content_read_more_text").addClass("mailpoet_hidden"),this.$(".mailpoet_automated_latest_content_select_button").removeClass("mailpoet_hidden")),this.changeField("readMoreType",e)},changeDisplayType:function(e){var t=M()(e.target).val();"titleOnly"===t?(this.$(".mailpoet_automated_latest_content_title_as_list").removeClass("mailpoet_hidden"),this.$(".mailpoet_automated_latest_content_image_full_width_option").addClass("mailpoet_hidden"),this.$(".mailpoet_automated_latest_content_image_separator").addClass("mailpoet_hidden")):(this.$(".mailpoet_automated_latest_content_title_as_list").addClass("mailpoet_hidden"),this.$(".mailpoet_automated_latest_content_image_full_width_option").removeClass("mailpoet_hidden"),this.$(".mailpoet_automated_latest_content_image_separator").removeClass("mailpoet_hidden"),"ul"===this.model.get("titleFormat")&&(this.model.set("titleFormat","h1"),this.$(".mailpoet_automated_latest_content_title_format").val(["h1"]),this.$(".mailpoet_automated_latest_content_title_as_link").removeClass("mailpoet_hidden"))),"excerpt"===t?this.$(".mailpoet_automated_latest_content_featured_image_position_container").removeClass("mailpoet_hidden"):this.$(".mailpoet_automated_latest_content_featured_image_position_container").addClass("mailpoet_hidden"),this.changeField("displayType",e)},changeTitleFormat:function(e){"ul"===M()(e.target).val()?(this.$(".mailpoet_automated_latest_content_non_title_list_options").addClass("mailpoet_hidden"),this.model.set("titleIsLink",!0),this.$(".mailpoet_automated_latest_content_title_as_link").addClass("mailpoet_hidden"),this.$(".mailpoet_automated_latest_content_title_as_links").val(["true"])):(this.$(".mailpoet_automated_latest_content_non_title_list_options").removeClass("mailpoet_hidden"),this.$(".mailpoet_automated_latest_content_title_as_link").removeClass("mailpoet_hidden")),this.changeField("titleFormat",e)},_updateContentTypes:function(e){var t=this.$(".mailpoet_automated_latest_content_content_type"),i=this.model.get("contentType");t.find("option").remove(),B.a.each(e,function(e){t.append(M()("<option>",{value:e.name,text:e.label}))}),t.val(i)}}),Me.AutomatedLatestContentWidgetView=Ae.WidgetView.extend({getTemplate:function(){return window.templates.automatedLatestContentInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new Me.AutomatedLatestContentBlockModel({},{parse:!0})},onDrop:function(e){e.droppedView.triggerMethod("showSettings")}}}}),C.on("before:start",function(e){e.registerBlockType("automatedLatestContent",{blockModel:Me.AutomatedLatestContentBlockModel,blockView:Me.AutomatedLatestContentBlockView})}),C.on("start",function(e){var t=e;t._ALCSupervisor=new Me.ALCSupervisor,t._ALCSupervisor.refresh()});var De={},Re=ce;De.ALCLayoutSupervisor=V.a.extend({initialize:function(){this.listenTo(C.getChannel(),"automatedLatestContentLayoutRefresh",B.a.debounce(this.refresh,500))},refresh:function(){var e,t=C.findModels(function(e){return"automatedLatestContentLayout"===e.get("type")})||[];0!==t.length&&(e=B.a.map(t,function(e){return e.toJSON()}),z.getBulkTransformedPosts({blocks:e}).then(B.a.partial(this.refreshBlocks,t)))},refreshBlocks:function(e,t){B.a.each(B.a.zip(e,t),function(e){var t=e[0],i=e[1];t.trigger("refreshPosts",i)})}}),De.AutomatedLatestContentLayoutBlockModel=Re.BlockModel.extend({stale:["_container"],defaults:function(){return this._getDefaults({type:"automatedLatestContentLayout",withLayout:!0,amount:"5",contentType:"post",terms:[],inclusionType:"include",displayType:"excerpt",titleFormat:"h1",titleAlignment:"left",titleIsLink:!1,imageFullWidth:!1,titlePosition:"abovePost",featuredImagePosition:"centered",showAuthor:"no",authorPrecededBy:"Author:",showCategories:"no",categoriesPrecededBy:"Categories:",readMoreType:"button",readMoreText:"Read more",readMoreButton:{text:"Read more",url:"[postLink]"},sortBy:"newest",showDivider:!0,divider:{},_container:new(C.getBlockTypeModel("container"))},C.getConfig().get("blockDefaults.automatedLatestContentLayout"))},relations:function(){return{readMoreButton:C.getBlockTypeModel("button"),divider:C.getBlockTypeModel("divider"),_container:C.getBlockTypeModel("container")}},initialize:function(){Re.BlockView.prototype.initialize.apply(this,arguments),this.on("change:amount change:contentType change:terms change:inclusionType change:displayType change:titleFormat change:featuredImagePosition change:titleAlignment change:titleIsLink change:imageFullWidth change:showAuthor change:authorPrecededBy change:showCategories change:categoriesPrecededBy change:readMoreType change:readMoreText change:sortBy change:showDivider change:titlePosition",this._handleChanges,this),this.listenTo(this.get("readMoreButton"),"change",this._handleChanges),this.listenTo(this.get("divider"),"change",this._handleChanges),this.on("add remove update reset",this._handleChanges),this.on("refreshPosts",this.updatePosts,this)},updatePosts:function(e){this.get("_container.blocks").reset(e,{parse:!0})},_handleChanges:function(){this._updateDefaults(),C.getChannel().trigger("automatedLatestContentLayoutRefresh")}}),De.AutomatedLatestContentLayoutBlockView=Re.BlockView.extend({className:"mailpoet_block mailpoet_automated_latest_content_block mailpoet_droppable_block",initialize:function(){C.getChannel().on("replaceAllButtonStyles",function(e){this.model.set({readMoreButton:e})}.bind(this))},getTemplate:function(){return window.templates.automatedLatestContentLayoutBlock},regions:{toolsRegion:".mailpoet_tools",postsRegion:".mailpoet_automated_latest_content_block_posts"},modelEvents:B.a.extend(B.a.omit(Re.BlockView.prototype.modelEvents,"change"),{postsChanged:"render"}),events:{"click .mailpoet_automated_latest_content_block_overlay":"showSettings"},onDragSubstituteBy:function(){return De.AutomatedLatestContentLayoutWidgetView},onRender:function(){var e=C.getBlockTypeView("container"),t={disableTextEditor:!0,disableDragAndDrop:!0,emptyContainerMessage:c.a.I18n.t("noPostsToDisplay")};this.toolsView=new De.AutomatedLatestContentLayoutBlockToolsView({model:this.model}),this.showChildView("toolsRegion",this.toolsView),this.showChildView("postsRegion",new e({model:this.model.get("_container"),renderOptions:t}))},duplicateBlock:function(){var e=this.model.toJSON(),t=new De.AutomatedLatestContentLayoutBlockModel(e);this.model.collection.add(t,{at:this.model.collection.findIndex(this.model)})}}),De.AutomatedLatestContentLayoutBlockToolsView=Re.BlockToolsView.extend({getSettingsView:function(){return De.AutomatedLatestContentLayoutBlockSettingsView}}),De.AutomatedLatestContentLayoutBlockSettingsView=Re.BlockSettingsView.extend({getTemplate:function(){return window.templates.automatedLatestContentLayoutBlockSettings},events:function(){return{"click .mailpoet_automated_latest_content_hide_display_options":"toggleDisplayOptions","click .mailpoet_automated_latest_content_show_display_options":"toggleDisplayOptions","click .mailpoet_automated_latest_content_select_button":"showButtonSettings","click .mailpoet_automated_latest_content_select_divider":"showDividerSettings","change .mailpoet_automated_latest_content_read_more_type":"changeReadMoreType","change .mailpoet_automated_latest_content_display_type":"changeDisplayType","change .mailpoet_automated_latest_content_title_format":"changeTitleFormat","change .mailpoet_automated_latest_content_title_as_links":B.a.partial(this.changeBoolField,"titleIsLink"),"change .mailpoet_automated_latest_content_show_divider":B.a.partial(this.changeBoolField,"showDivider"),"input .mailpoet_automated_latest_content_show_amount":B.a.partial(this.changeField,"amount"),"change .mailpoet_automated_latest_content_content_type":B.a.partial(this.changeField,"contentType"),"change .mailpoet_automated_latest_content_include_or_exclude":B.a.partial(this.changeField,"inclusionType"),"change .mailpoet_automated_latest_content_title_alignment":B.a.partial(this.changeField,"titleAlignment"),"change .mailpoet_automated_latest_content_image_full_width":B.a.partial(this.changeBoolField,"imageFullWidth"),"change .mailpoet_automated_latest_content_featured_image_position":B.a.partial(this.changeField,"featuredImagePosition"),"change .mailpoet_automated_latest_content_show_author":B.a.partial(this.changeField,"showAuthor"),"input .mailpoet_automated_latest_content_author_preceded_by":B.a.partial(this.changeField,"authorPrecededBy"),"change .mailpoet_automated_latest_content_show_categories":B.a.partial(this.changeField,"showCategories"),"input .mailpoet_automated_latest_content_categories":B.a.partial(this.changeField,"categoriesPrecededBy"),"input .mailpoet_automated_latest_content_read_more_text":B.a.partial(this.changeField,"readMoreText"),"change .mailpoet_automated_latest_content_sort_by":B.a.partial(this.changeField,"sortBy"),"change .mailpoet_automated_latest_content_title_position":B.a.partial(this.changeField,"titlePosition"),"click .mailpoet_done_editing":"close"}},onRender:function(){var e=this;z.getPostTypes().done(B.a.bind(this._updateContentTypes,this)),this.$(".mailpoet_automated_latest_content_categories_and_tags").select2({multiple:!0,allowClear:!0,placeholder:c.a.I18n.t("categoriesAndTags"),ajax:{data:function(e){return{term:e.term,page:e.page||1}},transport:function(t,i,o){var n,s=z.getTaxonomies(e.model.get("contentType")).then(function(e){return n=e,z.getTerms({search:t.data.term,page:t.data.page,taxonomies:B.a.keys(n)}).then(function(e){return{taxonomies:n,terms:e}})});return s.then(i),s.fail(o),s},processResults:function(e){return{results:B.a.map(e.terms,function(t){return B.a.defaults({text:e.taxonomies[t.taxonomy].labels.singular_name+": "+t.name,id:t.term_id},t)}),pagination:{more:100===e.terms.length}}}}}).on({"select2:select":function(t){var i=e.model.get("terms");i.add(t.params.data),e.model.set("terms",i.toJSON())},"select2:unselect":function(t){var i=e.model.get("terms");i.remove(t.params.data),e.model.set("terms",i.toJSON())}}).trigger("change")},toggleDisplayOptions:function(){var e=this.$(".mailpoet_automated_latest_content_display_options"),t=this.$(".mailpoet_automated_latest_content_show_display_options");e.hasClass("mailpoet_closed")?(e.removeClass("mailpoet_closed"),t.addClass("mailpoet_hidden")):(e.addClass("mailpoet_closed"),t.removeClass("mailpoet_hidden"))},showButtonSettings:function(){new fe.ButtonBlockSettingsView({model:this.model.get("readMoreButton"),renderOptions:{displayFormat:"subpanel",hideLink:!0,hideApplyToAll:!0}}).render()},showDividerSettings:function(){new xe.DividerBlockSettingsView({model:this.model.get("divider"),renderOptions:{displayFormat:"subpanel",hideApplyToAll:!0}}).render()},changeReadMoreType:function(e){var t=M()(e.target).val();"link"===t?(this.$(".mailpoet_automated_latest_content_read_more_text").removeClass("mailpoet_hidden"),this.$(".mailpoet_automated_latest_content_select_button").addClass("mailpoet_hidden")):"button"===t&&(this.$(".mailpoet_automated_latest_content_read_more_text").addClass("mailpoet_hidden"),this.$(".mailpoet_automated_latest_content_select_button").removeClass("mailpoet_hidden")),this.changeField("readMoreType",e)},changeDisplayType:function(e){var t=M()(e.target).val();"titleOnly"===t?(this.$(".mailpoet_automated_latest_content_title_as_list").removeClass("mailpoet_hidden"),this.$(".mailpoet_automated_latest_content_image_full_width_option").addClass("mailpoet_hidden"),this.$(".mailpoet_automated_latest_content_image_separator").addClass("mailpoet_hidden")):(this.$(".mailpoet_automated_latest_content_title_as_list").addClass("mailpoet_hidden"),this.$(".mailpoet_automated_latest_content_image_full_width_option").removeClass("mailpoet_hidden"),this.$(".mailpoet_automated_latest_content_image_separator").removeClass("mailpoet_hidden"),"ul"===this.model.get("titleFormat")&&(this.model.set("titleFormat","h1"),this.$(".mailpoet_automated_latest_content_title_format").val(["h1"]),this.$(".mailpoet_automated_latest_content_title_as_link").removeClass("mailpoet_hidden"))),"excerpt"===t?(this.$(".mailpoet_automated_latest_content_featured_image_position_container").removeClass("mailpoet_hidden"),this.$(".mailpoet_automated_latest_content_title_position_separator").removeClass("mailpoet_hidden"),this.$(".mailpoet_automated_latest_content_title_position").removeClass("mailpoet_hidden")):(this.$(".mailpoet_automated_latest_content_featured_image_position_container").addClass("mailpoet_hidden"),this.$(".mailpoet_automated_latest_content_title_position_separator").addClass("mailpoet_hidden"),this.$(".mailpoet_automated_latest_content_title_position").addClass("mailpoet_hidden")),this.changeField("displayType",e)},changeTitleFormat:function(e){"ul"===M()(e.target).val()?(this.$(".mailpoet_automated_latest_content_non_title_list_options").addClass("mailpoet_hidden"),this.model.set("titleIsLink",!0),this.$(".mailpoet_automated_latest_content_title_as_link").addClass("mailpoet_hidden"),this.$(".mailpoet_automated_latest_content_title_as_links").val(["true"])):(this.$(".mailpoet_automated_latest_content_non_title_list_options").removeClass("mailpoet_hidden"),this.$(".mailpoet_automated_latest_content_title_as_link").removeClass("mailpoet_hidden")),this.changeField("titleFormat",e)},_updateContentTypes:function(e){var t=this.$(".mailpoet_automated_latest_content_content_type"),i=this.model.get("contentType");t.find("option").remove(),B.a.each(e,function(e){t.append(M()("<option>",{value:e.name,text:e.label}))}),t.val(i)}}),De.AutomatedLatestContentLayoutWidgetView=Re.WidgetView.extend({className:Re.WidgetView.prototype.className+" mailpoet_droppable_layout_block",getTemplate:function(){return window.templates.automatedLatestContentLayoutInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new De.AutomatedLatestContentLayoutBlockModel({},{parse:!0})},onDrop:function(e){e.droppedView.triggerMethod("showSettings")}}}}),C.on("before:start",function(e){e.registerBlockType("automatedLatestContentLayout",{blockModel:De.AutomatedLatestContentLayoutBlockModel,blockView:De.AutomatedLatestContentLayoutBlockView}),e.registerWidget({name:"automatedLatestContentLayout",widgetView:De.AutomatedLatestContentLayoutWidgetView,priority:97})}),C.on("start",function(e){var t=e;t._ALCLayoutSupervisor=new De.ALCLayoutSupervisor,t._ALCLayoutSupervisor.refresh()});i(366);var Fe,Oe,ze,Ie,Ne,$e={},Le=ce;$e.PostsBlockModel=Le.BlockModel.extend({stale:["_selectedPosts","_availablePosts","_transformedPosts"],defaults:function(){return this._getDefaults({type:"posts",withLayout:!0,amount:"10",offset:0,contentType:"post",postStatus:"publish",terms:[],search:"",inclusionType:"include",displayType:"excerpt",titleFormat:"h1",titleAlignment:"left",titleIsLink:!1,imageFullWidth:!1,titlePosition:"abovePost",featuredImagePosition:"centered",showAuthor:"no",authorPrecededBy:"Author:",showCategories:"no",categoriesPrecededBy:"Categories:",readMoreType:"link",readMoreText:"Read more",readMoreButton:{text:"Read more",url:"[postLink]"},sortBy:"newest",showDivider:!0,divider:{},_selectedPosts:[],_availablePosts:[],_transformedPosts:new(C.getBlockTypeModel("container"))},C.getConfig().get("blockDefaults.posts"))},relations:function(){return{readMoreButton:C.getBlockTypeModel("button"),divider:C.getBlockTypeModel("divider"),_selectedPosts:N.a.Collection,_availablePosts:N.a.Collection,_transformedPosts:C.getBlockTypeModel("container")}},initialize:function(){var e=B.a.debounce(this.fetchAvailablePosts.bind(this),500),t=B.a.debounce(this._refreshTransformedPosts.bind(this),500);B.a.extend(this,y.a.Requests),this.fetchAvailablePosts(),this.on("change",this._updateDefaults,this),this.on("change:amount change:contentType change:terms change:inclusionType change:postStatus change:search change:sortBy",e),this.on("loadMorePosts",this._loadMorePosts,this),this.listenTo(this.get("_selectedPosts"),"add remove reset",t),this.on("change:displayType change:titleFormat change:featuredImagePosition change:titleAlignment change:titleIsLink change:imageFullWidth change:showAuthor change:authorPrecededBy change:showCategories change:categoriesPrecededBy change:readMoreType change:readMoreText change:showDivider change:titlePosition",t),this.listenTo(this.get("readMoreButton"),"change",t),this.listenTo(this.get("divider"),"change",t),this.on("insertSelectedPosts",this._insertSelectedPosts,this)},fetchAvailablePosts:function(){var e=this;this.set("offset",0),z.getPosts(this.toJSON()).done(function(t){e.get("_availablePosts").reset(t),e.get("_selectedPosts").reset(),e.trigger("change:_availablePosts")}).fail(function(){c.a.Notice.error(c.a.I18n.t("failedToFetchAvailablePosts"))})},_loadMorePosts:function(){var e=this,t=this.get("_availablePosts").length,i=this.get("offset")+Number(this.get("amount"));return!(0===t||t<i)&&(this.set("offset",i),this.trigger("loadingMorePosts"),z.getPosts(this.toJSON()).done(function(t){e.get("_availablePosts").add(t),e.trigger("change:_availablePosts")}).fail(function(){c.a.Notice.error(c.a.I18n.t("failedToFetchAvailablePosts"))}).always(function(){e.trigger("morePostsLoaded")}),!0)},_refreshTransformedPosts:function(){var e=this,t=this.toJSON();t.posts=this.get("_selectedPosts").pluck("ID"),0!==t.posts.length?z.getTransformedPosts(t).done(function(t){e.get("_transformedPosts").get("blocks").reset(t,{parse:!0})}).fail(function(){c.a.Notice.error(c.a.I18n.t("failedToFetchRenderedPosts"))}):this.get("_transformedPosts").get("blocks").reset()},_insertSelectedPosts:function(){var e=this.toJSON(),t=this.collection.indexOf(this),i=this.collection;e.posts=this.get("_selectedPosts").pluck("ID"),0!==e.posts.length&&z.getTransformedPosts(e).done(function(e){i.add(JSON.parse(R()(e)),{at:t})}).fail(function(){c.a.Notice.error(c.a.I18n.t("failedToFetchRenderedPosts"))})}}),$e.PostsBlockView=Le.BlockView.extend({className:"mailpoet_block mailpoet_posts_block mailpoet_droppable_block",getTemplate:function(){return window.templates.postsBlock},modelEvents:{},regions:B.a.extend({postsRegion:".mailpoet_posts_container"},Le.BlockView.prototype.regions),onDragSubstituteBy:function(){return $e.PostsWidgetView},initialize:function(){Le.BlockView.prototype.initialize.apply(this,arguments),this.toolsView=new $e.PostsBlockToolsView({model:this.model}),this.model.reply("blockView",this.notifyAboutSelf,this)},onRender:function(){var e,t;this.getRegion("toolsRegion").hasView()||this.showChildView("toolsRegion",this.toolsView),this.trigger("showSettings"),e=C.getBlockTypeView("container"),t={disableTextEditor:!0,disableDragAndDrop:!0,emptyContainerMessage:c.a.I18n.t("noPostsToDisplay")},this.showChildView("postsRegion",new e({model:this.model.get("_transformedPosts"),renderOptions:t}))},notifyAboutSelf:function(){return this},onBeforeDestroy:function(){this.model.stopReplying("blockView",this.notifyAboutSelf,this)}}),$e.PostsBlockToolsView=Le.BlockToolsView.extend({getSettingsView:function(){return $e.PostsBlockSettingsView}}),$e.PostsBlockSettingsView=Le.BlockSettingsView.extend({getTemplate:function(){return window.templates.postsBlockSettings},regions:{selectionRegion:".mailpoet_settings_posts_selection",displayOptionsRegion:".mailpoet_settings_posts_display_options"},events:{"click .mailpoet_settings_posts_show_display_options":"switchToDisplayOptions","click .mailpoet_settings_posts_show_post_selection":"switchToPostSelection","click .mailpoet_settings_posts_insert_selected":"insertPosts"},templateContext:function(){return{model:this.model.toJSON()}},initialize:function(){this.model.trigger("startEditing"),this.selectionView=new Ie({model:this.model}),this.displayOptionsView=new Fe({model:this.model})},onRender:function(){var e=this;this.model.request("blockView"),this.showChildView("selectionRegion",this.selectionView),this.showChildView("displayOptionsRegion",this.displayOptionsView),c.a.Modal.panel({element:this.$el,template:"",position:"right",width:C.getConfig().get("sidepanelWidth"),onCancel:function(){e.model.destroy()}}),this.selectionView.triggerMethod("attach"),this.displayOptionsView.triggerMethod("attach")},switchToDisplayOptions:function(){this.$(".mailpoet_settings_posts_selection").addClass("mailpoet_closed"),this.$(".mailpoet_settings_posts_display_options").removeClass("mailpoet_closed"),this.$(".mailpoet_settings_posts_show_display_options").addClass("mailpoet_hidden"),this.$(".mailpoet_settings_posts_show_post_selection").removeClass("mailpoet_hidden")},switchToPostSelection:function(){this.$(".mailpoet_settings_posts_display_options").addClass("mailpoet_closed"),this.$(".mailpoet_settings_posts_selection").removeClass("mailpoet_closed"),this.$(".mailpoet_settings_posts_show_post_selection").addClass("mailpoet_hidden"),this.$(".mailpoet_settings_posts_show_display_options").removeClass("mailpoet_hidden")},insertPosts:function(){this.model.trigger("insertSelectedPosts"),this.model.destroy(),this.close()}}),Ne=v.a.CollectionView.extend({className:"mailpoet_post_scroll_container",childView:function(){return Oe},emptyView:function(){return ze},childViewOptions:function(){return{blockModel:this.blockModel}},initialize:function(e){this.blockModel=e.blockModel},events:{scroll:"onPostsScroll"},onPostsScroll:function(e){var t=M()(e.target);t.scrollTop()+t.innerHeight()>=t[0].scrollHeight&&this.blockModel.trigger("loadMorePosts")}}),Ie=v.a.View.extend({getTemplate:function(){return window.templates.postSelectionPostsBlockSettings},regions:{posts:".mailpoet_post_selection_container"},events:function(){return{"change .mailpoet_settings_posts_content_type":B.a.partial(this.changeField,"contentType"),"change .mailpoet_posts_post_status":B.a.partial(this.changeField,"postStatus"),"input .mailpoet_posts_search_term":B.a.partial(this.changeField,"search")}},modelEvents:{"change:offset":function(e,t){0===t&&this.$(".mailpoet_post_scroll_container").scrollTop(0)},loadingMorePosts:function(){this.$(".mailpoet_post_selection_loading").css("visibility","visible")},morePostsLoaded:function(){this.$(".mailpoet_post_selection_loading").css("visibility","hidden")}},templateContext:function(){return{model:this.model.toJSON()}},onRender:function(){var e;z.getPostTypes().done(B.a.bind(this._updateContentTypes,this)),e=new Ne({collection:this.model.get("_availablePosts"),blockModel:this.model}),this.showChildView("posts",e)},onAttach:function(){var e=this;this.$(".mailpoet_posts_categories_and_tags").select2({multiple:!0,allowClear:!0,placeholder:c.a.I18n.t("categoriesAndTags"),ajax:{data:function(e){return{term:e.term,page:e.page||1}},transport:function(t,i,o){var n,s=z.getTaxonomies(e.model.get("contentType")).then(function(e){return n=e,z.getTerms({search:t.data.term,page:t.data.page,taxonomies:B.a.keys(n)}).then(function(e){return{taxonomies:n,terms:e}})});return s.then(i),s.fail(o),s},processResults:function(e){return{results:B.a.map(e.terms,function(t){return B.a.defaults({text:e.taxonomies[t.taxonomy].labels.singular_name+": "+t.name,id:t.term_id},t)}),pagination:{more:100===e.terms.length}}}}}).on({"select2:select":function(t){var i=e.model.get("terms");i.add(t.params.data),e.model.set("terms",i.toJSON())},"select2:unselect":function(t){var i=e.model.get("terms");i.remove(t.params.data),e.model.set("terms",i.toJSON())}}).trigger("change")},changeField:function(e,t){this.model.set(e,M()(t.target).val())},_updateContentTypes:function(e){var t=this.$(".mailpoet_settings_posts_content_type"),i=this.model.get("contentType");t.find("option").remove(),B.a.each(e,function(e){t.append(M()("<option>",{value:e.name,text:e.label}))}),t.val(i)}}),ze=v.a.View.extend({getTemplate:function(){return window.templates.emptyPostPostsBlockSettings}}),Oe=v.a.View.extend({getTemplate:function(){return window.templates.singlePostPostsBlockSettings},events:function(){return{"change .mailpoet_select_post_checkbox":"postSelectionChange"}},templateContext:function(){return{model:this.model.toJSON(),index:this._index}},initialize:function(e){this.blockModel=e.blockModel},postSelectionChange:function(e){var t=M()(e.target),i=this.blockModel.get("_selectedPosts");t.prop("checked")?i.add(this.model):i.remove(this.model)}}),Fe=Le.BlockSettingsView.extend({getTemplate:function(){return window.templates.displayOptionsPostsBlockSettings},events:function(){return{"click .mailpoet_posts_select_button":"showButtonSettings","click .mailpoet_posts_select_divider":"showDividerSettings","change .mailpoet_posts_read_more_type":"changeReadMoreType","change .mailpoet_posts_display_type":"changeDisplayType","change .mailpoet_posts_title_format":"changeTitleFormat","change .mailpoet_posts_title_as_links":B.a.partial(this.changeBoolField,"titleIsLink"),"change .mailpoet_posts_show_divider":B.a.partial(this.changeBoolField,"showDivider"),"input .mailpoet_posts_show_amount":B.a.partial(this.changeField,"amount"),"change .mailpoet_posts_content_type":B.a.partial(this.changeField,"contentType"),"change .mailpoet_posts_include_or_exclude":B.a.partial(this.changeField,"inclusionType"),"change .mailpoet_posts_title_alignment":B.a.partial(this.changeField,"titleAlignment"),"change .mailpoet_posts_image_full_width":B.a.partial(this.changeBoolField,"imageFullWidth"),"change .mailpoet_posts_featured_image_position":B.a.partial(this.changeField,"featuredImagePosition"),"change .mailpoet_posts_show_author":B.a.partial(this.changeField,"showAuthor"),"input .mailpoet_posts_author_preceded_by":B.a.partial(this.changeField,"authorPrecededBy"),"change .mailpoet_posts_show_categories":B.a.partial(this.changeField,"showCategories"),"input .mailpoet_posts_categories":B.a.partial(this.changeField,"categoriesPrecededBy"),"input .mailpoet_posts_read_more_text":B.a.partial(this.changeField,"readMoreText"),"change .mailpoet_posts_sort_by":B.a.partial(this.changeField,"sortBy"),"change .mailpoet_automated_latest_content_title_position":B.a.partial(this.changeField,"titlePosition")}},templateContext:function(){return{model:this.model.toJSON()}},showButtonSettings:function(){new fe.ButtonBlockSettingsView({model:this.model.get("readMoreButton"),renderOptions:{displayFormat:"subpanel",hideLink:!0,hideApplyToAll:!0}}).render()},showDividerSettings:function(){new xe.DividerBlockSettingsView({model:this.model.get("divider"),renderOptions:{displayFormat:"subpanel",hideApplyToAll:!0}}).render()},changeReadMoreType:function(e){var t=M()(e.target).val();"link"===t?(this.$(".mailpoet_posts_read_more_text").removeClass("mailpoet_hidden"),this.$(".mailpoet_posts_select_button").addClass("mailpoet_hidden")):"button"===t&&(this.$(".mailpoet_posts_read_more_text").addClass("mailpoet_hidden"),this.$(".mailpoet_posts_select_button").removeClass("mailpoet_hidden")),this.changeField("readMoreType",e)},changeDisplayType:function(e){var t=M()(e.target).val();"titleOnly"===t?(this.$(".mailpoet_posts_title_as_list").removeClass("mailpoet_hidden"),this.$(".mailpoet_posts_image_full_width_option").addClass("mailpoet_hidden"),this.$(".mailpoet_posts_image_separator").addClass("mailpoet_hidden")):(this.$(".mailpoet_posts_title_as_list").addClass("mailpoet_hidden"),this.$(".mailpoet_posts_image_full_width_option").removeClass("mailpoet_hidden"),this.$(".mailpoet_posts_image_separator").removeClass("mailpoet_hidden"),"ul"===this.model.get("titleFormat")&&(this.model.set("titleFormat","h1"),this.$(".mailpoet_posts_title_format").val(["h1"]),this.$(".mailpoet_posts_title_as_link").removeClass("mailpoet_hidden"))),"excerpt"===t?this.$(".mailpoet_posts_featured_image_position_container").removeClass("mailpoet_hidden"):this.$(".mailpoet_posts_featured_image_position_container").addClass("mailpoet_hidden"),this.changeField("displayType",e)},changeTitleFormat:function(e){"ul"===M()(e.target).val()?(this.$(".mailpoet_posts_non_title_list_options").addClass("mailpoet_hidden"),this.model.set("titleIsLink",!0),this.$(".mailpoet_posts_title_as_link").addClass("mailpoet_hidden"),this.$(".mailpoet_posts_title_as_links").val(["true"])):(this.$(".mailpoet_posts_non_title_list_options").removeClass("mailpoet_hidden"),this.$(".mailpoet_posts_title_as_link").removeClass("mailpoet_hidden")),this.changeField("titleFormat",e)}}),$e.PostsWidgetView=Le.WidgetView.extend({className:Le.WidgetView.prototype.className+" mailpoet_droppable_layout_block",getTemplate:function(){return window.templates.postsInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new $e.PostsBlockModel({},{parse:!0})}}}}),C.on("before:start",function(e){e.registerBlockType("posts",{blockModel:$e.PostsBlockModel,blockView:$e.PostsBlockView}),e.registerWidget({name:"posts",widgetView:$e.PostsWidgetView,priority:96})});var We,He,je,Ue,qe,Ye={},Xe=ce;Ye.ProductsBlockModel=Xe.BlockModel.extend({stale:["_selectedProducts","_availableProducts","_transformedProducts"],defaults:function(){return this._getDefaults({type:"products",withLayout:!0,amount:"10",offset:0,contentType:"product",postStatus:"publish",terms:[],search:"",inclusionType:"include",displayType:"excerpt",titleFormat:"h1",titleAlignment:"left",titleIsLink:!1,imageFullWidth:!1,titlePosition:"abovePost",featuredImagePosition:"centered",showAuthor:"no",authorPrecededBy:"Author:",showCategories:"no",categoriesPrecededBy:"Categories:",readMoreType:"link",readMoreText:"Read more",readMoreButton:{text:"Read more",url:"[postLink]"},sortBy:"newest",showDivider:!0,divider:{},_selectedProducts:[],_availableProducts:[],_transformedProducts:new(C.getBlockTypeModel("container"))},C.getConfig().get("blockDefaults.products"))},relations:function(){return{readMoreButton:C.getBlockTypeModel("button"),divider:C.getBlockTypeModel("divider"),_selectedProducts:N.a.Collection,_availableProducts:N.a.Collection,_transformedProducts:C.getBlockTypeModel("container")}},initialize:function(){var e=B.a.debounce(this.fetchAvailableProducts.bind(this),500),t=B.a.debounce(this._refreshTransformedProducts.bind(this),500);B.a.extend(this,y.a.Requests),this.fetchAvailableProducts(),this.on("change",this._updateDefaults,this),this.on("change:amount change:terms change:inclusionType change:postStatus change:search change:sortBy",e),this.on("loadMoreProducts",this._loadMoreProducts,this),this.listenTo(this.get("_selectedProducts"),"add remove reset",t),this.on("change:displayType change:titleFormat change:featuredImagePosition change:titleAlignment change:titleIsLink change:imageFullWidth change:showAuthor change:authorPrecededBy change:showCategories change:categoriesPrecededBy change:readMoreType change:readMoreText change:showDivider change:titlePosition",t),this.listenTo(this.get("readMoreButton"),"change",t),this.listenTo(this.get("divider"),"change",t),this.on("insertSelectedProducts",this._insertSelectedProducts,this)},fetchAvailableProducts:function(){var e=this;this.set("offset",0),z.getPosts(this.toJSON()).done(function(t){e.get("_availableProducts").reset(t),e.get("_selectedProducts").reset(),e.trigger("change:_availableProducts")}).fail(function(){c.a.Notice.error(c.a.I18n.t("failedToFetchAvailablePosts"))})},_loadMoreProducts:function(){var e=this,t=this.get("_availableProducts").length,i=this.get("offset")+Number(this.get("amount"));return!(0===t||t<i)&&(this.set("offset",i),this.trigger("loadingMoreProducts"),z.getPosts(this.toJSON()).done(function(t){e.get("_availableProducts").add(t),e.trigger("change:_availableProducts")}).fail(function(){c.a.Notice.error(c.a.I18n.t("failedToFetchAvailablePosts"))}).always(function(){e.trigger("moreProductsLoaded")}),!0)},_refreshTransformedProducts:function(){var e=this,t=this.toJSON();t.posts=this.get("_selectedProducts").pluck("ID"),0!==t.posts.length?z.getTransformedPosts(t).done(function(t){e.get("_transformedProducts").get("blocks").reset(t,{parse:!0})}).fail(function(){c.a.Notice.error(c.a.I18n.t("failedToFetchRenderedPosts"))}):this.get("_transformedProducts").get("blocks").reset()},_insertSelectedProducts:function(){var e=this.toJSON(),t=this.collection.indexOf(this),i=this.collection;e.posts=this.get("_selectedProducts").pluck("ID"),0!==e.posts.length&&z.getTransformedPosts(e).done(function(e){i.add(JSON.parse(R()(e)),{at:t})}).fail(function(){c.a.Notice.error(c.a.I18n.t("failedToFetchRenderedPosts"))})}}),Ye.ProductsBlockView=Xe.BlockView.extend({className:"mailpoet_block mailpoet_products_block mailpoet_droppable_block",getTemplate:function(){return window.templates.productsBlock},modelEvents:{},regions:B.a.extend({productsRegion:".mailpoet_products_container"},Xe.BlockView.prototype.regions),onDragSubstituteBy:function(){return Ye.ProductsWidgetView},initialize:function(){Xe.BlockView.prototype.initialize.apply(this,arguments),this.toolsView=new Ye.ProductsBlockToolsView({model:this.model}),this.model.reply("blockView",this.notifyAboutSelf,this)},onRender:function(){var e,t;this.getRegion("toolsRegion").hasView()||this.showChildView("toolsRegion",this.toolsView),this.trigger("showSettings"),e=C.getBlockTypeView("container"),t={disableTextEditor:!0,disableDragAndDrop:!0,emptyContainerMessage:c.a.I18n.t("noPostsToDisplay")},this.showChildView("productsRegion",new e({model:this.model.get("_transformedProducts"),renderOptions:t}))},notifyAboutSelf:function(){return this},onBeforeDestroy:function(){this.model.stopReplying("blockView",this.notifyAboutSelf,this)}}),Ye.ProductsBlockToolsView=Xe.BlockToolsView.extend({getSettingsView:function(){return Ye.ProductsBlockSettingsView}}),Ye.ProductsBlockSettingsView=Xe.BlockSettingsView.extend({getTemplate:function(){return window.templates.productsBlockSettings},regions:{selectionRegion:".mailpoet_settings_products_selection",displayOptionsRegion:".mailpoet_settings_products_display_options"},events:{"click .mailpoet_settings_products_show_display_options":"switchToDisplayOptions","click .mailpoet_settings_products_show_product_selection":"switchToProductSelection","click .mailpoet_settings_products_insert_selected":"insertProducts"},templateContext:function(){return{model:this.model.toJSON()}},initialize:function(){this.model.trigger("startEditing"),this.selectionView=new Ue({model:this.model}),this.displayOptionsView=new We({model:this.model})},onRender:function(){var e=this;this.model.request("blockView"),this.showChildView("selectionRegion",this.selectionView),this.showChildView("displayOptionsRegion",this.displayOptionsView),c.a.Modal.panel({element:this.$el,template:"",position:"right",width:C.getConfig().get("sidepanelWidth"),onCancel:function(){e.model.destroy()}}),this.selectionView.triggerMethod("attach"),this.displayOptionsView.triggerMethod("attach")},switchToDisplayOptions:function(){this.$(".mailpoet_settings_products_selection").addClass("mailpoet_closed"),this.$(".mailpoet_settings_products_display_options").removeClass("mailpoet_closed"),this.$(".mailpoet_settings_products_show_display_options").addClass("mailpoet_hidden"),this.$(".mailpoet_settings_products_show_product_selection").removeClass("mailpoet_hidden")},switchToProductSelection:function(){this.$(".mailpoet_settings_products_display_options").addClass("mailpoet_closed"),this.$(".mailpoet_settings_products_selection").removeClass("mailpoet_closed"),this.$(".mailpoet_settings_products_show_product_selection").addClass("mailpoet_hidden"),this.$(".mailpoet_settings_products_show_display_options").removeClass("mailpoet_hidden")},insertProducts:function(){this.model.trigger("insertSelectedProducts"),this.model.destroy(),this.close()}}),qe=v.a.CollectionView.extend({className:"mailpoet_post_scroll_container",childView:function(){return He},emptyView:function(){return je},childViewOptions:function(){return{blockModel:this.blockModel}},initialize:function(e){this.blockModel=e.blockModel},events:{scroll:"onProductsScroll"},onProductsScroll:function(e){var t=M()(e.target);t.scrollTop()+t.innerHeight()>=t[0].scrollHeight&&this.blockModel.trigger("loadMoreProducts")}}),Ue=v.a.View.extend({getTemplate:function(){return window.templates.postSelectionProductsBlockSettings},regions:{posts:".mailpoet_product_selection_container"},events:function(){return{"change .mailpoet_products_post_status":B.a.partial(this.changeField,"postStatus"),"input .mailpoet_products_search_term":B.a.partial(this.changeField,"search")}},modelEvents:{"change:offset":function(e,t){0===t&&this.$(".mailpoet_post_scroll_container").scrollTop(0)},loadingMoreProducts:function(){this.$(".mailpoet_product_selection_loading").css("visibility","visible")},moreProductsLoaded:function(){this.$(".mailpoet_product_selection_loading").css("visibility","hidden")}},templateContext:function(){return{model:this.model.toJSON()}},onRender:function(){var e;e=new qe({collection:this.model.get("_availableProducts"),blockModel:this.model}),this.showChildView("posts",e)},onAttach:function(){var e=this;this.$(".mailpoet_products_categories_and_tags").select2({multiple:!0,allowClear:!0,placeholder:c.a.I18n.t("categoriesAndTags"),ajax:{data:function(e){return{term:e.term,page:e.page||1}},transport:function(t,i,o){var n,s=z.getTaxonomies(e.model.get("contentType")).then(function(e){return n=e,z.getTerms({search:t.data.term,page:t.data.page,taxonomies:B.a.keys(n)}).then(function(e){return{taxonomies:n,terms:e}})});return s.then(i),s.fail(o),s},processResults:function(e){return{results:B.a.map(e.terms,function(t){return B.a.defaults({text:e.taxonomies[t.taxonomy].labels.singular_name+": "+t.name,id:t.term_id},t)}),pagination:{more:100===e.terms.length}}}}}).on({"select2:select":function(t){var i=e.model.get("terms");i.add(t.params.data),e.model.set("terms",i.toJSON())},"select2:unselect":function(t){var i=e.model.get("terms");i.remove(t.params.data),e.model.set("terms",i.toJSON())}}).trigger("change")},changeField:function(e,t){this.model.set(e,M()(t.target).val())}}),je=v.a.View.extend({getTemplate:function(){return window.templates.emptyPostProductsBlockSettings}}),He=v.a.View.extend({getTemplate:function(){return window.templates.singlePostProductsBlockSettings},events:function(){return{"change .mailpoet_select_product_checkbox":"productSelectionChange"}},templateContext:function(){return{model:this.model.toJSON(),index:this._index}},initialize:function(e){this.blockModel=e.blockModel},productSelectionChange:function(e){var t=M()(e.target),i=this.blockModel.get("_selectedProducts");t.prop("checked")?i.add(this.model):i.remove(this.model)}}),We=Xe.BlockSettingsView.extend({getTemplate:function(){return window.templates.displayOptionsProductsBlockSettings},events:function(){return{"click .mailpoet_posts_select_button":"showButtonSettings","click .mailpoet_posts_select_divider":"showDividerSettings","change .mailpoet_posts_read_more_type":"changeReadMoreType","change .mailpoet_posts_display_type":"changeDisplayType","change .mailpoet_posts_title_format":"changeTitleFormat","change .mailpoet_posts_title_as_links":B.a.partial(this.changeBoolField,"titleIsLink"),"change .mailpoet_posts_show_divider":B.a.partial(this.changeBoolField,"showDivider"),"input .mailpoet_posts_show_amount":B.a.partial(this.changeField,"amount"),"change .mailpoet_posts_include_or_exclude":B.a.partial(this.changeField,"inclusionType"),"change .mailpoet_posts_title_alignment":B.a.partial(this.changeField,"titleAlignment"),"change .mailpoet_posts_image_full_width":B.a.partial(this.changeBoolField,"imageFullWidth"),"change .mailpoet_posts_featured_image_position":B.a.partial(this.changeField,"featuredImagePosition"),"change .mailpoet_posts_show_author":B.a.partial(this.changeField,"showAuthor"),"input .mailpoet_posts_author_preceded_by":B.a.partial(this.changeField,"authorPrecededBy"),"change .mailpoet_posts_show_categories":B.a.partial(this.changeField,"showCategories"),"input .mailpoet_posts_categories":B.a.partial(this.changeField,"categoriesPrecededBy"),"input .mailpoet_posts_read_more_text":B.a.partial(this.changeField,"readMoreText"),"change .mailpoet_posts_sort_by":B.a.partial(this.changeField,"sortBy"),"change .mailpoet_automated_latest_content_title_position":B.a.partial(this.changeField,"titlePosition")}},templateContext:function(){return{model:this.model.toJSON()}},showButtonSettings:function(){new fe.ButtonBlockSettingsView({model:this.model.get("readMoreButton"),renderOptions:{displayFormat:"subpanel",hideLink:!0,hideApplyToAll:!0}}).render()},showDividerSettings:function(){new xe.DividerBlockSettingsView({model:this.model.get("divider"),renderOptions:{displayFormat:"subpanel",hideApplyToAll:!0}}).render()},changeReadMoreType:function(e){var t=M()(e.target).val();"link"===t?(this.$(".mailpoet_posts_read_more_text").removeClass("mailpoet_hidden"),this.$(".mailpoet_posts_select_button").addClass("mailpoet_hidden")):"button"===t&&(this.$(".mailpoet_posts_read_more_text").addClass("mailpoet_hidden"),this.$(".mailpoet_posts_select_button").removeClass("mailpoet_hidden")),this.changeField("readMoreType",e)},changeDisplayType:function(e){var t=M()(e.target).val();"titleOnly"===t?(this.$(".mailpoet_posts_title_as_list").removeClass("mailpoet_hidden"),this.$(".mailpoet_posts_image_full_width_option").addClass("mailpoet_hidden"),this.$(".mailpoet_posts_image_separator").addClass("mailpoet_hidden")):(this.$(".mailpoet_posts_title_as_list").addClass("mailpoet_hidden"),this.$(".mailpoet_posts_image_full_width_option").removeClass("mailpoet_hidden"),this.$(".mailpoet_posts_image_separator").removeClass("mailpoet_hidden"),"ul"===this.model.get("titleFormat")&&(this.model.set("titleFormat","h1"),this.$(".mailpoet_posts_title_format").val(["h1"]),this.$(".mailpoet_posts_title_as_link").removeClass("mailpoet_hidden"))),"excerpt"===t?this.$(".mailpoet_posts_featured_image_position_container").removeClass("mailpoet_hidden"):this.$(".mailpoet_posts_featured_image_position_container").addClass("mailpoet_hidden"),this.changeField("displayType",e)},changeTitleFormat:function(e){"ul"===M()(e.target).val()?(this.$(".mailpoet_posts_non_title_list_options").addClass("mailpoet_hidden"),this.model.set("titleIsLink",!0),this.$(".mailpoet_posts_title_as_link").addClass("mailpoet_hidden"),this.$(".mailpoet_posts_title_as_links").val(["true"])):(this.$(".mailpoet_posts_non_title_list_options").removeClass("mailpoet_hidden"),this.$(".mailpoet_posts_title_as_link").removeClass("mailpoet_hidden")),this.changeField("titleFormat",e)}}),Ye.ProductsWidgetView=Xe.WidgetView.extend({className:Xe.WidgetView.prototype.className+" mailpoet_droppable_layout_block",id:"automation_editor_block_products",getTemplate:function(){return window.templates.productsInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new Ye.ProductsBlockModel({},{parse:!0})}}}}),C.on("before:start",function(e){B.a.isEmpty(window.config.displayWcProductsWidget)||(e.registerBlockType("products",{blockModel:Ye.ProductsBlockModel,blockView:Ye.ProductsBlockView}),e.registerWidget({name:"products",widgetView:Ye.ProductsWidgetView,priority:98}))});var Je,Ge,Qe,Ke,Ze,et={},tt=ce;et.SocialIconModel=V.a.extend({defaults:function(){var e=C.getConfig().get("socialIcons.custom");return{type:"socialIcon",iconType:"custom",link:e.get("defaultLink"),image:C.getAvailableStyles().get("socialIconSets.default.custom"),height:"32px",width:"32px",text:e.get("title")}},initialize:function(){var e=this;this.on("change:iconType",function(){var t=C.getConfig().get("socialIcons").get(e.get("iconType")),i=e.collection.iconBlockModel.getIconSet();this.set({link:t.get("defaultLink"),image:i.get(e.get("iconType")),text:t.get("title")})},this),this.on("change",function(){C.getChannel().trigger("autoSave")})}}),et.SocialIconCollectionModel=N.a.Collection.extend({model:et.SocialIconModel}),et.SocialBlockModel=tt.BlockModel.extend({name:"iconBlockModel",defaults:function(){return this._getDefaults({type:"social",iconSet:"default",styles:{block:{textAlign:"center"}},icons:new et.SocialIconCollectionModel},C.getConfig().get("blockDefaults.social"))},relations:{icons:et.SocialIconCollectionModel},initialize:function(){this.get("icons").on("add remove change",this._iconsChanged,this),this.on("change:iconSet",this.changeIconSet,this),this.on("change",this._updateDefaults,this)},getIconSet:function(){return C.getAvailableStyles().get("socialIconSets").get(this.get("iconSet"))},changeIconSet:function(){var e=this.getIconSet();B.a.each(this.get("icons").models,function(t){t.set("image",e.get(t.get("iconType")))})},_iconsChanged:function(){this._updateDefaults(),C.getChannel().trigger("autoSave")}}),Ze=v.a.View.extend({tagName:"span",getTemplate:function(){return window.templates.socialIconBlock},modelEvents:{change:"render"},templateContext:function(){var e=C.getAvailableStyles().get("socialIconSets");return{model:this.model.toJSON(),allIconSets:e.toJSON(),imageMissingSrc:C.getConfig().get("urls.imageMissing")}}}),et.SocialIconCollectionView=v.a.CollectionView.extend({childView:Ze}),et.SocialBlockView=tt.BlockView.extend({className:"mailpoet_block mailpoet_social_block mailpoet_droppable_block",getTemplate:function(){return window.templates.socialBlock},regions:B.a.extend({},tt.BlockView.prototype.regions,{icons:".mailpoet_social"}),ui:{tools:"> .mailpoet_tools"},behaviors:B.a.extend({},tt.BlockView.prototype.behaviors,{ShowSettingsBehavior:{}}),onDragSubstituteBy:function(){return et.SocialWidgetView},onRender:function(){this.toolsView=new et.SocialBlockToolsView({model:this.model}),this.showChildView("toolsRegion",this.toolsView),this.showChildView("icons",new et.SocialIconCollectionView({collection:this.model.get("icons")}))}}),et.SocialBlockToolsView=tt.BlockToolsView.extend({getSettingsView:function(){return et.SocialBlockSettingsView}}),et.SocialBlockSettingsView=tt.BlockSettingsView.extend({getTemplate:function(){return window.templates.socialBlockSettings},regions:{iconRegion:"#mailpoet_social_icons_selection",stylesRegion:"#mailpoet_social_icons_styles"},events:function(){return{"click .mailpoet_done_editing":"close","change .mailpoet_social_block_alignment":B.a.partial(this.changeField,"styles.block.textAlign")}},initialize:function(){tt.BlockSettingsView.prototype.initialize.apply(this,arguments),this._iconSelectorView=new Je({model:this.model}),this._stylesView=new Ke({model:this.model})},onRender:function(){this.showChildView("iconRegion",this._iconSelectorView),this.showChildView("stylesRegion",this._stylesView)}}),Ge=v.a.View.extend({getTemplate:function(){return window.templates.socialSettingsIcon},events:function(){return{"click .mailpoet_delete_block":"deleteIcon","change .mailpoet_social_icon_field_type":B.a.partial(this.changeField,"iconType"),"input .mailpoet_social_icon_field_image":B.a.partial(this.changeField,"image"),"input .mailpoet_social_icon_field_link":this.changeLink,"input .mailpoet_social_icon_field_text":B.a.partial(this.changeField,"text")}},modelEvents:{"change:iconType":"render","change:image":function(){this.$(".mailpoet_social_icon_image").attr("src",this.model.get("image"))},"change:text":function(){this.$(".mailpoet_social_icon_image").attr("alt",this.model.get("text"))}},templateContext:function(){var e=C.getConfig().get("socialIcons"),t=B.a.map(B.a.keys(e.attributes),function(t){return{iconType:t,title:e.get(t).get("title")}}),i=C.getAvailableStyles().get("socialIconSets");return B.a.extend({},tt.BlockView.prototype.templateContext.apply(this,arguments),{iconTypes:t,currentType:e.get(this.model.get("iconType")).toJSON(),allIconSets:i.toJSON()})},deleteIcon:function(){this.model.destroy()},changeLink:function(e){if("email"!==this.model.get("iconType"))return this.changeField("link",e);this.model.set("link","mailto:"+M()(e.target).val())},changeField:function(e,t){this.model.set(e,M()(t.target).val())}}),Qe=v.a.CollectionView.extend({behaviors:{SortableBehavior:{items:"> div"}},childViewContainer:"#mailpoet_social_icon_selector_contents",childView:Ge}),Je=v.a.View.extend({getTemplate:function(){return window.templates.socialSettingsIconSelector},regions:{icons:"#mailpoet_social_icon_selector_contents"},events:{"click .mailpoet_add_social_icon":"addSocialIcon"},modelEvents:{"change:iconSet":"render"},addSocialIcon:function(){this.model.get("icons").add({})},onRender:function(){this.showChildView("icons",new Qe({collection:this.model.get("icons")}))}}),Ke=v.a.View.extend({getTemplate:function(){return window.templates.socialSettingsStyles},modelEvents:{change:"render"},events:{"click .mailpoet_social_icon_set":"changeSocialIconSet"},initialize:function(){this.listenTo(this.model.get("icons"),"add remove change",this.render)},templateContext:function(){var e=C.getAvailableStyles().get("socialIconSets");return{activeSet:this.model.get("iconSet"),socialIconSets:e.toJSON(),availableSets:B.a.keys(e.toJSON()),availableSocialIcons:this.model.get("icons").pluck("iconType")}},changeSocialIconSet:function(e){this.model.set("iconSet",M()(e.currentTarget).data("setname"))},onBeforeDestroy:function(){this.model.get("icons").off("add remove",this.render,this)}}),et.SocialWidgetView=tt.WidgetView.extend({getTemplate:function(){return window.templates.socialInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new et.SocialBlockModel}}}}),C.on("before:start",function(e){e.registerBlockType("social",{blockModel:et.SocialBlockModel,blockView:et.SocialBlockView}),e.registerWidget({name:"social",widgetView:et.SocialWidgetView,priority:95})})},90:function(e,t,i){e.exports=function(e,t){"use strict";e="default"in e?e.default:e,t="default"in t?t.default:t;var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},o=t.Radio,n=t.Radio={};n.VERSION="2.0.0",n.noConflict=function(){return t.Radio=o,this},n.DEBUG=!1,n._debugText=function(e,t,i){return e+(i?" on the "+i+" channel":"")+': "'+t+'"'},n.debugLog=function(e,t,i){n.DEBUG&&console&&console.warn&&console.warn(n._debugText(e,t,i))};var s=/\s+/;function r(e,t,i,o){var n=e[t];if(!(i&&i!==n.callback&&i!==n.callback._callback||o&&o!==n.context))return delete e[t],!0}n._eventsApi=function(t,o,n,r){if(!n)return!1;var a={};if("object"===(void 0===n?"undefined":i(n))){for(var l in n){var c=t[o].apply(t,[l,n[l]].concat(r));s.test(l)?e.extend(a,c):a[l]=c}return a}if(s.test(n)){for(var d=n.split(s),h=0,p=d.length;h<p;h++)a[d[h]]=t[o].apply(t,[d[h]].concat(r));return a}return!1},n._callHandler=function(e,t,i){var o=i[0],n=i[1],s=i[2];switch(i.length){case 0:return e.call(t);case 1:return e.call(t,o);case 2:return e.call(t,o,n);case 3:return e.call(t,o,n,s);default:return e.apply(t,i)}};var a,l,c={};function d(t){return c[t]||(c[t]=e.bind(n.log,n,t))}function h(t){return e.isFunction(t)?t:function(){return t}}e.extend(n,{log:function(t,i){if("undefined"!=typeof console){var o=e.toArray(arguments).slice(2);console.log("["+t+'] "'+i+'"',o)}},tuneIn:function(e){var t=n.channel(e);return t._tunedIn=!0,t.on("all",d(e)),this},tuneOut:function(e){var t=n.channel(e);return t._tunedIn=!1,t.off("all",d(e)),delete c[e],this}}),n.Requests={request:function(t){var i=e.toArray(arguments).slice(1),o=n._eventsApi(this,"request",t,i);if(o)return o;var s=this.channelName,r=this._requests;if(s&&this._tunedIn&&n.log.apply(this,[s,t].concat(i)),r&&(r[t]||r.default)){var a=r[t]||r.default;return i=r[t]?i:arguments,n._callHandler(a.callback,a.context,i)}n.debugLog("An unhandled request was fired",t,s)},reply:function(e,t,i){return n._eventsApi(this,"reply",e,[t,i])?this:(this._requests||(this._requests={}),this._requests[e]&&n.debugLog("A request was overwritten",e,this.channelName),this._requests[e]={callback:h(t),context:i||this},this)},replyOnce:function(t,i,o){if(n._eventsApi(this,"replyOnce",t,[i,o]))return this;var s=this,r=e.once(function(){return s.stopReplying(t),h(i).apply(this,arguments)});return this.reply(t,r,o)},stopReplying:function(t,i,o){return n._eventsApi(this,"stopReplying",t)?this:(t||i||o?function(t,i,o,n){t||(t={});for(var s=i?[i]:e.keys(t),a=!1,l=0,c=s.length;l<c;l++)i=s[l],t[i]&&r(t,i,o,n)&&(a=!0);return a}(this._requests,t,i,o)||n.debugLog("Attempted to remove the unregistered request",t,this.channelName):delete this._requests,this)}},n._channels={},n.channel=function(e){if(!e)throw new Error("You must provide a name for the channel.");return n._channels[e]?n._channels[e]:n._channels[e]=new n.Channel(e)},n.Channel=function(e){this.channelName=e},e.extend(n.Channel.prototype,t.Events,n.Requests,{reset:function(){return this.off(),this.stopListening(),this.stopReplying(),this}});var p=[t.Events,n.Requests];return e.each(p,function(t){e.each(t,function(t,i){n[i]=function(t){return l=e.toArray(arguments).slice(1),(a=this.channel(t))[i].apply(a,l)}})}),n.reset=function(t){var i=t?[this._channels[t]]:this._channels;e.each(i,function(e){e.reset()})},n}(i(4),i(26))},99:function(e,t,i){!function(i){"use strict";if(i){var o,n,s,r=(s=i.document.createTextNode("")).ownerDocument!==i.document&&"function"==typeof i.wrap&&i.wrap(s)===s?i.wrap(i):i,a=r.document,l=r.DocumentFragment||q,c=r.SVGElement||q,d=r.SVGSVGElement||q,h=r.SVGElementInstance||q,p=r.HTMLElement||r.Element,u=r.PointerEvent||r.MSPointerEvent,g=Math.hypot||function(e,t){return Math.sqrt(e*e+t*t)},f={},m=[],_=[],v=[],w=!1,y={},b={base:{accept:null,actionChecker:null,styleCursor:!0,preventDefault:"auto",origin:{x:0,y:0},deltaSource:"page",allowFrom:null,ignoreFrom:null,_context:a,dropChecker:null},drag:{enabled:!1,manualStart:!0,max:1/0,maxPerElement:1,snap:null,restrict:null,inertia:null,autoScroll:null,axis:"xy"},drop:{enabled:!1,accept:null,overlap:"pointer"},resize:{enabled:!1,manualStart:!1,max:1/0,maxPerElement:1,snap:null,restrict:null,inertia:null,autoScroll:null,square:!1,preserveAspectRatio:!1,axis:"xy",margin:NaN,edges:null,invert:"none"},gesture:{manualStart:!1,enabled:!1,max:1/0,maxPerElement:1,restrict:null},perAction:{manualStart:!1,max:1/0,maxPerElement:1,snap:{enabled:!1,endOnly:!1,range:1/0,targets:null,offsets:null,relativePoints:null},restrict:{enabled:!1,endOnly:!1},autoScroll:{enabled:!1,container:null,margin:60,speed:300},inertia:{enabled:!1,resistance:10,minSpeed:100,endSpeed:10,allowResume:!0,zeroResumeDelta:!0,smoothEndDuration:300}},_holdDuration:600},x={interaction:null,i:null,x:0,y:0,scroll:function(){var e,t,i,o,n=x.interaction.target.options[x.interaction.prepared.name].autoScroll,s=n.container||ue(x.interaction.element),r=(new Date).getTime(),a=(r-x.prevTimeX)/1e3,l=(r-x.prevTimeY)/1e3;n.velocity?(e=n.velocity.x,t=n.velocity.y):e=t=n.speed,o=t*l,((i=e*a)>=1||o>=1)&&(X(s)?s.scrollBy(x.x*i,x.y*o):s&&(s.scrollLeft+=x.x*i,s.scrollTop+=x.y*o),i>=1&&(x.prevTimeX=r),o>=1&&(x.prevTimeY=r)),x.isScrolling&&(I(x.i),x.i=z(x.scroll))},isScrolling:!1,prevTimeX:0,prevTimeY:0,start:function(e){x.isScrolling=!0,I(x.i),x.interaction=e,x.prevTimeX=(new Date).getTime(),x.prevTimeY=(new Date).getTime(),x.i=z(x.scroll)},stop:function(){x.isScrolling=!1,I(x.i)}},k="ontouchstart"in r||r.DocumentTouch&&a instanceof r.DocumentTouch,C=u&&!/Chrome/.test(navigator.userAgent),S=k||C?20:10,V=1,T=0,B=1/0,E=a.all&&!r.atob?{drag:"move",resizex:"e-resize",resizey:"s-resize",resizexy:"se-resize",resizetop:"n-resize",resizeleft:"w-resize",resizebottom:"s-resize",resizeright:"e-resize",resizetopleft:"se-resize",resizebottomright:"se-resize",resizetopright:"ne-resize",resizebottomleft:"ne-resize",gesture:""}:{drag:"move",resizex:"ew-resize",resizey:"ns-resize",resizexy:"nwse-resize",resizetop:"ns-resize",resizeleft:"ew-resize",resizebottom:"ns-resize",resizeright:"ew-resize",resizetopleft:"nwse-resize",resizebottomright:"nwse-resize",resizetopright:"nesw-resize",resizebottomleft:"nesw-resize",gesture:""},P={drag:!0,resize:!0,gesture:!0},M="onmousewheel"in a?"mousewheel":"wheel",A=["dragstart","dragmove","draginertiastart","dragend","dragenter","dragleave","dropactivate","dropdeactivate","dropmove","drop","resizestart","resizemove","resizeinertiastart","resizeend","gesturestart","gesturemove","gestureinertiastart","gestureend","down","move","up","cancel","tap","doubletap","hold"],D={},R="Opera"==navigator.appName&&k&&navigator.userAgent.match("Presto"),F=/iP(hone|od|ad)/.test(navigator.platform)&&/OS 7[^\d]/.test(navigator.appVersion),O="matches"in Element.prototype?"matches":"webkitMatchesSelector"in Element.prototype?"webkitMatchesSelector":"mozMatchesSelector"in Element.prototype?"mozMatchesSelector":"oMatchesSelector"in Element.prototype?"oMatchesSelector":"msMatchesSelector",z=i.requestAnimationFrame,I=i.cancelAnimationFrame,N=function(){var e="attachEvent"in r&&!("addEventListener"in r),t=e?"attachEvent":"addEventListener",i=e?"detachEvent":"removeEventListener",o=e?"on":"",n=[],s=[],a=[];function l(){this.returnValue=!1}function c(){this.cancelBubble=!0}function d(){this.cancelBubble=!0,this.immediatePropagationStopped=!0}return{add:function(i,r,h,p){var u=Ge(n,i),g=s[u];if(g||(g={events:{},typeCount:0},u=n.push(i)-1,s.push(g),a.push(e?{supplied:[],wrapped:[],useCount:[]}:null)),g.events[r]||(g.events[r]=[],g.typeCount++),!Qe(g.events[r],h)){var f;if(e){var m=a[u],_=Ge(m.supplied,h),v=m.wrapped[_]||function(e){e.immediatePropagationStopped||(e.target=e.srcElement,e.currentTarget=i,e.preventDefault=e.preventDefault||l,e.stopPropagation=e.stopPropagation||c,e.stopImmediatePropagation=e.stopImmediatePropagation||d,/mouse|click/.test(e.type)&&(e.pageX=e.clientX+ue(i).document.documentElement.scrollLeft,e.pageY=e.clientY+ue(i).document.documentElement.scrollTop),h(e))};f=i[t](o+r,v,Boolean(p)),-1===_?(m.supplied.push(h),m.wrapped.push(v),m.useCount.push(1)):m.useCount[_]++}else f=i[t](r,h,p||!1);return g.events[r].push(h),f}},remove:function t(r,l,c,d){var h,p,u,g=Ge(n,r),f=s[g],m=c;if(f&&f.events)if(e&&(u=Ge((p=a[g]).supplied,c),m=p.wrapped[u]),"all"!==l){if(f.events[l]){var _=f.events[l].length;if("all"===c){for(h=0;h<_;h++)t(r,l,f.events[l][h],Boolean(d));return}for(h=0;h<_;h++)if(f.events[l][h]===c){r[i](o+l,m,d||!1),f.events[l].splice(h,1),e&&p&&(p.useCount[u]--,0===p.useCount[u]&&(p.supplied.splice(u,1),p.wrapped.splice(u,1),p.useCount.splice(u,1)));break}f.events[l]&&0===f.events[l].length&&(f.events[l]=null,f.typeCount--)}f.typeCount||(s.splice(g,1),n.splice(g,1),a.splice(g,1))}else for(l in f.events)f.events.hasOwnProperty(l)&&t(r,l,"all")},useAttachEvent:e,_elements:n,_targets:s,_attachedListeners:a}}(),$={webkit:/(Movement[XY]|Radius[XY]|RotationAngle|Force)#x2F;};Re.prototype={getPageXY:function(e,t){return ce(e,t)},getClientXY:function(e,t){return de(e,t)},setEventXY:function(e,t){return i=e,ce(n=(o=t).length>1?_e(o):o[0],f),i.page.x=f.x,i.page.y=f.y,de(n,f),i.client.x=f.x,i.client.y=f.y,void(i.timeStamp=(new Date).getTime());var i,o,n},pointerOver:function(e,t,i){if(!this.prepared.name&&this.mouse){var n=[],s=[],r=this.element;this.addPointer(e),!this.target||!Be(this.target,this.element,i)&&Ee(this.target,this.element,i)||(this.target=null,this.element=null,this.matches=[],this.matchElements=[]);var a=_.get(i),l=a&&!Be(a,i,i)&&Ee(a,i,i)&&We(a.getAction(e,t,this,i),a);l&&!De(a,i,l)&&(l=null),l?(this.target=a,this.element=i,this.matches=[],this.matchElements=[]):(_.forEachSelector(function(e,t){e&&Te(e,i)&&!Be(e,i,i)&&Ee(e,i,i)&&Ke(i,t)&&(n.push(e),s.push(i))}),this.validateSelector(e,t,n,s)?(this.matches=n,this.matchElements=s,this.pointerHover(e,t,this.matches,this.matchElements),N.add(i,C?o.move:"mousemove",L.pointerHover)):this.target&&(Ce(r,i)?(this.pointerHover(e,t,this.matches,this.matchElements),N.add(this.element,C?o.move:"mousemove",L.pointerHover)):(this.target=null,this.element=null,this.matches=[],this.matchElements=[])))}},pointerHover:function(e,t,i,o,n,s){var r,a=this.target;!this.prepared.name&&this.mouse?(this.setEventXY(this.curCoords,[e]),n?r=this.validateSelector(e,t,n,s):a&&(r=We(a.getAction(this.pointers[0],t,this,this.element),this.target)),a&&a.options.styleCursor&&(a._doc.documentElement.style.cursor=r?Ne(r):"")):this.prepared.name&&this.checkAndPreventDefault(t,a,this.element)},pointerOut:function(e,t,i){this.prepared.name||(_.get(i)||N.remove(i,C?o.move:"mousemove",L.pointerHover),this.target&&this.target.options.styleCursor&&!this.interacting()&&(this.target._doc.documentElement.style.cursor=""))},selectorDown:function(e,t,i,o){var s,r=this,a=N.useAttachEvent?oe({},t):t,l=i,c=this.addPointer(e);if(this.holdTimers[c]=setTimeout(function(){r.pointerHold(N.useAttachEvent?a:e,a,i,o)},b._holdDuration),this.pointerIsDown=!0,this.inertiaStatus.active&&this.target.selector)for(;Y(l);){if(l===this.element&&We(this.target.getAction(e,t,this,this.element),this.target).name===this.prepared.name)return I(this.inertiaStatus.i),this.inertiaStatus.active=!1,void this.collectEventTargets(e,t,i,"down");l=Ve(l)}if(this.interacting())this.collectEventTargets(e,t,i,"down");else{for(this.setEventXY(this.curCoords,[e]),this.downEvent=t;Y(l)&&!s;)this.matches=[],this.matchElements=[],_.forEachSelector(d),s=this.validateSelector(e,t,this.matches,this.matchElements),l=Ve(l);if(s)return this.prepared.name=s.name,this.prepared.axis=s.axis,this.prepared.edges=s.edges,this.collectEventTargets(e,t,i,"down"),this.pointerDown(e,t,i,o,s);this.downTimes[c]=(new Date).getTime(),this.downTargets[c]=i,ne(this.downPointer,e),se(this.prevCoords,this.curCoords),this.pointerWasMoved=!1,this.collectEventTargets(e,t,i,"down")}function d(e,t,o){var s=n?o.querySelectorAll(t):void 0;Te(e,l)&&!Be(e,l,i)&&Ee(e,l,i)&&Ke(l,t,s)&&(r.matches.push(e),r.matchElements.push(l))}},pointerDown:function(e,t,i,o,n){if(n||this.inertiaStatus.active||!this.pointerWasMoved||!this.prepared.name){this.pointerIsDown=!0,this.downEvent=t;var s,r=this.addPointer(e);if(this.pointerIds.length>1&&this.target._element===this.element){var a=We(n||this.target.getAction(e,t,this,this.element),this.target);De(this.target,this.element,a)&&(s=a),this.prepared.name=null}else if(!this.prepared.name){var l=_.get(o);l&&!Be(l,o,i)&&Ee(l,o,i)&&(s=We(n||l.getAction(e,t,this,o),l))&&De(l,o,s)&&(this.target=l,this.element=o)}var c=this.target,d=c&&c.options;if(!c||!n&&this.prepared.name)this.inertiaStatus.active&&o===this.element&&We(c.getAction(e,t,this,this.element),c).name===this.prepared.name&&(I(this.inertiaStatus.i),this.inertiaStatus.active=!1,this.checkAndPreventDefault(t,c,this.element));else{if(s=s||We(n||c.getAction(e,t,this,o),c,this.element),this.setEventXY(this.startCoords,this.pointers),!s)return;d.styleCursor&&(c._doc.documentElement.style.cursor=Ne(s)),this.resizeAxes="resize"===s.name?s.axis:null,"gesture"===s&&this.pointerIds.length<2&&(s=null),this.prepared.name=s.name,this.prepared.axis=s.axis,this.prepared.edges=s.edges,this.snapStatus.snappedX=this.snapStatus.snappedY=this.restrictStatus.restrictedX=this.restrictStatus.restrictedY=NaN,this.downTimes[r]=(new Date).getTime(),this.downTargets[r]=i,ne(this.downPointer,e),se(this.prevCoords,this.startCoords),this.pointerWasMoved=!1,this.checkAndPreventDefault(t,c,this.element)}}else this.checkAndPreventDefault(t,this.target,this.element)},setModifications:function(e,t){var i=this.target,o=!0,n=Me(i,this.prepared.name)&&(!i.options[this.prepared.name].snap.endOnly||t),s=Ae(i,this.prepared.name)&&(!i.options[this.prepared.name].restrict.endOnly||t);return n?this.setSnapping(e):this.snapStatus.locked=!1,s?this.setRestriction(e):this.restrictStatus.restricted=!1,n&&this.snapStatus.locked&&!this.snapStatus.changed?o=s&&this.restrictStatus.restricted&&this.restrictStatus.changed:s&&this.restrictStatus.restricted&&!this.restrictStatus.changed&&(o=!1),o},setStartOffsets:function(e,t,i){var o,n,s=t.getRect(i),r=be(t,i),a=t.options[this.prepared.name].snap,l=t.options[this.prepared.name].restrict;s?(this.startOffset.left=this.startCoords.page.x-s.left,this.startOffset.top=this.startCoords.page.y-s.top,this.startOffset.right=s.right-this.startCoords.page.x,this.startOffset.bottom=s.bottom-this.startCoords.page.y,o="width"in s?s.width:s.right-s.left,n="height"in s?s.height:s.bottom-s.top):this.startOffset.left=this.startOffset.top=this.startOffset.right=this.startOffset.bottom=0,this.snapOffsets.splice(0);var c=a&&"startCoords"===a.offset?{x:this.startCoords.page.x-r.x,y:this.startCoords.page.y-r.y}:a&&a.offset||{x:0,y:0};if(s&&a&&a.relativePoints&&a.relativePoints.length)for(var d=0;d<a.relativePoints.length;d++)this.snapOffsets.push({x:this.startOffset.left-o*a.relativePoints[d].x+c.x,y:this.startOffset.top-n*a.relativePoints[d].y+c.y});else this.snapOffsets.push(c);s&&l.elementRect?(this.restrictOffset.left=this.startOffset.left-o*l.elementRect.left,this.restrictOffset.top=this.startOffset.top-n*l.elementRect.top,this.restrictOffset.right=this.startOffset.right-o*(1-l.elementRect.right),this.restrictOffset.bottom=this.startOffset.bottom-n*(1-l.elementRect.bottom)):this.restrictOffset.left=this.restrictOffset.top=this.restrictOffset.right=this.restrictOffset.bottom=0},start:function(e,t,i){this.interacting()||!this.pointerIsDown||this.pointerIds.length<("gesture"===e.name?2:1)||(-1===Ge(v,this)&&v.push(this),this.prepared.name||this.setEventXY(this.startCoords,this.pointers),this.prepared.name=e.name,this.prepared.axis=e.axis,this.prepared.edges=e.edges,this.target=t,this.element=i,this.setStartOffsets(e.name,t,i),this.setModifications(this.startCoords.page),this.prevEvent=this[this.prepared.name+"Start"](this.downEvent))},pointerMove:function(e,t,i,o,s){if(this.inertiaStatus.active){var r=this.inertiaStatus.upCoords.page,a=this.inertiaStatus.upCoords.client,l={pageX:r.x+this.inertiaStatus.sx,pageY:r.y+this.inertiaStatus.sy,clientX:a.x+this.inertiaStatus.sx,clientY:a.y+this.inertiaStatus.sy};this.setEventXY(this.curCoords,[l])}else this.recordPointer(e),this.setEventXY(this.curCoords,this.pointers);var c,d,h=this.curCoords.page.x===this.prevCoords.page.x&&this.curCoords.page.y===this.prevCoords.page.y&&this.curCoords.client.x===this.prevCoords.client.x&&this.curCoords.client.y===this.prevCoords.client.y,p=this.mouse?0:Ge(this.pointerIds,he(e));if(this.pointerIsDown&&!this.pointerWasMoved&&(c=this.curCoords.client.x-this.startCoords.client.x,d=this.curCoords.client.y-this.startCoords.client.y,this.pointerWasMoved=g(c,d)>V),h||this.pointerIsDown&&!this.pointerWasMoved||(this.pointerIsDown&&clearTimeout(this.holdTimers[p]),this.collectEventTargets(e,t,i,"move")),this.pointerIsDown)if(h&&this.pointerWasMoved&&!s)this.checkAndPreventDefault(t,this.target,this.element);else if(re(this.pointerDelta,this.prevCoords,this.curCoords),this.prepared.name){if(this.pointerWasMoved&&(!this.inertiaStatus.active||e instanceof ze&&/inertiastart/.test(e.type))){if(!this.interacting()&&(re(this.pointerDelta,this.prevCoords,this.curCoords),"drag"===this.prepared.name)){var u=Math.abs(c),f=Math.abs(d),m=this.target.options.drag.axis,v=u>f?"x":u<f?"y":"xy";if("xy"!==v&&"xy"!==m&&m!==v){this.prepared.name=null;for(var w=i;Y(w);){var y=_.get(w);if(y&&y!==this.target&&!y.options.drag.manualStart&&"drag"===y.getAction(this.downPointer,this.downEvent,this,w).name&&Pe(v,y)){this.prepared.name="drag",this.target=y,this.element=w;break}w=Ve(w)}if(!this.prepared.name){var b=this,x=function(e,t,o){var s=n?o.querySelectorAll(t):void 0;if(e!==b.target)return Te(e,i)&&!e.options.drag.manualStart&&!Be(e,w,i)&&Ee(e,w,i)&&Ke(w,t,s)&&"drag"===e.getAction(b.downPointer,b.downEvent,b,w).name&&Pe(v,e)&&De(e,w,"drag")?e:void 0};for(w=i;Y(w);){var k=_.forEachSelector(x);if(k){this.prepared.name="drag",this.target=k,this.element=w;break}w=Ve(w)}}}}var C=!!this.prepared.name&&!this.interacting();if(C&&(this.target.options[this.prepared.name].manualStart||!De(this.target,this.element,this.prepared)))return void this.stop(t);if(this.prepared.name&&this.target)C&&this.start(this.prepared,this.target,this.element),(this.setModifications(this.curCoords.page,s)||C)&&(this.prevEvent=this[this.prepared.name+"Move"](t)),this.checkAndPreventDefault(t,this.target,this.element)}se(this.prevCoords,this.curCoords),(this.dragging||this.resizing)&&this.autoScrollMove(e)}},dragStart:function(e){var t=new ze(this,e,"drag","start",this.element);this.dragging=!0,this.target.fire(t),this.activeDrops.dropzones=[],this.activeDrops.elements=[],this.activeDrops.rects=[],this.dynamicDrop||this.setActiveDrops(this.element);var i=this.getDropEvents(e,t);return i.activate&&this.fireActiveDrops(i.activate),t},dragMove:function(e){var t=this.target,i=new ze(this,e,"drag","move",this.element),o=this.element,n=this.getDrop(i,e,o);this.dropTarget=n.dropzone,this.dropElement=n.element;var s=this.getDropEvents(e,i);return t.fire(i),s.leave&&this.prevDropTarget.fire(s.leave),s.enter&&this.dropTarget.fire(s.enter),s.move&&this.dropTarget.fire(s.move),this.prevDropTarget=this.dropTarget,this.prevDropElement=this.dropElement,i},resizeStart:function(e){var t=new ze(this,e,"resize","start",this.element);if(this.prepared.edges){var i=this.target.getRect(this.element);if(this.target.options.resize.square||this.target.options.resize.preserveAspectRatio){var o=oe({},this.prepared.edges);o.top=o.top||o.left&&!o.bottom,o.left=o.left||o.top&&!o.right,o.bottom=o.bottom||o.right&&!o.top,o.right=o.right||o.bottom&&!o.left,this.prepared._linkedEdges=o}else this.prepared._linkedEdges=null;this.target.options.resize.preserveAspectRatio&&(this.resizeStartAspectRatio=i.width/i.height),this.resizeRects={start:i,current:oe({},i),restricted:oe({},i),previous:oe({},i),delta:{left:0,right:0,width:0,top:0,bottom:0,height:0}},t.rect=this.resizeRects.restricted,t.deltaRect=this.resizeRects.delta}return this.target.fire(t),this.resizing=!0,t},resizeMove:function(e){var t=new ze(this,e,"resize","move",this.element),i=this.prepared.edges,o=this.target.options.resize.invert,n="reposition"===o||"negate"===o;if(i){var s,r=t.dx,a=t.dy,l=this.resizeRects.start,c=this.resizeRects.current,d=this.resizeRects.restricted,h=this.resizeRects.delta,p=oe(this.resizeRects.previous,d),u=i;if(this.target.options.resize.preserveAspectRatio){var g=this.resizeStartAspectRatio;i=this.prepared._linkedEdges,u.left&&u.bottom||u.right&&u.top?a=-r/g:u.left||u.right?a=r/g:(u.top||u.bottom)&&(r=a*g)}else this.target.options.resize.square&&(i=this.prepared._linkedEdges,u.left&&u.bottom||u.right&&u.top?a=-r:u.left||u.right?a=r:(u.top||u.bottom)&&(r=a));if(i.top&&(c.top+=a),i.bottom&&(c.bottom+=a),i.left&&(c.left+=r),i.right&&(c.right+=r),n){if(oe(d,c),"reposition"===o)d.top>d.bottom&&(s=d.top,d.top=d.bottom,d.bottom=s),d.left>d.right&&(s=d.left,d.left=d.right,d.right=s)}else d.top=Math.min(c.top,l.bottom),d.bottom=Math.max(c.bottom,l.top),d.left=Math.min(c.left,l.right),d.right=Math.max(c.right,l.left);for(var f in d.width=d.right-d.left,d.height=d.bottom-d.top,d)h[f]=d[f]-p[f];t.edges=this.prepared.edges,t.rect=d,t.deltaRect=h}return this.target.fire(t),t},gestureStart:function(e){var t=new ze(this,e,"gesture","start",this.element);return t.ds=0,this.gesture.startDistance=this.gesture.prevDistance=t.distance,this.gesture.startAngle=this.gesture.prevAngle=t.angle,this.gesture.scale=1,this.gesturing=!0,this.target.fire(t),t},gestureMove:function(e){return this.pointerIds.length?((t=new ze(this,e,"gesture","move",this.element)).ds=t.scale-this.gesture.scale,this.target.fire(t),this.gesture.prevAngle=t.angle,this.gesture.prevDistance=t.distance,t.scale===1/0||null===t.scale||void 0===t.scale||isNaN(t.scale)||(this.gesture.scale=t.scale),t):this.prevEvent;var t},pointerHold:function(e,t,i){this.collectEventTargets(e,t,i,"hold")},pointerUp:function(e,t,i,o){var n=this.mouse?0:Ge(this.pointerIds,he(e));clearTimeout(this.holdTimers[n]),this.collectEventTargets(e,t,i,"up"),this.collectEventTargets(e,t,i,"tap"),this.pointerEnd(e,t,i,o),this.removePointer(e)},pointerCancel:function(e,t,i,o){var n=this.mouse?0:Ge(this.pointerIds,he(e));clearTimeout(this.holdTimers[n]),this.collectEventTargets(e,t,i,"cancel"),this.pointerEnd(e,t,i,o),this.removePointer(e)},ie8Dblclick:function(e,t,i){this.prevTap&&t.clientX===this.prevTap.clientX&&t.clientY===this.prevTap.clientY&&i===this.prevTap.target&&(this.downTargets[0]=i,this.downTimes[0]=(new Date).getTime(),this.collectEventTargets(e,t,i,"tap"))},pointerEnd:function(e,t,i,o){var n,s=this.target,r=s&&s.options,a=r&&this.prepared.name&&r[this.prepared.name].inertia,l=this.inertiaStatus;if(this.interacting()){if(l.active&&!l.ending)return;var c,d,h,p=(new Date).getTime(),u=!1,g=Me(s,this.prepared.name)&&r[this.prepared.name].snap.endOnly,f=Ae(s,this.prepared.name)&&r[this.prepared.name].restrict.endOnly,m=0,_=0;if(c=this.dragging?"x"===r.drag.axis?Math.abs(this.pointerDelta.client.vx):"y"===r.drag.axis?Math.abs(this.pointerDelta.client.vy):this.pointerDelta.client.speed:this.pointerDelta.client.speed,h=(d=a&&a.enabled&&"gesture"!==this.prepared.name&&t!==l.startEvent)&&p-this.curCoords.timeStamp<50&&c>a.minSpeed&&c>a.endSpeed,d&&!h&&(g||f)){var v={};v.snap=v.restrict=v,g&&(this.setSnapping(this.curCoords.page,v),v.locked&&(m+=v.dx,_+=v.dy)),f&&(this.setRestriction(this.curCoords.page,v),v.restricted&&(m+=v.dx,_+=v.dy)),(m||_)&&(u=!0)}if(h||u){if(se(l.upCoords,this.curCoords),this.pointers[0]=l.startEvent=new ze(this,t,this.prepared.name,"inertiastart",this.element),l.t0=p,s.fire(l.startEvent),h){l.vx0=this.pointerDelta.client.vx,l.vy0=this.pointerDelta.client.vy,l.v0=c,this.calcInertia(l);var w,y=oe({},this.curCoords.page),b=be(s,this.element);if(y.x=y.x+l.xe-b.x,y.y=y.y+l.ye-b.y,(w={useStatusXY:!0,x:y.x,y:y.y,dx:0,dy:0,snap:null}).snap=w,m=_=0,g){var x=this.setSnapping(this.curCoords.page,w);x.locked&&(m+=x.dx,_+=x.dy)}if(f){var k=this.setRestriction(this.curCoords.page,w);k.restricted&&(m+=k.dx,_+=k.dy)}l.modifiedXe+=m,l.modifiedYe+=_,l.i=z(this.boundInertiaFrame)}else l.smoothEnd=!0,l.xe=m,l.ye=_,l.sx=l.sy=0,l.i=z(this.boundSmoothEndFrame);return void(l.active=!0)}(g||f)&&this.pointerMove(e,t,i,o,!0)}if(this.dragging){n=new ze(this,t,"drag","end",this.element);var C=this.element,S=this.getDrop(n,t,C);this.dropTarget=S.dropzone,this.dropElement=S.element;var V=this.getDropEvents(t,n);V.leave&&this.prevDropTarget.fire(V.leave),V.enter&&this.dropTarget.fire(V.enter),V.drop&&this.dropTarget.fire(V.drop),V.deactivate&&this.fireActiveDrops(V.deactivate),s.fire(n)}else this.resizing?(n=new ze(this,t,"resize","end",this.element),s.fire(n)):this.gesturing&&(n=new ze(this,t,"gesture","end",this.element),s.fire(n));this.stop(t)},collectDrops:function(e){var t,i=[],o=[];for(e=e||this.element,t=0;t<_.length;t++)if(_[t].options.drop.enabled){var n=_[t],s=n.options.drop.accept;if(!(Y(s)&&s!==e||te(s)&&!Ke(e,s)))for(var r=n.selector?n._context.querySelectorAll(n.selector):[n._element],a=0,l=r.length;a<l;a++){var c=r[a];c!==e&&(i.push(n),o.push(c))}}return{dropzones:i,elements:o}},fireActiveDrops:function(e){var t,i,o,n;for(t=0;t<this.activeDrops.dropzones.length;t++)i=this.activeDrops.dropzones[t],(o=this.activeDrops.elements[t])!==n&&(e.target=o,i.fire(e)),n=o},setActiveDrops:function(e){var t=this.collectDrops(e,!0);this.activeDrops.dropzones=t.dropzones,this.activeDrops.elements=t.elements,this.activeDrops.rects=[];for(var i=0;i<this.activeDrops.dropzones.length;i++)this.activeDrops.rects[i]=this.activeDrops.dropzones[i].getRect(this.activeDrops.elements[i])},getDrop:function(e,t,i){var o=[];w&&this.setActiveDrops(i);for(var n=0;n<this.activeDrops.dropzones.length;n++){var s=this.activeDrops.dropzones[n],r=this.activeDrops.elements[n],a=this.activeDrops.rects[n];o.push(s.dropCheck(e,t,this.target,i,r,a)?r:null)}var l=function(e){var t,i,o,n,s,r=e[0],a=r?0:-1,l=[],h=[];for(n=1;n<e.length;n++)if((t=e[n])&&t!==r)if(r){if(t.parentNode!==t.ownerDocument)if(r.parentNode!==t.ownerDocument){if(!l.length)for(i=r;i.parentNode&&i.parentNode!==i.ownerDocument;)l.unshift(i),i=i.parentNode;if(r instanceof p&&t instanceof c&&!(t instanceof d)){if(t===r.parentNode)continue;i=t.ownerSVGElement}else i=t;for(h=[];i.parentNode!==i.ownerDocument;)h.unshift(i),i=i.parentNode;for(s=0;h[s]&&h[s]===l[s];)s++;var u=[h[s-1],h[s],l[s]];for(o=u[0].lastChild;o;){if(o===u[1]){r=t,a=n,l=[];break}if(o===u[2])break;o=o.previousSibling}}else r=t,a=n}else r=t,a=n;return a}(o);return{dropzone:this.activeDrops.dropzones[l]||null,element:this.activeDrops.elements[l]||null}},getDropEvents:function(e,t){var i={enter:null,leave:null,activate:null,deactivate:null,move:null,drop:null};return this.dropElement!==this.prevDropElement&&(this.prevDropTarget&&(i.leave={target:this.prevDropElement,dropzone:this.prevDropTarget,relatedTarget:t.target,draggable:t.interactable,dragEvent:t,interaction:this,timeStamp:t.timeStamp,type:"dragleave"},t.dragLeave=this.prevDropElement,t.prevDropzone=this.prevDropTarget),this.dropTarget&&(i.enter={target:this.dropElement,dropzone:this.dropTarget,relatedTarget:t.target,draggable:t.interactable,dragEvent:t,interaction:this,timeStamp:t.timeStamp,type:"dragenter"},t.dragEnter=this.dropElement,t.dropzone=this.dropTarget)),"dragend"===t.type&&this.dropTarget&&(i.drop={target:this.dropElement,dropzone:this.dropTarget,relatedTarget:t.target,draggable:t.interactable,dragEvent:t,interaction:this,timeStamp:t.timeStamp,type:"drop"},t.dropzone=this.dropTarget),"dragstart"===t.type&&(i.activate={target:null,dropzone:null,relatedTarget:t.target,draggable:t.interactable,dragEvent:t,interaction:this,timeStamp:t.timeStamp,type:"dropactivate"}),"dragend"===t.type&&(i.deactivate={target:null,dropzone:null,relatedTarget:t.target,draggable:t.interactable,dragEvent:t,interaction:this,timeStamp:t.timeStamp,type:"dropdeactivate"}),"dragmove"===t.type&&this.dropTarget&&(i.move={target:this.dropElement,dropzone:this.dropTarget,relatedTarget:t.target,draggable:t.interactable,dragEvent:t,interaction:this,dragmove:t,timeStamp:t.timeStamp,type:"dropmove"},t.dropzone=this.dropTarget),i},currentAction:function(){return(this.dragging?"drag":this.resizing&&"resize")||this.gesturing&&"gesture"||null},interacting:function(){return this.dragging||this.resizing||this.gesturing},clearTargets:function(){this.target=this.element=null,this.dropTarget=this.dropElement=this.prevDropTarget=this.prevDropElement=null},stop:function(e){if(this.interacting()){x.stop(),this.matches=[],this.matchElements=[];var t=this.target;t.options.styleCursor&&(t._doc.documentElement.style.cursor=""),e&&K(e.preventDefault)&&this.checkAndPreventDefault(e,t,this.element),this.dragging&&(this.activeDrops.dropzones=this.activeDrops.elements=this.activeDrops.rects=null)}this.clearTargets(),this.pointerIsDown=this.snapStatus.locked=this.dragging=this.resizing=this.gesturing=!1,this.prepared.name=this.prevEvent=null,this.inertiaStatus.resumeDx=this.inertiaStatus.resumeDy=0;for(var i=0;i<this.pointers.length;i++)-1===Ge(this.pointerIds,he(this.pointers[i]))&&this.pointers.splice(i,1)},inertiaFrame:function(){var e,t,i,o,n,s,r,a=this.inertiaStatus,l=this.target.options[this.prepared.name].inertia.resistance,c=(new Date).getTime()/1e3-a.t0;if(c<a.te){var d=1-(Math.exp(-l*c)-a.lambda_v0)/a.one_ve_v0;if(a.modifiedXe===a.xe&&a.modifiedYe===a.ye)a.sx=a.xe*d,a.sy=a.ye*d;else{var h=(e=0,t=0,i=a.xe,o=a.ye,n=a.modifiedXe,s=a.modifiedYe,{x:xe(r=d,e,i,n),y:xe(r,t,o,s)});a.sx=h.x,a.sy=h.y}this.pointerMove(a.startEvent,a.startEvent),a.i=z(this.boundInertiaFrame)}else a.ending=!0,a.sx=a.modifiedXe,a.sy=a.modifiedYe,this.pointerMove(a.startEvent,a.startEvent),this.pointerEnd(a.startEvent,a.startEvent),a.active=a.ending=!1},smoothEndFrame:function(){var e=this.inertiaStatus,t=(new Date).getTime()-e.t0,i=this.target.options[this.prepared.name].inertia.smoothEndDuration;t<i?(e.sx=ke(t,0,e.xe,i),e.sy=ke(t,0,e.ye,i),this.pointerMove(e.startEvent,e.startEvent),e.i=z(this.boundSmoothEndFrame)):(e.ending=!0,e.sx=e.xe,e.sy=e.ye,this.pointerMove(e.startEvent,e.startEvent),this.pointerEnd(e.startEvent,e.startEvent),e.smoothEnd=e.active=e.ending=!1)},addPointer:function(e){var t=he(e),i=this.mouse?0:Ge(this.pointerIds,t);return-1===i&&(i=this.pointerIds.length),this.pointerIds[i]=t,this.pointers[i]=e,i},removePointer:function(e){var t=he(e),i=this.mouse?0:Ge(this.pointerIds,t);-1!==i&&(this.pointers.splice(i,1),this.pointerIds.splice(i,1),this.downTargets.splice(i,1),this.downTimes.splice(i,1),this.holdTimers.splice(i,1))},recordPointer:function(e){var t=this.mouse?0:Ge(this.pointerIds,he(e));-1!==t&&(this.pointers[t]=e)},collectEventTargets:function(e,t,i,o){var s=this.mouse?0:Ge(this.pointerIds,he(e));if("tap"!==o||!this.pointerWasMoved&&this.downTargets[s]&&this.downTargets[s]===i){for(var r=[],a=[],l=i;l;)Ue.isSet(l)&&Ue(l)._iEvents[o]&&(r.push(Ue(l)),a.push(l)),_.forEachSelector(c),l=Ve(l);(r.length||"tap"===o)&&this.firePointers(e,t,i,r,a,o)}function c(e,t,s){var c=n?s.querySelectorAll(t):void 0;e._iEvents[o]&&Y(l)&&Te(e,l)&&!Be(e,l,i)&&Ee(e,l,i)&&Ke(l,t,c)&&(r.push(e),a.push(l))}},firePointers:function(e,t,i,o,n,s){var r,a,l,c=this.mouse?0:Ge(this.pointerIds,he(e)),d={};for("doubletap"===s?d=e:(ne(d,t),t!==e&&ne(d,e),d.preventDefault=Ie,d.stopPropagation=ze.prototype.stopPropagation,d.stopImmediatePropagation=ze.prototype.stopImmediatePropagation,d.interaction=this,d.timeStamp=(new Date).getTime(),d.originalEvent=t,d.originalPointer=e,d.type=s,d.pointerId=he(e),d.pointerType=this.mouse?"mouse":C?te(e.pointerType)?e.pointerType:[,,"touch","pen","mouse"][e.pointerType]:"touch"),"tap"===s&&(d.dt=d.timeStamp-this.downTimes[c],a=d.timeStamp-this.tapTime,l=!!(this.prevTap&&"doubletap"!==this.prevTap.type&&this.prevTap.target===d.target&&a<500),d.double=l,this.tapTime=d.timeStamp),r=0;r<o.length&&(d.currentTarget=n[r],d.interactable=o[r],o[r].fire(d),!(d.immediatePropagationStopped||d.propagationStopped&&n[r+1]!==d.currentTarget));r++);if(l){var h={};oe(h,d),h.dt=a,h.type="doubletap",this.collectEventTargets(h,t,i,"doubletap"),this.prevTap=h}else"tap"===s&&(this.prevTap=d)},validateSelector:function(e,t,i,o){for(var n=0,s=i.length;n<s;n++){var r=i[n],a=o[n],l=We(r.getAction(e,t,this,a),r);if(l&&De(r,a,l))return this.target=r,this.element=a,l}},setSnapping:function(e,t){var i,o,n,s=this.target.options[this.prepared.name].snap,r=[];if((t=t||this.snapStatus).useStatusXY)o={x:t.x,y:t.y};else{var a=be(this.target,this.element);(o=oe({},e)).x-=a.x,o.y-=a.y}t.realX=o.x,t.realY=o.y,o.x=o.x-this.inertiaStatus.resumeDx,o.y=o.y-this.inertiaStatus.resumeDy;for(var l=s.targets?s.targets.length:0,c=0;c<this.snapOffsets.length;c++){var d={x:o.x-this.snapOffsets[c].x,y:o.y-this.snapOffsets[c].y};for(n=0;n<l;n++)(i=K(s.targets[n])?s.targets[n](d.x,d.y,this):s.targets[n])&&r.push({x:Z(i.x)?i.x+this.snapOffsets[c].x:d.x,y:Z(i.y)?i.y+this.snapOffsets[c].y:d.y,range:Z(i.range)?i.range:s.range})}var h,p={target:null,inRange:!1,distance:0,range:0,dx:0,dy:0};for(n=0,l=r.length;n<l;n++){var u=(i=r[n]).range,f=i.x-o.x,m=i.y-o.y,_=g(f,m),v=_<=u;u===1/0&&p.inRange&&p.range!==1/0&&(v=!1),p.target&&!(v?p.inRange&&u!==1/0?_/u<p.distance/p.range:u===1/0&&p.range!==1/0||_<p.distance:!p.inRange&&_<p.distance)||(u===1/0&&(v=!0),p.target=i,p.distance=_,p.range=u,p.inRange=v,p.dx=f,p.dy=m,t.range=u)}return p.target?(h=t.snappedX!==p.target.x||t.snappedY!==p.target.y,t.snappedX=p.target.x,t.snappedY=p.target.y):(h=!0,t.snappedX=NaN,t.snappedY=NaN),t.dx=p.dx,t.dy=p.dy,t.changed=h||p.inRange&&!t.locked,t.locked=p.inRange,t},setRestriction:function(e,t){var i,o,n,s,r=this.target,a=r&&r.options[this.prepared.name].restrict,l=a&&a.restriction;return l?(i=i=(t=t||this.restrictStatus).useStatusXY?{x:t.x,y:t.y}:oe({},e),t.snap&&t.snap.locked&&(i.x+=t.snap.dx||0,i.y+=t.snap.dy||0),i.x-=this.inertiaStatus.resumeDx,i.y-=this.inertiaStatus.resumeDy,t.dx=0,t.dy=0,t.restricted=!1,te(l)&&!(l="parent"===l?Ve(this.element):"self"===l?r.getRect(this.element):Se(this.element,l))?t:(K(l)&&(l=l(i.x,i.y,this.element)),Y(l)&&(l=fe(l)),o=l,l?"x"in l&&"y"in l?(n=Math.max(Math.min(o.x+o.width-this.restrictOffset.right,i.x),o.x+this.restrictOffset.left),s=Math.max(Math.min(o.y+o.height-this.restrictOffset.bottom,i.y),o.y+this.restrictOffset.top)):(n=Math.max(Math.min(o.right-this.restrictOffset.right,i.x),o.left+this.restrictOffset.left),s=Math.max(Math.min(o.bottom-this.restrictOffset.bottom,i.y),o.top+this.restrictOffset.top)):(n=i.x,s=i.y),t.dx=n-i.x,t.dy=s-i.y,t.changed=t.restrictedX!==n||t.restrictedY!==s,t.restricted=!(!t.dx&&!t.dy),t.restrictedX=n,t.restrictedY=s,t)):t},checkAndPreventDefault:function(e,t,i){if(t=t||this.target){var o=t.options,n=o.preventDefault;if("auto"!==n||!i||/^(input|select|textarea)#x2F;i.test(e.target.nodeName))"always"!==n||e.preventDefault();else{if(/down|start/i.test(e.type)&&"drag"===this.prepared.name&&"xy"!==o.drag.axis)return;if(o[this.prepared.name]&&o[this.prepared.name].manualStart&&!this.interacting())return;e.preventDefault()}}},calcInertia:function(e){var t=this.target.options[this.prepared.name].inertia,i=t.resistance,o=-Math.log(t.endSpeed/e.v0)/i;e.x0=this.prevEvent.pageX,e.y0=this.prevEvent.pageY,e.t0=e.startEvent.timeStamp/1e3,e.sx=e.sy=0,e.modifiedXe=e.xe=(e.vx0-o)/i,e.modifiedYe=e.ye=(e.vy0-o)/i,e.te=o,e.lambda_v0=i/e.v0,e.one_ve_v0=1-t.endSpeed/e.v0},autoScrollMove:function(e){if(this.interacting()&&function(e,t){var i=e.options;return/^resize/.test(t)&&(t="resize"),i[t].autoScroll&&i[t].autoScroll.enabled}(this.target,this.prepared.name))if(this.inertiaStatus.active)x.x=x.y=0;else{var t,i,o,n,s=this.target.options[this.prepared.name].autoScroll,r=s.container||ue(this.element);if(X(r))n=e.clientX<x.margin,t=e.clientY<x.margin,i=e.clientX>r.innerWidth-x.margin,o=e.clientY>r.innerHeight-x.margin;else{var a=ge(r);n=e.clientX<a.left+x.margin,t=e.clientY<a.top+x.margin,i=e.clientX>a.right-x.margin,o=e.clientY>a.bottom-x.margin}x.x=i?1:n?-1:0,x.y=o?1:t?-1:0,x.isScrolling||(x.margin=s.margin,x.speed=s.speed,x.start(this))}},_updateEventTargets:function(e,t){this._eventTarget=e,this._curEventTarget=t}},ze.prototype={preventDefault:q,stopImmediatePropagation:function(){this.immediatePropagationStopped=this.propagationStopped=!0},stopPropagation:function(){this.propagationStopped=!0}};for(var L={},W=["dragStart","dragMove","resizeStart","resizeMove","gestureStart","gestureMove","pointerOver","pointerOut","pointerHover","selectorDown","pointerDown","pointerMove","pointerUp","pointerCancel","pointerEnd","addPointer","removePointer","recordPointer","autoScrollMove"],H=0,j=W.length;H<j;H++){var U=W[H];L[U]=Oe(U)}_.indexOfElement=function(e,t){t=t||a;for(var i=0;i<this.length;i++){var o=this[i];if(o.selector===e&&o._context===t||!o.selector&&o._element===e)return i}return-1},_.get=function(e,t){return this[this.indexOfElement(e,t&&t.context)]},_.forEachSelector=function(e){for(var t=0;t<this.length;t++){var i=this[t];if(i.selector){var o=e(i,i.selector,i._context,t,this);if(void 0!==o)return o}}},qe.prototype={setOnEvents:function(e,t){return"drop"===e?(K(t.ondrop)&&(this.ondrop=t.ondrop),K(t.ondropactivate)&&(this.ondropactivate=t.ondropactivate),K(t.ondropdeactivate)&&(this.ondropdeactivate=t.ondropdeactivate),K(t.ondragenter)&&(this.ondragenter=t.ondragenter),K(t.ondragleave)&&(this.ondragleave=t.ondragleave),K(t.ondropmove)&&(this.ondropmove=t.ondropmove)):(e="on"+e,K(t.onstart)&&(this[e+"start"]=t.onstart),K(t.onmove)&&(this[e+"move"]=t.onmove),K(t.onend)&&(this[e+"end"]=t.onend),K(t.oninertiastart)&&(this[e+"inertiastart"]=t.oninertiastart)),this},draggable:function(e){return Q(e)?(this.options.drag.enabled=!1!==e.enabled,this.setPerAction("drag",e),this.setOnEvents("drag",e),/^x$|^y$|^xy#x2F;.test(e.axis)?this.options.drag.axis=e.axis:null===e.axis&&delete this.options.drag.axis,this):ee(e)?(this.options.drag.enabled=e,this):this.options.drag},setPerAction:function(e,t){for(var i in t)i in b[e]&&(Q(t[i])?(this.options[e][i]=oe(this.options[e][i]||{},t[i]),Q(b.perAction[i])&&"enabled"in b.perAction[i]&&(this.options[e][i].enabled=!1!==t[i].enabled)):ee(t[i])&&Q(b.perAction[i])?this.options[e][i].enabled=t[i]:void 0!==t[i]&&(this.options[e][i]=t[i]))},dropzone:function(e){return Q(e)?(this.options.drop.enabled=!1!==e.enabled,this.setOnEvents("drop",e),/^(pointer|center)#x2F;.test(e.overlap)?this.options.drop.overlap=e.overlap:Z(e.overlap)&&(this.options.drop.overlap=Math.max(Math.min(1,e.overlap),0)),"accept"in e&&(this.options.drop.accept=e.accept),"checker"in e&&(this.options.drop.checker=e.checker),this):ee(e)?(this.options.drop.enabled=e,this):this.options.drop},dropCheck:function(e,t,i,o,n,s){var r=!1;if(!(s=s||this.getRect(n)))return!!this.options.drop.checker&&this.options.drop.checker(e,t,r,this,n,i,o);var a=this.options.drop.overlap;if("pointer"===a){var l,c,d=ce(e),h=be(i,o);d.x+=h.x,d.y+=h.y,l=d.x>s.left&&d.x<s.right,c=d.y>s.top&&d.y<s.bottom,r=l&&c}var p=i.getRect(o);if("center"===a){var u=p.left+p.width/2,g=p.top+p.height/2;r=u>=s.left&&u<=s.right&&g>=s.top&&g<=s.bottom}Z(a)&&(r=Math.max(0,Math.min(s.right,p.right)-Math.max(s.left,p.left))*Math.max(0,Math.min(s.bottom,p.bottom)-Math.max(s.top,p.top))/(p.width*p.height)>=a);return this.options.drop.checker&&(r=this.options.drop.checker(e,t,r,this,n,i,o)),r},dropChecker:function(e){return K(e)?(this.options.drop.checker=e,this):null===e?(delete this.options.getRect,this):this.options.drop.checker},accept:function(e){return Y(e)?(this.options.drop.accept=e,this):ie(e)?(this.options.drop.accept=e,this):null===e?(delete this.options.drop.accept,this):this.options.drop.accept},resizable:function(e){return Q(e)?(this.options.resize.enabled=!1!==e.enabled,this.setPerAction("resize",e),this.setOnEvents("resize",e),/^x$|^y$|^xy#x2F;.test(e.axis)?this.options.resize.axis=e.axis:null===e.axis&&(this.options.resize.axis=b.resize.axis),ee(e.preserveAspectRatio)?this.options.resize.preserveAspectRatio=e.preserveAspectRatio:ee(e.square)&&(this.options.resize.square=e.square),this):ee(e)?(this.options.resize.enabled=e,this):this.options.resize},squareResize:function(e){return ee(e)?(this.options.resize.square=e,this):null===e?(delete this.options.resize.square,this):this.options.resize.square},gesturable:function(e){return Q(e)?(this.options.gesture.enabled=!1!==e.enabled,this.setPerAction("gesture",e),this.setOnEvents("gesture",e),this):ee(e)?(this.options.gesture.enabled=e,this):this.options.gesture},autoScroll:function(e){return Q(e)?e=oe({actions:["drag","resize"]},e):ee(e)&&(e={actions:["drag","resize"],enabled:e}),this.setOptions("autoScroll",e)},snap:function(e){var t=this.setOptions("snap",e);return t===this?this:t.drag},setOptions:function(e,t){var i,o=t&&G(t.actions)?t.actions:["drag"];if(Q(t)||ee(t)){for(i=0;i<o.length;i++){var n=/resize/.test(o[i])?"resize":o[i];if(Q(this.options[n])){var s=this.options[n][e];Q(t)?(oe(s,t),s.enabled=!1!==t.enabled,"snap"===e&&("grid"===s.mode?s.targets=[Ue.createSnapGrid(oe({offset:s.gridOffset||{x:0,y:0}},s.grid||{}))]:"anchor"===s.mode?s.targets=s.anchors:"path"===s.mode&&(s.targets=s.paths),"elementOrigin"in t&&(s.relativePoints=[t.elementOrigin]))):ee(t)&&(s.enabled=t)}}return this}var r={},a=["drag","resize","gesture"];for(i=0;i<a.length;i++)e in b[a[i]]&&(r[a[i]]=this.options[a[i]][e]);return r},inertia:function(e){var t=this.setOptions("inertia",e);return t===this?this:t.drag},getAction:function(e,t,i,o){var n=this.defaultActionChecker(e,i,o);return this.options.actionChecker?this.options.actionChecker(e,t,n,this,o,i):n},defaultActionChecker:Le,actionChecker:function(e){return K(e)?(this.options.actionChecker=e,this):null===e?(delete this.options.actionChecker,this):this.options.actionChecker},getRect:function(e){return e=e||this._element,this.selector&&!Y(e)&&(e=this._context.querySelector(this.selector)),fe(e)},rectChecker:function(e){return K(e)?(this.getRect=e,this):null===e?(delete this.options.getRect,this):this.getRect},styleCursor:function(e){return ee(e)?(this.options.styleCursor=e,this):null===e?(delete this.options.styleCursor,this):this.options.styleCursor},preventDefault:function(e){return/^(always|never|auto)#x2F;.test(e)?(this.options.preventDefault=e,this):ee(e)?(this.options.preventDefault=e?"always":"never",this):this.options.preventDefault},origin:function(e){return ie(e)?(this.options.origin=e,this):Q(e)?(this.options.origin=e,this):this.options.origin},deltaSource:function(e){return"page"===e||"client"===e?(this.options.deltaSource=e,this):this.options.deltaSource},restrict:function(e){if(!Q(e))return this.setOptions("restrict",e);for(var t,i=["drag","resize","gesture"],o=0;o<i.length;o++){var n=i[o];if(n in e){var s=oe({actions:[n],restriction:e[n]},e);t=this.setOptions("restrict",s)}}return t},context:function(){return this._context},_context:a,ignoreFrom:function(e){return ie(e)?(this.options.ignoreFrom=e,this):Y(e)?(this.options.ignoreFrom=e,this):this.options.ignoreFrom},allowFrom:function(e){return ie(e)?(this.options.allowFrom=e,this):Y(e)?(this.options.allowFrom=e,this):this.options.allowFrom},element:function(){return this._element},fire:function(e){if(!e||!e.type||!Qe(A,e.type))return this;var t,i,o,n="on"+e.type;if(e.type in this._iEvents)for(i=0,o=(t=this._iEvents[e.type]).length;i<o&&!e.immediatePropagationStopped;i++)t[i].name,t[i](e);if(K(this[n])&&(this[n].name,this[n](e)),e.type in D&&(t=D[e.type]))for(i=0,o=t.length;i<o&&!e.immediatePropagationStopped;i++)t[i].name,t[i](e);return this},on:function(e,t,i){var o;if(te(e)&&-1!==e.search(" ")&&(e=e.trim().split(/ +/)),G(e)){for(o=0;o<e.length;o++)this.on(e[o],t,i);return this}if(Q(e)){for(var n in e)this.on(n,e[n],t);return this}if("wheel"===e&&(e=M),i=!!i,Qe(A,e))e in this._iEvents?this._iEvents[e].push(t):this._iEvents[e]=[t];else if(this.selector){if(!y[e])for(y[e]={selectors:[],contexts:[],listeners:[]},o=0;o<m.length;o++)N.add(m[o],e,He),N.add(m[o],e,je,!0);var s,r=y[e];for(s=r.selectors.length-1;s>=0&&(r.selectors[s]!==this.selector||r.contexts[s]!==this._context);s--);-1===s&&(s=r.selectors.length,r.selectors.push(this.selector),r.contexts.push(this._context),r.listeners.push([])),r.listeners[s].push([t,i])}else N.add(this._element,e,t,i);return this},off:function(e,t,i){var o;if(te(e)&&-1!==e.search(" ")&&(e=e.trim().split(/ +/)),G(e)){for(o=0;o<e.length;o++)this.off(e[o],t,i);return this}if(Q(e)){for(var n in e)this.off(n,e[n],t);return this}var s,r=-1;if(i=!!i,"wheel"===e&&(e=M),Qe(A,e))(s=this._iEvents[e])&&-1!==(r=Ge(s,t))&&this._iEvents[e].splice(r,1);else if(this.selector){var a=y[e],l=!1;if(!a)return this;for(r=a.selectors.length-1;r>=0;r--)if(a.selectors[r]===this.selector&&a.contexts[r]===this._context){var c=a.listeners[r];for(o=c.length-1;o>=0;o--){var d=c[o][0],h=c[o][1];if(d===t&&h===i){c.splice(o,1),c.length||(a.selectors.splice(r,1),a.contexts.splice(r,1),a.listeners.splice(r,1),N.remove(this._context,e,He),N.remove(this._context,e,je,!0),a.selectors.length||(y[e]=null)),l=!0;break}}if(l)break}}else N.remove(this._element,e,t,i);return this},set:function(e){Q(e)||(e={}),this.options=oe({},b.base);var t,i=["drag","drop","resize","gesture"],o=["draggable","dropzone","resizable","gesturable"],n=oe(oe({},b.perAction),e[s]||{});for(t=0;t<i.length;t++){var s=i[t];this.options[s]=oe({},b[s]),this.setPerAction(s,n),this[o[t]](e[s])}var r=["accept","actionChecker","allowFrom","deltaSource","dropChecker","ignoreFrom","origin","preventDefault","rectChecker","styleCursor"];for(t=0,j=r.length;t<j;t++){var a=r[t];this.options[a]=b.base[a],a in e&&this[a](e[a])}return this},unset:function(){if(N.remove(this._element,"all"),te(this.selector))for(var e in y)for(var t=y[e],i=0;i<t.selectors.length;i++){t.selectors[i]===this.selector&&t.contexts[i]===this._context&&(t.selectors.splice(i,1),t.contexts.splice(i,1),t.listeners.splice(i,1),t.selectors.length||(y[e]=null)),N.remove(this._context,e,He),N.remove(this._context,e,je,!0);break}else N.remove(this,"all"),this.options.styleCursor&&(this._element.style.cursor="");return this.dropzone(!1),_.splice(Ge(_,this),1),Ue}},qe.prototype.snap=Ye(qe.prototype.snap,"Interactable#snap is deprecated. See the new documentation for snapping at http://interactjs.io/docs/snapping"),qe.prototype.restrict=Ye(qe.prototype.restrict,"Interactable#restrict is deprecated. See the new documentation for resticting at http://interactjs.io/docs/restriction"),qe.prototype.inertia=Ye(qe.prototype.inertia,"Interactable#inertia is deprecated. See the new documentation for inertia at http://interactjs.io/docs/inertia"),qe.prototype.autoScroll=Ye(qe.prototype.autoScroll,"Interactable#autoScroll is deprecated. See the new documentation for autoScroll at http://interactjs.io/docs/#autoscroll"),qe.prototype.squareResize=Ye(qe.prototype.squareResize,"Interactable#squareResize is deprecated. See http://interactjs.io/docs/#resize-square"),qe.prototype.accept=Ye(qe.prototype.accept,"Interactable#accept is deprecated. use Interactable#dropzone({ accept: target }) instead"),qe.prototype.dropChecker=Ye(qe.prototype.dropChecker,"Interactable#dropChecker is deprecated. use Interactable#dropzone({ dropChecker: checkerFunction }) instead"),qe.prototype.context=Ye(qe.prototype.context,"Interactable#context as a method is deprecated. It will soon be a DOM Node instead"),Ue.isSet=function(e,t){return-1!==_.indexOfElement(e,t&&t.context)},Ue.on=function(e,t,i){if(te(e)&&-1!==e.search(" ")&&(e=e.trim().split(/ +/)),G(e)){for(var o=0;o<e.length;o++)Ue.on(e[o],t,i);return Ue}if(Q(e)){for(var n in e)Ue.on(n,e[n],t);return Ue}return Qe(A,e)?D[e]?D[e].push(t):D[e]=[t]:N.add(a,e,t,i),Ue},Ue.off=function(e,t,i){if(te(e)&&-1!==e.search(" ")&&(e=e.trim().split(/ +/)),G(e)){for(var o=0;o<e.length;o++)Ue.off(e[o],t,i);return Ue}if(Q(e)){for(var n in e)Ue.off(n,e[n],t);return Ue}var s;Qe(A,e)?e in D&&-1!==(s=Ge(D[e],t))&&D[e].splice(s,1):N.remove(a,e,t,i);return Ue},Ue.enableDragging=Ye(function(e){return null!=e?(P.drag=e,Ue):P.drag},"interact.enableDragging is deprecated and will soon be removed."),Ue.enableResizing=Ye(function(e){return null!=e?(P.resize=e,Ue):P.resize},"interact.enableResizing is deprecated and will soon be removed."),Ue.enableGesturing=Ye(function(e){return null!=e?(P.gesture=e,Ue):P.gesture},"interact.enableGesturing is deprecated and will soon be removed."),Ue.eventTypes=A,Ue.debug=function(){var e=v[0]||new Re;return{interactions:v,target:e.target,dragging:e.dragging,resizing:e.resizing,gesturing:e.gesturing,prepared:e.prepared,matches:e.matches,matchElements:e.matchElements,prevCoords:e.prevCoords,startCoords:e.startCoords,pointerIds:e.pointerIds,pointers:e.pointers,addPointer:L.addPointer,removePointer:L.removePointer,recordPointer:L.recordPointer,snap:e.snapStatus,restrict:e.restrictStatus,inertia:e.inertiaStatus,downTime:e.downTimes[0],downEvent:e.downEvent,downPointer:e.downPointer,prevEvent:e.prevEvent,Interactable:qe,interactables:_,pointerIsDown:e.pointerIsDown,defaultOptions:b,defaultActionChecker:Le,actionCursors:E,dragMove:L.dragMove,resizeMove:L.resizeMove,gestureMove:L.gestureMove,pointerUp:L.pointerUp,pointerDown:L.pointerDown,pointerMove:L.pointerMove,pointerHover:L.pointerHover,eventTypes:A,events:N,globalEvents:D,delegatedEvents:y,prefixedPropREs:$}},Ue.getPointerAverage=_e,Ue.getTouchBBox=ve,Ue.getTouchDistance=we,Ue.getTouchAngle=ye,Ue.getElementRect=fe,Ue.getElementClientRect=ge,Ue.matchesSelector=Ke,Ue.closest=Se,Ue.margin=Ye(function(e){return Z(e)?(S=e,Ue):S},"interact.margin is deprecated. Use interact(target).resizable({ margin: number }); instead."),Ue.supportsTouch=function(){return k},Ue.supportsPointerEvent=function(){return C},Ue.stop=function(e){for(var t=v.length-1;t>=0;t--)v[t].stop(e);return Ue},Ue.dynamicDrop=function(e){return ee(e)?(w=e,Ue):w},Ue.pointerMoveTolerance=function(e){return Z(e)?(V=e,this):V},Ue.maxInteractions=function(e){return Z(e)?(B=e,this):B},Ue.createSnapGrid=function(e){return function(t,i){var o=0,n=0;Q(e.offset)&&(o=e.offset.x,n=e.offset.y);var s=Math.round((t-o)/e.x),r=Math.round((i-n)/e.y);return{x:s*e.x+o,y:r*e.y+n,range:e.range}}},Je(a),O in Element.prototype&&K(Element.prototype[O])||(n=function(e,t,i){for(var o=0,n=(i=i||e.parentNode.querySelectorAll(t)).length;o<n;o++)if(i[o]===e)return!0;return!1}),function(){for(var e=0,t=["ms","moz","webkit","o"],o=0;o<t.length&&!i.requestAnimationFrame;++o)z=i[t[o]+"RequestAnimationFrame"],I=i[t[o]+"CancelAnimationFrame"]||i[t[o]+"CancelRequestAnimationFrame"];z||(z=function(t){var i=(new Date).getTime(),o=Math.max(0,16-(i-e)),n=setTimeout(function(){t(i+o)},o);return e=i+o,n}),I||(I=function(e){clearTimeout(e)})}(),e.exports&&(t=e.exports=Ue),t.interact=Ue}function q(){}function Y(e){if(!e||"object"!=typeof e)return!1;var t=ue(e)||r;return/object|function/.test(typeof t.Element)?e instanceof t.Element:1===e.nodeType&&"string"==typeof e.nodeName}function X(e){return e===r||!(!e||!e.Window)&&e instanceof e.Window}function J(e){return!!e&&e instanceof l}function G(e){return Q(e)&&void 0!==typeof e.length&&K(e.splice)}function Q(e){return!!e&&"object"==typeof e}function K(e){return"function"==typeof e}function Z(e){return"number"==typeof e}function ee(e){return"boolean"==typeof e}function te(e){return"string"==typeof e}function ie(e){return!!te(e)&&(a.querySelector(e),!0)}function oe(e,t){for(var i in t)e[i]=t[i];return e}function ne(e,t){for(var i in t){var o=!1;for(var n in $)if(0===i.indexOf(n)&&$[n].test(i)){o=!0;break}o||(e[i]=t[i])}return e}function se(e,t){e.page=e.page||{},e.page.x=t.page.x,e.page.y=t.page.y,e.client=e.client||{},e.client.x=t.client.x,e.client.y=t.client.y,e.timeStamp=t.timeStamp}function re(e,t,i){e.page.x=i.page.x-t.page.x,e.page.y=i.page.y-t.page.y,e.client.x=i.client.x-t.client.x,e.client.y=i.client.y-t.client.y,e.timeStamp=(new Date).getTime()-t.timeStamp;var o=Math.max(e.timeStamp/1e3,.001);e.page.speed=g(e.page.x,e.page.y)/o,e.page.vx=e.page.x/o,e.page.vy=e.page.y/o,e.client.speed=g(e.client.x,e.page.y)/o,e.client.vx=e.client.x/o,e.client.vy=e.client.y/o}function ae(e){return e instanceof r.Event||k&&r.Touch&&e instanceof r.Touch}function le(e,t,i){return e=e||"page",(i=i||{}).x=t[e+"X"],i.y=t[e+"Y"],i}function ce(e,t){return t=t||{},R&&ae(e)?(le("screen",e,t),t.x+=r.scrollX,t.y+=r.scrollY):le("page",e,t),t}function de(e,t){return t=t||{},R&&ae(e)?le("screen",e,t):le("client",e,t),t}function he(e){return Z(e.pointerId)?e.pointerId:e.identifier}function pe(e){return e instanceof h?e.correspondingUseElement:e}function ue(e){if(X(e))return e;var t=e.ownerDocument||e;return t.defaultView||t.parentWindow||r}function ge(e){var t=e instanceof c?e.getBoundingClientRect():e.getClientRects()[0];return t&&{left:t.left,right:t.right,top:t.top,bottom:t.bottom,width:t.width||t.right-t.left,height:t.height||t.bottom-t.top}}function fe(e){var t,i=ge(e);if(!F&&i){var o={x:(t=(t=ue(e))||r).scrollX||t.document.documentElement.scrollLeft,y:t.scrollY||t.document.documentElement.scrollTop};i.left+=o.x,i.right+=o.x,i.top+=o.y,i.bottom+=o.y}return i}function me(e){var t=[];return G(e)?(t[0]=e[0],t[1]=e[1]):"touchend"===e.type?1===e.touches.length?(t[0]=e.touches[0],t[1]=e.changedTouches[0]):0===e.touches.length&&(t[0]=e.changedTouches[0],t[1]=e.changedTouches[1]):(t[0]=e.touches[0],t[1]=e.touches[1]),t}function _e(e){for(var t,i={pageX:0,pageY:0,clientX:0,clientY:0,screenX:0,screenY:0},o=0;o<e.length;o++)for(t in i)i[t]+=e[o][t];for(t in i)i[t]/=e.length;return i}function ve(e){if(e.length||e.touches&&e.touches.length>1){var t=me(e),i=Math.min(t[0].pageX,t[1].pageX),o=Math.min(t[0].pageY,t[1].pageY);return{x:i,y:o,left:i,top:o,width:Math.max(t[0].pageX,t[1].pageX)-i,height:Math.max(t[0].pageY,t[1].pageY)-o}}}function we(e,t){var i=(t=t||b.deltaSource)+"X",o=t+"Y",n=me(e),s=n[0][i]-n[1][i],r=n[0][o]-n[1][o];return g(s,r)}function ye(e,t,i){var o=(i=i||b.deltaSource)+"X",n=i+"Y",s=me(e),r=s[0][o]-s[1][o],a=s[0][n]-s[1][n],l=180*Math.atan(a/r)/Math.PI;if(Z(t)){var c=(l-t)%360;c>315?l-=360+l/360|0:c>135?l-=180+l/360|0:c<-315?l+=360+l/360|0:c<-135&&(l+=180+l/360|0)}return l}function be(e,t){var i=e?e.options.origin:b.origin;return"parent"===i?i=Ve(t):"self"===i?i=e.getRect(t):ie(i)&&(i=Se(t,i)||{x:0,y:0}),K(i)&&(i=i(e&&t)),Y(i)&&(i=fe(i)),i.x="x"in i?i.x:i.left,i.y="y"in i?i.y:i.top,i}function xe(e,t,i,o){var n=1-e;return n*n*t+2*n*e*i+e*e*o}function ke(e,t,i,o){return-i*(e/=o)*(e-2)+t}function Ce(e,t){for(;t;){if(t===e)return!0;t=t.parentNode}return!1}function Se(e,t){for(var i=Ve(e);Y(i);){if(Ke(i,t))return i;i=Ve(i)}return null}function Ve(e){var t=e.parentNode;if(J(t)){for(;(t=t.host)&&J(t););return t}return t}function Te(e,t){return e._context===t.ownerDocument||Ce(e._context,t)}function Be(e,t,i){var o=e.options.ignoreFrom;return!(!o||!Y(i))&&(te(o)?Ze(i,o,t):!!Y(o)&&Ce(o,i))}function Ee(e,t,i){var o=e.options.allowFrom;return!o||!!Y(i)&&(te(o)?Ze(i,o,t):!!Y(o)&&Ce(o,i))}function Pe(e,t){if(!t)return!1;var i=t.options.drag.axis;return"xy"===e||"xy"===i||i===e}function Me(e,t){var i=e.options;return/^resize/.test(t)&&(t="resize"),i[t].snap&&i[t].snap.enabled}function Ae(e,t){var i=e.options;return/^resize/.test(t)&&(t="resize"),i[t].restrict&&i[t].restrict.enabled}function De(e,t,i){for(var o=e.options,n=o[i.name].max,s=o[i.name].maxPerElement,r=0,a=0,l=0,c=0,d=v.length;c<d;c++){var h=v[c],p=h.prepared.name;if(h.interacting()){if(++r>=B)return!1;if(h.target===e){if((a+=p===i.name|0)>=n)return!1;if(h.element===t&&(l++,p!==i.name||l>=s))return!1}}}return B>0}function Re(){if(this.target=null,this.element=null,this.dropTarget=null,this.dropElement=null,this.prevDropTarget=null,this.prevDropElement=null,this.prepared={name:null,axis:null,edges:null},this.matches=[],this.matchElements=[],this.inertiaStatus={active:!1,smoothEnd:!1,ending:!1,startEvent:null,upCoords:{},xe:0,ye:0,sx:0,sy:0,t0:0,vx0:0,vys:0,duration:0,resumeDx:0,resumeDy:0,lambda_v0:0,one_ve_v0:0,i:null},K(Function.prototype.bind))this.boundInertiaFrame=this.inertiaFrame.bind(this),this.boundSmoothEndFrame=this.smoothEndFrame.bind(this);else{var e=this;this.boundInertiaFrame=function(){return e.inertiaFrame()},this.boundSmoothEndFrame=function(){return e.smoothEndFrame()}}this.activeDrops={dropzones:[],elements:[],rects:[]},this.pointers=[],this.pointerIds=[],this.downTargets=[],this.downTimes=[],this.holdTimers=[],this.prevCoords={page:{x:0,y:0},client:{x:0,y:0},timeStamp:0},this.curCoords={page:{x:0,y:0},client:{x:0,y:0},timeStamp:0},this.startCoords={page:{x:0,y:0},client:{x:0,y:0},timeStamp:0},this.pointerDelta={page:{x:0,y:0,vx:0,vy:0,speed:0},client:{x:0,y:0,vx:0,vy:0,speed:0},timeStamp:0},this.downEvent=null,this.downPointer={},this._eventTarget=null,this._curEventTarget=null,this.prevEvent=null,this.tapTime=0,this.prevTap=null,this.startOffset={left:0,right:0,top:0,bottom:0},this.restrictOffset={left:0,right:0,top:0,bottom:0},this.snapOffsets=[],this.gesture={start:{x:0,y:0},startDistance:0,prevDistance:0,distance:0,scale:1,startAngle:0,prevAngle:0},this.snapStatus={x:0,y:0,dx:0,dy:0,realX:0,realY:0,snappedX:0,snappedY:0,targets:[],locked:!1,changed:!1},this.restrictStatus={dx:0,dy:0,restrictedX:0,restrictedY:0,snap:null,restricted:!1,changed:!1},this.restrictStatus.snap=this.snapStatus,this.pointerIsDown=!1,this.pointerWasMoved=!1,this.gesturing=!1,this.dragging=!1,this.resizing=!1,this.resizeAxes="xy",this.mouse=!1,v.push(this)}function Fe(e,t,i){var o,n=0,s=v.length,r=/mouse/i.test(e.pointerType||t)||4===e.pointerType,a=he(e);if(/down|start/i.test(t))for(n=0;n<s;n++){var l=i;if((o=v[n]).inertiaStatus.active&&o.target.options[o.prepared.name].inertia.allowResume&&o.mouse===r)for(;l;){if(l===o.element)return o;l=Ve(l)}}if(r||!k&&!C){for(n=0;n<s;n++)if(v[n].mouse&&!v[n].inertiaStatus.active)return v[n];for(n=0;n<s;n++)if(v[n].mouse&&(!/down/.test(t)||!v[n].inertiaStatus.active))return o;return(o=new Re).mouse=!0,o}for(n=0;n<s;n++)if(Qe(v[n].pointerIds,a))return v[n];if(/up|end|out/i.test(t))return null;for(n=0;n<s;n++)if((!(o=v[n]).prepared.name||o.target.options.gesture.enabled)&&!o.interacting()&&(r||!o.mouse))return o;return new Re}function Oe(e){return function(t){var i,o,n=pe(t.path?t.path[0]:t.target),s=pe(t.currentTarget);if(k&&/touch/.test(t.type))for(T=(new Date).getTime(),o=0;o<t.changedTouches.length;o++){var r=t.changedTouches[o];(i=Fe(r,t.type,n))&&(i._updateEventTargets(n,s),i[e](r,t,n,s))}else{if(!C&&/mouse/.test(t.type)){for(o=0;o<v.length;o++)if(!v[o].mouse&&v[o].pointerIsDown)return;if((new Date).getTime()-T<500)return}if(!(i=Fe(t,t.type,n)))return;i._updateEventTargets(n,s),i[e](t,t,n,s)}}}function ze(e,t,i,o,n,s){var r,a,l=e.target,c=e.snapStatus,d=e.restrictStatus,h=e.pointers,p=(l&&l.options||b).deltaSource,u=p+"X",f=p+"Y",m=l?l.options:b,_=be(l,n),v="start"===o,w="end"===o,y=v?e.startCoords:e.curCoords;n=n||e.element,a=oe({},y.page),r=oe({},y.client),a.x-=_.x,a.y-=_.y,r.x-=_.x,r.y-=_.y;var x=m[i].snap&&m[i].snap.relativePoints;!Me(l,i)||v&&x&&x.length||(this.snap={range:c.range,locked:c.locked,x:c.snappedX,y:c.snappedY,realX:c.realX,realY:c.realY,dx:c.dx,dy:c.dy},c.locked&&(a.x+=c.dx,a.y+=c.dy,r.x+=c.dx,r.y+=c.dy)),!Ae(l,i)||v&&m[i].restrict.elementRect||!d.restricted||(a.x+=d.dx,a.y+=d.dy,r.x+=d.dx,r.y+=d.dy,this.restrict={dx:d.dx,dy:d.dy}),this.pageX=a.x,this.pageY=a.y,this.clientX=r.x,this.clientY=r.y,this.x0=e.startCoords.page.x-_.x,this.y0=e.startCoords.page.y-_.y,this.clientX0=e.startCoords.client.x-_.x,this.clientY0=e.startCoords.client.y-_.y,this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.button=t.button,this.buttons=t.buttons,this.target=n,this.t0=e.downTimes[0],this.type=i+(o||""),this.interaction=e,this.interactable=l;var k=e.inertiaStatus;if(k.active&&(this.detail="inertia"),s&&(this.relatedTarget=s),w?"client"===p?(this.dx=r.x-e.startCoords.client.x,this.dy=r.y-e.startCoords.client.y):(this.dx=a.x-e.startCoords.page.x,this.dy=a.y-e.startCoords.page.y):v?(this.dx=0,this.dy=0):"inertiastart"===o?(this.dx=e.prevEvent.dx,this.dy=e.prevEvent.dy):"client"===p?(this.dx=r.x-e.prevEvent.clientX,this.dy=r.y-e.prevEvent.clientY):(this.dx=a.x-e.prevEvent.pageX,this.dy=a.y-e.prevEvent.pageY),e.prevEvent&&"inertia"===e.prevEvent.detail&&!k.active&&m[i].inertia&&m[i].inertia.zeroResumeDelta&&(k.resumeDx+=this.dx,k.resumeDy+=this.dy,this.dx=this.dy=0),"resize"===i&&e.resizeAxes?m.resize.square?("y"===e.resizeAxes?this.dx=this.dy:this.dy=this.dx,this.axes="xy"):(this.axes=e.resizeAxes,"x"===e.resizeAxes?this.dy=0:"y"===e.resizeAxes&&(this.dx=0)):"gesture"===i&&(this.touches=[h[0],h[1]],v?(this.distance=we(h,p),this.box=ve(h),this.scale=1,this.ds=0,this.angle=ye(h,void 0,p),this.da=0):w||t instanceof ze?(this.distance=e.prevEvent.distance,this.box=e.prevEvent.box,this.scale=e.prevEvent.scale,this.ds=this.scale-1,this.angle=e.prevEvent.angle,this.da=this.angle-e.gesture.startAngle):(this.distance=we(h,p),this.box=ve(h),this.scale=this.distance/e.gesture.startDistance,this.angle=ye(h,e.gesture.prevAngle,p),this.ds=this.scale-e.gesture.prevScale,this.da=this.angle-e.gesture.prevAngle)),v)this.timeStamp=e.downTimes[0],this.dt=0,this.duration=0,this.speed=0,this.velocityX=0,this.velocityY=0;else if("inertiastart"===o)this.timeStamp=e.prevEvent.timeStamp,this.dt=e.prevEvent.dt,this.duration=e.prevEvent.duration,this.speed=e.prevEvent.speed,this.velocityX=e.prevEvent.velocityX,this.velocityY=e.prevEvent.velocityY;else if(this.timeStamp=(new Date).getTime(),this.dt=this.timeStamp-e.prevEvent.timeStamp,this.duration=this.timeStamp-e.downTimes[0],t instanceof ze){var C=this[u]-e.prevEvent[u],S=this[f]-e.prevEvent[f],V=this.dt/1e3;this.speed=g(C,S)/V,this.velocityX=C/V,this.velocityY=S/V}else this.speed=e.pointerDelta[p].speed,this.velocityX=e.pointerDelta[p].vx,this.velocityY=e.pointerDelta[p].vy;if((w||"inertiastart"===o)&&e.prevEvent.speed>600&&this.timeStamp-e.prevEvent.timeStamp<150){var T=180*Math.atan2(e.prevEvent.velocityY,e.prevEvent.velocityX)/Math.PI;T<0&&(T+=360);var B=112.5<=T&&T<247.5,E=202.5<=T&&T<337.5,P=!B&&(292.5<=T||T<67.5),M=!E&&22.5<=T&&T<157.5;this.swipe={up:E,down:M,left:B,right:P,angle:T,speed:e.prevEvent.speed,velocity:{x:e.prevEvent.velocityX,y:e.prevEvent.velocityY}}}}function Ie(){this.originalEvent.preventDefault()}function Ne(e){var t="";if("drag"===e.name&&(t=E.drag),"resize"===e.name)if(e.axis)t=E[e.name+e.axis];else if(e.edges){for(var i="resize",o=["top","bottom","left","right"],n=0;n<4;n++)e.edges[o[n]]&&(i+=o[n]);t=E[i]}return t}function $e(e,t,i,o,n,s,r){if(!t)return!1;if(!0===t){var a=Z(s.width)?s.width:s.right-s.left,l=Z(s.height)?s.height:s.bottom-s.top;if(a<0&&("left"===e?e="right":"right"===e&&(e="left")),l<0&&("top"===e?e="bottom":"bottom"===e&&(e="top")),"left"===e)return i.x<(a>=0?s.left:s.right)+r;if("top"===e)return i.y<(l>=0?s.top:s.bottom)+r;if("right"===e)return i.x>(a>=0?s.right:s.left)-r;if("bottom"===e)return i.y>(l>=0?s.bottom:s.top)-r}return!!Y(o)&&(Y(t)?t===o:Ze(o,t,n))}function Le(e,t,i){var o,n=this.getRect(i),s=!1,r=null,a=null,l=oe({},t.curCoords.page),c=this.options;if(!n)return null;if(P.resize&&c.resize.enabled){var d=c.resize;if(o={left:!1,right:!1,top:!1,bottom:!1},Q(d.edges)){for(var h in o)o[h]=$e(h,d.edges[h],l,t._eventTarget,i,n,d.margin||S);o.left=o.left&&!o.right,o.top=o.top&&!o.bottom,s=o.left||o.right||o.top||o.bottom}else{var p="y"!==c.resize.axis&&l.x>n.right-S,u="x"!==c.resize.axis&&l.y>n.bottom-S;s=p||u,a=(p?"x":"")+(u?"y":"")}}return r=s?"resize":P.drag&&c.drag.enabled?"drag":null,P.gesture&&t.pointerIds.length>=2&&!t.dragging&&!t.resizing&&(r="gesture"),r?{name:r,axis:a,edges:o}:null}function We(e,t){if(!Q(e))return null;var i=e.name,o=t.options;return("resize"===i&&o.resize.enabled||"drag"===i&&o.drag.enabled||"gesture"===i&&o.gesture.enabled)&&P[i]?("resize"!==i&&"resizeyx"!==i||(i="resizexy"),e):null}function He(e,t){var i={},o=y[e.type],n=pe(e.path?e.path[0]:e.target),s=n;for(var r in t=!!t,e)i[r]=e[r];for(i.originalEvent=e,i.preventDefault=Ie;Y(s);){for(var a=0;a<o.selectors.length;a++){var l=o.selectors[a],c=o.contexts[a];if(Ke(s,l)&&Ce(c,n)&&Ce(c,s)){var d=o.listeners[a];i.currentTarget=s;for(var h=0;h<d.length;h++)d[h][1]===t&&d[h][0](i)}}s=Ve(s)}}function je(e){return He.call(this,e,!0)}function Ue(e,t){return _.get(e,t)||new qe(e,t)}function qe(e,t){var i;if(this._element=e,this._iEvents=this._iEvents||{},ie(e)){this.selector=e;var n=t&&t.context;i=n?ue(n):r,n&&(i.Node?n instanceof i.Node:Y(n)||n===i.document)&&(this._context=n)}else i=ue(e),Y(e)&&(C?(N.add(this._element,o.down,L.pointerDown),N.add(this._element,o.move,L.pointerHover)):(N.add(this._element,"mousedown",L.pointerDown),N.add(this._element,"mousemove",L.pointerHover),N.add(this._element,"touchstart",L.pointerDown),N.add(this._element,"touchmove",L.pointerHover)));this._doc=i.document,Qe(m,this._doc)||Je(this._doc),_.push(this),this.set(t)}function Ye(e,t){var i=!1;return function(){return i||(r.console.warn(t),i=!0),e.apply(this,arguments)}}function Xe(e){for(var t=0;t<v.length;t++)v[t].pointerEnd(e,e)}function Je(e){if(!Qe(m,e)){var t=e.defaultView||e.parentWindow;for(var i in y)N.add(e,i,He),N.add(e,i,je,!0);C?(o=u===t.MSPointerEvent?{up:"MSPointerUp",down:"MSPointerDown",over:"mouseover",out:"mouseout",move:"MSPointerMove",cancel:"MSPointerCancel"}:{up:"pointerup",down:"pointerdown",over:"pointerover",out:"pointerout",move:"pointermove",cancel:"pointercancel"},N.add(e,o.down,L.selectorDown),N.add(e,o.move,L.pointerMove),N.add(e,o.over,L.pointerOver),N.add(e,o.out,L.pointerOut),N.add(e,o.up,L.pointerUp),N.add(e,o.cancel,L.pointerCancel),N.add(e,o.move,L.autoScrollMove)):(N.add(e,"mousedown",L.selectorDown),N.add(e,"mousemove",L.pointerMove),N.add(e,"mouseup",L.pointerUp),N.add(e,"mouseover",L.pointerOver),N.add(e,"mouseout",L.pointerOut),N.add(e,"touchstart",L.selectorDown),N.add(e,"touchmove",L.pointerMove),N.add(e,"touchend",L.pointerUp),N.add(e,"touchcancel",L.pointerCancel),N.add(e,"mousemove",L.autoScrollMove),N.add(e,"touchmove",L.autoScrollMove)),N.add(t,"blur",Xe);try{if(t.frameElement){var n=t.frameElement.ownerDocument,s=n.defaultView;N.add(n,"mouseup",L.pointerEnd),N.add(n,"touchend",L.pointerEnd),N.add(n,"touchcancel",L.pointerEnd),N.add(n,"pointerup",L.pointerEnd),N.add(n,"MSPointerUp",L.pointerEnd),N.add(s,"blur",Xe)}}catch(e){Ue.windowParentError=e}N.add(e,"dragstart",function(e){for(var t=0;t<v.length;t++){var i=v[t];if(i.element&&(i.element===e.target||Ce(i.element,e.target)))return void i.checkAndPreventDefault(e,i.target,i.element)}}),N.useAttachEvent&&(N.add(e,"selectstart",function(e){var t=v[0];t.currentAction()&&t.checkAndPreventDefault(e)}),N.add(e,"dblclick",Oe("ie8Dblclick"))),m.push(e)}}function Ge(e,t){for(var i=0,o=e.length;i<o;i++)if(e[i]===t)return i;return-1}function Qe(e,t){return-1!==Ge(e,t)}function Ke(e,t,o){return n?n(e,t,o):(r!==i&&(t=t.replace(/\/deep\//g," ")),e[O](t))}function Ze(e,t,i){for(;Y(e);){if(Ke(e,t))return!0;if((e=Ve(e))===i)return Ke(e,t)}return!1}}("undefined"==typeof window?void 0:window)}},[[507,0,1]]]);
assets/dist/js/newsletter_editor.64becc03.chunk.js ADDED
@@ -0,0 +1,8 @@
1
+ (window.mailpoetJsonp=window.mailpoetJsonp||[]).push([[6,3],{13:function(e,t,i){e.exports=function(e,t,i){"use strict";e="default"in e?e.default:e,t="default"in t?t.default:t,i="default"in i?i.default:i;var o=function(e){return function(t){for(var i=arguments.length,o=Array(i>1?i-1:0),n=1;n<i;n++)o[n-1]=arguments[n];return e.apply(t,o)}},n=e.Model.extend,s=function e(i,o){t.isObject(i)&&(i=i.prev+" is going to be removed in the future. Please use "+i.next+" instead."+(i.url?" See: "+i.url:"")),Se.DEV_MODE&&(void 0!==o&&o||e._cache[i]||(e._warn("Deprecation warning: "+i),e._cache[i]=!0))};s._console="undefined"!=typeof console?console:{},s._warn=function(){var e=s._console.warn||s._console.log||t.noop;return e.apply(s._console,arguments)},s._cache={};var r=function(e){return document.documentElement.contains(e&&e.parentNode)},a=function(e,i){var o=this;e&&t.each(i,function(t){var i=e[t];void 0!==i&&(o[t]=i)})},l=function(e){if(e)return this.options&&void 0!==this.options[e]?this.options[e]:this[e]},c=function(e){var i=this;return t.reduce(e,function(e,o,n){return t.isFunction(o)||(o=i[o]),o&&(e[n]=o),e},{})},d=/(^|:)(\w)/gi;function h(e,t,i){return i.toUpperCase()}var p=t.memoize(function(e){return"on"+e.replace(d,h)});function u(e){for(var i=arguments.length,o=Array(i>1?i-1:0),n=1;n<i;n++)o[n-1]=arguments[n];var s=p(e),r=l.call(this,s),a=void 0;return t.isFunction(r)&&(a=r.apply(this,o)),this.trigger.apply(this,arguments),a}function g(e){for(var i=arguments.length,o=Array(i>1?i-1:0),n=1;n<i;n++)o[n-1]=arguments[n];return t.isFunction(e.triggerMethod)?e.triggerMethod.apply(e,o):u.apply(e,o)}function f(e,i,o){e._getImmediateChildren&&t.each(e._getImmediateChildren(),function(e){o(e)&&g(e,i,e)})}function m(e){return!e._isAttached}function _(e){return!!m(e)&&(e._isAttached=!0,!0)}function v(e){return e._isAttached}function w(e){return!!v(e)&&(e._isAttached=!1,!0)}function y(e){e._isAttached&&e._isRendered&&g(e,"dom:refresh",e)}function b(){f(this,"before:attach",m)}function x(){f(this,"attach",_),y(this)}function k(){f(this,"before:detach",v)}function C(){f(this,"detach",w)}function S(){y(this)}function V(e){e._areViewEventsMonitored||(e._areViewEventsMonitored=!0,e.on({"before:attach":b,attach:x,"before:detach":k,detach:C,render:S}))}var T=["description","fileName","lineNumber","name","message","number"],B=n.call(Error,{urlRoot:"http://marionettejs.com/docs/v3.2.0/",constructor:function(e,i){t.isObject(e)?e=(i=e).message:i||(i={});var o=Error.call(this,e);t.extend(this,t.pick(o,T),t.pick(i,T)),this.captureStackTrace(),i.url&&(this.url=this.urlRoot+i.url)},captureStackTrace:function(){Error.captureStackTrace&&Error.captureStackTrace(this,B)},toString:function(){return this.name+": "+this.message+(this.url?" See: "+this.url:"")}});function E(e,i,o,n){if(i&&o){if(!t.isObject(o))throw new B({message:"Bindings must be an object.",url:"marionette.functions.html#marionettebindevents"});t.each(o,function(o,s){t.isString(o)?function(e,i,o,n,s){var r=n.split(/\s+/);t.each(r,function(t){var n=e[t];if(!n)throw new B('Method "'+t+'" was configured as an event handler, but does not exist.');e[s](i,o,n)})}(e,i,s,o,n):e[n](i,s,o)})}}function P(e,t){return E(this,e,t,"listenTo"),this}function M(e,t){return E(this,e,t,"stopListening"),this}function A(e,i,o,n){if(i&&o){if(!t.isObject(o))throw new B({message:"Bindings must be an object.",url:"marionette.functions.html#marionettebindrequests"});var s=c.call(e,o);i[n](s,e)}}function D(e,t){return A(this,e,t,"reply"),this}function R(e,t){return A(this,e,t,"stopReplying"),this}B.extend=n;var F={normalizeMethods:c,_setOptions:function(){for(var e=arguments.length,i=Array(e),o=0;o<e;o++)i[o]=arguments[o];this.options=t.extend.apply(t,[{},t.result(this,"options")].concat(i))},mergeOptions:a,getOption:l,bindEvents:P,unbindEvents:M},O={_initRadio:function(){var e=t.result(this,"channelName");if(e){if(!i)throw new B({name:"BackboneRadioMissing",message:'The dependency "backbone.radio" is missing.'});var o=this._channel=i.channel(e),n=t.result(this,"radioEvents");this.bindEvents(o,n);var s=t.result(this,"radioRequests");this.bindRequests(o,s),this.on("destroy",this._destroyRadio)}},_destroyRadio:function(){this._channel.stopReplying(null,null,this)},getChannel:function(){return this._channel},bindEvents:P,unbindEvents:M,bindRequests:D,unbindRequests:R},z=["channelName","radioEvents","radioRequests"],I=function(e){this._setOptions(e),this.mergeOptions(e,z),this.cid=t.uniqueId(this.cidPrefix),this._initRadio(),this.initialize.apply(this,arguments)};I.extend=n,t.extend(I.prototype,e.Events,F,O,{cidPrefix:"mno",_isDestroyed:!1,isDestroyed:function(){return this._isDestroyed},initialize:function(){},destroy:function(){if(this._isDestroyed)return this;for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];return this.triggerMethod.apply(this,["before:destroy",this].concat(t)),this._isDestroyed=!0,this.triggerMethod.apply(this,["destroy",this].concat(t)),this.stopListening(),this},triggerMethod:u});var N={createBuffer:function(){return document.createDocumentFragment()},appendChildren:function(t,i){e.$(t).append(i)},beforeEl:function(t,i){e.$(t).before(i)},replaceEl:function(e,t){if(e!==t){var i=t.parentNode;i&&i.replaceChild(e,t)}},detachContents:function(t){e.$(t).contents().detach()},setInnerContent:function(t,i){e.$(t).html(i)},removeEl:function(t){e.$(t).remove()},findEls:function(t,i){return e.$(t,i)}},$=function(e){this.templateId=e};t.extend($,{templateCaches:{},get:function(e,t){var i=this.templateCaches[e];return i||(i=new $(e),this.templateCaches[e]=i),i.load(t)},clear:function(){for(var e=void 0,t=arguments.length,i=Array(t),o=0;o<t;o++)i[o]=arguments[o];var n=i.length;if(n>0)for(e=0;e<n;e++)delete this.templateCaches[i[e]];else this.templateCaches={}}}),t.extend($.prototype,N,{load:function(e){if(this.compiledTemplate)return this.compiledTemplate;var t=this.loadTemplate(this.templateId,e);return this.compiledTemplate=this.compileTemplate(t,e),this.compiledTemplate},loadTemplate:function(e,t){var i=this.findEls(e);if(!i.length)throw new B({name:"NoTemplateError",message:'Could not find template: "'+e+'"'});return i.html()},compileTemplate:function(e,i){return t.template(e,i)}});var L=t.invokeMap||t.invoke;function W(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t<e.length;t++)i[t]=e[t];return i}return Array.from(e)}function H(e,i){return t.chain(i).map(function(i,o){var n=function(e,i){return e.behaviorClass?e.behaviorClass:t.isFunction(e)?e:t.isFunction(Se.Behaviors.behaviorsLookup)?Se.Behaviors.behaviorsLookup(e,i)[i]:Se.Behaviors.behaviorsLookup[i]}(i,o),s=i===n?{}:i,r=new n(s,e),a=H(e,t.result(r,"behaviors"));return[r].concat(a)}).flatten().value()}var j={_initBehaviors:function(){this._behaviors=this._getBehaviors()},_getBehaviors:function(){var e=t.result(this,"behaviors");return t.isObject(e)?H(this,e):{}},_getBehaviorTriggers:function(){var e=L(this._behaviors,"getTriggers");return t.extend.apply(t,[{}].concat(W(e)))},_getBehaviorEvents:function(){var e=L(this._behaviors,"getEvents");return t.extend.apply(t,[{}].concat(W(e)))},_proxyBehaviorViewProperties:function(){L(this._behaviors,"proxyViewProperties")},_delegateBehaviorEntityEvents:function(){L(this._behaviors,"delegateEntityEvents")},_undelegateBehaviorEntityEvents:function(){L(this._behaviors,"undelegateEntityEvents")},_destroyBehaviors:function(e){L.apply(void 0,[this._behaviors,"destroy"].concat(W(e)))},_bindBehaviorUIElements:function(){L(this._behaviors,"bindUIElements")},_unbindBehaviorUIElements:function(){L(this._behaviors,"unbindUIElements")},_triggerEventOnBehaviors:function(){for(var e=this._behaviors,t=0,i=e&&e.length;t<i;t++)u.apply(e[t],arguments)}},U={_delegateEntityEvents:function(e,i){this._undelegateEntityEvents(e,i);var o=t.result(this,"modelEvents");P.call(this,e,o);var n=t.result(this,"collectionEvents");P.call(this,i,n)},_undelegateEntityEvents:function(e,i){var o=t.result(this,"modelEvents");M.call(this,e,o);var n=t.result(this,"collectionEvents");M.call(this,i,n)}},q=/^(\S+)\s*(.*)#x2F;,Y=function(e){var i=e.match(q);return function(e,i){return[e+t.uniqueId(".evt"),i].join(" ")}(i[1],i[2])},X={triggersStopPropagation:!0,triggersPreventDefault:!0};function J(e){return!!X[e]}var G={_getViewTriggers:function(e,i){return t.reduce(i,function(i,o,n){return n=Y(n),i[n]=function(e,i){t.isString(i)&&(i={event:i});var o=i.event,n=!!i.preventDefault;J("triggersPreventDefault")&&(n=!1!==i.preventDefault);var s=!!i.stopPropagation;return J("triggersStopPropagation")&&(s=!1!==i.stopPropagation),function(t){n&&t.preventDefault(),s&&t.stopPropagation(),e.triggerMethod(o,e,t)}}(e,o),i},{})}},Q=function(e,t){return e.replace(/@ui\.[a-zA-Z-_$0-9]*/g,function(e){return t[e.slice(4)]})},K={normalizeUIKeys:function(e){var i=this._getUIBindings();return function(e,i){return t.reduce(e,function(e,t,o){var n=Q(o,i);return e[n]=t,e},{})}(e,i)},normalizeUIString:function(e){var t=this._getUIBindings();return Q(e,t)},normalizeUIValues:function(e,i){var o=this._getUIBindings();return function e(i,o,n){return t.each(i,function(s,r){t.isString(s)?i[r]=Q(s,o):t.isObject(s)&&t.isArray(n)&&(t.extend(s,e(t.pick(s,n),o)),t.each(n,function(e){var i=s[e];t.isString(i)&&(s[e]=Q(i,o))}))}),i}(e,o,i)},_getUIBindings:function(){var e=t.result(this,"_uiBindings"),i=t.result(this,"ui");return e||i},_bindUIElements:function(){var e=this;if(this.ui){this._uiBindings||(this._uiBindings=this.ui);var i=t.result(this,"_uiBindings");this._ui={},t.each(i,function(t,i){e._ui[i]=e.$(t)}),this.ui=this._ui}},_unbindUIElements:function(){var e=this;this.ui&&this._uiBindings&&(t.each(this.ui,function(t,i){delete e.ui[i]}),this.ui=this._uiBindings,delete this._uiBindings,delete this._ui)},_getUI:function(e){return this._ui[e]}},Z={supportsRenderLifecycle:!0,supportsDestroyLifecycle:!0,_isDestroyed:!1,isDestroyed:function(){return!!this._isDestroyed},_isRendered:!1,isRendered:function(){return!!this._isRendered},_isAttached:!1,isAttached:function(){return!!this._isAttached},delegateEvents:function(i){this._proxyBehaviorViewProperties(),this._buildEventProxies();var o=this._getEvents(i);void 0===i&&(this.events=o);var n=t.extend({},this._getBehaviorEvents(),o,this._getBehaviorTriggers(),this.getTriggers());return e.View.prototype.delegateEvents.call(this,n),this},_getEvents:function(e){var i=e||this.events;return t.isFunction(i)?this.normalizeUIKeys(i.call(this)):this.normalizeUIKeys(i)},getTriggers:function(){if(this.triggers){var e=this.normalizeUIKeys(t.result(this,"triggers"));return this._getViewTriggers(this,e)}},delegateEntityEvents:function(){return this._delegateEntityEvents(this.model,this.collection),this._delegateBehaviorEntityEvents(),this},undelegateEntityEvents:function(){return this._undelegateEntityEvents(this.model,this.collection),this._undelegateBehaviorEntityEvents(),this},destroy:function(){if(this._isDestroyed)return this;for(var e=!!this._isAttached,t=arguments.length,i=Array(t),o=0;o<t;o++)i[o]=arguments[o];return this.triggerMethod.apply(this,["before:destroy",this].concat(i)),e&&this.triggerMethod("before:detach",this),this.unbindUIElements(),this.removeEl(this.el),e&&(this._isAttached=!1,this.triggerMethod("detach",this)),this._removeChildren(),this._destroyBehaviors(i),this._isDestroyed=!0,this._isRendered=!1,this.triggerMethod.apply(this,["destroy",this].concat(i)),this.stopListening(),this},bindUIElements:function(){return this._bindUIElements(),this._bindBehaviorUIElements(),this},unbindUIElements:function(){return this._unbindUIElements(),this._unbindBehaviorUIElements(),this},getUI:function(e){return this._getUI(e)},childViewEventPrefix:"childview",triggerMethod:function(){var e=u.apply(this,arguments);return this._triggerEventOnBehaviors.apply(this,arguments),e},_buildEventProxies:function(){this._childViewEvents=t.result(this,"childViewEvents"),this._childViewTriggers=t.result(this,"childViewTriggers")},_proxyChildViewEvents:function(e){this.listenTo(e,"all",this._childViewEventHandler)},_childViewEventHandler:function(e){for(var i=this.normalizeMethods(this._childViewEvents),o=arguments.length,n=Array(o>1?o-1:0),s=1;s<o;s++)n[s-1]=arguments[s];void 0!==i&&t.isFunction(i[e])&&i[e].apply(this,n);var r=this._childViewTriggers;r&&t.isString(r[e])&&this.triggerMethod.apply(this,[r[e]].concat(n));var a=t.result(this,"childViewEventPrefix");if(!1!==a){var l=a+":"+e;this.triggerMethod.apply(this,[l].concat(n))}}};function ee(e){e.supportsDestroyLifecycle||g(e,"before:destroy",e);var t=!!e._isAttached;t&&g(e,"before:detach",e),e.remove(),t&&(e._isAttached=!1,g(e,"detach",e)),e._isDestroyed=!0,e.supportsDestroyLifecycle||g(e,"destroy",e)}t.extend(Z,N,j,F,U,G,K);var te=["allowMissingEl","parentEl","replaceElement"],ie=I.extend({cidPrefix:"mnr",replaceElement:!1,_isReplaced:!1,constructor:function(t){if(this._setOptions(t),this.mergeOptions(t,te),this._initEl=this.el=this.getOption("el"),this.el=this.el instanceof e.$?this.el[0]:this.el,!this.el)throw new B({name:"NoElError",message:'An "el" must be specified for a region.'});this.$el=this.getEl(this.el),I.call(this,t)},show:function(e,t){if(this._ensureElement(t))return(e=this._getView(e,t))===this.currentView?this:(this.triggerMethod("before:show",this,e,t),e._isAttached||this.empty(t),this._setupChildView(e),this._renderView(e),this._attachView(e,t),this.currentView=e,this.triggerMethod("show",this,e,t),this)},_setupChildView:function(e){V(e),this._proxyChildViewEvents(e),e.on("destroy",this._empty,this)},_proxyChildViewEvents:function(e){var t=this._parentView;t&&t._proxyChildViewEvents(e)},_renderView:function(e){e._isRendered||(e.supportsRenderLifecycle||g(e,"before:render",e),e.render(),e.supportsRenderLifecycle||(e._isRendered=!0,g(e,"render",e)))},_attachView:function(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=!e._isAttached&&r(this.el),n=void 0===i.replaceElement?!!t.result(this,"replaceElement"):!!i.replaceElement;o&&g(e,"before:attach",e),n?this._replaceEl(e):this.attachHtml(e),o&&(e._isAttached=!0,g(e,"attach",e))},_ensureElement:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isObject(this.el)||(this.$el=this.getEl(this.el),this.el=this.$el[0]),!this.$el||0===this.$el.length){var i=void 0===e.allowMissingEl?!!t.result(this,"allowMissingEl"):!!e.allowMissingEl;if(i)return!1;throw new B('An "el" must exist in DOM for this region '+this.cid)}return!0},_getView:function(t){if(!t)throw new B({name:"ViewNotValid",message:"The view passed is undefined and therefore invalid. You must pass a view instance to show."});if(t._isDestroyed)throw new B({name:"ViewDestroyedError",message:'View (cid: "'+t.cid+'") has already been destroyed and cannot be used.'});if(t instanceof e.View)return t;var i=this._getViewOptions(t);return new le(i)},_getViewOptions:function(e){return t.isFunction(e)?{template:e}:t.isObject(e)?e:{template:function(){return e}}},getEl:function(e){return this.findEls(e,t.result(this,"parentEl"))},_replaceEl:function(e){this._restoreEl(),e.on("before:destroy",this._restoreEl,this),this.replaceEl(e.el,this.el),this._isReplaced=!0},_restoreEl:function(){if(this._isReplaced){var e=this.currentView;e&&(this.replaceEl(this.el,e.el),this._isReplaced=!1)}},isReplaced:function(){return!!this._isReplaced},attachHtml:function(e){this.appendChildren(this.el,e.el)},empty:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{allowMissingEl:!0},t=this.currentView;if(!t)return this._ensureElement(e)&&this.detachHtml(),this;var i=!e.preventDestroy;return i||s("The preventDestroy option is deprecated. Use Region#detachView"),this._empty(t,i),this},_empty:function(e,t){e.off("destroy",this._empty,this),this.triggerMethod("before:empty",this,e),this._restoreEl(),delete this.currentView,e._isDestroyed||(this._removeView(e,t),this._stopChildViewEvents(e)),this.triggerMethod("empty",this,e)},_stopChildViewEvents:function(e){var t=this._parentView;t&&this._parentView.stopListening(e)},_removeView:function(e,t){t?e.destroy?e.destroy():ee(e):this._detachView(e)},detachView:function(){var e=this.currentView;if(e)return this._empty(e),e},_detachView:function(e){var t=!!e._isAttached;t&&g(e,"before:detach",e),this.detachHtml(),t&&(e._isAttached=!1,g(e,"detach",e))},detachHtml:function(){this.detachContents(this.el)},hasView:function(){return!!this.currentView},reset:function(e){return this.empty(e),this.$el&&(this.el=this._initEl),delete this.$el,this},destroy:function(e){return this.reset(e),I.prototype.destroy.apply(this,arguments)}});t.extend(ie.prototype,N);var oe=function(e,i){return e instanceof ie?e:function(e,i){var o=t.extend({},i);if(t.isString(e))return t.extend(o,{el:e}),ne(o);if(t.isFunction(e))return t.extend(o,{regionClass:e}),ne(o);if(t.isObject(e))return e.selector&&s("The selector option on a Region definition object is deprecated. Use el to pass a selector string"),t.extend(o,{el:e.selector},e),ne(o);throw new B({message:"Improper region configuration type.",url:"marionette.region.html#region-configuration-types"})}(e,i)};function ne(e){var i=e.regionClass,o=t.omit(e,"regionClass");return new i(o)}var se={regionClass:ie,_initRegions:function(){this.regions=this.regions||{},this._regions={},this.addRegions(t.result(this,"regions"))},_reInitRegions:function(){L(this._regions,"reset")},addRegion:function(e,t){var i={};return i[e]=t,this.addRegions(i)[e]},addRegions:function(e){if(!t.isEmpty(e))return e=this.normalizeUIValues(e,["selector","el"]),this.regions=t.extend({},this.regions,e),this._addRegions(e)},_addRegions:function(e){var i=this,o={regionClass:this.regionClass,parentEl:t.partial(t.result,this,"el")};return t.reduce(e,function(e,t,n){return e[n]=oe(t,o),i._addRegion(e[n],n),e},{})},_addRegion:function(e,t){this.triggerMethod("before:add:region",this,t,e),e._parentView=this,this._regions[t]=e,this.triggerMethod("add:region",this,t,e)},removeRegion:function(e){var t=this._regions[e];return this._removeRegion(t,e),t},removeRegions:function(){var e=this.getRegions();return t.each(this._regions,t.bind(this._removeRegion,this)),e},_removeRegion:function(e,t){this.triggerMethod("before:remove:region",this,t,e),e.destroy(),delete this.regions[t],delete this._regions[t],this.triggerMethod("remove:region",this,t,e)},emptyRegions:function(){var e=this.getRegions();return L(e,"empty"),e},hasRegion:function(e){return!!this.getRegion(e)},getRegion:function(e){return this._regions[e]},getRegions:function(){return t.clone(this._regions)},showChildView:function(e,t){for(var i=this.getRegion(e),o=arguments.length,n=Array(o>2?o-2:0),s=2;s<o;s++)n[s-2]=arguments[s];return i.show.apply(i,[t].concat(n))},detachChildView:function(e){return this.getRegion(e).detachView()},getChildView:function(e){return this.getRegion(e).currentView}},re={render:function(e,i){if(!e)throw new B({name:"TemplateNotFoundError",message:"Cannot render the template since its false, null or undefined."});var o=t.isFunction(e)?e:$.get(e);return o(i)}},ae=["behaviors","childViewEventPrefix","childViewEvents","childViewTriggers","collectionEvents","events","modelEvents","regionClass","regions","template","templateContext","triggers","ui"],le=e.View.extend({constructor:function(i){this.render=t.bind(this.render,this),this._setOptions(i),this.mergeOptions(i,ae),V(this),this._initBehaviors(),this._initRegions();var o=Array.prototype.slice.call(arguments);o[0]=this.options,e.View.prototype.constructor.apply(this,o),this.delegateEntityEvents()},serializeData:function(){return this.model||this.collection?this.model?this.serializeModel():{items:this.serializeCollection()}:{}},serializeModel:function(){return this.model?t.clone(this.model.attributes):{}},serializeCollection:function(){return this.collection?this.collection.map(function(e){return t.clone(e.attributes)}):{}},setElement:function(){var t=!!this.el;return e.View.prototype.setElement.apply(this,arguments),t&&(this._isRendered=!!this.$el.length,this._isAttached=r(this.el)),this._isRendered&&this.bindUIElements(),this},render:function(){return this._isDestroyed?this:(this.triggerMethod("before:render",this),this._isRendered&&this._reInitRegions(),this._renderTemplate(),this.bindUIElements(),this._isRendered=!0,this.triggerMethod("render",this),this)},_renderTemplate:function(){var e=this.getTemplate();if(!1!==e){var t=this.mixinTemplateContext(this.serializeData()),i=re.render(e,t,this);this.attachElContent(i)}},getTemplate:function(){return this.template},mixinTemplateContext:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.result(this,"templateContext");return t.extend(e,i)},attachElContent:function(e){return this.setInnerContent(this.el,e),this},_removeChildren:function(){this.removeRegions()},_getImmediateChildren:function(){return t.chain(this.getRegions()).map("currentView").compact().value()}});t.extend(le.prototype,Z,se);var ce,de,he=["forEach","each","map","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","toArray","first","initial","rest","last","without","isEmpty","pluck","reduce"],pe=function(e){this._views={},this._indexByModel={},this._indexByCustom={},this._updateLength(),t.each(e,t.bind(this.add,this))};ce=pe.prototype,de="_views",t.each(he,function(e){ce[e]=function(){var i=t.values(t.result(this,de)),o=[i].concat(t.toArray(arguments));return t[e].apply(t,o)}}),t.extend(pe.prototype,{add:function(e,t){return this._add(e,t)._updateLength()},_add:function(e,t){var i=e.cid;return this._views[i]=e,e.model&&(this._indexByModel[e.model.cid]=i),t&&(this._indexByCustom[t]=i),this},findByModel:function(e){return this.findByModelCid(e.cid)},findByModelCid:function(e){var t=this._indexByModel[e];return this.findByCid(t)},findByCustom:function(e){var t=this._indexByCustom[e];return this.findByCid(t)},findByIndex:function(e){return t.values(this._views)[e]},findByCid:function(e){return this._views[e]},remove:function(e){return this._remove(e)._updateLength()},_remove:function(e){var i=e.cid;return e.model&&delete this._indexByModel[e.model.cid],t.some(this._indexByCustom,t.bind(function(e,t){if(e===i)return delete this._indexByCustom[t],!0},this)),delete this._views[i],this},_updateLength:function(){return this.length=t.size(this._views),this}});var ue=["behaviors","childView","childViewEventPrefix","childViewEvents","childViewOptions","childViewTriggers","collectionEvents","events","filter","emptyView","emptyViewOptions","modelEvents","reorderOnSort","sort","triggers","ui","viewComparator"],ge=e.View.extend({sort:!0,constructor:function(i){this.render=t.bind(this.render,this),this._setOptions(i),this.mergeOptions(i,ue),V(this),this._initBehaviors(),this.once("render",this._initialEvents),this._initChildViewStorage(),this._bufferedChildren=[];var o=Array.prototype.slice.call(arguments);o[0]=this.options,e.View.prototype.constructor.apply(this,o),this.delegateEntityEvents()},_startBuffering:function(){this._isBuffering=!0},_endBuffering:function(){var e=!!this._isAttached,i=e?this._getImmediateChildren():[];this._isBuffering=!1,t.each(i,function(e){g(e,"before:attach",e)}),this.attachBuffer(this,this._createBuffer()),t.each(i,function(e){e._isAttached=!0,g(e,"attach",e)}),this._bufferedChildren=[]},_getImmediateChildren:function(){return t.values(this.children._views)},_initialEvents:function(){this.collection&&(this.listenTo(this.collection,"add",this._onCollectionAdd),this.listenTo(this.collection,"update",this._onCollectionUpdate),this.listenTo(this.collection,"reset",this.render),this.sort&&this.listenTo(this.collection,"sort",this._sortViews))},_onCollectionAdd:function(e,i,o){var n=void 0!==o.at&&(o.index||i.indexOf(e));(this.filter||!1===n)&&(n=t.indexOf(this._filteredSortedModels(n),e)),this._shouldAddChild(e,n)&&(this._destroyEmptyView(),this._addChild(e,n))},_onCollectionUpdate:function(e,t){var i=t.changes;this._removeChildModels(i.removed)},_removeChildModels:function(e){var t=this._getRemovedViews(e);t.length&&(this.children._updateLength(),this._updateIndices(t,!1),this.isEmpty()&&this._showEmptyView())},_getRemovedViews:function(e){var i=this;return t.reduce(e,function(e,t){var o=t&&i.children.findByModel(t);return!o||o._isDestroyed?e:(i._removeChildView(o),e.push(o),e)},[])},_removeChildView:function(e){this.triggerMethod("before:remove:child",this,e),this.children._remove(e),e.destroy?e.destroy():ee(e),this.stopListening(e),this.triggerMethod("remove:child",this,e)},setElement:function(){var t=!!this.el;return e.View.prototype.setElement.apply(this,arguments),t&&(this._isAttached=r(this.el)),this},render:function(){return this._isDestroyed?this:(this.triggerMethod("before:render",this),this._renderChildren(),this._isRendered=!0,this.triggerMethod("render",this),this)},setFilter:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=t.preventRender,o=this._isRendered&&!this._isDestroyed,n=this.filter!==e,s=o&&n&&!i;if(s){var r=this._filteredSortedModels();this.filter=e;var a=this._filteredSortedModels();this._applyModelDeltas(a,r)}else this.filter=e;return this},removeFilter:function(e){return this.setFilter(null,e)},_applyModelDeltas:function(e,i){var o=this,n={};t.each(e,function(e,t){var i=!o.children.findByModel(e);i&&o._onCollectionAdd(e,o.collection,{at:t}),n[e.cid]=!0});var s=t.filter(i,function(e){return!n[e.cid]&&o.children.findByModel(e)});this._removeChildModels(s)},reorder:function(){var e=this,i=this.children,o=this._filteredSortedModels();if(!o.length&&this._showingEmptyView)return this;var n,s,r=t.some(o,function(e){return!i.findByModel(e)});return r?this.render():(n=[],s=i.reduce(function(e,i){var s=t.indexOf(o,i.model);return-1===s?(n.push(i.model),e):(i._index=s,e[s]=i.el,e)},new Array(o.length)),e.triggerMethod("before:reorder",e),e._appendReorderedChildren(s),e._removeChildModels(n),e.triggerMethod("reorder",e)),this},resortView:function(){return this.reorderOnSort?this.reorder():this._renderChildren(),this},_sortViews:function(){var e=this,i=this._filteredSortedModels(),o=t.find(i,function(t,i){var o=e.children.findByModel(t);return!o||o._index!==i});o&&this.resortView()},_emptyViewIndex:-1,_appendReorderedChildren:function(e){this.appendChildren(this.el,e)},_renderChildren:function(){this._isRendered&&(this._destroyEmptyView(),this._destroyChildren());var e=this._filteredSortedModels();this.isEmpty({processedModels:e})?this._showEmptyView():(this.triggerMethod("before:render:children",this),this._startBuffering(),this._showCollection(e),this._endBuffering(),this.triggerMethod("render:children",this))},_createView:function(e,t){var i=this._getChildView(e),o=this._getChildViewOptions(e,t),n=this.buildChildView(e,i,o);return n},_setupChildView:function(e,t){V(e),this._proxyChildViewEvents(e),this.sort&&(e._index=t)},_showCollection:function(e){t.each(e,t.bind(this._addChild,this)),this.children._updateLength()},_filteredSortedModels:function(e){if(!this.collection||!this.collection.length)return[];var t=this.getViewComparator(),i=this.collection.models;if(e=Math.min(Math.max(e,0),i.length-1),t){var o=void 0;e&&(o=i[e],i=i.slice(0,e).concat(i.slice(e+1))),i=this._sortModelsBy(i,t),o&&i.splice(e,0,o)}return i=this._filterModels(i)},getViewComparator:function(){return this.viewComparator},_filterModels:function(e){var i=this;return this.filter&&(e=t.filter(e,function(e,t){return i._shouldAddChild(e,t)})),e},_sortModelsBy:function(e,i){return"string"==typeof i?t.sortBy(e,function(e){return e.get(i)}):1===i.length?t.sortBy(e,t.bind(i,this)):t.clone(e).sort(t.bind(i,this))},_showEmptyView:function(){var i=this._getEmptyView();if(i&&!this._showingEmptyView){this._showingEmptyView=!0;var o=new e.Model,n=this.emptyViewOptions||this.childViewOptions;t.isFunction(n)&&(n=n.call(this,o,this._emptyViewIndex));var s=this.buildChildView(o,i,n);this.triggerMethod("before:render:empty",this,s),this.addChildView(s,0),this.triggerMethod("render:empty",this,s)}},_destroyEmptyView:function(){this._showingEmptyView&&(this.triggerMethod("before:remove:empty",this),this._destroyChildren(),delete this._showingEmptyView,this.triggerMethod("remove:empty",this))},_getEmptyView:function(){var e=this.emptyView;if(e)return this._getView(e)},_getChildView:function(e){var t=this.childView;if(!t)throw new B({name:"NoChildViewError",message:'A "childView" must be specified'});if(!(t=this._getView(t,e)))throw new B({name:"InvalidChildViewError",message:'"childView" must be a view class or a function that returns a view class'});return t},_getView:function(i,o){return i.prototype instanceof e.View||i===e.View?i:t.isFunction(i)?i.call(this,o):void 0},_addChild:function(e,t){var i=this._createView(e,t);return this.addChildView(i,t),i},_getChildViewOptions:function(e,i){return t.isFunction(this.childViewOptions)?this.childViewOptions(e,i):this.childViewOptions},addChildView:function(e,t){return this.triggerMethod("before:add:child",this,e),this._setupChildView(e,t),this._isBuffering?this.children._add(e):(this._updateIndices(e,!0),this.children.add(e)),this._renderView(e),this._attachView(e,t),this.triggerMethod("add:child",this,e),e},_updateIndices:function(e,i){if(this.sort)if(i){var o=t.isArray(e)?t.max(e,"_index"):e;t.isObject(o)&&this.children.each(function(e){e._index>=o._index&&(e._index+=1)})}else t.each(t.sortBy(this.children._views,"_index"),function(e,t){e._index=t})},_renderView:function(e){e._isRendered||(e.supportsRenderLifecycle||g(e,"before:render",e),e.render(),e.supportsRenderLifecycle||(e._isRendered=!0,g(e,"render",e)))},_attachView:function(e,t){var i=!e._isAttached&&!this._isBuffering&&this._isAttached;i&&g(e,"before:attach",e),this.attachHtml(this,e,t),i&&(e._isAttached=!0,g(e,"attach",e))},buildChildView:function(e,i,o){var n=t.extend({model:e},o);return new i(n)},removeChildView:function(e){return!e||e._isDestroyed?e:(this._removeChildView(e),this.children._updateLength(),this._updateIndices(e,!1),e)},isEmpty:function(e){var i=void 0;return t.result(e,"processedModels")?i=e.processedModels:(i=this.collection?this.collection.models:[],i=this._filterModels(i)),0===i.length},attachBuffer:function(e,t){this.appendChildren(e.el,t)},_createBuffer:function(){var e=this,i=this.createBuffer();return t.each(this._bufferedChildren,function(t){e.appendChildren(i,t.el)}),i},attachHtml:function(e,t,i){e._isBuffering?e._bufferedChildren.splice(i,0,t):e._insertBefore(t,i)||e._insertAfter(t)},_insertBefore:function(e,t){var i=void 0,o=this.sort&&t<this.children.length-1;return o&&(i=this.children.find(function(e){return e._index===t+1})),!!i&&(this.beforeEl(i.el,e.el),!0)},_insertAfter:function(e){this.appendChildren(this.el,e.el)},_initChildViewStorage:function(){this.children=new pe},_removeChildren:function(){this._destroyChildren()},_destroyChildren:function(e){this.children.length&&(this.triggerMethod("before:destroy:children",this),this.children.each(t.bind(this._removeChildView,this)),this.children._updateLength(),this.triggerMethod("destroy:children",this))},_shouldAddChild:function(e,i){var o=this.filter;return!t.isFunction(o)||o.call(this,e,i,this.collection)}});t.extend(ge.prototype,Z);var fe=["childViewContainer","template","templateContext"],me=ge.extend({constructor:function(e){s("CompositeView is deprecated. Convert to View at your earliest convenience"),this.mergeOptions(e,fe),ge.prototype.constructor.apply(this,arguments)},_initialEvents:function(){this.collection&&(this.listenTo(this.collection,"add",this._onCollectionAdd),this.listenTo(this.collection,"update",this._onCollectionUpdate),this.listenTo(this.collection,"reset",this.renderChildren),this.sort&&this.listenTo(this.collection,"sort",this._sortViews))},_getChildView:function(e){var t=this.childView;if(!t)return this.constructor;if(!(t=this._getView(t,e)))throw new B({name:"InvalidChildViewError",message:'"childView" must be a view class or a function that returns a view class'});return t},serializeData:function(){return this.serializeModel()},render:function(){return this._isDestroyed?this:(this._isRendering=!0,this.resetChildViewContainer(),this.triggerMethod("before:render",this),this._renderTemplate(),this.bindUIElements(),this.renderChildren(),this._isRendering=!1,this._isRendered=!0,this.triggerMethod("render",this),this)},renderChildren:function(){(this._isRendered||this._isRendering)&&ge.prototype._renderChildren.call(this)},attachBuffer:function(e,t){var i=this.getChildViewContainer(e);this.appendChildren(i,t)},_insertAfter:function(e){var t=this.getChildViewContainer(this,e);this.appendChildren(t,e.el)},_appendReorderedChildren:function(e){var t=this.getChildViewContainer(this);this.appendChildren(t,e)},getChildViewContainer:function(e,i){if(e.$childViewContainer)return e.$childViewContainer;var o=void 0,n=e.childViewContainer;if(n){var s=t.result(e,"childViewContainer");if((o="@"===s.charAt(0)&&e.ui?e.ui[s.substr(4)]:this.findEls(s,e.$el)).length<=0)throw new B({name:"ChildViewContainerMissingError",message:'The specified "childViewContainer" was not found: '+e.childViewContainer})}else o=e.$el;return e.$childViewContainer=o,o},resetChildViewContainer:function(){this.$childViewContainer&&(this.$childViewContainer=void 0)}}),_e=t.pick(le.prototype,"serializeModel","getTemplate","_renderTemplate","mixinTemplateContext","attachElContent");t.extend(me.prototype,_e);var ve=["collectionEvents","events","modelEvents","triggers","ui"],we=I.extend({cidPrefix:"mnb",constructor:function(e,i){this.view=i,this.defaults=t.clone(t.result(this,"defaults",{})),this._setOptions(this.defaults,e),this.mergeOptions(this.options,ve),this.ui=t.extend({},t.result(this,"ui"),t.result(i,"ui")),I.apply(this,arguments)},$:function(){return this.view.$.apply(this.view,arguments)},destroy:function(){return this.stopListening(),this},proxyViewProperties:function(){return this.$el=this.view.$el,this.el=this.view.el,this},bindUIElements:function(){return this._bindUIElements(),this},unbindUIElements:function(){return this._unbindUIElements(),this},getUI:function(e){return this._getUI(e)},delegateEntityEvents:function(){return this._delegateEntityEvents(this.view.model,this.view.collection),this},undelegateEntityEvents:function(){return this._undelegateEntityEvents(this.view.model,this.view.collection),this},getEvents:function(){var e=this,i=this.normalizeUIKeys(t.result(this,"events"));return t.reduce(i,function(i,o,n){if(t.isFunction(o)||(o=e[o]),o)return n=Y(n),i[n]=t.bind(o,e),i},{})},getTriggers:function(){if(this.triggers){var e=this.normalizeUIKeys(t.result(this,"triggers"));return this._getViewTriggers(this.view,e)}}});t.extend(we.prototype,U,G,K);var ye=["region","regionClass"],be=I.extend({cidPrefix:"mna",constructor:function(e){this._setOptions(e),this.mergeOptions(e,ye),this._initRegion(),I.prototype.constructor.apply(this,arguments)},regionClass:ie,_initRegion:function(){var e=this.region;if(e){var t={regionClass:this.regionClass};this._region=oe(e,t)}},getRegion:function(){return this._region},showView:function(e){for(var t=this.getRegion(),i=arguments.length,o=Array(i>1?i-1:0),n=1;n<i;n++)o[n-1]=arguments[n];return t.show.apply(t,[e].concat(o))},getView:function(){return this.getRegion().currentView},start:function(e){return this.triggerMethod("before:start",this,e),this.triggerMethod("start",this,e),this}}),xe=["appRoutes","controller"],ke=e.Router.extend({constructor:function(t){this._setOptions(t),this.mergeOptions(t,xe),e.Router.apply(this,arguments);var i=this.appRoutes,o=this._getController();this.processAppRoutes(o,i),this.on("route",this._processOnRoute,this)},appRoute:function(e,t){var i=this._getController();return this._addAppRoute(i,e,t),this},_processOnRoute:function(e,i){if(t.isFunction(this.onRoute)){var o=t.invert(this.appRoutes)[e];this.onRoute(e,o,i)}},processAppRoutes:function(e,i){var o=this;if(!i)return this;var n=t.keys(i).reverse();return t.each(n,function(t){o._addAppRoute(e,t,i[t])}),this},_getController:function(){return this.controller},_addAppRoute:function(e,i,o){var n=e[o];if(!n)throw new B('Method "'+o+'" was not found on the controller');this.route(i,o,t.bind(n,e))},triggerMethod:u});t.extend(ke.prototype,F);var Ce=e.Marionette,Se=e.Marionette={};return Se.noConflict=function(){return e.Marionette=Ce,this},Se.bindEvents=o(P),Se.unbindEvents=o(M),Se.bindRequests=o(D),Se.unbindRequests=o(R),Se.mergeOptions=o(a),Se.getOption=o(l),Se.normalizeMethods=o(c),Se.extend=n,Se.isNodeAttached=r,Se.deprecate=s,Se.triggerMethod=o(u),Se.triggerMethodOn=g,Se.isEnabled=J,Se.setEnabled=function(e,t){return X[e]=t},Se.monitorViewEvents=V,Se.Behaviors={},Se.Behaviors.behaviorsLookup=function(){throw new B({message:"You must define where your behaviors are stored.",url:"marionette.behaviors.md#behaviorslookup"})},Se.Application=be,Se.AppRouter=ke,Se.Renderer=re,Se.TemplateCache=$,Se.View=le,Se.CollectionView=ge,Se.CompositeView=me,Se.Behavior=we,Se.Region=ie,Se.Error=B,Se.Object=I,Se.DEV_MODE=!1,Se.FEATURES=X,Se.VERSION="3.2.0",Se}(i(26),i(4),i(90))},250:function(e,t,i){e.exports=i(503)},3:function(e,t){e.exports=jQuery},30:function(e,t){Backbone.SuperModel=function(e,t){var i=function(t){return e.isString(t)&&(t=t.split(".")),t},o=function(e,t,o){t=i(t),lastKeyIndex=t.length-1;for(var n=0;n<lastKeyIndex;++n)key=t[n],key in e||(e[key]={}),e=e[key];o(e,t[lastKeyIndex])},n=function(o,s,r){s=i(s);var a=e.first(s),l=o.get(a);l instanceof t.Model&&n(l,e.rest(s),r),r(o,s)},s=function(t,i,o){var n;i&&(n=e.result(t,"relations")[i]);return o&&!n&&(n=a),null==n&&(n=a),n},r=function(t,i,o){var n=e.result(t,"name");return n&&!i[n]&&(i[n]=t),i},a=t.Model.extend({relations:{},unsafeAttributes:[],name:null,_valueForCollection:function(t){return!!e.isArray(t)&&(!(t.length>=1)||e.isObject(t[0]))},_nestedSet:function(i,o,n){for(var c=(i=i.split(".")).length-1,d=this,h=0;h<c;++h){var p=i[h];if(!d.attributes[p]){var u=new(s(d,p,o));d.attributes[p]=r(d,u)}d=d.attributes[p]}var g=i[c];if(!e.isArray(o)&&e.isObject(o)&&function(e){return e.constructor===Object}(o))if(0===e.size(o))d.attributes[g]=new a;else for(var f in o){var m=g+"."+f;d._nestedSet(m,o[f],n)}else if(this._valueForCollection(o)){var _=s(d,g,o);_.prototype instanceof t.Model&&(_=l);var v=new _(o);v=r(d,v),d.attributes[g]=v}else 1==i.length?d.attributes[g]=o:d.set(g,o,e.extend({skipNested:!0,forceChange:!0},n));n.silent||function(t){for(var i=t.length-1;i>=0;i--){var o=t.slice(0,i),n=t.slice(i);if(1!=n.length){var s=this;(o=o.join(".")).length>0&&(s=this.get(o));for(var r=e.first(n),a=e.rest(n),l=[r],c=0;c<a.length;c++)r=[r,a[c]].join("."),l.push(r);for(var d=0;d<l.length;d++){var h=l[d],p=s.trigger;p&&e.isFunction(p)&&p.call(s,"change:"+h,s,s.get(h))}}}}.call(this,i)},_setChanging:function(){this._previousAttributes=this.toJSON(),this.changed={}},_triggerChanges:function(e,t,i){e.length&&(this._pending=!0);for(var o=0,n=e.length;o<n;o++)i||(i=this.get(e[o])),1==e[o].split(".").length&&this.trigger("change:"+e[o],this,i,t)},_setChange:function(t,i,n){var s,r,a=this.get(t);return t=t.split("."),!e.isEqual(a,i)||n.forceChange?(s=this.changed,r=i,o(s,t,function(e,t){e[t]=r}),!0):(function(e,t){o(e,t,function(e,t){delete e[t]})}(this.changed,t),!1)},set:function(e,t,i){var o,s,r,a,l,c,d;if(null==e)return this;if("object"==typeof e?(s=e,i=t):(s={})[e]=t,i=i||{},!this._validate(s,i))return!1;r=i.unset,l=i.silent,a=[],c=this._changing,d=i.skipNested,this._changing=!0,c||this._setChanging(),this.idAttribute in s&&(this.id=s[this.idAttribute]);var h=function(e,t){delete e.attributes[t]};for(o in s)t=s[o],this._setChange(o,t,i)&&a.push(o),r?n(this,o,h):d?this.attributes[o]=t:this._nestedSet(o,t,i);if(l||this._triggerChanges(a,i),c)return this;if(!l)for(;this._pending;)this._pending=!1,this.trigger("change",this,i);return this._pending=!1,this._changing=!1,this},get:function(t){var i=t?t.split("."):[];if(i.length>1){var o=this.attributes[e.first(i)];if(!o)return;var n=e.rest(i).join(".");return e.isFunction(o.get)?o.get(n):o[n]}return this.attributes[t]},toJSON:function(t){t=t||{};var i=e.result(this,"unsafeAttributes");t.except&&(i=e.union(i,t.except));var o=e.clone(this.attributes);return e.each(i,function(e){delete o[e]}),e.each(o,function(t,i){t&&e.isFunction(t.toJSON)&&(o[i]=t.toJSON())}),o},hasChanged:function(t){return null==t?!e.isEmpty(this.changed):(i=this.changed,n=!1,o(i,t,function(t,i){n=e.has(t,i)}),n);var i,n},previous:function(e){return null!=e&&this._previousAttributes?function(e,t,o){for(var n=(t=i(t)).length,s=0;s<n;s++){if(!e||"object"!=typeof e)return o;e=e[t[s]]}return void 0===e?o:e}(this._previousAttributes,e):null},clear:function(e){for(var i in this.id=void 0,this.attributes){var o=this.attributes[i];o instanceof t.Model?o.clear():o instanceof t.Collection?o.reset():this.unset(i)}return this}}),l=t.Collection.extend({model:a});return a}(_,Backbone),e.exports=Backbone.SuperModel},395:function(e,t){
2
+ /*! @source http://purl.eligrey.com/github/Blob.js/blob/master/Blob.js */
3
+ !function(e){"use strict";if(e.URL=e.URL||e.webkitURL,e.Blob&&e.URL)try{return void new Blob}catch(e){}var t=e.BlobBuilder||e.WebKitBlobBuilder||e.MozBlobBuilder||function(e){var t=function(e){return Object.prototype.toString.call(e).match(/^\[object\s(.*)\]#x2F;)[1]},i=function(){this.data=[]},o=function(e,t,i){this.data=e,this.size=e.length,this.type=t,this.encoding=i},n=i.prototype,s=o.prototype,r=e.FileReaderSync,a=function(e){this.code=this[this.name=e]},l="NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR".split(" "),c=l.length,d=e.URL||e.webkitURL||e,h=d.createObjectURL,p=d.revokeObjectURL,u=d,g=e.btoa,f=e.atob,m=e.ArrayBuffer,_=e.Uint8Array,v=/^[\w-]+:\/*\[?[\w\.:-]+\]?(?::[0-9]+)?/;for(o.fake=s.fake=!0;c--;)a.prototype[l[c]]=c+1;return d.createObjectURL||(u=e.URL=function(e){var t,i=document.createElementNS("http://www.w3.org/1999/xhtml","a");return i.href=e,"origin"in i||("data:"===i.protocol.toLowerCase()?i.origin=null:(t=e.match(v),i.origin=t&&t[1])),i}),u.createObjectURL=function(e){var t,i=e.type;return null===i&&(i="application/octet-stream"),e instanceof o?(t="data:"+i,"base64"===e.encoding?t+";base64,"+e.data:"URI"===e.encoding?t+","+decodeURIComponent(e.data):g?t+";base64,"+g(e.data):t+","+encodeURIComponent(e.data)):h?h.call(d,e):void 0},u.revokeObjectURL=function(e){"data:"!==e.substring(0,5)&&p&&p.call(d,e)},n.append=function(e){var i=this.data;if(_&&(e instanceof m||e instanceof _)){for(var n="",s=new _(e),l=0,c=s.length;l<c;l++)n+=String.fromCharCode(s[l]);i.push(n)}else if("Blob"===t(e)||"File"===t(e)){if(!r)throw new a("NOT_READABLE_ERR");var d=new r;i.push(d.readAsBinaryString(e))}else e instanceof o?"base64"===e.encoding&&f?i.push(f(e.data)):"URI"===e.encoding?i.push(decodeURIComponent(e.data)):"raw"===e.encoding&&i.push(e.data):("string"!=typeof e&&(e+=""),i.push(unescape(encodeURIComponent(e))))},n.getBlob=function(e){return arguments.length||(e=null),new o(this.data.join(""),e,"raw")},n.toString=function(){return"[object BlobBuilder]"},s.slice=function(e,t,i){var n=arguments.length;return n<3&&(i=null),new o(this.data.slice(e,n>1?t:this.data.length),i,this.encoding)},s.toString=function(){return"[object Blob]"},s.close=function(){this.size=0,delete this.data},i}(e);e.Blob=function(e,i){var o=i&&i.type||"",n=new t;if(e)for(var s=0,r=e.length;s<r;s++)Uint8Array&&e[s]instanceof Uint8Array?n.append(e[s].buffer):n.append(e[s]);var a=n.getBlob(o);return!a.slice&&a.webkitSlice&&(a.slice=a.webkitSlice),a};var i=Object.getPrototypeOf||function(e){return e.__proto__};e.Blob.prototype=i(new e.Blob)}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||this.content||this),e.exports=window.Blob},396:function(e,t,i){var o,n=n||function(e){"use strict";if(!(void 0===e||"undefined"!=typeof navigator&&/MSIE [1-9]\./.test(navigator.userAgent))){var t=e.document,i=function(){return e.URL||e.webkitURL||e},o=t.createElementNS("http://www.w3.org/1999/xhtml","a"),n="download"in o,s=/constructor/i.test(e.HTMLElement)||e.safari,r=/CriOS\/[\d]+/.test(navigator.userAgent),a=function(t){(e.setImmediate||e.setTimeout)(function(){throw t},0)},l=function(e){setTimeout(function(){"string"==typeof e?i().revokeObjectURL(e):e.remove()},4e4)},c=function(e){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e},d=function(t,d,h){h||(t=c(t));var p,u=this,g="application/octet-stream"===t.type,f=function(){!function(e,t,i){for(var o=(t=[].concat(t)).length;o--;){var n=e["on"+t[o]];if("function"==typeof n)try{n.call(e,i||e)}catch(e){a(e)}}}(u,"writestart progress write writeend".split(" "))};if(u.readyState=u.INIT,n)return p=i().createObjectURL(t),void setTimeout(function(){var e,t;o.href=p,o.download=d,e=o,t=new MouseEvent("click"),e.dispatchEvent(t),f(),l(p),u.readyState=u.DONE});!function(){if((r||g&&s)&&e.FileReader){var o=new FileReader;return o.onloadend=function(){var t=r?o.result:o.result.replace(/^data:[^;]*;/,"data:attachment/file;");e.open(t,"_blank")||(e.location.href=t),t=void 0,u.readyState=u.DONE,f()},o.readAsDataURL(t),void(u.readyState=u.INIT)}p||(p=i().createObjectURL(t)),g?e.location.href=p:e.open(p,"_blank")||(e.location.href=p);u.readyState=u.DONE,f(),l(p)}()},h=d.prototype;return"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob?function(e,t,i){return t=t||e.name||"download",i||(e=c(e)),navigator.msSaveOrOpenBlob(e,t)}:(h.abort=function(){},h.readyState=h.INIT=0,h.WRITING=1,h.DONE=2,h.error=h.onwritestart=h.onprogress=h.onwrite=h.onabort=h.onerror=h.onwriteend=null,function(e,t,i){return new d(e,t||e.name||"download",i)})}}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||this.content);
4
+ /*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */e.exports?e.exports.saveAs=n:null!==i(500)&&null!==i(501)&&(void 0===(o=function(){return n}.call(t,i,t,e))||(e.exports=o))},498:function(e,t){
5
+ /**
6
+ @license Sticky-kit v1.1.2 | WTFPL | Leaf Corcoran 2015 | http://leafo.net
7
+ */
8
+ (function(){var e,t;e=this.jQuery||window.jQuery,t=e(window),e.fn.stick_in_parent=function(i){var o,n,s,r,a,l,c,d,h,p,u,g,f;for(null==i&&(i={}),f=i.sticky_class,l=i.inner_scrolling,g=i.recalc_every,u=i.parent,h=i.offset_top,d=i.spacer,s=i.bottoming,null==h&&(h=0),null==u&&(u=void 0),null==l&&(l=!0),null==f&&(f="is_stuck"),o=e(document),null==s&&(s=!0),p=function(e){var t,i;return window.getComputedStyle?(e[0],t=window.getComputedStyle(e[0]),i=parseFloat(t.getPropertyValue("width"))+parseFloat(t.getPropertyValue("margin-left"))+parseFloat(t.getPropertyValue("margin-right")),"border-box"!==t.getPropertyValue("box-sizing")&&(i+=parseFloat(t.getPropertyValue("border-left-width"))+parseFloat(t.getPropertyValue("border-right-width"))+parseFloat(t.getPropertyValue("padding-left"))+parseFloat(t.getPropertyValue("padding-right"))),i):e.outerWidth(!0)},r=function(i,n,r,a,c,m,_,v){var w,y,b,x,k,C,S,V,T,B,E,P;if(!i.data("sticky_kit")){if(i.data("sticky_kit",!0),k=o.height(),S=i.parent(),null!=u&&(S=S.closest(u)),!S.length)throw"failed to find stick parent";return b=!1,w=!1,(E=null!=d?d&&i.closest(d):e("<div />"))&&E.css("position",i.css("position")),(V=function(){var e,t,s;if(!v)return k=o.height(),e=parseInt(S.css("border-top-width"),10),t=parseInt(S.css("padding-top"),10),n=parseInt(S.css("padding-bottom"),10),r=S.offset().top+e+t,a=S.height(),b&&(b=!1,w=!1,null==d&&(i.insertAfter(E),E.detach()),i.css({position:"",top:"",width:"",bottom:""}).removeClass(f),s=!0),c=i.offset().top-(parseInt(i.css("margin-top"),10)||0)-h,m=i.outerHeight(!0),_=i.css("float"),E&&E.css({width:p(i),height:m,display:i.css("display"),"vertical-align":i.css("vertical-align"),float:_}),s?P():void 0})(),x=void 0,C=h,B=g,P=function(){var e,p,u,y,T,P;if(!v)return u=!1,null!=B&&(B-=1)<=0&&(B=g,V(),u=!0),u||o.height()===k||(V(),u=!0),y=t.scrollTop(),null!=x&&(p=y-x),x=y,b?(s&&(T=y+m+C>a+r,w&&!T&&(w=!1,i.css({position:"fixed",bottom:"",top:C}).trigger("sticky_kit:unbottom"))),y<c&&(b=!1,C=h,null==d&&("left"!==_&&"right"!==_||i.insertAfter(E),E.detach()),e={position:"",width:"",top:""},i.css(e).removeClass(f).trigger("sticky_kit:unstick")),l&&(P=t.height(),m+h>P&&(w||(C-=p,C=Math.max(P-m,C),C=Math.min(h,C),b&&i.css({top:C+"px"}))))):y>c&&(b=!0,(e={position:"fixed",top:C}).width="border-box"===i.css("box-sizing")?i.outerWidth()+"px":i.width()+"px",i.css(e).addClass(f),null==d&&(i.after(E),"left"!==_&&"right"!==_||E.append(i)),i.trigger("sticky_kit:stick")),b&&s&&(null==T&&(T=y+m+C>a+r),!w&&T)?(w=!0,"static"===S.css("position")&&S.css({position:"relative"}),i.css({position:"absolute",bottom:n,top:"auto"}).trigger("sticky_kit:bottom")):void 0},T=function(){return V(),P()},y=function(){if(v=!0,t.off("touchmove",P),t.off("scroll",P),t.off("resize",T),e(document.body).off("sticky_kit:recalc",T),i.off("sticky_kit:detach",y),i.removeData("sticky_kit"),i.css({position:"",bottom:"",top:"",width:""}),S.position("position",""),b)return null==d&&("left"!==_&&"right"!==_||i.insertAfter(E),E.remove()),i.removeClass(f)},t.on("touchmove",P),t.on("scroll",P),t.on("resize",T),e(document.body).on("sticky_kit:recalc",T),i.on("sticky_kit:detach",y),setTimeout(P,0)}},a=0,c=this.length;a<c;a++)n=this[a],r(e(n));return this}}).call(this)},499:function(e,t,i){var o,n,s,r=i(3);!function(e){if(!e.jQuery){var t=function(e,i){return new t.fn.init(e,i)};t.isWindow=function(e){return null!=e&&e==e.window},t.type=function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?o[s.call(e)]||"object":typeof e},t.isArray=Array.isArray||function(e){return"array"===t.type(e)},t.isPlainObject=function(e){var i;if(!e||"object"!==t.type(e)||e.nodeType||t.isWindow(e))return!1;try{if(e.constructor&&!n.call(e,"constructor")&&!n.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(e){return!1}for(i in e);return void 0===i||n.call(e,i)},t.each=function(e,t,i){var o=0,n=e.length,s=l(e);if(i){if(s)for(;o<n&&!1!==t.apply(e[o],i);o++);else for(o in e)if(!1===t.apply(e[o],i))break}else if(s)for(;o<n&&!1!==t.call(e[o],o,e[o]);o++);else for(o in e)if(!1===t.call(e[o],o,e[o]))break;return e},t.data=function(e,o,n){if(void 0===n){var s=(r=e[t.expando])&&i[r];if(void 0===o)return s;if(s&&o in s)return s[o]}else if(void 0!==o){var r=e[t.expando]||(e[t.expando]=++t.uuid);return i[r]=i[r]||{},i[r][o]=n,n}},t.removeData=function(e,o){var n=e[t.expando],s=n&&i[n];s&&t.each(o,function(e,t){delete s[t]})},t.extend=function(){var e,i,o,n,s,r,a=arguments[0]||{},l=1,c=arguments.length,d=!1;for("boolean"==typeof a&&(d=a,a=arguments[l]||{},l++),"object"!=typeof a&&"function"!==t.type(a)&&(a={}),l===c&&(a=this,l--);l<c;l++)if(null!=(s=arguments[l]))for(n in s)e=a[n],a!==(o=s[n])&&(d&&o&&(t.isPlainObject(o)||(i=t.isArray(o)))?(i?(i=!1,r=e&&t.isArray(e)?e:[]):r=e&&t.isPlainObject(e)?e:{},a[n]=t.extend(d,r,o)):void 0!==o&&(a[n]=o));return a},t.queue=function(e,i,o){if(e){i=(i||"fx")+"queue";var n,s,r,a=t.data(e,i);return o?(!a||t.isArray(o)?a=t.data(e,i,(r=s||[],null!=(n=o)&&(l(Object(n))?function(e,t){for(var i=+t.length,o=0,n=e.length;o<i;)e[n++]=t[o++];if(i!=i)for(;void 0!==t[o];)e[n++]=t[o++];e.length=n}(r,"string"==typeof n?[n]:n):[].push.call(r,n)),r)):a.push(o),a):a||[]}},t.dequeue=function(e,i){t.each(e.nodeType?[e]:e,function(e,o){i=i||"fx";var n=t.queue(o,i),s=n.shift();"inprogress"===s&&(s=n.shift()),s&&("fx"===i&&n.unshift("inprogress"),s.call(o,function(){t.dequeue(o,i)}))})},t.fn=t.prototype={init:function(e){if(e.nodeType)return this[0]=e,this;throw new Error("Not a DOM node.")},offset:function(){var t=this[0].getBoundingClientRect?this[0].getBoundingClientRect():{top:0,left:0};return{top:t.top+(e.pageYOffset||document.scrollTop||0)-(document.clientTop||0),left:t.left+(e.pageXOffset||document.scrollLeft||0)-(document.clientLeft||0)}},position:function(){function e(){for(var e=this.offsetParent||document;e&&"html"===!e.nodeType.toLowerCase&&"static"===e.style.position;)e=e.offsetParent;return e||document}var i=this[0],e=e.apply(i),o=this.offset(),n=/^(?:body|html)#x2F;i.test(e.nodeName)?{top:0,left:0}:t(e).offset();return o.top-=parseFloat(i.style.marginTop)||0,o.left-=parseFloat(i.style.marginLeft)||0,e.style&&(n.top+=parseFloat(e.style.borderTopWidth)||0,n.left+=parseFloat(e.style.borderLeftWidth)||0),{top:o.top-n.top,left:o.left-n.left}}};var i={};t.expando="velocity"+(new Date).getTime(),t.uuid=0;for(var o={},n=o.hasOwnProperty,s=o.toString,r="Boolean Number String Function Array Date RegExp Object Error".split(" "),a=0;a<r.length;a++)o["[object "+r[a]+"]"]=r[a].toLowerCase();t.fn.init.prototype=t.fn,e.Velocity={Utilities:t}}function l(e){var i=e.length,o=t.type(e);return"function"!==o&&!t.isWindow(e)&&(!(1!==e.nodeType||!i)||("array"===o||0===i||"number"==typeof i&&i>0&&i-1 in e))}}(window),s=function(){return function(e,t,i,o){var n,s=function(){if(i.documentMode)return i.documentMode;for(var e=7;e>4;e--){var t=i.createElement("div");if(t.innerHTML="\x3c!--[if IE "+e+"]><span></span><![endif]--\x3e",t.getElementsByTagName("span").length)return t=null,e}return o}(),a=(n=0,t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||function(e){var t,i=(new Date).getTime();return t=Math.max(0,16-(i-n)),n=i+t,setTimeout(function(){e(i+t)},t)});function l(e){return d.isWrapped(e)?e=[].slice.call(e):d.isNode(e)&&(e=[e]),e}var c,d={isString:function(e){return"string"==typeof e},isArray:Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},isFunction:function(e){return"[object Function]"===Object.prototype.toString.call(e)},isNode:function(e){return e&&e.nodeType},isNodeList:function(e){return"object"==typeof e&&/^\[object (HTMLCollection|NodeList|Object)\]#x2F;.test(Object.prototype.toString.call(e))&&e.length!==o&&(0===e.length||"object"==typeof e[0]&&e[0].nodeType>0)},isWrapped:function(e){return e&&(e.jquery||t.Zepto&&t.Zepto.zepto.isZ(e))},isSVG:function(e){return t.SVGElement&&e instanceof t.SVGElement},isEmptyObject:function(e){for(var t in e)return!1;return!0}},h=!1;if(e.fn&&e.fn.jquery?(c=e,h=!0):c=t.Velocity.Utilities,s<=8&&!h)throw new Error("Velocity: IE8 and below require jQuery to be loaded before Velocity.");if(!(s<=7)){var p=400,u="swing",g={State:{isMobile:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),isAndroid:/Android/i.test(navigator.userAgent),isGingerbread:/Android 2\.3\.[3-7]/i.test(navigator.userAgent),isChrome:t.chrome,isFirefox:/Firefox/i.test(navigator.userAgent),prefixElement:i.createElement("div"),prefixMatches:{},scrollAnchor:null,scrollPropertyLeft:null,scrollPropertyTop:null,isTicking:!1,calls:[]},CSS:{},Utilities:c,Redirects:{},Easings:{},Promise:t.Promise,defaults:{queue:"",duration:p,easing:u,begin:o,complete:o,progress:o,display:o,visibility:o,loop:!1,delay:!1,mobileHA:!0,_cacheValues:!0},init:function(e){c.data(e,"velocity",{isSVG:d.isSVG(e),isAnimating:!1,computedStyle:null,tweensContainer:null,rootPropertyValueCache:{},transformCache:{}})},hook:null,mock:!1,version:{major:1,minor:2,patch:2},debug:!1};t.pageYOffset!==o?(g.State.scrollAnchor=t,g.State.scrollPropertyLeft="pageXOffset",g.State.scrollPropertyTop="pageYOffset"):(g.State.scrollAnchor=i.documentElement||i.body.parentNode||i.body,g.State.scrollPropertyLeft="scrollLeft",g.State.scrollPropertyTop="scrollTop");var f=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t,i,o){var n={x:t.x+o.dx*i,v:t.v+o.dv*i,tension:t.tension,friction:t.friction};return{dx:n.v,dv:e(n)}}function i(i,o){var n={dx:i.v,dv:e(i)},s=t(i,.5*o,n),r=t(i,.5*o,s),a=t(i,o,r),l=1/6*(n.dx+2*(s.dx+r.dx)+a.dx),c=1/6*(n.dv+2*(s.dv+r.dv)+a.dv);return i.x=i.x+l*o,i.v=i.v+c*o,i}return function e(t,o,n){var s,r,a,l={x:-1,v:0,tension:null,friction:null},c=[0],d=0;for(t=parseFloat(t)||500,o=parseFloat(o)||20,n=n||null,l.tension=t,l.friction=o,r=(s=null!==n)?(d=e(t,o))/n*.016:.016;a=i(a||l,r),c.push(1+a.x),d+=16,Math.abs(a.x)>1e-4&&Math.abs(a.v)>1e-4;);return s?function(e){return c[e*(c.length-1)|0]}:d}}();g.Easings={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},spring:function(e){return 1-Math.cos(4.5*e*Math.PI)*Math.exp(6*-e)}},c.each([["ease",[.25,.1,.25,1]],["ease-in",[.42,0,1,1]],["ease-out",[0,0,.58,1]],["ease-in-out",[.42,0,.58,1]],["easeInSine",[.47,0,.745,.715]],["easeOutSine",[.39,.575,.565,1]],["easeInOutSine",[.445,.05,.55,.95]],["easeInQuad",[.55,.085,.68,.53]],["easeOutQuad",[.25,.46,.45,.94]],["easeInOutQuad",[.455,.03,.515,.955]],["easeInCubic",[.55,.055,.675,.19]],["easeOutCubic",[.215,.61,.355,1]],["easeInOutCubic",[.645,.045,.355,1]],["easeInQuart",[.895,.03,.685,.22]],["easeOutQuart",[.165,.84,.44,1]],["easeInOutQuart",[.77,0,.175,1]],["easeInQuint",[.755,.05,.855,.06]],["easeOutQuint",[.23,1,.32,1]],["easeInOutQuint",[.86,0,.07,1]],["easeInExpo",[.95,.05,.795,.035]],["easeOutExpo",[.19,1,.22,1]],["easeInOutExpo",[1,0,0,1]],["easeInCirc",[.6,.04,.98,.335]],["easeOutCirc",[.075,.82,.165,1]],["easeInOutCirc",[.785,.135,.15,.86]]],function(e,t){g.Easings[t[0]]=y.apply(null,t[1])});var m=g.CSS={RegEx:{isHex:/^#([A-f\d]{3}){1,2}#x2F;i,valueUnwrap:/^[A-z]+\((.*)\)#x2F;i,wrappedValueAlreadyExtracted:/[0-9.]+ [0-9.]+ [0-9.]+( [0-9.]+)?/,valueSplit:/([A-z]+\(.+\))|(([A-z0-9#-.]+?)(?=\s|$))/gi},Lists:{colors:["fill","stroke","stopColor","color","backgroundColor","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","outlineColor"],transformsBase:["translateX","translateY","scale","scaleX","scaleY","skewX","skewY","rotateZ"],transforms3D:["transformPerspective","translateZ","scaleZ","rotateX","rotateY"]},Hooks:{templates:{textShadow:["Color X Y Blur","black 0px 0px 0px"],boxShadow:["Color X Y Blur Spread","black 0px 0px 0px 0px"],clip:["Top Right Bottom Left","0px 0px 0px 0px"],backgroundPosition:["X Y","0% 0%"],transformOrigin:["X Y Z","50% 50% 0px"],perspectiveOrigin:["X Y","50% 50%"]},registered:{},register:function(){for(var e=0;e<m.Lists.colors.length;e++){var t="color"===m.Lists.colors[e]?"0 0 0 1":"255 255 255 1";m.Hooks.templates[m.Lists.colors[e]]=["Red Green Blue Alpha",t]}var i,o,n;if(s)for(i in m.Hooks.templates){n=(o=m.Hooks.templates[i])[0].split(" ");var r=o[1].match(m.RegEx.valueSplit);"Color"===n[0]&&(n.push(n.shift()),r.push(r.shift()),m.Hooks.templates[i]=[n.join(" "),r.join(" ")])}for(i in m.Hooks.templates)for(var e in n=(o=m.Hooks.templates[i])[0].split(" ")){var a=i+n[e],l=e;m.Hooks.registered[a]=[i,l]}},getRoot:function(e){var t=m.Hooks.registered[e];return t?t[0]:e},cleanRootPropertyValue:function(e,t){return m.RegEx.valueUnwrap.test(t)&&(t=t.match(m.RegEx.valueUnwrap)[1]),m.Values.isCSSNullValue(t)&&(t=m.Hooks.templates[e][1]),t},extractValue:function(e,t){var i=m.Hooks.registered[e];if(i){var o=i[0],n=i[1];return(t=m.Hooks.cleanRootPropertyValue(o,t)).toString().match(m.RegEx.valueSplit)[n]}return t},injectValue:function(e,t,i){var o=m.Hooks.registered[e];if(o){var n,s=o[0],r=o[1];return(n=(i=m.Hooks.cleanRootPropertyValue(s,i)).toString().match(m.RegEx.valueSplit))[r]=t,n.join(" ")}return i}},Normalizations:{registered:{clip:function(e,t,i){switch(e){case"name":return"clip";case"extract":var o;return o=m.RegEx.wrappedValueAlreadyExtracted.test(i)?i:(o=i.toString().match(m.RegEx.valueUnwrap))?o[1].replace(/,(\s+)?/g," "):i;case"inject":return"rect("+i+")"}},blur:function(e,t,i){switch(e){case"name":return g.State.isFirefox?"filter":"-webkit-filter";case"extract":var o=parseFloat(i);if(!o&&0!==o){var n=i.toString().match(/blur\(([0-9]+[A-z]+)\)/i);o=n?n[1]:0}return o;case"inject":return parseFloat(i)?"blur("+i+")":"none"}},opacity:function(e,t,i){if(s<=8)switch(e){case"name":return"filter";case"extract":var o=i.toString().match(/alpha\(opacity=(.*)\)/i);return i=o?o[1]/100:1;case"inject":return t.style.zoom=1,parseFloat(i)>=1?"":"alpha(opacity="+parseInt(100*parseFloat(i),10)+")"}else switch(e){case"name":return"opacity";case"extract":case"inject":return i}}},register:function(){s<=9||g.State.isGingerbread||(m.Lists.transformsBase=m.Lists.transformsBase.concat(m.Lists.transforms3D));for(var e=0;e<m.Lists.transformsBase.length;e++)!function(){var t=m.Lists.transformsBase[e];m.Normalizations.registered[t]=function(e,i,n){switch(e){case"name":return"transform";case"extract":return w(i)===o||w(i).transformCache[t]===o?/^scale/i.test(t)?1:0:w(i).transformCache[t].replace(/[()]/g,"");case"inject":var s=!1;switch(t.substr(0,t.length-1)){case"translate":s=!/(%|px|em|rem|vw|vh|\d)#x2F;i.test(n);break;case"scal":case"scale":g.State.isAndroid&&w(i).transformCache[t]===o&&n<1&&(n=1),s=!/(\d)#x2F;i.test(n);break;case"skew":case"rotate":s=!/(deg|\d)#x2F;i.test(n)}return s||(w(i).transformCache[t]="("+n+")"),w(i).transformCache[t]}}}();for(e=0;e<m.Lists.colors.length;e++)!function(){var t=m.Lists.colors[e];m.Normalizations.registered[t]=function(e,i,n){switch(e){case"name":return t;case"extract":var r;if(m.RegEx.wrappedValueAlreadyExtracted.test(n))r=n;else{var a,l={black:"rgb(0, 0, 0)",blue:"rgb(0, 0, 255)",gray:"rgb(128, 128, 128)",green:"rgb(0, 128, 0)",red:"rgb(255, 0, 0)",white:"rgb(255, 255, 255)"};/^[A-z]+#x2F;i.test(n)?a=l[n]!==o?l[n]:l.black:m.RegEx.isHex.test(n)?a="rgb("+m.Values.hexToRgb(n).join(" ")+")":/^rgba?\(/i.test(n)||(a=l.black),r=(a||n).toString().match(m.RegEx.valueUnwrap)[1].replace(/,(\s+)?/g," ")}return s<=8||3!==r.split(" ").length||(r+=" 1"),r;case"inject":return s<=8?4===n.split(" ").length&&(n=n.split(/\s+/).slice(0,3).join(" ")):3===n.split(" ").length&&(n+=" 1"),(s<=8?"rgb":"rgba")+"("+n.replace(/\s+/g,",").replace(/\.(\d)+(?=,)/g,"")+")"}}}()}},Names:{camelCase:function(e){return e.replace(/-(\w)/g,function(e,t){return t.toUpperCase()})},SVGAttribute:function(e){var t="width|height|x|y|cx|cy|r|rx|ry|x1|x2|y1|y2";return(s||g.State.isAndroid&&!g.State.isChrome)&&(t+="|transform"),new RegExp("^("+t+")quot;,"i").test(e)},prefixCheck:function(e){if(g.State.prefixMatches[e])return[g.State.prefixMatches[e],!0];for(var t=["","Webkit","Moz","ms","O"],i=0,o=t.length;i<o;i++){var n;if(n=0===i?e:t[i]+e.replace(/^\w/,function(e){return e.toUpperCase()}),d.isString(g.State.prefixElement.style[n]))return g.State.prefixMatches[e]=n,[n,!0]}return[e,!1]}},Values:{hexToRgb:function(e){var t;return e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])#x2F;i,function(e,t,i,o){return t+t+i+i+o+o}),(t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})#x2F;i.exec(e))?[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]:[0,0,0]},isCSSNullValue:function(e){return 0==e||/^(none|auto|transparent|(rgba\(0, ?0, ?0, ?0\)))#x2F;i.test(e)},getUnitType:function(e){return/^(rotate|skew)/i.test(e)?"deg":/(^(scale|scaleX|scaleY|scaleZ|alpha|flexGrow|flexHeight|zIndex|fontWeight)$)|((opacity|red|green|blue|alpha)$)/i.test(e)?"":"px"},getDisplayType:function(e){var t=e&&e.tagName.toString().toLowerCase();return/^(b|big|i|small|tt|abbr|acronym|cite|code|dfn|em|kbd|strong|samp|var|a|bdo|br|img|map|object|q|script|span|sub|sup|button|input|label|select|textarea)#x2F;i.test(t)?"inline":/^(li)#x2F;i.test(t)?"list-item":/^(tr)#x2F;i.test(t)?"table-row":/^(table)#x2F;i.test(t)?"table":/^(tbody)#x2F;i.test(t)?"table-row-group":"block"},addClass:function(e,t){e.classList?e.classList.add(t):e.className+=(e.className.length?" ":"")+t},removeClass:function(e,t){e.classList?e.classList.remove(t):e.className=e.className.toString().replace(new RegExp("(^|\\s)"+t.split(" ").join("|")+"(\\s|$)","gi")," ")}},getPropertyValue:function(e,i,n,r){function a(e,i){var n=0;if(s<=8)n=c.css(e,i);else{var l,d=!1;function h(){d&&m.setPropertyValue(e,"display","none")}if(/^(width|height)#x2F;.test(i)&&0===m.getPropertyValue(e,"display")&&(d=!0,m.setPropertyValue(e,"display",m.Values.getDisplayType(e))),!r){if("height"===i&&"border-box"!==m.getPropertyValue(e,"boxSizing").toString().toLowerCase()){var p=e.offsetHeight-(parseFloat(m.getPropertyValue(e,"borderTopWidth"))||0)-(parseFloat(m.getPropertyValue(e,"borderBottomWidth"))||0)-(parseFloat(m.getPropertyValue(e,"paddingTop"))||0)-(parseFloat(m.getPropertyValue(e,"paddingBottom"))||0);return h(),p}if("width"===i&&"border-box"!==m.getPropertyValue(e,"boxSizing").toString().toLowerCase()){var u=e.offsetWidth-(parseFloat(m.getPropertyValue(e,"borderLeftWidth"))||0)-(parseFloat(m.getPropertyValue(e,"borderRightWidth"))||0)-(parseFloat(m.getPropertyValue(e,"paddingLeft"))||0)-(parseFloat(m.getPropertyValue(e,"paddingRight"))||0);return h(),u}}l=w(e)===o?t.getComputedStyle(e,null):w(e).computedStyle?w(e).computedStyle:w(e).computedStyle=t.getComputedStyle(e,null),"borderColor"===i&&(i="borderTopColor"),""!==(n=9===s&&"filter"===i?l.getPropertyValue(i):l[i])&&null!==n||(n=e.style[i]),h()}if("auto"===n&&/^(top|right|bottom|left)#x2F;i.test(i)){var g=a(e,"position");("fixed"===g||"absolute"===g&&/top|left/i.test(i))&&(n=c(e).position()[i]+"px")}return n}var l;if(m.Hooks.registered[i]){var d=i,h=m.Hooks.getRoot(d);n===o&&(n=m.getPropertyValue(e,m.Names.prefixCheck(h)[0])),m.Normalizations.registered[h]&&(n=m.Normalizations.registered[h]("extract",e,n)),l=m.Hooks.extractValue(d,n)}else if(m.Normalizations.registered[i]){var p,u;"transform"!==(p=m.Normalizations.registered[i]("name",e))&&(u=a(e,m.Names.prefixCheck(p)[0]),m.Values.isCSSNullValue(u)&&m.Hooks.templates[i]&&(u=m.Hooks.templates[i][1])),l=m.Normalizations.registered[i]("extract",e,u)}if(!/^[\d-]/.test(l))if(w(e)&&w(e).isSVG&&m.Names.SVGAttribute(i))if(/^(height|width)#x2F;i.test(i))try{l=e.getBBox()[i]}catch(e){l=0}else l=e.getAttribute(i);else l=a(e,m.Names.prefixCheck(i)[0]);return m.Values.isCSSNullValue(l)&&(l=0),g.debug>=2&&console.log("Get "+i+": "+l),l},setPropertyValue:function(e,i,o,n,r){var a=i;if("scroll"===i)r.container?r.container["scroll"+r.direction]=o:"Left"===r.direction?t.scrollTo(o,r.alternateValue):t.scrollTo(r.alternateValue,o);else if(m.Normalizations.registered[i]&&"transform"===m.Normalizations.registered[i]("name",e))m.Normalizations.registered[i]("inject",e,o),a="transform",o=w(e).transformCache[i];else{if(m.Hooks.registered[i]){var l=i,c=m.Hooks.getRoot(i);n=n||m.getPropertyValue(e,c),o=m.Hooks.injectValue(l,o,n),i=c}if(m.Normalizations.registered[i]&&(o=m.Normalizations.registered[i]("inject",e,o),i=m.Normalizations.registered[i]("name",e)),a=m.Names.prefixCheck(i)[0],s<=8)try{e.style[a]=o}catch(e){g.debug&&console.log("Browser does not support ["+o+"] for ["+a+"]")}else w(e)&&w(e).isSVG&&m.Names.SVGAttribute(i)?e.setAttribute(i,o):e.style[a]=o;g.debug>=2&&console.log("Set "+i+" ("+a+"): "+o)}return[a,o]},flushTransformCache:function(e){var t="";if((s||g.State.isAndroid&&!g.State.isChrome)&&w(e).isSVG){function i(t){return parseFloat(m.getPropertyValue(e,t))}var o={translate:[i("translateX"),i("translateY")],skewX:[i("skewX")],skewY:[i("skewY")],scale:1!==i("scale")?[i("scale"),i("scale")]:[i("scaleX"),i("scaleY")],rotate:[i("rotateZ"),0,0]};c.each(w(e).transformCache,function(e){/^translate/i.test(e)?e="translate":/^scale/i.test(e)?e="scale":/^rotate/i.test(e)&&(e="rotate"),o[e]&&(t+=e+"("+o[e].join(" ")+") ",delete o[e])})}else{var n,r;c.each(w(e).transformCache,function(i){if(n=w(e).transformCache[i],"transformPerspective"===i)return r=n,!0;9===s&&"rotateZ"===i&&(i="rotate"),t+=i+n+" "}),r&&(t="perspective"+r+" "+t)}m.setPropertyValue(e,"transform",t)}};m.Hooks.register(),m.Normalizations.register(),g.hook=function(e,t,i){var n=o;return e=l(e),c.each(e,function(e,s){if(w(s)===o&&g.init(s),i===o)n===o&&(n=g.CSS.getPropertyValue(s,t));else{var r=g.CSS.setPropertyValue(s,t,i);"transform"===r[0]&&g.CSS.flushTransformCache(s),n=r}}),n};var _=function(){function e(){return n?V.promise||null:s}var n,s,r,a,h,u,f=arguments[0]&&(arguments[0].p||c.isPlainObject(arguments[0].properties)&&!arguments[0].properties.names||d.isString(arguments[0].properties));if(d.isWrapped(this)?(n=!1,r=0,a=this,s=this):(n=!0,r=1,a=f?arguments[0].elements||arguments[0].e:arguments[0]),a=l(a)){f?(h=arguments[0].properties||arguments[0].p,u=arguments[0].options||arguments[0].o):(h=arguments[r],u=arguments[r+1]);var v=a.length,y=0;if(!/^(stop|finish|finishAll)#x2F;i.test(h)&&!c.isPlainObject(u)){u={};for(var C=r+1;C<arguments.length;C++)d.isArray(arguments[C])||!/^(fast|normal|slow)#x2F;i.test(arguments[C])&&!/^\d/.test(arguments[C])?d.isString(arguments[C])||d.isArray(arguments[C])?u.easing=arguments[C]:d.isFunction(arguments[C])&&(u.complete=arguments[C]):u.duration=arguments[C]}var S,V={promise:null,resolver:null,rejecter:null};switch(n&&g.Promise&&(V.promise=new g.Promise(function(e,t){V.resolver=e,V.rejecter=t})),h){case"scroll":S="scroll";break;case"reverse":S="reverse";break;case"finish":case"finishAll":case"stop":c.each(a,function(e,t){w(t)&&w(t).delayTimer&&(clearTimeout(w(t).delayTimer.setTimeout),w(t).delayTimer.next&&w(t).delayTimer.next(),delete w(t).delayTimer),"finishAll"!==h||!0!==u&&!d.isString(u)||(c.each(c.queue(t,d.isString(u)?u:""),function(e,t){d.isFunction(t)&&t()}),c.queue(t,d.isString(u)?u:"",[]))});var T=[];return c.each(g.State.calls,function(e,t){t&&c.each(t[1],function(i,n){var s=u===o?"":u;if(!0!==s&&t[2].queue!==s&&(u!==o||!1!==t[2].queue))return!0;c.each(a,function(i,o){o===n&&((!0===u||d.isString(u))&&(c.each(c.queue(o,d.isString(u)?u:""),function(e,t){d.isFunction(t)&&t(null,!0)}),c.queue(o,d.isString(u)?u:"",[])),"stop"===h?(w(o)&&w(o).tweensContainer&&!1!==s&&c.each(w(o).tweensContainer,function(e,t){t.endValue=t.currentValue}),T.push(e)):"finish"!==h&&"finishAll"!==h||(t[2].duration=1))})})}),"stop"===h&&(c.each(T,function(e,t){k(t,!0)}),V.promise&&V.resolver(a)),e();default:if(!c.isPlainObject(h)||d.isEmptyObject(h)){if(d.isString(h)&&g.Redirects[h]){var B=(M=c.extend({},u)).duration,E=M.delay||0;return!0===M.backwards&&(a=c.extend(!0,[],a).reverse()),c.each(a,function(e,t){parseFloat(M.stagger)?M.delay=E+parseFloat(M.stagger)*e:d.isFunction(M.stagger)&&(M.delay=E+M.stagger.call(t,e,v)),M.drag&&(M.duration=parseFloat(B)||(/^(callout|transition)/.test(h)?1e3:p),M.duration=Math.max(M.duration*(M.backwards?1-e/v:(e+1)/v),.75*M.duration,200)),g.Redirects[h].call(t,t,M||{},e,v,a,V.promise?V:o)}),e()}var P="Velocity: First argument ("+h+") was not a property map, a known action, or a registered redirect. Aborting.";return V.promise?V.rejecter(new Error(P)):console.log(P),e()}S="start"}var M,A,D={lastParent:null,lastPosition:null,lastFontSize:null,lastPercentToPxWidth:null,lastPercentToPxHeight:null,lastEmToPx:null,remToPx:null,vwToPx:null,vhToPx:null},R=[];if(c.each(a,function(e,n){d.isNode(n)&&function(){var e,n=this,s=c.extend({},g.defaults,u),r={};switch(w(n)===o&&g.init(n),parseFloat(s.delay)&&!1!==s.queue&&c.queue(n,s.queue,function(e){g.velocityQueueEntryFlag=!0,w(n).delayTimer={setTimeout:setTimeout(e,parseFloat(s.delay)),next:e}}),s.duration.toString().toLowerCase()){case"fast":s.duration=200;break;case"normal":s.duration=p;break;case"slow":s.duration=600;break;default:s.duration=parseFloat(s.duration)||1}function l(l){if(s.begin&&0===y)try{s.begin.call(a,a)}catch(e){setTimeout(function(){throw e},1)}if("scroll"===S){var p,f,_,k=/^x#x2F;i.test(s.axis)?"Left":"Top",C=parseFloat(s.offset)||0;s.container?d.isWrapped(s.container)||d.isNode(s.container)?(s.container=s.container[0]||s.container,_=(p=s.container["scroll"+k])+c(n).position()[k.toLowerCase()]+C):s.container=null:(p=g.State.scrollAnchor[g.State["scrollProperty"+k]],f=g.State.scrollAnchor[g.State["scrollProperty"+("Left"===k?"Top":"Left")]],_=c(n).offset()[k.toLowerCase()]+C),r={scroll:{rootPropertyValue:!1,startValue:p,currentValue:p,endValue:_,unitType:"",easing:s.easing,scrollData:{container:s.container,direction:k,alternateValue:f}},element:n},g.debug&&console.log("tweensContainer (scroll): ",r.scroll,n)}else if("reverse"===S){if(!w(n).tweensContainer)return void c.dequeue(n,s.queue);"none"===w(n).opts.display&&(w(n).opts.display="auto"),"hidden"===w(n).opts.visibility&&(w(n).opts.visibility="visible"),w(n).opts.loop=!1,w(n).opts.begin=null,w(n).opts.complete=null,u.easing||delete s.easing,u.duration||delete s.duration,s=c.extend({},w(n).opts,s);var T=c.extend(!0,{},w(n).tweensContainer);for(var B in T)if("element"!==B){var E=T[B].startValue;T[B].startValue=T[B].currentValue=T[B].endValue,T[B].endValue=E,d.isEmptyObject(u)||(T[B].easing=s.easing),g.debug&&console.log("reverse tweensContainer ("+B+"): "+JSON.stringify(T[B]),n)}r=T}else if("start"===S){function P(e,t){var i=o,r=o,a=o;return d.isArray(e)?(i=e[0],!d.isArray(e[1])&&/^[\d-]/.test(e[1])||d.isFunction(e[1])||m.RegEx.isHex.test(e[1])?a=e[1]:(d.isString(e[1])&&!m.RegEx.isHex.test(e[1])||d.isArray(e[1]))&&(r=t?e[1]:b(e[1],s.duration),e[2]!==o&&(a=e[2]))):i=e,t||(r=r||s.easing),d.isFunction(i)&&(i=i.call(n,y,v)),d.isFunction(a)&&(a=a.call(n,y,v)),[i||0,r,a]}for(var M in w(n).tweensContainer&&!0===w(n).isAnimating&&(T=w(n).tweensContainer),c.each(h,function(e,t){if(RegExp("^"+m.Lists.colors.join("$|^")+"quot;).test(e)){var i=P(t,!0),n=i[0],s=i[1],r=i[2];if(m.RegEx.isHex.test(n)){for(var a=["Red","Green","Blue"],l=m.Values.hexToRgb(n),c=r?m.Values.hexToRgb(r):o,d=0;d<a.length;d++){var p=[l[d]];s&&p.push(s),c!==o&&p.push(c[d]),h[e+a[d]]=p}delete h[e]}}}),h){var A=P(h[M]),F=A[0],O=A[1],z=A[2];M=m.Names.camelCase(M);var I=m.Hooks.getRoot(M),N=!1;if(w(n).isSVG||"tween"===I||!1!==m.Names.prefixCheck(I)[1]||m.Normalizations.registered[I]!==o){(s.display!==o&&null!==s.display&&"none"!==s.display||s.visibility!==o&&"hidden"!==s.visibility)&&/opacity|filter/.test(M)&&!z&&0!==F&&(z=0),s._cacheValues&&T&&T[M]?(z===o&&(z=T[M].endValue+T[M].unitType),N=w(n).rootPropertyValueCache[I]):m.Hooks.registered[M]?z===o?(N=m.getPropertyValue(n,I),z=m.getPropertyValue(n,M,N)):N=m.Hooks.templates[I][1]:z===o&&(z=m.getPropertyValue(n,M));var $,L,W,H=!1;if(z=($=U(M,z))[0],W=$[1],F=($=U(M,F))[0].replace(/^([+-\/*])=/,function(e,t){return H=t,""}),L=$[1],z=parseFloat(z)||0,F=parseFloat(F)||0,"%"===L&&(/^(fontSize|lineHeight)#x2F;.test(M)?(F/=100,L="em"):/^scale/.test(M)?(F/=100,L=""):/(Red|Green|Blue)#x2F;i.test(M)&&(F=F/100*255,L="")),/[\/*]/.test(H))L=W;else if(W!==L&&0!==z)if(0===F)L=W;else{e=e||q();var j=/margin|padding|left|right|width|text|word|letter/i.test(M)||/X#x2F;.test(M)||"x"===M?"x":"y";switch(W){case"%":z*="x"===j?e.percentToPxWidth:e.percentToPxHeight;break;case"px":break;default:z*=e[W+"ToPx"]}switch(L){case"%":z*=1/("x"===j?e.percentToPxWidth:e.percentToPxHeight);break;case"px":break;default:z*=1/e[L+"ToPx"]}}switch(H){case"+":F=z+F;break;case"-":F=z-F;break;case"*":F*=z;break;case"/":F=z/F}r[M]={rootPropertyValue:N,startValue:z,currentValue:z,endValue:F,unitType:L,easing:O},g.debug&&console.log("tweensContainer ("+M+"): "+JSON.stringify(r[M]),n)}else g.debug&&console.log("Skipping ["+I+"] due to a lack of browser support.");function U(e,t){var i,o;return o=(t||"0").toString().toLowerCase().replace(/[%A-z]+#x2F;,function(e){return i=e,""}),i||(i=m.Values.getUnitType(e)),[o,i]}function q(){var e={myParent:n.parentNode||i.body,position:m.getPropertyValue(n,"position"),fontSize:m.getPropertyValue(n,"fontSize")},o=e.position===D.lastPosition&&e.myParent===D.lastParent,s=e.fontSize===D.lastFontSize;D.lastParent=e.myParent,D.lastPosition=e.position,D.lastFontSize=e.fontSize;var r={};if(s&&o)r.emToPx=D.lastEmToPx,r.percentToPxWidth=D.lastPercentToPxWidth,r.percentToPxHeight=D.lastPercentToPxHeight;else{var a=w(n).isSVG?i.createElementNS("http://www.w3.org/2000/svg","rect"):i.createElement("div");g.init(a),e.myParent.appendChild(a),c.each(["overflow","overflowX","overflowY"],function(e,t){g.CSS.setPropertyValue(a,t,"hidden")}),g.CSS.setPropertyValue(a,"position",e.position),g.CSS.setPropertyValue(a,"fontSize",e.fontSize),g.CSS.setPropertyValue(a,"boxSizing","content-box"),c.each(["minWidth","maxWidth","width","minHeight","maxHeight","height"],function(e,t){g.CSS.setPropertyValue(a,t,"100%")}),g.CSS.setPropertyValue(a,"paddingLeft","100em"),r.percentToPxWidth=D.lastPercentToPxWidth=(parseFloat(m.getPropertyValue(a,"width",null,!0))||1)/100,r.percentToPxHeight=D.lastPercentToPxHeight=(parseFloat(m.getPropertyValue(a,"height",null,!0))||1)/100,r.emToPx=D.lastEmToPx=(parseFloat(m.getPropertyValue(a,"paddingLeft"))||1)/100,e.myParent.removeChild(a)}return null===D.remToPx&&(D.remToPx=parseFloat(m.getPropertyValue(i.body,"fontSize"))||16),null===D.vwToPx&&(D.vwToPx=parseFloat(t.innerWidth)/100,D.vhToPx=parseFloat(t.innerHeight)/100),r.remToPx=D.remToPx,r.vwToPx=D.vwToPx,r.vhToPx=D.vhToPx,g.debug>=1&&console.log("Unit ratios: "+JSON.stringify(r),n),r}}r.element=n}r.element&&(m.Values.addClass(n,"velocity-animating"),R.push(r),""===s.queue&&(w(n).tweensContainer=r,w(n).opts=s),w(n).isAnimating=!0,y===v-1?(g.State.calls.push([R,a,s,null,V.resolver]),!1===g.State.isTicking&&(g.State.isTicking=!0,x())):y++)}!1!==g.mock&&(!0===g.mock?s.duration=s.delay=1:(s.duration*=parseFloat(g.mock)||1,s.delay*=parseFloat(g.mock)||1)),s.easing=b(s.easing,s.duration),s.begin&&!d.isFunction(s.begin)&&(s.begin=null),s.progress&&!d.isFunction(s.progress)&&(s.progress=null),s.complete&&!d.isFunction(s.complete)&&(s.complete=null),s.display!==o&&null!==s.display&&(s.display=s.display.toString().toLowerCase(),"auto"===s.display&&(s.display=g.CSS.Values.getDisplayType(n))),s.visibility!==o&&null!==s.visibility&&(s.visibility=s.visibility.toString().toLowerCase()),s.mobileHA=s.mobileHA&&g.State.isMobile&&!g.State.isGingerbread,!1===s.queue?s.delay?setTimeout(l,s.delay):l():c.queue(n,s.queue,function(e,t){if(!0===t)return V.promise&&V.resolver(a),!0;g.velocityQueueEntryFlag=!0,l()}),""!==s.queue&&"fx"!==s.queue||"inprogress"===c.queue(n)[0]||c.dequeue(n)}.call(n)}),(M=c.extend({},g.defaults,u)).loop=parseInt(M.loop),A=2*M.loop-1,M.loop)for(var F=0;F<A;F++){var O={delay:M.delay,progress:M.progress};F===A-1&&(O.display=M.display,O.visibility=M.visibility,O.complete=M.complete),_(a,"reverse",O)}return e()}};(g=c.extend(_,g)).animate=_;var v=t.requestAnimationFrame||a;return g.State.isMobile||i.hidden===o||i.addEventListener("visibilitychange",function(){i.hidden?(v=function(e){return setTimeout(function(){e(!0)},16)},x()):v=t.requestAnimationFrame||a}),e.Velocity=g,e!==t&&(e.fn.velocity=_,e.fn.velocity.defaults=g.defaults),c.each(["Down","Up"],function(e,t){g.Redirects["slide"+t]=function(e,i,n,s,r,a){var l=c.extend({},i),d=l.begin,h=l.complete,p={height:"",marginTop:"",marginBottom:"",paddingTop:"",paddingBottom:""},u={};l.display===o&&(l.display="Down"===t?"inline"===g.CSS.Values.getDisplayType(e)?"inline-block":"block":"none"),l.begin=function(){for(var i in d&&d.call(r,r),p){u[i]=e.style[i];var o=g.CSS.getPropertyValue(e,i);p[i]="Down"===t?[o,0]:[0,o]}u.overflow=e.style.overflow,e.style.overflow="hidden"},l.complete=function(){for(var t in u)e.style[t]=u[t];h&&h.call(r,r),a&&a.resolver(r)},g(e,p,l)}}),c.each(["In","Out"],function(e,t){g.Redirects["fade"+t]=function(e,i,n,s,r,a){var l=c.extend({},i),d={opacity:"In"===t?1:0},h=l.complete;l.complete=n!==s-1?l.begin=null:function(){h&&h.call(r,r),a&&a.resolver(r)},l.display===o&&(l.display="In"===t?"auto":"none"),g(this,d,l)}}),g}function w(e){var t=c.data(e,"velocity");return null===t?o:t}function y(e,i,o,n){var s=4,r=.001,a=1e-7,l=10,c=11,d=1/(c-1),h="Float32Array"in t;if(4!==arguments.length)return!1;for(var p=0;p<4;++p)if("number"!=typeof arguments[p]||isNaN(arguments[p])||!isFinite(arguments[p]))return!1;e=Math.min(e,1),o=Math.min(o,1),e=Math.max(e,0),o=Math.max(o,0);var u=h?new Float32Array(c):new Array(c);function g(e,t){return 1-3*t+3*e}function f(e,t){return 3*t-6*e}function m(e){return 3*e}function _(e,t,i){return((g(t,i)*e+f(t,i))*e+m(t))*e}function v(e,t,i){return 3*g(t,i)*e*e+2*f(t,i)*e+m(t)}function w(t){for(var i=0,n=1,h=c-1;n!=h&&u[n]<=t;++n)i+=d;var p=i+(t-u[--n])/(u[n+1]-u[n])*d,g=v(p,e,o);return g>=r?function(t,i){for(var n=0;n<s;++n){var r=v(i,e,o);if(0===r)return i;i-=(_(i,e,o)-t)/r}return i}(t,p):0==g?p:function(t,i,n){var s,r,c=0;do{(s=_(r=i+(n-i)/2,e,o)-t)>0?n=r:i=r}while(Math.abs(s)>a&&++c<l);return r}(t,i,i+d)}var y=!1;function b(){y=!0,e==i&&o==n||function(){for(var t=0;t<c;++t)u[t]=_(t*d,e,o)}()}var x=function(t){return y||b(),e===i&&o===n?t:0===t?0:1===t?1:_(w(t),i,n)};x.getControlPoints=function(){return[{x:e,y:i},{x:o,y:n}]};var k="generateBezier("+[e,i,o,n]+")";return x.toString=function(){return k},x}function b(e,t){var i=e;return d.isString(e)?g.Easings[e]||(i=!1):i=d.isArray(e)&&1===e.length?function(e){return function(t){return Math.round(t*e)*(1/e)}}.apply(null,e):d.isArray(e)&&2===e.length?f.apply(null,e.concat([t])):!(!d.isArray(e)||4!==e.length)&&y.apply(null,e),!1===i&&(i=g.Easings[g.defaults.easing]?g.defaults.easing:u),i}function x(e){if(e){var t=(new Date).getTime(),i=g.State.calls.length;i>1e4&&(g.State.calls=function(e){for(var t=-1,i=e?e.length:0,o=[];++t<i;){var n=e[t];n&&o.push(n)}return o}(g.State.calls));for(var n=0;n<i;n++)if(g.State.calls[n]){var s=g.State.calls[n],r=s[0],a=s[2],l=s[3],h=!!l,p=null;l||(l=g.State.calls[n][3]=t-16);for(var u=Math.min((t-l)/a.duration,1),f=0,_=r.length;f<_;f++){var y=r[f],b=y.element;if(w(b)){var C=!1;if(a.display!==o&&null!==a.display&&"none"!==a.display){if("flex"===a.display){c.each(["-webkit-box","-moz-box","-ms-flexbox","-webkit-flex"],function(e,t){m.setPropertyValue(b,"display",t)})}m.setPropertyValue(b,"display",a.display)}for(var S in a.visibility!==o&&"hidden"!==a.visibility&&m.setPropertyValue(b,"visibility",a.visibility),y)if("element"!==S){var V,T=y[S],B=d.isString(T.easing)?g.Easings[T.easing]:T.easing;if(1===u)V=T.endValue;else{var E=T.endValue-T.startValue;if(V=T.startValue+E*B(u,a,E),!h&&V===T.currentValue)continue}if(T.currentValue=V,"tween"===S)p=V;else{if(m.Hooks.registered[S]){var P=m.Hooks.getRoot(S),M=w(b).rootPropertyValueCache[P];M&&(T.rootPropertyValue=M)}var A=m.setPropertyValue(b,S,T.currentValue+(0===parseFloat(V)?"":T.unitType),T.rootPropertyValue,T.scrollData);m.Hooks.registered[S]&&(m.Normalizations.registered[P]?w(b).rootPropertyValueCache[P]=m.Normalizations.registered[P]("extract",null,A[1]):w(b).rootPropertyValueCache[P]=A[1]),"transform"===A[0]&&(C=!0)}}a.mobileHA&&w(b).transformCache.translate3d===o&&(w(b).transformCache.translate3d="(0px, 0px, 0px)",C=!0),C&&m.flushTransformCache(b)}}a.display!==o&&"none"!==a.display&&(g.State.calls[n][2].display=!1),a.visibility!==o&&"hidden"!==a.visibility&&(g.State.calls[n][2].visibility=!1),a.progress&&a.progress.call(s[1],s[1],u,Math.max(0,l+a.duration-t),l,p),1===u&&k(n)}}g.State.isTicking&&v(x)}function k(e,t){if(!g.State.calls[e])return!1;for(var i=g.State.calls[e][0],n=g.State.calls[e][1],s=g.State.calls[e][2],r=g.State.calls[e][4],a=!1,l=0,d=i.length;l<d;l++){var h=i[l].element;if(t||s.loop||("none"===s.display&&m.setPropertyValue(h,"display",s.display),"hidden"===s.visibility&&m.setPropertyValue(h,"visibility",s.visibility)),!0!==s.loop&&(c.queue(h)[1]===o||!/\.velocityQueueEntryFlag/i.test(c.queue(h)[1]))&&w(h)){w(h).isAnimating=!1,w(h).rootPropertyValueCache={};var p=!1;c.each(m.Lists.transforms3D,function(e,t){var i=/^scale/.test(t)?1:0,n=w(h).transformCache[t];w(h).transformCache[t]!==o&&new RegExp("^\\("+i+"[^.]").test(n)&&(p=!0,delete w(h).transformCache[t])}),s.mobileHA&&(p=!0,delete w(h).transformCache.translate3d),p&&m.flushTransformCache(h),m.Values.removeClass(h,"velocity-animating")}if(!t&&s.complete&&!s.loop&&l===d-1)try{s.complete.call(n,n)}catch(e){setTimeout(function(){throw e},1)}r&&!0!==s.loop&&r(n),w(h)&&!0===s.loop&&!t&&(c.each(w(h).tweensContainer,function(e,t){/^rotate/.test(e)&&360===parseFloat(t.endValue)&&(t.endValue=0,t.startValue=360),/^backgroundPosition/.test(e)&&100===parseFloat(t.endValue)&&"%"===t.unitType&&(t.endValue=0,t.startValue=100)}),g(h,"reverse",{loop:!0,delay:s.delay})),!1!==s.queue&&c.dequeue(h,s.queue)}g.State.calls[e]=!1;for(var u=0,f=g.State.calls.length;u<f;u++)if(!1!==g.State.calls[u]){a=!0;break}!1===a&&(g.State.isTicking=!1,delete g.State.calls,g.State.calls=[])}r.fn.velocity=r.fn.animate}(window.jQuery||window.Zepto||window,window,document)},"object"==typeof e.exports?e.exports=s():void 0===(n="function"==typeof(o=s)?o.call(t,i,t,e):o)||(e.exports=n)},500:function(e,t){e.exports=function(){throw new Error("define cannot be used indirect")}},501:function(e,t){(function(t){e.exports=t}).call(this,{})},502:function(e,t,i){var o,n,s;!function(r){"use strict";n=[i(3)],void 0===(s="function"==typeof(o=function(e,t){var i={beforeShow:d,move:d,change:d,show:d,hide:d,color:!1,flat:!1,showInput:!1,allowEmpty:!1,showButtons:!0,clickoutFiresChange:!0,showInitial:!1,showPalette:!1,showPaletteOnly:!1,hideAfterPaletteSelect:!1,togglePaletteOnly:!1,showSelectionPalette:!0,localStorageKey:!1,appendTo:"body",maxSelectionSize:7,cancelText:"cancel",chooseText:"choose",togglePaletteMoreText:"more",togglePaletteLessText:"less",clearText:"Clear Color Selection",noColorSelectedText:"No Color Selected",preferredFormat:!1,className:"",containerClassName:"",replacerClassName:"",showAlpha:!1,theme:"sp-light",palette:[["#ffffff","#000000","#ff0000","#ff8000","#ffff00","#008000","#0000ff","#4b0082","#9400d3"]],selectionPalette:[],disabled:!1,offset:null},o=[],n=!!/msie/i.exec(window.navigator.userAgent),s=function(){function e(e,t){return!!~(""+e).indexOf(t)}var t=document.createElement("div"),i=t.style;return i.cssText="background-color:rgba(0,0,0,.5)",e(i.backgroundColor,"rgba")||e(i.backgroundColor,"hsla")}(),r=["<div class='sp-replacer'>","<div class='sp-preview'><div class='sp-preview-inner'></div></div>","<div class='sp-dd'>&#9660;</div>","</div>"].join(""),a=function(){var e="";if(n)for(var t=1;t<=6;t++)e+="<div class='sp-"+t+"'></div>";return["<div class='sp-container sp-hidden'>","<div class='sp-palette-container'>","<div class='sp-palette sp-thumb sp-cf'></div>","<div class='sp-palette-button-container sp-cf'>","<button type='button' class='sp-palette-toggle'></button>","</div>","</div>","<div class='sp-picker-container'>","<div class='sp-top sp-cf'>","<div class='sp-fill'></div>","<div class='sp-top-inner'>","<div class='sp-color'>","<div class='sp-sat'>","<div class='sp-val'>","<div class='sp-dragger'></div>","</div>","</div>","</div>","<div class='sp-clear sp-clear-display'>","</div>","<div class='sp-hue'>","<div class='sp-slider'></div>",e,"</div>","</div>","<div class='sp-alpha'><div class='sp-alpha-inner'><div class='sp-alpha-handle'></div></div></div>","</div>","<div class='sp-input-container sp-cf'>","<input class='sp-input' type='text' spellcheck='false' />","</div>","<div class='sp-initial sp-thumb sp-cf'></div>","<div class='sp-button-container sp-cf'>","<a class='sp-cancel' href='#'></a>","<button type='button' class='sp-choose'></button>","</div>","</div>","</div>"].join("")}();function l(t,i,o,n){for(var r=[],a=0;a<t.length;a++){var l=t[a];if(l){var c=tinycolor(l),d=c.toHsl().l<.5?"sp-thumb-el sp-thumb-dark":"sp-thumb-el sp-thumb-light";d+=tinycolor.equals(i,l)?" sp-thumb-active":"";var h=c.toString(n.preferredFormat||"rgb"),p=s?"background-color:"+c.toRgbString():"filter:"+c.toFilter();r.push('<span title="'+h+'" data-color="'+c.toRgbString()+'" class="'+d+'"><span class="sp-thumb-inner" style="'+p+';" /></span>')}else{r.push(e("<div />").append(e('<span data-color="" style="background-color:transparent;" class="sp-clear-display"></span>').attr("title",n.noColorSelectedText)).html())}}return"<div class='sp-cf "+o+"'>"+r.join("")+"</div>"}function c(c,d){var f,m,_,v,w=function(t,o){var n=e.extend({},i,t);return n.callbacks={move:p(n.move,o),change:p(n.change,o),show:p(n.show,o),hide:p(n.hide,o),beforeShow:p(n.beforeShow,o)},n}(d,c),y=w.flat,b=w.showSelectionPalette,x=w.localStorageKey,k=w.theme,C=w.callbacks,S=(f=He,m=10,function(){var e=this,t=arguments;_&&clearTimeout(v),!_&&v||(v=setTimeout(function(){v=null,f.apply(e,t)},m))}),V=!1,T=!1,B=0,E=0,P=0,M=0,A=0,D=0,R=0,F=0,O=0,z=0,I=1,N=[],$=[],L={},W=w.selectionPalette.slice(0),H=w.maxSelectionSize,j="sp-dragging",U=null,q=c.ownerDocument,Y=(q.body,e(c)),X=!1,J=e(a,q).addClass(k),G=J.find(".sp-picker-container"),Q=J.find(".sp-color"),K=J.find(".sp-dragger"),Z=J.find(".sp-hue"),ee=J.find(".sp-slider"),te=J.find(".sp-alpha-inner"),ie=J.find(".sp-alpha"),oe=J.find(".sp-alpha-handle"),ne=J.find(".sp-input"),se=J.find(".sp-palette"),re=J.find(".sp-initial"),ae=J.find(".sp-cancel"),le=J.find(".sp-clear"),ce=J.find(".sp-choose"),de=J.find(".sp-palette-toggle"),he=Y.is("input"),pe=he&&"color"===Y.attr("type")&&g(),ue=he&&!y,ge=ue?e(r).addClass(k).addClass(w.className).addClass(w.replacerClassName):e([]),fe=ue?ge:Y,me=ge.find(".sp-preview-inner"),_e=w.color||he&&Y.val(),ve=!1,we=w.preferredFormat,ye=!w.showButtons||w.clickoutFiresChange,be=!_e,xe=w.allowEmpty&&!pe;function ke(){if(w.showPaletteOnly&&(w.showPalette=!0),de.text(w.showPaletteOnly?w.togglePaletteMoreText:w.togglePaletteLessText),w.palette){N=w.palette.slice(0),$=e.isArray(N[0])?N:[N],L={};for(var t=0;t<$.length;t++)for(var i=0;i<$[t].length;i++){var o=tinycolor($[t][i]).toRgbString();L[o]=!0}}J.toggleClass("sp-flat",y),J.toggleClass("sp-input-disabled",!w.showInput),J.toggleClass("sp-alpha-enabled",w.showAlpha),J.toggleClass("sp-clear-enabled",xe),J.toggleClass("sp-buttons-disabled",!w.showButtons),J.toggleClass("sp-palette-buttons-disabled",!w.togglePaletteOnly),J.toggleClass("sp-palette-disabled",!w.showPalette),J.toggleClass("sp-palette-only",w.showPaletteOnly),J.toggleClass("sp-initial-disabled",!w.showInitial),J.addClass(w.className).addClass(w.containerClassName),He()}function Ce(){if(x&&window.localStorage){try{var t=window.localStorage[x].split(",#");t.length>1&&(delete window.localStorage[x],e.each(t,function(e,t){Se(t)}))}catch(e){}try{W=window.localStorage[x].split(";")}catch(e){}}}function Se(t){if(b){var i=tinycolor(t).toRgbString();if(!L[i]&&-1===e.inArray(i,W))for(W.push(i);W.length>H;)W.shift();if(x&&window.localStorage)try{window.localStorage[x]=W.join(";")}catch(e){}}}function Ve(){var t=Ie(),i=e.map($,function(e,i){return l(e,t,"sp-palette-row sp-palette-row-"+i,w)});Ce(),W&&i.push(l(function(){var e=[];if(w.showPalette)for(var t=0;t<W.length;t++){var i=tinycolor(W[t]).toRgbString();L[i]||e.push(W[t])}return e.reverse().slice(0,w.maxSelectionSize)}(),t,"sp-palette-row sp-palette-row-selection",w)),se.html(i.join(""))}function Te(){if(w.showInitial){var e=ve,t=Ie();re.html(l([e,t],t,"sp-palette-row-initial",w))}}function Be(){(E<=0||B<=0||M<=0)&&He(),T=!0,J.addClass(j),U=null,Y.trigger("dragstart.spectrum",[Ie()])}function Ee(){T=!1,J.removeClass(j),Y.trigger("dragstop.spectrum",[Ie()])}function Pe(){var e=ne.val();if(null!==e&&""!==e||!xe){var t=tinycolor(e);t.isValid()?(ze(t),We(!0)):ne.addClass("sp-validation-error")}else ze(null),We(!0)}function Me(){V?Fe():Ae()}function Ae(){var t=e.Event("beforeShow.spectrum");V?He():(Y.trigger(t,[Ie()]),!1===C.beforeShow(Ie())||t.isDefaultPrevented()||(!function(){for(var e=0;e<o.length;e++)o[e]&&o[e].hide()}(),V=!0,e(q).bind("keydown.spectrum",De),e(q).bind("click.spectrum",Re),e(window).bind("resize.spectrum",S),ge.addClass("sp-active"),J.removeClass("sp-hidden"),He(),$e(),ve=Ie(),Te(),C.show(ve),Y.trigger("show.spectrum",[ve])))}function De(e){27===e.keyCode&&Fe()}function Re(e){2!=e.button&&(T||(ye?We(!0):Oe(),Fe()))}function Fe(){V&&!y&&(V=!1,e(q).unbind("keydown.spectrum",De),e(q).unbind("click.spectrum",Re),e(window).unbind("resize.spectrum",S),ge.removeClass("sp-active"),J.addClass("sp-hidden"),C.hide(Ie()),Y.trigger("hide.spectrum",[Ie()]))}function Oe(){ze(ve,!0)}function ze(e,t){var i,o;tinycolor.equals(e,Ie())?$e():(!e&&xe?be=!0:(be=!1,i=tinycolor(e),o=i.toHsv(),F=o.h%360/360,O=o.s,z=o.v,I=o.a),$e(),i&&i.isValid()&&!t&&(we=w.preferredFormat||i.getFormat()))}function Ie(e){return e=e||{},xe&&be?null:tinycolor.fromRatio({h:F,s:O,v:z,a:Math.round(100*I)/100},{format:e.format||we})}function Ne(){$e(),C.move(Ie()),Y.trigger("move.spectrum",[Ie()])}function $e(){ne.removeClass("sp-validation-error"),Le();var e=tinycolor.fromRatio({h:F,s:1,v:1});Q.css("background-color",e.toHexString());var t=we;I<1&&(0!==I||"name"!==t)&&("hex"!==t&&"hex3"!==t&&"hex6"!==t&&"name"!==t||(t="rgb"));var i=Ie({format:t}),o="";if(me.removeClass("sp-clear-display"),me.css("background-color","transparent"),!i&&xe)me.addClass("sp-clear-display");else{var r=i.toHexString(),a=i.toRgbString();if(s||1===i.alpha?me.css("background-color",a):(me.css("background-color","transparent"),me.css("filter",i.toFilter())),w.showAlpha){var l=i.toRgb();l.a=0;var c=tinycolor(l).toRgbString(),d="linear-gradient(left, "+c+", "+r+")";n?te.css("filter",tinycolor(c).toFilter({gradientType:1},r)):(te.css("background","-webkit-"+d),te.css("background","-moz-"+d),te.css("background","-ms-"+d),te.css("background","linear-gradient(to right, "+c+", "+r+")"))}o=i.toString(t)}w.showInput&&ne.val(o),w.showPalette&&Ve(),Te()}function Le(){var e=O,t=z;if(xe&&be)oe.hide(),ee.hide(),K.hide();else{oe.show(),ee.show(),K.show();var i=e*B,o=E-t*E;i=Math.max(-P,Math.min(B-P,i-P)),o=Math.max(-P,Math.min(E-P,o-P)),K.css({top:o+"px",left:i+"px"});var n=I*A;oe.css({left:n-D/2+"px"});var s=F*M;ee.css({top:s-R+"px"})}}function We(e){var t=Ie(),i="",o=!tinycolor.equals(t,ve);t&&(i=t.toString(we),Se(t)),he&&Y.val(i),e&&o&&(C.change(t),Y.trigger("change",[t]))}function He(){var t,i,o,n,s,r,a,l,c,d;V&&(B=Q.width(),E=Q.height(),P=K.height(),Z.width(),M=Z.height(),R=ee.height(),A=ie.width(),D=oe.width(),y||(J.css("position","absolute"),w.offset?J.offset(w.offset):J.offset((i=fe,o=(t=J).outerWidth(),n=t.outerHeight(),s=i.outerHeight(),r=t[0].ownerDocument,a=r.documentElement,l=a.clientWidth+e(r).scrollLeft(),c=a.clientHeight+e(r).scrollTop(),(d=i.offset()).top+=s,d.left-=Math.min(d.left,d.left+o>l&&l>o?Math.abs(d.left+o-l):0),d.top-=Math.min(d.top,d.top+n>c&&c>n?Math.abs(n+s-0):0),d))),Le(),w.showPalette&&Ve(),Y.trigger("reflow.spectrum"))}function je(){Fe(),X=!0,Y.attr("disabled",!0),fe.addClass("sp-disabled")}!function(){n&&J.find("*:not(input)").attr("unselectable","on");ke(),ue&&Y.after(ge).hide();xe||le.hide();if(y)Y.after(J).hide();else{var t="parent"===w.appendTo?Y.parent():e(w.appendTo);1!==t.length&&(t=e("body")),t.append(J)}Ce(),fe.bind("click.spectrum touchstart.spectrum",function(t){X||Me(),t.stopPropagation(),e(t.target).is("input")||t.preventDefault()}),(Y.is(":disabled")||!0===w.disabled)&&je();J.click(h),ne.change(Pe),ne.bind("paste",function(){setTimeout(Pe,1)}),ne.keydown(function(e){13==e.keyCode&&Pe()}),ae.text(w.cancelText),ae.bind("click.spectrum",function(e){e.stopPropagation(),e.preventDefault(),Oe(),Fe()}),le.attr("title",w.clearText),le.bind("click.spectrum",function(e){e.stopPropagation(),e.preventDefault(),be=!0,Ne(),y&&We(!0)}),ce.text(w.chooseText),ce.bind("click.spectrum",function(e){e.stopPropagation(),e.preventDefault(),n&&ne.is(":focus")&&ne.trigger("change"),ne.hasClass("sp-validation-error")||(We(!0),Fe())}),de.text(w.showPaletteOnly?w.togglePaletteMoreText:w.togglePaletteLessText),de.bind("click.spectrum",function(e){e.stopPropagation(),e.preventDefault(),w.showPaletteOnly=!w.showPaletteOnly,w.showPaletteOnly||y||J.css("left","-="+(G.outerWidth(!0)+5)),ke()}),u(ie,function(e,t,i){I=e/A,be=!1,i.shiftKey&&(I=Math.round(10*I)/10),Ne()},Be,Ee),u(Z,function(e,t){F=parseFloat(t/M),be=!1,w.showAlpha||(I=1),Ne()},Be,Ee),u(Q,function(e,t,i){if(i.shiftKey){if(!U){var o=O*B,n=E-z*E,s=Math.abs(e-o)>Math.abs(t-n);U=s?"x":"y"}}else U=null;var r=!U||"y"===U;(!U||"x"===U)&&(O=parseFloat(e/B)),r&&(z=parseFloat((E-t)/E)),be=!1,w.showAlpha||(I=1),Ne()},Be,Ee),_e?(ze(_e),$e(),we=w.preferredFormat||tinycolor(_e).format,Se(_e)):$e();y&&Ae();function i(t){return t.data&&t.data.ignore?(ze(e(t.target).closest(".sp-thumb-el").data("color")),Ne()):(ze(e(t.target).closest(".sp-thumb-el").data("color")),Ne(),We(!0),w.hideAfterPaletteSelect&&Fe()),!1}var o=n?"mousedown.spectrum":"click.spectrum touchstart.spectrum";se.delegate(".sp-thumb-el",o,i),re.delegate(".sp-thumb-el:nth-child(1)",o,{ignore:!0},i)}();var Ue={show:Ae,hide:Fe,toggle:Me,reflow:He,option:function(i,o){if(i===t)return e.extend({},w);if(o===t)return w[i];w[i]=o,"preferredFormat"===i&&(we=w.preferredFormat);ke()},enable:function(){X=!1,Y.attr("disabled",!1),fe.removeClass("sp-disabled")},disable:je,offset:function(e){w.offset=e,He()},set:function(e){ze(e),We()},get:Ie,destroy:function(){Y.show(),fe.unbind("click.spectrum touchstart.spectrum"),J.remove(),ge.remove(),o[Ue.id]=null},container:J};return Ue.id=o.push(Ue)-1,Ue}function d(){}function h(e){e.stopPropagation()}function p(e,t){var i=Array.prototype.slice,o=i.call(arguments,2);return function(){return e.apply(t,o.concat(i.call(arguments)))}}function u(t,i,o,s){i=i||function(){},o=o||function(){},s=s||function(){};var r=document,a=!1,l={},c=0,d=0,h="ontouchstart"in window,p={};function u(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault(),e.returnValue=!1}function g(e){if(a){if(n&&r.documentMode<9&&!e.button)return f();var o=e.originalEvent&&e.originalEvent.touches&&e.originalEvent.touches[0],s=o&&o.pageX||e.pageX,p=o&&o.pageY||e.pageY,g=Math.max(0,Math.min(s-l.left,d)),m=Math.max(0,Math.min(p-l.top,c));h&&u(e),i.apply(t,[g,m,e])}}function f(){a&&(e(r).unbind(p),e(r.body).removeClass("sp-dragging"),setTimeout(function(){s.apply(t,arguments)},0)),a=!1}p.selectstart=u,p.dragstart=u,p["touchmove mousemove"]=g,p["touchend mouseup"]=f,e(t).bind("touchstart mousedown",function(i){(i.which?3==i.which:2==i.button)||a||!1!==o.apply(t,arguments)&&(a=!0,c=e(t).height(),d=e(t).width(),l=e(t).offset(),e(r).bind(p),e(r.body).addClass("sp-dragging"),g(i),u(i))})}function g(){return e.fn.spectrum.inputTypeColorSupport()}e.fn.spectrum=function(t,i){if("string"==typeof t){var n=this,s=Array.prototype.slice.call(arguments,1);return this.each(function(){var i=o[e(this).data("spectrum.id")];if(i){var r=i[t];if(!r)throw new Error("Spectrum: no such method: '"+t+"'");"get"==t?n=i.get():"container"==t?n=i.container:"option"==t?n=i.option.apply(i,s):"destroy"==t?(i.destroy(),e(this).removeData("spectrum.id")):r.apply(i,s)}}),n}return this.spectrum("destroy").each(function(){var i=e.extend({},t,e(this).data()),o=c(this,i);e(this).data("spectrum.id",o.id)})},e.fn.spectrum.load=!0,e.fn.spectrum.loadOpts={},e.fn.spectrum.draggable=u,e.fn.spectrum.defaults=i,e.fn.spectrum.inputTypeColorSupport=function t(){if(void 0===t._cachedResult){var i=e("<input type='color'/>")[0];t._cachedResult="color"===i.type&&""!==i.value}return t._cachedResult},e.spectrum={},e.spectrum.localization={},e.spectrum.palettes={},e.fn.spectrum.processNativeColorInputs=function(){var t=e("input[type=color]");t.length&&!g()&&t.spectrum({preferredFormat:"hex6"})},function(){var e=/^[\s,#]+/,t=/\s+#x2F;,i=0,o=Math,n=o.round,s=o.min,r=o.max,a=o.random,l=function(a,c){if(c=c||{},(a=a||"")instanceof l)return a;if(!(this instanceof l))return new l(a,c);var d=function(i){var n={r:0,g:0,b:0},a=1,l=!1,c=!1;"string"==typeof i&&(i=function(i){i=i.replace(e,"").replace(t,"").toLowerCase();var o,n=!1;if(V[i])i=V[i],n=!0;else if("transparent"==i)return{r:0,g:0,b:0,a:0,format:"name"};if(o=z.rgb.exec(i))return{r:o[1],g:o[2],b:o[3]};if(o=z.rgba.exec(i))return{r:o[1],g:o[2],b:o[3],a:o[4]};if(o=z.hsl.exec(i))return{h:o[1],s:o[2],l:o[3]};if(o=z.hsla.exec(i))return{h:o[1],s:o[2],l:o[3],a:o[4]};if(o=z.hsv.exec(i))return{h:o[1],s:o[2],v:o[3]};if(o=z.hsva.exec(i))return{h:o[1],s:o[2],v:o[3],a:o[4]};if(o=z.hex8.exec(i))return{a:(s=o[1],M(s)/255),r:M(o[2]),g:M(o[3]),b:M(o[4]),format:n?"name":"hex8"};var s;if(o=z.hex6.exec(i))return{r:M(o[1]),g:M(o[2]),b:M(o[3]),format:n?"name":"hex"};if(o=z.hex3.exec(i))return{r:M(o[1]+""+o[1]),g:M(o[2]+""+o[2]),b:M(o[3]+""+o[3]),format:n?"name":"hex"};return!1}(i));"object"==typeof i&&(i.hasOwnProperty("r")&&i.hasOwnProperty("g")&&i.hasOwnProperty("b")?(d=i.r,h=i.g,p=i.b,n={r:255*E(d,255),g:255*E(h,255),b:255*E(p,255)},l=!0,c="%"===String(i.r).substr(-1)?"prgb":"rgb"):i.hasOwnProperty("h")&&i.hasOwnProperty("s")&&i.hasOwnProperty("v")?(i.s=D(i.s),i.v=D(i.v),n=function(e,t,i){e=6*E(e,360),t=E(t,100),i=E(i,100);var n=o.floor(e),s=e-n,r=i*(1-t),a=i*(1-s*t),l=i*(1-(1-s)*t),c=n%6;return{r:255*[i,a,r,r,l,i][c],g:255*[l,i,i,a,r,r][c],b:255*[r,r,l,i,i,a][c]}}(i.h,i.s,i.v),l=!0,c="hsv"):i.hasOwnProperty("h")&&i.hasOwnProperty("s")&&i.hasOwnProperty("l")&&(i.s=D(i.s),i.l=D(i.l),n=function(e,t,i){var o,n,s;function r(e,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+6*(t-e)*i:i<.5?t:i<2/3?e+(t-e)*(2/3-i)*6:e}if(e=E(e,360),t=E(t,100),i=E(i,100),0===t)o=n=s=i;else{var a=i<.5?i*(1+t):i+t-i*t,l=2*i-a;o=r(l,a,e+1/3),n=r(l,a,e),s=r(l,a,e-1/3)}return{r:255*o,g:255*n,b:255*s}}(i.h,i.s,i.l),l=!0,c="hsl"),i.hasOwnProperty("a")&&(a=i.a));var d,h,p;return a=B(a),{ok:l,format:i.format||c,r:s(255,r(n.r,0)),g:s(255,r(n.g,0)),b:s(255,r(n.b,0)),a:a}}(a);this._originalInput=a,this._r=d.r,this._g=d.g,this._b=d.b,this._a=d.a,this._roundA=n(100*this._a)/100,this._format=c.format||d.format,this._gradientType=c.gradientType,this._r<1&&(this._r=n(this._r)),this._g<1&&(this._g=n(this._g)),this._b<1&&(this._b=n(this._b)),this._ok=d.ok,this._tc_id=i++};function c(e,t,i){e=E(e,255),t=E(t,255),i=E(i,255);var o,n,a=r(e,t,i),l=s(e,t,i),c=(a+l)/2;if(a==l)o=n=0;else{var d=a-l;switch(n=c>.5?d/(2-a-l):d/(a+l),a){case e:o=(t-i)/d+(t<i?6:0);break;case t:o=(i-e)/d+2;break;case i:o=(e-t)/d+4}o/=6}return{h:o,s:n,l:c}}function d(e,t,i){e=E(e,255),t=E(t,255),i=E(i,255);var o,n,a=r(e,t,i),l=s(e,t,i),c=a,d=a-l;if(n=0===a?0:d/a,a==l)o=0;else{switch(a){case e:o=(t-i)/d+(t<i?6:0);break;case t:o=(i-e)/d+2;break;case i:o=(e-t)/d+4}o/=6}return{h:o,s:n,v:c}}function h(e,t,i,o){var s=[A(n(e).toString(16)),A(n(t).toString(16)),A(n(i).toString(16))];return o&&s[0].charAt(0)==s[0].charAt(1)&&s[1].charAt(0)==s[1].charAt(1)&&s[2].charAt(0)==s[2].charAt(1)?s[0].charAt(0)+s[1].charAt(0)+s[2].charAt(0):s.join("")}function p(e,t,i,o){var s,r=[A((s=o,Math.round(255*parseFloat(s)).toString(16))),A(n(e).toString(16)),A(n(t).toString(16)),A(n(i).toString(16))];return r.join("")}function u(e,t){t=0===t?0:t||10;var i=l(e).toHsl();return i.s-=t/100,i.s=P(i.s),l(i)}function g(e,t){t=0===t?0:t||10;var i=l(e).toHsl();return i.s+=t/100,i.s=P(i.s),l(i)}function f(e){return l(e).desaturate(100)}function m(e,t){t=0===t?0:t||10;var i=l(e).toHsl();return i.l+=t/100,i.l=P(i.l),l(i)}function _(e,t){t=0===t?0:t||10;var i=l(e).toRgb();return i.r=r(0,s(255,i.r-n(-t/100*255))),i.g=r(0,s(255,i.g-n(-t/100*255))),i.b=r(0,s(255,i.b-n(-t/100*255))),l(i)}function v(e,t){t=0===t?0:t||10;var i=l(e).toHsl();return i.l-=t/100,i.l=P(i.l),l(i)}function w(e,t){var i=l(e).toHsl(),o=(n(i.h)+t)%360;return i.h=o<0?360+o:o,l(i)}function y(e){var t=l(e).toHsl();return t.h=(t.h+180)%360,l(t)}function b(e){var t=l(e).toHsl(),i=t.h;return[l(e),l({h:(i+120)%360,s:t.s,l:t.l}),l({h:(i+240)%360,s:t.s,l:t.l})]}function x(e){var t=l(e).toHsl(),i=t.h;return[l(e),l({h:(i+90)%360,s:t.s,l:t.l}),l({h:(i+180)%360,s:t.s,l:t.l}),l({h:(i+270)%360,s:t.s,l:t.l})]}function k(e){var t=l(e).toHsl(),i=t.h;return[l(e),l({h:(i+72)%360,s:t.s,l:t.l}),l({h:(i+216)%360,s:t.s,l:t.l})]}function C(e,t,i){t=t||6,i=i||30;var o=l(e).toHsl(),n=360/i,s=[l(e)];for(o.h=(o.h-(n*t>>1)+720)%360;--t;)o.h=(o.h+n)%360,s.push(l(o));return s}function S(e,t){t=t||6;for(var i=l(e).toHsv(),o=i.h,n=i.s,s=i.v,r=[],a=1/t;t--;)r.push(l({h:o,s:n,v:s})),s=(s+a)%1;return r}l.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},setAlpha:function(e){return this._a=B(e),this._roundA=n(100*this._a)/100,this},toHsv:function(){var e=d(this._r,this._g,this._b);return{h:360*e.h,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=d(this._r,this._g,this._b),t=n(360*e.h),i=n(100*e.s),o=n(100*e.v);return 1==this._a?"hsv("+t+", "+i+"%, "+o+"%)":"hsva("+t+", "+i+"%, "+o+"%, "+this._roundA+")"},toHsl:function(){var e=c(this._r,this._g,this._b);return{h:360*e.h,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=c(this._r,this._g,this._b),t=n(360*e.h),i=n(100*e.s),o=n(100*e.l);return 1==this._a?"hsl("+t+", "+i+"%, "+o+"%)":"hsla("+t+", "+i+"%, "+o+"%, "+this._roundA+")"},toHex:function(e){return h(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(){return p(this._r,this._g,this._b,this._a)},toHex8String:function(){return"#"+this.toHex8()},toRgb:function(){return{r:n(this._r),g:n(this._g),b:n(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+n(this._r)+", "+n(this._g)+", "+n(this._b)+")":"rgba("+n(this._r)+", "+n(this._g)+", "+n(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:n(100*E(this._r,255))+"%",g:n(100*E(this._g,255))+"%",b:n(100*E(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+n(100*E(this._r,255))+"%, "+n(100*E(this._g,255))+"%, "+n(100*E(this._b,255))+"%)":"rgba("+n(100*E(this._r,255))+"%, "+n(100*E(this._g,255))+"%, "+n(100*E(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(T[h(this._r,this._g,this._b,!0)]||!1)},toFilter:function(e){var t="#"+p(this._r,this._g,this._b,this._a),i=t,o=this._gradientType?"GradientType = 1, ":"";if(e){var n=l(e);i=n.toHex8String()}return"progid:DXImageTransform.Microsoft.gradient("+o+"startColorstr="+t+",endColorstr="+i+")"},toString:function(e){var t=!!e;e=e||this._format;var i=!1,o=this._a<1&&this._a>=0,n=!t&&o&&("hex"===e||"hex6"===e||"hex3"===e||"name"===e);return n?"name"===e&&0===this._a?this.toName():this.toRgbString():("rgb"===e&&(i=this.toRgbString()),"prgb"===e&&(i=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(i=this.toHexString()),"hex3"===e&&(i=this.toHexString(!0)),"hex8"===e&&(i=this.toHex8String()),"name"===e&&(i=this.toName()),"hsl"===e&&(i=this.toHslString()),"hsv"===e&&(i=this.toHsvString()),i||this.toHexString())},_applyModification:function(e,t){var i=e.apply(null,[this].concat([].slice.call(t)));return this._r=i._r,this._g=i._g,this._b=i._b,this.setAlpha(i._a),this},lighten:function(){return this._applyModification(m,arguments)},brighten:function(){return this._applyModification(_,arguments)},darken:function(){return this._applyModification(v,arguments)},desaturate:function(){return this._applyModification(u,arguments)},saturate:function(){return this._applyModification(g,arguments)},greyscale:function(){return this._applyModification(f,arguments)},spin:function(){return this._applyModification(w,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(C,arguments)},complement:function(){return this._applyCombination(y,arguments)},monochromatic:function(){return this._applyCombination(S,arguments)},splitcomplement:function(){return this._applyCombination(k,arguments)},triad:function(){return this._applyCombination(b,arguments)},tetrad:function(){return this._applyCombination(x,arguments)}},l.fromRatio=function(e,t){if("object"==typeof e){var i={};for(var o in e)e.hasOwnProperty(o)&&(i[o]="a"===o?e[o]:D(e[o]));e=i}return l(e,t)},l.equals=function(e,t){return!(!e||!t)&&l(e).toRgbString()==l(t).toRgbString()},l.random=function(){return l.fromRatio({r:a(),g:a(),b:a()})},l.mix=function(e,t,i){i=0===i?0:i||50;var o,n=l(e).toRgb(),s=l(t).toRgb(),r=i/100,a=2*r-1,c=s.a-n.a,d=1-(o=((o=a*c==-1?a:(a+c)/(1+a*c))+1)/2),h={r:s.r*o+n.r*d,g:s.g*o+n.g*d,b:s.b*o+n.b*d,a:s.a*r+n.a*(1-r)};return l(h)},l.readability=function(e,t){var i=l(e),o=l(t),n=i.toRgb(),s=o.toRgb(),r=i.getBrightness(),a=o.getBrightness(),c=Math.max(n.r,s.r)-Math.min(n.r,s.r)+Math.max(n.g,s.g)-Math.min(n.g,s.g)+Math.max(n.b,s.b)-Math.min(n.b,s.b);return{brightness:Math.abs(r-a),color:c}},l.isReadable=function(e,t){var i=l.readability(e,t);return i.brightness>125&&i.color>500},l.mostReadable=function(e,t){for(var i=null,o=0,n=!1,s=0;s<t.length;s++){var r=l.readability(e,t[s]),a=r.brightness>125&&r.color>500,c=r.brightness/125*3+r.color/500;(a&&!n||a&&n&&c>o||!a&&!n&&c>o)&&(n=a,o=c,i=l(t[s]))}return i};var V=l.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},T=l.hexNames=function(e){var t={};for(var i in e)e.hasOwnProperty(i)&&(t[e[i]]=i);return t}(V);function B(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function E(e,t){(function(e){return"string"==typeof e&&-1!=e.indexOf(".")&&1===parseFloat(e)})(e)&&(e="100%");var i=function(e){return"string"==typeof e&&-1!=e.indexOf("%")}(e);return e=s(t,r(0,parseFloat(e))),i&&(e=parseInt(e*t,10)/100),o.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function P(e){return s(1,r(0,e))}function M(e){return parseInt(e,16)}function A(e){return 1==e.length?"0"+e:""+e}function D(e){return e<=1&&(e=100*e+"%"),e}var R,F,O,z=(F="[\\s|\\(]+("+(R="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+R+")[,|\\s]+("+R+")\\s*\\)?",O="[\\s|\\(]+("+R+")[,|\\s]+("+R+")[,|\\s]+("+R+")[,|\\s]+("+R+")\\s*\\)?",{rgb:new RegExp("rgb"+F),rgba:new RegExp("rgba"+O),hsl:new RegExp("hsl"+F),hsla:new RegExp("hsla"+O),hsv:new RegExp("hsv"+F),hsva:new RegExp("hsva"+O),hex3:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})#x2F;,hex6:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})#x2F;,hex8:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})#x2F;});window.tinycolor=l}(),e(function(){e.fn.spectrum.load&&e.fn.spectrum.processNativeColorInputs()})})?o.apply(t,n):o)||(e.exports=s)}()},503:function(e,t,i){i(504),e.exports=i(18).parseFloat},504:function(e,t,i){var o=i(24),n=i(505);o(o.G+o.F*(parseFloat!=n),{parseFloat:n})},505:function(e,t,i){var o=i(23).parseFloat,n=i(251).trim;e.exports=1/o(i(92)+"-0")!=-1/0?function(e){var t=n(String(e),3),i=o(t);return 0===i&&"-"==t.charAt(0)?-0:i}:o},507:function(e,t,i){"use strict";i.r(t);i(498),i(499);var o=i(249),n=i.n(o),s=i(19),r=i.n(s),a=i(42),l=i.n(a),c=i(0),d=i(1),h=i.n(d),p=i(21),u=i.n(p),g=i(5),f=i.n(g),m=function(){window.config.dragDemoUrlSettings||f()(window.config.installedAt).isBefore(f()().subtract(7,"days"))||c.a.Modal.popup({title:c.a.I18n.t("tutorialVideoTitle"),template:'<div class="mailpoet_drag_and_drop_tutorial"><video style="height:640px;" src="'.concat(window.config.dragDemoUrl,'" controls autoplay></video></div>'),onCancel:function(){c.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"user_flags",action:"set",data:{editor_tutorial_seen:1}})}})};r.a.addAction("mailpoet_newsletters_editor_initialize",function(e){var t;document.getElementById("mailpoet_editor")&&window.EditorApplication&&(c.a.Modal.loading(!0),c.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"get",data:{id:(t="id",(document.location.search.split("".concat(t,"="))[1]||"").split("&")[0])}}).always(function(){return c.a.Modal.loading(!1)}).always(function(){return m()}).done(function(t){var i,o,s,a=t.data;n.a.resolve(r.a.applyFilters("mailpoet_newsletters_editor_extend_config",e,a)).then(function(e){window.EditorApplication.start({newsletter:a,config:e})}).catch(function(){window.EditorApplication.start({newsletter:a,config:e})}),i=a.type,o=document.getElementById("mailpoet_editor_breadcrumb"),s=r.a.applyFilters("mailpoet_newsletters_editor_breadcrumb",h.a.createElement(l.a,{step:"editor"}),i,"editor"),u.a.render(s,o),"sending"===a.status&&a.queue&&null===a.queue.status&&c.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sending_queue",action:"pause",data:{newsletter_id:a.id}}).done(function(){return c.a.Notice.success(c.a.I18n.t("newsletterIsPaused"))}).fail(function(e){e.errors.length>0&&c.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0,static:!0})})}).fail(function(e){e.errors.length>0&&c.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0,static:!0})}))});var _=i(13),v=i.n(_),w=i(90),y=i.n(w),b=y.a,x=v.a.View.extend({el:"#mailpoet_editor",regions:{stylesRegion:"#mailpoet_editor_styles",contentRegion:"#mailpoet_editor_content",sidebarRegion:"#mailpoet_editor_sidebar",bottomRegion:"#mailpoet_editor_bottom",headingRegion:"#mailpoet_editor_heading",topRegion:"#mailpoet_editor_top"}}),k=new(v.a.Application.extend({region:"#mailpoet_editor",onStart:function(){this._appView=new x,this.showView(this._appView)},getChannel:function(e){return void 0===e?b.channel("global"):b.channel(e)}}));window.EditorApplication=k;var C=k,S=i(30),V=i.n(S),T=i(4),B=i.n(T),E={};E.ConfigModel=V.a.extend({defaults:{availableStyles:{},socialIcons:{},blockDefaults:{},sidepanelWidth:"331px",validation:{},urls:{}}}),E._config={},E.getConfig=function(){return E._config},E.setConfig=function(e){return E._config=new E.ConfigModel(e,{parse:!0}),E._config},C.on("before:start",function(e,t){var i=e,o=B.a.clone(t.config);i.getConfig=E.getConfig,i.setConfig=E.setConfig,o.blockDefaults=B.a.extend(o.blockDefaults,t.newsletter.body.blockDefaults||{}),i.setConfig(o)});var P=i(3),M=i.n(P),A={};A.StylesModel=V.a.extend({defaults:{text:{fontColor:"#000000",fontFamily:"Arial",fontSize:"16px",lineHeight:"1.6"},h1:{fontColor:"#111111",fontFamily:"Arial",fontSize:"40px",lineHeight:"1.6"},h2:{fontColor:"#222222",fontFamily:"Tahoma",fontSize:"32px",lineHeight:"1.6"},h3:{fontColor:"#333333",fontFamily:"Verdana",fontSize:"24px",lineHeight:"1.6"},link:{fontColor:"#21759B",textDecoration:"underline"},wrapper:{backgroundColor:"#ffffff"},body:{backgroundColor:"#cccccc"}},initialize:function(e){this.set(M.a.extend(!0,{},this.defaults,e)),this.on("change",function(){C.getChannel().trigger("autoSave")})}}),A.StylesView=v.a.View.extend({getTemplate:function(){return window.templates.styles},modelEvents:{change:"render"},serializeData:function(){return this.model.toJSON()}}),A._globalStyles=new V.a,A.getGlobalStyles=function(){return A._globalStyles},A.setGlobalStyles=function(e){return A._globalStyles=new A.StylesModel(e),A._globalStyles},A.getAvailableStyles=function(){return C.getConfig().get("availableStyles")},C.on("before:start",function(e,t){var i,o,n=e;n.getGlobalStyles=A.getGlobalStyles,n.setGlobalStyles=A.setGlobalStyles,n.getAvailableStyles=A.getAvailableStyles,i=t.newsletter.body,o=B.a.has(i,"globalStyles")?i.globalStyles:{},this.setGlobalStyles(o)}),C.on("start",function(e){var t=new A.StylesView({model:e.getGlobalStyles()});e._appView.showChildView("stylesRegion",t)});var D=i(20),R=i.n(D),F=(i(252),{_query:function(e){return c.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"automatedLatestContent",action:e.action,data:e.options||{}})}});F._cachedQuery=B.a.memoize(F._query,R.a),F.getNewsletter=function(e){return F._query({action:"get",options:e})},F.getPostTypes=function(){return F._cachedQuery({action:"getPostTypes",options:{}}).then(function(e){return B.a.values(e.data)})},F.getTaxonomies=function(e){return F._cachedQuery({action:"getTaxonomies",options:{postType:e}}).then(function(e){return e.data})},F.getTerms=function(e){return F._cachedQuery({action:"getTerms",options:e}).then(function(e){return e.data})},F.getPosts=function(e){return F._cachedQuery({action:"getPosts",options:e}).then(function(e){return e.data})},F.getTransformedPosts=function(e){return F._cachedQuery({action:"getTransformedPosts",options:e}).then(function(e){return e.data})},F.getBulkTransformedPosts=function(e){return F._query({action:"getBulkTransformedPosts",options:e}).then(function(e){return e.data})},F.saveNewsletter=function(e){return c.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"save",data:e||{}})},F.previewNewsletter=function(e){return c.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"sendPreview",data:e||{}})},C.on("start",function(){F.getPostTypes()});var O,z=F,I=i(26),N=i.n(I),$={};$._contentWidgets=new(N.a.Collection.extend({model:V.a.extend({defaults:{name:"",priority:100,widgetView:void 0}}),comparator:"priority"})),$.registerWidget=function(e){return $._contentWidgets.add(e)},$.getWidgets=function(){return $._contentWidgets},$._layoutWidgets=new(N.a.Collection.extend({model:V.a.extend({defaults:{name:"",priority:100,widgetView:void 0}}),comparator:"priority"})),$.registerLayoutWidget=function(e){return $._layoutWidgets.add(e)},$.getLayoutWidgets=function(){return $._layoutWidgets},O=v.a.View.extend({getTemplate:function(){return window.templates.sidebar},regions:{contentRegion:".mailpoet_content_region",layoutRegion:".mailpoet_layout_region",stylesRegion:".mailpoet_styles_region",previewRegion:".mailpoet_preview_region"},events:{"click .mailpoet_sidebar_region h3, .mailpoet_sidebar_region .handlediv":function(e){var t=this.$el.find(".mailpoet_sidebar_region:not(.closed)"),i=this.$el.find(e.target).closest(".mailpoet_sidebar_region");t.find(".mailpoet_region_content").velocity("slideUp",{duration:250,easing:"easeOut",complete:function(){t.addClass("closed")}}),t.get(0)!==i.get(0)&&i.find(".mailpoet_region_content").velocity("slideDown",{duration:250,easing:"easeIn",complete:function(){i.removeClass("closed")}})}},initialize:function(){M()(window).on("resize",this.updateHorizontalScroll.bind(this)).on("scroll",this.updateHorizontalScroll.bind(this))},onRender:function(){this.showChildView("contentRegion",new $.SidebarWidgetsView(C.getWidgets())),this.showChildView("layoutRegion",new $.SidebarLayoutWidgetsView(C.getLayoutWidgets())),this.showChildView("stylesRegion",new $.SidebarStylesView({model:C.getGlobalStyles(),availableStyles:C.getAvailableStyles()})),this.showChildView("previewRegion",new $.SidebarPreviewView)},updateHorizontalScroll:function(){this.$el.parent().each(function(){var e,t=M()(this);"fixed"===t.css("position")?(e=t.parent().offset().left-M()(window).scrollLeft(),t.css("left",e+"px")):t.css("left","")})},onDomRefresh:function(){this.$el.parent().stick_in_parent({offset_top:32}),this.$el.parent().on("sticky_kit:stick",this.updateHorizontalScroll.bind(this)),this.$el.parent().on("sticky_kit:unstick",this.updateHorizontalScroll.bind(this)),this.$el.parent().on("sticky_kit:bottom",this.updateHorizontalScroll.bind(this)),this.$el.parent().on("sticky_kit:unbottom",this.updateHorizontalScroll.bind(this))}}),$.SidebarWidgetsCollectionView=v.a.CollectionView.extend({childView:function(e){return e.get("widgetView")}}),$.SidebarWidgetsView=v.a.View.extend({getTemplate:function(){return window.templates.sidebarContent},regions:{widgets:".mailpoet_region_content"},initialize:function(e){this.widgets=e},onRender:function(){this.showChildView("widgets",new $.SidebarWidgetsCollectionView({collection:this.widgets}))}}),$.SidebarLayoutWidgetsView=$.SidebarWidgetsView.extend({getTemplate:function(){return window.templates.sidebarLayout}}),$.SidebarStylesView=v.a.View.extend({getTemplate:function(){return window.templates.sidebarStyles},behaviors:{ColorPickerBehavior:{}},events:function(){return{"change #mailpoet_text_font_color":B.a.partial(this.changeColorField,"text.fontColor"),"change #mailpoet_text_font_family":function(e){this.model.set("text.fontFamily",e.target.value)},"change #mailpoet_text_font_size":function(e){this.model.set("text.fontSize",e.target.value)},"change #mailpoet_h1_font_color":B.a.partial(this.changeColorField,"h1.fontColor"),"change #mailpoet_h1_font_family":function(e){this.model.set("h1.fontFamily",e.target.value)},"change #mailpoet_h1_font_size":function(e){this.model.set("h1.fontSize",e.target.value)},"change #mailpoet_h2_font_color":B.a.partial(this.changeColorField,"h2.fontColor"),"change #mailpoet_h2_font_family":function(e){this.model.set("h2.fontFamily",e.target.value)},"change #mailpoet_h2_font_size":function(e){this.model.set("h2.fontSize",e.target.value)},"change #mailpoet_h3_font_color":B.a.partial(this.changeColorField,"h3.fontColor"),"change #mailpoet_h3_font_family":function(e){this.model.set("h3.fontFamily",e.target.value)},"change #mailpoet_h3_font_size":function(e){this.model.set("h3.fontSize",e.target.value)},"change #mailpoet_a_font_color":B.a.partial(this.changeColorField,"link.fontColor"),"change #mailpoet_a_font_underline":function(e){this.model.set("link.textDecoration",e.target.checked?e.target.value:"none")},"change #mailpoet_text_line_height":function(e){this.model.set("text.lineHeight",e.target.value)},"change #mailpoet_heading_line_height":function(e){this.model.set("h1.lineHeight",e.target.value),this.model.set("h2.lineHeight",e.target.value),this.model.set("h3.lineHeight",e.target.value)},"change #mailpoet_newsletter_background_color":B.a.partial(this.changeColorField,"wrapper.backgroundColor"),"change #mailpoet_background_color":B.a.partial(this.changeColorField,"body.backgroundColor")}},templateContext:function(){return{model:this.model.toJSON(),availableStyles:this.availableStyles.toJSON()}},initialize:function(e){this.availableStyles=e.availableStyles},changeField:function(e,t){this.model.set(e,M()(t.target).val())},changeColorField:function(e,t){var i=M()(t.target).val();""===i&&(i="transparent"),this.model.set(e,i)}}),$.SidebarPreviewView=v.a.View.extend({getTemplate:function(){return window.templates.sidebarPreview},events:{"click .mailpoet_show_preview":"showPreview","click #mailpoet_send_preview":"sendPreview"},onBeforeDestroy:function(){this.previewView&&(this.previewView.destroy(),this.previewView=null)},showPreview:function(){var e=C.toJSON();B.a.isUndefined(e.body)||(e.body=R()(e.body)),c.a.Modal.loading(!0),c.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"showPreview",data:e}).always(function(){c.a.Modal.loading(!1)}).done(function(e){this.previewView=new $.NewsletterPreviewView({previewType:window.localStorage.getItem(C.getConfig().get("newsletterPreview.previewTypeLocalStorageKey")),previewUrl:e.meta.preview_url}),this.previewView.render(),c.a.Modal.popup({template:"",element:this.previewView.$el,minWidth:"95%",height:"100%",title:c.a.I18n.t("newsletterPreview"),onCancel:function(){this.previewView.destroy(),this.previewView=null}.bind(this)}),c.a.trackEvent("Editor > Browser Preview",{"MailPoet Free version":window.mailpoet_version})}.bind(this)).fail(function(e){e.errors.length>0&&c.a.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})})},sendPreview:function(){var e=this.$("#mailpoet_preview_to_email"),t={subscriber:e.val(),id:C.getNewsletter().get("id")};if(t.subscriber.length<=0)return c.a.Notice.error(c.a.I18n.t("newsletterPreviewEmailMissing"),{positionAfter:e,scroll:!0}),!1;c.a.Modal.loading(!0),C.getChannel().request("save").always(function(){z.previewNewsletter(t).always(function(){c.a.Modal.loading(!1)}).done(function(){c.a.Notice.success(c.a.I18n.t("newsletterPreviewSent"),{scroll:!0}),c.a.trackEvent("Editor > Preview sent",{"MailPoet Free version":window.mailpoet_version,"Domain name":t.subscriber.substring(t.subscriber.indexOf("@")+1)}),c.a.Poll.successDelivery.canShow("preview")&&(c.a.Poll.successDelivery.showModal("preview","IHedf1"),c.a.Poll.successDelivery.setPollShown("preview"))}).fail(function(e){e.errors.length>0&&c.a.Notice.error(e.errors.map(function(e){var t="\n <p>\n ".concat(c.a.I18n.t("newsletterPreviewErrorNotice").replace("%$1s",window.config.mtaMethod),":\n <i>").concat(e.message,"</i>\n </p>\n ");if("PHPMail"===window.config.mtaMethod)t+="\n <p>".concat(c.a.I18n.t("newsletterPreviewErrorCheckConfiguration"),"</p>\n <br />\n <p>").concat(c.a.I18n.t("newsletterPreviewErrorUseSendingService"),'</p>\n <p>\n <a\n href="https://www.mailpoet.com/free-plan/?utm_source=plugin&utm_campaign=sending-error"\n target="_blank"\n rel="noopener noreferrer"\n >\n ').concat(c.a.I18n.t("newsletterPreviewErrorSignUpForSendingService"),"\n </a>\n </p>\n ");else{var i=c.a.I18n.t("newsletterPreviewErrorCheckSettingsNotice").replace(/\[link\](.*?)\[\/link\]/g,'<a href="?page=mailpoet-settings#mta" key="check-sending">$1</a>');t+="<p>".concat(i,"</p>")}return t}),{scroll:!0,static:!0})})})}}),$.NewsletterPreviewView=v.a.View.extend({className:"mailpoet_browser_preview_wrapper",getTemplate:function(){return window.templates.newsletterPreview},events:function(){return{"change .mailpoet_browser_preview_type":"changeBrowserPreviewType"}},initialize:function(e){this.previewType=e.previewType,this.previewUrl=e.previewUrl,this.width="100%",this.height="100%"},templateContext:function(){return{previewType:this.previewType,previewUrl:this.previewUrl,width:this.width,height:this.height}},changeBrowserPreviewType:function(e){var t=M()(e.target).val();"mobile"===t?(this.$(".mailpoet_browser_preview_container").removeClass("mailpoet_browser_preview_container_desktop"),this.$(".mailpoet_browser_preview_container").addClass("mailpoet_browser_preview_container_mobile")):(this.$(".mailpoet_browser_preview_container").addClass("mailpoet_browser_preview_container_desktop"),this.$(".mailpoet_browser_preview_container").removeClass("mailpoet_browser_preview_container_mobile")),window.localStorage.setItem(C.getConfig().get("newsletterPreview.previewTypeLocalStorageKey"),t),this.previewType=t}}),C.on("before:start",function(e){var t=e;t.registerWidget=$.registerWidget,t.getWidgets=$.getWidgets,t.registerLayoutWidget=$.registerLayoutWidget,t.getLayoutWidgets=$.getLayoutWidgets}),C.on("start",function(e){var t=new O;e._appView.showChildView("sidebarRegion",t),c.a.helpTooltip.show(document.getElementById("tooltip-send-preview"),{tooltipId:"tooltip-editor-send-preview",tooltip:c.a.I18n.t("helpTooltipSendPreview")})});var L={};L.NewsletterModel=V.a.extend({whitelisted:["id","subject","preheader","type"],initialize:function(){this.on("change",function(){C.getChannel().trigger("autoSave")})},toJSON:function(){return B.a.pick(V.a.prototype.toJSON.call(this),this.whitelisted)}}),L._blockTypes={},L.registerBlockType=function(e,t){L._blockTypes[e]=t},L.getBlockTypeModel=function(e){if(e in L._blockTypes)return L._blockTypes[e].blockModel;throw new Error("Block type not supported: "+e)},L.getBlockTypeView=function(e){if(e in L._blockTypes)return L._blockTypes[e].blockView;throw new Error("Block type not supported: "+e)},L.getBody=function(){return{content:C._contentContainer.toJSON(),globalStyles:C.getGlobalStyles().toJSON(),blockDefaults:B.a.omit(C.getConfig().toJSON().blockDefaults,"text","image")}},L.toJSON=function(){return B.a.extend({body:L.getBody()},C.getNewsletter().toJSON())},L.getNewsletter=function(){return L.newsletter},L.findModels=function(e){var t=C._contentContainer.getChildren();return B.a.filter(t,e)},C.on("before:start",function(e,t){var i=e;i.registerBlockType=L.registerBlockType,i.getBlockTypeModel=L.getBlockTypeModel,i.getBlockTypeView=L.getBlockTypeView,i.toJSON=L.toJSON,i.getBody=L.getBody,i.getNewsletter=L.getNewsletter,i.findModels=L.findModels,L.newsletter=new L.NewsletterModel(B.a.omit(B.a.clone(t.newsletter),["body"]))}),C.on("start",function(e,t){var i=e,o=t.newsletter.body,n=B.a.has(o,"content")?o.content:{};B.a.has(t.newsletter,"body")&&B.a.isObject(t.newsletter.body)||c.a.Notice.error(c.a.I18n.t("newsletterBodyIsCorrupted"),{static:!0}),i._contentContainer=new(i.getBlockTypeModel("container"))(n,{parse:!0}),i._contentContainerView=new(i.getBlockTypeView("container"))({model:i._contentContainer,renderOptions:{depth:0}}),i._appView.showChildView("contentRegion",i._contentContainerView)});var W={};W.HeadingView=v.a.View.extend({getTemplate:function(){return window.templates.heading},templateContext:function(){return{model:this.model.toJSON()}},events:function(){return{"keyup .mailpoet_input_title":B.a.partial(this.changeField,"subject"),"keyup .mailpoet_input_preheader":B.a.partial(this.changeField,"preheader")}},changeField:function(e,t){this.model.set(e,M()(t.target).val())}}),C.on("start",function(e){e._appView.showChildView("headingRegion",new W.HeadingView({model:e.getNewsletter()})),c.a.helpTooltip.show(document.getElementById("tooltip-designer-subject-line"),{tooltipId:"tooltip-designer-subject-line-ti",tooltip:c.a.I18n.t("helpTooltipDesignerSubjectLine"),place:"right"}),c.a.helpTooltip.show(document.getElementById("tooltip-designer-preheader"),{tooltipId:"tooltip-designer-preheader-ti",tooltip:c.a.I18n.t("helpTooltipDesignerPreheader")})});var H,j=i(395),U=i.n(j),q=i(396),Y=i.n(q),X=i(248),J={};J.save=function(){var e=C.toJSON(),t=M()("#mailpoet_editor_top");return B.a.isUndefined(e.body)||(e.body=R()(e.body)),C.getChannel().trigger("beforeEditorSave",e),z.saveNewsletter(e).done(function(i){void 0!==i.success&&!0===i.success||void 0!==i.error&&(0===i.error.length?c.a.Notice.error(c.a.I18n.t("templateSaveFailed"),{positionAfter:t,scroll:!0}):M()(i.error).each(function(e,i){c.a.Notice.error(i,{positionAfter:t,scroll:!0})})),B.a.isUndefined(e.body)||(e.body=JSON.parse(e.body)),C.getChannel().trigger("afterEditorSave",e,i)}).fail(function(e){C.getChannel().trigger("afterEditorSave",{},e)})},J.saveTemplate=function(e){return X.a(C.toJSON()).then(function(t){var i=B.a.extend(e||{},{thumbnail:t,body:R()(C.getBody()),categories:R()(["saved",C.getNewsletter().get("type")])});return c.a.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"save",data:i})})},J.exportTemplate=function(e){return X.a(C.toJSON()).then(function(t){var i=B.a.extend(e||{},{thumbnail:t,body:C.getBody(),categories:R()(["saved",C.getNewsletter().get("type")])}),o=new U.a([R()(i)],{type:"application/json;charset=utf-8"});Y.a.saveAs(o,"template.json"),c.a.trackEvent("Editor > Template exported",{"MailPoet Free version":window.mailpoet_version})})},J.SaveView=v.a.View.extend({getTemplate:function(){return window.templates.save},templateContext:function(){return{wrapperClass:this.wrapperClass}},events:{"click .mailpoet_save_button":"save","click .mailpoet_save_show_options":"toggleSaveOptions","click .mailpoet_save_next":"next","click .mailpoet_save_template":"showSaveAsTemplate","click .mailpoet_save_as_template":"saveAsTemplate","click .mailpoet_save_export":"showExportTemplate","click .mailpoet_export_template":"exportTemplate"},initialize:function(){this.setDropdownDirectionDown(),C.getChannel().on("beforeEditorSave",this.beforeSave,this),C.getChannel().on("afterEditorSave",this.afterSave,this)},setDropdownDirectionDown:function(){this.wrapperClass="mailpoet_save_dropdown_down"},setDropdownDirectionUp:function(){this.wrapperClass="mailpoet_save_dropdown_up"},onRender:function(){this.validateNewsletter(C.toJSON())},save:function(){this.hideSaveOptions(),C.getChannel().request("save")},beforeSave:function(){this.$(".mailpoet_autosaved_at").text(c.a.I18n.t("saving"))},afterSave:function(e){this.validateNewsletter(e),this.$(".mailpoet_editor_last_saved").removeClass("mailpoet_hidden"),this.$(".mailpoet_autosaved_at").text("")},showSaveOptions:function(){this.$(".mailpoet_save_show_options").addClass("mailpoet_save_show_options_active"),this.$(".mailpoet_save_options").removeClass("mailpoet_hidden"),this.hideSaveAsTemplate(),this.hideExportTemplate()},hideSaveOptions:function(){this.$(".mailpoet_save_show_options").removeClass("mailpoet_save_show_options_active"),this.$(".mailpoet_save_options").addClass("mailpoet_hidden"),this.hideSaveAsTemplate(),this.hideExportTemplate()},toggleSaveOptions:function(){this.$(".mailpoet_save_show_options").hasClass("mailpoet_save_show_options_active")?this.hideSaveOptions():this.showSaveOptions()},showSaveAsTemplate:function(){this.$(".mailpoet_save_as_template_container").removeClass("mailpoet_hidden")},hideSaveAsTemplate:function(){this.$(".mailpoet_save_as_template_container").addClass("mailpoet_hidden")},saveAsTemplate:function(){var e=this.$(".mailpoet_save_as_template_name").val(),t=M()("#mailpoet_editor_top");""===e?c.a.Notice.error(c.a.I18n.t("templateNameMissing"),{positionAfter:t,scroll:!0}):(J.saveTemplate({name:e}).then(function(){c.a.Notice.success(c.a.I18n.t("templateSaved"),{positionAfter:t,scroll:!0}),c.a.trackEvent("Editor > Template saved",{"MailPoet Free version":window.mailpoet_version})}).catch(function(){c.a.Notice.error(c.a.I18n.t("templateSaveFailed"),{positionAfter:t,scroll:!0})}),this.hideSaveOptions())},showExportTemplate:function(){this.$(".mailpoet_export_template_container").removeClass("mailpoet_hidden")},hideExportTemplate:function(){this.$(".mailpoet_export_template_container").addClass("mailpoet_hidden")},exportTemplate:function(){var e=this.$(".mailpoet_export_template_name").val(),t=M()("#mailpoet_editor_top");""===e?c.a.Notice.error(c.a.I18n.t("templateNameMissing"),{positionAfter:t,scroll:!0}):(J.exportTemplate({name:e}),this.hideExportTemplate())},next:function(){this.hideSaveOptions(),this.$(".mailpoet_save_next").hasClass("button-disabled")||(J._cancelAutosave(),J.save().done(function(){window.location.href=C.getConfig().get("urls.send")}))},validateNewsletter:function(e){var t="";C._contentContainer.isValid()?(e&&e.body&&e.body.content&&(t=R()(e.body.content)),C.getConfig().get("validation.validateUnsubscribeLinkPresent")&&t.indexOf("[link:subscription_unsubscribe_url]")<0&&t.indexOf("[link:subscription_unsubscribe]")<0?this.showValidationError(c.a.I18n.t("unsubscribeLinkMissing")):"notification"===C.getNewsletter().get("type")&&t.indexOf('"type":"automatedLatestContent"')<0&&t.indexOf('"type":"automatedLatestContentLayout"')<0?this.showValidationError(c.a.I18n.t("automatedLatestContentMissing")):this.hideValidationError()):this.showValidationError(C._contentContainer.validationError)},showValidationError:function(e){var t=this.$(".mailpoet_save_error");t.text(e),t.removeClass("mailpoet_hidden"),this.$(".mailpoet_save_next").addClass("button-disabled")},hideValidationError:function(){this.$(".mailpoet_save_error").addClass("mailpoet_hidden"),this.$(".mailpoet_save_next").removeClass("button-disabled")}}),J.autoSave=function(){J._cancelAutosave(),H=setTimeout(function(){C.getChannel().request("save").always(function(){J._cancelAutosave()})},1e3)},J._cancelAutosave=function(){H&&(clearTimeout(H),H=void 0)},J.beforeExitWithUnsavedChanges=function(e){var t,i;if(H)return t=c.a.I18n.t("unsavedChangesWillBeLost"),(i=e||window.event)&&(i.returnValue=t),t},C.on("before:start",function(e){var t=e;t.save=J.save,t.getChannel().on("autoSave",J.autoSave),window.onbeforeunload=J.beforeExitWithUnsavedChanges,t.getChannel().reply("save",t.save)}),C.on("start",function(e){var t=new J.SaveView,i=new J.SaveView;i.setDropdownDirectionUp(),e._appView.showChildView("topRegion",t),e._appView.showChildView("bottomRegion",i)});var G=v.a,Q={};G.Behaviors.behaviorsLookup=function(){return Q},window.BehaviorsLookup=Q;var K=Q;i(502);K.ColorPickerBehavior=v.a.Behavior.extend({onRender:function(){var e=this;this.view.$(".mailpoet_color").each(function(){var t=e.view.$(this),i=function(e){e&&e.getAlpha()>0?t.val(e.toString("hex6")):t.val(""),t.trigger("change")};t.spectrum({clickoutFiresChange:!0,showInput:!0,showInitial:!0,showPalette:!0,showSelectionPalette:!0,palette:[],localStorageKey:"newsletter_editor.spectrum.palette",preferredFormat:"hex6",allowEmpty:!0,chooseText:c.a.I18n.t("selectColor"),cancelText:c.a.I18n.t("cancelColorSelection"),change:i,move:i,hide:i})})}});var Z=i(45),ee=i.n(Z),te=i(99),ie=i.n(te);K.ContainerDropZoneBehavior=v.a.Behavior.extend({defaults:{columnLimit:3},onRender:function(){B.a.isObject(this.view.options.renderOptions)&&!0===this.view.options.renderOptions.disableDragAndDrop||this.addDropZone()},addDropZone:function(){var e,t=this,i=this.view,o=t.$el.get(0);if(0===this.view.renderOptions.depth)e=".mailpoet_droppable_block.mailpoet_droppable_layout_block";else{if(2!==this.view.renderOptions.depth)return;e=".mailpoet_droppable_block:not(.mailpoet_droppable_layout_block)"}ie()(o).dropzone({accept:e,overlap:"pointer",ondragenter:function(){i.$el.addClass("mailpoet_drop_active")},ondragleave:function(){t.cleanup()},ondropmove:function(e){var o,n,s,r,a,l,c,d=t.getDropPosition(e.dragmove.pageX,e.dragmove.pageY,i.$el,i.model.get("orientation"),i.model.get("blocks").length),h=i.$el,p="",u="",g=h.offset(),f=t.getCollection();void 0!==d&&(h.find(".mailpoet_drop_marker").remove(),f.isEmpty()||(0===f.length?(r=(s=h.find(i.childViewContainer)).offset().top-h.offset().top,a=s.offset().left-h.offset().left,p=s.width(),u=s.height()):(n=t.getCollection().length===d.index?f.at(d.index-1):f.at(d.index),r=(s=t.getChildren().findByModel(n).$el).offset().top-g.top,a=s.offset().left-g.left,"normal"===d.insertionType?("after"===d.position&&("vertical"===i.model.get("orientation")?r+=s.outerHeight(!0):a+=s.outerWidth()),"vertical"===i.model.get("orientation")?p=s.outerWidth():u=s.outerHeight()):("after"===d.position&&("vertical"===i.model.get("orientation")?a+=s.outerWidth():r+=s.outerHeight()),"vertical"===i.model.get("orientation")?u=s.outerHeight(!0):p=s.outerWidth(!0))),o=M()('<div class="mailpoet_drop_marker"></div>'),0===d.index&&o.addClass("mailpoet_drop_marker_first"),f.length-1===d.index&&o.addClass("mailpoet_drop_marker_last"),d.index>0&&f.length-1>d.index&&o.addClass("mailpoet_drop_marker_middle"),o.addClass("mailpoet_drop_marker_"+d.position),c=(l="before"===d.position?t.getChildren().findByModel(f.at(d.index-1)).$el:t.getChildren().findByModel(f.at(d.index)).$el).outerHeight(!0)-l.outerHeight(),o.css("top",r-c/2),o.css("left",a),o.css("width",p),o.css("height",u),h.append(o)))},ondrop:function(e){var o,n,s,r,a,l=t.getDropPosition(e.dragEvent.pageX,e.dragEvent.pageY,i.$el,i.model.get("orientation"),i.model.get("blocks").length),c=e.draggable.getDropModel(),d=t.getCollection();void 0!==l&&("normal"===l.insertionType?(n="after"===l.position?l.index+1:l.index,"horizontal"===i.model.get("orientation")&&"container"!==c.get("type")?((s=new(window.EditorApplication.getBlockTypeModel("container"))({orientation:"vertical"})).get("blocks").add(c),d.add(s,{at:n})):d.add(c,{at:n}),o=t.getChildren().findByModel(c)):(a=d.at(l.index),s=new(window.EditorApplication.getBlockTypeModel("container"))({orientation:"vertical"===i.model.get("orientation")?"horizontal":"vertical"}),d.remove(a),"horizontal"===s.get("orientation")?("before"===l.position&&((r=new(window.EditorApplication.getBlockTypeModel("container"))({orientation:"vertical"})).get("blocks").add(c),s.get("blocks").add(r)),(r=new(window.EditorApplication.getBlockTypeModel("container"))({orientation:"vertical"})).get("blocks").add(a),s.get("blocks").add(r),"after"===l.position&&((r=new(window.EditorApplication.getBlockTypeModel("container"))({orientation:"vertical"})).get("blocks").add(c),s.get("blocks").add(r))):("before"===l.position&&s.get("blocks").add(c),s.get("blocks").add(a),"after"===l.position&&s.get("blocks").add(c)),d.add(s,{at:l.index}),o=t.getChildren().findByModel(s).children.findByModel(c)),e.draggable.onDrop({dropBehavior:t,droppedModel:c,droppedView:o}),t.cleanup())}})},cleanup:function(){this.view.$el.removeClass("mailpoet_drop_active"),this.view.$(".mailpoet_drop_marker").remove()},getDropPosition:function(e,t,i){var o,n,s,r,a,l,c=0,d=this.view.$el,h=this.view.model.get("orientation"),p=d.offset(),u=p.left,g=p.top,f=d.outerWidth(!0),m=d.outerHeight(!0),_=e-u,v=t-g,w=this._canAcceptNormalInsertion(),y=this._canAcceptSpecialInsertion(),b=!!i;return 0===this.getCollection().length?{insertionType:"normal",index:0,position:"inside"}:("vertical"===h?(o=_,n=f):(o=v,n=m),y&&!w&&(c=.5),o<=n*c&&(b||y)?(s="special",a="before",r=this._computeSpecialIndex(e,t)):o>n*(1-c)&&(b||y)?(s="special",a="after",r=this._computeSpecialIndex(e,t)):(s="normal",a=(l=this._computeNormalIndex(e,t)).position,r=l.index),b||"vertical"!==h||"special"!==s||"horizontal"!==this.getCollection().at(r).get("orientation")||(s="normal",a=(l=this._computeNormalIndex(e,t)).position,r=l.index),"horizontal"!==h||"special"!==s?{insertionType:s,index:r,position:a}:void 0)},_computeNormalIndex:function(e,t){var i,o,n,s=this._computeCellIndex(e,t),r=this.getChildren().findByModel(this.getCollection().at(s)),a=this.view.model.get("orientation"),l=r.$el;return"vertical"===a?(i=t,o=l.offset().top,n=l.outerHeight(!0)):(i=e,o=l.offset().left,n=l.outerWidth(!0)),i<=o+n/2?{index:s,position:"before"}:{index:s,position:"after"}},_computeSpecialIndex:function(e,t){return this._computeCellIndex(e,t)},_computeCellIndex:function(e,t){var i=this.view.model.get("orientation"),o="vertical"===i?t:e,n=this.getChildren().find(function(e){var t,n,s=e.$el;return"vertical"===i?(t=s.offset().top,n=s.outerHeight(!0)):(t=s.offset().left,n=s.outerWidth(!0)),n+=t,t<=o&&o<=n});return"object"===ee()(n)?n._index:0},_canAcceptNormalInsertion:function(){var e=this.view.model.get("orientation"),t=this.view.renderOptions.depth,i=this.getChildren().length;return"vertical"===e||"horizontal"===e&&1===t&&i<this.options.columnLimit},_canAcceptSpecialInsertion:function(){var e=this.view.model.get("orientation"),t=this.view.renderOptions.depth,i=this.getChildren().length;return 0===t||1===t&&"horizontal"===e&&i<=this.options.columnLimit},getCollectionView:function(){return this.view.getChildView("blocks")},getChildren:function(){return this.getCollectionView().children},getCollection:function(){return this.getCollectionView().collection}});var oe=i(250),ne=i.n(oe);K.DraggableBehavior=v.a.Behavior.extend({defaults:{cloneOriginal:!1,hideOriginal:!1,ignoreSelector:".mailpoet_ignore_drag, .mailpoet_ignore_drag *",onDragSubstituteBy:void 0,getDropModel:function(){throw new Error("Missing 'drop' function for DraggableBehavior")},onDrop:function(){},testAttachToInstance:function(){return!0}},onRender:function(){var e,t=this;this.options.testAttachToInstance(this.view.model,this.view)&&(e=ie()(this.$el.get(0),{ignoreFrom:this.options.ignoreSelector}).draggable({max:1/0,autoScroll:!0,onstart:function(e){var i,o,n,s,r,a=e;!0===t.options.cloneOriginal&&(B.a.isFunction(t.options.onDragSubstituteBy)&&(n=t.options.onDragSubstituteBy(t)),s=n||a.target.cloneNode(!0),M()(a.target),(r=M()(s)).addClass("mailpoet_droppable_active"),r.css("position","absolute"),r.css("top",0),r.css("left",0),document.body.appendChild(s),i=r.width()/2,o=r.height()/2,r.css("top",a.pageY-o),r.css("left",a.pageX-i),a.interaction.element=s,!0===t.options.hideOriginal&&t.view.$el.addClass("mailpoet_hidden"),C.getChannel().trigger("dragStart"))},onmove:function(e){var t=e.target,i=(ne()(t.getAttribute("data-x"))||0)+e.dx,o=(ne()(t.getAttribute("data-y"))||0)+e.dy;t.style.transform="translate("+i+"px, "+o+"px)",t.style.webkitTransform=t.style.transform,t.setAttribute("data-x",i),t.setAttribute("data-y",o)},onend:function(e){var i=e.target;i.style.transform="",i.style.webkitTransform=i.style.transform,i.removeAttribute("data-x"),i.removeAttribute("data-y"),M()(e.interaction.element).addClass("mailpoet_droppable_active"),!0===t.options.cloneOriginal&&(M()(i).remove(),!0===t.options.hideOriginal&&t.view.$el.removeClass("mailpoet_hidden"))}}).preventDefault("auto").styleCursor(!1).actionChecker(function(e,t,i){return 0!==t.button?null:i}),void 0!==this.options.drop?e.getDropModel=this.options.drop:e.getDropModel=this.view.getDropFunc(),e.onDrop=function(e){var i=e;B.a.isObject(i)&&(i.dragBehavior=t),t.options.onDrop.apply(t,[i])})}});var se=function(e,t){var i=t.offset(),o=t.height(),n=t.width();return!(e.pageX<i.left||e.pageX>i.left+n||e.pageY<i.top||e.pageY>i.top+o)};K.HighlightEditingBehavior=v.a.Behavior.extend({modelEvents:{startEditing:"onStartEditing",stopEditing:"onStopEditing",startResizing:"onStartResizing",stopResizing:"onStopResizing"},events:{mouseenter:"onMouseEnter",mouseleave:"onMouseLeave"},onMouseEnter:function(e){this.isFocusedByPointer=!0,e&&e.buttons>0||this.view.addHighlight()},onMouseLeave:function(){this.isFocusedByPointer=!1,this.isBeingEdited||this.view.removeHighlight()},onStartEditing:function(){this.isBeingEdited=!0,this.view.addHighlight()},onStopEditing:function(){this.isBeingEdited=!1,this.isFocusedByPointer||this.view.removeHighlight()},onStartResizing:function(){this.onStartEditing(),this.view.triggerMethod("resizeStart")},onStopResizing:function(e){this.isFocusedByPointer=se(e,this.view.$el),this.onStopEditing(),this.view.triggerMethod("resizeStop",e)},onDomRefresh:function(){this.isBeingEdited&&this.view.addHighlight()},onChildviewResizeStart:function(){this.onStartEditing(),this.view.triggerMethod("resizeStart")},onChildviewResizeStop:function(e){this.isFocusedByPointer=se(e,this.view.$el),this.onStopEditing(),this.view.triggerMethod("resizeStop",e)}}),K.MediaManagerBehavior=v.a.Behavior.extend({ui:{"select-image":".mailpoet_field_image_select_image","address-input":".mailpoet_field_image_address"},events:{"click @ui.select-image":"showMediaManager","input @ui.address-input":"changeAddress"},initialize:function(){this.view.options.showImageManager&&this.showMediaManager()},changeAddress:function(e){var t=M()(e.target).val(),i=new Image;t||!this.options.onSelect?(i.onload=function(){this.options.onSelect&&this.view[this.options.onSelect]({src:t,width:i.naturalWidth+"px",height:i.naturalHeight+"px"})}.bind(this),i.src=t):this.view[this.options.onSelect]({src:null,width:null,height:null})},showMediaManager:function(){var e,t,i=this;if(this._mediaManager)return this._mediaManager.resetSelections(),void this._mediaManager.open();e=window.wp.media.view.MediaFrame.Select.extend({initialize:function(){window.wp.media.view.MediaFrame.prototype.initialize.apply(this,arguments),B.a.defaults(this.options,{multiple:!0,editing:!1,state:"insert"}),this.createSelection(),this.createStates(),this.bindHandlers(),this.createIframeStates(),this.$el.addClass("hide-title")},resetSelections:function(){this.state().get("selection").reset()},createQuery:function(e){return window.wp.media.query(e)},createStates:function(){var e=this.options;this.states.add([new window.wp.media.controller.Library({id:"insert",title:"Add images",priority:20,toolbar:"main-insert",filterable:"image",library:this.createQuery(e.library),multiple:!!e.multiple&&"reset",editable:!1,allowLocalEdits:!1,displaySettings:!1,displayUserSettings:!1})]),window.wp.media.view.settings.post.featuredImageId&&this.states.add(new window.wp.media.controller.FeaturedImage)},bindHandlers:function(){var e;this.on("router:create:browse",this.createRouter,this),this.on("router:render:browse",this.browseRouter,this),this.on("content:create:browse",this.browseContent,this),this.on("content:render:upload",this.uploadContent,this),this.on("toolbar:create:select",this.createSelectToolbar,this),this.on("menu:create:gallery",this.createMenu,this),this.on("toolbar:create:main-insert",this.createToolbar,this),this.on("toolbar:create:main-gallery",this.createToolbar,this),this.on("toolbar:create:main-embed",this.mainEmbedToolbar,this),this.on("updateExcluded",this.browseContent,this),e={content:{embed:"embedContent","edit-selection":"editSelectionContent"},toolbar:{"main-insert":"mainInsertToolbar"}},B.a.each(e,function(e,t){B.a.each(e,function(e,i){this.on(t+":render:"+i,this[e],this)},this)},this)},uploadContent:function(){window.wp.media.view.MediaFrame.Select.prototype.uploadContent.apply(this,arguments),this.$el.addClass("hide-toolbar")},embedContent:function(){var e=new window.wp.media.view.Embed({controller:this,model:this.state()}).render();this.content.set(e),e.url.focus()},editSelectionContent:function(){var e,t=this.state(),i=t.get("selection");(e=new window.wp.media.view.AttachmentsBrowser({controller:this,collection:i,selection:i,model:t,sortable:!0,search:!1,dragInfo:!0,AttachmentView:window.wp.media.view.Attachment.EditSelection}).render()).toolbar.set("backToLibrary",{text:"Return to library",priority:-100,click:function(){this.controller.content.mode("browse")}}),this.content.set(e)},selectionStatusToolbar:function(e){var t=this.state().get("editable");e.set("selection",new window.wp.media.view.Selection({controller:this,collection:this.state().get("selection"),priority:-40,editable:t&&function(){this.controller.content.mode("edit-selection")}}).render())},mainInsertToolbar:function(e){var t=this;this.selectionStatusToolbar(e),e.set("insert",{style:"primary",priority:80,text:"Select Image",requires:{selection:!0},click:function(){var e=t.state(),i=e.get("selection");t.close(),e.trigger("insert",i).reset()}})},mainEmbedToolbar:function(e){e.view=new window.wp.media.view.Toolbar.Embed({controller:this,text:"Add images"})}}),t=new e({id:"mailpoet-media-manager",frame:"select",title:"Select image",editing:!1,multiple:!1,library:{type:"image"},displaySettings:!1,button:{text:"Select"}}),this._mediaManager=t,this._mediaManager.on("insert",function(){t.state().get("selection").each(function(e){var t=e.get("sizes"),o=B.a.sortBy(B.a.keys(t),function(e){return Math.abs(1320-t[e].width)}),n=t[B.a.first(o)].width,s=B.a.filter(B.a.values(t),function(e){return e.width===n}),r=B.a.max(s,function(e){return e.height});i.options.onSelect&&i.view[i.options.onSelect]({height:r.height+"px",width:r.width+"px",src:r.url,alt:""!==e.get("alt")&&void 0!==e.get("alt")?e.get("alt"):e.get("title")})})}),this._mediaManager.open()},onBeforeDestroy:function(){"object"===ee()(this._mediaManager)&&this._mediaManager.remove()}}),K.ResizableBehavior=v.a.Behavior.extend({defaults:{elementSelector:null,resizeHandleSelector:!0,transformationFunction:function(e){return e},minLength:0,maxLength:1/0,modelField:"styles.block.height",onResize:function(e){var t=ne()(this.view.model.get(this.options.modelField))+this.options.transformationFunction(e.dy);t=Math.min(this.options.maxLength,Math.max(this.options.minLength,t)),this.view.model.set(this.options.modelField,t+"px")}},onRender:function(){this.attachResize(),this.view.$el.addClass("mailpoet_resizable_block")},attachResize:function(){var e,t=this;e=null===this.options.elementSelector?this.view.$el.get(0):this.view.$(this.options.elementSelector).get(0),ie()(e).resizable({edges:{top:!1,left:!1,right:!1,bottom:"string"==typeof this.options.resizeHandleSelector?this.view.$(this.options.resizeHandleSelector).get(0):this.options.resizeHandleSelector}}).on("resizestart",function(){t.view.model.trigger("startResizing")}).on("resizemove",function(e){return t.options.onResize.bind(t)(e)}).on("resizeend",function(e){t.view.model.trigger("stopResizing",e),t.$el.removeClass("mailpoet_resize_active")})}}),K.SortableBehavior=v.a.Behavior.extend({onRender:function(){var e=this.view.collection;B.a.isFunction(this.$el.sortable)&&this.$el.sortable({cursor:"move",start:function(e,t){t.item.data("previousIndex",t.item.index())},end:function(e,t){t.item.removeData("previousIndex")},update:function(t,i){var o=i.item.data("previousIndex"),n=i.item.index(),s=e.at(o);e.remove(s),e.add(s,{at:n})},items:this.options.items})}}),K.ShowSettingsBehavior=v.a.Behavior.extend({defaults:{ignoreFrom:""},events:{"click .mailpoet_content":"showSettings"},showSettings:function(e){this.isIgnoredElement(e.target)||this.view.triggerMethod("showSettings")},isIgnoredElement:function(e){return this.options.ignoreFrom&&this.options.ignoreFrom.length>0&&M()(e).is(this.options.ignoreFrom)}}),K.TextEditorBehavior=v.a.Behavior.extend({defaults:{selector:".mailpoet_content",toolbar1:"bold italic link unlink forecolor mailpoet_shortcodes",toolbar2:"",validElements:"p[class|style],span[class|style],a[href|class|title|target|style],strong[class|style],em[class|style],strike,br",invalidElements:"script",blockFormats:"Paragraph=p",plugins:"link textcolor colorpicker mailpoet_shortcodes",configurationFilter:function(e){return e}},initialize:function(){this.listenTo(C.getChannel(),"dragStart",this.hideEditor)},hideEditor:function(){this.tinymceEditor&&this.tinymceEditor.fire("blur")},onDomRefresh:function(){var e=this;!0!==this.view.disableTextEditor&&this.$(this.options.selector).tinymce(this.options.configurationFilter({inline:!0,menubar:!1,toolbar1:this.options.toolbar1,toolbar2:this.options.toolbar2,browser_spellcheck:!0,valid_elements:this.options.validElements,invalid_elements:this.options.invalidElements,block_formats:this.options.blockFormats,relative_urls:!1,remove_script_host:!1,convert_urls:!0,urlconverter_callback:function(e){return e.match(/\[.+\]/g)?e:this.documentBaseURI.toAbsolute(e,this.settings.remove_script_host)},plugins:this.options.plugins,setup:function(t){e.tinymceEditor=t,t.on("change",function(){e.view.triggerMethod("text:editor:change",t.getContent())}),t.on("click",function(e){document.activeElement!==t.targetElm&&t.selection.placeCaretAt(e.clientX,e.clientY)}),t.on("focus",function(){e.view.triggerMethod("text:editor:focus")}),t.on("blur",function(){e.view.triggerMethod("text:editor:blur")})}}))}});i(254);var re={},ae=v.a.View.extend({});re.BlockModel=V.a.extend({stale:[],initialize:function(){this.on("change",function(){this._updateDefaults(),C.getChannel().trigger("autoSave")})},_getDefaults:function(e,t){var i;return i=B.a.isObject(t)&&B.a.isFunction(t.toJSON)?t.toJSON():t,JSON.parse(R()(M.a.extend(e,i||{})))},_updateDefaults:function(){var e=this.get("context")||this.get("type");C.getConfig().set("blockDefaults."+e,this.toJSON())},toJSON:function(){return B.a.omit(V.a.prototype.toJSON.call(this),this.stale)},getChildren:function(){return[]}}),re.BlockView=ae.extend({regions:{toolsRegion:"> .mailpoet_tools"},modelEvents:{change:"render",delete:"deleteBlock",duplicate:"duplicateBlock"},behaviors:{DraggableBehavior:{cloneOriginal:!0,hideOriginal:!0,onDrop:function(e){e.dragBehavior.view.model.destroy()},onDragSubstituteBy:function(e){var t,i;if(B.a.isFunction(e.view.onDragSubstituteBy))return(t=new(e.view.onDragSubstituteBy())).render(),i=t.$el.get(0).cloneNode(!0),t.destroy(),i}},HighlightEditingBehavior:{}},templateContext:function(){return{model:this.model.toJSON(),viewCid:this.cid}},constructor:function(){ae.apply(this,arguments),this.$el.addClass("mailpoet_editor_view_"+this.cid)},initialize:function(){this.on("showSettings",this.showSettings,this),this.on("dom:refresh",this.showBlock,this),this._isFirstRender=!0},addHighlight:function(){this.$el.addClass("mailpoet_highlight"),this.showingToolsDisabled||(this.$("> .mailpoet_tools").addClass("mailpoet_display_tools"),this.toolsView.triggerMethod("showTools"))},removeHighlight:function(){this.$el.removeClass("mailpoet_highlight"),this.hideTools()},hideTools:function(){this.$("> .mailpoet_tools").removeClass("mailpoet_display_tools"),this.toolsView.triggerMethod("hideTools")},enableShowingTools:function(){this.showingToolsDisabled=!1},disableShowingTools:function(){this.showingToolsDisabled=!0,this.hideTools()},showSettings:function(e){this.toolsView.triggerMethod("showSettings",e)},getDropFunc:function(){return function(){return this.model.clone()}.bind(this)},disableDragging:function(){this.$el.addClass("mailpoet_ignore_drag")},enableDragging:function(){this.$el.removeClass("mailpoet_ignore_drag")},showBlock:function(){this._isFirstRender&&(this.transitionIn(),this._isFirstRender=!1)},deleteBlock:function(){this.transitionOut().then(function(){this.model.destroy()}.bind(this))},duplicateBlock:function(){this.model.collection.add(this.model.toJSON(),{at:this.model.collection.findIndex(this.model)})},transitionIn:function(){return this._transition("slideDown","fadeIn","easeOut")},transitionOut:function(){return this._transition("slideUp","fadeOut","easeIn")},_transition:function(e,t,i){var o=M.a.Deferred();return this.$el.velocity(e,{duration:250,easing:i,complete:function(){o.resolve()}}).velocity(t,{duration:250,easing:i,queue:!1}),o}}),re.BlockToolsView=ae.extend({getTemplate:function(){return window.templates.genericBlockTools},events:{"click .mailpoet_edit_block":"changeSettings","click .mailpoet_delete_block_activate":"showDeletionConfirmation","click .mailpoet_delete_block_cancel":"hideDeletionConfirmation","click .mailpoet_delete_block_confirm":"deleteBlock","click .mailpoet_duplicate_block":"duplicateBlock"},tools:{settings:!0,delete:!0,duplicate:!0,move:!0},getSettingsView:function(){return re.BlockSettingsView},initialize:function(e){var t=e||{};B.a.isUndefined(t.tools)||(this.tools=M.a.extend({},this.tools,t.tools||{})),this.on("hideTools",this.hideDeletionConfirmation,this),this.on("showSettings",this.changeSettings)},templateContext:function(){return{model:this.model.toJSON(),viewCid:this.cid,tools:this.tools}},changeSettings:function(e){new(this.getSettingsView())(B.a.extend({model:this.model},e||{})).render()},showDeletionConfirmation:function(){this.$(".mailpoet_delete_block").closest(".mailpoet_block").find("> .mailpoet_block_highlight").css({background:"#E64047",opacity:.5}),this.$(".mailpoet_delete_block").addClass("mailpoet_delete_block_activated")},hideDeletionConfirmation:function(){this.$(".mailpoet_delete_block").closest(".mailpoet_block").find("> .mailpoet_block_highlight").css({background:"transparent",opacity:1}),this.$(".mailpoet_delete_block").removeClass("mailpoet_delete_block_activated")},deleteBlock:function(e){return e.preventDefault(),this.model.trigger("delete"),!1},duplicateBlock:function(e){return e.preventDefault(),this.model.trigger("duplicate"),!1}}),re.BlockSettingsView=v.a.View.extend({className:"mailpoet_editor_settings",behaviors:{ColorPickerBehavior:{}},initialize:function(e){var t;this.model.trigger("startEditing"),t={element:this.$el,template:"",position:"right",width:C.getConfig().get("sidepanelWidth"),onCancel:function(){this.destroy()}.bind(this)},this.renderOptions=e.renderOptions||{},"subpanel"===this.renderOptions.displayFormat?c.a.Modal.subpanel(t):c.a.Modal.panel(t)},templateContext:function(){return{model:this.model.toJSON()}},close:function(){this.destroy()},changeField:function(e,t){this.model.set(e,M()(t.target).val())},changePixelField:function(e,t){this.changeFieldWithSuffix(e,t,"px")},changeFieldWithSuffix:function(e,t,i){this.model.set(e,M()(t.target).val()+i)},changeBoolField:function(e,t){this.model.set(e,"true"===M()(t.target).val())},changeBoolCheckboxField:function(e,t){this.model.set(e,!!M()(t.target).prop("checked"))},changeColorField:function(e,t){var i=M()(t.target).val();""===i&&(i="transparent"),this.model.set(e,i)},onBeforeDestroy:function(){c.a.Modal.close(),this.model.trigger("stopEditing")}}),re.WidgetView=v.a.View.extend({className:"mailpoet_widget mailpoet_droppable_block mailpoet_droppable_widget",behaviors:{DraggableBehavior:{drop:function(){throw new Error("Unsupported operation")}}}});var le,ce=re,de={},he=ce;le=N.a.Collection.extend({model:he.BlockModel,initialize:function(){this.on("add change remove",function(){C.getChannel().trigger("autoSave")})},parse:function(e){return B.a.map(e,function(e){return new(C.getBlockTypeModel(e.type))(e,{parse:!0})})}}),de.ContainerBlockModel=he.BlockModel.extend({relations:{blocks:le},defaults:function(){return this._getDefaults({type:"container",columnLayout:!1,orientation:"vertical",image:{src:null,display:"scale"},styles:{block:{backgroundColor:"transparent"}},blocks:new le},C.getConfig().get("blockDefaults.container"))},_updateDefaults:function(){},validate:function(){var e=this.get("blocks").find(function(e){return!e.isValid()});if(e)return e.validationError},parse:function(e){return"container"===e.type&&B.a.has(e,"blocks")&&e.blocks.constructor===Array&&(e.blocks=new le(e.blocks,{parse:!0})),e},getChildren:function(){var e=this.get("blocks").map(function(e){return[e,e.getChildren()]});return B.a.flatten(e)}}),de.ContainerBlocksView=v.a.CollectionView.extend({className:"mailpoet_container",childView:function(e){return C.getBlockTypeView(e.get("type"))},childViewOptions:function(){var e=B.a.clone(this.renderOptions);return void 0!==e.depth&&(e.depth+=1),{renderOptions:e}},emptyView:function(){return de.ContainerBlockEmptyView},emptyViewOptions:function(){return{renderOptions:this.renderOptions}},initialize:function(e){this.renderOptions=e.renderOptions},onChildviewResizeStart:function(){this.triggerMethod("resizeStart")},onChildviewResizeStop:function(e){this.triggerMethod("resizeStop",e)}}),de.ContainerBlockView=he.BlockView.extend({regions:B.a.extend({},he.BlockView.prototype.regions,{blocks:{el:"> .mailpoet_container",replaceElement:!0}}),className:"mailpoet_block mailpoet_container_block mailpoet_droppable_block mailpoet_droppable_layout_block",getTemplate:function(){return window.templates.containerBlock},events:B.a.extend({},he.BlockView.prototype.events,{"click .mailpoet_newsletter_layer_selector":"toggleEditingLayer"}),ui:{tools:"> .mailpoet_tools"},behaviors:B.a.extend({},he.BlockView.prototype.behaviors,{ContainerDropZoneBehavior:{},DraggableBehavior:{cloneOriginal:!0,hideOriginal:!0,onDrop:function(e){e.dragBehavior.view.model.destroy()},onDragSubstituteBy:function(e){var t,i;if(B.a.isFunction(e.view.onDragSubstituteBy))return(t=new(e.view.onDragSubstituteBy())).render(),i=t.$el.get(0).cloneNode(!0),t.destroy(),i},testAttachToInstance:function(e,t){return 1===t.renderOptions.depth}},HighlightEditingBehavior:{}}),onDragSubstituteBy:function(){if(1===this.renderOptions.depth){if(3===this.model.get("blocks").length)return de.ThreeColumnContainerWidgetView;if(2===this.model.get("blocks").length)return de.TwoColumnContainerWidgetView}return de.OneColumnContainerWidgetView},initialize:function(e){he.BlockView.prototype.initialize.apply(this,arguments),this.renderOptions=B.a.defaults(e.renderOptions||{},{})},onRender:function(){var e,t="";this.toolsView=new de.ContainerBlockToolsView({model:this.model,tools:{settings:1===this.renderOptions.depth,delete:1===this.renderOptions.depth,duplicate:!0,move:1===this.renderOptions.depth,layerSelector:!1}}),this.showChildView("toolsRegion",this.toolsView),this.showChildView("blocks",new de.ContainerBlocksView({collection:this.model.get("blocks"),renderOptions:this.renderOptions})),"string"==typeof(e=this.model.get("columnLayout"))&&(t="mailpoet_irregular_width_contents_container column_layout_"+e),this.$("> .mailpoet_container").attr("class","mailpoet_container mailpoet_container_"+this.model.get("orientation")+" "+t)},addHighlight:function(){1!==this.renderOptions.depth||this.$el.hasClass("mailpoet_container_layer_active")||(this.$(this.ui.tools).addClass("mailpoet_display_tools"),this.$el.addClass("mailpoet_highlight"),this.toolsView.triggerMethod("showTools"))},removeHighlight:function(){1!==this.renderOptions.depth||this.$el.hasClass("mailpoet_container_layer_active")||(this.$(this.ui.tools).removeClass("mailpoet_display_tools"),this.$el.removeClass("mailpoet_highlight"),this.toolsView.triggerMethod("hideTools"))},toggleEditingLayer:function(e){var t=this,i=this.$("> .mailpoet_tools .mailpoet_newsletter_layer_selector"),o=M()(".mailpoet_layer_overlay"),n=this.$("> .mailpoet_container"),s=function(){t.$el.removeClass("mailpoet_container_layer_active"),i.removeClass("mailpoet_container_layer_active"),n.removeClass("mailpoet_layer_highlight"),o.hide(),o.off("click")};i.hasClass("mailpoet_container_layer_active")?s():(t.$el.addClass("mailpoet_container_layer_active"),i.addClass("mailpoet_container_layer_active"),n.addClass("mailpoet_layer_highlight"),o.click(s),o.show()),e.stopPropagation()}}),de.ContainerBlockEmptyView=v.a.View.extend({getTemplate:function(){return window.templates.containerEmpty},initialize:function(e){this.renderOptions=B.a.defaults(e.renderOptions||{},{})},templateContext:function(){return{isRoot:0===this.renderOptions.depth,emptyContainerMessage:this.renderOptions.emptyContainerMessage||""}}}),de.ContainerBlockToolsView=he.BlockToolsView.extend({getSettingsView:function(){return de.ContainerBlockSettingsView}}),de.ContainerBlockSettingsView=he.BlockSettingsView.extend({behaviors:B.a.extend({},he.BlockSettingsView.prototype.behaviors,{MediaManagerBehavior:{onSelect:"onImageSelect"}}),getTemplate:function(){return window.templates.containerBlockSettings},events:function(){return{"change .mailpoet_field_container_background_color":B.a.partial(this.changeColorField,"styles.block.backgroundColor"),"click .mailpoet_done_editing":"close","change .mailpoet_field_display_type":"changeDisplayType"}},initialize:function(){he.BlockSettingsView.prototype.initialize.apply(this,arguments),this.model.trigger("startEditing"),this._columnsSettingsView=new de.ContainerBlockColumnsSettingsView({collection:this.model.get("blocks")})},changeDisplayType:function(e){this.model.get("image").set("display",e.target.value),this.model.trigger("change")},onImageSelect:function(e){this.model.set("image.src",e.src),this.model.trigger("change"),this.render()}}),de.ContainerBlockColumnsSettingsView=v.a.CollectionView.extend({childView:function(){return de.ContainerBlockColumnSettingsView},childViewOptions:function(e,t){return{columnIndex:t}}}),de.ContainerBlockColumnSettingsView=v.a.View.extend({getTemplate:function(){return window.templates.containerBlockColumnSettings},initialize:function(e){this.columnNumber=(e.columnIndex||0)+1},templateContext:function(){return{model:this.model.toJSON(),columnNumber:this.columnNumber}}}),de.OneColumnContainerWidgetView=he.WidgetView.extend({className:he.WidgetView.prototype.className+" mailpoet_droppable_layout_block",getTemplate:function(){return window.templates.oneColumnLayoutInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new de.ContainerBlockModel({orientation:"horizontal",blocks:[new de.ContainerBlockModel]})}}}}),de.TwoColumnContainerWidgetView=he.WidgetView.extend({className:he.WidgetView.prototype.className+" mailpoet_droppable_layout_block",getTemplate:function(){return window.templates.twoColumnLayoutInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new de.ContainerBlockModel({orientation:"horizontal",blocks:[new de.ContainerBlockModel,new de.ContainerBlockModel]})}}}}),de.ThreeColumnContainerWidgetView=he.WidgetView.extend({className:he.WidgetView.prototype.className+" mailpoet_droppable_layout_block",getTemplate:function(){return window.templates.threeColumnLayoutInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new de.ContainerBlockModel({orientation:"horizontal",blocks:[new de.ContainerBlockModel,new de.ContainerBlockModel,new de.ContainerBlockModel]})}}}}),de.TwoColumn12ContainerWidgetView=he.WidgetView.extend({className:he.WidgetView.prototype.className+" mailpoet_droppable_layout_block",getTemplate:function(){return window.templates.twoColumn12LayoutInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){var e=new de.ContainerBlockModel({orientation:"horizontal",blocks:[new de.ContainerBlockModel,new de.ContainerBlockModel]});return e.set("columnLayout","1_2"),e}}}}),de.TwoColumn21ContainerWidgetView=he.WidgetView.extend({className:he.WidgetView.prototype.className+" mailpoet_droppable_layout_block",getTemplate:function(){return window.templates.twoColumn21LayoutInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){var e=new de.ContainerBlockModel({orientation:"horizontal",blocks:[new de.ContainerBlockModel,new de.ContainerBlockModel]});return e.set("columnLayout","2_1"),e}}}}),C.on("before:start",function(e){e.registerBlockType("container",{blockModel:de.ContainerBlockModel,blockView:de.ContainerBlockView}),e.registerLayoutWidget({name:"oneColumnLayout",priority:100,widgetView:de.OneColumnContainerWidgetView}),e.registerLayoutWidget({name:"twoColumnLayout",priority:100,widgetView:de.TwoColumnContainerWidgetView}),e.registerLayoutWidget({name:"threeColumnLayout",priority:100,widgetView:de.ThreeColumnContainerWidgetView}),e.registerLayoutWidget({name:"twoColumn12Layout",priority:100,widgetView:de.TwoColumn12ContainerWidgetView}),e.registerLayoutWidget({name:"twoColumn21Layout",priority:100,widgetView:de.TwoColumn21ContainerWidgetView})});var pe={},ue=ce;pe.ButtonBlockModel=ue.BlockModel.extend({defaults:function(){return this._getDefaults({type:"button",text:"Button",url:"",styles:{block:{backgroundColor:"#ff0000",borderColor:"#cccccc",borderWidth:"1px",borderRadius:"4px",borderStyle:"solid",width:"200px",lineHeight:"40px",fontColor:"#000000",fontFamily:"Arial",fontSize:"16px",fontWeight:"normal",textAlign:"center"}}},C.getConfig().get("blockDefaults.button"))}}),pe.ButtonBlockView=ue.BlockView.extend({className:"mailpoet_block mailpoet_button_block mailpoet_droppable_block",getTemplate:function(){return window.templates.buttonBlock},onDragSubstituteBy:function(){return pe.ButtonWidgetView},behaviors:B.a.extend({},ue.BlockView.prototype.behaviors,{ShowSettingsBehavior:{}}),initialize:function(){ue.BlockView.prototype.initialize.apply(this,arguments),this._replaceButtonStylesHandler=function(e){this.model.set(e)}.bind(this),C.getChannel().on("replaceAllButtonStyles",this._replaceButtonStylesHandler)},onRender:function(){this.toolsView=new pe.ButtonBlockToolsView({model:this.model}),this.showChildView("toolsRegion",this.toolsView)}}),pe.ButtonBlockToolsView=ue.BlockToolsView.extend({getSettingsView:function(){return pe.ButtonBlockSettingsView}}),pe.ButtonBlockSettingsView=ue.BlockSettingsView.extend({getTemplate:function(){return window.templates.buttonBlockSettings},events:function(){return{"input .mailpoet_field_button_text":B.a.partial(this.changeField,"text"),"input .mailpoet_field_button_url":B.a.partial(this.changeField,"url"),"change .mailpoet_field_button_alignment":B.a.partial(this.changeField,"styles.block.textAlign"),"change .mailpoet_field_button_font_color":B.a.partial(this.changeColorField,"styles.block.fontColor"),"change .mailpoet_field_button_font_family":B.a.partial(this.changeField,"styles.block.fontFamily"),"change .mailpoet_field_button_font_size":B.a.partial(this.changeField,"styles.block.fontSize"),"change .mailpoet_field_button_background_color":B.a.partial(this.changeColorField,"styles.block.backgroundColor"),"change .mailpoet_field_button_border_color":B.a.partial(this.changeColorField,"styles.block.borderColor"),"change .mailpoet_field_button_font_weight":"changeFontWeight","input .mailpoet_field_button_border_width":B.a.partial(this.updateValueAndCall,".mailpoet_field_button_border_width_input",B.a.partial(this.changePixelField,"styles.block.borderWidth").bind(this)),"change .mailpoet_field_button_border_width":B.a.partial(this.updateValueAndCall,".mailpoet_field_button_border_width_input",B.a.partial(this.changePixelField,"styles.block.borderWidth").bind(this)),"input .mailpoet_field_button_border_width_input":B.a.partial(this.updateValueAndCall,".mailpoet_field_button_border_width",B.a.partial(this.changePixelField,"styles.block.borderWidth").bind(this)),"input .mailpoet_field_button_border_radius":B.a.partial(this.updateValueAndCall,".mailpoet_field_button_border_radius_input",B.a.partial(this.changePixelField,"styles.block.borderRadius").bind(this)),"change .mailpoet_field_button_border_radius":B.a.partial(this.updateValueAndCall,".mailpoet_field_button_border_radius_input",B.a.partial(this.changePixelField,"styles.block.borderRadius").bind(this)),"input .mailpoet_field_button_border_radius_input":B.a.partial(this.updateValueAndCall,".mailpoet_field_button_border_radius",B.a.partial(this.changePixelField,"styles.block.borderRadius").bind(this)),"input .mailpoet_field_button_width":B.a.partial(this.updateValueAndCall,".mailpoet_field_button_width_input",B.a.partial(this.changePixelField,"styles.block.width").bind(this)),"change .mailpoet_field_button_width":B.a.partial(this.updateValueAndCall,".mailpoet_field_button_width_input",B.a.partial(this.changePixelField,"styles.block.width").bind(this)),"input .mailpoet_field_button_width_input":B.a.partial(this.updateValueAndCall,".mailpoet_field_button_width",B.a.partial(this.changePixelField,"styles.block.width").bind(this)),"input .mailpoet_field_button_line_height":B.a.partial(this.updateValueAndCall,".mailpoet_field_button_line_height_input",B.a.partial(this.changePixelField,"styles.block.lineHeight").bind(this)),"change .mailpoet_field_button_line_height":B.a.partial(this.updateValueAndCall,".mailpoet_field_button_line_height_input",B.a.partial(this.changePixelField,"styles.block.lineHeight").bind(this)),"input .mailpoet_field_button_line_height_input":B.a.partial(this.updateValueAndCall,".mailpoet_field_button_line_height",B.a.partial(this.changePixelField,"styles.block.lineHeight").bind(this)),"click .mailpoet_field_button_replace_all_styles":"applyToAll","click .mailpoet_done_editing":"close"}},templateContext:function(){return B.a.extend({},ue.BlockView.prototype.templateContext.apply(this,arguments),{availableStyles:C.getAvailableStyles().toJSON(),renderOptions:this.renderOptions})},applyToAll:function(){C.getChannel().trigger("replaceAllButtonStyles",B.a.pick(this.model.toJSON(),"styles","type"))},updateValueAndCall:function(e,t,i){this.$(e).val(M()(i.target).val()),t(i)},changeFontWeight:function(e){var t=!!M()(e.target).prop("checked");this.model.set("styles.block.fontWeight",t?M()(e.target).val():"normal")}}),pe.ButtonWidgetView=ue.WidgetView.extend({getTemplate:function(){return window.templates.buttonInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new pe.ButtonBlockModel}}}}),C.on("before:start",function(e){e.registerBlockType("button",{blockModel:pe.ButtonBlockModel,blockView:pe.ButtonBlockView}),e.registerWidget({name:"button",widgetView:pe.ButtonWidgetView,priority:92})});var ge,fe=pe,me=i(15),_e=i.n(me),ve={},we=ce;ve.ImageBlockModel=we.BlockModel.extend({defaults:function(){return this._getDefaults({type:"image",link:"",src:"",alt:"An image of...",fullWidth:!0,width:"64px",height:"64px",styles:{block:{textAlign:"center"}}},C.getConfig().get("blockDefaults.image"))},_updateDefaults:function(){}}),ve.ImageBlockView=we.BlockView.extend({className:"mailpoet_block mailpoet_image_block mailpoet_droppable_block",getTemplate:function(){return window.templates.imageBlock},onDragSubstituteBy:function(){return ve.ImageWidgetView},templateContext:function(){return B.a.extend({imageMissingSrc:C.getConfig().get("urls.imageMissing")},we.BlockView.prototype.templateContext.apply(this))},behaviors:B.a.extend({},we.BlockView.prototype.behaviors,{ResizableBehavior:{elementSelector:".mailpoet_image",resizeHandleSelector:".mailpoet_image_resize_handle",onResize:function(e){var t=this.$(".mailpoet_image").offset(),i=e.pageX-t.left;this.view.model.set("width",i+"px")}},ShowSettingsBehavior:{ignoreFrom:".mailpoet_image_resize_handle"}}),onRender:function(){var e=this;this.toolsView=new ve.ImageBlockToolsView({model:this.model}),this.showChildView("toolsRegion",this.toolsView),this.model.get("fullWidth")?this.$el.addClass("mailpoet_full_image"):this.$el.removeClass("mailpoet_full_image"),this.model.get("width")&&"auto"!==this.model.get("width")||this.$el.find("img").on("load",function(){e.model.set("width",this.width),e.model.set("height",this.height)}),this.$(".mailpoet_content").css("width",this.model.get("width"))}}),ve.ImageBlockToolsView=we.BlockToolsView.extend({getSettingsView:function(){return ve.ImageBlockSettingsView}}),ve.ImageBlockSettingsView=we.BlockSettingsView.extend({behaviors:B.a.extend({},we.BlockSettingsView.prototype.behaviors,{MediaManagerBehavior:{onSelect:"onImageSelect"}}),onRender:function(){c.a.helpTooltip.show(document.getElementById("tooltip-designer-full-width"),{tooltipId:"tooltip-editor-full-width",tooltip:c.a.I18n.t("helpTooltipDesignerFullWidth")}),c.a.helpTooltip.show(document.getElementById("tooltip-designer-ideal-width"),{tooltipId:"tooltip-editor-ideal-width",tooltip:c.a.I18n.t("helpTooltipDesignerIdealWidth")})},getTemplate:function(){return window.templates.imageBlockSettings},events:function(){return{"input .mailpoet_field_image_link":B.a.partial(this.changeField,"link"),"input .mailpoet_field_image_alt_text":B.a.partial(this.changeField,"alt"),"change .mailpoet_field_image_full_width":B.a.partial(this.changeBoolCheckboxField,"fullWidth"),"change .mailpoet_field_image_alignment":B.a.partial(this.changeField,"styles.block.textAlign"),"click .mailpoet_done_editing":"close","input .mailpoet_field_image_width":B.a.partial(this.updateValueAndCall,".mailpoet_field_image_width_input",B.a.partial(this.changePixelField,"width").bind(this)),"change .mailpoet_field_image_width":B.a.partial(this.updateValueAndCall,".mailpoet_field_image_width_input",B.a.partial(this.changePixelField,"width").bind(this)),"input .mailpoet_field_image_width_input":B.a.partial(this.updateValueAndCall,".mailpoet_field_image_width",B.a.partial(this.changePixelField,"width").bind(this))}},modelEvents:function(){return{"change:maxWidth":"updateMaxWidth","change:width":"updateWidth"}},updateValueAndCall:function(e,t,i){this.$(e).val(M()(i.target).val()),t(i)},updateMaxWidth:function(){var e=_e()(this.model.get("maxWidth"),10);this.$(".mailpoet_field_image_width").attr("max",e),this.$(".mailpoet_field_image_width_input").attr("max",e)},updateWidth:function(){var e=_e()(this.model.get("width"),10);this.$(".mailpoet_field_image_width").val(e),this.$(".mailpoet_field_image_width_input").val(e)},onImageSelect:function(e){null===e.src?this.model.set({src:""}):this.model.set(e),this.render()}}),ge=we.WidgetView.extend({id:"automation_editor_block_image",getTemplate:function(){return window.templates.imageInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new ve.ImageBlockModel},onDrop:function(e){e.droppedView.triggerMethod("showSettings",{showImageManager:!0})}}}}),ve.ImageWidgetView=ge,C.on("before:start",function(e){e.registerBlockType("image",{blockModel:ve.ImageBlockModel,blockView:ve.ImageBlockView}),e.registerWidget({name:"image",widgetView:ve.ImageWidgetView,priority:91})});var ye={},be=ce;ye.DividerBlockModel=be.BlockModel.extend({defaults:function(){return this._getDefaults({type:"divider",styles:{block:{backgroundColor:"transparent",padding:"12px",borderStyle:"solid",borderWidth:"1px",borderColor:"#000000"}}},C.getConfig().get("blockDefaults.divider"))}}),ye.DividerBlockView=be.BlockView.extend({className:"mailpoet_block mailpoet_divider_block mailpoet_droppable_block",getTemplate:function(){return window.templates.dividerBlock},modelEvents:B.a.omit(be.BlockView.prototype.modelEvents,"change"),behaviors:B.a.defaults({ResizableBehavior:{elementSelector:".mailpoet_content",resizeHandleSelector:".mailpoet_resize_handle",transformationFunction:function(e){return e/2},minLength:0,modelField:"styles.block.padding"},ShowSettingsBehavior:{ignoreFrom:".mailpoet_resize_handle"}},be.BlockView.prototype.behaviors),onDragSubstituteBy:function(){return ye.DividerWidgetView},initialize:function(){var e=this;be.BlockView.prototype.initialize.apply(this,arguments),this._replaceDividerHandler=function(t){e.model.set(t),e.model.trigger("applyToAll")},C.getChannel().on("replaceAllDividers",this._replaceDividerHandler),this.listenTo(this.model,"change:src change:styles.block.backgroundColor change:styles.block.borderStyle change:styles.block.borderWidth change:styles.block.borderColor applyToAll",this.render),this.listenTo(this.model,"change:styles.block.padding",this.changePadding)},templateContext:function(){return B.a.extend({totalHeight:2*_e()(this.model.get("styles.block.padding"),10)+_e()(this.model.get("styles.block.borderWidth"),10)+"px"},be.BlockView.prototype.templateContext.apply(this))},onRender:function(){this.toolsView=new ye.DividerBlockToolsView({model:this.model}),this.showChildView("toolsRegion",this.toolsView)},onBeforeDestroy:function(){C.getChannel().off("replaceAllDividers",this._replaceDividerHandler),this.stopListening(this.model)},changePadding:function(){this.$(".mailpoet_content").css("padding-top",this.model.get("styles.block.padding")),this.$(".mailpoet_content").css("padding-bottom",this.model.get("styles.block.padding")),this.$(".mailpoet_resize_handle_text").text(2*_e()(this.model.get("styles.block.padding"),10)+_e()(this.model.get("styles.block.borderWidth"),10)+"px")}}),ye.DividerBlockToolsView=be.BlockToolsView.extend({getSettingsView:function(){return ye.DividerBlockSettingsView}}),ye.DividerBlockSettingsView=be.BlockSettingsView.extend({getTemplate:function(){return window.templates.dividerBlockSettings},events:function(){return{"click .mailpoet_field_divider_style":"changeStyle","input .mailpoet_field_divider_border_width":B.a.partial(this.updateValueAndCall,".mailpoet_field_divider_border_width_input",B.a.partial(this.changePixelField,"styles.block.borderWidth").bind(this)),"change .mailpoet_field_divider_border_width":B.a.partial(this.updateValueAndCall,".mailpoet_field_divider_border_width_input",B.a.partial(this.changePixelField,"styles.block.borderWidth").bind(this)),"input .mailpoet_field_divider_border_width_input":B.a.partial(this.updateValueAndCall,".mailpoet_field_divider_border_width",B.a.partial(this.changePixelField,"styles.block.borderWidth").bind(this)),"change .mailpoet_field_divider_border_color":B.a.partial(this.changeColorField,"styles.block.borderColor"),"change .mailpoet_field_divider_background_color":B.a.partial(this.changeColorField,"styles.block.backgroundColor"),"click .mailpoet_button_divider_apply_to_all":"applyToAll","click .mailpoet_done_editing":"close"}},modelEvents:function(){return{"change:styles.block.borderColor":"repaintDividerStyleOptions"}},templateContext:function(){return B.a.extend({},be.BlockView.prototype.templateContext.apply(this,arguments),{availableStyles:C.getAvailableStyles().toJSON(),renderOptions:this.renderOptions})},changeStyle:function(e){var t=M()(e.currentTarget).data("style");this.model.set("styles.block.borderStyle",t),this.$(".mailpoet_field_divider_style").removeClass("mailpoet_active_divider_style"),this.$('.mailpoet_field_divider_style[data-style="'+t+'"]').addClass("mailpoet_active_divider_style")},repaintDividerStyleOptions:function(){this.$(".mailpoet_field_divider_style > div").css("border-top-color",this.model.get("styles.block.borderColor"))},applyToAll:function(){C.getChannel().trigger("replaceAllDividers",this.model.toJSON())},updateValueAndCall:function(e,t,i){this.$(e).val(M()(i.target).val()),t(i)}}),ye.DividerWidgetView=be.WidgetView.extend({id:"automation_editor_block_divider",getTemplate:function(){return window.templates.dividerInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new ye.DividerBlockModel}}}}),C.on("before:start",function(e){e.registerBlockType("divider",{blockModel:ye.DividerBlockModel,blockView:ye.DividerBlockView}),e.registerWidget({name:"divider",widgetView:ye.DividerWidgetView,priority:93})});var xe=ye,ke={},Ce=ce;ke.TextBlockModel=Ce.BlockModel.extend({defaults:function(){return this._getDefaults({type:"text",text:"Edit this to insert text"},C.getConfig().get("blockDefaults.text"))},_updateDefaults:function(){}}),ke.TextBlockView=Ce.BlockView.extend({className:"mailpoet_block mailpoet_text_block mailpoet_droppable_block",getTemplate:function(){return window.templates.textBlock},modelEvents:B.a.omit(Ce.BlockView.prototype.modelEvents,"change"),behaviors:B.a.extend({},Ce.BlockView.prototype.behaviors,{TextEditorBehavior:{toolbar1:"formatselect bold italic forecolor | link unlink",toolbar2:"alignleft aligncenter alignright alignjustify | bullist numlist blockquote | code mailpoet_shortcodes",validElements:"p[class|style],span[class|style],a[href|class|title|target|style],h1[class|style],h2[class|style],h3[class|style],ol[class|style],ul[class|style],li[class|style],strong[class|style],em[class|style],strike,br,blockquote[class|style],table[class|style],tr[class|style],th[class|style],td[class|style]",invalidElements:"script",blockFormats:"Heading 1=h1;Heading 2=h2;Heading 3=h3;Paragraph=p",plugins:"link lists code textcolor colorpicker mailpoet_shortcodes paste",configurationFilter:function(e){return B.a.extend({},e,{mailpoet_shortcodes:C.getConfig().get("shortcodes").toJSON(),mailpoet_shortcodes_window_title:c.a.I18n.t("shortcodesWindowTitle")})}}}),initialize:function(e){Ce.BlockView.prototype.initialize.apply(this,arguments),this.renderOptions=B.a.defaults(e.renderOptions||{},{disableTextEditor:!1}),this.disableTextEditor=this.renderOptions.disableTextEditor},onDragSubstituteBy:function(){return ke.TextWidgetView},onRender:function(){this.toolsView=new ke.TextBlockToolsView({model:this.model,tools:{settings:!1}}),this.showChildView("toolsRegion",this.toolsView)},onTextEditorChange:function(e){this.model.set("text",e)},onTextEditorFocus:function(){this.disableDragging(),this.disableShowingTools()},onTextEditorBlur:function(){this.enableDragging(),this.enableShowingTools()}}),ke.TextBlockToolsView=Ce.BlockToolsView.extend({getSettingsView:function(){return ke.TextBlockSettingsView}}),ke.TextBlockSettingsView=Ce.BlockSettingsView.extend({getTemplate:function(){return window.templates.textBlockSettings}}),ke.TextWidgetView=Ce.WidgetView.extend({getTemplate:function(){return window.templates.textInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new ke.TextBlockModel}}}}),C.on("before:start",function(e){e.registerBlockType("text",{blockModel:ke.TextBlockModel,blockView:ke.TextBlockView}),e.registerWidget({name:"text",widgetView:ke.TextWidgetView,priority:90})});var Se={},Ve=ce;Se.SpacerBlockModel=Ve.BlockModel.extend({defaults:function(){return this._getDefaults({type:"spacer",styles:{block:{backgroundColor:"transparent",height:"40px"}}},C.getConfig().get("blockDefaults.spacer"))}}),Se.SpacerBlockView=Ve.BlockView.extend({className:"mailpoet_block mailpoet_spacer_block mailpoet_droppable_block",getTemplate:function(){return window.templates.spacerBlock},behaviors:B.a.defaults({ResizableBehavior:{elementSelector:".mailpoet_spacer",resizeHandleSelector:".mailpoet_resize_handle",minLength:20,modelField:"styles.block.height"},ShowSettingsBehavior:{ignoreFrom:".mailpoet_resize_handle"}},Ve.BlockView.prototype.behaviors),modelEvents:B.a.omit(Ve.BlockView.prototype.modelEvents,"change"),onDragSubstituteBy:function(){return Se.SpacerWidgetView},initialize:function(){Ve.BlockView.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change:styles.block.backgroundColor",this.render),this.listenTo(this.model,"change:styles.block.height",this.changeHeight)},onRender:function(){this.toolsView=new Se.SpacerBlockToolsView({model:this.model}),this.showChildView("toolsRegion",this.toolsView)},changeHeight:function(){this.$(".mailpoet_spacer").css("height",this.model.get("styles.block.height")),this.$(".mailpoet_resize_handle_text").text(this.model.get("styles.block.height"))},onBeforeDestroy:function(){this.stopListening(this.model)}}),Se.SpacerBlockToolsView=Ve.BlockToolsView.extend({getSettingsView:function(){return Se.SpacerBlockSettingsView}}),Se.SpacerBlockSettingsView=Ve.BlockSettingsView.extend({getTemplate:function(){return window.templates.spacerBlockSettings},events:function(){return{"change .mailpoet_field_spacer_background_color":B.a.partial(this.changeColorField,"styles.block.backgroundColor"),"click .mailpoet_done_editing":"close"}}}),Se.SpacerWidgetView=Ve.WidgetView.extend({id:"automation_editor_block_spacer",getTemplate:function(){return window.templates.spacerInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new Se.SpacerBlockModel}}}}),C.on("before:start",function(e){e.registerBlockType("spacer",{blockModel:Se.SpacerBlockModel,blockView:Se.SpacerBlockView}),e.registerWidget({name:"spacer",widgetView:Se.SpacerWidgetView,priority:94})});var Te={},Be=ce;Te.FooterBlockModel=Be.BlockModel.extend({defaults:function(){return this._getDefaults({type:"footer",text:'<a href="[link:subscription_unsubscribe_url]">Unsubscribe</a> | <a href="[link:subscription_manage_url]">Manage subscription</a><br /><b>Add your postal address here!</b>',styles:{block:{backgroundColor:"transparent"},text:{fontColor:"#000000",fontFamily:"Arial",fontSize:"12px",textAlign:"center"},link:{fontColor:"#0000ff",textDecoration:"none"}}},C.getConfig().get("blockDefaults.footer"))},_updateDefaults:function(){C.getConfig().set("blockDefaults.footer",B.a.omit(this.toJSON(),"text"))}}),Te.FooterBlockView=Be.BlockView.extend({className:"mailpoet_block mailpoet_footer_block mailpoet_droppable_block",getTemplate:function(){return window.templates.footerBlock},modelEvents:B.a.extend({"change:styles.block.backgroundColor change:styles.text.fontColor change:styles.text.fontFamily change:styles.text.fontSize change:styles.text.textAlign change:styles.link.fontColor change:styles.link.textDecoration":"render"},B.a.omit(Be.BlockView.prototype.modelEvents,"change")),behaviors:B.a.extend({},Be.BlockView.prototype.behaviors,{TextEditorBehavior:{configurationFilter:function(e){return B.a.extend({},e,{mailpoet_shortcodes:C.getConfig().get("shortcodes").toJSON(),mailpoet_shortcodes_window_title:c.a.I18n.t("shortcodesWindowTitle")})}}}),onDragSubstituteBy:function(){return Te.FooterWidgetView},onRender:function(){this.toolsView=new Te.FooterBlockToolsView({model:this.model}),this.showChildView("toolsRegion",this.toolsView)},onTextEditorChange:function(e){this.model.set("text",e)},onTextEditorFocus:function(){this.disableDragging(),this.disableShowingTools()},onTextEditorBlur:function(){this.enableDragging(),this.enableShowingTools()}}),Te.FooterBlockToolsView=Be.BlockToolsView.extend({getSettingsView:function(){return Te.FooterBlockSettingsView}}),Te.FooterBlockSettingsView=Be.BlockSettingsView.extend({getTemplate:function(){return window.templates.footerBlockSettings},events:function(){return{"change .mailpoet_field_footer_text_color":B.a.partial(this.changeColorField,"styles.text.fontColor"),"change .mailpoet_field_footer_text_font_family":B.a.partial(this.changeField,"styles.text.fontFamily"),"change .mailpoet_field_footer_text_size":B.a.partial(this.changeField,"styles.text.fontSize"),"change #mailpoet_field_footer_link_color":B.a.partial(this.changeColorField,"styles.link.fontColor"),"change #mailpoet_field_footer_link_underline":function(e){this.model.set("styles.link.textDecoration",e.target.checked?e.target.value:"none")},"change .mailpoet_field_footer_background_color":B.a.partial(this.changeColorField,"styles.block.backgroundColor"),"change .mailpoet_field_footer_alignment":B.a.partial(this.changeField,"styles.text.textAlign"),"click .mailpoet_done_editing":"close"}},templateContext:function(){return B.a.extend({},Be.BlockView.prototype.templateContext.apply(this,arguments),{availableStyles:C.getAvailableStyles().toJSON()})}}),Te.FooterWidgetView=Be.WidgetView.extend({id:"automation_editor_block_footer",getTemplate:function(){return window.templates.footerInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new Te.FooterBlockModel}}}}),C.on("before:start",function(e){e.registerBlockType("footer",{blockModel:Te.FooterBlockModel,blockView:Te.FooterBlockView}),e.registerWidget({name:"footer",widgetView:Te.FooterWidgetView,priority:100})});var Ee={},Pe=ce;Ee.HeaderBlockModel=Pe.BlockModel.extend({defaults:function(){return this._getDefaults({type:"header",text:'Display problems? <a href="[link:newsletter_view_in_browser_url]">View it in your browser</a>',styles:{block:{backgroundColor:"transparent"},text:{fontColor:"#000000",fontFamily:"Arial",fontSize:"12px",textAlign:"center"},link:{fontColor:"#0000ff",textDecoration:"underline"}}},C.getConfig().get("blockDefaults.header"))},_updateDefaults:function(){C.getConfig().set("blockDefaults.header",B.a.omit(this.toJSON(),"text"))}}),Ee.HeaderBlockView=Pe.BlockView.extend({className:"mailpoet_block mailpoet_header_block mailpoet_droppable_block",getTemplate:function(){return window.templates.headerBlock},modelEvents:B.a.extend({"change:styles.block.backgroundColor change:styles.text.fontColor change:styles.text.fontFamily change:styles.text.fontSize change:styles.text.textAlign change:styles.link.fontColor change:styles.link.textDecoration":"render"},B.a.omit(Pe.BlockView.prototype.modelEvents,"change")),behaviors:B.a.extend({},Pe.BlockView.prototype.behaviors,{TextEditorBehavior:{configurationFilter:function(e){return B.a.extend({},e,{mailpoet_shortcodes:C.getConfig().get("shortcodes").toJSON(),mailpoet_shortcodes_window_title:c.a.I18n.t("shortcodesWindowTitle")})}}}),onDragSubstituteBy:function(){return Ee.HeaderWidgetView},onRender:function(){this.toolsView=new Ee.HeaderBlockToolsView({model:this.model}),this.showChildView("toolsRegion",this.toolsView)},onTextEditorChange:function(e){this.model.set("text",e)},onTextEditorFocus:function(){this.disableDragging(),this.disableShowingTools()},onTextEditorBlur:function(){this.enableDragging(),this.enableShowingTools()}}),Ee.HeaderBlockToolsView=Pe.BlockToolsView.extend({getSettingsView:function(){return Ee.HeaderBlockSettingsView}}),Ee.HeaderBlockSettingsView=Pe.BlockSettingsView.extend({getTemplate:function(){return window.templates.headerBlockSettings},events:function(){return{"change .mailpoet_field_header_text_color":B.a.partial(this.changeColorField,"styles.text.fontColor"),"change .mailpoet_field_header_text_font_family":B.a.partial(this.changeField,"styles.text.fontFamily"),"change .mailpoet_field_header_text_size":B.a.partial(this.changeField,"styles.text.fontSize"),"change #mailpoet_field_header_link_color":B.a.partial(this.changeColorField,"styles.link.fontColor"),"change #mailpoet_field_header_link_underline":function(e){this.model.set("styles.link.textDecoration",e.target.checked?e.target.value:"none")},"change .mailpoet_field_header_background_color":B.a.partial(this.changeColorField,"styles.block.backgroundColor"),"change .mailpoet_field_header_alignment":B.a.partial(this.changeField,"styles.text.textAlign"),"click .mailpoet_done_editing":"close"}},templateContext:function(){return B.a.extend({},Pe.BlockView.prototype.templateContext.apply(this,arguments),{availableStyles:C.getAvailableStyles().toJSON()})}}),Ee.HeaderWidgetView=Pe.WidgetView.extend({id:"automation_editor_block_header",getTemplate:function(){return window.templates.headerInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new Ee.HeaderBlockModel}}}}),C.on("before:start",function(e){e.registerBlockType("header",{blockModel:Ee.HeaderBlockModel,blockView:Ee.HeaderBlockView}),e.registerWidget({name:"header",widgetView:Ee.HeaderWidgetView,priority:99})});var Me={},Ae=ce;Me.ALCSupervisor=V.a.extend({initialize:function(){this.listenTo(C.getChannel(),"automatedLatestContentRefresh",B.a.debounce(this.refresh,500))},refresh:function(){var e,t=C.findModels(function(e){return"automatedLatestContent"===e.get("type")})||[];0!==t.length&&(e=B.a.map(t,function(e){return e.toJSON()}),z.getBulkTransformedPosts({blocks:e}).then(B.a.partial(this.refreshBlocks,t)))},refreshBlocks:function(e,t){B.a.each(B.a.zip(e,t),function(e){var t=e[0],i=e[1];t.trigger("refreshPosts",i)})}}),Me.AutomatedLatestContentBlockModel=Ae.BlockModel.extend({stale:["_container"],defaults:function(){return this._getDefaults({type:"aut