PageSourceSearch

https://members.tech-tokyo.org/packs/js/79421-5ab017e84225c75e.js

js tech-tokyo.org collected 2026-09-30 19:15:05 UTC 169,729 bytes, 2 lines download raw bytes

1"use strict";(self.rspackChunkcircle=self.rspackChunkcircle||[]).push([[79421],{767788(t,e,i){let n,r,s,o,a,l,h,u;i.r(e);let c="[data-trix-attachment]",d={preview:{presentation:"gallery",caption:{name:!0,size:!0}},file:{caption:{size:!0}}},g={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 m(t.parentNode)===g[this.listAttribute].tagName}},numberList:{tagName:"ol",parse:!1},number:{tagName:"li",listAttribute:"numberList",group:!1,nestable:!0,test(t){return m(t.parentNode)===g[this.listAttribute].tagName}},attachmentGallery:{tagName:"div",exclusive:!0,terminal:!0,parse:!1,group:!1}},m=t=>{var e;return null==t||null==(e=t.tagName)?void 0:e.toLowerCase()},p=navigator.userAgent.match(/android\s([0-9]+.*Chrome)/i),f=p&&parseInt(p[1]);var b,A,v,x,y={composesExistingText:/Android.*Chrome/.test(navigator.userAgent),recentAndroid:f&&f>12,samsungAndroid:f&&navigator.userAgent.match(/Android.*SM-/),forcesObjectResizing:/Trident.*rv:11/.test(navigator.userAgent),supportsInputEvents:"u">typeof InputEvent&&["data","getTargetRanges","inputType"].every(t=>t in InputEvent.prototype)},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"};let k=[C.bytes,C.KB,C.MB,C.GB,C.TB,C.PB];var E={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);let 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(k[i])}}};let R=function(t){for(let e in t){let i=t[e];this[e]=i}return this},S=document.documentElement,L=S.matches,D=function(t){let{onElement:e,matchingSelector:i,withCallback:n,inPhase:r,preventDefault:s,times:o}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=e||S,l="capturing"===r,h=function(t){null!=o&&0==--o&&h.destroy();let e=F(t.target,{matchingSelector:i});null!=e&&(null==n||n.call(e,t,e),s&&t.preventDefault())};return h.destroy=()=>a.removeEventListener(t,h,l),a.addEventListener(t,h,l),h},w=function(t){let{onElement:e,bubbles:i,cancelable:n,attributes:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=null!=e?e:S;i=!1!==i,n=!1!==n;let o=document.createEvent("Events");return o.initEvent(t,i,n),null!=r&&R.call(o,r),s.dispatchEvent(o)},T=function(t,e){if(1===(null==t?void 0:t.nodeType))return L.call(t,e)},F=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(T(t,e))return t;t=t.parentNode}}},B=t=>document.activeElement!==t&&P(t,document.activeElement),P=function(t,e){if(t&&e)for(;e;){if(e===t)return!0;e=e.parentNode}},I=function(t){var e;if(null==(e=t)||!e.parentNode)return;let i=0;for(t=t.previousSibling;t;)i++,t=t.previousSibling;return i},N=t=>{var e;return null==t||null==(e=t.parentNode)?void 0:e.removeChild(t)},O=function(t){let{onlyNodesOfType:e,usingFilter:i,expandEntityReferences:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},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)},M=t=>{var e;return null==t||null==(e=t.tagName)?void 0:e.toLowerCase()},j=function(t){let e,i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"object"==typeof t?t=(n=t).tagName:n={attributes:n};let 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).forEac
1h(t=>{r.appendChild(t)}),r},W=function(){if(null!=n)return n;for(let t in n=[],g){let e=g[t];e.tagName&&n.push(e.tagName)}return n},U=t=>V(null==t?void 0:t.firstChild),q=function(t){let{strict:e}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{strict:!0};return e?V(t):V(t)||!V(t.firstChild)&&W().includes(M(t))&&!W().includes(M(t.firstChild))},V=t=>H(t)&&"block"===(null==t?void 0:t.data),H=t=>(null==t?void 0:t.nodeType)===Node.COMMENT_NODE,z=function(t){let{name:e}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t)return K(t)?"\uFEFF"===t.data?!e||t.parentNode.dataset.trixCursorTarget===e:void 0:z(t.firstChild)},_=t=>T(t,c),J=t=>K(t)&&""===(null==t?void 0:t.data),K=t=>(null==t?void 0:t.nodeType)===Node.TEXT_NODE,G={level2Enabled:!0,getLevel(){return this.level2Enabled&&y.supportsInputEvents?2:0},pickFiles(t){let e=j("input",{type:"file",multiple:!0,hidden:!0,id:this.fileInputId});e.addEventListener("change",()=>{t(e.files),N(e)}),N(document.getElementById(this.fileInputId)),document.body.appendChild(e),e.click()}};var $={removeBlankTableCells:!1,tableCellSeparator:" | ",tableRowSeparator:"\n"},X={bold:{tagName:"strong",inheritable:!0,parser(t){let 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){let e="a:not(".concat(c,")"),i=t.closest(e);if(i)return i.getAttribute("href")}},strike:{tagName:"del",inheritable:!0},frozen:{style:{backgroundColor:"highlight"}}},Y={getDefaultHTML:()=>'<div class="trix-button-row">
1\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,'" 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>')};let Q={interval:5e3};var Z=Object.freeze({__proto__:null,attachments:d,blockAttributes:g,browser:y,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:E,input:G,keyNames:{8:"backspace",9:"tab",13:"return",27:"escape",37:"left",39:"right",46:"delete",68:"d",72:"h",79:"o"},lang:C,parser:$,textAttributes:X,toolbar:Y,undo:Q});class tt{static proxyMethod(t){let{name:e,toMethod:i,toProperty:n,optional:r}=te(t);this.prototype[e]=function(){var t,s;let o,a;return i?a=r?null==(t=this[i])?void 0:t.call(this):this[i]():n&&(a=this[n]),r?(o=null==(s=a)?void 0:s[e])?ti.c
1all(o,a,arguments):void 0:(o=a[e],ti.call(o,a,arguments))}}}let te=function(t){let e=t.match(tn);if(!e)throw Error("can't parse @proxyMethod expression: ".concat(t));let i={name:e[4]};return null!=e[2]?i.toMethod=e[1]:i.toProperty=e[1],null!=e[3]&&(i.optional=!0),i},{apply:ti}=Function.prototype,tn=RegExp("^(.+?)(\\(\\))?(\\?)?\\.(.+?)$");class tr extends tt{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,r(t))}static fromCodepoints(t){return new this(s(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 s(this.codepoints.slice(0,Math.max(0,t))).length}offsetFromUCS2Offset(t){return r(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}}let ts=1===(null==(b=Array.from)?void 0:b.call(Array,"\uD83D\uDC7C").length),to=null!=(null==(A=" ".codePointAt)?void 0:A.call(" ",0)),ta=" \uD83D\uDC7C"===(null==(v=String.fromCodePoint)?void 0:v.call(String,32,128124));r=ts&&to?t=>Array.from(t).map(t=>t.codePointAt(0)):function(t){let e=[],i=0,{length:n}=t;for(;i<n;){let r=t.charCodeAt(i++);if(55296<=r&&r<=56319&&i<n){let e=t.charCodeAt(i++);56320==(64512&e)?r=((1023&r)<<10)+(1023&e)+65536:i--}e.push(r)}return e},s=ta?t=>String.fromCodePoint(...Array.from(t||[])):function(t){let e;return(e=[],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 tl=0;class th extends tt{static fromJSONString(t){return this.fromJSON(JSON.parse(t))}constructor(){super(...arguments),this.id=++tl}hasSameConstructorAs(t){return this.constructor===(null==t?void 0:t.constructor)}isEqualTo(t){return this===t}inspect(){let t=[],e=this.contentsForInspection()||{};for(let i in e){let 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 tr.box(this)}getCacheKey(){return this.id.toString()}}let tu=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},tc=function(t){let e=t.slice(0);for(var i=arguments.length,n=Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];return e.splice(...n),e},td=/[\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]/,tg=(o=j("input",{dir:"auto",name:"x",dirName:"x.dir"}),a=j("textarea",{dir:"auto",name:"y",dirName:"y.dir"}),(l=j("form")).appendChild(o),l.appendChild(a),h=function(){try{return new FormData(l).has(a.dirName)}catch(t){return!1}}(),u=function(){try{return o.matches(":dir(ltr),:dir(rtl)")}catch(t){return!1}}(),h?function(t){return a.value=t,new FormData(l).get(a.dirName)}:u?function(t){return o.value=t,o.matches(":dir(rtl)")?"rtl":"ltr"}:function(t){let e=t.trim().charAt(0);return td.test(e)?"rtl":"ltr"}),tm=null,tp=null,tf=null,tb=null,tA=()=>(tm||(tm=tC().concat(tx())),tm),tv=t=>g[t],tx=()=>(tp||(tp=Object.keys(g)),tp),ty=t=>X[t],tC=()=>(tf||(tf=Object.keys(X)),tf),tk=function(t,e){tE(t).textContent=e.replace(/%t/g,t)},tE=function(t){let e=document.createElement("style");e.setAttribute("type","text/css"),e.setAttribute("data-tag-name",t.toLowerCase());let i=tR();return i&&e.setAttribute("nonce",i),document.head.insertBefore(e,document.head.firstChild),e},tR=function(){let t=tS("trix-csp-nonce")||tS("csp-nonce");if(t)return t.getAttribute("content")},tS=t=>document.head.querySelector("meta[name=".concat(t,"]")),tL={"application/x-trix-feature-detection":"test"},tD=function(t){let e=t.getData("text/plain"),i=t.getData("text/html");if(!e||!i)return null==e?void 0:e.length;{let{body:t}=(new DOMParser).parseFromString(i,"text/html");if(t.textContent===e)return!t.querySelector("*")}},tw=/Mac|^iP/.test(navigator.platform)?t=>t.metaKey:t=>t.ctrlKey,tT=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e={};for(let i in t){let n=t[i];e[i]=n}return e},tF=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(let i in t)if(t[i]!==e[i])return!1;return!0},tB=function(t){if(null!=t)return Array.isArray(t)||(t=[t,t]),[tN(t[0]),tN(null!=t[1]?t[1]:t[0])]},tP=function(t){if(null==t)return;let[e,i]=tB(t);return tO(e,i)},tI=function(t,e){if(null==t||null==e)return;let[i,n]=tB(t),[r,s]=tB(e);return tO(i,r)&&tO(n,s)},tN=function(t){return"number"==typeof t?t:tT(t)},tO=function(t,e){return"number"==typeof t?t===e:tF(t,e)};class tM extends tt{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()}}let tj=new tM,tW=function(){let t=window.getSelection();if(t.rangeCount>0)return t},tU=function(){var t;let e=null==(t=tW())?void 0:t.getRangeAt(0);if(e&&!tV(e))return e},tq=function(t){let e=window.getSelection();return e.removeAllRanges(),e.addRange(t),tj.update()},tV=t=>tH(t.startContainer)||tH(t.endContainer),tH=t=>!Object.getPrototypeOf(t),tz=t=>t.replace(RegExp("".concat("\uFEFF"),"g"),"").replace(RegExp("".concat("\xa0"),"g")," "),t_=new RegExp("[^\\S".concat("\xa0","]")),tJ=t=>t.replace(RegExp("".concat(t_.source),"g")," ").replace(/\ {2,}/g," "),tK=function(t,e){let i;if(t.isEqualTo(e))return["",""];let n=tG(t,e),{length:r}=n.utf16String;if(r){let{offset:s}=n,o=t.codepoints.slice(0,s).concat(t.codepoints.slice(s+r));i=tG(e,tr.fromCodepoints(o))}else i=tG(e,t);return[n.utf16String.toString(),i.utf16String.toString()]},tG=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 t$ extends th{static fromCommonAttributesOfObjects(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(!t.length)return new this;let e=tZ(t[0]),i=e.getKeys();
1return t.slice(1).forEach(t=>{i=e.getKeysCommonToHash(tZ(t)),e=e.slice(i)}),e}static box(t){return tZ(t)}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(...arguments),this.values=tQ(t)}add(t,e){return this.merge(tX(t,e))}remove(t){return new t$(tQ(this.values,t))}get(t){return this.values[t]}has(t){return t in this.values}merge(t){return new t$(tY(this.values,t0(t)))}slice(t){let e={};return Array.from(t).forEach(t=>{this.has(t)&&(e[t]=this.values[t])}),new t$(e)}getKeys(){return Object.keys(this.values)}getKeysCommonToHash(t){return t=tZ(t),this.getKeys().filter(e=>this.values[e]===t.values[e])}isEqualTo(t){return tu(this.toArray(),tZ(t).toArray())}isEmpty(){return 0===this.getKeys().length}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 tQ(this.values)}toJSON(){return this.toObject()}contentsForInspection(){return{values:JSON.stringify(this.values)}}}let tX=function(t,e){let i={};return i[t]=e,i},tY=function(t,e){let i=tQ(t);for(let t in e){let n=e[t];i[t]=n}return i},tQ=function(t,e){let i={};return Object.keys(t).sort().forEach(n=>{n!==e&&(i[n]=t[n])}),i},tZ=function(t){return t instanceof t$?t:new t$(t)},t0=function(t){return t instanceof t$?t.values:t};class t1{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);let r=[];return Array.from(e).forEach(e=>{var s,o,a,l;if(t){if(null!=(o=e.canBeGrouped)&&o.call(e,i)&&null!=(a=(l=t[t.length-1]).canBeGroupedWith)&&a.call(l,e,i))return void t.push(e);r.push(new this(t,{depth:i,asTree:n})),t=null}null!=(s=e.canBeGrouped)&&s.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(){let t=["objectGroup"];return Array.from(this.getObjects()).forEach(e=>{t.push(e.getCacheKey())}),t.join("/")}}class t2 extends tt{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];super(...arguments),this.objects={},Array.from(t).forEach(t=>{let e=JSON.stringify(t);null==this.objects[e]&&(this.objects[e]=t)})}find(t){let e=JSON.stringify(t);return this.objects[e]}}class t6{constructor(t){this.reset(t)}add(t){let e=t3(t);this.elements[e]=t}remove(t){let e=t3(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}}let t3=t=>t.dataset.trixStoreKey;class t5 extends tt{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)||null==(e=t.cancel)||e.call(t),this.promise=null,this.performing=null,this.performed=null,this.succeeded=null}}t5.proxyMethod("getPromise().then"),t5.proxyMethod("getPromise().catch");class t4 extends tt{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.invalidate()}invalidateViewForObject(t){var e;return null==(e=this.findViewForObject(t))?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 t1&&(i.viewClass=t,t=t7);let n=new t(e,i);return this.recordChildView(n)}recordChildView(t){return t.parentView=this,t.rootView=this.root
1View,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=null==t?void 0: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!1!==this.shouldCacheViews}enableViewCaching(){this.shouldCacheViews=!0}disableViewCaching(){this.shouldCacheViews=!1}getCachedViewForObject(t){var e;return null==(e=this.getViewCache())?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(t=>t.object.getCacheKey());for(let i in t)e.includes(i)||delete t[i]}}}class t7 extends t4{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(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)}}let{css:t9}=Z;class t8 extends t4{constructor(){super(...arguments),this.attachment=this.object,this.attachment.uploadProgressDelegate=this,this.attachmentPiece=this.options.piece}createContentNodes(){return[]}createNodes(){let t,e=t=j({tagName:"figure",className:this.getClassName(),data:this.getData(),editable:!1}),i=this.getHref();return i&&(t=j({tagName:"a",editable:!1,attributes:{href:i,tabindex:-1}}),e.appendChild(t)),this.attachment.hasContent()?t.innerHTML=this.attachment.getContent():this.createContentNodes().forEach(e=>{t.appendChild(e)}),t.appendChild(this.createCaptionElement()),this.attachment.isPending()&&(this.progressElement=j({tagName:"progress",attributes:{class:t9.attachmentProgress,value:this.attachment.getUploadProgress(),max:100},data:{trixMutable:!0,trixStoreKey:["progressElement",this.attachment.id].join("/")}}),e.appendChild(this.progressElement)),[et("left"),e,et("right")]}createCaptionElement(){let t=j({tagName:"figcaption",className:t9.attachmentCaption}),e=this.attachmentPiece.getCaption();if(e)t.classList.add("".concat(t9.attachmentCaption,"--edited")),t.textContent=e;else{let e,i,n=this.getCaptionConfig();if(n.name&&(e=this.attachment.getFilename()),n.size&&(i=this.attachment.getFormattedFilesize()),e){let i=j({tagName:"span",className:t9.attachmentName,textContent:e});t.appendChild(i)}if(i){e&&t.appendChild(document.createTextNode(" "));let n=j({tagName:"span",className:t9.attachmentSize,textContent:i});t.appendChild(n)}}return t}getClassName(){let t=[t9.attachment,"".concat(t9.attachment,"--").concat(this.attachment.getType())],e=this.attachment.getExtension();return e&&t.push("".concat(t9.attachment,"--").concat(e)),t.join(" ")}getData(){let t={trixAttachment:JSON.stringify(this.attachment),trixContentType:this.attachment.getContentType(),trixId:this.attachment.id},{attributes:e}=this.attachmentPiece;return e.isEmpty()||(t.trixAttributes=JSON.stringify(e)),this.attachment.isPending()&&(t.trixSerialize=!1),t}getHref(){if(!ee(this.attachment.getContent(),"a"))return this.attachment.getHref()}getCaptionConfig(){var t;let e=this.attachment.getType(),i=tT(null==(t=d[e])?void 0:t.caption);return"file"===e&&(i.name=!0),i}findProgressElement(){var t;return null==(t=this.findElement())?void 0:t.querySelector("progress")}attachmentDidChangeUploadProgress(){let t=this.attachment.getUploadProgress(),e=this.findProgressElement();e&&(e.value=t)}}let et=t=>j({tagName:"span",textContent:"\uFEFF",data:{trixCursorTarget:t,trixSerialize:!1}}),ee=function(t,e){let i=j("div");return i.innerHTML=t||"",i.querySelector(e)};class ei extends t8{constructor(){super(...arguments),this.attachment.previewDelegate=this}createContentNodes(){return this.image=j({tagName:"img",attributes:{src:""},data:{trixMutable:!0}}),this.refresh(this.image),[this.image]}createCaptionElement(){let t=super.createCaptionElement(...arguments);return t.textContent||t.setAttribute("data-trix-placeholder",C.captionPlaceholder),t}refresh(t){var e;if(t||(t=null==(e=this.findElement())?void 0:e.querySelector("img")),t)return this.updateAttributesForImage(t)}updateAttributesForImage(t){let e=this.attachment.getURL(),i=this.attachment.getPreviewURL();if(t.src=i||e,i===e)t.removeAttribute("data-trix-serialized-attributes");else{let i=JSON.stringify({src:e});t.setAttribute("data-trix-serialized-attributes",i)}let n=this.attachment.getWidth(),r=this.attachment.getHeight();null!=n&&(t.width=n),null!=r&&(t.height=r);let s=["imageElement",this.attachment.id,t.src,t.width,t.height].join("/");t.dataset.trixStoreKey=s}attachmentDidChangeAttributes(){return this.refresh(this.image),this.refresh()}}class en extends t4{constructor(){super(...arguments),this.piece=this.object,this.attributes=this.piece.getAttributes(),this.textConfig=this.options.textConfig,this.context=this.options.context,this.piece.attachment?this.attachment=this.piece.attachment:this.string=this.piece.toString()}createNodes(){let t=this.attachment?this.createAttachmentNodes():this.createStringNodes(),e=this.createElement();if(e){let i=function(t){for(;null!=(e=t)&&e.firstElementChild;){var e;t=t.firstElementChild}return t}(e);Array.from(t).forEach(t=>{i.appendChild(t)}),t=[e]}return t}createAttachmentNodes(){let t=this.attachment.isPreviewable()?ei:t8;return this.createChildView(t,this.piece.attachment,{piece:this.piece}).getNodes()}createStringNodes(){var t;if(null!=(t=this.textConfig)&&t.plaintext)return[document.createTextNode(this.string)];{let t=[],e=this.string.split("\n");for(let i=0;i<e.length;i++){let n=e[i];if(i>0){let e=j("br");t.push(e)}if(n.length){let e=document.createTextNode(this.preserveSpaces(n));t.push(e)}}return t}}createElement(){let t,e,i,n={};for(e in this.attributes){i=this.attributes[e];let s=ty(e);if(s){if(s.tagName){var r;let e=j(s.tagName);r?(r.appendChild(e),r=e):t=r=e}if(s.styleProperty&&(n[s.styleProperty]=i),s.style)for(e in s.style)i=s.style[e],n[e]=i}}if(Object.keys(n).length)for(e in t||(t=j("span")),n)i=n[e],t.style[e]=i;return t}createContainerElement(){for(let t in this.attributes){let e=this.attributes[t],i=ty(t);if(i&&i.groupTagName){let n={};return n[t]=e,j(i.groupTagName,n)}}}
1preserveSpaces(t){return this.context.isLast&&(t=t.replace(/\ $/,"\xa0")),t=t.replace(/(\S)\ {3}(\S)/g,"$1 ".concat("\xa0"," $2")).replace(/\ {2}/g,"".concat("\xa0"," ")).replace(/\ {2}/g," ".concat("\xa0")),(this.context.isFirst||this.context.followsWhitespace)&&(t=t.replace(/^\ /,"\xa0")),t}}class er extends t4{constructor(){super(...arguments),this.text=this.object,this.textConfig=this.options.textConfig}createNodes(){let t=[],e=t1.groupObjects(this.getPieces()),i=e.length-1;for(let r=0;r<e.length;r++){let s=e[r],o={};0===r&&(o.isFirst=!0),r===i&&(o.isLast=!0),es(n)&&(o.followsWhitespace=!0);let a=this.findOrCreateCachedChildView(en,s,{textConfig:this.textConfig,context:o});t.push(...Array.from(a.getNodes()||[]));var n=s}return t}getPieces(){return Array.from(this.text.getPieces()).filter(t=>!t.hasAttribute("blockBreak"))}}let es=t=>/\s$/.test(null==t?void 0:t.toString()),{css:eo}=Z;class ea extends t4{constructor(){super(...arguments),this.block=this.object,this.attributes=this.block.getAttributes()}createNodes(){let t=[document.createComment("block")];if(this.block.isEmpty())t.push(j("br"));else{var e;let i=null==(e=tv(this.block.getLastAttribute()))?void 0:e.text,n=this.findOrCreateCachedChildView(er,this.block.text,{textConfig:i});t.push(...Array.from(n.getNodes()||[])),this.shouldAddExtraNewlineElement()&&t.push(j("br"))}if(this.attributes.length)return t;{let e,{tagName:i}=g.default;this.block.isRTL()&&(e={dir:"rtl"});let n=j({tagName:i,attributes:e});return t.forEach(t=>n.appendChild(t)),[n]}}createContainerElement(t){let e,i={},n=this.attributes[t],{tagName:r,htmlAttributes:s=[]}=tv(n);if(0===t&&this.block.isRTL()&&Object.assign(i,{dir:"rtl"}),"attachmentGallery"===n){let t=this.block.getBlockBreakPosition();e="".concat(eo.attachmentGallery," ").concat(eo.attachmentGallery,"--").concat(t)}return Object.entries(this.block.htmlAttributes).forEach(t=>{let[e,n]=t;s.includes(e)&&(i[e]=n)}),j({tagName:r,className:e,attributes:i})}
1shouldAddExtraNewlineElement(){return/\n\n$/.test(this.block.toString())}}class el extends t4{static render(t){let e=j("div"),i=new this(t,{element:e});return i.render(),i.sync(),e}constructor(){super(...arguments),this.element=this.options.element,this.elementStore=new t6,this.setDocument(this.object)}setDocument(t){t.isEqualTo(this.document)||(this.document=this.object=t)}render(){this.childViews=[],this.shadowElement=j("div"),this.document.isEmpty()||Array.from(t1.groupObjects(this.document.getBlocks(),{asTree:!0})).forEach(t=>{Array.from(this.findOrCreateCachedChildView(ea,t).getNodes()).map(t=>this.shadowElement.appendChild(t))})}isSynced(){return eu(this.shadowElement,this.element)}sync(){let t=this.createDocumentFragmentForSync();for(;this.element.lastChild;)this.element.removeChild(this.element.lastChild);return this.element.appendChild(t),this.didSync()}didSync(){return this.elementStore.reset(eh(this.element)),setTimeout(()=>this.garbageCollectCachedViews(),1)}createDocumentFragmentForSync(){let t=document.createDocumentFragment();return Array.from(this.shadowElement.childNodes).forEach(e=>{t.appendChild(e.cloneNode(!0))}),Array.from(eh(t)).forEach(t=>{let e=this.elementStore.remove(t);e&&t.parentNode.replaceChild(e,t)}),t}}let eh=t=>t.querySelectorAll("[data-trix-store-key]"),eu=(t,e)=>ec(t.innerHTML)===ec(e.innerHTML),ec=t=>t.replace(/&nbsp;/g," ");function ed(t){var e,i;function n(e,i){try{var s=t[e](i),o=s.value,a=o instanceof eg;Promise.resolve(a?o.v:o).then(function(i){if(a){var l="return"===e?"return":"next";if(!o.k||i.done)return n(l,i);i=t[l](i).value}r(s.done?"return":"normal",i)},function(t){n("throw",t)})}catch(t){r("throw",t)}}function r(t,r){switch(t){case"return":e.resolve({value:r,done:!0});break;case"throw":e.reject(r);break;default:e.resolve({value:r,done:!1})}(e=e.next)?n(e.key,e.arg):i=null}this._invoke=function(t,r){return new Promise(function(s,o){var a={key:t,arg:r,resolve:s,reject:o,next:null};i?i=i.next=a:(e=i=a,n(t,r))})},"function"!=typeof t.return&&(this.return=void 0)}function eg(t,e){this.v=t,this.k=e}function em(t,e,i){var n;return(e="symbol"==typeof(n=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(e,"string"))?n:String(n))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}ed.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},ed.prototype.next=function(t){return this._invoke("next",t)},ed.prototype.throw=function(t){return this._invoke("throw",t)},ed.prototype.return=function(t){return this._invoke("return",t)};class ep extends th{static registerType(t,e){e.type=t,this.types[t]=e}static fromJSON(t){let e=this.types[t.type];if(e)return e.fromJSON(t)}constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(...arguments),this.attributes=t$.box(e)}copyWithAttributes(t){return new this.constructor(this.getValue(),t)}copyWithAdditionalAttributes(t){return this.copyWithAttributes(this.attributes.merge(t))}copyWithoutAttribute(t){return this.copyWithAttributes(this.attributes.remove(t))}copy(){return this.copyWithAttributes(this.attributes)}getAttribute(t){return this.attributes.get(t)}getAttributesHash(){return this.attributes}getAttributes(){return this.attributes.toObject()}hasAttribute(t){return this.attributes.has(t)}hasSameStringValueAsPiece(t){return t&&this.toString()===t.toString()}hasSameAttributesAsPiece(t){return t&&(this.attributes===t.attributes||this.attributes.isEqualTo(t.attributes))}isBlockBreak(){return!1}isEqualTo(t){return super.isEqualTo(...arguments)||this.hasSameConstructorAs(t)&&this.hasSameStringValueAsPiece(t)&&this.hasSameAttributesAsPiece(t)}isEmpty(){return 0===this.length}isSerializable(){return!0}toJSON(){return{type:this.constructor.type,attributes:this.getAttributes()}}contentsForInspection(){return{type:this.constructor.type,attributes:this.attributes.inspect()}}canBeGrouped(){return this.hasAttribute("href")}canBeGroupedWith(t){return this.getAttribute("href")===t.getAttribute("href")}getLength(){return this.length}canBeConsolidatedWith(t){return!1}}em(ep,"types",{});class ef extends t5{constructor(t){super(...arguments),this.url=t}perform(t){let e=new Image;e.onload=()=>
1(e.width=this.width=e.naturalWidth,e.height=this.height=e.naturalHeight,t(!0,e)),e.onerror=()=>t(!1),e.src=this.url}}class eb extends th{static attachmentForFile(t){let e=new this(this.attributesForFile(t));return e.setFile(t),e}static attributesForFile(t){return new t$({filename:t.name,filesize:t.size,contentType:t.type})}static fromJSON(t){return new this(t)}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(t),this.releaseFile=this.releaseFile.bind(this),this.attributes=t$.box(t),this.didChangeAttributes()}getAttribute(t){return this.attributes.get(t)}hasAttribute(t){return this.attributes.has(t)}getAttributes(){return this.attributes.toObject()}setAttributes(){var t,e,i,n;let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=this.attributes.merge(r);if(!this.attributes.isEqualTo(s))return this.attributes=s,this.didChangeAttributes(),null==(t=this.previewDelegate)||null==(e=t.attachmentDidChangeAttributes)||e.call(t,this),null==(i=this.delegate)||null==(n=i.attachmentDidChangeAttributes)?void 0:n.call(i,this)}didChangeAttributes(){if(this.isPreviewable())return this.preloadURL()}isPending(){return null!=this.file&&!(this.getURL()||this.getHref())}isPreviewable(){return this.attributes.has("previewable")?this.attributes.get("previewable"):eb.previewablePattern.test(this.getContentType())}getType(){return this.hasContent()?"content":this.isPreviewable()?"preview":"file"}getURL(){return this.attributes.get("url")}getHref(){return this.attributes.get("href")}getFilename(){return this.attributes.get("filename")||""}getFilesize(){return this.attributes.get("filesize")}getFormattedFilesize(){let t=this.attributes.get("filesize");return"number"==typeof t?E.formatter(t):""}getExtension(){var t;return null==(t=this.getFilename().match(/\.(\w+)$/))?void 0:t[1].toLowerCase()}getContentType(){return this.attributes.get("contentType")}hasContent(){return this.attributes.has("content")}getContent(){return this.attributes.get("content")}getWidth(){return this.attributes.get("width")}getHeight(){return this.attributes.get("height")}getFile(){return this.file}setFile(t){if(this.file=t,this.isPreviewable())return this.preloadFile()}releaseFile(){this.releasePreloadedFile(),this.file=null}getUploadProgress(){return null!=this.uploadProgress?this.uploadProgress:0}setUploadProgress(t){var e,i;if(this.uploadProgress!==t)return this.uploadProgress=t,null==(e=this.uploadProgressDelegate)||null==(i=e.attachmentDidChangeUploadProgress)?void 0:i.call(e,this)}toJSON(){return this.getAttributes()}getCacheKey(){return[super.getCacheKey(...arguments),this.attributes.getCacheKey(),this.getPreviewURL()].join("/")}getPreviewURL(){return this.previewURL||this.preloadingURL}setPreviewURL(t){var e,i,n,r;if(t!==this.getPreviewURL())return this.previewURL=t,null==(e=this.previewDelegate)||null==(i=e.attachmentDidChangeAttributes)||i.call(e,this),null==(n=this.delegate)||null==(r=n.attachmentDidChangePreviewURL)?void 0:r.call(n,this)}preloadURL(){return this.preload(this.getURL(),this.releaseFile)}preloadFile(){if(this.file)return this.fileObjectURL=URL.createObjectURL(this.file),this.preload(this.fileObjectURL)}releasePreloadedFile(){this.fileObjectURL&&(URL.revokeObjectURL(this.fileObjectURL),this.fileObjectURL=null)}preload(t,e){if(t&&t!==this.getPreviewURL())return this.preloadingURL=t,new ef(t).then(i=>{let{width:n,height:r}=i;return this.getWidth()&&this.getHeight()||this.setAttributes({width:n,height:r}),this.preloadingURL=null,this.setPreviewURL(t),null==e?void 0:e()}).catch(()=>(this.preloadingURL=null,null==e?void 0:e()))}}em(eb,"previewablePattern",/^image(\/(gif|png|webp|jpe?g)|$)/);class eA extends ep{static fromJSON(t){return new this(eb.fromJSON(t.attachment),t.attributes)}constructor(t){super(...arguments),this.attachment=t,this.length=1,this.ensureAttachmentExclusivelyHasAttribute("href"),this.attachment.hasContent()||this.removeProhibitedAttributes()}ensureAttachmentExclusivelyHasAttribute(t){this.hasAttribute(t)&&(this.attachment.hasAttribute(t)||this.attachment.setAttributes(this.attributes.slice([t])),this.attributes=this.attributes.remove(t))}removeProhibitedAttributes(){let t=this.attributes.slice(eA.permittedAttributes);t.isEqualTo(this.attributes)||(this.attributes=t)}getValue(){return this.attachment}isSerializable(){return!this.attachment.isPending()}getCaption(){return this.attributes.get("caption")||""}isEqualTo(t){var e;return super.isEqualTo(t)&&this.attachment.id===(null==t||null==(e=t.attachment)?void 0:e.id)}toString(){return""}toJSON(){let t=super.toJSON(...arguments);return t.attachment=this.attachment,t}getCacheKey(){return[super.getCacheKey(...arguments),this.attachment.getCacheKey()].join("/")}toConsole(){return JSON.stringify(this.toString())}}em(eA,"permittedAttributes",["caption","presentation"]),ep.registerType("attachment",eA);class ev extends ep{static fromJSON(t){return new this(t.string,t.attributes)}constructor(t){super(...arguments),this.string=(t=>t.replace(/\r\n?/g,"\n"))(t),this.length=this.string.length}getValue(){return this.string}toString(){return this.string.toString()}isBlockBreak(){return"\n"===this.toString()&&!0===this.getAttribute("blockBreak")}toJSON(){let t=super.toJSON(...arguments);return t.string=this.string,t}canBeConsolidatedWith(t){return t&&this.hasSameConstructorAs(t)&&this.hasSameAttributesAsPiece(t)}consolidateWith(t){return new this.constructor(this.toString()+t.toString(),this.attributes)}splitAtOffset(t){let e,i;return 0===t?(e=null,i=this):t===this.length?(e=this,i=null):(e=new this.constructor(this.string.slice(0,t),this.attributes),i=new this.constructor(this.string.slice(t),this.attributes)),[e,i]}toConsole(){let{string:t}=this;return t.length>15&&(t=t.slice(0,14)+"…"),JSON.stringify(t.toString())}}ep.registerType("string",ev);class ex extends th{static box(t){return t instanceof this?t:new this(t)}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];super(...arguments),this.objects=t.slice(0),this.length=this.objects.length}indexOf(t){return this.objects.indexOf(t)}splice(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];return new this.constructor(tc(this.objects,...e))}eachObject(t){return this.objects.map((e,i)=>t(e,i))}insertObjectAtIndex(t,e){return this.splice(e,0,t)}insertSplittableListAtIndex(t,e){return this.splice(e,0,...t.objects)}insertSplittableListAtPosition(t,e){let[i,n]=this.splitObjectAtPosition(e);return new this.constructor(i).insertSplittableListAtIndex(t,n)}editObjectAtIndex(t,e){return this.replaceObjectAtIndex(e(this.objects[t]),t)}replaceObjectAtIndex(t,e){return this.splice(e,1,t)}removeObjectAtIndex(t){return this.splice(t,1)}getObjectAtIndex(t){return this.objects[t]}getSplittableListInRange(t){let[e,i,n]=this.splitObjectsAtRange(t);return new this.constructor(e.slice(i,n+1))}selectSplittableList(t){let e=this.objects.filter(e=>t(e));return new this.constructor(e)}removeObjectsInRange(t){let[e,i,n]=this.splitObjectsAtRange(t);return new this.constructor(e).splice(i,n-i+1)}transformObjectsInRange(t,e){let[i,n,r]=this.splitObjectsAtRange(t),s=i.map((t,i)=>n<=i&&i<=r?e(t):t);return new this.constructor(s)}splitObjectsAtRange(t){let e,[i,n,r]=this.splitObjectAtPosition(eC(t));return[i,e]=new this.constructor(i).splitObjectAtPosition(ek(t)+r),[i,n,e-1]}getObjectAtPosition(t){let{index:e}=this.findIndexAndOffsetAtPosition(t);return this.objects[e]}splitObjectAtPosition(t){let e,i,{index:n,offset:r}=this.findIndexAndOffsetAtPosition(t),s=this.objects.slice(0);if(null!=n)if(0===r)e=n,i=0;else{let[t,o]=this.getObjectAtIndex(n).splitAtOffset(r);s.splice(n,1,t,o),e=n+1,i=t.getLength()-r}else e=s.length,i=0;return[s,e,i]}consolidate(){let t=[],e=this.objects[0];
1return this.objects.slice(1).forEach(i=>{var n,r;null!=(n=(r=e).canBeConsolidatedWith)&&n.call(r,i)?e=e.consolidateWith(i):(t.push(e),e=i)}),e&&t.push(e),new this.constructor(t)}consolidateFromIndexToIndex(t,e){let i=this.objects.slice(0).slice(t,e+1),n=new this.constructor(i).consolidate().toArray();return this.splice(t,i.length,...n)}findIndexAndOffsetAtPosition(t){let e,i=0;for(e=0;e<this.objects.length;e++){let n=i+this.objects[e].getLength();if(i<=t&&t<n)return{index:e,offset:t-i};i=n}return{index:null,offset:null}}findPositionAtIndexAndOffset(t,e){let i=0;for(let n=0;n<this.objects.length;n++){let r=this.objects[n];if(n<t)i+=r.getLength();else if(n===t){i+=e;break}}return i}getEndPosition(){return null==this.endPosition&&(this.endPosition=0,this.objects.forEach(t=>this.endPosition+=t.getLength())),this.endPosition}toString(){return this.objects.join("")}toArray(){return this.objects.slice(0)}toJSON(){return this.toArray()}isEqualTo(t){return super.isEqualTo(...arguments)||ey(this.objects,null==t?void 0:t.objects)}contentsForInspection(){return{objects:"[".concat(this.objects.map(t=>t.inspect()).join(", "),"]")}}}let ey=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(t.length!==e.length)return!1;let i=!0;for(let n=0;n<t.length;n++){let r=t[n];i&&!r.isEqualTo(e[n])&&(i=!1)}return i},eC=t=>t[0],ek=t=>t[1];class eE extends th{static textForAttachmentWithAttributes(t,e){return new this([new eA(t,e)])}static textForStringWithAttributes(t,e){return new this([new ev(t,e)])}static fromJSON(t){return new this(Array.from(t).map(t=>ep.fromJSON(t)))}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];super(...arguments);const e=t.filter(t=>!t.isEmpty());this.pieceList=new ex(e)}copy(){return this.copyWithPieceList(this.pieceList)}copyWithPieceList(t){return new this.constructor(t.consolidate().toArray())}copyUsingObjectMap(t){let e=this.getPieces().map(e=>t.find(e)||e);return new this.constructor(e)}appendText(t){return this.insertTextAtPosition(t,this.getLength())}insertTextAtPosition(t,e){return this.copyWithPieceList(this.pieceList.insertSplittableListAtPosition(t.pieceList,e))}removeTextAtRange(t){return this.copyWithPieceList(this.pieceList.removeObjectsInRange(t))}replaceTextAtRange(t,e){return this.removeTextAtRange(e).insertTextAtPosition(t,e[0])}moveTextFromRangeToPosition(t,e){if(t[0]<=e&&e<=t[1])return;let i=this.getTextAtRange(t),n=i.getLength();return t[0]<e&&(e-=n),this.removeTextAtRange(t).insertTextAtPosition(i,e)}addAttributeAtRange(t,e,i){let n={};return n[t]=e,this.addAttributesAtRange(n,i)}addAttributesAtRange(t,e){return this.copyWithPieceList(this.pieceList.transformObjectsInRange(e,e=>e.copyWithAdditionalAttributes(t)))}removeAttributeAtRange(t,e){return this.copyWithPieceList(this.pieceList.transformObjectsInRange(e,e=>e.copyWithoutAttribute(t)))}setAttributesAtRange(t,e){return this.copyWithPieceList(this.pieceList.transformObjectsInRange(e,e=>e.copyWithAttributes(t)))}getAttributesAtPosition(t){var e;return(null==(e=this.pieceList.getObjectAtPosition(t))?void 0:e.getAttributes())||{}}getCommonAttributes(){let t=Array.from(this.pieceList.toArray()).map(t=>t.getAttributes());return t$.fromCommonAttributesOfObjects(t).toObject()}getCommonAttributesAtRange(t){return this.getTextAtRange(t).getCommonAttributes()||{}}getExpandedRangeForAttributeAtOffset(t,e){let i,n=i=e,r=this.getLength();for(;n>0&&this.getCommonAttributesAtRange([n-1,i])[t];)n--;for(;i<r&&this.getCommonAttributesAtRange([e,i+1])[t];)i++;return[n,i]}getTextAtRange(t){return this.copyWithPieceList(this.pieceList.getSplittableListInRange(t))}getStringAtRange(t){return this.pieceList.getSplittableListInRange(t).toString()}getStringAtPosition(t){return this.getStringAtRange([t,t+1])}startsWithString(t){return this.getStringAtRange([0,t.length])===t}endsWithString(t){let e=this.getLength();return this.getStringAtRange([e-t.length,e])===t}getAttachmentPieces(){return this.pieceList.toArray().filter(t=>!!t.attachment)}getAttachments(){return this.getAttachmentPieces().map(t=>t.attachment)}getAttachmentAndPositionById(t){let e=0;for(let n of this.pieceList.toArray()){var i;if((null==(i=n.attachment)?void 0:i.id)===t)return{attachment:n.attachment,position:e};e+=n.length}return{attachment:null,position:null}}getAttachmentById(t){let{attachment:e}=this.getAttachmentAndPositionById(t);return e}getRangeOfAttachment(t){let e=this.getAttachmentAndPositionById(t.id),i=e.position;if(t=e.attachment)return[i,i+1]}updateAttributesForAttachment(t,e){let i=this.getRangeOfAttachment(e);return i?this.addAttributesAtRange(t,i):this}getLength(){return this.pieceList.getEndPosition()}isEmpty(){return 0===this.getLength()}isEqualTo(t){var e;return super.isEqualTo(t)||(null==t||null==(e=t.pieceList)?void 0:e.isEqualTo(this.pieceList))}isBlockBreak(){return 1===this.getLength()&&this.pieceList.getObjectAtIndex(0).isBlockBreak()}eachPiece(t){return this.pieceList.eachObject(t)}getPieces(){return this.pieceList.toArray()}getPieceAtPosition(t){return this.pieceList.getObjectAtPosition(t)}contentsForInspection(){return{pieceList:this.pieceList.inspect()}}toSerializableText(){let t=this.pieceList.selectSplittableList(t=>t.isSerializable());return this.copyWithPieceList(t)}toString(){return this.pieceList.toString()}toJSON(){return this.pieceList.toJSON()}toConsole(){return JSON.stringify(this.pieceList.toArray().map(t=>JSON.parse(t.toConsole())))}getDirection(){return tg(this.toString())}isRTL(){return"rtl"===this.getDirection()}}class eR extends th{static fromJSON(t){return new this(eE.fromJSON(t.text),t.attributes,t.htmlAttributes)}constructor(t,e,i){super(...arguments),this.text=eS(t||new eE),this.attributes=e||[],this.htmlAttributes=i||{}}isEmpty(){return this.text.isBlockBreak()}isEqualTo(t){return!!super.isEqualTo(t)||this.text.isEqualTo(null==t?void 0:t.text)&&tu(this.attributes,null==t?void 0:t.attributes)&&tF(this.htmlAttributes,null==t?void 0:t.htmlAttributes)}copyWithText(t){return new eR(t,this.attributes,this.htmlAttributes)}copyWithoutText(){return this.copyWithText(null)}copyWithAttributes(t){return new eR(this.text,t,this.htmlAttributes)}copyWithoutAttributes(){return this.copyWithAttributes(null)}copyUsingObjectMap(t){let e=t.find(this.text);return e?this.copyWithText(e):this.copyWithText(this.text.copyUsingObjectMap(t))}addAttribute(t){let e=this.attributes.concat(eB(t));return this.copyWithAttributes(e)}addHTMLAttribute(t,e){let i=Object.assign({},this.htmlAttributes,{[t]:e});return new eR(this.text,this.attributes,i)}removeAttribute(t){let{listAttribute:e}=tv(t),i=eI(eI(this.attributes,t),e);return this.copyWithAttributes(i)}removeLastAttribute(){return this.removeAttribute(this.getLastAttribute())}getLastAttribute(){return eP(this.attributes)}getAttributes(){return this.attributes.slice(0)}getAttributeLevel(){return this.attributes.length}getAttributeAtLevel(t){return this.attributes[t-1]}hasAttribute(t){return this.attributes.includes(t)}hasAttributes(){return this.getAttributeLevel()>0}getLastNestableAttribute(){return eP(this.getNestableAttributes())}getNestableAttributes(){return this.attributes.filter(t=>tv(t).nestable)}getNestingLevel(){return this.getNestableAttributes().length}decreaseNestingLevel(){let t=this.getLastNestableAttribute();return t?this.removeAttribute(t):this}increaseNestingLevel(){let t=this.getLastNestableAttribute();if(t){let e=this.attributes.lastIndexOf(t),i=tc(this.attributes,e+1,0,...eB(t));return this.copyWithAttributes(i)}return this}getListItemAttributes(){return this.attributes.filter(t=>tv(t).listAttribute)}isListItem(){var t;return null==(t=tv(this.getLastAttribute()))?void 0:t.listAttribute}isTerminalBlock(){var t;return null==(t=tv(this.getLastAttribute()))?void 0:t.terminal}breaksOnReturn(){var t;return null==(t=tv(this.getLastAttribute()))?void 0:t.breakOnReturn}findLineBreakInDirectionFromPosition(t,e){let i,n=this.toString();switch(t){case"forward":i=n.indexOf("\n",e);break;case"backward":i=n.slice(0,e).lastIndexOf("\n")}if(-1!==i)return i}contentsForInspection(){return{text:this.text.inspect(),attributes:this.attributes}}toString(){return this.text.toString()}toJSON(){return{text:this.text,attributes:this.attributes,htmlAttributes:this.htmlAttributes}}getDirection(){return this.text.getDirection()}isRTL(){return this.text.isRTL()}getLength(){return this.text.getLength()}canBeConsolidatedWith(t){return!this.hasAttributes()&&!t.hasAttributes()&&this.getDirection()===t.getDirection()}consolidateWith(t){let e=eE.textForStringWithAttributes("\n"),i=this.getTextWithoutBlockBreak().appendText(e);return this.copyWithText(i.appendText(t.text))}splitAtOffset(t){let e,i;return 0===t?(e=null,i=this):t===this.getLength()?(e=this,i=null):(e=this.copyWithText(this.text.getTextAtRange([0,t])),i=this.copyWithText(this.text.getTextAtRange([t,this.getLength()]))),[e,i]}getBlockBreakPosition(){return this.text.getLength()-1}getTextWithoutBlockBreak(){return eT(this.text)?this.text.getTextAtRange([0,this.getBlockBreakPosition()]):this.text.copy()}canBeGrouped(t){return this.attributes[t]}canBeGroupedWith(t,e){let i=t.getAttributes(),n=i[e],r=this.attributes[e];return r===n&&!(!1===tv(r).group&&!(()=>
1{if(!tb)for(let t in tb=[],g){let{listAttribute:e}=g[t];null!=e&&tb.push(e)}return tb})().includes(i[e+1]))&&(this.getDirection()===t.getDirection()||t.isEmpty())}}let eS=function(t){return ew(t=eL(t))},eL=function(t){let e=!1,i=t.getPieces(),n=i.slice(0,i.length-1),r=i[i.length-1];return r?(n=n.map(t=>t.isBlockBreak()?(e=!0,eF(t)):t),e?new eE([...n,r]):t):t},eD=eE.textForStringWithAttributes("\n",{blockBreak:!0}),ew=function(t){return eT(t)?t:t.appendText(eD)},eT=function(t){let e=t.getLength();return 0!==e&&t.getTextAtRange([e-1,e]).isBlockBreak()},eF=t=>t.copyWithoutAttribute("blockBreak"),eB=function(t){let{listAttribute:e}=tv(t);return e?[e,t]:[t]},eP=t=>t.slice(-1)[0],eI=function(t,e){let i=t.lastIndexOf(e);return -1===i?t:tc(t,i,1)};class eN extends th{static fromJSON(t){return new this(Array.from(t).map(t=>eR.fromJSON(t)))}static fromString(t,e){return new this([new eR(eE.textForStringWithAttributes(t,e))])}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];super(...arguments),0===t.length&&(t=[new eR]),this.blockList=ex.box(t)}isEmpty(){let t=this.getBlockAtIndex(0);return 1===this.blockList.length&&t.isEmpty()&&!t.hasAttributes()}copy(){let t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).consolidateBlocks?this.blockList.consolidate().toArray():this.blockList.toArray();return new this.constructor(t)}copyUsingObjectsFromDocument(t){let e=new t2(t.getObjects());return this.copyUsingObjectMap(e)}copyUsingObjectMap(t){let e=this.getBlocks().map(e=>t.find(e)||e.copyUsingObjectMap(t));return new this.constructor(e)}copyWithBaseBlockAttributes(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=this.getBlocks().map(e=>{let i=t.concat(e.getAttributes());return e.copyWithAttributes(i)});return new this.constructor(e)}replaceBlock(t,e){let i=this.blockList.indexOf(t);return -1===i?this:new this.constructor(this.blockList.replaceObjectAtIndex(e,i))}insertDocumentAtRange(t,e){let{blockList:i}=t,[n]=e=tB(e),{index:r,offset:s}=this.locationFromPosition(n),o=this,a=this.getBlockAtPosition(n);return tP(e)&&a.isEmpty()&&!a.hasAttributes()?o=new this.constructor(o.blockList.removeObjectAtIndex(r)):a.getBlockBreakPosition()===s&&n++,o=o.removeTextAtRange(e),new this.constructor(o.blockList.insertSplittableListAtPosition(i,n))}mergeDocumentAtRange(t,e){let i,n,[r]=e=tB(e),s=this.locationFromPosition(r),o=this.getBlockAtIndex(s.index).getAttributes(),a=t.getBaseBlockAttributes(),l=o.slice(-a.length);if(tu(a,l)){let e=o.slice(0,-a.length);i=t.copyWithBaseBlockAttributes(e)}else i=t.copy({consolidateBlocks:!0}).copyWithBaseBlockAttributes(o);let h=i.getBlockCount(),u=i.getBlockAtIndex(0);if(tu(o,u.getAttributes())){let t=u.getTextWithoutBlockBreak();if(n=this.insertTextAtRange(t,e),h>1){i=new this.constructor(i.getBlocks().slice(1));let e=r+t.getLength();n=n.insertDocumentAtRange(i,e)}}else n=this.insertDocumentAtRange(i,e);return n}insertTextAtRange(t,e){let[i]=e=tB(e),{index:n,offset:r}=this.locationFromPosition(i),s=this.removeTextAtRange(e);return new this.constructor(s.blockList.editObjectAtIndex(n,e=>e.copyWithText(e.text.insertTextAtPosition(t,r))))}removeTextAtRange(t){let e,[i,n]=t=tB(t);if(tP(t))return this;let[r,s]=Array.from(this.locationRangeFromRange(t)),o=r.index,a=r.offset,l=this.getBlockAtIndex(o),h=s.index,u=s.offset,c=this.getBlockAtIndex(h);if(n-i==1&&l.getBlockBreakPosition()===a&&c.getBlockBreakPosition()!==u&&"\n"===c.text.getStringAtPosition(u))e=this.blockList.editObjectAtIndex(h,t=>t.copyWithText(t.text.removeTextAtRange([u,u+1])));else{let t,i=l.text.getTextAtRange([0,a]),n=c.text.getTextAtRange([u,c.getLength()]),r=i.appendText(n);t=o!==h&&0===a&&l.getAttributeLevel()>=c.getAttributeLevel()?c.copyWithText(r):l.copyWithText(r);let s=h+1-o;e=this.blockList.splice(o,s,t)}return new this.constructor(e)}moveTextFromRangeToPosition(t,e){let i,[n,r]=t=tB(t);if(n<=e&&e<=r)return this;let s=this.getDocumentAtRange(t),o=this.removeTextAtRange(t),a=n<e;a&&(e-=s.getLength());let[l,...h]=s.getBlocks();return 0===h.length?(i=l.getTextWithoutBlockBreak(),a&&(e+=1)):i=l.text,o=o.insertTextAtRange(i,e),0===h.length?o:(s=new this.constructor(h),e+=i.getLength(),o.insertDocumentAtRange(s,e))}addAttributeAtRange(t,e,i){let{blockList:n}=this;return this.eachBlockAtRange(i,(i,r,s)=>n=n.editObjectAtIndex(s,function(){return tv(t)?i.addAttribute(t,e):r[0]===r[1]?i:i.copyWithText(i.text.addAttributeAtRange(t,e,r))})),new this.constructor(n)}addAttribute(t,e){let{blockList:i}=this;return this.eachBlock((n,r)=>i=i.editObjectAtIndex(r,()=>n.addAttribute(t,e))),new this.constructor(i)}removeAttributeAtRange(t,e){let{blockList:i}=this;return this.eachBlockAtRange(e,function(e,n,r){tv(t)?i=i.editObjectAtIndex(r,()=>e.removeAttribute(t)):n[0]!==n[1]&&(i=i.editObjectAtIndex(r,()=>e.copyWithText(e.text.removeAttributeAtRange(t,n))))}),new this.constructor(i)}updateAttributesForAttachment(t,e){let[i]=Array.from(this.getRangeOfAttachment(e)),{index:n}=this.locationFromPosition(i),r=this.getTextAtIndex(n);return new this.constructor(this.blockList.editObjectAtIndex(n,i=>i.copyWithText(r.updateAttributesForAttachment(t,e))))}removeAttributeForAttachment(t,e){let i=this.getRangeOfAttachment(e);return this.removeAttributeAtRange(t,i)}
1setHTMLAttributeAtPosition(t,e,i){let n=this.getBlockAtPosition(t),r=n.addHTMLAttribute(e,i);return this.replaceBlock(n,r)}insertBlockBreakAtRange(t){let e,[i]=t=tB(t),{offset:n}=this.locationFromPosition(i),r=this.removeTextAtRange(t);return 0===n&&(e=[new eR]),new this.constructor(r.blockList.insertSplittableListAtPosition(new ex(e),i))}applyBlockAttributeAtRange(t,e,i){let n=this.expandRangeToLineBreaksAndSplitBlocks(i),r=n.document;i=n.range;let s=tv(t);if(s.listAttribute){let e=(r=r.removeLastListAttributeAtRange(i,{exceptAttributeName:t})).convertLineBreaksToBlockBreaksInRange(i);r=e.document,i=e.range}else r=s.exclusive?r.removeBlockAttributesAtRange(i):s.terminal?r.removeLastTerminalAttributeAtRange(i):r.consolidateBlocksAtRange(i);return r.addAttributeAtRange(t,e,i)}removeLastListAttributeAtRange(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{blockList:i}=this;return this.eachBlockAtRange(t,function(t,n,r){let s=t.getLastAttribute();s&&tv(s).listAttribute&&s!==e.exceptAttributeName&&(i=i.editObjectAtIndex(r,()=>t.removeAttribute(s)))}),new this.constructor(i)}removeLastTerminalAttributeAtRange(t){let{blockList:e}=this;return this.eachBlockAtRange(t,function(t,i,n){let r=t.getLastAttribute();r&&tv(r).terminal&&(e=e.editObjectAtIndex(n,()=>t.removeAttribute(r)))}),new this.constructor(e)}removeBlockAttributesAtRange(t){let{blockList:e}=this;return this.eachBlockAtRange(t,function(t,i,n){t.hasAttributes()&&(e=e.editObjectAtIndex(n,()=>t.copyWithoutAttributes()))}),new this.constructor(e)}expandRangeToLineBreaksAndSplitBlocks(t){let e,[i,n]=t=tB(t),r=this.locationFromPosition(i),s=this.locationFromPosition(n),o=this,a=o.getBlockAtIndex(r.index);if(r.offset=a.findLineBreakInDirectionFromPosition("backward",r.offset),null!=r.offset&&(e=o.positionFromLocation(r),o=o.insertBlockBreakAtRange([e,e+1]),s.index+=1,s.offset-=o.getBlockAtIndex(r.index).getLength(),r.index+=1),r.offset=0,0===s.offset&&s.index>r.index)s.index-=1,s.offset=o.getBlockAtIndex(s.index).getBlockBreakPosition();else{let t=o.getBlockAtIndex(s.index);"\n"===t.text.getStringAtRange([s.offset-1,s.offset])?s.offset-=1:s.offset=t.findLineBreakInDirectionFromPosition("forward",s.offset),s.offset!==t.getBlockBreakPosition()&&(e=o.positionFromLocation(s),o=o.insertBlockBreakAtRange([e,e+1]))}return i=o.positionFromLocation(r),n=o.positionFromLocation(s),{document:o,range:t=tB([i,n])}}convertLineBreaksToBlockBreaksInRange(t){let[e]=t=tB(t),i=this.getStringAtRange(t).slice(0,-1),n=this;return i.replace(/.*?\n/g,function(t){e+=t.length,n=n.insertBlockBreakAtRange([e-1,e])}),{document:n,range:t}}consolidateBlocksAtRange(t){let[e,i]=t=tB(t),n=this.locationFromPosition(e).index,r=this.locationFromPosition(i).index;return new this.constructor(this.blockList.consolidateFromIndexToIndex(n,r))}getDocumentAtRange(t){t=tB(t);let e=this.blockList.getSplittableListInRange(t).toArray();return new this.constructor(e)}getStringAtRange(t){let e,i=t=tB(t);return i[i.length-1]!==this.getLength()&&(e=-1),this.getDocumentAtRange(t).toString().slice(0,e)}getBlockAtIndex(t){return this.blockList.getObjectAtIndex(t)}getBlockAtPosition(t){let{index:e}=this.locationFromPosition(t);return this.getBlockAtIndex(e)}getTextAtIndex(t){var e;return null==(e=this.getBlockAtIndex(t))?void 0:e.text}getTextAtPosition(t){let{index:e}=this.locationFromPosition(t);return this.getTextAtIndex(e)}getPieceAtPosition(t){let{index:e,offset:i}=this.locationFromPosition(t);return this.getTextAtIndex(e).getPieceAtPosition(i)}getCharacterAtPosition(t){let{index:e,offset:i}=this.locationFromPosition(t);return this.getTextAtIndex(e).getStringAtRange([i,i+1])}getLength(){return this.blockList.getEndPosition()}getBlocks(){return this.blockList.toArray()}getBlockCount(){return this.blockList.length}getEditCount(){return this.editCount}eachBlock(t){return this.blockList.eachObject(t)}eachBlockAtRange(t,e){let i,n,[r,s]=t=tB(t),o=this.locationFromPosition(r),a=this.locationFromPosition(s);if(o.index===a.index)return e(i=this.getBlockAtIndex(o.index),n=[o.offset,a.offset],o.index);for(let t=o.index;t<=a.index;t++)if(i=this.getBlockAtIndex(t)){switch(t){case o.index:n=[o.offset,i.text.getLength()];break;case a.index:n=[0,a.offset];break;default:n=[0,i.text.getLength()]}e(i,n,t)}}getCommonAttributesAtRange(t){let[e]=t=tB(t);if(tP(t))return this.getCommonAttributesAtPosition(e);{let e=[],i=[];return this.eachBlockAtRange(t,function(t,n){if(n[0]!==n[1])return e.push(t.text.getCommonAttributesAtRange(n)),i.push(eO(t))}
1),t$.fromCommonAttributesOfObjects(e).merge(t$.fromCommonAttributesOfObjects(i)).toObject()}}getCommonAttributesAtPosition(t){let e,i,{index:n,offset:r}=this.locationFromPosition(t),s=this.getBlockAtIndex(n);if(!s)return{};let o=eO(s),a=s.text.getAttributesAtPosition(r),l=s.text.getAttributesAtPosition(r-1),h=Object.keys(X).filter(t=>X[t].inheritable);for(e in l)((i=l[e])===a[e]||h.includes(e))&&(o[e]=i);return o}getRangeOfCommonAttributeAtPosition(t,e){let{index:i,offset:n}=this.locationFromPosition(e),[r,s]=Array.from(this.getTextAtIndex(i).getExpandedRangeForAttributeAtOffset(t,n));return tB([this.positionFromLocation({index:i,offset:r}),this.positionFromLocation({index:i,offset:s})])}getBaseBlockAttributes(){let t=this.getBlockAtIndex(0).getAttributes();for(let e=1;e<this.getBlockCount();e++){let i=this.getBlockAtIndex(e).getAttributes(),n=Math.min(t.length,i.length);t=(()=>{let e=[];for(let r=0;r<n&&i[r]===t[r];r++)e.push(i[r]);return e})()}return t}getAttachmentById(t){for(let e of this.getAttachments())if(e.id===t)return e}getAttachmentPieces(){let t=[];return this.blockList.eachObject(e=>{let{text:i}=e;return t=t.concat(i.getAttachmentPieces())}),t}getAttachments(){return this.getAttachmentPieces().map(t=>t.attachment)}getRangeOfAttachment(t){let e=0,i=this.blockList.toArray();for(let n=0;n<i.length;n++){let{text:r}=i[n],s=r.getRangeOfAttachment(t);if(s)return tB([e+s[0],e+s[1]]);e+=r.getLength()}}getLocationRangeOfAttachment(t){let e=this.getRangeOfAttachment(t);return this.locationRangeFromRange(e)}getAttachmentPieceForAttachment(t){for(let e of this.getAttachmentPieces())if(e.attachment===t)return e}findRangesForBlockAttribute(t){let e=0,i=[];return this.getBlocks().forEach(n=>{let r=n.getLength();n.hasAttribute(t)&&i.push([e,e+r]),e+=r}),i}findRangesForTextAttribute(t){let{withValue:e}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=0,n=[],r=[];return this.getPieces().forEach(s=>{let o=s.getLength();(e?s.getAttribute(t)===e:s.hasAttribute(t))&&(n[1]===i?n[1]=i+o:r.push(n=[i,i+o])),i+=o}),r}locationFromPosition(t){let e=this.blockList.findIndexAndOffsetAtPosition(Math.max(0,t));if(null!=e.index)return e;{let t=this.getBlocks();return{index:t.length-1,offset:t[t.length-1].getLength()}}}positionFromLocation(t){return this.blockList.findPositionAtIndexAndOffset(t.index,t.offset)}locationRangeFromPosition(t){return tB(this.locationFromPosition(t))}locationRangeFromRange(t){if(!(t=tB(t)))return;let[e,i]=Array.from(t);return tB([this.locationFromPosition(e),this.locationFromPosition(i)])}rangeFromLocationRange(t){let e;t=tB(t);let i=this.positionFromLocation(t[0]);return tP(t)||(e=this.positionFromLocation(t[1])),tB([i,e])}isEqualTo(t){return this.blockList.isEqualTo(null==t?void 0:t.blockList)}getTexts(){return this.getBlocks().map(t=>t.text)}getPieces(){let t=[];return Array.from(this.getTexts()).forEach(e=>{t.push(...Array.from(e.getPieces()||[]))}),t}getObjects(){return this.getBlocks().concat(this.getTexts()).concat(this.getPieces())}toSerializableDocument(){let t=[];return this.blockList.eachObject(e=>t.push(e.copyWithText(e.text.toSerializableText()))),new this.constructor(t)}toString(){return this.blockList.toString()}toJSON(){return this.blockList.toJSON()}toConsole(){return JSON.stringify(this.blockList.toArray().map(t=>JSON.parse(t.text.toConsole())))}}let eO=function(t){let e={},i=t.getLastAttribute();return i&&(e[i]=!0),e},eM="style href src width height language class".split(" "),ej="javascript:".split(" "),eW="script iframe form noscript".split(" ");class eU extends tt{static sanitize(t,e){let i=new this(t,e);return i.sanitize(),i}constructor(t){let{allowedAttributes:e,forbiddenProtocols:i,forbiddenElements:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(...arguments),this.allowedAttributes=e||eM,this.forbiddenProtocols=i||ej,this.forbiddenElements=n||eW,this.body=eq(t)}sanitize(){return this.sanitizeElements(),this.normalizeListElementNesting()}getHTML(){return this.body.innerHTML}getBody(){return this.body}sanitizeElements(){let t=O(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(t=>N(t)),this.body}sanitizeElement(t){return t.hasAttribute("href")&&this.forbiddenProtocols.includes(t.protocol)&&t.removeAttribute("href"),Array.from(t.attributes).forEac
1h(e=>{let{name:i}=e;this.allowedAttributes.includes(i)||0===i.indexOf("data-trix")||t.removeAttribute(i)}),t}normalizeListElementNesting(){return Array.from(this.body.querySelectorAll("ul,ol")).forEach(t=>{let e=t.previousElementSibling;e&&"li"===M(e)&&e.appendChild(t)}),this.body}elementIsRemovable(t){if((null==t?void 0:t.nodeType)===Node.ELEMENT_NODE)return this.elementIsForbidden(t)||this.elementIsntSerializable(t)}elementIsForbidden(t){return this.forbiddenElements.includes(M(t))}elementIsntSerializable(t){return"false"===t.getAttribute("data-trix-serialize")&&!_(t)}}let eq=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";t=t.replace(/<\/html[^>]*>[^]*$/i,"</html>");let e=document.implementation.createHTMLDocument("");return e.documentElement.innerHTML=t,Array.from(e.head.querySelectorAll("style")).forEach(t=>{e.body.appendChild(t)}),e.body},eV=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return{string:t=tz(t),attributes:e,type:"string"}},eH=(t,e)=>{try{let i=JSON.parse(t.getAttribute("data-trix-".concat(e)));return"text/html"===i.contentType&&i.content&&(i.content=eU.sanitize(i.content).getHTML()),i}catch(t){return{}}};class ez extends tt{static parse(t,e){let i=new this(t,e);return i.parse(),i}constructor(t){let{referenceElement:e}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(...arguments),this.html=t,this.referenceElement=e,this.blocks=[],this.blockElements=[],this.processedElements=[]}getDocument(){return eN.fromJSON(this.blocks)}parse(){try{this.createHiddenContainer();let t=eU.sanitize(this.html).getHTML();this.containerElement.innerHTML=t;let e=O(this.containerElement,{usingFilter:eG});for(;e.nextNode();)this.processNode(e.currentNode);return this.translateBlockElementMarginsToNewlines()}finally{this.removeHiddenContainer()}}createHiddenContainer(){return this.referenceElement?(this.containerElement=this.referenceElement.cloneNode(!1),this.containerElement.removeAttribute("id"),this.containerElement.setAttribute("data-trix-internal",""),this.containerElement.style.display="none",this.referenceElement.parentNode.insertBefore(this.containerElement,this.referenceElement.nextSibling)):(this.containerElement=j({tagName:"div",style:{display:"none"}}),document.body.appendChild(this.containerElement))}removeHiddenContainer(){return N(this.containerElement)}processNode(t){switch(t.nodeType){case Node.TEXT_NODE:if(!this.isInsignificantTextNode(t))return this.appendBlockForTextNode(t),this.processTextNode(t);break;case Node.ELEMENT_NODE:return this.appendBlockForElement(t),this.processElement(t)}}appendBlockForTextNode(t){let e=t.parentNode;if(e===this.currentBlockElement&&this.isBlockElement(t.previousSibling))return this.appendStringWithAttributes("\n");if(e===this.containerElement||this.isBlockElement(e)){var i;let t=this.getBlockAttributes(e),n=this.getBlockHTMLAttributes(e);tu(t,null==(i=this.currentBlock)?void 0:i.attributes)||(this.currentBlock=this.appendBlockForAttributesWithElement(t,e,n),this.currentBlockElement=e)}}appendBlockForElement(t){let e=this.isBlockElement(t),i=P(this.currentBlockElement,t);if(e&&!this.isBlockElement(t.firstChild)){if(!this.isInsignificantTextNode(t.firstChild)||!this.isBlockElement(t.firstElementChild)){let e=this.getBlockAttributes(t),n=this.getBlockHTMLAttributes(t);if(t.firstChild){if(i&&tu(e,this.currentBlock.attributes))return this.appendStringWithAttributes("\n");this.currentBlock=this.appendBlockForAttributesWithElement(e,t,n),this.currentBlockElement=t}}}else if(this.currentBlockElement&&!i&&!e){let e=this.findParentBlockElement(t);if(e)return this.appendBlockForElement(e);this.currentBlock=this.appendEmptyBlock(),this.currentBlockElement=null}}findParentBlockElement(t){let{parentElement:e}=t;for(;e&&e!==this.containerElement;){if(this.isBlockElement(e)&&this.blockElements.includes(e))return e;e=e.parentElement}return null}processTextNode(t){var e;let i=t.data;return e_(t.parentNode)||(i=tJ(i),eY(null==(e=t.previousSibling)?void 0:e.textContent)&&(i=e$(i))),this.appendStringWithAttributes(i,this.getTextAttributes(t.parentNode))}processElement(t){let e;if(_(t)){if(Object.keys(e=eH(t,"attachment")).length){let i=this.getTextAttributes(t);this.appendAttachmentWithAttributes(e,i),t.innerHTML=""}return this.processedElements.push(t)}switch(M(t)){case"br":return this.isExtraBR(t)||this.isBlockElement(t.nextSibling)||this.appendStringWithAttributes("\n",this.getTextAttributes(t)),this.processedElements.push(t);case"img":let i,n,r;e={url:t.getAttribute("src"),contentType:"image"};let s=(i=t.getAttribute("width"),n=t.getAttribute("height"),r={},i&&(r.width=parseInt(i,10)),n&&(r.height=parseInt(n,10)),r);for(let t in s){let i=s[t];e[t]=i}return this.appendAttachmentWithAttributes(e,this.getTextAttributes(t)),this.processedElements.push(t);case"tr":if(this.needsTableSeparator(t))return this.appendStringWithAttributes($.tableRowSeparator);break;case"td":if(this.needsTableSeparator(t))return this.appendStringWithAttributes($.tableCellSeparator)}}appendBlockForAttributesWithElement(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.blockElements.push(e);let n=function(){return{text:[],attributes:arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},htmlAttributes:arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}}}(t,i);return this.blocks.push(n),n}appendEmptyBlock(){return this.appendBlockForAttributesWithElement([],null)}appendStringWithAttributes(t,e){return this.appendPiece(eV(t,e))}appendAttachmentWithAttributes(t,e){return this.appendPiece(function(t){return{attachment:t,attributes:arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},type:"attachment"}}(t,e))}appendPiece(t){return 0===this.blocks.length&&this.appendEmptyBlock(),this.blocks[this.blocks.length-1].text.push(t)}appendStringToTextAtIndex(t,e){let{text:i}=this.blocks[e],n=i[i.length-1];if("string"!==(null==n?void 0:n.type))return i.push(eV(t));n.string+=t}prependStringToTextAtIndex(t,e){let{text:i}=this.blocks[e],n=i[0];if("string"!==(null==n?void 0:n.type))return i.unshift(eV(t));n.string=t+n.string}getTextAttributes(t){let e,i={};for(let n in X){let r=X[n];if(r.tagName&&F(t,{matchingSelector:r.tagName,untilNode:this.containerElement}))i[n]=!0;else if(r.parser){if(e=r.parser(t)){let s=!1;for(let i of this.findBlockElementAncestors(t))if(r.parser(i)===e){s=!0;break}s||(i[n]=e)}}else r.styleProperty&&(e=t.style[r.styleProperty])&&(i[n]=e)}if(_(t)){let n=eH(t,"attributes");for(let t in n)e=n[t],i[t]=e}return i}getBlockAttributes(t){let e=[];for(;t&&t!==this.containerElement;){for(let n in g){var i;let r=g[n];!1!==r.parse&&M(t)===r.tagName&&(null!=(i=r.test)&&i.call(r,t)||!r.test)&&(e.push(n),r.listAttribute&&e.push(r.listAttribute))}t=t.parentNode}return e.reverse()}getBlockHTMLAttributes(t){let e={},i=Object.values(g).find(e=>e.tagName===M(t));
1return((null==i?void 0:i.htmlAttributes)||[]).forEach(i=>{t.hasAttribute(i)&&(e[i]=t.getAttribute(i))}),e}findBlockElementAncestors(t){let e=[];for(;t&&t!==this.containerElement;){let i=M(t);W().includes(i)&&e.push(t),t=t.parentNode}return e}isBlockElement(t){if((null==t?void 0:t.nodeType)===Node.ELEMENT_NODE&&!_(t)&&!F(t,{matchingSelector:"td",untilNode:this.containerElement}))return W().includes(M(t))||"block"===window.getComputedStyle(t).display}isInsignificantTextNode(t){if((null==t?void 0:t.nodeType)!==Node.TEXT_NODE||!eX(t.data))return;let{parentNode:e,previousSibling:i,nextSibling:n}=t;return eJ(e.previousSibling)&&!this.isBlockElement(e.previousSibling)||e_(e)?void 0:!i||this.isBlockElement(i)||!n||this.isBlockElement(n)}isExtraBR(t){return"br"===M(t)&&this.isBlockElement(t.parentNode)&&t.parentNode.lastChild===t}needsTableSeparator(t){if($.removeBlankTableCells){var e;let i=null==(e=t.previousSibling)?void 0:e.textContent;return i&&/\S/.test(i)}return t.previousSibling}translateBlockElementMarginsToNewlines(){let t=this.getMarginOfDefaultBlockElement();for(let e=0;e<this.blocks.length;e++){let i=this.getMarginOfBlockElementAtIndex(e);i&&(i.top>2*t.top&&this.prependStringToTextAtIndex("\n",e),i.bottom>2*t.bottom&&this.appendStringToTextAtIndex("\n",e))}}getMarginOfBlockElementAtIndex(t){let e=this.blockElements[t];if(e&&e.textContent&&!W().includes(M(e))&&!this.processedElements.includes(e))return eK(e)}getMarginOfDefaultBlockElement(){let t=j(g.default.tagName);return this.containerElement.appendChild(t),eK(t)}}let e_=function(t){let{whiteSpace:e}=window.getComputedStyle(t);return["pre","pre-wrap","pre-line"].includes(e)},eJ=t=>t&&!eY(t.textContent),eK=function(t){let e=window.getComputedStyle(t);if("block"===e.display)return{top:parseInt(e.marginTop),bottom:parseInt(e.marginBottom)}},eG=function(t){return"style"===M(t)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},e$=t=>t.replace(new RegExp("^".concat(t_.source,"+")),""),eX=t=>new RegExp("^".concat(t_.source,"*$")).test(t),eY=t=>/\s$/.test(t),eQ=["contenteditable","data-trix-id","data-trix-store-key","data-trix-mutable","data-trix-placeholder","tabindex"],eZ="data-trix-serialized-attributes",e0="[".concat(eZ,"]"),e1=RegExp("\x3c!--block--\x3e","g"),e2={"application/json":function(t){let e;if(t instanceof eN)e=t;else{if(!(t instanceof HTMLElement))throw Error("unserializable object");e=ez.parse(t.innerHTML).getDocument()}return e.toSerializableDocument().toJSONString()},"text/html":function(t){let e;if(t instanceof eN)e=el.render(t);else{if(!(t instanceof HTMLElement))throw Error("unserializable object");e=t.cloneNode(!0)}return Array.from(e.querySelectorAll("[data-trix-serialize=false]")).forEach(t=>{N(t)}),eQ.forEach(t=>{Array.from(e.querySelectorAll("[".concat(t,"]"))).forEach(e=>{e.removeAttribute(t)})}),Array.from(e.querySelectorAll(e0)).forEach(t=>{try{let e=JSON.parse(t.getAttribute(eZ));for(let i in t.removeAttribute(eZ),e){let n=e[i];t.setAttribute(i,n)}}catch(t){}}),e.innerHTML.replace(e1,"")}};var e6=Object.freeze({__proto__:null});class e3 extends tt{constructor(t,e){super(...arguments),this.attachmentManager=t,this.attachment=e,this.id=this.attachment.id,this.file=this.attachment.file}remove(){return this.attachmentManager.requestRemovalOfAttachment(this.attachment)}}e3.proxyMethod("attachment.getAttribute"),e3.proxyMethod("attachment.hasAttribute"),e3.proxyMethod("attachment.setAttribute"),e3.proxyMethod("attachment.getAttributes"),e3.proxyMethod("attachment.setAttributes"),e3.proxyMethod("attachment.isPending"),e3.proxyMethod("attachment.isPreviewable"),e3.proxyMethod("attachment.getURL"),e3.proxyMethod("attachment.getHref"),e3.proxyMethod("attachment.getFilename"),e3.proxyMethod("attachment.getFilesize"),e3.proxyMethod("attachment.getFormattedFilesize"),e3.proxyMethod("attachment.getExtension"),e3.proxyMethod("attachment.getContentType"),e3.proxyMethod("attachment.getFile"),e3.proxyMethod("attachment.setFile"),e3.proxyMethod("attachment.releaseFile"),e3.proxyMethod("attachment.getUploadProgress"),e3.proxyMethod("attachment.setUploadProgress");class e5 extends tt{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];super(...arguments),this.managedAttachments={},Array.from(t).forEach(t=>{this.manageAttachment(t)})}getAttachments(){let t=[];for(let e in this.managedAttachments){let i=this.managedAttachments[e];t.push(i)}return t}manageAttachment(t){return this.managedAttachments[t.id]||(this.managedAttachments[t.id]=new e3(this,t)),this.managedAttachments[t.id]}attachmentIsManaged(t){return t.id in this.managedAttachments}requestRemovalOfAttachment(t){var e,i;if(this.attachmentIsManaged(t))return null==(e=this.delegate)||null==(i=e.attachmentManagerDidRequestRemovalOfAttachment)?void 0:i.call(e,t)}unmanageAttachment(t){let e=this.managedAttachments[t.id];return delete this.managedAttachments[t.id],e}}class e4{constructor(t){this.composition=t,this.document=this.composition.document;const e=this.composition.getSelectedRange();this.startPosition=e[0],this.endPosition=e[1],this.startLocation=this.document.locationFromPosition(this.startPosition),this.endLocation=this.document.locationFromPosition(this.endPosition),this.block=this.document.getBlockAtIndex(this.endLocation.index),this.breaksOnReturn=this.block.breaksOnReturn(),this.previousCharacter=this.block.text.getStringAtPosition(this.endLocation.offset-1),this.nextCharacter=this.block.text.getStringAtPosition(this.endLocation.offset)}shouldInsertBlockBreak(){return this.block.hasAttributes()&&this.block.isListItem()&&!this.block.isEmpty()?0!==this.startLocation.offset:this.breaksOnReturn&&"\n"!==this.nextCharacter}shouldBreakFormattedBlock(){return this.block.hasAttributes()&&!this.block.isListItem()&&(this.breaksOnReturn&&"\n"===this.nextCharacter||"\n"===this.previousCharacter)}shouldDecreaseListLevel(){return this.block.hasAttributes()&&this.block.isListItem()&&this.block.isEmpty()}shouldPrependListItem(){return this.block.isListItem()&&0===this.startLocation.offset&&!this.block.isEmpty()}shouldRemoveLastBlockAttribute(){return this.block.hasAttributes()&&!this.block.isListItem()&&this.block.isEmpty()}}class e7 extends tt{constructor(){super(...arguments),this.document=new eN,this.attachments=[],this.currentAttributes={},this.revision=0}setDocument(t){var e,i;if(!t.isEqualTo(this.document))return this.document=t,this.refreshAttachments(),this.revision++,null==(e=this.delegate)||null==(i=e.compositionDidChangeDocument)?void 0:i.call(e,t)}getSnapshot(){return{document:this.document,selectedRange:this.getSelectedRange()}}
1loadSnapshot(t){var e,i,n,r;let{document:s,selectedRange:o}=t;return null==(e=this.delegate)||null==(i=e.compositionWillLoadSnapshot)||i.call(e),this.setDocument(null!=s?s:new eN),this.setSelection(null!=o?o:[0,0]),null==(n=this.delegate)||null==(r=n.compositionDidLoadSnapshot)?void 0:r.call(n)}insertText(t){let{updatePosition:e}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{updatePosition:!0},i=this.getSelectedRange();this.setDocument(this.document.insertTextAtRange(t,i));let n=i[0],r=n+t.getLength();return e&&this.setSelection(r),this.notifyDelegateOfInsertionAtRange([n,r])}insertBlock(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new eR,e=new eN([t]);return this.insertDocument(e)}insertDocument(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new eN,e=this.getSelectedRange();this.setDocument(this.document.insertDocumentAtRange(t,e));let i=e[0],n=i+t.getLength();return this.setSelection(n),this.notifyDelegateOfInsertionAtRange([i,n])}insertString(t,e){let i=this.getCurrentTextAttributes(),n=eE.textForStringWithAttributes(t,i);return this.insertText(n,e)}insertBlockBreak(){let t=this.getSelectedRange();this.setDocument(this.document.insertBlockBreakAtRange(t));let e=t[0],i=e+1;return this.setSelection(i),this.notifyDelegateOfInsertionAtRange([e,i])}insertLineBreak(){let t=new e4(this);if(t.shouldDecreaseListLevel())return this.decreaseListLevel(),this.setSelection(t.startPosition);if(t.shouldPrependListItem()){let e=new eN([t.block.copyWithoutText()]);return this.insertDocument(e)}return t.shouldInsertBlockBreak()?this.insertBlockBreak():t.shouldRemoveLastBlockAttribute()?this.removeLastBlockAttribute():t.shouldBreakFormattedBlock()?this.breakFormattedBlock(t):this.insertString("\n")}insertHTML(t){let e=ez.parse(t).getDocument(),i=this.getSelectedRange();this.setDocument(this.document.mergeDocumentAtRange(e,i));let n=i[0],r=n+e.getLength()-1;return this.setSelection(r),this.notifyDelegateOfInsertionAtRange([n,r])}replaceHTML(t){let e=ez.parse(t).getDocument().copyUsingObjectsFromDocument(this.document),i=this.getLocationRange({strict:!1}),n=this.document.rangeFromLocationRange(i);return this.setDocument(e),this.setSelection(n)}insertFile(t){return this.insertFiles([t])}insertFiles(t){let e=[];return Array.from(t).forEach(t=>{var i;if(null!=(i=this.delegate)&&i.compositionShouldAcceptFile(t)){let i=eb.attachmentForFile(t);e.push(i)}}),this.insertAttachments(e)}insertAttachment(t){return this.insertAttachments([t])}insertAttachments(t){let e=new eE;return Array.from(t).forEach(t=>{var i;let n=null==(i=d[t.getType()])?void 0:i.presentation,r=this.getCurrentTextAttributes();n&&(r.presentation=n);let s=eE.textForAttachmentWithAttributes(t,r);e=e.appendText(s)}),this.insertText(e)}shouldManageDeletingInDirection(t){let e=this.getLocationRange();if(tP(e)){if("backward"===t&&0===e[0].offset||this.shouldManageMovingCursorInDirection(t))return!0}else if(e[0].index!==e[1].index)return!0;return!1}deleteInDirection(t){let e,i,n,{length:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=this.getLocationRange(),o=this.getSelectedRange(),a=tP(o);if(a?i="backward"===t&&0===s[0].offset:n=s[0].index!==s[1].index,i&&this.canDecreaseBlockAttributeLevel()){let t=this.getBlock();if(t.isListItem()?this.decreaseListLevel():this.decreaseBlockAttributeLevel(),this.setSelection(o[0]),t.isEmpty())return!1}return a&&(o=this.getExpandedRangeInDirection(t,{length:r}),"backward"===t&&(e=this.getAttachmentAtRange(o))),e?(this.editAttachment(e),!1):(this.setDocument(this.document.removeTextAtRange(o)),this.setSelection(o[0]),!i&&!n&&void 0)}moveTextFromRange(t){let[e]=Array.from(this.getSelectedRange());return this.setDocument(this.document.moveTextFromRangeToPosition(t,e)),this.setSelection(e)}removeAttachment(t){let e=this.document.getRangeOfAttachment(t);if(e)return this.stopEditingAttachment(),this.setDocument(this.document.removeTextAtRange(e)),this.setSelection(e[0])}removeLastBlockAttribute(){let[t,e]=Array.from(this.getSelectedRange()),i=this.document.getBlockAtPosition(e);return this.removeCurrentAttribute(i.getLastAttribute()),this.setSelection(t)}insertPlaceholder(){return this.placeholderPosition=this.getPosition(),this.insertString(" ")}selectPlaceholder(){if(null!=this.placeholderPosition)return this.setSelectedRange([this.placeholderPosition,this.placeholderPosition+1]),this.get
1SelectedRange()}forgetPlaceholder(){this.placeholderPosition=null}hasCurrentAttribute(t){let e=this.currentAttributes[t];return null!=e&&!1!==e}toggleCurrentAttribute(t){let e=!this.currentAttributes[t];return e?this.setCurrentAttribute(t,e):this.removeCurrentAttribute(t)}canSetCurrentAttribute(t){return tv(t)?this.canSetCurrentBlockAttribute(t):this.canSetCurrentTextAttribute(t)}canSetCurrentTextAttribute(t){let e=this.getSelectedDocument();if(e){for(let t of Array.from(e.getAttachments()))if(!t.hasContent())return!1;return!0}}canSetCurrentBlockAttribute(t){let e=this.getBlock();if(e)return!e.isTerminalBlock()}setCurrentAttribute(t,e){return tv(t)?this.setBlockAttribute(t,e):(this.setTextAttribute(t,e),this.currentAttributes[t]=e,this.notifyDelegateOfCurrentAttributesChange())}setHTMLAtributeAtPosition(t,e,i){var n;let r=this.document.getBlockAtPosition(t),s=null==(n=tv(r.getLastAttribute()))?void 0:n.htmlAttributes;if(r&&null!=s&&s.includes(e)){let n=this.document.setHTMLAttributeAtPosition(t,e,i);this.setDocument(n)}}setTextAttribute(t,e){let i=this.getSelectedRange();if(!i)return;let[n,r]=Array.from(i);if(n!==r)return this.setDocument(this.document.addAttributeAtRange(t,e,i));if("href"===t){let t=eE.textForStringWithAttributes(e,{href:e});return this.insertText(t)}}setBlockAttribute(t,e){let i=this.getSelectedRange();if(this.canSetCurrentAttribute(t))return this.setDocument(this.document.applyBlockAttributeAtRange(t,e,i)),this.setSelection(i)}removeCurrentAttribute(t){return tv(t)?(this.removeBlockAttribute(t),this.updateCurrentAttributes()):(this.removeTextAttribute(t),delete this.currentAttributes[t],this.notifyDelegateOfCurrentAttributesChange())}removeTextAttribute(t){let e=this.getSelectedRange();if(e)return this.setDocument(this.document.removeAttributeAtRange(t,e))}removeBlockAttribute(t){let e=this.getSelectedRange();if(e)return this.setDocument(this.document.removeAttributeAtRange(t,e))}canDecreaseNestingLevel(){var t;return(null==(t=this.getBlock())?void 0:t.getNestingLevel())>0}canIncreaseNestingLevel(){var t;let e=this.getBlock();if(e){if(null==(t=tv(e.getLastNestableAttribute()))||!t.listAttribute)return e.getNestingLevel()>0;{let t=this.getPreviousBlock();if(t)return function(){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return tu((arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).slice(0,t.length),t)}(t.getListItemAttributes(),e.getListItemAttributes())}}}decreaseNestingLevel(){let t=this.getBlock();if(t)return this.setDocument(this.document.replaceBlock(t,t.decreaseNestingLevel()))}increaseNestingLevel(){let t=this.getBlock();if(t)return this.setDocument(this.document.replaceBlock(t,t.increaseNestingLevel()))}canDecreaseBlockAttributeLevel(){var t;return(null==(t=this.getBlock())?void 0:t.getAttributeLevel())>0}decreaseBlockAttributeLevel(){var t;let e=null==(t=this.getBlock())?void 0:t.getLastAttribute();if(e)return this.removeCurrentAttribute(e)}decreaseListLevel(){let[t]=Array.from(this.getSelectedRange()),{index:e}=this.document.locationFromPosition(t),i=e,n=this.getBlock().getAttributeLevel(),r=this.document.getBlockAtIndex(i+1);for(;r&&r.isListItem()&&!(r.getAttributeLevel()<=n);)i++,r=this.document.getBlockAtIndex(i+1);t=this.document.positionFromLocation({index:e,offset:0});let s=this.document.positionFromLocation({index:i,offset:0});return this.setDocument(this.document.removeLastListAttributeAtRange([t,s]))}updateCurrentAttributes(){let t=this.getSelectedRange({ignoreLock:!0});if(t){let e=this.document.getCommonAttributesAtRange(t);if(Array.from(tA()).forEach(t=>{e[t]||this.canSetCurrentAttribute(t)||(e[t]=!1)}),!tF(e,this.currentAttributes))return this.currentAttributes=e,this.notifyDelegateOfCurrentAttributesChange()}}getCurrentAttributes(){return R.call({},this.currentAttributes)}getCurrentTextAttributes(){let t={};for(let e in this.currentAttributes){let i=this.currentAttributes[e];!1!==i&&ty(e)&&(t[e]=i)}return t}freezeSelection(){return this.setCurrentAttribute("frozen",!0)}thawSelection(){return this.removeCurrentAttribute("frozen")}hasFrozenSelection(){return this.hasCurrentAttribute("frozen")}setSelection(t){var e;let i=this.document.locationRangeFromRange(t);return null==(e=this.delegate)?void 0:e.compositionDidRequestChangingSelectionToLocationRange(i)}getSelectedRange(){let t=this.getLocationRange();if(t)return this.document.rangeFromLocationRange(t)}
1setSelectedRange(t){let e=this.document.locationRangeFromRange(t);return this.getSelectionManager().setLocationRange(e)}getPosition(){let t=this.getLocationRange();if(t)return this.document.positionFromLocation(t[0])}getLocationRange(t){return this.targetLocationRange?this.targetLocationRange:this.getSelectionManager().getLocationRange(t)||tB({index:0,offset:0})}withTargetLocationRange(t,e){let i;this.targetLocationRange=t;try{i=e()}finally{this.targetLocationRange=null}return i}withTargetRange(t,e){let i=this.document.locationRangeFromRange(t);return this.withTargetLocationRange(i,e)}withTargetDOMRange(t,e){let i=this.createLocationRangeFromDOMRange(t,{strict:!1});return this.withTargetLocationRange(i,e)}getExpandedRangeInDirection(t){let{length:e}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},[i,n]=Array.from(this.getSelectedRange());return"backward"===t?e?i-=e:i=this.translateUTF16PositionFromOffset(i,-1):e?n+=e:n=this.translateUTF16PositionFromOffset(n,1),tB([i,n])}shouldManageMovingCursorInDirection(t){if(this.editingAttachment)return!0;let e=this.getExpandedRangeInDirection(t);return null!=this.getAttachmentAtRange(e)}moveCursorInDirection(t){let e,i;if(this.editingAttachment?i=this.document.getRangeOfAttachment(this.editingAttachment):e=!tI(this.getSelectedRange(),i=this.getExpandedRangeInDirection(t)),"backward"===t?this.setSelectedRange(i[0]):this.setSelectedRange(i[1]),e){let t=this.getAttachmentAtRange(i);if(t)return this.editAttachment(t)}}expandSelectionInDirection(t){let{length:e}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=this.getExpandedRangeInDirection(t,{length:e});return this.setSelectedRange(i)}expandSelectionForEditing(){if(this.hasCurrentAttribute("href"))return this.expandSelectionAroundCommonAttribute("href")}expandSelectionAroundCommonAttribute(t){let e=this.getPosition(),i=this.document.getRangeOfCommonAttributeAtPosition(t,e);return this.setSelectedRange(i)}selectionContainsAttachments(){var t;return(null==(t=this.getSelectedAttachments())?void 0:t.length)>0}selectionIsInCursorTarget(){return this.editingAttachment||this.positionIsCursorTarget(this.getPosition())}positionIsCursorTarget(t){let e=this.document.locationFromPosition(t);if(e)return this.locationIsCursorTarget(e)}positionIsBlockBreak(t){var e;return null==(e=this.document.getPieceAtPosition(t))?void 0:e.isBlockBreak()}getSelectedDocument(){let t=this.getSelectedRange();if(t)return this.document.getDocumentAtRange(t)}getSelectedAttachments(){var t;return null==(t=this.getSelectedDocument())?void 0:t.getAttachments()}getAttachments(){return this.attachments.slice(0)}refreshAttachments(){let t,e=this.document.getAttachments(),{added:i,removed:n}=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=[],n=[],r=new Set;t.forEach(t=>{r.add(t)});let s=new Set;return e.forEach(t=>{s.add(t),r.has(t)||i.push(t)}),t.forEach(t=>{s.has(t)||n.push(t)}),{added:i,removed:n}}(this.attachments,e);return this.attachments=e,Array.from(n).forEach(t=>{var e,i;t.delegate=null,null==(e=this.delegate)||null==(i=e.compositionDidRemoveAttachment)||i.call(e,t)}),t=[],Array.from(i).forEach(e=>{var i,n;e.delegate=this,t.push(null==(i=this.delegate)||null==(n=i.compositionDidAddAttachment)?void 0:n.call(i,e))}),t}attachmentDidChangeAttributes(t){var e,i;return this.revision++,null==(e=this.delegate)||null==(i=e.compositionDidEditAttachment)?void 0:i.call(e,t)}attachmentDidChangePreviewURL(t){var e,i;return this.revision++,null==(e=this.delegate)||null==(i=e.compositionDidChangeAttachmentPreviewURL)?void 0:i.call(e,t)}editAttachment(t,e){var i,n;if(t!==this.editingAttachment)return this.stopEditingAttachment(),this.editingAttachment=t,null==(i=this.delegate)||null==(n=i.compositionDidStartEditingAttachment)?void 0:n.call(i,this.editingAttachment,e)}stopEditingAttachment(){var t,e;this.editingAttachment&&(null==(t=this.delegate)||null==(e=t.compositionDidStopEditingAttachment)||e.call(t,this.editingAttachment),this.editingAttachment=null)}updateAttributesForAttachment(t,e){return this.setDocument(this.document.updateAttributesForAttachment(t,e))}removeAttributeForAttachment(t,e){return this.setDocument(this.document.removeAttributeForAttachment(t,e))}breakFormattedBlock(t){let{document:e}=t,{block:i}=t,n=t.startPosition,r=[n-1,n];i.getBlockBreakPosition()===t.startLocation.offset?(i.breaksOnReturn()&&"\n"===t.nextCharacter?n+=1:e=e.removeTextAtRange(r),r=[n,n]):"\n"===t.nextCharacter?"\n"===t.previousCharacter?r=[n-1,n+1]:(r=[n,n+1],n+=1):t.startLocation.offset-1!=0&&(n+=1);let s=new eN([i.removeLastAttribute().copyWithoutText()]);return this.setDocument(e.insertDocumentAtRange(s,r)),this.setSelection(n)}getPreviousBlock(){let t=this.getLocationRange();if(t){let{index:e}=t[0];if(e>0)return this.document.getBlockAtIndex(e-1)}}getBlock(){let t=this.getLocationRange();if(t)return this.document.getBlockAtIndex(t[0].index)}getAttachmentAtRange(t){let e=this.document.getDocumentAtRange(t);if(e.toString()==="".concat("","\n"))return e.getAttachments()[0]}notifyDelegateOfCurrentAttributesChange(){var t,e;return null==(t=this.delegate)||null==(e=t.compositionDidChangeCurrentAttributes)?void 0:e.call(t,this.currentAttributes)}notifyDelegateOfInsertionAtRange(t){var e,i;return null==(e=this.delegate)||null==(i=e.compositionDidPerformInsertionAtRange)?void 0:i.call(e,t)}translateUTF16PositionFromOffset(t,e){let i=this.document.toUTF16String(),n=i.offsetFromUCS2Offset(t);return i.offsetToUCS2Offset(n+e)}}e7.proxyMethod("getSelectionManager().getPointRange"),e7.proxyMethod("getSelectionManager().setLocationRangeFromPointRange"),e7.proxyMethod("getSelectionManager().createLocationRangeFromDOMRange"),e7.proxyMethod("getSelectionManager().locationIsCursorTarget"),e7.proxyMethod("getSelectionManager().selectionIsExpanded"),e7.proxyMethod("delegate?.getSelectionManager");class e9 extends tt{constructor(t){super(...arguments),this.composition=t,this.undoEntries=[],this.redoEntries=[]}recordUndoEntry(t){let{context:e,consolidatable:i}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.undoEntries.slice(-1)[0];
1if(!i||!e8(n,t,e)){let i=this.createEntry({description:t,context:e});this.undoEntries.push(i),this.redoEntries=[]}}undo(){let t=this.undoEntries.pop();if(t){let e=this.createEntry(t);return this.redoEntries.push(e),this.composition.loadSnapshot(t.snapshot)}}redo(){let t=this.redoEntries.pop();if(t){let e=this.createEntry(t);return this.undoEntries.push(e),this.composition.loadSnapshot(t.snapshot)}}canUndo(){return this.undoEntries.length>0}canRedo(){return this.redoEntries.length>0}createEntry(){let{description:t,context:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{description:null==t?void 0:t.toString(),context:JSON.stringify(e),snapshot:this.composition.getSnapshot()}}}let e8=(t,e,i)=>(null==t?void 0:t.description)===(null==e?void 0:e.toString())&&(null==t?void 0:t.context)===JSON.stringify(i),it="attachmentGallery";class ie{constructor(t){this.document=t.document,this.selectedRange=t.selectedRange}perform(){return this.removeBlockAttribute(),this.applyBlockAttribute()}getSnapshot(){return{document:this.document,selectedRange:this.selectedRange}}removeBlockAttribute(){return this.findRangesOfBlocks().map(t=>this.document=this.document.removeAttributeAtRange(it,t))}applyBlockAttribute(){let t=0;this.findRangesOfPieces().forEach(e=>{e[1]-e[0]>1&&(e[0]+=t,e[1]+=t,"\n"!==this.document.getCharacterAtPosition(e[1])&&(this.document=this.document.insertBlockBreakAtRange(e[1]),e[1]<this.selectedRange[1]&&this.moveSelectedRangeForward(),e[1]++,t++),0!==e[0]&&"\n"!==this.document.getCharacterAtPosition(e[0]-1)&&(this.document=this.document.insertBlockBreakAtRange(e[0]),e[0]<this.selectedRange[0]&&this.moveSelectedRangeForward(),e[0]++,t++),this.document=this.document.applyBlockAttributeAtRange(it,!0,e))})}findRangesOfBlocks(){return this.document.findRangesForBlockAttribute(it)}findRangesOfPieces(){return this.document.findRangesForTextAttribute("presentation",{withValue:"gallery"})}moveSelectedRangeForward(){this.selectedRange[0]+=1,this.selectedRange[1]+=1}}let ii=function(t){let e=new ie(t);return e.perform(),e.getSnapshot()},ir=[ii];class is{constructor(t,e,i){this.insertFiles=this.insertFiles.bind(this),this.composition=t,this.selectionManager=e,this.element=i,this.undoManager=new e9(this.composition),this.filters=ir.slice(0)}loadDocument(t){return this.loadSnapshot({document:t,selectedRange:[0,0]})}loadHTML(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=ez.parse(t,{referenceElement:this.element}).getDocument();return this.loadDocument(e)}loadJSON(t){let{document:e,selectedRange:i}=t;return e=eN.fromJSON(e),this.loadSnapshot({document:e,selectedRange:i})}loadSnapshot(t){return this.undoManager=new e9(this.composition),this.composition.loadSnapshot(t)}getDocument(){return this.composition.document}getSelectedDocument(){return this.composition.getSelectedDocument()}getSnapshot(){return this.composition.getSnapshot()}toJSON(){return this.getSnapshot()}deleteInDirection(t){return this.composition.deleteInDirection(t)}insertAttachment(t){return this.composition.insertAttachment(t)}insertAttachments(t){return this.composition.insertAttachments(t)}insertDocument(t){return this.composition.insertDocument(t)}insertFile(t){return this.composition.insertFile(t)}insertFiles(t){return this.composition.insertFiles(t)}insertHTML(t){return this.composition.insertHTML(t)}insertString(t){return this.composition.insertString(t)}insertText(t){return this.composition.insertText(t)}insertLineBreak(){return this.composition.insertLineBreak()}getSelectedRange(){return this.composition.getSelectedRange()}getPosition(){return this.composition.getPosition()}getClientRectAtPosition(t){let e=this.getDocument().locationRangeFromRange([t,t+1]);return this.selectionManager.getClientRectAtLocationRange(e)}expandSelectionInDirection(t){return this.composition.expandSelectionInDirection(t)}moveCursorInDirection(t){return this.composition.moveCursorInDirection(t)}setSelectedRange(t){return this.composition.setSelectedRange(t)}activateAttribute(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.composition.setCurrentAttribute(t,e)}attributeIsActive(t){return this.composition.hasCurrentAttribute(t)}canActivateAttribute(t){return this.composition.canSetCurrentAttribute(t)}deactivateAttribute(t){return this.composition.removeCurrentAttribute(t)}
1setHTMLAtributeAtPosition(t,e,i){this.composition.setHTMLAtributeAtPosition(t,e,i)}canDecreaseNestingLevel(){return this.composition.canDecreaseNestingLevel()}canIncreaseNestingLevel(){return this.composition.canIncreaseNestingLevel()}decreaseNestingLevel(){if(this.canDecreaseNestingLevel())return this.composition.decreaseNestingLevel()}increaseNestingLevel(){if(this.canIncreaseNestingLevel())return this.composition.increaseNestingLevel()}canRedo(){return this.undoManager.canRedo()}canUndo(){return this.undoManager.canUndo()}recordUndoEntry(t){let{context:e,consolidatable:i}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.undoManager.recordUndoEntry(t,{context:e,consolidatable:i})}redo(){if(this.canRedo())return this.undoManager.redo()}undo(){if(this.canUndo())return this.undoManager.undo()}}class io{constructor(t){this.element=t}findLocationFromContainerAndOffset(t,e){let{strict:i}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{strict:!0},n=0,r=!1,s={index:0,offset:0},o=this.findAttachmentElementParentForNode(t);o&&(t=o.parentNode,e=I(o));let a=O(this.element,{usingFilter:iu});for(;a.nextNode();){let o=a.currentNode;if(o===t&&K(t)){z(o)||(s.offset+=e);break}if(o.parentNode===t){if(n++===e)break}else if(!P(t,o)&&n>0)break;q(o,{strict:i})?(r&&s.index++,s.offset=0,r=!0):s.offset+=ia(o)}return s}findContainerAndOffsetFromLocation(t){let e,i;if(0===t.index&&0===t.offset){for(e=this.element,i=0;e.firstChild;)if(U(e=e.firstChild)){i=1;break}return[e,i]}let[n,r]=this.findNodeAndOffsetFromLocation(t);if(n){if(K(n))0===ia(n)?(e=n.parentNode.parentNode,i=I(n.parentNode),z(n,{name:"right"})&&i++):(e=n,i=t.offset-r);else{if(e=n.parentNode,!q(n.previousSibling)&&!U(e))for(;n===e.lastChild&&(n=e,!U(e=e.parentNode)););i=I(n),0!==t.offset&&i++}return[e,i]}}findNodeAndOffsetFromLocation(t){let e,i,n=0;for(let r of this.getSignificantNodesForIndex(t.index)){let s=ia(r);if(t.offset<=n+s)if(K(r)){if(e=r,i=n,t.offset===i&&z(e))break}else e||(e=r,i=n);if((n+=s)>t.offset)break}return[e,i]}findAttachmentElementParentForNode(t){for(;t&&t!==this.element;){if(_(t))return t;t=t.parentNode}}getSignificantNodesForIndex(t){let e=[],i=O(this.element,{usingFilter:il}),n=!1;for(;i.nextNode();){var r;let s=i.currentNode;if(V(s)){if(null!=r?r++:r=0,r===t)n=!0;else if(n)break}else n&&e.push(s)}return e}}let ia=function(t){return t.nodeType===Node.TEXT_NODE?z(t)?0:t.textContent.length:"br"===M(t)||_(t)?1:0},il=function(t){return ih(t)===NodeFilter.FILTER_ACCEPT?iu(t):NodeFilter.FILTER_REJECT},ih=function(t){return J(t)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},iu=function(t){return _(t.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT};class ic{createDOMRangeFromPoint(t){let e,{x:i,y:n}=t;if(document.caretPositionFromPoint){let{offsetNode:t,offset:r}=document.caretPositionFromPoint(i,n);return(e=document.createRange()).setStart(t,r),e}if(document.caretRangeFromPoint)return document.caretRangeFromPoint(i,n);if(document.body.createTextRange){let t=tU();try{let t=document.body.createTextRange();t.moveToPoint(i,n),t.select()}catch(t){}return e=tU(),tq(t),e}}getClientRectsForDOMRange(t){let e=Array.from(t.getClientRects());return[e[0],e[e.length-1]]}}class id extends tt{constructor(t){super(...arguments),this.didMouseDown=this.didMouseDown.bind(this),this.selectionDidChange=this.selectionDidChange.bind(this),this.element=t,this.locationMapper=new io(this.element),this.pointMapper=new ic,this.lockCount=0,D("mousedown",{onElement:this.element,withCallback:this.didMouseDown})}getLocationRange(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return!1===t.strict?this.createLocationRangeFromDOMRange(tU()):t.ignoreLock?this.currentLocationRange:this.lockedLocationRange?this.lockedLocationRange:this.currentLocationRange}setLocationRange(t){if(this.lockedLocationRange)return;t=tB(t);let e=this.createDOMRangeFromLocationRange(t);e&&(tq(e),this.updateCurrentLocationRange(t))}setLocationRangeFromPointRange(t){t=tB(t);let e=this.getLocationAtPoint(t[0]),i=this.getLocationAtPoint(t[1]);this.setLocationRange([e,i])}getClientRectAtLocationRange(t){let e=this.createDOMRangeFromLocationRange(t);if(e)return this.getClientRectsForDOMRange(e)[1]}locationIsCursorTarget(t){return z(Array.from(this.findNodeAndOffsetFromLocation(t))[0])}lock(){0==this.lockCount++&&(this.updateCurrentLocationRange(),this.lockedLocationRange=this.getLocationRange())}unlock(){if(0==--this.lockCount){let{lockedLocationRange:t}=this;if(this.lockedLocationRange=null,null!=t)return this.setLocationRange(t)}
1}clearSelection(){var t;return null==(t=tW())?void 0:t.removeAllRanges()}selectionIsCollapsed(){var t;return!0===(null==(t=tU())?void 0:t.collapsed)}selectionIsExpanded(){return!this.selectionIsCollapsed()}createLocationRangeFromDOMRange(t,e){if(null==t||!this.domRangeWithinElement(t))return;let i=this.findLocationFromContainerAndOffset(t.startContainer,t.startOffset,e);if(i)return tB([i,t.collapsed?void 0:this.findLocationFromContainerAndOffset(t.endContainer,t.endOffset,e)])}didMouseDown(){return this.pauseTemporarily()}pauseTemporarily(){let t;this.paused=!0;let e=()=>{if(this.paused=!1,clearTimeout(i),Array.from(t).forEach(t=>{t.destroy()}),P(document,this.element))return this.selectionDidChange()},i=setTimeout(e,200);t=["mousemove","keydown"].map(t=>D(t,{onElement:document,withCallback:e}))}selectionDidChange(){if(!this.paused&&!B(this.element))return this.updateCurrentLocationRange()}updateCurrentLocationRange(t){var e,i;if((null!=t?t:t=this.createLocationRangeFromDOMRange(tU()))&&!tI(t,this.currentLocationRange))return this.currentLocationRange=t,null==(e=this.delegate)||null==(i=e.locationRangeDidChange)?void 0:i.call(e,this.currentLocationRange.slice(0))}createDOMRangeFromLocationRange(t){let e=this.findContainerAndOffsetFromLocation(t[0]),i=tP(t)?e:this.findContainerAndOffsetFromLocation(t[1])||e;if(null!=e&&null!=i){let t=document.createRange();return t.setStart(...Array.from(e||[])),t.setEnd(...Array.from(i||[])),t}}getLocationAtPoint(t){var e;let i=this.createDOMRangeFromPoint(t);if(i)return null==(e=this.createLocationRangeFromDOMRange(i))?void 0:e[0]}domRangeWithinElement(t){return t.collapsed?P(this.element,t.startContainer):P(this.element,t.startContainer)&&P(this.element,t.endContainer)}}id.proxyMethod("locationMapper.findLocationFromContainerAndOffset"),id.proxyMethod("locationMapper.findContainerAndOffsetFromLocation"),id.proxyMethod("locationMapper.findNodeAndOffsetFromLocation"),id.proxyMethod("pointMapper.createDOMRangeFromPoint"),id.proxyMethod("pointMapper.getClientRectsForDOMRange");var ig=Object.freeze({__proto__:null,Attachment:eb,AttachmentManager:e5,AttachmentPiece:eA,Block:eR,Composition:e7,Document:eN,Editor:is,HTMLParser:ez,HTMLSanitizer:eU,LineBreakInsertion:e4,LocationMapper:io,ManagedAttachment:e3,Piece:ep,PointMapper:ic,SelectionManager:id,SplittableList:ex,StringPiece:ev,Text:eE,UndoManager:e9}),im=Object.freeze({__proto__:null,ObjectView:t4,AttachmentView:t8,BlockView:ea,DocumentView:el,PieceView:en,PreviewableAttachmentView:ei,TextView:er});let{lang:ip,css:ib,keyNames:iA}=Z,iv=function(t){return function(){let e=t.apply(this,arguments);e.do(),this.undos||(this.undos=[]),this.undos.push(e.undo)}};class ix extends tt{constructor(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};super(...arguments),em(this,"makeElementMutable",iv(()=>({do:()=>{this.element.dataset.trixMutable=!0},undo:()=>delete this.element.dataset.trixMutable}))),em(this,"addToolbar",iv(()=>{let t=j({tagName:"div",className:ib.attachmentToolbar,data:{trixMutable:!0},childNodes:j({tagName:"div",className:"trix-button-row",childNodes:j({tagName:"span",className:"trix-button-group trix-button-group--actions",childNodes:j({tagName:"button",className:"trix-button trix-button--remove",textContent:ip.remove,attributes:{title:ip.remove},data:{trixAction:"remove"}})})})});return this.attachment.isPreviewable()&&t.appendChild(j({tagName:"div",className:ib.attachmentMetadataContainer,childNodes:j({tagName:"span",className:ib.attachmentMetadata,childNodes:[j({tagName:"span",className:ib.attachmentName,textContent:this.attachment.getFilename(),attributes:{title:this.attachment.getFilename()}}),j({tagName:"span",className:ib.attachmentSize,textContent:this.attachment.getFormattedFilesize()})]})})),D("click",{onElement:t,withCallback:this.didClickToolbar}),D("click",{onElement:t,matchingSelector:"[data-trix-action]",withCallback:this.didClickActionButton}),w("trix-attachment-before-toolbar",{onElement:this.element,attributes:{toolbar:t,attachment:this.attachment}}),{do:()=>this.element.appendChild(t),undo:()=>N(t)}})),em(this,"installCaptionEditor",iv(()=>{let t=j({tagName:"textarea",className:ib.attachmentCaptionEditor,attributes:{placeholder:ip.captionPlaceholder},data:{trixMutable:!0}});t.value=this.attachmentPiece.getCaption();let e=t.cloneNode();e.classList.add("trix-autoresize-clone"),e.tabIndex=-1;let i=function(){e.value=t.value,t.style.height=e.scrollHeight+"px"};D("input",{onElement:t,withCallback:i}),D("input",{onElement:t,withCallback:this.didInputCaption}),D("keydown",{onElement:t,withCallback:this.didKeyDownCaption}),D("change",{onElement:t,withCallback:this.didChangeCaption}),D("blur",{onElement:t,withCallback:this.didBlurCaption});let n=this.element.querySelector("figcaption"),r=n.cloneNode();return{do:()=>
1{if(n.style.display="none",r.appendChild(t),r.appendChild(e),r.classList.add("".concat(ib.attachmentCaption,"--editing")),n.parentElement.insertBefore(r,n),i(),this.options.editCaption)return setTimeout(()=>t.focus(),1)},undo(){N(r),n.style.display=null}}})),this.didClickToolbar=this.didClickToolbar.bind(this),this.didClickActionButton=this.didClickActionButton.bind(this),this.didKeyDownCaption=this.didKeyDownCaption.bind(this),this.didInputCaption=this.didInputCaption.bind(this),this.didChangeCaption=this.didChangeCaption.bind(this),this.didBlurCaption=this.didBlurCaption.bind(this),this.attachmentPiece=t,this.element=e,this.container=i,this.options=n,this.attachment=this.attachmentPiece.attachment,"a"===M(this.element)&&(this.element=this.element.firstChild),this.install()}install(){this.makeElementMutable(),this.addToolbar(),this.attachment.isPreviewable()&&this.installCaptionEditor()}uninstall(){var t;let e=this.undos.pop();for(this.savePendingCaption();e;)e(),e=this.undos.pop();null==(t=this.delegate)||t.didUninstallAttachmentEditor(this)}savePendingCaption(){if(null!=this.pendingCaption){var t,e,i,n;let r=this.pendingCaption;(this.pendingCaption=null,r)?null==(t=this.delegate)||null==(e=t.attachmentEditorDidRequestUpdatingAttributesForAttachment)||e.call(t,{caption:r},this.attachment):null==(i=this.delegate)||null==(n=i.attachmentEditorDidRequestRemovingAttributeForAttachment)||n.call(i,"caption",this.attachment)}}didClickToolbar(t){return t.preventDefault(),t.stopPropagation()}didClickActionButton(t){var e;if("remove"===t.target.getAttribute("data-trix-action"))return null==(e=this.delegate)?void 0:e.attachmentEditorDidRequestRemovalOfAttachment(this.attachment)}didKeyDownCaption(t){var e,i;if("return"===iA[t.keyCode])return t.preventDefault(),this.savePendingCaption(),null==(e=this.delegate)||null==(i=e.attachmentEditorDidRequestDeselectingAttachment)?void 0:i.call(e,this.attachment)}didInputCaption(t){this.pendingCaption=t.target.value.replace(/\s/g," ").trim()}didChangeCaption(t){return this.savePendingCaption()}didBlurCaption(t){return this.savePendingCaption()}}class iy extends tt{constructor(t,e){super(...arguments),this.didFocus=this.didFocus.bind(this),this.didBlur=this.didBlur.bind(this),this.didClickAttachment=this.didClickAttachment.bind(this),this.element=t,this.composition=e,this.documentView=new el(this.composition.document,{element:this.element}),D("focus",{onElement:this.element,withCallback:this.didFocus}),D("blur",{onElement:this.element,withCallback:this.didBlur}),D("click",{onElement:this.element,matchingSelector:"a[contenteditable=false]",preventDefault:!0}),D("mousedown",{onElement:this.element,matchingSelector:c,withCallback:this.didClickAttachment}),D("click",{onElement:this.element,matchingSelector:"a".concat(c),preventDefault:!0})}didFocus(t){var e;let i=()=>{var t,e;if(!this.focused)return this.focused=!0,null==(t=this.delegate)||null==(e=t.compositionControllerDidFocus)?void 0:e.call(t)};return(null==(e=this.blurPromise)?void 0:e.then(i))||i()}didBlur(t){this.blurPromise=new Promise(t=>setTimeout(()=>{var e,i;return B(this.element)||(this.focused=null,null==(e=this.delegate)||null==(i=e.compositionControllerDidBlur)||i.call(e)),this.blurPromise=null,t()},1))}didClickAttachment(t,e){var i,n;let r=this.findAttachmentForElement(e),s=!!F(t.target,{matchingSelector:"figcaption"});return null==(i=this.delegate)||null==(n=i.compositionControllerDidSelectAttachment)?void 0:n.call(i,r,{editCaption:s})}getSerializableElement(){return this.isEditingAttachment()?this.documentView.shadowElement:this.element}render(){var t,e,i,n,r,s;return this.revision!==this.composition.revision&&(this.documentView.setDocument(this.composition.document),this.documentView.render(),this.revision=this.composition.revision),this.canSyncDocumentView()&&!this.documentView.isSynced()&&(null==(i=this.delegate)||null==(n=i.compositionControllerWillSyncDocumentView)||n.call(i),this.documentView.sync(),null==(r=this.delegate)||null==(s=r.compositionControllerDidSyncDocumentView)||s.call(r)),null==(t=this.delegate)||null==(e=t.compositionControllerDidRender)?void 0:e.call(t)}rerenderViewForObject(t){return this.invalidateViewForObject(t),this.render()}invalidateViewForObject(t){return this.documentView.invalidateViewForObject(t)}isViewCachingEnabled(){return this.documentView.isViewCachingEnabled()}enableViewCaching(){return this.documentView.enableViewCaching()}disableViewCaching(){return this.documentView.disableViewCaching()}refreshViewCache(){return this.documentView.garbageCollectCachedViews()}isEditingAttachment(){return!!this.attachmentEditor}installAttachmentEditorForAttachment(t,e){var i;if((null==(i=this.attachmentEditor)?void 0:i.attachment)===t)return;
1let n=this.documentView.findElementForObject(t);if(!n)return;this.uninstallAttachmentEditor();let r=this.composition.document.getAttachmentPieceForAttachment(t);this.attachmentEditor=new ix(r,n,this.element,e),this.attachmentEditor.delegate=this}uninstallAttachmentEditor(){var t;return null==(t=this.attachmentEditor)?void 0:t.uninstall()}didUninstallAttachmentEditor(){return this.attachmentEditor=null,this.render()}attachmentEditorDidRequestUpdatingAttributesForAttachment(t,e){var i,n;return null==(i=this.delegate)||null==(n=i.compositionControllerWillUpdateAttachment)||n.call(i,e),this.composition.updateAttributesForAttachment(t,e)}attachmentEditorDidRequestRemovingAttributeForAttachment(t,e){var i,n;return null==(i=this.delegate)||null==(n=i.compositionControllerWillUpdateAttachment)||n.call(i,e),this.composition.removeAttributeForAttachment(t,e)}attachmentEditorDidRequestRemovalOfAttachment(t){var e,i;return null==(e=this.delegate)||null==(i=e.compositionControllerDidRequestRemovalOfAttachment)?void 0:i.call(e,t)}attachmentEditorDidRequestDeselectingAttachment(t){var e,i;return null==(e=this.delegate)||null==(i=e.compositionControllerDidRequestDeselectingAttachment)?void 0:i.call(e,t)}canSyncDocumentView(){return!this.isEditingAttachment()}findAttachmentForElement(t){return this.composition.document.getAttachmentById(parseInt(t.dataset.trixId,10))}}class iC extends tt{}let ik="data-trix-mutable",iE="[".concat(ik,"]"),iR={attributes:!0,childList:!0,characterData:!0,characterDataOldValue:!0,subtree:!0};class iS extends tt{constructor(t){super(t),this.didMutate=this.didMutate.bind(this),this.element=t,this.observer=new window.MutationObserver(this.didMutate),this.start()}start(){return this.reset(),this.observer.observe(this.element,iR)}stop(){return this.observer.disconnect()}didMutate(t){var e,i;if(this.mutations.push(...Array.from(this.findSignificantMutations(t)||[])),this.mutations.length)return null==(e=this.delegate)||null==(i=e.elementDidMutate)||i.call(e,this.getMutationSummary()),this.reset()}reset(){this.mutations=[]}findSignificantMutations(t){return t.filter(t=>this.mutationIsSignificant(t))}mutationIsSignificant(t){if(this.nodeIsMutable(t.target))return!1;for(let e of Array.from(this.nodesModifiedByMutation(t)))if(this.nodeIsSignificant(e))return!0;return!1}nodeIsSignificant(t){return t!==this.element&&!this.nodeIsMutable(t)&&!J(t)}nodeIsMutable(t){return F(t,{matchingSelector:iE})}nodesModifiedByMutation(t){let e=[];switch(t.type){case"attributes":t.attributeName!==ik&&e.push(t.target);break;case"characterData":e.push(t.target.parentNode),e.push(t.target);break;case"childList":e.push(...Array.from(t.addedNodes||[])),e.push(...Array.from(t.removedNodes||[]))}return e}getMutationSummary(){return this.getTextMutationSummary()}getTextMutationSummary(){let{additions:t,deletions:e}=this.getTextChangesFromCharacterData(),i=this.getTextChangesFromChildList();Array.from(i.additions).forEach(e=>{Array.from(t).includes(e)||t.push(e)}),e.push(...Array.from(i.deletions||[]));let n={},r=t.join("");r&&(n.textAdded=r);let s=e.join("");return s&&(n.textDeleted=s),n}getMutationsByType(t){return Array.from(this.mutations).filter(e=>e.type===t)}getTextChangesFromChildList(){let t,e,i=[],n=[];return Array.from(this.getMutationsByType("childList")).forEach(t=>{i.push(...Array.from(t.addedNodes||[])),n.push(...Array.from(t.removedNodes||[]))}),0===i.length&&1===n.length&&V(n[0])?(t=[],e=["\n"]):(t=iL(i),e=iL(n)),{additions:t.filter((t,i)=>t!==e[i]).map(tz),deletions:e.filter((e,i)=>e!==t[i]).map(tz)}}getTextChangesFromCharacterData(){let t,e,i=this.getMutationsByType("characterData");if(i.length){var n,r;let s,o,a=i[0],l=i[i.length-1],h=(n=tz(a.oldValue),r=tz(l.target.data),n=tr.box(n),(r=tr.box(r)).length<n.length?[o,s]=tK(n,r):[s,o]=tK(r,n),{added:s,removed:o});t=h.added,e=h.removed}return{additions:t?[t]:[],deletions:e?[e]:[]}}}let iL=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=[];for(let i of Array.from(t))switch(i.nodeType){case Node.TEXT_NODE:e.push(i.data);break;case Node.ELEMENT_NODE:"br"===M(i)?e.push("\n"):e.push(...Array.from(iL(i.childNodes)||[]))}return e};class iD extends t5{constructor(t){super(...arguments),this.file=t}perform(t){let e=new FileReader;return e.onerror=()=>t(!1),e.onload=()=>{e.onerror=null;try{e.abort()}catch(t){}return t(!0,this.file)},e.readAsArrayBuffer(this.file)}}class iw{constructor(t){this.element=t}shouldIgnore(t){return!!y.samsungAndroid&&(this.previousEvent=this.event,this.event=t,this.checkSamsungKeyboardBuggyModeStart(),this.checkSamsungKeyboardBuggyModeEnd(),this.buggyMode)}checkSamsungKeyboardBuggyModeStart(){this.insertingLongTextAfterUnidentifiedChar(
1)&&iT(this.element.innerText,this.event.data)&&(this.buggyMode=!0,this.event.preventDefault())}checkSamsungKeyboardBuggyModeEnd(){this.buggyMode&&"insertText"!==this.event.inputType&&(this.buggyMode=!1)}insertingLongTextAfterUnidentifiedChar(){var t;return this.isBeforeInputInsertText()&&this.previousEventWasUnidentifiedKeydown()&&(null==(t=this.event.data)?void 0:t.length)>50}isBeforeInputInsertText(){return"beforeinput"===this.event.type&&"insertText"===this.event.inputType}previousEventWasUnidentifiedKeydown(){var t,e;return"keydown"===(null==(t=this.previousEvent)?void 0:t.type)&&"Unidentified"===(null==(e=this.previousEvent)?void 0:e.key)}}let iT=(t,e)=>iB(t)===iB(e),iF=RegExp("(".concat("","|").concat("\uFEFF","|").concat("\xa0","|\\s)+"),"g"),iB=t=>t.replace(iF," ").trim();class iP extends tt{constructor(t){for(const e in super(...arguments),this.element=t,this.mutationObserver=new iS(this.element),this.mutationObserver.delegate=this,this.flakyKeyboardDetector=new iw(this.element),this.constructor.events)D(e,{onElement:this.element,withCallback:this.handlerFor(e)})}elementDidMutate(t){}editorWillSyncDocumentView(){return this.mutationObserver.stop()}editorDidSyncDocumentView(){return this.mutationObserver.start()}requestRender(){var t,e;return null==(t=this.delegate)||null==(e=t.inputControllerDidRequestRender)?void 0:e.call(t)}requestReparse(){var t,e;return null==(t=this.delegate)||null==(e=t.inputControllerDidRequestReparse)||e.call(t),this.requestRender()}attachFiles(t){return Promise.all(Array.from(t).map(t=>new iD(t))).then(t=>{this.handleInput(function(){var e,i;return null==(e=this.delegate)||e.inputControllerWillAttachFiles(),null==(i=this.responder)||i.insertFiles(t),this.requestRender()})})}handlerFor(t){return e=>{e.defaultPrevented||this.handleInput(()=>{!B(this.element)&&(this.flakyKeyboardDetector.shouldIgnore(e)||(this.eventName=t,this.constructor.events[t].call(this,e)))})}}handleInput(t){var e,i;try{null==(e=this.delegate)||e.inputControllerWillHandleInput(),t.call(this)}finally{null==(i=this.delegate)||i.inputControllerDidHandleInput()}}createLinkHTML(t,e){let i=document.createElement("a");return i.href=t,i.textContent=e||t,i.outerHTML}}em(iP,"events",{});let{browser:iI,keyNames:iN}=Z,iO=0;class iM extends iP{constructor(){super(...arguments),this.resetInputSummary()}setInputSummary(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(let e in this.inputSummary.eventName=this.eventName,t){let i=t[e];this.inputSummary[e]=i}return this.inputSummary}resetInputSummary(){this.inputSummary={}}reset(){return this.resetInputSummary(),tj.reset()}elementDidMutate(t){var e,i;return this.isComposing()?null==(e=this.delegate)||null==(i=e.inputControllerDidAllowUnhandledInput)?void 0:i.call(e):this.handleInput(function(){return this.mutationIsSignificant(t)&&(this.mutationIsExpected(t)?this.requestRender():this.requestReparse()),this.reset()})}mutationIsExpected(t){let{textAdded:e,textDeleted:i}=t;if(this.inputSummary.preferDocument)return!0;let n=null!=e?e===this.inputSummary.textAdded:!this.inputSummary.textAdded,r=null!=i?this.inputSummary.didDelete:!this.inputSummary.didDelete,s=["\n"," \n"].includes(e)&&!n,o="\n"===i&&!r;if(s&&!o||o&&!s){let t=this.getSelectedRange();if(t){var a;let i=s?e.replace(/\n$/,"").length||-1:(null==e?void 0:e.length)||1;if(null!=(a=this.responder)&&a.positionIsBlockBreak(t[1]+i))return!0}}return n&&r}mutationIsSignificant(t){var e;let i=Object.keys(t).length>0,n=""===(null==(e=this.compositionInput)?void 0:e.getEndData());return i||!n}getCompositionInput(){if(this.isComposing())return this.compositionInput;this.compositionInput=new iV(this)}isComposing(){return this.compositionInput&&!this.compositionInput.isEnded()}deleteInDirection(t,e){var i;return!1!==(null==(i=this.responder)?void 0:i.deleteInDirection(t))?this.setInputSummary({didDelete:!0}):e?(e.preventDefault(),this.requestRender()):void 0}serializeSelectionToDataTransfer(t){var e;if(!function(t){if(null==t||!t.setData)return!1;for(let e in tL){let i=tL[e];try{if(t.setData(e,i),!t.getData(e)===i)return!1}catch(t){return!1}}return!0}(t))return;let i=null==(e=this.responder)?void 0:e.getSelectedDocument().toSerializableDocument();return t.setData("application/x-trix-document",JSON.stringify(i)),t.setData("text/html",el.render(i).innerHTML),t.setData("text/plain",i.toString().replace(/\n$/,"")),!0}canAcceptDataTransfer(t){let e={};
1return Array.from((null==t?void 0:t.types)||[]).forEach(t=>{e[t]=!0}),e.Files||e["application/x-trix-document"]||e["text/html"]||e["text/plain"]}getPastedHTMLUsingHiddenElement(t){let e=this.getSelectedRange(),i=j({style:{position:"absolute",left:"".concat(window.pageXOffset,"px"),top:"".concat(window.pageYOffset,"px"),opacity:0},tagName:"div",editable:!0});return document.body.appendChild(i),i.focus(),requestAnimationFrame(()=>{let n=i.innerHTML;return N(i),this.setSelectedRange(e),t(n)})}}em(iM,"events",{keydown(t){var e,i;this.isComposing()||this.resetInputSummary(),this.inputSummary.didInput=!0;let n=iN[t.keyCode];if(n){let i=this.keys;["ctrl","alt","shift","meta"].forEach(e=>{var n;t["".concat(e,"Key")]&&("ctrl"===e&&(e="control"),i=null==(n=i)?void 0:n[e])}),null!=(null==(e=i)?void 0:e[n])&&(this.setInputSummary({keyName:n}),tj.reset(),i[n].call(this,t))}if(tw(t)){let e=String.fromCharCode(t.keyCode).toLowerCase();if(e){let n=["alt","shift"].map(e=>{if(t["".concat(e,"Key")])return e}).filter(t=>t);n.push(e),null!=(i=this.delegate)&&i.inputControllerDidReceiveKeyboardCommand(n)&&t.preventDefault()}}},keypress(t){var e,i;if(null!=this.inputSummary.eventName||t.metaKey||t.ctrlKey&&!t.altKey)return;let n=iU(t);return n?(null==(e=this.delegate)||e.inputControllerWillPerformTyping(),null==(i=this.responder)||i.insertString(n),this.setInputSummary({textAdded:n,didDelete:this.selectionIsExpanded()})):void 0},textInput(t){let{data:e}=t,{textAdded:i}=this.inputSummary;if(i&&i!==e&&i.toUpperCase()===e){var n;let t=this.getSelectedRange();return this.setSelectedRange([t[0],t[1]+i.length]),null==(n=this.responder)||n.insertString(e),this.setInputSummary({textAdded:e}),this.setSelectedRange(t)}},dragenter(t){t.preventDefault()},dragstart(t){var e,i;return this.serializeSelectionToDataTransfer(t.dataTransfer),this.draggedRange=this.getSelectedRange(),null==(e=this.delegate)||null==(i=e.inputControllerDidStartDrag)?void 0:i.call(e)},dragover(t){if(this.draggedRange||this.canAcceptDataTransfer(t.dataTransfer)){var e,i;t.preventDefault();let n={x:t.clientX,y:t.clientY};if(!tF(n,this.draggingPoint))return this.draggingPoint=n,null==(e=this.delegate)||null==(i=e.inputControllerDidReceiveDragOverPoint)?void 0:i.call(e,this.draggingPoint)}},dragend(t){var e,i;null==(e=this.delegate)||null==(i=e.inputControllerDidCancelDrag)||i.call(e),this.draggedRange=null,this.draggingPoint=null},drop(t){var e,i,n,r,s;t.preventDefault();let o=null==(e=t.dataTransfer)?void 0:e.files,a=t.dataTransfer.getData("application/x-trix-document"),l={x:t.clientX,y:t.clientY};if(null==(i=this.responder)||i.setLocationRangeFromPointRange(l),null!=o&&o.length)this.attachFiles(o);else if(this.draggedRange)null==(n=this.delegate)||n.inputControllerWillMoveText(),null==(r=this.responder)||r.moveTextFromRange(this.draggedRange),this.draggedRange=null,this.requestRender();else if(a){let t=eN.fromJSONString(a);null==(s=this.responder)||s.insertDocument(t),this.requestRender()}this.draggedRange=null,this.draggingPoint=null},cut(t){var e,i;if(null!=(e=this.responder)&&e.selectionIsExpanded()&&(this.serializeSelectionToDataTransfer(t.clipboardData)&&t.preventDefault(),null==(i=this.delegate)||i.inputControllerWillCutText(),this.deleteInDirection("backward"),t.defaultPrevented))return this.requestRender()},copy(t){var e;null!=(e=this.responder)&&e.selectionIsExpanded()&&this.serializeSelectionToDataTransfer(t.clipboardData)&&t.preventDefault()},paste(t){var e,i,n,r,s,o,a,l,h,u,c,d,g,m;let p=t.clipboardData||t.testClipboardData,f={clipboard:p};if(!p||iq(t))return void this.getPastedHTMLUsingHiddenElement(t=>{var e,i,n;return f.type="text/html",f.html=t,null==(e=this.delegate)||e.inputControllerWillPaste(f),null==(i=this.responder)||i.insertHTML(f.html),this.requestRender(),null==(n=this.delegate)?void 0:n.inputControllerDidPaste(f)});let b=p.getData("URL"),A=p.getData("text/html"),v=p.getData("public.url-name");if(b){let t;f.type="text/html",t=v?tJ(v).trim():b,f.html=this.createLinkHTML(b,t),null==(e=this.delegate)||e.inputControllerWillPaste(f),this.setInputSummary({textAdded:t,didDelete:this.selectionIsExpanded()}),null==(i=this.responder)||i.insertHTML(f.html),this.requestRender(),null==(n=this.delegate)||n.inputControllerDidPaste(f)}else if(tD(p))f.type="text/plain",f.string=p.getData("text/plain"),null==(r=this.delegate)||r.inputControllerWillPaste(f),this.setInputSummary({textAdded:f.string,didDelete:this.selectionIsExpanded()}),null==(s=this.responder)||s.insertString(f.string),this.requestRender(),null==(o=this.delegate)||o.inputControllerDidPaste(f);else if(A)f.type="text/html",f.html=A,null==(a=this.delegate)||a.inputControllerWillPaste(f),null==(l=this.responder)||l.insertHTML(f.html),this.requestRender(),null==(h=this.delegate)||h.inputControllerDidPaste(f);else if(Array.from(p.types).includes("Files")){let t=null==(u=p.items)||null==(u=u[0])||null==(c=u.getAsFile)?void 0:c.call(u);if(t){let e=ij(t);!t.name&&e&&(t.name="pasted-file-".concat(++iO,".").concat(e)),f.type="File",f.file=t,null==(d=this.delegate)||d.inputControllerWillAttachFiles(),null==(g=this.responder)||g.insertFile(f.file),this.requestRender(),null==(m
1=this.delegate)||m.inputControllerDidPaste(f)}}t.preventDefault()},compositionstart(t){return this.getCompositionInput().start(t.data)},compositionupdate(t){return this.getCompositionInput().update(t.data)},compositionend(t){return this.getCompositionInput().end(t.data)},beforeinput(t){this.inputSummary.didInput=!0},input(t){return this.inputSummary.didInput=!0,t.stopPropagation()}}),em(iM,"keys",{backspace(t){var e;return null==(e=this.delegate)||e.inputControllerWillPerformTyping(),this.deleteInDirection("backward",t)},delete(t){var e;return null==(e=this.delegate)||e.inputControllerWillPerformTyping(),this.deleteInDirection("forward",t)},return(t){var e,i;return this.setInputSummary({preferDocument:!0}),null==(e=this.delegate)||e.inputControllerWillPerformTyping(),null==(i=this.responder)?void 0:i.insertLineBreak()},tab(t){var e,i;null!=(e=this.responder)&&e.canIncreaseNestingLevel()&&(null==(i=this.responder)||i.increaseNestingLevel(),this.requestRender(),t.preventDefault())},left(t){var e;if(this.selectionIsInCursorTarget())return t.preventDefault(),null==(e=this.responder)?void 0:e.moveCursorInDirection("backward")},right(t){var e;if(this.selectionIsInCursorTarget())return t.preventDefault(),null==(e=this.responder)?void 0:e.moveCursorInDirection("forward")},control:{d(t){var e;return null==(e=this.delegate)||e.inputControllerWillPerformTyping(),this.deleteInDirection("forward",t)},h(t){var e;return null==(e=this.delegate)||e.inputControllerWillPerformTyping(),this.deleteInDirection("backward",t)},o(t){var e,i;return t.preventDefault(),null==(e=this.delegate)||e.inputControllerWillPerformTyping(),null==(i=this.responder)||i.insertString("\n",{updatePosition:!1}),this.requestRender()}},shift:{return(t){var e,i;null==(e=this.delegate)||e.inputControllerWillPerformTyping(),null==(i=this.responder)||i.insertString("\n"),this.requestRender(),t.preventDefault()},tab(t){var e,i;null!=(e=this.responder)&&e.canDecreaseNestingLevel()&&(null==(i=this.responder)||i.decreaseNestingLevel(),this.requestRender(),t.preventDefault())},left(t){if(this.selectionIsInCursorTarget())return t.preventDefault(),this.expandSelectionInDirection("backward")},right(t){if(this.selectionIsInCursorTarget())return t.preventDefault(),this.expandSelectionInDirection("forward")}},alt:{backspace(t){var e;return this.setInputSummary({preferDocument:!1}),null==(e=this.delegate)?void 0:e.inputControllerWillPerformTyping()}},meta:{backspace(t){var e;return this.setInputSummary({preferDocument:!1}),null==(e=this.delegate)?void 0:e.inputControllerWillPerformTyping()}}}),iM.proxyMethod("responder?.getSelectedRange"),iM.proxyMethod("responder?.setSelectedRange"),iM.proxyMethod("responder?.expandSelectionInDirection"),iM.proxyMethod("responder?.selectionIsInCursorTarget"),iM.proxyMethod("responder?.selectionIsExpanded");let ij=t=>{var e;return null==(e=t.type)||null==(e=e.match(/\/(\w+)$/))?void 0:e[1]},iW=!(null==(x=" ".codePointAt)||!x.call(" ",0)),iU=function(t){if(t.key&&iW&&t.key.codePointAt(0)===t.keyCode)return t.key;{let e;if(null===t.which?e=t.keyCode:0!==t.which&&0!==t.charCode&&(e=t.charCode),null!=e&&"escape"!==iN[e])return tr.fromCodepoints([e]).toString()}},iq=function(t){let e=t.clipboardData;if(e){if(e.types.includes("text/html")){for(let t of e.types){let i=/^CorePasteboardFlavorType/.test(t),n=/^dyn\./.test(t)&&e.getData(t);if(i||n)return!0}return!1}{let t=e.types.includes("com.apple.webarchive"),i=e.types.includes("com.apple.flat-rtfd");return t||i}}};class iV extends tt{constructor(t){super(...arguments),this.inputController=t,this.responder=this.inputController.responder,this.delegate=this.inputController.delegate,this.inputSummary=this.inputController.inputSummary,this.data={}}start(t){if(this.data.start=t,this.isSignificant()){var e,i;"keypress"===this.inputSummary.eventName&&this.inputSummary.textAdded&&(null==(i=this.responder)||i.deleteInDirection("left")),this.selectionIsExpanded()||(this.insertPlaceholder(),this.requestRender()),this.range=null==(e=this.responder)?void 0:e.getSelectedRange()}}update(t){if(this.data.update=t,this.isSignificant()){let t=this.selectPlaceholder();t&&(this.forgetPlaceholder(),this.range=t)}}end(t){var e,i,n,r;return this.data.end=t,this.isSignificant()?(this.forgetPlaceholder(),this.canApplyToDocument()?(this.setInputSummary({preferDocument:!0,didInput:!1}),null==(e=this.delegate)||e.inputControllerWillPerformTyping(),null==(i=this.responder)||i.setSelectedRange(this.range),null==(n=this.responder)||n.insertString(this.data.end),null==(r=this.responder)?void 0:r.setSelectedRange(this.range[0]+this.data.end.length)):null!=this.data.start||null!=this.data.update?(this.requestReparse(),this.inputController.reset()):void 0):this.inputController.reset()}getEndData(){return this.data.end}isEnded(){return null!=this.getEndData()}isSignificant(){return!iI.composesExistingText||this.inputSummary.didInput}canApplyToDocument(){var t,e;return 0===(null==(t=this.data.start)?void 0:t.length)&&(null==(e=this.data.end)?void 0:e.length)>0&&this.range}}iV.proxyMethod("inputController.setInputSummary"),iV.proxyMethod("inputController.requestRender"),iV.proxyMethod("inputController.requestReparse"),iV.proxyMethod("responder?.selectionIsExpanded"),iV.proxyMethod("responder?.insertPlaceholder"),iV.proxyMethod("responder?.selectPlaceholder"),iV.proxyMethod("responder?.forgetPlaceholder");class iH extends iP{constructor(){super(...arguments),this.render=this.render.bind(this)}elementDidMutate(){var t,e;return this.scheduledRender?this.composing?null==(e=this.delegate)||null==(t=e.inputControllerDidAllowUnhandledInput)?void 0:t.call(e):void 0:this.reparse()}scheduleRender(){return this.scheduledRender?this.scheduledRender:this.scheduledRender=requestAnimationFrame(this.render)}render(){var t,e;cancelAnimationFrame(this.scheduledRender),this.scheduledRender=null,this.composing||null==(e=this.delegate)||e.render(),null==(t=this.afterRender)||t.call(this),this.afterRender=null}reparse(){var t;return null==(t=this.delegate)?void 0:t.reparse()}insertString(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",i=arguments.length>1?arguments[1]:void 0;return null==(t=this.delegate)||t.inputControllerWillPerformTyping(),this.withTargetDOMRange(function(){var t;return null==(t=this.responder)?void 0:t.insertString(e,i)})}toggleAttributeIfSupported(t){var e;if(tA().includes(t))return null==(e=this.delegate)||e.inputControllerWillPerformFormatting(t),this.withTargetDOMRange(function(){var e;return null==(e=this.responder)?void 0:e.toggleCurrentAttribute(t)})}activateAttributeIfSupported(t,e){var i;if(tA().includes(t))return null==(i=this.delegate)||i.inputControllerWillPerformFormatting(t),this.withTargetDOMRange(function(){var i;return null==(i=this.responder)?void 0:i.setCurrentAttribute(t,e)})}deleteInDirection(t){var e;let{recordUndoEntry:i}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{recordUndoEntry:!0};i&&(null==(e=this.delegate)||e.inputControllerWillPerformTyping());let n=()=>{var e;return null==(e=this.responder)?void 0:e.deleteInDirection(t)},r=this.getTargetDOMRange({minLength:this.composing?1:2});return r?this.withTargetDOMRange(r,n):n()}withTargetDOMRange(t,e){var i;return"function"==typeof t&&(e=t,t=this.getTargetDOMRange()),t?null==(i=this.responder)?void 0:i.withTargetDOMRange(t,e.bind(this)):(tj.reset(),e.call(this))}getTargetDOMRange(){var t,e;let{minLength:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{minLength:0},n=null==(t=(e=this.event).getTargetRanges)?void 0:t.call(e);
1if(n&&n.length){let t=iz(n[0]);if(0===i||t.toString().length>=i)return t}}withEvent(t,e){let i;this.event=t;try{i=e.call(this)}finally{this.event=null}return i}}em(iH,"events",{keydown(t){if(tw(t)){var e;let i=i$(t);null!=(e=this.delegate)&&e.inputControllerDidReceiveKeyboardCommand(i)&&t.preventDefault()}else{let e=t.key;t.altKey&&(e+="+Alt"),t.shiftKey&&(e+="+Shift");let i=this.constructor.keys[e];if(i)return this.withEvent(t,i)}},paste(t){var e,i,n,r,s,o,a;let l,h=null==(a=t.clipboardData)?void 0:a.getData("URL");return iK(t)?(t.preventDefault(),this.attachFiles(t.clipboardData.files)):iG(t)?(t.preventDefault(),l={type:"text/plain",string:t.clipboardData.getData("text/plain")},null==(s=this.delegate)||s.inputControllerWillPaste(l),null==(r=this.responder)||r.insertString(l.string),this.render(),null==(o=this.delegate)?void 0:o.inputControllerDidPaste(l)):h?(t.preventDefault(),l={type:"text/html",html:this.createLinkHTML(h)},null==(e=this.delegate)||e.inputControllerWillPaste(l),null==(n=this.responder)||n.insertHTML(l.html),this.render(),null==(i=this.delegate)?void 0:i.inputControllerDidPaste(l)):void 0},beforeinput(t){let e=this.constructor.inputTypes[t.inputType];e&&(this.withEvent(t,e),this.scheduleRender())},input(t){tj.reset()},dragstart(t){var e,i;null!=(e=this.responder)&&e.selectionContainsAttachments()&&(t.dataTransfer.setData("application/x-trix-dragging",!0),this.dragging={range:null==(i=this.responder)?void 0:i.getSelectedRange(),point:iX(t)})},dragenter(t){i_(t)&&t.preventDefault()},dragover(t){if(this.dragging){var e;t.preventDefault();let i=iX(t);if(!tF(i,this.dragging.point))return this.dragging.point=i,null==(e=this.responder)?void 0:e.setLocationRangeFromPointRange(i)}else i_(t)&&t.preventDefault()},drop(t){var e,i,n;if(this.dragging)return t.preventDefault(),null==(e=this.delegate)||e.inputControllerWillMoveText(),null==(i=this.responder)||i.moveTextFromRange(this.dragging.range),this.dragging=null,this.scheduleRender();if(i_(t)){t.preventDefault();let e=iX(t);return null==(n=this.responder)||n.setLocationRangeFromPointRange(e),this.attachFiles(t.dataTransfer.files)}},dragend(){var t;this.dragging&&(null==(t=this.responder)||t.setSelectedRange(this.dragging.range),this.dragging=null)},compositionend(t){this.composing&&(this.composing=!1,y.recentAndroid||this.scheduleRender())}}),em(iH,"keys",{ArrowLeft(){var t,e;if(null!=(t=this.responder)&&t.shouldManageMovingCursorInDirection("backward"))return this.event.preventDefault(),null==(e=this.responder)?void 0:e.moveCursorInDirection("backward")},ArrowRight(){var t,e;if(null!=(t=this.responder)&&t.shouldManageMovingCursorInDirection("forward"))return this.event.preventDefault(),null==(e=this.responder)?void 0:e.moveCursorInDirection("forward")},Backspace(){var t,e,i;if(null!=(t=this.responder)&&t.shouldManageDeletingInDirection("backward"))return this.event.preventDefault(),null==(e=this.delegate)||e.inputControllerWillPerformTyping(),null==(i=this.responder)||i.deleteInDirection("backward"),this.render()},Tab(){var t,e;if(null!=(t=this.responder)&&t.canIncreaseNestingLevel())return this.event.preventDefault(),null==(e=this.responder)||e.increaseNestingLevel(),this.render()},"Tab+Shift"(){var t,e;if(null!=(t=this.responder)&&t.canDecreaseNestingLevel())return this.event.preventDefault(),null==(e=this.responder)||e.decreaseNestingLevel(),this.render()}}),em(iH,"inputTypes",{deleteByComposition(){return this.deleteInDirection("backward",{recordUndoEntry:!1})},deleteByCut(){return this.deleteInDirection("backward")},deleteByDrag(){return this.event.preventDefault(),this.withTargetDOMRange(function(){var t;this.deleteByDragRange=null==(t=this.responder)?void 0:t.getSelectedRange()})},deleteCompositionText(){return this.deleteInDirection("backward",{recordUndoEntry:!1})},deleteContent(){return this.deleteInDirection("backward")},deleteContentBackward(){return this.deleteInDirection("backward")},deleteContentForward(){return this.deleteInDirection("forward")},deleteEntireSoftLine(){return this.deleteInDirection("forward")},deleteHardLineBackward(){return this.deleteInDirection("backward")},deleteHardLineForward(){return this.deleteInDirection("forward")},deleteSoftLineBackward(){return this.deleteInDirection("backward")},deleteSoftLineForward(){return this.deleteInDirection("forward")},deleteWordBackward(){return this.deleteInDirection("backward")}
1,deleteWordForward(){return this.deleteInDirection("forward")},formatBackColor(){return this.activateAttributeIfSupported("backgroundColor",this.event.data)},formatBold(){return this.toggleAttributeIfSupported("bold")},formatFontColor(){return this.activateAttributeIfSupported("color",this.event.data)},formatFontName(){return this.activateAttributeIfSupported("font",this.event.data)},formatIndent(){var t;if(null!=(t=this.responder)&&t.canIncreaseNestingLevel())return this.withTargetDOMRange(function(){var t;return null==(t=this.responder)?void 0:t.increaseNestingLevel()})},formatItalic(){return this.toggleAttributeIfSupported("italic")},formatJustifyCenter(){return this.toggleAttributeIfSupported("justifyCenter")},formatJustifyFull(){return this.toggleAttributeIfSupported("justifyFull")},formatJustifyLeft(){return this.toggleAttributeIfSupported("justifyLeft")},formatJustifyRight(){return this.toggleAttributeIfSupported("justifyRight")},formatOutdent(){var t;if(null!=(t=this.responder)&&t.canDecreaseNestingLevel())return this.withTargetDOMRange(function(){var t;return null==(t=this.responder)?void 0:t.decreaseNestingLevel()})},formatRemove(){this.withTargetDOMRange(function(){for(let i in null==(t=this.responder)?void 0:t.getCurrentAttributes()){var t,e;null==(e=this.responder)||e.removeCurrentAttribute(i)}})},formatSetBlockTextDirection(){return this.activateAttributeIfSupported("blockDir",this.event.data)},formatSetInlineTextDirection(){return this.activateAttributeIfSupported("textDir",this.event.data)},formatStrikeThrough(){return this.toggleAttributeIfSupported("strike")},formatSubscript(){return this.toggleAttributeIfSupported("sub")},formatSuperscript(){return this.toggleAttributeIfSupported("sup")},formatUnderline(){return this.toggleAttributeIfSupported("underline")},historyRedo(){var t;return null==(t=this.delegate)?void 0:t.inputControllerWillPerformRedo()},historyUndo(){var t;return null==(t=this.delegate)?void 0:t.inputControllerWillPerformUndo()},insertCompositionText(){return this.composing=!0,this.insertString(this.event.data)},insertFromComposition(){return this.composing=!1,this.insertString(this.event.data)},insertFromDrop(){var t;let e=this.deleteByDragRange;if(e)return this.deleteByDragRange=null,null==(t=this.delegate)||t.inputControllerWillMoveText(),this.withTargetDOMRange(function(){var t;return null==(t=this.responder)?void 0:t.moveTextFromRange(e)})},insertFromPaste(){var t,e,i,n;let{dataTransfer:r}=this.event,s={dataTransfer:r},o=r.getData("URL"),a=r.getData("text/html");if(o){let e;this.event.preventDefault(),s.type="text/html";let i=r.getData("public.url-name");e=i?tJ(i).trim():o,s.html=this.createLinkHTML(o,e),null==(t=this.delegate)||t.inputControllerWillPaste(s),this.withTargetDOMRange(function(){var t;return null==(t=this.responder)?void 0:t.insertHTML(s.html)}),this.afterRender=()=>{var t;return null==(t=this.delegate)?void 0:t.inputControllerDidPaste(s)}}else tD(r)?(s.type="text/plain",s.string=r.getData("text/plain"),null==(e=this.delegate)||e.inputControllerWillPaste(s),this.withTargetDOMRange(function(){var t;return null==(t=this.responder)?void 0:t.insertString(s.string)}),this.afterRender=()=>{var t;return null==(t=this.delegate)?void 0:t.inputControllerDidPaste(s)}):iJ(this.event)?(s.type="File",s.file=r.files[0],null==(i=this.delegate)||i.inputControllerWillPaste(s),this.withTargetDOMRange(function(){var t;return null==(t=this.responder)?void 0:t.insertFile(s.file)}),this.afterRender=()=>{var t;return null==(t=this.delegate)?void 0:t.inputControllerDidPaste(s)}):a&&(this.event.preventDefault(),s.type="text/html",s.html=a,null==(n=this.delegate)||n.inputControllerWillPaste(s),this.withTargetDOMRange(function(){var t;return null==(t=this.responder)?void 0:t.insertHTML(s.html)}),this.afterRender=()=>{var t;return null==(t=this.delegate)?void 0:t.inputControllerDidPaste(s)})},insertFromYank(){return this.insertString(this.event.data)},insertLineBreak(){return this.insertString("\n")},insertLink(){return this.activateAttributeIfSupported("href",this.event.data)},insertOrderedList(){return this.toggleAttributeIfSupported("number")},insertParagraph(){var t;return null==(t=this.delegate)||t.inputControllerWillPerformTyping(),this.withTargetDOMRange(function(){var t;return null==(t=this.responder)?void 0:t.insertLineBreak()})},insertReplacementText(){let t=this.event.dataTransfer.getData("text/plain"),e=this.event.getTargetRanges()[0];this.withTargetDOMRange(e,()=>{this.insertString(t,{updatePosition:!1})})},insertText(){var t;return this.insertString(this.event.data||(null==(t=this.event.dataTransfer)?void 0:t.getData("text/plain")))},insertTranspose(){return this.insertString(this.event.data)},insertUnorderedList(){return this.toggleAttributeIfSupported("bullet")}});let iz=function(t){let e=document.createRange();return e.setStart(t.startContainer,t.startOffset),e.setEnd(t.endContainer,t.endOffset),e},i_=t=>{var e;return Array.from((null==(e=t.dataTransfer)?void 0:e.types)||[]).includes("Files")},iJ=t=>{var e;return(null==(e=t.dataTransfer.files)?void 0:e[0])&&!iK(t)&&!(t=>{let{dataTransfer:e}=t;return e.types.includes("Files")&&e.types.includes("text/html")&&e.getData("text/html").includes("urn:schemas-microsoft-com:office:office")})(t)},iK=function(t){let e=t.clipboardData;if(e)return Array.from(e.types).filter(t=>t.match(/file/i)).length===e.types.length&&e.files.length>=1},iG=function(t){let e=t.clipboardData;if(e)return e.types.includes("text/plain")&&1===e.types.length},i$=function(t){let e=[];return t.altKey&&e.push("alt"),t.shiftKey&&e.push("shift"),e.push(t.key),e},iX=t=>({x:t.clientX,y:t.clientY}),iY="[data-trix-attribute]",iQ="[data-trix-action]",iZ="".concat(iY,", ").concat(iQ),i0="[data-trix-dialog]",i1="".concat(i0,"[data-trix-active]"),i2="".concat(i0," [data-trix-method]"),i6="".concat(i0," [data-trix-input]"),i3=(t,e)=>(e||(e=i5(t)),t.querySelector("[data-trix-input][name='".concat(e,"']"))),i5=t=>t.getAttribute("data-trix-attribute")||t.getAttribute("data-trix-dialog-attribute");class i4 extends tt{constructor(t){super(t),this.didClickActionButton=this.didClickActionButton.bind(this),this.didClickAttributeButton=this.didClickAttributeButton.bind(this),this.didClickDialogButton=this.didClickDialogButton.bind(this),this.didKeyDownDialogInput=this.didKeyDownDialogInput.bind(this),this.element=t,this.attributes={},this.actions={},this.resetDialogInputs(),D("mousedown",{onElement:this.element,matchingSelector:iQ,withCallback:this.didClickActionButton}),D("mousedown",{onElement:this.element,matchingSelector:iY,withCallback:this.didClickAttributeButton}),D("click",{onElement:this.element,matchingSelector:iZ,preventDefault:!0}),D("click",{onElement:this.element,matchingSelector:i2,withCallback:this.didClickDialogButton}),D("keydown",{onElement:this.element,matchingSelector:i6,withCallback:this.didKeyDownDialogInput})}didClickActionButton(t,e){var i,n;null==(n=this.delegate)||n.toolbarDidClickButton(),t.preventDefault();let r=e.getAttribute("data-trix-action");return this.getDialog(r)?this.toggleDialog(r):null==(i=this.delegate)?void 0:i.toolbarDidInvokeAction(r,e)}didClickAttributeButton(t,e){var i,n;null==(i=this.delegate)||i.toolbarDidClickButton(),t.preventDefault();let r=i5(e);return this.getDialog(r)?this.toggleDialog(r):null==(n=this.delegate)||n.toolbarDidToggleAttribute(r),this.refreshAttributeButtons()}didClickDialogButton(t,e){let i=F(e,{matchingSelector:i0});return this[e.getAttribute("data-trix-method")].call(this,i)}didKeyDownDialogInput(t,e){if(13===t.keyCode){t.preventDefault();let i=e.getAttribute("name"),n=this.getDialog(i);this.setAttribute(n)}if(27===t.keyCode)return t.preventDefault(),this.hideDialog()}updateActions(t){return this.actions=t,this.refreshActionButtons()}refreshActionButtons(){return this.eachActionButton((t,e)=>{t.disabled=!1===this.actions[e]})}eachActionButton(t){return Array.from(this.element.querySelectorAll(iQ)).map(e=>t(e,e.getAttribute("data-trix-action")))}updateAttributes(t){return this.attributes=t,this.refreshAttributeButtons()}refreshAttributeButtons(){return this.eachAttributeButton((t,e)=>(t.disabled=!1===this.attributes[e],this.attributes[e]||this.dialogIsVisible(e)?(t.setAttribute("data-trix-active",""),t.classList.add("trix-active")):(t.removeAttribute("data-trix-active"),t.classList.remove("trix-active"))))}eachAttributeButton(t){return Array.from(this.element.querySelectorAll(iY)).map(e=>t(e,i5(e)))}applyKeyboardCommand(t){let e=JSON.stringify(t.sort());for(let t of Array.from(this.element.querySelectorAll("[data-trix-key]")))if(JSON.stringify(t.getAttribute("data-trix-key").split("+").sort())===e)return w("mousedown",{onElement:t}),!0;return!1}dialogIsVisible(t){let e=this.getDialog(t);if(e)return e.hasAttribute("data-trix-active")}toggleDialog(t){return this.dialogIsVisible(t)?this.hideDialog():this.showDialog(t)}
1showDialog(t){var e,i;this.hideDialog(),null==(e=this.delegate)||e.toolbarWillShowDialog();let n=this.getDialog(t);n.setAttribute("data-trix-active",""),n.classList.add("trix-active"),Array.from(n.querySelectorAll("input[disabled]")).forEach(t=>{t.removeAttribute("disabled")});let r=i5(n);if(r){let e=i3(n,t);e&&(e.value=this.attributes[r]||"",e.select())}return null==(i=this.delegate)?void 0:i.toolbarDidShowDialog(t)}setAttribute(t){var e;let i=i5(t),n=i3(t,i);return n.willValidate&&!n.checkValidity()?(n.setAttribute("data-trix-validate",""),n.classList.add("trix-validate"),n.focus()):(null==(e=this.delegate)||e.toolbarDidUpdateAttribute(i,n.value),this.hideDialog())}removeAttribute(t){var e;let i=i5(t);return null==(e=this.delegate)||e.toolbarDidRemoveAttribute(i),this.hideDialog()}hideDialog(){var t;let e=this.element.querySelector(i1);if(e)return e.removeAttribute("data-trix-active"),e.classList.remove("trix-active"),this.resetDialogInputs(),null==(t=this.delegate)?void 0:t.toolbarDidHideDialog(e.getAttribute("data-trix-dialog"))}resetDialogInputs(){Array.from(this.element.querySelectorAll(i6)).forEach(t=>{t.setAttribute("disabled","disabled"),t.removeAttribute("data-trix-validate"),t.classList.remove("trix-validate")})}getDialog(t){return this.element.querySelector("[data-trix-dialog=".concat(t,"]"))}}class i7 extends iC{constructor(t){let{editorElement:e,document:i,html:n}=t;super(...arguments),this.editorElement=e,this.selectionManager=new id(this.editorElement),this.selectionManager.delegate=this,this.composition=new e7,this.composition.delegate=this,this.attachmentManager=new e5(this.composition.getAttachments()),this.attachmentManager.delegate=this,this.inputController=2===G.getLevel()?new iH(this.editorElement):new iM(this.editorElement),this.inputController.delegate=this,this.inputController.responder=this.composition,this.compositionController=new iy(this.editorElement,this.composition),this.compositionController.delegate=this,this.toolbarController=new i4(this.editorElement.toolbarElement),this.toolbarController.delegate=this,this.editor=new is(this.composition,this.selectionManager,this.editorElement),i?this.editor.loadDocument(i):this.editor.loadHTML(n)}registerSelectionManager(){return tj.registerSelectionManager(this.selectionManager)}unregisterSelectionManager(){return tj.unregisterSelectionManager(this.selectionManager)}render(){return this.compositionController.render()}reparse(){return this.composition.replaceHTML(this.editorElement.innerHTML)}compositionDidChangeDocument(t){if(this.notifyEditorElement("document-change"),!this.handlingInput)return this.render()}compositionDidChangeCurrentAttributes(t){return this.currentAttributes=t,this.toolbarController.updateAttributes(this.currentAttributes),this.updateCurrentActions(),this.notifyEditorElement("attributes-change",{attributes:this.currentAttributes})}compositionDidPerformInsertionAtRange(t){this.pasting&&(this.pastedRange=t)}compositionShouldAcceptFile(t){return this.notifyEditorElement("file-accept",{file:t})}compositionDidAddAttachment(t){let e=this.attachmentManager.manageAttachment(t);return this.notifyEditorElement("attachment-add",{attachment:e})}compositionDidEditAttachment(t){this.compositionController.rerenderViewForObject(t);let e=this.attachmentManager.manageAttachment(t);return this.notifyEditorElement("attachment-edit",{attachment:e}),this.notifyEditorElement("change")}compositionDidChangeAttachmentPreviewURL(t){return this.compositionController.invalidateViewForObject(t),this.notifyEditorElement("change")}compositionDidRemoveAttachment(t){let e=this.attachmentManager.unmanageAttachment(t);return this.notifyEditorElement("attachment-remove",{attachment:e})}compositionDidStartEditingAttachment(t,e){return this.attachmentLocationRange=this.composition.document.getLocationRangeOfAttachment(t),this.compositionController.installAttachmentEditorForAttachment(t,e),this.selectionManager.setLocationRange(this.attachmentLocationRange)}compositionDidStopEditingAttachment(t){this.compositionController.uninstallAttachmentEditor(),this.attachmentLocationRange=null}compositionDidRequestChangingSelectionToLocationRange(t){if(!this.loadingSnapshot||this.isFocused())return this.requestedLocationRange=t,this.compositionRevisionWhe
1nLocationRangeRequested=this.composition.revision,this.handlingInput?void 0:this.render()}compositionWillLoadSnapshot(){this.loadingSnapshot=!0}compositionDidLoadSnapshot(){this.compositionController.refreshViewCache(),this.render(),this.loadingSnapshot=!1}getSelectionManager(){return this.selectionManager}attachmentManagerDidRequestRemovalOfAttachment(t){return this.removeAttachment(t)}compositionControllerWillSyncDocumentView(){return this.inputController.editorWillSyncDocumentView(),this.selectionManager.lock(),this.selectionManager.clearSelection()}compositionControllerDidSyncDocumentView(){return this.inputController.editorDidSyncDocumentView(),this.selectionManager.unlock(),this.updateCurrentActions(),this.notifyEditorElement("sync")}compositionControllerDidRender(){this.requestedLocationRange&&(this.compositionRevisionWhenLocationRangeRequested===this.composition.revision&&this.selectionManager.setLocationRange(this.requestedLocationRange),this.requestedLocationRange=null,this.compositionRevisionWhenLocationRangeRequested=null),this.renderedCompositionRevision!==this.composition.revision&&(this.runEditorFilters(),this.composition.updateCurrentAttributes(),this.notifyEditorElement("render")),this.renderedCompositionRevision=this.composition.revision}compositionControllerDidFocus(){return this.isFocusedInvisibly()&&this.setLocationRange({index:0,offset:0}),this.toolbarController.hideDialog(),this.notifyEditorElement("focus")}compositionControllerDidBlur(){return this.notifyEditorElement("blur")}compositionControllerDidSelectAttachment(t,e){return this.toolbarController.hideDialog(),this.composition.editAttachment(t,e)}compositionControllerDidRequestDeselectingAttachment(t){let e=this.attachmentLocationRange||this.composition.document.getLocationRangeOfAttachment(t);return this.selectionManager.setLocationRange(e[1])}compositionControllerWillUpdateAttachment(t){return this.editor.recordUndoEntry("Edit Attachment",{context:t.id,consolidatable:!0})}compositionControllerDidRequestRemovalOfAttachment(t){return this.removeAttachment(t)}inputControllerWillHandleInput(){this.handlingInput=!0,this.requestedRender=!1}inputControllerDidRequestRender(){this.requestedRender=!0}inputControllerDidHandleInput(){if(this.handlingInput=!1,this.requestedRender)return this.requestedRender=!1,this.render()}inputControllerDidAllowUnhandledInput(){return this.notifyEditorElement("change")}inputControllerDidRequestReparse(){return this.reparse()}inputControllerWillPerformTyping(){return this.recordTypingUndoEntry()}inputControllerWillPerformFormatting(t){return this.recordFormattingUndoEntry(t)}inputControllerWillCutText(){return this.editor.recordUndoEntry("Cut")}inputControllerWillPaste(t){return this.editor.recordUndoEntry("Paste"),this.pasting=!0,this.notifyEditorElement("before-paste",{paste:t})}inputControllerDidPaste(t){return t.range=this.pastedRange,this.pastedRange=null,this.pasting=null,this.notifyEditorElement("paste",{paste:t})}inputControllerWillMoveText(){return this.editor.recordUndoEntry("Move")}inputControllerWillAttachFiles(){return this.editor.recordUndoEntry("Drop Files")}inputControllerWillPerformUndo(){return this.editor.undo()}inputControllerWillPerformRedo(){return this.editor.redo()}inputControllerDidReceiveKeyboardCommand(t){return this.toolbarController.applyKeyboardCommand(t)}inputControllerDidStartDrag(){this.locationRangeBeforeDrag=this.selectionManager.getLocationRange()}inputControllerDidReceiveDragOverPoint(t){return this.selectionManager.setLocationRangeFromPointRange(t)}inputControllerDidCancelDrag(){this.selectionManager.setLocationRange(this.locationRangeBeforeDrag),this.locationRangeBeforeDrag=null}locationRangeDidChange(t){return this.composition.updateCurrentAttributes(),this.updateCurrentActions(),this.attachmentLocationRange&&!tI(this.attachmentLocationRange,t)&&this.composition.stopEditingAttachment(),this.notifyEditorElement("selection-change")}toolbarDidClickButton(){if(!this.getLocationRange())return this.setLocationRange({index:0,offset:0})}toolbarDidInvokeAction(t,e){return this.invokeAction(t,e)}toolbarDidToggleAttribute(t){if(this.recordFormattingUndoEntry(t),this.composition.toggleCurrentAttribute(t),this.render(),!this.selectionFrozen)return this.editorElement.focus()}toolbarDidUpdateAttribute(t,e){if(this.recordFormattingUndoEntry(t),this.composition.setCurrentAttribute(t,e),this.render(),!this.selectionFrozen)return this.editorElement.focus()}toolbarDidRemoveAttribute(t){if(this.recordFormattingUndoEntry(t),this.composition.removeCurrentAttribute(t),this.render(),!this.selectionFrozen)return this.editorElement.focus()}toolbarWillShowDialog(t){return this.composition.expandSelectionForEditing(),this.freezeSelection()}toolbarDidShowDialog(t){return this.notifyEditorElement("toolbar-dialog-show",{dialogName:t})}toolbarDidHideDialog(t){return this.thawSelection(),this.editorElement.focus(),this.notifyEditorElement("toolbar-dialog-hide",{dialogName:t})}freezeSelection(){if(!this.selectionFrozen)return this.selectionManager.lock(),this.composition.freezeSelection(),this.selectionFrozen=!0,this.render()}thawSelection(){if(this.selectionFrozen)return this.composition.thawSelection(),this.selectionManager.unlock(),this.selectionFrozen=!1,this.render()}canInvokeAction(t){var e;return!!this.actionIsExternal(t)||!(null==(e=this.actions[t])||null==(e=e.test)||!e.call(this))}invokeAction(t,e){var i;return this.actionIsExternal(t)?this.notifyEditorElement("action-invoke",{actionName:t,invokingElement:e}):null==(i=this.actions[t])||null==(i=i.perform)?void 0:i.call(this)}actionIsExternal(t){return/^x-./.test(t)}getCurrentActions(){let t={};for(let e in this.actions)t[e]=this.canInvokeAction(e);return t}updateCurrentActions(){let t=this.getCurrentActions();if(!tF(t,this.currentActions))return this.currentActions=t,this.toolbarController.updateActions(this.currentActions),this.notifyEditorElement("actions-change",{actions:this.currentActions})}runEditorFilters(){var t,e;let i=this.composition.getSnapshot();
1if(Array.from(this.editor.filters).forEach(t=>{let{document:e,selectedRange:n}=i;(i=t.call(this.editor,i)||{}).document||(i.document=e),i.selectedRange||(i.selectedRange=n)}),t=i,e=this.composition.getSnapshot(),!tI(t.selectedRange,e.selectedRange)||!t.document.isEqualTo(e.document))return this.composition.loadSnapshot(i)}updateInputElement(){let t=function(t,e){let i=e2[e];if(i)return i(t);throw Error("unknown content type: ".concat(e))}(this.compositionController.getSerializableElement(),"text/html");return this.editorElement.setInputElementValue(t)}notifyEditorElement(t,e){switch(t){case"document-change":this.documentChangedSinceLastRender=!0;break;case"render":this.documentChangedSinceLastRender&&(this.documentChangedSinceLastRender=!1,this.notifyEditorElement("change"));break;case"change":case"attachment-add":case"attachment-edit":case"attachment-remove":this.updateInputElement()}return this.editorElement.notify(t,e)}removeAttachment(t){return this.editor.recordUndoEntry("Delete Attachment"),this.composition.removeAttachment(t),this.render()}recordFormattingUndoEntry(t){let e=tv(t),i=this.selectionManager.getLocationRange();if(e||!tP(i))return this.editor.recordUndoEntry("Formatting",{context:this.getUndoContext(),consolidatable:!0})}recordTypingUndoEntry(){return this.editor.recordUndoEntry("Typing",{context:this.getUndoContext(this.currentAttributes),consolidatable:!0})}getUndoContext(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];return[this.getLocationContext(),this.getTimeContext(),...Array.from(e)]}getLocationContext(){let t=this.selectionManager.getLocationRange();return tP(t)?t[0].index:t}getTimeContext(){return Q.interval>0?Math.floor((new Date).getTime()/Q.interval):0}isFocused(){var t;return this.editorElement===(null==(t=this.editorElement.ownerDocument)?void 0:t.activeElement)}isFocusedInvisibly(){return this.isFocused()&&!this.getLocationRange()}get actions(){return this.constructor.actions}}em(i7,"actions",{undo:{test(){return this.editor.canUndo()},perform(){return this.editor.undo()}},redo:{test(){return this.editor.canRedo()},perform(){return this.editor.redo()}},link:{test(){return this.editor.canActivateAttribute("href")}},increaseNestingLevel:{test(){return this.editor.canIncreaseNestingLevel()},perform(){return this.editor.increaseNestingLevel()&&this.render()}},decreaseNestingLevel:{test(){return this.editor.canDecreaseNestingLevel()},perform(){return this.editor.decreaseNestingLevel()&&this.render()}},attachFiles:{test:()=>!0,perform(){return G.pickFiles(this.editor.insertFiles)}}}),i7.proxyMethod("getSelectionManager().setLocationRange"),i7.proxyMethod("getSelectionManager().getLocationRange");var i9=Object.freeze({__proto__:null,AttachmentEditorController:ix,CompositionController:iy,Controller:iC,EditorController:i7,InputController:iP,Level0InputController:iM,Level2InputController:iH,ToolbarController:i4}),i8=Object.freeze({__proto__:null,MutationObserver:iS,SelectionChangeObserver:tM}),nt=Object.freeze({__proto__:null,FileVerificationOperation:iD,ImagePreloadOperation:ef});tk("trix-toolbar","%t {\n  display: block;\n}\n\n%t {\n  white-space: nowrap;\n}\n\n%t [data-trix-dialog] {\n  display: none;\n}\n\n%t [data-trix-dialog][data-trix-active] {\n  display: block;\n}\n\n%t [data-trix-dialog] [data-trix-validate]:invalid {\n  background-color: #ffdddd;\n}");class ne extends HTMLElement{connectedCallback(){""===this.innerHTML&&(this.innerHTML=Y.getDefaultHTML())}}let ni=0,nn=function(t){if(!t.hasAttribute("contenteditable"))return t.setAttribute("contenteditable",""),function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.times=1,D(t,e)}("focus",{onElement:t,withCallback:()=>nr(t)})},nr=function(t){return ns(t),no(t)},ns=function(t){var e,i;if(null!=(e=(i=document).queryCommandSupported)&&e.call(i,"enableObjectResizing"))return document.execCommand("enableObjectResizing",!1,!1),D("mscontrolselect",{onElement:t,preventDefault:!0})},no=function(t){var e,i;if(null!=(e=(i=document).queryCommandSupported)&&e.call(i,"DefaultParagraphSeparator")){let{tagName:t}=g.default;if(["div","p"].includes(t))return document.execCommand("DefaultParagraphSeparator",!1,t)}},na=y.forcesObjectResizing?{display:"inline",width:"auto"}:{display:"inline-block",width:"1px"};tk("trix-editor","%t {\n    display: block;\n}\n\n%t:empty:not(:focus)::before {\n    content: attr(placeholder);\n    color: graytext;\n    cursor: text;\n    pointer-events: none;\n    white-space: pre-line;\n}\n\n%t a[contenteditable=false] {\n    cursor: text;\n}\n\n%t img {\n    max-width: 100%;\n    height: auto;\n}\n\n%t ".concat(c," figcaption textarea {\n    resize: none;\n}\n\n%t ").concat(c," figcaption textarea.trix-autoresize-clone {\n    position: absolute;\n    left: -9999px;\n    max-height: 0px;\n}\n\n%t ").concat(c," figcaption[data-trix-placeholder]:empty::before {\n    content: attr(data-trix-placeholder);\n    color: graytext;\n}\n\n%t [data-trix-cursor-target] {\n    display: ").concat(na.display," !important;\n    width: ").concat(na.width," !important;\n    padding: 0 !important;\n    margin: 0 !important;\n    border: none !important;\n}\n\n%t [data-trix-cursor-target=left] {\n    vertical-align: top !important;\n    margin-left: -1px !important;\n}\n\n%t [data-trix-cursor-target=right] {\n    vertical-align: bottom !important;\n    margin-right: -1px !important;\n}"));
1class nl extends HTMLElement{get trixId(){return this.hasAttribute("trix-id")?this.getAttribute("trix-id"):(this.setAttribute("trix-id",++ni),this.trixId)}get labels(){let t=[];this.id&&this.ownerDocument&&t.push(...Array.from(this.ownerDocument.querySelectorAll("label[for='".concat(this.id,"']"))||[]));let e=F(this,{matchingSelector:"label"});return e&&[this,null].includes(e.control)&&t.push(e),t}get toolbarElement(){var t;if(this.hasAttribute("toolbar"))return null==(t=this.ownerDocument)?void 0:t.getElementById(this.getAttribute("toolbar"));if(this.parentNode){let t="trix-toolbar-".concat(this.trixId);this.setAttribute("toolbar",t);let e=j("trix-toolbar",{id:t});return this.parentNode.insertBefore(e,this),e}}get form(){var t;return null==(t=this.inputElement)?void 0:t.form}get inputElement(){var t;if(this.hasAttribute("input"))return null==(t=this.ownerDocument)?void 0:t.getElementById(this.getAttribute("input"));if(this.parentNode){let t="trix-input-".concat(this.trixId);this.setAttribute("input",t);let e=j("input",{type:"hidden",id:t});return this.parentNode.insertBefore(e,this.nextElementSibling),e}}get editor(){var t;return null==(t=this.editorController)?void 0:t.editor}get name(){var t;return null==(t=this.inputElement)?void 0:t.name}get value(){var t;return null==(t=this.inputElement)?void 0:t.value}set value(t){var e;this.defaultValue=t,null==(e=this.editor)||e.loadHTML(this.defaultValue)}notify(t,e){if(this.editorController)return w("trix-".concat(t),{onElement:this,attributes:e})}setInputElementValue(t){this.inputElement&&(this.inputElement.value=t)}connectedCallback(){this.hasAttribute("data-trix-internal")||(nn(this),this.hasAttribute("role")||this.setAttribute("role","textbox"),function(t){if(t.hasAttribute("aria-label")||t.hasAttribute("aria-labelledby"))return;let e=function(){let e=Array.from(t.labels).map(e=>{if(!e.contains(t))return e.textContent}).filter(t=>t).join(" ");return e?t.setAttribute("aria-label",e):t.removeAttribute("aria-label")};e(),D("focus",{onElement:t,withCallback:e})}(this),this.editorController||(w("trix-before-initialize",{onElement:this}),this.editorController=new i7({editorElement:this,html:this.defaultValue=this.value}),requestAnimationFrame(()=>w("trix-initialize",{onElement:this}))),this.editorController.registerSelectionManager(),this.registerResetListener(),this.registerClickListener(),!document.querySelector(":focus")&&this.hasAttribute("autofocus")&&document.querySelector("[autofocus]")===this&&this.focus())}disconnectedCallback(){var t;return null==(t=this.editorController)||t.unregisterSelectionManager(),this.unregisterResetListener(),this.unregisterClickListener()}registerResetListener(){return this.resetListener=this.resetBubbled.bind(this),window.addEventListener("reset",this.resetListener,!1)}unregisterResetListener(){return window.removeEventListener("reset",this.resetListener,!1)}registerClickListener(){return this.clickListener=this.clickBubbled.bind(this),window.addEventListener("click",this.clickListener,!1)}unregisterClickListener(){return window.removeEventListener("click",this.clickListener,!1)}resetBubbled(t){if(!t.defaultPrevented&&t.target===this.form)return this.reset()}clickBubbled(t){if(t.defaultPrevented||this.contains(t.target))return;let e=F(t.target,{matchingSelector:"label"});return e&&Array.from(this.labels).includes(e)?this.focus():void 0}reset(){this.value=this.defaultValue}}let nh={VERSION:"2.1.3",config:Z,core:e6,models:ig,views:im,controllers:i9,observers:i8,operations:nt,elements:Object.freeze({__proto__:null,TrixEditorElement:nl,TrixToolbarElement:ne}),filters:Object.freeze({__proto__:null,Filter:ie,attachmentGalleryFilter:ii})};Object.assign(nh,ig),window.Trix=nh,setTimeout(function(){customElements.get("trix-toolbar")||customElements.define("trix-toolbar",ne),customElements.get("trix-editor")||customElements.define("trix-editor",nl)},0),i.d(e,{},{default:nh})}}]);
2//# sourceMappingURL=/packs/js/79421-5ab017e84225c75e.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.