revise 1.0.0 → 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 (104) hide show
  1. package/CHANGELOG.md +962 -0
  2. package/FONT-LICENSE-HAN-EXT-B.txt +91 -0
  3. package/FONT-LICENSE-KATEX.txt +95 -0
  4. package/FONT-LICENSE-LIBERATION.txt +102 -0
  5. package/FONT-LICENSE-NOTO-MULTILINGUAL.txt +93 -0
  6. package/FONT-LICENSE-NOTO-SANS-SC.txt +93 -0
  7. package/FONT-LICENSE-NOTO.txt +94 -0
  8. package/FONT-LICENSE-SOURCE-CODE-PRO.txt +94 -0
  9. package/FONT-LICENSE-SOURCE-SERIF-4.txt +93 -0
  10. package/LICENSE +41 -21
  11. package/README.md +39 -1
  12. package/THIRD-PARTY-NOTICES.md +3376 -0
  13. package/assets/historyMaterializeWorker-CoAX9ZAi.js +3 -0
  14. package/backend.d.ts +133 -0
  15. package/backend.js +1 -0
  16. package/chunks/AgentPageRenderer-C0n4EnuW.js +1 -0
  17. package/chunks/AgentPageRenderer-DURfmiu0.js +1 -0
  18. package/chunks/AttachmentDocumentImporter-DSic_6At.js +1 -0
  19. package/chunks/AttachmentDocumentImporter-dNMtkxrv.js +1 -0
  20. package/chunks/BidiText-B4Hzrjg9.js +1 -0
  21. package/chunks/ColorParserFull-BKH72fK8.js +1 -0
  22. package/chunks/DocumentStylesheet-byN5dtC6.js +1 -0
  23. package/chunks/DocxConverter-B7P52lw7.js +11 -0
  24. package/chunks/DocxConverter-COV6CjUM.js +11 -0
  25. package/chunks/DocxConverter-Cq_zCEJC.js +11 -0
  26. package/chunks/DocxGraft-CJ12C9WP.js +1 -0
  27. package/chunks/DocxGraft-CQpvFcYb.js +1 -0
  28. package/chunks/DocxGraft-DcmFuUkd.js +1 -0
  29. package/chunks/FileImporter-DVnYOJHp.js +1 -0
  30. package/chunks/FileImporter-q9mCch0J.js +1 -0
  31. package/chunks/HorizontalRuleOrnaments-gmUZ3R7Q.js +1 -0
  32. package/chunks/HtmlConverter-JvRlkQM3.js +61 -0
  33. package/chunks/ListNumbering-Qlu6AuRZ.js +1 -0
  34. package/chunks/MarkdownConverter-B-tPY7X3.js +17 -0
  35. package/chunks/MathRenderer-B0Y1h1JU.js +33 -0
  36. package/chunks/OdtConverter-Br81BSoJ.js +1 -0
  37. package/chunks/OdtConverter-CQjh0vlo.js +1 -0
  38. package/chunks/OdtConverter-DYHnR4E8.js +1 -0
  39. package/chunks/PdfConverter-D26rXumc.js +21 -0
  40. package/chunks/PdfConverter-DGZpUSVf.js +21 -0
  41. package/chunks/PdfConverter-DZzVP0-B.js +21 -0
  42. package/chunks/PdfImportService-CBD8TL1k.js +2 -0
  43. package/chunks/PdfImportService-D6uUKGMf.js +2 -0
  44. package/chunks/RtfConverter-BQGge3K-.js +14 -0
  45. package/chunks/RtfConverter-CMfZ4olw.js +14 -0
  46. package/chunks/RtfConverter-oIwzoqCD.js +14 -0
  47. package/chunks/TableBorders-BLkZYt1k.js +1 -0
  48. package/chunks/TableGrid-DVWaRZv0.js +1 -0
  49. package/chunks/TextFileDecoder--rsVs3NR.js +2 -0
  50. package/chunks/TxtConverter-C1lp6dBS.js +11 -0
  51. package/chunks/__vite-browser-external-l0sNRNKZ.js +0 -0
  52. package/chunks/_commonjsHelpers-DaMA6jEr.js +1 -0
  53. package/chunks/_revise-sdk-lazy-harfbuzz-CDWdjF9f.js +1 -0
  54. package/chunks/_revise-sdk-lazy-harfbuzz-X8gnYTZL.js +1 -0
  55. package/chunks/ar-kgSWdrXF.js +8 -0
  56. package/chunks/backend-Cq-khfdG.js +1 -0
  57. package/chunks/base64-CfDUyGi8.js +36 -0
  58. package/chunks/browser-module-6b2Fq-5C.js +3 -0
  59. package/chunks/browser-module-CFmqfGkE.js +3 -0
  60. package/chunks/browser-module-CkO57IPL.js +3 -0
  61. package/chunks/bundle.min-DRpfgV69.js +8 -0
  62. package/chunks/capture-DU3MC7tb.js +1 -0
  63. package/chunks/carrier-WgcRSu7a.js +1 -0
  64. package/chunks/de-C2QTHrqo.js +8 -0
  65. package/chunks/es-BKboUn4q.js +8 -0
  66. package/chunks/footnoteFlatten-CW-DUcgK.js +1 -0
  67. package/chunks/graftExport-CVg7PO2A.js +2 -0
  68. package/chunks/html2canvas.esm-CntiHiYW.js +5 -0
  69. package/chunks/index-BWdRWxoH.js +24 -0
  70. package/chunks/index-CLw_BlSL.js +353 -0
  71. package/chunks/index-F-kHIwWT.js +353 -0
  72. package/chunks/index.es-CI0QPo8w.js +5 -0
  73. package/chunks/index.es-DOqegDGr.js +5 -0
  74. package/chunks/index.es-tXDO0RMv.js +5 -0
  75. package/chunks/jspdf.es.min-CzYti8jo.js +77 -0
  76. package/chunks/jspdf.es.min-DU74zN8b.js +77 -0
  77. package/chunks/jspdf.es.min-ejWOGhkJ.js +77 -0
  78. package/chunks/jszip.min-CPW0h1Kx.js +2 -0
  79. package/chunks/katex-DWj8TvwO.js +261 -0
  80. package/chunks/pdf-BLWDCiFF.js +12 -0
  81. package/chunks/persistInlineDocumentImages-DQj2iaqg.js +1 -0
  82. package/chunks/pseudoLocale-CdBtPHRi.js +1 -0
  83. package/chunks/pseudoLocale-DEVWLkGC.js +1 -0
  84. package/chunks/purify.es-BwLardii.js +2 -0
  85. package/chunks/serverDocumentSession-DZrYbdpk.js +42 -0
  86. package/chunks/tree-sitter-D6zWWUMP.js +4 -0
  87. package/chunks/wasmInline.generated-CBYFkdSM.js +1 -0
  88. package/chunks/web-tree-sitter-BXGZGnNj.js +1 -0
  89. package/full.js +1 -0
  90. package/index.d.ts +929 -0
  91. package/index.js +1 -0
  92. package/package.json +93 -26
  93. package/root.d.ts +5 -0
  94. package/root.js +2 -0
  95. package/serverToolContract.d.ts +373 -0
  96. package/serverToolInputs.generated.d.ts +229 -0
  97. package/style.css +1 -0
  98. package/.npmignore +0 -4
  99. package/.travis.yml +0 -16
  100. package/revise.js +0 -16
  101. package/t/cover +0 -18
  102. package/t/revise/comparator.t.js +0 -31
  103. package/t/revise/extractor.t.js +0 -29
  104. package/t/test +0 -20
