PageSourceSearch

https://www.hilma.ai/_next/static/chunks/5638-5d33a51229bdced8.js

js hilma.ai collected 2026-10-05 14:35:06 UTC 124,988 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5638],{42:(e,a,t)=>{t.d(a,{rV:()=>B,Fx:()=>H,j_:()=>q});var i=t(535),o=t(623),n=t(3979),s=t(5799);let r=(e,a)=>({selectedImageId:null,lastClickTime:0,isDeletingImageId:null,mostRecentGeneratedImageId:null,pollingEnabled:!1,isDeleting:()=>null!==a().isDeletingImageId,setSelectedImageId:a=>e({selectedImageId:a}),handleImageSelect:a=>{(null==a?void 0:a.id)&&e({selectedImageId:a.id})},setDeletionState:(a,t)=>{t&&a?(e({isDeletingImageId:a}),setTimeout(()=>{e({isDeletingImageId:null})},1e4)):e({isDeletingImageId:null})},clearDeletionState:()=>e({isDeletingImageId:null}),setMostRecentGeneratedImageId:a=>{e({mostRecentGeneratedImageId:a}),a&&setTimeout(()=>{e({mostRecentGeneratedImageId:null})},3e3)},setPollingEnabled:a=>e({pollingEnabled:a}),setLastClickTime:a=>e({lastClickTime:a}),resetAllState:()=>e({selectedImageId:null,lastClickTime:0,isDeletingImageId:null,mostRecentGeneratedImageId:null,pollingEnabled:!1})});var l=t(7953),d=t(7680),m=t(9461),g=t(2052);let u={selectedModel:null,userModels:[],isLoadingModels:!1,isModelSelectionView:!0,_preventParameterRestore:!1,_isPendingChainClear:!1,_isPendingParameterReset:!1,_preventSubmissionParamRestore:!1},c=(e,a)=>({...u,setSelectedModel:a=>{e(e=>{var t,i,o,n,s,r,u,c,p,h,f,b,v;let I;let y=(null===(t=e.workbench)||void 0===t?void 0:t.activeImageId)||(null===(i=e.workbench)||void 0===i?void 0:i.previewImageId),k=(null===(n=e.workbench)||void 0===n?void 0:null===(o=n.currentPromptChain)||void 0===o?void 0:o.length)>0,w=l.FW.includes(a.id);m.V.debug("ModelSlice","Model switch context:",{modelId:a.id,hasImageContext:y,hasPromptHistory:k,isInpaintModel:w,activeImageId:null===(s=e.workbench)||void 0===s?void 0:s.activeImageId,previewImageId:null===(r=e.workbench)||void 0===r?void 0:r.previewImageId,currentParams:e.parameters});let x=(0,d.vO)(a.id);if(y||k)m.V.debug("ModelSlice","Using full model defaults (has existing content)"),I=x({},a.defaultParams||{});else{m.V.debug("ModelSlice","Cleaning model defaults for fresh session");let e={...a.defaultParams};e.image="",e.input_image="",e.mask="",e.image_prompt="",I=x({},e)}if(w&&(I.image="",I.input_image="",I.mask="",I.image_prompt="",g.N)){let t=(null===(f=e.workbench)||void 0===f?void 0:f.previewImageId)||(null===(b=e.workbench)||void 0===b?void 0:b.activeImageId);if(t){let i=null===(v=e.generatedImages)||void 0===v?void 0:v.find(e=>e.id===t);if(null==i?void 0:i.url){let e=(0,l.rn)(a.id);I[e]=i.url,m.V.debug("ModelSlice","Auto-populated ".concat(e," with URL from active image"))}}}let _=null===(u=e.workbench)||void 0===u?void 0:u.currentPromptChain;w&&!y&&(null==_?void 0:_.length)>0&&(m.V.debug("ModelSlice","Clearing image/mask from prompts in chain"),_=_.map(e=>({...e,parameters:{...e.parameters,image:"",input_image:"",mask:"",image_prompt:""}})));let S=!y;return m.V.debug("ModelSlice","Setting new parameters:",I),{selectedModel:a,isModelSelectionView:!1,parameters:I,workbench:{...e.workbench,activeImageId:S?null:null===(c=e.workbench)||void 0===c?void 0:c.activeImageId,previewImageId:S?null:null===(p=e.workbench)||void 0===p?void 0:p.previewImageId,currentPromptChain:_||(null===(h=e.workbench)||void 0===h?void 0:h.currentPromptChain)},_preventParameterRestore:w}},!1,{type:"model/setSelected",id:a.id})},setSelectedModelIntentional:a=>{m.V.info("ModelSlice","Intentional model selection:",a.id),e(e=>({selectedModel:a,isModelSelectionView:!1,_isPendingChainClear:!0,_isPendingParameterReset:!0,_preventSubmissionParamRestore:!0,_preventParameterRestore:!1}),!1,{type:"model/setSelectedIntentional",id:a.id})},setSelectedModelWithImageContext:a=>{m.V.info("ModelSlice","Inpainting model selection with context preservation:",a.id),e(e=>{var t,i,o,n;let s=(null===(t=e.workbench)||void 0===t?void 0:t.previewImageId)||(null===(i=e.workbench)||void 0===i?void 0:i.activeImageId),r=null===(o=e.generatedImages)||void 0===o?void 0:o.find(e=>e.id===s);m.V.debug("ModelSlice","Context-aware model switch:",{modelId:a.id,effectiveImageId:s,hasCurrentImage:!!(null==r?void 0:r.url),isInpaintModel:l.FW.includes(a.id)});let u=(0,d.vO)(a.id)({},a.defaultParams||{});if(g.N&&l.FW.includes(a.id)&&(null==r?void 0:r.url)){let e=(0,l.rn)(a.id);u[e]=r.url,u.mask=null!==(n=u.mask)&&void 0!==n?n:"",m.V.info("ModelSlice","Auto-populated ".concat(e," with current image for ").concat(a.id))}return{selectedModel:a,isModelSelectionView:!1,parameters:u,_isPendingChainClear:!0,_isPendingParameterReset:!0,_preventSubmissionParamRestore:!0,_preventParameterRestore:!1}},!1,{type:"model/setSelectedWithImageContext",id:a.id})},setPendingChainClear:a=>{e(e=>({_isPendingChainClear:a}),!1,{type:"model/setPendingChainClear",value:a})},setPendingParameterReset:a=>{e(e=>({_isPendingParameterReset:a}),!1,{type:"model/setPendingParameterReset",value:a})},clearPendingChainClear:()=>{e(e=>({_isPendingChainClear:!1}))},clearPendingParameterReset:()=>{e(e=>({_isPendingParameterReset:!1}))},clearPreventSubmissionParamRestore:()=>{e(e=>({_preventSubmissionParamRestore:!1}))},setUserModels:a=>e({userModels:a}
1),setLoadingModels:a=>e({isLoadingModels:a}),clearPreventParameterRestore:()=>e({_preventParameterRestore:!1}),setIsModelSelectionView:a=>e({isModelSelectionView:a}),resetModelState:()=>e(e=>({selectedModel:null,isModelSelectionView:!0,_preventParameterRestore:!1,_isPendingChainClear:!1,_isPendingParameterReset:!1,parameters:{}}))}),p=(e,a)=>({parameters:{},isLoadingParameters:!1,setParameters:t=>{let i=a();if(i._preventParameterRestore){m.V.debug("ParametersSlice","Preventing parameter restore for inpaint model");let a={...t};return["image","input_image","mask","image_prompt"].forEach(e=>{a[e]?(m.V.debug("ParametersSlice","Filtering out ".concat(e,": ").concat(a[e])),a[e]=""):e in a||(a[e]="")}),e({parameters:a}),e({_preventParameterRestore:!1}),!0}let o=i.selectedModel;if(o&&l.FW.includes(o.id)){let a={...t};return["image","input_image","mask","image_prompt"].forEach(e=>{a[e]?a[e]="":e in a||(a[e]="")}),m.V.debug("ParametersSlice","Sanitized parameters for inpaint model:",Object.keys(a)),e({parameters:a}),!0}return e({parameters:t}),!0},updateParameters:a=>{e(e=>{let t={...e.parameters,...a};return Object.keys(t).every(a=>(function e(a,t){if(a===t)return!0;if(Array.isArray(a)&&Array.isArray(t)){if(a.length!==t.length)return!1;for(let i=0;i<a.length;i++)if(!e(a[i],t[i]))return!1;return!0}if(a&&t&&"object"==typeof a&&"object"==typeof t){let i=Object.keys(a),o=Object.keys(t);return i.length===o.length&&i.every(i=>e(a[i],t[i]))}return!1})(t[a],e.parameters[a]))?e:{parameters:t}})},setLoadingParameters:a=>{e({isLoadingParameters:a})},clearParameters:()=>{e({parameters:{}})}}),h={pendingFiles:new Map,uploadProgress:{},debugMode:!1},f=(e,a)=>{let t=function(e){for(var t=arguments.length,i=Array(t>1?t-1:0),o=1;o<t;o++)i[o-1]=arguments[o];a().debugMode&&console.log("[FileUploadSlice] ".concat(e),...i)};return{...h,registerFile:(a,i)=>{t("Registering file:",a,i.name),e(e=>{let t=new Map(e.pendingFiles);return t.set(a,i),{pendingFiles:t}})},removeFile:a=>{t("Removing file:",a),e(e=>{let t=new Map(e.pendingFiles);return t.delete(a),{pendingFiles:t}})},getFile:e=>a().pendingFiles.get(e),hasPendingFile:e=>a().pendingFiles.has(e),clearAllFiles:()=>{t("Clearing all pending files"),e({pendingFiles:new Map})},getAllPendingFiles:()=>Array.from(a().pendingFiles.entries()),setUploadProgress:(a,i)=>{t("Setting upload progress:",a,i),e(e=>({uploadProgress:{...e.uploadProgress,[a]:i}}))},clearUploadProgress:a=>{t("Clearing upload progress:",a),e(e=>{let t={...e.uploadProgress};return delete t[a],{uploadProgress:t}})},uploadPendingFiles:async e=>{t("Processing parameters for pending files:",e);let i={...e},o=[],n=a().pendingFiles;for(let[s,r]of Object.entries(e))if("string"==typeof r&&r.startsWith("pending-file:")){t("Found pending file reference: ".concat(s," = ").concat(r));let e=r.replace("pending-file:",""),l=n.get(e);l?(t("File found in registry, uploading: ".concat(s)),a().setUploadProgress(e,0),o.push(b(l,t=>{a().setUploadProgress(e,t)}).then(t=>(i[s]=t,a().removeFile(e),a().clearUploadProgress(e),{key:s,success:!0})).catch(t=>{throw console.error("Failed to upload file for ".concat(s,":"),t),a().clearUploadProgress(e),Error("Failed to upload ".concat(s,": ").concat(t.message))}))):(console.warn("No pending file found for parameter: ".concat(s,", removing from parameters")),delete i[s])}else if(Array.isArray(r)){t("Processing array parameter: ".concat(s),r);let e=[],l=[];for(let i=0;i<r.length;i++){let o=r[i];if("string"==typeof o&&o.startsWith("pending-file:")){t("Found pending file in array: ".concat(o));let s=o.replace("pending-file:",""),r=n.get(s);r?(t("File found in registry, uploading array item: ".concat(s)),a().setUploadProgress(s,0),l.push(b(r,e=>{a().setUploadProgress(s,e)}).then(t=>(e[i]=t,a().removeFile(s),a().clearUploadProgress(s),{index:i,success:!0})).catch(e=>{throw console.error("Failed to upload array file ".concat(s,":"),e),a().clearUploadProgress(s),Error("Failed to upload array file ".concat(s,": ").concat(e.message))}))):console.warn("No pending file found for array item: ".concat(o,", skipping"))}else e[i]=o}if(o.push(...l),l.length>0)i[s]=e;else{let a=e.filter(e=>null!=e);a.length>0?i[s]=a:delete i[s]}}return o.length>0&&(await Promise.all(o),t("Successfully uploaded ".concat(o.length," pending files"))),t("Final processed parameters:",i),i}}};async function b(e,a){try{let t=new FormData;t.append("file",e);let i=await fetch("/api/supabase/upload-user-image",{method:"POST",body:t});if(!i.ok){let e=await i.json();throw Error(e.error||"Upload failed")}let{url:o}=await i.json();return null==a||a(100),o}catch(e){throw console.error("File upload failed:",e),e}}let v={showSkeletons:{navigation:!1,sidebar:!1,gallery:!1,parameters:!1,featuredImage:!1,imageCards:!1},skeletonDelays:{navigation:150,gallery:300,parameters:200,featuredImage:250,imageCards:350},skeletonTimeouts:{},skeletonSettings:{autoHide:!0,autoHideDelay:1e4,fadeTransition:!0,respectPrefersReducedMotion:!0}
1},I=(e,a)=>({...v,setSkeletonVisibility:function(t,i){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return e(e=>{let{immediate:n=!1,delay:s=null}=o,r=a();if(r.skeletonTimeouts[t]&&clearTimeout(r.skeletonTimeouts[t]),i&&!n){var l;let e=setTimeout(()=>{a().setSkeletonVisibility(t,!0,{immediate:!0})},null!==(l=null!=s?s:r.skeletonDelays[t])&&void 0!==l?l:200);return{skeletonTimeouts:{...r.skeletonTimeouts,[t]:e}}}let d={...r.skeletonTimeouts};return delete d[t],{showSkeletons:{...e.showSkeletons,[t]:i},skeletonTimeouts:d}})},showAllSkeletons:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;(e||Object.keys(a().showSkeletons)).forEach(e=>{a().setSkeletonVisibility(e,!0)})},hideAllSkeletons:()=>e(e=>(Object.values(e.skeletonTimeouts).forEach(e=>{clearTimeout(e)}),{showSkeletons:Object.keys(e.showSkeletons).reduce((e,a)=>(e[a]=!1,e),{}),skeletonTimeouts:{}})),setSkeletonDelay:(a,t)=>e(e=>({skeletonDelays:{...e.skeletonDelays,[a]:t}})),updateSkeletonSettings:a=>e(e=>({skeletonSettings:{...e.skeletonSettings,...a}})),isSkeletonVisible:e=>a().showSkeletons[e]||!1,resetSkeletons:()=>e(v)}),y=(e,a)=>({activeDashboardTab:"general",setActiveDashboardTab:a=>e({activeDashboardTab:a}),isWorkbenchActive:()=>"workbench"===a().activeDashboardTab,isGeneralActive:()=>"general"===a().activeDashboardTab,resetDashboardTab:()=>e({activeDashboardTab:"general"})});var k=t(7928);let w={generatedImages:[],previewImagesById:{},selectedImageId:null,isDeletingImageId:null,mostRecentGeneratedImageId:null,pollingEnabled:!1,currentModelId:null,loadingInitialImages:!0,isCurrentlyLoading:!1,currentPage:1,hasMoreImages:!1,isLoadingMore:!1,totalImages:0,debugMode:!1},x=(e,a)=>({...w,setGeneratedImages:a=>e({generatedImages:a}),setSelectedImageId:a=>e({selectedImageId:a}),setIsDeletingImageId:a=>e({isDeletingImageId:a}),setCurrentModelId:a=>e({currentModelId:a}),setPollingEnabled:a=>e({pollingEnabled:a}),setMostRecentGeneratedImageId:a=>{e({mostRecentGeneratedImageId:a}),a&&setTimeout(()=>e({mostRecentGeneratedImageId:null}),3e3)},setLoadingInitialImages:a=>e({loadingInitialImages:a}),setIsCurrentlyLoading:a=>e({isCurrentlyLoading:a}),setIsLoadingMore:a=>e({isLoadingMore:a}),setCurrentPage:a=>e({currentPage:a}),setHasMoreImages:a=>e({hasMoreImages:a}),setTotalImages:a=>e({totalImages:a}),setPreviewImage:a=>{a&&a.id&&e(e=>({previewImagesById:{...e.previewImagesById,[a.id]:a}}))},updatePreviewImage:(a,t)=>{a&&t&&e(e=>{var i;let o=null===(i=e.previewImagesById)||void 0===i?void 0:i[a];return o?{previewImagesById:{...e.previewImagesById,[a]:{...o,...t}}}:e})},removePreviewImage:a=>{a&&e(e=>{let{[a]:t,...i}=e.previewImagesById||{};return{previewImagesById:i}})},updateImageById:(a,t)=>{e(e=>{let i=e.generatedImages.findIndex(e=>e.id===a);if(-1===i)return e;let o=e.generatedImages[i];if(!Object.keys(t).some(e=>o[e]!==t[e]))return e;let n=[...e.generatedImages];return n[i]={...o,...t},{generatedImages:n}})},appendImages:a=>{e(e=>({generatedImages:[...e.generatedImages,...a]}))},removeImageById:a=>{e(e=>({generatedImages:e.generatedImages.filter(e=>e.id!==a)}))},prependImage:a=>{e(e=>({generatedImages:[a,...e.generatedImages]}))},resetImagesState:()=>e(w),updateMultipleStates:a=>e(a),getDebugInfo:()=>{let e=a();return{imageCount:e.generatedImages.length,currentModel:e.currentModelId,isLoading:e.loadingInitialImages||e.isCurrentlyLoading,pagination:{page:e.currentPage,hasMore:e.hasMoreImages,total:e.totalImages}}}}),_={toasts:[],nextId:1,debugMode:!1},S=(e,a)=>{let t=function(e){for(var t=arguments.length,i=Array(t>1?t-1:0),o=1;o<t;o++)i[o-1]=arguments[o];a().debugMode&&console.log("[ToastSlice] ".concat(e),...i)};return{..._,showToast:function(i){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",n=arguments.length>
12&&void 0!==arguments[2]?arguments[2]:3e3,s=a().nextId,r={id:s,message:i,type:o,show:!0,createdAt:Date.now()};return t("Showing toast:",r),e(e=>({toasts:[...e.toasts,r],nextId:e.nextId+1})),n>0&&setTimeout(()=>{a().hideToast(s)},n),s},hideToast:a=>{t("Hiding toast:",a),e(e=>({toasts:e.toasts.map(e=>e.id===a?{...e,show:!1}:e)})),setTimeout(()=>{e(e=>({toasts:e.toasts.filter(e=>e.id!==a)}))},300)},clearAllToasts:()=>{t("Clearing all toasts"),e({toasts:[]})},getVisibleToasts:()=>a().toasts.filter(e=>e.show),showSuccessToast:(e,t)=>a().showToast(e,"success",t),showErrorToast:(e,t)=>a().showToast(e,"error",t),showInfoToast:(e,t)=>a().showToast(e,"info",t),showWarningToast:(e,t)=>a().showToast(e,"warning",t)}};var M=t(6233);class T{async switchToModel(e){if(this.store.getState().currentModelId===e){console.log("Already on this model, skipping switch");return}let a=M.Z.getCachedModelData(e);a&&a.images.length>0?(console.log("Loading cached images for model ".concat(e,": ").concat(a.images.length," images")),this.store.setState({currentModelId:e,generatedImages:a.images,currentPage:a.pagination.currentPage||1,hasMoreImages:a.pagination.hasMoreImages||!1,totalImages:a.pagination.totalImages||0,loadingInitialImages:!1,isCurrentlyLoading:!1,selectedImageId:null,isDeletingImageId:null,mostRecentGeneratedImageId:null})):(console.log("No cache for model ".concat(e,", will need to load")),this.store.setState({currentModelId:e,generatedImages:[],currentPage:1,hasMoreImages:!1,totalImages:0,loadingInitialImages:!0,isCurrentlyLoading:!1,selectedImageId:null,isDeletingImageId:null,mostRecentGeneratedImageId:null}))}addGeneratedImage(e){let a=this.store.getState();if(a.generatedImages.some(a=>a.id===e.id)){console.warn("[ImageOperations] Duplicate image detected, skipping add:",e.id);return}if(a.currentModelId){let t=M.Z.addImageToCache(a.currentModelId,e);this.store.setState({generatedImages:t,totalImages:a.totalImages+1})}else this.store.setState({generatedImages:[e,...a.generatedImages]})}removeImage(e){let a=this.store.getState();if(a.currentModelId){let t=M.Z.removeImageFromCache(a.currentModelId,e);this.store.setState({generatedImages:t,totalImages:Math.max(0,a.totalImages-1)})}else this.store.setState({generatedImages:a.generatedImages.filter(a=>a.id!==e)})}updateImage(e,a){var t;let i=this.store.getState();i.updateImageById(e,a),i.currentModelId&&M.Z.updateImageInCache(i.currentModelId,e,a),(null===(t=i.generatedImages[0])||void 0===t?void 0:t.id)===e&&i.loadingInitialImages&&a.url&&this.store.setState({loadingInitialImages:!1})}setImagesWithCache(e){let a=this.store.getState();console.log("[ImageOperations] Setting images with cache for model: ".concat(a.currentModelId),{imageCount:e.length,currentPage:a.currentPage}),a.currentModelId?(M.Z.setCacheForModel(a.currentModelId,e,{currentPage:a.currentPage,hasMoreImages:a.hasMoreImages,totalImages:a.totalImages}),console.log("[ImageOperations] Cache saved for model: ".concat(a.currentModelId))):console.log("[ImageOperations] No currentModelId - skipping cache"),a.setGeneratedImages(e)}refreshImages(){let e=this.store.getState();return e.currentModelId&&M.Z.clearModelCache(e.currentModelId),e.currentModelId}clearAllCaches(){M.Z.clearAllCache(),this.store.setState({generatedImages:[],selectedImageId:null,isDeletingImageId:null,mostRecentGeneratedImageId:null,pollingEnabled:!1,currentPage:1,hasMoreImages:!1,totalImages:0,currentModelId:null})}constructor(e){this.store=e}}var C=t(4121);let P=function(){for(var e=arguments.length,a=Array(e),t=0;t<e;t++)a[t]=arguments[t];return m.V.info("ImageLoader",...a)},L=function(){for(var e=arguments.length,a=Array(e),t=0;t<e;t++)a[t]=arguments[t];return m.V.warn("ImageLoader",...a)},D=function(){for(var e=arguments.length,a=Array(e),t=0;t<e;t++)a[t]=arguments[t];return m.V.error("ImageLoader",...a)};class A{async loadImages(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,t=arguments.length>2&&void 0!==arguments[2]&&arguments[2];P("[ImageLoader] Loading images for model: ".concat(e,", page: ").concat(a,", append: ").concat(t));let i="".concat(e,"-").concat(a,"-").concat(t);if(this.currentlyLoadingModels.has(i)){P("[ImageLoader] Already loading ".concat(i,", skipping duplicate request"));return}this.currentlyLoadingModels.add(i);try{var o;if(1===a&&!t){P("[ImageLoader] Checking cache for model: ".concat(e));let a=M.Z.getCachedModelData(e);if(a){if(P("[ImageLoader] Cache found for model ".concat(e,":"),{imageCount:a.images.length,lastUpdated:a.lastUpdated,age:Date.now()-a.lastUpdated}),a.images.length>0){P("[ImageLoader] Using cached images for model ".concat(e)),await this.imageOperations.switchToModel(e),a.images.some(e=>e.isEnhancement)&&(P("[ImageLoader] Enhancement images found - refreshing URLs (including originalImageUrl)"),C.imageUrlLoader.loadUrlsProgressively(a.images,(e,a)=>this.imageOperations.updateImage(e,a)));return}}
1else P("[ImageLoader] No cache found for model ".concat(e))}P("[ImageLoader] Loading fresh images from API for model ".concat(e)),1===a?this.store.setState({isCurrentlyLoading:!0,selectedImageId:null,isDeletingImageId:null,mostRecentGeneratedImageId:null,pollingEnabled:!1,currentPage:1,hasMoreImages:!1,totalImages:0,currentModelId:e}):this.store.setState({isLoadingMore:!0});let i=await this._fetchImageMetadata(e,a),n=await i.json();await this._updateImagesState(n,a,t,e),(null===(o=n.images)||void 0===o?void 0:o.length)>0&&(C.imageUrlLoader.loadUrlsProgressively(n.images,(e,a)=>this.imageOperations.updateImage(e,a)),this._loadSubmissionChainsForImages(n.images))}catch(e){D("Error loading images:",e),this._handleLoadingError(a)}finally{this.currentlyLoadingModels.delete(i)}}loadAllImages(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,a=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.loadImages(null,e,a)}async loadMoreImages(){let e=this.store.getState();if(!e.isLoadingMore&&e.hasMoreImages){var a;await this.loadImages(null!==(a=e.currentModelId)&&void 0!==a?a:null,e.currentPage+1,!0)}}async _fetchImageMetadata(e,a){let t=new URLSearchParams({page:a.toString(),limit:"20",fast:"true"});e&&t.append("model_entry_id",e);let i=await fetch("/api/images?".concat(t.toString()));if(!i.ok)throw Error((await i.json().catch(()=>({}))).error||"Failed to load images");return i}async _updateImagesState(e,a,t,i){var o,n,s,r,l;let d=e.images||[];if(console.log("\uD83D\uDD0D ImageLoader Debug - First image received:",{id:null===(o=d[0])||void 0===o?void 0:o.id,promptChainLength:null===(n=d[0])||void 0===n?void 0:n.promptChainLength,hasPromptChain:null===(s=d[0])||void 0===s?void 0:s.hasPromptChain,allFields:Object.keys(d[0]||{})}),i&&this.store.setState({currentModelId:i}),1!==a&&t){let e=[...this.store.getState().generatedImages,...d];this.imageOperations.setImagesWithCache(e)}else this.imageOperations.setImagesWithCache(d);this.store.setState({currentPage:a,hasMoreImages:(null===(r=e.pagination)||void 0===r?void 0:r.hasMore)||!1,totalImages:(null===(l=e.pagination)||void 0===l?void 0:l.total)||0,loadingInitialImages:!1,isCurrentlyLoading:!1,isLoadingMore:!1})}_handleLoadingError(e){let a=this.store.getState();this.store.setState({generatedImages:1===e?[]:a.generatedImages,isCurrentlyLoading:!1,isLoadingMore:!1,loadingInitialImages:!1})}async _loadSubmissionChainsForImages(e){if(!Array.isArray(e)||0===e.length)return;let a=e.map(e=>e.id).join(",");try{let t=await fetch("/api/form-submissions/history?image_ids=".concat(a));if(!t.ok){L("[ImageLoader] submission-history fetch failed",t.status);return}let{chains:i={},submissions:o={}}=await t.json();Object.keys(i).length>0&&this.store.getState().loadImageSubmissionChainsFromDb(i,o),P("[ImageLoader] Loaded submission history:",{images:e.length,chains:Object.keys(i).length,submissions:Object.keys(o).length})}catch(e){D("[ImageLoader] Error loading submission history",e)}}constructor(e,a){this.store=e,this.imageOperations=a,this.currentlyLoadingModels=new Set}}let U=(e,a)=>({imageMasking:{isActive:!1,currentImageId:null,brushSize:20,brushColor:"#000000",maskData:null,canvasReady:!1,isDrawing:!1,maskHistory:[],historyIndex:-1,initialMask:null,canvasUI:{imageDimensions:null,mousePosition:{x:0,y:0},isHovering:!1,mounted:!1},keyboard:{isCtrlPressed:!1,isEraseMode:!1},saving:{isLoading:!1,error:null,lastSavedMask:null},maskLibrary:{isVisible:!1,savedMasks:[],isLoadingMasks:!1,loadError:null}},setMaskingActive:function(a){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e(e=>({imageMasking:{...e.imageMasking,isActive:a,currentImageId:t,...a&&t!==e.imageMasking.currentImageId?{maskData:null,maskHistory:[],historyIndex:-1,canvasReady:!1,initialMask:null,saving:{isLoading:!1,error:null,lastSavedMask:null},canvasUI:{imageDimensions:null,mousePosition:{x:0,y:0},isHovering:!1,mounted:!1}}:{}}}))},setInitialMask:a=>e(e=>({imageMasking:{...e.imageMasking,initialMask:a}})),clearInitialMask:()=>e(e=>({imageMasking:{...e.imageMasking,initialMask:null}})),setImageDimensions:a=>e(e=>({imageMasking:{...e.imageMasking,canvasUI:{...e.imageMasking.canvasUI,imageDimensions:a}}})),setMousePosition:a=>e(e=>({imageMasking:{...e.imageMasking,canvasUI:{...e.imageMasking.canvasUI,mousePosition:a}}})),setCanvasHovering:a=>e(e=>({imageMasking:{...e.imageMasking,canvasUI:{...e.imageMasking.canvasUI,isHovering:a}}})),setCanvasMounted:a=>e(e=>({imageMasking:{...e.imageMasking,canvasUI:{...e.imageMasking.canvasUI,mounted:a}}})),setBrushSize:a=>e(e=>({imageMasking:{...e.imageMasking,brushSize:a}})),setBrushColor:a=>e(e=>({imageMasking:{...e.imageMasking,brushColor:a}})),setCanvasReady:a=>e(e=>({imageMasking:{...e.imageMasking,canvasReady:a}})),setIsDrawing:a=>e(e=>({imageMasking:{...e.imageMasking,isDrawing:a}})),setCtrlPressed:a=>e(e=>({imageMasking:{...e.imageMasking,keyboard:{...e.imageMasking.keyboard,isCtrlPressed:a}}})),setEraseMode:a=>e(e=>({imageMasking:{...e.imageMasking,keyboard:{...e.imageMasking.keyboard,isEraseMode:a}}})),adjustBrushSize:a=>e(e=>{let t=Math.max(1,Math.min(100,e.imageMasking.brushSize+a));return{imageMasking:{...e.imageMasking,brushSize:t}}}),setSaving:a=>e(e=>({imageMasking:{...e.imageMasking,saving:{...e.imageMasking.saving,isLoading:a,error:a?null:e.imageMasking.saving.error}}})),setSaveError:a=>e(e=>({imageMasking:{...e.imageMasking,saving:{...e.imageMasking.saving,error:a,isLoading:!1}}})),setSaveSuccess:a=>e(e=>({imageMasking:{...e.imageMasking,saving:{isLoading:!1,error:null,lastSavedMask:a}}})),saveMaskToHistory:()=>e(e=>e),undoMask:()=>e(e=>e),redoMask:()=>e(e=>e),clearMask:()=>e(e=>({imageMasking:{...e.imageMasking,maskData:null,maskHistory:[],historyIndex:-1}})),resetMaskingState:()=>e(e=>({imageMasking:{isActive:!1,currentImageId:null,brushSize:20,brushColor:"#000000",maskData:null,canvasReady:!1,isDrawing:!1,maskHistory:[],historyIndex:-1,initialMask:null,canvasUI:{imageDimensions:null,mousePosition:{x:0,y:0},isHovering:!1,mounted:!1},keyboard:{isCtrlPressed:!1,isEraseMode:!1},saving:{isLoading:!1,error:null,lastSavedMask:null},maskLibrary:{isVisible:!1,savedMasks:[],isLoadingMasks:!1,loadError:null}}})),canUndo:()=>!1,canRedo:()=>!1,hasMaskData:()=>{let{maskData:e}=a().imageMasking;return!!e},setMaskLibraryVisible:a=>e(e=>({imageMasking:{...e.imageMasking,maskLibrary:{...e.imageMasking.maskLibrary,isVisible:a}}})),setSavedMasks:a=>e(e=>({imageMasking:{...e.imageMasking,maskLibrary:{...e.imageMasking.maskLibrary,savedMasks:a}}})),setMaskLibraryLoading:a=>e(e=>({imageMasking:{...e.imageMasking,maskLibrary:{...e.imageMasking.maskLibrary,isLoadingMasks:a,loadError:a?null:e.imageMasking.maskLibrary.loadError}}})),setMaskLibraryError:a=>e(e=>({imageMasking:{...e.imageMasking,maskLibrary:{...e.imageMasking.maskLibrary,loadError:a,isLoadingMasks:!1}}})),loadImageMasks:null,saveMaskToDatabase:null}),F=(e,a)=>({workbench:{activeImageId:null,currentChainId:null,currentPromptChain:[],lastWorkingChain:[],promptInputCollapsed:{},showParametersSidebar:!0,draftPromptText:"",editingPromptId:null,editingPromptText:"",modelSelectorOpen:!1,isSyncing:!1,lastSyncTimestamp:null,previewImageId:null,firstLoadDone:!1},confirmPromptDbInsert:()=>{},linkImageToPromptChain:()=>{},loadImagePromptChain:()=>{},editPromptInChain:()=>{},startNewChain:()=>e(e=>{let a=e.selectedModel,t=(null==a?void 0:a.defaultParams)?{...a.defaultParams}:{};return a&&l.FW.includes(a.id)&&(t.image="",t.input_image="",t.mask="",t.image_prompt=""),{workbench:{...e.workbench,activeImageId:null,currentChainId:null,currentPromptChain:[],previewImageId:null,draftPromptText:"",editingPromptId:null,editingPromptText:""},parameters:t}},!1,{type:"workbench/startNewChain"}),loadLastWorkingChain:()=>e(e=>({workbench:{...e.workbench,currentPromptChain:[...e.workbench.lastWorkingChain],activeImageId:null}})),clearActiveImage:()=>e(e=>({workbench:{...e.workbench,activeImageId:null}})),setActiveImageId:a=>e(e=>({workbench:{...e.workbench,activeImageId:a,previewImageId:null,firstLoadDone:!0}})),simulateGenerationComplete:()=>e(e=>({workbench:{...e.workbench}})),loadPromptsFromDb:()=>{},loadImagePromptChainsFromDb:()=>{},getCurrentPromptChain:()=>[],getLatestPrompt:()=>null,isPromptCollapsed:e=>a().workbench.promptInputCollapsed[e]||!1,getPendingPrompts:()=>[],getImagePromptChain:()=>[],hasUnsavedChanges:()=>!1,getImageIdForPrompt:()=>null,addTestPromptToChain:(e,a,t)=>{Date.now(),null==a||a.id,new Date().toISOString()},setPreviewImageId:a=>e(e=>({workbench:{...e.workbench,previewImageId:a}})),clearPreviewImageId:()=>e(e=>({workbench:{...e.workbench,previewImageId:null}})),markFirstLoadDone:()=>e(e=>({workbench:{...e.workbench,firstLoadDone:!0}}))}),R=(e,a)=>({pendingMaskIds:[],addPendingMaskId:a=>e(e=>({pendingMaskIds:Array.from(new Set([...e.pendingMaskIds||[],a]))})),clearPendingMaskIds:()=>e({pendingMaskIds:[]}),applyMaskWithModel:e=>{let{modelId:t,imageUrl:i,maskUrl:o}=e;if(console.log("[MaskInpaintSlice] applyMaskWithModel",{modelId:t,imageUrl:i,maskUrl:o}),!t)return;let n=(0,l.bs)(t,a().userModels||[]);
1if(!n){console.warn("[applyMaskWithModel] Model not found for id:",t);return}let s=function(e,a,t){switch(e){case"sdxl":case"ideogram-v3-quality":case"ideogram-v3-turbo":case"flux-fill-pro":return{image:a,mask:t};case"flux-kontext-max":case"flux-kontext-pro":return{input_image:a,mask:t};default:return{}}}(n.id,i,o),{setSelectedModel:r,setActiveDashboardTab:d,setParameters:m,setIsModelSelectionView:g}=a();null==r||r(n),null==d||d("workbench"),null==g||g(!1),null==m||m({...n.defaultParams||{},...s})}}),E=(e,a)=>({submissions:{data:{},currentChainId:null,currentSubmissionChain:[],generatingSubmissionId:null,pendingSubmissionId:null,imageSubmissionChains:{},submissionToImageId:{}},addSubmissionToChain:(t,i,o,n)=>{let s=a().clearPreventSubmissionParamRestore;s&&s();let r="temp-".concat(Date.now()),l={id:r,chain_id:a().submissions.currentChainId,step_order:a().submissions.currentSubmissionChain.length,user_id:null,model_id:(null==o?void 0:o.dbUuid)||null,form_values:{...n,prompt:t},prompt_text:t,negative_prompt:i||null,submitted_at:new Date().toISOString(),image_id:null,status:"pending",_isTemporary:!0,_needsDbInsert:!0};return e(e=>({submissions:{...e.submissions,data:{...e.submissions.data,[r]:l},currentSubmissionChain:[...e.submissions.currentSubmissionChain,r],generatingSubmissionId:r,pendingSubmissionId:r},generation:{...e.generation,isGenerating:!0,generatingSubmissionId:r}})),r},confirmSubmissionDbInsert:(a,t,i,o,n)=>{e(e=>{if(!e.submissions.data[a])return e;let{[a]:n,...s}=e.submissions.data,r=e.submissions.currentSubmissionChain.map(e=>e===a?t:e),l=Object.fromEntries(Object.entries(e.submissions.imageSubmissionChains).map(e=>{let[i,o]=e;return[i,o.map(e=>e===a?t:e)]})),d={...e.submissions.submissionToImageId||{}};d[a]&&(d[t]=d[a],delete d[a]);let m=(e.generatedImages||[]).map(e=>e.form_submission_id===a?{...e,form_submission_id:t}:e);return{submissions:{...e.submissions,data:{...s,[t]:{...i,_isTemporary:!1,_needsDbInsert:!1}},currentChainId:o,currentSubmissionChain:r,imageSubmissionChains:l,submissionToImageId:d,generatingSubmissionId:e.submissions.generatingSubmissionId===a?t:e.submissions.generatingSubmissionId,pendingSubmissionId:e.submissions.pendingSubmissionId===a?null:e.submissions.pendingSubmissionId},generation:{...e.generation,generatingSubmissionId:e.generation.generatingSubmissionId===a?t:e.generation.generatingSubmissionId},generatedImages:m}}),console.log("[confirmSubmissionDbInsert] Submission confirmed:",{tempId:a,realDbId:t,chainId:o,stepOrder:n})},startNewChain:()=>e(e=>({submissions:{...e.submissions,currentChainId:null,currentSubmissionChain:[],generatingSubmissionId:null,pendingSubmissionId:null}}),!1,{type:"submission/startNewChain"}),linkImageToSubmissionChain:(a,t)=>{e(e=>{let i={...e.submissions.imageSubmissionChains};return i[a]=t,(e.generatedImages||[]).forEach(e=>{if(e.id===a)return;let o=i[e.id]||[];o.some(e=>t.includes(e))&&(i[e.id]=t,console.log("\uD83D\uDD04 Updated chain for ".concat(e.id,": ").concat(o.length," → ").concat(t.length," steps")))}),{submissions:{...e.submissions,imageSubmissionChains:i},workbench:{...e.workbench,activeImageId:a,previewImageId:null}}})},loadSubmissionChain:(a,t)=>{e(e=>{let i=t.reduce((e,a)=>(e[a.id]=a,e),{}),o=t.sort((e,a)=>e.step_order-a.step_order).map(e=>e.id);return{submissions:{...e.submissions,data:{...e.submissions.data,...i},currentChainId:a,currentSubmissionChain:o}}})},updateSubmissionWithImage:(a,t)=>{e(e=>{let i=e.submissions.data[a];return i?{submissions:{...e.submissions,data:{...e.submissions.data,[a]:{...i,image_id:t,status:"completed"}}},generation:{...e.generation,isGenerating:!1,generatingSubmissionId:null,generatingImageId:t},workbench:{...e.workbench,activeImageId:t,previewImageId:null}}:e})},loadImageSubmissionChain:(a,t,i)=>{e(e=>{var o;let n=i.reduce((e,a)=>(e[a.id]={...a,_isTemporary:!1,_needsDbInsert:!1},e),{}),s=(null==i?void 0:null===(o=i[0])||void 0===o?void 0:o.chain_id)||null;return{submissions:{...e.submissions,data:{...e.submissions.data,...n},imageSubmissionChains:{...e.submissions.imageSubmissionChains,[a]:t},currentChainId:s,currentSubmissionChain:t},workbench:{...e.workbench,activeImageId:a,previewImageId:null}}})},loadImageSubmissionChainsFromDb:function(a){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e(e=>({submissions:{...e.submissions,data:{...e.submissions.data,...Object.fromEntries(Object.entries(t).map(e=>{let[a,t]=e;return[a,{...t,_isTemporary:!1,_needsDbInsert:!1}]}))},imageSubmissionChains:{...e.submissions.imageSubmissionChains,...a}}}))},mergeSubmissionImageMap:function(){let a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a&&"object"==typeof a&&e(e=>({submissions:{...e.submissions,submissionToImageId:{...e.submissions.submissionToImageId,...a}}}))},unlinkImageFromSubmissions:a=>e(e=>{let t=(e.submissions.imageSubmissionChains||{})[a]||[],i={...e.submissions.submissionToImageId||{}};
1t.forEach(e=>{i[e]===a&&delete i[e]});let o={...e.submissions.data||{}};t.forEach(e=>{o[e]&&(o[e]={...o[e],image_id:null})});let{[a]:n,...s}=e.submissions.imageSubmissionChains||{};return{submissions:{...e.submissions,data:o,submissionToImageId:i,imageSubmissionChains:s}}}),getCurrentSubmissionChain:()=>{let e=a();return e.submissions.currentSubmissionChain.map(a=>e.submissions.data[a]).filter(Boolean)},getLatestSubmission:()=>{let e=a(),t=e.submissions.currentSubmissionChain;if(0===t.length)return null;let i=t[t.length-1];return e.submissions.data[i]||null},getImageSubmissionChain:e=>{let t=a();return(t.submissions.imageSubmissionChains[e]||[]).map(e=>t.submissions.data[e]).filter(Boolean)},isSubmissionGenerating:e=>a().submissions.generatingSubmissionId===e,hasPendingSubmissions:()=>Object.values(a().submissions.data).some(e=>e._needsDbInsert),getPendingSubmissions:()=>Object.values(a().submissions.data).filter(e=>e._needsDbInsert),debugSubmissionState:()=>{let e=a();console.log("[Submission State Debug]",{currentChainId:e.submissions.currentChainId,currentChain:e.submissions.currentSubmissionChain,totalSubmissions:Object.keys(e.submissions.data).length,generatingId:e.submissions.generatingSubmissionId,pendingId:e.submissions.pendingSubmissionId})}}),V=(e,a)=>({togglePromptCollapse:a=>e(e=>({workbench:{...e.workbench,promptInputCollapsed:{...e.workbench.promptInputCollapsed,[a]:!e.workbench.promptInputCollapsed[a]}}})),setDraftPromptText:a=>e(e=>({workbench:{...e.workbench,draftPromptText:a}})),clearDraftPromptText:()=>e(e=>({workbench:{...e.workbench,draftPromptText:""}})),startEditingPrompt:(a,t)=>e(e=>({workbench:{...e.workbench,editingPromptId:a,editingPromptText:t}})),setEditingPromptText:a=>e(e=>({workbench:{...e.workbench,editingPromptText:a}})),cancelEditingPrompt:()=>e(e=>({workbench:{...e.workbench,editingPromptId:null,editingPromptText:""}})),setModelSelectorOpen:a=>e(e=>({workbench:{...e.workbench,modelSelectorOpen:a}})),toggleModelSelector:()=>e(e=>({workbench:{...e.workbench,modelSelectorOpen:!e.workbench.modelSelectorOpen}})),setShowParametersSidebar:a=>e(e=>({workbench:{...e.workbench,showParametersSidebar:a}})),toggleParametersSidebar:()=>e(e=>({workbench:{...e.workbench,showParametersSidebar:!e.workbench.showParametersSidebar}})),setPreviewImageId:a=>e(e=>({workbench:{...e.workbench,previewImageId:a}})),clearPreviewImageId:()=>e(e=>({workbench:{...e.workbench,previewImageId:null}}))}),O=(e,a)=>({generation:{isGenerating:!1,generatingSubmissionId:null,generatingImageId:null,imageLoadStates:{}},setIsGenerating:a=>e(e=>({generation:{...e.generation,isGenerating:a}})),setGeneratingSubmission:a=>e(e=>({generation:{...e.generation,generatingSubmissionId:a,isGenerating:!!a}})),clearGenerationFlags:()=>e(e=>({generation:{...e.generation,isGenerating:!1,generatingSubmissionId:null,generatingImageId:null}})),setImageLoadState:(a,t)=>e(e=>({generation:{...e.generation,imageLoadStates:{...e.generation.imageLoadStates,[a]:{...e.generation.imageLoadStates[a],...t}}}})),getImageLoadState:e=>a().generation.imageLoadStates[e]||{loaded:!1,error:!1}});var j=t(607);let z={selectedImageId:null,lastClickTime:0,isDeletingImageId:null,mostRecentGeneratedImageId:null,pollingEnabled:!1,parameters:{},isLoadingParameters:!1,selectedModel:null,generatedImages:[],activeDashboardTab:"general",pendingFiles:new Map,uploadProgress:{},toasts:[],nextId:1,imageMasking:{isActive:!1,currentImageId:null,brushSize:20,brushColor:"#000000",maskData:null,canvasReady:!1,isDrawing:!1,maskHistory:[],historyIndex:-1},workbench:{prompts:{},imagePromptChains:{},activeImageId:null,currentPromptChain:[],lastWorkingChain:[],promptInputCollapsed:{},showParametersSidebar:!0,isSyncing:!1,lastSyncTimestamp:null,previewImageId:null},submissions:{data:{},currentChainId:null,currentSubmissionChain:[],generatingSubmissionId:null,pendingSubmissionId:null,imageSubmissionChains:{}}},N=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:z,a=(0,s.y)()((0,k.lt)(function(){for(var a=arguments.length,t=Array(a),i=0;i<a;i++)t[i]=arguments[i];return{...e,...r(...t),...c(...t),...p(...t),...x(...t),...f(...t),...I(...t),...S(...t),...y(...t),...U(...t),...F(...t),...R(...t),...E(...t),...V(...t),...O(...t)}},{name:"hilma-ui-state",enabled:!1,trace:!0,traceLimit:20})),t=new T(a),i=new A(a,t);a.imageOperations=t,a.imageLoader=i,a.loadImages=function(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,t=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return i.loadImages(e,a,t)},a.loadAllImages=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,a=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return i.loadAllImages(e,a)},a.loadMoreImages=()=>i.loadMoreImages(),a.switchToModel=e=>t.switchToModel(e),a.removeImage=e=>t.removeImage(e),a.addImage=e=>t.addGeneratedImage(e),a.refreshImages=()=>{let e=t.refreshImages();if(e)return i.loadImages(e,1,!1)},a.startMasking=e=>{let{setMaskingActive:t}=a.getState();t(!0,e)},a.stopMasking=()=>{let{resetMaskingState:e}=a.getState();e()},a.canvasDrawingService=null,a.initializeCanvas=(e,t)=>a.canvasDrawingService?a.canvasDrawingService.initialize(e,t):(console.warn("No canvas service available"),!1),a.loadCanvasImage=(e,t)=>
1a.canvasDrawingService?a.canvasDrawingService.loadBackgroundImage(e,t):(console.warn("No canvas service available"),Promise.reject(Error("No canvas service"))),a.updateBrushSettings=()=>!0,a.clearCanvasMask=()=>{a.canvasDrawingService&&a.canvasDrawingService.clearCanvas()},a.exportCanvasMask=()=>a.canvasDrawingService?a.canvasDrawingService.exportMask():null,a.disposeCanvas=()=>{a.canvasDrawingService&&a.canvasDrawingService.dispose()},a.loadMaskData=async e=>{try{if(console.log("\uD83C\uDFAD [Store] Loading mask data:",e),!e)return console.error("\uD83C\uDFAD [Store] No mask data provided"),!1;let t=null;if("saved_mask"===e.type&&e.maskImageUrl)t=e.maskImageUrl;else if("string"==typeof e)t=e;else if(e.maskImageUrl)t=e.maskImageUrl;else{if(!e.dataUrl)return console.error("\uD83C\uDFAD [Store] No mask image URL found in mask data:",e),!1;t=e.dataUrl}return console.log("\uD83C\uDFAD [Store] Using mask image URL:",t),await a.canvasDrawingService.loadMaskFromImage(t)}catch(e){return console.error("\uD83C\uDFAD [Store] Error loading mask data:",e),!1}},a.saveMaskToDatabase=async function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{console.log("\uD83C\uDFAD [Store] Starting mask save process...");let t=a.canvasDrawingService;if(!t)throw console.error("\uD83C\uDFAD [Store] No canvas service registered with store"),Error("Canvas not initialized - please make sure the mask editor is open");if(!t.isReady||"function"!=typeof t.isReady)throw console.error("\uD83C\uDFAD [Store] Canvas service is not a valid CanvasController instance"),Error("Invalid canvas service - initialization may have failed");if(!t.isReady())throw console.error("\uD83C\uDFAD [Store] Canvas not ready:",{hasCanvas:!!t.canvas,hasContext:!!t.ctx,disposed:t.disposed}),Error("Canvas not ready - it may not be properly initialized");console.log("\uD83C\uDFAD [Store] Canvas is ready, exporting mask...");let o=await t.exportMaskAsBlob(),n=t.getStats();if(console.log("\uD83C\uDFAD [Store] Export results:",{hasBlob:!!o,stats:n,hasContent:null==n?void 0:n.hasContent}),!o)throw Error("No mask data to save - try drawing something first");let s=new FormData;s.append("maskData",JSON.stringify({version:"1.0.0",type:"simple-canvas",dimensions:{width:n.width,height:n.height}})),s.append("maskImage",o,"mask.png"),s.append("sourceImageId",e),s.append("metadata",JSON.stringify({...i,...n,canvasType:"simple-canvas"}));let r=await fetch("/api/masks",{method:"POST",body:s});if(!r.ok){let e=await r.text();throw Error("API request failed: ".concat(r.status," ").concat(e))}let{mask:l}=await r.json();return a.getState().showSuccessToast("Mask saved successfully"),l}catch(e){throw console.error("\uD83C\uDFAD [Store] Error saving mask:",e),a.getState().showErrorToast("Failed to save mask: ".concat(e.message)),e}},a.loadImageMasks=async function(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"generated";try{let t=await fetch("/api/masks?imageId=".concat(e,"&imageType=").concat(a));if(!t.ok){let e="";try{e=await t.text()}catch(e){}throw Error("Failed to load masks (HTTP ".concat(t.status,") ").concat(e))}let{masks:i}=await t.json();return i}catch(e){return console.error("Error loading masks:",e),[]}};try{if(!window.__hilma_rt_channel__){let e=(0,j.createClient)().channel("rt_form_submissions").on("postgres_changes",{event:"UPDATE",schema:"hilma_images",table:"form_submissions"},e=>{let t=e.new,i=e.old||{};if(!t||t.status===i.status)return;let{updateSubmissionWithImage:o,clearGenerationFlags:n}=a.getState();"completed"===t.status&&t.image_id&&("function"==typeof o&&o(t.id,t.image_id),"function"==typeof n&&n()),"failed"===t.status&&"function"==typeof n&&n()}).subscribe();window.__hilma_rt_channel__=e,window.addEventListener("beforeunload",()=>{try{var e;null===(e=window.__hilma_rt_channel__)||void 0===e||e.unsubscribe()}catch(e){}window.__hilma_rt_channel__=null})}}catch(e){console.error("[uiStateStore] Failed to initialise Supabase Realtime listener",e)}return a},G=(0,o.createContext)(void 0);function B(e){let{children:a,initialState:t=z}=e,n=(0,o.useRef)(null);return n.current||(n.current=N(t)),(0,i.jsx)(G.Provider,{value:n.current,children:a})}function H(e,a){let t=(0,o.useContext)(G);if(!t)throw Error("useUIState must be used within UIStateProvider");return(0,n.P)(t,e,a)}function q(){let e=(0,o.useContext)(G);if(!e)throw Error("useUIStore must be used within UIStateProvider");return e}},607:(e,a,t)=>{t.r(a),t.d(a,{createClient:()=>n});var i=t(6449);let o=null;function n(){if(o)return o;let e="https://uodlrnxbqnzvuqdgqjrm.supabase.co",a="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InVvZGxybnhicW56dnVxZGdxanJtIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDE4MDA1MTEsImV4cCI6MjA1NzM3NjUxMX0.wqeVOwcsJKEiCXUsViaM6HL4WD7OVdvajqtNfupKe7E";if(!e||!a)throw Error("NEXT_PUBLIC_SUPABASE_URL and NEXT_PUBLIC_SUPABASE_ANON_KEY must be set");return o=(0,i.createBrowserClient)(e,a)}},1049:(e,a,t)=>{t.d(a,{fn:()=>l,kA:()=>n,uA:()=>r,xc:()=>s});var i=t(4426),o=t(42);function n(){return(0,o.Fx)(e=>e.selectedModel)}function s(){return(0,o.Fx)((0,i.k)(e=>({isModelSelectionView:e.isModelSelectionView,userModels:e.userModels||[]})))}function r(){let e=(0,o.j_)();return(0,o.Fx)((0,i.k)(a=>({setSelectedModel:a.setSelectedModel,setUserModels:a.setUserModels,setIsModelSelectionView:a.setIsModelSelectionView,resetModelState:a.resetModelState,switchToModel:e.switchToModel})))}function l(){let e=n(),a=s(),t=r();return{selectedModel:e,...a,...t}}},1814:(e,a,t)=>{t.d(a,{Ac:()=>d,Z2:()=>s,lZ:()=>l,uD:()=>r,xp:()=>n});var i=t(4426),o=t(42);function n(){return(0,o.Fx)((0,i.k)(e=>({generatedImages:e.generatedImages,previewImagesById:e.previewImagesById,selectedImageId:e.selectedImageId,currentModelId:e.currentModelId,loadingInitialImages:e.loadingInitialImages,isCurrentlyLoading:e.isCurrentlyLoading,hasMoreImages:e.hasMoreImages,isLoadingMore:e.isLoadingMore,totalImages:e.totalImages,isDeletingImageId:e.isDeletingImageId,mostRecentGeneratedImageId:e.mostRecentGeneratedImageId})))}function s(){let e=(0,o.j_)();return(0,o.Fx)((0,i.k)(a=>({setGeneratedImages:a.setGeneratedImages,setSelectedImageId:a.setSelectedImageId,setIsDeletingImageId:a.setIsDeletingImageId,prependImage:a.prependImage,removeImageById:a.removeImageById,updateImageById:a.updateImageById,setPreviewImage:a.setPreviewImage,updatePreviewImage:a.updatePreviewImage,removePreviewImage:a.removePreviewImage,resetImagesState:a.resetImagesState,appendImages:a.appendImages,setLoa
1dingInitialImages:a.setLoadingInitialImages,setIsCurrentlyLoading:a.setIsCurrentlyLoading,setCurrentModelId:a.setCurrentModelId,loadImages:e.loadImages,loadAllImages:e.loadAllImages,loadMoreImages:e.loadMoreImages,refreshImages:e.refreshImages,removeImage:e.removeImage,addImage:e.addImage})))}function r(){let e=n(),a=s();return{...e,...a}}function l(){return(0,o.Fx)(e=>e.selectedImageId)}function d(){return(0,o.Fx)(e=>e.loadingInitialImages||e.isCurrentlyLoading)}},2052:(e,a,t)=>{t.d(a,{N:()=>i,Z:()=>o});let i=!1,o=!0},3821:(e,a,t)=>{t.d(a,{Dl:()=>s,Tc:()=>p,UJ:()=>g,Vl:()=>r,X8:()=>m,bA:()=>c,dZ:()=>u,mj:()=>d,o2:()=>l});var i=t(623),o=t(4426),n=t(42);function s(e){return(0,n.Fx)((0,o.k)(a=>{var t,i;let o=(null===(t=a.submissions)||void 0===t?void 0:t.data)||{},n=(null===(i=a.submissions)||void 0===i?void 0:i.imageSubmissionChains)||{},s={};return e.forEach(e=>{let a=(n[e]||[]).filter(e=>o[e]);s[e]=a.length}),s}))}function r(){return(0,n.Fx)((0,o.k)(e=>{var a,t;return{chainId:null===(a=e.submissions)||void 0===a?void 0:a.currentChainId,submissionIds:(null===(t=e.submissions)||void 0===t?void 0:t.currentSubmissionChain)||[]}}))}function l(){let{submissionIds:e}=r(),a=(0,n.Fx)(e=>{var a;return(null===(a=e.submissions)||void 0===a?void 0:a.data)||{}});return(0,i.useMemo)(()=>e.map(e=>a[e]).filter(Boolean),[e,a])}function d(){let e=r(),a=l();return(0,i.useMemo)(()=>({...e,submissions:a}),[e,a])}function m(){let e=(0,n.j_)();return(0,i.useMemo)(()=>{let a=e.getState();return{getImageSubmissionChain:a.getImageSubmissionChain,loadImageSubmissionChain:a.loadImageSubmissionChain}},[e])}function g(e){return(0,n.Fx)((0,o.k)(a=>{var t,i;null===(t=a.submissions)||void 0===t||t.data;let o=(null===(i=a.submissions)||void 0===i?void 0:i.imageSubmissionChains)||{},n={};return e.forEach(e=>{let a=o[e]||[];n[e]=a}),n}))}function u(e){let a=g(e),t=(0,n.Fx)(e=>{var a;return(null===(a=e.submissions)||void 0===a?void 0:a.data)||{}});return(0,i.useMemo)(()=>{let e={};return Object.entries(a).forEach(a=>{let[i,o]=a;e[i]=o.map(e=>t[e]).filter(Boolean)}),e},[a,t])}function c(){let e=(0,n.j_)();return(0,i.useMemo)(()=>a=>{var t,i;let o=e.getState(),n=null===(i=o.submissions)||void 0===i?void 0:null===(t=i.submissionToImageId)||void 0===t?void 0:t[a];if(n)return n;let s=(o.generatedImages||[]).find(e=>e.form_submission_id===a);return s?s.id:null},[e])}function p(){return(0,n.Fx)((0,o.k)(e=>{var a;return(null===(a=e.submissions)||void 0===a?void 0:a.imageSubmissionChains)||{}}))}t(9461)},4121:(e,a,t)=>{t.r(a),t.d(a,{ImageUrlLoaderService:()=>i,imageUrlLoader:()=>o});class i{async loadUrlsProgressively(e,a){console.log("[URLLoader] Loading URLs progressively for ".concat(e.length," images"));let t=e.slice(0,4),i=e.slice(4);await Promise.allSettled(t.map(e=>this.loadSingleImageUrl(e,a)));for(let e=0;e<i.length;e+=3){let t=i.slice(e,e+3);await Promise.allSettled(t.map(e=>this.loadSingleImageUrl(e,a))),e+3<i.length&&await new Promise(e=>setTimeout(e,100))}console.log("[URLLoader] Progressive URL loading complete")}async loadSingleImageUrl(e,a){if(!this.loadingQueue.has(e.id)){this.loadingQueue.add(e.id);try{let t=await fetch("/api/images/signed-url?id=".concat(e.id));if(!t.ok){let e="HTTP ".concat(t.status,": ").concat(t.statusText);try{let a=await t.json();a.error&&(e+=" - ".concat(a.error))}catch(e){}throw Error(e)}let i=await t.json();if(i.url)a(e.id,{url:i.url,originalImageUrl:i.originalImageUrl,isEnhancement:i.isEnhancement,isLoadingUrl:!1,needsUrl:!1});else throw Error("No URL returned from API")}catch(t){console.error("[URLLoader] Failed to load URL for image ".concat(e.id,":"),t.message),a(e.id,{isLoadingUrl:!1,needsUrl:!1,urlError:!0})}finally{this.loadingQueue.delete(e.id)}}}isLoading(e){return this.loadingQueue.has(e)}getLoadingStats(){return{currentlyLoading:Array.from(this.loadingQueue),queueSize:this.loadingQueue.size}}constructor(){this.loadingQueue=new Set}}let o=new i},5261:(e,a,t)=>{t.d(a,{$6:()=>b,Er:()=>c,Rf:()=>u,Tc:()=>g,U1:()=>f,Vu:()=>p,_z:()=>h,gM:()=>d,xv:()=>m});var i=t(623),o=t(4426),n=t(42),s=t(9461),r=t(3821);
1function l(){return(0,n.Fx)((0,o.k)(e=>{var a,t,i,o,n,s,r,l,d,m,g,u;return{workbench:e.workbench,activeImageId:null===(a=e.workbench)||void 0===a?void 0:a.activeImageId,draftPromptText:(null===(t=e.workbench)||void 0===t?void 0:t.draftPromptText)||"",editingPromptId:null===(i=e.workbench)||void 0===i?void 0:i.editingPromptId,editingPromptText:(null===(o=e.workbench)||void 0===o?void 0:o.editingPromptText)||"",showParametersSidebar:null===(u=null===(n=e.workbench)||void 0===n?void 0:n.showParametersSidebar)||void 0===u||u,promptInputCollapsed:(null===(s=e.workbench)||void 0===s?void 0:s.promptInputCollapsed)||{},modelSelectorOpen:(null===(r=e.workbench)||void 0===r?void 0:r.modelSelectorOpen)||!1,previewImageId:null===(l=e.workbench)||void 0===l?void 0:l.previewImageId,isSyncing:(null===(d=e.workbench)||void 0===d?void 0:d.isSyncing)||!1,lastSyncTimestamp:null===(m=e.workbench)||void 0===m?void 0:m.lastSyncTimestamp,lastWorkingChain:(null===(g=e.workbench)||void 0===g?void 0:g.lastWorkingChain)||[]}}))}function d(e){return(0,n.Fx)((0,o.k)(a=>{var t,i;return(null===(i=a.generation)||void 0===i?void 0:null===(t=i.imageLoadStates)||void 0===t?void 0:t[e])||{loaded:!1,error:!1}}))}function m(){return(0,n.Fx)((0,o.k)(e=>{var a;return(null===(a=e.generation)||void 0===a?void 0:a.imageLoadStates)||{}}))}function g(){return(0,n.Fx)((0,o.k)(e=>{var a;return(null===(a=e.submissions)||void 0===a?void 0:a.imageSubmissionChains)||{}}))}function u(e){return useLiveImageChainLengths(e)}function c(){let e=(0,n.j_)();return(0,i.useMemo)(()=>({togglePromptCollapse:a=>e.getState().togglePromptCollapse(a),startNewChain:()=>e.getState().startNewChain(),setDraftPromptText:a=>e.getState().setDraftPromptText(a),clearDraftPromptText:()=>e.getState().clearDraftPromptText(),setModelSelectorOpen:a=>e.getState().setModelSelectorOpen(a),toggleModelSelector:()=>e.getState().toggleModelSelector(),setImageLoadState:(a,t)=>e.getState().setImageLoadState(a,t),setPreviewImageId:a=>e.getState().setPreviewImageId(a),clearPreviewImageId:()=>e.getState().clearPreviewImageId(),setShowParametersSidebar:a=>e.getState().setShowParametersSidebar(a),toggleParametersSidebar:()=>e.getState().toggleParametersSidebar(),isPromptCollapsed:a=>{var t,i;return(null===(i=e.getState().workbench)||void 0===i?void 0:null===(t=i.promptInputCollapsed)||void 0===t?void 0:t[a])||!1},getImageIdForSubmission:a=>{var t;let i=e.getState(),o=i.generatedImages||[];s.V.debug("getImageIdForSubmission","Looking for submission:",a);let n=o.find(e=>e.form_submission_id===a);if(n)return s.V.debug("getImageIdForSubmission","Found direct match:",n.id),n.id;let r=(null===(t=i.submissions)||void 0===t?void 0:t.imageSubmissionChains)||{},l=o.filter(e=>(r[e.id]||[]).includes(a));if(0===l.length)return s.V.debug("getImageIdForSubmission","No candidates found"),null;let d=l.sort((e,a)=>new Date(e.created_at)-new Date(a.created_at)),m=(r[d[0].id]||[]).indexOf(a);if(m>=0&&m<d.length){let e=d[m];return s.V.debug("getImageIdForSubmission","Using position mapping:",e.id),e.id}return s.V.debug("getImageIdForSubmission","Insufficient data to map; returning null"),null},getImageLoadState:a=>{var t,i;return(null===(i=e.getState().generation)||void 0===i?void 0:null===(t=i.imageLoadStates)||void 0===t?void 0:t[a])||{loaded:!1,error:!1}}}),[e])}function p(){let e=l(),a=(0,r.X8)(),t=c();(0,r.Vl)();let o=(0,r.o2)();return(0,i.useMemo)(()=>({...e,...a,...t,getCurrentSubmissionChain:()=>o}),[e,a,t,o])}function h(){let e=l(),{currentChainPrompts:a,latestPrompt:t,pendingPrompts:o,hasUnsavedChanges:n,hasActivePrompt:s}=p();return(0,i.useMemo)(()=>({...e,currentChainPrompts:a,latestPrompt:t,pendingPrompts:o,hasUnsavedChanges:n,hasActivePrompt:s}),[e,a,t,o,n,s])}function f(){return(0,n.Fx)((0,o.k)(e=>{var a;return(null===(a=e.workbench)||void 0===a?void 0:a.promptInputCollapsed)||{}}))}function b(e){return(0,n.Fx)(a=>{var t,i;return(null===(i=a.workbench)||void 0===i?void 0:null===(t=i.promptInputCollapsed)||void 0===t?void 0:t[e])||!1})}},5638:(e,a,t)=>{t.r(a),t.d(a,{UIStateProvider:()=>o.rV,useCanRedo:()=>I,useCanUndo:()=>v,useCurrentSubmissionChain:()=>C.mj,useCurrentSubmissionChainData:()=>C.o2,useCurrentSubmissionChainState:()=>C.Vl,useDashboard:()=>T.MZ,useDashboardActions:()=>T.vg,useDashboardState:()=>T.TN,useHasMaskData:()=>y,useImageIdForSubmission:()=>C.bA,useImageLoadState:()=>P.gM,useImageLoadStates:()=>P.xv,useImageMaskLibrary:()=>S,useImageMaskLibraryActions:()=>_,useImageMaskLibraryState:()=>x,useImageMasking:()=>k,useImageMaskingActions:()=>b,useImageMaskingState:()=>f,useImageSubmissionChainLengths:()=>P.Rf,useImageSubmissionChainsData:()=>C.dZ,useImageSubmissionChainsState:()=>C.UJ,useImages:()=>l.uD,useImagesActions:()=>l.Z2,useImagesState:()=>l.xp,useIsLoadingImages:()=>l.Ac,useIsPromptCollapsed:()=>P.$6,useLiveImageChainLengths:()=>C.Dl,useModel:()=>M.fn,useModelActions:()=>M.uA,useModelViewState:()=>M.xc,useParameterActions:()=>g,useParameters:()=>d,useParametersComplete:()=>u,useParametersState:()=>m,usePromptCollapsedState:()=>P.U1,useSelectedImageId:()=>l.lZ,useSelectedModel:()=>M.kA,useSubmissionActions:()=>C.X8,useToast:()=>n,useToastComplete:()=>r,useToastState:()=>s,useUIState:()=>o.Fx,useUIStore:()=>
1o.j_,useWorkbench:()=>P.Vu,useWorkbenchActions:()=>P.Er,useWorkbenchState:()=>P._z,useWorkbenchSubmissionChains:()=>P.Tc});var i=t(4426),o=t(42);function n(){return(0,o.Fx)((0,i.k)(e=>({showToast:e.showToast,hideToast:e.hideToast,clearAllToasts:e.clearAllToasts,showSuccessToast:e.showSuccessToast,showErrorToast:e.showErrorToast,showInfoToast:e.showInfoToast,showWarningToast:e.showWarningToast})))}function s(){return(0,o.Fx)((0,i.k)(e=>({toasts:e.toasts||[]})))}function r(){let e=n();return{...s(),...e}}var l=t(1814);function d(){return(0,o.Fx)(e=>e.parameters)}function m(){return(0,o.Fx)((0,i.k)(e=>({parameters:e.parameters,isLoadingParameters:e.isLoadingParameters,hasParameters:Object.keys(e.parameters||{}).length>0})))}function g(){return(0,o.Fx)((0,i.k)(e=>({setParameters:e.setParameters,updateParameters:e.updateParameters,clearParameters:e.clearParameters,setLoadingParameters:e.setLoadingParameters})))}function u(){let e=m(),a=g();return{...e,...a}}let c={imageDimensions:null,mousePosition:{x:0,y:0},isHovering:!1,mounted:!1},p={isCtrlPressed:!1,isEraseMode:!1},h={isLoading:!1,error:null,lastSavedMask:null};function f(){return(0,o.Fx)((0,i.k)(e=>{var a,t,i,o,n,s,r,l,d,m,g,u,f,b,v,I,y,k,w,x,_,S,M,T,C,P;return{isActive:null!==(b=null===(a=e.imageMasking)||void 0===a?void 0:a.isActive)&&void 0!==b&&b,currentImageId:null!==(v=null===(t=e.imageMasking)||void 0===t?void 0:t.currentImageId)&&void 0!==v?v:null,brushSize:null!==(I=null===(i=e.imageMasking)||void 0===i?void 0:i.brushSize)&&void 0!==I?I:20,brushColor:null!==(y=null===(o=e.imageMasking)||void 0===o?void 0:o.brushColor)&&void 0!==y?y:"#000000",maskData:null!==(k=null===(n=e.imageMasking)||void 0===n?void 0:n.maskData)&&void 0!==k?k:null,canvasReady:null!==(w=null===(s=e.imageMasking)||void 0===s?void 0:s.canvasReady)&&void 0!==w&&w,isDrawing:null!==(x=null===(r=e.imageMasking)||void 0===r?void 0:r.isDrawing)&&void 0!==x&&x,maskHistory:null!==(_=null===(l=e.imageMasking)||void 0===l?void 0:l.maskHistory)&&void 0!==_?_:null,historyIndex:null!==(S=null===(d=e.imageMasking)||void 0===d?void 0:d.historyIndex)&&void 0!==S?S:-1,initialMask:null!==(M=null===(m=e.imageMasking)||void 0===m?void 0:m.initialMask)&&void 0!==M?M:null,canvasUI:null!==(T=null===(g=e.imageMasking)||void 0===g?void 0:g.canvasUI)&&void 0!==T?T:c,keyboard:null!==(C=null===(u=e.imageMasking)||void 0===u?void 0:u.keyboard)&&void 0!==C?C:p,saving:null!==(P=null===(f=e.imageMasking)||void 0===f?void 0:f.saving)&&void 0!==P?P:h}}))}function b(){let e=(0,o.j_)();return{...(0,o.Fx)((0,i.k)(e=>({startMasking:e.setMaskingActive,setBrushSize:e.setBrushSize,setBrushColor:e.setBrushColor,setCanvasReady:e.setCanvasReady,setIsDrawing:e.setIsDrawing,clearMask:e.clearMask,resetMaskingState:e.resetMaskingState,setInitialMask:e.setInitialMask,clearInitialMask:e.clearInitialMask,setImageDimensions:e.setImageDimensions,setMousePosition:e.setMousePosition,setCanvasHovering:e.setCanvasHovering,setCanvasMounted:e.setCanvasMounted,setCtrlPressed:e.setCtrlPressed,setEraseMode:e.setEraseMode,adjustBrushSize:e.adjustBrushSize,setSaving:e.setSaving,setSaveError:e.setSaveError,setSaveSuccess:e.setSaveSuccess}))),stopMasking:e.stopMasking,initializeCanvas:e.initializeCanvas,loadCanvasImage:e.loadCanvasImage,disposeCanvas:e.disposeCanvas,updateBrushSettings:e.updateBrushSettings,clearCanvasMask:e.clearCanvasMask,exportCanvasMask:e.exportCanvasMask,saveMaskToDatabase:e.saveMaskToDatabase}}function v(){return(0,o.Fx)(e=>{var a,t;return(null!==(t=null===(a=e.imageMasking)||void 0===a?void 0:a.historyIndex)&&void 0!==t?t:0)>0})}function I(){return(0,o.Fx)(e=>{var a,t,i,o,n;return(null!==(o=null===(a=e.imageMasking)||void 0===a?void 0:a.historyIndex)&&void 0!==o?o:0)<(null!==(n=null===(i=e.imageMasking)||void 0===i?void 0:null===(t=i.maskHistory)||void 0===t?void 0:t.length)&&void 0!==n?n:0)-1})}function y(){return(0,o.Fx)(e=>{var a;return!!(null===(a=e.imageMasking)||void 0===a?void 0:a.maskData)})}function k(){let e=f(),a=b();return{...e,...a}}var w=t(623);function x(){return(0,o.Fx)((0,i.k)(e=>{var a,t,i,o,n,s,r,l;return{isVisible:(null===(t=e.imageMasking)||void 0===t?void 0:null===(a=t.maskLibrary)||void 0===a?void 0:a.isVisible)||!1,savedMasks:(null===(o=e.imageMasking)||void 0===o?void 0:null===(i=o.maskLibrary)||void 0===i?void 0:i.savedMasks)||[],isLoadingMasks:(null===(s=e.imageMasking)||void 0===s?void 0:null===(n=s.maskLibrary)||void 0===n?void 0:n.isLoadingMasks)||!1,loadError:null===(l=e.imageMasking)||void 0===l?void 0:null===(r=l.maskLibrary)||void 0===r?void 0:r.loadError}}))}function _(){let e=(0,o.j_)();return(0,o.Fx)((0,i.k)(a=>({setMaskLibraryVisible:a.setMaskLibraryVisible,setSavedMasks:a.setSavedMasks,setMaskLibraryLoading:a.setMaskLibraryLoading,setMaskLibraryError:a.setMaskLibraryError,loadImageMasks:e.loadImageMasks,saveMaskToDatabase:e.saveMaskToDatabase,loadMaskData:e.loadMaskData})))}function S(){let e=x(),a=_(),{isVisible:t}=e;return(0,w.useEffect)(()=>{console.log("\uD83D\uDCDA [MaskLibrary] render — isVisible:",t)},[t]),(0,w.useCallback)(e=>{console.log("\uD83D\uDCDA [MaskLibrary] onSelect → startMasking",{maskId:e.id})},[]),{...e,...a}}var M=t(1049),T=t(7376),C=t(3821),P=t(5261)},6233:(e,a,t)=>{t.d(a,{Z:()=>o});class i{getCachedModelData(e){let a=this.cache.get(e);return console.log("[ImageCache] Getting cache for model ".concat(e,":"),a?"FOUND":"NOT FOUND"),a&&console.log("[ImageCache] Cache details:",{imageCount:a.images.length,lastUpdated:a.lastUpdated,age:Date.now()-a.lastUpdated}),a}hasModelCache(e){let a=this.cache.get(e);return a&&a.images&&a.images.length>0}setCacheForModel(e,a,t){console.log("[ImageCache] Setting cache for model ".concat(e,":"),{imageCount:a.length,pagination:t}),this.cache.set(e,{images:a,pagination:t,lastUpdated:Date.now()}),console.log("[ImageCache] Cache updated. Current cache stats:",this.getCacheStats())}updateImageInCache(e,a,t){let i=this.cache.get(e);if(!i)return null;let o=i.images.map(e=>e.id===a?{...e,...t}:e);return this.cache.set(e,{...i,images:o,lastUpdated:Date.now()}),o}addImageToCache(e,a){let t=this.cache.get(e);if(!t)return[a];let i=[a,...t.images];return this.cache.set(e,{...t,images:i,pagination:{...t.pagination,totalImages:(t.pagination.totalImages||0)+1},lastUpdated:Date.now()}),i}removeImageFromCache(e,a){let t=this.cache.get(e);if(!t)return[];let i=t.images.filter(e=>e.id!==a);return this.cache.set(e,{...t,images:i,pagination:{...t.pagination,totalImages:Math.max(0,(t.pagination.totalImages||0)-1)},lastUpdated:Date.now()}),i}clearModelCache(e){console.log("[ImageCache] Clearing cache for model: ".concat(e)),this.cache.delete(e)}clearAllCache(){console.log("[ImageCache] Clearing all cache"),this.cache.clear()}getCacheStats(){let e={};return this.cache.forEach((a,t)=>{e[t]={imageCount:a.images.length,lastUpdated:a.lastUpdated,age:Date.now()-a.lastUpdated}}),e}constructor(){this.cache=new Map,this.CACHE_DURATION=15e5}}let o=new i},7376:(e,a,t)=>{t.d(a,{MZ:()=>r,TN:()=>n,vg:()=>s});var i=t(4426),o=t(42);function n(){return(0,o.Fx)((0,i.k)(e=>({activeDashboardTab:e.activeDashboardTab,isWorkbenchActive:"workbench"===e.activeDashboardTab,isGeneralActive:"general"===e.activeDashboardTab})))}function s(){return(0,o.Fx)((0,i.k)(e=>({setActiveDashboardTab:e.setActiveDashboardTab,resetDashboardTab:e.resetDashboardTab})))}function r(){let e=n(),a=s();return{...e,...a}}},7680:(e,a,t)=>{t.d(a,{eR:()=>f,vO:()=>h});let i=(e,a)=>({...a,...e.parameters,prompt:e.prompt||"",negative_prompt:e.negative_prompt||""}),o=(e,a)=>{var t,i,o,n,s,r,l;return{...a,...e.parameters,prompt:e.prompt||"",negative_prompt:e.negative_prompt||"",width:(null===(t=e.parameters)||void 0===t?void 0:t.width)||a.width,height:(null===(i=e.parameters)||void 0===i?void 0:i.height)||a.height,num_inference_steps:(null===(o=e.parameters)||void 0===o?void 0:o.num_inference_steps)||a.num_inference_steps,guidance_scale:(null===(n=e.parameters)||void 0===n?void 0:n.guidance_scale)||a.guidance_scale,scheduler:(null===(s=e.parameters)||void 0===s?void 0:s.scheduler)||a.scheduler,image:(null===(r=e.parameters)||void 0===r?void 0:r.image)||a.image,mask:(null===(l=e.parameters)||void 0===l?void 0:l.mask)||a.mask}},n=(e,a)=>{var t,i,o,n;return{...a,...e.parameters,prompt:e.prompt||"",negative_prompt:e.negative_prompt||"",safety_tolerance:(null===(t=e.parameters)||void 0===t?void 0:t.safety_tolerance)||a.safety_tolerance,prompt_upsampling:(null===(i=e.parameters)||void 0===i?void 0:i.prompt_upsampling)||a.prompt_upsampling,output_format:(null===(o=e.parameters)||void 0===o?void 0:o.output_format)||a.output_format,output_quality:(null===(n=e.parameters)||void 0===n?void 0:n.output_quality)||a.output_quality}},s=(e,a)=>{var t,i,o,n,s;return{...a,...e.parameters,prompt:e.prompt||"",negative_prompt:e.negative_prompt||"",aspect_ratio:(null===(t=e.parameters)||void 0===t?void 0:t.as
1pect_ratio)||a.aspect_ratio,safety_tolerance:(null===(i=e.parameters)||void 0===i?void 0:i.safety_tolerance)||a.safety_tolerance,seed:(null===(o=e.parameters)||void 0===o?void 0:o.seed)||a.seed,raw:(null===(n=e.parameters)||void 0===n?void 0:n.raw)||a.raw,output_format:(null===(s=e.parameters)||void 0===s?void 0:s.output_format)||a.output_format}},r=(e,a)=>{var t,i,o,n;return{...a,...e.parameters,prompt:e.prompt||"",negative_prompt:e.negative_prompt||"",input_image:(null===(t=e.parameters)||void 0===t?void 0:t.input_image)||a.input_image,mask:(null===(i=e.parameters)||void 0===i?void 0:i.mask)||a.mask,aspect_ratio:(null===(o=e.parameters)||void 0===o?void 0:o.aspect_ratio)||a.aspect_ratio,seed:(null===(n=e.parameters)||void 0===n?void 0:n.seed)||a.seed}},l=(e,a)=>{var t,i,o,n;return{...a,...e.parameters,prompt:e.prompt||"",negative_prompt:e.negative_prompt||"",input_image:(null===(t=e.parameters)||void 0===t?void 0:t.input_image)||a.input_image,mask:(null===(i=e.parameters)||void 0===i?void 0:i.mask)||a.mask,aspect_ratio:(null===(o=e.parameters)||void 0===o?void 0:o.aspect_ratio)||a.aspect_ratio,seed:(null===(n=e.parameters)||void 0===n?void 0:n.seed)||a.seed}},d=(e,a)=>{var t,i,o,n,s,r,l,d,m;return{...a,...e.parameters,prompt:e.prompt||"",negative_prompt:e.negative_prompt||"",image:(null===(t=e.parameters)||void 0===t?void 0:t.image)||a.image,mask:(null===(i=e.parameters)||void 0===i?void 0:i.mask)||a.mask,outpaint:(null===(o=e.parameters)||void 0===o?void 0:o.outpaint)||a.outpaint,steps:(null===(n=e.parameters)||void 0===n?void 0:n.steps)||a.steps,guidance:(null===(s=e.parameters)||void 0===s?void 0:s.guidance)||a.guidance,safety_tolerance:(null===(r=e.parameters)||void 0===r?void 0:r.safety_tolerance)||a.safety_tolerance,prompt_upsampling:null!==(m=null===(l=e.parameters)||void 0===l?void 0:l.prompt_upsampling)&&void 0!==m?m:a.prompt_upsampling,output_format:(null===(d=e.parameters)||void 0===d?void 0:d.output_format)||a.output_format}},m=(e,a)=>{var t,i,o,n,s,r,l;return{...a,...e.parameters,prompt:e.prompt||"",negative_prompt:e.negative_prompt||"",aspect_ratio:(null===(t=e.parameters)||void 0===t?void 0:t.aspect_ratio)||a.aspect_ratio,resolution:(null===(i=e.parameters)||void 0===i?void 0:i.resolution)||a.resolution,magic_prompt_option:(null===(o=e.parameters)||void 0===o?void 0:o.magic_prompt_option)||a.magic_prompt_option,style_type:(null===(n=e.parameters)||void 0===n?void 0:n.style_type)||a.style_type,style_reference_images:(null===(s=e.parameters)||void 0===s?void 0:s.style_reference_images)||a.style_reference_images||[],image:(null===(r=e.parameters)||void 0===r?void 0:r.image)||a.image,mask:(null===(l=e.parameters)||void 0===l?void 0:l.mask)||a.mask}},g=(e,a)=>{var t,i,o,n,s,r,l;return{...a,...e.parameters,prompt:e.prompt||"",negative_prompt:e.negative_prompt||"",aspect_ratio:(null===(t=e.parameters)||void 0===t?void 0:t.aspect_ratio)||a.aspect_ratio,resolution:(null===(i=e.parameters)||void 0===i?void 0:i.resolution)||a.resolution,magic_prompt_option:(null===(o=e.parameters)||void 0===o?void 0:o.magic_prompt_option)||a.magic_prompt_option,style_type:(null===(n=e.parameters)||void 0===n?void 0:n.style_type)||a.style_type,style_reference_images:(null===(s=e.parameters)||void 0===s?void 0:s.style_reference_images)||a.style_reference_images||[],image:(null===(r=e.parameters)||void 0===r?void 0:r.image)||a.image,mask:(null===(l=e.parameters)||void 0===l?void 0:l.mask)||a.mask}},u=(e,a)=>{var t,i,o,n,s;return{...a,...e.parameters,prompt:e.prompt||"",negative_prompt:e.negative_prompt||"",aspect_ratio:(null===(t=e.parameters)||void 0===t?void 0:t.aspect_ratio)||a.aspect_ratio,resolution:(null===(i=e.parameters)||void 0===i?void 0:i.resolution)||a.resolution,magic_prompt_option:(null===(o=e.parameters)||void 0===o?void 0:o.magic_prompt_option)||a.magic_prompt_option,style_type:(null===(n=e.parameters)||void 0===n?void 0:n.style_type)||"photorealistic",style_reference_images:(null===(s=e.parameters)||void 0===s?void 0:s.style_reference_images)||a.style_reference_images||[]}},c=(e,a)=>{var t,i,o,n,s,r,l,d;return{...a,...e.parameters,image:(null===(t=e.parameters)||void 0===t?void 0:t.originalImageUrl)||"",enhance_model:(null===(i=e.parameters)||void 0===i?void 0:i.enhance_model)||a.enhance_model,upscale_factor:(null===(o=e.parameters)||void 0===o?void 0:o.upscale_factor)||a.upscale_factor,output_format:(null===(n=e.parameters)||void 0===n?void 0:n.output_format)||a.output_format,subject_detection:(null===(s=e.parameters)||void 0===s?void 0:s.subject_detection)||a.subject_detection,face_enhancement:(null===(r=e.parameters)||void 0===r?void 0:r.face_enhancement)||a.face_enhancement,face_enhancement_creativity:(null===(l=e.parameters)||void 0===l?void 0:l.face_enhancement_creativity)||a.face_enhancement_creativity,face_enhancement_strength:(null===(d=e.parameters)||void 0===d?void 0:d.face_enhancement_strength)||a.face_enhancement_strength}},p=(e,a)=>{var t,i;return{...a,...e.parameters,prompt:e.prompt||"",negative_prompt:e.negative_prompt||"",image:(null===(t=e.parameters)||void 0===t?void 0:t.image)||a.image,mask:(null===(i=e.parameters)||void 0===i?void 0:i.mask)||a.mask}},h=e=>({"gemini-2-5-flash-image":p,sdxl:o,"flux-pro":n,"flux-pro-ultra":s,"flux-fill-pro":d,"flux-kontext-pro":r,"flux-kontext-max":l,"ideogram-v3-quality":m,"ideogram-v3-turbo":g,"conceptual-photography":u,"topaz-image-upscale":c})[e]||i,f=(e,a)=>{let t={...e},i={};
1return null==a||a.forEach(e=>{i[e.name]=e}),Object.entries(t).forEach(e=>{let[a,o]=e,n=i[a];n&&null!=o&&""!==o&&(("text"===n.type||"range"===n.type)&&(void 0!==n.min||void 0!==n.max)&&(a.includes("scale")||a.includes("strength")||a.includes("frac")||n.step<1?t[a]=parseFloat(o):t[a]=parseInt(o,10)),"checkbox"===n.type&&(t[a]=!!o),"scheduler"!==a||["DDIM","DPMSolverMultistep","HeunDiscrete","KarrasDPM","K_EULER_ANCESTRAL","K_EULER","PNDM"].includes(o)||(console.warn("Invalid scheduler value: ".concat(o,". Defaulting to K_EULER")),t[a]="K_EULER"))}),t}},7953:(e,a,t)=>{t.d(a,{$N:()=>r,FW:()=>n,bs:()=>o,mO:()=>i,rn:()=>l});let i=[{id:"gemini-2-5-flash-image",dbUuid:"26a7e645-2aa2-4832-a612-c20cf34ad392",replicateModelId:"google/gemini-2.5-flash-image-preview",provider:"google",name:"Gemini 2.5 Flash (Image Preview)",description:"Google Gemini native image generation and editing. Supports text-to-image and image edits.",sampleImage:"/samples/gemini-2-5-flash-image-preview.png",defaultOutputImage:"/samples/gemini-2-5-flash-image-preview.png",order:-1,isAvailable:!0,generatorType:"gemini",defaultParams:{prompt:"...",image:"",multi_turn:!0,input_images:[]},paramSchema:[{name:"prompt",type:"textarea",label:"Prompt",required:!0,placeholder:"Describe what to generate or edit",description:"Text prompt for image generation or editing",order:0},{name:"input_images",type:"style_reference_images",label:"Add multiple files",placeholder:"Add up to 3 images",description:"Input images to transform or use as reference (supports multiple images)",order:1},{name:"multi_turn",type:"checkbox",label:"Multi-turn editing",description:"Automatically reuse the last generated image for iterative refinement",order:2}]},{id:"sdxl",dbUuid:"b2af5872-3729-4069-bc3c-2d351cd19ce3",replicateModelId:"stability-ai/sdxl:8beff3369e81422112d93b89ca01426147de542cd4684c244b673b105188fe5f",name:"Stable Diffusion XL",description:"Latest version of Stable Diffusion, offering high-quality image generation with enhanced detail and composition.",sampleImage:"/samples/sdxl-sample.png",defaultOutputImage:"/samples/sdxl-sample.png",order:998,defaultParams:{prompt:"Generate a black and white image in the style of a 1950s science fiction film still, reminiscent of classic UFO abduction scenes.  The composition should feature a large, saucer-shaped UFO, hovering low in the sky, occupying roughly the upper third of the frame. The UFO should have a grainy, slightly textured surface, suggesting a film grain effect and possibly a hint of  noise to enhance the vintage feel. In the lower two-thirds of the image, a man and a woman, dressed in 1950s attire, stand in the foreground. The man is wearing a light-grey suit,  a crisp white shirt and a tie; the woman is wearing a simple, light-colored, knee-length dress. Both appear concerned and slightly apprehensive, gazing upwards towards the UFO. The man's expression should show worry and alertness, while the woman appears more stunned and fearful, almost paralyzed.  Their clothing should be sharply detailed, showcasing the texture of the fabric. The background features a dark, silhouetted mass of trees and possibly the blurry suggestion of a building or structure on the right side, adding depth and indicating a suburban or residential setting, possibly a nighttime or twilight scene indicated by darker tonality.  The overall mood should be one of suspense, unease, and impending dread. The image should employ a high contrast, with deep blacks and bright whites, evoking a classic film noir feel. The color palette is strictly grayscale, aiming for a monochromatic effect typical of mid-century photography. The style should be photorealistic,  but with a subtle, stylized touch; the image shouldn't be overly sharp or clean, maintaining a slightly grainy, somewhat vintage texture and low resolution look for authenticity. The focus should be sharp on the couple, while the UFO and background show more artistic blur or softening for a stylized effect. There should be a slight vignette effect around the edges to darken the corners of the image.",negative_prompt:"cartoon",width:1024,height:1024,scheduler:"K_EULER",num_inference_steps:30,guidance_scale:7.5,prompt_strength:.8,seed:null,refine:"no_refiner",high_noise_frac:.8,apply_watermark:!0,lora_scale:.6},paramSchema:[{name:"prompt",type:"textarea",label:"Prompt",defaultValue:"Generate a black and white image in the style of a 1950s scie
1nce fiction film still, reminiscent of classic UFO abduction scenes.  The composition should feature a large, saucer-shaped UFO, hovering low in the sky, occupying roughly the upper third of the frame. The UFO should have a grainy, slightly textured surface, suggesting a film grain effect and possibly a hint of  noise to enhance the vintage feel. In the lower two-thirds of the image, a man and a woman, dressed in 1950s attire, stand in the foreground. The man is wearing a light-grey suit,  a crisp white shirt and a tie; the woman is wearing a simple, light-colored, knee-length dress. Both appear concerned and slightly apprehensive, gazing upwards towards the UFO. The man's expression should show worry and alertness, while the woman appears more stunned and fearful, almost paralyzed.  Their clothing should be sharply detailed, showcasing the texture of the fabric. The background features a dark, silhouetted mass of trees and possibly the blurry suggestion of a building or structure on the right side, adding depth and indicating a suburban or residential setting, possibly a nighttime or twilight scene indicated by darker tonality.  The overall mood should be one of suspense, unease, and impending dread. The image should employ a high contrast, with deep blacks and bright whites, evoking a classic film noir feel. The color palette is strictly grayscale, aiming for a monochromatic effect typical of mid-century photography. The style should be photorealistic,  but with a subtle, stylized touch; the image shouldn't be overly sharp or clean, maintaining a slightly grainy, somewhat vintage texture and low resolution look for authenticity. The focus should be sharp on the couple, while the UFO and background show more artistic blur or softening for a stylized effect. There should be a slight vignette effect around the edges to darken the corners of the image.",placeholder:"Input prompt",description:"Input prompt",order:0,required:!0},{name:"negative_prompt",type:"textarea",label:"Negative Prompt",defaultValue:"cartoon",placeholder:"Input Negative Prompt",description:"Input Negative Prompt",order:1},{name:"image",type:"file",label:"Image",placeholder:"URL for img2img or inpaint mode",description:"Input image for img2img or inpaint mode",order:2},{name:"mask",type:"file",label:"Mask",placeholder:"URL for inpaint mask",description:"Input mask for inpaint mode. Black areas will be preserved, white areas will be inpainted.",order:3},{name:"width",type:"text",label:"Width",defaultValue:1024,min:256,max:1536,step:64,description:"Width of output image. Recommended: 1024. Max: 1536 during beta.",order:4},{name:"height",type:"text",label:"Height",defaultValue:1024,min:256,max:1536,step:64,description:"Height of output image. Recommended: 1024. Max: 1536 during beta.",order:5},{name:"scheduler",type:"select",label:"Scheduler",options:["DDIM","DPMSolverMultistep","HeunDiscrete","KarrasDPM","K_EULER_ANCESTRAL","K_EULER","PNDM"],defaultValue:"K_EULER",description:"Scheduler",order:7},{name:"num_inference_steps",type:"text-range",label:"Num Inference Steps",defaultValue:30,min:1,max:500,step:1,description:"Number of denoising steps",order:8},{name:"guidance_scale",type:"text-range",label:"Guidance Scale",defaultValue:7.5,min:1,max:50,step:.1,description:"Scale for classifier-free guidance",order:9},{name:"prompt_strength",type:"text-range",label:"Prompt Strength",defaultValue:.8,min:0,max:1,step:.01,description:"Prompt strength when using img2img / inpaint. 1.0 corresponds to full destruction of information in image. Only used if image is provided.",condition:e=>!!e.image,order:10},{name:"seed",type:"text",label:"Seed",placeholder:"Leave blank to randomize",description:"Random seed. Leave blank to randomize the seed",order:11},{name:"refine",type:"select",label:"Refine",options:["no_refiner","expert_ensemble_refiner","base_image_refiner"],defaultValue:"no_refiner",description:"Which refine style to use",order:12},{name:"high_noise_frac",type:"text-range",label:"High Noise Frac",defaultValue:.8,min:0,max:1,step:.01,description:"For expert_ensemble_refiner, the fraction of noise to use",condition:e=>"expert_ensemble_refiner"===e.refine,order:13},{name:"refine_steps",type:"text",label:"Refine Steps",min:0,max:500,step:1,placeholder:"Defaults to num_inference_steps",description:"For base_image_refiner, the number of steps to refine, defaults to num_inference_steps",condition:e=>"base_image_refiner"===e.refine,order:14},{name:"apply_watermark",type:"checkbox",label:"Apply Watermark",defaultValue:!0,placeholder:"Apply watermark to output",description:"Applies a watermark to enable determining if an image is generated in downstream applications.",order:15},{name:"lora_scale",type:"text-range",label:"Lora Scale",defaultValue:.6,min:0,max:1,step:.
101,description:"LoRA additive scale. Only applicable on trained models.",order:16},{name:"disable_safety_checker",type:"checkbox",label:"Disable Safety Checker",defaultValue:!1,placeholder:"Disable safety checker",description:"Disable safety checker for generated images.",order:17}]},{id:"flux-pro",dbUuid:"b137b0c6-1180-427a-8142-98065e4a8c52",replicateModelId:"black-forest-labs/flux-1.1-pro",name:"Flux 1.1 Pro",description:"FLUX.1 Pro by Black Forest Labs - Fast, high-quality image generation model.",sampleImage:"/samples/flux-pro-sample.png",defaultOutputImage:"/samples/flux-pro-sample.png",order:3,defaultParams:{prompt:'Generate a high-resolution photograph of a single pistachio cupcake with strawberry frosting, meticulously styled on a small, off-white saucer with a thin gold rim. Under the saucer should be a small high quality napkin with emerald green line border and the text "HILMA" in sophisticated font. The cupcake should be in sharp focus, with a shallow depth of field blurring the background.  Two additional cupcakes, slightly out of focus, are visible in the background, one to the left and one to the right, angled slightly away from the main subject.  These background cupcakes should also have pale green bases and the same vibrant pink strawberry frosting topped with a sprinkle of light green pistachio. The frosting is a swirl design, a light, pastel pink with visible tiny strawberry seeds speckles throughout.  The top of the frosting is delicately dusted with a light scattering of finely ground pistachios, creating a textural contrast. The cupcake liner is a pale cream or off-white, subtly textured with vertical pleats. The cupcake itself is a pale, light green, suggesting pistachio flavor, with a slightly visible crumb texture. The saucer sits on a light grey or off-white surface. Two ripe, red strawberries are placed artfully on the surface near the saucer, one slightly out of focus, and one in focus, creating a visually appealing contrast in color and texture alongside the delicate pastel tones of the cupcakes. A soft, pale teal linen napkin is partially visible in the bottom left corner, suggesting a delicate, elegant presentation. The lighting should be soft, diffused natural light, eliminating harsh shadows and creating a gentle, even illumination across the scene. The overall color palette should be soft and pastel, with a focus on the contrasts between the light green cupcakes, the vibrant pink frosting, the deep red of the strawberries, and the muted grey background. The style should emulate high-quality food photography, with a clean, minimalist aesthetic and a focus on detail and texture. The overall mood should be light, airy, delicate, and appetizing. The image should have a shallow depth of field, emphasizing the central cupcake.  The composition should follow the rule of thirds, with the main cupcake slightly off-center. The style should be reminiscent of a food blog photograph with a clean, professional feel.',image_prompt:"",aspect_ratio:"4:3",width:1024,height:1024,safety_tolerance:6,seed:null,prompt_upsampling:!1,output_format:"webp",output_quality:100},paramSchema:[{name:"prompt",type:"textarea",label:"Prompt",required:!0,defaultValue:'Generate a high-resolution photograph of a single pistachio cupcake with strawberry frosting, meticulously styled on a small, off-white saucer with a thin gold rim. Under the saucer should be a small high quality napkin with emerald green line border and the text "HILMA" in sophisticated font. The cupcake should be in sharp focus, with a shallow depth of field blurring the background.  Two additional cupcakes, slightly out of focus, are visible in the background, one to the left and one to the right, angled slightly away from the main subject.  These background cupcakes should also have pale green bases and the same vibrant pink strawberry frosting topped with a sprinkle of light green pistachio. The frosting is a swirl design, a light, pastel pink with visible tiny strawberry seeds speckles throughout.  The top of the frosting is delicately dusted with a light scattering of finely ground pistachios, creating a textural contrast. The cupcake liner is a pale cream or off-white, subtly textured with vertical pleats. The cupcake itself is a pale, light green, suggesting pistachio flavor, with a slightly visible crumb texture. The saucer sits on a light grey or off-white surface. Two ripe, red strawberries are placed artfully on the surface near the saucer, one slightly out of focus, and one in focus, creating a visually appealing contrast in color and texture alongside the delicate pastel tones of the cupcakes. A soft, pale teal linen napkin is partially visible in the bottom left corner, suggesting a delicate, elegant presentation. The lighting should be soft, diffused natural light, eliminating harsh shadows and creating a gentle, even illumination across the scene. The overall color palette should be soft and pastel, with a focus on the contrasts between the light green cupcakes, the vibrant pink frosting, the deep red of the strawberries, and the muted grey background. The style should emulate high-quality food photography, with a clean, minimalist aesthetic and a focus on detail and texture. The overall mood should be light, airy, delicate, and appetizing. The image should have a shallow depth of field, emphasizing the central cupcake.  The composition should follow the rule of thirds, with the main cupcake slightly off-center. The style should be reminiscent of a food blog photograph with a clean, professional feel.',placeholder:"Text prompt for image generation",description:"Text prompt for image generation",order:0},{name:"image_prompt",type:"file",label:"Image Prompt",placeholder:"URL of image for Flux Redux",de
1scription:"Image to use with Flux Redux. This is used together with the text prompt to guide the generation towards the composition of the image_prompt. Must be jpeg, png, gif, or webp.",order:9},{name:"aspect_ratio",type:"select",label:"Aspect Ratio",options:["custom","1:1","16:9","3:2","2:3","4:5","5:4","9:16","3:4","4:3"],defaultValue:"4:3",description:"Aspect ratio for the generated image",order:2},{name:"width",type:"text",label:"Width",defaultValue:1024,min:256,max:1440,step:32,description:"Width of the generated image in text-to-image mode. Only used when aspect_ratio=custom. Must be a multiple of 32.",condition:e=>"custom"===e.aspect_ratio,order:3},{name:"height",type:"text",label:"Height",defaultValue:1024,min:256,max:1440,step:32,description:"Height of the generated image in text-to-image mode. Only used when aspect_ratio=custom. Must be a multiple of 32.",condition:e=>"custom"===e.aspect_ratio,order:4},{name:"safety_tolerance",type:"text-range",label:"Safety Tolerance",defaultValue:6,min:1,max:6,step:1,description:"Safety tolerance, 1 is most strict and 6 is most permissive",order:8},{name:"seed",type:"text",label:"Seed",placeholder:"Enter a number for reproducible generation",description:"Random seed. Set for reproducible generation",order:7},{name:"prompt_upsampling",type:"checkbox",label:"Prompt Upsampling",defaultValue:!1,placeholder:"Automatically modify prompt",description:"Automatically modify the prompt for more creative generation",order:1},{name:"output_format",type:"select",label:"Output Format",options:["webp","jpg","png"],defaultValue:"webp",description:"Format of the output images.",order:5},{name:"output_quality",type:"text-range",label:"Output Quality",defaultValue:100,min:0,max:100,step:1,description:"Quality for webp/jpg. 0-100. Not for .png",order:6}]},{id:"flux-pro-ultra",dbUuid:"b5088b29-cb7b-40e8-aa5b-2d8611efe3b2",replicateModelId:"black-forest-labs/flux-1.1-pro-ultra",name:"Flux 1.1 Pro Ultra",description:"FLUX.1 Pro Ultra by Black Forest Labs - Highest resolution image generation with enhanced detail and realism.",sampleImage:"/samples/flux-pro-ultra-sample.jpg",defaultOutputImage:"/samples/flux-pro-ultra-sample.jpg",order:4,defaultParams:{prompt:'Generate a photorealistic image of a  Hot Air Balloon with the text "HILMA" partially visible on the side of the balloon in flight over a vast, tranquil archipelago at dusk.  The Hot Air Balloon, is centrally positioned but slightly off-center, angled subtly to the right. The Hot Air Balloon should be relatively small in scale compared to the expansive landscape. There should be no people visible in the balloons basket. The archipelago is composed of numerous dark blue-grey islands and inlets, partially shrouded in a light, ethereal morning mist, predominantly clinging to the lower areas and coastlines. The water is a calm, deep blue, reflecting the muted light of the setting or rising sun. The mountains in the background are a darker shade of blue-grey, layered in depth with a hazy atmospheric perspective, suggesting distance. The overall color palette is cool, dominated by blues and greys, with hints of muted greens from the vegetation on the islands. The lighting should be soft and diffuse, characteristic of the soft light at dawn or dusk. There should be no harsh shadows, creating a serene and peaceful mood.  The overall style should be reminiscent of high-quality landscape photography, with a focus on depth of field and atmospheric perspective. The image should have a cinematic quality, evoking a sense of exploration and adventure. The image should be high-resolution, with sharp detail in the Hot Air Balloon and a slightly softer focus on the distant mountains, utilizing a shallow depth of field effect to emphasize the seaplane and its surroundings.  A subtle vignette could enhance the focus on the central subject. The composition should utilize the rule of thirds, with the Hot Air Balloon placed to create visual balance and leading lines created by the waterways guiding the viewer\'s eye through the landscape.  The overall mood should be calm, peaceful, and slightly melancholic, evoking a sense of vastness, solitude, and quiet beauty.  The image should mimic the clarity and sharpness of professional photography, avoiding any overly artificial or stylized elements. Consider a slightly desaturated look to enhance the serene atmosphere.',image_prompt:"",aspect_ratio:"16:9",safety_tolerance:6,seed:null,raw:!1,output_format:"png",image_prompt_strength:.
11},paramSchema:[{name:"prompt",type:"textarea",label:"Prompt",required:!0,placeholder:"Text prompt for image generation",description:"Text prompt for image generation",order:0},{name:"image_prompt",type:"file",label:"Image Prompt",placeholder:"URL of image for Flux Redux",description:"Image to use with Flux Redux. This is used together with the text prompt to guide the generation towards the composition of the image_prompt. Must be jpeg, png, gif, or webp.",order:1},{name:"image_prompt_strength",type:"text-range",label:"Image Prompt Strength",defaultValue:.1,min:0,max:1,step:.01,description:"Blend between the prompt and the image prompt.",condition:e=>!!e.image_prompt,order:2},{name:"aspect_ratio",type:"select",label:"Aspect Ratio",options:["21:9","16:9","3:2","4:3","5:4","1:1","4:5","3:4","2:3","9:16","9:21"],defaultValue:"1:1",description:"Aspect ratio for the generated image",order:3},{name:"safety_tolerance",type:"text-range",label:"Safety Tolerance",defaultValue:2,min:1,max:6,step:1,description:"Safety tolerance, 1 is most strict and 6 is most permissive",order:4},{name:"seed",type:"text",label:"Seed",placeholder:"Enter a number for reproducible generation",description:"Random seed. Set for reproducible generation",order:5},{name:"raw",type:"checkbox",label:"Raw",defaultValue:!1,description:"Generate less processed, more natural-looking images",order:6},{name:"output_format",type:"select",label:"Output Format",options:["jpg","png"],defaultValue:"jpg",description:"Format of the output images.",order:7}]},{id:"ideogram-v3-quality",dbUuid:"e88c0d8b-ee06-4fa6-b9f0-c5bbe2b3b736",replicateModelId:"ideogram-ai/ideogram-v3-quality",name:"Ideogram v3 Quality",description:"High-quality, versatile image generation with the Ideogram v3 model. Excels at rendering text.",sampleImage:"/samples/hilma_girl_yellow.png",defaultOutputImage:"/samples/hilma_girl_yellow.png",order:5,isAvailable:!0,isTuneCard:!1,isUserModel:!1,defaultParams:{prompt:'The text "Hilma" in the center middle. A color film-inspired portrait of a young woman with a shallow depth of field that blurs the surrounding elements, drawing attention to the eye. The color pallet should be warm yellows. The fine grain and cast suggest a high ISO film stock, while the wide aperture lens creates a pleasing bokeh effect, enhancing the candid and natural documentary style.',aspect_ratio:"3:2",resolution:"None",magic_prompt_option:"Off",image:"",mask:"",style_type:"None",seed:null,style_reference_images:[]},paramSchema:[{name:"prompt",type:"textarea",label:"Prompt",required:!0,defaultValue:'The text "Hilma" in the center middle. A color film-inspired portrait of a young woman with a shallow depth of field that blurs the surrounding elements, drawing attention to the eye. The color pallet should be warm yellows. The fine grain and cast suggest a high ISO film stock, while the wide aperture lens creates a pleasing bokeh effect, enhancing the candid and natural documentary style.',placeholder:"Text prompt for image generation",description:"Text prompt for image generation",order:0},{name:"aspect_ratio",type:"select",label:"Aspect Ratio",options:["1:1","16:9","9:16","3:2","2:3","4:3","3:4","5:4","4:5","2:1","1:2","3:1","1:3"],defaultValue:"3:2",description:"Aspect ratio. Ignored if a resolution or inpainting image is given.",order:2},{name:"resolution",type:"select",label:"Resolution",options:["None","512x1536","576x1408","576x1472","576x1536","640x1344","640x1408","640x1472","640x1536","704x1152","704x1216","704x1280","704x1344","704x1408","704x1472","736x1312","768x1088","768x1216","768x1280","768x1344","800x1280","832x960","832x1024","832x1088","832x1152","832x1216","832x1248","864x1152","896x960","896x1024","896x1088","896x1120","896x1152","960x832","960x896","960x1024","960x1088","1024x832","1024x896","1024x960","1024x1024","1088x768","1088x832","1088x896","1088x960","1120x896","1152x704","1152x832","1152x864","1152x896","1216x704","1216x768","1216x832","1248x832","1280x704","1280x768","1280x800","1312x736","1344x640","1344x704","1344x768","1408x576","1408x640","1408x704","1472x576","1472x640","1472x704","1536x512","1536x576","1536x640"],defaultValue:"None",description:"Resolution. Overrides aspect ratio. Ignored if an inpainting image is given.",order:3},{name:"magic_prompt_option",type:"select",label:"Magic Prompt Option",options:["Auto","On","Off"],defaultValue:"Off",description:"Magic Prompt will interpret your prompt and optimize it.",order:1},{name:"image",type:"file",label:"Image (inpainting)",placeholder:"URL of image for inpainting",description:"An image file to use for inpainting. You must also use a mask.",order:4},{name:"mask",type:"file",label:"Mask (inpainting)",placeholder:"URL of mask for inpainting",description:"A black and white image. Black pixels are inpainted, white pixels are preserved.",order:5},{name:"style_type",type:"select",label:"Style Type",options:["None","Auto","General","Realistic","Design"],defaultValue:"None",description:"The styles help define the specific aesthetic of the image.",order:6},{name:"style_reference_images",type:"style-images",label:"Style Reference Images",description:"Add multiple images to use as style references. You can upload files or paste URLs.",order:7},{name:"seed",type:"text",label:"Seed",min:0,max:0x7fffffff,placeholder:"Enter number for reproducible generation",description:"Random seed. Set for reproducible generation",order:8}]},{id:"conceptual-photography",dbUuid:"4eb633f8-cd27-4faf-9d02-6aed053f4d87",replicateModelId:"ideogram-ai/ideogram-v3-quality:7e13f91a8406982076787e1fab19f8389e0347f639fc58705d55f52ad5b69b72",name:"Conceptual Photography",description:"Generate unique images using a predefined conceptual photography style with your own reference images.",sampleImage:"/samples/conceptual-sample.png",order:999,isAvailable:!0,isTuneCard:!1,isUserModel:!1,defaultParams:{prompt:"",aspect_ratio:"1:1",resolution:"None",magic_prompt_option:"Auto",image:"",mask:"",seed:null,style_reference_images:[]},paramSchema:[{name:"prompt",type:"textarea",label:"Prompt",required:!0,placeholder:"Describe your conceptual photograph.",description:"Text prompt for image generation",order:0},{name:"aspect_ratio",type:"select",label:"Aspect Ratio",options:["1:1","16:9","9:16","3:2","2:3","4:3","3:4","5:4","4:5","2:1","1:2","3:1","1:3"],defaultValue:"1:1",description:"Aspect ratio. Ignored if a resolution is given.",order:2},{name:"resolution",type:"select",label:"Resolution",options:["None","512x1536","576x1408","576x1472","576x1536","640x1344","640x1408","640x1472","640x1536","704x1152","704x1216","704x1280","704x1344","704x1408","704x1472","736x1312","768x1088","768x1216","768x1280","768x1344","800x1280","832x960","832x1024","832x1088","832x1152","832x1216","832x1248","864x1152","896x960","896x1024","896x1088","896x1120","896x1152","960x832","960x896","960x1024","960x1088","1024x832","1024x896","1024x960","1024x1024","1088x768","1088x832","1088x896","1088x960","1120x896","1152x704","1152x832","1152x864","1152x896","1216x704","1216x768","1216x832","1248x832","1280x704","1280x768","1280x800","1312x736","1344x640","1344x704","1344x768","1408x576","1408x640","1408x704","1472x576","1472x640","1472x704","1536x512","1536x576","1536x640"],defaultValue:"None",description:"Resolution. Overrides aspect ratio.",order:3},{name:"magic_prompt_option",type:"select",label:"Magic Prompt Option",options:["Auto","On","Off"],defaultValue:"Auto",de
1scription:"Magic Prompt will interpret your prompt and optimize it.",order:1},{name:"seed",type:"text",label:"Seed",min:0,max:0x7fffffff,placeholder:"Enter number for reproducible generation",description:"Random seed.",order:7}],generatorType:"conceptual-photography"},{id:"imagen-4",dbUuid:"8679920c-6f24-444c-9fe9-4b2ff725c6df",replicateModelId:"google/imagen-4",name:"Google Imagen 4",description:"Google's latest high-quality image generation model with excellent photorealism and prompt adherence.",sampleImage:"/samples/imagen-4-sample.png",defaultOutputImage:"/samples/imagen-4-sample.png",order:0,defaultParams:{prompt:'Generate an image with heavy analog photography film grain, of a young woman with a short, naturally curly afro hair.  She is seated sideways with her shoulders rotated toward the camera on a simple, black, slightly worn, metal adjustable stool against a minimalist, off-white studio backdrop.  The woman is wearing a light camel-colored, close-fitting, long-sleeved mini dress made of a knit or textured fabric with subtle ribbed detailing, particularly noticeable across the bust area, suggesting a slightly corseted effect. The dress is simple and elegant, clinging to her body but not overly tight. She wears a thin gold chain with a name pendant that says "HILMA". Her legs are slightly apart, and her pose is relaxed yet poised, one hand resting casually on the stool. Her expression is serene and direct, her gaze engaging the viewer. The lighting is soft and diffused, characteristic of a professional fashion photography shoot, creating even illumination across the subject without harsh shadows. The overall color palette is muted and understated, with the focus on the creamy beige of the dress contrasting subtly against the plain background and dark stool.  The style should evoke a mid-century modern aesthetic, possibly reminiscent of 1960s fashion photography with a clean, almost clinical feel yet with a touch of warmth in the lighting and the model\'s expression. The image should have a high-resolution, soft focus, similar to film photography, and incorporate a subtle, heavy analog photography film grain texture to give it a vintage yet modern feel.  The overall mood is sophisticated, minimalist, and quietly confident. The composition is straightforward, centering the woman while leaving ample negative space around her, creating a feeling of calm and openness.',aspect_ratio:"4:3",safety_filter_level:"block_only_high"},paramSchema:[{name:"prompt",type:"textarea",label:"Prompt",required:!0,defaultValue:'Generate an image with heavy analog photography film grain, of a young woman with a short, naturally curly afro hair.  She is seated sideways with her shoulders rotated toward the camera on a simple, black, slightly worn, metal adjustable stool against a minimalist, off-white studio backdrop.  The woman is wearing a light camel-colored, close-fitting, long-sleeved mini dress made of a knit or textured fabric with subtle ribbed detailing, particularly noticeable across the bust area, suggesting a slightly corseted effect. The dress is simple and elegant, clinging to her body but not overly tight. She wears a thin gold chain with a name pendant that says "HILMA". Her legs are slightly apart, and her pose is relaxed yet poised, one hand resting casually on the stool. Her expression is serene and direct, her gaze engaging the viewer. The lighting is soft and diffused, characteristic of a professional fashion photography shoot, creating even illumination across the subject without harsh shadows. The overall color palette is muted and understated, with the focus on the creamy beige of the dress contrasting subtly against the plain background and dark stool.  The style should evoke a mid-century modern aesthetic, possibly reminiscent of 1960s fashion photography with a clean, almost clinical feel yet with a touch of warmth in the lighting and the model\'s expression. The image should have a high-resolution, soft focus, similar to film photography, and incorporate a subtle, heavy analog photography film grain texture to give it a vintage yet modern feel.  The overall mood is sophisticated, minimalist, and quietly confident. The composition is straightforward, centering the woman while leaving ample negative space around her, creating a feeling of calm and openness.',placeholder:"Text prompt for image generation",description:"Text prompt for image generation",order:0},{name:"aspect_ratio",type:"select",label:"Aspect Ratio",options:["1:1","9:16","16:9","3:4","4:3"],defaultValue:"4:3",description:"Aspect ratio of the generated image",order:1},{name:"safety_filter_level",type:"select",label:"Safety Filter Level",options:["block_low_and_above","block_medium_and_above","block_only_high"],defaultValue:"block_only_high",description:"Safety filter strictness. block_only_high is most permissive, block_low_and_above is strictest",order:2}]}
1,{id:"imagen-4-fast",dbUuid:"7adafb9d-d2b5-4c18-bdd8-1d29af7d9e8f",replicateModelId:"google/imagen-4-fast",name:"Google Imagen 4 Fast",description:"Google's fastest high-quality image generation model. Optimized for speed while maintaining excellent photorealism.",sampleImage:"/samples/imagen-4-fast-sample.png",defaultOutputImage:"/samples/imagen-4-fast-sample.png",order:1,isAvailable:!0,isTuneCard:!1,isUserModel:!1,defaultParams:{prompt:"a product shot of a fast food meal, Burger, fries and soda, presented in vintage looking packaging with 'HILMA' branding on a seamless background. Make sure not to duplicate any of the meal items, just one burger, one package of fries and one soda.",aspect_ratio:"1:1",safety_filter_level:"block_only_high",output_format:"jpg"},paramSchema:[{name:"prompt",type:"textarea",label:"Prompt",required:!0,defaultValue:"a product shot of a fast food meal, Burger, fries and soda, presented in vintage looking packaging with 'HILMA' branding on a seamless background. Make sure not to duplicate any of the meal items, just one burger, one package of fries and one soda.",placeholder:"Text prompt for image generation",description:"Text prompt for image generation",order:0},{name:"aspect_ratio",type:"select",label:"Aspect Ratio",options:["1:1","9:16","16:9","3:4","4:3"],defaultValue:"1:1",description:"Aspect ratio of the generated image",order:1},{name:"safety_filter_level",type:"select",label:"Safety Filter Level",options:["block_low_and_above","block_medium_and_above","block_only_high"],defaultValue:"block_only_high",description:"Safety filter strictness. block_only_high is most permissive, block_low_and_above is strictest",order:2},{name:"output_format",type:"select",label:"Output Format",options:["jpg","png"],defaultValue:"jpg",description:"Format of the output image",order:3}]},{id:"imagen-4-ultra",dbUuid:"d67f9b64-fdab-4257-9f4a-daea75bd2082",replicateModelId:"google/imagen-4-ultra",name:"Google Imagen 4 Ultra",description:"Google's ultra-high quality image generation model. Premium quality with the highest level of detail and ph
1otorealism.",sampleImage:"/samples/imagen-4-ultra-sample.png",defaultOutputImage:"/samples/imagen-4-ultra-sample.png",order:2,isAvailable:!0,isTuneCard:!1,isUserModel:!1,defaultParams:{prompt:"This is a striking macro photograph that captures both the fine detail of nature and a clever composition. At the center of the image, a small lizard is positioned behind the delicate skeleton of a leaf, with only its head and neck peeking over. The leaf has been reduced to its intricate vein network, almost lace-like and bleached white, allowing the lizard's body to be visible through its transparent structure. Foreground (Leaf): The leaf is dried and translucent, with only the vein framework remaining. The veins form an intricate web of interconnected lines, radiating out from the central spine. The central vein runs vertically through the middle, dividing the image into left and right halves. Subject (Lizard): The lizard's body is pressed closely against the leaf, its limbs and torso perfectly aligned with the gaps in the leaf's veins. Its skin is a warm brown-orange shade, contrasting beautifully with the cooler dark green background. The head is not obscured by the leaf — it juts out on the right side, in crisp focu
1s, revealing its detailed scales, alert eye, and slightly raised head posture. Its limbs stretch outward, creating a star-like shape that mimics the branching of the leaf's veins. The positioning almost makes it look as if the lizard is part of the leaf's structure. Background: The backdrop is a mottled gradient of dark green, blurred out to remove distractions. This makes the leaf and lizard stand out as the sole focus of the image. Overall Impression: The composition creates a sense of symmetry and natural harmony — the skeletal leaf veins echo the lizard's form, while the lizard itself seems camouflaged within the organic pattern. It's both artistic and biological, blending textures of reptilian skin with the delicate tracery of plant structure.",aspect_ratio:"1:1",safety_filter_level:"block_only_high",output_format:"jpg"},paramSchema:[{name:"prompt",type:"textarea",label:"Prompt",required:!0,defaultValue:"This is a striking macro photograph that captures both the fine detail of nature and a clever composition. At the center of the image, a small lizard is positioned behind the delicate skeleton of a leaf, with only its head and neck peeking over. The leaf has been reduced to its intricate vein network, almost lace-like and bleached white, allowing the lizard's body to be visible through its transparent structure. Foreground (Leaf): The leaf is dried and translucent, with only the vein framework remaining. The veins form an intricate web of interconnected lines, radiating out from the central spine. The central vein runs vertically through the middle, dividing the image into left and right halves. Subject (Lizard): The lizard's body is pressed closely against the leaf, its limbs and torso perfectly aligned with the gaps in the leaf's veins. Its skin is a warm brown-orange shade, contrasting beautifully with the cooler dark green background. The head is not obscured by the leaf — it juts out on the right side, in crisp focu
1s, revealing its detailed scales, alert eye, and slightly raised head posture. Its limbs stretch outward, creating a star-like shape that mimics the branching of the leaf's veins. The positioning almost makes it look as if the lizard is part of the leaf's structure. Background: The backdrop is a mottled gradient of dark green, blurred out to remove distractions. This makes the leaf and lizard stand out as the sole focus of the image. Overall Impression: The composition creates a sense of symmetry and natural harmony — the skeletal leaf veins echo the lizard's form, while the lizard itself seems camouflaged within the organic pattern. It's both artistic and biological, blending textures of reptilian skin with the delicate tracery of plant structure.",placeholder:"Text prompt for image generation",description:"Text prompt for image generation",order:0},{name:"aspect_ratio",type:"select",label:"Aspect Ratio",options:["1:1","9:16","16:9","3:4","4:3"],defaultValue:"1:1",description:"Aspect ratio of the generated image",order:1},{name:"safety_filter_level",type:"select",label:"Safety Filter Level",options:["block_low_and_above","block_medium_and_above","block_only_high"],defaultValue:"block_only_high",description:"Safety filter strictness. block_only_high is most permissive, block_low_and_above is strictest",order:2},{name:"output_format",type:"select",label:"Output Format",options:["jpg","png"],defaultValue:"jpg",description:"Format of the output image",order:3}]},{id:"ideogram-v3-turbo",dbUuid:"2b3eaa6d-d3f2-4bf7-a9b0-998f702cd999",replicateModelId:"ideogram-ai/ideogram-v3-turbo",name:"Ideogram v3 Turbo",description:"Fast, high-quality image generation with the Ideogram v3 model. Similar capabilities as Quality version but optimized for speed.",sampleImage:"/samples/ideogram-turbo-sample.png",defaultOutputImage:"/samples/ideogram-turbo-sample.png",order:6,isAvailable:!0,isTuneCard:!1,isUserModel:!1,defaultParams:{prompt:"Generate an image of a MotoGP racer, leaning aggressively into a turn on a racetrack.  The bike is a HILMA, predominantly red and white with prominent \"HILMA\".  The number 42 should be large and clearly visible on the fairing. The racer's leathers are orange, white, and red. His helmet is orange with a complex, stylized design and the text \"HILMA\". The background should be a blurred but discernible racetrack with red and white markings visible and a slightly out-of-focus green and blue runoff area. The image should be a dynamic, low-angle shot, emphasizing speed and movement.  The bike should be angled towards the bottom right corner of the frame, creating a sense of motion. The racer should be slightly out of center, filling a significant portion of the frame. The composition should use leading lines created by the track's curves and the racer's body position to draw the viewer's eye into the scene. The lighting should be bright and natural, suggestive of a sunny day. There should be a slight highlight on the polished surfaces of the bike and helmet, suggesting intense sunlight.  The lighting should be realistic, with minimal harsh shadows, allowing for detail to be visible across all parts of the scene. The color palette should be vibrant and saturated, with the colors of orange, white, and red being dominant. The background should have contrasting but complementary colors (reds, whites, greens, blues) to create visual interest without distracting from the main subject. The style should be photorealistic, aiming for a level of detail that matches high-quality motorsport photography. The mood should convey energy, speed, and adrenaline – a sense of intense competition and athleticism. The image should employ a shallow depth of field, blurring the background to emphasize the subject.  This should make the focus sharp on the bike and rider, while the track is slightly out of focus.  Motion blur should subtly suggest the speed of the bike in its movement through the turn.  The overall image should have a sense of dynamism and realism, almost replicating the sharpness and clarity of a professional action shot.",aspect_ratio:"3:2",resolution:"None",magic_prompt_option:"Off",image:"",mask:"",style_type:"Realistic",seed:null,style_reference_images:[]},paramSchema:[{name:"prompt",type:"textarea",label:"Prompt",required:!0,defaultValue:"Generate an image of a MotoGP racer, leaning aggressively into a turn on a racetrack.  The bike is a HILMA, predominantly red and white with prominent \"HILMA\".  The number 42 should be large and clearly visible on the fairing. The racer's leathers are orange, white, and red. His helmet is orange with a complex, stylized design and the text \"HILMA\". The background should be a blurred but discernible racetrack with red and white markings visible and a slightly out-of-focus green and blue runoff area. The image should be a dynamic, low-angle shot, emphasizing speed and movement.  The bike should be angled towards the bottom right corner of the frame, creating a sense of motion. The racer should be slightly out of center, filling a significant portion of the frame. The composition should use leading lines created by the track's curves and the racer's body position to draw the viewer's eye into the scene. The lighting should be bright and natural, suggestive of a sunny day. There should be a slight highlight on the polished surfaces of the bike and helmet, suggesting intense sunlight.  The lighting should be realistic, with minimal harsh shadows, allowing for detail to be visible across all parts of the scene. The color palette should be vibrant and saturated, with the colors of orange, white, and red being dominant. The background should have contrasting but complementary colors (reds, whites, greens, blues) to create visual interest without distracting from the main subject. The style should be photorealistic, aiming for a level of detail that matches high-quality motorsport photography. The mood should convey energy, speed, and adrenaline – a sense of intense competition and athleticism. The image should employ a shallow depth of field, blurring the background to emphasize the subject.  This should make the focus sharp on the bike and rider, while the track is slightly out of focus.  Motion blur should subtly suggest the speed of the bike in its movement through the turn.  The overall image should have a sense of dynamism and realism, almost replicating the sharpness and clarity of a professional action shot.",placeholder:"Text prompt for image generation",description:"Text prompt for image generation",order:0},{name:"aspect_ratio",type:"select",label:"Aspect Ratio",options:["1:1","16:9","9:16","3:2","2:3","4:3","3:4","5:4","4:5","2:1","1:2","3:1","1:3"],defaultValue:"3:2",description:"Aspect ratio. Ignored if a resolution or inpainting image is given.",order:2},{name:"resolution",type:"select",label:"Resolution",options:["None","512x1536","576x1408","576x1472","576x1536","640x1344","640x1408","640x1472","640x1536","704x1152","704x1216","704x1280","704x1344","704x1408","704x1472","736x1312","768x1088","768x1216","768x1280","768x1344","800x1280","832x960","832x1024","832x1088","832x1152","832x1216","832x1248","864x1152","896x960","896x1024","896x1088","896x1120","896x1152","960x832","960x896","960x1024","960x1088","1024x832","1024x896","1024x960","1024x1024","1088x768","1088x832","1088x896","1088x960","1120x896","1152x704","1152x832","1152x864","1152x896","1216x704","1216x768","1216x832","1248x832","1280x704","1280x768","1280x800","1312x736","1344x640","1344x704","1344x768","1408x576","1408x640","1408x704","1472x576","1472x640","1472x704","1536x512","1536x576","1536x640"],defaultValue:"None",description:"Resolution. Overrides aspect ratio. Ignored if an inpainting image is given.",order:3},{name:"magic_prompt_option",type:"select",label:"Magic Prompt Option",options:["Auto","On","Off"],defaultValue:"Off",description:"Magic Prompt will interpret your prompt and optimize it.",order:1},{name:"image",type:"file",label:"Image (inpainting)",placeholder:"URL of image for inpainting",description:"An image file to use for inpainting. You must also use a mask.",order:4},{name:"mask",type:"file",label:"Mask (inpainting)",placeholder:"URL of mask for inpainting",description:"A black and white image. Black pixels are inpainted, white pixels are preserved.",order:5},{name:"style_type",type:"select",label:"Style Type",options:["None","Auto","General","Realistic","Design"],defaultValue:"Realistic",description:"The styles help define the specific aesthetic of the image.",order:6},{name:"style_reference_images",type:"style-images",label:"Style Reference Images",description:"Add multiple images to use as style references. You can upload files or paste URLs.",order:7},{name:"seed",type:"text",label:"Seed",min:0,max:0x7fffffff,placeholder:"Enter number for reproducible generation",description:"Random seed. Set for reproducible generation",order:8}]},{id:"flux-kontext-max",dbUuid:"be686be1-b4f1-4ac0-8c45-063d44780f42",replicateModelId:"black-forest-labs/flux-kontext-max",name:"Flux Kontext Max",description:"A premium text-based image editing model that delivers maximum performance and improved typography generation for transforming images through natural language prompts",sampleImage:"/samples/flux-kontext-max-sample.jpg",defaultOutputImage:"/samples/flux-kontext-max-sample.jpg",order:10,defaultParams:{prompt:'make this look like photo realistic street photography the text "HILMA" on her costume',input_image:"/samples/ma-74529.jpg",mask:"",aspect_ratio:"match_input_image",seed:null},paramSchema:[{name:"prompt",type:"textarea",label:"Prompt",required:!0,defaultValue:'make this look like photo realistic street photography the text "HILMA" on her costume',placeholder:"Text description of what you want to generate, or the instruction on how to edit the given image.",description:"Text description of what you want to generate, or the instruction on how to edit the given image.",order:0},{name:"input_image",type:"file",label:"Input Image",defaultValue:"/samples/ma-74529.jpg",placeholder:"URL of image to use as reference",description:"Image to use as reference. Must be jpeg, png, gif, or webp.",order:1},{name:"mask",type:"file",label:"Mask (inpainting)",placeholder:"URL of mask for inpainting",description:"A black and white image for inpainting. Use with input_image for targeted editing.",order:2},{name:"aspect_ratio",type:"select",label:"Aspect Ratio",options:["match_input_image","1:1","16:9","9:16","4:3","3:4","3:2","2:3","4:5","5:4","21:9","9:21","2:1","1:2"],defaultValue:"match_input_image",description:'Aspect ratio of the generated image. Use "match_input_image" to match the aspect ratio of the input image.',order:3},{name:"seed",type:"text",label:"Seed",placeholder:"Enter a number for reproducible generation",description:"Random seed. Set for reproducible generation",order:4}]},{id:"flux-kontext-pro",dbUuid:"8e2f94b2-2880-40b7-a32d-f5567ecf01b5",replicateModelId:"black-forest-labs/flux-kontext-pro",name:"Flux Kontext Pro",description:"Professional image editing and variation model. Upload an image and describe how to edit or transform it. Faster than Max version.",sampleImage:"/samples/flux-kontext-pro-sample.jpg",defaultOutputImage:"/samples/flux-kontext-pro-sample.jpg",order:9,defaultParams:{prompt:"make it look like it's buried in snow",input_image:"/samples/LC-19_115_2-002.jpg",mask:"",aspect_ratio:"match_input_image",seed:null},paramSchema:[{name:"prompt",type:"textarea",label:"Prompt",required:!0,defaultValue:"make it look like it's buried in snow",placeholder:"Text description of what you want to generate, or the instruction on how to edit the given image.",description:"Text description of what you want to generate, or the instruction on how to edit the given image.",order:0},{name:"input_image",type:"file",label:"Input Image",defaultValue:"https://images.metmuseum.org/CRDImages/aa/original/LC-19_115_2-002.jpg",placeholder:"URL of image to use as reference",description:"Image to use as reference. Must be jpeg, png, gif, or webp.",order:1},{name:"mask",type:"file",label:"Mask (inpainting)",placeholder:"URL of mask for inpainting",description:"A black and white image for inpainting. Use with input_image for targeted editing.",order:2},{name:"aspect_ratio",type:"select",label:"Aspect Ratio",options:["match_input_image","1:1","16:9","9:16","4:3","3:4","3:2","2:3","4:5","5:4","21:9","9:21","2:1","1:2"],defaultValue:"match_input_image",description:'Aspect ratio of the generated image. Use "match_input_image" to match the aspect ratio of the input image.',order:3},{name:"seed",type:"text",label:"Seed",placeholder:"Enter a number for reproducible generation",description:"Random seed. Set for reproducible generation",order:4}]},{id:"flux-fill-pro",dbUuid:"5bffc302-22e1-487f-ad88-dc46498b3722",replicateModelId:"black-forest-labs/flux-fill-pro",name:"Flux Fill Pro",description:"Advanced in-painting and out-painting model from Black Forest Labs built for precise image edits.",sampleImage:"/samples/flux-fill-pro-sample.png",defaultOutputImage:"/samples/flux-fill-pro-sample.png",order:8,isAvailable:!0,defaultParams:{prompt:"The woman wears a long sleeved black leather jacket over her existing clothes",image:"",mask:"",outpaint:"None",steps:50,guidance:60,safety_tolerance:2,seed:null,prompt_upsampling:!1,output_format:"jpg"},paramSchema:[{name:"prompt",type:"textarea",label:"Prompt",required:!0,placeholder:"Describe what to generate / inpaint",description:"Text prompt for image generation",order:0},{name:"image",type:"file",label:"Image",required:!0,placeholder:"Image to inpaint",description:"The image to inpaint. Can contain an alpha mask.",order:1},{name:"mask",type:"file",label:"Mask",placeholder:"Black = keep, White = inp
1aint",description:"A black-and-white mask. Black areas preserved, white areas inpainted.",order:2},{name:"outpaint",type:"select",label:"Outpaint",options:["None","Zoom out 1.5x","Zoom out 2x","Make square","Left outpaint","Right outpaint","Top outpaint","Bottom outpaint"],defaultValue:"None",description:"Quick outpainting options (mask ignored).",order:3},{name:"steps",type:"text-range",label:"Steps",defaultValue:50,min:15,max:50,step:1,description:"Number of diffusion steps.",order:4},{name:"guidance",type:"text-range",label:"Guidance",defaultValue:60,min:1.5,max:100,step:.5,description:"Balance between prompt adherence and creativity.",order:5},{name:"safety_tolerance",type:"text-range",label:"Safety Tolerance",defaultValue:2,min:1,max:6,step:1,description:"Safety tolerance (1 strict – 6 permissive).",order:6},{name:"seed",type:"text",label:"Seed",placeholder:"Enter number for reproducibility",description:"Random seed. Leave blank for random.",order:7},{name:"prompt_upsampling",type:"checkbox",label:"Prompt Upsampling",defaultValue:!1,description:"Automatically refine prompt for creative variation.",order:8},{name:"output_format",type:"select",label:"Output Format",options:["jpg","png"],defaultValue:"jpg",description:"Output image format.",order:9}]},{id:"topaz-image-upscale",dbUuid:"35c12835-66d0-46e5-9c1b-e8f09611e008",replicateModelId:"topazlabs/image-upscale",name:"Topaz Image Upscale",description:"AI-powered image enhancement and upscaling. Enhance resolution, remove noise, and improve image quality up to 6x.",sampleImage:"/samples/topaz-upscale-sample.png",defaultOutputImage:"/samples/hilma_to
1paz_after.png",order:11,isAvailable:!0,isTuneCard:!1,isUserModel:!1,modelType:"image-enhancement",defaultParams:{image:"/samples/hilma_topaz_before.jpg",enhance_model:"Standard V2",output_format:"jpg",upscale_factor:"2x",face_enhancement:!0,subject_detection:"All",face_enhancement_strength:.1,face_enhancement_creativity:0},paramSchema:[{name:"image",type:"file",label:"Image",required:!0,placeholder:"Upload image to enhance",description:"Image to enhance and upscale. For best results, use images larger than 200x200 pixels.",order:0},{name:"enhance_model",type:"select",label:"Enhancement Model",options:["Standard V2","Low Resolution V2","CGI","High Fidelity V2","Text Refine"],defaultValue:"Standard V2",description:"Standard V2 (general purpose), Low Resolution V2 (for low-res images), CGI (for digital art), High Fidelity V2 (preserves details), Text Refine (optimized for text)",order:1},{name:"upscale_factor",type:"select",label:"Upscale Factor",options:["None","2x","4x","6x"],defaultValue:"2x",description:"How much to upscale the image. Start with 2x for best results, use higher values for very small images.",order:2},{name:"output_format",type:"select",label:"Output Format",options:["jpg","png"],defaultValue:"jpg",description:"Output format for the enhanced image",order:3},{name:"subject_detection",type:"select",label:"Subject Detection",options:["None","All","Foreground","Background"],defaultValue:"All",description:'Apply enhancement to specific parts of the image. Use "None" for general enhancement.',order:4},{name:"face_enhancement",type:"checkbox",label:"Face Enhancement",defaultValue:!0,description:"Enhance faces in the image. Only enable if image contains clear faces.",order:5},{name:"face_enhancement_creativity",type:"text-range",label:"Face Enhancement Creativity",defaultValue:0,min:0,max:1,step:.01,description:"Level of creativity for face enhancement (0 = conservative, 1 = creative)",condition:e=>!0===e.face_enhancement,order:6},{name:"face_enhancement_strength",type:"text-range",label:"Face Enhancement Strength",defaultValue:.1,min:0,max:1,step:.01,description:"How strong the face enhancement should be (0 = subtle, 1 = strong)",condition:e=>!0===e.face_enhancement,order:7}]}];function o(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return[...i,...a].find(a=>a.dbUuid===e||a.id===e)}let n=["gemini-2-5-flash-image","sdxl","ideogram-v3-quality","ideogram-v3-turbo","flux-fill-pro","flux-kontext-pro","flux-kontext-max"],s=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return[...i,...e].filter(e=>n.includes(e.id))},r=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return s(e).map(e=>{var a;return{id:e.id,label:"".concat(null!==(a=e.provider)&&void 0!==a?a:e.replicateModelId.split("/")[0],"/").concat(e.name),model:e}})},l=e=>{switch(e){case"gemini-2-5-flash-image":case"sdxl":case"flux-fill-pro":case"ideogram-v3-quality":case"ideogram-v3-turbo":default:return"image";case"flux-kontext-max":case"flux-kontext-pro":return"input_image"}}},9461:(e,a,t)=>{t.d(a,{V:()=>i});class i{static log(e,a,t){for(var o=arguments.length,n=Array(o>3?o-3:0),s=3;s<o;s++)n[s-3]=arguments[s];if(e>i.currentLevel)return;let r={[i.levels.ERROR]:"❌",[i.levels.WARN]:"⚠️",[i.levels.INFO]:"ℹ️",[i.levels.DEBUG]:"\uD83D\uDD0D"}[e]||"\uD83D\uDCDD";Object.keys(i.levels)[e],new Date().toLocaleTimeString(),console.log("".concat(r," [").concat(a,"] ").concat(t),...n)}static error(e,a){for(var t=arguments.length,o=Array(t>2?t-2:0),n=2;n<t;n++)o[n-2]=arguments[n];i.log(i.levels.ERROR,e,a,...o)}static warn(e,a){for(var t=arguments.length,o=Array(t>2?t-2:0),n=2;n<t;n++)o[n-2]=arguments[n];i.log(i.levels.WARN,e,a,...o)}static info(e,a){for(var t=arguments.length,o=Array(t>2?t-2:0),n=2;n<t;n++)o[n-2]=arguments[n];i.log(i.levels.INFO,e,a,...o)}static debug(e,a){for(var t=arguments.length,o=Array(t>2?t-2:0),n=2;n<t;n++)o[n-2]=arguments[n];i.log(i.levels.DEBUG,e,a,...o)}static setLevel(e){i.currentLevel=e}static enableAll(){i.currentLevel=i.levels.DEBUG}static disableAll(){i.currentLevel=-1}}
1i.levels={ERROR:0,WARN:1,INFO:2,DEBUG:3},i.currentLevel=i.levels.ERROR}}]);

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.