1import{a as e}from"./rolldown-runtime-BEU_UCik.js";import{n as a,r as n}from"./vendor-auth-DAuWozuU.js";import{a as t,n as i}from"./vendor-query-Ct_3YD9H.js";import{t as r}from"./axiosInstance-DrZDrJAX.js";var s=e(n()),o={getProfile:e=>r.get("/profile",{signal:e}).then(e=>e.data),getFavorites:e=>r.get("/favorites/",{signal:e}).then(e=>e.data),toggleFavorite:(e,a)=>r.post("/favorites/",{content_type:e,object_uuid:a}).then(e=>e.data),createPersonalApiKey:e=>r.post("/users/personal-api-keys/",e?{name:e}:{}).then(e=>e.data),listPersonalApiKeys:e=>r.get("/users/personal-api-keys/",{signal:e}).then(e=>e.data),revokePersonalApiKey:e=>r.delete(`/users/personal-api-keys/${e}/`).then(e=>e.data),getPersonalApiKeyActivity:(e,a)=>r.get(`/users/personal-api-keys/${e}/activity/`,{signal:a}).then(e=>e.data)},l=t(),_={isLoading:!0,is_internal:!1,is_internal_admin:!1,genti_role:"",has_personal_api_key:!1},p=(0,s.createContext)(_);function d({children:e}){const{isAuthenticated:n,isLoading:t}=a(),{data:r,isPending:d,fetchStatus:g,refetch:u}=i({queryKey:["user-profile"],queryFn:({signal:e})=>o.getProfile(e).then(e=>function(e){const{genti_role:a,is_internal:n,is_internal_admin:t,has_personal_api_key:i}=e;return{genti_role:a,is_internal:n,is_internal_admin:t,has_personal_api_key:Boolean(i)}}(e||{})),enabled:!t&&n,staleTime:1/0}),h=(0,s.useCallback)(async()=>{const e=await u();if(e.isError)throw e.error;return{genti_role:e.data?.genti_role}},[u]),y=t||d&&"idle"!==g,{is_internal:c,is_internal_admin:m,genti_role:f,has_personal_api_key:v}=(n?r:void 0)??_,k=(0,s.useMemo)(()=>({is_internal:c,is_internal_admin:m,isLoading:y,genti_role:f,has_personal_api_key:v,refetch:h}),[y,h,c,m,f,v]);return(0,l.jsx)(p.Provider,{value:k,children:e})}var g=()=>(0,s.useContext)(p);export{g as n,o as r,d as t};
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.