PageSourceSearch

https://visualab.ai/static/js/async/5451.2914a132fc.js

js visualab.ai collected 2026-10-05 15:16:09 UTC 31,970 bytes, 1 lines download raw bytes

1"use strict";(self.rspackChunknewapi_web=self.rspackChunknewapi_web||[]).push([[5451],{45835(e,t,n){let r=(0,n(79540).v)(()=>({assets:{}}));function i(e){0!==e.length&&r.setState(t=>{let n={...t.assets};for(let t of e)n[`${t.kind}:${t.assetId}`]=t;return{assets:n}})}function s(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(!e)return"";let r=t*Math.max(1,n);return r<=384?e.variants.thumbnail??e.variants.preview??e.url:r<=1600?e.variants.preview??e.url:e.url}function o(e){return e?.variants.poster??""}function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"image";return r(n=>n.assets[`${t}:${e}`])}function d(){r.setState({assets:{}})}function l(e){if(!e)return"";try{let t=new URL(e,globalThis.location?.origin||"http://localhost");if("http:"===t.protocol||"https:"===t.protocol||"blob:"===t.protocol||/^data:(image|video)\//i.test(e))return e}catch{}return""}n.d(t,{Cl:()=>s,HD:()=>o,Qx:()=>a,Ry:()=>l,f1:()=>d,fC:()=>i})},63334(e,t,n){n.d(t,{c:()=>A});var r=n(72361),i=n(52490),s=n(68413),o=n(24327),a=n(6176),d=n(39647),l=n(89629),u=n(62042),c=n(50110),f=n(56275);let p={asset:"border-sky-500/40",text:"border-zinc-500/40",generation:"border-violet-500/50",agent:"border-emerald-500/40",group:"border-amber-500/30"},g={idle:"bg-transparent",quoted:"bg-sky-400",awaiting_confirmation:"bg-amber-400",queued:"bg-amber-400",running:"bg-violet-400 animate-pulse",completed:"bg-emerald-400",failed:"bg-red-500",cancelled:"bg-zinc-400",unknown:"bg-amber-400"},m={idle:"",quoted:"Quoted",awaiting_confirmation:"Awaiting confirmation",queued:"Queued",running:"Generating",completed:"Completed",failed:"Failed",cancelled:"Cancelled",unknown:"Result unconfirmed"},h=(0,s.memo)(function(e){let{t}=(0,o.Bd)(),n="minimal"===(0,l.ZM)(),s=n||!1===e.hasTarget&&!1===e.hasSource;return(0,r.jsxs)("div",{className:(0,f.cn)("bg-card relative flex h-full w-full flex-col rounded-xl border-2 shadow-sm",p[e.accent],e.selected&&"ring-primary ring-2"),children:[(0,r.jsx)(i.h7,{type:"target",position:c.yX.Left,isConnectable:!1!==e.hasTarget,className:(0,f.cn)("!size-2 z-10",s&&"!opacity-0")}),(0,r.jsx)(i.h7,{type:"source",position:c.yX.Right,isConnectable:!1!==e.hasSource,className:(0,f.cn)("!size-2 z-10",s&&"!opacity-0")}),(0,r.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1.5",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:(0,f.cn)("size-2 shrink-0 rounded-full",g[e.status])}),!n&&(0,r.jsx)("span",{className:"truncate text-[11px] font-medium",children:e.title}),!n&&"idle"!==e.status&&(0,r.jsx)("span",{className:"text-muted-foreground ml-auto shrink-0 text-[10px]",children:t(m[e.status])})]}),!n&&(0,r.jsx)("div",{className:"min-h-0 flex-1 overflow-hidden rounded-b-xl",children:e.children})]})}),y=(0,s.memo)(function(e){let{id:t}=e,{t:n}=(0,o.Bd)(),i=(0,d.bh)(e=>e.graph.nodes[t]),s=(0,l.H9)(t),a=(0,u.NC)(t),c=i?.config;return i&&c?(0,r.jsx)(h,{accent:"agent",selected:s,status:a.status,title:"Agent",children:(0,r.jsx)("p",{className:"text-muted-foreground line-clamp-4 px-2 pb-2 text-[11px]",children:c.goal||n("Describe your goal")})}):null});var b=n(45835);let x=(0,s.memo)(function(e){let{t}=(0,o.Bd)(),n=(0,d.bh)(t=>t.graph.nodes[e.id]),i=(0,l.H9)(e.id),a=(0,u.NC)(e.id),c=(0,l.ZM)(),f=(0,l.nO)(t=>t.activeVideoNodeId===e.id),p=(0,l.nO)(e=>{let t=Math.max(n?.size.w??240,n?.size.h??240)*e.zoom*(globalThis.devicePixelRatio??1);return t<=384?0:t<=1600?1:2}),g=(0,s.useRef)(null),[m,y]=(0,s.useState)(""),x=n?.config,v=(0,b.Qx)(x?.assetId??0,x?.kind??"image");if((0,s.useEffect)(()=>{let e=g.current;if(!e||!f||"u"<typeof IntersectionObserver)return;let t=new IntersectionObserver(e=>{e[0]?.isIntersecting===!1&&(0,l.my)(null)});return t.observe(e),()=>t.disconnect()},[f]),(0,s.useEffect)(()=>()=>{l.nO.getState().activeVideoNodeId===e.id&&(0,l.my)(null)},[e.id]),!n||!x)return null;let O="video"===x.kind,j=O&&f,k=(0,b.Ry)(v?.url||x.url),S=(0,b.Ry)((0,b.HD)(v));O||(S=(0,b.Ry)((0,b.Cl)(v,[240,800,2e3][p])||x.url));let I=m===(j?k:S),w=x.title||t(O?"Video asset":"Image asset");return(0,r.jsx)(h,{accent:"asset",selected:i,status:a.status,title:w,children:(0,r.jsxs)("div",{ref:g,className:"bg-muted relative size-full",children:[j&&!I&&(0,r.jsx)("video",{src:k,autoPlay:!0,controls:!0,muted:!0,playsInl
1ine:!0,className:"nodrag nopan absolute inset-0 size-full object-contain",onError:()=>{y(k),(0,l.my)(null)},onEnded:()=>(0,l.my)(null)}),!j&&S&&!I&&(0,r.jsx)("img",{src:S,alt:w,loading:"lazy",decoding:"async",draggable:!1,className:"absolute inset-0 size-full object-contain",onError:()=>y(S)}),(!S&&!j||I)&&(0,r.jsxs)("div",{className:"text-muted-foreground flex size-full flex-col items-center justify-center gap-2 p-3 text-xs",role:"status",children:[t(I?"Preview unavailable":O?"Video preview unavailable":"Image preview unavailable"),I&&(0,r.jsx)("button",{type:"button",className:"nodrag nopan underline",onClick:()=>y(""),children:t("Retry")})]}),O&&!j&&"full"===c&&k&&(0,r.jsx)("button",{type:"button","aria-label":t("Play video"),onClick:t=>{t.stopPropagation(),y(""),(0,l.my)(e.id)},className:"nodrag nopan absolute bottom-2 left-2 rounded-full bg-black/70 px-3 py-1.5 text-xs text-white",children:t("Play")}),i&&"full"===c&&k&&(0,r.jsx)("a",{href:k,download:!0,target:"_blank",rel:"noopener noreferrer","aria-label":t("Download original"),onClick:e=>e.stopPropagation(),className:"nodrag nopan absolute right-2 bottom-2 rounded-full bg-black/70 px-3 py-1.5 text-xs text-white",children:t("Download")})]})})});var v=n(52048),O=n(65869);let j={image:"Generate image",video:"Generate video",text:"Generate text"},k=(0,s.memo)(function(e){let{id:t}=e,{t:n,i18n:i}=(0,o.Bd)(),s=(0,d.bh)(e=>e.graph.nodes[t]),a=(0,l.H9)(t),c=(0,u.NC)(t),f=(0,l.ZM)(),p=s?.config;if(!s||!p)return null;let g=new Intl.NumberFormat((0,v.Tl)(i.language),{maximumFractionDigits:4});return(0,r.jsx)(h,{accent:"generation",selected:a,status:c.status,title:n(j[p.kind]??"Generate"),children:(0,r.jsxs)("div",{className:"flex h-full flex-col gap-1 px-2 pb-2",children:[(0,r.jsx)("p",{className:"text-muted-foreground line-clamp-3 text-[11px]",children:p.prompt||n("Enter a prompt")}),"text"!==p.kind&&"minimal"!==f&&("running"===c.status||"queued"===c.status)&&(0,r.jsx)("div",{className:"relative min-h-20 flex-1",children:(0,r.jsx)(O.P,{label:n("queued"===c.status?"Queued":"Generating…"),progress:"video"===p.kind?c.progress:void 0})}),"full"===f&&(0,r.jsxs)("div",{className:"text-muted-foreground mt-auto flex flex-wrap items-center gap-x-2 gap-y-1 text-[10px]",children:[(0,r.jsx)("span",{className:"w-full truncate",children:p.model||n("Choose a model")}),void 0!==c.quoteCredits&&(0,r.jsx)("span",{children:n("Estimated {{credits}} credits",{credits:g.format(c.quoteCredits)})}),void 0!==c.spentCredits&&(0,r.jsx)("span",{children:n("Spent {{credits}} credits",{credits:g.format(c.spentCredits)})})]}),"text"===p.kind&&"running"===c.status&&"minimal"!==f&&(0,r.jsx)("div",{className:"bg-muted h-0.5 w-full overflow-hidden rounded-full",children:(0,r.jsx)("div",{className:"bg-primary h-full transition-[width] duration-300",style:{width:`${Math.max(4,c.progress)}%`}})}),"failed"===c.status&&"minimal"!==f&&(0,r.jsx)("p",{className:"line-clamp-2 text-[10px] text-red-500",children:c.error||n(m.failed)})]})})}),S=(0,s.memo)(function(e){let{id:t}=e,{t:n}=(0,o.Bd)(),i=(0,d.bh)(e=>e.graph.nodes[t]),s=(0,l.H9)(t),a=(0,d.bh)(e=>Object.values(e.graph.nodes).filter(e=>e.parentId===t).length),u=i?.config;return i&&u?(0,r.jsx)(h,{accent:"group",selected:s,status:"idle",title:u.title||n("Group"),hasTarget:!1,hasSource:!1,children:(0,r.jsx)("p",{className:"text-muted-foreground px-2 pb-2 text-[10px]",children:n("{{count}} items",{count:a})})}):null});n(95163);let I=(0,s.memo)(function(e){let{id:t}=e,{t:n}=(0,o.Bd)(),i=(0,l.nO)(e=>e.readOnly),a=(0,d.bh)(e=>e.graph.nodes[t]),c=(0,l.H9)(t),f=(0,u.NC)(t),p=(0,l.ZM)(),g=(0,l.Te)(t),m=(0,s.useRef)(void 0),y=a?.config?.text??"",b=g??y,x=(0,s.useCallback)(e=>{if(clearTimeout(m.current),!l.nO.getState().readOnly){if(e===y)return void(0,l.nr)(t);(0,d.OK)(t,{config:{text:e}}),(0,l.nr)(t)}},[t,y]);return((0,s.useEffect)(()=>()=>clearTimeout(m.current),[]),a)?(0,r.jsxs)(h,{accent:"text",selected:c,status:f.status,title:n("Text"),hasTarget:!1,children:["string"==typeof a.config.compatibilitySvg?(0,r.jsx)("img",{src:a.config.compatibilitySvg,alt:b||n("Preserved drawing"),className:"size-full object-contain"}
1):null,"string"!=typeof a.config.compatibilitySvg&&c&&"full"===p&&!i&&(0,r.jsx)("textarea",{value:b,"aria-label":n("Text"),maxLength:2e4,onChange:e=>{let n=e.target.value;(0,l.iR)(t,n),clearTimeout(m.current),m.current=setTimeout(()=>{let e=l.nO.getState().drafts[t];void 0!==e&&x(e)},600)},onBlur:e=>x(e.target.value),className:"nodrag nopan nowheel size-full resize-none bg-transparent px-2 pb-2 text-[11px] outline-none",placeholder:n("Enter a prompt or note")}),"string"!=typeof a.config.compatibilitySvg&&!(c&&"full"===p&&!i)&&(0,r.jsx)("p",{className:"text-muted-foreground line-clamp-6 px-2 pb-2 text-[11px] whitespace-pre-wrap",children:b||n("Empty text")})]}):null});function w(e){return function(t){return(0,r.jsx)(e,{id:t.id})}}n(23325);let C={asset:w(x),text:w(I),generation:w(k),agent:w(y),group:w(S)},N={input:"#8b5cf6",reference:"#0ea5e9",mask:"#f59e0b",prompt:"#71717a",result:"#10b981",first_frame:"#f43f5e",last_frame:"#f43f5e"};function z(){let{t:e}=(0,o.Bd)(),t=(0,i.VH)(),n=(0,i.Pj)(e=>{let t=e.nodeLookup.values().next().value;return{storeWidth:e.width,storeHeight:e.height,nodeCount:e.nodeLookup.size,sampleHasHandleBounds:!!t?.internals?.handleBounds,sampleMeasured:t?.measured}});return(0,s.useEffect)(()=>{globalThis.__rfProbe=n},[n]),(0,r.jsxs)(i.Zk,{position:"top-left",className:"flex gap-1",children:[[.2,.5,1,1.5].map(e=>(0,r.jsxs)("button",{type:"button",onClick:()=>t.setViewport({x:0,y:0,zoom:e},{duration:0}),className:"bg-muted rounded px-1.5 py-0.5 text-[10px]",children:[e,"x"]},e)),(0,r.jsx)("button",{type:"button",onClick:()=>t.fitView({duration:0}),className:"bg-muted rounded px-1.5 py-0.5 text-[10px]",children:e("Fit canvas")})]})}function V(e){let{t}=(0,o.Bd)(),n=(0,d.bh)(e=>e.graph.nodes),u=(0,d.bh)(e=>e.graph.edges),c=(0,l.nO)(e=>e.selectedIds),f=(0,s.useRef)(null),p=(0,s.useRef)(null),g=(0,i.VH)(),m=(0,s.useRef)(new Set(Object.keys(n))),h=e.readOnly??!1;(0,s.useEffect)(()=>{(0,l.JC)(h)},[h]);let y=(0,l.ZM)(),b=(0,s.useMemo)(()=>Object.values(n).sort((e,t)=>{let r=0,i=0,s=e.parentId;for(;s;)r++,s=n[s]?.parentId;for(s=t.parentId;s;)i++,s=n[s]?.parentId;return r-i}).map(e=>({id:e.id,type:e.type,position:e.position,parentId:e.parentId,zIndex:e.zIndex,data:{},initialWidth:e.size.w,initialHeight:e.size.h,style:{width:e.size.w,height:e.size.h}})),[n]);(0,s.useEffect)(()=>{let e=b.filter(e=>!m.current.has(e.id)).map(e=>e.id);if(m.current=new Set(b.map(e=>e.id)),!e.length)return;let t=requestAnimationFrame(()=>{let t=new Set(l.nO.getState().selectedIds),n=e.filter(e=>t.has(e));n.length&&g.fitView({nodes:n.map(e=>({id:e})),duration:180,padding:.4,maxZoom:1})});return()=>cancelAnimationFrame(t)},[b,g]);let x=(0,s.useMemo)(()=>{let e={input:t("Input"),reference:t("Reference"),mask:t("Mask"),prompt:t("Prompt"),result:t("Result"),first_frame:t("First frame"),last_frame:t("Last frame")};return Object.values(u).map(t=>({id:t.id,source:t.source,target:t.target,style:{stroke:N[t.role],strokeWidth:1.5},label:"full"===y?e[t.role]:void 0,animated:!1}))},[u,y,t]),[v,O]=(0,s.useState)(b),[j,k]=(0,s.useState)(x);(0,s.useEffect)(()=>{k(e=>{let t=new Set(e.filter(e=>e.selected).map(e=>e.id));return x.map(e=>({...e,selected:t.has(e.id)}))})},[x]);let S=(0,s.useCallback)(e=>{k(t=>(0,i.zW)(e,t))},[]);(0,s.useEffect)(()=>{O(e=>{let t=new Map(e.map(e=>[e.id,e.measured]));return b.map(e=>({...e,measured:t.get(e.id)??e.measured,selected:c.includes(e.id)}
1))})},[b,c]);let I=(0,s.useCallback)(e=>{O(t=>(0,i._0)(e,t));let t=e.filter(e=>"position"===e.type&&"dragging"in e&&!1===e.dragging&&"position"in e&&void 0!==e.position);0!==t.length&&(0,d.z7)(t.map(e=>({id:e.id,position:e.position})))},[]),w=e.connectionRole,V=e.onRejectConnection,A=(0,s.useCallback)(e=>{if(!e.source||!e.target)return;let n=w;if(!n||"input"===n){let t=(0,d.SN)().nodes[e.source]?.type;n="input","text"===t?n="prompt":("generation"===t||"agent"===t)&&(n="result")}let r=(0,d.oM)({id:(0,a.s)(),source:e.source,target:e.target,role:n});null!==r&&V?.(t(r))},[w,V,t]),R=(0,s.useCallback)(e=>{(0,l.td)(e.nodes.map(e=>e.id))},[]),T=(0,s.useCallback)((e,t)=>{(0,l.Qp)(t.zoom)},[]);return(0,r.jsx)("div",{ref:f,className:"h-full w-full outline-none",role:"region","aria-label":t("Canvas"),tabIndex:0,onKeyDown:e=>(function(e,t){if(e.defaultPrevented||e.isComposing||e.altKey)return!1;let n=e.target;if(n?.closest?.('input, textarea, select, button, [contenteditable="true"], [role="textbox"], [role="dialog"], [role="combobox"], [data-canvas-shortcuts="off"]'))return!1;let r=l.nO.getState().selectedIds,i=e.metaKey||e.ctrlKey,s=e.key.toLowerCase();if(i&&"a"===s)return(0,l.td)(Object.keys((0,d.SN)().nodes)),e.preventDefault(),!0;if(i&&"c"===s&&t.clipboard&&r.length)return t.clipboard.current=(0,d.tC)(r),e.preventDefault(),!0;if(l.nO.getState().readOnly)return!1;if(i&&"v"===s&&t.clipboard?.current)(0,d.VG)(t.clipboard.current);else if(i&&"z"===s)e.shiftKey?(0,d.ZS)():(0,d.tN)();else if(i&&"y"===s)(0,d.ZS)();else if(i&&"d"===s)(0,d.nk)(r);else if(i&&"g"===s)(0,d.xs)(r,t.groupTitle);else if("Delete"===e.key||"Backspace"===e.key)(0,d.Rn)(()=>{(0,d.if)(r),(0,d.p1)(t.selectedEdgeIds)});else{if(!(!i&&["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(e.key))||!r.length)return!1;let t=e.shiftKey?10:1,n="ArrowLeft"===e.key?-t:0,s="ArrowUp"===e.key?-t:0,o=(0,d.SN)(),a=new Set(r);(0,d.z7)(r.filter(e=>{let t=o.nodes[e]?.parentId;for(;t;){if(a.has(t))return!1;t=o.nodes[t]?.parentId}return!!o.nodes[e]}).map(r=>({id:r,position:{x:o.nodes[r].position.x+n+("ArrowRight"===e.key?t:0),y:o.nodes[r].position.y+s+("ArrowDown"===e.key?t:0)}})))}return e.preventDefault(),!0})(e,{selectedEdgeIds:g.getEdges().filter(e=>e.selected).map(e=>e.id),groupTitle:t("Group"),clipboard:p}),onPointerDown:e=>{e.target.closest('input, textarea, button, select, [contenteditable="true"], [role="dialog"]')||f.current?.focus({preventScroll:!0})},children:(0,r.jsxs)(i.Gc,{nodes:v,edges:j,onEdgesChange:S,nodesDraggable:!h,nodesConnectable:!h,edgesReconnectable:!h,nodeTypes:C,onNodesChange:I,onConnect:A,onSelectionChange:R,onMove:T,onlyRenderVisibleElements:!0,minZoom:.1,maxZoom:2.5,deleteKeyCode:null,proOptions:{hideAttribution:!0},fitView:!0,children:["minimal"!==y&&(0,r.jsx)(i.VS,{variant:i._5.Dots,gap:16,size:1}),e.showViewportPresets&&(0,r.jsx)(z,{})]})})}function A(e){return(0,r.jsx)(i.Ln,{children:(0,r.jsx)(V,{...e})})}},24587(e,t,n){var r=n(95163);function i(e){return`node:${e}`}function s(e){return`edge:${e}`}function o(e){return{kind:"node",...e}}function a(e){return{kind:"edge",...e}}function d(e,t){return JSON.stringify(e)===JSON.stringify(t)}function l(e,t){let n={},r={},l={};for(let[s,a]of Object.entries(t.nodes)){let t=i(s),l=e.nodes[s];l?d(l,a)||(r[t]=[o(l),o(a)]):n[t]=o(a)}for(let[i,o]of Object.entries(t.edges)){let t=s(i),l=e.edges[i];l?d(l,o)||(r[t]=[a(l),a(o)]):n[t]=a(o)}for(let[n,r]of Object.entries(e.nodes))t.nodes[n]||(l[i(n)]=o(r));for(let[n,r]of Object.entries(e.edges))t.edges[n]||(l[s(n)]=a(r));let u={};return Object.keys(n).length>0&&(u.added=n),Object.keys(r).length>0&&(u.updated=r),Object.keys(l).length>0&&(u.removed=l),u}function u(e){return[e.added,e.updated,e.removed].every(e=>!e||0===Object.keys(e).length)}function c(e){let{kind:t,...n}=e;return n}function f(e,t){if(!t||"object"!=typeof t||Array.isArray(t)||Object.keys(t).some(e=>!["added","updated","removed"].includes(e)))return{graph:e,skipped:1};let n={...e.nodes},o={...e.edges},a=new Set,l=0;for(let u of["added","updated","removed"]){let f=t[u];if(void 0!==f){if(!f||"object"!=typeof f||Array.isArray(f))return{graph:e,skipped:1};for(let[t,p]of Object.entries(f)){if(a.has(t)){l++;continue}a.add(t);let f="updated"===u?p:[p];if(!Array.isArray(f)||f.length!==("updated"===u?2:1)){l++;continue}let g=!0;for(let e of f){if(!e||"object"!=typeof e||Array.isArray(e)){g=!1;break}"node"===e.kind?(t!==i(e.id)||(0,r.T2)(e))&&(g=!1):"edge"===e.kind?(t!==s(e.id)||(0,r.Wd)(e))&&(g=!1):g=!1}if(!g){l++;continue}let m=f.at(-1),h="node"===m.kind?e.nodes[m.id]:e.edges[m.id];if("updated"===u&&!h||"added"===u&&h&&!d(h,c(m))||"updated"===u&&h&&!d(h,c(f[0]))&&!d(h,c(m))||"removed"===u&&h&&!d(h,c(m))){l++;continue}"node"===m.kind?"removed"===u?delete n[m.id]:n[m.id]=c(m):"removed"===u?delete o[m.id]:o[m.id]=c(m)}}}let u={nodes:n,edges:o};return l||(0,r.dC)(u)?{graph:e,skipped:l||1}:{graph:u,skipped:0}}function p(e){let t={};return e.added&&(t.removed=e.added),e.removed&&(t.added=e.removed),e.updated&&(t.updated=Object.fromEntries(Object.entries(e.updated).map(e=>{let[t,[n,r]]=e;return[t,[r,n]]}))),t}function g(e){let t=new Map,n=new Map,r=new Map;for(let i of e){for(let[e,s]of Object.entries(i.added??{})){let i=r.get(e);if(i){r.delete(e),n.set(e,[i,s]);continue}t.set(e,s)}for(let[e,r]of Object.entries(i.updated??{})){if(!Array.isArray(r)||2!==r.length)continue;let[i,s]=r;if(t.has(e)){t.set(e,s);continue}let o=n.get(e);n.set(e,[o?o[0]:i,s])}for(let[e,s]of Object.entries(i.removed??{})){if(t.delete(e))continue;let i=n.get(e);if(i){n.delete(e),r.set(e,i[0]);continue}r.set(e,s)}}let i={};return t.size>0&&(i.added=Object.fromEntries(t)),n.size>0&&(i.updated=Object.fromEntries(n)),r.size>0&&(i.removed=Object.fromEntries(r)),i}function m(e){return JSON.stringify({format:"vlab-graph-json-v1",nodes:e.nodes,edges:e.edges})}function h(e){let t;try{t=JSON.parse(e)}catch{return{graph:null,skipped:-1,error:"invalid snapshot JSON"}}if(!t||"object"!=typeof t||Array.isArray(t)||"vlab-graph-json-v1"!==t.format)return{graph:null,skipped:-1,error:"unsupported snapshot format"};let n=(0,r.dC)(t);if(n)return{graph:null,skipped:1,error:n};let i=t;return{graph:{nodes:i.nodes,edges:i.edges},skipped:0}}n.d(t,{$7:()=>u,I$:()=>h,I1:()=>p,PO:()=>l,QX:()=>s,Vx:()=>i,cN:()=>g,e1:()=>f,zi:()=>m})},39647(e,t,n){var r=n(79540),i=n(6176),s=n(24587),o=n(95163),a=n(89629);let d=new Set,l=[],u=[],c=null,f=!1;function p(e){return d.add(e),()=>{d.delete(e)}}function g(e){if((0,s.$7)(e))return;if(c)return void c.push(e);f||(l.push(e),l.length>100&&l.shift(),u.length=0),y.setState({canUndo:l.length>0,canRedo:u.length>0});let t=b();for(let n of((0,a.td)(a.nO.getState().selectedIds.filter(e=>t.nodes[e])),d))n(e)}function m(e){return{kind:"node",...e}}function h(e){return{kind:"edge",...e}}let y=(0,r.v)(()=>({graph:(0,o.K1)(),structureVersion:0,canUndo:!1,canRedo:!1}));function b(){return y.getState().graph}let x={asset:{w:240,h:240},text:{w:260,h:140},generation:{w:300,h:220},agent:{w:320,h:200},group:{w:640,h:480}};function v(e){if(a.nO.getState().readOnly)return"Canvas is read-only";let t=y.getState();if(t.graph.nodes[e.id])return"This canvas item already exists";let n={id:e.id,type:e.type,position:{...e.position},size:{...e.size??x[e.type]},zIndex:e.zIndex??0,config:structuredClone(e.config),assetIds:[...e.assetIds??[]],createdBy:e.createdBy??"user",schemaVersion:1};void 0!==e.parentId&&(n.parentId=e.parentId);let r=(0,o.T2)(n);if(null!==r)return r;let i=(0,o.dC)({nodes:{...t.graph.nodes,[n.id]:n},edges:t.graph.edges});
1return i||(y.setState(e=>({graph:{nodes:{...e.graph.nodes,[n.id]:n},edges:e.graph.edges},structureVersion:e.structureVersion+1})),g({added:{[(0,s.Vx)(n.id)]:m(n)}}),null)}function O(e,t){if(a.nO.getState().readOnly)return"Canvas is read-only";let n=y.getState().graph.nodes[e];if(!n)return"Canvas item not found";let r={...n,...structuredClone(t),id:n.id,schemaVersion:n.schemaVersion,config:t.config?{...n.config,...structuredClone(t.config)}:n.config},i=(0,o.T2)(r);if(null!==i)return i;let d=(0,o.dC)({nodes:{...b().nodes,[e]:r},edges:b().edges});return d||(JSON.stringify(n)===JSON.stringify(r)||(y.setState(n=>({graph:{nodes:{...n.graph.nodes,[e]:r},edges:n.graph.edges},structureVersion:n.structureVersion+(t.position||t.size||t.type||void 0!==t.zIndex||Object.hasOwn(t,"parentId")?1:0)})),g({updated:{[(0,s.Vx)(e)]:[m(n),m(r)]}})),null)}function j(e){if(a.nO.getState().readOnly)return;let t={...y.getState().graph.nodes},n={};for(let r of e){let e=t[r.id];if(!e||e.position.x===r.position.x&&e.position.y===r.position.y)continue;let i={...e,position:{...r.position}};null===(0,o.T2)(i)&&(t[r.id]=i,n[(0,s.Vx)(r.id)]=[m(e),m(i)])}0!==Object.keys(n).length&&(y.setState(e=>({graph:{nodes:t,edges:e.graph.edges},structureVersion:e.structureVersion+1})),g({updated:n}))}function k(e){if(a.nO.getState().readOnly)return;let t=y.getState(),n=new Set(e.filter(e=>t.graph.nodes[e]));if(0===n.size)return;let r={...t.graph.nodes},i={...t.graph.edges},d={};for(let e of n)d[(0,s.Vx)(e)]=m(r[e]),delete r[e];for(let[e,t]of Object.entries(i))(n.has(t.source)||n.has(t.target))&&(d[(0,s.QX)(e)]=h(t),delete i[e]);let l={};for(let[e,i]of Object.entries(r))if(i.parentId&&n.has(i.parentId)){let n={...i,position:(0,o.OG)(t.graph,i.id)};delete n.parentId,r[e]=n,l[(0,s.Vx)(e)]=[m(i),m(n)]}y.setState(e=>({graph:{nodes:r,edges:i},structureVersion:e.structureVersion+1})),g(Object.keys(l).length>0?{removed:d,updated:l}:{removed:d})}function S(e){if(a.nO.getState().readOnly)return"Canvas is read-only";let t=y.getState(),n=t.graph.nodes[e.source],r=t.graph.nodes[e.target];if(!n)return"The connection source is missing";if(!r)return"The connection target is missing";if(t.graph.edges[e.id])return"This connection already exists";let i={id:e.id,source:e.source,target:e.target,role:e.role},d=(0,o.Wd)(i);if(null!==d)return d;let l=(0,o.ik)(n.type,r.type,e.role);return null!==l?l:Object.values(t.graph.edges).some(e=>e.source===i.source&&e.target===i.target&&e.role===i.role)?"This connection already exists":(y.setState(e=>({graph:{nodes:e.graph.nodes,edges:{...e.graph.edges,[i.id]:i}},structureVersion:e.structureVersion+1})),g({added:{[(0,s.QX)(i.id)]:h(i)}}),null)}function I(e){if(a.nO.getState().readOnly)return;let t={...y.getState().graph.edges},n={};for(let r of e){let e=t[r];e&&(n[(0,s.QX)(r)]=h(e),delete t[r])}0!==Object.keys(n).length&&(y.setState(e=>({graph:{nodes:e.graph.nodes,edges:t},structureVersion:e.structureVersion+1})),g({removed:n}))}function w(e){let t=(0,o.dC)(e);if(t)throw Error(t);l.length=0,u.length=0,y.setState(t=>({graph:e,structureVersion:t.structureVersion+1,canUndo:!1,canRedo:!1})),(0,a.td)(a.nO.getState().selectedIds.filter(t=>e.nodes[t]))}function C(){d.clear(),l.length=0,u.length=0,c=null,f=!1,a.nO.setState({readOnly:!1}),y.setState({graph:(0,o.K1)(),structureVersion:0,canUndo:!1,canRedo:!1})}function N(e,t){let n;if(c)return e();let r=b(),i=a.nO.getState().selectedIds;c=[];try{n=e()}catch(e){throw c=null,y.setState(e=>({graph:r,structureVersion:e.structureVersion+1})),(0,a.td)(i),e}let o=(0,s.cN)(c);c=null;let d=f;f=t?.history===!1;try{g(o)}finally{f=d}return n}function z(e){if(a.nO.getState().readOnly)return"Canvas is read-only";let t=b(),n=(0,s.e1)(t,e);if(n.skipped)return"Invalid canvas command";let r=(0,s.PO)(t,n.graph);return(0,s.$7)(r)||(y.setState(e=>({graph:n.graph,structureVersion:e.structureVersion+1})),g(r)),null}function V(){if(a.nO.getState().readOnly)return!1;let e=l.pop();if(!e)return!1;u.push(e),f=!0;try{z((0,s.I1)(e))}finally{f=!1}return!0}function A(){if(a.nO.getState().readOnly)return!1;let e=u.pop();if(!e)return!1;l.push(e),f=!0;try{z(e)}finally{f=!1}return!0}function R(e){let t=b(),n=new Set(e.filter(e=>t.nodes[e])),r=!0;for(;r;)for(let e of(r=!1,Object.values(t.nodes)))e.parentId&&n.has(e.parentId)&&!n.has(e.id)&&(n.add(e.id),r=!0);let i=(0,o.K1)();for(let e of n){let r=structuredClone(t.nodes[e]);r.parentId&&!n.has(r.parentId)&&(r.position=(0,o.OG)(t,e),delete r.parentId),i.nodes[e]=r}for(let e of Object.values(t.edges))n.has(e.source)&&n.has(e.target)&&(i.edges[e.id]=structuredClone(e));return i}function T(e){return E(R(e))}function E(e){if(a.nO.getState().readOnly||(0,o.dC)(e))return[];let t=new Set(Object.keys(e.nodes)),n=new Map([...t].map(e=>[e,(0,i.s)()])),r={};for(let i of t){let t=e.nodes[i],o=structuredClone(t),a=n.get(i);if(!a)continue;o.id=a,o.createdBy="user",delete o.config.runId,"agent"===o.type&&(o.config.runId=0),delete o.config.execution,delete o.config.agentOpId;let d=t.parentId?n.get(t.parentId):void 0;d?o.parentId=d:o.position={x:t.position.x+32,y:t.position.y+32},r[(0,s.Vx)(o.id)]=m(o)}for(let t of Object.values(e.edges)){let e=n.get(t.source),o=n.get(t.target);if(!e||!o)continue;let a={...t,id:(0,i.s)(),source:e,target:o};r[(0,s.QX)(a.id)]=h(a)}if(z({added:r}))return[];let d=[...n.values()];return(0,a.td)(d),d}function M(e,t){if(a.nO.getState().readOnly)return null;let n=b(),r=new Set(e.filter(e=>n.nodes[e])),s=[...r].filter(e=>{let t=n.nodes[e].parentId;for(;t;){if(r.has(t))return!1;t=n.nodes[t]?.parentId}return!0});if(!s.length)return null;let d=s.map(e=>({id:e,...(0,o.OG)(n,e)})),l=Math.min(...d.map(e=>e.x))-24,u=Math.min(...d.map(e=>e.y))-48,c=Math.max(...d.map(e=>e.x+n.nodes[e.id].size.w))-l+24,f=Math.max(...d.map(e=>e.y+n.nodes[e.id].size.h))-u+24,p=(0,i.s)();try{N(()=>{let e=v({id:p,type:"group",position:{x:l,y:u},size:{w:c,h:f},config:{title:t},zIndex:-1});if(e)throw Error(e);for(let e of d){let t=O(e.id,{parentId:p,position:{x:e.x-l,y:e.y-u}});if(t)throw Error(t)}})}catch{return null}return(0,a.td)([p]),p}function _(){if(a.nO.getState().readOnly)return"Canvas is read-only";let e=a.nO.getState().drafts,t=null;return N(()=>{for(let[n,r]of Object.entries(e)){let e=b().nodes[n]?.type;if("text"!==e&&"generation"!==e)continue;let i=O(n,{config:"text"===e?{text:r}:{prompt:r}}
1);if(i){t=i;continue}a.nO.setState(e=>{let t={...e.drafts};return delete t[n],{drafts:t}})}}),t}n.d(t,{OG:()=>o.OG,OK:()=>O,Pp:()=>w,Qy:()=>p,Rn:()=>N,SN:()=>b,VG:()=>E,ZS:()=>A,if:()=>k,iu:()=>v,nk:()=>T,oM:()=>S,p1:()=>I,p4:()=>C,tC:()=>R,tN:()=>V,xs:()=>M,yD:()=>_,z7:()=>j},{bh:y})},95163(e,t,n){function r(){return{nodes:{},edges:{}}}let i=new Set(["asset","text","generation","agent","group"]),s=new Set(["input","reference","mask","prompt","result","first_frame","last_frame"]),o=new Set(["user","agent","import","recipe"]);function a(e,t){return"number"==typeof e&&Number.isFinite(e)&&Math.abs(e)<=t}function d(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function l(e,t){return"string"==typeof e&&e.length>0&&e.length<=t&&!["__proto__","constructor","prototype"].includes(e)}function u(e){if(!d(e))return"node must be an object";if(!l(e.id,128))return"node id is required";if(!i.has(e.type))return"Unknown canvas node type";if(!d(e.position))return"node position is required";if(!a(e.position.x,1e6)||!a(e.position.y,1e6))return"node position is out of range";if(!d(e.size))return"node size is required";let{w:t,h:n}=e.size;if(!a(t,2e4)||!a(n,2e4)||t<1||n<1)return"node size is out of range";if("number"!=typeof e.zIndex||!Number.isFinite(e.zIndex))return"node zIndex must be a finite number";if(!d(e.config))return"node config must be an object";if(!Array.isArray(e.assetIds))return"node assetIds must be an array";if(e.assetIds.length>16)return"node references too many assets";for(let t of e.assetIds)if(!Number.isSafeInteger(t)||t<0)return"node assetIds must be non-negative integers";return void 0===e.parentId||l(e.parentId,128)?o.has(e.createdBy)?1!==e.schemaVersion?"unsupported node schemaVersion":function(e,t){switch(e){case"asset":if("image"!==t.kind&&"video"!==t.kind)return"asset node kind must be image or video";if(!Number.isSafeInteger(t.assetId)||t.assetId<0)return"asset node assetId must be a non-negative integer";if("string"!=typeof t.url)return"asset node url must be a string";return null;case"text":if("string"!=typeof t.text)return"text node text must be a string";if(t.text.length>2e4)return"text node text is too long";return null;case"generation":if("image"!==t.kind&&"video"!==t.kind&&"text"!==t.kind)return"generation node kind must be image, video or text";if("string"!=typeof t.prompt)return"generation node prompt must be a string";if(t.prompt.length>4e3)return"generation node prompt is too long";if("string"!=typeof t.model)return"generation node model must be a string";return null;case"agent":if("string"!=typeof t.goal)return"agent node goal must be a string";if(t.goal.length>4e3)return"agent node goal is too long";if(!Number.isSafeInteger(t.runId)||t.runId<0)return"agent node runId must be a non-negative integer";return null;case"group":if("string"!=typeof t.title)return"group node title must be a string";if(t.title.length>200)return"group node title is too long";return null;default:return"Unknown canvas node type"}}(e.type,e.config):"Unknown canvas node origin":"node parentId must be a non-empty string when present"}function c(e){return d(e)?l(e.id,128)?l(e.source,128)?l(e.target,128)?e.source===e.target?"edge cannot connect a node to itself":s.has(e.role)?null:"Unknown canvas connection role":"edge target is required":"edge source is required":"edge id is required":"edge must be an object"}function f(e,t,n){return"group"===t?"Groups cannot receive connections":"group"===e?"Groups cannot start connections":"prompt"===n&&"text"!==e?"Prompt inputs must come from text nodes":("mask"===n||"first_frame"===n||"last_frame"===n)&&"asset"!==e?"Masks and video frames must come from assets":("input"===n||"reference"===n||"prompt"===n||"mask"===n||"first_frame"===n||"last_frame"===n)&&"generation"!==t&&"agent"!==t?"Inputs must connect to a generation or Agent node":"result"===n&&"generation"!==e&&"agent"!==e?"Results must come from a generation or Agent node":null}function p(e){if(!d(e)||!d(e.nodes)||!d(e.edges))return"graph nodes and edges must be objects";for(let[t,n]of Object.entries(e.nodes)){let e=u(n);if(e)return e;if(n.id!==t)return"node map key does not match id"}let t=e.nodes;
1for(let e of Object.values(t)){let n=new Set([e.id]),r=e.parentId;for(;r;){if(n.has(r))return"group parent cycle";n.add(r);let e=t[r];if(!e||"group"!==e.type)return"group parent does not exist";r=e.parentId}}for(let[n,r]of Object.entries(e.edges)){let e=c(r);if(e)return e;if(r.id!==n)return"edge map key does not match id";if(!t[r.source]||!t[r.target])return"edge endpoint does not exist"}return null}function g(e,t){let n=e.nodes[t];if(!n)return{x:0,y:0};let r={...n.position},i=n.parentId,s=new Set([t]);for(;i&&!s.has(i);){s.add(i);let t=e.nodes[i];if(!t)break;r.x+=t.position.x,r.y+=t.position.y,i=t.parentId}return r}n.d(t,{K1:()=>r,OG:()=>g,T2:()=>u,Wd:()=>c,dC:()=>p,ik:()=>f})},62042(e,t,n){var r=n(79540);let i={status:"idle",progress:0},s=(0,r.v)(()=>({runs:{}}));function o(e,t){s.setState(n=>{let r=n.runs[e]??i,s={...r,...t};return Object.keys(t).every(e=>Object.is(r[e],s[e]))?n:{runs:{...n.runs,[e]:s}}})}function a(e){return s(t=>t.runs[e]??i)}function d(e){return s.getState().runs[e]??i}function l(){s.setState({runs:{}})}n.d(t,{NC:()=>a,UQ:()=>d,ej:()=>l,ez:()=>o})},89629(e,t,n){let r=(0,n(79540).v)(()=>({readOnly:!1,selectedIds:[],zoom:1,detail:"full",agentPanelOpen:!0,activeVideoNodeId:null,drafts:{}}));function i(e){r.setState(t=>t.selectedIds.length===e.length&&t.selectedIds.every((t,n)=>t===e[n])?t:{selectedIds:e})}function s(e){r.setState(t=>{let n=e<.35?"minimal":e<.7?"compact":"full";return t.zoom===e&&t.detail===n?t:{zoom:e,detail:n}})}function o(e){r.setState(t=>t.activeVideoNodeId===e?t:{activeVideoNodeId:e})}function a(e,t){r.setState(n=>({drafts:{...n.drafts,[e]:t}}))}function d(e){r.setState(t=>{if(void 0===t.drafts[e])return t;let n={...t.drafts};return delete n[e],{drafts:n}})}function l(e){return r(t=>t.drafts[e])}function u(e){return r(t=>t.selectedIds.includes(e))}function c(){return r(e=>e.detail)}function f(){r.setState({readOnly:!1,selectedIds:[],zoom:1,detail:"full",agentPanelOpen:!0,activeVideoNodeId:null,drafts:{}})}function p(e){r.setState({readOnly:e})}n.d(t,{H9:()=>u,JC:()=>p,Qp:()=>s,TI:()=>f,Te:()=>l,ZM:()=>c,iR:()=>a,my:()=>o,nr:()=>d,td:()=>i},{nO:r})}}]);

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.