import{isNode as l}from"../../../../../markdoc/helpers/guards/is-node.js";import{isStringNode as s}from"../../../../../markdoc/helpers/guards/is-string-node.js";import{getNodeAttribute as c}from"../../../../../markdoc/helpers/get-node-attribute.js";import{getInnerText as a}from"../../../../../markdoc/helpers/get-inner-text.js";function p(t){const r=c(t,"level");if(r)return{value:a(t.children),id:c(t,"id"),depth:r}}function h(t){let r;return f(t,i=>{if(l(i)&&i.type==="heading")return r=p(i)?.value,o}),r}const o=Symbol("Exit visitor");function f(t,r){if(!t)return;const i=r(t);if(i===o)return i;for(const e of t.children){if(!e||s(e))continue;const n=f(e,r);if(n===o)return n}const u=t.slots||{};for(const e of Object.values(u)){if(!e||s(e))continue;const n=f(e,r);if(n===o)return n}}export{o as EXIT,h as extractFirstHeading,p as getHeadingData,f as visit};
