import"./rolldown-runtime-DIIn1E2Q.js";import{D as e}from"./vendor-vue-core-DO0afONr.js";import{Ct as t}from"./api-BebQfoGK.js";import{b as n}from"./dialogService-Cm1GEBK8.js";function useUpstreamValue(r,i){let a=n(),o=t();return e(()=>{let e=r();if(!e)return;let t=a.canvas?.graph?.rootGraph.id;if(t)return i(o.getNodeWidgets(t,e.nodeId),e.outputName)})}function singleValueExtractor(e){return(t,n)=>{if(n){let r=t.find(e=>e.name===n);if(r&&e(r.value))return r.value}let r=t.map(e=>e.value).filter(e);return r.length===1?r[0]:void 0}}function isBoundsObject(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.x==`number`&&typeof t.y==`number`&&typeof t.width==`number`&&typeof t.height==`number`}function boundsExtractor(){let e=singleValueExtractor(isBoundsObject);return(t,n)=>{let r=e(t,n);if(r)return r;let getNum=e=>{let n=t.find(t=>t.name===e);return typeof n?.value==`number`?n.value:void 0},i=getNum(`x`),a=getNum(`y`),o=getNum(`width`),s=getNum(`height`);if(i!==void 0&&a!==void 0&&o!==void 0&&s!==void 0)return{x:i,y:a,width:o,height:s}}}export{singleValueExtractor as n,useUpstreamValue as r,boundsExtractor as t};
//# sourceMappingURL=useUpstreamValue-CCqjUxT5.js.map