import{o as e}from"./devlop-Cl3hj7Sz.js";import{n as t}from"./micromark-util-normalize-identifier-CzKtq1sx.js";function n(){this.buffer()}function o(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function i(){this.buffer()}function r(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function f(n){const o=this.resume(),i=this.stack[this.stack.length-1];e("footnoteReference"===i.type),i.identifier=t(this.sliceSerialize(n)).toLowerCase(),i.label=o}function s(e){this.exit(e)}function c(n){const o=this.resume(),i=this.stack[this.stack.length-1];e("footnoteDefinition"===i.type),i.identifier=t(this.sliceSerialize(n)).toLowerCase(),i.label=o}function a(e){this.exit(e)}function l(e,t,n,o){const i=n.createTracker(o);let r=i.move("[^");const f=n.enter("footnoteReference"),s=n.enter("reference");return r+=i.move(n.safe(n.associationId(e),{after:"]",before:r})),s(),f(),r+=i.move("]"),r}function u(){return{enter:{gfmFootnoteCallString:n,gfmFootnoteCall:o,gfmFootnoteDefinitionLabelString:i,gfmFootnoteDefinition:r},exit:{gfmFootnoteCallString:f,gfmFootnoteCall:s,gfmFootnoteDefinitionLabelString:c,gfmFootnoteDefinition:a}}}function h(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:function(e,n,o,i){const r=o.createTracker(i);let f=r.move("[^");const s=o.enter("footnoteDefinition"),c=o.enter("label");f+=r.move(o.safe(o.associationId(e),{before:f,after:"]"})),c(),f+=r.move("]:"),e.children&&e.children.length>0&&(r.shift(4),f+=r.move((t?"\n":" ")+o.indentLines(o.containerFlow(e,r.current()),t?g:m)));return s(),f},footnoteReference:l},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}}function m(e,t,n){return 0===t?e:g(e,t,n)}function g(e,t,n){return(n?"":"    ")+e}l.peek=function(){return"["};export{h as a,u as g};
