PageSourceSearch

https://alosem.com/assets/GenerationJobDialog-_jEpIZo2.js

js alosem.com collected 2026-10-09 17:55:46 UTC 14,410 bytes, 1 lines download raw bytes

1import{r as o,j as t,ab as K,S as $,B as A,a4 as z,cE as Z,a5 as Q,N as X,cF as _,Z as Y,_ as ee,s as D,ad as P,a9 as J,a8 as l,cG as te,aa as E,t as G,a7 as q,cH as se}from"./index-DbeMXurT.js";import{D as ae,c as j,P as k,F as le,d as S,B as oe,b as ne,W as re}from"./DetailPanel-BAnjkmjr.js";import{V as ie}from"./VectorizePanel-C0FDcBh5.js";import"./CopyPromptButton-B25UVspV.js";import"./Tag-Cf06gbkM.js";const de=D({id:l().min(1),slug:l().min(1),status:E(["draft","publishing","published","hidden"]),title:l(),description:l().nullable().optional(),altText:l().nullable().optional(),tags:q(l()).optional(),categories:q(l()).optional(),enrichment:E(["pending","running","done","failed"]).optional(),promptLayers:se.nullable().optional(),protectedResult:P().optional(),compositionManaged:G(!0).optional(),composition:D({id:l().uuid(),sceneId:l().uuid()}).optional(),publishable:P().optional(),missing:q(l()).optional(),hasTransparency:G(!0).optional(),cutoutResult:G(!0).optional(),publishedAt:l().min(1).optional(),shareUrl:l().min(1).optional()}),ce=D({jobId:l().min(1).optional(),imageId:l().min(1).optional(),prompt:l().nullable(),model:l(),status:E(["queued","processing","completed","failed","draft","publishing","published","hidden"]),createdAt:l().min(1),resultUrl:l().min(1).optional(),downloadUrl:l().min(1).optional(),mediaState:E(["pending","ready","unavailable"]).optional(),failureDetail:l().min(1).optional(),revisedPrompt:l().min(1).optional(),usage:te(l(),J()).optional(),title:l().min(1).optional(),image:de.optional(),vector:D({vectorizable:P(),price:J().int().min(1),hasVector:P(),selectedVector:P().optional()}).optional()});async function ue(e,n,d){const u=await fetch(e?`/api/generate/${encodeURIComponent(e)}?vector=1`:`/api/images/drafts/${encodeURIComponent(n)}?vector=1`,{signal:d});if(u.status===404)return null;if(!u.ok)throw new Error("request failed");return ce.parse(await u.json())}function pe(e){return new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(new Date(e))}function me(e){return Object.entries(e).filter(([,n])=>typeof n=="number").map(([n,d])=>`${n}: ${d}`).join(" · ")||"—"}function ye({jobId:e,imageId:n=null,mediaAspect:d,onClose:u,onChanged:g,backLabel:M="back"}){const f=o.useRef(g);f.current=g;const[a,p]=o.useState(null),[U,v]=o.useState(!1),[F,x]=o.useState(!1),[I,h]=o.useState(!1),[T,C]=o.useState(0),[m,N]=o.useState(null),[L,y]=o.useState(null);o.useEffect(()=>{N(null),y(null)},[e,n]),o.useEffect(()=>{if(!e&&!n){p(null);return}const i=new AbortController;return(async()=>{v(!0),x(!1),h(!1),p(s=>s&&(s.jobId===e||s.imageId===n)?s:null);try{const s=await ue(e,n,i.signal);if(i.signal.aborted)return;s?(p(s),T>0&&s.image&&f.current?.(s.image)):x(!0)}catch(s){if(s instanceof DOMException&&s.name==="AbortError")return;i.signal.aborted||h(!0)}finally{i.signal.aborted||v(!1)}})(),()=>i.abort()},[e,n,T]);function R(){if(U&&!a)return t.jsxs("div",{className:"space-y-4 p-6",role:"status","aria-label":"Loading generation",children:[t.jsx($,{className:"aspect-square max-h-[45vh] w-full"}),t.jsx($,{className:"h-4 w-3/4"}),t.jsx($,{className:"h-4 w-1/2"})]});if(F)return t.jsx("p",{className:"p-6 text-sm text-alosem-300",role:"status",children:"This generation is no longer available."});if(I||!a)return t.jsxs("div",{className:"space-y-3 p-6",role:"alert",children:[t.jsx("p",{className:"text-sm text-rose-400",children:"Unable to load this generation."}),t.jsx(A,{type:"button",variant:"outline",size:"sm",onClick:()=>C(B=>B+1),children:"Try again"})]});const i=a.image?.title?.trim()||a.title?.trim()||z,b=a.mediaState==="pending"||a.mediaState==="unavailable",s=b?null:a.downloadUrl??(a.jobId?`/api/generate/${encodeURIComponent(a.jobId)}/download`:null),r=d!=null&&d>re,c=a.jobId==null&&a.vector?.selectedVector===!0,V=a.image?.hasTransparency===!0&&s!=null&&!c,w=V&&a.image?.cutoutResult===!0,O=L??(w?"#999999":void 0);return t.jsx(ae,{label:`${i} generation detail`,wide:r,dense:r,asideLabel:"Generation details",header:t.jsx(ne,{title:i,actionsLabel:"Generation actions",actions:t.jsx(t.Fragment,{children:s&&t.jsx("a",{href:s,className:"inline-flex items-center rounded-md border border-alosem-700/70 px-3 py-1.5 text-sm text-alosem-200",download:!0,children:w?"Download transparent WebP":"Download"})})}),media:a.mediaState==="pending"?t.jsx("div",{className:"flex aspect-square max-h-[45vh] w-full shrink-0 items-center justify-center rounded-xl bg-alosem-950 text-xs text-alosem-500",role:"img","aria-label":"Pending image processing",children:"Processing"}):a.resultUrl?t.jsxs("div",{className:"relative",children:[t.jsx(Q,{src:a.resultUrl,alt:a.image?.altText??z,className:"reveal-result aspect-square max-h-[45vh] w-full shrink-0 rounded-xl bg-alosem-950 object-contain",style:O?{backgroundColor:O}:void 0}),t.jsxs("div",{className:"absolute right-3 top-3 z-10 flex flex-col items-end gap-2",children:[t.jsx(X,{imageUrl:a.resultUrl,alt:i,backgroundColor:O}
1),V&&t.jsx(oe,{downloadUrl:s,paletteColors:w?["#FFFFFF","#999999","#0F766E","#171717"]:void 0,onColor:y})]})]}):t.jsx("div",{className:"flex aspect-square max-h-[45vh] w-full shrink-0 items-center justify-center rounded-xl bg-alosem-950 text-xs text-alosem-500",role:"img","aria-label":"No result image",children:"No result image"}),aside:t.jsx(j,{label:"Generation vitals",children:t.jsxs(le,{children:[w&&t.jsx(S,{label:"File",value:"Transparent WebP"}),t.jsx(S,{label:"Model",value:a.model}),t.jsx(S,{label:"Status",value:Z(a)}),t.jsx(S,{label:"Created",value:t.jsx("time",{dateTime:a.createdAt,children:pe(a.createdAt)})}),a.usage?t.jsx(S,{label:"Usage",value:me(a.usage)}):null]})}),discourse:t.jsxs(t.Fragment,{children:[w&&t.jsxs(j,{label:"Cutout inspection",title:"Inspect your cutout",children:[t.jsx("p",{className:"text-sm text-alosem-300",children:"Visual discovery, not perfect background removal. Inspect the subject, shadows and soft edges on white, gray, teal and dark. These are visual checks, not a pixel-fidelity guarantee."}),t.jsx("p",{className:"mt-2 text-sm text-alosem-300",children:"Backgroun
1d color changes the viewing surface only. Download transparent WebP keeps the original alpha file unchanged. Download with background creates a separate opaque PNG."})]}),a.prompt!==null&&t.jsxs(j,{label:"Prompt",title:"Prompt",children:[t.jsx(k,{children:a.prompt}),a.revisedPrompt?t.jsxs(t.Fragment,{children:[t.jsx("h3",{className:"text-xs font-bold text-alosem-400 type-voice",children:"Revised by the provider"}),t.jsx(k,{children:a.revisedPrompt})]}):null]}),a.image?t.jsx(xe,{image:a.image,mediaBlocked:b,initialMessage:m,onReload:B=>{N(B??null),C(H=>H+1)}},a.image.id):null,a.image&&a.vector?t.jsx(ie,{imageId:a.image.id,vector:a.vector}):null]})})}return t.jsx(K,{isOpen:e!==null||n!==null,onClose:u,ariaLabel:"Generation details",backLabel:M,className:"h-auto max-h-[calc(100svh-2rem)] max-w-6xl overflow-y-auto overscroll-contain md:max-h-[90vh]",children:R()})}class W extends Error{missing;constructor(n){super("publish blocked"),this.missing=n}}function xe({image:e,mediaBlocked:n=!1,initialMessage:d,onReload:u}){const[g,M]=o.useState(e.title),[f,a]=o.useState(e.description??""),[p,U]=o.useState(e.promptLayers?.standalonePrompt??""),[v,F]=o.use
1State(e.altText??""),[x,I]=o.useState((e.tags??[]).join(", ")),[h,T]=o.useState((e.categories??[]).join(", ")),C=g!==e.title||f!==(e.description??"")||v!==(e.altText??"")||x!==(e.tags??[]).join(", ")||h!==(e.categories??[]).join(", ")||e.status==="draft"&&p!==(e.promptLayers?.standalonePrompt??""),[m,N]=o.useState(null),[L,y]=o.useState(d),[R,i]=o.useState(null);o.useEffect(()=>{d&&y(d)},[d]);async function b(s){N(s),i(null),y(null);try{let r;if(s==="save"?r=await fetch(`/api/images/drafts/${encodeURIComponent(e.id)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({title:g.trim(),...e.status==="draft"&&p?{standalonePrompt:p}:{},description:f.trim()||null,altText:v.trim(),...x.trim()||e.tags&&e.tags.length>0?{tags:x.split(",").map(c=>c.trim()).filter(Boolean)}:{},...h.trim()||e.categories&&e.categories.length>0?{categories:h.split(",").map(c=>c.trim()).filter(Boolean)}:{}})}):s==="unpublish"&&e.compositionManaged&&e.composition?r=await fetch(`/api/compositions/${encodeURIComponent(e.composition.id)}/revoke`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sceneId:e.composition.sceneId})}):r=await fetch(`/api/images/drafts/${encodeURIComponent(e.id)}/${s}`,{method:"POST",headers:{"content-type":"application/json"},body:s==="publish"?JSON.stringify(e.protectedResult?{imageId:e.id,outputReviewed:!0}:{imageId:e.id,standalonePrompt:e.promptLayers?.standalonePrompt,exactPrompt:e.promptLayers?.exactPrompt,outputReviewed:!0}):void 0}),!r.ok){const c=await r.json().catch(()=>null);if(s==="unpublish"&&(c?.status==="draft"||e.compositionManaged&&c?.state==="revoked")){u("Publication revoked. Storage cleanup failed.");return}throw new W(r.status===409&&c?.missing?.length?c.missing:null)}y(s==="save"?"Saved.":s==="publish"?"Published.":"Unpublished."),u()}catch(r){i(r instanceof W&&r.missing?`Add ${_(r.missing)} before publishing.`:"That did not go through. Try again.")}finally{N(null)}}return t.jsxs("section",{className:"space-y-4 border-t border-alosem-800/70 pt-4","aria-label":"Image management",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t.jsx("span",{className:"rounded-full border border-alosem-700 px-3 py-1 text-xs type-voice text-alosem-300","data-status":e.status,children:e.status==="published"?"Published":e.status==="publishing"?"Publishing…":"Private draft"}),e.status==="published"&&e.shareUrl?t.jsx("a",{href:e.shareUrl,className:"text-sm text-alosem-300 underline",target:"_blank",rel:"noreferrer",children:"View public page"}):null,e.composition?t.jsx("a",{href:`/dashboard/compositions/${e.composition.id}`,className:"text-sm text-alosem-300 underline",children:"Manage composition publication"}):null,t.jsx("div",{className:"ml-auto flex gap-2",children:(e.status==="published"||e.status==="publishing")&&(!e.compositionManaged||e.composition)?t.jsx(A,{type:"button",variant:"outline",size:"sm",disabled:m!==null,onClick:()=>{b("unpublish")},children:m==="unpublish"?"Unpublishing…":"Unpublish"}):n||e.compositionManaged?null:t.jsx(A,{type:"button",size:"sm",disabled:m!==null||e.publishable===!1||!e.protectedResult&&!e.promptLayers||C,title:e.publishable===!1&&e.missing?.length?`Add ${_(e.missing)} before publishing.`:void 0,onClick:()=>{b("publish")},children:m==="publish"?"Publishing…":"Publish"})})]}),!e.compositionManaged&&e.status==="draft"&&e.promptLayers&&t.jsxs("label",{className:"block space-y-1 text-sm type-identity",children:[t.jsx("span",{children:"Standalone interpretation · adapted creation prompt"}),t.jsx("textarea",{value:p,onChange:s=>U(s.target.value),rows:5,className:"w-full rounded-md border border-alosem-700 bg-alosem-950 p-3 type-identity"}),t.jsx("span",{className:"block text-xs text-alosem-400",children:"Save changes, then compare the saved interpretation with the selected image before publishing."})]}),e.protectedResult&&t.jsxs(j,{label:"Review public description",children:[t.jsx("p",{className:"type-identity text-sm text-alosem-300",children:"The Sema-written description is public. The tool recipe stays private."}),t.jsx(k,{narrow:!0,children:e.description??""})]}),e.promptLayers&&t.jsxs(j,{label:"Review both prompt layers",children:[t.jsx("h3",{className:"type-voice text-sm text-alosem-200",children:"What you see"}),t.jsxs("p",{className:"type-identity text-xs text-alosem-400",children:[Y,". ",ee]}),t.jsx(k,{narrow:!0,children:e.promptLayers.standalonePrompt}),t.jsx("h3",{className:"type-voice text-sm text-alosem-200",children:"How it was made · exact execution prompt"}),t.jsx(k,{narrow:!0,children:e.promptLayers.exactPrompt}),t.jsx("p",{className:"type-identity text-xs text-alosem-400",children:"Publishing confirms that you checked this standalone interpretation against the selected image and reviewed both prompt layers."})]}),e.status==="draft"&&e.publishable===!1&&e.missing?.length?t.jsx("p",{className:"text-sm text-alosem-400",role:"status",children:e.protectedResult&&e.missing.includes("description")?"A Sema-written public de
1scription is required before publishing; the private recipe cannot be used instead.":`Add ${_(e.missing)} before publishing.`}):null,R?t.jsx("p",{className:"text-sm text-rose-400",role:"alert",children:R}):null,L?t.jsx("p",{className:"text-sm text-alosem-400",role:"status",children:L}):null,t.jsxs(j,{label:"Metadata",title:"Metadata",className:"grid gap-3",children:[t.jsxs("label",{className:"grid gap-1 text-xs font-semibold type-voice text-alosem-500",children:["Title",t.jsx("input",{value:g,readOnly:e.compositionManaged,onChange:s=>M(s.target.value),maxLength:200,className:"rounded-md border border-alosem-800 bg-alosem-950 px-3 py-2 text-sm text-alosem-100"})]}),t.jsxs("label",{className:"grid gap-1 text-xs font-semibold type-voice text-alosem-500",children:["Description",t.jsx("textarea",{value:f,readOnly:e.compositionManaged,onChange:s=>a(s.target.value),rows:2,maxLength:2e3,className:"rounded-md border border-alosem-800 bg-alosem-950 px-3 py-2 text-sm text-alosem-100"})]}),t.jsxs("label",{className:"grid gap-1 text-xs font-semibold type-voice text-alosem-500",children:["Alt text",t.jsx("input",{value:v,readOnly:e.compositionManaged,onChange:s=>F(s.target.value),maxLength:300,className:"rounded-md border border-alosem-800 bg-alosem-950 px-3 py-2 text-sm text-alosem-100"})]}),t.jsxs("label",{className:"grid gap-1 text-xs font-semibold type-voice text-alosem-500",children:["Tags (comma-separated)",t.jsx("input",{value:x,readOnly:e.compositionManaged,onChange:s=>I(s.target.value),className:"rounded-md border border-alosem-800 bg-alosem-950 px-3 py-2 text-sm text-alosem-100"})]}),t.jsxs("label",{className:"grid gap-1 text-xs font-semibold type-voice text-alosem-500",children:["Categories (comma-separated)",t.jsx("input",{value:h,readOnly:e.compositionManaged,onChange:s=>T(s.target.value),className:"rounded-md border border-alosem-800 bg-alosem-950 px-3 py-2 text-sm text-alosem-100"})]}),e.compositionManaged?null:t.jsx(A,{type:"button",variant:"outline",size:"sm",disabled:m!==null,onClick:()=>{b("save")},children:m==="save"?"Saving…":"Save details"})]})]})}export{ye as GenerationJobDialog};

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.