@limetech/lime-elements 40.20.0 → 40.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/limel-chart.cjs.entry.js +29 -18
- package/dist/cjs/limel-markdown.cjs.entry.js +2 -2
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +1 -1
- package/dist/cjs/{markdown-exporter-BWS2EBxq.js → markdown-exporter-CGNfjGr9.js} +80 -897
- package/dist/cjs/{markdown-parser-toAp9-Eq.js → markdown-parser-C14XF_G3.js} +994 -38
- package/dist/collection/components/chart/chart.css +20 -5
- package/dist/collection/components/chart/chart.js +3 -0
- package/dist/collection/components/chart/options.js +12 -16
- package/dist/collection/components/chart/theme.js +13 -1
- package/dist/esm/limel-chart.entry.js +29 -18
- package/dist/esm/limel-markdown.entry.js +2 -2
- package/dist/esm/limel-prosemirror-adapter.entry.js +1 -1
- package/dist/esm/{markdown-exporter-B2vFxSLw.js → markdown-exporter-DcFcD699.js} +80 -897
- package/dist/esm/{markdown-parser-Cw8iW5R9.js → markdown-parser-8aHA9IYo.js} +991 -33
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/{p-8514480b.entry.js → p-0887e0df.entry.js} +2 -2
- package/dist/lime-elements/{p-1d9bc526.entry.js → p-9edd79a8.entry.js} +1 -1
- package/dist/lime-elements/p-C9gctvIB.js +1 -0
- package/dist/lime-elements/{p-c2f993cc.entry.js → p-a891f3e8.entry.js} +1 -1
- package/dist/lime-elements/p-kiQd8Ntf.js +7 -0
- package/dist/types/components/chart/theme.d.ts +2 -2
- package/package.json +3 -3
- package/dist/lime-elements/p-Bd37Vplf.js +0 -7
- package/dist/lime-elements/p-CvHpvp0f.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as t,w as n,y as e,A as r,i as o,C as i,g as c,v as a,E as u,S as s,h as l,u as f}from"./p-CbPYnlF-.js";import{f as d,h as p,c as h,a as m,d as g,p as b,b as y,e as v,i as k,j as x,k as w,t as C,r as S,l as A}from"./p-kiQd8Ntf.js";import"./p-B85MJLTf.js";const B={}.hasOwnProperty;function F(t,n){let e,r=-1;if(n.extensions)for(;++r<n.extensions.length;)F(t,n.extensions[r]);for(e in n)if(B.call(n,e))switch(e){case"extensions":break;case"unsafe":case"join":o=t[e],(i=n[e])&&o.push(...i);break;case"handlers":L(t[e],n[e]);break;default:t.options[e]=n[e]}var o,i;return t}function L(t,n){n&&Object.assign(t,n)}const E=[function(t,n,e,r){if("code"===n.type&&d(n,r)&&("list"===t.type||t.type===n.type&&d(t,r)))return!1;if("spread"in e&&"boolean"==typeof e.spread){if(e.spread)return 1;if("html"===t.type){const n=p(t.value);if(void 0===n||6===n||7===n)return 1}if("blockquote"===t.type&&"blockquote"===n.type)return 1;if(("definition"===t.type||"paragraph"===t.type)&&"list"===n.type&&(n.ordered&&"number"==typeof n.start&&1!==n.start||n.children.length>0&&0===n.children[0].children.length))return 1;if("paragraph"===t.type&&"thematicBreak"===n.type&&"-"===h(r)&&!r.options.ruleSpaces)return 1;let o=t;for(;("blockquote"===o.type||"list"===o.type||"listItem"===o.type)&&o.children.length>0;)o=o.children[o.children.length-1];if("definition"!==o.type&&"paragraph"!==o.type)return 0;if("code"===n.type&&d(n,r))return 1;if("html"===n.type){const t=p(n.value);if(void 0===t||7===t)return 1}return"paragraph"!==t.type&&t===o||!("definition"===n.type||"heading"===n.type&&m(n,r)||"paragraph"===n.type)?0:1}}],T=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],M=[{character:"\t",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"\t",before:"[\\r\\n]",inConstruct:"phrasing"},{character:"\t",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:"\n",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:"\r",before:"[\\r\\n]",inConstruct:"phrasing"},{character:"\r",after:"\\r",inConstruct:"phrasing"},{character:"\n",before:"\\n",inConstruct:"phrasing"},{character:"\n",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:T},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:"(?:[\r\n]|$)"},{character:"&",after:"[#A-Za-z]",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","destinationRaw","phrasing","titleApostrophe","titleQuote"]},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:T},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:"(?:[ \t\r\n*])"},{character:"*",inConstruct:"phrasing",notInConstruct:T},{atBreak:!0,character:"+",after:"(?:[ \t\r\n])"},{atBreak:!0,character:"-",after:"(?:[ \t\r\n-])"},{atBreak:!0,before:"\\d+",character:".",after:"(?:[ \t\r\n]|$)"},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:T},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:T},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:T},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:T},{atBreak:!0,character:"~"},{character:"<",inConstruct:"autolink"},{character:">",inConstruct:"autolink"},{character:"",inConstruct:"autolink"}];let I=-1;for(;++I<33;)M.push({character:String.fromCharCode(I),inConstruct:"autolink"});function j(t){return t.label||!t.identifier?t.label||"":g(t.identifier)}function N(t){if(!t._compiled){const n=(t.atBreak?"[\\r\\n][\\t ]*":"")+(t.before?"(?:"+t.before+")":"");t._compiled=new RegExp((t.beforeNode?"^":n?"("+n+")":"")+(/[$()*+.?[\\\]^{|}]/.test(t.character)?"\\":"")+t.character+(t.afterNode?"$":t.after?"(?:"+t.after+")":""),t.unicode?"gu":"g")}return t._compiled}function q(t,n,e,r){let o=r.join.length;for(;o--;){const i=r.join[o](t,n,e,r);if(!0===i||1===i)break;if("number"==typeof i)return"\n".repeat(1+i);if(!1===i)return"\n\n\x3c!----\x3e\n\n"}return"\n\n"}const R=/\r?\n|\r/g;function G(t,n){const e=[];let r,o=0,i=0;for(;r=R.exec(t);)c(t.slice(o,r.index)),e.push(r[0]),o=r.index+r[0].length,i++;return c(t.slice(o)),e.join("");function c(t){e.push(n(t,i,!t))}}const $={}.hasOwnProperty;function _(t,n){return!t||!!n&&("string"==typeof t?t===n.type:t.includes(n.type))}function z(t,n){return t-n}function P(t,n){const e=/\\(?=[!-/:-@[-`{-~])/g,r=[],o=[],i=t+n;let c,a=-1,u=0;for(;c=e.exec(i);)r.push(c.index);for(;++a<r.length;)u!==r[a]&&o.push(t.slice(u,r[a])),o.push("\\"),u=r[a];return o.push(t.slice(u)),o.join("")}function U(t){const n=t||{},e=n.now||{};let r=n.lineShift||0,o=e.line||1,i=e.column||1;return{move:function(t){const n=t||"",e=n.split(/\r?\n|\r/g),c=e[e.length-1];return o+=e.length-1,i=1===e.length?i+c.length:1+c.length+r,n},current:function(){return{now:{line:o,column:i},lineShift:r}},shift:function(t){r+=t}}}function Q(n,e){const r=e||{},o={associationId:j,bulletCurrent:void 0,bulletLastUsed:void 0,containerPhrasing:H,containerFlow:J,createTracker:U,compilePattern:N,enter:function(t){return o.stack.push(t),function(){o.stack.pop()}},handlers:{...k},handle:void 0,indentLines:G,indexStack:[],join:[...E],options:{},safe:Y,stack:[],unsafe:[...M]};F(o,r),o.options.tightDefinitions&&o.join.push(D),o.handle=t("type",{invalid:Z,unknown:O,handlers:o.handlers});let i=o.handle(x(n)?{type:"root",children:[n]}:n,void 0,o,{before:"\n",after:"\n",now:{line:1,column:1},lineShift:0});return i&&10!==i.charCodeAt(i.length-1)&&13!==i.charCodeAt(i.length-1)&&(i+="\n"),i}function Z(t){throw new Error("Cannot handle value `"+t+"`, expected node")}function O(t){throw new Error("Cannot handle unknown node `"+t.type+"`")}function D(t,n){if("definition"===t.type&&t.type===n.type)return 0}function H(t,n){return w(t,this,n)}function J(t,n){return function(t,n,e){const r=n.indexStack,o=t.children||[],i=n.createTracker(e),c=[];let a=-1;for(r.push(-1);++a<o.length;){const e=o[a];r[r.length-1]=a,c.push(i.move(n.handle(e,t,n,{before:"\n",after:"\n",...i.current()}))),"list"!==e.type&&(n.bulletLastUsed=void 0),a<o.length-1&&c.push(i.move(q(e,o[a+1],t,n)))}return r.pop(),c.join("")}(t,this,n)}function Y(t,n){return function(t,n,e){const r=(e.before||"")+(n||"")+(e.after||""),o=[],i=[],c={},a=t.stack.includes("autolink"),u=e.before?e.before.length:0,s=r.length-(e.after?e.after.length:0);let l=-1;for(;++l<t.unsafe.length;){const n=t.unsafe[l];if(!b(t.stack,n)||!_(n.beforeNode,e.beforeNode)||!_(n.afterNode,e.afterNode))continue;const i=t.compilePattern(n),a=n.beforeNode?u:0,f=r.slice(a,n.afterNode?s:void 0);let d;for(;d=i.exec(f);){const t="before"in n||Boolean(n.atBreak),e="after"in n,r=a+d.index+(t?d[1].length:0);$.call(c,r)?(c[r].before&&!t&&(c[r].before=!1),c[r].after&&!e&&(c[r].after=!1)):(o.push(r),c[r]={before:t,after:e})}}o.sort(z);let f=u;for(l=-1;++l<o.length;){const t=o[l];if(!(t<f||t>=s)){if("_"===r.charAt(t)&&t>0&&void 0===y(r.charCodeAt(t-1))&&!$.call(c,t-1)&&(t-1!==u||!/[*_]/.test(r.charAt(u-1)))){let n=t+1;for(;n<s&&"_"===r.charAt(n);)n++;const e=n-t-1;if(o[l+e]===n-1&&n<r.length&&void 0===y(r.charCodeAt(n))&&!$.call(c,n)&&(n!==s-1||!/[*_]/.test(r.charAt(s)))){l+=e;continue}}if(!(t+1<s&&o[l+1]===t+1&&c[t].after&&!c[t+1].before&&!c[t+1].after||t-1>=u&&o[l-1]===t-1&&c[t].before&&!c[t-1].before&&!c[t-1].after)){if(f!==t){const n=r.slice(f,t);i.push(a?n:P(n,"\\"))}f=t+1,a?i.push("%"+r.charCodeAt(t).toString(16).toUpperCase().padStart(2,"0")):!/[!-/:-@[-`{-~]/.test(r.charAt(t))||e.encode&&e.encode.includes(r.charAt(t))?i.push(v(r.charCodeAt(t))):i.push("\\"+r.charAt(t))}}}const d=r.slice(f,s);return i.push(a?d:P(d,e.after)),i.join("")}(this,t,n)}function K(t,o){const i=function(t,o){switch(t.nodeType){case 1:return function(t,o){const i=t.namespaceURI,c=i===n.svg?e:r,a=i===n.html?t.tagName.toLowerCase():t.tagName,u=i===n.html&&"template"===a?t.content:t,s=t.getAttributeNames(),l={};let f=-1;for(;++f<s.length;)l[s[f]]=t.getAttribute(s[f])||"";return c(a,l,W(u,o))}(t,o);case 3:return function(t){return{type:"text",value:t.nodeValue||""}}(t);case 8:return function(t){return{type:"comment",value:t.nodeValue||""}}(t);case 9:case 11:return V(t,o);case 10:return{type:"doctype"};default:return}}(t,o);return i&&o.afterTransform&&o.afterTransform(t,i),i}function V(t,n){return{type:"root",children:W(t,n)}}function W(t,n){const e=t.childNodes,r=[];let o=-1;for(;++o<e.length;){const t=K(e[o],n);void 0!==t&&r.push(t)}return r}const X=function(t,n,e,r,o){const i=tt(n);return!!rt(t)&&i.call(o,t,e,r)},tt=function(t){if(null==t)return et;if("string"==typeof t)return n=t,nt((function(t){return t.tagName===n}));var n;if("object"==typeof t)return function(t){const n=[];let e=-1;for(;++e<t.length;)n[e]=tt(t[e]);return nt((function(...t){let e=-1;for(;++e<n.length;)if(n[e].apply(this,t))return!0;return!1}))}(t);if("function"==typeof t)return nt(t);throw new Error("Expected function, string, or array as `test`")};function nt(t){return function(n,e,r){return Boolean(rt(n)&&t.call(this,n,"number"==typeof e?e:void 0,r||void 0))}}function et(t){return Boolean(t&&"object"==typeof t&&"type"in t&&"element"===t.type&&"tagName"in t&&"string"==typeof t.tagName)}function rt(t){return null!==t&&"object"==typeof t&&"type"in t&&"tagName"in t}const ot=tt((function(t){return"audio"===t.tagName||"canvas"===t.tagName||"embed"===t.tagName||"iframe"===t.tagName||"img"===t.tagName||"math"===t.tagName||"object"===t.tagName||"picture"===t.tagName||"svg"===t.tagName||"video"===t.tagName})),it=["address","article","aside","blockquote","body","br","caption","center","col","colgroup","dd","dialog","dir","div","dl","dt","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","legend","li","li","listing","main","menu","nav","ol","optgroup","option","p","plaintext","pre","section","summary","table","tbody","td","td","tfoot","th","th","thead","tr","ul","wbr","xmp"],ct=["button","input","select","textarea"],at=["area","base","basefont","dialog","datalist","head","link","meta","noembed","noframes","param","rp","script","source","style","template","track","title"],ut={},st=o(["comment","doctype"]);function lt(t,n){if("children"in t){const e={...n};return("root"===t.type||ht(t))&&(e.before=!0,e.after=!0),e.whitespace=function(t,n){if("tagName"in t&&t.properties)switch(t.tagName){case"listing":case"plaintext":case"script":case"style":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return t.properties.wrap?"pre-wrap":"pre";case"td":case"th":return t.properties.noWrap?"nowrap":n.whitespace;case"textarea":return"pre-wrap"}return n.whitespace}(t,n),function(t,n){let e=n.before;const r=n.after,o=t.children;let i=o.length,c=-1;for(;++c<i;){const t=lt(o[c],{...n,after:ft(o,c,r),before:e});t.remove?(o.splice(c,1),c--,i--):t.ignore||(e=t.stripAtStart),pt(o[c])&&(e=!1)}return{ignore:!1,stripAtStart:Boolean(e||r),remove:!1}}(t,e)}if("text"===t.type){if("normal"===n.whitespace)return function(t,n){const e=n.collapse(t.value),r={ignore:!1,stripAtStart:!1,remove:!1};let o=0,i=e.length;return n.before&>(e.charAt(0))&&o++,o!==i&>(e.charAt(i-1))&&(n.after?i--:r.stripAtStart=!0),o===i?r.remove=!0:t.value=e.slice(o,i),r}(t,n);"nowrap"===n.whitespace&&(t.value=n.collapse(t.value))}return{ignore:st(t),stripAtStart:!1,remove:!1}}function ft(t,n,e){for(;++n<t.length;){const e=t[n];let r=dt(e);if(void 0===r&&"children"in e&&!mt(e)&&(r=ft(e.children,-1)),"boolean"==typeof r)return r}return e}function dt(t){if("element"===t.type){if(pt(t))return!1;if(ht(t))return!0}else if("text"===t.type){if(!i(t))return!1}else if(!st(t))return!1}function pt(t){return ot(t)||X(t,ct)}function ht(t){return X(t,it)}function mt(t){return Boolean("element"===t.type&&t.properties.hidden)||st(t)||X(t,at)}function gt(t){return" "===t||"\n"===t}function bt(t){const n=/\r?\n|\r/.exec(t);return n?n[0]:" "}function yt(){return" "}function vt(t){return function(n){!function(t,n){var e;lt(t,{collapse:(e=(n||ut).newlines?bt:yt,function(t){return String(t).replace(/[\t\n\v\f\r ]+/g,e)}),whitespace:"normal"})}(n,t)}}const kt=function(t,n,e){const r=o(e);if(!t||!t.type||!t.children)throw new Error("Expected parent node");if("number"==typeof n){if(n<0||n===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if((n=t.children.indexOf(n))<0)throw new Error("Expected child node or index");for(;++n<t.children.length;)if(r(t.children[n],n,t))return t.children[n]},xt=/\n/g,wt=/[\t ]+/g,Ct=tt("br"),St=tt((function(t){return"td"===t.tagName||"th"===t.tagName})),At=tt("p"),Bt=tt("tr"),Ft=tt(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",function(t){return Boolean((t.properties||{}).hidden)},function(t){return"dialog"===t.tagName&&!(t.properties||{}).open}]),Lt=tt(["address","article","aside","blockquote","body","caption","center","dd","dialog","dir","dl","dt","div","figure","figcaption","footer","form,","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","p","plaintext","pre","section","ul","xmp"]);function Et(t){const n="children"in t?t.children:[],e=Lt(t),r=jt(t,{whitespace:{}.whitespace||"normal"}),o=[];"text"!==t.type&&"comment"!==t.type||o.push(...Mt(t,{breakBefore:!0,breakAfter:!0}));let i=-1;for(;++i<n.length;)o.push(...Tt(n[i],t,{whitespace:r,breakBefore:i?void 0:e,breakAfter:i<n.length-1?Ct(n[i+1]):e}));const c=[];let a;for(i=-1;++i<o.length;){const t=o[i];"number"==typeof t?void 0!==a&&t>a&&(a=t):t&&(void 0!==a&&a>-1&&c.push("\n".repeat(a)||" "),a=-1,c.push(t))}return c.join("")}function Tt(t,n,e){return"element"===t.type?function(t,n,e){const r=jt(t,e),o=t.children||[];let i,c,a=-1,u=[];if(Ft(t))return u;for(Ct(t)||Bt(t)&&kt(n,t,Bt)?c="\n":At(t)?(i=2,c=2):Lt(t)&&(i=1,c=1);++a<o.length;)u=u.concat(Tt(o[a],t,{whitespace:r,breakBefore:a?void 0:i,breakAfter:a<o.length-1?Ct(o[a+1]):c}));return St(t)&&kt(n,t,St)&&u.push("\t"),i&&u.unshift(i),c&&u.push(c),u}(t,n,e):"text"===t.type?"normal"===e.whitespace?Mt(t,e):function(t){return[String(t.value)]}(t):[]}function Mt(t,n){const e=String(t.value),r=[],o=[];let i=0;for(;i<=e.length;){xt.lastIndex=i;const t=xt.exec(e),o=t&&"index"in t?t.index:e.length;r.push(It(e.slice(i,o).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),0!==i||n.breakBefore,o!==e.length||n.breakAfter)),i=o+1}let c,a=-1;for(;++a<r.length;)8203===r[a].charCodeAt(r[a].length-1)||a<r.length-1&&8203===r[a+1].charCodeAt(0)?(o.push(r[a]),c=void 0):r[a]?("number"==typeof c&&o.push(c),o.push(r[a]),c=0):0!==a&&a!==r.length-1||o.push(0);return o}function It(t,n,e){const r=[];let o,i=0;for(;i<t.length;){wt.lastIndex=i;const e=wt.exec(t);o=e?e.index:t.length,i||o||!e||n||r.push(""),i!==o&&r.push(t.slice(i,o)),i=e?o+e[0].length:o}return i===o||e||r.push(""),r.join(" ")}function jt(t,n){if("element"===t.type){const e=t.properties||{};switch(t.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return e.wrap?"pre-wrap":"pre";case"td":case"th":return e.noWrap?"nowrap":n.whitespace;case"textarea":return"pre-wrap"}}return n.whitespace}function Nt(t){const n=String(t);let e=n.length;for(;e>0;){const t=n.codePointAt(e-1);if(void 0===t||10!==t&&13!==t)break;e--}return n.slice(0,e)}function qt(t,n){const e=n.children;let r,o,i=-1;if("pre"===n.tagName)for(;++i<e.length;){const t=e[i];if("element"===t.type&&"code"===t.tagName&&t.properties&&t.properties.className&&Array.isArray(t.properties.className)){r=t.properties.className;break}}if(r)for(i=-1;++i<r.length;)if("language-"===String(r[i]).slice(0,9)){o=String(r[i]).slice(9);break}const c={type:"code",lang:o||null,meta:null,value:Nt(Et(n))};return t.patch(n,c),c}function Rt(t,n){const e={type:"delete",children:t.all(n)};return t.patch(n,e),e}function Gt(t){let n=-1;if(t.length>1)for(;++n<t.length;)if(t[n].spread)return!0;return!1}function $t(t,n){const e=t.all({type:"root",children:n}),r=t.toSpecificContent(e,_t);return 0===r.length?[]:1===r.length?r[0].children:[{type:"list",ordered:!1,start:null,spread:Gt(r),children:r}]}function _t(){return{type:"listItem",spread:!1,checked:null,children:[]}}function zt(t,n){const e={type:"emphasis",children:t.all(n)};return t.patch(n,e),e}function Pt(t){let n=0,e=t.length;for(;n<e&&"break"===t[n].type;)n++;for(;e>n&&"break"===t[e-1].type;)e--;return 0===n&&e===t.length?t:t.slice(n,e)}function Ut(t,n){const e={type:"heading",depth:Number(n.tagName.charAt(1))||1,children:Pt(t.all(n))};return t.patch(n,e),e}function Qt(t,n){const e=n.properties||{},r={type:"image",url:t.resolve(String(e.src||"")||null),title:e.title?String(e.title):null,alt:e.alt?String(e.alt):""};return t.patch(n,r),r}function Zt(t,n){const e={type:"inlineCode",value:Et(n)};return t.patch(n,e),e}function Ot(t,n){const e=[],r=[],o=n||t.properties||{},i=Dt(t),c=Math.min(Number.parseInt(String(o.size),10),0)||(o.multiple?4:1);let a=-1;for(;++a<i.length;){const t=i[a];t&&t.properties&&t.properties.selected&&e.push(t)}const u=e.length>0?e:i,s=Math.min(u.length,c);for(a=-1;++a<s;){const t=u[a],n=t.properties||{},e=Et(t),o=e||String(n.label||""),i=String(n.value||"")||e;r.push([i,o===i?void 0:o])}return r}function Dt(t){const n=[];let e=-1;for(;++e<t.children.length;){const r=t.children[e];"children"in r&&Array.isArray(r.children)&&n.push(...Dt(r)),"element"!==r.type||"option"!==r.tagName||r.properties&&r.properties.disabled||n.push(r)}return n}const Ht={}.hasOwnProperty,Jt=new Set(["pingback","prefetch","stylesheet"]),Yt=tt(["a","abbr","area","b","bdi","bdo","br","button","cite","code","data","datalist","del","dfn","em","i","input","ins","kbd","keygen","label","map","mark","meter","noscript","output","progress","q","ruby","s","samp","script","select","small","span","strong","sub","sup","template","textarea","time","u","var","wbr"]),Kt=tt("meta");function Vt(t){return Boolean("text"===t.type||Yt(t)||ot(t)||function(t){if("element"!==t.type||"link"!==t.tagName)return!1;if(t.properties.itemProp)return!0;const n=t.properties.rel;let e=-1;if(!Array.isArray(n)||0===n.length)return!1;for(;++e<n.length;)if(!Jt.has(String(n[e])))return!1;return!0}(t)||Kt(t)&&function(t,n){const e="element"===t.type&&Ht.call(t.properties,n)&&t.properties[n];return null!=e&&!1!==e}(t,"itemProp"))}function Wt(t,n){const{rest:e,checkbox:r}=tn(n),o=r?Boolean(r.properties.checked):null,i={type:"listItem",spread:Xt(e),checked:o,children:t.toFlow(t.all(e))};return t.patch(n,i),i}function Xt(t){let n=-1,e=!1;for(;++n<t.children.length;){const r=t.children[n];if("element"===r.type){if(Vt(r))continue;if("p"===r.tagName||e||Xt(r))return!0;e=!0}}return!1}function tn(t){const n=t.children[0];if(n&&"element"===n.type&&"input"===n.tagName&&n.properties&&("checkbox"===n.properties.type||"radio"===n.properties.type))return{checkbox:n,rest:{...t,children:t.children.slice(1)}};if(n&&"element"===n.type&&"p"===n.tagName){const{checkbox:e,rest:r}=tn(n);if(e)return{checkbox:e,rest:{...t,children:[r,...t.children.slice(1)]}}}return{checkbox:void 0,rest:t}}function nn(t,n){const e="ol"===n.tagName,r=t.toSpecificContent(t.all(n),en);let o=null;e&&(o=n.properties&&n.properties.start?Number.parseInt(String(n.properties.start),10):1);const i={type:"list",ordered:e,start:o,spread:Gt(r),children:r};return t.patch(n,i),i}function en(){return{type:"listItem",spread:!1,checked:null,children:[]}}function rn(t){let n=-1;for(;++n<t.length;){const e=t[n];if(!un(e)||"children"in e&&rn(e.children))return!0}return!1}function on(t){return an(t,(function(t){return t.every((function(t){return"text"===t.type&&i(t.value)}))?[]:[{type:"paragraph",children:Pt(t)}]}),(function(t){return t}))}function cn(t){return an(t.children,(function(n){const e=sn(t);return e.children=n,[e]}),(function(n){if("children"in n&&"children"in t){const e=sn(t),r=sn(n);return e.children=n.children,r.children.push(e),r}return{...n}}))}function an(t,n,e){const r=function(t){const n=[];let e=-1;for(;++e<t.length;){const r=t[e];"delete"!==r.type&&"link"!==r.type||!rn(r.children)?n.push(r):n.push(...cn(r))}return n}(t),o=[];let i=[],c=-1;for(;++c<r.length;){const t=r[c];un(t)?i.push(t):(i.length>0&&(o.push(...n(i)),i=[]),o.push(e(t)))}return i.length>0&&(o.push(...n(i)),i=[]),o}function un(t){const n=t.data&&t.data.hName;return n?Vt({type:"element",tagName:n,properties:{},children:[]}):x(t)}function sn(t){return c({...t,children:[]})}function ln(t,n){const e=n.properties||{},r="video"===n.tagName?String(e.poster||""):"";let o=String(e.src||""),i=-1,c=!1,s=t.all(n);if(a({type:"root",children:s},(function(t){if("link"===t.type)return c=!0,u})),c||rn(s))return s;for(;!o&&++i<n.children.length;){const t=n.children[i];"element"===t.type&&"source"===t.tagName&&t.properties&&(o=String(t.properties.src||""))}if(r){const e={type:"image",title:null,url:t.resolve(r),alt:C(s)};t.patch(n,e),s=[e]}const l=s,f={type:"link",title:e.title?String(e.title):null,url:t.resolve(o),children:l};return t.patch(n,f),f}function fn(t,n){const e=Pt(t.all(n));if(e.length>0){const r={type:"paragraph",children:e};return t.patch(n,r),r}}const dn=['"'];function pn(t,n){const e={type:"strong",children:t.all(n)};return t.patch(n,e),e}function hn(t,n){const e={type:"tableCell",children:t.all(n)};if(t.patch(n,e),n.properties){const t=n.properties.rowSpan,r=n.properties.colSpan;if(t||r){const n=e.data||(e.data={});t&&(n.hastUtilToMdastTemporaryRowSpan=t),r&&(n.hastUtilToMdastTemporaryColSpan=r)}}return e}function mn(){return{type:"tableCell",children:[]}}function gn(){return{type:"tableCell",children:[]}}function bn(){return{type:"tableRow",children:[]}}const yn={comment:function(t,n){const e={type:"html",value:"\x3c!--"+n.value+"--\x3e"};return t.patch(n,e),e},doctype:wn,root:function(t,n){let e=t.all(n);(t.options.document||rn(e))&&(e=on(e));const r={type:"root",children:e};return t.patch(n,r),r},text:function(t,n){const e={type:"text",value:n.value};return t.patch(n,e),e}},vn={applet:wn,area:wn,basefont:wn,bgsound:wn,caption:wn,col:wn,colgroup:wn,command:wn,content:wn,datalist:wn,dialog:wn,element:wn,embed:wn,frame:wn,frameset:wn,isindex:wn,keygen:wn,link:wn,math:wn,menu:wn,menuitem:wn,meta:wn,nextid:wn,noembed:wn,noframes:wn,optgroup:wn,option:wn,param:wn,script:wn,shadow:wn,source:wn,spacer:wn,style:wn,svg:wn,template:wn,title:wn,track:wn,abbr:kn,acronym:kn,bdi:kn,bdo:kn,big:kn,blink:kn,button:kn,canvas:kn,cite:kn,data:kn,details:kn,dfn:kn,font:kn,ins:kn,label:kn,map:kn,marquee:kn,meter:kn,nobr:kn,noscript:kn,object:kn,output:kn,progress:kn,rb:kn,rbc:kn,rp:kn,rt:kn,rtc:kn,ruby:kn,slot:kn,small:kn,span:kn,sup:kn,sub:kn,tbody:kn,tfoot:kn,thead:kn,time:kn,address:xn,article:xn,aside:xn,body:xn,center:xn,div:xn,fieldset:xn,figcaption:xn,figure:xn,form:xn,footer:xn,header:xn,hgroup:xn,html:xn,legend:xn,main:xn,multicol:xn,nav:xn,picture:xn,section:xn,a:function(t,n){const e=n.properties||{},r=t.all(n),o={type:"link",url:t.resolve(String(e.href||"")||null),title:e.title?String(e.title):null,children:r};return t.patch(n,o),o},audio:ln,b:pn,base:function(t,n){t.baseFound||(t.frozenBaseUrl=String(n.properties&&n.properties.href||"")||void 0,t.baseFound=!0)},blockquote:function(t,n){const e={type:"blockquote",children:t.toFlow(t.all(n))};return t.patch(n,e),e},br:function(t,n){const e={type:"break"};return t.patch(n,e),e},code:Zt,dir:nn,dl:function(t,n){const e=[],r=[];let o=-1;for(;++o<n.children.length;){const t=n.children[o];"element"===t.type&&"div"===t.tagName?e.push(...t.children):e.push(t)}let i={definitions:[],titles:[]};for(o=-1;++o<e.length;){const t=e[o];if("element"===t.type&&"dt"===t.tagName){const n=e[o-1];n&&"element"===n.type&&"dd"===n.tagName&&(r.push(i),i={definitions:[],titles:[]}),i.titles.push(t)}else i.definitions.push(t)}r.push(i),o=-1;const c=[];for(;++o<r.length;){const n=[...$t(t,r[o].titles),...$t(t,r[o].definitions)];n.length>0&&c.push({type:"listItem",spread:n.length>1,checked:null,children:n})}if(c.length>0){const e={type:"list",ordered:!1,start:null,spread:Gt(c),children:c};return t.patch(n,e),e}},dt:Wt,dd:Wt,del:Rt,em:zt,h1:Ut,h2:Ut,h3:Ut,h4:Ut,h5:Ut,h6:Ut,hr:function(t,n){const e={type:"thematicBreak"};return t.patch(n,e),e},i:zt,iframe:function(t,n){const e=n.properties||{},r=String(e.src||""),o=String(e.title||"");if(r&&o){const e={type:"link",title:null,url:t.resolve(r),children:[{type:"text",value:o}]};return t.patch(n,e),e}},img:Qt,image:Qt,input:function(t,n){const e=n.properties||{},r=String(e.value||e.placeholder||"");if(e.disabled||"hidden"===e.type||"file"===e.type)return;if("checkbox"===e.type||"radio"===e.type){const r={type:"text",value:e.checked?t.options.checked||"[x]":t.options.unchecked||"[ ]"};return t.patch(n,r),r}if("image"===e.type){const o=e.alt||r;if(o){const r={type:"image",url:t.resolve(String(e.src||"")||null),title:String(e.title||"")||null,alt:String(o)};return t.patch(n,r),r}return}let o=[];if(r)o=[[r,void 0]];else if("button"!==e.type&&"file"!==e.type&&"password"!==e.type&&"reset"!==e.type&&"submit"!==e.type&&e.list){const n=String(e.list),r=t.elementById.get(n);r&&"datalist"===r.tagName&&(o=Ot(r,e))}if(0===o.length)return;if("password"===e.type&&(o[0]=["•".repeat(o[0][0].length),void 0]),"email"===e.type||"url"===e.type){const n=[];let r=-1;for(;++r<o.length;){const i=t.resolve(o[r][0]);n.push({type:"link",title:null,url:"email"===e.type?"mailto:"+i:i,children:[{type:"text",value:o[r][1]||i}]}),r!==o.length-1&&n.push({type:"text",value:", "})}return n}const i=[];let c=-1;for(;++c<o.length;)i.push(o[c][1]?o[c][1]+" ("+o[c][0]+")":o[c][0]);const a={type:"text",value:i.join(", ")};return t.patch(n,a),a},kbd:Zt,li:Wt,listing:qt,mark:zt,ol:nn,p:fn,plaintext:qt,pre:qt,q:function(t,n){const e=t.options.quotes||dn;t.qNesting++;const r=t.all(n);t.qNesting--;const o=e[t.qNesting%e.length],i=r[0],c=r[r.length-1],a=o.charAt(0),u=o.length>1?o.charAt(1):o;return i&&"text"===i.type?i.value=a+i.value:r.unshift({type:"text",value:a}),c&&"text"===c.type?c.value+=u:r.push({type:"text",value:u}),r},s:Rt,samp:Zt,select:function(t,n){const e=Ot(n);let r=-1;const o=[];for(;++r<e.length;){const t=e[r];o.push(t[1]?t[1]+" ("+t[0]+")":t[0])}if(o.length>0){const e={type:"text",value:o.join(", ")};return t.patch(n,e),e}},strike:Rt,strong:pn,summary:fn,table:function(t,n){if(t.inTable){const e={type:"text",value:Et(n)};return t.patch(n,e),e}t.inTable=!0;const{align:e,headless:r}=function(t){const n={align:[null],headless:!0};let e=0,r=0;return a(t,(function(o){if("element"===o.type){if("table"===o.tagName&&t!==o)return s;if("th"!==o.tagName&&"td"!==o.tagName||!o.properties)"thead"===o.tagName?n.headless=!1:"tr"===o.tagName&&(e++,r=0);else{if(!n.align[r]){const t=String(o.properties.align||"")||null;"center"!==t&&"left"!==t&&"right"!==t&&null!==t||(n.align[r]=t)}n.headless&&e<2&&"th"===o.tagName&&(n.headless=!1),r++}}})),n}(n),o=t.toSpecificContent(t.all(n),bn);r&&o.unshift({type:"tableRow",children:[]});let i=-1;for(;++i<o.length;){const n=o[i],e=t.toSpecificContent(n.children,gn);n.children=e}let c=1;for(i=-1;++i<o.length;){const t=o[i].children;let n=-1;for(;++n<t.length;){const e=t[n];if(e.data){const t=e.data,r=Number.parseInt(String(t.hastUtilToMdastTemporaryColSpan),10)||1,c=Number.parseInt(String(t.hastUtilToMdastTemporaryRowSpan),10)||1;if(r>1||c>1){let t=i-1;for(;++t<i+c;){let e=n-1;for(;++e<n+r&&o[t];){const r=[];t===i&&e===n||r.push({type:"tableCell",children:[]}),o[t].children.splice(e,0,...r)}}}"hastUtilToMdastTemporaryColSpan"in e.data&&delete e.data.hastUtilToMdastTemporaryColSpan,"hastUtilToMdastTemporaryRowSpan"in e.data&&delete e.data.hastUtilToMdastTemporaryRowSpan,0===Object.keys(e.data).length&&delete e.data}}t.length>c&&(c=t.length)}for(i=-1;++i<o.length;){const t=o[i].children;let n=t.length-1;for(;++n<c;)t.push({type:"tableCell",children:[]})}let u=e.length-1;for(;++u<c;)e.push(null);t.inTable=!1;const l={type:"table",align:e,children:o};return t.patch(n,l),l},td:hn,textarea:function(t,n){const e={type:"text",value:Et(n)};return t.patch(n,e),e},th:hn,tr:function(t,n){const e={type:"tableRow",children:t.toSpecificContent(t.all(n),mn)};return t.patch(n,e),e},tt:Zt,u:zt,ul:nn,var:Zt,video:ln,wbr:function(t,n){const e={type:"text",value:""};return t.patch(n,e),e},xmp:qt};function kn(t,n){return t.all(n)}function xn(t,n){return t.toFlow(t.all(n))}function wn(){}const Cn={}.hasOwnProperty;function Sn(t){const n=t.children||[],e=[];let r=-1;for(;++r<n.length;){const o=this.one(n[r],t);Array.isArray(o)?e.push(...o):o&&e.push(o)}return e}function An(t,n){if("element"===t.type){if(t.properties&&"ignore"===t.properties.dataMdast)return;if(Cn.call(this.handlers,t.tagName))return this.handlers[t.tagName](this,t,n)||void 0}else if(Cn.call(this.nodeHandlers,t.type))return this.nodeHandlers[t.type](this,t,n)||void 0;if("value"in t&&"string"==typeof t.value){const n={type:"text",value:t.value};return this.patch(t,n),n}if("children"in t)return this.all(t)}function Bn(t,n){t.position&&(n.position=l(t))}function Fn(t){const n=this.frozenBaseUrl;return null==t?"":n?String(new URL(t,n)):t}function Ln(t){return on(t)}function En(t,n){const e=n(),r=[];let o=[],i=-1;for(;++i<t.length;){const n=t[i];c(n)?(o.length>0&&(n.children.unshift(...o),o=[]),r.push(n)):o.push(n)}if(o.length>0){let t=r[r.length-1];t||(t=n(),r.push(t)),t.children.push(...o),o=[]}return r;function c(t){return t.type===e.type}}const Tn={};function Mn(t,n){const e=c(t),r=n||Tn,o=vt({newlines:!0===r.newlines}),i=function(t){return{all:Sn,baseFound:!1,elementById:new Map,frozenBaseUrl:void 0,handlers:{...vn,...t.handlers},inTable:!1,nodeHandlers:{...yn,...t.nodeHandlers},one:An,options:t,patch:Bn,qNesting:0,resolve:Fn,toFlow:Ln,toSpecificContent:En}}(r);let u;o(e),a(e,(function(t){if(t&&"element"===t.type&&t.properties){const n=String(t.properties.id||"")||void 0;n&&!i.elementById.has(n)&&i.elementById.set(n,t)}}));const s=i.one(e,void 0);return u=s?Array.isArray(s)?{type:"root",children:s}:s:{type:"root",children:[]},a(u,(function(t,n,e){if("text"===t.type&&void 0!==n&&e){const r=e.children[n-1];if(r&&r.type===t.type)return r.value+=t.value,e.children.splice(n,1),r.position&&t.position&&(r.position.end=t.position.end),n-1;if(t.value=t.value.replace(/[\t ]*(\r?\n|\r)[\t ]*/,"$1"),!e||"heading"!==e.type&&"paragraph"!==e.type&&"root"!==e.type||(n||(t.value=t.value.replace(/^[\t ]+/,"")),n===e.children.length-1&&(t.value=t.value.replace(/[\t ]+$/,""))),!t.value)return e.children.splice(n,1),n}})),u}const In={document:!0};function jn(t,n){return t&&"run"in t?async function(e,r){const o=Mn(e,{...In,...n});await t.run(o,r)}:function(n){return Mn(n,{...In,...t})}}function Nn(t){const n=this;n.compiler=function(e){return Q(e,{...n.data("settings"),...t,extensions:n.data("toMarkdownExtensions")||[]})}}async function qn(t,n){const e=new Set(n.map((t=>t.tagName)).filter(Pn)),r=new Map,o=function(t,n){return K(t,n||{})||{type:"root",children:[]}}(t,{afterTransform:(t,n)=>{var o;"element"===n.type&&(function(t){const n=t.properties.dataSrc;"img"===t.tagName&&!t.properties.src&&n&&(t.properties.src=n)}(n),"a"===(o=n).tagName&&void 0!==o.properties.dataFootnoteBackref&&(o.properties.dataMdast="ignore"),t instanceof Element&&e.has(t.localName)&&r.set(n,t))}});await async function(t){await Promise.all([...t].map((async([t,n])=>{try{const e=await n.toMarkdown();t.properties.dataMarkdownDescription=e,t.children=[{type:"text",value:e}]}catch(t){console.error("Failed to describe element as markdown",t)}})))}(r);const i={sup:$n,section:_n};for(const t of e)i[t]=Rn;const c=f().use(jn,{handlers:i}).use(S).use(Nn,{bullet:"-",handlers:{break:Gn}}),a=await c.run({type:"root",children:o.children});return c.stringify(a).trimEnd()}const Rn=(t,n)=>{const e=n.properties.dataMarkdownDescription;return"string"==typeof e?function(t){const{children:n}=f().use(A).use(S).parse(t);return 1===n.length&&"paragraph"===n[0].type?n[0].children:n}(e):t.all(n)},Gn=(...t)=>{const n=k.break(...t);return"\\\n"===n?" \n":n},$n=(t,n)=>{const e=n.children.find((t=>zn(t,"a")&&void 0!==t.properties.dataFootnoteRef));if(!e)return vn.sup(t,n);const r=e.children.map((t=>"text"===t.type?t.value:"")).join("");return{type:"footnoteReference",identifier:r,label:r}},_n=(t,n)=>{if(void 0===n.properties.dataFootnotes)return vn.section(t,n);const e=n.children.find((t=>zn(t,"ol"))),r=null==e?void 0:e.children.filter((t=>zn(t,"li")));return(null!=r?r:[]).map(((n,e)=>{const r=String(e+1);return{type:"footnoteDefinition",identifier:r,label:r,children:t.toFlow(t.all(n))}}))};function zn(t,n){return"element"===t.type&&t.tagName===n}function Pn(t){var n;const e=null===(n=customElements.get(t))||void 0===n?void 0:n.prototype;return"function"==typeof(null==e?void 0:e.toMarkdown)}export{qn as exportMarkdown}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,h as t,H as r}from"./p-BU9IJqli.js";import{m as o}from"./p-Bd37Vplf.js";import{g as a}from"./p-Dnt5w_Bp.js";import{d as n}from"./p-CbPYnlF-.js";import{a as l}from"./p-BQoih_t0.js";import"./p-B85MJLTf.js";class i{constructor(e){this.handleIntersection=e=>{for(const t of e){if(!t.isIntersecting)continue;const e=t.target,r=e.dataset.src;r&&(e.setAttribute("src",r),delete e.dataset.src),this.observer.unobserve(e)}},this.observer=new IntersectionObserver(this.handleIntersection);const t=e.querySelectorAll("img");for(const e of t)this.observer.observe(e)}disconnect(){this.observer.disconnect()}}var s;const d=new Map(Object.entries(null!==(s=n.protocols)&&void 0!==s?s:{}).map((([e,t])=>[e,new Set(t)])));function m(e,t){for(const r of t){const t=e.getAttribute(r);if(!t)continue;const o=c(t);if(void 0===o)continue;const a=f(o);e[b(r)]=a}}function c(e){const t=e.trim();if(t.startsWith("{")&&t.endsWith("}")||t.startsWith("[")&&t.endsWith("]"))try{return JSON.parse(t)}catch(e){try{const e=t.replaceAll(""",'"').replaceAll(""",'"').replaceAll(""",'"').replaceAll("'","'").replaceAll("'","'").replaceAll("'","'").replaceAll("&","&");return JSON.parse(e)}catch(e){return}}}function h(e,t){const r=e.trim(),o=r.indexOf(":");if(-1===o||/[?#/]/.test(r.slice(0,o)))return!0;const a=r.slice(0,o).toLowerCase();return t.has(a)}function f(e){if(null===e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map(f);const t=Object.assign({},e);for(const e of Object.keys(t)){const r=d.get(e);r&&"string"==typeof t[e]&&!h(t[e],r)?(console.warn(`limel-markdown: Removed unsafe URL from "${e}" during sanitization.`),delete t[e]):"object"==typeof t[e]&&null!==t[e]&&(t[e]=f(t[e]))}return t}function b(e){return e.replaceAll(/-([a-z])/g,((e,t)=>t.toUpperCase()))}var u,g="undefined"==typeof document?void 0:document,p=!!g&&"content"in g.createElement("template"),v=!!g&&g.createRange&&"createContextualFragment"in g.createRange();function w(e,t){var r,o,a=e.nodeName,n=t.nodeName;return a===n||(r=a.charCodeAt(0),o=n.charCodeAt(0),r<=90&&o>=97?a===n.toUpperCase():o<=90&&r>=97&&n===a.toUpperCase())}function k(e,t,r){e[r]!==t[r]&&(e[r]=t[r],e[r]?e.setAttribute(r,""):e.removeAttribute(r))}var y={OPTION:function(e,t){var r=e.parentNode;if(r){var o=r.nodeName.toUpperCase();"OPTGROUP"===o&&(o=(r=r.parentNode)&&r.nodeName.toUpperCase()),"SELECT"!==o||r.hasAttribute("multiple")||(e.hasAttribute("selected")&&!t.selected&&(e.setAttribute("selected","selected"),e.removeAttribute("selected")),r.selectedIndex=-1)}k(e,t,"selected")},INPUT:function(e,t){k(e,t,"checked"),k(e,t,"disabled"),e.value!==t.value&&(e.value=t.value),t.hasAttribute("value")||e.removeAttribute("value")},TEXTAREA:function(e,t){var r=t.value;e.value!==r&&(e.value=r);var o=e.firstChild;if(o){var a=o.nodeValue;if(a==r||!r&&a==e.placeholder)return;o.nodeValue=r}},SELECT:function(e,t){if(!t.hasAttribute("multiple")){for(var r,o,a=-1,n=0,l=e.firstChild;l;)if("OPTGROUP"===(o=l.nodeName&&l.nodeName.toUpperCase()))(l=(r=l).firstChild)||(l=r.nextSibling,r=null);else{if("OPTION"===o){if(l.hasAttribute("selected")){a=n;break}n++}!(l=l.nextSibling)&&r&&(l=r.nextSibling,r=null)}e.selectedIndex=a}}};function j(){}function x(e){if(e)return e.getAttribute&&e.getAttribute("id")||e.id}var z=function(e,t,r){if(r||(r={}),"string"==typeof t)if("#document"===e.nodeName||"HTML"===e.nodeName){var o=t;(t=g.createElement("html")).innerHTML=o}else if("BODY"===e.nodeName){var a=t;(t=g.createElement("html")).innerHTML=a;var n=t.querySelector("body");n&&(t=n)}else l=(l=t).trim(),t=p?function(e){var t=g.createElement("template");return t.innerHTML=e,t.content.childNodes[0]}(l):v?function(e){return u||(u=g.createRange()).selectNode(g.body),u.createContextualFragment(e).childNodes[0]}(l):function(e){var t=g.createElement("body");return t.innerHTML=e,t.childNodes[0]}(l);else 11===t.nodeType&&(t=t.firstElementChild);var l,i=r.getNodeKey||x,s=r.onBeforeNodeAdded||j,d=r.onNodeAdded||j,m=r.onBeforeElUpdated||j,c=r.onElUpdated||j,h=r.onBeforeNodeDiscarded||j,f=r.onNodeDiscarded||j,b=r.onBeforeElChildrenUpdated||j,k=r.skipFromChildren||j,z=r.addChild||function(e,t){return e.appendChild(t)},C=!0===r.childrenOnly,O=Object.create(null),T=[];function q(e){T.push(e)}function N(e,t){if(1===e.nodeType)for(var r=e.firstChild;r;){var o=void 0;t&&(o=i(r))?q(o):(f(r),r.firstChild&&N(r,t)),r=r.nextSibling}}function M(e,t,r){!1!==h(e)&&(t&&t.removeChild(e),f(e),N(e,r))}function P(e){if(1===e.nodeType||11===e.nodeType)for(var t=e.firstChild;t;){var r=i(t);r&&(O[r]=t),P(t),t=t.nextSibling}}function E(e){d(e);for(var t=e.firstChild;t;){var r=t.nextSibling,o=i(t);if(o){var a=O[o];a&&w(t,a)?(t.parentNode.replaceChild(a,t),H(a,t)):E(t)}else E(t);t=r}}function H(e,t,r){var o=i(t);if(o&&delete O[o],!r){var a=m(e,t);if(!1===a)return;if(a instanceof HTMLElement&&P(e=a),function(e,t){var r,o,a,n,l=t.attributes;if(11!==t.nodeType&&11!==e.nodeType){for(var i=l.length-1;i>=0;i--)o=(r=l[i]).name,n=r.value,(a=r.namespaceURI)?e.getAttributeNS(a,o=r.localName||o)!==n&&("xmlns"===r.prefix&&(o=r.name),e.setAttributeNS(a,o,n)):e.getAttribute(o)!==n&&e.setAttribute(o,n);for(var s=e.attributes,d=s.length-1;d>=0;d--)o=(r=s[d]).name,(a=r.namespaceURI)?t.hasAttributeNS(a,o=r.localName||o)||e.removeAttributeNS(a,o):t.hasAttribute(o)||e.removeAttribute(o)}}(e,t),c(e),!1===b(e,t))return}"TEXTAREA"!==e.nodeName?function(e,t){var r,o,a,n,l,d=k(e,t),m=t.firstChild,c=e.firstChild;e:for(;m;){for(n=m.nextSibling,r=i(m);!d&&c;){if(a=c.nextSibling,m.isSameNode&&m.isSameNode(c)){m=n,c=a;continue e}o=i(c);var h=c.nodeType,f=void 0;if(h===m.nodeType&&(1===h?(r?r!==o&&((l=O[r])?a===l?f=!1:(e.insertBefore(l,c),o?q(o):M(c,e,!0),o=i(c=l)):f=!1):o&&(f=!1),(f=!1!==f&&w(c,m))&&H(c,m)):3!==h&&8!=h||(f=!0,c.nodeValue!==m.nodeValue&&(c.nodeValue=m.nodeValue))),f){m=n,c=a;continue e}o?q(o):M(c,e,!0),c=a}if(r&&(l=O[r])&&w(l,m))d||z(e,l),H(l,m);else{var b=s(m);!1!==b&&(b&&(m=b),m.actualize&&(m=m.actualize(e.ownerDocument||g)),z(e,m),E(m))}m=n,c=a}!function(e,t,r){for(;t;){var o=t.nextSibling;(r=i(t))?q(r):M(t,e,!0),t=o}}(e,c,o);var u=y[e.nodeName];u&&u(e,t)}(e,t):y.TEXTAREA(e,t)}P(e);var I,L,S=e,R=S.nodeType,A=t.nodeType;if(!C)if(1===R)1===A?w(e,t)||(f(e),S=function(e,t){for(var r=e.firstChild;r;){var o=r.nextSibling;t.appendChild(r),r=o}return t}(e,(I=t.nodeName,(L=t.namespaceURI)&&"http://www.w3.org/1999/xhtml"!==L?g.createElementNS(L,I):g.createElement(I)))):S=t;else if(3===R||8===R){if(A===R)return S.nodeValue!==t.nodeValue&&(S.nodeValue=t.nodeValue),S;S=t}if(S===t)f(e);else{if(t.isSameNode&&t.isSameNode(S))return;if(H(S,t,C),T)for(var B=0,U=T.length;B<U;B++){var D=O[T[B]];D&&M(D,D.parentNode,!1)}}return!C&&S!==e&&e.parentNode&&(S.actualize&&(S=S.actualize(e.ownerDocument||g)),e.parentNode.replaceChild(S,e)),S};const C=[{tagName:"limel-chip",attributes:["text","icon","link","badge","disabled","readonly","selected","type","size"]},{tagName:"limel-icon",attributes:["name","size","badge"]},{tagName:"limel-badge",attributes:["label"]},{tagName:"limel-callout",attributes:["heading","icon","type"]},{tagName:"limel-linear-progress",attributes:["value","indeterminate"]},{tagName:"limel-circular-progress",attributes:["value","max-value","prefix","suffix","size","display-percentage-colors"]},{tagName:"limel-spinner",attributes:["size"]},{tagName:"limel-info-tile",attributes:["value","icon","label","prefix","suffix","badge"]}],O=class{constructor(t){e(this,t),this.value="",this.whitelist=a.markdownWhitelist,this.lazyLoadImages=!1,this.removeEmptyParagraphs=!0,this.adaptColorContrast=!1,this.imageIntersectionObserver=null}async toMarkdown(){await this.rendering;const{exportMarkdown:e}=await import("./p-CvHpvp0f.js");return e(this.rootElement,this.cachedCombinedWhitelist)}textChanged(){return this.rendering=this.renderMarkdown(),this.rendering}async renderMarkdown(){try{this.cleanupImageIntersectionObserver(),this.cachedCombinedWhitelist&&this.whitelist===this.cachedConsumerWhitelist||(this.cachedConsumerWhitelist=this.whitelist,this.cachedCombinedWhitelist=function(e,t){if(!(null==t?void 0:t.length))return e.map((e=>Object.assign(Object.assign({},e),{attributes:[...e.attributes]})));const r=new Map;for(const o of[...e,...t]){const e=r.get(o.tagName);if(e)for(const t of o.attributes)e.add(t);else r.set(o.tagName,new Set(o.attributes))}return[...r].map((([e,t])=>({tagName:e,attributes:[...t]})))}(C,this.whitelist));const e=this.cachedCombinedWhitelist,t=await o(this.value,{forceHardLineBreaks:!0,whitelist:e,lazyLoadImages:this.lazyLoadImages,removeEmptyParagraphs:this.removeEmptyParagraphs});!function(e,t=""){try{z(e,`<div>${t}</div>`,{childrenOnly:!0})}catch(r){console.warn("morphdom failed, falling back to innerHTML:",r),e.innerHTML=t}}(this.rootElement,t),function(e,t){if(e&&(null==t?void 0:t.length))for(const r of t){const t=e.querySelectorAll(r.tagName);for(const e of t)m(e,r.attributes)}}(this.rootElement,e),this.adaptColorContrast&&l(this.rootElement),this.setupImageIntersectionObserver()}catch(e){console.error(e)}}handleWhitelistChange(){return this.textChanged()}handleRemoveEmptyParagraphsChange(){return this.textChanged()}handleAdaptColorContrastChange(){return this.textChanged()}async componentDidLoad(){this.textChanged()}disconnectedCallback(){this.cleanupImageIntersectionObserver()}render(){return t(r,{key:"847bffc9b7fa4fbec42b705d3019c635d88fb6c6"},t("div",{key:"cd84ef0919fc4b2b80090de836366b317e60e51a",id:"markdown",ref:e=>this.rootElement=e}))}setupImageIntersectionObserver(){this.lazyLoadImages&&(this.imageIntersectionObserver=new i(this.rootElement))}cleanupImageIntersectionObserver(){this.imageIntersectionObserver&&(this.imageIntersectionObserver.disconnect(),this.imageIntersectionObserver=null)}static get watchers(){return{value:[{textChanged:0}],whitelist:[{handleWhitelistChange:0}],removeEmptyParagraphs:[{handleRemoveEmptyParagraphsChange:0}],adaptColorContrast:[{handleAdaptColorContrastChange:0}]}}};O.style='@charset "UTF-8";pre,pre p,code{font-family:ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;font-size:0.75rem}pre{max-width:100%;white-space:pre-wrap;word-wrap:break-word}code{letter-spacing:-0.0125rem;color:rgb(var(--contrast-1300));tab-size:4;hyphens:none;display:inline;border-radius:0.25rem;padding:0.03125rem 0.25rem;background-color:rgb(var(--contrast-600))}pre>code{display:block;margin:0.5rem 0;padding:0.5rem 0.75rem}h1{font-size:1.5rem}h2{font-size:1.25rem}h3{font-size:1.125rem}h4{font-size:1rem}h5{font-size:var(--limel-theme-default-font-size)}h6{font-size:0.75rem}h1,h2{margin-top:0.5rem;margin-bottom:0.5rem;letter-spacing:-0.03125rem;font-weight:500}h3,h4{margin-top:0.75rem;margin-bottom:0.25rem;font-weight:600}h5,h6{margin-top:0.5rem;margin-bottom:0.125rem;font-weight:600}h1,h2,h3,h4,h5,h6{word-break:break-word;hyphens:auto;-webkit-hyphens:auto}h1 code,h2 code,h3 code,h4 code,h5 code,h6 code{font-size:inherit}:not([contenteditable=true]) h1,:not([contenteditable=true]) h2,:not([contenteditable=true]) h3,:not([contenteditable=true]) h4,:not([contenteditable=true]) h5,:not([contenteditable=true]) h6{text-wrap:balance}[contenteditable=true] h1,[contenteditable=true] h2,[contenteditable=true] h3,[contenteditable=true] h4,[contenteditable=true] h5,[contenteditable=true] h6{text-wrap:initial}:host(limel-markdown.truncate-paragraphs) p{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}p,li{font-size:var(--limel-theme-default-font-size);word-break:break-word}a{word-break:break-all}p{margin-top:0;margin-bottom:0.5rem}p:last-child{margin-bottom:0}a{transition:color 0.2s ease;color:var(--markdown-hyperlink-color, rgb(var(--color-blue-dark)));text-decoration:none}a:hover{color:var(--markdown-hyperlink-color--hovered, rgb(var(--color-blue-default)))}hr{margin:1.75rem 0 2rem 0;border-width:0;border-top:1px solid rgb(var(--contrast-500))}ul{list-style:none}ul>li{margin-left:0.75rem}ul>li:before{content:"";position:absolute;left:-0.5rem;top:0.5rem;width:0.25rem;height:0.25rem;border-radius:50%;background-color:rgb(var(--contrast-700));display:block}ol{margin-top:0.25rem;padding-left:1rem}ul{margin-top:0.25rem;padding-left:0}ul ul,ul ol,ol ol,ol ul{margin-left:0}li{position:relative;margin-bottom:0.25rem}:host(limel-markdown:not(.no-table-styles)) table{table-layout:auto;min-width:100%;border-collapse:collapse;border-spacing:0;background:transparent;margin:0.75rem 0}:host(limel-markdown:not(.no-table-styles)) tbody{border:1px solid rgb(var(--contrast-400));border-radius:0.25rem}:host(limel-markdown:not(.no-table-styles)) th,:host(limel-markdown:not(.no-table-styles)) td{text-align:left;vertical-align:top;transition:background-color 0.2s ease;font-size:var(--limel-theme-default-font-size)}:host(limel-markdown:not(.no-table-styles)) th p,:host(limel-markdown:not(.no-table-styles)) th li,:host(limel-markdown:not(.no-table-styles)) th a,:host(limel-markdown:not(.no-table-styles)) td p,:host(limel-markdown:not(.no-table-styles)) td li,:host(limel-markdown:not(.no-table-styles)) td a{word-break:normal;overflow-wrap:normal}:host(limel-markdown:not(.no-table-styles)) td{padding:0.5rem 0.375rem 0.75rem 0.375rem}:host(limel-markdown:not(.no-table-styles)) tr th{background-color:rgb(var(--contrast-400));padding:0.25rem 0.375rem;font-weight:normal}:host(limel-markdown:not(.no-table-styles)) tr th:only-child{text-align:center}:host(limel-markdown:not(.no-table-styles)) tbody tr:nth-child(odd) td{background-color:rgb(var(--contrast-200))}:host(limel-markdown:not(.no-table-styles)) tbody tr:hover td{background-color:rgb(var(--contrast-300))}table{display:block;box-sizing:border-box;overflow-x:auto;-webkit-overflow-scrolling:touch;max-width:100%}blockquote{position:relative;max-width:100%;margin:0.75rem 0;padding:0.5rem;border-left:0.25rem solid rgb(var(--contrast-500));background-color:rgb(var(--contrast-200))}blockquote:before,blockquote:after{position:absolute;line-height:0;font-size:2rem;opacity:0.4}blockquote:before{content:"“";left:-0.5rem;top:0.5rem}blockquote:after{content:"”";right:-0.25rem;bottom:-0.25rem}blockquote blockquote{padding-top:0;padding-right:0;padding-bottom:0;padding-left:0.25rem;border-color:rgb(var(--contrast-700));border-left-width:1px}blockquote blockquote:before,blockquote blockquote:after{display:none}blockquote:has(>blockquote){padding-left:0.25rem;padding-bottom:0}dl{display:grid;grid-template-columns:1fr 2fr;grid-template-rows:1fr;margin-bottom:2rem;border:1px solid rgb(var(--contrast-400));border-radius:0.375rem;background-color:rgb(var(--contrast-200))}dl dt,dl dd{padding:0.375rem 0.5rem;font-size:var(--limel-theme-default-font-size);margin:0}dl dt:nth-of-type(even),dl dd:nth-of-type(even){background-color:rgb(var(--contrast-300))}dl dt:first-child{border-top-left-radius:0.375rem}dl dt:last-child{border-bottom-left-radius:0.375rem}dl dd:first-child{border-top-right-radius:0.375rem}dl dd:last-child{border-bottom-right-radius:0.375rem}img{max-width:100%;border-radius:0.25rem}kbd{display:inline-block;font-family:ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;font-weight:600;color:rgb(var(--contrast-1100));white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:normal;border-radius:0.125rem;border-style:solid;border-color:rgb(var(--contrast-500));border-width:0 1px 0.1875rem 1px;padding:0.0625rem 0.375rem;margin:0 0.25rem;background-color:rgb(var(--contrast-200));box-shadow:var(--button-shadow-normal), 0 0.625rem 0.375rem -0.5rem rgb(var(--color-black), 0.02), 0 0.025rem 0.5rem 0 rgb(var(--contrast-100)) inset}:host(limel-markdown.adjust-for-table-cell) img{max-height:1.25rem;vertical-align:middle}:host(limel-markdown.adjust-for-table-cell) p{display:inline}:host(limel-markdown.adjust-for-table-cell) h1,:host(limel-markdown.adjust-for-table-cell) h2,:host(limel-markdown.adjust-for-table-cell) h3,:host(limel-markdown.adjust-for-table-cell) h4,:host(limel-markdown.adjust-for-table-cell) h5,:host(limel-markdown.adjust-for-table-cell) h6{display:inline-block;vertical-align:bottom;font-size:var(--limel-theme-default-font-size);margin:0 0.25rem 0 0;letter-spacing:normal;font-weight:500}:host(limel-markdown.adjust-for-table-cell) h1:before,:host(limel-markdown.adjust-for-table-cell) h2:before,:host(limel-markdown.adjust-for-table-cell) h3:before,:host(limel-markdown.adjust-for-table-cell) h4:before,:host(limel-markdown.adjust-for-table-cell) h5:before,:host(limel-markdown.adjust-for-table-cell) h6:before{opacity:0.6;vertical-align:middle;font-size:0.5rem;border-radius:0.25rem 0 0 0.25rem;padding:0.25rem;padding-right:2rem;margin-right:-1.75rem;background:linear-gradient(to right, rgb(var(--contrast-800), 0.6), rgb(var(--contrast-800), 0))}:host(limel-markdown.adjust-for-table-cell) h1:before{content:"H1"}:host(limel-markdown.adjust-for-table-cell) h2:before{content:"H2"}:host(limel-markdown.adjust-for-table-cell) h3:before{content:"H3"}:host(limel-markdown.adjust-for-table-cell) h4:before{content:"H4"}:host(limel-markdown.adjust-for-table-cell) h5:before{content:"H5"}:host(limel-markdown.adjust-for-table-cell) h6:before{content:"H6"}:host(limel-markdown.adjust-for-table-cell) pre{margin:0}:host(limel-markdown.adjust-for-table-cell) pre>code{padding:0.125rem;margin:0}:host(limel-markdown.adjust-for-table-cell) dl{margin:0}:host(limel-markdown.adjust-for-table-cell) dl dt,:host(limel-markdown.adjust-for-table-cell) dl dd{padding:0.00625rem 0.125rem}*,*::before,*::after{box-sizing:border-box}* :where(:not(img,video,svg,canvas,iframe)),*::before :where(:not(img,video,svg,canvas,iframe)),*::after :where(:not(img,video,svg,canvas,iframe)){min-width:0;min-height:0}hr{border-top:1px solid rgb(var(--contrast-700))}.MsoNormal{margin:0}:host(limel-markdown.reset-img-height) #markdown img{height:auto !important}';export{O as limel_markdown}
|
|
1
|
+
import{r as e,h as t,H as r}from"./p-BU9IJqli.js";import{m as o}from"./p-kiQd8Ntf.js";import{g as a}from"./p-Dnt5w_Bp.js";import{d as n}from"./p-CbPYnlF-.js";import{a as l}from"./p-BQoih_t0.js";import"./p-B85MJLTf.js";class i{constructor(e){this.handleIntersection=e=>{for(const t of e){if(!t.isIntersecting)continue;const e=t.target,r=e.dataset.src;r&&(e.setAttribute("src",r),delete e.dataset.src),this.observer.unobserve(e)}},this.observer=new IntersectionObserver(this.handleIntersection);const t=e.querySelectorAll("img");for(const e of t)this.observer.observe(e)}disconnect(){this.observer.disconnect()}}var s;const d=new Map(Object.entries(null!==(s=n.protocols)&&void 0!==s?s:{}).map((([e,t])=>[e,new Set(t)])));function m(e,t){for(const r of t){const t=e.getAttribute(r);if(!t)continue;const o=c(t);if(void 0===o)continue;const a=f(o);e[b(r)]=a}}function c(e){const t=e.trim();if(t.startsWith("{")&&t.endsWith("}")||t.startsWith("[")&&t.endsWith("]"))try{return JSON.parse(t)}catch(e){try{const e=t.replaceAll(""",'"').replaceAll(""",'"').replaceAll(""",'"').replaceAll("'","'").replaceAll("'","'").replaceAll("'","'").replaceAll("&","&");return JSON.parse(e)}catch(e){return}}}function h(e,t){const r=e.trim(),o=r.indexOf(":");if(-1===o||/[?#/]/.test(r.slice(0,o)))return!0;const a=r.slice(0,o).toLowerCase();return t.has(a)}function f(e){if(null===e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map(f);const t=Object.assign({},e);for(const e of Object.keys(t)){const r=d.get(e);r&&"string"==typeof t[e]&&!h(t[e],r)?(console.warn(`limel-markdown: Removed unsafe URL from "${e}" during sanitization.`),delete t[e]):"object"==typeof t[e]&&null!==t[e]&&(t[e]=f(t[e]))}return t}function b(e){return e.replaceAll(/-([a-z])/g,((e,t)=>t.toUpperCase()))}var u,g="undefined"==typeof document?void 0:document,p=!!g&&"content"in g.createElement("template"),v=!!g&&g.createRange&&"createContextualFragment"in g.createRange();function w(e,t){var r,o,a=e.nodeName,n=t.nodeName;return a===n||(r=a.charCodeAt(0),o=n.charCodeAt(0),r<=90&&o>=97?a===n.toUpperCase():o<=90&&r>=97&&n===a.toUpperCase())}function k(e,t,r){e[r]!==t[r]&&(e[r]=t[r],e[r]?e.setAttribute(r,""):e.removeAttribute(r))}var y={OPTION:function(e,t){var r=e.parentNode;if(r){var o=r.nodeName.toUpperCase();"OPTGROUP"===o&&(o=(r=r.parentNode)&&r.nodeName.toUpperCase()),"SELECT"!==o||r.hasAttribute("multiple")||(e.hasAttribute("selected")&&!t.selected&&(e.setAttribute("selected","selected"),e.removeAttribute("selected")),r.selectedIndex=-1)}k(e,t,"selected")},INPUT:function(e,t){k(e,t,"checked"),k(e,t,"disabled"),e.value!==t.value&&(e.value=t.value),t.hasAttribute("value")||e.removeAttribute("value")},TEXTAREA:function(e,t){var r=t.value;e.value!==r&&(e.value=r);var o=e.firstChild;if(o){var a=o.nodeValue;if(a==r||!r&&a==e.placeholder)return;o.nodeValue=r}},SELECT:function(e,t){if(!t.hasAttribute("multiple")){for(var r,o,a=-1,n=0,l=e.firstChild;l;)if("OPTGROUP"===(o=l.nodeName&&l.nodeName.toUpperCase()))(l=(r=l).firstChild)||(l=r.nextSibling,r=null);else{if("OPTION"===o){if(l.hasAttribute("selected")){a=n;break}n++}!(l=l.nextSibling)&&r&&(l=r.nextSibling,r=null)}e.selectedIndex=a}}};function j(){}function x(e){if(e)return e.getAttribute&&e.getAttribute("id")||e.id}var z=function(e,t,r){if(r||(r={}),"string"==typeof t)if("#document"===e.nodeName||"HTML"===e.nodeName){var o=t;(t=g.createElement("html")).innerHTML=o}else if("BODY"===e.nodeName){var a=t;(t=g.createElement("html")).innerHTML=a;var n=t.querySelector("body");n&&(t=n)}else l=(l=t).trim(),t=p?function(e){var t=g.createElement("template");return t.innerHTML=e,t.content.childNodes[0]}(l):v?function(e){return u||(u=g.createRange()).selectNode(g.body),u.createContextualFragment(e).childNodes[0]}(l):function(e){var t=g.createElement("body");return t.innerHTML=e,t.childNodes[0]}(l);else 11===t.nodeType&&(t=t.firstElementChild);var l,i=r.getNodeKey||x,s=r.onBeforeNodeAdded||j,d=r.onNodeAdded||j,m=r.onBeforeElUpdated||j,c=r.onElUpdated||j,h=r.onBeforeNodeDiscarded||j,f=r.onNodeDiscarded||j,b=r.onBeforeElChildrenUpdated||j,k=r.skipFromChildren||j,z=r.addChild||function(e,t){return e.appendChild(t)},C=!0===r.childrenOnly,O=Object.create(null),N=[];function T(e){N.push(e)}function q(e,t){if(1===e.nodeType)for(var r=e.firstChild;r;){var o=void 0;t&&(o=i(r))?T(o):(f(r),r.firstChild&&q(r,t)),r=r.nextSibling}}function M(e,t,r){!1!==h(e)&&(t&&t.removeChild(e),f(e),q(e,r))}function P(e){if(1===e.nodeType||11===e.nodeType)for(var t=e.firstChild;t;){var r=i(t);r&&(O[r]=t),P(t),t=t.nextSibling}}function E(e){d(e);for(var t=e.firstChild;t;){var r=t.nextSibling,o=i(t);if(o){var a=O[o];a&&w(t,a)?(t.parentNode.replaceChild(a,t),H(a,t)):E(t)}else E(t);t=r}}function H(e,t,r){var o=i(t);if(o&&delete O[o],!r){var a=m(e,t);if(!1===a)return;if(a instanceof HTMLElement&&P(e=a),function(e,t){var r,o,a,n,l=t.attributes;if(11!==t.nodeType&&11!==e.nodeType){for(var i=l.length-1;i>=0;i--)o=(r=l[i]).name,n=r.value,(a=r.namespaceURI)?e.getAttributeNS(a,o=r.localName||o)!==n&&("xmlns"===r.prefix&&(o=r.name),e.setAttributeNS(a,o,n)):e.getAttribute(o)!==n&&e.setAttribute(o,n);for(var s=e.attributes,d=s.length-1;d>=0;d--)o=(r=s[d]).name,(a=r.namespaceURI)?t.hasAttributeNS(a,o=r.localName||o)||e.removeAttributeNS(a,o):t.hasAttribute(o)||e.removeAttribute(o)}}(e,t),c(e),!1===b(e,t))return}"TEXTAREA"!==e.nodeName?function(e,t){var r,o,a,n,l,d=k(e,t),m=t.firstChild,c=e.firstChild;e:for(;m;){for(n=m.nextSibling,r=i(m);!d&&c;){if(a=c.nextSibling,m.isSameNode&&m.isSameNode(c)){m=n,c=a;continue e}o=i(c);var h=c.nodeType,f=void 0;if(h===m.nodeType&&(1===h?(r?r!==o&&((l=O[r])?a===l?f=!1:(e.insertBefore(l,c),o?T(o):M(c,e,!0),o=i(c=l)):f=!1):o&&(f=!1),(f=!1!==f&&w(c,m))&&H(c,m)):3!==h&&8!=h||(f=!0,c.nodeValue!==m.nodeValue&&(c.nodeValue=m.nodeValue))),f){m=n,c=a;continue e}o?T(o):M(c,e,!0),c=a}if(r&&(l=O[r])&&w(l,m))d||z(e,l),H(l,m);else{var b=s(m);!1!==b&&(b&&(m=b),m.actualize&&(m=m.actualize(e.ownerDocument||g)),z(e,m),E(m))}m=n,c=a}!function(e,t,r){for(;t;){var o=t.nextSibling;(r=i(t))?T(r):M(t,e,!0),t=o}}(e,c,o);var u=y[e.nodeName];u&&u(e,t)}(e,t):y.TEXTAREA(e,t)}P(e);var I,L,S=e,R=S.nodeType,A=t.nodeType;if(!C)if(1===R)1===A?w(e,t)||(f(e),S=function(e,t){for(var r=e.firstChild;r;){var o=r.nextSibling;t.appendChild(r),r=o}return t}(e,(I=t.nodeName,(L=t.namespaceURI)&&"http://www.w3.org/1999/xhtml"!==L?g.createElementNS(L,I):g.createElement(I)))):S=t;else if(3===R||8===R){if(A===R)return S.nodeValue!==t.nodeValue&&(S.nodeValue=t.nodeValue),S;S=t}if(S===t)f(e);else{if(t.isSameNode&&t.isSameNode(S))return;if(H(S,t,C),N)for(var B=0,U=N.length;B<U;B++){var D=O[N[B]];D&&M(D,D.parentNode,!1)}}return!C&&S!==e&&e.parentNode&&(S.actualize&&(S=S.actualize(e.ownerDocument||g)),e.parentNode.replaceChild(S,e)),S};const C=[{tagName:"limel-chip",attributes:["text","icon","link","badge","disabled","readonly","selected","type","size"]},{tagName:"limel-icon",attributes:["name","size","badge"]},{tagName:"limel-badge",attributes:["label"]},{tagName:"limel-callout",attributes:["heading","icon","type"]},{tagName:"limel-linear-progress",attributes:["value","indeterminate"]},{tagName:"limel-circular-progress",attributes:["value","max-value","prefix","suffix","size","display-percentage-colors"]},{tagName:"limel-spinner",attributes:["size"]},{tagName:"limel-info-tile",attributes:["value","icon","label","prefix","suffix","badge"]}],O=class{constructor(t){e(this,t),this.value="",this.whitelist=a.markdownWhitelist,this.lazyLoadImages=!1,this.removeEmptyParagraphs=!0,this.adaptColorContrast=!1,this.imageIntersectionObserver=null}async toMarkdown(){await this.rendering;const{exportMarkdown:e}=await import("./p-C9gctvIB.js");return e(this.rootElement,this.cachedCombinedWhitelist)}textChanged(){return this.rendering=this.renderMarkdown(),this.rendering}async renderMarkdown(){try{this.cleanupImageIntersectionObserver(),this.cachedCombinedWhitelist&&this.whitelist===this.cachedConsumerWhitelist||(this.cachedConsumerWhitelist=this.whitelist,this.cachedCombinedWhitelist=function(e,t){if(!(null==t?void 0:t.length))return e.map((e=>Object.assign(Object.assign({},e),{attributes:[...e.attributes]})));const r=new Map;for(const o of[...e,...t]){const e=r.get(o.tagName);if(e)for(const t of o.attributes)e.add(t);else r.set(o.tagName,new Set(o.attributes))}return[...r].map((([e,t])=>({tagName:e,attributes:[...t]})))}(C,this.whitelist));const e=this.cachedCombinedWhitelist,t=await o(this.value,{forceHardLineBreaks:!0,whitelist:e,lazyLoadImages:this.lazyLoadImages,removeEmptyParagraphs:this.removeEmptyParagraphs});!function(e,t=""){try{z(e,`<div>${t}</div>`,{childrenOnly:!0})}catch(r){console.warn("morphdom failed, falling back to innerHTML:",r),e.innerHTML=t}}(this.rootElement,t),function(e,t){if(e&&(null==t?void 0:t.length))for(const r of t){const t=e.querySelectorAll(r.tagName);for(const e of t)m(e,r.attributes)}}(this.rootElement,e),this.adaptColorContrast&&l(this.rootElement),this.setupImageIntersectionObserver()}catch(e){console.error(e)}}handleWhitelistChange(){return this.textChanged()}handleRemoveEmptyParagraphsChange(){return this.textChanged()}handleAdaptColorContrastChange(){return this.textChanged()}async componentDidLoad(){this.textChanged()}disconnectedCallback(){this.cleanupImageIntersectionObserver()}render(){return t(r,{key:"847bffc9b7fa4fbec42b705d3019c635d88fb6c6"},t("div",{key:"cd84ef0919fc4b2b80090de836366b317e60e51a",id:"markdown",ref:e=>this.rootElement=e}))}setupImageIntersectionObserver(){this.lazyLoadImages&&(this.imageIntersectionObserver=new i(this.rootElement))}cleanupImageIntersectionObserver(){this.imageIntersectionObserver&&(this.imageIntersectionObserver.disconnect(),this.imageIntersectionObserver=null)}static get watchers(){return{value:[{textChanged:0}],whitelist:[{handleWhitelistChange:0}],removeEmptyParagraphs:[{handleRemoveEmptyParagraphsChange:0}],adaptColorContrast:[{handleAdaptColorContrastChange:0}]}}};O.style='@charset "UTF-8";pre,pre p,code{font-family:ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;font-size:0.75rem}pre{max-width:100%;white-space:pre-wrap;word-wrap:break-word}code{letter-spacing:-0.0125rem;color:rgb(var(--contrast-1300));tab-size:4;hyphens:none;display:inline;border-radius:0.25rem;padding:0.03125rem 0.25rem;background-color:rgb(var(--contrast-600))}pre>code{display:block;margin:0.5rem 0;padding:0.5rem 0.75rem}h1{font-size:1.5rem}h2{font-size:1.25rem}h3{font-size:1.125rem}h4{font-size:1rem}h5{font-size:var(--limel-theme-default-font-size)}h6{font-size:0.75rem}h1,h2{margin-top:0.5rem;margin-bottom:0.5rem;letter-spacing:-0.03125rem;font-weight:500}h3,h4{margin-top:0.75rem;margin-bottom:0.25rem;font-weight:600}h5,h6{margin-top:0.5rem;margin-bottom:0.125rem;font-weight:600}h1,h2,h3,h4,h5,h6{word-break:break-word;hyphens:auto;-webkit-hyphens:auto}h1 code,h2 code,h3 code,h4 code,h5 code,h6 code{font-size:inherit}:not([contenteditable=true]) h1,:not([contenteditable=true]) h2,:not([contenteditable=true]) h3,:not([contenteditable=true]) h4,:not([contenteditable=true]) h5,:not([contenteditable=true]) h6{text-wrap:balance}[contenteditable=true] h1,[contenteditable=true] h2,[contenteditable=true] h3,[contenteditable=true] h4,[contenteditable=true] h5,[contenteditable=true] h6{text-wrap:initial}:host(limel-markdown.truncate-paragraphs) p{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}p,li{font-size:var(--limel-theme-default-font-size);word-break:break-word}a{word-break:break-all}p{margin-top:0;margin-bottom:0.5rem}p:last-child{margin-bottom:0}a{transition:color 0.2s ease;color:var(--markdown-hyperlink-color, rgb(var(--color-blue-dark)));text-decoration:none}a:hover{color:var(--markdown-hyperlink-color--hovered, rgb(var(--color-blue-default)))}hr{margin:1.75rem 0 2rem 0;border-width:0;border-top:1px solid rgb(var(--contrast-500))}ul{list-style:none}ul>li{margin-left:0.75rem}ul>li:before{content:"";position:absolute;left:-0.5rem;top:0.5rem;width:0.25rem;height:0.25rem;border-radius:50%;background-color:rgb(var(--contrast-700));display:block}ol{margin-top:0.25rem;padding-left:1rem}ul{margin-top:0.25rem;padding-left:0}ul ul,ul ol,ol ol,ol ul{margin-left:0}li{position:relative;margin-bottom:0.25rem}:host(limel-markdown:not(.no-table-styles)) table{table-layout:auto;min-width:100%;border-collapse:collapse;border-spacing:0;background:transparent;margin:0.75rem 0}:host(limel-markdown:not(.no-table-styles)) tbody{border:1px solid rgb(var(--contrast-400));border-radius:0.25rem}:host(limel-markdown:not(.no-table-styles)) th,:host(limel-markdown:not(.no-table-styles)) td{text-align:left;vertical-align:top;transition:background-color 0.2s ease;font-size:var(--limel-theme-default-font-size)}:host(limel-markdown:not(.no-table-styles)) th p,:host(limel-markdown:not(.no-table-styles)) th li,:host(limel-markdown:not(.no-table-styles)) th a,:host(limel-markdown:not(.no-table-styles)) td p,:host(limel-markdown:not(.no-table-styles)) td li,:host(limel-markdown:not(.no-table-styles)) td a{word-break:normal;overflow-wrap:normal}:host(limel-markdown:not(.no-table-styles)) td{padding:0.5rem 0.375rem 0.75rem 0.375rem}:host(limel-markdown:not(.no-table-styles)) tr th{background-color:rgb(var(--contrast-400));padding:0.25rem 0.375rem;font-weight:normal}:host(limel-markdown:not(.no-table-styles)) tr th:only-child{text-align:center}:host(limel-markdown:not(.no-table-styles)) tbody tr:nth-child(odd) td{background-color:rgb(var(--contrast-200))}:host(limel-markdown:not(.no-table-styles)) tbody tr:hover td{background-color:rgb(var(--contrast-300))}table{display:block;box-sizing:border-box;overflow-x:auto;-webkit-overflow-scrolling:touch;max-width:100%}blockquote{position:relative;max-width:100%;margin:0.75rem 0;padding:0.5rem;border-left:0.25rem solid rgb(var(--contrast-500));background-color:rgb(var(--contrast-200))}blockquote:before,blockquote:after{position:absolute;line-height:0;font-size:2rem;opacity:0.4}blockquote:before{content:"“";left:-0.5rem;top:0.5rem}blockquote:after{content:"”";right:-0.25rem;bottom:-0.25rem}blockquote blockquote{padding-top:0;padding-right:0;padding-bottom:0;padding-left:0.25rem;border-color:rgb(var(--contrast-700));border-left-width:1px}blockquote blockquote:before,blockquote blockquote:after{display:none}blockquote:has(>blockquote){padding-left:0.25rem;padding-bottom:0}dl{display:grid;grid-template-columns:1fr 2fr;grid-template-rows:1fr;margin-bottom:2rem;border:1px solid rgb(var(--contrast-400));border-radius:0.375rem;background-color:rgb(var(--contrast-200))}dl dt,dl dd{padding:0.375rem 0.5rem;font-size:var(--limel-theme-default-font-size);margin:0}dl dt:nth-of-type(even),dl dd:nth-of-type(even){background-color:rgb(var(--contrast-300))}dl dt:first-child{border-top-left-radius:0.375rem}dl dt:last-child{border-bottom-left-radius:0.375rem}dl dd:first-child{border-top-right-radius:0.375rem}dl dd:last-child{border-bottom-right-radius:0.375rem}img{max-width:100%;border-radius:0.25rem}kbd{display:inline-block;font-family:ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;font-weight:600;color:rgb(var(--contrast-1100));white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:normal;border-radius:0.125rem;border-style:solid;border-color:rgb(var(--contrast-500));border-width:0 1px 0.1875rem 1px;padding:0.0625rem 0.375rem;margin:0 0.25rem;background-color:rgb(var(--contrast-200));box-shadow:var(--button-shadow-normal), 0 0.625rem 0.375rem -0.5rem rgb(var(--color-black), 0.02), 0 0.025rem 0.5rem 0 rgb(var(--contrast-100)) inset}:host(limel-markdown.adjust-for-table-cell) img{max-height:1.25rem;vertical-align:middle}:host(limel-markdown.adjust-for-table-cell) p{display:inline}:host(limel-markdown.adjust-for-table-cell) h1,:host(limel-markdown.adjust-for-table-cell) h2,:host(limel-markdown.adjust-for-table-cell) h3,:host(limel-markdown.adjust-for-table-cell) h4,:host(limel-markdown.adjust-for-table-cell) h5,:host(limel-markdown.adjust-for-table-cell) h6{display:inline-block;vertical-align:bottom;font-size:var(--limel-theme-default-font-size);margin:0 0.25rem 0 0;letter-spacing:normal;font-weight:500}:host(limel-markdown.adjust-for-table-cell) h1:before,:host(limel-markdown.adjust-for-table-cell) h2:before,:host(limel-markdown.adjust-for-table-cell) h3:before,:host(limel-markdown.adjust-for-table-cell) h4:before,:host(limel-markdown.adjust-for-table-cell) h5:before,:host(limel-markdown.adjust-for-table-cell) h6:before{opacity:0.6;vertical-align:middle;font-size:0.5rem;border-radius:0.25rem 0 0 0.25rem;padding:0.25rem;padding-right:2rem;margin-right:-1.75rem;background:linear-gradient(to right, rgb(var(--contrast-800), 0.6), rgb(var(--contrast-800), 0))}:host(limel-markdown.adjust-for-table-cell) h1:before{content:"H1"}:host(limel-markdown.adjust-for-table-cell) h2:before{content:"H2"}:host(limel-markdown.adjust-for-table-cell) h3:before{content:"H3"}:host(limel-markdown.adjust-for-table-cell) h4:before{content:"H4"}:host(limel-markdown.adjust-for-table-cell) h5:before{content:"H5"}:host(limel-markdown.adjust-for-table-cell) h6:before{content:"H6"}:host(limel-markdown.adjust-for-table-cell) pre{margin:0}:host(limel-markdown.adjust-for-table-cell) pre>code{padding:0.125rem;margin:0}:host(limel-markdown.adjust-for-table-cell) dl{margin:0}:host(limel-markdown.adjust-for-table-cell) dl dt,:host(limel-markdown.adjust-for-table-cell) dl dd{padding:0.00625rem 0.125rem}*,*::before,*::after{box-sizing:border-box}* :where(:not(img,video,svg,canvas,iframe)),*::before :where(:not(img,video,svg,canvas,iframe)),*::after :where(:not(img,video,svg,canvas,iframe)){min-width:0;min-height:0}hr{border-top:1px solid rgb(var(--contrast-700))}.MsoNormal{margin:0}:host(limel-markdown.reset-img-height) #markdown img{height:auto !important}';export{O as limel_markdown}
|