var S=Object.defineProperty;var y=Object.getOwnPropertySymbols;var L=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable;var j=(i,a,e)=>a in i?S(i,a,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[a]=e,d=(i,a)=>{for(var e in a||(a={}))L.call(a,e)&&j(i,e,a[e]);if(y)for(var e of y(a))w.call(a,e)&&j(i,e,a[e]);return i};import{j as t,_ as s,d as T}from"./main.2.8.1.js";import{d as p}from"./react-router-dom.9mCuUg3q.js";import{B as P}from"./BackIcn._kGL_vVw.js";import{z as k}from"./Note.BeM7sN-p.js";import{t as G}from"./tutorialLinks.kMkIDzcD.js";import{T as f}from"./TutorialLink.BAFX--T3.js";import"./CopyIcn.3gZpHton.js";function q({getgistConf:i,setGetgistConf:a,step:e,setstep:N,isInfo:h}){const[l,z]=p.useState(!1),[b,u]=p.useState({name:"",api_key:""}),[A,_]=p.useState(!1),[c,x]=p.useState(!1),{getgist:r}=G,v=()=>{const n=d({},i);if(!n.name||!n.api_key){u({name:n.name?"":s("Integration name can't be empty","bit-integrations"),api_key:n.api_key?"":s("API Key can't be empty","bit-integrations")});return}x("auth");const m={api_key:n.api_key};T(m,"getgist_authorize").then(o=>{o!=null&&o.success&&z(!0),_(!0),x(!1)})},g=n=>{const m=d({},i),o=d({},b);o[n.target.name]="",m[n.target.name]=n.target.value,u(o),a(m)},I=()=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),N(2)};return t.jsxs("div",{className:"btcd-stp-page",style:{width:e===1&&900,height:e===1&&"auto"},children:[t.jsx(f,{title:"GetGist",youTubeLink:r==null?void 0:r.youTubeLink}),t.jsx(f,{title:"GetGist",docLink:r==null?void 0:r.docLink}),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:g,name:"name",value:i.name,type:"text",placeholder:s("Integration Name...","bit-integrations"),disabled:h}),t.jsx("div",{style:{color:"red",fontSize:"15px"},children:b.name}),t.jsx("div",{className:"mt-3",children:t.jsx("b",{children:s("API Key:","bit-integrations")})}),t.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:g,name:"api_key",value:i.api_key,type:"text",placeholder:s("Integration Name...","bit-integrations"),disabled:h}),t.jsx("div",{style:{color:"red",fontSize:"15px"},children:b.api_key}),t.jsxs("small",{className:"d-blk mt-5",children:[s("To get API , Please Visit","bit-integrations")," ",t.jsx("a",{className:"btcd-link",href:"https://app.getgist.com/projects/jgmmrszy/settings/api-key",target:"_blank",rel:"noreferrer",children:s("Getgist API Console","bit-integrations")})]}),c==="auth"&&t.jsxs("div",{className:"flx mt-5",children:[t.jsx(k,{size:25,clr:"#022217",className:"mr-2"}),s("Checking API Key!!!","bit-integrations")]}),A&&!l&&!c&&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:"×"}),s("Sorry, Api key is invalid","bit-integrations")]}),!h&&t.jsxs(t.Fragment,{children:[t.jsxs("button",{onClick:v,className:"btn btcd-btn-lg purple sh-sm flx",type:"button",disabled:l||c,children:[l?s("Authorized ✔","bit-integrations"):s("Authorize","bit-integrations"),c&&t.jsx(k,{size:20,clr:"#022217",className:"ml-2"})]}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>I(),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",disabled:!l,children:[s("Next","bit-integrations"),t.jsx(P,{className:"ml-1 rev-icn"})]})]})]})}export{q as default};
