1import{r as d}from"./app-sHYn2X7e.js";function m(t){return{...t,message:t.message??t.reason}}function b(t){return t.errors&&typeof t.errors=="object"?t.errors:null}function O(t){const a=b(t);if(!a)return"";const s=Object.values(a).flat().at(0);return typeof s=="string"?s:""}function f(t){return t.message??""}const S=f,U={medico:{login:"/api/auth/medico/login",recuperarSenha:"/api/auth/medico/recuperar-senha",register:"/api/auth/medico/register",verify:"/api/auth/medico/verify"},paciente:{checkCpf:"/api/auth/paciente/check-cpf",login:"/api/auth/paciente/login",protocolo:"/api/auth/paciente/protocolo",recuperarSenha:"/api/auth/paciente/recuperar-senha",register:"/api/auth/paciente/register"}};function R(){var t;return((t=document.querySelector('meta[name="csrf-token"]'))==null?void 0:t.getAttribute("content"))??""}function y(t,a="POST"){return{method:a,headers:{"content-type":"application/json","x-csrf-token":R()},body:JSON.stringify(t)}}function T(t,a,s="POST"){return fetch(t,y(a,s)).then(r=>r.json()).then(r=>m(r))}function j(t,a,s="POST"){return fetch(t,y(a,s)).then(async r=>{const u=r.headers.get("content-type")||"";if(u.includes("application/json")){const n=await r.json();return m(n)}const p=(r.headers.get("content-disposition")||"").match(/filename\*?=(?:UTF-8'')?["']?([^"';\n]+)["']?/i),h=p?decodeURIComponent(p[1].trim()):"download",l=await r.blob(),e=URL.createObjectURL(l),o=window.open("","_blank");if(u.startsWith("image/")||u==="application/pdf")o.location.href=e;else{const n=o.document.createElement("a");n.href=e,n.download=h,o.document.body.appendChild(n),n.click()}return setTimeout(()=>URL.revokeObjectURL(e),1e4),{success:!0}})}function k({response:t,onFieldErrors:a,onError:s,onSuccess:r}){const u=b(t);if(u){a==null||a(u);return}const i=S(t);if(i&&!t.success){s==null||s(i);return}t.success&&(r==null||r(t))}function A(){const[t,a]=d.useState(!1),[s,r]=d.useState({}),[u,i]=d.useState("");async function p(h,l,e){a(!0),i(""),r({});try{const o=e!=null&&e.stream?await j(h,l):await T(h,l);return k({response:o,onFieldErrors:n=>{var c;r(n),(c=e==null?void 0:e.onFieldErrors)==null||c.call(e,n,o)},onError:n=>{var c;i(n),(c=e==null?void 0:e.onError)==null||c.call(e,n,o)},onSuccess:n=>{var c;(c=e==null?void 0:e.onSuccess)==null||c.call(e,n)}}),o}catch{return i(""),{success:!1}}finally{a(!1)}}return{isSubmitting:t,errors:s,error:u,setError:i,setErrors:r,send:p}}export{U as a,O as g,A as u};
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.