@aeriz/wysiwyg 1.0.4 → 2.0.0

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.
Files changed (132) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +82 -573
  3. package/angular/README.md +10 -4
  4. package/angular/aeriz-editor.directive.ts +40 -18
  5. package/dist/adapters/jquery.cjs +1 -1
  6. package/dist/adapters/jquery.js +14 -14
  7. package/dist/adapters/shared.cjs +1 -1
  8. package/dist/adapters/shared.js +59 -56
  9. package/dist/adapters/vue.cjs +1 -1
  10. package/dist/adapters/vue.js +64 -56
  11. package/dist/adapters/vue2.cjs +1 -1
  12. package/dist/adapters/vue2.js +24 -17
  13. package/dist/adapters/wc.cjs +1 -1
  14. package/dist/adapters/wc.js +108 -72
  15. package/dist/aeriz-wysiwyg-adapter.js +24 -32
  16. package/dist/aeriz-wysiwyg-adapter.min.js +1 -1
  17. package/dist/aeriz-wysiwyg-highlight.js +964 -0
  18. package/dist/aeriz-wysiwyg-highlight.min.js +5 -0
  19. package/dist/aeriz-wysiwyg-jquery.js +25 -32
  20. package/dist/aeriz-wysiwyg-jquery.min.js +1 -1
  21. package/dist/aeriz-wysiwyg-wc.js +80 -43
  22. package/dist/aeriz-wysiwyg-wc.min.js +1 -1
  23. package/dist/aeriz-wysiwyg.cjs +3688 -1757
  24. package/dist/aeriz-wysiwyg.css +2104 -1904
  25. package/dist/aeriz-wysiwyg.esm.js +3688 -1757
  26. package/dist/aeriz-wysiwyg.esm.min.js +4904 -3538
  27. package/dist/aeriz-wysiwyg.js +3688 -1757
  28. package/dist/aeriz-wysiwyg.min.cjs +53 -40
  29. package/dist/aeriz-wysiwyg.min.css +1 -1
  30. package/dist/aeriz-wysiwyg.min.js +53 -40
  31. package/dist/highlight.cjs +5 -0
  32. package/dist/highlight.js +895 -0
  33. package/dist/server.cjs +24 -19
  34. package/dist/server.js +612 -251
  35. package/dist-types/adapters/shared.d.ts +0 -8
  36. package/dist-types/adapters/shared.d.ts.map +1 -1
  37. package/dist-types/adapters/vue.d.ts +62 -21
  38. package/dist-types/adapters/vue.d.ts.map +1 -1
  39. package/dist-types/adapters/vue2.d.ts +33 -14
  40. package/dist-types/adapters/vue2.d.ts.map +1 -1
  41. package/dist-types/adapters/wc.d.ts +15 -6
  42. package/dist-types/adapters/wc.d.ts.map +1 -1
  43. package/dist-types/cjs/adapters/shared.d.cts +0 -8
  44. package/dist-types/cjs/adapters/vue.d.cts +62 -21
  45. package/dist-types/cjs/adapters/vue2.d.cts +33 -14
  46. package/dist-types/cjs/adapters/wc.d.cts +15 -6
  47. package/dist-types/cjs/core/AerizEditor.d.cts +238 -48
  48. package/dist-types/cjs/core/AerizViewer.d.cts +7 -0
  49. package/dist-types/cjs/core/block-meta.d.cts +40 -0
  50. package/dist-types/cjs/core/block-tracker.d.cts +64 -0
  51. package/dist-types/cjs/core/blocks.d.cts +39 -4
  52. package/dist-types/cjs/core/fonts.d.cts +33 -46
  53. package/dist-types/cjs/core/highlight.d.cts +2 -0
  54. package/dist-types/cjs/core/history.d.cts +28 -10
  55. package/dist-types/cjs/core/html-to-blocks.d.cts +10 -0
  56. package/dist-types/cjs/core/i18n.d.cts +44 -0
  57. package/dist-types/cjs/core/import-html.d.cts +0 -13
  58. package/dist-types/cjs/core/insert-fragment.d.cts +21 -0
  59. package/dist-types/cjs/core/paste-clean.d.cts +36 -0
  60. package/dist-types/cjs/core/sanitize-dom.d.cts +21 -0
  61. package/dist-types/cjs/core/sanitize-html.d.cts +8 -0
  62. package/dist-types/cjs/core/sanitize-policy.d.cts +22 -0
  63. package/dist-types/cjs/core/selection.d.cts +5 -0
  64. package/dist-types/cjs/core/table-grid.d.cts +87 -0
  65. package/dist-types/cjs/core/table-ops.d.cts +2 -22
  66. package/dist-types/cjs/highlight/index.d.cts +5 -0
  67. package/dist-types/cjs/index.d.cts +19 -11
  68. package/dist-types/cjs/server/index.d.cts +4 -5
  69. package/dist-types/cjs/types/index.d.cts +63 -15
  70. package/dist-types/cjs/ui/Toolbar.d.cts +10 -0
  71. package/dist-types/cjs/ui/doc-tools.d.cts +58 -0
  72. package/dist-types/cjs/ui/popovers.d.cts +14 -25
  73. package/dist-types/core/AerizEditor.d.ts +238 -48
  74. package/dist-types/core/AerizEditor.d.ts.map +1 -1
  75. package/dist-types/core/AerizViewer.d.ts +7 -0
  76. package/dist-types/core/AerizViewer.d.ts.map +1 -1
  77. package/dist-types/core/block-meta.d.ts +40 -0
  78. package/dist-types/core/block-meta.d.ts.map +1 -1
  79. package/dist-types/core/block-policy.d.ts.map +1 -1
  80. package/dist-types/core/block-tracker.d.ts +64 -0
  81. package/dist-types/core/block-tracker.d.ts.map +1 -0
  82. package/dist-types/core/blocks.d.ts +39 -4
  83. package/dist-types/core/blocks.d.ts.map +1 -1
  84. package/dist-types/core/fonts.d.ts +33 -46
  85. package/dist-types/core/fonts.d.ts.map +1 -1
  86. package/dist-types/core/highlight.d.ts +2 -0
  87. package/dist-types/core/highlight.d.ts.map +1 -1
  88. package/dist-types/core/history.d.ts +28 -10
  89. package/dist-types/core/history.d.ts.map +1 -1
  90. package/dist-types/core/html-mini.d.ts.map +1 -1
  91. package/dist-types/core/html-to-blocks.d.ts +10 -0
  92. package/dist-types/core/html-to-blocks.d.ts.map +1 -0
  93. package/dist-types/core/i18n.d.ts +44 -0
  94. package/dist-types/core/i18n.d.ts.map +1 -1
  95. package/dist-types/core/import-html.d.ts +0 -13
  96. package/dist-types/core/import-html.d.ts.map +1 -1
  97. package/dist-types/core/import-markdown.d.ts.map +1 -1
  98. package/dist-types/core/insert-fragment.d.ts +21 -0
  99. package/dist-types/core/insert-fragment.d.ts.map +1 -0
  100. package/dist-types/core/markdown-export.d.ts.map +1 -1
  101. package/dist-types/core/paste-clean.d.ts +36 -0
  102. package/dist-types/core/paste-clean.d.ts.map +1 -0
  103. package/dist-types/core/render-string.d.ts.map +1 -1
  104. package/dist-types/core/sanitize-dom.d.ts +21 -0
  105. package/dist-types/core/sanitize-dom.d.ts.map +1 -0
  106. package/dist-types/core/sanitize-html.d.ts +8 -0
  107. package/dist-types/core/sanitize-html.d.ts.map +1 -0
  108. package/dist-types/core/sanitize-policy.d.ts +22 -0
  109. package/dist-types/core/sanitize-policy.d.ts.map +1 -0
  110. package/dist-types/core/selection.d.ts +5 -0
  111. package/dist-types/core/selection.d.ts.map +1 -1
  112. package/dist-types/core/snapshot.d.ts.map +1 -1
  113. package/dist-types/core/table-grid.d.ts +87 -0
  114. package/dist-types/core/table-grid.d.ts.map +1 -0
  115. package/dist-types/core/table-ops.d.ts +2 -22
  116. package/dist-types/core/table-ops.d.ts.map +1 -1
  117. package/dist-types/highlight/index.d.ts +5 -0
  118. package/dist-types/highlight/index.d.ts.map +1 -0
  119. package/dist-types/index.d.ts +19 -11
  120. package/dist-types/index.d.ts.map +1 -1
  121. package/dist-types/server/index.d.ts +4 -5
  122. package/dist-types/server/index.d.ts.map +1 -1
  123. package/dist-types/types/index.d.ts +63 -15
  124. package/dist-types/types/index.d.ts.map +1 -1
  125. package/dist-types/ui/Toolbar.d.ts +10 -0
  126. package/dist-types/ui/Toolbar.d.ts.map +1 -1
  127. package/dist-types/ui/doc-tools.d.ts +58 -0
  128. package/dist-types/ui/doc-tools.d.ts.map +1 -0
  129. package/dist-types/ui/icons.d.ts.map +1 -1
  130. package/dist-types/ui/popovers.d.ts +14 -25
  131. package/dist-types/ui/popovers.d.ts.map +1 -1
  132. package/package.json +70 -5
