"use strict";(globalThis.webpackChunknewfold_Onboarding=globalThis.webpackChunknewfold_Onboarding||[]).push([[390],{6999:(e,t,n)=>{n.d(t,{A:()=>m});var a=n(1609),s=n(6942),i=n.n(s),l=n(148),o=n(7143),r=n(6427),c=n(7677),d=n(6655),u=n(7675);const m=({text:e,className:t,callback:n=null,disabled:s=!1,showChevronRight:m=!0})=>{const g=(0,l.Zp)(),{nextStep:p}=(0,o.useSelect)((e=>({nextStep:e(u.M).getNextStep()})));return(0,a.createElement)(r.Button,{className:i()("nfd-onboarding-button--site-gen-next",{"nfd-onboarding-button--site-gen-next--disabled":s},t),onClick:()=>{s||(n&&"function"==typeof n&&n(),p&&g(p.path))}},(0,a.createElement)("p",{className:"nfd-onboarding-button--site-gen-next--text"},e),m&&(0,a.createElement)(c.A,{className:"nfd-onboarding-button--site-gen-next--icon",icon:d.A}))}},513:(e,t,n)=>{n.d(t,{A:()=>l});var a=n(1609),s=n(8468),i=n(7673);const l=(0,s.memo)((({title:e})=>(0,a.createElement)("div",{className:"ai-heading"},(0,a.createElement)(i.A,{height:"40px"}),(0,a.createElement)("div",{className:"ai-heading--title"},e))))},5390:(e,t,n)=>{n.r(t),n.d(t,{default:()=>E});var a=n(1609),s=n(9491),i=n(7143),l=n(8468),o=n(1056),r=n(7723);var c=n(431),d=n(513),u=n(3988),m=n(6942),g=n.n(m);const p=(0,l.memo)((({hint:e,height:t,children:n,placeholder:s,customerInput:i,setIsValidInput:o,setCustomerInput:c,setCustomerInputStrength:d,customChildren:u=!1})=>{const m=(0,l.useRef)(null),[p,h]=(0,l.useState)(0),[b,f]=(0,l.useState)("nfd-sg-input-box__field"),[_,x]=(0,l.useState)(0),v=(E=_,{characterCount:(0,r.sprintf)(/* translators: 1: characterCount */ /* translators: 1: characterCount */
(0,r.__)("%d Characters left","wp-module-onboarding"),E)});var E;(0,l.useEffect)((()=>{var e;m.current.style.height=t;const n=m.current.scrollHeight;m.current.style.height=n+"px";const a=w(i?.trim());h(a),d(a),o(a>=2),x(Math.max(200-(null!==(e=i?.length)&&void 0!==e?e:0),0))}),[i]);const w=e=>{const t=e?.length;let n=0;return t>200?n=3:t>150?n=2:t>100&&(n=1),n},N=e=>{if(e<=p)return"nfd-sg-input-box__info-icon--selected"};return(0,a.createElement)("div",{className:"nfd-sg-input"},(0,a.createElement)("label",{htmlFor:b},(0,a.createElement)("div",{className:"nfd-sg-input-box"},(0,a.createElement)("textarea",{"data-wnd-ai-logo":!0,type:"text",className:b,ref:m,style:{height:"47px"},placeholder:s,value:i,onChange:e=>(e=>{e.preventDefault(),c(e.target.value),f("nfd-sg-input-box__field")})(e)})),_>0&&(0,a.createElement)("p",{className:"nfd-sg-input-box__count"},v.characterCount),(0,a.createElement)("div",{className:"nfd-sg-input-box_bottom"},i?(0,a.createElement)("div",{className:"nfd-sg-input-box__info"},(0,a.createElement)("div",{className:"nfd-sg-input-box__info-text"},(0,r.__)("Detail","wp-module-onboarding")),(()=>{const e=[];for(let t=1;t<=3;t++)e.push((0,a.createElement)("div",{className:g()("nfd-sg-input-box__info-icon",N(t))}));return e})()):(0,a.createElement)("p",{className:"nfd-sg-input-box__hint"},e),u&&n)))}));var h=n(6999),b=n(1032),f=n(8969),_=n(7675),x=n(2202),v=n(8744);const E=()=>{const[e,t]=(0,l.useState)(),[n,m]=(0,l.useState)(0),[g,E]=(0,l.useState)(!1),{currentData:w}=(0,i.useSelect)((e=>({currentData:e(_.M).getCurrentOnboardingData()}))),{setIsFooterNavAllowed:N,setIsHeaderEnabled:C,setSidebarActiveView:I,setHeaderActiveView:k,setDrawerActiveView:D,setHideFooterNav:S,setCurrentOnboardingData:A,setIsHeaderNavigationEnabled:y}=(0,i.useDispatch)(_.M),H=(0,s.useViewportMatch)("small");(0,l.useEffect)((()=>{if(S(!1),C(!0),I(!1),k(f.Ix),y(!0),D(!1),""!==w.sitegen.siteDetails?.prompt)return E(!0),N(!0),t(w.sitegen.siteDetails.prompt);N(!1)}),[]),(0,l.useEffect)((()=>{void 0!==e&&""!==e&&e!==w.sitegen.siteDetails.prompt&&(w.sitegen.siteDetails.prompt=e?.trim(),w.sitegen.siteDetails.mode="simple",w.sitegen.skipCache=!0,w.sitegen.sitemapPagesGenerated=!1,w.sitegen.homepages.active={},w.sitegen.homepages.data={},A(w)),N(g)}),[e]);const T={heading:(0,r.__)("Tell me some details about the site you want created?","wp-module-onboarding"),inputPlaceholder:(0,r.__)("I want a site for my company that sells…","wp-module-onboarding"),inputHint:(0,r.__)("The more detail the better","wp-module-onboarding"),buttonText:(0,r.__)("Next","wp-module-onboarding"),walkThroughText:(0,r.__)("Not sure what to say? We can walk you through it.","wp-module-onboarding"),walkThroughlink:(0,r.__)("click here","wp-module-onboarding")};return(0,a.createElement)(b.tR,null,(0,a.createElement)(u.A,{isCentered:!0},(0,a.createElement)(c.A,{type:"fade-in"},(0,a.createElement)("div",{className:"nfd-sg-site-details"},(0,a.createElement)(d.A,{title:T.heading}),(0,a.createElement)(p,{placeholder:T.inputPlaceholder,hint:T.inputHint,height:"40px",customerInput:e,setIsValidInput:E,setCustomerInput:t,setCustomerInputStrength:m,customChildren:!0},H&&(0,a.createElement)("div",{className:"nfd-sg-site-details-endrow"},(0,a.createElement)(h.A,{className:"nfd-sg-site-details--next-btn",callback:()=>{(()=>{let t=!1;switch(n){case 2:t="MEDIUM";break;case 3:t="HIGH"}t&&(0,o.v)(new o.iC(x.WN,e,{strength:t,source:v.d0}))})()},text:T.buttonText,disabled:!g})))))))}}}]);