1import{_ as E}from"./BDZsAkX8.js";import{g as K,A as R,E as j,G,c as n,a as t,t as l,n as x,d as y,s as b,B as q,v as S,F as k,r as C,H as Q,w as H,m as A,I as J,y as W,p as i,C as Y,o}from"./DDfpvU8e.js";import{d as Z}from"./DCv7H5HJ.js";import{s as X}from"./mYSspDoh.js";import{u as ee}from"./DzDuzV2W.js";const te={class:"mx-auto max-w-5xl space-y-6"},se={key:0,role:"alert",class:"zw-panel p-4"},le={class:"grid gap-4 sm:grid-cols-2"},ae={class:"grid gap-4 sm:grid-cols-2"},oe={class:"block"},ne=["value"],ie={class:"flex items-start gap-2 text-sm"},ue=["disabled"],re={class:"zw-panel space-y-4 p-5"},de={key:0,class:"zw-muted"},ce={class:"flex flex-wrap justify-between gap-3"},ve={class:"text-sm"},me={key:0,class:"break-all font-mono text-xs"},pe={class:"zw-muted text-xs"},ye=["disabled","onClick"],be={class:"zw-panel space-y-4 p-5"},ke={class:"flex flex-wrap items-center justify-between gap-3"},we=["disabled"],fe={class:"font-semibold"},ge={class:"break-all font-mono text-xs"},xe={class:"flex flex-wrap gap-2"},_e=["onClick"],Ce=["disabled","onClick"],ze={key:0,class:"space-y-2 border-t pt-3 text-sm",style:{"border-color":"var(--skin-border)"}},Ie={class:"break-all"},Pe={class:"zw-muted"},De=K({__name:"venues",setup(he){const{orgId:D,request:d,message:B}=ee(),r=i("polymarket_us"),w=i(""),v=i(""),m=i(""),z=i(""),c=i(!1),p=i(!1),_=i(""),I=i([]),U=i([]),P=i([]),u=i(null),V=i(""),$=Y(()=>U.value.filter(a=>a.kind==="dedicated"&&a.chain_id===137));async function h(){const[a,e]=await Promise.all([d("/connections"),d("/wallets")]);I.value=a.connections,U.value=e.wallets}async function f(a){_.value="",p.value=!0;try{await a()}catch(e){_.value=B(e)}finally{p.value=!1}}async function M(){await f(async()=>{if(r.value==="polymarket_us"){const{publicKey:a}=await d("/signer"),e=await X(JSON.stringify({keyId:v.value.trim(),secretKey:m.value.trim()}),a);await d("/connections","POST",{venue:r.value,label:w.value,sealedCredentials:e,eligibilityConfirmed:c.value}),v.value="",m.value=""}else await d("/connections","POST",{venue:r.value,label:w.value,walletId:z.value,eligibilityConfirmed:c.value});c.value=!1,w.value="",await h()})}async function T(a){await f(async()=>{await d(`/connections/${a}/refresh`,"POST",{}),await h()})}async function N(){await f(async()=>{P.value=(await d(`/markets?venue=${r.value}`)).markets})}async function L(a,e){await f(async()=>{u.value=(await d(`/quote?venue=${r.value}&market=${encodeURIComponent(a)}&token=${encodeURIComponent(e)}`)).quote})}async function O(a){await navigator.clipboard.writeText(a),V.value=a}return R(r,()=>{P.value=[],u.value=null,c.value=!1,v.value="",m.value=""}),j(()=>{f(h)}),G(()=>{m.value="",v.value=""}),(a,e)=>{const F=E;return o(),n("div",te,[e[22]||(e[22]=t("header",null,[t("h1",{class:"text-2xl font-semibold"},"Markets & venues"),t("p",{class:"zw-muted mt-2"},"Connect your own eligible account, explore markets, then allocate capital to a mission.")],-1)),_.value?(o(),n("p",se,l(_.value),1)):x("",!0),t("form",{class:"zw-panel space-y-4 p-5",onSubmit:W(M,["prevent"])},[e[18]||(e[18]=t("h2",{class:"text-lg font-semibold"},"Connect a venue",-1)),t("div",le,[t("label",null,[e[7]||(e[7]=y("Venue",-1)),b(t("select",{"onUpdate:modelValue":e[0]||(e[0]=s=>r.value=s),"aria-label":"Venue",class:"zw-input mt-1 block w-full"},[...e[6]||(e[6]=[t("option",{value:"polymarket_us"},"Polymarket US",-1),t("option",{value:"polymarket_international"},"Polymarket International",-1)])],512),[[q,r.value]])]),t("label",null,[e[8]||(e[8]=y("Connection name",-1)),b(t("input",{"onUpdate:modelValue":e[1]||(e[1]=s=>w.value=s),class:"zw-input mt-1 block w-full",required:"",maxlength:"120"},null,512),[[S,w.value]])])]),r.value==="polymarket_us"?(o(),n(k,{key:0},[e[11]||(e[11]=t("p",{class:"zw-muted text-sm"},"Use API credentials from your verified personal Polymarket US account. USD and any deposits or withdrawals stay in that account. ZergWallet does not connect to your bank.",-1)),t("div",ae,[t("label",null,[e[9]||(e[9]=y("API key ID",-1)),b(t("input",{"onUpdate:modelValue":e[2]||(e[2]=s=>v.value=s),autocomplete:"off",class:"zw-input mt-1 block w-full",required:""},null,512),[[S,v.value]])]),t("label",null,[e[10]||(e[10]=y("API
1secret",-1)),b(t("input",{"onUpdate:modelValue":e[3]||(e[3]=s=>m.value=s),type:"password",autocomplete:"new-password",class:"zw-input mt-1 block w-full",required:""},null,512),[[S,m.value]])])]),e[12]||(e[12]=t("a",{href:"https://polymarket.us/developer",target:"_blank",rel:"noopener noreferrer",class:"text-sm underline"},"Get your Polymarket US API credentials",-1))],64)):(o(),n(k,{key:1},[e[16]||(e[16]=t("p",{class:"zw-muted text-sm"},"Use a dedicated Polygon wallet with a verified recovery file. Your trading account uses that address. International access depends on your eligibility and the service location. Orders currently rest on the book as maker orders.",-1)),t("label",oe,[e[14]||(e[14]=y("Dedicated Polygon wallet",-1)),b(t("select",{"onUpdate:modelValue":e[4]||(e[4]=s=>z.value=s),class:"zw-input mt-1 block w-full",required:""},[e[13]||(e[13]=t("option",{value:"",disabled:""},"Choose a wallet",-1)),(o(!0),n(k,null,C($.value,s=>(o(),n("option",{key:s.id,value:s.id},l(s.label)+" · "+l(s.address),9,ne))),128))],512),[[q,z.value]])]),$.value.length?x("",!0):(o(),Q(F,{key:0,to:`/orgs/${A(D)}/wallets`,class:"text-sm underline"},{default:H(()=>[...e[15]||(e[15]=[y("Create a recoverable Polygon wallet",-1)])]),_:1},8,["to"]))],64)),t("label",ie,[b(t("input",{"onUpdate:modelValue":e[5]||(e[5]=s=>c.value=s),type:"checkbox",required:"",class:"mt-1"},null,512),[[J,c.value]]),e[17]||(e[17]=t("span",null,"I own this account and am eligible to use this venue under its current account and location rules.",-1))]),t("button",{class:"zw-button",disabled:p.value||!c.value},"Verify and connect",8,ue)],32),t("section",re,[e[19]||(e[19]=t("h2",{class:"text-lg font-semibold"},"Connected accounts",-1)),I.value.length?x("",!0):(o(),n("p",de,"No venue accounts connected.")),(o(!0),n(k,null,C(I.value,s=>(o(),n("article",{key:s.id,class:"space-y-2 border-t pt-3",style:{"border-color":"var(--skin-border)"}},[t("div",ce,[t("strong",null,l(s.label),1),t("span",null,l(s.state),1)]),t("p",ve,l(s.venue==="polymarket_us"?"Polymarket US":"Polymarket International")+" · Available: $"+l(A(Z)(BigInt(s.available_micros))),1),s.account_address?(o(),n("p",me,l(s.account_address),1)):x("",!0),t("p",pe,"Verified "+l(s.verified_at?new Date(s.verified_at).toLocaleString():"never"),1),t("button",{class:"zw-button",disabled:p.value,onClick:g=>T(s.id)},"Refresh account",8,ye)]))),128))]),t("section",be,[t("div",ke,[e[20]||(e[20]=t("h2",{class:"text-lg font-semibold"},"Explore markets",-1)),t("button",{class:"zw-button",disabled:p.value,onClick:N},"Load markets",8,we)]),e[21]||(e[21]=t("p",{class:"zw-muted text-sm"},"Copy market IDs into your missionâs allowed markets. A market listing does not authorize trades.",-1)),(o(!0),n(k,null,C(P.value,s=>(o(),n("article",{key:s.market,class:"space-y-2 border-t pt-3",style:{"border-color":"var(--skin-border)"}},[t("h3",fe,l(s.title),1),t("p",ge,l(s.market),1),t("div",xe,[t("button",{class:"zw-button",onClick:g=>O(s.market)},l(V.value===s.market?"Copied":"Copy market ID"),9,_e),(o(!0),n(k,null,C(s.tokens,g=>(o(),n("button",{key:g.id,class:"zw-button",disabled:p.value,onClick:Se=>L(s.market,g.id)},l(g.outcome)+" quote",9,Ce))),128))])]))),128)),u.value?(o(),n("div",ze,[t("p",Ie,l(u.value.market)+" · "+l(u.value.token),1),t("p",null,"Bid $"+l(u.value.bid)+" · Ask $"+l(u.value.ask),1),t("p",null,"Available at ask: "+l(u.value.askSize)+" shares · Minimum: "+l(u.value.minimumQuantity),1),t("p",Pe,"Fees reserved conservatively; execution records actual charges. Quoted "+l(new Date(u.value.observedAt).toLocaleTimeString())+".",1)])):x("",!0)])])}}});export{De as default};
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.