1import{a as g,j as e}from"./vendor-query-skQMsM6X.js";import{r}from"./vendor-react-DyYvSSk1.js";import{u as j,p as _,S as v}from"./useSystemSettingsMap-DgE5Yhb8.js";import{at as b,au as N,av as y,ab as C,ax as S,aq as n,aL as w,I as i,p as k,b as E,c as x}from"./index-BGwtrXIa.js";import{bl as I,L as f,af as F,bp as A}from"./vendor-ui-CCmu0bzQ.js";import"./vendor-supabase-BfoV2C50.js";const p={contract_address:"0x93C667E4ad2e9827e494B90Cdf138Ecbf1d84e49",chain_id:84532,platform_fee_bps:250,platform_fee_recipient:"0xCFa8d642bA3b6cA206A3951d4801dDc04d96fE8E",enabled:!0},P=()=>{const o=g(),[d,m]=r.useState(!1),[s,t]=r.useState(p),{data:c,isLoading:u}=j(),l=r.useMemo(()=>{if(!c)return;const a=_(c.get("marketplace_v3_config"));return a?{...p,...a}:null},[c]);r.useEffect(()=>{l&&t(l)},[l]);const h=async()=>{m(!0);try{const{error:a}=await E.from("system_settings").upsert({setting_key:"marketplace_v3_config",setting_value:s,updated_at:new Date().toISOString()},{onConflict:"setting_key"});if(a)throw a;x.success("Configuração do MarketplaceV3 salva!"),o.invalidateQueries({queryKey:["marketplace-v3-config"]}),o.invalidateQueries({queryKey:v})}catch(a){x.error("Erro ao salvar: "+(a.message||"desconhecido"))}finally{m(!1)}};return e.jsxs(b,{children:[e.jsxs(N,{className:"flex flex-row items-center justify-between pb-2",children:[e.jsxs(y,{className:"text-base font-mono flex items-center gap-2",children:[e.jsx(I,{className:"h-4 w-4 text-primary"})," MarketplaceV3 (P2P Trading)"]}),e.jsx(C,{variant:s.enabled?"default":"secondary",children:s.enabled?"Ativo":"Inativo"})]}),e.jsx(S,{className:"space-y-4",children:u?e.jsx("div",{className:"flex justify-center py-4",children:e.jsx(f,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(n,{className:"text-sm",children:"Habilitado"}),e.jsx(w,{checked:s.enabled,onCheckedChange:a=>t({...s,enabled:a})})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(n,{className:"text-xs font-mono",children:"Contract Address"}),e.jsx(i,{value:s.contract_address,onChange:a=>t({...s,contract_address:a.target.value}),placeholder:"0x...",className:"font-mono text-xs"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(n,{className:"text-xs font-mono",children:"Chain ID"}),e.jsx(i,{type:"number",value:s.chain_id,onChange:a=>t({...s,chain_id:parseInt(a.target.value,10)||84532}),className:"font-mono text-xs"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(n,{className:"text-xs font-mono",children:"Platform Fee (bps)"}),e.jsx(i,{type:"number",value:s.platform_fee_bps,onChange:a=>t({...s,platform_fee_bps:parseInt(a.target.value,10)||0}),className:"font-mono text-xs",min:0,max:1e4}),e.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[(s.platform_fee_bps/100).toFixed(2),"%"]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(n,{className:"text-xs font-mono",children:"Fee Recipient"}),e.jsx(i,{value:s.platform_fee_recipient,onChange:a=>t({...s,platform_fee_recipient:a.target.value}),placeholder:"0x...",className:"font-mono text-xs"})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2",children:[e.jsxs("a",{href:`https://thirdweb.com/${s.chain_id}/${s.contract_address}`,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline flex items-center gap-1",children:["Ver no Thirdweb ",e.jsx(F,{className:"h-3 w-3"})]}),e.jsxs(k,{size:"sm",onClick:h,disabled:d,className:"gap-1.5",children:[d?e.jsx(f,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(A,{className:"h-3.5 w-3.5"}),"Salvar"]})]})]})})]})};export{P as MarketplaceV3ConfigSection};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.