PageSourceSearch

https://claibe.com/_next/static/chunks/2023.99870c35146888db.js

js claibe.com collected 2026-10-02 01:28:28 UTC 8,322 bytes, 1 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="b2ea232f-9ccb-4e1a-85ce-6f510c28e2e0",e._sentryDebugIdIdentifier="sentry-dbid-b2ea232f-9ccb-4e1a-85ce-6f510c28e2e0")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2023],{2023:(e,t,r)=>{r.r(t),r.d(t,{PixelRestorePanel:()=>N});var o=r(50669),i=r(87663),a=r(39321),n=r(61856),s=r(64374),p=r(18998),l=r(95514),c=r(41755),d=r(81867),u=r(86330),_=r(53072),m=r(2206),g=r(35270),f=r(99210),h=r(60694),w=r(94309),y=r(19578),b=r(41042),v=r(59982),x=r(1241),k=r(63345),j=r(74175),T=r(44412),I=r(64580);let P="pixel-restore",C="[pixel-restore:edit]";function z(e){var t,r;let o=crypto.randomUUID(),i="jobs-create:".concat(crypto.randomUUID()),{request:a}=e;return(0,c.ZJ)(e,{clientRequestId:o,idempotencyKey:i,workflowType:P,prompt:null!=(t=a.prompt)?t:"",...a.input_image&&{sourceUrls:a.input_image},parameters:{...void 0!==a.prompt_upsampling&&{prompt_upsampling:a.prompt_upsampling},output_format:null!=(r=a.output_format)?r:"png",...a.aspect_ratio&&{aspect_ratio:a.aspect_ratio}},...a.output_resolution&&{outputResolution:a.output_resolution}})}function N(e){let{imageUrl:t,editSessionId:r,getSubmitImageUrl:c,integritySourceImageUrls:N,integrityCompositeFingerprint:F}=e,U=(0,i.c)("inApp.organization.mainPages.edit.aiTools.panels.pixelRestore"),D=(0,i.c)("inApp.organization.shared.imageLibrary.sources"),E=(0,v.X)(),{waitForSessionReady:R}=(0,h.bA)(),{activeSessionId:A,setSessionStatus:J}=(0,b.pE)(),{recordProcessingStatusChanged:S}=(0,x.m)(),{data:O}=(0,y.A)({workflowType:P}),[q,K]=(0,a.useState)("1K"),[L,M]=(0,a.useState)(!1),V=(0,w.M)(),H=(0,k.vT)(e=>e.beginAiPreparing),W=(0,k.vT)(e=>e.endAiPreparing),B=(0,a.useCallback)(async(e,t)=>{try{_.vF.info("app.in_app.organization.app.edit.ai_tools.panel_pixel_restore.description_request",{message:"".concat(C," description request")});let r=await (0,p.c)({imageUrl:e,prompt:t});return _.vF.info("app.in_app.organization.app.edit.ai_tools.panel_pixel_restore.description_ok",{message:"".concat(C," description ok"),...{len:r.trim().length}}),r.trim()}catch(e){return _.vF.warn("app.in_app.organization.app.edit.ai_tools.panel_pixel_restore.description_threw_proceeding_without_it",{message:"".concat(C," description threw, proceeding without it"),errorName:e instanceof Error?e.name:"UnknownError",status:e instanceof p.r?e.status:void 0}),""}},[]),X=(0,a.useCallback)(async()=>{if(!t)return;let e=null!=r?r:A;(0,j.u4)("edit.ai_tool.pixel_restore.run",{outputResolution:q},{surface:"ai_tool.pixel_restore",tool:"pixel-restore"}),_.vF.info("app.in_app.organization.app.edit.ai_tools.panel_pixel_restore.run_click",{message:"".concat(C," run click")});let o=O.find(e=>0===e.sortOrder),i=O.find(e=>1===e.sortOrder),a=O.find(e=>2===e.sortOrder);if(!(null==o?void 0:o.prompt)||!(null==i?void 0:i.prompt)||!(null==a?void 0:a.prompt)){_.vF.error("app.in_app.organization.app.edit.ai_tools.panel_pixel_restore.missing_db_prompt_s",{message:"".concat(C," missing DB prompt(s)"),...{hasWatercolor:!!(null==o?void 0:o.prompt),hasDescription:!!(null==i?void 0:i.prompt),hasRestore:!!(null==a?void 0:a.prompt),totalLoaded:O.length}}),s.oR.error(U("error"));return}M(!0),H(e);let n=!1,p=()=>{n||(n=!0,W(e))},l=window.setTimeout(()=>M(!1),1e3),g=await c();if(!g){window.clearTimeout(l),p(),M(!1);return}try{let e=await (0,d.CT)(g),t=null==e?void 0:e[0],r=crypto.randomUUID().slice(0,8),n="".concat("Pixel Restore Watercolor"," ").concat(r),s=B(g,i.prompt),c={prompt:o.prompt,output_format:"png",input_image:g,prompt_upsampling:!1,...t&&{aspect_ratio:t}};_.vF.info("app.in_app.organization.app.edit.ai_tools.panel_pixel_restore.stage_1_watercolor_starting",{message:"".concat(C," stage 1 (watercolor) starting"),title:n,aspectRatio:t});let f=!1;if(await E(z({request:c,workflowType:P,promptTitle:n,promptAiProvider:o.aiProvider,stepIdx:0,isHidden:!0,integritySourceImageUrls:N,integrityCompositeFingerprint:F}),1,void 0,{onJobsCreated:e=>{f=0===e.length}}),f)throw Error("Pixel Restore source preflight rejected");_.vF.info("app.in_app.organization.app.edit.ai_tools.panel_pixel_restore.stage_1_batch_started_awaiting_session_description",{message:"".concat(C," stage 1 batch started, awaiting session + description")});let[h,w]=await Promise.all([s,R(n)]);_.vF.info("app.in_app.organization.app.edit.ai_tools.panel_pixel_restore.stage_1_ready",{message:"".concat(C," stage 1 ready"),...{descriptionLen:h.length,watercolorUrl:w.url,watercolorJobId:w.jobId}}),fetch("/api/app/images?fluxJobId=".concat(w.jobId),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({isInLibrary:!1})}).catch(()=>{});let y=(0,m.vC)(a.prompt,{"{description}":h},"source_description",{role:"source_truth_description",description:h,use_for:["detail_recovery","identity_lock","colour_lock"],never_use_for:["inventing_details","restyling","geometry_change"]},"context_sources"),b=D("pixel-restore"),v="Restore ".concat(r);if((0,u.w)(w.url))throw Error("Pixel Restore intermediate image is not durable");let x={prompt:y,input_image:w.url,output_format:"png",output_resolution:q,prompt_upsampling:!1,...t&&{aspect_ratio:t}};_.vF.info("app.in_app.organization.app.edit.ai_tools.panel_pixel_restore.stage_2_restore_starting",{message:"".concat(C," stage 2 (restore) starting"),...{title:v,restorePromptLen:y.length}}),await E(z({request:x,workflowType:P,promptTitle:v,displayPrompt:b,stepIdx:1,displayInputImage:null!=g?g:void 0}),1,void 0,{onJobsStarted:()=>p()}),_.vF.info("app.in_app.organization.app.edit.ai_tools.panel_pixel_restore.stage_2_batch_started_pipeline_kicked_off_end_to_end",{message:"".concat(C," stage 2 batch started - pipeline kicked off end-to-e
1nd")}),window.clearTimeout(l),p(),M(!1)}catch(t){_.vF.error("app.in_app.organization.app.edit.ai_tools.panel_pixel_restore.pipeline_failed",{message:"".concat(C," pipeline failed"),errorName:t instanceof Error?t.name:"UnknownError"}),s.oR.error(U("error")),e&&(J(e,"idle"),S(e,"idle")),window.clearTimeout(l),p(),M(!1)}},[t,r,A,J,S,O,q,E,B,R,U,D,c,H,W,N,F]);return(0,o.jsxs)("div",{className:"space-y-3",children:[(0,o.jsxs)("div",{className:"flex items-center gap-2",children:[(0,o.jsx)("span",{className:"text-[12px]",style:{color:"var(--st-muted)"},children:U("resolution")}),(0,o.jsxs)(f.l6,{value:q,onValueChange:e=>K(e),children:[(0,o.jsx)(f.bq,{className:"touch-target h-7 w-24 text-xs",children:(0,o.jsx)(f.yv,{})}),(0,o.jsx)(f.gC,{children:l.m_.map(e=>{let t="4K"===e&&!V;return(0,o.jsxs)(f.eb,{value:e,disabled:t,children:[e,t?" (Pro-feature)":""]},e)})})]})]}),(0,o.jsx)(g.$,{size:"sm",className:"w-full",onClick:()=>{t&&X()},disabled:!t,style:{background:t?"var(--st-accent)":"var(--st-surface-2)",color:t?"#fff":"var(--st-muted)",border:"1px solid ".concat(t?"var(--st-accent)":"var(--st-line)")},children:L?(0,o.jsx)(n.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,o.jsxs)(o.Fragment,{children:[U("run"),(0,o.jsx)(T.R,{credits:(0,I.KV)({resolution:"1K",numJobs:1})+(0,I.KV)({resolution:q,numJobs:1})})]})})]})}},18998:(e,t,r)=>{r.d(t,{c:()=>a,r:()=>o});class o extends Error{constructor(e){super("Direct image analysis failed"),this.status=e,this.name="ChatDirectClientError"}}function i(e){return new Promise(t=>setTimeout(t,e))}async function a(e){var t,r,a;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=null!=(t=n.fetcher)?t:fetch,p=null!=(r=n.createOperationId)?r:()=>crypto.randomUUID(),l=null!=(a=n.sleep)?a:i,c=p(),d=0,u=0;for(;;){let t;try{t=await s("/api/chat/direct",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...e,operationId:c})})}catch(e){if(d>=2)throw new o(null);await l(250*2**d),d++;continue}if(t.ok){let e=await t.json().catch(()=>null);if("string"!=typeof e||!e.trim())throw new o(t.status);return e.trim()}let r=await t.json().catch(()=>null);if(409===t.status&&null!==r&&"object"==typeof r&&"operationStatus"in r&&"processing"===r.operationStatus&&u<12){u++,await l(function(e){let t=Number(e.headers.get("Retry-After"));return!Number.isFinite(t)||t<=0?500:Math.max(250,Math.min(5e3,Math.ceil(1e3*t)))}(t));continue}throw new o(t.status)}}}}]);

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.