import{r as c}from"./index-TmnhPDhN.js";const m=(...t)=>t.filter((e,r,o)=>!!e&&e.trim()!==""&&o.indexOf(e)===r).join(" ").trim();const g=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const w=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,r,o)=>o?o.toUpperCase():r.toLowerCase());const h=t=>{const e=w(t);return e.charAt(0).toUpperCase()+e.slice(1)};var C={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const S=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1};const k=c.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:s="",children:a,iconNode:l,...n},i)=>c.createElement("svg",{ref:i,...C,width:e,height:e,stroke:t,strokeWidth:o?Number(r)*24/Number(e):r,className:m("lucide",s),...!a&&!S(n)&&{"aria-hidden":"true"},...n},[...l.map(([p,u])=>c.createElement(p,u)),...Array.isArray(a)?a:[a]]));const A=(t,e)=>{const r=c.forwardRef(({className:o,...s},a)=>c.createElement(k,{ref:a,iconNode:e,className:m(`lucide-${g(h(t))}`,`lucide-${t}`,o),...s}));return r.displayName=h(t),r};const y=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],$=A("loader-circle",y),E="/assets/MS-Bqlvf8Cm.png",L="https://api.mithusiyan.store/api";async function P(t,{body:e,params:r,...o}={}){const s=localStorage.getItem("auth_token");let a="";if(r){const u=new URLSearchParams;Object.entries(r).forEach(([f,d])=>{d!=null&&d!==""&&u.append(f,d.toString())}),a="?"+u.toString()}const l={"Content-Type":"application/json",Accept:"application/json"};s&&(l.Authorization=`Bearer ${s}`);const n={method:e?"POST":"GET",...o,headers:{...l,...o.headers}};e&&(n.body=JSON.stringify(e));const i=await fetch(`${L}${t}${a}`,n);if(i.status===401)return localStorage.removeItem("auth_token"),localStorage.removeItem("user_role"),window.location.href="/login",Promise.reject({message:"Unauthorized"});const p=await i.json();return i.ok?p:Promise.reject(p)}export{$ as L,P as a,A as c,E as l};
