"use strict";(self.webpackChunkfrontend=self.webpackChunkfrontend||[]).push([[969],{4969:(e,t,a)=>{a.r(t),a.d(t,{default:()=>A});var n=a(5e3),l=a(1663),o=a(9920),d=a(9048),i=a(8199),s=a(5988),r=a(9091),c=a(7976),u=a.n(c),m=a(4945);function p(e){const t=e.split("/");return t[0]+"//"+t[2]}var g=a(3139),f=a(9577),h=a(2949),y=a(9541),v=a.n(y),_=a(7249),N=a.n(_),k=a(2358),Z=a.n(k),w=a(3585),E=a.n(w),C=a(7850),x=a.n(C),P=a(8756),S=a.n(P),b=a(1802),T={};T.styleTagTransform=S(),T.setAttributes=E(),T.insert=Z().bind(null,"head"),T.domAPI=N(),T.insertStyleElement=x(),v()(b.Z,T),b.Z&&b.Z.locals&&b.Z.locals,a(3827);const I=m.z.array(m.z.any()),j="SPECIALNULLVALUEDONOTSETEVER";function B({arg:e,callUpdate:t,argValue:a,setArg:n,setNode:o,idx:d}){const i=(0,c.useRef)(null),s=a?a.mode:"node",r=a?a.value:a,m=e=>{n({mode:s,value:e})};return(0,c.useEffect)((()=>{"input"===s&&i.current&&i.current.offsetTop&&i.current.clientHeight&&(o((e=>{const t={...e.input_handles?e.input_handles:{},[d]:(i.current?.offsetTop??0)+(i.current?.clientHeight??0)/2};return{...e,input_handles:t,num_inputs:Object.keys(t).length}})),t())}),[s,i]),(0,c.useEffect)((()=>{"node"===s&&(o((e=>{const t={...e.input_handles?e.input_handles:{}};return t[d]&&delete t[d],{...e,num_inputs:Object.keys(t).length,input_handles:t}})),t())}),[s]),u().createElement("div",{className:"flex flex-row space-x-2 items-center w-full",ref:i},u().createElement(O,{className:"nodrag",onClick:e=>{e.stopPropagation()},size:"small",value:s,onChange:e=>{"node"===e?(e=>{n({mode:e,value:r})})(e.toString()):((e,t)=>{n({mode:e,value:t})})(e.toString(),j)},options:[{icon:u().createElement(U,null),value:"input"},{icon:u().createElement(L,null),value:"ui",disabled:!0},{icon:u().createElement(V,null),value:"node",disabled:"File"===e.type}]}),u().createElement(z,null,e.name),(()=>{switch(e.type){case"Choice":return u().createElement(D,{className:"nodrag",disabled:"node"!==s,value:r&&r!=j?r:void 0,options:e.ty.choices.map((e=>({value:e,label:e}))),onChange:e=>{m(e)}});case"Num":return u().createElement(G,{className:"nodrag",disabled:"node"!==s,min:e.ty.min_value??void 0,max:e.ty.max_value??void 0,value:r&&r!=j?r:void 0,onChange:e=>{e&&m(e)}});case"String":return u().createElement(F,{className:"nodrag",disabled:"node"!==s,value:r&&r!=j?r:void 0,onChange:e=>{m(e.target.value)}});case"Bool":return u().createElement(l.Z,{disabled:"node"!==s,onChange:e=>{m(e)},checked:r&&r!=j?r:e.ty.default});case"File":return null;default:throw e.type,new Error("Unhandled argument type")}})())}const A=function({callAfterUpdateInpOuts:e=(()=>{}),node:t,setNode:a}){const n=I.safeParse(t.data).success?t.data:Array(t.metadata.args.length).fill(null);return(0,c.useEffect)((()=>{I.length(t.metadata.args.length).safeParse(t.data).success||(a((e=>({...e,data:Array(t.metadata.args.length).fill(null),operator:`${p(t.remote.url)}/operator/${t.metadata.operator}`,num_inputs:0,num_outputs:t.metadata.num_outputs}))),e())}),[t]),u().createElement(H,null,t.metadata.name?u().createElement(R,null,t.metadata.name):null,t.metadata.description?u().createElement(o.Z.Paragraph,null,t.metadata.description):null,t.metadata.args.map(((t,l)=>u().createElement(B,{arg:t,key:l,idx:l,callUpdate:e,argValue:n[l],setNode:a,setArg:e=>{a((t=>({...t,data:t.data.map(((t,a)=>a===l?e:t))})))}}))))};var O=(0,n.ZP)(d.Z).withConfig({displayName:"BaseNode___StyledSegmented",componentId:"sc-vkkiaj-0"})({pointerEvents:"auto",cursor:"pointer"}),U=(0,n.ZP)(g.Z).withConfig({displayName:"BaseNode___StyledLoginOutlined",componentId:"sc-vkkiaj-1"})({paddingTop:"3px"}),L=(0,n.ZP)(f.Z).withConfig({displayName:"BaseNode___StyledPlayCircleOutlined",componentId:"sc-vkkiaj-2"})({paddingTop:"3px"}),V=(0,n.ZP)(h.Z).withConfig({displayName:"BaseNode___StyledPicCenterOutlined",componentId:"sc-vkkiaj-3"})({paddingTop:"3px"}),z=(0,n.ZP)(o.Z.Text).withConfig({displayName:"BaseNode___StyledTypographyText",componentId:"sc-vkkiaj-4"})({width:"fit-content"}),D=(0,n.ZP)(i.Z).withConfig({displayName:"BaseNode___StyledSelect",componentId:"sc-vkkiaj-5"})({flexGrow:"1"}),G=(0,n.ZP)(s.Z).withConfig({displayName:"BaseNode___StyledInputNumber",componentId:"sc-vkkiaj-6"})({flexGrow:"1"}),F=(0,n.ZP)(r.Z).withConfig({displayName:"BaseNode___StyledInput",componentId:"sc-vkkiaj-7"})({flexGrow:"1"}),H=(0,n.ZP)("div").withConfig({displayName:"BaseNode___StyledDiv",componentId:"sc-vkkiaj-8"})({display:"flex",width:"24rem",flexDirection:"column","> :not([hidden]) ~ :not([hidden])":{"--tw-space-y-reverse":"0",marginTop:"calc(0.5rem * calc(1 - var(--tw-space-y-reverse)))",marginBottom:"calc(0.5rem * var(--tw-space-y-reverse))"}}),R=(0,n.ZP)(o.Z.Text).withConfig({displayName:"BaseNode___StyledTypographyText2",componentId:"sc-vkkiaj-9"})({fontWeight:"700"})},1802:(e,t,a)=>{a.d(t,{Z:()=>i});var n=a(4039),l=a.n(n),o=a(6499),d=a.n(o)()(l());d.push([e.id,"svg {\n  display: inline-block !important;\n  vertical-align: baseline !important;\n}\n",""]);const i=d}}]);