import{l as O,c as p,R as b,r as j,n as o,q as x,L as S}from"./vendor-react-DfNOgXDS.js";import{u as g}from"./vendor-i18n-BWzZRYJm.js";var N={exports:{}},T="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",E=T,R=E;function _(){}function k(){}k.resetWarningCache=_;var M=function(){function t(n,a,s,c,v,i){if(i!==R){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}t.isRequired=t;function e(){return t}var r={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:k,resetWarningCache:_};return r.PropTypes=r,r};N.exports=M();var C=N.exports;const m=O(C);var F=!!(typeof window<"u"&&window.document&&window.document.createElement),D=function(){function t(e,r){for(var n=0;n<r.length;n++){var a=r[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();function q(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function U(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:t}function W(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var w=function(t){W(e,t);function e(){return q(this,e),U(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return D(e,[{key:"componentWillUnmount",value:function(){this.defaultNode&&document.body.removeChild(this.defaultNode),this.defaultNode=null}},{key:"render",value:function(){return F?(!this.props.node&&!this.defaultNode&&(this.defaultNode=document.createElement("div"),document.body.appendChild(this.defaultNode)),p.createPortal(this.props.children,this.props.node||this.defaultNode)):null}}]),e}(b.Component);w.propTypes={children:m.node.isRequired,node:m.any};var I=function(){function t(e,r){for(var n=0;n<r.length;n++){var a=r[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();function $(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function L(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:t}function A(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var P=function(t){A(e,t);function e(){return $(this,e),L(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return I(e,[{key:"componentDidMount",value:function(){this.renderPortal()}},{key:"componentDidUpdate",value:function(n){this.renderPortal()}},{key:"componentWillUnmount",value:function(){p.unmountComponentAtNode(this.defaultNode||this.props.node),this.defaultNode&&document.body.removeChild(this.defaultNode),this.defaultNode=null,this.portal=null}},{key:"renderPortal",value:function(n){!this.props.node&&!this.defaultNode&&(this.defaultNode=document.createElement("div"),document.body.appendChild(this.defaultNode));var a=this.props.children;typeof this.props.children.type=="function"&&(a=b.cloneElement(this.props.children)),this.portal=p.unstable_renderSubtreeIntoContainer(this,a,this.props.node||this.defaultNode)}},{key:"render",value:function(){return null}}]),e}(b.Component);P.propTypes={children:m.node.isRequired,node:m.any};var h=void 0;p.createPortal?h=w:h=P;const H="_modal_3wplf_1",V="_close_3wplf_20",Y="_backdrop_3wplf_48",y={modal:H,close:V,backdrop:Y},z=({onClose:t})=>{const e=document.getElementById("modal-root");if(!e)return null;const r=n=>{t(n)};return j.createPortal(o.jsx("div",{className:y.backdrop,children:o.jsxs("div",{className:y.modal,children:[o.jsx("button",{type:"button",className:y.close,onClick:r,"aria-label":"Закрыть"}),o.jsx("p",{children:"Спасибо, что выбрали нас! Скоро наш менеджер свяжется с Вами"})]})}),e)},G=({onClose:t,onSuccessModalOpen:e})=>{const r=document.getElementById("modal-root"),{t:n}=g(),[a,s]=x.useState({name:"",phone:"",email:"",point:"",destination:"",question:""}),c=l=>{const{name:f,value:B}=l.target;s({...a,[f]:B})},v=l=>{l.preventDefault()},i=l=>{l.target.placeholder=""},u=l=>{const f=document.getElementById("checkbox");a.name&&a.phone&&a.email&&a.question&&a.point&&a.destination&&f.checked?(e(),t(l)):alert(n("costBtn.modal.alert"))},d=l=>{l.target.name==="name"&&(l.target.placeholder=n("costBtn.modal.placeholder.name")),l.target.name==="phone"&&(l.target.placeholder=n("costBtn.modal.placeholder.phone")),l.target.name==="email"&&(l.target.placeholder=n("costBtn.modal.placeholder.email")),l.target.name==="question"&&(l.target.placeholder=n("costBtn.modal.placeholder.question")),l.target.name==="point"&&(l.target.placeholder=n("costBtn.modal.placeholder.point")),l.target.name==="destination"&&(l.target.placeholder=n("costBtn.modal.placeholder.destination"))};return r?j.createPortal(o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"backdrop"}),o.jsx("div",{className:"modal",children:o.jsxs("div",{className:"modal-content",children:[o.jsx("div",{className:"logo_form"}),o.jsx("button",{type:"button",className:"close",onClick:t,"aria-label":"Закрыть"}),o.jsx("form",{onSubmit:v,className:"form",children:o.jsxs("div",{className:"right-content",children:[o.jsx("div",{className:"form-group",children:o.jsx("input",{type:"text",name:"name",value:a.name,onChange:c,onFocus:i,onBlur:d,className:"form-input",placeholder:n("costBtn.modal.placeholder.name")})}),o.jsx("div",{className:"form-group",children:o.jsx("input",{type:"tel",name:"phone",title:n("costBtn.modal.placeholder.titlePhone"),required:!0,value:a.phone,onChange:c,onFocus:i,onBlur:d,className:"form-input",placeholder:n("costBtn.modal.placeholder.phone")})}),o.jsx("div",{className:"form-group",children:o.jsx("input",{type:"email",name:"email",value:a.email,onChange:c,onFocus:i,onBlur:d,className:"form-input",placeholder:n("costBtn.modal.placeholder.email")})}),o.jsx("div",{className:"form-group",children:o.jsx("input",{type:"text",name:"point",value:a.point,onChange:c,onFocus:i,onBlur:d,className:"form-input",placeholder:n("costBtn.modal.placeholder.point")})}),o.jsx("div",{className:"form-group",children:o.jsx("input",{type:"text",name:"destination",value:a.destination,onChange:c,onFocus:i,onBlur:d,className:"form-input",placeholder:n("costBtn.modal.placeholder.destination")})}),o.jsxs("div",{className:" textarea-container-cost",children:[o.jsxs("div",{className:"textarea_container",children:[o.jsx("div",{className:"form-text",children:n("costBtn.modal.question")}),o.jsx("textarea",{name:"question",value:a.question,onChange:c,className:"form-textarea-cost"}),o.jsxs("div",{className:"form-check",children:[o.jsx("input",{type:"checkbox",name:"checkbox",id:"checkbox",className:"checkbox"}),o.jsxs("label",{className:"label",htmlFor:"checkbox",children:[n("costBtn.modal.text1"),o.jsx(S,{to:"/privacy-policy",className:"link",children:n("costBtn.modal.text2")})]})]})]}),o.jsx("button",{type:"submit",className:"form-button",onClick:u,children:n("costBtn.modal.btn")})]})]})})]})})]}),r):null},Q=()=>{const{t}=g(),[e,r]=x.useState(!1),[n,a]=x.useState(!1),s=()=>{r(!e)},c=()=>{a(!0)};return o.jsxs("div",{children:[o.jsx("button",{className:"modal-button-cost",onClick:s,children:o.jsx("span",{className:"modal-button-text",children:t("costBtn.btn")})}),e&&o.jsx(h,{children:o.jsx(G,{onClose:s,onSuccessModalOpen:c})}),n&&o.jsx(h,{children:o.jsx(z,{onClose:()=>a(!1)})})]})};export{Q as M,h as P,z as S};