var Mi="2.1.5",K="[data-trix-attachment]",je={preview:{presentation:"gallery",caption:{name:!0,size:!0}},file:{caption:{size:!0}}},y={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(n){return Je(n.parentNode)===y[this.listAttribute].tagName}},numberList:{tagName:"ol",parse:!1},number:{tagName:"li",listAttribute:"numberList",group:!1,nestable:!0,test(n){return Je(n.parentNode)===y[this.listAttribute].tagName}},attachmentGallery:{tagName:"div",exclusive:!0,terminal:!0,parse:!1,group:!1}},Je=n=>{var t;return n==null||(t=n.tagName)===null||t===void 0?void 0:t.toLowerCase()},Ke=navigator.userAgent.match(/android\s([0-9]+.*Chrome)/i),se=Ke&&parseInt(Ke[1]),St={composesExistingText:/Android.*Chrome/.test(navigator.userAgent),recentAndroid:se&&se>12,samsungAndroid:se&&navigator.userAgent.match(/Android.*SM-/),forcesObjectResizing:/Trident.*rv:11/.test(navigator.userAgent),supportsInputEvents:typeof InputEvent<"u"&&["data","getTargetRanges","inputType"].every(n=>n in InputEvent.prototype)},h={attachFiles:"Attach Files",bold:"Bold",bullets:"Bullets",byte:"Byte",bytes:"Bytes",captionPlaceholder:"Add a caption\u2026",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\u2026",GB:"GB",KB:"KB",MB:"MB",PB:"PB",TB:"TB"},ji=[h.bytes,h.KB,h.MB,h.GB,h.TB,h.PB],vi={prefix:"IEC",precision:2,formatter(n){switch(n){case 0:return"0 ".concat(h.bytes);case 1:return"1 ".concat(h.byte);default:let t;this.prefix==="SI"?t=1e3:this.prefix==="IEC"&&(t=1024);let e=Math.floor(Math.log(n)/Math.log(t)),i=(n/Math.pow(t,e)).toFixed(this.precision).replace(/0*$/,"").replace(/\.$/,"");return"".concat(i," ").concat(ji[e])}}},te="\uFEFF",U="\xA0",Ai=function(n){for(let t in n){let e=n[t];this[t]=e}return this},We=document.documentElement,Wi=We.matches,p=function(n){let{onElement:t,matchingSelector:e,withCallback:i,inPhase:r,preventDefault:o,times:s}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=t||We,l=e,c=r==="capturing",u=function(b){s!=null&&--s==0&&u.destroy();let A=q(b.target,{matchingSelector:l});A!=null&&(i?.call(A,b,A),o&&b.preventDefault())};return u.destroy=()=>a.removeEventListener(n,u,c),a.addEventListener(n,u,c),u},vt=function(n){let{onElement:t,bubbles:e,cancelable:i,attributes:r}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=t??We;e=e!==!1,i=i!==!1;let s=document.createEvent("Events");return s.initEvent(n,e,i),r!=null&&Ai.call(s,r),o.dispatchEvent(s)},xi=function(n,t){if(n?.nodeType===1)return Wi.call(n,t)},q=function(n){let{matchingSelector:t,untilNode:e}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};for(;n&&n.nodeType!==Node.ELEMENT_NODE;)n=n.parentNode;if(n!=null){if(t==null)return n;if(n.closest&&e==null)return n.closest(t);for(;n&&n!==e;){if(xi(n,t))return n;n=n.parentNode}}},Ue=n=>document.activeElement!==n&&J(n,document.activeElement),J=function(n,t){if(n&&t)for(;t;){if(t===n)return!0;t=t.parentNode}},ae=function(n){var t;if((t=n)===null||t===void 0||!t.parentNode)return;let e=0;for(n=n.previousSibling;n;)e++,n=n.previousSibling;return e},V=n=>{var t;return n==null||(t=n.parentNode)===null||t===void 0?void 0:t.removeChild(n)},Ft=function(n){let{onlyNodesOfType:t,usingFilter:e,expandEntityReferences:i}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=(()=>{switch(t){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(n,r,e??null,i===!0)},x=n=>{var t;return n==null||(t=n.tagName)===null||t===void 0?void 0:t.toLowerCase()},d=function(n){let t,e,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof n=="object"?(i=n,n=i.tagName):i={attributes:i};let r=document.createElement(n);if(i.editable!=null&&(i.attributes==null&&(i.attributes={}),i.attributes.contenteditable=i.editable),i.attributes)for(t in i.attributes)e=i.attributes[t],r.setAttribute(t,e);if(i.style)for(t in i.style)e=i.style[t],r.style[t]=e;if(i.data)for(t in i.data)e=i.data[t],r.dataset[t]=e;return i.className&&i.className.split(" ").forEach(o=>{r.classList.add(o)}),i.textContent&&(r.textContent=i.textContent),i.childNodes&&[].concat(i.childNodes).forEach(o=>{r.appendChild(o)}),r},pt,At=function(){if(pt!=null)return pt;pt=[];for(let n in y){let t=y[n];t.tagName&&pt.push(t.tagName)}return pt},le=n=>ot(n?.firstChild),$e=function(n){let{strict:t}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{strict:!0};return t?ot(n):ot(n)||!ot(n.firstChild)&&function(e){return At().includes(x(e))&&!At().includes(x(e.firstChild))}(n)},ot=n=>Ui(n)&&n?.data==="block",Ui=n=>n?.nodeType===Node.COMMENT_NODE,st=function(n){let{name:t}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(n)return xt(n)?n.data===te?!t||n.parentNode.dataset.trixCursorTarget===t:void 0:st(n.firstChild)},$=n=>xi(n,K),yi=n=>xt(n)&&n?.data==="",xt=n=>n?.nodeType===Node.TEXT_NODE,qe={level2Enabled:!0,getLevel(){return this.level2Enabled&&St.supportsInputEvents?2:0},pickFiles(n){let t=d("input",{type:"file",multiple:!0,hidden:!0,id:this.fileInputId});t.addEventListener("change",()=>{n(t.files),V(t)}),V(document.getElementById(this.fileInputId)),document.body.appendChild(t),t.click()}},Tt={removeBlankTableCells:!1,tableCellSeparator:" | ",tableRowSeparator:`
`},Y={bold:{tagName:"strong",inheritable:!0,parser(n){let t=window.getComputedStyle(n);return t.fontWeight==="bold"||t.fontWeight>=600}},italic:{tagName:"em",inheritable:!0,parser:n=>window.getComputedStyle(n).fontStyle==="italic"},href:{groupTagName:"a",parser(n){let t="a:not(".concat(K,")"),e=n.closest(t);if(e)return e.getAttribute("href")}},strike:{tagName:"del",inheritable:!0},frozen:{style:{backgroundColor:"highlight"}}},Ci={getDefaultHTML:()=>`
`)},Re={interval:5e3},Lt=Object.freeze({__proto__:null,attachments:je,blockAttributes:y,browser:St,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"},fileSize:vi,input:qe,keyNames:{8:"backspace",9:"tab",13:"return",27:"escape",37:"left",39:"right",46:"delete",68:"d",72:"h",79:"o"},lang:h,parser:Tt,textAttributes:Y,toolbar:Ci,undo:Re}),f=class{static proxyMethod(t){let{name:e,toMethod:i,toProperty:r,optional:o}=qi(t);this.prototype[e]=function(){let s,a;var l,c;return i?a=o?(l=this[i])===null||l===void 0?void 0:l.call(this):this[i]():r&&(a=this[r]),o?(s=(c=a)===null||c===void 0?void 0:c[e],s?Ge.call(s,a,arguments):void 0):(s=a[e],Ge.call(s,a,arguments))}}},qi=function(n){let t=n.match(Vi);if(!t)throw new Error("can't parse @proxyMethod expression: ".concat(n));let e={name:t[4]};return t[2]!=null?e.toMethod=t[1]:e.toProperty=t[1],t[3]!=null&&(e.optional=!0),e},{apply:Ge}=Function.prototype,Vi=new RegExp("^(.+?)(\\(\\))?(\\?)?\\.(.+?)$"),ce,ue,he,Z=class extends f{static box(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return t instanceof this?t:this.fromUCS2String(t?.toString())}static fromUCS2String(t){return new this(t,Ee(t))}static fromCodepoints(t){return new this(Se(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 Se(this.codepoints.slice(0,Math.max(0,t))).length}offsetFromUCS2Offset(t){return Ee(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}},Hi=((ce=Array.from)===null||ce===void 0?void 0:ce.call(Array,"\u{1F47C}").length)===1,zi=((ue=" ".codePointAt)===null||ue===void 0?void 0:ue.call(" ",0))!=null,_i=((he=String.fromCodePoint)===null||he===void 0?void 0:he.call(String,32,128124))===" \u{1F47C}",Ee,Se;Ee=Hi&&zi?n=>Array.from(n).map(t=>t.codePointAt(0)):function(n){let t=[],e=0,{length:i}=n;for(;eString.fromCodePoint(...Array.from(n||[])):function(n){return(()=>{let t=[];return Array.from(n).forEach(e=>{let i="";e>65535&&(e-=65536,i+=String.fromCharCode(e>>>10&1023|55296),e=56320|1023&e),t.push(i+String.fromCharCode(e))}),t})().join("")};var Ji=0,O=class extends f{static fromJSONString(t){return this.fromJSON(JSON.parse(t))}constructor(){super(...arguments),this.id=++Ji}hasSameConstructorAs(t){return this.constructor===t?.constructor}isEqualTo(t){return this===t}inspect(){let t=[],e=this.contentsForInspection()||{};for(let i in e){let r=e[i];t.push("".concat(i,"=").concat(r))}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()}},Q=function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];if(n.length!==t.length)return!1;for(let e=0;e1?e-1:0),r=1;r(de||(de=Xi().concat(Gi())),de),v=n=>y[n],Gi=()=>(ge||(ge=Object.keys(y)),ge),De=n=>Y[n],Xi=()=>(me||(me=Object.keys(Y)),me),ki=function(n,t){Yi(n).textContent=t.replace(/%t/g,n)},Yi=function(n){let t=document.createElement("style");t.setAttribute("type","text/css"),t.setAttribute("data-tag-name",n.toLowerCase());let e=Zi();return e&&t.setAttribute("nonce",e),document.head.insertBefore(t,document.head.firstChild),t},Zi=function(){let n=Xe("trix-csp-nonce")||Xe("csp-nonce");if(n)return n.getAttribute("content")},Xe=n=>document.head.querySelector("meta[name=".concat(n,"]")),Ye={"application/x-trix-feature-detection":"test"},Ri=function(n){let t=n.getData("text/plain"),e=n.getData("text/html");if(!t||!e)return t?.length;{let{body:i}=new DOMParser().parseFromString(e,"text/html");if(i.textContent===t)return!i.querySelector("*")}},Ei=/Mac|^iP/.test(navigator.platform)?n=>n.metaKey:n=>n.ctrlKey,He=n=>setTimeout(n,1),Si=function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t={};for(let e in n){let i=n[e];t[e]=i}return t},dt=function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(Object.keys(n).length!==Object.keys(t).length)return!1;for(let e in n)if(n[e]!==t[e])return!1;return!0},g=function(n){if(n!=null)return Array.isArray(n)||(n=[n,n]),[Ze(n[0]),Ze(n[1]!=null?n[1]:n[0])]},N=function(n){if(n==null)return;let[t,e]=g(n);return we(t,e)},Pt=function(n,t){if(n==null||t==null)return;let[e,i]=g(n),[r,o]=g(t);return we(e,r)&&we(i,o)},Ze=function(n){return typeof n=="number"?n:Si(n)},we=function(n,t){return typeof n=="number"?n===t:dt(n,t)},It=class extends f{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),this.selectionManagers.length===0)return this.stop()}notifySelectionManagersOfSelectionChange(){return this.selectionManagers.map(t=>t.selectionDidChange())}update(){this.notifySelectionManagersOfSelectionChange()}reset(){this.update()}},tt=new It,Li=function(){let n=window.getSelection();if(n.rangeCount>0)return n},yt=function(){var n;let t=(n=Li())===null||n===void 0?void 0:n.getRangeAt(0);if(t&&!Qi(t))return t},Di=function(n){let t=window.getSelection();return t.removeAllRanges(),t.addRange(n),tt.update()},Qi=n=>Qe(n.startContainer)||Qe(n.endContainer),Qe=n=>!Object.getPrototypeOf(n),bt=n=>n.replace(new RegExp("".concat(te),"g"),"").replace(new RegExp("".concat(U),"g")," "),ze=new RegExp("[^\\S".concat(U,"]")),_e=n=>n.replace(new RegExp("".concat(ze.source),"g")," ").replace(/\ {2,}/g," "),ti=function(n,t){if(n.isEqualTo(t))return["",""];let e=pe(n,t),{length:i}=e.utf16String,r;if(i){let{offset:o}=e,s=n.codepoints.slice(0,o).concat(n.codepoints.slice(o+i));r=pe(t,Z.fromCodepoints(s))}else r=pe(t,n);return[e.utf16String.toString(),r.utf16String.toString()]},pe=function(n,t){let e=0,i=n.length,r=t.length;for(;ee+1&&n.charAt(i-1).isEqualTo(t.charAt(r-1));)i--,r--;return{utf16String:n.slice(e,i),offset:e}},C=class extends O{static fromCommonAttributesOfObjects(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];if(!t.length)return new this;let e=ft(t[0]),i=e.getKeys();return t.slice(1).forEach(r=>{i=e.getKeysCommonToHash(ft(r)),e=e.slice(i)}),e}static box(t){return ft(t)}constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(...arguments),this.values=Bt(t)}add(t,e){return this.merge(tn(t,e))}remove(t){return new C(Bt(this.values,t))}get(t){return this.values[t]}has(t){return t in this.values}merge(t){return new C(en(this.values,nn(t)))}slice(t){let e={};return Array.from(t).forEach(i=>{this.has(i)&&(e[i]=this.values[i])}),new C(e)}getKeys(){return Object.keys(this.values)}getKeysCommonToHash(t){return t=ft(t),this.getKeys().filter(e=>this.values[e]===t.values[e])}isEqualTo(t){return Q(this.toArray(),ft(t).toArray())}isEmpty(){return this.getKeys().length===0}toArray(){if(!this.array){let t=[];for(let e in this.values){let i=this.values[e];t.push(t.push(e,i))}this.array=t.slice(0)}return this.array}toObject(){return Bt(this.values)}toJSON(){return this.toObject()}contentsForInspection(){return{values:JSON.stringify(this.values)}}},tn=function(n,t){let e={};return e[n]=t,e},en=function(n,t){let e=Bt(n);for(let i in t){let r=t[i];e[i]=r}return e},Bt=function(n,t){let e={};return Object.keys(n).sort().forEach(i=>{i!==t&&(e[i]=n[i])}),e},ft=function(n){return n instanceof C?n:new C(n)},nn=function(n){return n instanceof C?n.values:n},Ct=class{static groupObjects(){let t,e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],{depth:i,asTree:r}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};r&&i==null&&(i=0);let o=[];return Array.from(e).forEach(s=>{var a;if(t){var l,c,u;if((l=s.canBeGrouped)!==null&&l!==void 0&&l.call(s,i)&&(c=(u=t[t.length-1]).canBeGroupedWith)!==null&&c!==void 0&&c.call(u,s,i))return void t.push(s);o.push(new this(t,{depth:i,asTree:r})),t=null}(a=s.canBeGrouped)!==null&&a!==void 0&&a.call(s,i)?t=[s]:o.push(s)}),t&&o.push(new this(t,{depth:i,asTree:r})),o}constructor(){let t=arguments.length>0&&arguments[0]!==void 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(){let t=["objectGroup"];return Array.from(this.getObjects()).forEach(e=>{t.push(e.getCacheKey())}),t.join("/")}},Te=class extends f{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(...arguments),this.objects={},Array.from(t).forEach(e=>{let i=JSON.stringify(e);this.objects[i]==null&&(this.objects[i]=e)})}find(t){let e=JSON.stringify(t);return this.objects[e]}},Be=class{constructor(t){this.reset(t)}add(t){let e=ei(t);this.elements[e]=t}remove(t){let e=ei(t),i=this.elements[e];if(i)return delete this.elements[e],i}reset(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return this.elements={},Array.from(t).forEach(e=>{this.add(e)}),t}},ei=n=>n.dataset.trixStoreKey,at=class extends f{isPerforming(){return this.performing===!0}hasPerformed(){return this.performed===!0}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,r)=>{this.succeeded=i,this.performing=!1,this.performed=!0,this.succeeded?t(r):e(r)})))),this.promise}perform(t){return t(!1)}release(){var t,e;(t=this.promise)===null||t===void 0||(e=t.cancel)===null||e===void 0||e.call(t),this.promise=null,this.performing=null,this.performed=null,this.succeeded=null}};at.proxyMethod("getPromise().then"),at.proxyMethod("getPromise().catch");var M=class extends f{constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?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=[],(t=this.parentView)===null||t===void 0?void 0:t.invalidate()}invalidateViewForObject(t){var e;return(e=this.findViewForObject(t))===null||e===void 0?void 0:e.invalidate()}findOrCreateCachedChildView(t,e,i){let r=this.getCachedViewForObject(e);return r?this.recordChildView(r):(r=this.createChildView(...arguments),this.cacheViewForObject(r,e)),r}createChildView(t,e){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};e instanceof Ct&&(i.viewClass=t,t=Fe);let r=new t(e,i);return this.recordChildView(r)}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){let e=t?.id;if(e)return this.rootView.element.querySelector("[data-trix-id='".concat(e,"']"))}findViewForObject(t){for(let 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 this.shouldCacheViews!==!1}enableViewCaching(){this.shouldCacheViews=!0}disableViewCaching(){this.shouldCacheViews=!1}getCachedViewForObject(t){var e;return(e=this.getViewCache())===null||e===void 0?void 0:e[t.getCacheKey()]}cacheViewForObject(t,e){let i=this.getViewCache();i&&(i[e.getCacheKey()]=t)}garbageCollectCachedViews(){let t=this.getViewCache();if(t){let e=this.getAllChildViews().concat(this).map(i=>i.object.getCacheKey());for(let i in t)e.includes(i)||delete t[i]}}},Fe=class extends M{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(){let t=this.createContainerElement();return this.getChildViews().forEach(e=>{Array.from(e.getNodes()).forEach(i=>{t.appendChild(i)})}),[t]}createContainerElement(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.objectGroup.getDepth();return this.getChildViews()[0].createContainerElement(t)}},rn="style href src width height language class".split(" "),on="javascript:".split(" "),sn="script iframe form noscript".split(" "),lt=class extends f{static setHTML(t,e){let i=new this(e).sanitize(),r=i.getHTML?i.getHTML():i.outerHTML;t.innerHTML=r}static sanitize(t,e){let i=new this(t,e);return i.sanitize(),i}constructor(t){let{allowedAttributes:e,forbiddenProtocols:i,forbiddenElements:r}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(...arguments),this.allowedAttributes=e||rn,this.forbiddenProtocols=i||on,this.forbiddenElements=r||sn,this.body=an(t)}sanitize(){return this.sanitizeElements(),this.normalizeListElementNesting()}getHTML(){return this.body.innerHTML}getBody(){return this.body}sanitizeElements(){let t=Ft(this.body),e=[];for(;t.nextNode();){let i=t.currentNode;switch(i.nodeType){case Node.ELEMENT_NODE:this.elementIsRemovable(i)?e.push(i):this.sanitizeElement(i);break;case Node.COMMENT_NODE:e.push(i)}}return e.forEach(i=>V(i)),this.body}sanitizeElement(t){return t.hasAttribute("href")&&this.forbiddenProtocols.includes(t.protocol)&&t.removeAttribute("href"),Array.from(t.attributes).forEach(e=>{let{name:i}=e;this.allowedAttributes.includes(i)||i.indexOf("data-trix")===0||t.removeAttribute(i)}),t}normalizeListElementNesting(){return Array.from(this.body.querySelectorAll("ul,ol")).forEach(t=>{let e=t.previousElementSibling;e&&x(e)==="li"&&e.appendChild(t)}),this.body}elementIsRemovable(t){if(t?.nodeType===Node.ELEMENT_NODE)return this.elementIsForbidden(t)||this.elementIsntSerializable(t)}elementIsForbidden(t){return this.forbiddenElements.includes(x(t))}elementIsntSerializable(t){return t.getAttribute("data-trix-serialize")==="false"&&!$(t)}},an=function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";n=n.replace(/<\/html[^>]*>[^]*$/i,"