a4c1d21720a574af22e99de26ce4e77b0fca7349089b4d47332be2bf21cd237b.json 3.7 KB

1
  1. {"ast":null,"code":"import { RichTypeFlowGraphInteger } from \"./flowGraphRichTypes.js\";\nconst pathHasTemplatesRegex = new RegExp(/\\{(\\w+)\\}/g);\n/**\n * @experimental\n * A component that converts a path to an object accessor.\n */\nexport class FlowGraphPathConverterComponent {\n constructor(path, ownerBlock) {\n this.path = path;\n this.ownerBlock = ownerBlock;\n /**\n * The templated inputs for the provided path.\n */\n this.templatedInputs = [];\n let match = pathHasTemplatesRegex.exec(path);\n while (match) {\n const [, matchGroup] = match;\n this.templatedInputs.push(ownerBlock.registerDataInput(matchGroup, RichTypeFlowGraphInteger));\n match = pathHasTemplatesRegex.exec(path);\n }\n }\n getAccessor(pathConverter, context) {\n let finalPath = this.path;\n for (const templatedInput of this.templatedInputs) {\n const valueToReplace = templatedInput.getValue(context).value;\n finalPath = finalPath.replace(`{${templatedInput.name}}`, valueToReplace.toString());\n }\n return pathConverter.convert(finalPath);\n }\n}","map":{"version":3,"names":["RichTypeFlowGraphInteger","pathHasTemplatesRegex","RegExp","FlowGraphPathConverterComponent","constructor","path","ownerBlock","templatedInputs","match","exec","matchGroup","push","registerDataInput","getAccessor","pathConverter","context","finalPath","templatedInput","valueToReplace","getValue","value","replace","name","toString","convert"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/FlowGraph/flowGraphPathConverterComponent.js"],"sourcesContent":["import { RichTypeFlowGraphInteger } from \"./flowGraphRichTypes.js\";\nconst pathHasTemplatesRegex = new RegExp(/\\{(\\w+)\\}/g);\n/**\n * @experimental\n * A component that converts a path to an object accessor.\n */\nexport class FlowGraphPathConverterComponent {\n constructor(path, ownerBlock) {\n this.path = path;\n this.ownerBlock = ownerBlock;\n /**\n * The templated inputs for the provided path.\n */\n this.templatedInputs = [];\n let match = pathHasTemplatesRegex.exec(path);\n while (match) {\n const [, matchGroup] = match;\n this.templatedInputs.push(ownerBlock.registerDataInput(matchGroup, RichTypeFlowGraphInteger));\n match = pathHasTemplatesRegex.exec(path);\n }\n }\n getAccessor(pathConverter, context) {\n let finalPath = this.path;\n for (const templatedInput of this.templatedInputs) {\n const valueToReplace = templatedInput.getValue(context).value;\n finalPath = finalPath.replace(`{${templatedInput.name}}`, valueToReplace.toString());\n }\n return pathConverter.convert(finalPath);\n }\n}\n"],"mappings":"AAAA,SAASA,wBAAwB,QAAQ,yBAAyB;AAClE,MAAMC,qBAAqB,GAAG,IAAIC,MAAM,CAAC,YAAY,CAAC;AACtD;AACA;AACA;AACA;AACA,OAAO,MAAMC,+BAA+B,CAAC;EACzCC,WAAWA,CAACC,IAAI,EAAEC,UAAU,EAAE;IAC1B,IAAI,CAACD,IAAI,GAAGA,IAAI;IAChB,IAAI,CAACC,UAAU,GAAGA,UAAU;IAC5B;AACR;AACA;IACQ,IAAI,CAACC,eAAe,GAAG,EAAE;IACzB,IAAIC,KAAK,GAAGP,qBAAqB,CAACQ,IAAI,CAACJ,IAAI,CAAC;IAC5C,OAAOG,KAAK,EAAE;MACV,MAAM,GAAGE,UAAU,CAAC,GAAGF,KAAK;MAC5B,IAAI,CAACD,eAAe,CAACI,IAAI,CAACL,UAAU,CAACM,iBAAiB,CAACF,UAAU,EAAEV,wBAAwB,CAAC,CAAC;MAC7FQ,KAAK,GAAGP,qBAAqB,CAACQ,IAAI,CAACJ,IAAI,CAAC;IAC5C;EACJ;EACAQ,WAAWA,CAACC,aAAa,EAAEC,OAAO,EAAE;IAChC,IAAIC,SAAS,GAAG,IAAI,CAACX,IAAI;IACzB,KAAK,MAAMY,cAAc,IAAI,IAAI,CAACV,eAAe,EAAE;MAC/C,MAAMW,cAAc,GAAGD,cAAc,CAACE,QAAQ,CAACJ,OAAO,CAAC,CAACK,KAAK;MAC7DJ,SAAS,GAAGA,SAAS,CAACK,OAAO,CAAC,IAAIJ,cAAc,CAACK,IAAI,GAAG,EAAEJ,cAAc,CAACK,QAAQ,CAAC,CAAC,CAAC;IACxF;IACA,OAAOT,aAAa,CAACU,OAAO,CAACR,SAAS,CAAC;EAC3C;AACJ","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]}