"), o("click", {
onElement: n,
withCallback: this.didClickToolbar
}), o("click", {
onElement: n,
matchingSelector: "[data-trix-action]",
withCallback: this.didClickActionButton
}), {
"do": function (t) {
return function () {
return t.element.appendChild(n)
}
}(this), undo: function () {
return function () {
return e.removeNode(n)
}
}(this)
}
}), p.prototype.installCaptionEditor = d(function () {
var i, r, u, c, l;
return c = a({
tagName: "textarea",
className: t.attachmentCaptionEditor,
attributes: {placeholder: s.captionPlaceholder},
data: {trixMutable: !0}
}), c.value = this.attachmentPiece.getCaption(), l = c.cloneNode(), l.classList.add("trix-autoresize-clone"), l.tabIndex = -1, i = function () {
return l.value = c.value, c.style.height = l.scrollHeight + "px"
}, o("input", {onElement: c, withCallback: i}), o("input", {
onElement: c,
withCallback: this.didInputCaption
}), o("keydown", {onElement: c, withCallback: this.didKeyDownCaption}), o("change", {
onElement: c,
withCallback: this.didChangeCaption
}), o("blur", {
onElement: c,
withCallback: this.didBlurCaption
}), u = this.element.querySelector("figcaption"), r = u.cloneNode(), {
"do": function (e) {
return function () {
return u.style.display = "none", r.appendChild(c), r.appendChild(l), r.classList.add(t.attachmentCaption + "--editing"), u.parentElement.insertBefore(r, u), i(), e.options.editCaption ? n(function () {
return c.focus()
}) : void 0
}
}(this), undo: function () {
return e.removeNode(r), u.style.display = null
}
}
}), p.prototype.didClickToolbar = function (t) {
return t.preventDefault(), t.stopPropagation()
}, p.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
}
}, p.prototype.didKeyDownCaption = function (t) {
var e;
return "return" === r[t.keyCode] ? (t.preventDefault(), this.savePendingCaption(), null != (e = this.delegate) && "function" == typeof e.attachmentEditorDidRequestDeselectingAttachment ? e.attachmentEditorDidRequestDeselectingAttachment(this.attachment) : void 0) : void 0
}, p.prototype.didInputCaption = function (t) {
return this.pendingCaption = t.target.value.replace(/\s/g, " ").trim()
}, p.prototype.didChangeCaption = function () {
return this.savePendingCaption()
}, p.prototype.didBlurCaption = function () {
return this.savePendingCaption()
}, p
}(e.BasicObject)
}.call(this), function () {
var t, 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;
i = e.makeElement, t = e.config.css, e.AttachmentView = function (r) {
function s() {
s.__super__.constructor.apply(this, arguments), this.attachment = this.object, this.attachment.uploadProgressDelegate = this, this.attachmentPiece = this.options.piece
}
var a;
return o(s, r), s.attachmentSelector = "[data-trix-attachment]", s.prototype.createContentNodes = function () {
return []
}, s.prototype.createNodes = function () {
var e, n, o, r, s, u, c;
if (e = r = i({
tagName: "figure",
className: this.getClassName(),
data: this.getData(),
editable: !1
}), (n = this.getHref()) && (r = i({
tagName: "a",
editable: !1,
attributes: {href: n, tabindex: -1}
}), e.appendChild(r)), this.attachment.hasContent()) r.innerHTML = this.attachment.getContent(); else for (c = this.createContentNodes(), o = 0, s = c.length; s > o; o++) u = c[o], r.appendChild(u);
return r.appendChild(this.createCaptionElement()), this.attachment.isPending() && (this.progressElement = i({
tagName: "progress",
attributes: {
"class": t.attachmentProgress,
value: this.attachment.getUploadProgress(),
max: 100
},
data: {trixMutable: !0, trixStoreKey: ["progressElement", this.attachment.id].join("/")}
}), e.appendChild(this.progressElement)), [a("left"), e, a("right")]
}, s.prototype.createCaptionElement = function () {
var e, n, o, r, s, a, u;
return o = i({
tagName: "figcaption",
className: t.attachmentCaption
}), (e = this.attachmentPiece.getCaption()) ? (o.classList.add(t.attachmentCaption + "--edited"), o.textContent = e) : (n = this.getCaptionConfig(), n.name && (r = this.attachment.getFilename()), n.size && (a = this.attachment.getFormattedFilesize()), r && (s = i({
tagName: "span",
className: t.attachmentName,
textContent: r
}), o.appendChild(s)), a && (r && o.appendChild(document.createTextNode(" ")), u = i({
tagName: "span",
className: t.attachmentSize,
textContent: a
}), o.appendChild(u))), o
}, s.prototype.getClassName = function () {
var e, n;
return n = [t.attachment, t.attachment + "--" + this.attachment.getType()], (e = this.attachment.getExtension()) && n.push(t.attachment + "--" + e), n.join(" ")
}, s.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
}, s.prototype.getHref = function () {
return n(this.attachment.getContent(), "a") ? void 0 : this.attachment.getHref()
}, s.prototype.getCaptionConfig = function () {
var t, n, i;
return i = this.attachment.getType(), t = e.copyObject(null != (n = e.config.attachments[i]) ? n.caption : void 0), "file" === i && (t.name = !0), t
}, s.prototype.findProgressElement = function () {
var t;
return null != (t = this.findElement()) ? t.querySelector("progress") : void 0
}, a = function (t) {
return i({
tagName: "span",
textContent: e.ZERO_WIDTH_SPACE,
data: {trixCursorTarget: t, trixSerialize: !1}
})
}, s.prototype.attachmentDidChangeUploadProgress = function () {
var t, e;
return e = this.attachment.getUploadProgress(), null != (t = this.findProgressElement()) ? t.value = e : void 0
}, s
}(e.ObjectView), n = function (t, e) {
var n;
return n = i("div"), n.innerHTML = null != t ? t : "", n.querySelector(e)
}
}.call(this), function () {
var t, n = function (t, e) {
function n() {
this.constructor = t
}
for (var o in e) i.call(e, o) && (t[o] = e[o]);
return n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype, t
}, i = {}.hasOwnProperty;
t = e.makeElement, e.PreviewableAttachmentView = function (i) {
function o() {
o.__super__.constructor.apply(this, arguments), this.attachment.previewDelegate = this
}
return n(o, i), o.prototype.createContentNodes = function () {
return this.image = t({
tagName: "img",
attributes: {src: ""},
data: {trixMutable: !0}
}), this.refresh(this.image), [this.image]
}, o.prototype.createCaptionElement = function () {
var t;
return t = o.__super__.createCaptionElement.apply(this, arguments), t.textContent || t.setAttribute("data-trix-placeholder", e.config.lang.captionPlaceholder), t
}, o.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
}, o.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
}, o.prototype.attachmentDidChangeAttributes = function () {
return this.refresh(this.image), this.refresh()
}, o
}(e.AttachmentView)
}.call(this), function () {
var t, 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;
i = e.makeElement, t = e.findInnerElement, n = e.getTextConfig, e.PieceView = function (r) {
function s() {
var t;
s.__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 a;
return o(s, r), s.prototype.createNodes = function () {
var e, n, i, o, r, s;
if (s = this.attachment ? this.createAttachmentNodes() : this.createStringNodes(), e = this.createElement()) {
for (i = t(e), n = 0, o = s.length; o > n; n++) r = s[n], i.appendChild(r);
s = [e]
}
return s
}, s.prototype.createAttachmentNodes = function () {
var t, n;
return t = this.attachment.isPreviewable() ? e.PreviewableAttachmentView : e.AttachmentView, n = this.createChildView(t, this.piece.attachment, {piece: this.piece}), n.getNodes()
}, s.prototype.createStringNodes = function () {
var t, e, n, o, r, s, a, u, c, l;
if (null != (u = this.textConfig) ? u.plaintext : void 0) return [document.createTextNode(this.string)];
for (a = [], c = this.string.split("\n"), n = e = 0, o = c.length; o > e; n = ++e) l = c[n], n > 0 && (t = i("br"), a.push(t)), (r = l.length) && (s = document.createTextNode(this.preserveSpaces(l)), a.push(s));
return a
}, s.prototype.createElement = function () {
var t, e, o, r, s, a, u, c, l;
c = {}, a = this.attributes;
for (r in a) if (l = a[r], (t = n(r)) && (t.tagName && (s = i(t.tagName), o ? (o.appendChild(s), o = s) : e = o = s), t.styleProperty && (c[t.styleProperty] = l), t.style)) {
u = t.style;
for (r in u) l = u[r], c[r] = l
}
if (Object.keys(c).length) {
null == e && (e = i("span"));
for (r in c) l = c[r], e.style[r] = l
}
return e
}, s.prototype.createContainerElement = function () {
var t, e, o, r, s;
r = this.attributes;
for (o in r) if (s = r[o], (e = n(o)) && e.groupTagName) return t = {}, t[o] = s, i(e.groupTagName, t)
}, a = e.NON_BREAKING_SPACE, s.prototype.preserveSpaces = function (t) {
return this.context.isLast && (t = t.replace(/\ $/, a)), t = t.replace(/(\S)\ {3}(\S)/g, "$1 " + a + " $2").replace(/\ {2}/g, a + " ").replace(/\ {2}/g, " " + a), (this.context.isFirst || this.context.followsWhitespace) && (t = t.replace(/^\ /, a)), t
}, s
}(e.ObjectView)
}.call(this), function () {
var t = function (t, e) {
function i() {
this.constructor = t
}
for (var o in e) n.call(e, o) && (t[o] = e[o]);
return i.prototype = e.prototype, t.prototype = new i, t.__super__ = e.prototype, t
}, n = {}.hasOwnProperty;
e.TextView = function (n) {
function i() {
i.__super__.constructor.apply(this, arguments), this.text = this.object, this.textConfig = this.options.textConfig
}
var o;
return t(i, n), i.prototype.createNodes = function () {
var t, n, i, r, s, a, u, c, l, h;
for (a = [], c = e.ObjectGroup.groupObjects(this.getPieces()), r = c.length - 1, i = n = 0, s = c.length; s > n; i = ++n) u = c[i], t = {}, 0 === i && (t.isFirst = !0), i === r && (t.isLast = !0), o(l) && (t.followsWhitespace = !0), h = this.findOrCreateCachedChildView(e.PieceView, u, {
textConfig: this.textConfig,
context: t
}), a.push.apply(a, h.getNodes()), l = u;
return a
}, i.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
}, o = function (t) {
return /\s$/.test(null != t ? t.toString() : void 0)
}, i
}(e.ObjectView)
}.call(this), function () {
var t, 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;
i = e.makeElement, n = e.getBlockConfig, t = e.config.css, e.BlockView = function (r) {
function s() {
s.__super__.constructor.apply(this, arguments), this.block = this.object, this.attributes = this.block.getAttributes()
}
return o(s, r), s.prototype.createNodes = function () {
var t, o, r, s, a, u, c, l, h;
if (t = document.createComment("block"), u = [t], this.block.isEmpty() ? u.push(i("br")) : (l = null != (c = n(this.block.getLastAttribute())) ? c.text : void 0, h = this.findOrCreateCachedChildView(e.TextView, this.block.text, {textConfig: l}), u.push.apply(u, h.getNodes()), this.shouldAddExtraNewlineElement() && u.push(i("br"))), this.attributes.length) return u;
for (o = i(e.config.blockAttributes["default"].tagName), r = 0, s = u.length; s > r; r++) a = u[r], o.appendChild(a);
return [o]
}, s.prototype.createContainerElement = function (e) {
var o, r, s, a;
return o = this.attributes[e], a = n(o).tagName, r = {tagName: a}, "attachmentGallery" === o && (s = this.block.getBlockBreakPosition(), r.className = t.attachmentGallery + " " + t.attachmentGallery + "--" + s), i(r)
}, s.prototype.shouldAddExtraNewlineElement = function () {
return /\n\n$/.test(this.block.toString())
}, s
}(e.ObjectView)
}.call(this), function () {
var t, 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;
t = e.defer, n = e.makeElement, e.DocumentView = function (o) {
function r() {
r.__super__.constructor.apply(this, arguments), this.element = this.options.element, this.elementStore = new e.ElementStore, this.setDocument(this.object)
}
var s, a, u;
return i(r, o), r.render = function (t) {
var e, i;
return e = n("div"), i = new this(t, {element: e}), i.render(), i.sync(), e
}, r.prototype.setDocument = function (t) {
return t.isEqualTo(this.document) ? void 0 : this.document = this.object = t
}, r.prototype.render = function () {
var t, i, o, r, s, a, u;
if (this.childViews = [], this.shadowElement = n("div"), !this.document.isEmpty()) {
for (s = e.ObjectGroup.groupObjects(this.document.getBlocks(), {asTree: !0}), a = [], t = 0, i = s.length; i > t; t++) r = s[t], u = this.findOrCreateCachedChildView(e.BlockView, r), a.push(function () {
var t, e, n, i;
for (n = u.getNodes(), i = [], t = 0, e = n.length; e > t; t++) o = n[t], i.push(this.shadowElement.appendChild(o));
return i
}.call(this));
return a
}
}, r.prototype.isSynced = function () {
return s(this.shadowElement, this.element)
}, r.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()
}, r.prototype.didSync = function () {
return this.elementStore.reset(a(this.element)), t(function (t) {
return function () {
return t.garbageCollectCachedViews()
}
}(this))
}, r.prototype.createDocumentFragmentForSync = function () {
var t, e, n, i, o, r, s, u, c, l;
for (e = document.createDocumentFragment(), u = this.shadowElement.childNodes, n = 0, o = u.length; o > n; n++) s = u[n], e.appendChild(s.cloneNode(!0));
for (c = a(e), i = 0, r = c.length; r > i; i++) t = c[i], (l = this.elementStore.remove(t)) && t.parentNode.replaceChild(l, t);
return e
}, a = function (t) {
return t.querySelectorAll("[data-trix-store-key]")
}, s = function (t, e) {
return u(t.innerHTML) === u(e.innerHTML)
}, u = function (t) {
return t.replace(/ /g, " ")
}, r
}(e.ObjectView)
}.call(this), function () {
var t, n, i, o, r, s = function (t, e) {
return function () {
return t.apply(e, arguments)
}
}, a = function (t, e) {
function n() {
this.constructor = t
}
for (var i in e) u.call(e, i) && (t[i] = e[i]);
return n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype, t
}, u = {}.hasOwnProperty;
i = e.findClosestElementFromNode, o = e.handleEvent, r = e.innerElementIsActive, n = e.defer, t = e.AttachmentView.attachmentSelector, e.CompositionController = function (u) {
function c(n, i) {
this.element = n, this.composition = i, this.didClickAttachment = s(this.didClickAttachment, this), this.didBlur = s(this.didBlur, this), this.didFocus = s(this.didFocus, this), this.documentView = new e.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: t,
withCallback: this.didClickAttachment
}), o("click", {onElement: this.element, matchingSelector: "a" + t, preventDefault: !0})
}
return a(c, u), c.prototype.didFocus = function () {
var t, e, n;
return t = function (t) {
return function () {
var e;
return t.focused ? void 0 : (t.focused = !0, null != (e = t.delegate) && "function" == typeof e.compositionControllerDidFocus ? e.compositionControllerDidFocus() : void 0)
}
}(this), null != (e = null != (n = this.blurPromise) ? n.then(t) : void 0) ? e : t()
}, c.prototype.didBlur = function () {
return this.blurPromise = new Promise(function (t) {
return function (e) {
return n(function () {
var n;
return r(t.element) || (t.focused = null, null != (n = t.delegate) && "function" == typeof n.compositionControllerDidBlur && n.compositionControllerDidBlur()), t.blurPromise = null, e()
})
}
}(this))
}, c.prototype.didClickAttachment = function (t, e) {
var n, o, r;
return n = this.findAttachmentForElement(e), o = null != i(t.target, {matchingSelector: "figcaption"}), null != (r = this.delegate) && "function" == typeof r.compositionControllerDidSelectAttachment ? r.compositionControllerDidSelectAttachment(n, {editCaption: o}) : void 0
}, c.prototype.getSerializableElement = function () {
return this.isEditingAttachment() ? this.documentView.shadowElement : this.element
}, c.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
}, c.prototype.rerenderViewForObject = function (t) {
return this.invalidateViewForObject(t), this.render()
}, c.prototype.invalidateViewForObject = function (t) {
return this.documentView.invalidateViewForObject(t)
}, c.prototype.isViewCachingEnabled = function () {
return this.documentView.isViewCachingEnabled()
}, c.prototype.enableViewCaching = function () {
return this.documentView.enableViewCaching()
}, c.prototype.disableViewCaching = function () {
return this.documentView.disableViewCaching()
}, c.prototype.refreshViewCache = function () {
return this.documentView.garbageCollectCachedViews()
}, c.prototype.isEditingAttachment = function () {
return null != this.attachmentEditor
}, c.prototype.installAttachmentEditorForAttachment = function (t, n) {
var i, o, r;
if ((null != (r = this.attachmentEditor) ? r.attachment : void 0) !== t && (o = this.documentView.findElementForObject(t))) return this.uninstallAttachmentEditor(), i = this.composition.document.getAttachmentPieceForAttachment(t), this.attachmentEditor = new e.AttachmentEditorController(i, o, this.element, n), this.attachmentEditor.delegate = this
}, c.prototype.uninstallAttachmentEditor = function () {
var t;
return null != (t = this.attachmentEditor) ? t.uninstall() : void 0
}, c.prototype.didUninstallAttachmentEditor = function () {
return this.attachmentEditor = null, this.render()
}, c.prototype.attachmentEditorDidRequestUpdatingAttributesForAttachment = function (t, e) {
var n;
return null != (n = this.delegate) && "function" == typeof n.compositionControllerWillUpdateAttachment && n.compositionControllerWillUpdateAttachment(e), this.composition.updateAttributesForAttachment(t, e)
}, c.prototype.attachmentEditorDidRequestRemovingAttributeForAttachment = function (t, e) {
var n;
return null != (n = this.delegate) && "function" == typeof n.compositionControllerWillUpdateAttachment && n.compositionControllerWillUpdateAttachment(e), this.composition.removeAttributeForAttachment(t, e)
}, c.prototype.attachmentEditorDidRequestRemovalOfAttachment = function (t) {
var e;
return null != (e = this.delegate) && "function" == typeof e.compositionControllerDidRequestRemovalOfAttachment ? e.compositionControllerDidRequestRemovalOfAttachment(t) : void 0
}, c.prototype.attachmentEditorDidRequestDeselectingAttachment = function (t) {
var e;
return null != (e = this.delegate) && "function" == typeof e.compositionControllerDidRequestDeselectingAttachment ? e.compositionControllerDidRequestDeselectingAttachment(t) : void 0
}, c.prototype.canSyncDocumentView = function () {
return !this.isEditingAttachment()
}, c.prototype.findAttachmentForElement = function (t) {
return this.composition.document.getAttachmentById(parseInt(t.dataset.trixId, 10))
}, c
}(e.BasicObject)
}.call(this), function () {
var t, n, 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;
n = e.handleEvent, i = e.triggerEvent, t = e.findClosestElementFromNode, e.ToolbarController = function (e) {
function s(t) {
this.element = t, this.didKeyDownDialogInput = o(this.didKeyDownDialogInput, this), this.didClickDialogButton = o(this.didClickDialogButton, this), this.didClickAttributeButton = o(this.didClickAttributeButton, this), this.didClickActionButton = o(this.didClickActionButton, this), this.attributes = {}, this.actions = {}, this.resetDialogInputs(), n("mousedown", {
onElement: this.element,
matchingSelector: a,
withCallback: this.didClickActionButton
}), n("mousedown", {
onElement: this.element,
matchingSelector: c,
withCallback: this.didClickAttributeButton
}), n("click", {
onElement: this.element,
matchingSelector: v,
preventDefault: !0
}), n("click", {
onElement: this.element,
matchingSelector: l,
withCallback: this.didClickDialogButton
}), n("keydown", {
onElement: this.element,
matchingSelector: h,
withCallback: this.didKeyDownDialogInput
})
}
var a, u, c, l, h, p, d, f, g, m, v;
return r(s, e), c = "[data-trix-attribute]", a = "[data-trix-action]", v = c + ", " + a, p = "[data-trix-dialog]", u = p + "[data-trix-active]", l = p + " [data-trix-method]", h = p + " [data-trix-input]", s.prototype.didClickActionButton = function (t, e) {
var n, i, o;
return null != (i = this.delegate) && i.toolbarDidClickButton(), t.preventDefault(), n = d(e), this.getDialog(n) ? this.toggleDialog(n) : null != (o = this.delegate) ? o.toolbarDidInvokeAction(n) : void 0
}, s.prototype.didClickAttributeButton = function (t, e) {
var n, i, o;
return null != (i = this.delegate) && i.toolbarDidClickButton(), t.preventDefault(), n = f(e), this.getDialog(n) ? this.toggleDialog(n) : null != (o = this.delegate) && o.toolbarDidToggleAttribute(n), this.refreshAttributeButtons()
}, s.prototype.didClickDialogButton = function (e, n) {
var i, o;
return i = t(n, {matchingSelector: p}), o = n.getAttribute("data-trix-method"), this[o].call(this, i)
}, s.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
}, s.prototype.updateActions = function (t) {
return this.actions = t, this.refreshActionButtons()
}, s.prototype.refreshActionButtons = function () {
return this.eachActionButton(function (t) {
return function (e, n) {
return e.disabled = t.actions[n] === !1
}
}(this))
}, s.prototype.eachActionButton = 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, d(e)));
return r
}, s.prototype.updateAttributes = function (t) {
return this.attributes = t, this.refreshAttributeButtons()
}, s.prototype.refreshAttributeButtons = function () {
return this.eachAttributeButton(function (t) {
return function (e, n) {
return e.disabled = t.attributes[n] === !1, t.attributes[n] || t.dialogIsVisible(n) ? (e.setAttribute("data-trix-active", ""), e.classList.add("trix-active")) : (e.removeAttribute("data-trix-active"), e.classList.remove("trix-active"))
}
}(this))
}, s.prototype.eachAttributeButton = function (t) {
var e, n, i, o, r;
for (o = this.element.querySelectorAll(c), r = [], n = 0, i = o.length; i > n; n++) e = o[n], r.push(t(e, f(e)));
return r
}, s.prototype.applyKeyboardCommand = function (t) {
var e, n, o, r, s, a, u;
for (s = JSON.stringify(t.sort()), u = this.element.querySelectorAll("[data-trix-key]"), r = 0, a = u.length; a > r; r++) if (e = u[r], o = e.getAttribute("data-trix-key").split("+"), n = JSON.stringify(o.sort()), n === s) return i("mousedown", {onElement: e}), !0;
return !1
}, s.prototype.dialogIsVisible = function (t) {
var e;
return (e = this.getDialog(t)) ? e.hasAttribute("data-trix-active") : void 0
}, s.prototype.toggleDialog = function (t) {
return this.dialogIsVisible(t) ? this.hideDialog() : this.showDialog(t)
}, s.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 = f(i)) && (r = m(i, t)) && (r.value = null != (c = this.attributes[e]) ? c : "", r.select()), null != (l = this.delegate) ? l.toolbarDidShowDialog(t) : void 0
}, s.prototype.setAttribute = function (t) {
var e, n, i;
return e = f(t), n = m(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())
}, s.prototype.removeAttribute = function (t) {
var e, n;
return e = f(t), null != (n = this.delegate) && n.toolbarDidRemoveAttribute(e), this.hideDialog()
}, s.prototype.hideDialog = function () {
var t, e;
return (t = this.element.querySelector(u)) ? (t.removeAttribute("data-trix-active"), t.classList.remove("trix-active"), this.resetDialogInputs(), null != (e = this.delegate) ? e.toolbarDidHideDialog(g(t)) : void 0) : void 0
}, s.prototype.resetDialogInputs = function () {
var t, e, n, i, o;
for (i = this.element.querySelectorAll(h), 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
}, s.prototype.getDialog = function (t) {
return this.element.querySelector("[data-trix-dialog=" + t + "]")
}, m = function (t, e) {
return null == e && (e = f(t)), t.querySelector("[data-trix-input][name='" + e + "']")
}, d = function (t) {
return t.getAttribute("data-trix-action")
}, f = function (t) {
var e;
return null != (e = t.getAttribute("data-trix-attribute")) ? e : t.getAttribute("data-trix-dialog-attribute")
}, g = function (t) {
return t.getAttribute("data-trix-dialog")
}, s
}(e.BasicObject)
}.call(this), function () {
var t = function (t, e) {
function i() {
this.constructor = t
}
for (var o in e) n.call(e, o) && (t[o] = e[o]);
return i.prototype = e.prototype, t.prototype = new i, t.__super__ = e.prototype, t
}, n = {}.hasOwnProperty;
e.ImagePreloadOperation = function (e) {
function n(t) {
this.url = t
}
return t(n, e), n.prototype.perform = function (t) {
var e;
return e = new Image, e.onload = function (n) {
return function () {
return e.width = n.width = e.naturalWidth, e.height = n.height = e.naturalHeight, t(!0, e)
}
}(this), e.onerror = function () {
return t(!1)
}, e.src = this.url
}, n
}(e.Operation)
}.call(this), function () {
var t = function (t, e) {
return function () {
return t.apply(e, arguments)
}
}, n = function (t, e) {
function n() {
this.constructor = t
}
for (var o in e) i.call(e, o) && (t[o] = e[o]);
return n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype, t
}, i = {}.hasOwnProperty;
e.Attachment = function (i) {
function o(n) {
null == n && (n = {}), this.releaseFile = t(this.releaseFile, this), o.__super__.constructor.apply(this, arguments), this.attributes = e.Hash.box(n), this.didChangeAttributes()
}
return n(o, i), o.previewablePattern = /^image(\/(gif|png|jpe?g)|$)/, o.attachmentForFile = function (t) {
var e, n;
return n = this.attributesForFile(t), e = new this(n), e.setFile(t), e
}, o.attributesForFile = function (t) {
return new e.Hash({filename: t.name, filesize: t.size, contentType: t.type})
}, o.fromJSON = function (t) {
return new this(t)
}, o.prototype.getAttribute = function (t) {
return this.attributes.get(t)
}, o.prototype.hasAttribute = function (t) {
return this.attributes.has(t)
}, o.prototype.getAttributes = function () {
return this.attributes.toObject()
}, o.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)
}, o.prototype.didChangeAttributes = function () {
return this.isPreviewable() ? this.preloadURL() : void 0
}, o.prototype.isPending = function () {
return null != this.file && !(this.getURL() || this.getHref())
}, o.prototype.isPreviewable = function () {
return this.attributes.has("previewable") ? this.attributes.get("previewable") : this.constructor.previewablePattern.test(this.getContentType())
}, o.prototype.getType = function () {
return this.hasContent() ? "content" : this.isPreviewable() ? "preview" : "file"
}, o.prototype.getURL = function () {
return this.attributes.get("url")
}, o.prototype.getHref = function () {
return this.attributes.get("href")
}, o.prototype.getFilename = function () {
var t;
return null != (t = this.attributes.get("filename")) ? t : ""
}, o.prototype.getFilesize = function () {
return this.attributes.get("filesize")
}, o.prototype.getFormattedFilesize = function () {
var t;
return t = this.attributes.get("filesize"), "number" == typeof t ? e.config.fileSize.formatter(t) : ""
}, o.prototype.getExtension = function () {
var t;
return null != (t = this.getFilename().match(/\.(\w+)$/)) ? t[1].toLowerCase() : void 0
}, o.prototype.getContentType = function () {
return this.attributes.get("contentType")
}, o.prototype.hasContent = function () {
return this.attributes.has("content")
}, o.prototype.getContent = function () {
return this.attributes.get("content")
}, o.prototype.getWidth = function () {
return this.attributes.get("width")
}, o.prototype.getHeight = function () {
return this.attributes.get("height")
}, o.prototype.getFile = function () {
return this.file
}, o.prototype.setFile = function (t) {
return this.file = t, this.isPreviewable() ? this.preloadFile() : void 0
}, o.prototype.releaseFile = function () {
return this.releasePreloadedFile(), this.file = null
}, o.prototype.getUploadProgress = function () {
var t;
return null != (t = this.uploadProgress) ? t : 0
}, o.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
}, o.prototype.toJSON = function () {
return this.getAttributes()
}, o.prototype.getCacheKey = function () {
return [o.__super__.getCacheKey.apply(this, arguments), this.attributes.getCacheKey(), this.getPreviewURL()].join("/")
}, o.prototype.getPreviewURL = function () {
return this.previewURL || this.preloadingURL
}, o.prototype.setPreviewURL = function (t) {
var e, n;
return 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
}, o.prototype.preloadURL = function () {
return this.preload(this.getURL(), this.releaseFile)
}, o.prototype.preloadFile = function () {
return this.file ? (this.fileObjectURL = URL.createObjectURL(this.file), this.preload(this.fileObjectURL)) : void 0
}, o.prototype.releasePreloadedFile = function () {
return this.fileObjectURL ? (URL.revokeObjectURL(this.fileObjectURL), this.fileObjectURL = null) : void 0
}, o.prototype.preload = function (t, n) {
var i;
return t && t !== this.getPreviewURL() ? (this.preloadingURL = t, i = new e.ImagePreloadOperation(t), i.then(function (e) {
return function (i) {
var o, r;
return r = i.width, o = i.height, e.setAttributes({
width: r,
height: o
}), e.preloadingURL = null, e.setPreviewURL(t), "function" == typeof n ? n() : void 0
}
}(this))) : void 0
}, o
}(e.Object)
}.call(this), function () {
var t = function (t, e) {
function i() {
this.constructor = t
}
for (var o in e) n.call(e, o) && (t[o] = e[o]);
return i.prototype = e.prototype, t.prototype = new i, t.__super__ = e.prototype, t
}, n = {}.hasOwnProperty;
e.Piece = function (n) {
function i(t, n) {
null == n && (n = {}), i.__super__.constructor.apply(this, arguments), this.attributes = e.Hash.box(n)
}
return t(i, n), i.types = {}, i.registerType = function (t, e) {
return e.type = t, this.types[t] = e
}, i.fromJSON = function (t) {
var e;
return (e = this.types[t.type]) ? e.fromJSON(t) : void 0
}, i.prototype.copyWithAttributes = function (t) {
return new this.constructor(this.getValue(), t)
}, i.prototype.copyWithAdditionalAttributes = function (t) {
return this.copyWithAttributes(this.attributes.merge(t))
}, i.prototype.copyWithoutAttribute = function (t) {
return this.copyWithAttributes(this.attributes.remove(t))
}, i.prototype.copy = function () {
return this.copyWithAttributes(this.attributes)
}, i.prototype.getAttribute = function (t) {
return this.attributes.get(t)
}, i.prototype.getAttributesHash = function () {
return this.attributes
}, i.prototype.getAttributes = function () {
return this.attributes.toObject()
}, i.prototype.getCommonAttributes = function () {
var t, e, n;
return (n = pieceList.getPieceAtIndex(0)) ? (t = n.attributes, e = t.getKeys(), pieceList.eachPiece(function (n) {
return e = t.getKeysCommonToHash(n.attributes), t = t.slice(e)
}), t.toObject()) : {}
}, i.prototype.hasAttribute = function (t) {
return this.attributes.has(t)
}, i.prototype.hasSameStringValueAsPiece = function (t) {
return null != t && this.toString() === t.toString()
}, i.prototype.hasSameAttributesAsPiece = function (t) {
return null != t && (this.attributes === t.attributes || this.attributes.isEqualTo(t.attributes))
}, i.prototype.isBlockBreak = function () {
return !1
}, i.prototype.isEqualTo = function (t) {
return i.__super__.isEqualTo.apply(this, arguments) || this.hasSameConstructorAs(t) && this.hasSameStringValueAsPiece(t) && this.hasSameAttributesAsPiece(t)
}, i.prototype.isEmpty = function () {
return 0 === this.length
}, i.prototype.isSerializable = function () {
return !0
}, i.prototype.toJSON = function () {
return {type: this.constructor.type, attributes: this.getAttributes()}
}, i.prototype.contentsForInspection = function () {
return {type: this.constructor.type, attributes: this.attributes.inspect()}
}, i.prototype.canBeGrouped = function () {
return this.hasAttribute("href")
}, i.prototype.canBeGroupedWith = function (t) {
return this.getAttribute("href") === t.getAttribute("href")
}, i.prototype.getLength = function () {
return this.length
}, i.prototype.canBeConsolidatedWith = function () {
return !1
}, i
}(e.Object)
}.call(this), function () {
var t = function (t, e) {
function i() {
this.constructor = t
}
for (var o in e) n.call(e, o) && (t[o] = e[o]);
return i.prototype = e.prototype, t.prototype = new i, t.__super__ = e.prototype, t
}, n = {}.hasOwnProperty;
e.Piece.registerType("attachment", e.AttachmentPiece = function (n) {
function i(t) {
this.attachment = t, i.__super__.constructor.apply(this, arguments), this.length = 1, this.ensureAttachmentExclusivelyHasAttribute("href"), this.attachment.hasContent() || this.removeProhibitedAttributes()
}
return t(i, n), i.fromJSON = function (t) {
return new this(e.Attachment.fromJSON(t.attachment), t.attributes)
}, i.permittedAttributes = ["caption", "presentation"], i.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
}, i.prototype.removeProhibitedAttributes = function () {
var t;
return t = this.attributes.slice(this.constructor.permittedAttributes), t.isEqualTo(this.attributes) ? void 0 : this.attributes = t
}, i.prototype.getValue = function () {
return this.attachment
}, i.prototype.isSerializable = function () {
return !this.attachment.isPending()
}, i.prototype.getCaption = function () {
var t;
return null != (t = this.attributes.get("caption")) ? t : ""
}, i.prototype.isEqualTo = function (t) {
var e;
return i.__super__.isEqualTo.apply(this, arguments) && this.attachment.id === (null != t && null != (e = t.attachment) ? e.id : void 0)
}, i.prototype.toString = function () {
return e.OBJECT_REPLACEMENT_CHARACTER
}, i.prototype.toJSON = function () {
var t;
return t = i.__super__.toJSON.apply(this, arguments), t.attachment = this.attachment, t
}, i.prototype.getCacheKey = function () {
return [i.__super__.getCacheKey.apply(this, arguments), this.attachment.getCacheKey()].join("/")
}, i.prototype.toConsole = function () {
return JSON.stringify(this.toString())
}, i
}(e.Piece))
}.call(this), function () {
var t, n = function (t, e) {
function n() {
this.constructor = t
}
for (var o in e) i.call(e, o) && (t[o] = e[o]);
return n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype, t
}, i = {}.hasOwnProperty;
t = e.normalizeNewlines, e.Piece.registerType("string", e.StringPiece = function (e) {
function i(e) {
i.__super__.constructor.apply(this, arguments), this.string = t(e), this.length = this.string.length
}
return n(i, e), i.fromJSON = function (t) {
return new this(t.string, t.attributes)
}, i.prototype.getValue = function () {
return this.string
}, i.prototype.toString = function () {
return this.string.toString()
}, i.prototype.isBlockBreak = function () {
return "\n" === this.toString() && this.getAttribute("blockBreak") === !0
}, i.prototype.toJSON = function () {
var t;
return t = i.__super__.toJSON.apply(this, arguments), t.string = this.string, t
}, i.prototype.canBeConsolidatedWith = function (t) {
return null != t && this.hasSameConstructorAs(t) && this.hasSameAttributesAsPiece(t)
}, i.prototype.consolidateWith = function (t) {
return new this.constructor(this.toString() + t.toString(), this.attributes)
}, i.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]
}, i.prototype.toConsole = function () {
var t;
return t = this.string, t.length > 15 && (t = t.slice(0, 14) + "\u2026"), JSON.stringify(t.toString())
}, i
}(e.Piece))
}.call(this), function () {
var t, n = function (t, e) {
function n() {
this.constructor = t
}
for (var o in e) i.call(e, o) && (t[o] = e[o]);
return n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype, t
}, i = {}.hasOwnProperty, o = [].slice;
t = e.spliceArray, e.SplittableList = function (e) {
function i(t) {
null == t && (t = []), i.__super__.constructor.apply(this, arguments), this.objects = t.slice(0), this.length = this.objects.length
}
var r, s, a;
return n(i, e), i.box = function (t) {
return t instanceof this ? t : new this(t)
}, i.prototype.indexOf = function (t) {
return this.objects.indexOf(t)
}, i.prototype.splice = function () {
var e;
return e = 1 <= arguments.length ? o.call(arguments, 0) : [], new this.constructor(t.apply(null, [this.objects].concat(o.call(e))))
}, i.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
}, i.prototype.insertObjectAtIndex = function (t, e) {
return this.splice(e, 0, t)
}, i.prototype.insertSplittableListAtIndex = function (t, e) {
return this.splice.apply(this, [e, 0].concat(o.call(t.objects)))
}, i.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)
}, i.prototype.editObjectAtIndex = function (t, e) {
return this.replaceObjectAtIndex(e(this.objects[t]), t)
}, i.prototype.replaceObjectAtIndex = function (t, e) {
return this.splice(e, 1, t)
}, i.prototype.removeObjectAtIndex = function (t) {
return this.splice(t, 1)
}, i.prototype.getObjectAtIndex = function (t) {
return this.objects[t]
}, i.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))
}, i.prototype.selectSplittableList = function (t) {
var e, n;
return n = function () {
var n, i, o, r;
for (o = this.objects, r = [], n = 0, i = o.length; i > n; n++) e = o[n], t(e) && r.push(e);
return r
}.call(this), new this.constructor(n)
}, i.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)
}, i.prototype.transformObjectsInRange = function (t, e) {
var n, i, o, r, s, a, u;
return s = this.splitObjectsAtRange(t), r = s[0], i = s[1], a = s[2], u = function () {
var t, s, u;
for (u = [], n = t = 0, s = r.length; s > t; n = ++t) o = r[n], u.push(n >= i && a >= n ? e(o) : o);
return u
}(), new this.constructor(u)
}, i.prototype.splitObjectsAtRange = function (t) {
var e, n, i, o, s, u;
return o = this.splitObjectAtPosition(a(t)), n = o[0], e = o[1], i = o[2], s = new this.constructor(n).splitObjectAtPosition(r(t) + i), n = s[0], u = s[1], [n, e, u - 1]
}, i.prototype.getObjectAtPosition = function (t) {
var e, n, i;
return i = this.findIndexAndOffsetAtPosition(t), e = i.index, n = i.offset, this.objects[e]
}, i.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]
}, i.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)
}, i.prototype.consolidateFromIndexToIndex = function (t, e) {
var n, i, r;
return i = this.objects.slice(0), r = i.slice(t, e + 1), n = new this.constructor(r).consolidate().toArray(), this.splice.apply(this, [t, r.length].concat(o.call(n)))
}, i.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}
}, i.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
}, i.prototype.getEndPosition = function () {
var t, e;
return null != this.endPosition ? this.endPosition : this.endPosition = function () {
var n, i, o;
for (e = 0, o = this.objects, n = 0, i = o.length; i > n; n++) t = o[n], e += t.getLength();
return e
}.call(this)
}, i.prototype.toString = function () {
return this.objects.join("")
}, i.prototype.toArray = function () {
return this.objects.slice(0)
}, i.prototype.toJSON = function () {
return this.toArray()
}, i.prototype.isEqualTo = function (t) {
return i.__super__.isEqualTo.apply(this, arguments) || s(this.objects, null != t ? t.objects : void 0)
}, s = 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
}, i.prototype.contentsForInspection = function () {
var t;
return {
objects: "[" + function () {
var e, n, i, o;
for (i = this.objects, o = [], e = 0, n = i.length; n > e; e++) t = i[e], o.push(t.inspect());
return o
}.call(this).join(", ") + "]"
}
}, a = function (t) {
return t[0]
}, r = function (t) {
return t[1]
}, i
}(e.Object)
}.call(this), function () {
var t = function (t, e) {
function i() {
this.constructor = t
}
for (var o in e) n.call(e, o) && (t[o] = e[o]);
return i.prototype = e.prototype, t.prototype = new i, t.__super__ = e.prototype, t
}, n = {}.hasOwnProperty;
e.Text = function (n) {
function i(t) {
var n;
null == t && (t = []), i.__super__.constructor.apply(this, arguments), this.pieceList = new e.SplittableList(function () {
var e, i, o;
for (o = [], e = 0, i = t.length; i > e; e++) n = t[e], n.isEmpty() || o.push(n);
return o
}())
}
return t(i, n), i.textForAttachmentWithAttributes = function (t, n) {
var i;
return i = new e.AttachmentPiece(t, n), new this([i])
}, i.textForStringWithAttributes = function (t, n) {
var i;
return i = new e.StringPiece(t, n), new this([i])
}, i.fromJSON = function (t) {
var n, i;
return i = function () {
var i, o, r;
for (r = [], i = 0, o = t.length; o > i; i++) n = t[i], r.push(e.Piece.fromJSON(n));
return r
}(), new this(i)
}, i.prototype.copy = function () {
return this.copyWithPieceList(this.pieceList)
}, i.prototype.copyWithPieceList = function (t) {
return new this.constructor(t.consolidate().toArray())
}, i.prototype.copyUsingObjectMap = function (t) {
var e, n;
return n = function () {
var n, i, o, r, s;
for (o = this.getPieces(), s = [], n = 0, i = o.length; i > n; n++) e = o[n], s.push(null != (r = t.find(e)) ? r : e);
return s
}.call(this), new this.constructor(n)
}, i.prototype.appendText = function (t) {
return this.insertTextAtPosition(t, this.getLength())
}, i.prototype.insertTextAtPosition = function (t, e) {
return this.copyWithPieceList(this.pieceList.insertSplittableListAtPosition(t.pieceList, e))
}, i.prototype.removeTextAtRange = function (t) {
return this.copyWithPieceList(this.pieceList.removeObjectsInRange(t))
}, i.prototype.replaceTextAtRange = function (t, e) {
return this.removeTextAtRange(e).insertTextAtPosition(t, e[0])
}, i.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)
}, i.prototype.addAttributeAtRange = function (t, e, n) {
var i;
return i = {}, i[t] = e, this.addAttributesAtRange(i, n)
}, i.prototype.addAttributesAtRange = function (t, e) {
return this.copyWithPieceList(this.pieceList.transformObjectsInRange(e, function (e) {
return e.copyWithAdditionalAttributes(t)
}))
}, i.prototype.removeAttributeAtRange = function (t, e) {
return this.copyWithPieceList(this.pieceList.transformObjectsInRange(e, function (e) {
return e.copyWithoutAttribute(t)
}))
}, i.prototype.setAttributesAtRange = function (t, e) {
return this.copyWithPieceList(this.pieceList.transformObjectsInRange(e, function (e) {
return e.copyWithAttributes(t)
}))
}, i.prototype.getAttributesAtPosition = function (t) {
var e, n;
return null != (e = null != (n = this.pieceList.getObjectAtPosition(t)) ? n.getAttributes() : void 0) ? e : {}
}, i.prototype.getCommonAttributes = function () {
var t, n;
return t = function () {
var t, e, i, o;
for (i = this.pieceList.toArray(), o = [], t = 0, e = i.length; e > t; t++) n = i[t], o.push(n.getAttributes());
return o
}.call(this), e.Hash.fromCommonAttributesOfObjects(t).toObject()
}, i.prototype.getCommonAttributesAtRange = function (t) {
var e;
return null != (e = this.getTextAtRange(t).getCommonAttributes()) ? e : {}
}, i.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]
}, i.prototype.getTextAtRange = function (t) {
return this.copyWithPieceList(this.pieceList.getSplittableListInRange(t))
}, i.prototype.getStringAtRange = function (t) {
return this.pieceList.getSplittableListInRange(t).toString()
}, i.prototype.getStringAtPosition = function (t) {
return this.getStringAtRange([t, t + 1])
}, i.prototype.startsWithString = function (t) {
return this.getStringAtRange([0, t.length]) === t
}, i.prototype.endsWithString = function (t) {
var e;
return e = this.getLength(), this.getStringAtRange([e - t.length, e]) === t
}, i.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
}, i.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
}, i.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}
}, i.prototype.getAttachmentById = function (t) {
var e, n, i;
return i = this.getAttachmentAndPositionById(t), e = i.attachment, n = i.position, e
}, i.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
}, i.prototype.updateAttributesForAttachment = function (t, e) {
var n;
return (n = this.getRangeOfAttachment(e)) ? this.addAttributesAtRange(t, n) : this
}, i.prototype.getLength = function () {
return this.pieceList.getEndPosition()
}, i.prototype.isEmpty = function () {
return 0 === this.getLength()
}, i.prototype.isEqualTo = function (t) {
var e;
return i.__super__.isEqualTo.apply(this, arguments) || (null != t && null != (e = t.pieceList) ? e.isEqualTo(this.pieceList) : void 0)
}, i.prototype.isBlockBreak = function () {
return 1 === this.getLength() && this.pieceList.getObjectAtIndex(0).isBlockBreak()
}, i.prototype.eachPiece = function (t) {
return this.pieceList.eachObject(t)
}, i.prototype.getPieces = function () {
return this.pieceList.toArray()
}, i.prototype.getPieceAtPosition = function (t) {
return this.pieceList.getObjectAtPosition(t)
}, i.prototype.contentsForInspection = function () {
return {pieceList: this.pieceList.inspect()}
}, i.prototype.toSerializableText = function () {
var t;
return t = this.pieceList.selectSplittableList(function (t) {
return t.isSerializable()
}), this.copyWithPieceList(t)
}, i.prototype.toString = function () {
return this.pieceList.toString()
}, i.prototype.toJSON = function () {
return this.pieceList.toJSON()
}, i.prototype.toConsole = function () {
var t;
return JSON.stringify(function () {
var e, n, i, o;
for (i = this.pieceList.toArray(), o = [], e = 0, n = i.length; n > e; e++) t = i[e], o.push(JSON.parse(t.toConsole()));
return o
}.call(this))
}, i
}(e.Object)
}.call(this), function () {
var t, n, i, 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, u = [].indexOf || function (t) {
for (var e = 0, n = this.length; n > e; e++) if (e in this && this[e] === t) return e;
return -1
}, c = [].slice;
t = e.arraysAreEqual, r = e.spliceArray, i = e.getBlockConfig, n = e.getBlockAttributeNames, o = e.getListAttributeNames, e.Block = function (n) {
function a(t, n) {
null == t && (t = new e.Text), null == n && (n = []), a.__super__.constructor.apply(this, arguments), this.text = h(t), this.attributes = n
}
var l, h, p, d, f, g, m, v, y;
return s(a, n), a.fromJSON = function (t) {
var n;
return n = e.Text.fromJSON(t.text), new this(n, t.attributes)
}, a.prototype.isEmpty = function () {
return this.text.isBlockBreak()
}, a.prototype.isEqualTo = function (e) {
return a.__super__.isEqualTo.apply(this, arguments) || this.text.isEqualTo(null != e ? e.text : void 0) && t(this.attributes, null != e ? e.attributes : void 0)
}, a.prototype.copyWithText = function (t) {
return new this.constructor(t, this.attributes)
}, a.prototype.copyWithoutText = function () {
return this.copyWithText(null)
}, a.prototype.copyWithAttributes = function (t) {
return new this.constructor(this.text, t)
}, a.prototype.copyWithoutAttributes = function () {
return this.copyWithAttributes(null)
}, a.prototype.copyUsingObjectMap = function (t) {
var e;
return this.copyWithText((e = t.find(this.text)) ? e : this.text.copyUsingObjectMap(t))
}, a.prototype.addAttribute = function (t) {
var e;
return e = this.attributes.concat(d(t)), this.copyWithAttributes(e)
}, a.prototype.removeAttribute = function (t) {
var e, n;
return n = i(t).listAttribute, e = g(g(this.attributes, t), n), this.copyWithAttributes(e)
}, a.prototype.removeLastAttribute = function () {
return this.removeAttribute(this.getLastAttribute())
}, a.prototype.getLastAttribute = function () {
return f(this.attributes)
}, a.prototype.getAttributes = function () {
return this.attributes.slice(0)
}, a.prototype.getAttributeLevel = function () {
return this.attributes.length
}, a.prototype.getAttributeAtLevel = function (t) {
return this.attributes[t - 1]
}, a.prototype.hasAttribute = function (t) {
return u.call(this.attributes, t) >= 0
}, a.prototype.hasAttributes = function () {
return this.getAttributeLevel() > 0
}, a.prototype.getLastNestableAttribute = function () {
return f(this.getNestableAttributes())
}, a.prototype.getNestableAttributes = function () {
var t, e, n, o, r;
for (o = this.attributes, r = [], e = 0, n = o.length; n > e; e++) t = o[e], i(t).nestable && r.push(t);
return r
}, a.prototype.getNestingLevel = function () {
return this.getNestableAttributes().length
}, a.prototype.decreaseNestingLevel = function () {
var t;
return (t = this.getLastNestableAttribute()) ? this.removeAttribute(t) : this
}, a.prototype.increaseNestingLevel = function () {
var t, e, n;
return (t = this.getLastNestableAttribute()) ? (n = this.attributes.lastIndexOf(t), e = r.apply(null, [this.attributes, n + 1, 0].concat(c.call(d(t)))), this.copyWithAttributes(e)) : this
}, a.prototype.getListItemAttributes = function () {
var t, e, n, o, r;
for (o = this.attributes, r = [], e = 0, n = o.length; n > e; e++) t = o[e], i(t).listAttribute && r.push(t);
return r
}, a.prototype.isListItem = function () {
var t;
return null != (t = i(this.getLastAttribute())) ? t.listAttribute : void 0
}, a.prototype.isTerminalBlock = function () {
var t;
return null != (t = i(this.getLastAttribute())) ? t.terminal : void 0
}, a.prototype.breaksOnReturn = function () {
var t;
return null != (t = i(this.getLastAttribute())) ? t.breakOnReturn : void 0
}, a.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
}, a.prototype.contentsForInspection = function () {
return {text: this.text.inspect(), attributes: this.attributes}
}, a.prototype.toString = function () {
return this.text.toString()
}, a.prototype.toJSON = function () {
return {text: this.text, attributes: this.attributes}
}, a.prototype.getLength = function () {
return this.text.getLength()
}, a.prototype.canBeConsolidatedWith = function (t) {
return !this.hasAttributes() && !t.hasAttributes()
}, a.prototype.consolidateWith = function (t) {
var n, i;
return n = e.Text.textForStringWithAttributes("\n"), i = this.getTextWithoutBlockBreak().appendText(n), this.copyWithText(i.appendText(t.text))
}, a.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]
}, a.prototype.getBlockBreakPosition = function () {
return this.text.getLength() - 1
}, a.prototype.getTextWithoutBlockBreak = function () {
return m(this.text) ? this.text.getTextAtRange([0, this.getBlockBreakPosition()]) : this.text.copy()
}, a.prototype.canBeGrouped = function (t) {
return this.attributes[t]
}, a.prototype.canBeGroupedWith = function (t, e) {
var n, r, s, a;
return s = t.getAttributes(), r = s[e], n = this.attributes[e], n === r && !(i(n).group === !1 && (a = s[e + 1], u.call(o(), a) < 0))
}, h = function (t) {
return t = y(t), t = l(t)
}, y = function (t) {
var n, i, o, r, s, a;
return r = !1, a = t.getPieces(), i = 2 <= a.length ? c.call(a, 0, n = a.length - 1) : (n = 0, []), o = a[n++], null == o ? t : (i = function () {
var t, e, n;
for (n = [], t = 0, e = i.length; e > t; t++) s = i[t], s.isBlockBreak() ? (r = !0, n.push(v(s))) : n.push(s);
return n
}(), r ? new e.Text(c.call(i).concat([o])) : t)
}, p = e.Text.textForStringWithAttributes("\n", {blockBreak: !0}), l = function (t) {
return m(t) ? t : t.appendText(p)
}, m = function (t) {
var e, n;
return n = t.getLength(), 0 === n ? !1 : (e = t.getTextAtRange([n - 1, n]), e.isBlockBreak())
}, v = function (t) {
return t.copyWithoutAttribute("blockBreak")
}, d = function (t) {
var e;
return e = i(t).listAttribute, null != e ? [e, t] : [t]
}, f = function (t) {
return t.slice(-1)[0]
}, g = function (t, e) {
var n;
return n = t.lastIndexOf(e), -1 === n ? t : r(t, n, 1)
}, a
}(e.Object)
}.call(this), function () {
var t, 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, s = [].slice, 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
};
n = e.tagName, i = e.walkTree, t = e.nodeIsAttachmentElement, e.HTMLSanitizer = function (r) {
function u(t, e) {
this.allowedAttributes = (null != e ? e : {}).allowedAttributes, null == this.allowedAttributes && (this.allowedAttributes = c), this.body = l(t)
}
var c, l, h;
return o(u, r), c = "style href src width height class".split(" "), u.sanitize = function (t, e) {
var n;
return n = new this(t, e), n.sanitize(), n
}, u.prototype.sanitize = function () {
return this.sanitizeElements(), this.normalizeListElementNesting()
}, u.prototype.getHTML = function () {
return this.body.innerHTML
}, u.prototype.getBody = function () {
return this.body
}, u.prototype.sanitizeElements = function () {
var t, n, o, r, s;
for (s = i(this.body), r = []; s.nextNode();) switch (o = s.currentNode, o.nodeType) {
case Node.ELEMENT_NODE:
h(o) ? r.push(o) : this.sanitizeElement(o);
break;
case Node.COMMENT_NODE:
r.push(o)
}
for (t = 0, n = r.length; n > t; t++) o = r[t], e.removeNode(o);
return this.body
}, u.prototype.sanitizeElement = function (t) {
var e, n, i, o;
for (o = s.call(t.attributes), e = 0, n = o.length; n > e; e++) i = o[e].name, a.call(this.allowedAttributes, i) >= 0 || 0 === i.indexOf("data-trix") || t.removeAttribute(i);
return t
}, u.prototype.normalizeListElementNesting = function () {
var t, e, i, o, r;
for (r = s.call(this.body.querySelectorAll("ul,ol")), t = 0, e = r.length; e > t; t++) i = r[t], (o = i.previousElementSibling) && "li" === n(o) && o.appendChild(i);
return this.body
}, h = function (e) {
return (null != e ? e.nodeType : void 0) !== Node.ELEMENT_NODE || t(e) ? void 0 : "script" === n(e) || "false" === e.getAttribute("data-trix-serialize")
}, l = function (t) {
var e, n, i, o, r;
for (null == t && (t = ""), t = t.replace(/<\/html[^>]*>[^]*$/i, "