"use strict";(globalThis.webpackChunkhelpgent=globalThis.webpackChunkhelpgent||[]).push([[862],{8863:(e,t,n)=>{n.d(t,{A:()=>l}),n(51609);const l="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNSIgaGVpZ2h0PSIxNC40MzMiIHZpZXdCb3g9IjAgMCAxNSAxNC40MzMiPgogIDxnIGlkPSJleWUtY3Jvc3NlZF8xXyIgZGF0YS1uYW1lPSJleWUtY3Jvc3NlZCAoMSkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgLTkuNjE5KSI+CiAgICA8cGF0aCBpZD0iUGF0aF8xNTI1IiBkYXRhLW5hbWU9IlBhdGggMTUyNSIgZD0iTTE0LjQsMTQuODc5aDBhOS42MTMsOS42MTMsMCwwLDAtMS43MjEtMS45bDEuNzctMS43NjlhLjk0Mi45NDIsMCwwLDAtMS4zMzMtMS4zMzFsLTIuMDM5LDIuMDRBNy44NzgsNy44NzgsMCwwLDAsNy41LDExLjA4Nyw4LjMxOSw4LjMxOSwwLDAsMCwuNiwxNC44NzlhMy40NjEsMy40NjEsMCwwLDAsMCwzLjg5Miw5LjYxMyw5LjYxMywwLDAsMCwxLjcyMSwxLjlMLjU1LDIyLjQ0M2EuOTQzLjk0MywwLDAsMCwxLjMzMywxLjMzM2wyLjAzOS0yLjA0YTcuODc4LDcuODc4LDAsMCwwLDMuNTc3LjgzMSw4LjMxOSw4LjMxOSwwLDAsMCw2LjktMy43OTJBMy40NjEsMy40NjEsMCwwLDAsMTQuNCwxNC44NzlaTTIuMTUzLDE3LjcwN2ExLjU2MSwxLjU2MSwwLDAsMSwwLTEuNzU5QTYuMzc1LDYuMzc1LDAsMCwxLDcuNSwxMi45NzJhNi4xMjksNi4xMjksMCwwLDEsMi4xNDYuMzc3TDguNDgxLDE0LjUxM2EyLjUxMywyLjUxMywwLDAsMC0zLjMsMy4zTDMuNjU0LDE5LjM0QTcuNTk0LDcuNTk0LDAsMCwxLDIuMTUzLDE3LjcwN1ptMTAuNjkyLDBBNi4zNzUsNi4zNzUsMCwwLDEsNy41LDIwLjY4MmE2LjEyOSw2LjEyOSwwLDAsMS0yLjE0Ni0uMzc3TDYuNTE4LDE5LjE0YTIuNTEzLDIuNTEzLDAsMCwwLDMuMy0zLjNsMS41MzEtMS41MzFhNy42LDcuNiwwLDAsMSwxLjUsMS42MzQsMS41NjEsMS41NjEsMCwwLDEsMCwxLjc1OVoiIGZpbGw9IiM2ZTZlNmUiLz4KICA8L2c+Cjwvc3ZnPgo="},10155:(e,t,n)=>{n.d(t,{BT:()=>o,jD:()=>a,oF:()=>i,yY:()=>r});var l=n(38267);const a=l.Ay.div`
    display: flex;
    justify-content: center;
    align-items: center;
    &.helpgent-permission-modal{
        width: auto;
        padding: 0;
    }
    .helpgent-media-preview{
        margin-left: 0;
        margin-right: 0;
        width: 100%;
        height: calc(100vh - 160px);
    }
`,i=l.Ay.div`
    position: relative;
    padding-top: 52.54%;
    width: 100%;

    .helpgent-video-recorder-wrap {
        position: absolute;
        top: 0;
        bottom: 0;
        right: 0;
        left: 0;
    }

    .helpgent-video-recorder-container {
        position: relative;
        height: 100%;
        text-align: center;
        display: flex;
        flex-direction: column;
        justify-content: center;
        overflow: hidden;
        background: var(--helpgent-color-dark);
        border-radius: 30px;
        &.helpgent-record-screen{
            .helpgent-sec{
                font-size: 50px;
                font-weight: 500;
                color: var(--helpgent-color-text);
            }
        }
        &.helpgent-record-audio--start{
            .helpgent-record-btn{
                position: relative;
                background-color: transparent;
                &:after{
                    position: absolute;
                    width: 30px;
                    height: 30px;
                    left: 50%;
                    top: 50%;
                    border-radius: 8px;
                    content: "";
                    background-color: rgb(252, 73, 93);
                    transform: translate(-50%, -50%);
                }
                svg{
                    display: none;
                }
            }
        }
        &.helpgent-video-recorder{
            position: relative;
            &:after,
            &:before{
                position: absolute;
                left: 0px;
                top: 0px;
                width: 100%;
                height: 20%;
                content: "";
                z-index: 1;
                opacity: 0.8;
                background-image: linear-gradient(to top, rgba(0, 0, 0, 0), rgb(0, 0, 0));
            }
            &:before{
                top: auto;
                bottom: 0px;
                border-radius: 0px 0px 23px 23px;
                opacity: 0.6;
                background-image: linear-gradient(rgba(0, 0, 0, 0), rgb(0, 0, 0));
            }
            video{
                position: absolute;
                width: 100%;
                height: 100%;
                border-radius: 25px;
                object-fit: cover;
                inset: 0px;
            }
            .helpgent-video-recorder-countdown-container {
                position: absolute;
                width: 100%;
                height: 100%;
                top: 0;
                bottom: 0;
                left: 0;
                right: 0;
                .helpgent-countdown-timer {
                    color: #ffffff;
                }
            }
            .helpgent-timer{
                position: absolute;
                display: block;
                top: 20px;
                left: 65px;
                z-index: 2;
                .helpgent-sec{
                    font-size: 20px;
                    color: var(--helpgent-color-white);
                    font-family: var(--font-family);
                }
            }
            .helpgent-record-action{
                position: relative;
                margin: auto 0 calc(var(--helpgent-bottom-extras-height) + 20px);
                padding: 0;
                z-index: 101;
                &.helpgent-record-start{
                    .helpgent-record-btn{
                        &::after{
                            width: 30px;
                            height: 30px;
                            border-radius: 6px;
                        }
                    }
                }
            }
            .helpgent-record-btn{
                position: relative;
                display: block;
                width: 70px;
                height: 70px;
                margin: 0px auto;
                border-radius: 50%;
                border: 5px solid var(--helpgent-color-white);
                background-color: var(--helpgent-color-white);
                &:after{
                    position: absolute;
                    left: 50%;
                    top: 50%;
                    transform: translate(-50%, -50%);
                    width: calc(100%);
                    height: calc(100%);
                    border-radius: 50%;
                    content: "";
                    z-index: 101;
                    transition-property: width, height, border-radius;
                    transition-duration: 0.2s;
                    transition-timing-function: ease-in;
                    background-color: rgb(252, 73, 93);
                }
            }
        }
        .helpgent-btn-back{
            position: absolute;
            left: 15px;
            top: 15px;
            z-index: 99;
        }
        .helpgent-timer{
            &.helpgent-timer-start{
                .helpgent-sec{
                    color: rgb(252, 73, 93);
                }
            }
            .helpgent-sec{
                font-size: 50px;
                font-weight: 500;
                color: var(--helpgent-color-text)
            }
        }

        .helpgent-record-action{
            padding-top: 200px;
        }
        .helpgent-record-action-inner{
            position: relative;
        }
        .helpgent-record-btn{
            display: flex;
            align-items: center;
            justify-content: center;
            width: 110px;
            height: 110px;
            margin: 0px auto;
            border-radius: 50%;
            transition: background-color 0.3s ease-in-out 0s;
            background-color: rgb(252, 73, 93);
            border: 2px solid rgb(252, 73, 93);
            &:hover{
                color: rgb(252, 73, 93);
                background-color: rgb(255, 255, 255);
                svg{
                    path{
                        fill: rgb(252, 73, 93);
                    }
                }
            }
            svg{
                width: 36px;
                height: 36px;
                path{
                    fill: var(--helpgent-color-white);
                }
            }
        }
        .helpgent-btn-record-right{
            display: flex;
            justify-content: center;
            align-items: center;
            width: 55px;
            height: 55px;
            position: absolute;
            right: 30px;
            top: 50%;
            transform: translateY(-50%);
            border-radius: 50%;
            background-color: rgb(180, 180, 180);
            border: 2px solid transparent;
            text-decoration: none;
            transition: background-color 0.3s ease-in-out 0s;
            color: var(--helpgent-color-white);
            svg{
                width: 20px;
                height: 20px;
                path{
                    fill: var(--helpgent-color-white);
                }
            }
            &:hover{
                background-color: transparent;
                border-color: rgb(180, 180, 180);
                svg{
                    path{
                        fill: rgb(180, 180, 180);
                    }
                }
            }
        }
    }
`,o=l.Ay.div`
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 25px 25px;
    height: 100%;
    max-width: 300px;
    background-color: #fff;
    border-radius: 20px;
    .helpgent-permission-title {
        font-size: 18px;
        font-weight: 500;
        margin: 0px 0px 30px;
        font-family: var(--font-family);
    }

    img {
        width: 100%;
        max-width: 370px;
        margin-bottom: 26px;
    }

    .helpgent-text-right {
        text-align: right;
    }

    .helpgent-header-action {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        margin-bottom: 15px;
    }

    .helpgent-header-action-item {
        flex-grow: 1;
    }

    .helpgent-action-icon {
        padding: 5px;
        outline: none;
        box-shadow: none;
        &:active, &:focus {
            outline: none;
            box-shadow: none;
        }
        svg {
            width: 15px;
            height: 15px;

            path {
                fill: #2188ff;
            }
        }
    }

    .helpgent-btn {
        justify-content: center;
    }
`,r=l.Ay.div`
    display: block;
    .helpgent-video-recorder-container-area {
        width: calc( 80vw - 40px );

        @media only screen and (max-width: 1400px) {
            width: calc( 80vw - 20px );
        }

        @media only screen and (max-width: 1200px) {
            width: calc( 90vw - 20px );
        }

        @media only screen and (max-width: 992px) {
            width: calc( 100vw - 20px );
        }

        @media only screen and (max-width: 768px) {
            width: calc( 100vw - 40px );
        }

        @media only screen and (max-width: 576px) {
            width: calc( 100vw - 20px );
        }
    }

    .helpgent-media-preview-container {
        width: calc( 70vw - 40px );

        @media only screen and (max-width: 1400px) {
            width: calc( 80vw - 20px );
        }

        @media only screen and (max-width: 1200px) {
            width: calc( 90vw - 20px );
        }

        @media only screen and (max-width: 992px) {
            width: calc( 100vw - 20px );
        }

        @media only screen and (max-width: 768px) {
            width: calc( 100vw - 40px );
        }

        @media only screen and (max-width: 576px) {
            width: calc( 100vw - 20px );
        }
    }
`},17331:(e,t,n)=>{n.d(t,{A:()=>l}),n(51609);const l="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTYiIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDUxMiA1MTIiPjwhLS0hRm9udCBBd2Vzb21lIEZyZWUgNi41LjEgYnkgQGZvbnRhd2Vzb21lIC0gaHR0cHM6Ly9mb250YXdlc29tZS5jb20gTGljZW5zZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tL2xpY2Vuc2UvZnJlZSBDb3B5cmlnaHQgMjAyMyBGb250aWNvbnMsIEluYy4tLT48cGF0aCBvcGFjaXR5PSIxIiBmaWxsPSIjMUUzMDUwIiBkPSJNNDk1LjkgMTY2LjZjMy4yIDguNyAuNSAxOC40LTYuNCAyNC42bC00My4zIDM5LjRjMS4xIDguMyAxLjcgMTYuOCAxLjcgMjUuNHMtLjYgMTcuMS0xLjcgMjUuNG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TguNi0uMyAyNC41IDYuOGM4LjEgOS44IDE1LjUgMjAuMiAyMi4xIDMxLjJsNC43IDguMWM2LjEgMTEgMTEuNCAyMi40IDE1LjggMzQuM3pNMjU2IDMzNmE4MCA4MCAwIDEgMCAwLTE2MCA4MCA4MCAwIDEgMCAwIDE2MHoiLz48L3N2Zz4="},17676:(e,t,n)=>{n.d(t,{A:()=>a});var l=n(52619);async function a(e,t,n,a,i,o){if(t)return;const r={...a};r.status=n,r.email_template_settings=i,r.content=JSON.stringify(r.content);try{const t=await e((0,l.applyFilters)("helpgent_form_update_data",r));(0,l.doAction)("helpgent-toast",{message:t.message,position:"bottom-right"}),a.status="publish",o(e=>({...e,draftContent:null,isBuilderClosePanelOpen:!0}))}catch(e){console.log(e)}}},19348:(e,t,n)=>{n.d(t,{A:()=>l}),n(51609);const l="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0LjU1MiIgaGVpZ2h0PSI4IiB2aWV3Qm94PSIwIDAgNC41NTIgOCI+CiAgPHBhdGggaWQ9ImFycm93IiBkPSJNNCw5Ny4xNDFhLjU1OS41NTksMCwwLDAtLjQuMTY0bC0zLjQ0LDMuNDM0YS41Ni41NiwwLDAsMCwuNzkyLjc5MUw0LDk4LjQ5bDMuMDQ0LDMuMDM4YS41Ni41NiwwLDAsMCwuNzkyLS43OTFMNC40LDk3LjNBLjU1OS41NTksMCwwLDAsNCw5Ny4xNDFaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMDEuNjkyIC0wLjAwMSkgcm90YXRlKDkwKSIgZmlsbD0iIzZlNmU2ZSIvPgo8L3N2Zz4K"},19862:(e,t,n)=>{n.r(t),n.d(t,{default:()=>W});var l=n(51609),a=n(86087),i=n(48036),o=n(88869),r=n(37734),s=n(40493),c=n(52619),g=n(27723);function p(){const{singleFormState:e,setSingleFormState:t}=(0,i.$)(),{singleForm:n,emailTemplateType:a,emailTemplateTab:p}=e,m=n.content,{email_notification:d}=m.global,{admin_notification:u,user_notification:h}=d,{notify_on_new_response:b,notify_on_user_message:M}=u,{notify_on_new_response:w,notify_on_admin_message:N}=h,x=(n,l)=>{(0,r.A)(n,l,null,d,e,t)},L=n=>{t({...e,emailTemplateType:n.target.dataset.template,emailTemplateTab:"content"})},v=(e,t,n,a)=>(0,l.createElement)("div",{className:"helpgent-field-element"},(0,l.createElement)("div",{className:"helpgent-field-element__top"},(0,l.createElement)(o.Switch,{handleToggle:n,label:e,isActive:t,className:"1"===t?"helpgent-mb-20":"0"===t&&null===a?"helpgent-mb-30":"helpgent-mb-5"})));return(0,l.createElement)(s.z,{className:"helpgent-screen-setting-wrap"},(0,l.createElement)("div",{className:"helpgent-screen-setting-block"},(0,l.createElement)("h5",{className:"helpgent-screen-setting-block__label"},(0,c.applyFilters)("helpgent_email_notification_settings_author_title","Notify Admin On")),v((0,g.__)("Form submission","helpgent"),u.notify_on_new_response.isActive,()=>{x("admin_notification","notify_on_new_response")},null),"1"===b.isActive&&(0,l.createElement)("div",{className:"helpgent-field-element helpgent-field-element--inline helpgent-mt-20 helpgent-mb-30"},(0,l.createElement)("div",{className:"helpgent-field-element__left"},(0,l.createElement)("label",{className:"helpgent-field-element__label"},(0,g.__)("Email template","helpgent"))),(0,l.createElement)("div",{className:"helpgent-field-element__right"},(0,l.createElement)("button",{className:`helpgent-btn helpgent-btn-email-template helpgent-btn-${"admin-notify-new-response"===a?"primary":"light"} helpgent-btn-sm`,"data-template":"admin-notify-new-response",onClick:e=>L(e)},(0,g.__)("Edit","helpgent")))),v("New user message",u.notify_on_user_message.isActive,()=>{x("admin_notification","notify_on_user_message")}),"1"===M.isActive&&(0,l.createElement)("div",{className:"helpgent-field-element helpgent-field-element--inline helpgent-mt-20 helpgent-mb-5"},(0,l.createElement)("div",{className:"helpgent-field-element__left"},(0,l.createElement)("label",{className:"helpgent-field-element__label"},(0,g.__)("Email template","helpgent"))),(0,l.createElement)("div",{className:"helpgent-field-element__right"},(0,l.createElement)("button",{className:`helpgent-btn helpgent-btn-email-template helpgent-btn-${"admin-notify-user-message"===a?"primary":"light"} helpgent-btn-sm`,"data-template":"admin-notify-user-message",onClick:e=>L(e)},(0,g.__)("Edit","helpgent"))))),(0,l.createElement)("div",{className:"helpgent-screen-setting-block"},(0,l.createElement)("h5",{className:"helpgent-screen-setting-block__label"},(0,g.__)("Notify User On","helpgent")),v("Form submission (Welcome Message)",h.notify_on_new_response.isActive,()=>{x("user_notification","notify_on_new_response")},null),"1"===w.isActive&&(0,l.createElement)("div",{className:"helpgent-field-element helpgent-field-element--inline helpgent-mt-20 helpgent-mb-30"},(0,l.createElement)("div",{className:"helpgent-field-element__left"},(0,l.createElement)("label",{className:"helpgent-field-element__label"},(0,g.__)("Email template","helpgent"))),(0,l.createElement)("div",{className:"helpgent-field-element__right"},(0,l.createElement)("button",{className:`helpgent-btn helpgent-btn-email-template helpgent-btn-${"user-notify-new-response"===a?"primary":"light"} helpgent-btn-sm`,"data-template":"user-notify-new-response",onClick:e=>L(e)},(0,g.__)("Edit","helpgent")))),v((0,c.applyFilters)("helpgent_email_notification_admin_new_reply_label","Admin new reply"),h.notify_on_admin_message.isActive,()=>{x("user_notification","notify_on_admin_message")},null),"1"===N.isActive&&(0,l.createElement)("div",{className:"helpgent-field-element helpgent-field-element--inline helpgent-mt-20"},(0,l.createElement)("div",{className:"helpgent-field-element__left"},(0,l.createElement)("label",{className:"helpgent-field-element__label"},(0,g.__)("Email template","helpgent"))),(0,l.createElement)("div",{className:"helpgent-field-element__right"},(0,l.createElement)("button",{className:`helpgent-btn helpgent-btn-email-template helpgent-btn-${"user-notify-admin-message"===a?"primary":"light"} helpgent-btn-sm`,"data-template":"user-notify-admin-message",onClick:e=>{L(e)}},(0,g.__)("Edit","helpgent"))))))}var m=n(38745),d=n(65604);function u(e){const{isSubmissionActive:t}=e,{singleFormState:n,setSingleFormState:a}=(0,i.$)(),{singleForm:o}=n,{global:s}=o.content;return(0,l.createElement)("div",{className:"helpgent-field-element"},(0,l.createElement)("div",{className:"helpgent-field-element__top"},(0,l.createElement)("label",{className:"helpgent-field-element__label",htmlFor:"helpgent-btnText-"+(t?"submission":"next")},t?(0,g.__)("Button to submit form","helpgent"):(0,g.__)("Button to confirm answer","helpgent"))),(0,l.createElement)("div",{className:"helpgent-field-element__content"},(0,l.createElement)("div",{className:"helpgent-form-group"},(0,l.createElement)("input",{type:"value",className:"helpgent-form-group__element",id:"helpgent-btnText-"+(t?"submission":"next"),value:t?s?.submission_text?.value:s?.go_to_next_text?.value,onChange:e=>(0,r.A)(t?"submission_text":"go_to_next_text","value",e.target.value,t?s?.submission_text:s?.go_to_next_text,n,a)}))))}var h=n(19348),b=n(49876),M=n(56427),w=n(16622),N=n(9716);function x(){const{singleFormState:e,setSingleFormState:t}=(0,i.$)(),{singleForm:n}=e,{elements:a,global:o}=n.content,{bubble:s}=o,{background_type:c}=s,{id:g}=a,{filteredWelcomeElement:p,filteredEndElement:m,filteredOtherElement:u}=a.reduce((e,t)=>(t.id!==g&&("welcome"===t.element_type?e.filteredWelcomeElement.push(t):"end"===t.element_type?e.filteredEndElement.push(t):"user_validation"!==t.element_type&&e.filteredOtherElement.push(t)),e),{filteredWelcomeElement:[],filteredEndElement:[],filteredOtherElement:[]}),h=[...p,...u].map((e,t)=>(e.element_type,{label:e.title,value:e.id,icon:e.icon,type:e.element_type,media:e.media}));return(0,l.createElement)(l.Fragment,null,h.map((n,a)=>(0,l.createElement)("div",{key:a,className:"helpgent-element-single "+(n.value===c?.upload?.value?"helpgent-element-single--active":""),onClick:()=>{!function(n){var l;l=n,Object.keys(l.media).length,(0,r.A)("background_type","upload",l,s,e,t)}(n)}},(0,l.createElement)("span",{className:"helpgent-element-single__icon"},(0,l.createElement)(d.A,{src:w.UF[n.icon]})),(0,l.createElement)("span",{className:"helpgent-element-single__label",dangerouslySetInnerHTML:{__html:n.label}}),n.value===c?.upload?.value&&(0,l.createElement)("span",{className:"helpgent-element-single__selected"},(0,l.createElement)(d.A,{src:N.A})))))}var L=n(27308),v=n(6945);function f(){const{singleFormState:e,setSingleFormState:t}=(0,i.$)(),{singleForm:n}=e,{global:a}=n.content,{bubble:o,media:s}=a,{max_upload_size:c,video_resolution:p,max_video_duration:m}=s,d=p&&p.value?parseInt(p.value):720,u=m&&m.value?60*parseInt(m.value):120,h=(0,v.CR)("background_type.upload",o,{}),b="custom_bg"===h.type?h.media:{};return(0,l.createElement)(L.A,{value:b,videoResolution:d,maxVideoDuration:u,onChange:n=>{(null===n||function(e){t(e=>({...e,bubbleBgUploadError:null}));const n=c.unit?c.unit:"mb";let l="number"==typeof c.value?c.value:1;return l=c.value*("kb"===n?1024:1048576),!("number"==typeof e.filesizeInBytes&&e.filesizeInBytes>l&&(t(e=>({...e,bubbleBgUploadError:(0,g.sprintf)((0,g.__)("Max file size allowed: %s %s","helpgent"),c.value,n.toUpperCase())})),1))}(n))&&(0,r.A)("background_type","upload",n?{icon:"picture",label:n.filename?n.filename:"",media:{type:n.type,url:n.url},type:"custom_bg"}:{},o,e,t)}})}function y(){const{singleFormState:e,setSingleFormState:t}=(0,i.$)(),{singleForm:n}=e,a=n.content,{bubble:o}=a.global;return(0,l.createElement)("div",{className:"helpgent-bubble-color-picker"},(0,l.createElement)(M.ColorPicker,{enableAlpha:!0,onChange:n=>{(0,r.A)("background_type","color",n,o,e,t)}}))}var E=n(88589),_=n(76012),j=n(1294),A=n(62957),C=n(38930);function S(){const[e,t]=(0,a.useState)("screen"),[n,o]=(0,a.useState)(!1),{singleFormState:s,setSingleFormState:c}=(0,i.$)(),{singleForm:p,bubbleBgUploadError:m}=s,{elements:u,global:h}=p.content,{bubble:b}=h,{background_type:N}=b,L={},v=(0,a.useRef)(null),S=(0,a.useRef)(null);return(0,a.useEffect)(()=>{const e=e=>{const t=document.querySelector(".helpgent-modal-portal"),l=document.querySelector("body").contains(t);!n||v.current.contains(e.target)||S.current.contains(e.target)||l||o(!1)};return document.addEventListener("click",e),()=>{document.removeEventListener("click",e)}},[n]),(0,a.useEffect)(()=>{u.map((e,t)=>{e.id===N?.upload?.value&&(0,r.A)("background_type","upload",{icon:e.icon,label:e.title,media:e.media,type:e.element_type,value:e.id},b,s,c)})},[]),(0,l.createElement)("div",{className:"helpgent-field-element helpgent-field-element--inline helpgent-field-element--wrap"},(0,l.createElement)("div",{className:"helpgent-field-element__left helpgent-field-element__left--has-tooltip"},(0,l.createElement)("label",{className:"helpgent-field-element__label"},(0,g.__)("Background type","helpgent")),(0,l.createElement)(M.Tooltip,{text:(0,g.__)("Select a background for the Form Bubble to seamlessly integrate it with your website's design. Choose the background from the form screens or upload a new image.","helpgent"),delay:"0",placement:"bottom"},(0,l.createElement)("span",{className:"helpgent-tooltip-toggle"},(0,l.createElement)(d.A,{src:E.A})))),(0,l.createElement)("div",{className:"helpgent-field-element__right"},(0,l.createElement)("button",{className:"helpgent-btn helpgent-btn-light helpgent-btn-sm helpgent-bubble-bg-btn helpgent-btn-icon",onClick:e=>{o(!n)},ref:v},(0,l.createElement)(d.A,{src:_.A}),(0,g.__)("Add","helpgent")),n&&(0,l.createElement)("div",{className:"helpgent-bubble-bg-types",ref:S},(0,l.createElement)("div",{className:"helpgent-bubble-bg-types__list"},["screen","upload","color"].map((n,a)=>(0,l.createElement)("span",{key:a,onClick:()=>function(e){t(e)}(n),className:e===n?"helpgent-active":""},(0,l.createElement)(d.A,{src:"screen"===n?j.A:"upload"===n?A.A:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNCIgaGVpZ2h0PSIxMy45NzgiIHZpZXdCb3g9IjAgMCAxNCAxMy45NzgiPgogIDxwYXRoIGlkPSJwYWludC1idWNrZXQiIGQ9Ik0xMy4wMjQsMTAuNzYyYTQuMzM5LDQuMzM5LDAsMCwxLC45NzYsMS44LDEuNDU4LDEuNDU4LDAsMCwxLTIuOTE3LDAsNC43MzQsNC43MzQsMCwwLDEsLjk4Ny0xLjc5LjU4My41ODMsMCwwLDEsLjk1NC0uMDA1Wm0tLjUxLTIuMjQ4TDcuOTUyLDEzLjA3NmEzLjIxMywzLjIxMywwLDAsMS00LjUzNywwTC45NCwxMC42YTMuMjA4LDMuMjA4LDAsMCwxLDAtNC41MzdMMy4xNjcsMy44MzYsMS40MjMsMi4wOTNBLjg3NS44NzUsMCwxLDEsMi42NjEuODU1TDQuNCwyLjYsNS41LDEuNUEuODc1Ljg3NSwwLDAsMSw2Ljc0NC4yNzJsNyw3YS44NzUuODc1LDAsMCwxLTEuMjMsMS4yNDNaTTExLjI3NSw3LjI3OCw2LjczOCwyLjc0bC0xLjEsMS4xTDcuOTExLDYuMTA1QS44NzUuODc1LDAsMCwxLDYuNjczLDcuMzQzTDQuNCw1LjA3NCwyLjE3Nyw3LjNhMS40NTgsMS40NTgsMCwwLDAsMCwyLjA2M2wyLjQ3NSwyLjQ3NWExLjQ1OCwxLjQ1OCwwLDAsMCwyLjA2MywwWiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCAtMC4wMzcpIiBmaWxsPSIjNmU2ZTZlIi8+Cjwvc3ZnPgo="})," ",n.charAt(0).toUpperCase()+n.slice(1)))),(0,l.createElement)("div",{className:"helpgent-bubble-bg-types__content helpgent-scrollbar-style"},"screen"===e&&(0,l.createElement)(x,null),"upload"===e&&(0,l.createElement)(f,null),"color"===e&&(0,l.createElement)(y,null)))),""!==N.color||0!==Object.keys(N.upload).length?(0,l.createElement)("div",{className:"helpgent-selected-screen"},(0,l.createElement)("span",{className:"helpgent-element-single__icon",style:""!==N.color?{backgroundColor:N.color}:null},""===N.color&&("custom_bg"===N?.upload?.type?"video"===N?.upload?.media?.type?(0,l.createElement)("video",{src:N?.upload?.media?.url}):(0,l.createElement)("img",{src:N?.upload?.media?.url,alt:N.upload.label}):(0,l.createElement)(d.A,{src:w.UF[N.upload.icon]}))),(0,l.createElement)("span",{className:"helpgent-element-single__label",dangerouslySetInnerHTML:{__html:""===N.color?N.upload.label:N.color}}),(0,l.createElement)("span",{className:"helpgent-element-single__remove",onClick:e=>function(e){e.stopPropagation(),(0,r.A)("background_type","upload",L,b,s,c)}(e)},(0,l.createElement)(d.A,{src:C.A}))):null,null!==m&&(0,l.createElement)("div",{className:"helpgent-validate-danger-wrapper"},(0,l.createElement)("span",{className:"helpgent-validate-danger"},m)))}var D=n(49785);function I(e){const{singleFormState:t,setSingleFormState:n,baseApiRoute:i}=e,{singleForm:r}=t,{available_pages:s}=r,{control:p,setValue:m}=(0,D.mN)({mode:"all"}),u=(0,c.applyFilters)("helpgent_available_pages_api",i.availablePages,r);return(0,a.useEffect)(()=>{m("available_pages",s)},[]),(0,l.createElement)("div",{className:"helpgent-field-element"},(0,l.createElement)("div",{className:"helpgent-field-element__top"},(0,l.createElement)("label",{htmlFor:"helpgent-page-select",className:"helpgent-field-element__label"},u.text,(0,l.createElement)(M.Tooltip,{text:(0,g.__)("Control where your form bubble appears by specifying the pages it's displayed on.","helpgent"),delay:"0"},(0,l.createElement)("span",{className:"helpgent-tooltip-toggle"},(0,l.createElement)(d.A,{src:E.A}))))),(0,l.createElement)("div",{className:"helpgent-field-element__content"},(0,l.createElement)("div",{className:"helpgent-form-group"},(0,l.createElement)(o.SelectField,{name:"available_pages",control:p,isMulti:!0,optionsAPI:u.api,apiParams:{form_id:r.id},onChange:e=>{!function(e,l){const a={...t.singleForm,[e]:l};n({...t,singleForm:a})}("available_pages",e)},placeholder:(0,g.__)("Select...","helpgent")}))))}var z=n(27921),T=n(54899),k=n(8863);const Y=(0,c.applyFilters)("helpgent_form_settings_general",{formText:{component:function(e){const{singleFormState:t,handleActiveSettingsItem:n,showSettingsContent:i}=e,{activeSettingsTitle:o,activeSettingsGroup:r}=t;return(0,l.createElement)(a.Fragment,null,""===o&&(0,l.createElement)("div",{className:"helpgent-screen-setting-block helpgent-settings-item-wrap"},(0,l.createElement)("button",{className:"helpgent-settings-item","data-settings":"form-texts",onClick:e=>{n(e)}},(0,g.__)("Form texts","helpgent"),(0,l.createElement)(d.A,{src:h.A}))),"form-texts"===r&&""!==o&&(0,l.createElement)("div",{className:"helpgent-screen-setting-block helpgent-screen-setting-block--content "+(i?"helpgent-screen-setting-block--slide-in":"")},(0,l.createElement)("span",{className:"helpgent-screen-setting-block__label"},(0,g.__)("Button texts","helpgent")),(0,l.createElement)(u,null),(0,l.createElement)(u,{isSubmissionActive:!0})))}},helpgentBranding:{component:function(e){const{singleFormState:t,setSingleFormState:n}=e,{singleForm:a,activeSettingsTitle:i}=t,{global:s}=a.content,c=(0,m.L)();return""===i&&(0,l.createElement)("div",{className:"helpgent-screen-setting-block"},(0,l.createElement)("div",{className:"helpgent-inline-filed-block"},(0,l.createElement)(o.Switch,{handleToggle:()=>c?(0,r.A)("helpgent_branding","toggle",s?.helpgent_branding?.isActive,s?.helpgent_branding,t,n):n({...t,isProModalActive:!0}),badgeText:c?null:"PRO",label:(0,g.__)("Helpgent branding","helpgent"),isActive:s?.helpgent_branding?.isActive,className:"helpgent-mb-0"})))}},saveIncompleteData:{component:function(e){const{singleFormState:t,setSingleFormState:n}=e,{singleForm:a,activeSettingsTitle:i}=t,{global:s}=a.content,c=(0,m.L)();return""===i&&(0,l.createElement)("div",{className:"helpgent-screen-setting-block"},(0,l.createElement)("div",{className:"helpgent-inline-filed-block"},(0,l.createElement)(o.Switch,{handleToggle:()=>c?(0,r.A)("save_incomplete_data","toggle",s?.save_incomplete_data?.isActive,s?.save_incomplete_data,t,n):n({...t,isProModalActive:!0}),badgeText:c?null:"PRO",label:(0,g.__)("Save incomplete data","helpgent"),isActive:s?.save_incomplete_data?.isActive,className:"helpgent-mb-0"})))}},anonymousSubmission:{component:function(e){const{singleFormState:t,setSingleFormState:n}=e,{singleForm:a,activeSettingsTitle:i}=t,{global:s}=a.content;return""===i&&(0,l.createElement)("div",{className:"helpgent-screen-setting-block"},(0,l.createElement)("div",{className:"helpgent-inline-filed-block"},(0,l.createElement)(o.Switch,{handleToggle:()=>(0,r.A)("anonymous_submission","toggle",s?.anonymous_submission?.isActive,s?.anonymous_submission,t,n),label:(0,g.__)("Allow anonymous submission","helpgent"),isActive:s?.anonymous_submission?.isActive,className:"helpgent-mb-0",tooltip:!0,tooltipText:(0,g.__)("Users can submit forms without validation. It disables conversation features.","helpgent")})))}},disableProgressCount:{component:function(e){const{singleFormState:t,setSingleFormState:n}=e,{singleForm:a,activeSettingsTitle:i}=t,{global:s}=a.content;return""===i&&(0,l.createElement)("div",{className:"helpgent-screen-setting-block"},(0,l.createElement)("div",{className:"helpgent-inline-filed-block"},(0,l.createElement)(o.Switch,{handleToggle:()=>(0,r.A)("progress_count","toggle",s?.progress_count?.isActive,s?.progress_count,t,n),label:(0,g.__)("Enable progress count","helpgent"),isActive:s?.progress_count?.isActive,className:"helpgent-mb-0",tooltip:!0,tooltipText:(0,g.__)("Enable or disable the progress counter within the form area.","helpgent")})))}},chatBubble:{component:function(e){const{singleFormState:t,setSingleFormState:n,handleActiveSettingsItem:i,showSettingsContent:s,baseApiRoute:c}=e,{singleForm:p,activeSettingsTitle:m,activeSettingsGroup:u}=t,{global:M}=p.content,[w,N]=(0,a.useState)(p?.is_chat_bubble),x=(0,b.$)("helpgent_form_edit_bubble_customizer",{},{singleFormState:t,setSingleFormState:n});return(0,l.createElement)(a.Fragment,null,""===m?(0,l.createElement)("div",{className:"helpgent-screen-setting-block"},(0,l.createElement)("div",{className:"helpgent-field-element"},(0,l.createElement)("div",{className:"helpgent-field-element__top"},(0,l.createElement)(o.Switch,{handleToggle:()=>function(){const e="0"===w?"1":"0";n(t=>({...t,singleForm:{...t.singleForm,is_chat_bubble:e}})),N(e)}(),label:(0,g.__)("Enable form bubble","helpgent"),isActive:w,tooltip:!0,tooltipText:(0,g.__)("Enable the Form Bubble to add a floating icon to your website. When activated, users can easily access and expand the form with a single click.","helpgent")}))),"1"===p?.is_chat_bubble&&(0,l.createElement)(a.Fragment,null,(0,l.createElement)(I,{baseApiRoute:c,singleFormState:t,setSingleFormState:n}),(0,b.$)("helpgent_form_editor_bubble_controls",{},{singleFormState:t,setSingleFormState:n}))):null,""===m&&"1"===p?.is_chat_bubble&&(0,l.createElement)("div",{className:"helpgent-screen-setting-block helpgent-settings-item-wrap"},(0,l.createElement)("button",{className:"helpgent-settings-item","data-settings":"customize-bubble",onClick:e=>{i(e)}},(0,g.__)("Customize form bubble","helpgent"),(0,l.createElement)(d.A,{src:h.A}))),"1"===p?.is_chat_bubble&&"customize-bubble"===u&&""!==m?(0,l.createElement)("div",{className:"helpgent-screen-setting-block helpgent-screen-setting-block--content "+(s?"helpgent-screen-setting-block--slide-in":"")},(0,l.createElement)(S,null),(0,l.createElement)("div",{className:"helpgent-field-element"},(0,l.createElement)("div",{className:"helpgent-field-element__top"},(0,l.createElement)("label",{className:"helpgent-field-element__label",htmlFor:"helpgent-placeholderText"},(0,g.__)("Overlay text","helpgent"))),(0,l.createElement)("div",{className:"helpgent-field-element__content"},(0,l.createElement)("div",{className:"helpgent-form-group"},(0,l.createElement)("input",{type:"text",className:"helpgent-form-group__element",id:"helpgent-placeholderText",value:M?.bubble?.overlay_text,onChange:e=>(0,r.A)("overlay_text",null,e.target.value,M?.bubble,t,n)})))),(0,l.createElement)("div",{className:"helpgent-field-element"},(0,l.createElement)("div",{className:"helpgent-field-element__top"},(0,l.createElement)("label",{className:"helpgent-field-element__label"},(0,g.__)("Shape","helpgent"))),(0,l.createElement)("div",{className:"helpgent-field-element__content"},(0,l.createElement)("ul",{className:"helpgent-bubble-shapes"},["circle","boxed-horizontal","boxed-vertical"].map((e,a)=>(0,l.createElement)("li",{key:a,className:`helpgent-bubble-shape helpgent-bubble-shape--${e} ${M?.bubble?.shape===e?"helpgent-active":""}`,"data-shape":e,onClick:e=>{(0,r.A)("shape",null,e.target.dataset.shape,M?.bubble,t,n)}},(0,l.createElement)("span",null)))))),(0,l.createElement)("div",{className:"helpgent-field-element helpgent-field-element--inline"},(0,l.createElement)("div",{className:"helpgent-field-element__left"},(0,l.createElement)("label",{className:"helpgent-field-element__label"},(0,g.__)("Border color","helpgent"))),(0,l.createElement)("div",{className:"helpgent-field-element__right"},(0,l.createElement)("ul",{className:"helpgent-bubble-border"},(0,l.createElement)("li",{className:"helpgent-bubble-border__color"},(0,l.createElement)(z.A,{id:"helpgent-bubble-border-color",textColor:M?.bubble?.border?.color,handler:e=>(0,r.A)("border","color",e.target.value,M?.bubble,t,n)})),(0,l.createElement)("li",{className:"helpgent-bubble-border__visibility",onClick:e=>(0,r.A)("border","has_border",null,M?.bubble,t,n)},(0,l.createElement)(d.A,{src:"1"===M?.bubble?.border?.has_border?T.A:k.A}))))),x):null)}}});function F({baseApiRoute:e}){const{singleFormState:t,setSingleFormState:n}=(0,i.$)(),{singleForm:o,activeSettingsTitle:r,activeSettingsGroup:c}=t,g=o.content,{bubble:p,helpgent_branding:d,save_incomplete_data:u}=g.global,{overlay_text:h}=p,[b,M]=(0,a.useState)(!1),w=(0,m.L)();(0,a.useEffect)(()=>{if(!w){d.isActive="1",u.isActive="0";const e={...o,content:{elements:g.elements,global:g.global}};n({...t,singleForm:e})}},[w]),(0,a.useEffect)(()=>{M(""!==r)},[r]);const N={singleFormState:t,setSingleFormState:n,handleActiveSettingsItem:e=>{const l=e.currentTarget.dataset.settings,a=e.currentTarget.textContent;n({...t,activeSettingsGroup:l,activeSettingsTitle:a})},showSettingsContent:b,baseApiRoute:e};return(0,l.createElement)(s.z,{className:"helpgent-screen-setting-wrap"},Object.keys(Y).map((e,t)=>{const n=Y[e].component;return(0,l.createElement)(n,{key:t,...N})}))}var O=n(94091),U=n(38769),Z=n(17676),R=n(87277),P=n(22057),B=n(17331);function W(e){const{baseApiRoute:t}=e,{singleFormState:n,setSingleFormState:o}=(0,i.$)(),{singleForm:r,emailTemplateSettings:s,activeSetting:c,activeSettingsTitle:m}=n,u=JSON.stringify(s),{paramsHook:h}=(r.content,(0,v.Xd)("helpgent_router_references",null)),{id:b}=h(),{mutateAsync:M,isLoading:w}=(0,U.A)(`${t?.form}/${b}`),N=(0,a.useRef)(null),x=(0,a.useRef)(null),[L,f]=(0,a.useState)(!1),[y,E]=(0,a.useState)(),[_,j]=(0,a.useState)();return(0,a.useEffect)(()=>{const e=()=>(0,R.A)(N,E,j,window.innerWidth<=575||window.innerWidth<=1199?300:340);return window.addEventListener("resize",e),e(),()=>{window.removeEventListener("resize",e)}},[]),(0,a.useEffect)(()=>{const e=e=>{if(L&&N.current&&!N.current.contains(e.target)&&!x.current.contains(e.target)){const e=N.current;e&&e.classList.add("helpgent-email-settings-sidebar--collapsed"),y<1040&&e.classList.remove("helpgent-email-settings-sidebar--float"),f(!1)}};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[L]),(0,l.createElement)(l.Fragment,null,y&&y<1040?(0,l.createElement)("button",{className:"helpgent-settings-float",onClick:e=>{!function(e){e.preventDefault();const t=N.current;t&&t.classList.toggle("helpgent-email-settings-sidebar--collapsed"),y<1040&&t.classList.toggle("helpgent-email-settings-sidebar--float"),f(!L),N.current.clientWidth!==_&&j(window.innerWidth<=575||window.innerWidth<=1199?300:340)}(e)},style:{right:L?`${_+20}px`:"20px",top:"0"},ref:x},(0,l.createElement)(d.A,{src:B.A})):null,(0,l.createElement)(O.xk,{className:"helpgent-email-settings-sidebar "+(y&&y<1040?"helpgent-email-settings-sidebar--collapsed":""),ref:N},(0,l.createElement)("div",{className:"helpgent-screen-setting-header"},""===m?(0,l.createElement)("ul",{className:"helpgent-screen-setting-list"},(0,l.createElement)("li",{className:"general"===c?"helpgent-active":null,onClick:()=>o({...n,activeSetting:"general"})},(0,g.__)("General","helpgent")),(0,l.createElement)("li",{className:"email-notification"===c?"helpgent-active":null,onClick:()=>o({...n,activeSetting:"email-notification"})},(0,g.__)("Email Notification","helpgent"))):(0,l.createElement)("button",{className:"helpgent-settings-back-btn",onClick:()=>{o({...n,activeSettingsTitle:""})}},(0,l.createElement)(d.A,{src:P.A}),m)),(0,l.createElement)("div",{className:"helpgent-screen-setting-content helpgent-screen-setting-content--global helpgent-scrollbar-style"},"general"===c&&(0,l.createElement)(F,{baseApiRoute:t}),"email-notification"===c&&(0,l.createElement)(p,null)),(0,l.createElement)("button",{className:"helpgent-btn helpgent-btn-block helpgent-btn-primary helpgent-btn-save-settings",onClick:()=>(0,Z.A)(M,w,"publish",r,u,o)},w?(0,g.__)("Saving","helpgent"):(0,g.__)("Save","helpgent"))))}},21113:(e,t,n)=>{function l(e,t,n,l){const{singleForm:a}=n,{elements:i,global:o}=a.content;let r={};r=e in o.bubble?{...o,bubble:{...o.bubble,[e]:t}}:e in o.email_notification?{...o,email_notification:{...o.email_notification,[e]:t}}:e in o.media?{...o,media:{...o.media,[e]:t}}:{...o,[e]:t};const s={...a,content:{elements:i,global:r}};l(e=>({...e,singleForm:s}))}n.d(t,{A:()=>l})},27308:(e,t,n)=>{n.d(t,{A:()=>b});var l=n(51609),a=n(86087),i=(n(50481),n(65604)),o=n(47690),r=n(38930),s=n(47977),c=n(62947),g=n(10155),p=n(26374),m=n(85168);const d=(e,t)=>{const n=helpgent_localization&&helpgent_localization.rest_nonce?helpgent_localization.rest_nonce:"",l=helpgent_localization&&helpgent_localization.rest_url?helpgent_localization.rest_url:"",a={method:"post",baseURL:t&&t.useRESTRootURL?(i=l,i.replace(/\/helpgent\/?$/,"")):l,headers:{"X-WP-Nonce":n}};var i;function o(e){return r(e.headers)||(e.headers={}),void 0===e.headers["X-WP-Nonce"]&&(e.headers["X-WP-Nonce"]=n),e}const r=e=>e&&"object"==typeof e&&!Array.isArray(e);return t=r(t)?o({...a,...t}):a,(0,p.n)(n=>(0,m.A)(e,o({...t,...n})))};function u({onComplete:e,isActive:t,setIsActive:n,videoResolution:i,maxVideoDuration:o,className:r}){const p=(0,a.useRef)(document.querySelector("body")),m=(0,a.useRef)(document.getElementById("helpgent-wp-video-recorder-container")||function(){const e=document.createElement("div");return e.setAttribute("class","helpgent-modal-portal"),e.setAttribute("id","helpgent-wp-video-recorder-container"),e}()),{mutateAsync:u}=d("wp/v2/media",{useRESTRootURL:!0});return(0,a.useEffect)(()=>{t?(p.current.appendChild(m.current),p.current.style.overflow="hidden"):(m.current.remove(),p.current.style.overflow="")},[t]),t?(0,l.createElement)(l.Fragment,null,(0,a.createPortal)((0,l.createElement)(s.A,{isActive:!0,onChange:()=>{n(!1)},className:r},(0,l.createElement)(g.yY,{className:"helpgent-video-recorder-modal-contents"},(0,l.createElement)(c.A,{videoResolution:i,maxRecordLength:o,onSubmit:async function(t){const n=t.type.match(/\/([a-zA-Z0-9]+)/),l=`record.${n?n[1]:"webm"}`,a=new FormData;a.append("file",t,l);const i={headers:{"Content-Disposition":`attachment; filename=${l}`}};try{const t=await u({data:a,...i});"function"==typeof e&&e(t)}catch(e){console.log(e)}},onExit:()=>{n(!1)},previewMode:"default"}))),m.current)):""}var h=n(27723);function b(e){const{title:t,buttonLabel:n,value:s,onChange:c,libraryType:g,videoResolution:p,maxVideoDuration:m}=e,d=e=>e&&"object"==typeof e&&!Array.isArray(e),b=(0,a.useRef)(),[M,w]=(0,a.useState)(null);(0,a.useEffect)(()=>{w(d(s)&&Object.keys(s).length?s:null)},[s]);const[N,x]=(0,a.useState)(!1);function L(){b.current&&b.current.el&&b.current.remove(),b.current=wp.media({title:t||(0,h.__)("Select or Upload Media Of Your Chosen Persuasion","helpgent"),button:{text:n||(0,h.__)("Use this media","helpgent")},library:{type:g||["video","image"]},multiple:!1}),b.current.on("select",function(){const e=b.current.state().get("selection").first()&&b.current.state().get("selection").first().toJSON();b.current=void 0,v(e)}),b.current.open()}function v(e){d(e)&&(e.type||e.url)&&(w(e),"function"==typeof c&&c(e))}return(0,l.createElement)("div",{className:"helpgent-element-media-uploader"},!M&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)("span",{className:"helpgent-btn helpgent-btn-sm helpgent-btn-gray helpgent-btn-upload-trigger",onClick:L},(0,h.__)("Add Media","helpgent")),(0,l.createElement)("span",{className:"helpgent-btn helpgent-btn-sm helpgent-btn-gray helpgent-btn-upload-trigger",onClick:function(){x(!0)}},(0,h.__)("Record Video","helpgent"))),M&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)("span",{className:"helpgent-btn helpgent-btn-sm helpgent-btn-gray helpgent-btn-replace",onClick:L},(0,l.createElement)(i.A,{src:o.A}),(0,h.__)("Change","helpgent")),(0,l.createElement)("span",{className:"helpgent-btn helpgent-btn-sm helpgent-btn-gray helpgent-btn-remove",onClick:function(){w(null),"function"==typeof c&&c(null)}},(0,l.createElement)(i.A,{src:r.A}),(0,h.__)("Remove","helpgent"))),(0,l.createElement)(u,{videoResolution:p,maxVideoDuration:m,isActive:N,setIsActive:x,onComplete:function(e){d(e)&&v({type:"video",url:e.source_url}),x(!1)},className:"helpgent-video-recorder-modal"}))}},27921:(e,t,n)=>{n.d(t,{A:()=>i});var l=n(51609),a=n(4286);function i(e){const{id:t,textColor:n,handler:i}=e;return(0,l.createElement)(a.ny,{className:"helpgent-color-picker"},(0,l.createElement)("span",{className:"helpgent-color-picker__text"},n),(0,l.createElement)("label",{htmlFor:`${t}`,className:"helpgent-color-picker__trigger",style:{backgroundColor:n}}),(0,l.createElement)("input",{type:"color",id:`${t}`,name:`${t}`,value:`${n.trim()}`,onChange:i}))}},37734:(e,t,n)=>{n.d(t,{A:()=>a});var l=n(21113);function a(e,t,n,a,i,o){function r(e,t,n){return{...t[e],[n]:{isActive:"1"===t[e][n].isActive?"0":"1"}}}switch(e){case"color_style":a={...a,[t]:{value:n}};break;case"background_style":a={...a,[t]:n};break;case"background_color":case"background_image":case"corner":case"element_size":case"specialElement_size":case"overlay_text":case"position":case"shape":case"size":a=n;break;case"max_video_duration":case"video_resolution":case"max_voice_duration":a={value:n};break;case"max_upload_size":let e={};e="unit"===t?{value:a.value,unit:n}:{unit:a.unit,value:n},a=e;break;case"helpgent_branding":case"save_incomplete_data":case"anonymous_submission":case"progress_count":case"action_btn":"toggle"===t&&(a.isActive="0"===n?"1":"0");break;case"submission_text":case"go_to_next_text":a.value=n;break;case"border":"has_border"===t?a={...a.border,has_border:"1"===a.border.has_border?"0":"1"}:"color"===t&&(a={...a.border,color:n});break;case"offset_x":case"offset_y":a=n<0||""===n?0:n;break;case"background_type":"color"===t?a={...a.background_type,color:n,upload:{id:"",type:"",url:""}}:"upload"===t&&(a={...a.background_type,color:"",upload:n});break;case"admin_notification":a="notify_on_new_response"===t||"notify_on_user_message"===t?r("admin_notification",a,t):{...a.admin_notification,[t]:{value:n}};break;case"user_notification":a="notify_on_new_response"===t||"notify_on_admin_message"===t?r("user_notification",a,t):{...a.user_notification,[t]:{value:n}};break;case"template_settings":a="enable_header"===t||"enable_footer"===t?r("template_settings",a,t):{...a.template_settings,[t]:{value:n}}}(0,l.A)(e,a,i,o)}},38769:(e,t,n)=>{n.d(t,{A:()=>o});var l=n(26374),a=n(1455),i=n.n(a);const o=e=>(0,l.n)(t=>async function(e,t){return await i()({path:e,method:"PATCH",data:t}).then(e=>e)}(e,t))},38930:(e,t,n)=>{n.d(t,{A:()=>l}),n(51609);const l="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNC42NjciIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNC42NjcgMTYiPgogIDxnIGlkPSJ0cmFzaF8xXyIgZGF0YS1uYW1lPSJ0cmFzaCAoMSkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMS4zMzMpIj4KICAgIDxwYXRoIGlkPSJQYXRoXzE1MDgiIGRhdGEtbmFtZT0iUGF0aCAxNTA4IiBkPSJNMzYsM2ExLDEsMCwwLDAtMS0xSDMyLjQ4MmEzLDMsMCwwLDAtMi44MTYtMmgtMkEzLDMsMCwwLDAsMjQuODUsMkgyMi4zMzNhMSwxLDAsMCwwLTEsMWgwYTEsMSwwLDAsMCwxLDFoLjMzM3Y4LjMzM0EzLjY2NywzLjY2NywwLDAsMCwyNi4zMzMsMTZIMzFhMy42NjcsMy42NjcsMCwwLDAsMy42NjctMy42NjdWNEgzNUExLDEsM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ni45NTdhLjIzMy4yMzMsMCwwLDEsLjA2OS4xNjd2MS43NjRhMS45OSwxLjk5LDAsMCwwLDEuOTg4LDEuOTg4SDUuNjg1YS4yMzguMjM4LDAsMCwxLC4xNjguMDY5bC45NTYuOTU2YTMuMDgyLDMuMDgyLDAsMCwwLDIuMTg0LjkxLDMuMTIxLDMuMTIxLDAsMCwwLDEtLjE2NEEzLjA4MSwzLjA4MSwwLDAsMCwxMi4wNjcsMTEuNGwxLjg3NC04Ljg4OUExLjk3MywxLjk3MywwLDAsMCwxMy40MTYuNjMyWk0xLjgyLDQuNjE0YTEuMzI1LDEuMzI1LDAsMCwxLDEuMS0uOTA3bC4wNjEtLjAxLDcuNzctMS42MzNMMy42ODMsOS4xMjVWOC4zNkExLjk3MywxLjk3MywwLDAsMCwzLjEsNi45NTVMMi4xNDUsNkExLjMyNiwxLjMyNiwwLDAsMSwxLjgyLDQuNjE0Wm04LjUyOCw2LjQ1NWMwLC4wMi0uMDA4LjA0MS0uMDEuMDYxYTEuMzUsMS4zNSwwLDAsMS0yLjI5Mi43NzJsLS45NTUtLjk1NWExLjk3MywxLjk3MywwLDAsMC0xLjQwNi0uNTgzSDQuOTJMMTEuOTg0LDMuM1oiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDApIiBmaWxsPSIjM2MzYzNjIi8+CiAgPC9nPgo8L3N2Zz4K"},47977:(e,t,n)=>{n.d(t,{A:()=>o});var l=n(51609),a=n(86087);const i=n(38267).Ay.div`
    display: none;
    position: fixed;
    justify-content: center;
    align-items: center;
    top: 0;
    bottom: 0;
    right: 0;
    left: 0;
    background-color: rgba( 0, 0, 0, 0.5 );
    overflow-y: auto;
    z-index: 999999;

    &.--active {
        display: flex;
    }
`,o=function({children:e,isActive:t,onChange:n,className:o}){const r=(0,a.useRef)(),[s,c]=(0,a.useState)("boolean"==typeof t&&t);return(0,a.useEffect)(()=>{c(t)},[t]),s?(0,l.createElement)(i,{ref:r,className:`helpgent-modal-container --active ${o}`,onClick:function(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cm09InRyYW5zbGF0ZSg0Ljk3OCA2Mi45OTEpIiBmaWxsPSIjNmU2ZTZlIi8+CiAgPC9nPgo8L3N2Zz4K"},62947:(e,t,n)=>{n.d(t,{A:()=>E});var l=n(51609),a=n(86087),i=n(44253),o=n(10155),r=n(65604),s=n(50481),c=n(22057),g=n(90781),p=n(72235),m=n(27723);function d({recorder:e,afterGrantPermission:t,onBack:n,onExit:a}){let i=e.getRecorderConfig("checkPermissions");return(0,l.createElement)(o.BT,{className:"helpgent-video-recorder-permission-container"},"function"==typeof a&&(0,l.createElement)("div",{className:"helpgent-close-btn"},(0,l.createElement)("a",{href:"#",className:"helpgent-close-btn-icon",onClick:e=>{e.preventDefault(),a()}},(0,l.createElement)(r.A,{src:g.A}))),("function"==typeof n||"function"==typeof a)&&(0,l.createElement)("div",{className:"helpgent-header-action"},"function"==typeof n&&(0,l.createElement)("div",{className:"helpgent-header-action-item"},(0,l.createElement)("a",{href:"#",className:"helpgent-btn-back helpgent-action-icon",onClick:e=>{e.preventDefault(),n()}},(0,l.createElement)(r.A,{src:c.A})))),(0,l.createElement)("h4",{className:"helpgent-permission-title"},(0,m.sprintf)((0,m.__)("To Record %s, your browser will need to request access to your %s.","helpgent"),e.getRecorderType(),i.length?i.join(", "):"")),(0,l.createElement)(s.A,{src:p,alt:"helpgent video support"}),(0,l.createElement)("div",{className:"helpgent-btn helpgent-btn-lg helpgent-btn-primary",onClick:n=>{n.preventDefault(),async function(){await e.requestPermission()&&t()}()}},(0,m.__)("Request Permission","helpgent")),e.isPermissionDenied&&(0,l.createElement)("div",{className:"helpgent-mt-10 helpgent-notice helpgent-notice-danger helpgent-text-center"},(0,m.__)("Please grant the requested permission","helpgent")))}var u=n(82902),h=n(62064),b=n(33410);function M({recorder:e,onCancel:t}){function n(){return e.isRecording||e.isPaused}return(0,a.useEffect)(()=>{e.setupStream()},[]),(0,l.createElement)(o.oF,{className:"helpgent-video-recorder-container-area"},(0,l.createElement)("div",{className:"helpgent-video-recorder-wrap"},(0,l.createElement)("div",{className:"helpgent-video-recorder-container helpgent-video-recorder"},(0,l.createElement)("a",{href:"#",className:"helpgent-btn-back",onClick:e=>{e.preventDefault(),t()}},(0,l.createElement)(r.A,{src:c.A})),(0,l.createElement)("video",{ref:e.videoPreviewStreamRef,muted:!0,playsInline:!0}),(0,l.createElement)("div",{className:"helpgent-timer"},(0,l.createElement)("span",{className:"helpgent-sec"},e.getFormattedRecordedTime())),e.isActiveCountdown&&(0,l.createElement)("div",{className:"helpgent-video-recorder-countdown-container"},(0,l.createElement)(u.A,{value:e.getCountdownTimeReversed(),onClick:e.skipCountdown,hint:(0,m.__)("Click anywhere to skip the countdown","helpgent")})),!e.isActiveCountdown&&(0,l.createElement)("div",{className:"helpgent-record-action"+(n()?" helpgent-record-start":"")},(0,l.createElement)("a",{href:"#",className:"helpgent-record-btn",onClick:t=>{t.preventDefault(),async function(){n()?e.stop():await e.start()}()}}),n()&&(0,l.createElement)("a",{href:"#",className:"helpgent-btn-record-right helpgent-btn-"+(e.isPaused?"play":"pause"),onClick:t=>{t.preventDefault(),async function(){e.isPaused?e.resume():e.pause()}()}}," ",(0,l.createElement)(r.A,{src:e.isPaused?b.A:h.A})," ")))))}var w=n(69466);const N=n(38267).Ay.div`
    position: relative;
    padding-top: calc( 56.25% + 79px );
    margin-right: 80px;
    margin-left: 80px;
    border-radius: 20px;
    box-sizing: border-box;
    background: #fff;
    overflow: hidden;
    height: unset !important;

    .helpgent-media-preview-wrap {
        position: absolute;
        top: 0;
        right: 0;
        left: 0;
        bottom: 0;
    }

    .helpgent-media-preview-close-action{
        position: absolute;
        right: 25px;
        top: 10px;
        z-index: 10;
        .helpgent-media-preview-close-action-link{
            svg{
                width: 12px;
                height: 12px;
                path{
                    fill: var(--helpgent-color-dark);
                    transition: var(--helpgent-transition);
                }
            }
            &:hover{
                svg path{
                    fill: var(--helpgent-color-danger);
                }
            }
        }
    }
    .helpgent-media-preview__media {
        height: calc( 100% - 79px );
        .helpgent-media-preview__video{
            height: 100%;
        }
        video{
            width: 100%;
            height: 100%;
            object-fit: cover;
            border-radius: 0;
        }
    }

    .helpgent-media-preview__actions {
        display: flex;
        flex-direction: column;
        background: var(--helpgent-color-bg-light);
        h4{
            padding: 25px;
            margin: 0;
            font-size: 20px;
        }
        .helpgent-media-preview-message{
            height: 100%;
            textarea{
                background: none;
                resize: none;
                border: 0 none;
                width: 100%;
                height: 100%;
                padding: 0 25px 15px;
                font-size: 18px;
                &:focus{
                    border: 0 none;
                    box-shadow: none;
                }
                &::-webkit-scrollbar {
                    width: 5px;
                }
                &::-webkit-scrollbar-track {
                    background: #f1f1f1;
                    border-radius: 3px;
                }
                &::-webkit-scrollbar-thumb {
                    background: var(--helpgent-color-bg-deep);
                    transition: var(--helpgent-transition);
                    border-radius: 3px;
                }
                &::-webkit-scrollbar-thumb:hover {
                    background: var(--helpgent-color-primary);
                }
            }
        }
        .helpgent-media-preview-buttons{
            margin-top: auto;
            display: flex;
            align-items: center;
            background: #fff;
            a{
                flex: 1;
                display: flex;
                align-items:center;
                justify-content: center;
                gap: 10px;
                font-size: 15px;
                color: var(--helpgent-color-gray);
                text-decoration: none;
                padding: 30px 15px;
                transition: var(--helpgent-transition);
                &:not(:last-child){
                    border-right: 1px solid var(--helpgent-color-border-light);
                }
                svg{
                    path{
                        fill: var(--helpgent-color-gray);
                        transition: var(--helpgent-transition);
                    }
                }
                &:hover{
                    color: var(--helpgent-color-primary);
                    svg path{
                        fill: var(--helpgent-color-primary);
                    }
                }
            }
        }
    }

    .helpgent-btn-recorded {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 70px;
        height: 70px;
        margin: 0px auto;
        border-radius: 50%;
        z-index: 101;
        transition: box-shadow 0.2s ease-in 0s;
        background-color: var(--color-white);
        box-shadow: rgba(0, 0, 0, 0.15) 0px 5px 50px;
        &:hover{
            box-shadow: rgba(0, 0, 0, 0.2) 0px 20px 60px;
        }
        svg{
            path{
                fill: var(--helpgent-color-primary);
            }
        }
        &.helpgent-btn-recorded-pause{

        }
    }
    .helpgent-audio-range{
        width: calc(100% + 50px);
        display: block;
        margin: 100px 0px 0px -30px;
    }
    .helpgent-recorded-preview__bottom{
        margin-top: 35px;
        h4{
            font-size: 20px;
            font-weight: 600;
            margin: 0px 0px 20px;
        }
    }
    .helpgent-recorded-preview__bottom-actions{
        a{
            display: flex;
            justify-content: center;
            width: 100%;
            text-align: center;
            box-sizing: border-box;
            border-radius: 14px;
        }
        a + a{
            margin-top: 10px;
        }
    }
`;var x=n(21192),L=n(52973),v=n(23142),f=n(47539);function y({file:e,onSubmit:t,onBack:n,onExit:i,submitButtonLabel:o}){const[s,g]=(0,a.useState)(""),[p,d]=(0,a.useState)(""),[u,h]=(0,a.useState)(!1);return o=o||"Save",(0,a.useEffect)(()=>{if(!e||"object"!=typeof e)return;let t=e.type.match(/^[^/]+/);t=t?t[0]:"",d(t),g(URL.createObjectURL(e))},[]),(0,l.createElement)(N,{className:"helpgent-media-preview"},(0,l.createElement)("div",{className:"helpgent-media-preview-wrap"},(0,l.createElement)("div",{className:"helpgent-media-preview-close-action"},(0,l.createElement)("a",{href:"#",className:"helpgent-media-preview-close-action-link",onClick:e=>{e.preventDefault(),i()}},(0,l.createElement)(r.A,{src:v.A}))),(0,l.createElement)("div",{className:"helpgent-media-preview__media"},"audio"===p&&(0,l.createElement)(x.A,{mediaURL:s}),"video"===p&&(0,l.createElement)(L.A,{mediaURL:s})),(0,l.createElement)("div",{className:"helpgent-media-preview__actions"},(0,l.createElement)("div",{className:"helpgent-media-preview-buttons"},("function"==typeof n||"function"==typeof i)&&(0,l.createElement)("a",{href:"#",onClick:function(e){e.preventDefault(),"function"!=typeof n?"function"!=typeof i||i():n()}},(0,l.createElement)(r.A,{src:c.A}),(0,m.__)("Cancel","helpgent")),(0,l.createElement)("a",{href:"#",onClick:async function(n){if(n.preventDefault(),"function"!=typeof t)return;if(u)return;if(!e)return;h(!0);const l=await t(e,p);h(!1),l&&l.success&&"function"==typeof i&&i()}},u?(0,m.__)("Please wait...","helpgent"):o,(0,l.createElement)(r.A,{src:f.A}))))))}function E({fileUploader:e,onSubmit:t,onExit:n,maxRecordLength:r,videoResolution:s,previewMode:c,submitButtonLabel:g}){const[p,m]=(0,a.useState)("recorder"),[u,h]=(0,a.useState)(""),b={default:y,previewWithText:w.A};c=c||"default";const N=b.hasOwnProperty(c)?b[c]:b.default,x={recorderType:"video",maxRecordLength:r?parseInt(r):120,countdownTimer:3,videoResolution:s?parseInt(s):null,afterStopRecording:function(t){t&&(e&&e.setFile(t.blob),m("mediaPreview"))}},L=(0,i.A)(x),v=()=>{L.reset(),n()},f={permission:(0,l.createElement)(d,{recorder:L,onExit:v,afterGrantPermission:()=>{m("recorder")}}),recorder:(0,l.createElement)(M,{recorder:L,onCancel:v}),mediaPreview:(0,l.createElement)("div",{className:"helpgent-media-preview-container"},(0,l.createElement)(N,{file:e&&e.hasFile()?e.getFile().file:L.recordedBlob,onSubmit:(n,l,a)=>t(e?e.files:n,l),onBack:()=>{L.reset(),m("recorder")},onExit:v,submitButtonLabel:g}))};return(0,a.useEffect)(()=>(async function(){await L.checkPermission()?m("recorder"):(m("permission"),h("helpgent-permission-modal"))}(),()=>{L.reset()}),[]),(0,l.createElement)(o.jD,{className:u},(E=p,f.hasOwnProperty(E)?f[E]:""));var E}},69466:(e,t,n)=>{n.d(t,{A:()=>d});var l=n(51609),a=n(86087);const i=n(38267).Ay.div`
    display: flex;
    box-sizing: border-box;
    background: #fff;
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    margin-left: 80px;
    margin-right: 80px;
    height: calc(100vh - 160px);
    @media only screen and (max-width: 575px){
        flex-wrap: wrap;
        flex-direction: column;
    }

    .helpgent-media-preview-close-action{
        position: absolute;
        right: 25px;
        top: 10px;
        .helpgent-media-preview-close-action-link{
            svg{
                width: 12px;
                height: 12px;
                path{
                    fill: var(--helpgent-color-dark);
                    transition: var(--helpgent-transition);
                }
            }
            &:hover{
                svg path{
                    fill: var(--helpgent-color-danger);
                }
            }
        }
    }
    .helpgent-media-preview__media {
        flex: 1;
        position: relative;
        .helpgent-media-preview__video{
            height: 100%;
        }
        video{
            width: 100%;
            height: calc(100% + 1px);
            object-fit: cover;
            border-radius: 0;
        }
    }

    .helpgent-media-preview__actions {
        flex: 1;
        display: flex;
        flex-direction: column;
        background: var(--helpgent-color-bg-light);
        h4{
            padding: 25px;
            margin: 0;
            font-size: 20px;
        }
        .helpgent-media-preview-message{
            height: 100%;
            textarea{
                background: none;
                resize: none;
                border: 0 none;
                width: 100%;
                height: 100%;
                padding: 0 25px 15px;
                font-size: 18px;
                &:focus{
                    border: 0 none;
                    box-shadow: none;
                }
                &::-webkit-scrollbar {
                    width: 5px;
                }
                &::-webkit-scrollbar-track {
                    background: #f1f1f1;
                    border-radius: 3px;
                }
                &::-webkit-scrollbar-thumb {
                    background: var(--helpgent-color-bg-deep);
                    transition: var(--helpgent-transition);
                    border-radius: 3px;
                }
                &::-webkit-scrollbar-thumb:hover {
                    background: var(--helpgent-color-primary);
                }
            }
        }
        .helpgent-media-preview-buttons{
            margin-top: auto;
            display: flex;
            align-items: center;
            background: #fff;
            a{
                flex: 1;
                display: flex;
                align-items:center;
                justify-content: center;
                gap: 10px;
                font-size: 15px;
                color: var(--helpgent-color-gray);
                text-decoration: none;
                padding: 30px 15px;
                transition: var(--helpgent-transition);
                &:not(:last-child){
                    border-right: 1px solid var(--helpgent-color-border-light);
                }
                svg{
                    path{
                        fill: var(--helpgent-color-gray);
                        transition: var(--helpgent-transition);
                    }
                }
                &:hover{
                    color: var(--helpgent-color-primary);
                    svg path{
                        fill: var(--helpgent-color-primary);
                    }
                }
            }
        }
    }

    .helpgent-btn-recorded {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 70px;
        height: 70px;
        margin: 0px auto;
        border-radius: 50%;
        z-index: 101;
        transition: box-shadow 0.2s ease-in 0s;
        background-color: var(--color-white);
        box-shadow: rgba(0, 0, 0, 0.15) 0px 5px 50px;
        &:hover{
            box-shadow: rgba(0, 0, 0, 0.2) 0px 20px 60px;
        }
        svg{
            path{
                fill: var(--helpgent-color-primary);
            }
        }
        &.helpgent-btn-recorded-pause{

        }
    }
    .helpgent-audio-range{
        width: calc(100% + 50px);
        display: block;
        margin: 100px 0px 0px -30px;
    }
    .helpgent-recorded-preview__bottom{
        margin-top: 35px;
        h4{
            font-size: 20px;
            font-weight: 600;
            margin: 0px 0px 20px;
        }
    }
    .helpgent-recorded-preview__bottom-actions{
        a{
            display: flex;
            justify-content: center;
            width: 100%;
            text-align: center;
            box-sizing: border-box;
            border-radius: 14px;
        }
        a + a{
            margin-top: 10px;
        }
    }
`;var o=n(21192),r=n(52973),s=n(65604),c=n(23142),g=n(22057),p=n(47539),m=n(27723);function d({file:e,onSubmit:t,onBack:n,onExit:d,submitButtonLabel:u}){const[h,b]=(0,a.useState)(""),[M,w]=(0,a.useState)(""),[N,x]=(0,a.useState)(""),[L,v]=(0,a.useState)(""),[f,y]=(0,a.useState)(!1);return u=u||(0,m.__)("Save","helpgent"),(0,a.useEffect)(()=>{if(!e||"object"!=typeof e)return;let t=e.type.match(/^[^/]+/);t=t?t[0]:"",w(t),b(URL.createObjectURL(e))},[]),(0,l.createElement)(i,{className:"helpgent-media-preview"},(0,l.createElement)("div",{className:"helpgent-media-preview-close-action"},(0,l.createElement)("a",{href:"#",className:"helpgent-media-preview-close-action-link",onClick:e=>{e.preventDefault(),d()}},(0,l.createElement)(s.A,{src:c.A}))),(0,l.createElement)("div",{className:"helpgent-media-preview__media"},"audio"===M&&(0,l.createElement)(o.A,{mediaURL:h}),"video"===M&&(0,l.createElement)(r.A,{mediaURL:h})),(0,l.createElement)("div",{className:"helpgent-media-preview__actions"},(0,l.createElement)("h4",null,(0,m.__)("Ready to Send?","helpgent")),(0,l.createElement)("div",{className:"helpgent-media-preview-message"},(0,l.createElement)("textarea",{onChange:e=>x(e.target.value),value:N,placeholder:(0,m.__)("Type your text here","helpgent")})),L&&(0,l.createElement)("div",null,L),(0,l.createElement)("div",{className:"helpgent-media-preview-buttons"},("function"==typeof n||"function"==typeof d)&&(0,l.createElement)("a",{href:"#",onClick:function(e){e.preventDefault(),"function"!=typeof n?"function"!=typeof d||d():n()}},(0,l.createElement)(s.A,{src:g.A}),(0,m.__)("Cancel","helpgent")),(0,l.createElement)("a",{href:"#",onClick:async function(n){if(n.preventDefault(),"function"!=typeof t)return;if(f)return;if(v(""),!e)return void v((0,m.__)("Please select a file","helpgent"));y(!0);const l=await t(e,N,M);l&&(y(!1),l.success?"function"==typeof d&&d():v(l.message))}},f?(0,m.__)("Please wait...","helpgent"):u,(0,l.createElement)(s.A,{src:p.A})))))}},76012:(e,t,n)=>{n.d(t,{A:()=>l}),n(51609);const l="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMCIgaGVpZ2h0PSIxMCIgdmlld0JveD0iMCAwIDEwIDEwIj4KICA8cGF0aCBpZD0iSWNvbl9hd2Vzb21lLXBsdXMiIGRhdGEtbmFtZT0iSWNvbiBhd2Vzb21lLXBsdXMiIGQ9Ik05LjI4Niw2LjE3OUg2LjA3MVYyLjk2NGEuNzE0LjcxNCwwLDAsMC0uNzE0LS43MTRINC42NDNhLjcxNC43MTQsMCwwLDAtLjcxNC43MTRWNi4xNzlILjcxNEEuNzE0LjcxNCwwLDAsMCwwLDYuODkzdi43MTRhLjcxNC43MTQsMCwwLDAsLjcxNC43MTRIMy45Mjl2My4yMTRhLjcxNC43MTQsMCwwLDAsLjcxNC43MTRoLjcxNGEuNzE0LjcxNCwwLDAsMCwuNzE0LS43MTRWOC4zMjFIOS4yODZBLjcxNC43MTQsMCwwLDAsMTAsNy42MDdWNi44OTNBLjcxNC43MTQsMCwwLDAsOS4yODYsNi4xNzlaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwIC0yLjI1KSIgZmlsbD0iIzY1NTFmMiIvPgo8L3N2Zz4K"},87277:(e,t,n)=>{function l(e,t,n,l){const a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