@code0-tech/triangulum 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -6,5 +6,4 @@ export * from './suggestion/getNodeSuggestions';
6
6
  export * from './suggestion/getReferenceSuggestions';
7
7
  export * from './suggestion/getValueSuggestions';
8
8
  export * from './validation/getFlowValidation';
9
- export * from './validation/getNodeValidation';
10
9
  export * from './validation/getValueValidation';
@@ -3,4 +3,4 @@ import { DataType, Flow, FunctionDefinition, NodeFunction, ReferenceValue } from
3
3
  * Calculates all available reference suggestions for a specific target node in a flow
4
4
  * and filters them by a required type.
5
5
  */
6
- export declare const getReferenceSuggestions: (flow?: Flow, nodeId?: NodeFunction["id"], type?: string, functions?: FunctionDefinition[], dataTypes?: DataType[]) => ReferenceValue[];
6
+ export declare const getReferenceSuggestions: (flow?: Flow, nodeId?: NodeFunction["id"], targetIndex?: number, functions?: FunctionDefinition[], dataTypes?: DataType[]) => ReferenceValue[];
@@ -1,5 +1,9 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("typescript");function A(){return A=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},A.apply(null,arguments)}var W=!1;try{W=typeof localStorage<"u"}catch{}var X=typeof process<"u",ee=W&&typeof localStorage.getItem=="function"&&localStorage.getItem("DEBUG")||X&&process.env.DEBUG,J=ee?console.log:function(e){return""};function te(e,t,n,r,o){r===void 0&&(r={});var s=A({},G(n),r),c=re(e,t,s,n,o),a=c.languageServiceHost,u=c.updateFile,p=c.deleteFile,l=n.createLanguageService(a),T=l.getCompilerOptionsDiagnostics();if(T.length){var i=Y(e,r,n);throw new Error(n.formatDiagnostics(T,i.compilerHost))}return{name:"vfs",sys:e,languageService:l,getSourceFile:function(F){var d;return(d=l.getProgram())==null?void 0:d.getSourceFile(F)},createFile:function(F,d){u(n.createSourceFile(F,d,s.target,!1))},updateFile:function(F,d,h){var f=l.getProgram().getSourceFile(F);if(!f)throw new Error("Did not find a source file for "+F);var S=f.text,m=h??n.createTextSpan(0,S.length),$=S.slice(0,m.start)+d+S.slice(m.start+m.length),v=n.updateSourceFile(f,$,{span:m,newLength:d.length});u(v)},deleteFile:function(F){var d=l.getProgram().getSourceFile(F);d&&p(d)}}}function R(e){throw new Error("Method '"+e+"' is not implemented.")}function w(e,t){return function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];var s=t.apply(void 0,r),c=typeof s=="string"?s.slice(0,80)+"...":s;return J.apply(void 0,["> "+e].concat(r)),J("< "+c),s}}var G=function(t){return A({},t.getDefaultCompilerOptions(),{jsx:t.JsxEmit.React,strict:!0,esModuleInterop:!0,module:t.ModuleKind.ESNext,suppressOutputPathCheck:!0,skipLibCheck:!0,skipDefaultLibCheck:!0},t.versionMajorMinor&&Number(t.versionMajorMinor.split(".")[0])>=6?{ignoreDeprecations:"6.0"}:{moduleResolution:t.ModuleResolutionKind.NodeJs})},K=function(t){return t.replace("/","/lib.").toLowerCase()};function ne(e){return{args:[],createDirectory:function(){return R("createDirectory")},directoryExists:w("directoryExists",function(t){return Array.from(e.keys()).some(function(n){return n.startsWith(t)})}),exit:function(){return R("exit")},fileExists:w("fileExists",function(t){return e.has(t)||e.has(K(t))}),getCurrentDirectory:function(){return"/"},getDirectories:function(){return[]},getExecutingFilePath:function(){return R("getExecutingFilePath")},readDirectory:w("readDirectory",function(t){return t==="/"?Array.from(e.keys()):[]}),readFile:w("readFile",function(t){var n;return(n=e.get(t))!=null?n:e.get(K(t))}),resolvePath:function(n){return n},newLine:`
2
- `,useCaseSensitiveFileNames:!0,write:function(){return R("write")},writeFile:function(n,r){e.set(n,r)},deleteFile:function(n){e.delete(n)}}}function Y(e,t,n){var r=new Map,o=function(a){return r.set(a.fileName,a),a},s={compilerHost:A({},e,{getCanonicalFileName:function(a){return a},getDefaultLibFileName:function(){return"/"+n.getDefaultLibFileName(t)},getNewLine:function(){return e.newLine},getSourceFile:function(a,u){var p;return r.get(a)||o(n.createSourceFile(a,e.readFile(a),(p=u??t.target)!=null?p:G(n).target,!1))},useCaseSensitiveFileNames:function(){return e.useCaseSensitiveFileNames}}),updateFile:function(a){var u=r.has(a.fileName);return e.writeFile(a.fileName,a.text),r.set(a.fileName,a),u},deleteFile:function(a){var u=r.has(a.fileName);return r.delete(a.fileName),e.deleteFile(a.fileName),u}};return s}function re(e,t,n,r,o){var s=[].concat(t),c=Y(e,n,r),a=c.compilerHost,u=c.updateFile,p=c.deleteFile,l=new Map,T=0,i=A({},a,{getProjectVersion:function(){return T.toString()},getCompilationSettings:function(){return n},getCustomTransformers:function(){return o},getScriptFileNames:function(){return s.slice()},getScriptSnapshot:function(d){var h=e.readFile(d);if(h&&typeof h=="string")return r.ScriptSnapshot.fromString(h)},getScriptVersion:function(d){return l.get(d)||"0"},writeFile:e.writeFile}),g={languageServiceHost:i,updateFile:function(d){T++,l.set(d.fileName,T.toString()),s.includes(d.fileName)||s.push(d.fileName),u(d)},deleteFile:function(d){T++,l.set(d.fileName,T.toString());var h=s.indexOf(d.fileName);h!==-1&&s.splice(h,1),p(d)}};return g}const ie=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("typescript");function R(){return R=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var r in i)({}).hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},R.apply(null,arguments)}var Y=!1;try{Y=typeof localStorage<"u"}catch{}var X=typeof process<"u",ee=Y&&typeof localStorage.getItem=="function"&&localStorage.getItem("DEBUG")||X&&process.env.DEBUG,J=ee?console.log:function(t){return""};function te(t,n,i,r,g){r===void 0&&(r={});var l=R({},q(i),r),p=re(t,n,l,i,g),u=p.languageServiceHost,c=p.updateFile,d=p.deleteFile,a=i.createLanguageService(u),F=a.getCompilerOptionsDiagnostics();if(F.length){var s=G(t,r,i);throw new Error(i.formatDiagnostics(F,s.compilerHost))}return{name:"vfs",sys:t,languageService:a,getSourceFile:function(e){var o;return(o=a.getProgram())==null?void 0:o.getSourceFile(e)},createFile:function(e,o){c(i.createSourceFile(e,o,l.target,!1))},updateFile:function(e,o,m){var T=a.getProgram().getSourceFile(e);if(!T)throw new Error("Did not find a source file for "+e);var v=T.text,S=m??i.createTextSpan(0,v.length),C=v.slice(0,S.start)+o+v.slice(S.start+S.length),w=i.updateSourceFile(T,C,{span:S,newLength:o.length});c(w)},deleteFile:function(e){var o=a.getProgram().getSourceFile(e);o&&d(o)}}}function I(t){throw new Error("Method '"+t+"' is not implemented.")}function k(t,n){return function(){for(var i=arguments.length,r=new Array(i),g=0;g<i;g++)r[g]=arguments[g];var l=n.apply(void 0,r),p=typeof l=="string"?l.slice(0,80)+"...":l;return J.apply(void 0,["> "+t].concat(r)),J("< "+p),l}}var q=function(n){return R({},n.getDefaultCompilerOptions(),{jsx:n.JsxEmit.React,strict:!0,esModuleInterop:!0,module:n.ModuleKind.ESNext,suppressOutputPathCheck:!0,skipLibCheck:!0,skipDefaultLibCheck:!0},n.versionMajorMinor&&Number(n.versionMajorMinor.split(".")[0])>=6?{ignoreDeprecations:"6.0"}:{moduleResolution:n.ModuleResolutionKind.NodeJs})},K=function(n){return n.replace("/","/lib.").toLowerCase()};function ne(t){return{args:[],createDirectory:function(){return I("createDirectory")},directoryExists:k("directoryExists",function(n){return Array.from(t.keys()).some(function(i){return i.startsWith(n)})}),exit:function(){return I("exit")},fileExists:k("fileExists",function(n){return t.has(n)||t.has(K(n))}),getCurrentDirectory:function(){return"/"},getDirectories:function(){return[]},getExecutingFilePath:function(){return I("getExecutingFilePath")},readDirectory:k("readDirectory",function(n){return n==="/"?Array.from(t.keys()):[]}),readFile:k("readFile",function(n){var i;return(i=t.get(n))!=null?i:t.get(K(n))}),resolvePath:function(i){return i},newLine:`
2
+ `,useCaseSensitiveFileNames:!0,write:function(){return I("write")},writeFile:function(i,r){t.set(i,r)},deleteFile:function(i){t.delete(i)}}}function G(t,n,i){var r=new Map,g=function(u){return r.set(u.fileName,u),u},l={compilerHost:R({},t,{getCanonicalFileName:function(u){return u},getDefaultLibFileName:function(){return"/"+i.getDefaultLibFileName(n)},getNewLine:function(){return t.newLine},getSourceFile:function(u,c){var d;return r.get(u)||g(i.createSourceFile(u,t.readFile(u),(d=c??n.target)!=null?d:q(i).target,!1))},useCaseSensitiveFileNames:function(){return t.useCaseSensitiveFileNames}}),updateFile:function(u){var c=r.has(u.fileName);return t.writeFile(u.fileName,u.text),r.set(u.fileName,u),c},deleteFile:function(u){var c=r.has(u.fileName);return r.delete(u.fileName),t.deleteFile(u.fileName),c}};return l}function re(t,n,i,r,g){var l=[].concat(n),p=G(t,i,r),u=p.compilerHost,c=p.updateFile,d=p.deleteFile,a=new Map,F=0,s=R({},u,{getProjectVersion:function(){return F.toString()},getCompilationSettings:function(){return i},getCustomTransformers:function(){return g},getScriptFileNames:function(){return l.slice()},getScriptSnapshot:function(o){var m=t.readFile(o);if(m&&typeof m=="string")return r.ScriptSnapshot.fromString(m)},getScriptVersion:function(o){return a.get(o)||"0"},writeFile:t.writeFile}),y={languageServiceHost:s,updateFile:function(o){F++,a.set(o.fileName,F.toString()),l.includes(o.fileName)||l.push(o.fileName),c(o)},deleteFile:function(o){F++,a.set(o.fileName,F.toString());var m=l.indexOf(o.fileName);m!==-1&&l.splice(m,1),d(o)}};return y}const Q=(t,n,i)=>{if(!t)return{parameters:[],returnType:"any"};const r=t.id||"temp_node_id",g={...t,id:r,parameters:{...t.parameters,nodes:t.parameters?.nodes?.map(e=>e?.value?e:{...e,value:null})||[]}},l=r+"_params",p={...g,id:l,parameters:{...g.parameters,nodes:g.parameters.nodes.map(e=>e.value?.__typename==="LiteralValue"&&e.value.value!==null&&typeof e.value.value!="object"?{...e,value:null}:e)}},c=oe({nodes:{__typename:"NodeFunctionConnection",nodes:[g,p]}},n,i),d=L(r),a=L(l),F=c.parameters.get(d)||[],s=c.parameters.get(a)||[];return{parameters:F.map((e,o)=>{const m=s[o];return m&&m!=="any"&&m!=="unknown"?m:e}),returnType:c.nodes.get(d)||"any"}};var j=(t=>(t[t.PRIMITIVE=0]="PRIMITIVE",t[t.TYPE=1]="TYPE",t[t.ARRAY=2]="ARRAY",t[t.OBJECT=3]="OBJECT",t[t.NODE=4]="NODE",t))(j||{});const U=(t,n)=>{const r=`
3
+ ${O(n)}
4
+ type TargetType = ${t};
5
+ const val: TargetType = {} as any;
6
+ `,g="index.ts",l=A(g,r),p=l.getSourceFile(g),c=l.languageService.getProgram().getTypeChecker();let d=1;const a=F=>{if(f.isVariableDeclaration(F)&&F.name.getText()==="val"){const s=c.getTypeAtLocation(F);s.getCallSignatures().length>0?d=4:c.isArrayType(s)?d=2:s.isStringLiteral()||s.isNumberLiteral()||(s.getFlags()&(f.TypeFlags.String|f.TypeFlags.Number|f.TypeFlags.Boolean|f.TypeFlags.EnumLiteral|f.TypeFlags.BigInt|f.TypeFlags.ESSymbol))!==0?d=0:s.isClassOrInterface()||(s.getFlags()&f.TypeFlags.Object)!==0?d=3:d=1}f.forEachChild(F,a)};return a(p),d},ie=`
3
7
  interface Array<T> {
4
8
  [n: number]: T;
5
9
  length: number;
@@ -13,59 +17,41 @@
13
17
  interface NewableFunction extends Function {}
14
18
  interface IArguments { }
15
19
  interface RegExp { }
20
+ type Record<K extends keyof any, T> = { [P in K]: T; };
16
21
  type ReturnType<T extends (...args: any) => any> = T extends (...args: any) => infer R ? R : any;
17
- `;function V(e,t){const n=new Map;n.set(e,t),n.set("lib.codezero.d.ts",ie);const r=ne(n);return te(r,[e,"lib.codezero.d.ts"],y,oe)}const oe={target:y.ScriptTarget.Latest,lib:["lib.codezero.d.ts"],noEmit:!0,strictNullChecks:!0};function E(e){const t=Array.from(new Set(e?.flatMap(r=>r.genericKeys||[]))).map(r=>`type ${r} = any;`).join(`
18
- `),n=e?.map(r=>`type ${r.identifier}${r.genericKeys?`<${r.genericKeys.join(",")}>`:""} = ${r.type};`).join(`
19
- `);return`${t}
20
- ${n}`}function ae(e,t){let n=e;for(const r of t){if(n==null)return"unknown";typeof r.path=="string"&&(n=n[r.path])}return typeof n}function H(e,t){const n=e?.nodes;if(n)return Array.isArray(n)?n.find(r=>r.id===t):n.nodes?.find(r=>r.id===t)}function q(e,t,n){const r=e?.value;if(!r)return"undefined";if(r.__typename==="ReferenceValue"){const o=r,s=H(t,o.nodeFunctionId);if(!s)return"undefined";let c=n?.(t,s).returnType;if(o.referencePath&&o.referencePath.length>0){let a;const u=s.parameters?.nodes;if(u&&u.length>0){const p=u[0];p?.value?.__typename==="LiteralValue"&&(a=p.value.value)}c=ae(a,o.referencePath)}return`({} as ${c})`}if(r.__typename==="NodeFunctionIdWrapper"){const o=r.id,s=H(t,o);if(!s)return"(() => undefined)";const c=p=>{if(p.functionDefinition?.identifier==="std::control::return")return p;const l=p.nextNodeId?H(t,p.nextNodeId):void 0;return l?c(l):void 0},a=c(s);return a?`(() => ({} as ${n?.(t,a)?.returnType}))`:"(() => undefined)"}return r.__typename==="LiteralValue"?JSON.stringify(r.value):"undefined"}const U=(e,t)=>{const n=e?.nodes?.nodes;if(n)return n.find(r=>r?.parameters?.nodes?.some(o=>o?.value?.__typename==="NodeFunctionIdWrapper"&&o.value.id===t))},Q=(e,t,n,r=new Set)=>{const o=t?.id;if(!o||r.has(o))return!1;r.add(o);const s=a=>{const u=e?.nodes?.nodes?.find(p=>p?.nextNodeId===a);return u?u.id===n?!0:s(u.id):!1};if(s(o))return!0;const c=U(e,o);return c?c.id===n?!0:Q(e,c,n,r):!1},se=(e,t,n)=>{if(!n?.nodeFunctionId)return{isValid:!0};if(n.parameterIndex!==void 0&&n.inputIndex!==void 0){if(t?.id===n.nodeFunctionId)return{isValid:!0};let r=U(e,t?.id);for(;r;){if(r.id===n.nodeFunctionId)return{isValid:!0};r=U(e,r.id)}return{isValid:!1,error:`Invalid input reference: Node ${t?.id} is not in the scope of Node ${n.nodeFunctionId}.`}}return Q(e,t,n.nodeFunctionId)?{isValid:!0}:{isValid:!1,error:`Node ${n.nodeFunctionId} has not been executed yet or is not visible in this scope.`}},ce=e=>{const n=`const tempValue = ${JSON.stringify(e?.value)??"any"};`,r="index.ts",o=V(r,n),s=o.getSourceFile(r),a=o.languageService.getProgram().getTypeChecker();let u="any";const p=l=>{if(y.isVariableDeclaration(l)&&l.name.getText()==="tempValue"){const T=a.getTypeAtLocation(l);u=a.typeToString(T,l,y.TypeFormatFlags.NoTruncation|y.TypeFormatFlags.UseFullyQualifiedType)}y.forEachChild(l,p)};return p(s),u};var Z=(e=>(e[e.PRIMITIVE=0]="PRIMITIVE",e[e.TYPE=1]="TYPE",e[e.ARRAY=2]="ARRAY",e[e.OBJECT=3]="OBJECT",e[e.NODE=4]="NODE",e))(Z||{});const ue=(e,t)=>{const r=`
21
- ${E(t)}
22
- type TargetType = ${e};
23
- const val: TargetType = {} as any;
24
- `,o="index.ts",s=V(o,r),c=s.getSourceFile(o),u=s.languageService.getProgram().getTypeChecker();let p=1;const l=T=>{if(y.isVariableDeclaration(T)&&T.name.getText()==="val"){const i=u.getTypeAtLocation(T);i.getCallSignatures().length>0?p=4:u.isArrayType(i)?p=2:i.isStringLiteral()||i.isNumberLiteral()||(i.getFlags()&(y.TypeFlags.String|y.TypeFlags.Number|y.TypeFlags.Boolean|y.TypeFlags.EnumLiteral|y.TypeFlags.BigInt|y.TypeFlags.ESSymbol))!==0?p=0:(i.isClassOrInterface()||(i.getFlags()&y.TypeFlags.Object)!==0)&&i.getProperties().length>0?p=3:p=1}y.forEachChild(T,l)};return l(c),p},le=(e,t)=>{const n=`
25
- ${E(t)}
26
- type Target = ${e};
27
- `,r="index.ts",o=V(r,n),s=o.getSourceFile(r),a=o.languageService.getProgram().getTypeChecker(),u=s.statements.find(i=>y.isTypeAliasDeclaration(i)&&i.name.text==="Target");if(!u)return{__typename:"LiteralValue",value:null};const p=a.getTypeAtLocation(u.type),l=(i,g,F=new Set)=>{if(F.has(i))return null;F.add(i);const d=i.getFlags();if(i.isUnion()){if(g.type,y.isTypeAliasDeclaration(g)&&g.type&&y.isUnionTypeNode(g.type)){const S=a.getTypeFromTypeNode(g.type.types[0]);return l(S,g,F)}const h=i.types.filter(S=>{const m=S.getFlags();return!(m&y.TypeFlags.Undefined)&&!(m&y.TypeFlags.Null)}),f=h.length>0?h[0]:i.types[0];return l(f,g,F)}if(d&y.TypeFlags.StringLiteral)return i.value;if(d&y.TypeFlags.String)return"sample";if(d&y.TypeFlags.NumberLiteral)return i.value;if(d&y.TypeFlags.Number)return 1;if(d&y.TypeFlags.BooleanLiteral)return i.intrinsicName==="true";if(d&y.TypeFlags.Boolean)return!1;if(a.isArrayType(i)){const f=i.typeArguments?.[0]||a.getAnyType();return[l(f,g,F)]}if(i.isClassOrInterface()||d&y.TypeFlags.Object||i.getProperties().length>0){const h={};return i.getProperties().forEach(S=>{const m=a.getTypeOfSymbolAtLocation(S,g);m&&(h[S.getName()]=l(m,g,F))}),h}return null};return{value:l(p,u)}},j=(e,t,n,r)=>{const s=new Map(n?.map(v=>[v.identifier,v])).get(t?.functionDefinition?.identifier);if(!s)return{isValid:!1,returnType:"any",diagnostics:[{message:`Function ${t?.id} not found`,nodeId:t?.id,code:404,severity:"error"}]};const c=t?.parameters?.nodes||[],a=[];for(const v of c){const N=v.value;if(N?.__typename==="ReferenceValue"){const x=se(e,t,N);x.isValid||a.push({message:x.error||"Scope error",code:403,nodeId:t?.id,parameterIndex:c.indexOf(v),severity:"error"})}}if(a.length>0)return{isValid:!1,returnType:"any",diagnostics:a};const u=c.map(v=>q(v,e,(N,x)=>j(N,x,n,r))),p=u.map(v=>v==="undefined"?"({} as any)":v).join(", ");let l=s.signature;const T=`
28
- ${E(r)}
29
- declare function testFunc${l};
30
- const result = testFunc(${p});
31
- `,i="index.ts",g=V(i,T),F=g.getSourceFile(i),d=g.languageService.getProgram(),h=d.getTypeChecker(),f=d.getSemanticDiagnostics(F);let S="any";const m=v=>{if(y.isVariableDeclaration(v)&&v.name.getText()==="result"){const N=h.getTypeAtLocation(v);S=h.typeToString(N,v,y.TypeFormatFlags.NoTruncation|y.TypeFormatFlags.UseFullyQualifiedType)}y.forEachChild(v,m)};m(F);const $=f.map(v=>{const N=y.flattenDiagnosticMessageText(v.messageText,`
32
- `),x=/\b([TRKV])\b/.test(N),C=N.includes("not assignable to parameter of type")&&(N.includes("'{}'")||N.includes("undefined"))||N.includes("not assignable to type 'undefined'")||N.includes("not assignable to type 'void'")||N.includes("may be a mistake because neither type sufficiently overlaps");return{message:N,code:v.code,nodeId:t?.id,parameterIndex:(()=>{if(v.start!==void 0){const P=c.findIndex((M,I)=>{const b=T.indexOf(u[I]);return v.start>=b&&v.start<b+u[I].length});if(P!==-1)return P}})(),severity:x||C?"warning":"error"}});return{isValid:!$.some(v=>v.severity==="error"),returnType:S,diagnostics:$}},ge=(e,t,n)=>{const o=new Map(t?.map(m=>[m.identifier,m])).get(e?.functionDefinition?.identifier);if(!o)return{parameters:[],returnType:"any"};const s={id:"gid://sagittarius/Flow/0",nodes:{__typename:"NodeFunctionConnection",nodes:[e]}},u=(e?.parameters?.nodes||[]).map(m=>q(m,s,($,v)=>j($,v,t,n))).map(m=>m==="undefined"?"({} as any)":m).join(", "),p=o.signature,l=`
33
- ${E(n)}
34
- declare function testFunc${p};
35
- const result = testFunc(${u});
36
- `,T="index.ts",i=V(T,l),g=i.getSourceFile(T),d=i.languageService.getProgram().getTypeChecker();let h="any",f=[];const S=m=>{if(y.isVariableDeclaration(m)&&m.name.getText()==="result"){const $=d.getTypeAtLocation(m);if(h=d.typeToString($,m,y.TypeFormatFlags.NoTruncation),y.isCallExpression(m.initializer)){const v=m.initializer,N=d.getResolvedSignature(v);N&&(f=N.getParameters().map(x=>{const C=d.getTypeOfSymbolAtLocation(x,v);return d.typeToString(C,v,y.TypeFormatFlags.NoTruncation)}))}}y.forEachChild(m,S)};return S(g),{parameters:f,returnType:h}},de=(e,t,n)=>{let r=t;if(e&&t){let o=function(i){const g=i.match(/<([^>]+)>/);return g?g[1].split(",").map(F=>F.trim()).filter(Boolean).length:0};const s=`
37
- ${E(n)}
38
- type TargetType = ${e};
39
- ${t?.map((i,g)=>`
40
- declare function Fu${g}${i.signature};
41
- type F${g} = ReturnType<typeof Fu${g}${o(i.signature)>0?`<${Array(o(i.signature)).fill("any").join(", ")}>`:""}>;
22
+ `;function A(t,n){const i=new Map;i.set(t,n),i.set("lib.codezero.d.ts",ie);const r=ne(i);return te(r,[t,"lib.codezero.d.ts"],f,ae)}const ae={target:f.ScriptTarget.Latest,lib:["lib.codezero.d.ts"],noEmit:!0,strictNullChecks:!0};function O(t){const n=Array.from(new Set(t?.flatMap(r=>r.genericKeys||[]))).map(r=>`type ${r} = any;`).join(`
23
+ `),i=t?.map(r=>`type ${r.identifier}${(r.genericKeys?.length??0)>0?`<${r.genericKeys?.join(",")}>`:""} = ${r.type};`).join(`
24
+ `);return`${n}
25
+ ${i}`}const L=t=>t.replace(/[^a-zA-Z0-9]/g,"_");function z(t,n,i,r=!1){const g=t?.nodes?.nodes||[],l=new Map(n?.map(e=>[e.identifier,e])),p=new Set,u=(e,o,m)=>{const T=g.find(P=>P?.id===e);if(!T||!T.functionDefinition?.identifier)return"undefined";const S=(T.parameters?.nodes||[]).map((P,x)=>{const E=P.value;if(!E)return r?`/* @pos ${e} ${x} */ {}`:`/* @pos ${e} ${x} */ undefined`;if(E.__typename==="ReferenceValue"){const $=E;if(!$.nodeFunctionId)return`/* @pos ${e} ${x} */ undefined`;let N=$.inputIndex!==void 0?`p_${L($.nodeFunctionId)}_${$.parameterIndex}[${$.inputIndex}]`:`node_${L($.nodeFunctionId)}`;return $.referencePath?.forEach(h=>{N+=`?.${h.path}`}),`/* @pos ${e} ${x} */ ${N}`}return E.__typename==="LiteralValue"?`/* @pos ${e} ${x} */ ${JSON.stringify(E.value)}`:E.__typename==="NodeFunctionIdWrapper"?u(E.id,e,x):r?`/* @pos ${e} ${x} */ ({} as any)`:`/* @pos ${e} ${x} */ undefined`}).join(", "),w=`${`fn_${T.functionDefinition.identifier.replace(/::/g,"_")}`}(${S})`;return o!==void 0&&m!==void 0?`${w}`:w},c=(e,o="")=>{if(p.has(e))return"";const m=g.find(N=>N?.id===e);if(!m||!m.functionDefinition)return"";if(p.add(e),!l.get(m.functionDefinition.identifier))return`${o}// Error: Function ${m.functionDefinition.identifier} not found
26
+ `;let v={parameters:[]};r||(v=Q(m,n,i));const C=(m.parameters?.nodes||[]).map((N,h)=>{const b=N.value;if(!b)return r?`/* @pos ${e} ${h} */ {}`:`/* @pos ${e} ${h} */ undefined`;if(b.__typename==="ReferenceValue"){const _=b;if(!_.nodeFunctionId)return`/* @pos ${e} ${h} */ undefined`;let D=_.inputIndex!==void 0?`p_${L(_.nodeFunctionId)}_${_.parameterIndex}[${_.inputIndex}]`:`node_${L(_.nodeFunctionId)}`;return _.referencePath?.forEach(V=>{D+=`?.${V.path}`}),`/* @pos ${e} ${h} */ ${D}`}if(b.__typename==="LiteralValue")return`/* @pos ${e} ${h} */ ${JSON.stringify(b.value)}`;if(b.__typename==="NodeFunctionIdWrapper"){const _=b;if(r){const D=`p_${L(e)}_${h}`,V=c(_.id,o+" ");return`/* @pos ${e} ${h} */ (...${D}) => {
27
+ ${V}${o}}`}else{const D=v.parameters[h];if(D?U(D,i)===j.NODE:!1){const M=`p_${L(e)}_${h}`,H=c(_.id,o+" ");return`/* @pos ${e} ${h} */ (...${M}) => {
28
+ ${H}${o}}`}else{const M=u(_.id,e,h);return`/* @pos ${e} ${h} */ ${M}`}}}return r?`/* @pos ${e} ${h} */ {}`:`/* @pos ${e} ${h} */ undefined`}).join(", "),w=`node_${L(m.id)}`,P=`fn_${m?.functionDefinition?.identifier?.replace(/::/g,"_")}`,x=C.includes("undefined"),E=m.functionDefinition.identifier==="std::control::return";let $=`${o}${E?"return ":`const ${w} = `}${P}(${C}) ;
29
+ `;return m.nextNodeId&&($+=c(m.nextNodeId,o)),$},d=O(i),a=n?.map(e=>`declare function fn_${e.identifier?.replace(/::/g,"_")}${e.signature}`).join(`
30
+ `),F=new Set(g.map(e=>e?.nextNodeId).filter(e=>!!e)),s=new Set;g.forEach(e=>e?.parameters?.nodes?.forEach(o=>{o?.value?.__typename==="NodeFunctionIdWrapper"&&o.value.id&&s.add(o.value.id)}));const y=g.filter(e=>e?.id&&!F.has(e.id)&&!s.has(e.id)).map(e=>c(e.id)).join(`
31
+ `);return`${d}
32
+ ${a}
33
+
34
+ // --- Flow ---
35
+ ${y}`}function oe(t,n,i){const r=z(t,n,i,!0),g="index.ts",l=A(g,r),p=l.getSourceFile(g),c=l.languageService.getProgram().getTypeChecker(),d=new Map,a=new Map,F=new Map;(t?.nodes?.nodes||[]).forEach(e=>{e?.id&&F.set(L(e.id),e)});const y=e=>{if(f.isVariableDeclaration(e)&&e.name.getText().startsWith("node_")){const o=e.name.getText().replace("node_",""),m=c.getTypeAtLocation(e);if(d.set(o,c.typeToString(m,e,f.TypeFormatFlags.NoTruncation)),e.initializer&&f.isCallExpression(e.initializer)){const T=c.getResolvedSignature(e.initializer);if(T){const v=T.getParameters().map(S=>{const C=c.getTypeOfSymbolAtLocation(S,e.initializer);return c.typeToString(C,e.initializer,f.TypeFormatFlags.NoTruncation)});a.set(o,v)}}}if(f.isReturnStatement(e)&&e.expression&&f.isCallExpression(e.expression)){const o=e.expression;c.getResolvedSignature(o)}f.forEachChild(e,y)};return y(p),{nodes:d,parameters:a}}const se=t=>{const i=`const tempValue = ${JSON.stringify(t?.value)??"any"};`,r="index.ts",g=A(r,i),l=g.getSourceFile(r),u=g.languageService.getProgram().getTypeChecker();let c="any";const d=a=>{if(f.isVariableDeclaration(a)&&a.name.getText()==="tempValue"){const F=u.getTypeAtLocation(a);c=u.typeToString(F,a,f.TypeFormatFlags.NoTruncation|f.TypeFormatFlags.UseFullyQualifiedType)}f.forEachChild(a,d)};return d(l),c},ce=(t,n)=>{const i=`
36
+ ${O(n)}
37
+ type Target = ${t};
38
+ `,r="index.ts",g=A(r,i),l=g.getSourceFile(r),u=g.languageService.getProgram().getTypeChecker(),c=l.statements.find(s=>f.isTypeAliasDeclaration(s)&&s.name.text==="Target");if(!c)return{__typename:"LiteralValue",value:null};const d=u.getTypeAtLocation(c.type),a=(s,y,e=new Set)=>{if(e.has(s))return null;e.add(s);const o=s.getFlags();if(s.isUnion()){if(y.type,f.isTypeAliasDeclaration(y)&&y.type&&f.isUnionTypeNode(y.type)){const v=u.getTypeFromTypeNode(y.type.types[0]);return a(v,y,e)}const m=s.types.filter(v=>{const S=v.getFlags();return!(S&f.TypeFlags.Undefined)&&!(S&f.TypeFlags.Null)}),T=m.length>0?m[0]:s.types[0];return a(T,y,e)}if(o&f.TypeFlags.StringLiteral)return s.value;if(o&f.TypeFlags.String)return"";if(o&f.TypeFlags.NumberLiteral)return s.value;if(o&f.TypeFlags.Number)return 0;if(o&f.TypeFlags.BooleanLiteral)return s.intrinsicName==="true";if(o&f.TypeFlags.Boolean)return!1;if(u.isArrayType(s)){const T=s.typeArguments?.[0]||u.getAnyType();return a(T,y,e)==="null"?[a(T,y,e)]:[]}if(s.isClassOrInterface()||o&f.TypeFlags.Object||s.getProperties().length>0){const m={};return s.getProperties().forEach(v=>{const S=u.getTypeOfSymbolAtLocation(v,y);S&&(m[v.getName()]=a(S,y,e))}),m}return null};return{__typename:"LiteralValue",value:a(d,c)}},le=(t,n,i)=>{let r=n;const g=t?U(t,i):null;if(t&&n&&g!==j.NODE){let l=function(y){const e=y.trim().match(/^<([^>]+)>/);return e?e[1].split(",").map(o=>o.trim()).filter(Boolean).length:0};const p=`
39
+ ${O(i)}
40
+ type TargetType = ${t};
41
+ ${n?.map((y,e)=>`
42
+ declare function Fu${e}${y.signature};
43
+ type F${e} = ReturnType<typeof Fu${e}${l(y.signature)>0?`<${Array(l(y.signature)).fill("any").join(", ")}>`:""}>;
42
44
  `).join(`
43
45
  `)}
44
- ${t?.map((i,g)=>`const check${g}: TargetType = {} as F${g};`).join(`
46
+ ${n?.map((y,e)=>`const check${e}: TargetType = {} as F${e};`).join(`
45
47
  `)}
46
- `,c="index.ts",a=V(c,s),u=a.getSourceFile(c),l=a.languageService.getProgram().getSemanticDiagnostics(),T=new Set;l.forEach(i=>{i.file===u&&i.start!==void 0&&T.add(u.getLineAndCharacterOfPosition(i.start).line)}),r=t.filter((i,g)=>{const F=`const check${g}: TargetType = {} as F${g};`,h=s.split(`
47
- `).findIndex(f=>f.includes(F));return h!==-1&&!T.has(h)})}return r?.map(o=>({__typename:"NodeFunction",id:"gid://sagittarius/NodeFunction/1",functionDefinition:{__typename:"FunctionDefinition",id:o.identifier,identifier:o.identifier},parameters:{__typename:"NodeParameterConnection",nodes:(o.parameterDefinitions?.nodes||[]).map(s=>({__typename:"NodeParameter",parameterDefinition:{__typename:"ParameterDefinition",id:s?.identifier,identifier:s?.identifier},value:null}))}})).filter(o=>o!==null)??[]},fe=(e,t,n="any",r,o)=>{if(!e)return[];if(!t)return[];const s=[],c=e?.nodes?.nodes||[],a=c.find(i=>i?.id===t);if(!a)return[];const u=E(o),p=(i,g)=>{if(!n||n==="any"||i==="any")return!0;const F="index.ts",d=`
48
- ${u}
49
- const val: ${i} = {} as any;
50
- const test: ${n} = val${g?`.${g}`:""};
51
- `,h=V(F,d),f=h.getSourceFile(F);return!h.languageService.getProgram().getSemanticDiagnostics(f).some($=>$.category===y.DiagnosticCategory.Error)},l=(i,g)=>{const F=[],d="index.ts",h=`
52
- ${u}
53
- const val: ${i} = {} as any;
54
- `,f=V(d,h),S=f.getSourceFile(d),m=f.languageService.getProgram(),$=m.getTypeChecker();p(i)&&F.push({...g,referencePath:[]});const v=(x,C=[])=>{if(C.length>3)return;const P=x.getProperties();for(const M of P){const I=M.getName();let b;if($.getPropertyOfType){const _=$.getPropertyOfType(x,I);_&&(b=$.getTypeOfSymbolAtLocation(_,S))}else{const _=x.getProperty(I);_&&(b=$.getTypeOfSymbolAtLocation(_,S))}if(!b)continue;const D=[...C,I],L=D.join(".");p(i,L)&&F.push({...g,referencePath:D.map(_=>({__typename:"ReferencePath",path:_}))}),v(b,D)}};if(m.getSemanticDiagnostics(S).length===0){let x;const C=P=>{y.isVariableDeclaration(P)&&P.name.getText()==="val"&&(x=$.getTypeAtLocation(P)),y.forEachChild(P,C)};C(S),x&&v(x)}return F};if(e.inputType){const i=e.inputType||"any";s.push(...l(i,{}))}c.forEach(i=>{if(!(!i||i.id===t)&&pe(e,i,a)){const g=j(e,i,r,o);s.push(...l(g.returnType,{__typename:"ReferenceValue",nodeFunctionId:i.id,referencePath:[]}))}});let T=O(e,t);for(;T;){if(r?.find(g=>g.identifier===T.functionDefinition?.identifier)){const g=T.parameters?.nodes?.findIndex(F=>{const d=F?.value;if(d?.__typename==="NodeFunctionIdWrapper"){const h=d;return h.id===t||z(e,h.id||void 0,t)}return!1});g!==void 0&&g!==-1&&s.push(...l("any",{__typename:"ReferenceValue",nodeFunctionId:T.id,parameterIndex:g,inputIndex:0,referencePath:[]}))}T=O(e,T.id)}return s};function pe(e,t,n){const r=e.nodes?.nodes||[];let o=t.nextNodeId;const s=new Set;for(;o;){if(o===n.id)return!0;if(s.has(o))break;s.add(o),o=r.find(u=>u?.id===o)?.nextNodeId}let c=O(e,n.id);for(;c;){if(c.id===t.id)return!0;c=O(e,c.id)}return!1}function O(e,t){return e.nodes?.nodes?.find(r=>r?.parameters?.nodes?.some(o=>o?.value?.__typename==="NodeFunctionIdWrapper"&&o.value.id===t))||void 0}function z(e,t,n){if(!t)return!1;if(t===n)return!0;const o=(e.nodes?.nodes||[]).find(c=>c?.id===t);return o?o.nextNodeId&&z(e,o.nextNodeId||void 0,n)?!0:!!o.parameters?.nodes?.some(c=>{const a=c?.value;return a?.__typename==="NodeFunctionIdWrapper"?z(e,a.id||void 0,n):!1}):!1}const me=(e,t)=>{if(!e)return[];const n=`
55
- ${E(t)}
56
- type T = ${e}; const val: T = {} as any;
57
- `,r="index.ts",o=V(r,n),s=o.getSourceFile(r),a=o.languageService.getProgram().getTypeChecker(),u=s.statements.find(y.isTypeAliasDeclaration);if(!u)return[];const p=a.getTypeAtLocation(u),l=i=>i.isUnion()?i.types.flatMap(l):i.isStringLiteral()?[i.value]:i.isNumberLiteral()?[i.value.toString()]:i.intrinsicName==="true"?["true"]:i.intrinsicName==="false"?["false"]:[];return Array.from(new Set(l(p))).map(i=>({__typename:"LiteralValue",value:i}))},k=e=>e.replace(/[^a-zA-Z0-9]/g,"_"),ye=(e,t,n)=>{const r=new Set,o=e?.nodes?.nodes||[],s=new Map(t?.map(f=>[f.identifier,f])),c=(f,S="")=>{if(r.has(f))return"";const m=o.find(I=>I?.id===f);if(!m||!m.functionDefinition)return"";r.add(f);const $=s.get(m.functionDefinition?.identifier);if(!$)return`${S}// Error: Function ${m.functionDefinition.identifier} not found
58
- `;const N=(m.parameters?.nodes||[]).map((I,b)=>{const D=I.value;if(!D)return"undefined";if(D.__typename==="ReferenceValue"){const L=D;if(!L.nodeFunctionId)return"undefined";let _=L.parameterIndex!==void 0?`/* @pos ${f} ${b} */ p_${k(L.nodeFunctionId)}_${L.parameterIndex}`:`/* @pos ${f} ${b} */ node_${k(L.nodeFunctionId)}`;return L.referencePath?.forEach(B=>{_+=`?.${B.path}`}),_}if(D.__typename==="LiteralValue")return`/* @pos ${f} ${b} */ ${JSON.stringify(D.value)}`;if(D.__typename==="NodeFunctionIdWrapper"){const L=D,_=`p_${k(m.id)}_${b}`,B=c(L.id,S+" ");return`/* @pos ${f} ${b} */ (${_}) => {
59
- ${B}${S}}`}return"undefined"}).join(", "),x=`node_${k(m.id)}`,C=`fn_${$.identifier?.replace(/::/g,"_")}`,P=N.includes("undefined");let M=`${S}const ${x} = ${C}(${N})${P?" as any":""} ;
60
- `;return m.nextNodeId&&(M+=c(m.nextNodeId,S)),M},a=E(n),u=t?.map(f=>`declare function fn_${f.identifier?.replace(/::/g,"_")}${f.signature}`).join(`
61
- `),p=o.map(f=>f?.id?c(f.id):"").filter(f=>f!=="").join(`
62
- `),l=`${a}
63
- ${u}
64
-
65
- // --- Flow ---
66
- ${p}`,T="index.ts",i=V(T,l),g=i.getSourceFile(T),h=i.languageService.getProgram().getSemanticDiagnostics(g).map(f=>{const S=y.flattenDiagnosticMessageText(f.messageText,`
67
- `);if(S.includes("Argument of type 'undefined'")||S.includes("not assignable to type 'undefined'"))return null;let $,v;if(f.start!==void 0){const C=g.getFullText().substring(0,f.start).match(/\/\* @pos ([^ ]+) (\d+) \*\/\s*$/);C&&($=C[1],v=parseInt(C[2],10))}return{message:S,code:f.code,severity:"error",nodeId:$,parameterIndex:v}}).filter(f=>f!==null);return{isValid:!h.some(f=>f?.severity==="error"),returnType:"void",diagnostics:h}},Fe=(e,t,n)=>{const r=JSON.stringify(t?.value),o=`
68
- ${E(n)}
69
- const testValue: ${e} = ${r};
70
- `,s="index.ts",u=V(s,o).languageService.getSemanticDiagnostics(s).map(p=>{const l=y.flattenDiagnosticMessageText(p.messageText,`
71
- `),T=/\b([TRKV])\b/.test(l),i=l.includes("not assignable to parameter of type")&&(l.includes("'{}'")||l.includes("undefined"))||l.includes("not assignable to type 'undefined'")||l.includes("not assignable to type 'void'")||l.includes("may be a mistake because neither type sufficiently overlaps");return{message:l,code:p.code,severity:T||i?"warning":"error"}});return{isValid:!u.some(p=>p.severity==="error"),returnType:"void",diagnostics:u}};exports.DataTypeVariant=Z;exports.getFlowValidation=ye;exports.getNodeSuggestions=de;exports.getNodeValidation=j;exports.getReferenceSuggestions=fe;exports.getTypeFromValue=ce;exports.getTypeVariant=ue;exports.getTypesFromNode=ge;exports.getValueFromType=le;exports.getValueSuggestions=me;exports.getValueValidation=Fe;
48
+ `,u="index.ts",c=A(u,p),d=c.getSourceFile(u),F=c.languageService.getProgram().getSemanticDiagnostics(),s=new Set;F.forEach(y=>{y.file===d&&y.start!==void 0&&s.add(d.getLineAndCharacterOfPosition(y.start).line)}),r=n.filter((y,e)=>{const o=`const check${e}: TargetType = {} as F${e};`,T=p.split(`
49
+ `).findIndex(v=>v.includes(o));return T!==-1&&!s.has(T)})}return r?.map(l=>({__typename:"NodeFunction",id:"gid://sagittarius/NodeFunction/1",functionDefinition:{__typename:"FunctionDefinition",id:l.id,identifier:l.identifier},parameters:{__typename:"NodeParameterConnection",nodes:(l.parameterDefinitions?.nodes||[]).map(p=>({__typename:"NodeParameter",parameterDefinition:{__typename:"ParameterDefinition",id:p?.id,identifier:p?.identifier},value:null}))}})).filter(l=>l!==null)??[]},ue=(t,n,i,r,g)=>{const l=z(t,r,g,!0),p="index.ts",u=A(p,l),c=u.getSourceFile(p),a=u.languageService.getProgram().getTypeChecker(),F=c.getFullText(),s=`/* @pos ${n} ${i} */`,e=F.indexOf(s)+s.length;function o($,N){let h=$;return f.forEachChild($,b=>{b.getStart(c,!0)<=N&&b.getEnd()>=N&&(h=o(b,N))}),h}const T=o(c,e);let v;if(f.isCallExpression(T)&&(v=T),!v)return[];const S=a.getResolvedSignature(v);if(!S)return[];const C=S.getParameters(),w=C[i]||C[C.length-1],P=a.getTypeOfSymbolAtLocation(w,T),x=a.getSymbolsInScope(T,f.SymbolFlags.Variable),E=[];return x.forEach($=>{const N=$.getName();if(!N.startsWith("node_")&&!N.startsWith("p_"))return;const h=$.valueDeclaration||$.declarations?.[0];if(!h||h.getEnd()>=e)return;const b=a.getTypeOfSymbolAtLocation($,T);if(N.startsWith("node_")){if((b.flags&f.TypeFlags.Void)===0&&a.isTypeAssignableTo(b,P)){const _=N.replace("node_","").replace(/___/g,"://").replace(/__/g,"/").replace(/_/g,"/");E.push({__typename:"ReferenceValue",nodeFunctionId:_})}}else if(N.startsWith("p_")){const _=N.replace("p_",""),D=_.lastIndexOf("_"),V=_.substring(0,D),M=parseInt(_.substring(D+1),10),H=V.replace("p_","").replace(/___/g,"://").replace(/__/g,"/").replace(/_/g,"/");if(a.isTupleType(b)){const B=b;a.getTypeArguments(B).forEach((Z,W)=>{a.isTypeAssignableTo(Z,P)&&E.push({__typename:"ReferenceValue",nodeFunctionId:H,parameterIndex:isNaN(M)?0:M,inputIndex:W,inputTypeIdentifier:B.target.labeledElementDeclarations?.[W].name.getText()})})}}}),E},ge=(t,n)=>{if(!t)return[];const i=`
50
+ ${O(n)}
51
+ type VALUE = ${t}; const val: VALUE = {} as any;
52
+ `,r="index.ts",g=A(r,i),l=g.getSourceFile(r),u=g.languageService.getProgram().getTypeChecker(),c=l.statements.find(s=>f.isTypeAliasDeclaration(s)&&s.name.text==="VALUE");if(!c||!f.isTypeAliasDeclaration(c))return[];const d=u.getTypeAtLocation(c),a=s=>s.isUnion()?s.types.flatMap(a):s.isStringLiteral()?[s.value]:s.isNumberLiteral()?[s.value.toString()]:s.intrinsicName==="true"?["true"]:s.intrinsicName==="false"?["false"]:[];return Array.from(new Set(a(d))).map(s=>({__typename:"LiteralValue",value:s}))},pe=(t,n,i)=>{const r=z(t,n,i),g="index.ts",l=A(g,r),p=l.getSourceFile(g),d=l.languageService.getProgram().getSemanticDiagnostics(p).map(a=>{const F=f.flattenDiagnosticMessageText(a.messageText,`
53
+ `);let s,y;if(a.start!==void 0){const e=p.getFullText(),o=Math.max(0,a.start-300),m=Math.min(e.length,a.start),T=e.substring(o,m),v=/\/\* @pos ([^ ]+) (\d+) \*\//g;let S,C=null,w=-1;for(;(S=v.exec(T))!==null;){const x=o+S.index+S[0].length;x<=a.start&&x>w&&(w=x,C=S)}C&&(s=C[1],y=parseInt(C[2],10))}return{message:F,code:a.code,severity:"error",nodeId:s,parameterIndex:y}}).filter(a=>a!==null);return{isValid:!d.some(a=>a?.severity==="error"),returnType:"void",diagnostics:d}},fe=(t,n,i)=>{const r=JSON.stringify(n?.value),g=`
54
+ ${O(i)}
55
+ const testValue: ${t} = ${r};
56
+ `,l="index.ts",c=A(l,g).languageService.getSemanticDiagnostics(l).map(d=>{const a=f.flattenDiagnosticMessageText(d.messageText,`
57
+ `),F=a.includes("not assignable to parameter of type")&&(a.includes("'{}'")||a.includes("undefined"))||a.includes("not assignable to type 'undefined'")||a.includes("not assignable to type 'void'")||a.includes("may be a mistake because neither type sufficiently overlaps");return{message:a,code:d.code,severity:F?"warning":"error"}});return{isValid:!c.some(d=>d.severity==="error"),returnType:"void",diagnostics:c}};exports.DataTypeVariant=j;exports.getFlowValidation=pe;exports.getNodeSuggestions=le;exports.getReferenceSuggestions=ue;exports.getTypeFromValue=se;exports.getTypeVariant=U;exports.getTypesFromNode=Q;exports.getValueFromType=ce;exports.getValueSuggestions=ge;exports.getValueValidation=fe;