{
  "version": 3,
  "sources": ["../../../../../src/libs/custom/data-structure/tree/binary-search.mts"],
  "sourcesContent": ["import { rawRecursive } from \"../../algorithms/recursive.mjs\";\nimport { none, Option, some } from \"../common/option.mjs\";\nimport type { Comparator } from \"../interfaces/schema.mjs\";\nimport type { BinaryNode } from \"./binary-tree-schema.mjs\";\n\nexport const typedBinarySearchFactory = <N extends BinaryNode<unknown>>() =>\n  rawRecursive<\n    [node: N | null, entry: N[\"entry\"], comparator: Comparator<N[\"entry\"]>],\n    Option<N[\"entry\"]>\n  >(function* (node, entry, comparator) {\n    if (node === null) {\n      return none();\n    }\n    const result = comparator(node.entry, entry);\n    if (result > 0) {\n      return yield this.call(node.left, entry, comparator);\n    }\n    if (result < 0) {\n      return yield this.call(node.right, entry, comparator);\n    }\n    return some(node.entry);\n  });\n"],
  "mappings": "AAAA;AACA;AAIO,MAAM,2BAA2B,MACtC,aAGE,WAAW,MAAM,OAAO,YAAY;AACpC,MAAI,SAAS,MAAM;AACjB,WAAO;AAAA;AAET,QAAM,SAAS,WAAW,KAAK,OAAO;AACtC,MAAI,SAAS,GAAG;AACd,WAAO,MAAM,KAAK,KAAK,KAAK,MAAM,OAAO;AAAA;AAE3C,MAAI,SAAS,GAAG;AACd,WAAO,MAAM,KAAK,KAAK,KAAK,OAAO,OAAO;AAAA;AAE5C,SAAO,KAAK,KAAK;AAAA;",
  "names": []
}