package/dist/server.cjs CHANGED
@@ -1,34 +1,39 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function X(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/1024/1024).toFixed(1)} MB`:`${(e/1024/1024/1024).toFixed(1)} GB`}function J(e,t){if(e){const n=e.lastIndexOf(".");if(n>0&&n<e.length-1)return e.slice(n+1).toUpperCase()}return t?(t.split("/").pop()??"").toUpperCase():""}function U(e){try{return new URL(e).hostname}catch{return""}}function Q(e){const t=U(e);return t?`https://www.google.com/s2/favicons?domain=${encodeURIComponent(t)}&sz=64`:""}const ee='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"/><path d="M14 3v6h6"/></svg>',te='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>',ne="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",R="https://www.youtube-nocookie.com/embed/",re="파일",ie="data-block-id",oe=/[​-‍]/g,ce=["id","class","dir","lang","title"],se=new Set(["div","section","article","aside","header","footer","main","nav","details","summary","figure","figcaption","address","fieldset","dl","dt","dd","small","span"]);function ae(e){if(!e)return"div";const t=e.toLowerCase();return se.has(t)?t:"div"}function le(...e){const t=new Set;for(const n of e)if(n)for(const r of n.split(/\s+/))r&&t.add(r);return[...t].join(" ")}const ue="aw-task-list",de="data-checked",fe=new Set(["http:","https:","mailto:","tel:","ftp:","sms:"]),pe=new Set(["http:","https:","blob:"]),$e=/^data:image\/[a-z0-9.+-]+[,;]/i;function W(e){return e.replace(me,"")}const me=new RegExp("[\\u0000-\\u0020\\u007f]","g");function q(e){const t=/^([a-z][a-z0-9+.-]*):/i.exec(e);return t&&t[1]?`${t[1].toLowerCase()}:`:null}function I(e){if(!e)return"";const t=e.trim();if(!t)return"";const n=q(W(t));return n===null||fe.has(n)?t:""}function v(e){if(!e)return"";const t=e.trim();if(!t)return"";const n=W(t),r=q(n);return r===null?t:r==="data:"?$e.test(n)?t:"":pe.has(r)?t:""}function D(e){return e&&/^[A-Za-z0-9_-]{6,20}$/.test(e)?e:""}const P=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),ge=new Set(["script","style"]),he=new Map([["li",new Set(["li"])],["p",new Set(["p","div","ul","ol","blockquote","pre","table","h1","h2","h3","h4","h5","h6"])],["td",new Set(["td","th","tr"])],["th",new Set(["td","th","tr"])],["tr",new Set(["tr"])],["option",new Set(["option"])]]),be={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",hellip:"…",mdash:"—",ndash:"–",lsquo:"‘",rsquo:"’",ldquo:"“",rdquo:"”",middot:"·",bull:"•",copy:"©",reg:"®",trade:"™",deg:"°",plusmn:"±",times:"×",divide:"÷",laquo:"«",raquo:"»"};function k(e){return e.includes("&")?e.replace(/&(#[Xx][0-9A-Fa-f]+|#\d+|[A-Za-z][A-Za-z0-9]{1,31});/g,(t,n)=>{if(n.charCodeAt(0)===35){const i=n[1]==="x"||n[1]==="X",o=i?n.slice(2):n.slice(1),c=Number.parseInt(o,i?16:10);if(!Number.isFinite(c)||c<0||c>1114111||c>=55296&&c<=57343)return t;try{return String.fromCodePoint(c)}catch{return t}}return be[n.toLowerCase()]??t}):e}function g(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function f(e){return g(e).replace(/"/g,"&quot;")}function ke(e){const t={},n=/([^\s/=>"']+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g;let r;for(;(r=n.exec(e))!==null;){const i=r[1];if(!i)continue;const o=r[2]??r[3]??r[4]??"";t[i.toLowerCase()]=k(o)}return t}function S(e){const t=[],n=[],r=()=>{const a=n[n.length-1];return a?a.children:t},i=a=>{if(a.length===0)return;const s=r(),u=s[s.length-1];u&&u.type==="text"?u.value+=a:s.push({type:"text",value:a})},o=a=>{var s;for(let u=n.length-1;u>=0;u--)if(((s=n[u])==null?void 0:s.tag)===a){n.length=u;return}};let c=0;for(;c<e.length;){const a=e.indexOf("<",c);if(a<0){i(k(e.slice(c)));break}if(a>c&&i(k(e.slice(c,a))),e.startsWith("<!--",a)){const m=e.indexOf("-->",a+4);c=m<0?e.length:m+3;continue}if(e.startsWith("<!",a)||e.startsWith("<?",a)){const m=e.indexOf(">",a+2);c=m<0?e.length:m+1;continue}const s=e.indexOf(">",a+1);if(s<0){i(k(e.slice(a)));break}const u=e.slice(a+1,s);if(c=s+1,u.startsWith("/")){const m=u.slice(1).trim().toLowerCase();m&&o(m);continue}const d=/^([A-Za-z][^\s/>]*)/.exec(u);if(!d||!d[1]){i(k(e.slice(a,c)));continue}const l=d[1].toLowerCase(),$=u.slice(d[1].length),h=/\/\s*$/.test($),p=ke(h?$.replace(/\/\s*$/,""):$);if(ge.has(l)){const m=new RegExp(`</${l}\\s*>`,"i"),Z=e.slice(c),O=m.exec(Z);c=O?c+O.index+O[0].length:e.length;continue}const A=n[n.length-1];if(A){const m=he.get(A.tag);m!=null&&m.has(l)&&n.pop()}const z={type:"element",tag:l,attrs:p,children:[]};r().push(z),!h&&!P.has(l)&&n.push(z)}return t}function C(e){let t="";for(const n of e){if(n.type==="text"){t+=g(n.value);continue}const r=Object.entries(n.attrs).map(([i,o])=>o===""?` ${i}`:` ${i}="${f(o)}"`).join("");if(P.has(n.tag)){t+=`<${n.tag}${r}>`;continue}t+=`<${n.tag}${r}>${C(n.children)}</${n.tag}>`}return t}function N(e){let t="";for(const n of e){if(n.type==="text"){t+=n.value;continue}if(n.tag==="br"){t+=`
2
- `;continue}t+=N(n.children)}return t}const we=new Set(["address","article","aside","blockquote","div","dd","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","li","main","nav","ol","p","pre","section","table","tbody","td","tfoot","th","thead","tr","ul"]);function E(e){let t="";for(const n of e){if(n.type==="text"){t+=n.value;continue}if(n.tag==="br"){t+=`
3
- `;continue}const r=we.has(n.tag);r&&t!==""&&!t.endsWith(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function Q(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/1024/1024).toFixed(1)} MB`:`${(e/1024/1024/1024).toFixed(1)} GB`}function ee(e,t){if(e){const n=e.lastIndexOf(".");if(n>0&&n<e.length-1)return e.slice(n+1).toUpperCase()}return t?(t.split("/").pop()??"").toUpperCase():""}function F(e){try{return new URL(e).hostname}catch{return""}}function te(e){const t=F(e);return t?`https://www.google.com/s2/favicons?domain=${encodeURIComponent(t)}&sz=64`:""}const ne='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"/><path d="M14 3v6h6"/></svg>',re='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>',ie="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",N="https://www.youtube-nocookie.com/embed/",oe="파일",se="data-block-id",ae=/[​-‍]/g,ce=["id","class","dir","lang","title"],le=new Set(["div","section","article","aside","header","footer","main","nav","details","summary","figure","figcaption","address","fieldset","dl","dt","dd","small","span"]);function ue(e){if(!e)return"div";const t=e.toLowerCase();return le.has(t)?t:"div"}function de(...e){const t=new Set;for(const n of e)if(n)for(const r of n.split(/\s+/))r&&t.add(r);return[...t].join(" ")}const fe="aw-task-list",pe="data-checked",ge=["note","tip","warning","danger"],me="aw-callout",he="aw-callout-";function U(e){return ge.find(n=>n===e)??"note"}const $e="aw-toggle-summary",we="aw-toggle-body",be=new Set(["http:","https:","mailto:","tel:","ftp:","sms:"]),Se=new Set(["http:","https:","blob:"]),ke=/^data:image\/[a-z0-9.+-]+[,;]/i;function q(e){return e.replace(ye,"")}const ye=new RegExp("[\\u0000-\\u0020\\u007f]","g");function P(e){const t=/^([a-z][a-z0-9+.-]*):/i.exec(e);return t&&t[1]?`${t[1].toLowerCase()}:`:null}function L(e){if(!e)return"";const t=e.trim();if(!t)return"";const n=P(q(t));return n===null||be.has(n)?t:""}function y(e){if(!e)return"";const t=e.trim();if(!t)return"";const n=q(t),r=P(n);return r===null?t:r==="data:"?ke.test(n)?t:"":Se.has(r)?t:""}function G(e){return e&&/^[A-Za-z0-9_-]{6,20}$/.test(e)?e:""}function Ae(e){return/^on/i.test(e)}const Te=new Set(["srcdoc","formaction","action","xlink:href","ping"]);function _e(e){return Te.has(e.toLowerCase())}function ve(e){const t=e.split(",");for(const n of t){const r=n.trim().split(/\s+/)[0]??"";if(r!==""&&!y(r))return!1}return!0}const D=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Ee=new Set(["script","style"]),Le=new Map([["li",new Set(["li"])],["p",new Set(["p","div","ul","ol","blockquote","pre","table","h1","h2","h3","h4","h5","h6"])],["td",new Set(["td","th","tr"])],["th",new Set(["td","th","tr"])],["tr",new Set(["tr"])],["option",new Set(["option"])]]),xe={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",hellip:"…",mdash:"—",ndash:"–",lsquo:"‘",rsquo:"’",ldquo:"“",rdquo:"”",middot:"·",bull:"•",copy:"©",reg:"®",trade:"™",deg:"°",plusmn:"±",times:"×",divide:"÷",laquo:"«",raquo:"»"};function T(e){return e.includes("&")?e.replace(/&(#[Xx][0-9A-Fa-f]+|#\d+|[A-Za-z][A-Za-z0-9]{1,31});/g,(t,n)=>{if(n.charCodeAt(0)===35){const i=n[1]==="x"||n[1]==="X",o=i?n.slice(2):n.slice(1),s=Number.parseInt(o,i?16:10);if(!Number.isFinite(s)||s<0||s>1114111||s>=55296&&s<=57343)return t;try{return String.fromCodePoint(s)}catch{return t}}return xe[n.toLowerCase()]??t}):e}function $(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function p(e){return $(e).replace(/"/g,"&quot;")}function Ce(e){const t={},n=/([^\s/=>"']+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g;let r;for(;(r=n.exec(e))!==null;){const i=r[1];if(!i)continue;const o=r[2]??r[3]??r[4]??"";t[i.toLowerCase()]=T(o)}return t}function k(e){const t=[],n=[],r=()=>{const c=n[n.length-1];return c?c.children:t},i=c=>{if(c.length===0)return;const a=r(),u=a[a.length-1];u&&u.type==="text"?u.value+=c:a.push({type:"text",value:c})},o=c=>{var a;for(let u=n.length-1;u>=0;u--)if(((a=n[u])==null?void 0:a.tag)===c){n.length=u;return}};let s=0;for(;s<e.length;){const c=e.indexOf("<",s);if(c<0){i(T(e.slice(s)));break}if(c>s&&i(T(e.slice(s,c))),e.startsWith("<!--",c)){const m=e.indexOf("-->",c+4);s=m<0?e.length:m+3;continue}if(e.startsWith("<!",c)||e.startsWith("<?",c)){const m=e.indexOf(">",c+2);s=m<0?e.length:m+1;continue}const a=e.indexOf(">",c+1);if(a<0){i(T(e.slice(c)));break}const u=e.slice(c+1,a);if(s=a+1,u.startsWith("/")){const m=u.slice(1).trim().toLowerCase();m&&o(m);continue}const d=/^([A-Za-z][^\s/>]*)/.exec(u);if(!d||!d[1]){i(T(e.slice(c,s)));continue}const l=d[1].toLowerCase(),f=u.slice(d[1].length),w=/\/\s*$/.test(f),g=Ce(w?f.replace(/\/\s*$/,""):f);if(Ee.has(l)){const m=new RegExp(`</${l}\\s*>`,"i"),J=e.slice(s),R=m.exec(J);s=R?s+R.index+R[0].length:e.length;continue}const A=n[n.length-1];if(A){const m=Le.get(A.tag);m!=null&&m.has(l)&&n.pop()}const j={type:"element",tag:l,attrs:g,children:[]};r().push(j),!w&&!D.has(l)&&n.push(j)}return t}function O(e){let t="";for(const n of e){if(n.type==="text"){t+=$(n.value);continue}const r=Object.entries(n.attrs).map(([i,o])=>o===""?` ${i}`:` ${i}="${p(o)}"`).join("");if(D.has(n.tag)){t+=`<${n.tag}${r}>`;continue}t+=`<${n.tag}${r}>${O(n.children)}</${n.tag}>`}return t}function M(e){let t="";for(const n of e){if(n.type==="text"){t+=n.value;continue}if(n.tag==="br"){t+=`
2
+ `;continue}t+=M(n.children)}return t}const Ie=new Set(["address","article","aside","blockquote","details","div","dd","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","li","main","nav","ol","p","pre","section","summary","table","tbody","td","tfoot","th","thead","tr","ul"]);function x(e){let t="";for(const n of e){if(n.type==="text"){t+=n.value;continue}if(n.tag==="br"){t+=`
3
+ `;continue}const r=Ie.has(n.tag);r&&t!==""&&!t.endsWith(`
4
4
  `)&&(t+=`
5
- `),t+=E(n.children),r&&!t.endsWith(`
5
+ `),t+=x(n.children),r&&!t.endsWith(`
6
6
  `)&&(t+=`
7
- `)}return t}function L(e,t){return e.filter(n=>n.type==="element"&&n.tag===t)}const Se=1;function K(e){const t=e.version;return typeof t=="number"&&Number.isFinite(t)&&t>0?t:1}const ye=new Set(["paragraph","heading","bulletList","orderedList","taskList","blockquote","codeBlock","image","table","hr","linkCard","youtube","file","importedHtml","unknown"]);function M(e){return e.map(t=>B(t))}function B(e){const t=ye.has(e.kind)?e.kind:"unknown",n=Math.max(K(e),1);return{...e,kind:t,version:n,html:typeof e.html=="string"?e.html:""}}function Ae(e,t={}){const n=t.blockIds!==!1,r=M(e).map(o=>V(o,{blockIds:n})).join("");return t.wrapper!=="content"?r:`<div class="aeriz-wysiwyg aeriz-wysiwyg-viewer"${t.theme?` data-theme="${t.theme}"`:""}><div class="aw-content-wrap"><div class="aw-content">${r}</div></div></div>`}function Te(e,t={}){return V(B(e),t)}function V(e,t={}){const n=t.blockIds===!1?"":` ${ie}="${f(e.id)}"`,r=Ee(e.html),i=(e.style?` style="${f(e.style)}"`:"")+ve(e.attributes),o=c=>{var s;const a=le(c,(s=e.attributes)==null?void 0:s.class);return a?` class="${f(a)}"`:""};switch(e.kind){case"paragraph":return`<p${n}${i}>${r||"<br>"}</p>`;case"unknown":{const c=ae(e.attrs.tag);return`<${c}${n}${i}>${r||"<br>"}</${c}>`}case"heading":{const c=_e(e.attrs.level);return`<h${c}${n}${i}>${r||"<br>"}</h${c}>`}case"bulletList":return`<ul${n}${i}>${r||"<li><br></li>"}</ul>`;case"orderedList":return`<ol${n}${i}>${r||"<li><br></li>"}</ol>`;case"taskList":return`<ul${o(ue)}${n}${i}>${r||"<li><br></li>"}</ul>`;case"blockquote":return`<blockquote${n}${i}>${r||"<p><br></p>"}</blockquote>`;case"codeBlock":{if(r)return`<pre${n}${i}>${r}</pre>`;const c=e.attrs.language,a=c?` data-language="${f(c)}"`:"";return`<pre${n}${i}><code${a}></code></pre>`}case"table":return`<table${n}${i}>${r||Ie(e.attrs.rows,e.attrs.cols)}</table>`;case"hr":return`<hr${n}${i}>`;case"image":return r?`<figure${n}${i}>${_(r)}</figure>`:Ce(e.attrs,n,i);case"youtube":{if(!r)return Ne(e.attrs,n,i,o);const c=D(e.attrs.videoId),a=c?` data-youtube-id="${f(c)}"`:"";return`<div${o("aw-youtube-embed")}${a}${n}${i}>${_(r)}</div>`}case"linkCard":return Me(e.attrs,n,i,r,o);case"file":return Oe(e.attrs,n,i,r,o);case"importedHtml":{const c=e.attrs.importedStyle,a=e.style?i:c?` style="${f(c)}"`:"";return`<div data-imported-html="true"${o(e.attrs.importedClass)}${a}${n}>${r}</div>`}default:return""}}function ve(e){if(!e)return"";let t="";for(const n of ce){if(n==="class")continue;const r=e[n];r===void 0||r===""||(t+=` ${n}="${f(r)}"`)}return t}const j=/\s(href|src)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/gi;function Ee(e){return!e||!Le(e)&&!xe.test(e)?e:C(S(e).map(G))}const xe=/<iframe[\s>]/i;function Le(e){j.lastIndex=0;let t;for(;(t=j.exec(e))!==null;){const n=(t[1]??"").toLowerCase(),r=k(t[2]??t[3]??t[4]??"");if(!(n==="href"?I(r):v(r)))return!0}return!1}function G(e){if(e.type!=="element")return e;const t=e.tag==="iframe",n={};for(const[r,i]of Object.entries(e.attrs))r==="href"&&!I(i)||r==="src"&&!(t?i.startsWith(R):v(i))||(n[r]=i);return{...e,attrs:n,children:e.children.map(G)}}const H=/aw-block-align-controls|aw-resize-handle/;function _(e){if(!H.test(e))return e;const t=S(e).filter(n=>!(n.type==="element"&&H.test(n.attrs.class??"")));return C(t)}function _e(e){return e===void 0||e<1?1:e>6?6:e}function Ie(e,t){const n=Math.max(1,Number.isFinite(e)?e:1),r=Math.max(1,Number.isFinite(t)?t:1);return`<tbody>${`<tr>${"<td><br></td>".repeat(r)}</tr>`.repeat(n)}</tbody>`}function Ce(e,t,n){const r=n||(e.wrapperStyle?` style="${f(e.wrapperStyle)}"`:""),i=v(e.src),o=i?` src="${f(i)}"`:"",c=` alt="${f(e.alt??"")}"`,a=e.caption?`<figcaption>${g(e.caption)}</figcaption>`:"";return`<figure${t}${r}><img${o}${c}>${a}</figure>`}function Ne(e,t,n,r){const i=D(e.videoId),o=n||(e.wrapperStyle?` style="${f(e.wrapperStyle)}"`:""),c=i?` data-youtube-id="${f(i)}"`:"",a=i?` src="${f(`${R}${i}`)}"`:"";return`<div${r("aw-youtube-embed")}${c}${t}${o}><iframe${a} allow="${f(ne)}" allowfullscreen frameborder="0" referrerpolicy="strict-origin-when-cross-origin"></iframe></div>`}function Me(e,t,n,r,i){const o=I(e.href)||"#",c=e.text&&e.text.length>0?e.text:U(o)||o,a=e.description??"",s=v(e.image),u=e.favicon?v(e.favicon):Q(o),l=`<a${i(s?"aw-link-card aw-link-card-with-image":"aw-link-card")} href="${f(o)}" target="_blank" rel="noopener"${t}${n}>`;if(r)return`${l}${_(r)}</a>`;let $=l;return s&&($+=`<img class="aw-link-card-image" src="${f(s)}" alt="" loading="lazy">`),$+='<span class="aw-link-card-body">',$+=`<span class="aw-link-card-title">${g(c)}</span>`,a&&($+=`<span class="aw-link-card-desc">${g(a)}</span>`),$+='<span class="aw-link-card-url">',u&&($+=`<img class="aw-link-card-favicon" src="${f(u)}" alt="" loading="lazy">`),$+=`<span class="aw-link-card-url-text">${g(o)}</span>`,$+="</span></span></a>",$}function Oe(e,t,n,r,i){const o=I(e.fileSrc),c=o?` href="${f(o)}"`:"",a=e.fileName?` data-file-name="${f(e.fileName)}"`:"",s=e.fileSize!==void 0?` data-file-size="${f(String(e.fileSize))}"`:"",u=e.fileType?` data-file-type="${f(e.fileType)}"`:"",d=` download="${f(e.fileName??"")}"`,l=[],$=J(e.fileName,e.fileType);$&&l.push($),e.fileSize!==void 0&&l.push(X(e.fileSize));const h=`<a${i("aw-file-attachment")} target="_blank" rel="noopener"${c}${d}${a}${s}${u}${t}${n}>`;if(r)return`${h}${_(r)}</a>`;let p=h;return p+=`<span class="aw-file-icon" aria-hidden="true">${ee}</span>`,p+='<span class="aw-file-meta">',p+=`<span class="aw-file-name">${g(e.fileName??re)}</span>`,l.length>0&&(p+=`<span class="aw-file-info">${g(l.join(" · "))}</span>`),p+="</span>",p+=`<span class="aw-file-action" aria-hidden="true">${te}</span>`,p+="</a>",p}const Re=/([\\`*_[\]<])/g,Be=/^([#>|+-]|\d+\.)/;function ze(e,t={}){const n=t.bullet??"-",r=t.gfmTables!==!1,i=[];for(const o of M(e)){const c=je(o,n,r);c!==""&&i.push(c)}return i.length>0?`${i.join(`
7
+ `)}return t}function _(e,t){return e.filter(n=>n.type==="element"&&n.tag===t)}function W(e,t){for(const n of e){if(n.type!=="element")continue;if(n.tag===t)return n;const r=W(n.children,t);if(r)return r}return null}const Re=new Set(["script","style","template","noscript","noembed","noframes","xmp","plaintext","object","embed","applet","frame","frameset","base","link","meta","title","head","form","input","button","textarea","select","option","optgroup","datalist","output","portal","param","math","foreignobject","use","animate","animatemotion","animatetransform","set","image","audio","video","source","track","canvas","dialog","slot"]),Ne=new Set(["p","div","span","br","hr","h1","h2","h3","h4","h5","h6","blockquote","pre","code","section","article","aside","header","footer","main","nav","address","figure","figcaption","details","summary","center","fieldset","legend","ul","ol","li","dl","dt","dd","a","b","strong","i","em","u","s","strike","del","ins","mark","small","big","sub","sup","kbd","samp","var","q","cite","abbr","dfn","time","bdi","bdo","wbr","ruby","rt","rp","font","label","table","caption","colgroup","col","thead","tbody","tfoot","tr","td","th","img","picture","iframe","svg","g","path","line","polyline","polygon","circle","ellipse","rect","desc"]);function Oe(e){const t=e.toLowerCase();return Re.has(t)?"drop":Ne.has(t)?"keep":"unwrap"}const Me=new Set(["class","style","title","lang","dir","role","contenteditable","spellcheck","translate","hidden"]),je={a:new Set(["href","target","rel","download","hreflang"]),img:new Set(["src","srcset","sizes","alt","width","height","loading","decoding"]),iframe:new Set(["src","allow","allowfullscreen","frameborder","referrerpolicy","loading","width","height"]),table:new Set(["border","cellpadding","cellspacing","width","summary","align","bgcolor"]),td:new Set(["colspan","rowspan","headers","scope","width","height","align","valign","bgcolor","nowrap"]),th:new Set(["colspan","rowspan","headers","scope","abbr","width","height","align","valign","bgcolor","nowrap"]),tr:new Set(["align","valign","bgcolor","height"]),col:new Set(["span","width"]),colgroup:new Set(["span","width"]),ol:new Set(["start","type","reversed"]),ul:new Set(["type"]),li:new Set(["value","type"]),details:new Set(["open"]),time:new Set(["datetime"]),blockquote:new Set(["cite"]),q:new Set(["cite"]),del:new Set(["cite","datetime"]),ins:new Set(["cite","datetime"]),font:new Set(["color","face","size"]),p:new Set(["align"]),div:new Set(["align"]),h1:new Set(["align"]),h2:new Set(["align"]),h3:new Set(["align"]),h4:new Set(["align"]),h5:new Set(["align"]),h6:new Set(["align"]),svg:new Set(["viewbox","width","height","fill","stroke","stroke-width","stroke-linecap","stroke-linejoin","xmlns","preserveaspectratio","focusable"])},Be=new Set(["d","points","x","y","x1","x2","y1","y2","cx","cy","r","rx","ry","width","height","fill","stroke","stroke-width","stroke-linecap","stroke-linejoin","stroke-dasharray","opacity","fill-rule","clip-rule","transform"]),ze=new Set(["g","path","line","polyline","polygon","circle","ellipse","rect"]),He=/^(?:data|aria)-[a-z0-9_.:-]+$/;function K(e,t,n){var r;return Ae(t)||_e(t)?null:t==="style"?Pe(n)||null:t==="href"?L(n)?n:null:t==="src"?e==="iframe"?n.startsWith(N)?n:null:y(n)?n:null:t==="srcset"?ve(n)?n:null:t==="cite"?L(n)?n:null:t==="id"?Ue(n):t==="contenteditable"?n==="false"?n:null:Me.has(t)||He.test(t)||(r=je[e])!=null&&r.has(t)||ze.has(e)&&Be.has(t)?n:null}const Fe=new Set(["window","document","self","top","parent","frames","opener","location","cookie","domain","body","head","forms","images","links","scripts","anchors","embeds","plugins","documentelement","defaultview","name","localstorage","sessionstorage","navigator","history","alert","eval","fetch","xmlhttprequest","implementation","currentscript","activeelement"]);function Ue(e){return/^[A-Za-z][\w:.-]{0,127}$/.test(e)?Fe.has(e.toLowerCase())?null:e:null}const B=/expression\s*\(|behavior\s*:|-moz-binding|@import|javascript:|vbscript:/i,qe=/url\s*\(\s*(['"]?)(.*?)\1\s*\)/gi;function Pe(e){if(!e)return"";const t=e.replace(/\/\*[\s\S]*?\*\//g,"");if(!B.test(t.replace(/\\/g,""))&&!/url\s*\(/i.test(t))return t.trim();const n=[];for(const r of t.split(";")){const i=r.trim();if(!i||B.test(i.replace(/\\/g,"")))continue;let o=!1;i.replace(qe,(s,c,a)=>(y(a)||(o=!0),s)),!o&&n.push(i)}return n.join("; ")}function Ge(e,t){if(!e||e.toLowerCase()==="_self")return t;const n=new Set((t??"").split(/\s+/).filter(Boolean));return n.add("noopener"),n.add("noreferrer"),[...n].join(" ")}function V(e){return e?O(Y(k(e))):""}function Y(e){const t=[];for(const n of e){if(n.type==="text"){t.push(n);continue}const r=Oe(n.tag);if(r==="drop"||n.tag==="iframe"&&!De(n))continue;const i=Y(n.children);if(r==="unwrap"){t.push(...i);continue}t.push({type:"element",tag:n.tag,attrs:We(n),children:i})}return t}function De(e){return K("iframe","src",e.attrs.src??"")!==null}function We(e){const t={};for(const[n,r]of Object.entries(e.attrs)){const i=K(e.tag,n,r);i!==null&&(t[n]=i)}if(e.tag==="a"){const n=Ge(t.target??null,t.rel??null);n&&(t.rel=n)}return t}const Ke=1;function Ve(e){const t=e.version;return typeof t=="number"&&Number.isFinite(t)&&t>0?t:1}const Ye=new Set(["paragraph","heading","bulletList","orderedList","taskList","blockquote","codeBlock","toggle","callout","image","table","hr","linkCard","youtube","file","importedHtml","unknown"]);function I(e){return e.map(t=>Ze(t))}function Ze(e){const t=Ye.has(e.kind)?e.kind:"unknown",n=Math.max(Ve(e),1);return{...e,kind:t,version:n,html:typeof e.html=="string"?e.html:""}}function Xe(e,t={}){const n=t.blockIds!==!1,r=I(e).map(o=>Je(o,{blockIds:n})).join("");return t.wrapper!=="content"?r:`<div class="aeriz-wysiwyg aeriz-wysiwyg-viewer"${t.theme?` data-theme="${t.theme}"`:""}><div class="aw-content-wrap"><div class="aw-content">${r}</div></div></div>`}function Je(e,t={}){const n=t.blockIds===!1?"":` ${se}="${p(e.id)}"`,r=V(e.html),i=(e.style?` style="${p(e.style)}"`:"")+Qe(e.attributes),o=s=>{var a;const c=de(s,(a=e.attributes)==null?void 0:a.class);return c?` class="${p(c)}"`:""};switch(e.kind){case"paragraph":return`<p${n}${i}>${r||"<br>"}</p>`;case"unknown":{const s=ue(e.attrs.tag);return`<${s}${n}${i}>${r||"<br>"}</${s}>`}case"heading":{const s=et(e.attrs.level);return`<h${s}${n}${i}>${r||"<br>"}</h${s}>`}case"bulletList":return`<ul${n}${i}>${r||"<li><br></li>"}</ul>`;case"orderedList":return`<ol${n}${i}>${r||"<li><br></li>"}</ol>`;case"taskList":return`<ul${o(fe)}${n}${i}>${r||"<li><br></li>"}</ul>`;case"blockquote":return`<blockquote${n}${i}>${r||"<p><br></p>"}</blockquote>`;case"codeBlock":{if(r)return`<pre${n}${i}>${r}</pre>`;const s=e.attrs.language,c=s?` data-language="${p(s)}"`:"";return`<pre${n}${i}><code${c}></code></pre>`}case"callout":{const s=U(e.attrs.variant),c=`${me} ${he}${s}`;return`<aside${o(c)}${n}${i}>${r||"<p><br></p>"}</aside>`}case"toggle":return`<details${e.attrs.open?" open":""}${n}${i}>${r||tt()}</details>`;case"table":return`<table${n}${i}>${r||nt(e.attrs.rows,e.attrs.cols)}</table>`;case"hr":return`<hr${n}${i}>`;case"image":return r?`<figure${n}${i}>${C(r)}</figure>`:rt(e.attrs,n,i);case"youtube":{if(!r)return it(e.attrs,n,i,o);const s=G(e.attrs.videoId),c=s?` data-youtube-id="${p(s)}"`:"";return`<div${o("aw-youtube-embed")}${c}${n}${i}>${C(r)}</div>`}case"linkCard":return ot(e.attrs,n,i,r,o);case"file":return st(e.attrs,n,i,r,o);case"importedHtml":{const s=e.attrs.importedStyle,c=e.style?i:s?` style="${p(s)}"`:"";return`<div data-imported-html="true"${o(e.attrs.importedClass)}${c}${n}>${r}</div>`}default:return""}}function Qe(e){if(!e)return"";let t="";for(const n of ce){if(n==="class")continue;const r=e[n];r===void 0||r===""||(t+=` ${n}="${p(r)}"`)}return t}const z=/aw-block-align-controls|aw-resize-handle/;function C(e){if(!z.test(e))return e;const t=k(e).filter(n=>!(n.type==="element"&&z.test(n.attrs.class??"")));return O(t)}function et(e){return e===void 0||e<1?1:e>6?6:e}function tt(){return`<summary class="${$e}"><br></summary><div class="${we}"><p><br></p></div>`}function nt(e,t){const n=Math.max(1,Number.isFinite(e)?e:1),r=Math.max(1,Number.isFinite(t)?t:1);return`<tbody>${`<tr>${"<td><br></td>".repeat(r)}</tr>`.repeat(n)}</tbody>`}function rt(e,t,n){const r=n||(e.wrapperStyle?` style="${p(e.wrapperStyle)}"`:""),i=y(e.src),o=i?` src="${p(i)}"`:"",s=` alt="${p(e.alt??"")}"`,c=e.caption?`<figcaption>${$(e.caption)}</figcaption>`:"";return`<figure${t}${r}><img${o}${s}>${c}</figure>`}function it(e,t,n,r){const i=G(e.videoId),o=n||(e.wrapperStyle?` style="${p(e.wrapperStyle)}"`:""),s=i?` data-youtube-id="${p(i)}"`:"",c=i?` src="${p(`${N}${i}`)}"`:"";return`<div${r("aw-youtube-embed")}${s}${t}${o}><iframe${c} allow="${p(ie)}" allowfullscreen frameborder="0" referrerpolicy="strict-origin-when-cross-origin"></iframe></div>`}function ot(e,t,n,r,i){const o=L(e.href)||"#",s=e.text&&e.text.length>0?e.text:F(o)||o,c=e.description??"",a=y(e.image),u=e.favicon?y(e.favicon):te(o),l=`<a${i(a?"aw-link-card aw-link-card-with-image":"aw-link-card")} href="${p(o)}" target="_blank" rel="noopener"${t}${n}>`;if(r)return`${l}${C(r)}</a>`;let f=l;return a&&(f+=`<img class="aw-link-card-image" src="${p(a)}" alt="" loading="lazy">`),f+='<span class="aw-link-card-body">',f+=`<span class="aw-link-card-title">${$(s)}</span>`,c&&(f+=`<span class="aw-link-card-desc">${$(c)}</span>`),f+='<span class="aw-link-card-url">',u&&(f+=`<img class="aw-link-card-favicon" src="${p(u)}" alt="" loading="lazy">`),f+=`<span class="aw-link-card-url-text">${$(o)}</span>`,f+="</span></span></a>",f}function st(e,t,n,r,i){const o=L(e.fileSrc),s=o?` href="${p(o)}"`:"",c=e.fileName?` data-file-name="${p(e.fileName)}"`:"",a=e.fileSize!==void 0?` data-file-size="${p(String(e.fileSize))}"`:"",u=e.fileType?` data-file-type="${p(e.fileType)}"`:"",d=` download="${p(e.fileName??"")}"`,l=[],f=ee(e.fileName,e.fileType);f&&l.push(f),e.fileSize!==void 0&&l.push(Q(e.fileSize));const w=`<a${i("aw-file-attachment")} target="_blank" rel="noopener"${s}${d}${c}${a}${u}${t}${n}>`;if(r)return`${w}${C(r)}</a>`;let g=w;return g+=`<span class="aw-file-icon" aria-hidden="true">${ne}</span>`,g+='<span class="aw-file-meta">',g+=`<span class="aw-file-name">${$(e.fileName??oe)}</span>`,l.length>0&&(g+=`<span class="aw-file-info">${$(l.join(" · "))}</span>`),g+="</span>",g+=`<span class="aw-file-action" aria-hidden="true">${re}</span>`,g+="</a>",g}const at=/([\\`*_[\]<])/g,ct=/^([#>|+-]|\d+\.)/;function lt(e,t={}){const n=t.bullet??"-",r=t.gfmTables!==!1,i=[];for(const o of I(e)){const s=ut(o,n,r);s!==""&&i.push(s)}return i.length>0?`${i.join(`
8
8
 
9
9
  `)}
10
- `:""}function je(e,t,n){var i,o,c,a;const r=S(e.html);switch(e.kind){case"paragraph":case"unknown":{const s=w(r).trim();return s===""?"":F(s)}case"heading":{const s=Math.min(6,Math.max(1,e.attrs.level??1)),u=w(r).trim();return u===""?"":`${"#".repeat(s)} ${u}`}case"bulletList":return x(r,{ordered:!1,bullet:t,depth:0});case"orderedList":return x(r,{ordered:!0,bullet:t,depth:0});case"taskList":return x(r,{ordered:!1,bullet:t,depth:0,task:!0});case"blockquote":{const s=L(r,"p"),d=(s.length>0?s.map(l=>w(l.children).trim()):[w(r).trim()]).filter(l=>l!=="").join(`
10
+ `:""}function ut(e,t,n){var i,o,s,c;const r=k(e.html);switch(e.kind){case"paragraph":case"unknown":{const a=h(r).trim();return a===""?"":H(a)}case"heading":{const a=Math.min(6,Math.max(1,e.attrs.level??1)),u=h(r).trim();return u===""?"":`${"#".repeat(a)} ${u}`}case"bulletList":return E(r,{ordered:!1,bullet:t,depth:0});case"orderedList":return E(r,{ordered:!0,bullet:t,depth:0});case"taskList":return E(r,{ordered:!1,bullet:t,depth:0,task:!0});case"blockquote":{const a=_(r,"p"),d=(a.length>0?a.map(l=>h(l.children).trim()):[h(r).trim()]).filter(l=>l!=="").join(`
11
11
 
12
12
  `).split(`
13
13
  `).map(l=>l===""?">":`> ${l}`);return d.length>0&&d[0]!==void 0?d.join(`
14
- `):""}case"codeBlock":{const s=L(r,"code")[0],u=N(s?s.children:r).replace(/\n$/,""),d=e.attrs.language??(s==null?void 0:s.attrs["data-language"])??"",l="`".repeat(Math.max(3,Y(u)+1));return`${l}${d}
14
+ `):""}case"codeBlock":{const a=_(r,"code")[0],u=M(a?a.children:r).replace(/\n$/,""),d=e.attrs.language??(a==null?void 0:a.attrs["data-language"])??"",l="`".repeat(Math.max(3,X(u)+1));return`${l}${d}
15
15
  ${u}
16
- ${l}`}case"image":{const s=e.attrs.src??"";if(s==="")return"";const u=`![${b(e.attrs.alt??"")}](${T(s)})`,d=(i=e.attrs.caption)==null?void 0:i.trim();return d?`${u}
17
- *${b(d)}*`:u}case"table":return n?He(r):`<table>${e.html}</table>`;case"hr":return"---";case"linkCard":{const s=e.attrs.href??"";if(s==="")return"";const u=((o=e.attrs.text)==null?void 0:o.trim())||s,d=`[${b(u)}](${T(s)})`,l=(c=e.attrs.description)==null?void 0:c.trim();return l?`${d}
16
+ ${l}`}case"image":{const a=e.attrs.src??"";if(a==="")return"";const u=`![${b(e.attrs.alt??"")}](${v(a)})`,d=(i=e.attrs.caption)==null?void 0:i.trim();return d?`${u}
17
+ *${b(d)}*`:u}case"table":return n&&!Z(r)?dt(r):`<table>${e.html}</table>`;case"hr":return"---";case"linkCard":{const a=e.attrs.href??"";if(a==="")return"";const u=((o=e.attrs.text)==null?void 0:o.trim())||a,d=`[${b(u)}](${v(a)})`,l=(s=e.attrs.description)==null?void 0:s.trim();return l?`${d}
18
18
 
19
- ${F(b(l))}`:d}case"youtube":{const s=e.attrs.videoId;return s?`[YouTube](${R}${encodeURIComponent(s)})`:""}case"file":{const s=e.attrs.fileSrc??"";if(s==="")return"";const u=((a=e.attrs.fileName)==null?void 0:a.trim())||s;return`[${b(u)}](${T(s)})`}case"importedHtml":return e.html.trim();default:return""}}function x(e,t){const n=L(e,"li");if(n.length===0)return"";const r=" ".repeat(t.depth),i=[];return n.forEach((o,c)=>{const a=[],s=[];for(const p of o.children)p.type==="element"&&(p.tag==="ul"||p.tag==="ol")?s.push(p):a.push(p);const u=t.ordered?`${c+1}.`:t.bullet,d=t.task?`${u} ${o.attrs[de]==="true"?"[x]":"[ ]"}`:u,l=w(a).trim(),$=`${r}${" ".repeat(d.length+1)}`,h=l.split(`
19
+ ${H(b(l))}`:d}case"youtube":{const a=e.attrs.videoId;return a?`[YouTube](${N}${encodeURIComponent(a)})`:""}case"file":{const a=e.attrs.fileSrc??"";if(a==="")return"";const u=((c=e.attrs.fileName)==null?void 0:c.trim())||a;return`[${b(u)}](${v(a)})`}case"callout":{const a=U(e.attrs.variant),u=_(r,"p"),l=(u.length>0?u.map(f=>h(f.children).trim()):[h(r).trim()]).filter(f=>f!=="").join(`
20
+
21
+ `).split(`
22
+ `).map(f=>f===""?">":`> ${f}`);return[`> [!${a.toUpperCase()}]`,...l].join(`
23
+ `)}case"toggle":{const a=W(r,"summary"),u=a?h(a.children).trim():"",d=r.filter(f=>f.type!=="element"||f.tag!=="summary"),l=h(d).trim();return["<details>",`<summary>${u}</summary>`,"",l,"</details>"].join(`
24
+ `)}case"importedHtml":return e.html.trim();default:return""}}function E(e,t){const n=_(e,"li");if(n.length===0)return"";const r=" ".repeat(t.depth),i=[];return n.forEach((o,s)=>{const c=[],a=[];for(const g of o.children)g.type==="element"&&(g.tag==="ul"||g.tag==="ol")?a.push(g):c.push(g);const u=t.ordered?`${s+1}.`:t.bullet,d=t.task?`${u} ${o.attrs[pe]==="true"?"[x]":"[ ]"}`:u,l=h(c).trim(),f=`${r}${" ".repeat(d.length+1)}`,w=l.split(`
20
25
  `).join(`
21
- ${$}`);i.push(`${r}${d} ${h}`);for(const p of s){const A=x(p.children,{ordered:p.tag==="ol",bullet:t.bullet,depth:t.depth+1});A!==""&&i.push(A)}}),i.join(`
22
- `)}function He(e){const t=[],n=d=>{for(const l of d)if(l.type==="element"){if(l.tag==="tr"){t.push(l);continue}(l.tag==="tbody"||l.tag==="thead"||l.tag==="tfoot")&&n(l.children)}};if(n(e),t.length===0)return"";const r=t.map(d=>d.children.filter(l=>l.type==="element"&&(l.tag==="td"||l.tag==="th")).map(l=>Fe(l.children))),i=r.reduce((d,l)=>Math.max(d,l.length),0);if(i===0)return"";const o=d=>d.length===i?d:[...d,...Array(i-d.length).fill("")],[c,...a]=r.map(o);return[`| ${(c??Array(i).fill("")).join(" | ")} |`,`| ${Array(i).fill("---").join(" | ")} |`,...a.map(d=>`| ${d.join(" | ")} |`)].join(`
23
- `)}function Fe(e){return w(e,{inTableCell:!0}).replace(/\n+/g,"<br>").replace(/\|/g,"\\|").trim()}function w(e,t={}){let n="";for(const r of e){if(r.type==="text"){n+=b(r.value);continue}const i=()=>w(r.children,t);switch(r.tag){case"br":n+=t.inTableCell?`
26
+ ${f}`);i.push(`${r}${d} ${w}`);for(const g of a){const A=E(g.children,{ordered:g.tag==="ol",bullet:t.bullet,depth:t.depth+1});A!==""&&i.push(A)}}),i.join(`
27
+ `)}function Z(e){return e.some(t=>t.type==="element"&&((t.tag==="td"||t.tag==="th")&&(Number(t.attrs.rowspan)>1||Number(t.attrs.colspan)>1)||Z(t.children)))}function dt(e){const t=[],n=d=>{for(const l of d)if(l.type==="element"){if(l.tag==="tr"){t.push(l);continue}(l.tag==="tbody"||l.tag==="thead"||l.tag==="tfoot")&&n(l.children)}};if(n(e),t.length===0)return"";const r=t.map(d=>d.children.filter(l=>l.type==="element"&&(l.tag==="td"||l.tag==="th")).map(l=>ft(l.children))),i=r.reduce((d,l)=>Math.max(d,l.length),0);if(i===0)return"";const o=d=>d.length===i?d:[...d,...Array(i-d.length).fill("")],[s,...c]=r.map(o);return[`| ${(s??Array(i).fill("")).join(" | ")} |`,`| ${Array(i).fill("---").join(" | ")} |`,...c.map(d=>`| ${d.join(" | ")} |`)].join(`
28
+ `)}function ft(e){return h(e,{inTableCell:!0}).replace(/\n+/g,"<br>").replace(/\|/g,"\\|").trim()}function h(e,t={}){let n="";for(const r of e){if(r.type==="text"){n+=b(r.value);continue}const i=()=>h(r.children,t);switch(r.tag){case"br":n+=t.inTableCell?`
24
29
  `:`
25
- `;break;case"b":case"strong":{const o=i();n+=o.trim()===""?o:`**${o}**`;break}case"i":case"em":{const o=i();n+=o.trim()===""?o:`*${o}*`;break}case"s":case"del":case"strike":{const o=i();n+=o.trim()===""?o:`~~${o}~~`;break}case"code":{const o=N(r.children),c="`".repeat(Y(o)+1),a=o.startsWith("`")||o.endsWith("`")?" ":"";n+=`${c}${a}${o}${a}${c}`;break}case"a":{const o=r.attrs.href,c=i();n+=o?`[${c}](${T(o)})`:c;break}case"img":{const o=r.attrs.src;o&&(n+=`![${b(r.attrs.alt??"")}](${T(o)})`);break}case"u":case"sub":case"sup":case"mark":n+=`<${r.tag}>${i()}</${r.tag}>`;break;default:n+=i();break}}return n}function b(e){return e.replace(Re,"\\$1")}function F(e){return e.replace(Be,"\\$1")}function Y(e){let t=0,n=0;for(const r of e)r==="`"?(n+=1,n>t&&(t=n)):n=0;return t}function T(e){const t=e.trim();return/[\s()]/.test(t)?`<${t.replace(/[<>]/g,"")}>`:t}function Ue(e,t={}){const n=t.blockSeparator??`
30
+ `;break;case"b":case"strong":{const o=i();n+=o.trim()===""?o:`**${o}**`;break}case"i":case"em":{const o=i();n+=o.trim()===""?o:`*${o}*`;break}case"s":case"del":case"strike":{const o=i();n+=o.trim()===""?o:`~~${o}~~`;break}case"code":{const o=M(r.children),s="`".repeat(X(o)+1),c=o.startsWith("`")||o.endsWith("`")?" ":"";n+=`${s}${c}${o}${c}${s}`;break}case"a":{const o=r.attrs.href,s=i();n+=o?`[${s}](${v(o)})`:s;break}case"img":{const o=r.attrs.src;o&&(n+=`![${b(r.attrs.alt??"")}](${v(o)})`);break}case"u":case"sub":case"sup":case"mark":n+=`<${r.tag}>${i()}</${r.tag}>`;break;default:n+=i();break}}return n}function b(e){return e.replace(at,"\\$1")}function H(e){return e.replace(ct,"\\$1")}function X(e){let t=0,n=0;for(const r of e)r==="`"?(n+=1,n>t&&(t=n)):n=0;return t}function v(e){const t=e.trim();return/[\s()]/.test(t)?`<${t.replace(/[<>]/g,"")}>`:t}function pt(e,t={}){const n=t.blockSeparator??`
26
31
 
27
- `,r=t.cellSeparator??" ",i=[];for(const o of M(e)){const c=We(o,r);c!==""&&i.push(c)}return i.join(n)}function We(e,t){switch(e.kind){case"hr":case"youtube":return"";case"image":return y([e.attrs.alt,e.attrs.caption].filter(Boolean).join(`
28
- `));case"linkCard":return y(e.attrs.text??e.attrs.href??"");case"file":return y(e.attrs.fileName??"");case"bulletList":case"orderedList":case"taskList":return L(S(e.html),"li").map(r=>y(E(r.children))).filter(r=>r!=="").join(`
29
- `);case"table":return qe(S(e.html),t);default:return y(E(S(e.html)))}}function qe(e,t){const n=[],r=i=>{for(const o of i)o.type==="element"&&(o.tag==="tr"?n.push(o):["tbody","thead","tfoot"].includes(o.tag)&&r(o.children))};return r(e),n.map(i=>i.children.filter(o=>o.type==="element"&&(o.tag==="td"||o.tag==="th")).map(o=>y(E(o.children)).replace(/\n+/g," ")).join(t)).filter(i=>i.replace(new RegExp(De(t),"g"),"").trim()!=="").join(`
30
- `)}function y(e){return e.replace(oe,"").split(`
32
+ `,r=t.cellSeparator??" ",i=[];for(const o of I(e)){const s=gt(o,r);s!==""&&i.push(s)}return i.join(n)}function gt(e,t){switch(e.kind){case"hr":case"youtube":return"";case"image":return S([e.attrs.alt,e.attrs.caption].filter(Boolean).join(`
33
+ `));case"linkCard":return S(e.attrs.text??e.attrs.href??"");case"file":return S(e.attrs.fileName??"");case"bulletList":case"orderedList":case"taskList":return _(k(e.html),"li").map(r=>S(x(r.children))).filter(r=>r!=="").join(`
34
+ `);case"table":return mt(k(e.html),t);default:return S(x(k(e.html)))}}function mt(e,t){const n=[],r=i=>{for(const o of i)o.type==="element"&&(o.tag==="tr"?n.push(o):["tbody","thead","tfoot"].includes(o.tag)&&r(o.children))};return r(e),n.map(i=>i.children.filter(o=>o.type==="element"&&(o.tag==="td"||o.tag==="th")).map(o=>S(x(o.children)).replace(/\n+/g," ")).join(t)).filter(i=>i.replace(new RegExp(ht(t),"g"),"").trim()!=="").join(`
35
+ `)}function S(e){return e.replace(ae,"").split(`
31
36
  `).map(t=>t.replace(/[^\S\n]+/g," ").trim()).join(`
32
37
  `).replace(/\n{3,}/g,`
33
38
 
34
- `).trim()}function De(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}exports.SNAPSHOT_VERSION=Se;exports.blocksToMarkdown=ze;exports.blocksToPlainText=Ue;exports.decodeEntities=k;exports.escapeAttr=f;exports.escapeHtml=g;exports.parseHtmlFragment=S;exports.renderBlockToHTML=Te;exports.renderBlocksToHTML=Ae;exports.serializeNodes=C;exports.snapshotVersionOf=K;exports.textOf=N;exports.textWithBlockBreaks=E;exports.upgradeSnapshot=B;exports.upgradeSnapshots=M;
39
+ `).trim()}function ht(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}exports.SNAPSHOT_VERSION=Ke;exports.blocksToMarkdown=lt;exports.blocksToPlainText=pt;exports.renderBlocksToHTML=Xe;exports.sanitizeHTML=V;exports.upgradeSnapshots=I;