var N=Object.defineProperty;var j=Object.getOwnPropertySymbols;var T=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable;var v=(a,e,s)=>e in a?N(a,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[e]=s,S=(a,e)=>{for(var s in e||(e={}))T.call(e,s)&&v(a,s,e[s]);if(j)for(var s of j(e))y.call(e,s)&&v(a,s,e[s]);return a};import{j as t,_ as m,s as C,b as L}from"./main.2.9.0.js";import{b as u,u as w}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{S as I}from"./SnackMsg.DYSD96P4.js";import{S as k}from"./Steps.BYe8zHkm.js";import{I as z,s as M}from"./Integrations.DL8wqGct.js";import{B as A}from"./BackIcn._8Wofmn2.js";import{y as _,x as B}from"./Note.NSUdvR3c.js";import{T as E}from"./TutorialLink.CFG7bS5c.js";import{T as D,h as F}from"./TutorLmsIntegLayout.DmzNzgey.js";import"./react-vendor.P7K3d6op.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";function H({tutorlmsConf:a,setTutorlmsConf:e,step:s,setStep:g,setSnackbar:f}){const[n,r]=u.useState(!1),[i,p]=u.useState(!1),[b,c]=u.useState(!1),l=()=>{p("auth"),L({},"tutor_authorize").then(o=>{o!=null&&o.success&&(r(!0),f({show:!0,msg:m("Connected with Tutor LMS Successfully","bit-integrations")})),p(!1),c(!0)})},d=o=>{const h=B(a);h[o.target.name]=o.target.value,e(h)};return t.jsxs("div",{className:"btcd-stp-page",style:{width:s===1&&900,height:s===1&&"auto"},children:[t.jsx(E,{linkKey:"tutorlms"}),t.jsx("div",{className:"mt-3",children:t.jsx("b",{children:m("Integration Name:","bit-integrations")})}),t.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:d,name:"name",value:a.name,type:"text",placeholder:m("Integration Name...","bit-integrations")}),i==="auth"&&t.jsxs("div",{className:"flx mt-5",children:[t.jsx(_,{size:25,clr:"#022217",className:"mr-2"}),"Checking if Tutor LMS is active!!!"]}),b&&!n&&!i&&t.jsxs("div",{className:"flx mt-5",style:{color:"red"},children:[t.jsx("span",{className:"btcd-icn mr-2",style:{fontSize:30,marginTop:-5},children:"×"}),C(m("%s plugin must be activated to integrate with Bit Integrations","bit-integrations"),"Tutor LMS")]}),!n&&t.jsx("button",{onClick:l,className:"btn btcd-btn-lg purple sh-sm flx mt-5",type:"button",children:m("Connect","bit-integrations")}),n&&t.jsxs("button",{onClick:()=>g(2),className:"btn btcd-btn-lg purple sh-sm flx mt-5",type:"button",disabled:!n,children:[m("Next","bit-integrations"),t.jsx(A,{className:"ml-1 rev-icn"})]})]})}function $({formFields:a,setFlow:e,flow:s,allIntegURL:g}){const f=w(),[n,r]=u.useState(!1),[i,p]=u.useState(1),[b,c]=u.useState({show:!1}),[l,d]=u.useState({name:"Tutor LMS",type:"Tutor Lms",field_map:[{formField:"",tutorField:""}],actions:{},actionData:{}}),o=()=>{r(!0),M({flow:s,setFlow:e,allIntegURL:g,conf:l,navigate:f,setIsLoading:r,setSnackbar:c})},h=x=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),p(x)};return t.jsxs("div",{children:[t.jsx(I,{snack:b,setSnackbar:c}),t.jsx("div",{className:"txt-center mt-2",children:t.jsx(k,{step:3,active:i})}),t.jsx(H,{tutorlmsConf:l,setTutorlmsConf:d,step:i,setStep:p,isLoading:n,setIsLoading:r,setSnackbar:c}),t.jsxs("div",{className:"btcd-stp-page",style:S({},i===2&&{width:900,height:"auto",minHeight:i===2&&"500px",overflow:"visible"}),children:[t.jsx(D,{formFields:a,handleInput:x=>F(x,l,d,r,c),tutorlmsConf:l,setTutorlmsConf:d,isLoading:n,setIsLoading:r,setSnackbar:c}),t.jsxs("button",{onClick:()=>h(3),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[m("Next","bit-integrations"),"  ",t.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),t.jsx(z,{step:i,saveConfig:()=>o(),isLoading:n,dataConf:l,setDataConf:d,formFields:a})]})}export{$ as default};
