"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../../../micromark-util-character@2.1.1/node_modules/micromark-util-character/index.cjs.js"),b={tokenize:_,partial:!0},x={tokenize:H,partial:!0},P={tokenize:R,partial:!0},S={tokenize:j,partial:!0},D={tokenize:q,partial:!0},L={name:"wwwAutolink",tokenize:y,previous:v},W={name:"protocolAutolink",tokenize:T,previous:E},A={name:"emailAutolink",tokenize:C,previous:I},p={};function O(){return{text:p}}let f=48;for(;f<123;)p[f]=A,f++,f===58?f=65:f===91&&(f=97);p[43]=A;p[45]=A;p[46]=A;p[95]=A;p[72]=[A,W];p[104]=[A,W];p[87]=[A,L];p[119]=[A,L];function C(n,m,l){const u=this;let e,a;return t;function t(r){return!h(r)||!I.call(u,u.previous)||g(u.events)?l(r):(n.enter("literalAutolink"),n.enter("literalAutolinkEmail"),i(r))}function i(r){return h(r)?(n.consume(r),i):r===64?(n.consume(r),k):l(r)}function k(r){return r===46?n.check(D,w,s)(r):r===45||r===95||o.asciiAlphanumeric(r)?(a=!0,n.consume(r),k):w(r)}function s(r){return n.consume(r),e=!0,k}function w(r){return a&&e&&o.asciiAlpha(u.previous)?(n.exit("literalAutolinkEmail"),n.exit("literalAutolink"),m(r)):l(r)}}function y(n,m,l){const u=this;return e;function e(t){return t!==87&&t!==119||!v.call(u,u.previous)||g(u.events)?l(t):(n.enter("literalAutolink"),n.enter("literalAutolinkWww"),n.check(b,n.attempt(x,n.attempt(P,a),l),l)(t))}function a(t){return n.exit("literalAutolinkWww"),n.exit("literalAutolink"),m(t)}}function T(n,m,l){const u=this;let e="",a=!1;return t;function t(r){return(r===72||r===104)&&E.call(u,u.previous)&&!g(u.events)?(n.enter("literalAutolink"),n.enter("literalAutolinkHttp"),e+=String.fromCodePoint(r),n.consume(r),i):l(r)}function i(r){if(o.asciiAlpha(r)&&e.length<5)return e+=String.fromCodePoint(r),n.consume(r),i;if(r===58){const z=e.toLowerCase();if(z==="http"||z==="https")return n.consume(r),k}return l(r)}function k(r){return r===47?(n.consume(r),a?s:(a=!0,k)):l(r)}function s(r){return r===null||o.asciiControl(r)||o.markdownLineEndingOrSpace(r)||o.unicodeWhitespace(r)||o.unicodePunctuation(r)?l(r):n.attempt(x,n.attempt(P,w),l)(r)}function w(r){return n.exit("literalAutolinkHttp"),n.exit("literalAutolink"),m(r)}}function _(n,m,l){let u=0;return e;function e(t){return(t===87||t===119)&&u<3?(u++,n.consume(t),e):t===46&&u===3?(n.consume(t),a):l(t)}function a(t){return t===null?l(t):m(t)}}function H(n,m,l){let u,e,a;return t;function t(s){return s===46||s===95?n.check(S,k,i)(s):s===null||o.markdownLineEndingOrSpace(s)||o.unicodeWhitespace(s)||s!==45&&o.unicodePunctuation(s)?k(s):(a=!0,n.consume(s),t)}function i(s){return s===95?u=!0:(e=u,u=void 0),n.consume(s),t}function k(s){return e||u||!a?l(s):m(s)}}function R(n,m){let l=0,u=0;return e;function e(t){return t===40?(l++,n.consume(t),e):t===41&&u<l?a(t):t===33||t===34||t===38||t===39||t===41||t===42||t===44||t===46||t===58||t===59||t===60||t===63||t===93||t===95||t===126?n.check(S,m,a)(t):t===null||o.markdownLineEndingOrSpace(t)||o.unicodeWhitespace(t)?m(t):(n.consume(t),e)}function a(t){return t===41&&u++,n.consume(t),e}}function j(n,m,l){return u;function u(i){return i===33||i===34||i===39||i===41||i===42||i===44||i===46||i===58||i===59||i===63||i===95||i===126?(n.consume(i),u):i===38?(n.consume(i),a):i===93?(n.consume(i),e):i===60||i===null||o.markdownLineEndingOrSpace(i)||o.unicodeWhitespace(i)?m(i):l(i)}function e(i){return i===null||i===40||i===91||o.markdownLineEndingOrSpace(i)||o.unicodeWhitespace(i)?m(i):u(i)}function a(i){return o.asciiAlpha(i)?t(i):l(i)}function t(i){return i===59?(n.consume(i),u):o.asciiAlpha(i)?(n.consume(i),t):l(i)}}function q(n,m,l){return u;function u(a){return n.consume(a),e}function e(a){return o.asciiAlphanumeric(a)?l(a):m(a)}}function v(n){return n===null||n===40||n===42||n===95||n===91||n===93||n===126||o.markdownLineEndingOrSpace(n)}function E(n){return!o.asciiAlpha(n)}function I(n){return!(n===47||h(n))}function h(n){return n===43||n===45||n===46||n===95||o.asciiAlphanumeric(n)}function g(n){let m=n.length,l=!1;for(;m--;){const u=n[m][1];if((u.type==="labelLink"||u.type==="labelImage")&&!u._balanced){l=!0;break}if(u._gfmAutolinkLiteralWalkedInto){l=!1;break}}return n.length>0&&!l&&(n[n.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),l}exports.gfmAutolinkLiteral=O;
//# sourceMappingURL=syntax.cjs.js.map
