{"version":3,"sources":["../../../src/internals/helpers/prototype.ts"],"names":["traversePrototypeChain","value","excluded","node","undefined","Object","getPrototypeOf","has","isDirectInstanceOf","object","constructor","R","isTruthy","prototype","findDescriptor","target","property","descriptor","getOwnPropertyDescriptor"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAmBO,UAAUA,sBAAAA,CAAuBC,OAAgBC,QAAmB,EAAA;AACzE,EAAA,IAAIC,IAAOF,GAAAA,KAAAA;AACX,EAAOE,OAAAA,IAAAA,KAAS,IAAQA,IAAAA,IAAAA,KAASC,MAAW,EAAA;AAC1CD,IAAOE,IAAAA,GAAAA,MAAAA,CAAOC,eAAeH,IAAAA,CAAAA;AAC7B,IAAA,IAAI,CAACD,QAAAA,EAAUK,GAAMJ,GAAAA,IAAAA,CAAO,EAAA;AAC1B,MAAMA,MAAAA,IAAAA;AACR;AACF;AACF;AARiBH,MAAAA,CAAAA,sBAAAA,EAAAA,wBAAAA,CAAAA;AAUV,SAASQ,kBAAAA,CACdC,QACAC,WAAgC,EAAA;AAEhC,EAAOC,OAAAA,YAAAA,CAAEC,SAASH,MAAAA,CAAAA,IAAWJ,OAAOC,cAAeG,CAAAA,MAAAA,MAAYC,WAAYG,CAAAA,SAAAA;AAC7E;AALgBL,MAAAA,CAAAA,kBAAAA,EAAAA,oBAAAA,CAAAA;AAOT,SAASM,cAAAA,CACdC,QACAC,QAAiB,EAAA;AAEjB,EAAWb,KAAAA,MAAAA,IAAAA,IAAQH,sBAAuBe,CAAAA,MAAAA,CAAS,EAAA;AACjD,IAAA,MAAME,UAAaZ,GAAAA,MAAAA,CAAOa,wBAAyBf,CAAAA,IAAAA,EAAMa,QAAAA,CAAAA;AACzD,IAAA,IAAIC,UAAY,EAAA;AACd,MAAOA,OAAAA,UAAAA;AACT;AACF;AACA,EAAO,OAAA,IAAA;AACT;AAXgBH,MAAAA,CAAAA,cAAAA,EAAAA,gBAAAA,CAAAA","file":"prototype.cjs","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ClassConstructor } from \"@/internals/types.js\";\nimport * as R from \"remeda\";\n\nexport function* traversePrototypeChain(value: unknown, excluded?: Set<any>) {\n  let node = value;\n  while (node !== null && node !== undefined) {\n    node = Object.getPrototypeOf(node);\n    if (!excluded?.has?.(node)) {\n      yield node;\n    }\n  }\n}\n\nexport function isDirectInstanceOf<A>(\n  object: unknown,\n  constructor: ClassConstructor<A>,\n): object is A {\n  return R.isTruthy(object) && Object.getPrototypeOf(object) === constructor.prototype;\n}\n\nexport function findDescriptor<T extends NonNullable<unknown>>(\n  target: T,\n  property: keyof T,\n): PropertyDescriptor | null {\n  for (const node of traversePrototypeChain(target)) {\n    const descriptor = Object.getOwnPropertyDescriptor(node, property);\n    if (descriptor) {\n      return descriptor;\n    }\n  }\n  return null;\n}\n"]}