PageSourceSearch

https://cdn4.zappter.com/assets/prod/ce6b3cd5933815169630a23c5e43a499.js?9.1.718

js zappter.com collected 2026-09-24 10:57:17 UTC 225,419 bytes, 1 lines download raw bytes

1(function(){}).call(this),function(){var t;null==window.Set&&(window.Set=t=function(){function t(){this.clear()}return t.prototype.clear=function(){return this.values=[]},t.prototype.has=function(t){return-1!==this.values.indexOf(t)},t.prototype.add=function(t){return this.has(t)||this.values.push(t),this},t.prototype["delete"]=function(t){var e;return-1===(e=this.values.indexOf(t))?!1:(this.values.splice(e,1),!0)},t.prototype.forEach=function(){var t;return(t=this.values).forEach.apply(t,arguments)},t}())}.call(this),function(t){function i(){}function o(t,e){return function(){t.apply(e,arguments)}}function r(t){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],h(t,this)}function s(n,i){for(;3===n._state;)n=n._value;return 0===n._state?void n._deferreds.push(i):(n._handled=!0,void p(function(){var t=1===n._state?i.onFulfilled:i.onRejected;if(null===t)return void(1===n._state?a:u)(i.promise,n._value);var e;try{e=t(n._value)}catch(t){return void u(i.promise,t)}a(i.promise,e)}))}function a(e,t){try{if(t===e)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if(t instanceof r)return e._state=3,e._value=t,void c(e);if("function"==typeof n)return void h(o(n,t),e)}e._state=1,e._value=t,c(e)}catch(t){u(e,t)}}function u(t,e){t._state=2,t._value=e,c(t)}function c(t){2===t._state&&0===t._deferreds.length&&setTimeout(function(){t._handled||d(t._value)},1);for(var e=0,n=t._deferreds.length;n>e;e++)s(t,t._deferreds[e]);t._deferreds=null}function l(t,e,n){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=n}function h(t,e){var n=!1;try{t(function(t){n||(n=!0,a(e,t))},function(t){n||(n=!0,u(e,t))})}catch(t){if(n)return;n=!0,u(e,t)}}var e=setTimeout,p="function"==typeof setImmediate&&setImmediate||function(t){e(t,1)},d=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)};r.prototype["catch"]=function(t){return this.then(null,t)},r.prototype.then=function(t,e){var n=new r(i);return s(this,new l(t,e,n)),n},r.all=function(t){var a=Array.prototype.slice.call(t);return new r(function(i,o){function r(e,t){try{if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if("function"==typeof n)return void n.call(t,function(t){r(e,t)},o)}a[e]=t,0===--s&&i(a)}catch(t){o(t)}}if(0===a.length)return i([]);for(var s=a.length,t=0;t<a.length;t++)r(t,a[t])})},r.resolve=function(e){return e&&"object"==typeof e&&e.constructor===r?e:new r(function(t){t(e)})},r.reject=function(n){return new r(function(t,e){e(n)})},r.race=function(o){return new r(function(t,e){for(var n=0,i=o.length;i>n;n++)o[n].then(t,e)})},r._setImmediateFn=function(t){p=t},r._setUnhandledRejectionFn=function(t){d=t},"undefined"!=typeof module&&module.exports?module.exports=r:t.Promise||(t.Promise=r)}(this),function(){var t="object"==typeof window.customElements,e="function"==typeof document.registerElement,n=t||e;n||("undefined"==typeof WeakMap&&!function(){var i=Object.defineProperty,t=Date.now()%1e9,e=function(){this.name="__st"+(1e9*Math.random()>>>0)+(t+++"__")};e.prototype={set:function(t,e){var n=t[this.name];return n&&n[0]===t?n[1]=e:i(t,this.name,{value:[t,e],writable:!0}),this},get:function(t){var e;return(e=t[this.name])&&e[0]===t?e[1]:void 0},delete:function(t){var e=t[this.name];return e&&e[0]===t?(e[0]=e[1]=void 0,!0):!1},has:function(t){var e=t[this.name];return e?e[0]===t:!1}},window.WeakMap=e}(),function(t){function r(t){A.push(t),b||(b=!0,g(e))}function s(t){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(t)||t}function e(){b=!1;var t=A;A=[],t.sort(function(t,e){return t.uid_-e.uid_});var n=!1;t.forEach(function(t){var e=t.takeRecords();i(t),e.length&&(t.callback_(e,t),n=!0)}),n&&e()}function i(n){n.nodes_.forEach(function(t){var e=m.get(t);e&&e.forEach(function(t){t.observer===n&&t.removeTransientObservers()})})}function h(t,e){for(var n=t;n;n=n.parentNode){var i=m.get(n);if(i)for(var o=0;o<i.length;o++){var r=i[o],s=r.options;if(n===t||s.subtree){var a=e(s);a&&r.enqueue(a)}}}}function n(t){this.callback_=t,this.nodes_=[],this.records_=[],this.uid_=++C}function o(t,e){this.type=t,this.target=e,this.addedNodes=[],this.removedNodes=[],this.previousSibling=null,this.nextSibling=null,this.attributeName=null,this.attributeNamespace=null,this.oldValue=null}function a(t){var e=new o(t.type,t.target);return e.addedNodes=t.addedNodes.slice(),e.removedNodes=t.removedNodes.slice(),e.previousSibling=t.previousSibling,e.nextSibling=t.nextSibling,e.attributeName=t.attributeName,e.attributeNamespace=t.attributeNamespace,e.oldValue=t.oldValue,e}function p(t,e){return x=new o(t,e)}function d(t){return w?w:(w=a(x),w.oldValue=t,w)}function f(){x=w=void 0}function u(t){return t===w||t===x}function c(t,e){return t===e?t:w&&u(t)?w:null}function l(t,e,n){this.observer=t,this.target=e,this.options=n,this.transientObservedNodes=[]}
1if(!t.JsMutationObserver){var g,m=new WeakMap;if(/Trident|Edge/.test(navigator.userAgent))g=setTimeout;else if(window.setImmediate)g=window.setImmediate;else{var v=[],y=String(Math.random());window.addEventListener("message",function(t){if(t.data===y){var e=v;v=[],e.forEach(function(t){t()})}}),g=function(t){v.push(t),window.postMessage(y,"*")}}var b=!1,A=[],C=0;n.prototype={observe:function(t,e){if(t=s(t),!e.childList&&!e.attributes&&!e.characterData||e.attributeOldValue&&!e.attributes||e.attributeFilter&&e.attributeFilter.length&&!e.attributes||e.characterDataOldValue&&!e.characterData)throw new SyntaxError;var n=m.get(t);n||m.set(t,n=[]);for(var i,o=0;o<n.length;o++)if(n[o].observer===this){i=n[o],i.removeListeners(),i.options=e;break}i||(i=new l(this,t,e),n.push(i),this.nodes_.push(t)),i.addListeners()},disconnect:function(){this.nodes_.forEach(function(t){for(var e=m.get(t),n=0;n<e.length;n++){var i=e[n];if(i.observer===this){i.removeListeners(),e.splice(n,1);break}}},this),this.records_=[]},takeRecords:function(){var t=this.records_;return this.records_=[],t}};var x,w;l.prototype={enqueue:function(t){var e=this.observer.records_,n=e.length;if(e.length>0){var i=e[n-1],o=c(i,t);if(o)return void(e[n-1]=o)}else r(this.observer);e[n]=t},addListeners:function(){this.addListeners_(this.target)},addListeners_:function(t){var e=this.options;e.attributes&&t.addEventListener("DOMAttrModified",this,!0),e.characterData&&t.addEventListener("DOMCharacterDataModified",this,!0),e.childList&&t.addEventListener("DOMNodeInserted",this,!0),(e.childList||e.subtree)&&t.addEventListener("DOMNodeRemoved",this,!0)},removeListeners:function(){this.removeListeners_(this.target)},removeListeners_:function(t){var e=this.options;e.attributes&&t.removeEventListener("DOMAttrModified",this,!0),e.characterData&&t.removeEventListener("DOMCharacterDataModified",this,!0),e.childList&&t.removeEventListener("DOMNodeInserted",this,!0),(e.childList||e.subtree)&&t.removeEventListener("DOMNodeRemoved",this,!0)},addTransientObserver:function(t){if(t!==this.target){this.addListeners_(t),this.transientObservedNodes.push(t);var e=m.get(t);e||m.set(t,e=[]),e.push(this)}},removeTransientObservers:function(){var t=this.transientObservedNodes;this.transientObservedNodes=[],t.forEach(function(t){this.removeListeners_(t);for(var e=m.get(t),n=0;n<e.length;n++)if(e[n]===this){e.splice(n,1);break}},this)},handleEvent:function(t){switch(t.stopImmediatePropagation(),t.type){case"DOMAttrModified":var e=t.attrName,n=t.relatedNode.namespaceURI,i=t.target,o=new p("attributes",i);o.attributeName=e,o.attributeNamespace=n;var r=t.attrChange===MutationEvent.ADDITION?null:t.prevValue;h(i,function(t){return!t.attributes||t.attributeFilter&&t.attributeFilter.length&&-1===t.attributeFilter.indexOf(e)&&-1===t.attributeFilter.indexOf(n)?void 0:t.attributeOldValue?d(r):o});break;case"DOMCharacterDataModified":var i=t.target,o=p("characterData",i),r=t.prevValue;h(i,function(t){return t.characterData?t.characterDataOldValue?d(r):o:void 0});break;case"DOMNodeRemoved":this.addTransientObserver(t.target);case"DOMNodeInserted":var s,a,u=t.target;"DOMNodeInserted"===t.type?(s=[u],a=[]):(s=[],a=[u]);var c=u.previousSibling,l=u.nextSibling,o=p("childList",t.target.parentNode);o.addedNodes=s,o.removedNodes=a,o.previousSibling=c,o.nextSibling=l,h(t.relatedNode,function(t){return t.childList?o:void 0})}f()}},t.JsMutationObserver=n,t.MutationObserver||(t.MutationObserver=n,n._isPolyfilled=!0)}}(self),function(){"use strict";if(!window.performance||!window.performance.now){var t=Date.now();window.performance={now:function(){return Date.now()-t}}}window.requestAnimationFrame||(window.requestAnimationFrame=function(){var e=window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame;return e?function(t){return e(function(){t(performance.now())})}:function(t){return window.setTimeout(t,1e3/60)}}()),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(){return window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||function(t){clearTimeout(t)}}());var e=function(){var t=document.createEvent("Event");return t.initEvent("foo",!0,!0),t.preventDefault(),t.defaultPrevented}();if(!e){var n=Event.prototype.preventDefault;Event.prototype.preventDefault=function(){this.cancelable&&(n.call(this),Ob
1ject.defineProperty(this,"defaultPrevented",{get:function(){return!0},configurable:!0}))}}var i=/Trident/.test(navigator.userAgent);if((!window.CustomEvent||i&&"function"!=typeof window.CustomEvent)&&(window.CustomEvent=function(t,e){e=e||{};var n=document.createEvent("CustomEvent");return n.initCustomEvent(t,Boolean(e.bubbles),Boolean(e.cancelable),e.detail),n},window.CustomEvent.prototype=window.Event.prototype),!window.Event||i&&"function"!=typeof window.Event){var o=window.Event;window.Event=function(t,e){e=e||{};var n=document.createEvent("Event");return n.initEvent(t,Boolean(e.bubbles),Boolean(e.cancelable)),n},window.Event.prototype=o.prototype}}(window.WebComponents),window.CustomElements=window.CustomElements||{flags:{}},function(e){var t=e.flags,n=[],i=function(t){n.push(t)},o=function(){n.forEach(function(t){t(e)})};e.addModule=i,e.initializeModules=o,e.hasNative=Boolean(document.registerElement),e.isIE=/Trident/.test(navigator.userAgent),e.useNative=!t.register&&e.hasNative&&!window.ShadowDOMPolyfill&&(!window.HTMLImports||window.HTMLImports.useNative)}(window.CustomElements),window.CustomElements.addModule(function(t){function i(t,e){o(t,function(t){return e(t)?!0:void n(t,e)}),n(t,e)}function o(t,e,n){var i=t.firstElementChild;if(!i)for(i=t.firstChild;i&&i.nodeType!==Node.ELEMENT_NODE;)i=i.nextSibling;for(;i;)e(i,n)!==!0&&o(i,e,n),i=i.nextElementSibling;return null}function n(t,e){for(var n=t.shadowRoot;n;)i(n,e),n=n.olderShadowRoot}function e(t,e){a(t,e,[])}function a(t,e,n){if(t=window.wrap(t),!(n.indexOf(t)>=0)){n.push(t);for(var i,o=t.querySelectorAll("link[rel="+u+"]"),r=0,s=o.length;s>r&&(i=o[r]);r++)i.import&&a(i.import,e,n);e(t)}}var u=window.HTMLImports?window.HTMLImports.IMPORT_LINK_TYPE:"none";t.forDocumentTree=e,t.forSubtree=i}),window.CustomElements.addModule(function(n){function s(t,e){return i(t,e)||o(t,e)}function i(t,e){return n.upgrade(t,e)?!0:void(e&&a(t))}function o(t,e){b(t,function(t){return i(t,e)?!0:void 0})}function e(t){w.push(t),x||(x=!0,setTimeout(r))}function r(){x=!1;for(var t,e=w,n=0,i=e.length;i>n&&(t=e[n]);n++)t();w=[]}function a(t){C?e(function(){u(t)}):u(t)}function u(t){t.__upgraded__&&!t.__attached&&(t.__attached=!0,t.attachedCallback&&t.attachedCallback())}function c(t){l(t),b(t,function(t){l(t)})}function l(t){C?e(function(){h(t)}):h(t)}function h(t){t.__upgraded__&&t.__attached&&(t.__attached=!1,t.detachedCallback&&t.detachedCallback())}function p(t){for(var e=t,n=window.wrap(document);e;){if(e==n)return!0;e=e.parentNode||e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&e.host}}function t(t){if(t.shadowRoot&&!t.shadowRoot.__watched){y.dom&&console.log("watching shadow-root for: ",t.localName);for(var e=t.shadowRoot;e;)g(e),e=e.olderShadowRoot}}function d(t,e){if(y.dom){var n=e[0];if(n&&"childList"===n.type&&n.addedNodes&&n.addedNodes){for(var i=n.addedNodes[0];i&&i!==document&&!i.host;)i=i.parentNode;var o=i&&(i.URL||i._URL||i.host&&i.host.localName)||"";o=o.split("/?").shift().split("/").pop()}console.group("mutations (%d) [%s]",e.length,o||"")}var r=p(t);e.forEach(function(t){"childList"===t.type&&(E(t.addedNodes,function(t){t.localName&&s(t,r)}),E(t.removedNodes,function(t){t.localName&&c(t)}))}),y.dom&&console.groupEnd()}function f(t){for(t=window.wrap(t),t||(t=window.wrap(document));t.parentNode;)t=t.parentNode;var e=t.__observer;e&&(d(t,e.takeRecords()),r())}function g(t){if(!t.__observer){var e=new MutationObserver(d.bind(this,t));e.observe(t,{childList:!0,subtree:!0}),t.__observer=e}}function m(t){t=window.wrap(t),y.dom&&console.group("upgradeDocument: ",t.baseURI.split("/").pop());var e=t===window.wrap(document);s(t,e),g(t),y.dom&&console.groupEnd()}function v(t){A(t,m)}var y=n.flags,b=n.forSubtree,A=n.forDocumentTree,C=window.MutationObserver._isPolyfilled&&y["throttle-attached"];n.hasPolyfillMutations=C,n.hasThrottledAttached=C;var x=!1,w=[],E=Array.prototype.forEach.call.bind(Array.prototype.forEach),S=Element.prototype.createShadowRoot;S&&(Element.prototype.createShadowRoot=function(){var t=S.call(this);return window.CustomElements.watchShadow(this),t}),n.watchShadow=t,n.upgradeDocumentTree=v,n.upgradeDocument=m,n.upgradeSubtree=o,n.upgradeAll=s,n.attached=a,n.takeRecords=f}),window.CustomElements.addModule(function(o){function t(t,e){if("template"===t.localName&&window.HTMLTemplateElement&&HTMLTemplateElement.decorate&&HTMLTemplateElement.decorate(t),!t.__upgraded__&&t.nodeType===Node.ELEMENT_NODE){var n=t.getAttribute("is"),i=o.getRegisteredDefinition(t.localName)||o.getRegisteredDefinition(n);if(i&&(n&&i.tag==t.localName||!n&&!i.extends))return r(t,i,e)}}function r(t,e,n){return a.upgrade&&console.group("upgrade:",t.localName),e.is&&t.setAttribute("is",e.is),i(t,e),t.__upgraded__=!0,s(t),n&&o.attached(t),o.upgradeSubtree(t,n),a.upgrade&&console.groupEnd(),t}function i(t,e){Object.__proto__?t.__proto__=e.prototype:(n(t,e.prototype,e.native),t.__proto__=e.prototype)}function n(t,e,n){for(var i={},o=e;o!==n&&o!==HTMLElement.prototype;){for(var r,s=Object.getOwnPropertyNames(o),a=0;r=s[a];a++)i[r]||(Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(o,r)),i[r]=1);
1o=Object.getPrototypeOf(o)}}function s(t){t.createdCallback&&t.createdCallback()}var a=o.flags;o.upgrade=t,o.upgradeWithDefinition=r,o.implementPrototype=i}),window.CustomElements.addModule(function(i){function t(t,e){var n=e||{};if(!t)throw new Error("document.registerElement: first argument `name` must not be empty");if(t.indexOf("-")<0)throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '"+String(t)+"'.");if(s(t))throw new Error("Failed to execute 'registerElement' on 'Document': Registration failed for type '"+String(t)+"'. The type name is invalid.");if(l(t))throw new Error("DuplicateDefinitionError: a type with name '"+String(t)+"' is already registered");return n.prototype||(n.prototype=Object.create(HTMLElement.prototype)),n.__name=t.toLowerCase(),n.extends&&(n.extends=n.extends.toLowerCase()),n.lifecycle=n.lifecycle||{},n.ancestry=a(n.extends),u(n),c(n),o(n.prototype),h(n.__name,n),n.ctor=p(n),n.ctor.prototype=n.prototype,n.prototype.constructor=n.ctor,i.ready&&m(document),n.ctor}function o(t){if(!t.setAttribute._polyfilled){var n=t.setAttribute;t.setAttribute=function(t,e){r.call(this,t,e,n)};var e=t.removeAttribute;t.removeAttribute=function(t){r.call(this,t,null,e)},t.setAttribute._polyfilled=!0}}function r(t,e,n){t=t.toLowerCase();var i=this.getAttribute(t);n.apply(this,arguments);var o=this.getAttribute(t);this.attributeChangedCallback&&o!==i&&this.attributeChangedCallback(t,i,o)}function s(t){for(var e=0;e<C.length;e++)if(t===C[e])return!0}function a(t){var e=l(t);return e?a(e.extends).concat([e]):[]}function u(t){for(var e,n=t.extends,i=0;e=t.ancestry[i];i++)n=e.is&&e.tag;t.tag=n||t.__name,n&&(t.is=t.__name)}function c(t){if(!Object.__proto__){var e=HTMLElement.prototype;if(t.is){var n=document.createElement(t.tag);e=Object.getPrototypeOf(n)}for(var i,o=t.prototype,r=!1;o;)o==e&&(r=!0),i=Object.getPrototypeOf(o),i&&(o.__proto__=i),o=i;r||console.warn(t.tag+" prototype not found in prototype chain for "+t.is),t.native=e}}function e(t){return y(E(t.tag),t)}function l(t){return t?x[t.toLowerCase()]:void 0}function h(t,e){x[t]=e}function p(t){return function(){return e(t)}}function n(t,e,n){return t===w?d(e,n):S(t,e)}function d(t,e){t&&(t=t.toLowerCase()),e&&(e=e.toLowerCase());var n=l(e||t);if(n){if(t==n.tag&&e==n.is)return new n.ctor;if(!e&&!n.is)return new n.ctor}var i;return e?(i=d(t),i.setAttribute("is",e),i):(i=E(t),t.indexOf("-")>=0&&b(i,HTMLElement),i)}function f(t,e){var n=t[e];t[e]=function(){var t=n.apply(this,arguments);return v(t),t}}var g,m=(i.isIE,i.upgradeDocumentTree),v=i.upgradeAll,y=i.upgradeWithDefinition,b=i.implementPrototype,A=i.useNative,C=["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"],x={},w="http://www.w3.org/1999/xhtml",E=document.createElement.bind(document),S=document.createElementNS.bind(document);g=Object.__proto__||A?function(t,e){return t instanceof e}:function(t,e){if(t instanceof e)return!0;for(var n=t;n;){if(n===e.prototype)return!0;n=n.__proto__}return!1},f(Node.prototype,"cloneNode"),f(document,"importNode"),document.registerElement=t,document.createElement=d,document.createElementNS=n,i.registry=x,i.instanceof=g,i.reservedTagList=C,i.getRegisteredDefinition=l,document.register=document.registerElement}),function(t){function e(){r(window.wrap(document)),window.CustomElements.ready=!0;var t=window.requestAnimationFrame||function(t){setTimeout(t,16)};t(function(){setTimeout(function(){window.CustomElements.readyTime=Date.now(),window.HTMLImports&&(window.CustomElements.elapsed=window.CustomElements.readyTime-window.HTMLImports.readyTime),document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))})})}var n=t.useNative,i=t.initializeModules;if(t.isIE,n){var o=function(){};t.watchShadow=o,t.upgrade=o,t.upgradeAll=o,t.upgradeDocumentTree=o,t.upgradeSubtree=o,t.takeRecords=o,t.instanceof=function(t,e){return t instanceof e}}else i();var r=t.upgradeDocumentTree,s=t.upgradeDocument;if(window.wrap||(window.ShadowDOMPolyfill?(window.wrap=window.ShadowDOMPolyfill.wrapIfNeeded,window.unwrap=window.ShadowDOMPolyfill.unwrapIfNeeded):window.wrap=window.unwrap=function(t){return t}),window.HTMLImports&&(window.HTMLImports.__importsParsingHook=function(t){t.import&&s(wrap(t.import))}),"complete"===document.readyState||t.flags.eager)e();else if("interactive"!==document.readyState||window.attachEvent||window.HTMLImports&&!window.HTMLImports.ready){var a=window.HTMLImports&&!window.HTMLImports.ready?"HTMLImportsLoaded":"DOMContentLoaded";window.addEventListener(a,e)}else e()}(window.CustomElements))}.call(this),function(){}.call(this),function(){var t=this;(function(){(function(){this.Trix={VERSION:"1.2.2",ZERO_WIDTH_SPACE:"\ufeff",NON_BREAKING_SPACE:" ",OBJECT_REPLACEMENT_CHARACTER:"",browser:{composesExistingText:/Android.*Chrome/.test(navigator.userAgent),forcesObjectResizing:/Trident.*rv:11/.test(navigator.userAgent),supportsInputEvents:function(){var t,e,n,i;if("undefined"==typeof InputEvent)return!1;for(i=["data","getTargetRanges","inputType"],t=0,e=i.length;e>t;t++)if(n=i[t],!(n in InputEvent.prototype))return!1;return!0}()},config:{}}}).call(this)}).call(t);var D=t.Trix;(function(){(function(){D.BasicObject=function(){function t(){}var s,a,i;return t.proxyMethod=function(t){var n,i,e,o,r;return e=a(t),n=e.name,o=e.toMethod,r=e.toProperty,i=e.optional,this.prototype[n]=function(){var t,e;return t=null!=o?i?"function"==typeof this[o]?this[o]():void 0:this[o]():null!=r?this[r]:void 0,i?(e=null!=t?t[n]:void 0,null!=e?s.call(e,t,arguments):void 0):(e=t[n],s.call(e,t,arguments))}},a=function(t){var e,n;if(!(n=t.match(i)))throw new Error("can't parse @proxyMethod expression: "+t);return e={name:n[4]},null!=n[2]?e.toMethod=n[1]:e.toProperty=n[1],null!=n[3]&&(e.optional=!0),e},s=Function.prototype.apply,i=/^(.+?)(\(\))?(\?)?\.(.+?)$/,t}()}).call(this),function(){var i=function(t,e){function n(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty;D.Object=function(t){function e(){this.id=++n}var n;return i(e,t),n=0,e.fromJSONString=function(t){return this.fromJSON(JSON.parse(t))},e.prototype.hasSameConstructorAs=function(t){return this.constructor===(null!=t?t.constructor:void 0)},e.prototype.isEqualTo=function(t){return this===t},e.prototype.inspect=function(){var t,i,o;return t=function(){var t,e,n;e=null!=(t=this.contentsForInspection())?t:{},n=[];for(i in e)o=e[i],n.push(i+"="+o);return n}.call(this),"#<"+this.constructor.name+":"+this.id+(t.length?" "+t.join(", "):"")+">"},e.prototype.contentsForInspection=function(){},e.prototype.toJSONString=function(){return JSON.stringify(this)},e.prototype.toUTF16String=function(){return D.UTF16String.box(this)},e.prototype.getCacheKey=function(){return this.id.toString()},e}(D.BasicObject)}.call(this),function(){D.extend=function(t){var e,n;for(e in t)n=t[e],this[e]=n;return this}}.call(this),function(){D.extend({defer:function(t){return setTimeout(t,1)}})}.call(this),function(){var a,s;D.extend({normalizeSpaces:function(t){return t.replace(RegExp(""+D.ZERO_WIDTH_SPACE,"g"),"").replace(RegExp(""+D.NON_BREAKING_SPACE,"g")," ")},normalizeNewlines:function(t){return t.replace(/\r\n/g,"\n")},breakableWhitespacePattern:RegExp("[^\\S"+D.NON_BREAKING_SPACE+"]"),squishBreakableWhitespace:function(t){return t.replace(RegExp(""+D.breakableWhitespacePattern.source,"g")," ").replace(/\ {2,}/g," ")},escapeHTML:function(t){var e;return e=document.createElement("div"),e.textContent=t,e.innerHTML},summarizeStringChange:function(t,e){var n,i,o,r;return t=D.UTF16String.box(t),e=D.UTF16String.box(e),e.length<t.length?(i=s(t,e),r=i[0],n=i[1]):(o=s(e,t),n=o[0],r=o[1]),{added:n,removed:r}}}),s=function(t,e){var n,i,o,r,s;return t.isEqualTo(e)?["",""]:(i=a(t,e),r=i.utf16String.length,o=r?(s=i.offset,i,n=t.codepoints.slice(0,s).concat(t.codepoints.slice(s+r)),a(e,D.UTF16String.fromCodepoints(n))):a(e,t),[i.utf16String.toString(),o.utf16String.toString()])},a=function(t,e){var n,i,o;for(n=0,i=t.length,o=e.length;i>n&&t.charAt(n).isEqualTo(e.charAt(n));)n++;for(;i>n+1&&t.charAt(i-1).isEqualTo(e.charAt(o-1));)i--,o--;return{utf16String:t.slice(n,i),offset:n}}}.call(this),function(){D.extend({copyObject:function(t){var e,n,i;null==t&&(t={}),n={};for(e in t)i=t[e],n[e]=i;return n},objectsAreEqual:function(t,e){var n,i;if(null==t&&(t={}),null==e&&(e={}),Object.keys(t).length!==Object.keys(e).length)return!1;for(n in t)if(i=t[n],i!==e[n])return!1;return!0}})}.call(this),function(){var i=[].slice;D.extend({arraysAreEqual:function(t,e){var n,i,o,r;if(null==t&&(t=[]),null==e&&(e=[]),t.length!==e.length)return!1;for(i=n=0,o=t.length;o>n;i=++n)if(r=t[i],r!==e[i])return!1;return!0},arrayStartsWith:function(t,e){return null==t&&(t=[]),null==e&&(e=[]),D.arraysAreEqual(t.slice(0,e.length),e)},spliceArray:function(){var t,e,n;
1return e=arguments[0],t=2<=arguments.length?i.call(arguments,1):[],n=e.slice(0),n.splice.apply(n,t),n},summarizeArrayChange:function(t,e){var n,i,o,r,s,a,u,c,l,h,p;for(null==t&&(t=[]),null==e&&(e=[]),n=[],h=[],o=new Set,r=0,u=t.length;u>r;r++)p=t[r],o.add(p);for(i=new Set,s=0,c=e.length;c>s;s++)p=e[s],i.add(p),o.has(p)||n.push(p);for(a=0,l=t.length;l>a;a++)p=t[a],i.has(p)||h.push(p);return{added:n,removed:h}}})}.call(this),function(){var t,e,o,n;t=null,e=null,n=null,o=null,D.extend({getAllAttributeNames:function(){return null!=t?t:t=D.getTextAttributeNames().concat(D.getBlockAttributeNames())},getBlockConfig:function(t){return D.config.blockAttributes[t]},getBlockAttributeNames:function(){return null!=e?e:e=Object.keys(D.config.blockAttributes)},getTextConfig:function(t){return D.config.textAttributes[t]},getTextAttributeNames:function(){return null!=n?n:n=Object.keys(D.config.textAttributes)},getListAttributeNames:function(){var n,i;return null!=o?o:o=function(){var t,e;t=D.config.blockAttributes,e=[];for(n in t)i=t[n].listAttribute,null!=i&&e.push(i);return e}()}})}.call(this),function(){var f,n,t,e,i,o=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};f=document.documentElement,n=null!=(t=null!=(e=null!=(i=f.matchesSelector)?i:f.webkitMatchesSelector)?e:f.msMat
1chesSelector)?t:f.mozMatchesSelector,D.extend({handleEvent:function(t,e){var n,i,o,r,s,a,u,c,l,h,p,d;return c=null!=e?e:{},a=c.onElement,s=c.matchingSelector,d=c.withCallback,r=c.inPhase,u=c.preventDefault,h=c.times,i=null!=a?a:f,l=s,n=d,p="capturing"===r,o=function(t){var e;return null!=h&&0===--h&&o.destroy(),e=D.findClosestElementFromNode(t.target,{matchingSelector:l}),null!=e&&(null!=d&&d.call(e,t,e),u)?t.preventDefault():void 0},o.destroy=function(){return i.removeEventListener(t,o,p)},i.addEventListener(t,o,p),o},handleEventOnce:function(t,e){return null==e&&(e={}),e.times=1,D.handleEvent(t,e)},triggerEvent:function(t,e){var n,i,o,r,s,a,u;return u=null!=e?e:{},a=u.onElement,i=u.bubbles,o=u.cancelable,n=u.attributes,r=null!=a?a:f,i=i!==!1,o=o!==!1,s=document.createEvent("Events"),s.initEvent(t,i,o),null!=n&&D.extend.call(s,n),r.dispatchEvent(s)},elementMatchesSelector:function(t,e){return 1===(null!=t?t.nodeType:void 0)?n.call(t,e):void 0},findClosestElementFromNode:function(t,e){var n,i,o;for(i=null!=e?e:{},n=i.matchingSelector,o=i.untilNode;null!=t&&t.nodeType!==Node.ELEMENT_NODE;)t=t.parentNode;if(null!=t){if(null==n)return t;if(t.closest&&null==o)return t.closest(n);for(;t&&t!==o;){if(D.elementMatchesSelector(t,n))return t;t=t.parentNode}}},findInnerElement:function(t){for(;null!=t?t.firstElementChild:void 0;)t=t.firstElementChild;return t},innerElementIsActive:function(t){return document.activeElement!==t&&D.elementContainsNode(t,document.activeElement)},elementContainsNode:function(t,e){if(t&&e)for(;e;){if(e===t)return!0;e=e.parentNode}},findNodeFromContainerAndOffset:function(t,e){var n;if(t)return t.nodeType===Node.TEXT_NODE?t:0===e?null!=(n=t.firstChild)?n:t:t.childNodes.item(e-1)},findElementFromContainerAndOffset:function(t,e){var n;return n=D.findNodeFromContainerAndOffset(t,e),D.findClosestElementFromNode(n)},findChildIndexOfNode:function(t){var e;if(null!=t?t.parentNode:void 0){for(e=0;t=t.previousSibling;)e++;return e}},removeNode:function(t){var e;return null!=t&&null!=(e=t.parentNode)?e.removeChild(t):void 0},walkTree:function(t,e){var n,i,o,r,s;return o=null!=e?e:{},i=o.onlyNodesOfType,r=o.usingFilter,n=o.expandEntityReferences,s=function(){switch(i){case"element":return NodeFilter.SHOW_ELEMENT;case"text":return NodeFilter.SHOW_TEXT;case"comment":return NodeFilter.SHOW_COMMENT;default:return NodeFilter.SHOW_ALL}}(),document.createTreeWalker(t,s,null!=r?r:null,n===!0)},tagName:function(t){var e;return null!=t&&null!=(e=t.tagName)?e.toLowerCase():void 0},makeElement:function(t,e){var n,i,o,r,s,a,u,c,l,h;if(null==e&&(e={}),"object"==typeof t?(e=t,t=e.tagName):e={attributes:e},i=document.createElement(t),null!=e.editable&&(null==e.attributes&&(e.attributes={}),e.attributes.contenteditable=e.editable),e.attributes){a=e.attributes;for(r in a)h=a[r],i.setAttribute(r,h)}if(e.style){u=e.style;for(r in u)h=u[r],i.style[r]=h}if(e.data){c=e.data;for(r in c)h=c[r],i.dataset[r]=h}if(e.className)for(l=e.className.split(" "),o=0,s=l.length;s>o;o++)n=l[o],i.classList.add(n);return e.textContent&&(i.textContent=e.textContent),i},getBlockTagNames:function(){var n,i;return null!=D.blockTagNames?D.blockTagNames:D.blockTagNames=function(){var t,e;t=D.config.blockAttributes,e=[];for(n in t)i=t[n].tagName,i&&e.push(i);return e}()},nodeIsBlockContainer:function(t){return D.nodeIsBlockStartComment(null!=t?t.firstChild:void 0)},nodeProbablyIsBlockContainer:function(t){var e,n;return e=D.tagName(t),o.call(D.getBlockTagNames(),e)>=0&&(n=D.tagName(t.firstChild),o.call(D.getBlockTagNames(),n)<0)},nodeIsBlockStart:function(t,e){var n;return n=(null!=e?e:{strict:!0}).strict,n?D.nodeIsBlockStartComment(t):D.nodeIsBlockStartComment(t)||!D.nodeIsBlockStartComment(t.firstChild)&&D.nodeProbablyIsBlockContainer(t)},nodeIsBlockStartComment:function(t){return D.nodeIsCommentNode(t)&&"block"===(null!=t?t.data:void 0)},nodeIsCommentNode:function(t){return(null!=t?t.nodeType:void 0)===Node.COMMENT_NODE},nodeIsCursorTarget:function(t,e){var n;return n=(null!=e?e:{}).name,t?D.nodeIsTextNode(t)?t.data===D.ZERO_WIDTH_SPACE?n?t.parentNode.dataset.trixCursorTarget===n:!0:void 0:D.nodeIsCursorTarget(t.firstChild):void 0},nodeIsAttachmentElement:function(t){return D.elementMatchesSelector(t,D.AttachmentView.attachmentSelector)},nodeIsEmptyTextNode:function(t){return D.nodeIsTextNode(t)&&""===(null!=t?t.data:void 0)},nodeIsTextNode:function(t){return(null!=t?t.nodeType:void 0)===Node.TEXT_NODE}})}.call(this),function(){var e,n,u,i,c;e=D.copyObject,i=D.objectsAreEqual,D.extend({normalizeRange:u=function(t){var e;if(null!=t)return Array.isArray(t)||(t=[t,t]),[n(t[0]),n(null!=(e=t[1])?e:t[0])]},rangeIsCollapsed:function(t){var e,n,i;if(null!=t)return n=u(t),i=n[0],e=n[1],c(i,e)},rangesAreEqual:function(t,e){var n,i,o,r,s,a;if(null!=t&&null!=e)return o=u(t),i=o[0],n=o[1],r=u(e),a=r[0],s=r[1],c(i,a)&&c(n,s)}}),n=function(t){return"number"==typeof t?t:e(t)},c=function(t,e){return"number"==typeof t?t===e:i(t,e)}}.call(this),function(){var i,e,o,r,s,a,u;D.registerElement=function(t,e){var n,i;return null==e&&(e={}),t=t.toLowerCase(),e=u(e),i=a(e),(n=i.defaultCSS)&&(delete i.defaultCSS,r(n,t)),s(t,i)},r=function(t,e){var n;return n=o(e),n.textContent=t.replace(/%t/g,e)},o=function(t){var e,n;return e=document.createElement("style"),e.setAttribute("type","text/css"),e.setAttribute("data-tag-name",t.toLowerCase()),(n=i())&&e.setAttribute("nonce",n),document.head.insertBefore(e,document.head.firstChild),e},i=function(){var t;return(t=e("trix-csp-nonce")||e("csp-nonce"))?t.getAttribute("content"):void 0},e=function(t){return document.head.querySelector("meta[name="+t+"]")},a=function(t){var e,n,i;n={};for(e in t)i=t[e],n[e]="function"==typeof i?{value:i}:i;return n},u=function(){var s;return s=function(t){var e,n,i,o,r;for(e={},r=["initialize","connect","disconnect"],n=0,o=r.length;o>n;n++)i=r[n],e[i]=t[i],delete t[i];return e},window.customElements?function(t){var e,n,i,o,r;
1return r=s(t),i=r.initialize,e=r.connect,n=r.disconnect,i&&(o=e,e=function(){return this.initialized||(this.initialized=!0,i.call(this)),null!=o?o.call(this):void 0}),e&&(t.connectedCallback=e),n&&(t.disconnectedCallback=n),t}:function(t){var e,n,i,o;return o=s(t),i=o.initialize,e=o.connect,n=o.disconnect,i&&(t.createdCallback=i),e&&(t.attachedCallback=e),n&&(t.detachedCallback=n),t}}(),s=function(){return window.customElements?function(t,e){var n;return n=function(){return"object"==typeof Reflect?Reflect.construct(HTMLElement,[],n):HTMLElement.apply(this)},Object.setPrototypeOf(n.prototype,HTMLElement.prototype),Object.setPrototypeOf(n,HTMLElement),Object.defineProperties(n.prototype,e),window.customElements.define(t,n),n}:function(t,e){var n,i;return i=Object.create(HTMLElement.prototype,e),n=document.registerElement(t,{prototype:i}),Object.defineProperty(i,"constructor",{value:n}),n}}()}.call(this),function(){var n,e;D.extend({getDOMSelection:function(){var t;return t=window.getSelection(),t.rangeCount>0?t:void 0},getDOMRange:function(){var t,e;return(t=null!=(e=D.getDOMSelection())?e.getRangeAt(0):void 0)&&!n(t)?t:void 0},setDOMRange:function(t){var e;return e=window.getSelection(),e.removeAllRanges(),e.addRange(t),D.selectionChangeObserver.update()}}),n=function(t){return e(t.startContainer)||e(t.endContainer)},e=function(t){return!Object.getPrototypeOf(t)}}.call(this),function(){var i;i={"application/x-trix-feature-detection":"test"},D.extend({dataTransferIsPlainText:function(t){var e,n,i;return i=t.getData("text/plain"),n=t.getData("text/html"),i&&n?(e=(new DOMParser).parseFromString(n,"text/html").body,e.textContent===i?!e.querySelector("*"):void 0):null!=i?i.length:void 0},dataTransferIsWritable:function(t){var e,n;if(null!=(null!=t?t.setData:void 0)){for(e in i)if(n=i[e],!function(){try{return t.setData(e,n),t.getData(e)===n}catch(t){}}())return;return!0}},keyEventIsKeyboardCommand:function(){return/Mac|^iP/.test(navigator.platform)?function(t){return t.metaKey}:function(t){return t.ctrlKey}}()})}.call(this),function(){}.call(this),function(){var s,u=function(t,e){function n(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty;s=D.arraysAreEqual,D.Hash=function(t){function e(t){null==t&&(t={}),this.values=r(t),e.__super__.constructor.apply(this,arguments)}var a,r,n,i,o;return u(e,t),e.fromCommonAttributesOfObjects=function(t){var e,n,i,o,r,s;if(null==t&&(t=[]),!t.length)return new this;for(e=a(t[0]),i=e.getKeys(),s=t.slice(1),n=0,o=s.length;o>n;n++)r=s[n],i=e.getKeysCommonToHash(a(r)),e=e.slice(i);return e},e.box=function(t){return a(t)},e.prototype.add=function(t,e){return this.merge(i(t,e))},e.prototype.remove=function(t){return new D.Hash(r(this.values,t))},e.prototype.get=function(t){return this.values[t]},e.prototype.has=function(t){return t in this.values},e.prototype.merge=function(t){return new D.Hash(n(this.values,o(t)))},e.prototype.slice=function(t){var e,n,i,o;for(o={},e=0,i=t.length;i>e;e++)n=t[e],this.has(n)&&(o[n]=this.values[n]);return new D.Hash(o)},e.prototype.getKeys=function(){return Object.keys(this.values)},e.prototype.getKeysCommonToHash=function(t){var e,n,i,o,r;for(t=a(t),o=this.getKeys(),r=[],e=0,i=o.length;i>e;e++)n=o[e],this.values[n]===t.values[n]&&r.push(n);return r},e.prototype.isEqualTo=function(t){return s(this.toArray(),a(t).toArray())},e.prototype.isEmpty=function(){return 0===this.getKeys().length},e.prototype.toArray=function(){var e,n,i;return(null!=this.array?this.array:this.array=function(){var t;n=[],t=this.values;for(e in t)i=t[e],n.push(e,i);return n}.call(this)).slice(0)},e.prototype.toObject=function(){return r(this.values)},e.prototype.toJSON=function(){return this.toObject()},e.prototype.contentsForInspection=function(){return{values:JSON.stringify(this.values)}},i=function(t,e){var n;return n={},n[t]=e,n},n=function(t,e){var n,i,o;i=r(t);for(n in e)o=e[n],i[n]=o;return i},r=function(t,e){var n,i,o,r,s;for(r={},s=Object.keys(t).sort(),n=0,o=s.length;o>n;n++)i=s[n],i!==e&&(r[i]=t[i]);return r},a=function(t){return t instanceof D.Hash?t:new D.Hash(t)},o=function(t){return t instanceof D.Hash?t.values:t},e}(D.Object)}.call(this),function(){D.ObjectGroup=function(){function t(t,e){var n,i;this.objects=null!=t?t:[],i=e.depth,n=e.asTree,n&&(this.depth=i,this.objects=this.constructor.groupObjects(this.objects,{asTree:n,depth:this.depth+1}))}return t.groupObjects=function(t,e){var n,i,o,r,s,a,u,c,l;for(null==t&&(t=[]),l=null!=e?e:{},o=l.depth,n=l.asTree,n&&null==o&&(o=0),c=[],s=0,a=t.length;a>s;s++){if(u=t[s],r){if(("function"==typeof u.canBeGrouped?u.canBeGrouped(o):void 0)&&("function"==typeof(i=r[r.length-1]).canBeGroupedWith?i.canBeGroupedWith(u,o):void 0)){r.push(u);continue}c.push(new this(r,{depth:o,asTree:n})),r=null}("function"==typeof u.canBeGrouped?u.canBeGrouped(o):void 0)?r=[u]:c.push(u)}return r&&c.push(new this(r,{depth:o,asTree:n})),c},t.prototype.getObjects=function(){return this.objects},t.prototype.getDepth=function(){return this.depth},t.prototype.getCacheKey=function(){var t,e,n,i,o;for(e=["objectGroup"],o=this.getObjects(),t=0,n=o.length;n>t;t++)i=o[t],e.push(i.getCacheKey());return e.join("/")},t}()}.call(this),function(){var n=function(t,e){function n(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty;D.ObjectMap=function(t){function e(t){var e,n,i,o,r;for(null==t&&(t=[]),this.objects={},i=0,o=t.length;o>i;i++)r=t[i],n=JSON.stringify(r),null==(e=this.objects)[n]&&(e[n]=r)}return n(e,t),e.prototype.find=function(t){var e;return e=JSON.stringify(t),this.objects[e]},e}(D.BasicObject)}.call(this),function(){D.ElementStore=function(){function t(t){this.reset(t)}var i;return t.prototype.add=function(t){var e;return e=i(t),this.elements[e]=t},t.prototype.remove=function(t){var e,n;return e=i(t),(n=this.elements[e])?(delete this.elements[e],n):void 0},t.prototype.reset=function(t){var e,n,i;for(null==t&&(t=[]),this.elements={},n=0,i=t.length;i>n;n++)e=t[n],this.add(e);return t},i=function(t){return t.dataset.trixStoreKey},t}()}.call(this),function(){}.call(this),function(){var n=function(t,e){function n(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty;D.Operation=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return n(e,t),e.prototype.isPerforming=function(){return this.performing===!0},e.prototype.hasPerformed=function(){return this.performed===!0},e.prototype.hasSucceeded=function(){return this.performed&&this.succeeded},e.prototype.hasFailed=function(){return this.performed&&!this.succeeded},e.prototype.getPromise=function(){return null!=this.promise?this.promise:this.promise=new Promise(function(o){return function(n,i){return o.performing=!0,o.perform(function(t,e){return o.succeeded=t,o.performing=!1,o.performed=!0,o.succeeded?n(e):i(e)})}}(this))},e.prototype.perform=function(t){return t(!1)},e.prototype.release=function(){var t;return null!=(t=this.promise)&&"function"==typeof t.cancel&&t.cancel(),this.promise=null,this.performing=null,this.performed=null,this.succeeded=null},e.proxyMethod("getPromise().then"),e.proxyMethod("getPromise().catch"),e}(D.BasicObject)}.call(this),function(){var t,e,n,i,o,r=function(t,e){function n(){this.constructor=t}for(var i in e)s.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;D.UTF16String=function(t){function e(t,e){this.ucs2String=t,this.co
1depoints=e,this.length=this.codepoints.length,this.ucs2Length=this.ucs2String.length}return r(e,t),e.box=function(t){return null==t&&(t=""),t instanceof this?t:this.fromUCS2String(null!=t?t.toString():void 0)},e.fromUCS2String=function(t){return new this(t,i(t))},e.fromCodepoints=function(t){return new this(o(t),t)},e.prototype.offsetToUCS2Offset=function(t){return o(this.codepoints.slice(0,Math.max(0,t))).length},e.prototype.offsetFromUCS2Offset=function(t){return i(this.ucs2String.slice(0,Math.max(0,t))).length},e.prototype.slice=function(){var t;return this.constructor.fromCodepoints((t=this.codepoints).slice.apply(t,arguments))},e.prototype.charAt=function(t){return this.slice(t,t+1)},e.prototype.isEqualTo=function(t){return this.constructor.box(t).ucs2String===this.ucs2String},e.prototype.toJSON=function(){return this.ucs2String},e.prototype.getCacheKey=function(){return this.ucs2String},e.prototype.toString=function(){return this.ucs2String},e}(D.BasicObject),t=1===("function"==typeof Array.from?Array.from("👼").length:void 0),e=null!=("function"==typeof" ".codePointAt?" ".codePointAt(0):void 0),n=" 👼"===("function"==typeof String.fromCodePoint?String.fromCodePoint(32,128124):void 0),i=t&&e?function(t){return Array.from(t).map(function(t){return t.codePointAt(0)})}:function(t){var e,n,i,o,r;for(o=[],e=0,i=t.length;i>e;)r=t.charCodeAt(e++),r>=55296&&56319>=r&&i>e&&(n=t.charCodeAt(e++),56320===(64512&n)?r=((1023&r)<<10)+(1023&n)+65536:e--),o.push(r);return o},o=n?function(t){return String.fromCodePoint.apply(String,t)}:function(i){var t,o,r;return t=function(){var t,e,n;for(n=[],t=0,e=i.length;e>t;t++)r=i[t],o="",r>65535&&(r-=65536,o+=String.fromCharCode(r>>>10&1023|55296),r=56320|1023&r),n.push(o+String.fromCharCode(r));return n}(),t.join("")}}.call(this),function(){}.call(this),function(){}.call(this),function(){D.config.lang={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"}}.call(this),function(){D.config.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"}}.call(this),function(){var e;D.config.blockAttributes=e={default:{tagName:"div",parse:!1},quote:{tagName:"blockquote",nestable:!0},heading1:{tagName:"h1",terminal:!0,breakOnReturn:!0,group:!1},code:{tagName:"pre",terminal:!0,text:{plaintext:!0}},bulletList:{tagName:"ul",parse:!1},bullet:{tagName:"li",listAttribute:"bulletList",group:!1,nestable:!0,test:function(t){return D.tagName(t.parentNode)===e[this.listAttribute].tagName}},numberList:{tagName:"ol",parse:!1},number:{tagName:"li",listAttribute:"numberList",group:!1,nestable:!0,test:function(t){return D.tagName(t.parentNode)===e[this.listAttribute].tagName}},attachmentGallery:{tagName:"div",exclusive:!0,terminal:!0,parse:!1,group:!1}}}.call(this),function(){var s,a;s=D.config.lang,a=[s.bytes,s.KB,s.MB,s.GB,s.TB,s.PB],D.config.fileSize={prefix:"IEC",precision:2,formatter:function(t){var e,n,i,o,r;switch(t){case 0:return"0 "+s.bytes;case 1:return"1 "+s.byte;default:return e=function(){switch(this.prefix){case"SI":return 1e3;case"IEC":return 1024}}
1.call(this),n=Math.floor(Math.log(t)/Math.log(e)),i=t/Math.pow(e,n),o=i.toFixed(this.precision),r=o.replace(/0*$/,"").replace(/\.$/,""),r+" "+a[n]}}}}.call(this),function(){D.config.textAttributes={bold:{tagName:"strong",inheritable:!0,parser:function(t){var e;return e=window.getComputedStyle(t),"bold"===e.fontWeight||e.fontWeight>=600}},italic:{tagName:"em",inheritable:!0,parser:function(t){var e;return e=window.getComputedStyle(t),"italic"===e.fontStyle}},href:{groupTagName:"a",parser:function(t){var e,n,i;return e=D.AttachmentView.attachmentSelector,i="a:not("+e+")",(n=D.findClosestElementFromNode(t,{matchingSelector:i}))?n.getAttribute("href"):void 0}},strike:{tagName:"del",inheritable:!0},frozen:{style:{backgroundColor:"highlight"}}}}.call(this),function(){var y,b,A,C,x;x="[data-trix-serialize=false]",C=["contenteditable","data-trix-id","data-trix-store-key","data-trix-mutable","data-trix-placeholder","tabindex"],b="data-trix-serialized-attributes",A="["+b+"]",y=new RegExp("\x3c!--block--\x3e","g"),D.extend({serializers:{"application/json":function(t){var e;if(t instanceof D.Document)e=t;else{if(!(t instanceof HTMLElement))throw new Error("unserializable object");e=D.Document.fromHTML(t.innerHTML)}return e.toSerializableDocument().toJSONString()},"text/html":function(t){var e,n,i,o,r,s,a,u,c,l,h,p,d,f,g,m,v;if(t instanceof D.Document)o=D.DocumentView.render(t);else{if(!(t instanceof HTMLElement))throw new Error("unserializable object");o=t.cloneNode(!0)}for(f=o.querySelectorAll(x),r=0,c=f.length;c>r;r++)i=f[r],D.removeNode(i);for(s=0,l=C.length;l>s;s++)for(e=C[s],g=o.querySelectorAll("["+e+"]"),a=0,h=g.length;h>a;a++)i=g[a],i.removeAttribute(e);for(m=o.querySelectorAll(A),u=0,p=m.length;p>u;u++){i=m[u];try{n=JSON.parse(i.getAttribute(b)),i.removeAttribute(b);for(d in n)v=n[d],i.setAttribute(d,v)}catch(t){}}return o.innerHTML.replace(y,"")}},deserializers:{"application/json":function(t){return D.Document.fromJSONString(t)},"text/html":function(t){return D.Document.fromHTML(t)}},serializeToContentType:function(t,e){var n;if(n=D.serializers[e])return n(t);throw new Error("unknown content type: "+e)},deserializeFromContentType:function(t,e){var n;if(n=D.deserializers[e])return n(t);throw new Error("unknown content type: "+e)}})}.call(this),function(){var t;t=D.config.lang,D.config.toolbar={getDefaultHTML:function(){return'<div class="trix-button-row">\n  <span class="trix-button-group trix-button-group--text-tools" data-trix-button-group="text-tools">\n    <button type="button" class="trix-button trix-button--icon trix-button--icon-bold" data-trix-attribute="bold" data-trix-key="b" title="'+t.bold+'" tabindex="-1">'+t.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="'+t.italic+'" tabindex="-1">'+t.italic+'</button>\n    <button type="button" class="trix-button trix-button--icon trix-button--icon-strike" data-trix-attribute="strike" title="'+t.strike+'" tabindex="-1">'+t.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="'+t.link+'" tabindex="-1">'+t.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="'+t.heading1+'" tabindex="-1">'+t.heading1+'</button>\n    <button type="button" class="trix-button trix-button--icon trix-button--icon-quote" data-trix-attribute="quote" title="'+t.quote+'" tabindex="-1">'+t.quote+'</button>\n    <button type="button" class="trix-button trix-button--icon trix-button--icon-code" data-trix-attribute="code" title="'+t.code+'" tabindex="-1">'+t.code+'</button>\n    <button type="button" class="trix-button trix-button--icon trix-button--icon-bullet-list" data-trix-attribute="bullet" title="'+t.bullets+'" tabindex="-1">'+t.bullets+'</button>\n    <button type="button" class="trix-button trix-button--icon trix-button--icon-number-list" data-trix-attribute="number" title="'+t.numbers+'" tabindex="-1">'+t.numbers+'</button>\n    <button type="button" class="trix-button trix-button--icon trix-button--icon-decrease-nesting-level" data-trix-action="decreaseNestingLevel" title="'+t.outdent+'" tabindex="-1">'+t.outdent+'</button>\n    <button type="button" class="trix-button trix-button--icon trix-button--icon-increase-nesting-level" data-trix-action="increaseNestingLevel" title="'+t.indent+'" tabindex="-1">
1'+t.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="'+t.attachFiles+'" tabindex="-1">'+t.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="'+t.undo+'" tabindex="-1">'+t.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="'+t.redo+'" tabindex="-1">'+t.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="'+t.urlPlaceholder+'" aria-label="'+t.url+'" required data-trix-input>\n      <div class="trix-button-group">\n        <input type="button" class="trix-button trix-button--dialog" value="'+t.link+'" data-trix-method="setAttribute">\n        <input type="button" class="trix-button trix-button--dialog" value="'+t.unlink+'" data-trix-method="removeAttribute">\n      </div>\n    </div>\n  </div>\n</div>'}}}.call(this),function(){D.config.undoInterval=5e3}.call(this),function(){D.config.attachments={preview:{presentation:"gallery",caption:{name:!0,size:!0}},file:{caption:{size:!0}}}}.call(this),function(){D.config.keyNames={8:"backspace",9:"tab",13:"return",27:"escape",37:"left",39:"right",46:"delete",68:"d",72:"h",79:"o"}}.call(this),function(){D.config.input={level2Enabled:!0,getLevel:function(){return this.level2Enabled&&D.browser.supportsInputEvents?2:0},pickFiles:function(t){var e;return e=D.makeElement("input",{type:"file",multiple:!0,hidden:!0,id:this.fileInputId}),e.addEventListener("change",function(){return t(e.files),D.removeNode(e)}),D.removeNode(document.getElementById(this.fileInputId)),document.body.appendChild(e),e.click()},fileInputId:"trix-file-input-"+Date.now().toString(16)}}.call(this),function(){}.call(this),function(){D.registerElement("trix-toolbar",{defaultCSS:"%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}",initialize:function(){return""===this.innerHTML?this.innerHTML=D.config.toolbar.getDefaultHTML():void 0}})}.call(this),function(){var n=function(t,e){function n(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty,s=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};D.ObjectView=function(t){function e(t,e){this.object=t,this.options=null!=e?e:{},this.childViews=[],this.rootView=this}return n(e,t),e.prototype.getNodes=function(){var t,e,n,i,o;for(null==this.nodes&&(this.nodes=this.createNodes()),i=this.nodes,o=[],t=0,e=i.length;e>t;t++)n=i[t],o.push(n.cloneNode(!0));return o},e.prototype.invalidate=function(){var t;return this.nodes=null,this.childViews=[],null!=(t=this.parentView)?t.invalidate():void 0},e.prototype.invalidateViewForObject=function(t){var e;return null!=(e=this.findViewForObject(t))?e.invalidate():void 0},e.prototype.findOrCreateCachedChildView=function(t,e){var n;return(n=this.getCachedViewForObject(e))?this.recordChildView(n):(n=this.createChildView.apply(this,arguments),this.cacheViewForObject(n,e)),n},e.prototype.createChildView=function(t,e,n){var i;return null==n&&(n={}),e instanceof D.ObjectGroup&&(n.viewClass=t,t=D.ObjectGroupView),i=new t(e,n),this.recordChildView(i)},e.prototype.recordChildView=function(t){return t.parentView=this,t.rootView=this.root
1View,this.childViews.push(t),t},e.prototype.getAllChildViews=function(){var t,e,n,i,o;for(o=[],i=this.childViews,e=0,n=i.length;n>e;e++)t=i[e],o.push(t),o=o.concat(t.getAllChildViews());return o},e.prototype.findElement=function(){return this.findElementForObject(this.object)},e.prototype.findElementForObject=function(t){var e;return(e=null!=t?t.id:void 0)?this.rootView.element.querySelector("[data-trix-id='"+e+"']"):void 0},e.prototype.findViewForObject=function(t){var e,n,i,o;for(i=this.getAllChildViews(),e=0,n=i.length;n>e;e++)if(o=i[e],o.object===t)return o},e.prototype.getViewCache=function(){return this.rootView!==this?this.rootView.getViewCache():this.isViewCachingEnabled()?null!=this.viewCache?this.viewCache:this.viewCache={}:void 0},e.prototype.isViewCachingEnabled=function(){return this.shouldCacheViews!==!1},e.prototype.enableViewCaching=function(){return this.shouldCacheViews=!0},e.prototype.disableViewCaching=function(){return this.shouldCacheViews=!1},e.prototype.getCachedViewForObject=function(t){var e;return null!=(e=this.getViewCache())?e[t.getCacheKey()]:void 0},e.prototype.cacheViewForObject=function(t,e){var n;return null!=(n=this.getViewCache())?n[e.getCacheKey()]=t:void 0},e.prototype.garbageCollectCachedViews=function(){var t,e,n,i,o,r;if(t=this.getViewCache()){r=this.getAllChildViews().concat(this),n=function(){var t,e,n;for(n=[],t=0,e=r.length;e>t;t++)o=r[t],n.push(o.object.getCacheKey());return n}(),i=[];for(e in t)s.call(n,e)<0&&i.push(delete t[e]);return i}},e}(D.BasicObject)}.call(this),function(){var n=function(t,e){function n(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty;D.ObjectGroupView=function(t){function e(){e.__super__.constructor.apply(this,arguments),this.objectGroup=this.object,this.viewClass=this.options.viewClass,delete this.options.viewClass}return n(e,t),e.prototype.getChildViews=function(){var t,e,n,i;if(!this.childViews.length)for(i=this.objectGroup.getObjects(),t=0,e=i.length;e>t;t++)n=i[t],this.findOrCreateCachedChildView(this.viewClass,n,this.options);return this.childViews},e.prototype.createNodes=function(){var t,e,n,i,o,r,s,a,u;for(t=this.createContainerElement(),s=this.getChildViews(),e=0,i=s.length;i>e;e++)for(u=s[e],a=u.getNodes(),n=0,o=a.length;o>n;n++)r=a[n],t.appendChild(r);return[t]},e.prototype.createContainerElement=function(t){return null==t&&(t=this.objectGroup.getDepth()),this.getChildViews()[0].createContainerElement(t)},e}(D.ObjectView)}.call(this),function(){var n=function(t,e){function n(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty;D.Controller=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return n(e,t),e}(D.BasicObject)}.call(this),function(){var r,p,s,d,u,a,c=function(t,e){return function(){return t.apply(e,arguments)}},l=function(t,e){function n(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty,f=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};r=D.findClosestElementFromNode,s=D.nodeIsEmptyTextNode,p=D.nodeIsBlockStartComment,d=D.normalizeSpaces,u=D.summarizeStringChange,a=D.tagName,D.MutationObserver=function(t){function e(t){this.element=t,this.didMutate=c(this.didMutate,this),this.observer=new window.MutationObserver(this.didMutate),this.start()}var h,n,i,o;return l(e,t),n="data-trix-mutable",i="["+n+"]",o={attributes:!0,childList:!0,characterData:!0,characterDataOldValue:!0,subtree:!0},e.prototype.start=function(){return this.reset(),this.observer.observe(this.element,o)},e.prototype.stop=function(){return this.observer.disconnect()},e.prototype.didMutate=function(t){var e,n;return(e=this.mutations).push.apply(e,this.findSignificantMutations(t)),this.mutations.length?(null!=(n=this.delegate)&&"function"==typeof n.elementDidMutate&&n.elementDidMutate(this.getMutationSummary()),this.reset()):void 0},e.prototype.reset=function(){return this.mutations=[]},e.prototype.findSignificantMutations=function(t){var e,n,i,o;for(o=[],e=0,n=t.length;n>e;e++)i=t[e],this.mutationIsSignificant(i)&&o.push(i);return o},e.prototype.mutationIsSignificant=function(t){var e,n,i,o;if(this.nodeIsMutable(t.target))return!1;for(o=this.nodesModifiedByMutation(t),e=0,n=o.length;n>e;e++)if(i=o[e],this.nodeIsSignificant(i))return!0;return!1},e.prototype.nodeIsSignificant=function(t){return t!==this.element&&!this.nodeIsMutable(t)&&!s(t)},e.prototype.nodeIsMutable=function(t){return r(t,{matchingSelector:i})},e.prototype.nodesModifiedByMutation=function(t){var e;switch(e=[],t.type){case"attributes":t.attributeName!==n&&e.push(t.target);break;case"characterData":e.push(t.target.parentNode),e.push(t.target);break;case"childList":e.push.apply(e,t.addedNodes),e.push.apply(e,t.removedNodes
1)}return e},e.prototype.getMutationSummary=function(){return this.getTextMutationSummary()},e.prototype.getTextMutationSummary=function(){var t,e,n,i,o,r,s,a,u,c,l;for(a=this.getTextChangesFromCharacterData(),n=a.additions,o=a.deletions,l=this.getTextChangesFromChildList(),u=l.additions,r=0,s=u.length;s>r;r++)e=u[r],f.call(n,e)<0&&n.push(e);return o.push.apply(o,l.deletions),c={},(t=n.join(""))&&(c.textAdded=t),(i=o.join(""))&&(c.textDeleted=i),c},e.prototype.getMutationsByType=function(t){var e,n,i,o,r;for(o=this.mutations,r=[],e=0,n=o.length;n>e;e++)i=o[e],i.type===t&&r.push(i);return r},e.prototype.getTextChangesFromChildList=function(){var t,e,i,n,o,r,s,a,u,c,l;for(t=[],s=[],r=this.getMutationsByType("childList"),e=0,n=r.length;n>e;e++)o=r[e],t.push.apply(t,o.addedNodes),s.push.apply(s,o.removedNodes);return a=0===t.length&&1===s.length&&p(s[0]),a?(c=[],l=["\n"]):(c=h(t),l=h(s)),{additions:function(){var t,e,n;for(n=[],i=t=0,e=c.length;e>t;i=++t)u=c[i],u!==l[i]&&n.push(d(u));return n}(),deletions:function(){var t,e,n;for(n=[],i=t=0,e=l.length;e>t;i=++t)u=l[i],u!==c[i]&&n.push(d(u));return n}()}},e.prototype.getTextChangesFromCharacterData=function(){var t,e,n,i,o,r,s,a;return e=this.getMutationsByType("characterData"),e.length&&(a=e[0],n=e[e.length-1],o=d(a.oldValue),i=d(n.target.data),r=u(o,i),t=r.added,s=r.removed),{additions:t?[t]:[],deletions:s?[s]:[]}},h=function(t){var e,n,i,o;for(null==t&&(t=[]),o=[],e=0,n=t.length;n>e;e++)switch(i=t[e],i.nodeType){case Node.TEXT_NODE:o.push(i.data);break;case Node.ELEMENT_NODE:"br"===a(i)?o.push("\n"):o.push.apply(o,h(i.childNodes))}return o},e}(D.BasicObject)}.call(this),function(){var n=function(t,e){function n(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty;D.FileVerificationOperation=function(t){function e(t){this.file=t}return n(e,t),e.prototype.perform=function(e){var n;return n=new FileReader,n.onerror=function(){return e(!1)},n.onload=function(t){return function(){n.onerror=null;try{n.abort()}catch(t){}return e(!0,t.file)}}(this),n.readAsArrayBuffer(this.file)},e}(D.Operation)}.call(this),function(){var n,i,o=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;n=D.handleEvent,i=D.innerElementIsActive,D.InputController=function(t){function e(t){var e;this.element=t,this.mutationObserver=new D.MutationObserver(this.element),this.mutationObserver.delegate=this;for(e in this.events)n(e,{onElement:this.element,withCallback:this.handlerFor(e)})}return o(e,t),e.prototype.events={},e.prototype.elementDidMutate=function(){},e.prototype.editorWillSyncDocumentView=function(){return this.mutationObserver.stop()},e.prototype.editorDidSyncDocumentView=function(){return this.mutationObserver.start()},e.prototype.requestRender=function(){var t;return null!=(t=this.delegate)&&"function"==typeof t.inputControllerDidRequestRender?t.inputControllerDidRequestRender():void 0},e.prototype.requestReparse=function(){var t;return null!=(t=this.delegate)&&"function"==typeof t.inputControllerDidRequestReparse&&t.inputControllerDidRequestReparse(),this.requestRender()},e.prototype.attachFiles=function(i){var o,t;return t=function(){var t,e,n;for(n=[],t=0,e=i.length;e>t;t++)o=i[t],n.push(new D.FileVerificationOperation(o));return n}(),Promise.all(t).then(function(t){return function(n){return t.handleInput(function(){var t,e;return null!=(t=this.delegate)&&t.inputControllerWillAttachFiles(),null!=(e=this.responder)&&e.insertFiles(n),this.requestRender()})}}(this))},e.prototype.handlerFor=function(n){return function(e){return function(t){return t.defaultPrevented?void 0:e.handleInput(function(){return i(this.element)?void 0:(this.eventName=n,this.events[n].call(this,t))})}}(this)},e.prototype.handleInput=function(t){var e,n;try{return null!=(e=this.delegate)&&e.inputControllerWillHandleInput(),t.call(this)}finally{null!=(n=this.delegate)&&n.inputControllerDidHandleInput()}},e}(D.BasicObject)}.call(this),function(){var n,i,E,o,S,r,l,h,s,a,R,u,t,c=function(t,e){function n(){this.constructor=t}for(var i in e)p.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},p={}.hasOwnProperty,k=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};s=D.makeElement,a=D.objectsAreEqual,t=D.tagName,i=D.browser,l=D.keyEventIsKeyboardCommand,o=D.dataTransferIsWritable,E=D.dataTransferIsPlainText,h=D.config.keyNames,D.Level0InputController=function(t){function e(){e.__super__.constructor.apply(this,arguments),this.resetInputSummary()}var w;return c(e,t),w=0,e.prototype.setInputSummary=function(t){var e,n;null==t&&(t={}),this.inputSummary.eventName=this.eventName;for(e in t)n=t[e],this.inputSummary[e]=n;return this.inputSummary},e.prototype.resetInputSummary=function(){return this.inputSummary={}},e.prototype.reset=function(){return this.resetInputSummary(),D.selectionChangeObserver.reset()},e.prototype.elementDidMutate=function(t){var e;return this.isComposing()?null!=(e=this.delegate)&&"function"==typeof e.inputControllerDidAllowUnhandledInput?e.inputControllerDidAllowUnhandledInput():void 0:this.handleInput(function(){return this.mutationIsSignificant(t)&&(this.mutationIsExpected(t)?this.requestRender():this.requestReparse()),this.reset()})},e.prototype.mutationIsExpected=function(t){var e,n,i,o,r,s,a,u,c,l;return a=t.textAdded,u=t.textDeleted,this.inputSummary.preferDocument?!0:(e=null!=a?a===this.inputSummary.textAdded:!this.inputSummary.textAdded,n=null!=u?this.inputSummary.didDelete:!this.inputSummary.didDelete,c=("\n"===a||" \n"===a)&&!e,l="\n"===u&&!n,s=c&&!l||l&&!c,s&&(o=this.getSelectedRange())&&(i=c?a.replace(/\n$/,"").length||-1:(null!=a?a.length:void 0)||1,null!=(r=this.responder)?r.positionIsBlockBreak(o[1]+i):void 0)?!0:e&&n)},e.prototype.mutationIsSignificant=function(t){var e,n,i;return i=Object.keys(t).length>0,e=""===(null!=(n=this.compositionInput)?n.getEndData():void 0),i||
1!e},e.prototype.events={keydown:function(o){var t,e,n,i,r,s,a,u,c;if(this.isComposing()||this.resetInputSummary(),this.inputSummary.didInput=!0,i=h[o.keyCode]){for(e=this.keys,u=["ctrl","alt","shift","meta"],n=0,s=u.length;s>n;n++)a=u[n],o[a+"Key"]&&("ctrl"===a&&(a="control"),e=null!=e?e[a]:void 0);null!=(null!=e?e[i]:void 0)&&(this.setInputSummary({keyName:i}),D.selectionChangeObserver.reset(),e[i].call(this,o))}return l(o)&&(t=String.fromCharCode(o.keyCode).toLowerCase())&&(r=function(){var t,e,n,i;for(n=["alt","shift"],i=[],t=0,e=n.length;e>t;t++)a=n[t],o[a+"Key"]&&i.push(a);return i}(),r.push(t),null!=(c=this.delegate)?c.inputControllerDidReceiveKeyboardCommand(r):void 0)?o.preventDefault():void 0},keypress:function(t){var e,n,i;if(null==this.inputSummary.eventName&&!t.metaKey&&(!t.ctrlKey||t.altKey))return(i=u(t))?(null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),null!=(n=this.responder)&&n.insertString(i),this.setInputSummary({textAdded:i,didDelete:this.selectionIsExpanded()})):void 0},textInput:function(t){var e,n,i,o;return e=t.data,o=this.inputSummary.textAdded,o&&o!==e&&o.toUpperCase()===e?(n=this.getSelectedRange(),this.setSelectedRange([n[0],n[1]+o.length]),null!=(i=this.responder)&&i.insertString(e),this.setInputSummary({textAdded:e}),this.setSelectedRange(n)):void 0},dragenter:function(t){return t.preventDefault()},dragstart:function(t){var e,n;return n=t.target,this.serializeSelectionToDataTransfer(t.dataTransfer),this.draggedRange=this.getSelectedRange(),null!=(e=this.delegate)&&"function"==typeof e.inputControllerDidStartDrag?e.inputControllerDidStartDrag():void 0},dragover:function(t){var e,n;return!this.draggedRange&&!this.canAcceptDataTransfer(t.dataTransfer)||(t.preventDefault(),e={x:t.clientX,y:t.clientY},a(e,this.draggingPoint))?void 0:(this.draggingPoint=e,null!=(n=this.delegate)&&"function"==typeof n.inputControllerDidReceiveDragOverPoint?n.inputControllerDidReceiveDragOverPoint(this.draggingPoint):void 0)},dragend:function(){var t;return null!=(t=this.delegate)&&"function"==typeof t.inputControllerDidCancelDrag&&t.inputControllerDidCancelDrag(),this.draggedRange=null,this.draggingPoint=null},drop:function(t){var e,n,i,o,r,s,a,u,c;return t.preventDefault(),i=null!=(r=t.dataTransfer)?r.files:void 0,o={x:t.clientX,y:t.clientY},null!=(s=this.responder)&&s.setLocationRangeFromPointRange(o),(null!=i?i.length:void 0)?this.attachFiles(i):this.draggedRange?(null!=(a=this.delegate)&&a.inputControllerWillMoveText(),null!=(u=this.responder)&&u.moveTextFromRange(this.draggedRange),this.draggedRange=null,this.requestRender()):(n=t.dataTransfer.getData("application/x-trix-document"))&&(e=D.Document.fromJSONString(n),null!=(c=this.responder)&&c.insertDocument(e),this.requestRender()),this.draggedRange=null,this.draggingPoint=null},cut:function(t){var e,n;return(null!=(e=this.responder)?e.selectionIsExpanded():void 0)&&(this.serializeSelectionToDataTransfer(t.clipboardData)&&t.preventDefault(),null!=(n=this.delegate)&&n.inputControllerWillCutText(),this.deleteInDirection("backward"),t.defaultPrevented)?this.requestRender():void 0},copy:function(t){var e;return(null!=(e=this.responder)?e.selectionIsExpanded():void 0)&&this.serializeSelectionToDataTransfer(t.clipboardData)?t.preventDefault():void 0},paste:function(t){var e,n,i,o,r,s,a,u,c,l,h,p,d,f,g,m,v,y,b,A,C,x;return e=null!=(u=t.clipboardData)?u:t.testClipboardData,a={clipboard:e},null==e||R(t)?void this.getPastedHTMLUsingHiddenElement(function(o){return function(t){var e,n,i;return a.type="text/html",a.html=t,null!=(e=o.delegate)&&e.inputControllerWillPaste(a),null!=(n=o.responder)&&n.insertHTML(a.html),o.requestRender(),null!=(i=o.delegate)?i.inputControllerDidPaste(a):void 0}}(this)):((o=e.getData("URL"))?(a.type="URL",a.href=o,a.string=(s=e.getData("public.url-name"))?D.squishBreakableWhitespace(s).trim():o,null!=(c=this.delegate)&&c.inputControllerWillPaste(a),this.setInputSummary({textAdded:a.string,didDelete:this.selectionIsExpanded()}),null!=(g=this.responder)&&g.insertText(D.Text.textForStringWithAttributes(a.string,{href:a.href})),this.requestRender(),null!=(m=this.delegate)&&m.inputControllerDidPaste(a)):E(e)?(a.type="text/plain",a.string=e.getData("text/plain"),null!=(v=this.delegate)&&v.inputControllerWillPaste(a),this.setInputSummary({textAdded:a.string,didDelete:this.selectionIsExpanded()}
1),null!=(y=this.responder)&&y.insertString(a.string),this.requestRender(),null!=(b=this.delegate)&&b.inputControllerDidPaste(a)):(r=e.getData("text/html"))?(a.type="text/html",a.html=r,null!=(A=this.delegate)&&A.inputControllerWillPaste(a),null!=(C=this.responder)&&C.insertHTML(a.html),this.requestRender(),null!=(x=this.delegate)&&x.inputControllerDidPaste(a)):k.call(e.types,"Files")>=0&&(i=null!=(l=e.items)&&null!=(h=l[0])&&"function"==typeof h.getAsFile?h.getAsFile():void 0)&&(!i.name&&(n=S(i))&&(i.name="pasted-file-"+ ++w+"."+n),a.type="File",a.file=i,null!=(p=this.delegate)&&p.inputControllerWillAttachFiles(),null!=(d=this.responder)&&d.insertFile(a.file),this.requestRender(),null!=(f=this.delegate)&&f.inputControllerDidPaste(a)),t.preventDefault())},compositionstart:function(t){return this.getCompositionInput().start(t.data)},compositionupdate:function(t){return this.getCompositionInput().update(t.data)},compositionend:function(t){return this.getCompositionInput().end(t.data)},beforeinput:function(){return this.inputSummary.didInput=!0},input:function(t){return this.inputSummary.didInput=!0,t.stopPropagation()}},e.prototype.keys={backspace:function(t){var e;return null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),this.deleteInDirection("backward",t)},delete:function(t){var e;return null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),this.deleteInDirection("forward",t)},return:function(){var t,e;return this.setInputSummary({preferDocument:!0}),null!=(t=this.delegate)&&t.inputControllerWillPerformTyping(),null!=(e=this.responder)?e.insertLineBreak():void 0},tab:function(t){var e,n;return(null!=(e=this.responder)?e.canIncreaseNestingLevel():void 0)?(null!=(n=this.responder)&&n.increaseNestingLevel(),this.requestRender(),t.preventDefault()):void 0},left:function(t){var e;return this.selectionIsInCursorTarget()?(t.preventDefault(),null!=(e=this.responder)?e.moveCursorInDirection("backward"):void 0):void 0},right:function(t){var e;return this.selectionIsInCursorTarget()?(t.preventDefault(),null!=(e=this.responder)?e.moveCursorInDirection("forward"):void 0):void 0},control:{d:function(t){var e;return null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),this.deleteInDirection("forward",t)},h:function(t){var e;return null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),this.deleteInDirection("backward",t)},o:function(t){var e,n;return t.preventDefault(),null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),null!=(n=this.responder)&&n.insertString("\n",{updatePosition:!1}),this.requestRender()}},shift:{return:function(t){var e,n;return null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),null!=(n=this.responder)&&n.insertString("\n"),this.requestRender(),t.preventDefault()},tab:function(t){var e,n;return(null!=(e=this.responder)?e.canDecreaseNestingLevel():void 0)?(null!=(n=this.responder)&&n.decreaseNestingLevel(),this.requestRender(),t.preventDefault()):void 0},left:function(t){return this.selectionIsInCursorTarget()?(t.preventDefault(),this.expandSelectionInDirection("backward")):void 0},right:function(t){return this.selectionIsInCursorTarget()?(t.preventDefault(),this.expandSelectionInDirection("forward")):void 0}},alt:{backspace:function(){var t;return this.setInputSummary({preferDocument:!1}),null!=(t=this.delegate)?t.inputControllerWillPerformTyping():void 0}},meta:{backspace:function(){var t;return this.setInputSummary({preferDocument:!1}),null!=(t=this.delegate)?t.inputControllerWillPerformTyping():void 0}}},e.prototype.getCompositionInput=function(){return this.isComposing()?this.compositionInput:this.compositionInput=new n(this)},e.prototype.isComposing=function(){return null!=this.compositionInput&&!this.compositionInput.isEnded()},e.prototype.deleteInDirection=function(t,e){var n;return(null!=(n=this.responder)?n.deleteInDirection(t):void 0)!==!1?this.setInputSummary({didDelete:!0}):e?(e.preventDefault(),this.requestRender()):void 0},e.prototype.serializeSelectionToDataTransfer=function(t){var e,n;if(o(t))return e=null!=(n=this.responder)?n.getSelectedDocument().toSerializableDocument():void 0,t.setData("application/x-trix-document",JSON.stringify(e)),t.setData("text/html",D.DocumentView.render(e).innerHTML),t.setData("text/plain",e.toString().replace(/\n$/,"")),!0},e.prototype.canAcceptDataTransfer=function(t){var e,n,i,o,r,s;for(s={},o=null!=(i=null!=t?t.types:void 0)?i:[],e=0,n=o.length;n>e;e++)r=o[e],s[r]=!0;return s.Files||s["application/x-trix-document"]||s["text/html"]||s["text/plain"]},e.prototype.getPastedHTMLUsingHiddenElement=function(n){var i,o,t;return o=this.getSelectedRange(),t={position:"absolute",left:window.pageXOffset+"px",to
1p:window.pageYOffset+"px",opacity:0},i=s({style:t,tagName:"div",editable:!0}),document.body.appendChild(i),i.focus(),requestAnimationFrame(function(e){return function(){var t;return t=i.innerHTML,D.removeNode(i),e.setSelectedRange(o),n(t)}}(this))},e.proxyMethod("responder?.getSelectedRange"),e.proxyMethod("responder?.setSelectedRange"),e.proxyMethod("responder?.expandSelectionInDirection"),e.proxyMethod("responder?.selectionIsInCursorTarget"),e.proxyMethod("responder?.selectionIsExpanded"),e}(D.InputController),S=function(t){var e,n;return null!=(e=t.type)&&null!=(n=e.match(/\/(\w+)$/))?n[1]:void 0},r=null!=("function"==typeof" ".codePointAt?" ".codePointAt(0):void 0),u=function(t){var e;return t.key&&r&&t.key.codePointAt(0)===t.keyCode?t.key:(null===t.which?e=t.keyCode:0!==t.which&&0!==t.charCode&&(e=t.charCode),null!=e&&"escape"!==h[e]?D.UTF16String.fromCodepoints([e]).toString():void 0)},R=function(t){var e,n,i,o,r,s,a,u,c,l;if(u=t.clipboardData){if(k.call(u.types,"text/html")>=0){for(c=u.types,i=0,s=c.length;s>i;i++)if(l=c[i],e=/^CorePasteboardFlavorType/.test(l),n=/^dyn\./.test(l)&&u.getData(l),a=e||n)return!0;return!1}return o=k.call(u.types,"com.apple.webarchive")>=0,r=k.call(u.types,"com.apple.flat-rtfd")>=0,o||r}},n=function(t){function e(t){var e;this.inputController=t,e=this.inputController,this.responder=e.responder,this.delegate=e.delegate,this.inputSummary=e.inputSummary,this.data={}}return c(e,t),e.prototype.start=function(t){var e,n;return this.data.start=t,this.isSignificant()?("keypress"===this.inputSummary.eventName&&this.inputSummary.textAdded&&null!=(e=this.responder)&&e.deleteInDirection("left"),this.selectionIsExpanded()||(this.insertPlaceholder(),this.requestRender()),this.range=null!=(n=this.responder)?n.getSelectedRange():void 0):void 0},e.prototype.update=function(t){var e;return this.data.update=t,this.isSignificant()&&(e=this.selectPlaceholder())?(this.forgetPlaceholder(),this.range=e):void 0},e.prototype.end=function(t){var e,n,i,o;return this.data.end=t,this.isSignificant()?(this.forgetPlaceholder(),this.canApplyToDocument()?(this.setInputSummary({preferDocument:!0,didInput:!1}),null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),null!=(n=this.responder)&&n.setSelectedRange(this.range),null!=(i=this.responder)&&i.insertString(this.data.end),null!=(o=this.responder)?o.setSelectedRange(this.range[0]+this.data.end.length):void 0):null!=this.data.start||null!=this.data.update?(this.requestReparse(),this.inputController.reset()):void 0):this.inputController.reset()},e.prototype.getEndData=function(){return this.data.end},e.prototype.isEnded=function(){return null!=this.getEndData()},e.prototype.isSignificant=function(){return i.composesExistingText?this.inputSummary.didInput:!0},e.prototype.canApplyToDocument=function(){var t,e;return 0===(null!=(t=this.data.start)?t.length:void 0)&&(null!=(e=this.data.end)?e.length:void 0)>0&&null!=this.range},e.proxyMethod("inputController.setInputSummary"),e.proxyMethod("inputController.requestRender"),e.proxyMethod("inputController.requestReparse"),e.proxyMethod("responder?.selectionIsExpanded"),e.proxyMethod("responder?.insertPlaceholder"),e.proxyMethod("responder?.selectPlaceholder"),e.proxyMethod("responder?.forgetPlaceholder"),e}(D.BasicObject)}.call(this),function(){var p,c,i,n=function(t,e){return function(){return t.apply(e,arguments)}},o=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty,d=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};p=D.dataTransferIsPlainText,c=D.keyEventIsKeyboardCommand,i=D.objectsAreEqual,D.Level2InputController=function(t){function e(){return this.render=n(this.render,this),e.__super__.constructor.apply(this,arguments)}var r,s,l,h,a,u;return o(e,t),e.prototype.elementDidMutate=function(){var t;return this.scheduledRender?this.composing&&null!=(t=this.delegate)&&"function"==typeof t.inputControllerDidAllowUnhandledInput?t.inputControllerDidAllowUnhandledInput():void 0:this.reparse()},e.prototype.scheduleRender=function(){return null!=this.scheduledRender?this.scheduledRender:this.scheduledRender=requestAnimationFrame(this.render)},e.prototype.render=function(){var t;return cancelAnimationFrame(this.scheduledRender),this.scheduledRender=null,this.composing||null!=(t=this.delegate)&&t.render(),"function"==typeof this.afterRender&&this.afterRender(),this.afterRender=null},e.prototype.reparse=function(){var t;return null!=(t=this.delegate)?t.reparse():void 0},e.prototype.events={keydown:function(t){var e,n,i,o;if(c(t)){if(e=s(t),null!=(o=this.delegate)?o.inputControllerDidReceiveKeyboardCommand(e):void 0)return t.preventDefault()}
1else if(i=t.key,t.altKey&&(i+="+Alt"),t.shiftKey&&(i+="+Shift"),n=this.keys[i])return this.withEvent(t,n)},paste:function(t){var e,n,i,o,r,s,a,u,c;return l(t)?(t.preventDefault(),this.attachFiles(t.clipboardData.files)):h(t)?(t.preventDefault(),n={type:"text/plain",string:t.clipboardData.getData("text/plain")},null!=(i=this.delegate)&&i.inputControllerWillPaste(n),null!=(o=this.responder)&&o.insertString(n.string),this.render(),null!=(r=this.delegate)?r.inputControllerDidPaste(n):void 0):(e=null!=(s=t.clipboardData)?s.getData("URL"):void 0)?(t.preventDefault(),n={type:"URL",href:e,string:e},null!=(a=this.delegate)&&a.inputControllerWillPaste(n),null!=(u=this.responder)&&u.insertText(D.Text.textForStringWithAttributes(n.string,{href:n.href})),this.render(),null!=(c=this.delegate)?c.inputControllerDidPaste(n):void 0):void 0},beforeinput:function(t){var e;return(e=this.inputTypes[t.inputType])?(this.withEvent(t,e),this.scheduleRender()):void 0},input:function(){return D.selectionChangeObserver.reset()},dragstart:function(t){var e,n;return(null!=(e=this.responder)?e.selectionContainsAttachments():void 0)?(t.dataTransfer.setData("application/x-trix-dragging",!0),this.dragging={range:null!=(n=this.responder)?n.getSelectedRange():void 0,point:a(t)}):void 0},dragenter:function(t){return r(t)?t.preventDefault():void 0},dragover:function(t){var e,n;return this.dragging&&(t.preventDefault(),e=a(t),!i(e,this.dragging.point))?(this.dragging.point=e,null!=(n=this.responder)?n.setLocationRangeFromPointRange(e):void 0):void 0},drop:function(t){var e,n,i,o;return this.dragging?(t.preventDefault(),null!=(n=this.delegate)&&n.inputControllerWillMoveText(),null!=(i=this.responder)&&i.moveTextFromRange(this.dragging.range),this.dragging=null,this.scheduleRender()):r(t)?(t.preventDefault(),e=a(t),null!=(o=this.responder)&&o.setLocationRangeFromPointRange(e),this.attachFiles(t.dataTransfer.files)):void 0},dragend:function(){var t;return this.dragging?(null!=(t=this.responder)&&t.setSelectedRange(this.dragging.range),this.dragging=null):void 0},compositionend:function(){return this.composing?(this.composing=!1,this.scheduleRender()):void 0}},e.prototype.keys={ArrowLeft:function(){var t,e;return(null!=(t=this.responder)?t.shouldManageMovingCursorInDirection("backward"):void 0)?(this.event.preventDefault(),null!=(e=this.responder)?e.moveCursorInDirection("backward"):void 0):void 0},ArrowRight:function(){var t,e;return(null!=(t=this.responder)?t.shouldManageMovingCursorInDirection("forward"):void 0)?(this.event.preventDefault(),null!=(e=this.responder)?e.moveCursorInDirection("forward"):void 0):void 0},Backspace:function(){var t,e,n;return(null!=(t=this.responder)?t.shouldManageDeletingInDirection("backward"):void 0)?(this.event.preventDefault(),null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),null!=(n=this.responder)&&n.deleteInDirection("backward"),this.render()):void 0},Tab:function(){var t,e;return(null!=(t=this.responder)?t.canIncreaseNestingLevel():void 0)?(this.event.preventDefault(),null!=(e=this.responder)&&e.increaseNestingLevel(),this.render()):void 0},"Tab+Shift":function(){var t,e;return(null!=(t=this.responder)?t.canDecreaseNestingLevel():void 0)?(this.event.preventDefault(),null!=(e=this.responder)&&e.decreaseNestingLevel(),this.render()):void 0}},e.prototype.inputTypes={deleteByComposition:function(){return this.deleteInDirection("backward",{recordUndoEntry:!1})},deleteByCut:function(){return this.deleteInDirection("backward")},deleteByDrag:function(){return this.event.preventDefault(),this.withTargetDOMRange(function(){var t;return this.deleteByDragRange=null!=(t=this.responder)?t.getSelectedRange():void 0})},deleteCompositionText:function(){return this.deleteInDirection("backward",{recordUndoEntry:!1})},deleteContent:function(){return this.deleteInDirection("backward")},deleteContentBackward:function(){return this.deleteInDirection("backward")},deleteContentForward:function(){return this.deleteInDirection("forward")},deleteEntireSoftLine:function(){return this.deleteInDirection("forward")},deleteHardLineBackward:function(){return this.deleteInDirection("backward")},deleteHardLineForward:function(){return this.deleteInDirection("forward")},deleteSoftLineBackward:function(){return this.deleteInDirection("backward")},deleteSoftLineForward:function(){return this.deleteInDirection("forward")},deleteWordBackward:function(){return this.deleteInDirection("backward")}
1,deleteWordForward:function(){return this.deleteInDirection("forward")},formatBackColor:function(){return this.activateAttributeIfSupported("backgroundColor",this.event.data)},formatBold:function(){return this.toggleAttributeIfSupported("bold")},formatFontColor:function(){return this.activateAttributeIfSupported("color",this.event.data)},formatFontName:function(){return this.activateAttributeIfSupported("font",this.event.data)},formatIndent:function(){var t;return(null!=(t=this.responder)?t.canIncreaseNestingLevel():void 0)?this.withTargetDOMRange(function(){var t;return null!=(t=this.responder)?t.increaseNestingLevel():void 0}):void 0},formatItalic:function(){return this.toggleAttributeIfSupported("italic")},formatJustifyCenter:function(){return this.toggleAttributeIfSupported("justifyCenter")},formatJustifyFull:function(){return this.toggleAttributeIfSupported("justifyFull")},formatJustifyLeft:function(){return this.toggleAttributeIfSupported("justifyLeft")},formatJustifyRight:function(){return this.toggleAttributeIfSupported("justifyRight")},formatOutdent:function(){var t;return(null!=(t=this.responder)?t.canDecreaseNestingLevel():void 0)?this.withTargetDOMRange(function(){var t;return null!=(t=this.responder)?t.decreaseNestingLevel():void 0}):void 0},formatRemove:function(){return this.withTargetDOMRange(function(){var t,e,n,i;i=[];for(t in null!=(e=this.responder)?e.getCurrentAttributes():void 0)i.push(null!=(n=this.responder)?n.removeCurrentAttribute(t):void 0);return i})},formatSetBlockTextDirection:function(){return this.activateAttributeIfSupported("blockDir",this.event.data)},formatSetInlineTextDirection:function(){return this.activateAttributeIfSupported("textDir",this.event.data)},formatStrikeThrough:function(){return this.toggleAttributeIfSupported("strike")},formatSubscript:function(){return this.toggleAttributeIfSupported("sub")},formatSuperscript:function(){return this.toggleAttributeIfSupported("sup")},formatUnderline:function(){return this.toggleAttributeIfSupported("underline")},historyRedo:function(){var t;return null!=(t=this.delegate)?t.inputControllerWillPerformRedo():void 0},historyUndo:function(){var t;return null!=(t=this.delegate)?t.inputControllerWillPerformUndo():void 0},insertCompositionText:function(){return this.composing=!0,this.insertString(this.event.data)},insertFromComposition:function(){return this.composing=!1,this.insertString(this.event.data)},insertFromDrop:function(){var e,t;return(e=this.deleteByDragRange)?(this.deleteByDragRange=null,null!=(t=this.delegate)&&t.inputControllerWillMoveText(),this.withTargetDOMRange(function(){var t;return null!=(t=this.responder)?t.moveTextFromRange(e):void 0})):void 0},insertFromPaste:function(){var t,e,n,i,o,r,s,a,u,c;return t=this.event.dataTransfer,o={dataTransfer:t},(e=t.getData("URL"))?(o.type="URL",o.href=e,o.string=(i=t.getData("public.url-name"))?D.squishBreakableWhitespace(i).trim():e,null!=(r=this.delegate)&&r.inputControllerWillPaste(o),this.withTargetDOMRange(function(){var t;return null!=(t=this.responder)?t.insertText(D.Text.textForStringWithAttributes(o.string,{href:o.href})):void 0}),this.afterRender=function(e){return function(){var t;return null!=(t=e.delegate)?t.inputControllerDidPaste(o):void 0}}(this)):p(t)?(o.type="text/plain",o.string=t.getData("text/plain"),null!=(s=this.delegate)&&s.inputControllerWillPaste(o),this.withTargetDOMRange(function(){var t;return null!=(t=this.responder)?t.insertString(o.string):void 0}),this.afterRender=function(e){return function(){var t;return null!=(t=e.delegate)?t.inputControllerDidPaste(o):void 0}}(this)):(n=t.getData("text/html"))?(o.type="text/html",o.html=n,null!=(a=this.delegate)&&a.inputControllerWillPaste(o),this.withTargetDOMRange(function(){var t;return null!=(t=this.responder)?t.insertHTML(o.html):void 0}),this.afterRender=function(e){return function(){var t;return null!=(t=e.delegate)?t.inputControllerDidPaste(o):void 0}}(this)):(null!=(u=t.files)?u.length:void 0)?(o.type="File",o.file=t.files[0],null!=(c=this.delegate)&&c.inputControllerWillPaste(o),this.withTargetDOMRange(function(){var t;return null!=(t=this.responder)?t.insertFile(o.file):void 0}),this.afterRender=function(e){return function(){var t;return null!=(t=e.delegate)?t.inputControllerDidPaste(o):void 0}}(this)):void 0},insertFromYank:function(){return this.insertString(this.event.data)},insertLineBreak:function(){return this.insertString("\n")},insertLink:function(){return this.activateAttributeIfSupported("href",this.event.data)},insertOrderedList:function(){return this.toggleAttributeIfSupported("number")},insertParagraph:function(){var t;return null!=(t=this.delegate)&&t.inputControllerWillPerformTyping(),this.withTargetDOMRange(function(){var t;return null!=(t=this.responder)?t.insertLineBreak():void 0})},insertReplacementText:function(){return this.insertString(this.event.dataTransfer.getData("text/plain"),{updatePosition:!1})},insertText:function(){var t,e;return this.insertString(null!=(t=this.event.data)?t:null!=(e=this.event.dataTransfer)?e.getData("text/plain"):void 0)},insertTranspose:function(){return this.insertString(this.event.data)},insertUnorderedList:function(){return this.toggleAttributeIfSupported("bullet")}},e.prototype.insertString=function(e,n){var t;return null==e&&(e=""),null!=(t=this.delegate)&&t.inputControllerWillPerformTyping(),this.withTargetDOMRange(function(){var t;return null!=(t=this.responder)?t.insertString(e,n):void 0})},e.prototype.toggleAttributeIfSupported=function(e){var t;return d.call(D.getAllAttributeNames(),e)>=0?(null!=(t=this.delegate)&&t.inputControllerWillPerformFormatting(e),this.withTargetDOMRange(function(){var t;return null!=(t=this.responder)?t.toggleCurrentAttribute(e):void 0})):void 0},e.prototype.activateAttributeIfSupported=function(e,n){var t;return d.call(D.getAllAttributeNames(),e)>=0?(null!=(t=this.delegate)&&t.inputControllerWillPerformFormatting(e),this.withTargetDOMRange(function(){var t;return null!=(t=this.responder)?t.setCurrentAttribute(e,n):void 0})):void 0},e.prototype.deleteInDirection=function(n,t){var e,i,o,r;return o=(null!=t?t:{recordUndoEntry:!0}).recordUndoEntry,o&&null!=(r=this.delegate)&&r.inputControllerWillPerformTyping(),i=function(e){return function(){var t;return null!=(t=e.responder)?t.deleteInDirection(n):void 0}}(this),(e=this.getTargetDOMRange({minLength:2}))?this.withTargetDOMRange(e,i):i()},e.prototype.withTargetDOMRange=function(t,e){var n;return"function"==typeof t&&(e=t,t=this.getTargetDOMRange()),t?null!=(n=this.responder)?n.withTargetDOMRange(t,e.bind(this)):void 0:(D.selectionChangeObserver.reset(),e.call(this))},e.prototype.getTargetDOMRange=function(t){var e,n,i,o;return i=(null!=t?t:{minLength:0}).minLength,(o="function"==typeof(e=this.event).getTargetRanges?e.getTargetRanges():void 0)&&o.length&&(n=u(o[0]),0===i||n.toString().length>=i)?n:void 0},u=function(t){var e;return e=document.createRange(),e.setStart(t.startContainer,t.startOffset),e.setEnd(t.endContainer,t.endOffset),e},e.prototype.withEvent=function(t,e){var n;this.event=t;try{n=e.call(this)}finally{this.event=null}return n},r=function(t){var e,n;return d.call(null!=(e=null!=(n=t.dataTransfer)?n.types:void 0)?e:[],"Files")>=0},l=function(t){var e;return(e=t.clipboardData)?d.call(e.types,"Files")>=0&&1===e.types.length&&e.files.length>=1:void 0},h=function(t){var e;return(e=t.clipboardData)?d.call(e.types,"text/plain")>=0&&1===e.types.length:void 0},s=function(t){var e;return e=[],t.altKey&&e.push("alt"),t.shiftKey&&e.push("shift"),e.push(t.key),e},a=function(t){return{x:t.clientX,y:t.clientY}},e}(D.InputController)}.call(this),function(){var s,a,i,u,o,c,l,t,r,h=function(t,e){return function(){return t.apply(e,arguments)}},p=function(t,e){function n(){this.constructor=t}for(var i in e)d.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},d={}.hasOwnProperty;a=D.defer,i=D.escapeHTML,u=D.handleEvent,l=D.makeElement,r=D.tagName,t=D.config,c=t.lang,s=t.css,o=t.keyNames,D.AttachmentEditorController=function(t){function e(t,e,n,i){this.attachmentPiece=t,this.element=e,this.container=n,this.options=null!=i?i:{},this.didBlurCaption=h(this.didBlurCaption,this),this.didChangeCaption=h(this.didChangeCaption,this),this.didInputCaption=h(this.didInputCaption,this),this.didKeyDownCaption=h(this.didKeyDownCaption,this),this.didClickActionButton=h(this.didClickActionButton,this),this.didClickToolbar=h(this.didClickToolbar,this),this.attachment=this.attachmentPiece.attachment,"a"===r(this.element)&&(this.element=this.element.firstChild),this.install()}var n;return p(e,t),n=function(e){return function(){var t;return t=e.apply(this,arguments),t["do"](),null==this.undos&&(this.undos=[]),this.undos.push(t.undo)}},e.prototype.install=function(){return this.makeElementMutable(),this.addToolbar(),this.attachment.isPreviewable()?this.installCaptionEditor():void 0},e.prototype.uninstall=function(){var t,e;for(this.savePendingCaption();e=this.undos.pop();)e();return null!=(t=this.delegate)?t.didUninstallAttachmentEditor(this):void 0},e.prototype.savePendingCaption=function(){var t,e,n;return null!=this.pendingCaption?(t=this.pendingCaption,this.pendingCaption=null,t?null!=(e=this.delegate)&&"function"==typeof e.attachmentEditorDidRequestUpdatingAttributesForAttachment?e.attachmentEditorDidRequestUpdatingAttributesForAttachment({caption:t},this.attachment):void 0:null!=(n=this.delegate)&&"function"==typeof n.attachmentEditorDidRequestRemovingAttributeForAttachment?n.attachmentEditorDidRequestRemovingAttributeForAttachment("caption",this.attachment):void 0):void 0},e.prototype.makeElementMutable=n(function(){return{do:function(t){return function(){return t.element.dataset.trixMutable=!0}}(this),undo:function(t){return function(){return delete t.element.dataset.trixMutable}}(this)}}),e.prototype.addToolbar=n(function(){var e,t,n;return e=l({tagName:"div",className:s.attachmentToolbar,data:{trixMutable:!0}}
1),e.innerHTML='<div class="trix-button-row">\n  <span class="trix-button-group trix-button-group--actions">\n    <button type="button" data-trix-action="remove" class="trix-button trix-button--remove" title="'+c.remove+'">'+c.remove+"</button>\n  </span>\n</div>",this.attachment.isPreviewable()&&(t=i(this.attachment.getFilename()),n=i(this.attachment.getFormattedFilesize()),e.innerHTML+='<div class="'+s.attachmentMetadataContainer+'">\n  <span class="'+s.attachmentMetadata+'">\n    <span class="'+s.attachmentName+'" title="'+t+'">'+t+'</span>\n    <span class="'+s.attachmentSize+'">'+n+"</span>\n  </span>\n</div>"),u("click",{onElement:e,withCallback:this.didClickToolbar}),u("click",{onElement:e,matchingSelector:"[data-trix-action]",withCallback:this.didClickActionButton}),{do:function(t){return function(){return t.element.appendChild(e)}}(this),undo:function(){return function(){return D.removeNode(e)}}(this)}}),e.prototype.installCaptionEditor=n(function(){var e,n,i,o,r;return o=l({tagName:"textarea",className:s.attachmentCaptionEditor,attributes:{placeholder:c.captionPlaceholder},data:{trixMutable:!0}}),o.value=this.attachmentPiece.getCaption(),r=o.cloneNode(),r.classList.add("trix-autoresize-clone"),r.tabIndex=-1,e=function(){return r.value=o.value,o.style.height=r.scrollHeight+"px"},u("input",{onElement:o,withCallback:e}),u("input",{onElement:o,withCallback:this.didInputCaption}),u("keydown",{onElement:o,withCallback:this.didKeyDownCaption}),u("change",{onElement:o,withCallback:this.didChangeCaption}),u("blur",{onElement:o,withCallback:this.didBlurCaption}),i=this.element.querySelector("figcaption"),n=i.cloneNode(),{do:function(t){return function(){return i.style.display="none",n.appendChild(o),n.appendChild(r),n.classList.add(s.attachmentCaption+"--editing"),i.parentElement.insertBefore(n,i),e(),t.options.editCaption?a(function(){return o.focus()}):void 0}}(this),undo:function(){return D.removeNode(n),i.style.display=null}}}),e.prototype.didClickToolbar=function(t){return t.preventDefault(),t.stopPropagation()},e.prototype.didClickActionButton=function(t){var e,n;switch(e=t.target.getAttribute("data-trix-action")){case"remove":return null!=(n=this.delegate)?n.attachmentEditorDidRequestRemovalOfAttachment(this.attachment):void 0}},e.prototype.didKeyDownCaption=function(t){var e;return"return"===o[t.keyCode]?(t.preventDefault(),this.savePendingCaption(),null!=(e=this.delegate)&&"function"==typeof e.attachmentEditorDidRequestDeselectingAttachment?e.attachmentEditorDidRequestDeselectingAttachment(this.attachment):void 0):void 0},e.prototype.didInputCaption=function(t){return this.pendingCaption=t.target.value.replace(/\s/g," ").trim()},e.prototype.didChangeCaption=function(){return this.savePendingCaption()},e.prototype.didBlurCaption=function(){return this.savePendingCaption()},e}(D.BasicObject)}.call(this),function(){var u,n,c,i=function(t,e){function n(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty;c=D.makeElement,u=D.config.css,D.AttachmentView=function(t){function e(){e.__super__.constructor.apply(this,arguments),this.attachment=this.object,this.attachment.uploadProgressDelegate=this,this.attachmentPiece=this.options.piece}var a;return i(e,t),e.attachmentSelector="[data-trix-attachment]",e.prototype.createContentNodes=function(){return[]},e.prototype.createNodes=function(){var t,e,n,i,o,r,s;if(t=i=c({tagName:"figure",className:this.getClassName(),data:this.getData(),editable:!1}),(e=this.getHref())&&(i=c({tagName:"a",editable:!1,attributes:{href:e,tabindex:-1}}),t.appendChild(i)),this.attachment.hasContent())i.innerHTML=this.attachment.getContent();else for(s=this.createContentNodes(),n=0,o=s.length;o>n;n++)r=s[n],i.appendChild(r);return i.appendChild(this.createCaptionElement()),this.attachment.isPending()&&(this.progressElement=c({tagName:"progress",attributes:{class:u.attachmentProgress,value:this.attachment.getUploadProgress(),max:100},data:{trixMutable:!0,trixStoreKey:["progressElement",this.attachment.id].join("/")}}),t.appendChild(this.progressElement)),[a("left"),t,a("right")]},e.prototype.createCaptionElement=function(){var t,e,n,i,o,r,s;return n=c({tagName:"figcaption",className:u.attachmentCaption}),(t=this.attachmentPiece.getCaption())?(n.classList.add(u.attachmentCaption+"--edited"),n.textContent=t):(e=this.getCaptionConfig(),e.name&&(i=this.attachment.getFilename()),e.size&&(r=this.attachment.getFormattedFilesize()),i&&(o=c({tagName:"span",className:u.attachmentName,textContent:i}),n.appendChild(o)),r&&(i&&n.appendChild(document.createTextNode(" ")),s=c({tagName:"span",className:u.attachmentSize,textContent:r}),n.appendChild(s))),n},e.prototype.getClassName=function(){var t,e;return e=[u.attachment,u.attachment+"--"+this.attachment.getType()],(t=this.attachment.getExtension())&&e.push(u.attachment+"--"+t),e.join(" ")},e.prototype.getData=function(){var t,e;return e={trixAttachment:JSON.stringify(this.attachment),trixContentType:this.attachment.getContentType(),trixId:this.attachment.id},t=this.attachmentPiece.attributes,t.isEmpty()||(e.trixAttributes=JSON.stringify(t)),this.attachment.isPending()&&(e.trixSerialize=!1),e},e.prototype.getHref=function(){return n(this.attachment.getContent(),"a")?void 0:this.attachment.getHref()},e.prototype.getCaptionConfig=function(){var t,e,n;return n=this.attachment.getType(),t=D.copyObject(null!=(e=D.config.attachments[n])?e.caption:void 0),"file"===n&&(t.name=!0),t},e.prototype.findProgressElement=function(){var t;return null!=(t=this.findElement())?t.querySelector("progress"):void 0},a=function(t){return c({tagName:"span",textContent:D.ZERO_WIDTH_SPACE,data:{trixCursorTarget:t,trixSerialize:!1}})},e.prototype.attachmentDidChangeUploadProgress=function(){var t,e;return e=this.attachment.getUploadProgress(),null!=(t=this.findProgressElement())?t.value=e:void 0},e}(D.ObjectView),n=function(t,e){var n;return n=c("div"),n.innerHTML=null!=t?t:"",n.querySelector(e)}}.call(this),function(){var n,i=function(t,e){function n(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty;n=D.makeElement,D.PreviewableAttachmentView=function(t){function e(){e.__super__.constructor.apply(this,arguments),this.attachment.previewDelegate=this}return i(e,t),e.prototype.createContentNodes=function(){return this.image=n({tagName:"img",attributes:{src:""},data:{trixMutable:!0}}),this.refresh(this.image),[this.image]},e.prototype.createCaptionElement=function(){var t;return t=e.__super__.createCaptionElement.apply(this,arguments),t.textContent||t.setAttribute("data-trix-placeholder",D.config.lang.captionPlaceholder),t},e.prototype.refresh=function(t){var e;return null==t&&(t=null!=(e=this.findElement())?e.querySelector("img"):void 0),t?this.updateAttributesForImage(t):void 0},e.prototype.updateAttributesForImage=function(t){var e,n,i,o,r,s;return r=this.attachment.getURL(),n=this.attachment.getPreviewURL(),t.src=n||r,n===r?t.removeAttribute("data-trix-serialized-attributes"):(i=JSON.stringify({src:r}),t.setAttribute("data-trix-serialized-attributes",i)),s=this.attachment.getWidth(),e=this.attachment.getHeight(),null!=s&&(t.width=s),null!=e&&(t.height=e),o=["imageElement",this.attachment.id,t.src,t.width,t.height].join("/"),t.dataset.trixStoreKey=o},e.prototype.attachmentDidChangeAttributes=function(){return this.refresh(this.image),this.refresh()},e}(D.AttachmentView)}.call(this),function(){var s,c,l,i=function(t,e){function n(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty;l=D.makeElement,s=D.findInnerElement,c=D.getTextConfig,D.PieceView=function(t){function e(){var t;e.__super__.constructor.apply(this,arguments),this.piece=this.object,this.attributes=this.piece.getAttributes(),t=this.options,this.textConfig=t.textConfig,this.context=t.context,this.piece.attachment?this.attachment=this.piece.attachment:this.string=this.piece.toString()}var n;return i(e,t),e.prototype.createNodes=function(){var t,e,n,i,o,r;if(r=this.attachment?this.createAttachmentNodes():this.createStringNodes(),t=this.createElement()){for(n=s(t),e=0,i=r.length;i>e;e++)o=r[e],n.appendChild(o);r=[t]}return r},e.prototype.createAttachmentNodes=function(){var t,e;return t=this.attachment.isPreviewable()?D.PreviewableAttachmentView:D.AttachmentView,e=this.createChildView(t,this.piece.attachment,{piece:this.piece}),e.getNodes()},e.prototype.createStringNodes=function(){var t,e,n,i,o,r,s,a,u,c;if(null!=(a=this.textConfig)?a.plaintext:void 0)return[document.createTextNode(this.string)];for(s=[],u=this.string.split("\n"),n=e=0,i=u.length;i>e;n=++e)c=u[n],n>0&&(t=l("br"),s.push(t)),(o=c.length)&&(r=document.createTextNode(this.preserveSpaces(c)),s.push(r));return s},e.prototype.createElement=function(){var t,e,n,i,o,r,s,a,u;a={},r=this.attributes;for(i in r)if(u=r[i],(t=c(i))&&(t.tagName&&(o=l(t.tagName),n?(n.appendChild(o),n=o):e=n=o),t.styleProperty&&(a[t.styleProperty]=u),t.style)){s=t.style;for(i in s)u=s[i],a[i]=u}if(Object.keys(a).length){null==e&&(e=l("span"));for(i in a)u=a[i],e.style[i]=u}return e},e.prototype.createContainerElement=function(){var t,e,n,i,o;i=this.attributes;for(n in i)if(o=i[n],(e=c(n))&&e.groupTagName)return t={},t[n]=o,l(e.groupTagName,t)},n=D.NON_BREAKING_SPACE,e.prototype.preserveSpaces=function(t){return this.context.
1isLast&&(t=t.replace(/\ $/,n)),t=t.replace(/(\S)\ {3}(\S)/g,"$1 "+n+" $2").replace(/\ {2}/g,n+" ").replace(/\ {2}/g," "+n),(this.context.isFirst||this.context.followsWhitespace)&&(t=t.replace(/^\ /,n)),t},e}(D.ObjectView)}.call(this),function(){var n=function(t,e){function n(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty;D.TextView=function(t){function e(){e.__super__.constructor.apply(this,arguments),this.text=this.object,this.textConfig=this.options.textConfig}var l;return n(e,t),e.prototype.createNodes=function(){var t,e,n,i,o,r,s,a,u,c;for(r=[],a=D.ObjectGroup.groupObjects(this.getPieces()),i=a.length-1,n=e=0,o=a.length;o>e;n=++e)s=a[n],t={},0===n&&(t.isFirst=!0),n===i&&(t.isLast=!0),l(u)&&(t.followsWhitespace=!0),c=this.findOrCreateCachedChildView(D.PieceView,s,{textConfig:this.textConfig,context:t}),r.push.apply(r,c.getNodes()),u=s;return r},e.prototype.getPieces=function(){var t,e,n,i,o;for(i=this.text.getPieces(),o=[],t=0,e=i.length;e>t;t++)n=i[t],n.hasAttribute("blockBreak")||o.push(n);return o},l=function(t){return/\s$/.test(null!=t?t.toString():void 0)},e}(D.ObjectView)}.call(this),function(){var r,c,l,n=function(t,e){function n(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty;l=D.makeElement,c=D.getBlockConfig,r=D.config.css,D.BlockView=function(t){function e(){e.__super__.constructor.apply(this,arguments),this.block=this.object,this.attributes=this.block.getAttributes()}return n(e,t),e.prototype.createNodes=function(){var t,e,n,i,o,r,s,a,u;if(t=document.createComment("block"),r=[t],this.block.isEmpty()?r.push(l("br")):(a=null!=(s=c(this.block.getLastAttribute()))?s.text:void 0,u=this.findOrCreateCachedChildView(D.TextView,this.block.text,{textConfig:a}),r.push.apply(r,u.getNodes()),this.shouldAddExtraNewlineElement()&&r.push(l("br"))),this.attributes.length)return r;for(e=l(D.config.blockAttributes["default"].tagName),n=0,i=r.length;i>n;n++)o=r[n],e.appendChild(o);return[e]},e.prototype.createContainerElement=function(t){var e,n,i,o;return e=this.attributes[t],o=c(e).tagName,n={tagName:o},"attachmentGallery"===e&&(i=this.block.getBlockBreakPosition(),n.className=r.attachmentGallery+" "+r.attachmentGallery+"--"+i),l(n)},e.prototype.shouldAddExtraNewlineElement=function(){return/\n\n$/.test(this.block.toString())},e}(D.ObjectView)}.call(this),function(){var o,a,r=function(t,e){function n(){this.constructor=t}for(var i in e)s.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;o=D.defer,a=D.makeElement,D.DocumentView=function(t){function e(){e.__super__.constructor.apply(this,arguments),this.element=this.options.element,this.elementStore=new D.ElementStore,this.setDocument(this.object)}var n,l,i;return r(e,t),e.render=function(t){var e,n;return e=a("div"),n=new this(t,{element:e}),n.render(),n.sync(),e},e.prototype.setDocument=function(t){return t.isEqualTo(this.document)?void 0:this.document=this.object=t},e.prototype.render=function(){var t,e,o,n,i,r,s;if(this.childViews=[],this.shadowElement=a("div"),!this.document.isEmpty()){for(i=D.ObjectGroup.groupObjects(this.document.getBlocks(),{asTree:!0}),r=[],t=0,e=i.length;e>t;t++)n=i[t],s=this.findOrCreateCachedChildView(D.BlockView,n),r.push(function(){var t,e,n,i;for(n=s.getNodes(),i=[],t=0,e=n.length;e>t;t++)o=n[t],i.push(this.shadowElement.appendChild(o));return i}.call(this));return r}},e.prototype.isSynced=function(){return n(this.shadowElement,this.element)},e.prototype.sync=function(){var t;for(t=this.createDocumentFragmentForSync();this.element.lastChild;)this.element.removeChild(this.element.lastChild);return this.element.appendChild(t),this.didSync()},e.prototype.didSync=function(){return this.elementStore.reset(l(this.element)),o(function(t){return function(){return t.garbageCollectCachedViews()}}(this))},e.prototype.createDocumentFragmentForSync=function(){var t,e,n,i,o,r,s,a,u,c;for(e=document.createDocumentFragment(),a=this.shadowElement.childNodes,n=0,o=a.length;o>n;n++)s=a[n],e.appendChild(s.cloneNode(!0));for(u=l(e),i=0,r=u.length;r>i;i++)t=u[i],(c=this.elementStore.remove(t))&&t.parentNode.replaceChild(c,t);return e},l=function(t){return t.querySelectorAll("[data-trix-store-key]")},n=function(t,e){return i(t.innerHTML)===i(e.innerHTML)},i=function(t){return t.replace(/&nbsp;/g," ")},e}(D.ObjectView)}.call(this),function(){var n,i,r,o,s,a=function(t,e){return function(){return t.apply(e,arguments)}},u=function(t,e){function n(){this.constructor=t}for(var i in e)c.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},c={}.hasOwnProperty;r=D.findClosestElementFromNode,o=D.handleEvent,s=D.innerElementIsActive,i=D.defer,n=D.AttachmentView.attachmentSelector,D.CompositionController=function(t){function e(t,e){this.element=t,this.composition=e,this.didClickAttachment=a(this.didClickAttachment,this),this.didBlur=a(this.didBlur,this),this.didFocus=a(this.didFocus,this),this.documentView=new D.DocumentView(this.composition.document,{element:this.element}),o("focus",{onElement:this.element,withCallback:this.didFocus}),o("blur",{onElement:this.element,withCallback:this.didBlur}),o("click",{onElement:this.element,matchingSelector:"a[contenteditable=false]",preventDefault:!0}),o("mousedown",{onElement:this.element,matchingSelector:n,withCallback:this.didClickAttachment}),o("click",{onElement:this.element,matchingSelector:"a"+n,preventDefault:!0})}return u(e,t),e.prototype.didFocus=function(){var t,e,n;return t=function(e){return function(){var t;return e.focused?void 0:(e.focused=!0,null!=(t=e.delegate)&&"function"==typeof t.compositionControllerDidFocus?t.compositionControllerDidFocus():void 0)}}(this),null!=(e=null!=(n=this.blurPromise)?n.then(t):void 0)?e:t()},e.prototype.didBlur=function(){return this.blurPromise=new Promise(function(n){return function(e){return i(function(){var t;return s(n.element)||(n.focused=null,null!=(t=n.delegate)&&"function"==typeof t.compositionControllerDidBlur&&t.compositionControllerDidBlur()),n.blurPromise=null,e()})}}(this))},e.prototype.didClickAttachment=function(t,e){var n,i,o;return n=this.findAttachmentForElement(e),i=null!=r(t.target,{matchingSelector:"figcaption"}),null!=(o=this.delegate)&&"function"==typeof o.compositionControllerDidSelectAttachment?o.compositionControllerDidSelectAttachment(n,{editCaption:i}):void 0},e.prototype.getSerializableElement=function(){return this.isEditingAttachment()?this.documentView.shadowElement:this.element},e.prototype.render=function(){var t,e,n;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!=(t=this.delegate)&&"function"==typeof t.compositionControllerWillSyncDocumentView&&t.compositionControllerWillSyncDocumentView(),this.documentView.sync(),null!=(e=this.delegate)&&"function"==typeof e.compositionControllerDidSyncDocumentView&&e.compositionControllerDidSyncDocumentView()),null!=(n=this.delegate)&&"function"==typeof n.compositionControllerDidRender?n.compositionControllerDidRender():void 0},e.prototype.rerenderViewForObject=function(t){return this.invalidateViewForObject(t),this.render()},e.prototype.invalidateViewForObject=function(t){return this.documentView.invalidateViewForObject(t)},e.prototype.isViewCachingEnabled=function(){return this.documentView.isViewCachingEnabled()},e.prototype.enableViewCaching=function(){return this.documentView.enableViewCaching()},e.prototype.disableViewCaching=function(){return this.documentView.disableViewCaching()},e.prototype.refreshViewCache=function(){return this.documentView.garbageCollectCachedViews()},e.prototype.isEditingAttachment=function(){return null!=this.attachmentEditor},e.prototype.installAttachmentEditorForAttachment=function(t,e){var n,i,o;if((null!=(o=this.attachmentEditor)?o.attachment:void 0)!==t&&(i=this.documentView.findElementForOb
1ject(t)))return this.uninstallAttachmentEditor(),n=this.composition.document.getAttachmentPieceForAttachment(t),this.attachmentEditor=new D.AttachmentEditorController(n,i,this.element,e),this.attachmentEditor.delegate=this},e.prototype.uninstallAttachmentEditor=function(){var t;return null!=(t=this.attachmentEditor)?t.uninstall():void 0},e.prototype.didUninstallAttachmentEditor=function(){return this.attachmentEditor=null,this.render()},e.prototype.attachmentEditorDidRequestUpdatingAttributesForAttachment=function(t,e){var n;return null!=(n=this.delegate)&&"function"==typeof n.compositionControllerWillUpdateAttachment&&n.compositionControllerWillUpdateAttachment(e),this.composition.updateAttributesForAttachment(t,e)},e.prototype.attachmentEditorDidRequestRemovingAttributeForAttachment=function(t,e){var n;return null!=(n=this.delegate)&&"function"==typeof n.compositionControllerWillUpdateAttachment&&n.compositionControllerWillUpdateAttachment(e),this.composition.removeAttributeForAttachment(t,e)},e.prototype.attachmentEditorDidRequestRemovalOfAttachment=function(t){var e;return null!=(e=this.delegate)&&"function"==typeof e.compositionControllerDidRequestRemovalOfAttachment?e.compositionControllerDidRequestRemovalOfAttachment(t):void 0},e.prototype.attachmentEditorDidRequestDeselectingAttachment=function(t){var e;return null!=(e=this.delegate)&&"function"==typeof e.compositionControllerDidRequestDeselectingAttachment?e.compositionControllerDidRequestDeselectingAttachment(t):void 0},e.prototype.canSyncDocumentView=function(){return!this.isEditingAttachment()},e.prototype.findAttachmentForElement=function(t){return this.composition.document.getAttachmentById(parseInt(t.dataset.trixId,10))},e}(D.BasicObject)}.call(this),function(){var d,f,g,m=function(t,e){return function(){return t.apply(e,arguments)}},v=function(t,e){function n(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty;f=D.handleEvent,g=D.triggerEvent,d=D.findClosestElementFromNode,D.ToolbarController=function(t){function e(t){this.element=t,this.didKeyDownDialogInput=m(this.didKeyDownDialogInput,this),this.didClickDialogButton=m(this.didClickDialogButton,this),this.didClickAttributeButton=m(this.didClickAttributeButton,this),this.didClickActionButton=m(this.didClickActionButton,this),this.attributes={},this.actions={},this.resetDialogInputs(),f("mousedown",{onElement:this.element,matchingSelector:s,withCallback:this.didClickActionButton}),f("mousedown",{onElement:this.element,matchingSelector:a,withCallback:this.didClickAttributeButton}),f("click",{onElement:this.element,matchingSelector:l,preventDefault:!0}),f("click",{onElement:this.element,matchingSelector:i,withCallback:this.didClickDialogButton}),f("keydown",{onElement:this.element,matchingSelector:r,withCallback:this.didKeyDownDialogInput})}var s,n,a,i,r,o,u,h,c,p,l;return v(e,t),a="[data-trix-attribute]",s="[data-trix-action]",l=a+", "+s,o="[data-trix-dialog]",n=o+"[data-trix-active]",i=o+" [data-trix-method]",r=o+" [data-trix-input]",e.prototype.didClickActionButton=function(t,e){var n,i,o;return null!=(i=this.delegate)&&i.toolbarDidClickButton(),t.preventDefault(),n=u(e),this.getDialog(n)?this.toggleDialog(n):null!=(o=this.delegate)?o.toolbarDidInvokeAction(n):void 0},e.prototype.didClickAttributeButton=function(t,e){var n,i,o;return null!=(i=this.delegate)&&i.toolbarDidClickButton(),t.preventDefault(),n=h(e),this.getDialog(n)?this.toggleDialog(n):null!=(o=this.delegate)&&o.toolbarDidToggleAttribute(n),this.refreshAttributeButtons()},e.prototype.didClickDialogButton=function(t,e){var n,i;return n=d(e,{matchingSelector:o}),i=e.getAttribute("data-trix-method"),this[i].call(this,n)},e.prototype.didKeyDownDialogInput=function(t,e){var n,i;return 13===t.keyCode&&(t.preventDefault(),n=e.getAttribute("name"),i=this.getDialog(n),this.setAttribute(i)),27===t.keyCode?(t.preventDefault(),this.hideDialog()):void 0},e.prototype.updateActions=function(t){return this.actions=t,this.refreshActionButtons()},e.prototype.refreshActionButtons=function(){return this.eachActionButton(function(n){return function(t,e){return t.disabled=n.actions[e]===!1}}(this))},e.prototype.eachActionButton=function(t){var e,n,i,o,r;for(o=this.element.querySelectorAll(s),r=[],n=0,i=o.length;i>n;n++)e=o[n],r.push(t(e,u(e)));return r},e.prototype.updateAttributes=function(t){return this.attributes=t,this.refreshAttributeButtons()},e.prototype.refreshAttributeButtons=function(){return this.eachAttributeButton(function(n){return function(t,e){return t.disabled=n.attributes[e]===!1,n.attributes[e]||n.dialogIsVisible(e)?(t.setAttribute("data-trix-active",""),t.classList.add("trix-active")):(t.removeAttribute("data-trix-active"),t.classList.remove("trix-active"))}}(this))},e.prototype.eachAttributeButton=function(t){var e,n,i,o,r;for(o=this.element.querySelectorAll(a),r=[],n=0,i=o.length;i>n;n++)e=o[n],r.push(t(e,h(e)));return r},e.prototype.applyKeyboardCommand=function(t){var e,n,i,o,r,s,a;for(r=JSON.stringify(t.sort()),a=this.element.querySelectorAll("[data-trix-key]"),o=0,s=a.length;s>o;o++)if(e=a[o],i=e.getAttribute("data-trix-key").split("+"),n=JSON.stringify(i.sort()),n===r)return g("mousedown",{onElement:e}),!0;return!1},e.prototype.dialogIsVisible=function(t){var e;return(e=this.getDialog(t))?e.hasAttribute("data-trix-active"):void 0},e.prototype.toggleDialog=function(t){return this.dialogIsVisible(t)?this.hideDialog():this.showDialog(t)}
1,e.prototype.showDialog=function(t){var e,n,i,o,r,s,a,u,c,l;for(this.hideDialog(),null!=(a=this.delegate)&&a.toolbarWillShowDialog(),i=this.getDialog(t),i.setAttribute("data-trix-active",""),i.classList.add("trix-active"),u=i.querySelectorAll("input[disabled]"),o=0,s=u.length;s>o;o++)n=u[o],n.removeAttribute("disabled");return(e=h(i))&&(r=p(i,t))&&(r.value=null!=(c=this.attributes[e])?c:"",r.select()),null!=(l=this.delegate)?l.toolbarDidShowDialog(t):void 0},e.prototype.setAttribute=function(t){var e,n,i;return e=h(t),n=p(t,e),n.willValidate&&!n.checkValidity()?(n.setAttribute("data-trix-validate",""),n.classList.add("trix-validate"),n.focus()):(null!=(i=this.delegate)&&i.toolbarDidUpdateAttribute(e,n.value),this.hideDialog())},e.prototype.removeAttribute=function(t){var e,n;return e=h(t),null!=(n=this.delegate)&&n.toolbarDidRemoveAttribute(e),this.hideDialog()},e.prototype.hideDialog=function(){var t,e;return(t=this.element.querySelector(n))?(t.removeAttribute("data-trix-active"),t.classList.remove("trix-active"),this.resetDialogInputs(),null!=(e=this.delegate)?e.toolbarDidHideDialog(c(t)):void 0):void 0},e.prototype.resetDialogInputs=function(){var t,e,n,i,o;for(i=this.element.querySelectorAll(r),o=[],t=0,n=i.length;n>t;t++)e=i[t],e.setAttribute("disabled","disabled"),e.removeAttribute("data-trix-validate"),o.push(e.classList.remove("trix-validate"));return o},e.prototype.getDialog=function(t){return this.element.querySelector("[data-trix-dialog="+t+"]")},p=function(t,e){return null==e&&(e=h(t)),t.querySelector("[data-trix-input][name='"+e+"']")},u=function(t){return t.getAttribute("data-trix-action")},h=function(t){var e;return null!=(e=t.getAttribute("data-trix-attribute"))?e:t.getAttribute("data-trix-dialog-attribute")},c=function(t){return t.getAttribute("data-trix-dialog")},e}(D.BasicObject)}.call(this),function(){var n=function(t,e){function n(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty;D.ImagePreloadOperation=function(t){function e(t){this.url=t}return n(e,t),e.prototype.perform=function(e){var n;return n=new Image,n.onload=function(t){return function(){return n.width=t.width=n.naturalWidth,n.height=t.height=n.naturalHeight,e(!0,n)}}(this),n.onerror=function(){return e(!1)},n.src=this.url},e}(D.Operation)}.call(this),function(){var n=function(t,e){return function(){return t.apply(e,arguments)}},i=function(t,e){function n(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty;D.Attachment=function(t){function e(t){null==t&&(t={}),this.releaseFile=n(this.releaseFile,this),e.__super__.constructor.apply(this,arguments),this.attributes=D.Hash.box(t),this.didChangeAttributes()}return i(e,t),e.previewablePattern=/^image(\/(gif|png|jpe?g)|$)/,e.attachmentForFile=function(t){var e,n;return n=this.attributesForFile(t),e=new this(n),e.setFile(t),e},e.attributesForFile=function(t){return new D.Hash({filename:t.name,filesize:t.size,contentType:t.type})},e.fromJSON=function(t){return new this(t)},e.prototype.getAttribute=function(t){return this.attributes.get(t)},e.prototype.hasAttribute=function(t){return this.attributes.has(t)},e.prototype.getAttributes=function(){return this.attributes.toObject()},e.prototype.setAttributes=function(t){var e,n,i;return null==t&&(t={}),e=this.attributes.merge(t),this.attributes.isEqualTo(e)?void 0:(this.attributes=e,this.didChangeAttributes(),null!=(n=this.previewDelegate)&&"function"==typeof n.attachmentDidChangeAttributes&&n.attachmentDidChangeAttributes(this),null!=(i=this.delegate)&&"function"==typeof i.attachmentDidChangeAttributes?i.attachmentDidChangeAttributes(this):void 0)},e.prototype.didChangeAttributes=function(){return this.isPreviewable()?this.preloadURL():void 0},e.prototype.isPending=function(){return null!=this.file&&!(this.getURL()||this.getHref())},e.prototype.isPreviewable=function(){return this.attributes.has("previewable")?this.attributes.get("previewable"):this.constructor.previewablePattern.test(this.getContentType())},e.prototype.getType=function(){return this.hasContent()?"content":this.isPreviewable()?"preview":"file"},e.prototype.getURL=function(){return this.attributes.get("url")},e.prototype.getHref=function(){return this.attributes.get("href")},e.prototype.getFilename=function(){var t;return null!=(t=this.attributes.get("filename"))?t:""},e.prototype.getFilesize=function(){return this.attributes.get("filesize")},e.prototype.getFormattedFilesize=function(){var t;return t=this.attributes.get("filesize"),"number"==typeof t?D.config.fileSize.formatter(t):""},e.prototype.getExtension=function(){var t;return null!=(t=this.getFilename().match(/\.(\w+)$/))?t[1].toLowerCase():void 0},e.prototype.getContentType=function(){return this.attributes.get("contentType")},e.prototype.hasContent=function(){return this.attributes.has("content")},e.prototype.getContent=function(){return this.attributes.get("content")},e.prototype.getWidth=function(){return this.attributes.get("width")},e.prototype.getHeight=function(){return this.attributes.get("height")},e.prototype.getFile=function(){return this.file},e.prototype.setFile=function(t){return this.file=t,this.isPreviewable()?this.preloadFile():void 0},e.prototype.releaseFile=function(){return this.releasePreloadedFile(),this.file=null},e.prototype.getUploadProgress=function(){var t;return null!=(t=this.uploadProgress)?t:0},e.prototype.setUploadProgress=function(t){var e;return this.uploadProgress!==t?(this.uploadProgress=t,null!=(e=this.uploadProgressDelegate)&&"function"==typeof e.attachmentDidChangeUploadProgress?e.attachmentDidChangeUploadProgress(this):void 0):void 0},e.prototype.toJSON=function(){return this.getAttributes()},e.prototype.getCacheKey=function(){return[e.__super__.getCacheKey.apply(this,arguments),this.attributes.getCacheKey(),this.getPreviewURL()].join("/")},e.prototype.getPreviewURL=function(){return this.previewURL||this.preloadingURL},e.prototype.setPreviewURL=function(t){var e,n;
1return t!==this.getPreviewURL()?(this.previewURL=t,null!=(e=this.previewDelegate)&&"function"==typeof e.attachmentDidChangeAttributes&&e.attachmentDidChangeAttributes(this),null!=(n=this.delegate)&&"function"==typeof n.attachmentDidChangePreviewURL?n.attachmentDidChangePreviewURL(this):void 0):void 0},e.prototype.preloadURL=function(){return this.preload(this.getURL(),this.releaseFile)},e.prototype.preloadFile=function(){return this.file?(this.fileObjectURL=URL.createObjectURL(this.file),this.preload(this.fileObjectURL)):void 0},e.prototype.releasePreloadedFile=function(){return this.fileObjectURL?(URL.revokeObjectURL(this.fileObjectURL),this.fileObjectURL=null):void 0},e.prototype.preload=function(o,r){var t;return o&&o!==this.getPreviewURL()?(this.preloadingURL=o,t=new D.ImagePreloadOperation(o),t.then(function(i){return function(t){var e,n;return n=t.width,e=t.height,i.getWidth()&&i.getHeight()||i.setAttributes({width:n,height:e}),i.preloadingURL=null,i.setPreviewURL(o),"function"==typeof r?r():void 0}}(this))["catch"](function(t){return function(){return t.preloadingURL=null,"function"==typeof r?r():void 0}}(this))):void 0},e}(D.Object)}.call(this),function(){var e=function(t,e){function n(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty;D.Piece=function(t){function n(t,e){null==e&&(e={}),n.__super__.constructor.apply(this,arguments),this.attributes=D.Hash.box(e)}return e(n,t),n.types={},n.registerType=function(t,e){return e.type=t,this.types[t]=e},n.fromJSON=function(t){var e;return(e=this.types[t.type])?e.fromJSON(t):void 0},n.prototype.copyWithAttributes=function(t){return new this.constructor(this.getValue(),t)},n.prototype.copyWithAdditionalAttributes=function(t){return this.copyWithAttributes(this.attributes.merge(t))},n.prototype.copyWithoutAttribute=function(t){return this.copyWithAttributes(this.attributes.remove(t))},n.prototype.copy=function(){return this.copyWithAttributes(this.attributes)},n.prototype.getAttribute=function(t){return this.attributes.get(t)},n.prototype.getAttributesHash=function(){return this.attributes},n.prototype.getAttributes=function(){return this.attributes.toObject()},n.prototype.getCommonAttributes=function(){var e,n,t;return(t=pieceList.getPieceAtIndex(0))?(e=t.attributes,n=e.getKeys(),pieceList.eachPiece(function(t){return n=e.getKeysCommonToHash(t.attributes),e=e.slice(n)}),e.toObject()):{}},n.prototype.hasAttribute=function(t){return this.attributes.has(t)},n.prototype.hasSameStringValueAsPiece=function(t){return null!=t&&this.toString()===t.toString()},n.prototype.hasSameAttributesAsPiece=function(t){return null!=t&&(this.attributes===t.attributes||this.attributes.isEqualTo(t.attributes))},n.prototype.isBlockBreak=function(){return!1},n.prototype.isEqualTo=function(t){return n.__super__.isEqualTo.apply(this,arguments)||this.hasSameConstructorAs(t)&&this.hasSameStringValueAsPiece(t)&&this.hasSameAttributesAsPiece(t)},n.prototype.isEmpty=function(){return 0===this.length},n.prototype.isSerializable=function(){return!0},n.prototype.toJSON=function(){return{type:this.constructor.type,attributes:this.getAttributes()}},n.prototype.contentsForInspection=function(){return{type:this.constructor.type,attributes:this.attributes.inspect()}},n.prototype.canBeGrouped=function(){return this.hasAttribute("href")},n.prototype.canBeGroupedWith=function(t){return this.getAttribute("href")===t.getAttribute("href")},n.prototype.getLength=function(){return this.length},n.prototype.canBeConsolidatedWith=function(){return!1},n}(D.Object)}.call(this),function(){var e=function(t,e){function n(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty;D.Piece.registerType("attachment",D.AttachmentPiece=function(t){function n(t){this.attachment=t,n.__super__.constructor.apply(this,arguments),this.length=1,this.ensureAttachmentExclusivelyHasAttribute("href"),this.attachment.hasContent()||this.removeProhibitedAttributes()}return e(n,t),n.fromJSON=function(t){return new this(D.Attachment.fromJSON(t.attachment),t.attributes)},n.permittedAttributes=["caption","presentation"],n.prototype.ensureAttachmentExclusivelyHasAttribute=function(t){return this.hasAttribute(t)?(this.attachment.hasAttribute(t)||this.attachment.setAttributes(this.attributes.slice(t)),this.attributes=this.attributes.remove(t)):void 0},n.prototype.removeProhibitedAttributes=function(){var t;return t=this.attributes.slice(this.constructor.permittedAttributes),t.isEqualTo(this.attributes)?void 0:this.attributes=t},n.prototype.getValue=function(){return this.attachment},n.prototype.isSerializable=function(){return!this.attachment.isPending()},n.prototype.getCaption=function(){var t;return null!=(t=this.attributes.get("caption"))?t:""},n.prototype.isEqualTo=function(t){var e;return n.__super__.isEqualTo.apply(this,arguments)&&this.attachment.id===(null!=t&&null!=(e=t.attachment)?e.id:void 0)},n.prototype.toString=function(){return D.OBJECT_REPLACEMENT_CHARACTER},n.prototype.toJSON=function(){var t;return t=n.__super__.toJSON.apply(this,arguments),t.attachment=this.attachment,t},n.prototype.getCacheKey=function(){return[n.__super__.getCacheKey.apply(this,arguments),this.attachment.getCacheKey()].join("/")},n.prototype.toConsole=function(){return JSON.stringify(this.toString())},n}(D.Piece))}.call(this),function(){var n,i=function(t,e){function n(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty;
1n=D.normalizeNewlines,D.Piece.registerType("string",D.StringPiece=function(t){function e(t){e.__super__.constructor.apply(this,arguments),this.string=n(t),this.length=this.string.length}return i(e,t),e.fromJSON=function(t){return new this(t.string,t.attributes)},e.prototype.getValue=function(){return this.string},e.prototype.toString=function(){return this.string.toString()},e.prototype.isBlockBreak=function(){return"\n"===this.toString()&&this.getAttribute("blockBreak")===!0},e.prototype.toJSON=function(){var t;return t=e.__super__.toJSON.apply(this,arguments),t.string=this.string,t},e.prototype.canBeConsolidatedWith=function(t){return null!=t&&this.hasSameConstructorAs(t)&&this.hasSameAttributesAsPiece(t)},e.prototype.consolidateWith=function(t){return new this.constructor(this.toString()+t.toString(),this.attributes)},e.prototype.splitAtOffset=function(t){var e,n;return 0===t?(e=null,n=this):t===this.length?(e=this,n=null):(e=new this.constructor(this.string.slice(0,t),this.attributes),n=new this.constructor(this.string.slice(t),this.attributes)),[e,n]},e.prototype.toConsole=function(){var t;return t=this.string,t.length>15&&(t=t.slice(0,14)+"…"),JSON.stringify(t.toString())},e}(D.Piece))}.call(this),function(){var i,o=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty,s=[].slice;i=D.spliceArray,D.SplittableList=function(t){function e(t){null==t&&(t=[]),e.__super__.constructor.apply(this,arguments),this.objects=t.slice(0),this.length=this.objects.length}var a,n,u;return o(e,t),e.box=function(t){return t instanceof this?t:new this(t)},e.prototype.indexOf=function(t){return this.objects.indexOf(t)},e.prototype.splice=function(){var t;return t=1<=arguments.length?s.call(arguments,0):[],new this.constructor(i.apply(null,[this.objects].concat(s.call(t))))},e.prototype.eachObject=function(t){var e,n,i,o,r,s;for(r=this.objects,s=[],n=e=0,i=r.length;i>e;n=++e)o=r[n],s.push(t(o,n));return s},e.prototype.insertObjectAtIndex=function(t,e){return this.splice(e,0,t)},e.prototype.insertSplittableListAtIndex=function(t,e){return this.splice.apply(this,[e,0].concat(s.call(t.objects)))},e.prototype.insertSplittableListAtPosition=function(t,e){var n,i,o;return o=this.splitObjectAtPosition(e),i=o[0],n=o[1],new this.constructor(i).insertSplittableListAtIndex(t,n)},e.prototype.editObjectAtIndex=function(t,e){return this.replaceObjectAtIndex(e(this.objects[t]),t)},e.prototype.replaceObjectAtIndex=function(t,e){return this.splice(e,1,t)},e.prototype.removeObjectAtIndex=function(t){return this.splice(t,1)},e.prototype.getObjectAtIndex=function(t){return this.objects[t]},e.prototype.getSplittableListInRange=function(t){var e,n,i,o;return i=this.splitObjectsAtRange(t),n=i[0],e=i[1],o=i[2],new this.constructor(n.slice(e,o+1))},e.prototype.selectSplittableList=function(o){var r,t;return t=function(){var t,e,n,i;for(n=this.objects,i=[],t=0,e=n.length;e>t;t++)r=n[t],o(r)&&i.push(r);return i}.call(this),new this.constructor(t)},e.prototype.removeObjectsInRange=function(t){var e,n,i,o;return i=this.splitObjectsAtRange(t),n=i[0],e=i[1],o=i[2],new this.constructor(n).splice(e,o-e+1)},e.prototype.transformObjectsInRange=function(t,i){var o,r,s,a,e,u,n;return e=this.splitObjectsAtRange(t),a=e[0],r=e[1],u=e[2],n=function(){var t,e,n;for(n=[],o=t=0,e=a.length;e>t;o=++t)s=a[o],n.push(o>=r&&u>=o?i(s):s);return n}(),new this.constructor(n)},e.prototype.splitObjectsAtRange=function(t){var e,n,i,o,r,s;return o=this.splitObjectAtPosition(u(t)),n=o[0],e=o[1],i=o[2],r=new this.constructor(n).splitObjectAtPosition(a(t)+i),n=r[0],s=r[1],[n,e,s-1]},e.prototype.getObjectAtPosition=function(t){var e,n,i;return i=this.findIndexAndOffsetAtPosition(t),e=i.index,n=i.offset,this.objects[e]},e.prototype.splitObjectAtPosition=function(t){var e,n,i,o,r,s,a,u,c,l;return s=this.findIndexAndOffsetAtPosition(t),e=s.index,r=s.offset,o=this.objects.slice(0),null!=e?0===r?(c=e,l=0):(i=this.getObjectAtIndex(e),a=i.splitAtOffset(r),n=a[0],u=a[1],o.splice(e,1,n,u),c=e+1,l=n.getLength()-r):(c=o.length,l=0),[o,c,l]},e.prototype.consolidate=function(){var t,e,n,i,o,r;for(i=[],o=this.objects[0],r=this.objects.slice(1),t=0,e=r.length;e>t;t++)n=r[t],("function"==typeof o.canBeConsolidatedWith?o.canBeConsolidatedWith(n):void 0)?o=o.consolidateWith(n):(i.push(o),o=n);return null!=o&&i.push(o),new this.constructor(i)},e.prototype.consolidateFromIndexToIndex=function(t,e){var n,i,o;return i=this.objects.slice(0),o=i.slice(t,e+1),n=new this.constructor(o).consolidate().toArray(),this.splice.apply(this,[t,o.length].concat(s.call(n)))},e.prototype.findIndexAndOffsetAtPosition=function(t){var e,n,i,o,r,s,a;for(e=0,a=this.objects,i=n=0,o=a.length;o>n;i=++n){if(s=a[i],r=e+s.getLength(),t>=e&&r>t)return{index:i,offset:t-e};e=r}return{index:null,offset:null}},e.prototype.findPositionAtIndexAndOffset=function(t,e){var n,i,o,r,s,a;for(s=0,a=this.objects,n=i=0,o=a.length;o>i;n=++i)if(r=a[n],t>n)s+=r.getLength();else if(n===t){s+=e;break}return s},e.prototype.getEndPosition=function(){var i,o;return null!=this.endPosition?this.endPosition:this.endPosition=function(){var t,e,n;for(o=0,n=this.objects,t=0,e=n.length;e>t;t++)i=n[t],o+=i.getLength();return o}.call(this)},e.prototype.toString=function(){return this.objects.join("")},e.prototype.toArray=function(){return this.objects.slice(0)},e.prototype.toJSON=function(){return this.toArray()},e.prototype.isEqualTo=function(t){return e.__super__.isEqualTo.apply(this,arguments)||n(this.objects,null!=t?t.objects:void 0)},n=function(t,e){var n,i,o,r,s;if(null==e&&(e=[]),t.length!==e.length)return!1;for(s=!0,i=n=0,o=t.length;o>n;i=++n)r=t[i],s&&!r.isEqualTo(e[i])&&(s=!1);return s},e.prototype.contentsForInspection=function(){var o;return{objects:"["+function(){var t,e,n,i;for(n=this.objects,i=[],t=0,e=n.length;e>t;t++)o=n[t],i.push(o.inspect());return i}.call(this).join(", ")+"]"}},u=function(t){return t[0]},a=function(t){return t[1]},e}(D.Object)}.call(this),function(){var e=function(t,e){function n(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty;D.Text=function(t){function n(i){var o;null==i&&(i=[]),n.__super__.constructor.apply(this,arguments),this.pieceList=new D.SplittableList(function(){var t,e,n;for(n=[],t=0,e=i.length;e>t;t++)o=i[t],o.isEmpty()||n.push(o);return n}())}return e(n,t),n.textForAttachmentWithAttributes=function(t,e){var n;return n=new D.AttachmentPiece(t,e),new this([n])},n.textForStringWithAttributes=function(t,e){var n;return n=new D.StringPiece(t,e),new this([n])},n.fromJSON=function(i){var o,t;return t=function(){var t,e,n;for(n=[],t=0,e=i.length;e>t;
1t++)o=i[t],n.push(D.Piece.fromJSON(o));return n}(),new this(t)},n.prototype.copy=function(){return this.copyWithPieceList(this.pieceList)},n.prototype.copyWithPieceList=function(t){return new this.constructor(t.consolidate().toArray())},n.prototype.copyUsingObjectMap=function(r){var s,t;return t=function(){var t,e,n,i,o;for(n=this.getPieces(),o=[],t=0,e=n.length;e>t;t++)s=n[t],o.push(null!=(i=r.find(s))?i:s);return o}.call(this),new this.constructor(t)},n.prototype.appendText=function(t){return this.insertTextAtPosition(t,this.getLength())},n.prototype.insertTextAtPosition=function(t,e){return this.copyWithPieceList(this.pieceList.insertSplittableListAtPosition(t.pieceList,e))},n.prototype.removeTextAtRange=function(t){return this.copyWithPieceList(this.pieceList.removeObjectsInRange(t))},n.prototype.replaceTextAtRange=function(t,e){return this.removeTextAtRange(e).insertTextAtPosition(t,e[0])},n.prototype.moveTextFromRangeToPosition=function(t,e){var n,i;if(!(t[0]<=e&&e<=t[1]))return i=this.getTextAtRange(t),n=i.getLength(),t[0]<e&&(e-=n),this.removeTextAtRange(t).insertTextAtPosition(i,e)},n.prototype.addAttributeAtRange=function(t,e,n){var i;return i={},i[t]=e,this.addAttributesAtRange(i,n)},n.prototype.addAttributesAtRange=function(e,t){return this.copyWithPieceList(this.pieceList.transformObjectsInRange(t,function(t){return t.copyWithAdditionalAttributes(e)}))},n.prototype.removeAttributeAtRange=function(e,t){return this.copyWithPieceList(this.pieceList.transformObjectsInRange(t,function(t){return t.copyWithoutAttribute(e)}))},n.prototype.setAttributesAtRange=function(e,t){return this.copyWithPieceList(this.pieceList.transformObjectsInRange(t,function(t){return t.copyWithAttributes(e)}))},n.prototype.getAttributesAtPosition=function(t){var e,n;return null!=(e=null!=(n=this.pieceList.getObjectAtPosition(t))?n.getAttributes():void 0)?e:{}},n.prototype.getCommonAttributes=function(){var t,o;return t=function(){var t,e,n,i;for(n=this.pieceList.toArray(),i=[],t=0,e=n.length;e>t;t++)o=n[t],i.push(o.getAttributes());return i}.call(this),D.Hash.fromCommonAttributesOfObjects(t).toObject()},n.prototype.getCommonAttributesAtRange=function(t){var e;return null!=(e=this.getTextAtRange(t).getCommonAttributes())?e:{}},n.prototype.getExpandedRangeForAttributeAtOffset=function(t,e){var n,i,o;for(n=o=e,i=this.getLength();n>0&&this.getCommonAttributesAtRange([n-1,o])[t];)n--;for(;i>o&&this.getCommonAttributesAtRange([e,o+1])[t];)o++;return[n,o]},n.prototype.getTextAtRange=function(t){return this.copyWithPieceList(this.pieceList.getSplittableListInRange(t))},n.prototype.getStringAtRange=function(t){return this.pieceList.getSplittableListInRange(t).toString()},n.prototype.getStringAtPosition=function(t){return this.getStringAtRange([t,t+1])},n.prototype.startsWithString=function(t){return this.getStringAtRange([0,t.length])===t},n.prototype.endsWithString=function(t){var e;
1return e=this.getLength(),this.getStringAtRange([e-t.length,e])===t},n.prototype.getAttachmentPieces=function(){var t,e,n,i,o;for(i=this.pieceList.toArray(),o=[],t=0,e=i.length;e>t;t++)n=i[t],null!=n.attachment&&o.push(n);return o},n.prototype.getAttachments=function(){var t,e,n,i,o;for(i=this.getAttachmentPieces(),o=[],t=0,e=i.length;e>t;t++)n=i[t],o.push(n.attachment);return o},n.prototype.getAttachmentAndPositionById=function(t){var e,n,i,o,r,s;for(o=0,r=this.pieceList.toArray(),e=0,n=r.length;n>e;e++){if(i=r[e],(null!=(s=i.attachment)?s.id:void 0)===t)return{attachment:i.attachment,position:o};o+=i.length}return{attachment:null,position:null}},n.prototype.getAttachmentById=function(t){var e,n,i;return i=this.getAttachmentAndPositionById(t),e=i.attachment,n=i.position,e},n.prototype.getRangeOfAttachment=function(t){var e,n;return n=this.getAttachmentAndPositionById(t.id),t=n.attachment,e=n.position,null!=t?[e,e+1]:void 0},n.prototype.updateAttributesForAttachment=function(t,e){var n;return(n=this.getRangeOfAttachment(e))?this.addAttributesAtRange(t,n):this},n.prototype.getLength=function(){return this.pieceList.getEndPosition()},n.prototype.isEmpty=function(){return 0===this.getLength()},n.prototype.isEqualTo=function(t){var e;return n.__super__.isEqualTo.apply(this,arguments)||(null!=t&&null!=(e=t.pieceList)?e.isEqualTo(this.pieceList):void 0)},n.prototype.isBlockBreak=function(){return 1===this.getLength()&&this.pieceList.getObjectAtIndex(0).isBlockBreak()},n.prototype.eachPiece=function(t){return this.pieceList.eachObject(t)},n.prototype.getPieces=function(){return this.pieceList.toArray()},n.prototype.getPieceAtPosition=function(t){return this.pieceList.getObjectAtPosition(t)},n.prototype.contentsForInspection=function(){return{pieceList:this.pieceList.inspect()}},n.prototype.toSerializableText=function(){var t;return t=this.pieceList.selectSplittableList(function(t){return t.isSerializable()}),this.copyWithPieceList(t)},n.prototype.toString=function(){return this.pieceList.toString()},n.prototype.toJSON=function(){return this.pieceList.toJSON()},n.prototype.toConsole=function(){var o;return JSON.stringify(function(){var t,e,n,i;for(n=this.pieceList.toArray(),i=[],t=0,e=n.length;e>t;t++)o=n[t],i.push(JSON.parse(o.toConsole()));return i}.call(this))},n}(D.Object)}.call(this),function(){var h,t,p,d,f,g=function(t,e){function n(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty,m=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},v=[].slice;h=D.arraysAreEqual,f=D.spliceArray,p=D.getBlockConfig,t=D.getBlockAttributeNames,d=D.getListAttributeNames,D.Block=function(t){function n(t,e){null==t&&(t=new D.Text),null==e&&(e=[]),n.__super__.constructor.apply(this,arguments),this.text=i(t),this.attributes=e}var e,i,o,r,s,a,u,c,l;return g(n,t),n.fromJSON=function(t){var e;return e=D.Text.fromJSON(t.text),new this(e,t.attributes)},n.prototype.isEmpty=function(){return this.text.isBlockBreak()},n.prototype.isEqualTo=function(t){return n.__super__.isEqualTo.apply(this,arguments)||this.text.isEqualTo(null!=t?t.text:void 0)&&h(this.attributes,null!=t?t.attributes:void 0)},n.prototype.copyWithText=function(t){return new this.constructor(t,this.attributes)},n.prototype.copyWithoutText=function(){return this.copyWithText(null)},n.prototype.copyWithAttributes=function(t){return new this.constructor(this.text,t)},n.prototype.copyWithoutAttributes=function(){return this.copyWithAttributes(null)},n.prototype.copyUsingObjectMap=function(t){var e;return this.copyWithText((e=t.find(this.text))?e:this.text.copyUsingObjectMap(t))},n.prototype.addAttribute=function(t){var e;return e=this.attributes.concat(r(t)),this.copyWithAttributes(e)},n.prototype.removeAttribute=function(t){var e,n;return n=p(t).listAttribute,e=a(a(this.attributes,t),n),this.copyWithAttributes(e)},n.prototype.removeLastAttribute=function(){return this.removeAttribute(this.getLastAttribute())},n.prototype.getLastAttribute=function(){return s(this.attributes)},n.prototype.getAttributes=function(){return this.attributes.slice(0)},n.prototype.getAttributeLevel=function(){return this.attributes.length},n.prototype.getAttributeAtLevel=function(t){return this.attributes[t-1]},n.prototype.hasAttribute=function(t){return m.call(this.attributes,t)>=0},n.prototype.hasAttributes=function(){return this.getAttributeLevel()>0},n.prototype.getLastNestableAttribute=function(){return s(this.getNestableAttributes())},n.prototype.getNestableAttributes=function(){var t,e,n,i,o;for(i=this.attributes,o=[],e=0,n=i.length;n>e;e++)t=i[e],p(t).nestable&&o.push(t);return o},n.prototype.getNestingLevel=function(){return this.getNestableAttributes().length},n.prototype.decreaseNestingLevel=function(){var t;return(t=this.getLastNestableAttribute())?this.removeAttribute(t):this},n.prototype.increaseNestingLevel=function(){var t,e,n;return(t=this.getLastNestableAttribute())?(n=this.attributes.lastIndexOf(t),e=f.apply(null,[this.attributes,n+1,0].c
1oncat(v.call(r(t)))),this.copyWithAttributes(e)):this},n.prototype.getListItemAttributes=function(){var t,e,n,i,o;for(i=this.attributes,o=[],e=0,n=i.length;n>e;e++)t=i[e],p(t).listAttribute&&o.push(t);return o},n.prototype.isListItem=function(){var t;return null!=(t=p(this.getLastAttribute()))?t.listAttribute:void 0},n.prototype.isTerminalBlock=function(){var t;return null!=(t=p(this.getLastAttribute()))?t.terminal:void 0},n.prototype.breaksOnReturn=function(){var t;return null!=(t=p(this.getLastAttribute()))?t.breakOnReturn:void 0},n.prototype.findLineBreakInDirectionFromPosition=function(t,e){var n,i;return i=this.toString(),n=function(){switch(t){case"forward":return i.indexOf("\n",e);case"backward":return i.slice(0,e).lastIndexOf("\n")}}(),-1!==n?n:void 0},n.prototype.contentsForInspection=function(){return{text:this.text.inspect(),attributes:this.attributes}},n.prototype.toString=function(){return this.text.toString()},n.prototype.toJSON=function(){return{text:this.text,attributes:this.attributes}},n.prototype.getLength=function(){return this.text.getLength()},n.prototype.canBeConsolidatedWith=function(t){return!this.hasAttributes()&&!t.hasAttributes()},n.prototype.consolidateWith=function(t){var e,n;return e=D.Text.textForStringWithAttributes("\n"),n=this.getTextWithoutBlockBreak().appendText(e),this.copyWithText(n.appendText(t.text))},n.prototype.splitAtOffset=function(t){var e,n;return 0===t?(e=null,n=this):t===this.getLength()?(e=this,n=null):(e=this.copyWithText(this.text.getTextAtRange([0,t])),n=this.copyWithText(this.text.getTextAtRange([t,this.getLength()]))),[e,n]},n.prototype.getBlockBreakPosition=function(){return this.text.getLength()-1},n.prototype.getTextWithoutBlockBreak=function(){return u(this.text)?this.text.getTextAtRange([0,this.getBlockBreakPosition()]):this.text.copy()},n.prototype.canBeGrouped=function(t){return this.attributes[t]},n.prototype.canBeGroupedWith=function(t,e){var n,i,o,r;return o=t.getAttributes(),i=o[e],n=this.attributes[e],n===i&&!(p(n).group===!1&&(r=o[e+1],m.call(d(),r)<0))},i=function(t){return t=l(t),t=e(t)},l=function(t){var e,i,n,o,r,s;return o=!1,s=t.getPieces(),i=2<=s.length?v.call(s,0,e=s.length-1):(e=0,[]),n=s[e++],null==n?t:(i=function(){var t,e,n;for(n=[],t=0,e=i.length;e>t;t++)r=i[t],r.isBlockBreak()?(o=!0,n.push(c(r))):n.push(r);return n}(),o?new D.Text(v.call(i).concat([n])):t)},o=D.Text.textForStringWithAttributes("\n",{blockBreak:!0}),e=function(t){return u(t)?t:t.appendText(o)},u=function(t){var e,n;return n=t.getLength(),0===n?!1:(e=t.getTextAtRange([n-1,n]),e.isBlockBreak())},c=function(t){return t.copyWithoutAttribute("blockBreak")},r=function(t){var e;return e=p(t).listAttribute,null!=e?[e,t]:[t]},s=function(t){return t.slice(-1)[0]},a=function(t,e){var n;return n=t.lastIndexOf(e),-1===n?t:f(t,n,1)},n}(D.Object)}.call(this),function(){var o,s,a,u=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty,c=[].slice,l=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};s=D.tagName,a=D.walkTree,o=D.nodeIsAttachmentElement,D.HTMLSanitizer=function(t){function e(t,e){this.allowedAttributes=(null!=e?e:{}).allowedAttributes,null==this.allowedAttributes&&(this.allowedAttributes=n),this.body=i(t)}var n,i,r;return u(e,t),n="style href src width height class".split(" "),e.sanitize=function(t,e){var n;return n=new this(t,e),n.sanitize(),n},e.prototype.sanitize=function(){return this.sanitizeElements(),this.normalizeListElementNesting()},e.prototype.getHTML=function(){return this.body.innerHTML},e.prototype.getBody=function(){return this.body},e.prototype.sanitizeElements=function(){var t,e,n,i,o;for(o=a(this.body),i=[];o.nextNode();)switch(n=o.currentNode,n.nodeType){case Node.ELEMENT_NODE:r(n)?i.push(n):this.sanitizeElement(n);break;case Node.COMMENT_NODE:i.push(n)}for(t=0,e=i.length;e>t;t++)n=i[t],D.removeNode(n);return this.body},e.prototype.sanitizeElement=function(t){var e,n,i,o;for(o=c.call(t.attributes),e=0,n=o.length;n>e;e++)i=o[e].name,l.call(this.allowedAttributes,i)>=0||0===i.indexOf("data-trix")||t.removeAttribute(i);return t},e.prototype.normalizeListElementNesting=function(){var t,e,n,i,o;for(o=c.call(this.body.querySelectorAll("ul,ol")),t=0,e=o.length;e>t;t++)n=o[t],(i=n.previousElementSibling)&&"li"===s(i)&&i.appendChild(n);return this.body},r=function(t){return(null!=t?t.nodeType:void 0)!==Node.ELEMENT_NODE||o(t)?void 0:"script"===s(t)||"false"===t.getAttribute("data-trix-serialize")},i=function(t){var e,n,i,o,r;for(null==t&&(t=""),t=t.replace(/<\/html[^>]*>[^]*$/i,"</html>"),e=document.implementation.createHTMLDocument(""),e.documentElement.innerHTML=t,r=e.head.querySelectorAll("style"),i=0,o=r.length;o>i;i++)n=r[i],e.body.appendChild(n);return e.body},e}(D.BasicObject)}.call(this),function(){var f,g,m,v,y,b,A,C,x,w,E,S=function(t,e){function n(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty,R=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};f=D.arraysAreEqual,b=D.makeElement,w=D.tagName,y=D.getBlockTagNames,E=D.walkTree,v=D.findClosestElementFromNode,m=D.elementContainsNode,A=D.nodeIsAttachmentElement,C=D.normalizeSpaces,g=D.breakableWhitespacePattern,x=D.squishBreakableWhitespace,D.HTMLParser=function(t){function e(t,e){this.html=t,this.referenceElement=(null!=e?e:{}).referenceElement,this.blocks=[],this.blockElements=[],this.processedElements=[]}var i,o,s,r,a,u,c,n,l,h,p,d;return S(e,t),e.parse=function(t,e){var n;return n=new this(t,e),n.parse(),n},e.prototype.getDocument=function(){return D.Document.fromJSON(this.blocks)},e.prototype.parse=function(){var t,e;try{for(this.createHiddenContainer(),t=D.HTMLSanitizer.sanitize(this.html).getHTML(),this.containerElement.innerHTML=t,e=E(this.containerElement,{usingFilter:n}
1);e.nextNode();)this.processNode(e.currentNode);return this.translateBlockElementMarginsToNewlines()}finally{this.removeHiddenContainer()}},e.prototype.createHiddenContainer=function(){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=b({tagName:"div",style:{display:"none"}}),document.body.appendChild(this.containerElement))},e.prototype.removeHiddenContainer=function(){return D.removeNode(this.containerElement)},n=function(t){return"style"===w(t)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},e.prototype.processNode=function(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)}},e.prototype.appendBlockForTextNode=function(t){var e,n,i;return n=t.parentNode,n!==this.currentBlockElement&&this.isBlockElement(n)?(e=this.getBlockAttributes(n),f(e,null!=(i=this.currentBlock)?i.attributes:void 0)?void 0:(this.currentBlock=this.appendBlockForAttributesWithElement(e,n),this.currentBlockElement=n)):void 0},e.prototype.appendBlockForElement=function(t){var e,n,i,o;if(i=this.isBlockElement(t),n=m(this.currentBlockElement,t),i&&!this.isBlockElement(t.firstChild)){if(!(this.isInsignificantTextNode(t.firstChild)&&this.isBlockElement(t.firstElementChild)||(e=this.getBlockAttributes(t),n&&f(e,this.currentBlock.attributes))))return this.currentBlock=this.appendBlockForAttributesWithElement(e,t),this.currentBlockElement=t}else if(this.currentBlockElement&&!n&&!i)return(o=this.findParentBlockElement(t))?this.appendBlockForElement(o):(this.currentBlock=this.appendEmptyBlock(),this.currentBlockElement=null)},e.prototype.findParentBlockElement=function(t){var e;for(e=t.parentElement;e&&e!==this.containerElement;){if(this.isBlockElement(e)&&R.call(this.blockElements,e)>=0)return e;e=e.parentElement}return null},e.prototype.processTextNode=function(t){var e,n;return n=t.data,o(t.parentNode)||(n=x(n),p(null!=(e=t.previousSibling)?e.textContent:void 0)&&(n=u(n))),this.appendStringWithAttributes(n,this.getTextAttributes(t.parentNode))},e.prototype.processElement=function(t){var e,n,i,o,r;if(A(t))return e=s(t),Object.keys(e).length&&(o=this.getTextAttributes(t),this.appendAttachmentWithAttributes(e,o),t.innerHTML=""),this.processedElements.push(t);switch(w(t)){case"br":return this.isExtraBR(t)||this.isBlockElement(t.nextSibling)||this.appendStringWithAttributes("\n",this.getTextAttributes(t)),this.processedElements.push(t);case"img":e={url:t.getAttribute("src"),contentType:"image"},i=a(t);for(n in i)r=i[n],e[n]=r;return this.appendAttachmentWithAttributes(e,this.getTextAttributes(t)),this.processedElements.push(t);case"tr":if(t.parentNode.firstChild!==t)return this.appendStringWithAttributes("\n");break;case"td":if(t.parentNode.firstChild!==t)return this.appendStringWithAttributes(" | ")}},e.prototype.appendBlockForAttributesWithElement=function(t,e){var n;return this.blockElements.push(e),n=i(t),this.blocks.push(n),n},e.prototype.appendEmptyBlock=function(){return this.appendBlockForAttributesWithElement([],null)},e.prototype.appendStringWithAttributes=function(t,e){return this.appendPiece(h(t,e))},e.prototype.appendAttachmentWithAttributes=function(t,e){return this.appendPiece(l(t,e))},e.prototype.appendPiece=function(t){return 0===this.blocks.length&&this.appendEmptyBlock(),this.blocks[this.blocks.length-1].text.push(t)},e.prototype.appendStringToTextAtIndex=function(t,e){var n,i;return i=this.blocks[e].text,n=i[i.length-1],"string"===(null!=n?n.type:void 0)?n.string+=t:i.push(h(t))},e.prototype.prependStringToTextAtIndex=function(t,e){var n,i;return i=this.blocks[e].text,n=i[0],"string"===(null!=n?n.type:void 0)?n.string=t+n.string:i.unshift(h(t))},h=function(t,e){var n;return null==e&&(e={}),n="string",t=C(t),{string:t,attributes:e,type:n}},l=function(t,e){var n;return null==e&&(e={}),n="attachment",{attachment:t,attributes:e,type:n}},i=function(t){var e;return null==t&&(t={}),e=[],{text:e,attributes:t}},e.prototype.getTextAttributes=function(t){var e,n,i,o,r,s,a,u,c,l,h,p,d;i={},l=D.config.textAttributes;for(e in l)if(r=l[e],r.tagName&&v(t,{matchingSelector:r.tagName,untilNode:this.containerElement}))i[e]=!0;else if(r.parser){if(d=r.parser(t)){for(n=!1,h=this.findBlockElementAncestors(t),s=0,c=h.length;c>s;s++)if(o=h[s],r.parser(o)===d){n=!0;break}n||(i[e]=d)}}else r.styleProperty&&(d=t.style[r.styleProperty])&&(i[e]=d);if(A(t)&&(a=t.getAttribute("data-trix-attributes"))){p=JSON.parse(a);for(u in p)d=p[u],i[u]=d}return i},e.prototype.getBlockAttributes=function(t){var e,n,i,o;for(n=[];t&&t!==this.containerElement;){o=D.config.blockAttributes;for(e in o)i=o[e],i.parse!==!1&&w(t)===i.tagName&&(("function"==typeof i.test?i.test(t):void 0)||!i.test)&&(n.push(e),i.listAttribute&&n.push(i.listAttribute));t=t.parentNode}return n.reverse()},e.prototype.findBlockElementAncestors=function(t){var e,n;for(e=[];t&&t!==this.containerElement;)n=w(t),R.call(y(),n)>=0&&e.push(t),t=t.parentNode;return e},s=function(t){return JSON.parse(t.getAttribute("data-trix-attachment"))},a=function(t){var e,n,i;return i=t.getAttribute("width"),n=t.getAttribute("height"),e={},i&&(e.width=parseInt(i,10)),n&&(e.height=parseInt(n,10)),e},e.prototype.isBlockElement=function(t){var e;if((null!=t?t.nodeType:void 0)===Node.ELEMENT_NODE&&!A(t)&&!v(t,{matchingSelector:"td",untilNode:this.containerElement}))return e=w(t),R.call(y(),e)>=0||"block"===window.getComputedStyle(t).display},e.prototype.isInsignificantTextNode=function(t){var e,n,i;if((null!=t?t.nodeType:void 0)===Node.TEXT_NODE&&d(t.data)&&(n=t.parentNode,i=t.previousSibling,e=t.nextSibling,(!c(n.previousSibling)||this.isBlockElement(n.previousSibling))&&!o(n)))return!i||this.isBlockElement(i)||!e||this.isBlockElement(e)},e.prototype.isExtraBR=function(t){return"br"===w(t)&&this.isBlockElement(t.parentNode)&&t.parentNode.lastChild===t},o=function(t){var e;return e=window.getComputedStyle(t).whiteSpace,"pre"===e||"pre-wrap"===e||"pre-line"===e},c=function(t){return t&&!p(t.textContent)},e.prototype.translateBlockElementMarginsToNewlines=function(){var t,e,n,i,o,r,s,a;for(e=this.getMarginOfDefaultBlockElement(),s=this.blocks,a=[],i=n=0,o=s.length;o>n;i=++n)t=s[i],(r=this.getMarginOfBlockElementAtIndex(i))&&(r.top>2*e.top&&this.prependStringToTextAtIndex("\n",i),a.push(r.bottom>2*e.bottom?this.appendStringToTextAtIndex("\n",i):void 0));return a},e.prototype.getMarginOfBlockElementAtIndex=function(t){var e,n;return!(e=this.blockElements[t])||!e.textContent||(n=w(e),R.call(y(),n)>=0||R.call(this.processedElements,e)>=0)?void 0:r(e)},e.prototype.getMarginOfDefaultBlockElement=function(){var t;return t=b(D.config.blockAttributes["default"].tagName),this.containerElement.appendChild(t),r(t)},r=function(t){var e;return e=window.getComputedStyle(t),"block"===e.display?{top:parseInt(e.marginTop),bottom:parseInt(e.marginBottom)}:void 0},u=function(t){return t.replace(RegExp("^"+g.source+"+"),"")},d=function(t){return RegExp("^"+g.source+"*$").test(t)},p=function(t){return/\s$/.test(t)},e}(D.BasicObject)}.call(this),function(){var f,a,x,w,n=function(t,e){function n(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty,p=[].slice,d=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};f=D.arraysAreEqual,x=D.normalizeRange,w=D.rangeIsCollapsed,a=D.getBlockConfig,D.Document=function(t){function e(t){null==t&&(t=[]),e.__super__.constructor.apply(this,arguments),0===t.length&&(t=[new D.Block]),this.blockList=D.SplittableList.box(t)}var h;return n(e,t),e.fromJSON=function(i){var o,t;return t=function(){var t,e,n;for(n=[],t=0,e=i.length;e>t;
1t++)o=i[t],n.push(D.Block.fromJSON(o));return n}(),new this(t)},e.fromHTML=function(t,e){return D.HTMLParser.parse(t,e).getDocument()},e.fromString=function(t,e){var n;return n=D.Text.textForStringWithAttributes(t,e),new this([new D.Block(n)])},e.prototype.isEmpty=function(){var t;return 1===this.blockList.length&&(t=this.getBlockAtIndex(0),t.isEmpty()&&!t.hasAttributes())},e.prototype.copy=function(t){var e;return null==t&&(t={}),e=t.consolidateBlocks?this.blockList.consolidate().toArray():this.blockList.toArray(),new this.constructor(e)},e.prototype.copyUsingObjectsFromDocument=function(t){var e;return e=new D.ObjectMap(t.getObjects()),this.copyUsingObjectMap(e)},e.prototype.copyUsingObjectMap=function(o){var r,t,s;return t=function(){var t,e,n,i;for(n=this.getBlocks(),i=[],t=0,e=n.length;e>t;t++)r=n[t],i.push((s=o.find(r))?s:r.copyUsingObjectMap(o));return i}.call(this),new this.constructor(t)},e.prototype.copyWithBaseBlockAttributes=function(o){var r,s,t;return null==o&&(o=[]),t=function(){var t,e,n,i;for(n=this.getBlocks(),i=[],t=0,e=n.length;e>t;t++)s=n[t],r=o.concat(s.getAttributes()),i.push(s.copyWithAttributes(r));return i}.call(this),new this.constructor(t)},e.prototype.replaceBlock=function(t,e){var n;return n=this.blockList.indexOf(t),-1===n?this:new this.constructor(this.blockList.replaceObjectAtIndex(e,n))},e.prototype.insertDocumentAtRange=function(t,e){var n,i,o,r,s,a,u;return i=t.blockList,s=(e=x(e))[0],a=this.locationFromPosition(s),o=a.index,r=a.offset,u=this,n=this.getBlockAtPosition(s),w(e)&&n.isEmpty()&&!n.hasAttributes()?u=new this.constructor(u.blockList.removeObjectAtIndex(o)):n.getBlockBreakPosition()===r&&s++,u=u.removeTextAtRange(e),new this.constructor(u.blockList.insertSplittableListAtPosition(i,s))},e.prototype.mergeDocumentAtRange=function(t,e){var n,i,o,r,s,a,u,c,l,h,p,d;return p=(e=x(e))[0],h=this.locationFromPosition(p),i=this.getBlockAtIndex(h.index).getAttributes(),n=t.getBaseBlockAttributes(),d=i.slice(-n.length),f(n,d)?(u=i.slice(0,-n.length),a=t.copyWithBaseBlockAttributes(u)):a=t.copy({consolidateBlocks:!0}).copyWithBaseBlockAttributes(i),o=a.getBlockCount(),r=a.getBlockAtIndex(0),f(i,r.getAttributes())?(s=r.getTextWithoutBlockBreak(),l=this.insertTextAtRange(s,e),o>1&&(a=new this.constructor(a.getBlocks().slice(1)),c=p+s.getLength(),l=l.insertDocumentAtRange(a,c))):l=this.insertDocumentAtRange(a,e),l},e.prototype.insertTextAtRange=function(e,t){var n,i,o,r,s;return s=(t=x(t))[0],r=this.locationFromPosition(s),i=r.index,o=r.offset,n=this.removeTextAtRange(t),new this.constructor(n.blockList.editObjectAtIndex(i,function(t){return t.copyWithText(t.text.insertTextAtPosition(e,o))}))},e.prototype.removeTextAtRange=function(t){var e,n,i,o,r,s,a,u,c,l,h,p,d,f,g,m,v,y,b,A,C;return l=t=x(t),u=l[0],y=l[1],w(t)?this:(h=this.locationRangeFromRange(t),s=h[0],m=h[1],r=s.index,a=s.offset,o=this.getBlockAtIndex(r),g=m.index,v=m.offset,f=this.getBlockAtIndex(g),p=y-u===1&&o.getBlockBreakPosition()===a&&f.getBlockBreakPosition()!==v&&"\n"===f.text.getStringAtPosition(v),p?i=this.blockList.editObjectAtIndex(g,function(t){return t.copyWithText(t.text.removeTextAtRange([v,v+1]))}):(c=o.text.getTextAtRange([0,a]),b=f.text.getTextAtRange([v,f.getLength()]),A=c.appendText(b),d=r!==g&&0===a,C=d&&o.getAttributeLevel()>=f.getAttributeLevel(),n=C?f.copyWithText(A):o.copyWithText(A),e=g+1-r,i=this.blockList.splice(r,e,n)),new this.constructor(i))},e.prototype.moveTextFromRangeToPosition=function(t,e){var n,i,o,r,s,a,u,c,l,h;return a=t=x(t),l=a[0],o=a[1],e>=l&&o>=e?this:(i=this.getDocumentAtRange(t),c=this.removeTextAtRange(t),s=e>l,s&&(e-=i.getLength()),u=i.getBlocks(),r=u[0],n=2<=u.length?p.call(u,1):[],0===n.length?(h=r.getTextWithoutBlockBreak(),s&&(e+=1)):h=r.text,c=c.insertTextAtRange(h,e),0===n.length?c:(i=new this.constructor(n),e+=h.getLength(),c.insertDocumentAtRange(i,e)))},e.prototype.addAttributeAtRange=function(i,o,t){var r;return r=this.blockList,this.eachBlockAtRange(t,function(t,e,n){return r=r.editObjectAtIndex(n,function(){return a(i)?t.addAttribute(i,o):e[0]===e[1]?t:t.copyWithText(t.text.addAttributeAtRange(i,o,e))})}),new this.constructor(r)},e.prototype.addAttribute=function(n,i){var o;return o=this.blockList,this.eachBlock(function(t,e){return o=o.editObjectAtIndex(e,function(){return t.addAttribute(n,i)})}),new this.constructor(o)},e.prototype.removeAttributeAtRange=function(i,t){var o;return o=this.blockList,this.eachBlockAtRange(t,function(t,e,n){return a(i)?o=o.editObjectAtIndex(n,function(){return t.removeAttribute(i)}):e[0]!==e[1]?o=o.editObjectAtIndex(n,function(){return t.copyWithText(t.text.removeAttributeAtRange(i,e))}):void 0}),new this.constructor(o)},e.prototype.updateAttributesForAttachment=function(e,n){var t,i,o,r;return o=(i=this.getRangeOfAttachment(n))[0],t=this.locationFromPosition(o).index,r=this.getTextAtIndex(t),new this.constructor(this.blockList.editObjectAtIndex(t,function(t){return t.copyWithText(r.updateAttributesForAttachment(e,n))}))},e.prototype.removeAttributeForAttachment=function(t,e){var n;return n=this.getRangeOfAttachment(e),this.removeAttributeAtRange(t,n)},e.prototype.insertBlockBreakAtRange=function(t){var e,n,i,o;return o=(t=x(t))[0],i=this.locationFromPosition(o).offset,n=this.removeTextAtRange(t),0===i&&(e=[new D.Block]),new this.constructor(n.blockList.insertSplittableListAtPosition(new D.SplittableList(e),o))},e.prototype.applyBlockAttributeAtRange=function(t,e,n){var i,o,r,s;return r=this.expandRangeToLineBreaksAndSplitBlocks(n),o=r.document,n=r.range,i=a(t),i.listAttribute?(o=o.removeLastListAttributeAtRange(n,{exceptAttributeName:t}),s=o.convertLineBreaksToBlockBreaksInRange(n),o=s.document,n=s.range):o=i.exclusive?o.removeBlockAttributesAtRange(n):i.terminal?o.removeLastTerminalAttributeAtRange(n):o.consolidateBlocksAtRange(n),o.addAttributeAtRange(t,e,n)},e.prototype.removeLastListAttributeAtRange=function(t,o){var r;return null==o&&(o={}),r=this.blockList,this.eachBlockAtRange(t,function(t,e,n){var i;if((i=t.getLastAttribute())&&a(i).listAttribute&&i!==o.exceptAttributeName)return r=r.editObjectAtIndex(n,function(){return t.removeAttribute(i)})}),new this.constructor(r)},e.prototype.removeLastTerminalAttributeAtRange=function(t){var o;return o=this.blockList,this.eachBlockAtRange(t,function(t,e,n){var i;if((i=t.getLastAttribute())&&a(i).terminal)return o=o.editObjectAtIndex(n,function(){return t.removeAttribute(i)})}),new this.constructor(o)},e.prototype.removeBlockAttributesAtRange=function(t){var i;return i=this.blockList,this.eachBlockAtRange(t,function(t,e,n){return t.hasAttributes()?i=i.editObjectAtIndex(n,function(){return t.copyWithoutAttributes()}):void 0}),new this.constructor(i)},e.prototype.expandRangeToLineBreaksAndSplitBlocks=function(t){var e,n,i,o,r,s,a,u,c;return s=t=x(t),c=s[0],o=s[1],u=this.locationFromPosition(c),i=this.locationFromPosition(o),e=this,a=e.getBlockAtIndex(u.index),null!=(u.offset=a.findLineBreakInDirectionFromPosition("backward",u.offset))&&(r=e.positionFromLocation(u),e=e.insertBlockBreakAtRange([r,r+1]),i.index+=1,i.offset-=e.getBlockAtIndex(u.index).getLength(),u.index+=1),u.offset=0,0===i.offset&&i.index>u.index?(i.index-=1,i.offset=e.getBlockAtIndex(i.index).getBlockBreakPosition()):(n=e.getBlockAtIndex(i.index),"\n"===n.text.getStringAtRange([i.offset-1,i.offset])?i.offset-=1:i.offset=n.findLineBreakInDirectionFromPosition("forward",i.offset),i.offset!==n.getBlockBreakPosition()&&(r=e.positionFromLocation(i),e=e.insertBlockBreakAtRange([r,r+1]))),c=e.positionFromLocation(u),o=e.positionFromLocation(i),t=x([c,o]),{document:e,range:t}},e.prototype.convertLineBreaksToBlockBreaksInRange=function(t){var e,n,i;return n=(t=x(t))[0],i=this.getStringAtRange(t).slice(0,-1),e=this,i.replace(/.*?\n/g,function(t){return n+=t.length,e=e.insertBlockBreakAtRange([n-1,n])}),{document:e,range:t}},e.prototype.consolidateBlocksAtRange=function(t){var e,n,i,o,r;return i=t=x(t),r=i[0],n=i[1],o=this.locationFromPosition(r).index,e=this.locationFromPosition(n).index,new this.constructor(this.blockList.consolidateFromIndexToIndex(o,e))},e.prototype.getDocumentAtRange=function(t){var e;return t=x(t),e=this.blockList.getSplittableListInRange(t).toArray(),new this.constructor(e)},e.prototype.getStringAtRange=function(t){var e,n,i;return i=t=x(t),n=i[i.length-1],n!==this.getLength()&&(e=-1),this.getDocumentAtRange(t).toString().slice(0,e)},e.prototype.getBlockAtIndex=function(t){return this.blockList.getObjectAtIndex(t)},e.prototype.getBlockAtPosition=function(t){var e;return e=this.locationFromPosition(t).index,this.getBlockAtIndex(e)},e.prototype.getTextAtIndex=function(t){var e;return null!=(e=this.getBlockAtIndex(t))?e.text:void 0},e.prototype.getTextAtPosition=function(t){var e;return e=this.locationFromPosition(t).index,this.getTextAtIndex(e)},e.prototype.getPieceAtPosition=function(t){var e,n,i;return i=this.locationFromPosition(t),e=i.index,n=i.offset,this.getTextAtIndex(e).getPieceAtPosition(n)},e.prototype.getCharacterAtPosition=function(t){var e,n,i;return i=this.locationFromPosition(t),e=i.index,n=i.offset,this.getTextAtIndex(e).getStringAtRange([n,n+1])},e.prototype.getLength=function(){return this.blockList.getEndPosition()},e.prototype.getBlocks=function(){return this.blockList.toArray()},e.prototype.getBlockCount=function(){return this.blockList.length},e.prototype.getEditCount=function(){return this.editCount},e.prototype.eachBlock=function(t){return this.blockList.eachObject(t)},e.prototype.eachBlockAtRange=function(t,e){var n,i,o,r,s,a,u,c,l,h,p,d;if(a=t=x(t),p=a[0],o=a[1],h=this.locationFromPosition(p),i=this.locationFromPosition(o),h.index===i.index)return n=this.getBlockAtIndex(h.index),d=[h.offset,i.offset],e(n,d,h.index);for(l=[],s=r=u=h.index,c=i.index;c>=u?c>=r:r>=c;s=c>=u?++r:--r)(n=this.getBlockAtIndex(s))?(d=function(){switch(s){case h.index:return[h.offset,n.text.getLength()];case i.index:return[0,i.offset];default:return[0,n.text.getLength()]}}(),l.push(e(n,d,s))):l.push(void 0);return l},e.prototype.getCommonAttributesAtRange=function(t){var n,e,i;return e=(t=x(t))[0],w(t)?this.getCommonAttributesAtPosition(e):(i=[],n=[],this.eachBlockAtRange(t,function(t,e){return e[0]!==e[1]?(i.push(t.text.getCommonAttributesAtRange(e)),n.push(h(t))):void 0}),D.Hash.fromCommonAttributesOfObjects(i).merge(D.Hash.fromCommonAttributesOfObjects(n)).toObject())},e.prototype.getCommonAttributesAtPosition=function(t){var e,n,i,o,r,s,a,u,c,l;if(c=this.locationFromPosition(t),r=c.index,u=c.offset,i=this.getBlockAtIndex(r),!i)return{};o=h(i),e=i.text.getAttributesAtPosition(u),n=i.text.getAttributesAtPosition(u-1),s=function(){var t,e;t=D.config.textAttributes,e=[];
1for(a in t)l=t[a],l.inheritable&&e.push(a);return e}();for(a in n)l=n[a],(l===e[a]||d.call(s,a)>=0)&&(o[a]=l);return o},e.prototype.getRangeOfCommonAttributeAtPosition=function(t,e){var n,i,o,r,s,a,u,c,l;return s=this.locationFromPosition(e),o=s.index,r=s.offset,l=this.getTextAtIndex(o),a=l.getExpandedRangeForAttributeAtOffset(t,r),c=a[0],i=a[1],u=this.positionFromLocation({index:o,offset:c}),n=this.positionFromLocation({index:o,offset:i}),x([u,n])},e.prototype.getBaseBlockAttributes=function(){var i,o,t,e,r,s,n;for(i=this.getBlockAtIndex(0).getAttributes(),t=e=1,n=this.getBlockCount();n>=1?n>e:e>n;t=n>=1?++e:--e)o=this.getBlockAtIndex(t).getAttributes(),s=Math.min(i.length,o.length),i=function(){var t,e,n;for(n=[],r=t=0,e=s;(e>=0?e>t:t>e)&&o[r]===i[r];r=e>=0?++t:--t)n.push(o[r]);return n}();return i},h=function(t){var e,n;return n={},(e=t.getLastAttribute())&&(n[e]=!0),n},e.prototype.getAttachmentById=function(t){var e,n,i,o;for(o=this.getAttachments(),n=0,i=o.length;i>n;n++)if(e=o[n],e.id===t)return e},e.prototype.getAttachmentPieces=function(){var n;return n=[],this.blockList.eachObject(function(t){var e;return e=t.text,n=n.concat(e.getAttachmentPieces())}),n},e.prototype.getAttachments=function(){var t,e,n,i,o;for(i=this.getAttachmentPieces(),o=[],t=0,e=i.length;e>t;t++)n=i[t],o.push(n.attachment);return o},e.prototype.getRangeOfAttachment=function(t){var e,n,i,o,r,s,a;for(o=0,r=this.blockList.toArray(),n=e=0,i=r.length;i>e;n=++e){if(s=r[n].text,a=s.getRangeOfAttachment(t))return x([o+a[0],o+a[1]]);o+=s.getLength()}},e.prototype.getLocationRangeOfAttachment=function(t){var e;return e=this.getRangeOfAttachment(t),this.locationRangeFromRange(e)},e.prototype.getAttachmentPieceForAttachment=function(t){var e,n,i,o;for(o=this.getAttachmentPieces(),e=0,n=o.length;n>e;e++)if(i=o[e],i.attachment===t)return i},e.prototype.findRangesForBlockAttribute=function(t){var e,n,i,o,r,s,a;for(r=0,s=[],a=this.getBlocks(),n=0,i=a.length;i>n;n++)e=a[n],o=e.getLength(),e.hasAttribute(t)&&s.push([r,r+o]),r+=o;return s},e.prototype.findRangesForTextAttribute=function(e,t){var n,i,o,r,s,a,u,c,l,h;for(h=(null!=t?t:{}).withValue,a=0,u=[],c=[],r=function(t){return null!=h?t.getAttribute(e)===h:t.hasAttribute(e)},l=this.getPieces(),n=0,i=l.length;i>n;n++)s=l[n],o=s.getLength(),r(s)&&(u[1]===a?u[1]=a+o:c.push(u=[a,a+o])),a+=o;return c},e.prototype.locationFromPosition=function(t){var e,n;return n=this.blockList.findIndexAndOffsetAtPosition(Math.max(0,t)),null!=n.index?n:(e=this.getBlocks(),{index:e.length-1,offset:e[e.length-1].getLength()})},e.prototype.positionFromLocation=function(t){return this.blockList.findPositionAtIndexAndOffset(t.index,t.offset)},e.prototype.locationRangeFromPosition=function(t){return x(this.locationFromPosition(t))},e.prototype.locationRangeFromRange=function(t){var e,n,i,o;if(t=x(t))return o=t[0],n=t[1],i=this.locationFromPosition(o),e=this.locationFromPosition(n),x([i,e])},e.prototype.rangeFromLocationRange=function(t){var e,n;return t=x(t),e=this.positionFromLocation(t[0]),w(t)||(n=this.positionFromLocation(t[1])),x([e,n])},e.prototype.isEqualTo=function(t){return this.blockList.isEqualTo(null!=t?t.blockList:void 0)},e.prototype.getTexts=function(){var t,e,n,i,o;for(i=this.getBlocks(),o=[],e=0,n=i.length;n>e;e++)t=i[e],o.push(t.text);return o},e.prototype.getPieces=function(){var t,e,n,i,o;for(n=[],i=this.getTexts(),t=0,e=i.length;e>t;t++)o=i[t],n.push.apply(n,o.getPieces());return n},e.prototype.getObjects=function(){return this.getBlocks().concat(this.getTexts()).concat(this.getPieces())},e.prototype.toSerializableDocument=function(){var e;return e=[],this.blockList.eachObject(function(t){return e.push(t.copyWithText(t.text.toSerializableText()))}),new this.constructor(e)},e.prototype.toString=function(){return this.blockList.toString()},e.prototype.toJSON=function(){return this.blockList.toJSON()},e.prototype.toConsole=function(){var o;return JSON.stringify(function(){var t,e,n,i;for(n=this.blockList.toArray(),i=[],t=0,e=n.length;e>t;t++)o=n[t],i.push(JSON.parse(o.text.toConsole()));return i}.call(this))},e}(D.Object)}.call(this),function(){D.LineBreakInsertion=function(){function t(t){var e;this.composition=t,this.document=this.composition.document,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)}return t.prototype.shouldInsertBlockBreak=function(){return this.block.hasAttributes()&&this.block.isListItem()&&!this.block.isEmpty()?0!==this.startLocation.offset:this.breaksOnReturn&&"\n"!==this.nextCharacter},t.prototype.shouldBreakFormattedBlock=function(){return this.block.hasAttributes()&&!this.block.isListItem()&&(this.breaksOnReturn&&"\n"===this.nextCharacter||"\n"===this.previousCharacter)},t.prototype.shouldDecreaseListLevel=function(){return this.block.hasAttributes()&&this.block.isListItem()&&this.block.isEmpty()},t.prototype.shouldPrependListItem=function(){return this.block.isListItem()&&0===this.startLocation.offset&&!this.block.isEmpty()},t.prototype.shouldRemoveLastBlockAttribute=function(){return this.block.hasAttributes()&&!this.block.isListItem()&&this.block.isEmpty()},t}()}.call(this),function(){var i,o,s,r,a,u,c,l,h,p,d=function(t,e){function n(){this.constructor=t}for(var i in e)f.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},f={}.hasOwnProperty;u=D.normalizeRange,h=D.rangesAreEqual,l=D.rangeIsCollapsed,c=D.objectsAreEqual,i=D.arrayStartsWith,p=D.summarizeArrayChange,s=D.getAllAttributeNames,r=D.getBlockConfig,a=D.getTextConfig,o=D.extend,D.Composition=function(t){function e(){this.document=new D.Document,this.attachments=[],this.currentAttributes={},this.revision=0}var n;return d(e,t),e.prototype.setDocument=function(t){var e;return t.isEqualTo(this.document)?void 0:(this.document=t,this.refreshAttachments(),this.revision++,null!=(e=this.delegate)&&"function"==typeof e.compositionDidChangeDocument?e.compositionDidChangeDocument(t):void 0)},e.prototype.getSnapshot=function(){return{document:this.document,selectedRange:this.getSelectedRange()}}
1,e.prototype.loadSnapshot=function(t){var e,n,i,o;return e=t.document,o=t.selectedRange,null!=(n=this.delegate)&&"function"==typeof n.compositionWillLoadSnapshot&&n.compositionWillLoadSnapshot(),this.setDocument(null!=e?e:new D.Document),this.setSelection(null!=o?o:[0,0]),null!=(i=this.delegate)&&"function"==typeof i.compositionDidLoadSnapshot?i.compositionDidLoadSnapshot():void 0},e.prototype.insertText=function(t,e){var n,i,o,r;return r=(null!=e?e:{updatePosition:!0}).updatePosition,i=this.getSelectedRange(),this.setDocument(this.document.insertTextAtRange(t,i)),o=i[0],n=o+t.getLength(),r&&this.setSelection(n),this.notifyDelegateOfInsertionAtRange([o,n])},e.prototype.insertBlock=function(t){var e;return null==t&&(t=new D.Block),e=new D.Document([t]),this.insertDocument(e)},e.prototype.insertDocument=function(t){var e,n,i;return null==t&&(t=new D.Document),n=this.getSelectedRange(),this.setDocument(this.document.insertDocumentAtRange(t,n)),i=n[0],e=i+t.getLength(),this.setSelection(e),this.notifyDelegateOfInsertionAtRange([i,e])},e.prototype.insertString=function(t,e){var n,i;return n=this.getCurrentTextAttributes(),i=D.Text.textForStringWithAttributes(t,n),this.insertText(i,e)},e.prototype.insertBlockBreak=function(){var t,e,n;return e=this.getSelectedRange(),this.setDocument(this.document.insertBlockBreakAtRange(e)),n=e[0],t=n+1,this.setSelection(t),this.notifyDelegateOfInsertionAtRange([n,t])},e.prototype.insertLineBreak=function(){var t,e;return e=new D.LineBreakInsertion(this),e.shouldDecreaseListLevel()?(this.decreaseListLevel(),this.setSelection(e.startPosition)):e.shouldPrependListItem()?(t=new D.Document([e.block.copyWithoutText()]),this.insertDocument(t)):e.shouldInsertBlockBreak()?this.insertBlockBreak():e.shouldRemoveLastBlockAttribute()?this.removeLastBlockAttribute():e.shouldBreakFormattedBlock()?this.breakFormattedBlock(e):this.insertString("\n")},e.prototype.insertHTML=function(t){var e,n,i,o;return e=D.Document.fromHTML(t),i=this.getSelectedRange(),this.setDocument(this.document.mergeDocumentAtRange(e,i)),o=i[0],n=o+e.getLength()-1,this.setSelection(n),this.notifyDelegateOfInsertionAtRange([o,n])},e.prototype.replaceHTML=function(t){var e,n,i;return e=D.Document.fromHTML(t).copyUsingObjectsFromDocument(this.document),n=this.getLocationRange({strict:!1}),i=this.document.rangeFromLocationRange(n),this.setDocument(e),this.setSelection(i)},e.prototype.insertFile=function(t){return this.insertFiles([t])},e.prototype.insertFiles=function(t){var e,n,i,o,r,s;for(n=[],o=0,r=t.length;r>o;o++)i=t[o],(null!=(s=this.delegate)?s.compositionShouldAcceptFile(i):void 0)&&(e=D.Attachment.attachmentForFile(i),n.push(e));return this.insertAttachments(n)},e.prototype.insertAttachment=function(t){return this.insertAttachments([t])},e.prototype.insertAttachments=function(t){var e,n,i,o,r,s,a,u,c;for(u=new D.Text,o=0,r=t.length;r>o;o++)e=t[o],c=e.getType(),s=null!=(a=D.config.attachments[c])?a.presentation:void 0,i=this.getCurrentTextAttributes(),s&&(i.presentation=s),n=D.Text.textForAttachmentWithAttributes(e,i),u=u.appendText(n);return this.insertText(u)},e.prototype.shouldManageDeletingInDirection=function(t){var e;if(e=this.getLocationRange(),l(e)){if("backward"===t&&0===e[0].offset)return!0;if(this.shouldManageMovingCursorInDirection(t))return!0}else if(e[0].index!==e[1].index)return!0;return!1},e.prototype.deleteInDirection=function(t,e){var n,i,o,r,s,a,u,c;return r=(null!=e?e:{}).length,s=this.getLocationRange(),a=this.getSelectedRange(),u=l(a),u?o="backward"===t&&0===s[0].offset:c=s[0].index!==s[1].index,o&&this.canDecreaseBlockAttributeLevel()&&(i=this.getBlock(),i.isListItem()?this.decreaseListLevel():this.decreaseBlockAttributeLevel(),this.setSelection(a[0]),i.isEmpty())?!1:(u&&(a=this.getExpandedRangeInDirection(t,{length:r}),"backward"===t&&(n=this.getAttachmentAtRange(a))),n?(this.editAttachment(n),!1):(this.setDocument(this.document.removeTextAtRange(a)),this.setSelection(a[0]),o||c?!1:void 0))},e.prototype.moveTextFromRange=function(t){var e;return e=this.getSelectedRange()[0],this.setDocument(this.document.moveTextFromRangeToPosition(t,e)),this.setSelection(e)},e.prototype.removeAttachment=function(t){var e;return(e=this.document.getRangeOfAttachment(t))?(this.stopEditingAttachment(),this.setDocument(this.document.removeTextAtRange(e)),this.setSelection(e[0])):void 0},e.prototype.removeLastBlockAttribute=function(){var t,e,n,i;return n=this.getSelectedRange(),i=n[0],e=n[1],t=this.document.getBlockAtPosition(e),this.removeCurrentAttribute(t.getLastAttribute()),this.setSelection(i)},n=" ",e.prototype.insertPlaceholder=function(){return this.placeholderPosition=this.getPosition(),this.insertString(n)},e.prototype.selectPlaceholder=function(){return null!=this.placeholderPosition?(this.setSelectedRange([this.placeholderPosition,this.placeholderPosition+n.length]),this.get
1SelectedRange()):void 0},e.prototype.forgetPlaceholder=function(){return this.placeholderPosition=null},e.prototype.hasCurrentAttribute=function(t){var e;return e=this.currentAttributes[t],null!=e&&e!==!1},e.prototype.toggleCurrentAttribute=function(t){var e;return(e=!this.currentAttributes[t])?this.setCurrentAttribute(t,e):this.removeCurrentAttribute(t)},e.prototype.canSetCurrentAttribute=function(t){return r(t)?this.canSetCurrentBlockAttribute(t):this.canSetCurrentTextAttribute(t)},e.prototype.canSetCurrentTextAttribute=function(){var t,e,n,i,o;if(e=this.getSelectedDocument()){for(o=e.getAttachments(),n=0,i=o.length;i>n;n++)if(t=o[n],!t.hasContent())return!1;return!0}},e.prototype.canSetCurrentBlockAttribute=function(){var t;if(t=this.getBlock())return!t.isTerminalBlock()},e.prototype.setCurrentAttribute=function(t,e){return r(t)?this.setBlockAttribute(t,e):(this.setTextAttribute(t,e),this.currentAttributes[t]=e,this.notifyDelegateOfCurrentAttributesChange())},e.prototype.setTextAttribute=function(t,e){var n,i,o,r;if(i=this.getSelectedRange())return o=i[0],n=i[1],o!==n?this.setDocument(this.document.addAttributeAtRange(t,e,i)):"href"===t?(r=D.Text.textForStringWithAttributes(e,{href:e}),this.insertText(r)):void 0},e.prototype.setBlockAttribute=function(t,e){var n,i;if(i=this.getSelectedRange())return this.canSetCurrentAttribute(t)?(n=this.getBlock(),this.setDocument(this.document.applyBlockAttributeAtRange(t,e,i)),this.setSelection(i)):void 0},e.prototype.removeCurrentAttribute=function(t){return r(t)?(this.removeBlockAttribute(t),this.updateCurrentAttributes()):(this.removeTextAttribute(t),delete this.currentAttributes[t],this.notifyDelegateOfCurrentAttributesChange())},e.prototype.removeTextAttribute=function(t){var e;if(e=this.getSelectedRange())return this.setDocument(this.document.removeAttributeAtRange(t,e))},e.prototype.removeBlockAttribute=function(t){var e;if(e=this.getSelectedRange())return this.setDocument(this.document.removeAttributeAtRange(t,e))},e.prototype.canDecreaseNestingLevel=function(){var t;return(null!=(t=this.getBlock())?t.getNestingLevel():void 0)>0},e.prototype.canIncreaseNestingLevel=function(){var t,e,n;if(t=this.getBlock())return(null!=(n=r(t.getLastNestableAttribute()))?n.listAttribute:0)?(e=this.getPreviousBlock())?i(e.getListItemAttributes(),t.getListItemAttributes()):void 0:t.getNestingLevel()>0},e.prototype.decreaseNestingLevel=function(){var t;if(t=this.getBlock())return this.setDocument(this.document.replaceBlock(t,t.decreaseNestingLevel()))},e.prototype.increaseNestingLevel=function(){var t;if(t=this.getBlock())return this.setDocument(this.document.replaceBlock(t,t.increaseNestingLevel()))},e.prototype.canDecreaseBlockAttributeLevel=function(){var t;return(null!=(t=this.getBlock())?t.getAttributeLevel():void 0)>0},e.prototype.decreaseBlockAttributeLevel=function(){var t,e;return(t=null!=(e=this.getBlock())?e.getLastAttribute():void 0)?this.removeCurrentAttribute(t):void 0},e.prototype.decreaseListLevel=function(){var t,e,n,i,o,r;for(r=this.getSelectedRange()[0],o=this.document.locationFromPosition(r).index,n=o,t=this.getBlock().getAttributeLevel();(e=this.document.getBlockAtIndex(n+1))&&e.isListItem()&&e.getAttributeLevel()>t;)n++;return r=this.document.positionFromLocation({index:o,offset:0}),i=this.document.positionFromLocation({index:n,offset:0}),this.setDocument(this.document.removeLastListAttributeAtRange([r,i]))},e.prototype.updateCurrentAttributes=function(){var t,e,n,i,o,r;if(r=this.getSelectedRange({ignoreLock:!0})){for(e=this.document.getCommonAttributesAtRange(r),o=s(),n=0,i=o.length;i>n;n++)t=o[n],e[t]||this.canSetCurrentAttribute(t)||(e[t]=!1);if(!c(e,this.currentAttributes))return this.currentAttributes=e,this.notifyDelegateOfCurrentAttributesChange()}},e.prototype.getCurrentAttributes=function(){return o.call({},this.currentAttributes)},e.prototype.getCurrentTextAttributes=function(){var t,e,n,i;t={},n=this.currentAttributes;for(e in n)i=n[e],i!==!1&&a(e)&&(t[e]=i);return t},e.prototype.freezeSelection=function(){return this.setCurrentAttribute("frozen",!0)},e.prototype.thawSelection=function(){return this.removeCurrentAttribute("frozen")},e.prototype.hasFrozenSelection=function(){return this.hasCurrentAttribute("frozen")},e.proxyMethod("getSelectionManager().getPointRange"),e.proxyMethod("getSelectionManager().setLocationRangeFromPointRange"),e.proxyMethod("getSelectionManager().createLocationRangeFromDOMRange"),e.proxyMethod("getSelectionManager().locationIsCursorTarget"),e.proxyMethod("getSelectionManager().selectionIsExpanded"),e.proxyMethod("delegate?.getSelectionManager"),e.prototype.setSelection=function(t){var e,n;return e=this.document.locationRangeFromRange(t),null!=(n=this.delegate)?n.compositionDidRequestChangingSelectionToLocationRange(e):void 0},e.prototype.getSelectedRange=function(){var t;return(t=this.getLocationRange())?this.document.rangeFromLocationRange(t):void 0},e.prototype.setSelectedRange=function(t){var e;
1return e=this.document.locationRangeFromRange(t),this.getSelectionManager().setLocationRange(e)},e.prototype.getPosition=function(){var t;return(t=this.getLocationRange())?this.document.positionFromLocation(t[0]):void 0},e.prototype.getLocationRange=function(t){var e,n;return null!=(e=null!=(n=this.targetLocationRange)?n:this.getSelectionManager().getLocationRange(t))?e:u({index:0,offset:0})},e.prototype.withTargetLocationRange=function(t,e){var n;this.targetLocationRange=t;try{n=e()}finally{this.targetLocationRange=null}return n},e.prototype.withTargetRange=function(t,e){var n;return n=this.document.locationRangeFromRange(t),this.withTargetLocationRange(n,e)},e.prototype.withTargetDOMRange=function(t,e){var n;return n=this.createLocationRangeFromDOMRange(t,{strict:!1}),this.withTargetLocationRange(n,e)},e.prototype.getExpandedRangeInDirection=function(t,e){var n,i,o,r;return i=(null!=e?e:{}).length,o=this.getSelectedRange(),r=o[0],n=o[1],"backward"===t?i?r-=i:r=this.translateUTF16PositionFromOffset(r,-1):i?n+=i:n=this.translateUTF16PositionFromOffset(n,1),u([r,n])},e.prototype.shouldManageMovingCursorInDirection=function(t){var e;return this.editingAttachment?!0:(e=this.getExpandedRangeInDirection(t),null!=this.getAttachmentAtRange(e))},e.prototype.moveCursorInDirection=function(t){var e,n,i,o;return this.editingAttachment?i=this.document.getRangeOfAttachment(this.editingAttachment):(o=this.getSelectedRange(),i=this.getExpandedRangeInDirection(t),n=!h(o,i)),this.setSelectedRange("backward"===t?i[0]:i[1]),n&&(e=this.getAttachmentAtRange(i))?this.editAttachment(e):void 0},e.prototype.expandSelectionInDirection=function(t,e){var n,i;return n=(null!=e?e:{}).length,i=this.getExpandedRangeInDirection(t,{length:n}),this.setSelectedRange(i)},e.prototype.expandSelectionForEditing=function(){return this.hasCurrentAttribute("href")?this.expandSelectionAroundCommonAttribute("href"):void 0},e.prototype.expandSelectionAroundCommonAttribute=function(t){var e,n;return e=this.getPosition(),n=this.document.getRangeOfCommonAttributeAtPosition(t,e),this.setSelectedRange(n)},e.prototype.selectionContainsAttachments=function(){var t;return(null!=(t=this.getSelectedAttachments())?t.length:void 0)>0},e.prototype.selectionIsInCursorTarget=function(){return this.editingAttachment||this.positionIsCursorTarget(this.getPosition())},e.prototype.positionIsCursorTarget=function(t){var e;return(e=this.document.locationFromPosition(t))?this.locationIsCursorTarget(e):void 0},e.prototype.positionIsBlockBreak=function(t){var e;return null!=(e=this.document.getPieceAtPosition(t))?e.isBlockBreak():void 0},e.prototype.getSelectedDocument=function(){var t;return(t=this.getSelectedRange())?this.document.getDocumentAtRange(t):void 0},e.prototype.getSelectedAttachments=function(){var t;return null!=(t=this.getSelectedDocument())?t.getAttachments():void 0},e.prototype.getAttachments=function(){return this.attachments.slice(0)},e.prototype.refreshAttachments=function(){var t,e,n,i,o,r,s,a,u,c,l,h;for(n=this.document.getAttachments(),a=p(this.attachments,n),t=a.added,l=a.removed,this.attachments=n,i=0,r=l.length;r>i;i++)e=l[i],e.delegate=null,null!=(u=this.delegate)&&"function"==typeof u.compositionDidRemoveAttachment&&u.compositionDidRemoveAttachment(e);for(h=[],o=0,s=t.length;s>o;o++)e=t[o],e.delegate=this,h.push(null!=(c=this.delegate)&&"function"==typeof c.compositionDidAddAttachment?c.compositionDidAddAttachment(e):void 0);return h},e.prototype.attachmentDidChangeAttributes=function(t){var e;return this.revision++,null!=(e=this.delegate)&&"function"==typeof e.compositionDidEditAttachment?e.compositionDidEditAttachment(t):void 0},e.prototype.attachmentDidChangePreviewURL=function(t){var e;return this.revision++,null!=(e=this.delegate)&&"function"==typeof e.compositionDidChangeAttachmentPreviewURL?e.compositionDidChangeAttachmentPreviewURL(t):void 0},e.prototype.editAttachment=function(t,e){var n;if(t!==this.editingAttachment)return this.stopEditingAttachment(),this.editingAttachment=t,null!=(n=this.delegate)&&"function"==typeof n.compositionDidStartEditingAttachment?n.compositionDidStartEditingAttachment(this.editingAttachment,e):void 0},e.prototype.stopEditingAttachment=function(){var t;if(this.editingAttachment)return null!=(t=this.delegate)&&"function"==typeof t.compositionDidStopEditingAttachment&&t.compositionDidStopEditingAttachment(this.editingAttachment),this.editingAttachment=null},e.prototype.updateAttributesForAttachment=function(t,e){return this.setDocument(this.document.updateAttributesForAttachment(t,e))},e.prototype.removeAttributeForAttachment=function(t,e){return this.setDocument(this.document.removeAttributeForAttachment(t,e))},e.prototype.breakFormattedBlock=function(t){var e,n,i,o,r;return n=t.document,e=t.block,o=t.startPosition,r=[o-1,o],e.getBlockBreakPosition()===t.startLocation.offset?(e.breaksOnReturn()&&"\n"===t.nextCharacter?o+=1:n=n.removeTextAtRange(r),r=[o,o]):"\n"===t.nextCharacter?"\n"===t.previousCharacter?r=[o-1,o+1]:(r=[o,o+1],o+=1):t.startLocation.offset-1!==0&&(o+=1),i=new D.Document([e.removeLastAttribute().copyWithoutText()]),this.setDocument(n.insertDocumentAtRange(i,r)),this.setSelection(o)},e.prototype.getPreviousBlock=function(){var t,e;return(e=this.getLocationRange())&&(t=e[0].index,t>0)?this.document.getBlockAtIndex(t-1):void 0},e.prototype.getBlock=function(){var t;return(t=this.getLocationRange())?this.document.getBlockAtIndex(t[0].index):void 0},e.prototype.getAttachmentAtRange=function(t){var e;return e=this.document.getDocumentAtRange(t),e.toString()===D.OBJECT_REPLACEMENT_CHARACTER+"\n"?e.getAttachments()[0]:void 0},e.prototype.notifyDelegateOfCurrentAttributesChange=function(){var t;return null!=(t=this.delegate)&&"function"==typeof t.compositionDidChangeCurrentAttributes?t.compositionDidChangeCurrentAttributes(this.currentAttributes):void 0},e.prototype.notifyDelegateOfInsertionAtRange=function(t){var e;return null!=(e=this.delegate)&&"function"==typeof e.compositionDidPerformInsertionAtRange?e.compositionDidPerformInsertionAtRange(t):void 0},e.prototype.translateUTF16PositionFromOffset=function(t,e){var n,i;return i=this.document.toUTF16String(),n=i.offsetFromUCS2Offset(t),i.offsetToUCS2Offset(n+e)},e}(D.BasicObject)}.call(this),function(){var n=function(t,e){function n(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty;D.UndoManager=function(t){function e(t){this.composition=t,this.undoEntries=[],this.redoEntries=[]}var a;return n(e,t),e.prototype.recordUndoEntry=function(t,e){var n,i,o,r,s;return r=null!=e?e:{},i=r.context,n=r.consolidatable,o=this.undoEntries.slice(-1)[0],n&&a(o,t,i)?void 0:(s=this.createEntry({description:t,context:i}),this.undoEntries.push(s),this.redoEntries=[])},e.prototype.undo=function(){var t,e;return(e=this.undoEntries.pop())?(t=this.createEntry(e),this.redoEntries.push(t),this.composition.loadSnapsh
1ot(e.snapshot)):void 0},e.prototype.redo=function(){var t,e;return(t=this.redoEntries.pop())?(e=this.createEntry(t),this.undoEntries.push(e),this.composition.loadSnapshot(t.snapshot)):void 0},e.prototype.canUndo=function(){return this.undoEntries.length>0},e.prototype.canRedo=function(){return this.redoEntries.length>0},e.prototype.createEntry=function(t){var e,n,i;return i=null!=t?t:{},n=i.description,e=i.context,{description:null!=n?n.toString():void 0,context:JSON.stringify(e),snapshot:this.composition.getSnapshot()}},a=function(t,e,n){return(null!=t?t.description:void 0)===(null!=e?e.toString():void 0)&&(null!=t?t.context:void 0)===JSON.stringify(n)},e}(D.BasicObject)}.call(this),function(){var n;D.attachmentGalleryFilter=function(t){var e;return e=new n(t),e.perform(),e.getSnapshot()},n=function(){function t(t){this.document=t.document,this.selectedRange=t.selectedRange}var s,e,n;return s="attachmentGallery",e="presentation",n="gallery",t.prototype.perform=function(){return this.removeBlockAttribute(),this.applyBlockAttribute()},t.prototype.getSnapshot=function(){return{document:this.document,selectedRange:this.selectedRange}},t.prototype.removeBlockAttribute=function(){var t,e,n,i,o;for(i=this.findRangesOfBlocks(),o=[],t=0,e=i.length;e>t;t++)n=i[t],o.push(this.document=this.document.removeAttributeAtRange(s,n));return o},t.prototype.applyBlockAttribute=function(){var t,e,n,i,o,r;for(n=0,o=this.findRangesOfPieces(),r=[],t=0,e=o.length;e>t;t++)i=o[t],i[1]-i[0]>1&&(i[0]+=n,i[1]+=n,"\n"!==this.document.getCharacterAtPosition(i[1])&&(this.document=this.document.insertBlockBreakAtRange(i[1]),i[1]<this.selectedRange[1]&&this.moveSelectedRangeForward(),i[1]++,n++),0!==i[0]&&"\n"!==this.document.getCharacterAtPosition(i[0]-1)&&(this.document=this.document.insertBlockBreakAtRange(i[0]),i[0]<this.selectedRange[0]&&this.moveSelectedRangeForward(),i[0]++,n++),r.push(this.document=this.document.applyBlockAttributeAtRange(s,!0,i)));return r},t.prototype.findRangesOfBlocks=function(){return this.document.findRangesForBlockAttribute(s)},t.prototype.findRangesOfPieces=function(){return this.document.findRangesForTextAttribute(e,{withValue:n})},t.prototype.moveSelectedRangeForward=function(){return this.selectedRange[0]+=1,this.selectedRange[1]+=1},t}()}.call(this),function(){var o=function(t,e){return function(){return t.apply(e,arguments)}};D.Editor=function(){function t(t,e,n){this.composition=t,this.selectionManager=e,this.element=n,this.insertFiles=o(this.insertFiles,this),this.undoManager=new D.UndoManager(this.composition),this.filters=i.slice(0)}var i;return i=[D.attachmentGalleryFilter],t.prototype.loadDocument=function(t){return this.loadSnapshot({document:t,selectedRange:[0,0]})},t.prototype.loadHTML=function(t){return null==t&&(t=""),this.loadDocument(D.Document.fromHTML(t,{referenceElement:this.element}))},t.prototype.loadJSON=function(t){var e,n;return e=t.document,n=t.selectedRange,e=D.Document.fromJSON(e),this.loadSnapshot({document:e,selectedRange:n})},t.prototype.loadSnapshot=function(t){return this.undoManager=new D.UndoManager(this.composition),this.composition.loadSnapshot(t)},t.prototype.getDocument=function(){return this.composition.document},t.prototype.getSelectedDocument=function(){return this.composition.getSelectedDocument()},t.prototype.getSnapshot=function(){return this.composition.getSnapshot()},t.prototype.toJSON=function(){return this.getSnapshot()},t.prototype.deleteInDirection=function(t){return this.composition.deleteInDirection(t)},t.prototype.insertAttachment=function(t){return this.composition.insertAttachment(t)},t.prototype.insertAttachments=function(t){return this.composition.insertAttachments(t)},t.prototype.insertDocument=function(t){return this.composition.insertDocument(t)},t.prototype.insertFile=function(t){return this.composition.insertFile(t)},t.prototype.insertFiles=function(t){return this.composition.insertFiles(t)},t.prototype.insertHTML=function(t){return this.composition.insertHTML(t)},t.prototype.insertString=function(t){return this.composition.insertString(t)},t.prototype.insertText=function(t){return this.composition.insertText(t)},t.prototype.insertLineBreak=function(){return this.composition.insertLineBreak()},t.prototype.getSelectedRange=function(){return this.composition.getSelectedRange()},t.prototype.getPosition=function(){return this.composition.getPosition()},t.prototype.getClientRectAtPosition=function(t){var e;return e=this.getDocument().locationRangeFromRange([t,t+1]),this.selectionManager.getClientRectAtLocationRange(e)},t.prototype.expandSelectionInDirection=function(t){return this.composition.expandSelectionInDirection(t)},t.prototype.moveCursorInDirection=function(t){return this.composition.moveCursorInDirection(t)},t.prototype.setSelectedRange=function(t){return this.composition.setSelectedRange(t)}
1,t.prototype.activateAttribute=function(t,e){return null==e&&(e=!0),this.composition.setCurrentAttribute(t,e)},t.prototype.attributeIsActive=function(t){return this.composition.hasCurrentAttribute(t)},t.prototype.canActivateAttribute=function(t){return this.composition.canSetCurrentAttribute(t)},t.prototype.deactivateAttribute=function(t){return this.composition.removeCurrentAttribute(t)},t.prototype.canDecreaseNestingLevel=function(){return this.composition.canDecreaseNestingLevel()},t.prototype.canIncreaseNestingLevel=function(){return this.composition.canIncreaseNestingLevel()},t.prototype.decreaseNestingLevel=function(){return this.canDecreaseNestingLevel()?this.composition.decreaseNestingLevel():void 0},t.prototype.increaseNestingLevel=function(){return this.canIncreaseNestingLevel()?this.composition.increaseNestingLevel():void 0},t.prototype.canRedo=function(){return this.undoManager.canRedo()},t.prototype.canUndo=function(){return this.undoManager.canUndo()},t.prototype.recordUndoEntry=function(t,e){var n,i,o;return o=null!=e?e:{},i=o.context,n=o.consolidatable,this.undoManager.recordUndoEntry(t,{context:i,consolidatable:n})},t.prototype.redo=function(){return this.canRedo()?this.undoManager.redo():void 0},t.prototype.undo=function(){return this.canUndo()?this.undoManager.undo():void 0},t}()}.call(this),function(){var n=function(t,e){function n(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty;D.ManagedAttachment=function(t){function e(t,e){var n;this.attachmentManager=t,this.attachment=e,n=this.attachment,this.id=n.id,this.file=n.file}return n(e,t),e.prototype.remove=function(){return this.attachmentManager.requestRemovalOfAttachment(this.attachment)},e.proxyMethod("attachment.getAttribute"),e.proxyMethod("attachment.hasAttribute"),e.proxyMethod("attachment.setAttribute"),e.proxyMethod("attachment.getAttributes"),e.proxyMethod("attachment.setAttributes"),e.proxyMethod("attachment.isPending"),e.proxyMethod("attachment.isPreviewable"),e.proxyMethod("attachment.getURL"),e.proxyMethod("attachment.getHref"),e.proxyMethod("attachment.getFilename"),e.proxyMethod("attachment.getFilesize"),e.proxyMethod("attachment.getFormattedFilesize"),e.proxyMethod("attachment.getExtension"),e.proxyMethod("attachment.getContentType"),e.proxyMethod("attachment.getFile"),e.proxyMethod("attachment.setFile"),e.proxyMethod("attachment.releaseFile"),e.proxyMethod("attachment.getUploadProgress"),e.proxyMethod("attachment.setUploadProgress"),e}(D.BasicObject)}.call(this),function(){var n=function(t,e){function n(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty;D.AttachmentManager=function(t){function e(t){var e,n,i;for(null==t&&(t=[]),this.managedAttachments={},n=0,i=t.length;i>n;n++)e=t[n],this.manageAttachment(e)}return n(e,t),e.prototype.getAttachments=function(){var t,e,n,i;n=this.managedAttachments,i=[];for(e in n)t=n[e],i.push(t);return i},e.prototype.manageAttachment=function(t){var e,n;return null!=(e=this.managedAttachments)[n=t.id]?e[n]:e[n]=new D.ManagedAttachment(this,t)},e.prototype.attachmentIsManaged=function(t){return t.id in this.managedAttachments},e.prototype.requestRemovalOfAttachment=function(t){var e;return this.attachmentIsManaged(t)&&null!=(e=this.delegate)&&"function"==typeof e.attachmentManagerDidRequestRemovalOfAttachment?e.attachmentManagerDidRequestRemovalOfAttachment(t):void 0},e.prototype.unmanageAttachment=function(t){var e;return e=this.managedAttachments[t.id],delete this.managedAttachments[t.id],e},e}(D.BasicObject)}.call(this),function(){var p,d,n,a,f,u,g,i,m,o,v;p=D.elementContainsNode,d=D.findChildIndexOfNode,f=D.nodeIsBlockStart,u=D.nodeIsBlockStartComment,a=D.nodeIsBlockContainer,g=D.nodeIsCursorTarget,i=D.nodeIsEmptyTextNode,m=D.nodeIsTextNode,n=D.nodeIsAttachmentElement,o=D.tagName,v=D.walkTree,D.LocationMapper=function(){function t(t){this.element=t}var s,l,h,e;return t.prototype.findLocationFromContainerAndOffset=function(t,e,n){var i,o,r,s,a,u,c;for(u=(null!=n?n:{strict:!0}).strict,o=0,r=!1,s={index:0,offset:0},(i=this.findAttachmentElementParentForNode(t))&&(t=i.parentNode,e=d(i)),c=v(this.element,{usingFilter:h});c.nextNode();
1){if(a=c.currentNode,a===t&&m(t)){g(a)||(s.offset+=e);break}if(a.parentNode===t){if(o++===e)break}else if(!p(t,a)&&o>0)break;f(a,{strict:u})?(r&&s.index++,s.offset=0,r=!0):s.offset+=l(a)}return s},t.prototype.findContainerAndOffsetFromLocation=function(t){var e,n,i,o,r;if(0===t.index&&0===t.offset){for(e=this.element,o=0;e.firstChild;)if(e=e.firstChild,a(e)){o=1;break}return[e,o]}if(r=this.findNodeAndOffsetFromLocation(t),n=r[0],i=r[1],n){if(m(n))0===l(n)?(e=n.parentNode.parentNode,o=d(n.parentNode),g(n,{name:"right"})&&o++):(e=n,o=t.offset-i);else{if(e=n.parentNode,!f(n.previousSibling)&&!a(e))for(;n===e.lastChild&&(n=e,e=e.parentNode,!a(e)););o=d(n),0!==t.offset&&o++}return[e,o]}},t.prototype.findNodeAndOffsetFromLocation=function(t){var e,n,i,o,r,s,a,u;for(a=0,u=this.getSignificantNodesForIndex(t.index),n=0,i=u.length;i>n;n++){if(e=u[n],o=l(e),t.offset<=a+o)if(m(e)){if(r=e,s=a,t.offset===s&&g(r))break}else r||(r=e,s=a);if(a+=o,a>t.offset)break}return[r,s]},t.prototype.findAttachmentElementParentForNode=function(t){for(;t&&t!==this.element;){if(n(t))return t;t=t.parentNode}},t.prototype.getSignificantNodesForIndex=function(t){var e,n,i,o,r;for(i=[],r=v(this.element,{usingFilter:s}),o=!1;r.nextNode();)if(n=r.currentNode,u(n)){if("undefined"!=typeof e&&null!==e?e++:e=0,e===t)o=!0;else if(o)break}else o&&i.push(n);return i},l=function(t){var e;return t.nodeType===Node.TEXT_NODE?g(t)?0:(e=t.textContent,e.length):"br"===o(t)||n(t)?1:0},s=function(t){return e(t)===NodeFilter.FILTER_ACCEPT?h(t):NodeFilter.FILTER_REJECT},e=function(t){return i(t)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},h=function(t){return n(t.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},t}()}.call(this),function(){var c,l,o=[].slice;c=D.getDOMRange,l=D.setDOMRange,D.PointMapper=function(){function t(){}return t.prototype.createDOMRangeFromPoint=function(t){var e,n,i,o,r,s,a,u;if(a=t.x,u=t.y,document.caretPositionFromPoint)return r=document.caretPositionFromPoint(a,u),i=r.offsetNode,n=r.offset,e=document.createRange(),e.setStart(i,n),e;if(document.caretRangeFromPoint)return document.caretRangeFromPoint(a,u);if(document.body.createTextRange){o=c();try{s=document.body.createTextRange(),s.moveToPoint(a,u),s.select()}catch(t){}return e=c(),l(o),e}},t.prototype.getClientRectsForDOMRange=function(t){var e,n,i;return n=o.call(t.getClientRects()),i=n[0],e=n[n.length-1],[i,e]},t}()}.call(this),function(){var i,o=function(t,e){return function(){return t.apply(e,arguments)}},r=function(t,e){function n(){this.constructor=t}for(var i in e)s.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty,a=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};i=D.getDOMRange,D.SelectionChangeObserver=function(t){function e(){this.run=o(this.run,this),this.update=o(this.update,this),this.selectionManagers=[]}var n;return r(e,t),e.prototype.start=function(){return this.started?void 0:(this.started=!0,"onselectionchange"in document?document.addEventListener("selectionchange",this.update,!0):this.run())},e.prototype.stop=function(){return this.started?(this.started=!1,document.removeEventListener("selectionchange",this.update,!0)):void 0},e.prototype.registerSelectionManager=function(t){return a.call(this.selectionManagers,t)<0?(this.selectionManagers.push(t),this.start()):void 0},e.prototype.unregisterSelectionManager=function(o){var r;return this.selectionManagers=function(){var t,e,n,i;for(n=this.selectionManagers,i=[],t=0,e=n.length;e>t;t++)r=n[t],r!==o&&i.push(r);return i}.call(this),0===this.selectionManagers.length?this.stop():void 0},e.prototype.notifySelectionManagersOfSelectionChange=function(){var t,e,n,i,o;for(n=this.selectionManagers,i=[],t=0,e=n.length;e>t;t++)o=n[t],i.push(o.selectionDidChange());return i},e.prototype.update=function(){var t;return t=i(),n(t,this.domRange)?void 0:(this.domRange=t,this.notifySelectionManagersOfSelectionChange())},e.prototype.reset=function(){return this.domRange=null,this.update()},e.prototype.run=function(){return this.started?(this.update(),requestAnimationFrame(this.run)):void 0},n=function(t,e){return(null!=t?t.startContainer:void 0)===(null!=e?e.startContainer:void 0)&&(null!=t?t.startOffset:void 0)===(null!=e?e.startOffset:void 0)&&(null!=t?t.endContainer:void 0)===(null!=e?e.endContainer:void 0)&&(null!=t?t.endOffset:void 0)===(null!=e?e.endOffset:void 0)},e}(D.BasicObject),null==D.selectionChangeObserver&&(D.selectionChangeObserver=new D.SelectionChangeObserver)}.call(this),function(){var u,i,n,c,o,r,s,a,l,h,p=function(t,e){return function(){return t.apply(e,arguments)}},d=function(t,e){function n(){this.constructor=t}for(var i in e)f.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},f={}.hasOwnProperty;n=D.getDOMSelection,i=D.getDOMRange,h=D.setDOMRange,u=D.elementContainsNode,r=D.nodeIsCursorTarget,o=D.innerElementIsActive,c=D.handleEvent,s=D.normalizeRange,a=D.rangeIsCollapsed,l=D.rangesAreEqual,D.SelectionManager=function(t){function e(t){this.element=t,this.selectionDidChange=p(this.selectionDidChange,this),this.didMouseDown=p(this.didMouseDown,this),this.locationMapper=new D.LocationMapper(this.element),this.pointMapper=new D.PointMapper,this.lockCount=0,c("mousedown",{onElement:this.element,withCallback:this.didMouseDown})}return d(e,t),e.prototype.getLocationRange=function(t){var e,n;return null==t&&(t={}),e=t.strict===!1?this.createLocationRangeFromDOMRange(i(),{strict:!1}):t.ignoreLock?this.currentLocationRange:null!=(n=this.lockedLocationRange)?n:this.currentLocationRange},e.prototype.setLocationRange=function(t){var e;if(!this.lockedLocationRange)return t=s(t),(e=this.createDOMRangeFromLocationRange(t))?(h(e),this.updateCurrentLocationRange(t)):void 0},e.prototype.setLocationRangeFromPointRange=function(t){var e,n;return t=s(t),n=this.getLocationAtPoint(t[0]),e=this.getLocationAtPoint(t[1]),this.setLocationRange([n,e])},e.prototype.getClientRectAtLocationRange=function(t){var e;return(e=this.createDOMRangeFromLocationRange(t))?this.getClientRectsForDOMRange(e)[1]:void 0},e.prototype.locationIsCursorTarget=function(t){var e,n,i;return i=this.findNodeAndOffsetFromLocation(t),e=i[0],n=i[1],r(e)},e.prototype.lock=function(){return 0===this.lockCount++?(this.updateCurrentLocationRange(),this.lockedLocationRange=this.getLocationRange()):void 0},e.prototype.unlock=function(){var t;return 0===--this.lockCount&&(t=this.lockedLocationRange,this.lockedLocationRange=null,null!=t)?this.setLocationRange(t):void 0},e.prototype.clearSelection=function(){var t;return null!=(t=n())?t.removeAllRanges():void 0},e.prototype.selectionIsCollapsed=function(){var t;return(null!=(t=i())?t.collapsed:void 0)===!0},e.prototype.selectionIsExpanded=function(){return!this.selectionIsCollapsed()},e.prototype.createLocationRangeFromDOMRange=function(t,e){var n,i;if(null!=t&&this.domRangeWithinElement(t)&&(i=this.findLocationFromContainerAndOffset(t.startContainer,t.startOffset,e)))return t.collapsed||(n=this.findLocationFromContainerAndOffset(t.endContainer,t.endOffset,e)),s([i,n])},e.proxyMethod("locationMapper.findLocationFromContainerAndOffset"),e.proxyMethod("locationMapper.findContainerAndOffsetFromLocation"),e.proxyMethod("locationMapper.findNodeAndOffsetFromLocation"),e.proxyMethod("pointMapper.createDOMRangeFromPoint"),e.proxyMethod("pointMapper.getClientRectsForDOMRange"),e.prototype.didMouseDown=function(){return this.pauseTemporarily()},e.prototype.pauseTemporarily=function(){var o,r,s,a;return this.paused=!0,r=function(i){return function(){var t,e,n;for(i.paused=!1,clearTimeout(a),e=0,n=s.length;n>e;e++)t=s[e],t.destroy();return u(document,i.element)?i.selectionDidChange():void 0}}(this),a=setTimeout(r,200),s=function(){var t,e,n,i;for(n=["mousemove","keydown"],i=[],t=0,e=n.length;e>t;t++)o=n[t],i.push(c(o,{onElement:document,withCallback:r}));return i}()},e.prototype.selectionDidChange=function(){return this.paused||o(this.element)?void 0:this.updateCurrentLocationRange()},e.prototype.updateCurrentLocationRange=function(t){var e;return(null!=t?t:t=this.createLocationRangeFromDOMRange(i()))&&!l(t,this.currentLocationRange)?(this.currentLocationRange=t,null!=(e=this.delegate)&&"function"==typeof e.locationRangeDidChange?e.locationRangeDidChange(this.currentLocationRange.slice(0)):void 0):void 0},e.prototype.createDOMRangeFromLocationRange=function(t){var e,n,i,o;return i=this.findContainerAndOffsetFromLocation(t[0]),n=a(t)?i:null!=(o=this.findContainerAndOffsetFromLocation(t[1]))?o:i,null!=i&&null!=n?(e=document.createRange(),e.setStart.apply(e,i),e.setEnd.apply(e,n),e):void 0},e.prototype.getLocationAtPoint=function(t){var e,n;return(e=this.createDOMRangeFromPoint(t))&&null!=(n=this.createLocationRangeFromDOMRange(e))?n[0]:void 0},e.prototype.domRangeWithinElement=function(t){return t.collapsed?u(this.element,t.startContainer):u(this.element,t.startContainer)&&u(this.element,t.endContainer)},e}(D.BasicObject)}.call(this),function(){var i,n,o,r,s=function(t,e){function n(){this.constructor=t}for(var i in e)a.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty,c=[].slice;o=D.rangeIsCollapsed,r=D.rangesAreEqual,n=D.objectsAreEqual,i=D.getBlockConfig,D.EditorController=function(t){function e(t){var e,n;this.editorElement=t.editorElement,e=t.document,n=t.html,this.selectionManager=new D.SelectionManager(this.editorElement),this.selectionManager.delegate=this,this.composition=new D.Composition,this.composition.delegate=this,this.attachmentManager=new D.AttachmentManager(this.composition.getAttachments()),this.attachmentManager.delegate=this,this.inputController=new(D["Level"+D.config.input.getLevel()+"InputController"])(this.editorElement),this.inputController.delegate=this,this.inputController.responder=this.composition,this.compositionController=new D.CompositionController(this.editorElement,this.composition),this.compositionController.delegate=this,this.toolbarController=new D.ToolbarController(this.editorElement.toolbarElement),this.toolbarController.delegate=this,this.editor=new D.Editor(this.composition,this.selectionManager,this.editorElement),null!=e?this.editor.loadDocument(e):this.editor.loadHTML(n)}var u;return s(e,t),e.prototype.registerSelectionManager=function(){return D.selectionChangeObserver.registerSelectionManager(this.selectionManager)},e.prototype.unregisterSelectionManager=function(){return D.selectionChangeObserver.unregisterSelectionManager(this.selectionManager)},e.prototype.render=function(){return this.compositionController.render()},e.prototype.reparse=function(){return this.composition.replaceHTML(this.editorElement.innerHTML)},e.prototype.compositionDidChangeDocument=function(){return this.notifyEditorElement("document-change"),this.handlingInput?void 0:this.render()},e.prototype.compositionDidChangeCurrentAttributes=function(t){return this.currentAttributes=t,this.toolbarController.updateAttributes(this.currentAttributes),this.updateCurrentActions(),this.notifyEditorElement("attributes-change",{attributes:this.currentAttributes})},e.prototype.compositionDidPerformInsertionAtRange=function(t){return this.pasting?this.pastedRange=t:void 0},e.prototype.compositionShouldAcceptFile=function(t){return this.notifyEditorElement("file-accept",{file:t})},e.prototype.compositionDidAddAttachment=function(t){var e;return e=this.attachmentManager.manageAttachment(t),this.notifyEditorElement("attachment-add",{attachment:e})},e.prototype.compositionDidEditAttachment=function(t){var e;return this.compositionController.rerenderViewForObject(t),e=this.attachmentManager.manageAttachment(t),this.notifyEditorElement("attachment-edit",{attachment:e}),this.notifyEditorElement("change")},e.prototype.compositionDidChangeAttachmentPreviewURL=function(t){return this.compositionController.invalidateViewForObject(t),this.notifyEditorElement("change")},e.prototype.compositionDidRemoveAttachment=function(t){var e;return e=this.attachmentManager.unmanageAttachment(t),this.notifyEditorElement("attachment-remove",{attachment:e})},e.prototype.compositionDidStartEditingAttachment=function(t,e){return this.attachmentLocationRange=this.composition.document.getLocationRangeOfAttachment(t),this.compositionController.installAttachmentEditorForAttachment(t,e),this.selectionManager.setLocationRange(this.attachmentLocationRange)},e.prototype.compositionDidStopEditingAttachment=function(){return this.compositionController.uninstallAttachmentEditor(),this.attachmentLocationRange=null},e.prototype.compositionDidRequestChangingSelectionToLocationRange=function(t){return!this.loadingSnapshot||this.isFocused()?(this.requestedLocationRange=t,this.compositionRevisionWhe
1nLocationRangeRequested=this.composition.revision,this.handlingInput?void 0:this.render()):void 0},e.prototype.compositionWillLoadSnapshot=function(){return this.loadingSnapshot=!0},e.prototype.compositionDidLoadSnapshot=function(){return this.compositionController.refreshViewCache(),this.render(),this.loadingSnapshot=!1},e.prototype.getSelectionManager=function(){return this.selectionManager},e.proxyMethod("getSelectionManager().setLocationRange"),e.proxyMethod("getSelectionManager().getLocationRange"),e.prototype.attachmentManagerDidRequestRemovalOfAttachment=function(t){return this.removeAttachment(t)},e.prototype.compositionControllerWillSyncDocumentView=function(){return this.inputController.editorWillSyncDocumentView(),this.selectionManager.lock(),this.selectionManager.clearSelection()},e.prototype.compositionControllerDidSyncDocumentView=function(){return this.inputController.editorDidSyncDocumentView(),this.selectionManager.unlock(),this.updateCurrentActions(),this.notifyEditorElement("sync")},e.prototype.compositionControllerDidRender=function(){return null!=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},e.prototype.compositionControllerDidFocus=function(){return this.toolbarController.hideDialog(),this.notifyEditorElement("focus")},e.prototype.compositionControllerDidBlur=function(){return this.notifyEditorElement("blur")},e.prototype.compositionControllerDidSelectAttachment=function(t,e){return this.composition.editAttachment(t,e)},e.prototype.compositionControllerDidRequestDeselectingAttachment=function(t){var e,n;return e=null!=(n=this.attachmentLocationRange)?n:this.composition.document.getLocationRangeOfAttachment(t),this.selectionManager.setLocationRange(e[1])},e.prototype.compositionControllerWillUpdateAttachment=function(t){return this.editor.recordUndoEntry("Edit Attachment",{context:t.id,consolidatable:!0})},e.prototype.compositionControllerDidRequestRemovalOfAttachment=function(t){return this.removeAttachment(t)},e.prototype.inputControllerWillHandleInput=function(){return this.handlingInput=!0,this.requestedRender=!1},e.prototype.inputControllerDidRequestRender=function(){return this.requestedRender=!0},e.prototype.inputControllerDidHandleInput=function(){return this.handlingInput=!1,this.requestedRender?(this.requestedRender=!1,this.render()):void 0},e.prototype.inputControllerDidAllowUnhandledInput=function(){return this.notifyEditorElement("change")},e.prototype.inputControllerDidRequestReparse=function(){return this.reparse()},e.prototype.inputControllerWillPerformTyping=function(){return this.recordTypingUndoEntry()},e.prototype.inputControllerWillPerformFormatting=function(t){return this.recordFormattingUndoEntry(t)},e.prototype.inputControllerWillCutText=function(){return this.editor.recordUndoEntry("Cut")},e.prototype.inputControllerWillPaste=function(t){return this.editor.recordUndoEntry("Paste"),this.pasting=!0,this.notifyEditorElement("before-paste",{paste:t})},e.prototype.inputControllerDidPaste=function(t){return t.range=this.pastedRange,this.pastedRange=null,this.pasting=null,this.notifyEditorElement("paste",{paste:t})},e.prototype.inputControllerWillMoveText=function(){return this.editor.recordUndoEntry("Move")},e.prototype.inputControllerWillAttachFiles=function(){return this.editor.recordUndoEntry("Drop Files")},e.prototype.inputControllerWillPerformUndo=function(){return this.editor.undo()},e.prototype.inputControllerWillPerformRedo=function(){return this.editor.redo()},e.prototype.inputControllerDidReceiveKeyboardCommand=function(t){return this.toolbarController.applyKeyboardCommand(t)},e.prototype.inputControllerDidStartDrag=function(){return this.locationRangeBeforeDrag=this.selectionManager.getLocationRange()},e.prototype.inputControllerDidReceiveDragOverPoint=function(t){return this.selectionManager.setLocationRangeFromPointRange(t)},e.prototype.inputControllerDidCancelDrag=function(){return this.selectionManager.setLocationRange(this.locationRangeBeforeDrag),this.locationRangeBeforeDrag=null},e.prototype.locationRangeDidChange=function(t){return this.composition.updateCurrentAttributes(),this.updateCurrentActions(),this.attachmentLocationRange&&!r(this.attachmentLocationRange,t)&&this.composition.stopEditingAttachment(),this.notifyEditorElement("selection-change")},e.prototype.toolbarDidClickButton=function(){return this.getLocationRange()?void 0:this.setLocationRange({index:0,offset:0})},e.prototype.toolbarDidInvokeAction=function(t){return this.invokeAction(t)},e.prototype.toolbarDidToggleAttribute=function(t){return this.recordFormattingUndoEntry(t),this.composition.toggleCurrentAttribute(t),this.render(),this.selectionFrozen?void 0:this.editorElement.focus()},e.prototype.toolbarDidUpdateAttribute=function(t,e){return this.recordFormattingUndoEntry(t),this.composition.setCurrentAttribute(t,e),this.render(),this.selectionFrozen?void 0:this.editorElement.focus()},e.prototype.toolbarDidRemoveAttribute=function(t){return this.recordFormattingUndoEntry(t),this.composition.removeCurrentAttribute(t),this.render(),this.selectionFrozen?void 0:this.editorElement.focus()},e.prototype.toolbarWillShowDialog=function(){return this.composition.expandSelectionForEditing(),this.freezeSelection()},e.prototype.toolbarDidShowDialog=function(t){return this.notifyEditorElement("toolbar-dialog-show",{dialogName:t})},e.prototype.toolbarDidHideDialog=function(t){return this.thawSelection(),this.editorElement.focus(),this.notifyEditorElement("toolbar-dialog-hide",{dialogName:t})},e.prototype.freezeSelection=function(){return this.selectionFrozen?void 0:(this.selectionManager.lock(),this.composition.freezeSelection(),this.selectionFrozen=!0,this.render())},e.prototype.thawSelection=function(){return this.selectionFrozen?(this.composition.thawSelection(),this.selectionManager.unlock(),this.selectionFrozen=!1,this.render()):void 0},e.prototype.actions={undo:{test:function(){return this.editor.canUndo()},perform:function(){return this.editor.undo()}},redo:{test:function(){return this.editor.canRedo()},perform:function(){return this.editor.redo()}},link:{test:function(){return this.editor.canActivateAttribute("href")}},increaseNestingLevel:{test:function(){return this.editor.canIncreaseNestingLevel()},perform:function(){return this.editor.increaseNestingLevel()&&this.render()}},decreaseNestingLevel:{test:function(){return this.editor.canDecreaseNestingLevel()},perform:function(){return this.editor.decreaseNestingLevel()&&this.render()}},attachFiles:{test:function(){return!0},perform:function(){return D.config.input.pickFiles(this.editor.insertFiles)}}},e.prototype.canInvokeAction=function(t){var e,n;return this.actionIsExternal(t)?!0:!!(null!=(e=this.actions[t])&&null!=(n=e.test)?n.c
1all(this):void 0)},e.prototype.invokeAction=function(t){var e,n;return this.actionIsExternal(t)?this.notifyEditorElement("action-invoke",{actionName:t}):null!=(e=this.actions[t])&&null!=(n=e.perform)?n.call(this):void 0},e.prototype.actionIsExternal=function(t){return/^x-./.test(t)},e.prototype.getCurrentActions=function(){var t,e;e={};for(t in this.actions)e[t]=this.canInvokeAction(t);return e},e.prototype.updateCurrentActions=function(){var t;return t=this.getCurrentActions(),n(t,this.currentActions)?void 0:(this.currentActions=t,this.toolbarController.updateActions(this.currentActions),this.notifyEditorElement("actions-change",{actions:this.currentActions}))},e.prototype.runEditorFilters=function(){var t,e,n,i,o,r,s,a;for(a=this.composition.getSnapshot(),o=this.editor.filters,n=0,i=o.length;i>n;n++)e=o[n],t=a.document,s=a.selectedRange,a=null!=(r=e.call(this.editor,a))?r:{},null==a.document&&(a.document=t),null==a.selectedRange&&(a.selectedRange=s);return u(a,this.composition.getSnapshot())?void 0:this.composition.loadSnapshot(a)},u=function(t,e){return r(t.selectedRange,e.selectedRange)&&t.document.isEqualTo(e.document)},e.prototype.updateInputElement=function(){var t,e;return t=this.compositionController.getSerializableElement(),e=D.serializeToContentType(t,"text/html"),this.editorElement.setInputElementValue(e)},e.prototype.notifyEditorElement=function(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)},e.prototype.removeAttachment=function(t){return this.editor.recordUndoEntry("Delete Attachment"),this.composition.removeAttachment(t),this.render()},e.prototype.recordFormattingUndoEntry=function(t){var e,n;return e=i(t),n=this.selectionManager.getLocationRange(),e||!o(n)?this.editor.recordUndoEntry("Formatting",{context:this.getUndoContext(),consolidatable:!0}):void 0},e.prototype.recordTypingUndoEntry=function(){return this.editor.recordUndoEntry("Typing",{context:this.getUndoContext(this.currentAttributes),consolidatable:!0})},e.prototype.getUndoContext=function(){var t;return t=1<=arguments.length?c.call(arguments,0):[],[this.getLocationContext(),this.getTimeContext()].concat(c.call(t))},e.prototype.getLocationContext=function(){var t;return t=this.selectionManager.getLocationRange(),o(t)?t[0].index:t},e.prototype.getTimeContext=function(){return D.config.undoInterval>0?Math.floor((new Date).getTime()/D.config.undoInterval):0},e.prototype.isFocused=function(){var t;return this.editorElement===(null!=(t=this.editorElement.ownerDocument)?t.activeElement:void 0)},e}(D.Controller)}.call(this),function(){var u,c,l,h,p,d;c=D.browser,p=D.makeElement,d=D.triggerEvent,l=D.handleEvent,h=D.handleEventOnce,u=D.AttachmentView.attachmentSelector,D.registerElement("trix-editor",function(){var t,e,n,i,o,r,s,a;return r=0,e=function(t){return!document.querySelector(":focus")&&t.hasAttribute("autofocus")&&document.querySelector("[autofocus]")===t?t.focus():void 0},s=function(t){return t.hasAttribute("contenteditable")?void 0:(t.setAttribute("contenteditable",""),h("focus",{onElement:t,withCallback:function(){return n(t)}}))},t=function(t){return t.hasAttribute("role")?void 0:t.setAttribute("role","textbox")},n=function(t){return o(t),a(t)},o=function(t){return("function"==typeof document.queryCommandSupported?document.queryCommandSupported("enableObjectResizing"):void 0)?(document.execCommand("enableObjectResizing",!1,!1),l("mscontrolselect",{onElement:t,preventDefault:!0})):void 0},a=function(){var t;return("function"==typeof document.queryCommandSupported?document.queryCommandSupported("DefaultParagraphSeparator"):void 0)&&(t=D.config.blockAttributes["default"].tagName,"div"===t||"p"===t)?document.execCommand("DefaultParagraphSeparator",!1,t):void 0},i=function(){return c.forcesObjectResizing?{display:"inline",width:"auto"}:{display:"inline-block",width:"1px"}}(),{defaultCSS:"%t {\n  display: block;\n}\n\n%t:empty:not(:focus)::before {\n  content: attr(placeholder);\n  color: graytext;\n  cursor: text;\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 "+u+" figcaption textarea {\n  resize: none;\n}\n\n%t "+u+" figcaption textarea.trix-autoresize-clone {\n  position: absolute;\n  left: -9999px;\n  max-height: 0px;\n}\n\n%t "+u+" 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: "+i.display+" !important;\n  width: "+i.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}",trixId:{get:function(){return this.hasAttribute("trix-id")?this.getAttribute("trix-id"):(this.setAttribute("trix-id",++r),this.trixId)}},toolbarElement:{get:function(){var t,e,n;return this.hasAttribute("toolbar")?null!=(e=this.ownerDocument)?e.getElementById(this.getAttribute("toolbar")):void 0:this.parentNode?(n="trix-toolbar-"+this.trixId,this.setAttribute("toolbar",n),t=p("trix-toolbar",{id:n}),this.parentNode.insertBefore(t,this),t):void 0}},inputElement:{get:function(){var t,e,n;return this.hasAttribute("input")?null!=(n=this.ownerDocument)?n.getElementById(this.getAttribute("input")):void 0:this.parentNode?(e="trix-input-"+this.trixId,this.setAttribute("input",e),t=p("input",{type:"hidden",id:e}),this.parentNode.insertBefore(t,this.nextElementSibling),t):void 0}},editor:{get:function(){var t;return null!=(t=this.editorController)?t.editor:void 0}},name:{get:function(){var t;return null!=(t=this.inputElement)?t.name:void 0}},value:{get:function(){var t;return null!=(t=this.inputElement)?t.value:void 0},set:function(t){var e;return this.defaultValue=t,null!=(e=this.editor)?e.loadHTML(this.defaultValue):void 0}},notify:function(t,e){return this.editorController?d("trix-"+t,{onElement:this,attributes:e}):void 0},setInputElementValue:function(t){var e;return null!=(e=this.inputElement)?e.value=t:void 0},initialize:function(){return s(this),t(this)},connect:function(){return this.hasAttribute("data-trix-internal")?void 0:(this.editorController||(d("trix-before-initialize",{onElement:this}),this.editorController=new D.EditorController({editorElement:this,html:this.defaultValue=this.value}),requestAnimationFrame(function(t){return function(){return d("trix-initialize",{onElement:t})}}(this))),this.editorController.registerSelectionManager(),this.registerResetListener(),e(this))},disconnect:function(){var t;return null!=(t=this.editorController)&&t.unregisterSelectionManager(),this.unregisterResetListener()},registerResetListener:function(){return this.resetListener=this.resetBubbled.bind(this),window.addEventListener("reset",this.resetListener,!1)},unregisterResetListener:function(){return window.removeEventListener("reset",this.resetListener,!1)},resetBubbled:function(t){var e;return t.target!==(null!=(e=this.inputElement)?e.form:void 0)||t.defaultPrevented?void 0:this.reset()},reset:function(){return this.value=this.defaultValue}}}())}.call(this),function(){}.call(this)}).call(this),"object"==typeof module&&module.exports?module.exports=D:"function"==typeof define&&define.amd&&define(D)}.call(this);

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.