@@ -0,0 +1 @@
1
+ const m="https://app-api.revise-sdk.invalid";async function h(t,r,n,e,o){const i={"Content-Type":"application/json"},a=await fetch(`${m}/uploads/images/presign`,{method:"POST",headers:i,body:JSON.stringify({fileName:r,contentType:n,fileSize:t.size,prefix:o})});if(!a.ok){const p=await a.text();throw new Error(p||"Failed to get upload URL")}const s=await a.json(),c=new Headers,l={...s.headers||{},"Content-Type":s.contentType||n};for(const[p,u]of Object.entries(l))u&&c.set(p,u);if(!(await fetch(s.uploadUrl,{method:s.method||"PUT",body:t,headers:c})).ok)throw new Error("Failed to upload to storage");return s.fileUrl}const g=/^data:(image\/(?:png|jpe?g|gif|bmp|x-emf|x-wmf));base64,([a-z0-9+/=\s]+)$/i,y=4;function d(t){switch(t.toLowerCase()){case"image/jpeg":case"image/jpg":return"jpg";case"image/gif":return"gif";case"image/bmp":return"bmp";case"image/x-emf":return"emf";case"image/x-wmf":return"wmf";default:return"png"}}function w(t){const r=t.replace(/\s+/g,"");if(typeof Buffer<"u")return new Uint8Array(Buffer.from(r,"base64"));const n=atob(r),e=new Uint8Array(n.length);for(let o=0;o<n.length;o++)e[o]=n.charCodeAt(o);return e}function f(t,r){if(Array.isArray(t)){for(const e of t)f(e,r);return}if(!t||typeof t!="object")return;const n=t;if(n.type==="image"&&typeof n.src=="string"){const e=t;r.push({src:e.src,replace:o=>{e.src=o}}),e.originalDataUrl&&r.push({src:e.originalDataUrl,replace:o=>{e.originalDataUrl=o}});return}for(const e of Object.values(n))f(e,r)}async function b(t,r){const n=t.match(g);if(!n)return null;try{const e=n[1].toLowerCase(),o=w(n[2]);if(o.byteLength===0)return null;const i=d(e),a=new Blob([Uint8Array.from(o).buffer],{type:e});return await h(a,`docx-import-${r}.${i}`,e,null,"rehosted-images")}catch{return null}}async function U(t){if(typeof window>"u")return;const r=[];f(t.children,r),f(t.notes,r),f(t.chrome,r);const n=new Map;for(const a of r){if(!g.test(a.src))continue;const s=n.get(a.src);s?s.push(a):n.set(a.src,[a])}const e=[...n.keys()];let o=0;const i=Array.from({length:Math.min(y,e.length)},async()=>{for(;o<e.length;){const a=o++,s=e[a],c=await b(s,a);if(c)for(const l of n.get(s)??[])l.replace(c)}});await Promise.all(i)}export{U as persistInlineDocumentImages};
@@ -0,0 +1 @@
1
+ import{R as u}from"./index-F-kHIwWT.js";const a={a:"á",b:"ƀ",c:"ç",d:"ð",e:"é",f:"ƒ",g:"ğ",h:"ĥ",i:"í",j:"ĵ",k:"ķ",l:"ł",m:"ɱ",n:"ñ",o:"ó",p:"þ",q:"ɋ",r:"ř",s:"š",t:"ţ",u:"ú",v:"ṽ",w:"ŵ",x:"ẋ",y:"ý",z:"ž",A:"Á",B:"Ɓ",C:"Ç",D:"Ð",E:"É",F:"Ƒ",G:"Ğ",H:"Ĥ",I:"Í",J:"Ĵ",K:"Ķ",L:"Ł",M:"Ṁ",N:"Ñ",O:"Ó",P:"Þ",Q:"Q",R:"Ř",S:"Š",T:"Ţ",U:"Ú",V:"Ṽ",W:"Ŵ",X:"X",Y:"Ý",Z:"Ž"},h=1.75,l="·";function p(n){let t="";for(const r of n)t+=a[r]??r;return t}function c(n){if(!n)return n;const t=n.match(/^\s*/)?.[0]??"",r=n.match(/\s*$/)?.[0]??"",o=n.slice(t.length,n.length-r.length);if(!o)return n;const e=o.split(/(\{\w+\})/g).map((i,f)=>f%2===1?i:p(i)).join(""),s=Math.max(1,Math.round(o.length*(h-1)));return`${t}⟦${e}${l.repeat(s)}⟧${r}`}function g(n){if(typeof n=="string")return c(n);if(Array.isArray(n))return n.map(c);const t=n,r={};for(const[o,e]of Object.entries(t))r[o]=c(e);return r}function m(){const n={};for(const[t,r]of Object.entries(u))n[t]=g(r);return n}export{m as buildPseudoOverlay};
@@ -0,0 +1 @@
1
+ import{R as u}from"./index-CLw_BlSL.js";const a={a:"á",b:"ƀ",c:"ç",d:"ð",e:"é",f:"ƒ",g:"ğ",h:"ĥ",i:"í",j:"ĵ",k:"ķ",l:"ł",m:"ɱ",n:"ñ",o:"ó",p:"þ",q:"ɋ",r:"ř",s:"š",t:"ţ",u:"ú",v:"ṽ",w:"ŵ",x:"ẋ",y:"ý",z:"ž",A:"Á",B:"Ɓ",C:"Ç",D:"Ð",E:"É",F:"Ƒ",G:"Ğ",H:"Ĥ",I:"Í",J:"Ĵ",K:"Ķ",L:"Ł",M:"Ṁ",N:"Ñ",O:"Ó",P:"Þ",Q:"Q",R:"Ř",S:"Š",T:"Ţ",U:"Ú",V:"Ṽ",W:"Ŵ",X:"X",Y:"Ý",Z:"Ž"},h=1.75,l="·";function p(n){let t="";for(const r of n)t+=a[r]??r;return t}function c(n){if(!n)return n;const t=n.match(/^\s*/)?.[0]??"",r=n.match(/\s*$/)?.[0]??"",o=n.slice(t.length,n.length-r.length);if(!o)return n;const e=o.split(/(\{\w+\})/g).map((i,f)=>f%2===1?i:p(i)).join(""),s=Math.max(1,Math.round(o.length*(h-1)));return`${t}⟦${e}${l.repeat(s)}⟧${r}`}function g(n){if(typeof n=="string")return c(n);if(Array.isArray(n))return n.map(c);const t=n,r={};for(const[o,e]of Object.entries(t))r[o]=c(e);return r}function m(){const n={};for(const[t,r]of Object.entries(u))n[t]=g(r);return n}export{m as buildPseudoOverlay};
@@ -0,0 +1,2 @@
1
+ const{entries:oe,setPrototypeOf:re,isFrozen:Be,getPrototypeOf:Ge,getOwnPropertyDescriptor:Ye}=Object;let{freeze:E,seal:N,create:ae}=Object,{apply:Rt,construct:wt}=typeof Reflect<"u"&&Reflect;E||(E=function(r){return r}),N||(N=function(r){return r}),Rt||(Rt=function(r,o,l){return r.apply(o,l)}),wt||(wt=function(r,o){return new r(...o)});const it=_(Array.prototype.forEach),je=_(Array.prototype.lastIndexOf),ie=_(Array.prototype.pop),X=_(Array.prototype.push),Xe=_(Array.prototype.splice),lt=_(String.prototype.toLowerCase),Ot=_(String.prototype.toString),le=_(String.prototype.match),q=_(String.prototype.replace),qe=_(String.prototype.indexOf),$e=_(String.prototype.trim),b=_(Object.prototype.hasOwnProperty),A=_(RegExp.prototype.test),$=Ke(TypeError);function _(r){return function(o){o instanceof RegExp&&(o.lastIndex=0);for(var l=arguments.length,i=new Array(l>1?l-1:0),h=1;h<l;h++)i[h-1]=arguments[h];return Rt(r,o,i)}}function Ke(r){return function(){for(var o=arguments.length,l=new Array(o),i=0;i<o;i++)l[i]=arguments[i];return wt(r,l)}}function a(r,o){let l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:lt;re&&re(r,null);let i=o.length;for(;i--;){let h=o[i];if(typeof h=="string"){const R=l(h);R!==h&&(Be(o)||(o[i]=R),h=R)}r[h]=!0}return r}function Ve(r){for(let o=0;o<r.length;o++)b(r,o)||(r[o]=null);return r}function C(r){const o=ae(null);for(const[l,i]of oe(r))b(r,l)&&(Array.isArray(i)?o[l]=Ve(i):i&&typeof i=="object"&&i.constructor===Object?o[l]=C(i):o[l]=i);return o}function K(r,o){for(;r!==null;){const i=Ye(r,o);if(i){if(i.get)return _(i.get);if(typeof i.value=="function")return _(i.value)}r=Ge(r)}function l(){return null}return l}const ce=E(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Lt=E(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),vt=E(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Ze=E(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Ct=E(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Je=E(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),se=E(["#text"]),ue=E(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Dt=E(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),me=E(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ct=E(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Qe=N(/\{\{[\w\W]*|[\w\W]*\}\}/gm),tn=N(/<%[\w\W]*|[\w\W]*%>/gm),en=N(/\$\{[\w\W]*/gm),nn=N(/^data-[\-\w.\u00B7-\uFFFF]+$/),on=N(/^aria-[\-\w]+$/),pe=N(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),rn=N(/^(?:\w+script|data):/i),an=N(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),fe=N(/^html$/i),ln=N(/^[a-z][.\w]*(-[.\w]+)+$/i);var de=Object.freeze({__proto__:null,ARIA_ATTR:on,ATTR_WHITESPACE:an,CUSTOM_ELEMENT:ln,DATA_ATTR:nn,DOCTYPE_NAME:fe,ERB_EXPR:tn,IS_ALLOWED_URI:pe,IS_SCRIPT_OR_DATA:rn,MUSTACHE_EXPR:Qe,TMPLIT_EXPR:en});const V={element:1,text:3,progressingInstruction:7,comment:8,document:9},cn=function(){return typeof window>"u"?null:window},sn=function(r,o){if(typeof r!="object"||typeof r.createPolicy!="function")return null;let l=null;const i="data-tt-policy-suffix";o&&o.hasAttribute(i)&&(l=o.getAttribute(i));const h="dompurify"+(l?"#"+l:"");try{return r.createPolicy(h,{createHTML(R){return R},createScriptURL(R){return R}})}catch{return console.warn("TrustedTypes policy "+h+" could not be created."),null}},ge=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function he(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:cn();const o=t=>he(t);if(o.version="3.2.6",o.removed=[],!r||!r.document||r.document.nodeType!==V.document||!r.Element)return o.isSupported=!1,o;let{document:l}=r;const i=l,h=i.currentScript,{DocumentFragment:R,HTMLTemplateElement:Te,Node:st,Element:xt,NodeFilter:F,NamedNodeMap:ye=r.NamedNodeMap||r.MozNamedAttrMap,HTMLFormElement:Ee,DOMParser:Ae,trustedTypes:Z}=r,W=xt.prototype,_e=K(W,"cloneNode"),Ne=K(W,"remove"),Se=K(W,"nextSibling"),be=K(W,"childNodes"),J=K(W,"parentNode");if(typeof Te=="function"){const t=l.createElement("template");t.content&&t.content.ownerDocument&&(l=t.content.ownerDocument)}let T,B="";const{implementation:ut,createNodeIterator:Re,createDocumentFragment:we,getElementsByTagName:Oe}=l,{importNode:Le}=i;let y=ge();o.isSupported=typeof oe=="function"&&typeof J=="function"&&ut&&ut.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:mt,ERB_EXPR:pt,TMPLIT_EXPR:ft,DATA_ATTR:ve,ARIA_ATTR:Ce,IS_SCRIPT_OR_DATA:De,ATTR_WHITESPACE:It,CUSTOM_ELEMENT:xe}=de;let{IS_ALLOWED_URI:kt}=de,m=null;const Mt=a({},[...ce,...Lt,...vt,...Ct,...se]);let f=null;const Ut=a({},[...ue,...Dt,...me,...ct]);let u=Object.seal(ae(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),G=null,dt=null,Pt=!0,gt=!0,zt=!1,Ht=!0,I=!1,Q=!0,D=!1,ht=!1,Tt=!1,k=!1,tt=!1,et=!1,Ft=!0,Wt=!1;const Ie="user-content-";let yt=!0,Y=!1,M={},U=null;const Bt=a({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Gt=null;const Yt=a({},["audio","video","img","source","image","track"]);let Et=null;const jt=a({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),nt="http://www.w3.org/1998/Math/MathML",ot="http://www.w3.org/2000/svg",O="http://www.w3.org/1999/xhtml";let P=O,At=!1,_t=null;const ke=a({},[nt,ot,O],Ot);let rt=a({},["mi","mo","mn","ms","mtext"]),at=a({},["annotation-xml"]);const Me=a({},["title","style","font","a","script"]);let j=null;const Ue=["application/xhtml+xml","text/html"],Pe="text/html";let p=null,z=null;const ze=l.createElement("form"),Xt=function(t){return t instanceof RegExp||t instanceof Function},Nt=function(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(z&&z===t)){if((!t||typeof t!="object")&&(t={}),t=C(t),j=Ue.indexOf(t.PARSER_MEDIA_TYPE)===-1?Pe:t.PARSER_MEDIA_TYPE,p=j==="application/xhtml+xml"?Ot:lt,m=b(t,"ALLOWED_TAGS")?a({},t.ALLOWED_TAGS,p):Mt,f=b(t,"ALLOWED_ATTR")?a({},t.ALLOWED_ATTR,p):Ut,_t=b(t,"ALLOWED_NAMESPACES")?a({},t.ALLOWED_NAMESPACES,Ot):ke,Et=b(t,"ADD_URI_SAFE_ATTR")?a(C(jt),t.ADD_URI_SAFE_ATTR,p):jt,Gt=b(t,"ADD_DATA_URI_TAGS")?a(C(Yt),t.ADD_DATA_URI_TAGS,p):Yt,U=b(t,"FORBID_CONTENTS")?a({},t.FORBID_CONTENTS,p):Bt,G=b(t,"FORBID_TAGS")?a({},t.FORBID_TAGS,p):C({}),dt=b(t,"FORBID_ATTR")?a({},t.FORBID_ATTR,p):C({}),M=b(t,"USE_PROFILES")?t.USE_PROFILES:!1,Pt=t.ALLOW_ARIA_ATTR!==!1,gt=t.ALLOW_DATA_ATTR!==!1,zt=t.ALLOW_UNKNOWN_PROTOCOLS||!1,Ht=t.ALLOW_SELF_CLOSE_IN_ATTR!==!1,I=t.SAFE_FOR_TEMPLATES||!1,Q=t.SAFE_FOR_XML!==!1,D=t.WHOLE_DOCUMENT||!1,k=t.RETURN_DOM||!1,tt=t.RETURN_DOM_FRAGMENT||!1,et=t.RETURN_TRUSTED_TYPE||!1,Tt=t.FORCE_BODY||!1,Ft=t.SANITIZE_DOM!==!1,Wt=t.SANITIZE_NAMED_PROPS||!1,yt=t.KEEP_CONTENT!==!1,Y=t.IN_PLACE||!1,kt=t.ALLOWED_URI_REGEXP||pe,P=t.NAMESPACE||O,rt=t.MATHML_TEXT_INTEGRATION_POINTS||rt,at=t.HTML_INTEGRATION_POINTS||at,u=t.CUSTOM_ELEMENT_HANDLING||{},t.CUSTOM_ELEMENT_HANDLING&&Xt(t.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(u.tagNameCheck=t.CUSTOM_ELEMENT_HANDLING.tagNameCheck),t.CUSTOM_ELEMENT_HANDLING&&Xt(t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(u.attributeNameCheck=t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),t.CUSTOM_ELEMENT_HANDLING&&typeof t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(u.allowCustomizedBuiltInElements=t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),I&&(gt=!1),tt&&(k=!0),M&&(m=a({},se),f=[],M.html===!0&&(a(m,ce),a(f,ue)),M.svg===!0&&(a(m,Lt),a(f,Dt),a(f,ct)),M.svgFilters===!0&&(a(m,vt),a(f,Dt),a(f,ct)),M.mathMl===!0&&(a(m,Ct),a(f,me),a(f,ct))),t.ADD_TAGS&&(m===Mt&&(m=C(m)),a(m,t.ADD_TAGS,p)),t.ADD_ATTR&&(f===Ut&&(f=C(f)),a(f,t.ADD_ATTR,p)),t.ADD_URI_SAFE_ATTR&&a(Et,t.ADD_URI_SAFE_ATTR,p),t.FORBID_CONTENTS&&(U===Bt&&(U=C(U)),a(U,t.FORBID_CONTENTS,p)),yt&&(m["#text"]=!0),D&&a(m,["html","head","body"]),m.table&&(a(m,["tbody"]),delete G.tbody),t.TRUSTED_TYPES_POLICY){if(typeof t.TRUSTED_TYPES_POLICY.createHTML!="function")throw $('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof t.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw $('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');T=t.TRUSTED_TYPES_POLICY,B=T.createHTML("")}else T===void 0&&(T=sn(Z,h)),T!==null&&typeof B=="string"&&(B=T.createHTML(""));E&&E(t),z=t}},qt=a({},[...Lt,...vt,...Ze]),$t=a({},[...Ct,...Je]),He=function(t){let n=J(t);(!n||!n.tagName)&&(n={namespaceURI:P,tagName:"template"});const e=lt(t.tagName),c=lt(n.tagName);return _t[t.namespaceURI]?t.namespaceURI===ot?n.namespaceURI===O?e==="svg":n.namespaceURI===nt?e==="svg"&&(c==="annotation-xml"||rt[c]):!!qt[e]:t.namespaceURI===nt?n.namespaceURI===O?e==="math":n.namespaceURI===ot?e==="math"&&at[c]:!!$t[e]:t.namespaceURI===O?n.namespaceURI===ot&&!at[c]||n.namespaceURI===nt&&!rt[c]?!1:!$t[e]&&(Me[e]||!qt[e]):!!(j==="application/xhtml+xml"&&_t[t.namespaceURI]):!1},x=function(t){X(o.removed,{element:t});try{J(t).removeChild(t)}catch{Ne(t)}},H=function(t,n){try{X(o.removed,{attribute:n.getAttributeNode(t),from:n})}catch{X(o.removed,{attribute:null,from:n})}if(n.removeAttribute(t),t==="is")if(k||tt)try{x(n)}catch{}else try{n.setAttribute(t,"")}catch{}},Kt=function(t){let n=null,e=null;if(Tt)t="<remove></remove>"+t;else{const s=le(t,/^[\r\n\t ]+/);e=s&&s[0]}j==="application/xhtml+xml"&&P===O&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");const c=T?T.createHTML(t):t;if(P===O)try{n=new Ae().parseFromString(c,j)}catch{}if(!n||!n.documentElement){n=ut.createDocument(P,"template",null);try{n.documentElement.innerHTML=At?B:c}catch{}}const d=n.body||n.documentElement;return t&&e&&d.insertBefore(l.createTextNode(e),d.childNodes[0]||null),P===O?Oe.call(n,D?"html":"body")[0]:D?n.documentElement:d},Vt=function(t){return Re.call(t.ownerDocument||t,t,F.SHOW_ELEMENT|F.SHOW_COMMENT|F.SHOW_TEXT|F.SHOW_PROCESSING_INSTRUCTION|F.SHOW_CDATA_SECTION,null)},St=function(t){return t instanceof Ee&&(typeof t.nodeName!="string"||typeof t.textContent!="string"||typeof t.removeChild!="function"||!(t.attributes instanceof ye)||typeof t.removeAttribute!="function"||typeof t.setAttribute!="function"||typeof t.namespaceURI!="string"||typeof t.insertBefore!="function"||typeof t.hasChildNodes!="function")},Zt=function(t){return typeof st=="function"&&t instanceof st};function L(t,n,e){it(t,c=>{c.call(o,n,e,z)})}const Jt=function(t){let n=null;if(L(y.beforeSanitizeElements,t,null),St(t))return x(t),!0;const e=p(t.nodeName);if(L(y.uponSanitizeElement,t,{tagName:e,allowedTags:m}),Q&&t.hasChildNodes()&&!Zt(t.firstElementChild)&&A(/<[/\w!]/g,t.innerHTML)&&A(/<[/\w!]/g,t.textContent)||t.nodeType===V.progressingInstruction||Q&&t.nodeType===V.comment&&A(/<[/\w]/g,t.data))return x(t),!0;if(!m[e]||G[e]){if(!G[e]&&te(e)&&(u.tagNameCheck instanceof RegExp&&A(u.tagNameCheck,e)||u.tagNameCheck instanceof Function&&u.tagNameCheck(e)))return!1;if(yt&&!U[e]){const c=J(t)||t.parentNode,d=be(t)||t.childNodes;if(d&&c){const s=d.length;for(let v=s-1;v>=0;--v){const S=_e(d[v],!0);S.__removalCount=(t.__removalCount||0)+1,c.insertBefore(S,Se(t))}}}return x(t),!0}return t instanceof xt&&!He(t)||(e==="noscript"||e==="noembed"||e==="noframes")&&A(/<\/no(script|embed|frames)/i,t.innerHTML)?(x(t),!0):(I&&t.nodeType===V.text&&(n=t.textContent,it([mt,pt,ft],c=>{n=q(n,c," ")}),t.textContent!==n&&(X(o.removed,{element:t.cloneNode()}),t.textContent=n)),L(y.afterSanitizeElements,t,null),!1)},Qt=function(t,n,e){if(Ft&&(n==="id"||n==="name")&&(e in l||e in ze))return!1;if(!(gt&&!dt[n]&&A(ve,n))&&!(Pt&&A(Ce,n))){if(!f[n]||dt[n]){if(!(te(t)&&(u.tagNameCheck instanceof RegExp&&A(u.tagNameCheck,t)||u.tagNameCheck instanceof Function&&u.tagNameCheck(t))&&(u.attributeNameCheck instanceof RegExp&&A(u.attributeNameCheck,n)||u.attributeNameCheck instanceof Function&&u.attributeNameCheck(n))||n==="is"&&u.allowCustomizedBuiltInElements&&(u.tagNameCheck instanceof RegExp&&A(u.tagNameCheck,e)||u.tagNameCheck instanceof Function&&u.tagNameCheck(e))))return!1}else if(!Et[n]&&!A(kt,q(e,It,""))&&!((n==="src"||n==="xlink:href"||n==="href")&&t!=="script"&&qe(e,"data:")===0&&Gt[t])&&!(zt&&!A(De,q(e,It,"")))&&e)return!1}return!0},te=function(t){return t!=="annotation-xml"&&le(t,xe)},ee=function(t){L(y.beforeSanitizeAttributes,t,null);const{attributes:n}=t;if(!n||St(t))return;const e={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:f,forceKeepAttr:void 0};let c=n.length;for(;c--;){const d=n[c],{name:s,namespaceURI:v,value:S}=d,w=p(s),bt=S;let g=s==="value"?bt:$e(bt);if(e.attrName=w,e.attrValue=g,e.keepAttr=!0,e.forceKeepAttr=void 0,L(y.uponSanitizeAttribute,t,e),g=e.attrValue,Wt&&(w==="id"||w==="name")&&(H(s,t),g=Ie+g),Q&&A(/((--!?|])>)|<\/(style|title)/i,g)){H(s,t);continue}if(e.forceKeepAttr)continue;if(!e.keepAttr){H(s,t);continue}if(!Ht&&A(/\/>/i,g)){H(s,t);continue}I&&it([mt,pt,ft],We=>{g=q(g,We," ")});const ne=p(t.nodeName);if(!Qt(ne,w,g)){H(s,t);continue}if(T&&typeof Z=="object"&&typeof Z.getAttributeType=="function"&&!v)switch(Z.getAttributeType(ne,w)){case"TrustedHTML":{g=T.createHTML(g);break}case"TrustedScriptURL":{g=T.createScriptURL(g);break}}if(g!==bt)try{v?t.setAttributeNS(v,s,g):t.setAttribute(s,g),St(t)?x(t):ie(o.removed)}catch{H(s,t)}}L(y.afterSanitizeAttributes,t,null)},Fe=function t(n){let e=null;const c=Vt(n);for(L(y.beforeSanitizeShadowDOM,n,null);e=c.nextNode();)L(y.uponSanitizeShadowNode,e,null),Jt(e),ee(e),e.content instanceof R&&t(e.content);L(y.afterSanitizeShadowDOM,n,null)};return o.sanitize=function(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},e=null,c=null,d=null,s=null;if(At=!t,At&&(t="<!-->"),typeof t!="string"&&!Zt(t))if(typeof t.toString=="function"){if(t=t.toString(),typeof t!="string")throw $("dirty is not a string, aborting")}else throw $("toString is not a function");if(!o.isSupported)return t;if(ht||Nt(n),o.removed=[],typeof t=="string"&&(Y=!1),Y){if(t.nodeName){const w=p(t.nodeName);if(!m[w]||G[w])throw $("root node is forbidden and cannot be sanitized in-place")}}else if(t instanceof st)e=Kt("<!---->"),c=e.ownerDocument.importNode(t,!0),c.nodeType===V.element&&c.nodeName==="BODY"||c.nodeName==="HTML"?e=c:e.appendChild(c);else{if(!k&&!I&&!D&&t.indexOf("<")===-1)return T&&et?T.createHTML(t):t;if(e=Kt(t),!e)return k?null:et?B:""}e&&Tt&&x(e.firstChild);const v=Vt(Y?t:e);for(;d=v.nextNode();)Jt(d),ee(d),d.content instanceof R&&Fe(d.content);if(Y)return t;if(k){if(tt)for(s=we.call(e.ownerDocument);e.firstChild;)s.appendChild(e.firstChild);else s=e;return(f.shadowroot||f.shadowrootmode)&&(s=Le.call(i,s,!0)),s}let S=D?e.outerHTML:e.innerHTML;return D&&m["!doctype"]&&e.ownerDocument&&e.ownerDocument.doctype&&e.ownerDocument.doctype.name&&A(fe,e.ownerDocument.doctype.name)&&(S="<!DOCTYPE "+e.ownerDocument.doctype.name+`>
2
+ `+S),I&&it([mt,pt,ft],w=>{S=q(S,w," ")}),T&&et?T.createHTML(S):S},o.setConfig=function(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Nt(t),ht=!0},o.clearConfig=function(){z=null,ht=!1},o.isValidAttribute=function(t,n,e){z||Nt({});const c=p(t),d=p(n);return Qt(c,d,e)},o.addHook=function(t,n){typeof n=="function"&&X(y[t],n)},o.removeHook=function(t,n){if(n!==void 0){const e=je(y[t],n);return e===-1?void 0:Xe(y[t],e,1)[0]}return ie(y[t])},o.removeHooks=function(t){y[t]=[]},o.removeAllHooks=function(){y=ge()},o}var un=he();export{un as default};