"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../util/check-quote.cjs.js"),c=require("../util/format-link-as-autolink.cjs.js");f.peek=b;function f(i,k,e,m){const n=s.checkQuote(e),v=n==='"'?"Quote":"Apostrophe",r=e.createTracker(m);let u,o;if(c.formatLinkAsAutolink(i,e)){const a=e.stack;e.stack=[],u=e.enter("autolink");let l=r.move("<");return l+=r.move(e.containerPhrasing(i,{before:l,after:">",...r.current()})),l+=r.move(">"),u(),e.stack=a,l}u=e.enter("link"),o=e.enter("label");let t=r.move("[");return t+=r.move(e.containerPhrasing(i,{before:t,after:"](",...r.current()})),t+=r.move("]("),o(),!i.url&&i.title||/[\0- \u007F]/.test(i.url)?(o=e.enter("destinationLiteral"),t+=r.move("<"),t+=r.move(e.safe(i.url,{before:t,after:">",...r.current()})),t+=r.move(">")):(o=e.enter("destinationRaw"),t+=r.move(e.safe(i.url,{before:t,after:i.title?" ":")",...r.current()}))),o(),i.title&&(o=e.enter(`title${v}`),t+=r.move(" "+n),t+=r.move(e.safe(i.title,{before:t,after:n,...r.current()})),t+=r.move(n),o()),t+=r.move(")"),u(),t}function b(i,k,e){return c.formatLinkAsAutolink(i,e)?"<":"["}exports.link=f;
//# sourceMappingURL=link.cjs.js.map
