@wordinweb/agent 0.2.0 → 0.2.1

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.
@@ -7052,22 +7052,18 @@ var _DocxDocument = class _DocxDocument {
7052
7052
  }
7053
7053
  findParentOf(target) {
7054
7054
  const roots = this.contentRoots();
7055
+ if (roots.includes(target)) return void 0;
7055
7056
  const memo = this._parentMemo.get(target);
7056
7057
  if (memo && memo.children.includes(target) && this.memoIsLive(memo, roots)) return memo;
7057
7058
  const walk2 = (el26) => {
7058
7059
  for (const c of el26.children) {
7059
7060
  this._parentMemo.set(c, el26);
7060
- if (c === target) return el26;
7061
- const hit = walk2(c);
7062
- if (hit) return hit;
7061
+ walk2(c);
7063
7062
  }
7064
- return void 0;
7065
7063
  };
7066
- for (const root of roots) {
7067
- const hit = walk2(root);
7068
- if (hit) return hit;
7069
- }
7070
- return void 0;
7064
+ for (const root of roots) walk2(root);
7065
+ const found = this._parentMemo.get(target);
7066
+ return found && found.children.includes(target) && this.memoIsLive(found, roots) ? found : void 0;
7071
7067
  }
7072
7068
  /** Record a parent link the caller just created (a splice), so the next
7073
7069
  * lookup skips the full-document walk. Advisory only — findParentOf
@@ -45398,4 +45394,4 @@ export {
45398
45394
  AgentDocument,
45399
45395
  collaborativeAgentTarget
45400
45396
  };
45401
- //# sourceMappingURL=chunk-3HREJUDW.js.map
45397
+ //# sourceMappingURL=chunk-EMDLXVNY.js.map