import{b as z}from"./bail-FqpXQuLt.js";import{i as Y}from"./is-buffer-Boa4a7IC.js";import{e as C}from"./extend-B7yenLig.js";import{i as x}from"./is-plain-obj-C1gvLhAf.js";import{t as _}from"./trough-B_b8ryxu.js";import{V as q}from"./vfile-BlpNzP9y.js";const Z=j().freeze(),T={}.hasOwnProperty;function j(){const t=_(),s=[];let l={},m,g=-1;return n.data=I,n.Parser=void 0,n.Compiler=void 0,n.freeze=V,n.attachers=s,n.use=O,n.parse=F,n.stringify=N,n.run=L,n.runSync=B,n.process=U,n.processSync=D,n;function n(){const e=j();let r=-1;for(;++r{if(i||!f||!u)y(i);else{const a=n.stringify(f,u);a==null||(J(a)?u.value=a:u.result=a),y(i,u)}});function y(i,f){i||!f?p(i):c?c(f):r(null,f)}}}function D(e){let r;n.freeze(),h("processSync",n.Parser),P("processSync",n.Compiler);const o=w(e);return n.process(o,c),A("processSync","process",r),o;function c(p){r=!0,z(p)}}}function S(t,s){return typeof t=="function"&&t.prototype&&(G(t.prototype)||s in t.prototype)}function G(t){let s;for(s in t)if(T.call(t,s))return!0;return!1}function h(t,s){if(typeof s!="function")throw new TypeError("Cannot `"+t+"` without `Parser`")}function P(t,s){if(typeof s!="function")throw new TypeError("Cannot `"+t+"` without `Compiler`")}function E(t,s){if(s)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function b(t){if(!x(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function A(t,s,l){if(!l)throw new Error("`"+t+"` finished async. Use `"+s+"` instead")}function w(t){return H(t)?t:new q(t)}function H(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function J(t){return typeof t=="string"||Y(t)}export{Z as u};