(window.webpackJsonp=window.webpackJsonp||[]).push([[78],{1182:function(e,t,n){"use strict";n.r(t);var a=n(0),r=n(796),c=n(797),o=n(870),l=n(63),i=n(2),s=n(268),m=n(4);function b(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],a=!0,r=!1,c=void 0;try{for(var o,l=e[Symbol.iterator]();!(a=(o=l.next()).done)&&(n.push(o.value),!t||n.length!==t);a=!0);}catch(e){r=!0,c=e}finally{try{a||null==l.return||l.return()}finally{if(r)throw c}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}var f=function(e){return Object(i.__)("Saved form does not exist.","wp-marketing-automations")},p=function(){var e=bwfcrm_contacts_data&&bwfcrm_contacts_data.form_nice_names?bwfcrm_contacts_data.form_nice_names:{},t=bwfcrm_contacts_data&&bwfcrm_contacts_data.available_forms?bwfcrm_contacts_data.available_forms:[],n=Object(c.a)().getFeed,o=Object(r.a)(),l=o.setFormSource,u=o.resetSelection,p=n(),d=(p||{}).source,O=void 0===d?"":d,j=b(Object(a.useState)(O&&!t.includes(O)?f(e[O]):""),2),w=j[0],_=j[1];return Object(a.createElement)(a.Fragment,null,!!e&&Object.keys(e).length>0&&Object(a.createElement)(a.Fragment,null,Object(a.createElement)("div",{className:"bwf-h4"},Object(i.__)("Form Type","wp-marketing-automations")),Object(a.createElement)("div",{className:"bwf-crm-icon-btn-wrap","data-size":"small"},Object.keys(e).map((function(n){return Object(a.createElement)(s.a,{key:n,isSelected:n===O,onClick:function(){l(n),t.includes(n)?_(""):(_(f(e[n])),u())}},e[n])})))),!!w&&Object(a.createElement)(a.Fragment,null,Object(a.createElement)("div",{className:"bwf_clear_30"}),Object(a.createElement)(m.Notice,{className:"bwf-error-notice",isDismissible:!1,status:"error"},w)))},d=n(43),O=(n(82),function(e){var t=Object(c.a)(),n=t.getSelectionOptions,o=t.getSelections,l=t.getLoading,s=Object(r.a)().setSelection,m=l(),b=n(),u=o();return Object(a.createElement)("div",{className:"bwf-crm-form-selection-wrap"},b&&Object.keys(b).map((function(e){var t=b[e],n=t.slug,r=void 0===n?"":n,c=r&&u[r]?u[r]:"";return t&&t.options?Object(a.createElement)("div",{key:e},Object(a.createElement)("div",{className:"bwf-h4"},Object(i.__)("Select ","wp-marketing-automations")+t.name),Object(a.createElement)("select",{onChange:function(e){return s(r,e.target.value)},value:c},Object(a.createElement)("option",{value:""},Object(i.__)("Choose ","wp-marketing-automations")+t.name),Object.keys(t.options).map((function(e){var n=t.options[e],r=n?Object.keys(n).map((function(e){return Object(a.createElement)("option",{key:e,value:e},n[e])})):[];return"default"!==e?Object(a.createElement)("optgroup",{key:e,label:e},r):r})))):null})),m&&Object(a.createElement)(d.a,{size:"l"}))}),j=function(e,t,n){return!(!e||parseInt(t)>Object.keys(e).length)&&Object.keys(n).reduce((function(t,a){var r=n[a];if(!e[r.slug])return!1;for(var c in r.options){var o=r.options[c];for(var l in o)if(l===e[r.slug]||parseInt(l)===parseInt(e[r.slug]))return t}return!1}),!0)},w=bwfcrm_contacts_data&&bwfcrm_contacts_data.available_forms?bwfcrm_contacts_data.available_forms:[];t.default=function(e){var t=e.feedId,n=Object(r.a)(),s=n.syncSelection,b=n.setStep,u=Object(c.a)(),f=u.getFeed,d=u.getSelections,_=u.getSelectionOptionsTotal,v=u.getSelectionOptions,g=f(),y=(g||{}).source,E=void 0===y?"":y,k=d(),S=_(),h=v();return Object(a.useEffect)((function(){g&&parseInt(g.id)===parseInt(t)&&E&&w.includes(E)&&s(t,k,!0)}),[E,k]),Object(a.createElement)(a.Fragment,null,g&&parseInt(g.id)===parseInt(t)?Object(a.createElement)(a.Fragment,null,Object(a.createElement)(l.a,null),Object(a.createElement)("div",{className:"bwf-crm-stepper-wrap bwf-card-wrap"},Object(a.createElement)("div",{className:"bwf-card-header"},Object(a.createElement)("span",{className:"bwf-form-title"},Object(i.__)("Select Form","wp-marketing-automations"))),Object(a.createElement)("div",{className:"bwf-crm-background-wrap"},Object(a.createElement)(p,null),Object(a.createElement)("div",{className:"bwf_clear_30"}),Object(a.createElement)(O,null)),Object(a.createElement)("div",{className:"bwf_clear_20"}),Object(a.createElement)("div",{className:"bwf-crm-stepper-navigation bwf_text_right"},Object(a.createElement)(m.Button,{className:"bwf-crm-stepper-next",isPrimary:!0,disabled:!j(k,S,h),onClick:function(){return b("mapping")}},Object(i.__)("Next","wp-marketing-automations"))))):Object(a.createElement)(o.a,null))}}}]);