var $=Object.defineProperty;var k=Object.getOwnPropertySymbols;var G=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable;var S=(a,e,i)=>e in a?$(a,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[e]=i,f=(a,e)=>{for(var i in e||(e={}))G.call(e,i)&&S(a,i,e[i]);if(k)for(var i of k(e))H.call(e,i)&&S(a,i,e[i]);return a};var w=(a,e,i)=>new Promise((h,u)=>{var l=n=>{try{r(i.next(n))}catch(b){u(b)}},c=n=>{try{r(i.throw(n))}catch(b){u(b)}},r=n=>n.done?h(n.value):Promise.resolve(n.value).then(l,c);r((i=i.apply(a,e)).next())});import{k as O,f as U,h as V,a as K,j as t,_ as s,L as q}from"./main.2.8.10.js";import{b as p}from"./react-router.DMwpH23k.js";import{B as F}from"./BackIcn.BFDZx8No.js";import{a2 as I,y as E}from"./Note.DalStCGz.js";import{c as J,t as M,r as Q}from"./GoogleSheetCommonFunc.tmVkP4MP.js";import{T as W}from"./TutorialLink.D6K_DiHL.js";import"./react-vendor.P7K3d6op.js";import"./CopyIcn.BnhKHfEP.js";function rt({formID:a,sheetConf:e,setSheetConf:i,step:h,setstep:u,isLoading:l,setIsLoading:c,setSnackbar:r,redirectLocation:n,isEdit:b,isInfo:d}){const[x,T]=p.useState(!1),[j,A]=p.useState({clientId:"",clientSecret:""}),y=O(U),[_,R]=p.useState([]),[g,B]=V(K),[m,X]=p.useState("Custom Authorization"),v=o=>{J(e,o,A,c,y)},D=o=>w(null,null,function*(){yield M(o,e,i,T,m,_,R,c,r,y),B(void 0)});p.useEffect(()=>{!g||Object.keys(g).length===0||D(g)},[g]);const N=o=>{const z=f({},e),C=f({},j);C[o.target.name]="",z[o.target.name]=o.target.value,A(C),i(z)},P=()=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),u(2),Q(a,e,i,c,r)};return t.jsxs("div",{className:"btcd-stp-page",style:{width:h===1&&900,height:h===1&&"auto"},children:[t.jsx(W,{linkKey:"googleSheet"}),m==="Custom Authorization"&&t.jsxs("div",{children:[t.jsx("div",{className:"mt-3",children:t.jsx("b",{children:s("Integration Name:","bit-integrations")})}),t.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:N,name:"name",value:e.name,type:"text",placeholder:s("Integration Name...","bit-integrations"),disabled:d}),t.jsx("div",{className:"mt-3",children:t.jsx("b",{children:s("Homepage URL:","bit-integrations")})}),t.jsx(I,{value:`${window.location.origin}`,className:"field-key-cpy w-6 ml-0",setSnackbar:r}),t.jsx("div",{className:"mt-3",children:t.jsx("b",{children:s("Authorized Redirect URIs:","bit-integrations")})}),t.jsx(I,{value:n||`${y.api}/redirect`,className:"field-key-cpy w-6 ml-0",setSnackbar:r}),t.jsxs("small",{className:"d-blk mt-5",children:[s("To get Client ID and SECRET , Please Visit","bit-integrations")," ",t.jsx("a",{className:"btcd-link",href:"https://console.developers.google.com/apis/credentials",target:"_blank",rel:"noreferrer",children:s("Google API Console","bit-integrations")})]}),t.jsx("div",{className:"mt-3",children:t.jsx("b",{children:s("Client id:","bit-integrations")})}),t.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:N,name:"clientId",value:e.clientId,type:"text",placeholder:s("Client id...","bit-integrations"),disabled:d}),t.jsx("div",{style:{color:"red",fontSize:"15px"},children:j.clientId}),t.jsx("div",{className:"mt-3",children:t.jsx("b",{children:s("Client secret:","bit-integrations")})}),t.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:N,name:"clientSecret",value:e.clientSecret,type:"text",placeholder:s("Client secret...","bit-integrations"),disabled:d}),t.jsx("div",{style:{color:"red",fontSize:"15px"},children:j.clientSecret}),t.jsxs("button",{onClick:()=>v(m),className:"btn btcd-btn-lg purple sh-sm flx",type:"button",disabled:l||d,children:[x||d?s("Authorized ✔","bit-integrations"):s("Authorize","bit-integrations"),l&&t.jsx(E,{size:20,clr:"#022217",className:"ml-2"})]}),t.jsx("br",{})]}),l&&m!=="Custom Authorization"&&t.jsx(q,{style:{display:"flex",justifyContent:"center",alignItems:"center",height:100,transform:"scale(0.7)"}}),x&&m==="One Click Authorization"&&t.jsxs("button",{onClick:()=>v(),className:"btn btcd-btn-lg purple sh-sm flx",type:"button",disabled:l,children:[x?s("Authorized ✔","bit-integrations"):s("Authorize","bit-integrations"),l&&t.jsx(E,{size:20,clr:"#022217",className:"ml-2"})]}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>P(),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",disabled:!x,children:[s("Next","bit-integrations"),t.jsx(F,{className:"ml-1 rev-icn"})]})]})}export{rt as default};
