import{t as e}from"./i18n-jmtZ2Bqk.js";var t=`http://localhost:8787`,n=1e4,r=2e3;async function i(r,{method:i=`POST`,body:a=null,timeoutMs:o=n}={}){let s=new AbortController,c=setTimeout(()=>s.abort(),o+2e3);try{return await(await fetch(t+r,{method:i,headers:a?{"Content-Type":`application/json`}:void 0,body:a?JSON.stringify(a):void 0,signal:s.signal})).json().catch(()=>null)||{success:!1,message:e.t(`BridgeBadReply`)}}catch(t){return t.name===`AbortError`?{success:!1,message:e.t(`BridgeTimeout`)}:{success:!1,offline:!0,message:e.t(`BridgeUnreachable`)}}finally{clearTimeout(c)}}function a(){return i(`/status`,{method:`GET`,timeoutMs:r})}async function o(){let e=await a();return{online:!!e.success,...e}}function s(){return i(`/reconnect`,{timeoutMs:r})}function c({timeoutMs:e=n,image:t=!0}={}){return i(`/capture`,{body:{timeoutMs:e,image:t},timeoutMs:e})}var l=45e3;function u({timeoutMs:e=l}={}){return i(`/enroll`,{body:{timeoutMs:e},timeoutMs:e})}function d(){return i(`/enroll/cancel`,{timeoutMs:r})}function f(e,{timeoutMs:t=n}={}){return i(`/verify`,{body:{template:e,timeoutMs:t},timeoutMs:t})}function p(e){return i(`/db/load`,{body:{templates:e},timeoutMs:15e3})}function m({timeoutMs:e=n}={}){return i(`/identify`,{body:{timeoutMs:e},timeoutMs:e})}var h={status:a,isOnline:o,reconnect:s,capture:c,enroll:u,cancelEnroll:d,verify:f,loadTemplates:p,identify:m,BRIDGE_URL:t};export{h as t};