trix
Version:
A rich text editor for everyday writing
6 lines • 208 kB
JavaScript
/*
Trix 2.1.19
Copyright © 2026 37signals, LLC
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Trix=e()}(this,(function(){"use strict";var t="2.1.19";const e="[data-trix-attachment]",i={preview:{presentation:"gallery",caption:{name:!0,size:!0}},file:{caption:{size:!0}}},n={default:{tagName:"div",parse:!1},quote:{tagName:"blockquote",nestable:!0},heading1:{tagName:"h1",terminal:!0,breakOnReturn:!0,group:!1},code:{tagName:"pre",terminal:!0,htmlAttributes:["language"],text:{plaintext:!0}},bulletList:{tagName:"ul",parse:!1},bullet:{tagName:"li",listAttribute:"bulletList",group:!1,nestable:!0,test(t){return r(t.parentNode)===n[this.listAttribute].tagName}},numberList:{tagName:"ol",parse:!1},number:{tagName:"li",listAttribute:"numberList",group:!1,nestable:!0,test(t){return r(t.parentNode)===n[this.listAttribute].tagName}},attachmentGallery:{tagName:"div",exclusive:!0,terminal:!0,parse:!1,group:!1}},r=t=>{var e;return null==t||null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase()},o=navigator.userAgent.match(/android\s([0-9]+.*Chrome)/i),s=o&&parseInt(o[1]);var a={composesExistingText:/Android.*Chrome/.test(navigator.userAgent),recentAndroid:s&&s>12,samsungAndroid:s&&navigator.userAgent.match(/Android.*SM-/),forcesObjectResizing:/Trident.*rv:11/.test(navigator.userAgent),supportsInputEvents:"undefined"!=typeof InputEvent&&["data","getTargetRanges","inputType"].every((t=>t in InputEvent.prototype))},l={ADD_ATTR:["language"],SAFE_FOR_XML:!1,RETURN_DOM:!0},c={attachFiles:"Attach Files",bold:"Bold",bullets:"Bullets",byte:"Byte",bytes:"Bytes",captionPlaceholder:"Add a caption…",code:"Code",heading1:"Heading",indent:"Increase Level",italic:"Italic",link:"Link",numbers:"Numbers",outdent:"Decrease Level",quote:"Quote",redo:"Redo",remove:"Remove",strike:"Strikethrough",undo:"Undo",unlink:"Unlink",url:"URL",urlPlaceholder:"Enter a URL…",GB:"GB",KB:"KB",MB:"MB",PB:"PB",TB:"TB"};const u=[c.bytes,c.KB,c.MB,c.GB,c.TB,c.PB];var h={prefix:"IEC",precision:2,formatter(t){switch(t){case 0:return"0 ".concat(c.bytes);case 1:return"1 ".concat(c.byte);default:let e;"SI"===this.prefix?e=1e3:"IEC"===this.prefix&&(e=1024);const i=Math.floor(Math.log(t)/Math.log(e)),n=(t/Math.pow(e,i)).toFixed(this.precision).replace(/0*$/,"").replace(/\.$/,"");return"".concat(n," ").concat(u[i])}}};const d="\ufeff",g=" ",m=function(t){for(const e in t){const i=t[e];this[e]=i}return this},p=document.documentElement,f=p.matches,b=function(t){let{onElement:e,matchingSelector:i,withCallback:n,inPhase:r,preventDefault:o,times:s}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const a=e||p,l=i,c="capturing"===r,u=function(t){null!=s&&0==--s&&u.destroy();const e=x(t.target,{matchingSelector:l});null!=e&&(null==n||n.call(e,t,e),o&&t.preventDefault())};return u.destroy=()=>a.removeEventListener(t,u,c),a.addEventListener(t,u,c),u},v=function(t){let{bubbles:e,cancelable:i,attributes:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=!1!==e,i=!1!==i;const r=document.createEvent("Events");return r.initEvent(t,e,i),null!=n&&m.call(r,n),r},A=function(t){let{onElement:e,bubbles:i,cancelable:n,attributes:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const o=null!=e?e:p,s=v(t,{bubbles:i,cancelable:n,attributes:r});return o.dispatchEvent(s)},y=function(t,e){if(1===(null==t?void 0:t.nodeType))return f.call(t,e)},x=function(t){let{matchingSelector:e,untilNode:i}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for(;t&&t.nodeType!==Node.ELEMENT_NODE;)t=t.parentNode;if(null!=t){if(null==e)return t;if(t.closest&&null==i)return t.closest(e);for(;t&&t!==i;){if(y(t,e))return t;t=t.parentNode}}},C=t=>document.activeElement!==t&&E(t,document.activeElement),E=function(t,e){if(t&&e)for(;e;){if(e===t)return!0;e=e.parentNode}},S=function(t){var e;if(null===(e=t)||void 0===e||!e.parentNode)return;let i=0;for(t=t.previousSibling;t;)i++,t=t.previousSibling;return i},R=t=>{var e;return null==t||null===(e=t.parentNode)||void 0===e?void 0:e.removeChild(t)},T=function(t){let{onlyNodesOfType:e,usingFilter:i,expandEntityReferences:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=(()=>{switch(e){case"element":return NodeFilter.SHOW_ELEMENT;case"text":return NodeFilter.SHOW_TEXT;case"comment":return NodeFilter.SHOW_COMMENT;default:return NodeFilter.SHOW_ALL}})();return document.createTreeWalker(t,r,null!=i?i:null,!0===n)},k=t=>{var e;return null==t||null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase()},w=function(t){let e,i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"object"==typeof t?(n=t,t=n.tagName):n={attributes:n};const r=document.createElement(t);if(null!=n.editable&&(null==n.attributes&&(n.attributes={}),n.attributes.contenteditable=n.editable),n.attributes)for(e in n.attributes)i=n.attributes[e],r.setAttribute(e,i);if(n.style)for(e in n.style)i=n.style[e],r.style[e]=i;if(n.data)for(e in n.data)i=n.data[e],r.dataset[e]=i;return n.className&&n.className.split(" ").forEach((t=>{r.classList.add(t)})),n.textContent&&(r.textContent=n.textContent),n.childNodes&&[].concat(n.childNodes).forEach((t=>{r.appendChild(t)})),r};let D;const L=function(){if(null!=D)return D;D=[];for(const t in n){const e=n[t];e.tagName&&D.push(e.tagName)}return D},N=t=>O(null==t?void 0:t.firstChild),I=function(t){let{strict:e}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{strict:!0};return e?O(t):O(t)||!O(t.firstChild)&&function(t){return L().includes(k(t))&&!L().includes(k(t.firstChild))}(t)},O=t=>F(t)&&"block"===(null==t?void 0:t.data),F=t=>(null==t?void 0:t.nodeType)===Node.COMMENT_NODE,P=function(t){let{name:e}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t)return _(t)?t.data===d?!e||t.parentNode.dataset.trixCursorTarget===e:void 0:P(t.firstChild)},M=t=>y(t,e),B=t=>_(t)&&""===(null==t?void 0:t.data),_=t=>(null==t?void 0:t.nodeType)===Node.TEXT_NODE,j={level2Enabled:!0,getLevel(){return this.level2Enabled&&a.supportsInputEvents?2:0},pickFiles(t){const e=w("input",{type:"file",multiple:!0,hidden:!0,id:this.fileInputId});e.addEventListener("change",(()=>{t(e.files),R(e)})),R(document.getElementById(this.fileInputId)),document.body.appendChild(e),e.click()}};var W={removeBlankTableCells:!1,tableCellSeparator:" | ",tableRowSeparator:"\n"},U={bold:{tagName:"strong",inheritable:!0,parser(t){const e=window.getComputedStyle(t);return"bold"===e.fontWeight||e.fontWeight>=600}},italic:{tagName:"em",inheritable:!0,parser:t=>"italic"===window.getComputedStyle(t).fontStyle},href:{groupTagName:"a",parser(t){const i="a:not(".concat(e,")"),n=t.closest(i);if(n)return n.getAttribute("href")}},strike:{tagName:"del",inheritable:!0},frozen:{style:{backgroundColor:"highlight"}}},V={getDefaultHTML:()=>'<div class="trix-button-row">\n <span class="trix-button-group trix-button-group--text-tools" data-trix-button-group="text-tools">\n <button type="button" class="trix-button trix-button--icon trix-button--icon-bold" data-trix-attribute="bold" data-trix-key="b" title="'.concat(c.bold,'" tabindex="-1">').concat(c.bold,'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-italic" data-trix-attribute="italic" data-trix-key="i" title="').concat(c.italic,'" tabindex="-1">').concat(c.italic,'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-strike" data-trix-attribute="strike" title="').concat(c.strike,'" tabindex="-1">').concat(c.strike,'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-link" data-trix-attribute="href" data-trix-action="link" data-trix-key="k" title="').concat(c.link,'" tabindex="-1">').concat(c.link,'</button>\n </span>\n\n <span class="trix-button-group trix-button-group--block-tools" data-trix-button-group="block-tools">\n <button type="button" class="trix-button trix-button--icon trix-button--icon-heading-1" data-trix-attribute="heading1" title="').concat(c.heading1,'" tabindex="-1">').concat(c.heading1,'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-quote" data-trix-attribute="quote" title="').concat(c.quote,'" tabindex="-1">').concat(c.quote,'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-code" data-trix-attribute="code" title="').concat(c.code,'" tabindex="-1">').concat(c.code,'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-bullet-list" data-trix-attribute="bullet" title="').concat(c.bullets,'" tabindex="-1">').concat(c.bullets,'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-number-list" data-trix-attribute="number" title="').concat(c.numbers,'" tabindex="-1">').concat(c.numbers,'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-decrease-nesting-level" data-trix-action="decreaseNestingLevel" title="').concat(c.outdent,'" tabindex="-1">').concat(c.outdent,'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-increase-nesting-level" data-trix-action="increaseNestingLevel" title="').concat(c.indent,'" tabindex="-1">').concat(c.indent,'</button>\n </span>\n\n <span class="trix-button-group trix-button-group--file-tools" data-trix-button-group="file-tools">\n <button type="button" class="trix-button trix-button--icon trix-button--icon-attach" data-trix-action="attachFiles" title="').concat(c.attachFiles,'" tabindex="-1">').concat(c.attachFiles,'</button>\n </span>\n\n <span class="trix-button-group-spacer"></span>\n\n <span class="trix-button-group trix-button-group--history-tools" data-trix-button-group="history-tools">\n <button type="button" class="trix-button trix-button--icon trix-button--icon-undo" data-trix-action="undo" data-trix-key="z" title="').concat(c.undo,'" tabindex="-1">').concat(c.undo,'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-redo" data-trix-action="redo" data-trix-key="shift+z" title="').concat(c.redo,'" tabindex="-1">').concat(c.redo,'</button>\n </span>\n </div>\n\n <div class="trix-dialogs" data-trix-dialogs>\n <div class="trix-dialog trix-dialog--link" data-trix-dialog="href" data-trix-dialog-attribute="href">\n <div class="trix-dialog__link-fields">\n <input type="url" name="href" class="trix-input trix-input--dialog" placeholder="').concat(c.urlPlaceholder,'" aria-label="').concat(c.url,'" data-trix-validate-href required data-trix-input>\n <div class="trix-button-group">\n <input type="button" class="trix-button trix-button--dialog" value="').concat(c.link,'" data-trix-method="setAttribute">\n <input type="button" class="trix-button trix-button--dialog" value="').concat(c.unlink,'" data-trix-method="removeAttribute">\n </div>\n </div>\n </div>\n </div>')};const z={interval:5e3};var H=Object.freeze({__proto__:null,attachments:i,blockAttributes:n,browser:a,css:{attachment:"attachment",attachmentCaption:"attachment__caption",attachmentCaptionEditor:"attachment__caption-editor",attachmentMetadata:"attachment__metadata",attachmentMetadataContainer:"attachment__metadata-container",attachmentName:"attachment__name",attachmentProgress:"attachment__progress",attachmentSize:"attachment__size",attachmentToolbar:"attachment__toolbar",attachmentGallery:"attachment-gallery"},dompurify:l,fileSize:h,input:j,keyNames:{8:"backspace",9:"tab",13:"return",27:"escape",37:"left",39:"right",46:"delete",68:"d",72:"h",79:"o"},lang:c,parser:W,textAttributes:U,toolbar:V,undo:z});class q{static proxyMethod(t){const{name:e,toMethod:i,toProperty:n,optional:r}=J(t);this.prototype[e]=function(){let t,o;var s,a;i?o=r?null===(s=this[i])||void 0===s?void 0:s.call(this):this[i]():n&&(o=this[n]);return r?(t=null===(a=o)||void 0===a?void 0:a[e],t?K.call(t,o,arguments):void 0):(t=o[e],K.call(t,o,arguments))}}}const J=function(t){const e=t.match(G);if(!e)throw new Error("can't parse @proxyMethod expression: ".concat(t));const i={name:e[4]};return null!=e[2]?i.toMethod=e[1]:i.toProperty=e[1],null!=e[3]&&(i.optional=!0),i},{apply:K}=Function.prototype,G=new RegExp("^(.+?)(\\(\\))?(\\?)?\\.(.+?)$");var X,Y,$;class Z extends q{static box(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return t instanceof this?t:this.fromUCS2String(null==t?void 0:t.toString())}static fromUCS2String(t){return new this(t,it(t))}static fromCodepoints(t){return new this(nt(t),t)}constructor(t,e){super(...arguments),this.ucs2String=t,this.codepoints=e,this.length=this.codepoints.length,this.ucs2Length=this.ucs2String.length}offsetToUCS2Offset(t){return nt(this.codepoints.slice(0,Math.max(0,t))).length}offsetFromUCS2Offset(t){return it(this.ucs2String.slice(0,Math.max(0,t))).length}slice(){return this.constructor.fromCodepoints(this.codepoints.slice(...arguments))}charAt(t){return this.slice(t,t+1)}isEqualTo(t){return this.constructor.box(t).ucs2String===this.ucs2String}toJSON(){return this.ucs2String}getCacheKey(){return this.ucs2String}toString(){return this.ucs2String}}const Q=1===(null===(X=Array.from)||void 0===X?void 0:X.call(Array,"👼").length),tt=null!=(null===(Y=" ".codePointAt)||void 0===Y?void 0:Y.call(" ",0)),et=" 👼"===(null===($=String.fromCodePoint)||void 0===$?void 0:$.call(String,32,128124));let it,nt;it=Q&&tt?t=>Array.from(t).map((t=>t.codePointAt(0))):function(t){const e=[];let i=0;const{length:n}=t;for(;i<n;){let r=t.charCodeAt(i++);if(55296<=r&&r<=56319&&i<n){const e=t.charCodeAt(i++);56320==(64512&e)?r=((1023&r)<<10)+(1023&e)+65536:i--}e.push(r)}return e},nt=et?t=>String.fromCodePoint(...Array.from(t||[])):function(t){return(()=>{const e=[];return Array.from(t).forEach((t=>{let i="";t>65535&&(t-=65536,i+=String.fromCharCode(t>>>10&1023|55296),t=56320|1023&t),e.push(i+String.fromCharCode(t))})),e})().join("")};let rt=0;class ot extends q{static fromJSONString(t){return this.fromJSON(JSON.parse(t))}constructor(){super(...arguments),this.id=++rt}hasSameConstructorAs(t){return this.constructor===(null==t?void 0:t.constructor)}isEqualTo(t){return this===t}inspect(){const t=[],e=this.contentsForInspection()||{};for(const i in e){const n=e[i];t.push("".concat(i,"=").concat(n))}return"#<".concat(this.constructor.name,":").concat(this.id).concat(t.length?" ".concat(t.join(", ")):"",">")}contentsForInspection(){}toJSONString(){return JSON.stringify(this)}toUTF16String(){return Z.box(this)}getCacheKey(){return this.id.toString()}}const st=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++){if(t[i]!==e[i])return!1}return!0},at=function(t){const e=t.slice(0);for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];return e.splice(...n),e},lt=/[\u05BE\u05C0\u05C3\u05D0-\u05EA\u05F0-\u05F4\u061B\u061F\u0621-\u063A\u0640-\u064A\u066D\u0671-\u06B7\u06BA-\u06BE\u06C0-\u06CE\u06D0-\u06D5\u06E5\u06E6\u200F\u202B\u202E\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE72\uFE74\uFE76-\uFEFC]/,ct=function(){const t=w("input",{dir:"auto",name:"x",dirName:"x.dir"}),e=w("textarea",{dir:"auto",name:"y",dirName:"y.dir"}),i=w("form");i.appendChild(t),i.appendChild(e);const n=function(){try{return new FormData(i).has(e.dirName)}catch(t){return!1}}(),r=function(){try{return t.matches(":dir(ltr),:dir(rtl)")}catch(t){return!1}}();return n?function(t){return e.value=t,new FormData(i).get(e.dirName)}:r?function(e){return t.value=e,t.matches(":dir(rtl)")?"rtl":"ltr"}:function(t){const e=t.trim().charAt(0);return lt.test(e)?"rtl":"ltr"}}();let ut=null,ht=null,dt=null,gt=null;const mt=()=>(ut||(ut=vt().concat(ft())),ut),pt=t=>n[t],ft=()=>(ht||(ht=Object.keys(n)),ht),bt=t=>U[t],vt=()=>(dt||(dt=Object.keys(U)),dt),At=function(t,e){yt(t).textContent=e.replace(/%t/g,t)},yt=function(t){const e=document.createElement("style");e.setAttribute("type","text/css"),e.setAttribute("data-tag-name",t.toLowerCase());const i=xt();return i&&e.setAttribute("nonce",i),document.head.insertBefore(e,document.head.firstChild),e},xt=function(){const t=Ct("trix-csp-nonce")||Ct("csp-nonce");if(t){const{nonce:e,content:i}=t;return""==e?i:e}},Ct=t=>document.head.querySelector("meta[name=".concat(t,"]")),Et={"application/x-trix-feature-detection":"test"},St=function(t){const e=t.getData("text/plain"),i=t.getData("text/html");if(!e||!i)return null==e?void 0:e.length;{const{body:t}=(new DOMParser).parseFromString(i,"text/html");if(t.textContent===e)return!t.querySelector("*")}},Rt=/Mac|^iP/.test(navigator.platform)?t=>t.metaKey:t=>t.ctrlKey;const Tt=t=>setTimeout(t,1),kt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e={};for(const i in t){const n=t[i];e[i]=n}return e},wt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const i in t){if(t[i]!==e[i])return!1}return!0},Dt=function(t){if(null!=t)return Array.isArray(t)||(t=[t,t]),[It(t[0]),It(null!=t[1]?t[1]:t[0])]},Lt=function(t){if(null==t)return;const[e,i]=Dt(t);return Ot(e,i)},Nt=function(t,e){if(null==t||null==e)return;const[i,n]=Dt(t),[r,o]=Dt(e);return Ot(i,r)&&Ot(n,o)},It=function(t){return"number"==typeof t?t:kt(t)},Ot=function(t,e){return"number"==typeof t?t===e:wt(t,e)};class Ft extends q{constructor(){super(...arguments),this.update=this.update.bind(this),this.selectionManagers=[]}start(){this.started||(this.started=!0,document.addEventListener("selectionchange",this.update,!0))}stop(){if(this.started)return this.started=!1,document.removeEventListener("selectionchange",this.update,!0)}registerSelectionManager(t){if(!this.selectionManagers.includes(t))return this.selectionManagers.push(t),this.start()}unregisterSelectionManager(t){if(this.selectionManagers=this.selectionManagers.filter((e=>e!==t)),0===this.selectionManagers.length)return this.stop()}notifySelectionManagersOfSelectionChange(){return this.selectionManagers.map((t=>t.selectionDidChange()))}update(){this.notifySelectionManagersOfSelectionChange()}reset(){this.update()}}const Pt=new Ft,Mt=function(){const t=window.getSelection();if(t.rangeCount>0)return t},Bt=function(){var t;const e=null===(t=Mt())||void 0===t?void 0:t.getRangeAt(0);if(e&&!jt(e))return e},_t=function(t){const e=window.getSelection();return e.removeAllRanges(),e.addRange(t),Pt.update()},jt=t=>Wt(t.startContainer)||Wt(t.endContainer),Wt=t=>!Object.getPrototypeOf(t),Ut=t=>t.replace(new RegExp("".concat(d),"g"),"").replace(new RegExp("".concat(g),"g")," "),Vt=new RegExp("[^\\S".concat(g,"]")),zt=t=>t.replace(new RegExp("".concat(Vt.source),"g")," ").replace(/\ {2,}/g," "),Ht=function(t,e){if(t.isEqualTo(e))return["",""];const i=qt(t,e),{length:n}=i.utf16String;let r;if(n){const{offset:o}=i,s=t.codepoints.slice(0,o).concat(t.codepoints.slice(o+n));r=qt(e,Z.fromCodepoints(s))}else r=qt(e,t);return[i.utf16String.toString(),r.utf16String.toString()]},qt=function(t,e){let i=0,n=t.length,r=e.length;for(;i<n&&t.charAt(i).isEqualTo(e.charAt(i));)i++;for(;n>i+1&&t.charAt(n-1).isEqualTo(e.charAt(r-1));)n--,r--;return{utf16String:t.slice(i,n),offset:i}};class Jt extends ot{static fromCommonAttributesOfObjects(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(!t.length)return new this;let e=Yt(t[0]),i=e.getKeys();return t.slice(1).forEach((t=>{i=e.getKeysCommonToHash(Yt(t)),e=e.slice(i)})),e}static box(t){return Yt(t)}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(...arguments),this.values=Xt(t)}add(t,e){return this.merge(Kt(t,e))}remove(t){return new Jt(Xt(this.values,t))}get(t){return this.values[t]}has(t){return t in this.values}merge(t){return new Jt(Gt(this.values,$t(t)))}slice(t){const e={};return Array.from(t).forEach((t=>{this.has(t)&&(e[t]=this.values[t])})),new Jt(e)}getKeys(){return Object.keys(this.values)}getKeysCommonToHash(t){return t=Yt(t),this.getKeys().filter((e=>this.values[e]===t.values[e]))}isEqualTo(t){return st(this.toArray(),Yt(t).toArray())}isEmpty(){return 0===this.getKeys().length}toArray(){if(!this.array){const t=[];for(const e in this.values){const i=this.values[e];t.push(t.push(e,i))}this.array=t.slice(0)}return this.array}toObject(){return Xt(this.values)}toJSON(){return this.toObject()}contentsForInspection(){return{values:JSON.stringify(this.values)}}}const Kt=function(t,e){const i={};return i[t]=e,i},Gt=function(t,e){const i=Xt(t);for(const t in e){const n=e[t];i[t]=n}return i},Xt=function(t,e){const i={};return Object.keys(t).sort().forEach((n=>{n!==e&&(i[n]=t[n])})),i},Yt=function(t){return t instanceof Jt?t:new Jt(t)},$t=function(t){return t instanceof Jt?t.values:t};class Zt{static groupObjects(){let t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],{depth:i,asTree:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n&&null==i&&(i=0);const r=[];return Array.from(e).forEach((e=>{var o;if(t){var s,a,l;if(null!==(s=e.canBeGrouped)&&void 0!==s&&s.call(e,i)&&null!==(a=(l=t[t.length-1]).canBeGroupedWith)&&void 0!==a&&a.call(l,e,i))return void t.push(e);r.push(new this(t,{depth:i,asTree:n})),t=null}null!==(o=e.canBeGrouped)&&void 0!==o&&o.call(e,i)?t=[e]:r.push(e)})),t&&r.push(new this(t,{depth:i,asTree:n})),r}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],{depth:e,asTree:i}=arguments.length>1?arguments[1]:void 0;this.objects=t,i&&(this.depth=e,this.objects=this.constructor.groupObjects(this.objects,{asTree:i,depth:this.depth+1}))}getObjects(){return this.objects}getDepth(){return this.depth}getCacheKey(){const t=["objectGroup"];return Array.from(this.getObjects()).forEach((e=>{t.push(e.getCacheKey())})),t.join("/")}}class Qt extends q{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];super(...arguments),this.objects={},Array.from(t).forEach((t=>{const e=JSON.stringify(t);null==this.objects[e]&&(this.objects[e]=t)}))}find(t){const e=JSON.stringify(t);return this.objects[e]}}class te{constructor(t){this.reset(t)}add(t){const e=ee(t);this.elements[e]=t}remove(t){const e=ee(t),i=this.elements[e];if(i)return delete this.elements[e],i}reset(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.elements={},Array.from(t).forEach((t=>{this.add(t)})),t}}const ee=t=>t.dataset.trixStoreKey;class ie extends q{isPerforming(){return!0===this.performing}hasPerformed(){return!0===this.performed}hasSucceeded(){return this.performed&&this.succeeded}hasFailed(){return this.performed&&!this.succeeded}getPromise(){return this.promise||(this.promise=new Promise(((t,e)=>(this.performing=!0,this.perform(((i,n)=>{this.succeeded=i,this.performing=!1,this.performed=!0,this.succeeded?t(n):e(n)})))))),this.promise}perform(t){return t(!1)}release(){var t,e;null===(t=this.promise)||void 0===t||null===(e=t.cancel)||void 0===e||e.call(t),this.promise=null,this.performing=null,this.performed=null,this.succeeded=null}}ie.proxyMethod("getPromise().then"),ie.proxyMethod("getPromise().catch");class ne extends q{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(...arguments),this.object=t,this.options=e,this.childViews=[],this.rootView=this}getNodes(){return this.nodes||(this.nodes=this.createNodes()),this.nodes.map((t=>t.cloneNode(!0)))}invalidate(){var t;return this.nodes=null,this.childViews=[],null===(t=this.parentView)||void 0===t?void 0:t.invalidate()}invalidateViewForObject(t){var e;return null===(e=this.findViewForObject(t))||void 0===e?void 0:e.invalidate()}findOrCreateCachedChildView(t,e,i){let n=this.getCachedViewForObject(e);return n?this.recordChildView(n):(n=this.createChildView(...arguments),this.cacheViewForObject(n,e)),n}createChildView(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};e instanceof Zt&&(i.viewClass=t,t=re);const n=new t(e,i);return this.recordChildView(n)}recordChildView(t){return t.parentView=this,t.rootView=this.rootView,this.childViews.push(t),t}getAllChildViews(){let t=[];return this.childViews.forEach((e=>{t.push(e),t=t.concat(e.getAllChildViews())})),t}findElement(){return this.findElementForObject(this.object)}findElementForObject(t){const e=null==t?void 0:t.id;if(e)return this.rootView.element.querySelector("[data-trix-id='".concat(e,"']"))}findViewForObject(t){for(const e of this.getAllChildViews())if(e.object===t)return e}getViewCache(){return this.rootView!==this?this.rootView.getViewCache():this.isViewCachingEnabled()?(this.viewCache||(this.viewCache={}),this.viewCache):void 0}isViewCachingEnabled(){return!1!==this.shouldCacheViews}enableViewCaching(){this.shouldCacheViews=!0}disableViewCaching(){this.shouldCacheViews=!1}getCachedViewForObject(t){var e;return null===(e=this.getViewCache())||void 0===e?void 0:e[t.getCacheKey()]}cacheViewForObject(t,e){const i=this.getViewCache();i&&(i[e.getCacheKey()]=t)}garbageCollectCachedViews(){const t=this.getViewCache();if(t){const e=this.getAllChildViews().concat(this).map((t=>t.object.getCacheKey()));for(const i in t)e.includes(i)||delete t[i]}}}class re extends ne{constructor(){super(...arguments),this.objectGroup=this.object,this.viewClass=this.options.viewClass,delete this.options.viewClass}getChildViews(){return this.childViews.length||Array.from(this.objectGroup.getObjects()).forEach((t=>{this.findOrCreateCachedChildView(this.viewClass,t,this.options)})),this.childViews}createNodes(){const t=this.createContainerElement();return this.getChildViews().forEach((e=>{Array.from(e.getNodes()).forEach((e=>{t.appendChild(e)}))})),[t]}createContainerElement(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.objectGroup.getDepth();return this.getChildViews()[0].createContainerElement(t)}}
/*! @license DOMPurify 3.4.2 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.2/LICENSE */const{entries:oe,setPrototypeOf:se,isFrozen:ae,getPrototypeOf:le,getOwnPropertyDescriptor:ce}=Object;let{freeze:ue,seal:he,create:de}=Object,{apply:ge,construct:me}="undefined"!=typeof Reflect&&Reflect;ue||(ue=function(t){return t}),he||(he=function(t){return t}),ge||(ge=function(t,e){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r<i;r++)n[r-2]=arguments[r];return t.apply(e,n)}),me||(me=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];return new t(...i)});const pe=Me(Array.prototype.forEach),fe=Me(Array.prototype.lastIndexOf),be=Me(Array.prototype.pop),ve=Me(Array.prototype.push),Ae=Me(Array.prototype.splice),ye=Array.isArray,xe=Me(String.prototype.toLowerCase),Ce=Me(String.prototype.toString),Ee=Me(String.prototype.match),Se=Me(String.prototype.replace),Re=Me(String.prototype.indexOf),Te=Me(String.prototype.trim),ke=Me(Number.prototype.toString),we=Me(Boolean.prototype.toString),De="undefined"==typeof BigInt?null:Me(BigInt.prototype.toString),Le="undefined"==typeof Symbol?null:Me(Symbol.prototype.toString),Ne=Me(Object.prototype.hasOwnProperty),Ie=Me(Object.prototype.toString),Oe=Me(RegExp.prototype.test),Fe=(Pe=TypeError,function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return me(Pe,e)});var Pe;function Me(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];return ge(t,e,n)}}function Be(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:xe;if(se&&se(t,null),!ye(e))return t;let n=e.length;for(;n--;){let r=e[n];if("string"==typeof r){const t=i(r);t!==r&&(ae(e)||(e[n]=t),r=t)}t[r]=!0}return t}function _e(t){for(let e=0;e<t.length;e++){Ne(t,e)||(t[e]=null)}return t}function je(t){const e=de(null);for(const[i,n]of oe(t)){Ne(t,i)&&(ye(n)?e[i]=_e(n):n&&"object"==typeof n&&n.constructor===Object?e[i]=je(n):e[i]=n)}return e}function We(t,e){for(;null!==t;){const i=ce(t,e);if(i){if(i.get)return Me(i.get);if("function"==typeof i.value)return Me(i.value)}t=le(t)}return function(){return null}}const Ue=ue(["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","search","section","select","shadow","slot","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"]),Ve=ue(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ze=ue(["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"]),He=ue(["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"]),qe=ue(["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=ue(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ke=ue(["#text"]),Ge=ue(["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","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","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","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Xe=ue(["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","mask-type","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"]),Ye=ue(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","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"]),$e=ue(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ze=he(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Qe=he(/<%[\w\W]*|[\w\W]*%>/gm),ti=he(/\$\{[\w\W]*/gm),ei=he(/^data-[\-\w.\u00B7-\uFFFF]+$/),ii=he(/^aria-[\-\w]+$/),ni=he(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ri=he(/^(?:\w+script|data):/i),oi=he(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),si=he(/^html$/i),ai=he(/^[a-z][.\w]*(-[.\w]+)+$/i);var li=Object.freeze({__proto__:null,ARIA_ATTR:ii,ATTR_WHITESPACE:oi,CUSTOM_ELEMENT:ai,DATA_ATTR:ei,DOCTYPE_NAME:si,ERB_EXPR:Qe,IS_ALLOWED_URI:ni,IS_SCRIPT_OR_DATA:ri,MUSTACHE_EXPR:Ze,TMPLIT_EXPR:ti});const ci=1,ui=3,hi=7,di=8,gi=9,mi=function(){return"undefined"==typeof window?null:window};var pi=function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:mi();const i=e=>t(e);if(i.version="3.4.2",i.removed=[],!e||!e.document||e.document.nodeType!==gi||!e.Element)return i.isSupported=!1,i;let{document:n}=e;const r=n,o=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:a,Node:l,Element:c,NodeFilter:u,NamedNodeMap:h=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:d,DOMParser:g,trustedTypes:m}=e,p=c.prototype,f=We(p,"cloneNode"),b=We(p,"remove"),v=We(p,"nextSibling"),A=We(p,"childNodes"),y=We(p,"parentNode");if("function"==typeof a){const t=n.createElement("template");t.content&&t.content.ownerDocument&&(n=t.content.ownerDocument)}let x,C="";const{implementation:E,createNodeIterator:S,createDocumentFragment:R,getElementsByTagName:T}=n,{importNode:k}=r;let w={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};i.isSupported="function"==typeof oe&&"function"==typeof y&&E&&void 0!==E.createHTMLDocument;const{MUSTACHE_EXPR:D,ERB_EXPR:L,TMPLIT_EXPR:N,DATA_ATTR:I,ARIA_ATTR:O,IS_SCRIPT_OR_DATA:F,ATTR_WHITESPACE:P,CUSTOM_ELEMENT:M}=li;let{IS_ALLOWED_URI:B}=li,_=null;const j=Be({},[...Ue,...Ve,...ze,...qe,...Ke]);let W=null;const U=Be({},[...Ge,...Xe,...Ye,...$e]);let V=Object.seal(de(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}})),z=null,H=null;const q=Object.seal(de(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let J=!0,K=!0,G=!1,X=!0,Y=!1,$=!0,Z=!1,Q=!1,tt=!1,et=!1,it=!1,nt=!1,rt=!0,ot=!1;const st="user-content-";let at=!0,lt=!1,ct={},ut=null;const ht=Be({},["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 dt=null;const gt=Be({},["audio","video","img","source","image","track"]);let mt=null;const pt=Be({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ft="http://www.w3.org/1998/Math/MathML",bt="http://www.w3.org/2000/svg",vt="http://www.w3.org/1999/xhtml";let At=vt,yt=!1,xt=null;const Ct=Be({},[ft,bt,vt],Ce);let Et=Be({},["mi","mo","mn","ms","mtext"]),St=Be({},["annotation-xml"]);const Rt=Be({},["title","style","font","a","script"]);let Tt=null;const kt=["application/xhtml+xml","text/html"];let wt=null,Dt=null;const Lt=n.createElement("form"),Nt=function(t){return t instanceof RegExp||t instanceof Function},It=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(Dt&&Dt===t)return;t&&"object"==typeof t||(t={}),t=je(t),Tt=-1===kt.indexOf(t.PARSER_MEDIA_TYPE)?"text/html":t.PARSER_MEDIA_TYPE,wt="application/xhtml+xml"===Tt?Ce:xe,_=Ne(t,"ALLOWED_TAGS")&&ye(t.ALLOWED_TAGS)?Be({},t.ALLOWED_TAGS,wt):j,W=Ne(t,"ALLOWED_ATTR")&&ye(t.ALLOWED_ATTR)?Be({},t.ALLOWED_ATTR,wt):U,xt=Ne(t,"ALLOWED_NAMESPACES")&&ye(t.ALLOWED_NAMESPACES)?Be({},t.ALLOWED_NAMESPACES,Ce):Ct,mt=Ne(t,"ADD_URI_SAFE_ATTR")&&ye(t.ADD_URI_SAFE_ATTR)?Be(je(pt),t.ADD_URI_SAFE_ATTR,wt):pt,dt=Ne(t,"ADD_DATA_URI_TAGS")&&ye(t.ADD_DATA_URI_TAGS)?Be(je(gt),t.ADD_DATA_URI_TAGS,wt):gt,ut=Ne(t,"FORBID_CONTENTS")&&ye(t.FORBID_CONTENTS)?Be({},t.FORBID_CONTENTS,wt):ht,z=Ne(t,"FORBID_TAGS")&&ye(t.FORBID_TAGS)?Be({},t.FORBID_TAGS,wt):je({}),H=Ne(t,"FORBID_ATTR")&&ye(t.FORBID_ATTR)?Be({},t.FORBID_ATTR,wt):je({}),ct=!!Ne(t,"USE_PROFILES")&&(t.USE_PROFILES&&"object"==typeof t.USE_PROFILES?je(t.USE_PROFILES):t.USE_PROFILES),J=!1!==t.ALLOW_ARIA_ATTR,K=!1!==t.ALLOW_DATA_ATTR,G=t.ALLOW_UNKNOWN_PROTOCOLS||!1,X=!1!==t.ALLOW_SELF_CLOSE_IN_ATTR,Y=t.SAFE_FOR_TEMPLATES||!1,$=!1!==t.SAFE_FOR_XML,Z=t.WHOLE_DOCUMENT||!1,et=t.RETURN_DOM||!1,it=t.RETURN_DOM_FRAGMENT||!1,nt=t.RETURN_TRUSTED_TYPE||!1,tt=t.FORCE_BODY||!1,rt=!1!==t.SANITIZE_DOM,ot=t.SANITIZE_NAMED_PROPS||!1,at=!1!==t.KEEP_CONTENT,lt=t.IN_PLACE||!1,B=function(t){try{return Oe(t,""),!0}catch(t){return!1}}(t.ALLOWED_URI_REGEXP)?t.ALLOWED_URI_REGEXP:ni,At="string"==typeof t.NAMESPACE?t.NAMESPACE:vt,Et=Ne(t,"MATHML_TEXT_INTEGRATION_POINTS")&&t.MATHML_TEXT_INTEGRATION_POINTS&&"object"==typeof t.MATHML_TEXT_INTEGRATION_POINTS?je(t.MATHML_TEXT_INTEGRATION_POINTS):Be({},["mi","mo","mn","ms","mtext"]),St=Ne(t,"HTML_INTEGRATION_POINTS")&&t.HTML_INTEGRATION_POINTS&&"object"==typeof t.HTML_INTEGRATION_POINTS?je(t.HTML_INTEGRATION_POINTS):Be({},["annotation-xml"]);const e=Ne(t,"CUSTOM_ELEMENT_HANDLING")&&t.CUSTOM_ELEMENT_HANDLING&&"object"==typeof t.CUSTOM_ELEMENT_HANDLING?je(t.CUSTOM_ELEMENT_HANDLING):de(null);if(V=de(null),Ne(e,"tagNameCheck")&&Nt(e.tagNameCheck)&&(V.tagNameCheck=e.tagNameCheck),Ne(e,"attributeNameCheck")&&Nt(e.attributeNameCheck)&&(V.attributeNameCheck=e.attributeNameCheck),Ne(e,"allowCustomizedBuiltInElements")&&"boolean"==typeof e.allowCustomizedBuiltInElements&&(V.allowCustomizedBuiltInElements=e.allowCustomizedBuiltInElements),Y&&(K=!1),it&&(et=!0),ct&&(_=Be({},Ke),W=de(null),!0===ct.html&&(Be(_,Ue),Be(W,Ge)),!0===ct.svg&&(Be(_,Ve),Be(W,Xe),Be(W,$e)),!0===ct.svgFilters&&(Be(_,ze),Be(W,Xe),Be(W,$e)),!0===ct.mathMl&&(Be(_,qe),Be(W,Ye),Be(W,$e))),q.tagCheck=null,q.attributeCheck=null,Ne(t,"ADD_TAGS")&&("function"==typeof t.ADD_TAGS?q.tagCheck=t.ADD_TAGS:ye(t.ADD_TAGS)&&(_===j&&(_=je(_)),Be(_,t.ADD_TAGS,wt))),Ne(t,"ADD_ATTR")&&("function"==typeof t.ADD_ATTR?q.attributeCheck=t.ADD_ATTR:ye(t.ADD_ATTR)&&(W===U&&(W=je(W)),Be(W,t.ADD_ATTR,wt))),Ne(t,"ADD_URI_SAFE_ATTR")&&ye(t.ADD_URI_SAFE_ATTR)&&Be(mt,t.ADD_URI_SAFE_ATTR,wt),Ne(t,"FORBID_CONTENTS")&&ye(t.FORBID_CONTENTS)&&(ut===ht&&(ut=je(ut)),Be(ut,t.FORBID_CONTENTS,wt)),Ne(t,"ADD_FORBID_CONTENTS")&&ye(t.ADD_FORBID_CONTENTS)&&(ut===ht&&(ut=je(ut)),Be(ut,t.ADD_FORBID_CONTENTS,wt)),at&&(_["#text"]=!0),Z&&Be(_,["html","head","body"]),_.table&&(Be(_,["tbody"]),delete z.tbody),t.TRUSTED_TYPES_POLICY){if("function"!=typeof t.TRUSTED_TYPES_POLICY.createHTML)throw Fe('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof t.TRUSTED_TYPES_POLICY.createScriptURL)throw Fe('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');x=t.TRUSTED_TYPES_POLICY,C=x.createHTML("")}else void 0===x&&(x=function(t,e){if("object"!=typeof t||"function"!=typeof t.createPolicy)return null;let i=null;const n="data-tt-policy-suffix";e&&e.hasAttribute(n)&&(i=e.getAttribute(n));const r="dompurify"+(i?"#"+i:"");try{return t.createPolicy(r,{createHTML:t=>t,createScriptURL:t=>t})}catch(t){return console.warn("TrustedTypes policy "+r+" could not be created."),null}}(m,o)),null!==x&&"string"==typeof C&&(C=x.createHTML(""));ue&&ue(t),Dt=t},Ot=Be({},[...Ve,...ze,...He]),Ft=Be({},[...qe,...Je]),Pt=function(t){ve(i.removed,{element:t});try{y(t).removeChild(t)}catch(e){b(t)}},Mt=function(t,e){try{ve(i.removed,{attribute:e.getAttributeNode(t),from:e})}catch(t){ve(i.removed,{attribute:null,from:e})}if(e.removeAttribute(t),"is"===t)if(et||it)try{Pt(e)}catch(t){}else try{e.setAttribute(t,"")}catch(t){}},Bt=function(t){let e=null,i=null;if(tt)t="<remove></remove>"+t;else{const e=Ee(t,/^[\r\n\t ]+/);i=e&&e[0]}"application/xhtml+xml"===Tt&&At===vt&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");const r=x?x.createHTML(t):t;if(At===vt)try{e=(new g).parseFromString(r,Tt)}catch(t){}if(!e||!e.documentElement){e=E.createDocument(At,"template",null);try{e.documentElement.innerHTML=yt?C:r}catch(t){}}const o=e.body||e.documentElement;return t&&i&&o.insertBefore(n.createTextNode(i),o.childNodes[0]||null),At===vt?T.call(e,Z?"html":"body")[0]:Z?e.documentElement:o},_t=function(t){return S.call(t.ownerDocument||t,t,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},jt=function(t){return t instanceof d&&("string"!=typeof t.nodeName||"string"!=typeof t.textContent||"function"!=typeof t.removeChild||!(t.attributes instanceof h)||"function"!=typeof t.removeAttribute||"function"!=typeof t.setAttribute||"string"!=typeof t.namespaceURI||"function"!=typeof t.insertBefore||"function"!=typeof t.hasChildNodes)},Wt=function(t){return"function"==typeof l&&t instanceof l};function Ut(t,e,n){pe(t,(t=>{t.call(i,e,n,Dt)}))}const Vt=function(t){let e=null;if(Ut(w.beforeSanitizeElements,t,null),jt(t))return Pt(t),!0;const n=wt(t.nodeName);if(Ut(w.uponSanitizeElement,t,{tagName:n,allowedTags:_}),$&&t.hasChildNodes()&&!Wt(t.firstElementChild)&&Oe(/<[/\w!]/g,t.innerHTML)&&Oe(/<[/\w!]/g,t.textContent))return Pt(t),!0;if($&&t.namespaceURI===vt&&"style"===n&&Wt(t.firstElementChild))return Pt(t),!0;if(t.nodeType===hi)return Pt(t),!0;if($&&t.nodeType===di&&Oe(/<[/\w]/g,t.data))return Pt(t),!0;if(z[n]||!(q.tagCheck instanceof Function&&q.tagCheck(n))&&!_[n]){if(!z[n]&&qt(n)){if(V.tagNameCheck instanceof RegExp&&Oe(V.tagNameCheck,n))return!1;if(V.tagNameCheck instanceof Function&&V.tagNameCheck(n))return!1}if(at&&!ut[n]){const e=y(t)||t.parentNode,i=A(t)||t.childNodes;if(i&&e){for(let n=i.length-1;n>=0;--n){const r=f(i[n],!0);e.insertBefore(r,v(t))}}}return Pt(t),!0}return t instanceof c&&!function(t){let e=y(t);e&&e.tagName||(e={namespaceURI:At,tagName:"template"});const i=xe(t.tagName),n=xe(e.tagName);return!!xt[t.namespaceURI]&&(t.namespaceURI===bt?e.namespaceURI===vt?"svg"===i:e.namespaceURI===ft?"svg"===i&&("annotation-xml"===n||Et[n]):Boolean(Ot[i]):t.namespaceURI===ft?e.namespaceURI===vt?"math"===i:e.namespaceURI===bt?"math"===i&&St[n]:Boolean(Ft[i]):t.namespaceURI===vt?!(e.namespaceURI===bt&&!St[n])&&!(e.namespaceURI===ft&&!Et[n])&&!Ft[i]&&(Rt[i]||!Ot[i]):!("application/xhtml+xml"!==Tt||!xt[t.namespaceURI]))}(t)?(Pt(t),!0):"noscript"!==n&&"noembed"!==n&&"noframes"!==n||!Oe(/<\/no(script|embed|frames)/i,t.innerHTML)?(Y&&t.nodeType===ui&&(e=t.textContent,pe([D,L,N],(t=>{e=Se(e,t," ")})),t.textContent!==e&&(ve(i.removed,{element:t.cloneNode()}),t.textContent=e)),Ut(w.afterSanitizeElements,t,null),!1):(Pt(t),!0)},zt=function(t,e,i){if(H[e])return!1;if(rt&&("id"===e||"name"===e)&&(i in n||i in Lt))return!1;const r=W[e]||q.attributeCheck instanceof Function&&q.attributeCheck(e,t);if(K&&!H[e]&&Oe(I,e));else if(J&&Oe(O,e));else if(!r||H[e]){if(!(qt(t)&&(V.tagNameCheck instanceof RegExp&&Oe(V.tagNameCheck,t)||V.tagNameCheck instanceof Function&&V.tagNameCheck(t))&&(V.attributeNameCheck instanceof RegExp&&Oe(V.attributeNameCheck,e)||V.attributeNameCheck instanceof Function&&V.attributeNameCheck(e,t))||"is"===e&&V.allowCustomizedBuiltInElements&&(V.tagNameCheck instanceof RegExp&&Oe(V.tagNameCheck,i)||V.tagNameCheck instanceof Function&&V.tagNameCheck(i))))return!1}else if(mt[e]);else if(Oe(B,Se(i,P,"")));else if("src"!==e&&"xlink:href"!==e&&"href"!==e||"script"===t||0!==Re(i,"data:")||!dt[t]){if(G&&!Oe(F,Se(i,P,"")));else if(i)return!1}else;return!0},Ht=Be({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),qt=function(t){return!Ht[xe(t)]&&Oe(M,t)},Jt=function(t){Ut(w.beforeSanitizeAttributes,t,null);const{attributes:e}=t;if(!e||jt(t))return;const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:W,forceKeepAttr:void 0};let r=e.length;for(;r--;){const o=e[r],{name:s,namespaceURI:a,value:l}=o,c=wt(s),u=l;let h="value"===s?u:Te(u);if(n.attrName=c,n.attrValue=h,n.keepAttr=!0,n.forceKeepAttr=void 0,Ut(w.uponSanitizeAttribute,t,n),h=n.attrValue,!ot||"id"!==c&&"name"!==c||0===Re(h,st)||(Mt(s,t),h=st+h),$&&Oe(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,h)){Mt(s,t);continue}if("attributename"===c&&Ee(h,"href")){Mt(s,t);continue}if(n.forceKeepAttr)continue;if(!n.keepAttr){Mt(s,t);continue}if(!X&&Oe(/\/>/i,h)){Mt(s,t);continue}Y&&pe([D,L,N],(t=>{h=Se(h,t," ")}));const d=wt(t.nodeName);if(zt(d,c,h)){if(x&&"object"==typeof m&&"function"==typeof m.getAttributeType)if(a);else switch(m.getAttributeType(d,c)){case"TrustedHTML":h=x.createHTML(h);break;case"TrustedScriptURL":h=x.createScriptURL(h)}if(h!==u)try{a?t.setAttributeNS(a,s,h):t.setAttribute(s,h),jt(t)?Pt(t):be(i.removed)}catch(e){Mt(s,t)}}else Mt(s,t)}Ut(w.afterSanitizeAttributes,t,null)},Kt=function(t){let e=null;const i=_t(t);for(Ut(w.beforeSanitizeShadowDOM,t,null);e=i.nextNode();)Ut(w.uponSanitizeShadowNode,e,null),Vt(e),Jt(e),e.content instanceof s&&Kt(e.content);Ut(w.afterSanitizeShadowDOM,t,null)};return i.sanitize=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null,o=null,a=null,c=null;if(yt=!t,yt&&(t="\x3c!--\x3e"),"string"!=typeof t&&!Wt(t)&&"string"!=typeof(t=function(t){switch(typeof t){case"string":return t;case"number":return ke(t);case"boolean":return we(t);case"bigint":return De?De(t):"0";case"symbol":return Le?Le(t):"Symbol()";case"undefined":default:return Ie(t);case"function":case"object":{if(null===t)return Ie(t);const e=t,i=We(e,"toString");if("function"==typeof i){const t=i(e);return"string"==typeof t?t:Ie(t)}return Ie(t)}}}(t)))throw Fe("dirty is not a string, aborting");if(!i.isSupported)return t;if(Q||It(e),i.removed=[],"string"==typeof t&&(lt=!1),lt){const e=t.nodeName;if("string"==typeof e){const t=wt(e);if(!_[t]||z[t])throw Fe("root node is forbidden and cannot be sanitized in-place")}}else if(t instanceof l)n=Bt("\x3c!----\x3e"),o=n.ownerDocument.importNode(t,!0),o.nodeType===ci&&"BODY"===o.nodeName||"HTML"===o.nodeName?n=o:n.appendChild(o);else{if(!et&&!Y&&!Z&&-1===t.indexOf("<"))return x&&nt?x.createHTML(t):t;if(n=Bt(t),!n)return et?null:nt?C:""}n&&tt&&Pt(n.firstChild);const u=_t(lt?t:n);for(;a=u.nextNode();)Vt(a),Jt(a),a.content instanceof s&&Kt(a.content);if(lt)return t;if(et){if(Y){n.normalize();let t=n.innerHTML;pe([D,L,N],(e=>{t=Se(t,e," ")})),n.innerHTML=t}if(it)for(c=R.call(n.ownerDocument);n.firstChild;)c.appendChild(n.firstChild);else c=n;return(W.shadowroot||W.shadowrootmode)&&(c=k.call(r,c,!0)),c}let h=Z?n.outerHTML:n.innerHTML;return Z&&_["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&Oe(si,n.ownerDocu