import{i as e,n as t}from"./rolldown-runtime-BKYq3fBv.js";import{Jr as n,Nn as r,Xn as i,Yr as a}from"./vendor-primevue-D50rA9nL.js";import{an as o,i as s,in as c,on as l,r as u,sn as d}from"./api-z_dXWY_S.js";import{i as f,n as p,r as m}from"./remoteConfig-BXkMU0oz.js";import{r as h,s as g}from"./i18n-ZU7-AXHi.js";function useFeatureFlags(){let e=n({get supportsPreviewMetadata(){return u.getServerFeature(_.SUPPORTS_PREVIEW_METADATA)},get maxUploadSize(){return u.getServerFeature(_.MAX_UPLOAD_SIZE)},get supportsManagerV4(){return u.getServerFeature(_.MANAGER_SUPPORTS_V4)},get modelUploadButtonEnabled(){return f.value.model_upload_button_enabled??u.getServerFeature(_.MODEL_UPLOAD_BUTTON_ENABLED,!1)},get assetDeletionEnabled(){return f.value.asset_deletion_enabled??u.getServerFeature(_.ASSET_DELETION_ENABLED,!1)},get assetRenameEnabled(){return f.value.asset_rename_enabled??u.getServerFeature(_.ASSET_RENAME_ENABLED,!1)},get privateModelsEnabled(){return f.value.private_models_enabled??u.getServerFeature(_.PRIVATE_MODELS_ENABLED,!1)},get onboardingSurveyEnabled(){return f.value.onboarding_survey_enabled??u.getServerFeature(_.ONBOARDING_SURVEY_ENABLED,!0)},get huggingfaceModelImportEnabled(){return f.value.huggingface_model_import_enabled??u.getServerFeature(_.HUGGINGFACE_MODEL_IMPORT_ENABLED,!1)},get linearToggleEnabled(){return f.value.linear_toggle_enabled??u.getServerFeature(_.LINEAR_TOGGLE_ENABLED,!1)},get asyncModelUploadEnabled(){return f.value.async_model_upload_enabled??u.getServerFeature(_.ASYNC_MODEL_UPLOAD_ENABLED,!1)},get teamWorkspacesEnabled(){return!d||!m.value?!1:f.value.team_workspaces_enabled??u.getServerFeature(_.TEAM_WORKSPACES_ENABLED,!1)}}),featureFlag=(e,t)=>i(()=>u.getServerFeature(e,t));return{flags:a(e),featureFlag}}var _,v=t((()=>{r(),l(),p(),s(),_=function(e){return e.SUPPORTS_PREVIEW_METADATA=`supports_preview_metadata`,e.MAX_UPLOAD_SIZE=`max_upload_size`,e.MANAGER_SUPPORTS_V4=`extension.manager.supports_v4`,e.MODEL_UPLOAD_BUTTON_ENABLED=`model_upload_button_enabled`,e.ASSET_DELETION_ENABLED=`asset_deletion_enabled`,e.ASSET_RENAME_ENABLED=`asset_rename_enabled`,e.PRIVATE_MODELS_ENABLED=`private_models_enabled`,e.ONBOARDING_SURVEY_ENABLED=`onboarding_survey_enabled`,e.HUGGINGFACE_MODEL_IMPORT_ENABLED=`huggingface_model_import_enabled`,e.LINEAR_TOGGLE_ENABLED=`linear_toggle_enabled`,e.ASYNC_MODEL_UPLOAD_ENABLED=`async_model_upload_enabled`,e.TEAM_WORKSPACES_ENABLED=`team_workspaces_enabled`,e}({})}));function useErrorHandling(){let e=o(),toastErrorHandler=t=>{e.add({severity:`error`,summary:g(`g.error`),detail:t instanceof Error?t.message:g(`g.unknownError`)}),console.error(t)},wrapWithErrorHandling=(e,t,n)=>(...r)=>{try{return e(...r)}catch(e){(t??toastErrorHandler)(e)}finally{n?.()}},wrapWithErrorHandlingAsync=(e,t,n,r=[])=>async(...i)=>{try{return await e(...i)}catch(n){for(let t of r)if(t.shouldHandle(n))try{await t.recover(n,e,i);return}catch(e){console.error(`Recovery strategy failed:`,e)}(t??toastErrorHandler)(n)}finally{n?.()}};return{wrapWithErrorHandling,wrapWithErrorHandlingAsync,toastErrorHandler}}var y=t((()=>{h(),c()}));export{useFeatureFlags as i,useErrorHandling as n,v as r,y as t};
//# sourceMappingURL=useErrorHandling-Dt_X40fr.js.map