UNPKG

@forbespro/lead-agent

Version:
2 lines (1 loc) 3.27 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("./index58.js"),m=require("react/jsx-runtime");require("react");const O=require("./index59.js"),v=require("./index60.js"),P=require("./index61.js"),q=require("./index62.js"),j=require("./index63.js"),E=require("./index64.js"),c=require("./index65.js"),T="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",f=[],p={allowDangerousHtml:!0},N=/^(https?|ircs?|mailto|xmpp)$/i,R=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function S(r){const e=$(r),s=H(r);return U(e.runSync(e.parse(s),s),r)}function $(r){const e=r.rehypePlugins||f,s=r.remarkPlugins||f,l=r.remarkRehypeOptions?{...r.remarkRehypeOptions,...p}:p;return O.unified().use(v.default).use(s).use(P.default,l).use(e)}function H(r){const e=r.children||"",s=new q.VFile;return typeof e=="string"&&(s.value=e),s}function U(r,e){const s=e.allowedElements,l=e.allowElement,a=e.components,u=e.disallowedElements,w=e.skipHtml,h=e.unwrapDisallowed,y=e.urlTransform||g;for(const t of R)Object.hasOwn(e,t.from)&&x.unreachable("Unexpected `"+t.from+"` prop, "+(t.to?"use `"+t.to+"` instead":"remove it")+" (see <"+T+"#"+t.id+"> for more info)");return j.visit(r,k),E.toJsxRuntime(r,{Fragment:m.Fragment,components:a,ignoreInvalidStyle:!0,jsx:m.jsx,jsxs:m.jsxs,passKeys:!0,passNode:!0});function k(t,n,i){if(t.type==="raw"&&i&&typeof n=="number")return w?i.children.splice(n,1):i.children[n]={type:"text",value:t.value},n;if(t.type==="element"){let o;for(o in c.urlAttributes)if(Object.hasOwn(c.urlAttributes,o)&&Object.hasOwn(t.properties,o)){const b=t.properties[o],d=c.urlAttributes[o];(d===null||d.includes(t.tagName))&&(t.properties[o]=y(String(b||""),o,t))}}if(t.type==="element"){let o=s?!s.includes(t.tagName):u?u.includes(t.tagName):!1;if(!o&&l&&typeof n=="number"&&(o=!l(t,n,i)),o&&i&&typeof n=="number")return h&&t.children?i.children.splice(n,1,...t.children):i.children.splice(n,1),n}}}function g(r){const e=r.indexOf(":"),s=r.indexOf("?"),l=r.indexOf("#"),a=r.indexOf("/");return e===-1||a!==-1&&e>a||s!==-1&&e>s||l!==-1&&e>l||N.test(r.slice(0,e))?r:""}exports.Markdown=S;exports.defaultUrlTransform=g;