(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["views/smb/web/setup"],{765:(e,t,n)=>{"use strict";n.r(t),n.d(t,{useAddDomainFormInDrawer:()=>I});var a=n(153),o=n.n(a),l=n(154),r=n(261),i=n.n(r),s=n(302),c=n(405),m=n(556),d=n(144),u=n(155),p=n(766),g=n(722),b=n(767),E=n(576),f=n(769),h=n(770),w=n(772);const C=s.gql`
    query GetWebspaceIpAddress($id: ID!) {
        domain: node(id: $id) {
            ... on Domain {
                ipAddresses {
                    ipAddress(publicIp: true)
                }
            }
        }
    }
`,S=d.Locale.getSection("smb.components.forms.web.add-domain"),v=d.Locale.getTranslate("smb.components.forms.web.add-domain"),k=d.Locale.getTranslate("smb.components.forms.domain-info-section"),T=d.Locale.getTranslate("components.forms.ip-addresses-selector"),y=d.Locale.getTranslate("smb.components.forms.web._shared"),N=d.Locale.getTranslate("smb.components.forms.web.seo-settings"),F=d.Locale.getTranslate("admin.components.forms.admin-panel.form.contact-info"),P=d.Locale.getTranslate("components.buttons"),D=({id:e,showDomainRegistrationPromo:t,ipAddresses:a,allowCustomerCreation:r,allowWebspaceCreation:i,subscriptionsLookUpParams:s,canManageMailSettings:h,maxSysnameSize:D,isWindows:I,techDomain:q,settingsEnabled:R,settingsCollapsed:x,applicationWizardConfig:A,embeddedForms:L,applicationWizardEmbeddedForms:B,cancelLink:U,className:H,render:O,onProcess:V,onStepPropsChange:z,status:_,...W})=>{var j;const $=(0,c.useApolloClient)(),M=(0,m.useHistory)(),[Y,J]=(0,l.useState)(W.values),[G,Z]=(0,l.useState)(Boolean(W.values.hostingSettings.root)),[K,Q]=(0,l.useState)(!W.values.domainInfo),[X,ee]=(0,l.useState)(W.webspaceIpAddress),[te,ne]=(0,l.useState)(null);(0,l.useEffect)((()=>{if(G)return;let e=/^[a-zA-Z0-9\.\-\*]+$/.match(Y.domainName.name)?Y.domainName.name.replace(/\*/g,"_"):"";-1!==Y.hostingSettings.rootPattern.indexOf("<domain>")&&(e=Y.hostingSettings.rootPattern.replace("<domain>",e)),J((0,u.setIn)(Y,"hostingSettings[root]",e))}),[Y.domainName.name]),(0,l.useEffect)((()=>{Y.domainName.webspace&&"new"!==Y.domainName.webspace.id&&$.query({query:C,variables:{id:btoa(`Domain:${Y.domainName.webspace.id}`)}}).then((({data:{domain:{ipAddresses:e}}})=>{ee(e[0].ipAddress)}))}),[Y.domainName.webspace]);const ae=(e,t)=>{switch(J((n=>{if(n=(0,u.setIn)(n,e,t),"domainName[name]"===e&&!K){let e=/^[a-zA-Z0-9_.\-]+$/.match(t)?n.domainName.type===p.TYPE_TECH?t.split(".")[0]:t:"";e=e.toLowerCase().substr(0,D),I&&"."===e.substr(-1)&&(e=e.substr(0,e.length-1)),n=(0,u.setIn)(n,"domainInfo[userName]",e||W.values.domainInfo.userName)}return n})),["domainInfo[ipSelector][ipv4]","domainInfo[ipSelector][ipv6]","domainInfo[userName]","domainInfo[password]"].includes(e)&&d.UAT.dispatchAction("CUSTOM-VALUE",{name:e}),e){case"hostingSettings[root]":Z(!0);break;case"domainInfo[userName]":Q(!0)}},oe="1"===Y.domainName.assignToCustomer||void 0!==Y.domainName.targetWebspace||Y.domainName.webspace&&"new"===Y.domainName.webspace.id,le=oe||!X?Object.keys(a).map((e=>{const t=Y.domainInfo.ipSelector[e];return"none"===t?null:a[e][t].split(" ")[0]})).filter(Boolean)[0]:X;(0,l.useEffect)((()=>{A.enabled||null==z||z({sideBanner:n(777),sideBannerContainer:{background:"#faf5f7"}})}),[A.enabled]);const re=A.enabled?w.default:g.default;return(0,l.createElement)(re,{vertical:!0,id:e,className:H,render:O,values:Y,onFieldChange:ae,onSubmit:e=>(e.domainName.customer&&(e=(0,u.setIn)(e,"domainName[customer]",e.domainName.customer.id)),e.domainName.webspace&&(e=(0,u.setIn)(e,"domainName[webspace]",e.domainName.webspace.id)),e),onLongTask:e=>{ne(e),null==V||V(e),null==z||z({sideBanner:n(779),sideBannerContainer:{background:"#e0f3f9"}})},onStepChange:e=>{te||null==z||z("chooseApplicationStep"===e?{sideBanner:n(778),sideBannerContainer:{background:"#f3f4f5"}}:{sideBanner:n(777),sideBannerContainer:{background:"#faf5f7"}})},embeddedForms:L,wizardConfig:A,wizardEmbeddedForms:B,submitButton:{id:"btn-send",children:(0,l.createElement)(v,{content:"buttonAddDomain"})},applyButton:!1,cancelButton:!!U&&{id:"btn-cancel",children:(0,l.createElement)(P,{content:"cancel"}),onClick:()=>{M.push(U)}}},(_||[]).filter((({status:e})=>"warning"===e)).map((({content:e})=>(0,l.createElement)(u.StatusMessage,{intent:"warning",key:e},e))),t?(0,l.createElement)(E.default,null,(()=>new Jsw.Panel({cls:"tools-box",items:[{componentType:"Jsw.Hint",hint:S.lmsg("formRegistrationHint",{link:`<a href="${(0,d.prepareUrl)("/mpc/register-domains")}" target="_blank">${S.lmsg("portalLink")}</a>`})}]}))):null,(0,l.createElement)(p.default,o()({isEnabled:void 0!==Y.domainName.type,isDefault:Y.domainName.type===p.TYPE_TECH,typeName:"domainName[type]",name:"domainName[name]",ipAddress:le,onTypeChange:e=>ae("domainName[type]",e),onDomainNameChange:e=>ae("domainName[name]",e)},q)),void 0===Y.domainName.assignToCustomer?null:(0,l.createElement)(u.Section,null,(0,l.createElement)(u.FormFieldCheckbox,{name:"domainName[assignToCustomer]",label:(0,l.createElement)(v,{content:"assignToCustomer"}),checkedValue:"1",uncheckedValue:"0"}),"1"===Y.domainName.assignToCustomer?(0,l.createElement)(u.Section,{collapsible:!0},void 0===Y.domainName.customer?null:(0,l.createElement)(b.default,{name:"domainName[customer]",label:(0,l.createElement)(v,{content:"customer"}),dataUrl:"/admin/customer/look-up",newItemValue:r?{id:"new",title:S.lmsg("createNewCustomer")}:null,locale:{label:S.lmsg("selectExistingCustomer")},required:!0}),void 0===Y.domainName.customer||"new"===(null===(j=Y.domainName.customer)||void 0===j?void 0:j.id)?(0,l.createElement)(l.Fragment,null,(0,l.createElement)(u.FormFieldText,{name:"customerInfo[customerContactInfo][contactName]",label:(0,l.createElement)(F,{content:"contactName"}),required:!0}),(0,l.createElement)(u.FormFieldText,{name:"customerInfo[customerContactInfo][email]",label:(0,l.createElement)(F,{content:"email"}),required:!0}),(0,l.createElement)("br",null),(0,l.createElement)(u.Heading,{level:"4"},(0,l.createElement)(v,{content:"customerLoginInfoHint"})),(0,l.createElement)(f.default,{prefix:"customerInfo[customerLoginInfo]"})):null):null),void 0===Y.domainName.webspace||"1"===Y.domainName.assignToCustomer?null:(0,l.createElement)(u.Section,null,(0,l.createElement)(b.default,{name:"domainName[webspace]",label:(0,l.createElement)(v,{content:"target"}),dataUrl:"/smb/web/subscription-look-up",newItemValue:i?{id:"new",title:S.lmsg("createNewTarget")}:null,locale:{label:S.lmsg("selectExistingTarget")},lookUpParams:s,required:!0})),oe?R?(0,l.createElement)(u.Section,{id:"domainInfo",title:(0,l.createElement)(v,{content:"webspaceLegend"}),collapsible:!0,collapsed:x},Object.keys(a).map((e=>(0,l.createElement)(u.FormFieldSelect,{key:e,name:`domainInfo[ipSelector][${e}]`,label:(0,l.createElement)(T,{content:Object.keys(a).length>1?`${e}Address`:"ipAddress"}),required:!0},Object.keys(a[e]).map((t=>(0,l.createElement)(u.SelectOption,{key:t,value:t},a[e][t])))))),(0,l.createElement)("br",null),(0,l.createElement)(u.Heading,{level:"4"},(0,l.createElement)(v,{content:"credentials"})),(0,l.createElement)(u.Text,{component:"p",intent:"muted"},(0,l.createElement)(v,{content:I?"credentialsHintWin":"credentialsHint"})),(0,l.createElement)(u.FormFieldText,{name:"domainInfo[userName]",label:(0,l.createElement)(k,{content:"userName"}),required:!0}),(0,l.createElement)(u.FormFieldPassword,{name:"domainInfo[password]",label:(0,l.createElement)(k,{content:"password"}),required:!0})):null:(0,l.createElement)(u.Section,null,(0,l.createElement)(u.FormFieldSelect,{name:"hostingType[hosting]",label:(0,l.createElement)(v,{content:"hostingManagementOptions"})},(0,l.createElement)(u.SelectOption,{value:"hosting",label:"hosting"},(0,l.createElement)(v,{content:"websiteHosting"})),(0,l.createElement)(u.SelectOption,{value:"forwarding",label:"forwarding"},(0,l.createElement)(v,{content:"websiteForwarding"})),(0,l.createElement)(u.SelectOption,{value:"none",label:"none"},(0,l.createElement)(v,{content:"websiteNoHosting"}))),void 0===Y.dnsSettings?null:(0,l.createElement)(u.FormFieldCheckbox,{name:"dnsSettings[dns]",label:(0,l.createElement)(v,{content:"dns"}),description:(0,l.createElement)(v,{content:"dnsHint"}),disabled:Y.domainName.type===p.TYPE_TECH,checkedValue:Y.domainName.type===p.TYPE_TECH?null:"master",uncheckedValue:Y.domainName.type===p.TYPE_TECH?null:"none"}),void 0===Y.mailSettings?null:(0,l.createElement)(u.FormFieldCheckbox,{name:"mailSettings[mail]",label:(0,l.createElement)(v,{content:"mail"}),description:h?(0,l.createElement)(v,{content:"mailHint"}):(0,l.createElement)(v,{content:"mailHintNoPermission"}),disabled:Y.domainName.type===p.TYPE_TECH,checkedValue:Y.domainName.type===p.TYPE_TECH?null:"1",uncheckedValue:Y.domainName.type===p.TYPE_TECH?null:"0"}),"hosting"===Y.hostingType.hosting?(0,l.createElement)(u.Section,{id:"hostingSettings",title:(0,l.createElement)(v,{content:"hostingSettingsSectionLegend"}),collapsible:!0,collapsed:!0},(0,l.createElement)(u.FormField,{name:"hostingSettings[root]",label:(0,l.createElement)(y,{content:"documentRoot"}),description:(0,l.createElement)(y,{content:"documentRootHint"}),required:!0},(({getId:e,getName:t,getValue:n,setValue:a})=>(0,l.createElement)(l.Fragment,null,(0,l.createElement)(u.Icon,{name:"home"})," / ",(0,l.createElement)(u.Input,{id:e(),name:t(),value:n(),onChange:({target:e})=>a(e.value)})))),(0,l.createElement)(u.FormFieldRadioButtons,{name:"hostingSettings[seoRedirectDirection]",label:(0,l.createElement)(N,{content:"seoRedirectDirection"}),description:(0,l.createElement)(N,{content:"seoRedirectDirectionHint"}),required:!0,options:[{value:"www",label:`www.${Y.domainName.name||"<your_domain>"}`},{value:"non-www",label:Y.domainName.name||"<your_domain>"},{value:"none",label:(0,l.createElement)(N,{content:"seoRedirectDirectionNone"})}]})):null,"forwarding"===Y.hostingType.hosting?(0,l.createElement)(u.Section,{id:"forwardingSettings",title:(0,l.createElement)(y,{content:"forwardingSettingsSectionLegend"}),collapsible:!0,collapsed:!0},(0,l.createElement)(u.FormFieldText,{name:"forwardingSettings[forwardTo]",label:(0,l.createElement)(y,{content:"forwardDestination"}),description:(0,l.createElement)(y,{content:"forwardDestinationHint"}),required:!0}),(0,l.createElement)(u.FormFieldRadioButtons,{name:"forwardingSettings[forwardingType]",label:(0,l.createElement)(y,{content:"forwardingTypeOptions"}),options:[{value:"std_fwd301",label:(0,l.createElement)(y,{content:"forwardingHttpCode301"}),description:(0,l.createElement)(y,{content:"forwardingHttpCode301Hint"})},{value:"std_fwd302",label:(0,l.createElement)(y,{content:"forwardingHttpCode302"}),description:(0,l.createElement)(y,{content:"forwardingHttpCode302Hint"})},{value:"frm_fwd",label:(0,l.createElement)(y,{content:"forwardingFrame"}),description:(0,l.createElement)(y,{content:"forwardingFrameHint"})}]})):null))};D.propTypes={id:i().string.isRequired,showDomainRegistrationPromo:i().bool,values:i().object.isRequired,ipAddresses:i().shape({ipv4:i().object,ipv6:i().object}).isRequired,allowCustomerCreation:i().bool,allowWebspaceCreation:i().bool,subscriptionsLookUpParams:i().object,webspaceIpAddress:i().string,canManageMailSettings:i().bool,maxSysnameSize:i().number.isRequired,isWindows:i().bool.isRequired,techDomain:i().object.isRequired,settingsEnabled:i().bool,settingsCollapsed:i().bool,applicationWizardConfig:i().object,cancelLink:i().string,embeddedForms:i().array,applicationWizardEmbeddedForms:i().array,className:i().string,render:i().func,onProcess:i().func,onStepPropsChange:i().func,status:i().array},D.defaultProps={showDomainRegistrationPromo:!1,allowCustomerCreation:!1,allowWebspaceCreation:!1,subscriptionsLookUpParams:null,webspaceIpAddress:null,canManageMailSettings:!1,settingsEnabled:!1,settingsCollapsed:!1,applicationWizardConfig:{},cancelLink:null,embeddedForms:void 0,applicationWizardEmbeddedForms:void 0,className:void 0,render:void 0,onProcess:void 0,onStepPropsChange:void 0,status:void 0};const I=(e,t)=>(0,h.default)(D,"add-domain",e,t);t.default=D},772:(e,t,n)=>{"use strict";n.r(t);var a=n(153),o=n.n(a),l=n(154),r=n(261),i=n.n(r),s=n(144),c=n(773),m=n(774);const d=s.Locale.getTranslate("components.domain-applications.applications"),u=({onFieldChange:e,onStepChange:t,formPrefix:a,wizardConfig:r,embeddedForms:i,wizardEmbeddedForms:s,values:u,children:p,...g})=>{const[b,E]=(0,l.useState)([]),f=t=>{e("applicationName",t),E([...s.filter((({ext:e,name:n})=>t===`ext-${e}-${n}`)).filter((({content:e})=>Boolean(e))).map((({ext:e,name:t,...n})=>({key:`ext-${e}-${t}`,children:"",embeddedForms:[{name:t,...n}]})))])},h=[r.blankSite&&{name:"blank-site",icon:n(775),title:(0,l.createElement)(d,{content:"blank-site.title"}),description:(0,l.createElement)(d,{content:"blank-site.description"})},r.uploadFiles&&{name:"upload-files",icon:n(776),title:(0,l.createElement)(d,{content:"upload-files.title"}),description:(0,l.createElement)(d,{content:"upload-files.description"})},...s.map((({ext:e,name:t,title:n,icon:a,description:o})=>({name:`ext-${e}-${t}`,icon:a,title:n,description:o})))].filter(Boolean),w=[h.length>1&&{key:"chooseApplicationStep",children:(0,l.createElement)(c.default,{onApplicationSelect:f,applicationsList:h}),nextButton:!1},{key:"addDomainStep",formPrefix:a,children:p,embeddedForms:i}].filter(Boolean);(0,l.useEffect)((()=>{if(0===h.length&&f("blank-site"),1===h.length){const[{name:e}]=h;f(e)}}),[]);const C=u.applicationName&&1!==w.length?1:0;return(0,l.useEffect)((()=>{null==t||t(w[C].key)}),[C]),(0,l.createElement)(m.default,o()({},g,{values:u,onFieldChange:e,onStepChange:(t,n)=>0===n&&w.length>1?(e("applicationName",null),E([]),t):n,step:C,steps:[...w,...b]}))};u.propTypes={values:i().object.isRequired,onFieldChange:i().func.isRequired,onStepChange:i().func,children:i().node,formPrefix:i().string,wizardConfig:i().shape({enabled:i().bool,blankSite:i().bool,uploadFiles:i().bool}),embeddedForms:i().array,wizardEmbeddedForms:i().array},u.defaultProps={children:null,onStepChange:void 0,formPrefix:"",wizardConfig:{enabled:!0,blankSite:!0,uploadFiles:!0},embeddedForms:[],wizardEmbeddedForms:[]},t.default=u},773:(e,t,n)=>{"use strict";n.r(t);var a=n(154),o=n(155),l=n(261),r=n.n(l);const i=n(144).Locale.getTranslate("components.domain-applications"),s=({onApplicationSelect:e,applicationsList:t})=>(0,a.createElement)(a.Fragment,null,(0,a.createElement)(o.Heading,{level:"3"},(0,a.createElement)(i,{content:"title"})),(0,a.createElement)(o.ItemList,{minColumnWidth:220,gap:"xs",selectable:!0},t.map((({name:t,icon:n,title:l,description:r})=>(0,a.createElement)(o.Item,{"data-action":t,key:t,icon:(0,a.createElement)(o.Icon,{src:n,intent:"info",size:"64"}),title:(0,a.createElement)(o.Heading,{level:"4"},l),onClick:()=>e(t)},(0,a.createElement)(o.Paragraph,null,r))))));s.propTypes={onApplicationSelect:r().func.isRequired,applicationsList:r().arrayOf(r().shape({name:r().string.isRequired,icon:r().string.isRequired,title:r().node,description:r().node}))},s.defaultProps={applicationsList:[]},t.default=s},771:(e,t,n)=>{"use strict";n.r(t);var a=n(153),o=n.n(a),l=n(154),r=n(155),i=n(144),s=n(261),c=n.n(s),m=n(615),d=n(635),u=n(582);const p="running",g=()=>(0,i.getComponent)("asyncProgressBarWrapper"),b=({children:e,dataType:t,isOpen:n,onClose:a,task:s,history:c,pageUrl:b,...E})=>{const[f,h]=(0,l.useState)([]),[w,C]=(0,l.useState)(null),[S,v]=(0,l.useState)(null),[k,T]=(0,l.useState)(null),y=s?s.id:null,{addToast:N}=(0,d.useToaster)(),F=()=>c&&S&&(0,u.isMatch)(S)&&!((e,t)=>{if(e===t)return!0;try{const n=new URLSearchParams(new URL(e,window.location.origin).search);return n.get("returnUrl")===t||n.get("pageUrl")===t}catch(e){}return!0})(S,b),P=({id:e,steps:t,status:a,errors:o,output:r,progressValue:s,progressTitle:c,progressTitleHtml:m})=>{if(!n||y!==e)return;const d=m||c,u=i.Task.STATUS_STARTED===a?p:a,g=e=>(e||[]).map((e=>(0,l.createElement)("div",{key:e},e)));T(u),t&&t.length?(C(d),h(t.map((({errors:e,...t})=>({children:g(e),...t}))))):h([{title:d,status:u,progress:Number(s),children:(0,l.createElement)(l.Fragment,null,g(o),g(r))}])};(0,l.useEffect)((()=>{const e=g();n?(null==e||e.hide(),h([]),C(null),v(null),T(null)):(async()=>{D()||await I(),null==e||e.show()})()}),[n]),(0,l.useEffect)((()=>{var e;y&&(null===(e=g())||void 0===e||e.update(),P(s))}),[y,s]),(0,m.default)("plesk:taskStepUpdate",P,i.Observer),(0,m.default)("plesk:taskComplete",(({id:e,redirect:t,status:a})=>{n&&y===e&&i.Task.STATUS_DONE===a&&v(t.url||t)}),i.Observer);const D=()=>i.Task.STATUS_NOT_STARTED===k||p===k,I=()=>{var e,t;return y&&(null===(e=g())||void 0===e||null===(t=e.getItems().find((e=>e.getId()===y)))||void 0===t?void 0:t.remove())};return(0,l.createElement)(r.Drawer,o()({"data-type":t,isOpen:n,onClose:()=>{S?F()?c.push(S,{reload:!0}):(0,i.redirect)(S):a()},progress:f.length?{cancelable:!1,title:w,steps:f,onFinish:()=>{I(),N({intent:"success",message:w||f[0].title})},autoCloseTimeout:1}:null,hideButton:D()},E),e)};b.propTypes={children:c().node,dataType:c().string.isRequired,isOpen:c().bool,onClose:c().func.isRequired,task:c().shape({id:c().string.isRequired,steps:c().array,status:c().string,progressTitle:c().string,progressTitleHtml:c().string}),history:c().object,pageUrl:c().string},b.defaultProps={children:null,isOpen:!1,task:null,history:null,pageUrl:null},t.default=b},767:(e,t,n)=>{"use strict";n.r(t);var a=n(154),o=n(261),l=n.n(o),r=n(155),i=n(768);const s=n(144).Locale.getSection("components.elements.lookup"),c=({data:e,dataUrl:t,lookUpParams:n,newItemValue:o,locale:l,placeholder:c,...m})=>(0,a.createElement)(r.FormField,m,(({getId:r,getName:m,getValue:d,setValue:u,isDisabled:p})=>(0,a.createElement)(i.default,{id:r(),name:m(),value:d(),onChange:e=>u(e),data:e,dataUrl:t,lookUpParams:n,newItemValue:o,locale:{...s.messages,...l},disabled:p(),placeholder:c})));c.propTypes={locale:l().object,data:l().array,dataUrl:l().string,lookUpParams:l().object,newItemValue:l().object,placeholder:l().string},c.defaultProps={locale:void 0,data:void 0,dataUrl:void 0,lookUpParams:void 0,newItemValue:void 0,placeholder:void 0},t.default=c},768:(e,t,n)=>{"use strict";n.r(t);var a=n(154),o=n(144),l=n(576);t.default=e=>{const[t,n]=(0,a.useState)(null);return(0,a.useEffect)((()=>{const t=new o.LookUp(e);return n(t),()=>{t.remove(),n(null)}}),[]),t?(0,a.createElement)(l.default,null,t):null}},774:(e,t,n)=>{"use strict";n.r(t);var a=n(153),o=n.n(a),l=n(155),r=n(154),i=n(722),s=n(144),c=n(261),m=n.n(c);const d=s.Locale.getTranslate("components.buttons"),u=({step:e,steps:t,onStepChange:n,onSubmit:a,submitButton:s,cancelButton:c,...m})=>{const u=(0,r.useRef)(),[p,g]=(0,r.useState)(0),b=p+e,{children:E,formPrefix:f,embeddedForms:h,backButton:w,nextButton:C}={backButton:{},nextButton:{},...t[b]},S=b===t.length-1,v=0===b,k=()=>{u.current.handleEmbeddedFormValues(),g((t=>n(t+e,t+e+1)-e))};return(0,r.createElement)(i.default,o()({},m,{ref:u,additionalButtons:[v&&c&&(0,r.createElement)(l.Button,o()({key:"cancel",children:(0,r.createElement)(d,{content:"cancel"})},c)),!v&&w&&(0,r.createElement)(l.Button,o()({key:"back",arrow:"backward",onClick:()=>{u.current.handleEmbeddedFormValues(),g((t=>n(t+e,t+e-1)-e))},children:(0,r.createElement)(d,{content:"back"})},w)),!S&&C&&(0,r.createElement)(l.Button,o()({key:"next",intent:"primary",onClick:k,arrow:"forward",children:(0,r.createElement)(d,{content:"nextWithoutArrow"})},C)),S&&s&&(0,r.createElement)(l.Button,o()({key:"submit",intent:"primary",arrow:"forward",onClick:()=>u.current.submit(),children:(0,r.createElement)(d,{content:"ok"})},s))],onSubmit:S?a:k,onError:a=>{const o=t.findIndex((({formPrefix:e})=>""===e)),l=Object.keys(a).map((e=>{const n=t.findIndex((({formPrefix:t,embeddedForms:n=[]})=>t===e||n.any((({name:t})=>t===e))));return n>=0?n:o}));g(n(b,l.length>0?Math.min(...l):e)-e)},applyButton:!1,submitButton:!1,cancelButton:!1,formPrefix:f,embeddedForms:h}),E)};u.propTypes={step:m().number,steps:m().arrayOf(m().shape({formPrefix:m().string,embeddedForms:m().array,children:m().node,nextButton:m().bool,backButton:m().bool})),onStepChange:m().func,onSubmit:m().func,submitButton:m().object,cancelButton:m().object},u.defaultProps={step:0,steps:[],onStepChange:(e,t)=>t,onSubmit:void 0,submitButton:{},cancelButton:{}},t.default=u},769:(e,t,n)=>{"use strict";n.r(t);var a=n(154),o=n(155),l=n(144),r=n(261),i=n.n(r);const s=l.Locale.getTranslate("admin.components.forms.admin-panel.form.login-info"),c=({prefix:e})=>(0,a.createElement)(a.Fragment,null,(0,a.createElement)(o.FormFieldText,{name:"".concat(e,"[userName]"),label:(0,a.createElement)(s,{content:"userName"}),required:!0,autoComplete:"off"}),(0,a.createElement)(o.FormFieldPassword,{name:"".concat(e,"[password]"),label:(0,a.createElement)(s,{content:"password"}),required:!0,autoComplete:"off"}),(0,a.createElement)(o.FormFieldCheckbox,{name:"".concat(e,"[isActivationRequired]"),label:(0,a.createElement)(s,{content:"emailActivation"}),description:(0,a.createElement)(s,{content:"emailActivationHint"}),checkedValue:"1",uncheckedValue:"0"}));c.propTypes={prefix:i().string.isRequired},t.default=c},766:(e,t,n)=>{"use strict";n.r(t),n.d(t,{TYPE_TECH:()=>m,TYPE_CUSTOM:()=>d});var a=n(153),o=n.n(a),l=n(155),r=n(154),i=n(261),s=n.n(i),c=n(144);const m="tech",d="custom",u=c.Locale.getTranslate("components.forms.domain.tech-domain-name"),p=({isEnabled:e,isDefault:t,url:n,vendor:a,typeName:o,name:i,ipAddress:s,onDomainNameChange:c,onTypeChange:p})=>{const[E,f]=(0,r.useState)(e&&t?m:d);if(!e)return(0,r.createElement)(g,{name:i,isEnabled:!1,onDomainNameChange:c});const h=[{key:d,icon:(0,r.createElement)(l.Icon,{name:"ribbon",intent:"success"})},{key:m,icon:(0,r.createElement)(l.Icon,{name:"rocket",intent:"info"})}];return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(l.Section,{title:(0,r.createElement)(u,{content:"title"}),vertical:!0},(0,r.createElement)(l.FormField,{name:o,onChange:e=>(e=>{f(e),p(e),c("")})(e)},(({getId:e,getName:t,getValue:n,setValue:a,isDisabled:o})=>(0,r.createElement)(r.Fragment,null,(0,r.createElement)(l.ItemList,{stretchable:!0,selectable:!0,minColumnWidth:270,gap:"sm",value:n(),onSelect:e=>a(e)},h.map((({key:e,icon:t})=>(0,r.createElement)(l.Item,{icon:t,key:e,value:e,"data-action":`use-${e}-domain`,title:(0,r.createElement)(l.Heading,{level:"4"},(0,r.createElement)(l.Paragraph,null,(0,r.createElement)(u,{content:`${e}DomainTitle`}))),disabled:o()},(0,r.createElement)(l.Text,{fontSize:"md"},(0,r.createElement)(u,{content:`${e}DomainText`})))))),(0,r.createElement)("input",{hidden:!0,id:e(),name:t(),value:n(),readOnly:!0}))))),E===m?(0,r.createElement)(b,{name:i,ipAddress:s,url:n,vendor:a,onDomainNameChange:c}):(0,r.createElement)(g,{name:i,isEnabled:!0,onDomainNameChange:c}))},g=({name:e,isEnabled:t,onDomainNameChange:n})=>(0,r.createElement)(l.Section,{vertical:!0},(0,r.createElement)(l.FormField,{name:e,label:t?(0,r.createElement)(u,{content:"customDomain"}):(0,r.createElement)(u,{content:"domainName"}),onChange:e=>n(e),required:!0},(({getId:e,getName:t,getValue:n,setValue:a,isDisabled:o})=>(0,r.createElement)(r.Fragment,null,(0,r.createElement)("span",{dir:"ltr"},"www. ",(0,r.createElement)(l.Input,{id:e(),name:t(),value:n(),placeholder:"domain.name",size:"lg",onChange:e=>a(e.target.value),disabled:o()}))))));g.propTypes={name:s().string.isRequired,isEnabled:s().bool.isRequired,onDomainNameChange:s().func.isRequired};const b=({name:e,onDomainNameChange:t,...n})=>(0,r.createElement)(l.Section,{vertical:!0},(0,r.createElement)(r.Fragment,null,(0,r.createElement)(l.FormField,{label:(0,r.createElement)(u,{content:"techDomain"}),name:e,onChange:e=>t(e)},(({getId:e,getName:t,...a})=>(0,r.createElement)(E,o()({id:e(),name:t()},a,n)))),(0,r.createElement)(l.Cuttable,{maxHeight:24},(0,r.createElement)(l.Paragraph,null,(0,r.createElement)(u,{content:"techDomainDesc"})),(0,r.createElement)("ul",null,(0,r.createElement)("li",null,(0,r.createElement)(u,{content:"techDomainRandom"})),(0,r.createElement)("li",null,(0,r.createElement)(u,{content:"techDomainDns"})),(0,r.createElement)("li",null,(0,r.createElement)(u,{content:"techDomainMail"}))),(0,r.createElement)(l.Paragraph,null,(0,r.createElement)(u,{content:"techDomainSwitch"})))));b.propTypes={name:s().string.isRequired,onDomainNameChange:s().func.isRequired};const E=({id:e,name:t,ipAddress:n,url:a,vendor:o,getValue:i,setValue:s})=>{const[c,m]=(0,r.useState)(!1),[d,p]=(0,r.useState)(n),[g,b]=(0,r.useState)({}),E=(0,r.useCallback)((async()=>{if(b({}),!i()||n!==d)if(n){m(!0);try{const e=await fetch(a,{method:"POST",body:JSON.stringify({ip_address:n,vendor:o})}),{subdomain:t}=await e.json();if(!t)return void b({error:(0,r.createElement)(u,{content:"error"})});s(t),p(n)}catch{b({error:(0,r.createElement)(u,{content:"error"})})}finally{m(!1)}}else b({noIpAddress:(0,r.createElement)(u,{content:"errorNoIpAddress"})})}),[i,s,n,d,a,o]);return(0,r.useEffect)((()=>{E()}),[n]),(0,r.createElement)(r.Fragment,null,c?(0,r.createElement)(l.Status,{progress:!0},(0,r.createElement)(u,{content:"generating"})):(0,r.createElement)(l.Text,{bold:!0},i()),(0,r.createElement)("input",{hidden:!0,id:e,name:t,value:i(),readOnly:!0}),Object.keys(g).map((e=>(0,r.createElement)(l.Alert,{key:e,intent:"danger"},(0,r.createElement)(l.Icon,{name:"exclamation-mark-circle-filled",intent:"danger"})," ",g[e]))))};E.propTypes={id:s().string.isRequired,name:s().string.isRequired,ipAddress:s().string,url:s().string.isRequired,vendor:s().string.isRequired,getValue:s().func.isRequired,setValue:s().func.isRequired},E.defaultProps={ipAddress:null},p.propTypes={isEnabled:s().bool.isRequired,isDefault:s().bool.isRequired,url:s().string.isRequired,vendor:s().string.isRequired,typeName:s().string.isRequired,name:s().string.isRequired,ipAddress:s().string,onDomainNameChange:s().func.isRequired,onTypeChange:s().func.isRequired},p.defaultProps={ipAddress:null},t.default=p},770:(e,t,n)=>{"use strict";n.r(t);var a=n(153),o=n.n(a),l=n(154),r=n(302),i=n(405),s=n(556),c=n(155),m=n(144),d=n(771);const u=r.gql`
    query GetAddDomainData {
        config {
            domainManagement {
                settings {
                    enabled
                    collapsed
                }
                applicationWizard {
                    enabled
                    blankSite
                    uploadFiles
                }
            }
            techDomain {
                url
                vendor
            }
        }
    }
`;t.default=(e,t,n,a)=>{const r=(0,i.useApolloClient)(),p=!!(0,s.useRouteMatch)(a),g=(0,s.useHistory)(),[b,E]=(0,l.useState)(null),[f,h]=(0,l.useState)(null),[w,C]=(0,l.useState)(null);(0,l.useEffect)((()=>{p&&(E(null),h(null),Promise.all([m.api.get(a),r.query({query:u})]).then((([e,{data:{config:t}}])=>{e.redirect?(0,m.redirect)(e.redirect):E({...e,techDomain:{url:`${t.techDomain.url}/api/subdomain`,vendor:t.techDomain.vendor},settingsEnabled:t.domainManagement.settings.enabled,settingsCollapsed:t.domainManagement.settings.collapsed,applicationWizardConfig:t.domainManagement.applicationWizard})})))}),[p,a,r]);const S=()=>{g.push(n)};return[(0,l.createElement)(d.default,o()({dataType:t,title:b?b.pageTitle:"",size:"sm",isOpen:p,onClose:S,form:b?(0,l.createElement)(e,o()({onCancel:S,onProcess:h,onStepPropsChange:C},b)):null,task:f,history:g,pageUrl:n},w),b?null:(0,l.createElement)(c.ContentLoader,null))]}},902:(e,t,n)=>{"use strict";n.r(t);var a=n(155),o=n(154),l=n(261),r=n.n(l),i=n(144),s=n(582),c=n(602),m=n(648),d=n(765);const u=i.Locale.getTranslate("smb.controllers.web.setup"),p=({addDomainUrl:e,openTutorialUrl:t,baseClassName:l})=>{const[r]=(0,d.useAddDomainFormInDrawer)("/smb/web/setup","/smb/web/add-domain/create-webspace/true");return(0,o.createElement)(o.Fragment,null,r,(0,o.createElement)(a.ListEmptyView,{className:l,title:(0,o.createElement)(u,{content:"noDomainTitle"}),description:(0,o.createElement)(o.Fragment,null,(0,o.createElement)(u,{content:"description"}),(0,o.createElement)("br",null),(0,o.createElement)(u,{content:"openTutorial",params:{link:(0,o.createElement)(s.default,{to:t,target:"_blank",id:"linkOpenTutorial"},(0,o.createElement)(u,{content:"openTutorialLink"}))}})),image:n(903),actions:(0,o.createElement)(a.Button,{component:s.default,to:e,size:"lg",icon:"plus",intent:"primary",id:"buttonAddDomain"},(0,o.createElement)(u,{content:"addDomain"}))}))};p.propTypes={addDomainUrl:r().string.isRequired,openTutorialUrl:r().string.isRequired,baseClassName:r().string},p.defaultProps={baseClassName:"web-setup-panel"},t.default=(0,c.withPageLayout)((0,m.withPageContent)(p))},901:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>a.default});var a=n(902)},903:e=>{e.exports=Jsw.skinUrl+"/images/add-domain.svg?8718d077e71615582cb1f89dad81e476"},779:e=>{e.exports=Jsw.skinUrl+"/images/add-domain/process.svg?2cd8b0c86019c2d951acd8c173a6974f"},778:e=>{e.exports=Jsw.skinUrl+"/images/add-domain/step1.svg?cdb98922dc6afaf36776f30b81762d6d"},777:e=>{e.exports=Jsw.skinUrl+"/images/add-domain/step2.svg?5c9d5f36abe3d2707367cb8a7f9e432a"},775:e=>{e.exports=Jsw.skinUrl+"/images/code.svg?e9fb9feb605b8cf334414f688a603918"},776:e=>{e.exports=Jsw.skinUrl+"/images/upload-files.svg?e6091d3474a27a3eafe63b2d09b1b943"}}]);
//# sourceMappingURL=setup.js.map?f492ddef76ad6be744d4