Best Python code snippet using locust
trix.js
Source:trix.js  
...134                return void a2.call(s2, function(t4) {135                  i2(r3, t4);136                }, n2);137            }138            e2[r3] = s2, --o2 === 0 && t3(e2);139          } catch (u2) {140            n2(u2);141          }142        }143        if (e2.length === 0)144          return t3([]);145        for (var o2 = e2.length, r2 = 0; r2 < e2.length; r2++)146          i2(r2, e2[r2]);147      });148    }, i.resolve = function(t2) {149      return t2 && typeof t2 == "object" && t2.constructor === i ? t2 : new i(function(e2) {150        e2(t2);151      });152    }, i.reject = function(t2) {153      return new i(function(e2, n2) {154        n2(t2);155      });156    }, i.race = function(t2) {157      return new i(function(e2, n2) {158        for (var i2 = 0, o2 = t2.length; o2 > i2; i2++)159          t2[i2].then(e2, n2);160      });161    }, i._setImmediateFn = function(t2) {162      h = t2;163    }, i._setUnhandledRejectionFn = function(t2) {164      p = t2;165    }, module.exports ? module.exports = i : t.Promise || (t.Promise = i);166  }(commonjsGlobal), function() {167    var t = typeof window.customElements == "object", e = typeof document.registerElement == "function", n = t || e;168    n || (typeof WeakMap == "undefined" && !function() {169      var t2 = Object.defineProperty, e2 = Date.now() % 1e9, n2 = function() {170        this.name = "__st" + (1e9 * Math.random() >>> 0) + (e2++ + "__");171      };172      n2.prototype = {set: function(e3, n3) {173        var i = e3[this.name];174        return i && i[0] === e3 ? i[1] = n3 : t2(e3, this.name, {value: [e3, n3], writable: true}), this;175      }, get: function(t3) {176        var e3;177        return (e3 = t3[this.name]) && e3[0] === t3 ? e3[1] : void 0;178      }, delete: function(t3) {179        var e3 = t3[this.name];180        return e3 && e3[0] === t3 ? (e3[0] = e3[1] = void 0, true) : false;181      }, has: function(t3) {182        var e3 = t3[this.name];183        return e3 ? e3[0] === t3 : false;184      }}, window.WeakMap = n2;185    }(), function(t2) {186      function e2(t3) {187        A.push(t3), b || (b = true, g(i));188      }189      function n2(t3) {190        return window.ShadowDOMPolyfill && window.ShadowDOMPolyfill.wrapIfNeeded(t3) || t3;191      }192      function i() {193        b = false;194        var t3 = A;195        A = [], t3.sort(function(t4, e4) {196          return t4.uid_ - e4.uid_;197        });198        var e3 = false;199        t3.forEach(function(t4) {200          var n3 = t4.takeRecords();201          o(t4), n3.length && (t4.callback_(n3, t4), e3 = true);202        }), e3 && i();203      }204      function o(t3) {205        t3.nodes_.forEach(function(e3) {206          var n3 = m.get(e3);207          n3 && n3.forEach(function(e4) {208            e4.observer === t3 && e4.removeTransientObservers();209          });210        });211      }212      function r(t3, e3) {213        for (var n3 = t3; n3; n3 = n3.parentNode) {214          var i2 = m.get(n3);215          if (i2)216            for (var o2 = 0; o2 < i2.length; o2++) {217              var r2 = i2[o2], s2 = r2.options;218              if (n3 === t3 || s2.subtree) {219                var a2 = e3(s2);220                a2 && r2.enqueue(a2);221              }222            }223        }224      }225      function s(t3) {226        this.callback_ = t3, this.nodes_ = [], this.records_ = [], this.uid_ = ++C;227      }228      function a(t3, e3) {229        this.type = t3, this.target = e3, this.addedNodes = [], this.removedNodes = [], this.previousSibling = null, this.nextSibling = null, this.attributeName = null, this.attributeNamespace = null, this.oldValue = null;230      }231      function u(t3) {232        var e3 = new a(t3.type, t3.target);233        return e3.addedNodes = t3.addedNodes.slice(), e3.removedNodes = t3.removedNodes.slice(), e3.previousSibling = t3.previousSibling, e3.nextSibling = t3.nextSibling, e3.attributeName = t3.attributeName, e3.attributeNamespace = t3.attributeNamespace, e3.oldValue = t3.oldValue, e3;234      }235      function c(t3, e3) {236        return x = new a(t3, e3);237      }238      function l(t3) {239        return w ? w : (w = u(x), w.oldValue = t3, w);240      }241      function h() {242        x = w = void 0;243      }244      function p(t3) {245        return t3 === w || t3 === x;246      }247      function d(t3, e3) {248        return t3 === e3 ? t3 : w && p(t3) ? w : null;249      }250      function f(t3, e3, n3) {251        this.observer = t3, this.target = e3, this.options = n3, this.transientObservedNodes = [];252      }253      if (!t2.JsMutationObserver) {254        var g, m = new WeakMap();255        if (/Trident|Edge/.test(navigator.userAgent))256          g = setTimeout;257        else if (window.setImmediate)258          g = window.setImmediate;259        else {260          var v = [], y = String(Math.random());261          window.addEventListener("message", function(t3) {262            if (t3.data === y) {263              var e3 = v;264              v = [], e3.forEach(function(t4) {265                t4();266              });267            }268          }), g = function(t3) {269            v.push(t3), window.postMessage(y, "*");270          };271        }272        var b = false, A = [], C = 0;273        s.prototype = {observe: function(t3, e3) {274          if (t3 = n2(t3), !e3.childList && !e3.attributes && !e3.characterData || e3.attributeOldValue && !e3.attributes || e3.attributeFilter && e3.attributeFilter.length && !e3.attributes || e3.characterDataOldValue && !e3.characterData)275            throw new SyntaxError();276          var i2 = m.get(t3);277          i2 || m.set(t3, i2 = []);278          for (var o2, r2 = 0; r2 < i2.length; r2++)279            if (i2[r2].observer === this) {280              o2 = i2[r2], o2.removeListeners(), o2.options = e3;281              break;282            }283          o2 || (o2 = new f(this, t3, e3), i2.push(o2), this.nodes_.push(t3)), o2.addListeners();284        }, disconnect: function() {285          this.nodes_.forEach(function(t3) {286            for (var e3 = m.get(t3), n3 = 0; n3 < e3.length; n3++) {287              var i2 = e3[n3];288              if (i2.observer === this) {289                i2.removeListeners(), e3.splice(n3, 1);290                break;291              }292            }293          }, this), this.records_ = [];294        }, takeRecords: function() {295          var t3 = this.records_;296          return this.records_ = [], t3;297        }};298        var x, w;299        f.prototype = {enqueue: function(t3) {300          var n3 = this.observer.records_, i2 = n3.length;301          if (n3.length > 0) {302            var o2 = n3[i2 - 1], r2 = d(o2, t3);303            if (r2)304              return void (n3[i2 - 1] = r2);305          } else306            e2(this.observer);307          n3[i2] = t3;308        }, addListeners: function() {309          this.addListeners_(this.target);310        }, addListeners_: function(t3) {311          var e3 = this.options;312          e3.attributes && t3.addEventListener("DOMAttrModified", this, true), e3.characterData && t3.addEventListener("DOMCharacterDataModified", this, true), e3.childList && t3.addEventListener("DOMNodeInserted", this, true), (e3.childList || e3.subtree) && t3.addEventListener("DOMNodeRemoved", this, true);313        }, removeListeners: function() {314          this.removeListeners_(this.target);315        }, removeListeners_: function(t3) {316          var e3 = this.options;317          e3.attributes && t3.removeEventListener("DOMAttrModified", this, true), e3.characterData && t3.removeEventListener("DOMCharacterDataModified", this, true), e3.childList && t3.removeEventListener("DOMNodeInserted", this, true), (e3.childList || e3.subtree) && t3.removeEventListener("DOMNodeRemoved", this, true);318        }, addTransientObserver: function(t3) {319          if (t3 !== this.target) {320            this.addListeners_(t3), this.transientObservedNodes.push(t3);321            var e3 = m.get(t3);322            e3 || m.set(t3, e3 = []), e3.push(this);323          }324        }, removeTransientObservers: function() {325          var t3 = this.transientObservedNodes;326          this.transientObservedNodes = [], t3.forEach(function(t4) {327            this.removeListeners_(t4);328            for (var e3 = m.get(t4), n3 = 0; n3 < e3.length; n3++)329              if (e3[n3] === this) {330                e3.splice(n3, 1);331                break;332              }333          }, this);334        }, handleEvent: function(t3) {335          switch (t3.stopImmediatePropagation(), t3.type) {336            case "DOMAttrModified":337              var e3 = t3.attrName, n3 = t3.relatedNode.namespaceURI, i2 = t3.target, o2 = new c("attributes", i2);338              o2.attributeName = e3, o2.attributeNamespace = n3;339              var s2 = t3.attrChange === MutationEvent.ADDITION ? null : t3.prevValue;340              r(i2, function(t4) {341                return !t4.attributes || t4.attributeFilter && t4.attributeFilter.length && t4.attributeFilter.indexOf(e3) === -1 && t4.attributeFilter.indexOf(n3) === -1 ? void 0 : t4.attributeOldValue ? l(s2) : o2;342              });343              break;344            case "DOMCharacterDataModified":345              var i2 = t3.target, o2 = c("characterData", i2), s2 = t3.prevValue;346              r(i2, function(t4) {347                return t4.characterData ? t4.characterDataOldValue ? l(s2) : o2 : void 0;348              });349              break;350            case "DOMNodeRemoved":351              this.addTransientObserver(t3.target);352            case "DOMNodeInserted":353              var a2, u2, p2 = t3.target;354              t3.type === "DOMNodeInserted" ? (a2 = [p2], u2 = []) : (a2 = [], u2 = [p2]);355              var d2 = p2.previousSibling, f2 = p2.nextSibling, o2 = c("childList", t3.target.parentNode);356              o2.addedNodes = a2, o2.removedNodes = u2, o2.previousSibling = d2, o2.nextSibling = f2, r(t3.relatedNode, function(t4) {357                return t4.childList ? o2 : void 0;358              });359          }360          h();361        }}, t2.JsMutationObserver = s, t2.MutationObserver || (t2.MutationObserver = s, s._isPolyfilled = true);362      }363    }(self), function() {364      if (!window.performance || !window.performance.now) {365        var t2 = Date.now();366        window.performance = {now: function() {367          return Date.now() - t2;368        }};369      }370      window.requestAnimationFrame || (window.requestAnimationFrame = function() {371        var t3 = window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;372        return t3 ? function(e3) {373          return t3(function() {374            e3(performance.now());375          });376        } : function(t4) {377          return window.setTimeout(t4, 1e3 / 60);378        };379      }()), window.cancelAnimationFrame || (window.cancelAnimationFrame = function() {380        return window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || function(t3) {381          clearTimeout(t3);382        };383      }());384      var e2 = function() {385        var t3 = document.createEvent("Event");386        return t3.initEvent("foo", true, true), t3.preventDefault(), t3.defaultPrevented;387      }();388      if (!e2) {389        var n2 = Event.prototype.preventDefault;390        Event.prototype.preventDefault = function() {391          this.cancelable && (n2.call(this), Object.defineProperty(this, "defaultPrevented", {get: function() {392            return true;393          }, configurable: true}));394        };395      }396      var i = /Trident/.test(navigator.userAgent);397      if ((!window.CustomEvent || i && typeof window.CustomEvent != "function") && (window.CustomEvent = function(t3, e3) {398        e3 = e3 || {};399        var n3 = document.createEvent("CustomEvent");400        return n3.initCustomEvent(t3, Boolean(e3.bubbles), Boolean(e3.cancelable), e3.detail), n3;401      }, window.CustomEvent.prototype = window.Event.prototype), !window.Event || i && typeof window.Event != "function") {402        var o = window.Event;403        window.Event = function(t3, e3) {404          e3 = e3 || {};405          var n3 = document.createEvent("Event");406          return n3.initEvent(t3, Boolean(e3.bubbles), Boolean(e3.cancelable)), n3;407        }, window.Event.prototype = o.prototype;408      }409    }(), window.CustomElements = window.CustomElements || {flags: {}}, function(t2) {410      var e2 = t2.flags, n2 = [], i = function(t3) {411        n2.push(t3);412      }, o = function() {413        n2.forEach(function(e3) {414          e3(t2);415        });416      };417      t2.addModule = i, t2.initializeModules = o, t2.hasNative = Boolean(document.registerElement), t2.isIE = /Trident/.test(navigator.userAgent), t2.useNative = !e2.register && t2.hasNative && !window.ShadowDOMPolyfill && (!window.HTMLImports || window.HTMLImports.useNative);418    }(window.CustomElements), window.CustomElements.addModule(function(t2) {419      function e2(t3, e3) {420        n2(t3, function(t4) {421          return e3(t4) ? true : void i(t4, e3);422        }), i(t3, e3);423      }424      function n2(t3, e3, i2) {425        var o2 = t3.firstElementChild;426        if (!o2)427          for (o2 = t3.firstChild; o2 && o2.nodeType !== Node.ELEMENT_NODE; )428            o2 = o2.nextSibling;429        for (; o2; )430          e3(o2, i2) !== true && n2(o2, e3, i2), o2 = o2.nextElementSibling;431        return null;432      }433      function i(t3, n3) {434        for (var i2 = t3.shadowRoot; i2; )435          e2(i2, n3), i2 = i2.olderShadowRoot;436      }437      function o(t3, e3) {438        r(t3, e3, []);439      }440      function r(t3, e3, n3) {441        if (t3 = window.wrap(t3), !(n3.indexOf(t3) >= 0)) {442          n3.push(t3);443          for (var i2, o2 = t3.querySelectorAll("link[rel=" + s + "]"), a = 0, u = o2.length; u > a && (i2 = o2[a]); a++)444            i2.import && r(i2.import, e3, n3);445          e3(t3);446        }447      }448      var s = window.HTMLImports ? window.HTMLImports.IMPORT_LINK_TYPE : "none";449      t2.forDocumentTree = o, t2.forSubtree = e2;450    }), window.CustomElements.addModule(function(t2) {451      function e2(t3, e3) {452        return n2(t3, e3) || i(t3, e3);453      }454      function n2(e3, n3) {455        return t2.upgrade(e3, n3) ? true : void (n3 && s(e3));456      }457      function i(t3, e3) {458        b(t3, function(t4) {459          return n2(t4, e3) ? true : void 0;460        });461      }462      function o(t3) {463        w.push(t3), x || (x = true, setTimeout(r));464      }465      function r() {466        x = false;467        for (var t3, e3 = w, n3 = 0, i2 = e3.length; i2 > n3 && (t3 = e3[n3]); n3++)468          t3();469        w = [];470      }471      function s(t3) {472        C ? o(function() {473          a(t3);474        }) : a(t3);475      }476      function a(t3) {477        t3.__upgraded__ && !t3.__attached && (t3.__attached = true, t3.attachedCallback && t3.attachedCallback());478      }479      function u(t3) {480        c(t3), b(t3, function(t4) {481          c(t4);482        });483      }484      function c(t3) {485        C ? o(function() {486          l(t3);487        }) : l(t3);488      }489      function l(t3) {490        t3.__upgraded__ && t3.__attached && (t3.__attached = false, t3.detachedCallback && t3.detachedCallback());491      }492      function h(t3) {493        for (var e3 = t3, n3 = window.wrap(document); e3; ) {494          if (e3 == n3)495            return true;496          e3 = e3.parentNode || e3.nodeType === Node.DOCUMENT_FRAGMENT_NODE && e3.host;497        }498      }499      function p(t3) {500        if (t3.shadowRoot && !t3.shadowRoot.__watched) {501          y.dom && console.log("watching shadow-root for: ", t3.localName);502          for (var e3 = t3.shadowRoot; e3; )503            g(e3), e3 = e3.olderShadowRoot;504        }505      }506      function d(t3, n3) {507        if (y.dom) {508          var i2 = n3[0];509          if (i2 && i2.type === "childList" && i2.addedNodes && i2.addedNodes) {510            for (var o2 = i2.addedNodes[0]; o2 && o2 !== document && !o2.host; )511              o2 = o2.parentNode;512            var r2 = o2 && (o2.URL || o2._URL || o2.host && o2.host.localName) || "";513            r2 = r2.split("/?").shift().split("/").pop();514          }515          console.group("mutations (%d) [%s]", n3.length, r2 || "");516        }517        var s2 = h(t3);518        n3.forEach(function(t4) {519          t4.type === "childList" && (E(t4.addedNodes, function(t5) {520            t5.localName && e2(t5, s2);521          }), E(t4.removedNodes, function(t5) {522            t5.localName && u(t5);523          }));524        }), y.dom && console.groupEnd();525      }526      function f(t3) {527        for (t3 = window.wrap(t3), t3 || (t3 = window.wrap(document)); t3.parentNode; )528          t3 = t3.parentNode;529        var e3 = t3.__observer;530        e3 && (d(t3, e3.takeRecords()), r());531      }532      function g(t3) {533        if (!t3.__observer) {534          var e3 = new MutationObserver(d.bind(this, t3));535          e3.observe(t3, {childList: true, subtree: true}), t3.__observer = e3;536        }537      }538      function m(t3) {539        t3 = window.wrap(t3), y.dom && console.group("upgradeDocument: ", t3.baseURI.split("/").pop());540        var n3 = t3 === window.wrap(document);541        e2(t3, n3), g(t3), y.dom && console.groupEnd();542      }543      function v(t3) {544        A(t3, m);545      }546      var y = t2.flags, b = t2.forSubtree, A = t2.forDocumentTree, C = window.MutationObserver._isPolyfilled && y["throttle-attached"];547      t2.hasPolyfillMutations = C, t2.hasThrottledAttached = C;548      var x = false, w = [], E = Array.prototype.forEach.call.bind(Array.prototype.forEach), S = Element.prototype.createShadowRoot;549      S && (Element.prototype.createShadowRoot = function() {550        var t3 = S.call(this);551        return window.CustomElements.watchShadow(this), t3;552      }), t2.watchShadow = p, t2.upgradeDocumentTree = v, t2.upgradeDocument = m, t2.upgradeSubtree = i, t2.upgradeAll = e2, t2.attached = s, t2.takeRecords = f;553    }), window.CustomElements.addModule(function(t2) {554      function e2(e3, i2) {555        if (e3.localName === "template" && window.HTMLTemplateElement && HTMLTemplateElement.decorate && HTMLTemplateElement.decorate(e3), !e3.__upgraded__ && e3.nodeType === Node.ELEMENT_NODE) {556          var o2 = e3.getAttribute("is"), r2 = t2.getRegisteredDefinition(e3.localName) || t2.getRegisteredDefinition(o2);557          if (r2 && (o2 && r2.tag == e3.localName || !o2 && !r2.extends))558            return n2(e3, r2, i2);559        }560      }561      function n2(e3, n3, o2) {562        return s.upgrade && console.group("upgrade:", e3.localName), n3.is && e3.setAttribute("is", n3.is), i(e3, n3), e3.__upgraded__ = true, r(e3), o2 && t2.attached(e3), t2.upgradeSubtree(e3, o2), s.upgrade && console.groupEnd(), e3;563      }564      function i(t3, e3) {565        Object.__proto__ ? t3.__proto__ = e3.prototype : (o(t3, e3.prototype, e3.native), t3.__proto__ = e3.prototype);566      }567      function o(t3, e3, n3) {568        for (var i2 = {}, o2 = e3; o2 !== n3 && o2 !== HTMLElement.prototype; ) {569          for (var r2, s2 = Object.getOwnPropertyNames(o2), a = 0; r2 = s2[a]; a++)570            i2[r2] || (Object.defineProperty(t3, r2, Object.getOwnPropertyDescriptor(o2, r2)), i2[r2] = 1);571          o2 = Object.getPrototypeOf(o2);572        }573      }574      function r(t3) {575        t3.createdCallback && t3.createdCallback();576      }577      var s = t2.flags;578      t2.upgrade = e2, t2.upgradeWithDefinition = n2, t2.implementPrototype = i;579    }), window.CustomElements.addModule(function(t2) {580      function e2(e3, i2) {581        var u2 = i2 || {};582        if (!e3)583          throw new Error("document.registerElement: first argument `name` must not be empty");584        if (e3.indexOf("-") < 0)585          throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '" + String(e3) + "'.");586        if (o(e3))587          throw new Error("Failed to execute 'registerElement' on 'Document': Registration failed for type '" + String(e3) + "'. The type name is invalid.");588        if (c(e3))589          throw new Error("DuplicateDefinitionError: a type with name '" + String(e3) + "' is already registered");590        return u2.prototype || (u2.prototype = Object.create(HTMLElement.prototype)), u2.__name = e3.toLowerCase(), u2.extends && (u2.extends = u2.extends.toLowerCase()), u2.lifecycle = u2.lifecycle || {}, u2.ancestry = r(u2.extends), s(u2), a(u2), n2(u2.prototype), l(u2.__name, u2), u2.ctor = h(u2), u2.ctor.prototype = u2.prototype, u2.prototype.constructor = u2.ctor, t2.ready && m(document), u2.ctor;591      }592      function n2(t3) {593        if (!t3.setAttribute._polyfilled) {594          var e3 = t3.setAttribute;595          t3.setAttribute = function(t4, n4) {596            i.call(this, t4, n4, e3);597          };598          var n3 = t3.removeAttribute;599          t3.removeAttribute = function(t4) {600            i.call(this, t4, null, n3);601          }, t3.setAttribute._polyfilled = true;602        }603      }604      function i(t3, e3, n3) {605        t3 = t3.toLowerCase();606        var i2 = this.getAttribute(t3);607        n3.apply(this, arguments);608        var o2 = this.getAttribute(t3);609        this.attributeChangedCallback && o2 !== i2 && this.attributeChangedCallback(t3, i2, o2);610      }611      function o(t3) {612        for (var e3 = 0; e3 < C.length; e3++)613          if (t3 === C[e3])614            return true;615      }616      function r(t3) {617        var e3 = c(t3);618        return e3 ? r(e3.extends).concat([e3]) : [];619      }620      function s(t3) {621        for (var e3, n3 = t3.extends, i2 = 0; e3 = t3.ancestry[i2]; i2++)622          n3 = e3.is && e3.tag;623        t3.tag = n3 || t3.__name, n3 && (t3.is = t3.__name);624      }625      function a(t3) {626        if (!Object.__proto__) {627          var e3 = HTMLElement.prototype;628          if (t3.is) {629            var n3 = document.createElement(t3.tag);630            e3 = Object.getPrototypeOf(n3);631          }632          for (var i2, o2 = t3.prototype, r2 = false; o2; )633            o2 == e3 && (r2 = true), i2 = Object.getPrototypeOf(o2), i2 && (o2.__proto__ = i2), o2 = i2;634          r2 || console.warn(t3.tag + " prototype not found in prototype chain for " + t3.is), t3.native = e3;635        }636      }637      function u(t3) {638        return y(E(t3.tag), t3);639      }640      function c(t3) {641        return t3 ? x[t3.toLowerCase()] : void 0;642      }643      function l(t3, e3) {644        x[t3] = e3;645      }646      function h(t3) {647        return function() {648          return u(t3);649        };650      }651      function p(t3, e3, n3) {652        return t3 === w ? d(e3, n3) : S(t3, e3);653      }654      function d(t3, e3) {655        t3 && (t3 = t3.toLowerCase()), e3 && (e3 = e3.toLowerCase());656        var n3 = c(e3 || t3);657        if (n3) {658          if (t3 == n3.tag && e3 == n3.is)659            return new n3.ctor();660          if (!e3 && !n3.is)661            return new n3.ctor();662        }663        var i2;664        return e3 ? (i2 = d(t3), i2.setAttribute("is", e3), i2) : (i2 = E(t3), t3.indexOf("-") >= 0 && b(i2, HTMLElement), i2);665      }666      function f(t3, e3) {667        var n3 = t3[e3];668        t3[e3] = function() {669          var t4 = n3.apply(this, arguments);670          return v(t4), t4;671        };672      }673      var g, m = (t2.isIE, t2.upgradeDocumentTree), v = t2.upgradeAll, y = t2.upgradeWithDefinition, b = t2.implementPrototype, A = t2.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);674      g = Object.__proto__ || A ? function(t3, e3) {675        return t3 instanceof e3;676      } : function(t3, e3) {677        if (t3 instanceof e3)678          return true;679        for (var n3 = t3; n3; ) {680          if (n3 === e3.prototype)681            return true;682          n3 = n3.__proto__;683        }684        return false;685      }, f(Node.prototype, "cloneNode"), f(document, "importNode"), document.registerElement = e2, document.createElement = d, document.createElementNS = p, t2.registry = x, t2.instanceof = g, t2.reservedTagList = C, t2.getRegisteredDefinition = c, document.register = document.registerElement;686    }), function(t2) {687      function e2() {688        r(window.wrap(document)), window.CustomElements.ready = true;689        var t3 = window.requestAnimationFrame || function(t4) {690          setTimeout(t4, 16);691        };692        t3(function() {693          setTimeout(function() {694            window.CustomElements.readyTime = Date.now(), window.HTMLImports && (window.CustomElements.elapsed = window.CustomElements.readyTime - window.HTMLImports.readyTime), document.dispatchEvent(new CustomEvent("WebComponentsReady", {bubbles: true}));695          });696        });697      }698      var n2 = t2.useNative, i = t2.initializeModules;699      if (t2.isIE, n2) {700        var o = function() {701        };702        t2.watchShadow = o, t2.upgrade = o, t2.upgradeAll = o, t2.upgradeDocumentTree = o, t2.upgradeSubtree = o, t2.takeRecords = o, t2.instanceof = function(t3, e3) {703          return t3 instanceof e3;704        };705      } else706        i();707      var r = t2.upgradeDocumentTree, s = t2.upgradeDocument;708      if (window.wrap || (window.ShadowDOMPolyfill ? (window.wrap = window.ShadowDOMPolyfill.wrapIfNeeded, window.unwrap = window.ShadowDOMPolyfill.unwrapIfNeeded) : window.wrap = window.unwrap = function(t3) {709        return t3;710      }), window.HTMLImports && (window.HTMLImports.__importsParsingHook = function(t3) {711        t3.import && s(wrap(t3.import));712      }), document.readyState === "complete" || t2.flags.eager)713        e2();714      else if (document.readyState !== "interactive" || window.attachEvent || window.HTMLImports && !window.HTMLImports.ready) {715        var a = window.HTMLImports && !window.HTMLImports.ready ? "HTMLImportsLoaded" : "DOMContentLoaded";716        window.addEventListener(a, e2);717      } else718        e2();719    }(window.CustomElements));720  }.call(commonjsGlobal), function() {721  }.call(commonjsGlobal), function() {722    var t = this;723    (function() {724      (function() {725        this.Trix = {VERSION: "1.3.1", ZERO_WIDTH_SPACE: "\uFEFF", NON_BREAKING_SPACE: "\xA0", OBJECT_REPLACEMENT_CHARACTER: "\uFFFC", browser: {composesExistingText: /Android.*Chrome/.test(navigator.userAgent), forcesObjectResizing: /Trident.*rv:11/.test(navigator.userAgent), supportsInputEvents: function() {726          var t2, e2, n, i;727          if (typeof InputEvent == "undefined")728            return false;729          for (i = ["data", "getTargetRanges", "inputType"], t2 = 0, e2 = i.length; e2 > t2; t2++)730            if (n = i[t2], !(n in InputEvent.prototype))731              return false;732          return true;733        }()}, config: {}};734      }).call(this);735    }).call(t);736    var e = t.Trix;737    (function() {738      (function() {739        e.BasicObject = function() {740          function t2() {741          }742          var e2, n, i;743          return t2.proxyMethod = function(t3) {744            var i2, o, r, s, a;745            return r = n(t3), i2 = r.name, s = r.toMethod, a = r.toProperty, o = r.optional, this.prototype[i2] = function() {746              var t4, n2;747              return t4 = s != null ? o ? typeof this[s] == "function" ? this[s]() : void 0 : this[s]() : a != null ? this[a] : void 0, o ? (n2 = t4 != null ? t4[i2] : void 0, n2 != null ? e2.call(n2, t4, arguments) : void 0) : (n2 = t4[i2], e2.call(n2, t4, arguments));748            };749          }, n = function(t3) {750            var e3, n2;751            if (!(n2 = t3.match(i)))752              throw new Error("can't parse @proxyMethod expression: " + t3);753            return e3 = {name: n2[4]}, n2[2] != null ? e3.toMethod = n2[1] : e3.toProperty = n2[1], n2[3] != null && (e3.optional = true), e3;754          }, e2 = Function.prototype.apply, i = /^(.+?)(\(\))?(\?)?\.(.+?)$/, t2;755        }();756      }).call(this), function() {757        var t2 = function(t3, e2) {758          function i() {759            this.constructor = t3;760          }761          for (var o in e2)762            n.call(e2, o) && (t3[o] = e2[o]);763          return i.prototype = e2.prototype, t3.prototype = new i(), t3.__super__ = e2.prototype, t3;764        }, n = {}.hasOwnProperty;765        e.Object = function(n2) {766          function i() {767            this.id = ++o;768          }769          var o;770          return t2(i, n2), o = 0, i.fromJSONString = function(t3) {771            return this.fromJSON(JSON.parse(t3));772          }, i.prototype.hasSameConstructorAs = function(t3) {773            return this.constructor === (t3 != null ? t3.constructor : void 0);774          }, i.prototype.isEqualTo = function(t3) {775            return this === t3;776          }, i.prototype.inspect = function() {777            var t3, e2, n3;778            return t3 = function() {779              var t4, i2, o2;780              i2 = (t4 = this.contentsForInspection()) != null ? t4 : {}, o2 = [];781              for (e2 in i2)782                n3 = i2[e2], o2.push(e2 + "=" + n3);783              return o2;784            }.call(this), "#<" + this.constructor.name + ":" + this.id + (t3.length ? " " + t3.join(", ") : "") + ">";785          }, i.prototype.contentsForInspection = function() {786          }, i.prototype.toJSONString = function() {787            return JSON.stringify(this);788          }, i.prototype.toUTF16String = function() {789            return e.UTF16String.box(this);790          }, i.prototype.getCacheKey = function() {791            return this.id.toString();792          }, i;793        }(e.BasicObject);794      }.call(this), function() {795        e.extend = function(t2) {796          var e2, n;797          for (e2 in t2)798            n = t2[e2], this[e2] = n;799          return this;800        };801      }.call(this), function() {802        e.extend({defer: function(t2) {803          return setTimeout(t2, 1);804        }});805      }.call(this), function() {806        var t2, n;807        e.extend({normalizeSpaces: function(t3) {808          return t3.replace(RegExp("" + e.ZERO_WIDTH_SPACE, "g"), "").replace(RegExp("" + e.NON_BREAKING_SPACE, "g"), " ");809        }, normalizeNewlines: function(t3) {810          return t3.replace(/\r\n/g, "\n");811        }, breakableWhitespacePattern: RegExp("[^\\S" + e.NON_BREAKING_SPACE + "]"), squishBreakableWhitespace: function(t3) {812          return t3.replace(RegExp("" + e.breakableWhitespacePattern.source, "g"), " ").replace(/\ {2,}/g, " ");813        }, summarizeStringChange: function(t3, i) {814          var o, r, s, a;815          return t3 = e.UTF16String.box(t3), i = e.UTF16String.box(i), i.length < t3.length ? (r = n(t3, i), a = r[0], o = r[1]) : (s = n(i, t3), o = s[0], a = s[1]), {added: o, removed: a};816        }}), n = function(n2, i) {817          var o, r, s, a, u;818          return n2.isEqualTo(i) ? ["", ""] : (r = t2(n2, i), a = r.utf16String.length, s = a ? (u = r.offset, o = n2.codepoints.slice(0, u).concat(n2.codepoints.slice(u + a)), t2(i, e.UTF16String.fromCodepoints(o))) : t2(i, n2), [r.utf16String.toString(), s.utf16String.toString()]);819        }, t2 = function(t3, e2) {820          var n2, i, o;821          for (n2 = 0, i = t3.length, o = e2.length; i > n2 && t3.charAt(n2).isEqualTo(e2.charAt(n2)); )822            n2++;823          for (; i > n2 + 1 && t3.charAt(i - 1).isEqualTo(e2.charAt(o - 1)); )824            i--, o--;825          return {utf16String: t3.slice(n2, i), offset: n2};826        };827      }.call(this), function() {828        e.extend({copyObject: function(t2) {829          var e2, n, i;830          t2 == null && (t2 = {}), n = {};831          for (e2 in t2)832            i = t2[e2], n[e2] = i;833          return n;834        }, objectsAreEqual: function(t2, e2) {835          var n, i;836          if (t2 == null && (t2 = {}), e2 == null && (e2 = {}), Object.keys(t2).length !== Object.keys(e2).length)837            return false;838          for (n in t2)839            if (i = t2[n], i !== e2[n])840              return false;841          return true;842        }});843      }.call(this), function() {844        var t2 = [].slice;845        e.extend({arraysAreEqual: function(t3, e2) {846          var n, i, o, r;847          if (t3 == null && (t3 = []), e2 == null && (e2 = []), t3.length !== e2.length)848            return false;849          for (i = n = 0, o = t3.length; o > n; i = ++n)850            if (r = t3[i], r !== e2[i])851              return false;852          return true;853        }, arrayStartsWith: function(t3, n) {854          return t3 == null && (t3 = []), n == null && (n = []), e.arraysAreEqual(t3.slice(0, n.length), n);855        }, spliceArray: function() {856          var e2, n, i;857          return n = arguments[0], e2 = 2 <= arguments.length ? t2.call(arguments, 1) : [], i = n.slice(0), i.splice.apply(i, e2), i;858        }, summarizeArrayChange: function(t3, e2) {859          var n, i, o, r, s, a, u, c, l, h, p;860          for (t3 == null && (t3 = []), e2 == null && (e2 = []), n = [], h = [], o = new Set(), r = 0, u = t3.length; u > r; r++)861            p = t3[r], o.add(p);862          for (i = new Set(), s = 0, c = e2.length; c > s; s++)863            p = e2[s], i.add(p), o.has(p) || n.push(p);864          for (a = 0, l = t3.length; l > a; a++)865            p = t3[a], i.has(p) || h.push(p);866          return {added: n, removed: h};867        }});868      }.call(this), function() {869        var t2, n, i, o;870        t2 = null, n = null, o = null, i = null, e.extend({getAllAttributeNames: function() {871          return t2 != null ? t2 : t2 = e.getTextAttributeNames().concat(e.getBlockAttributeNames());872        }, getBlockConfig: function(t3) {873          return e.config.blockAttributes[t3];874        }, getBlockAttributeNames: function() {875          return n != null ? n : n = Object.keys(e.config.blockAttributes);876        }, getTextConfig: function(t3) {877          return e.config.textAttributes[t3];878        }, getTextAttributeNames: function() {879          return o != null ? o : o = Object.keys(e.config.textAttributes);880        }, getListAttributeNames: function() {881          var t3, n2;882          return i != null ? i : i = function() {883            var i2, o2;884            i2 = e.config.blockAttributes, o2 = [];885            for (t3 in i2)886              n2 = i2[t3].listAttribute, n2 != null && o2.push(n2);887            return o2;888          }();889        }});890      }.call(this), function() {891        var t2, n, i, o, r, s = [].indexOf || function(t3) {892          for (var e2 = 0, n2 = this.length; n2 > e2; e2++)893            if (e2 in this && this[e2] === t3)894              return e2;895          return -1;896        };897        t2 = document.documentElement, n = (i = (o = (r = t2.matchesSelector) != null ? r : t2.webkitMatchesSelector) != null ? o : t2.msMatchesSelector) != null ? i : t2.mozMatchesSelector, e.extend({handleEvent: function(n2, i2) {898          var r2, s2, a, u, c, l, h, p, d, f, g;899          return h = i2 != null ? i2 : {}, c = h.onElement, u = h.matchingSelector, g = h.withCallback, a = h.inPhase, l = h.preventDefault, d = h.times, r2 = c != null ? c : t2, p = u, f = a === "capturing", s2 = function(t3) {900            var n3;901            return d != null && --d === 0 && s2.destroy(), n3 = e.findClosestElementFromNode(t3.target, {matchingSelector: p}), n3 != null && (g != null && g.call(n3, t3, n3), l) ? t3.preventDefault() : void 0;902          }, s2.destroy = function() {903            return r2.removeEventListener(n2, s2, f);904          }, r2.addEventListener(n2, s2, f), s2;905        }, handleEventOnce: function(t3, n2) {906          return n2 == null && (n2 = {}), n2.times = 1, e.handleEvent(t3, n2);907        }, triggerEvent: function(n2, i2) {908          var o2, r2, s2, a, u, c, l;909          return l = i2 != null ? i2 : {}, c = l.onElement, r2 = l.bubbles, s2 = l.cancelable, o2 = l.attributes, a = c != null ? c : t2, r2 = r2 !== false, s2 = s2 !== false, u = document.createEvent("Events"), u.initEvent(n2, r2, s2), o2 != null && e.extend.call(u, o2), a.dispatchEvent(u);910        }, elementMatchesSelector: function(t3, e2) {911          return (t3 != null ? t3.nodeType : void 0) === 1 ? n.call(t3, e2) : void 0;912        }, findClosestElementFromNode: function(t3, n2) {913          var i2, o2, r2;914          for (o2 = n2 != null ? n2 : {}, i2 = o2.matchingSelector, r2 = o2.untilNode; t3 != null && t3.nodeType !== Node.ELEMENT_NODE; )915            t3 = t3.parentNode;916          if (t3 != null) {917            if (i2 == null)918              return t3;919            if (t3.closest && r2 == null)920              return t3.closest(i2);921            for (; t3 && t3 !== r2; ) {922              if (e.elementMatchesSelector(t3, i2))923                return t3;924              t3 = t3.parentNode;925            }926          }927        }, findInnerElement: function(t3) {928          for (; t3 != null ? t3.firstElementChild : void 0; )929            t3 = t3.firstElementChild;930          return t3;931        }, innerElementIsActive: function(t3) {932          return document.activeElement !== t3 && e.elementContainsNode(t3, document.activeElement);933        }, elementContainsNode: function(t3, e2) {934          if (t3 && e2)935            for (; e2; ) {936              if (e2 === t3)937                return true;938              e2 = e2.parentNode;939            }940        }, findNodeFromContainerAndOffset: function(t3, e2) {941          var n2;942          if (t3)943            return t3.nodeType === Node.TEXT_NODE ? t3 : e2 === 0 ? (n2 = t3.firstChild) != null ? n2 : t3 : t3.childNodes.item(e2 - 1);944        }, findElementFromContainerAndOffset: function(t3, n2) {945          var i2;946          return i2 = e.findNodeFromContainerAndOffset(t3, n2), e.findClosestElementFromNode(i2);947        }, findChildIndexOfNode: function(t3) {948          var e2;949          if (t3 != null ? t3.parentNode : void 0) {950            for (e2 = 0; t3 = t3.previousSibling; )951              e2++;952            return e2;953          }954        }, removeNode: function(t3) {955          var e2;956          return t3 != null && (e2 = t3.parentNode) != null ? e2.removeChild(t3) : void 0;957        }, walkTree: function(t3, e2) {958          var n2, i2, o2, r2, s2;959          return o2 = e2 != null ? e2 : {}, i2 = o2.onlyNodesOfType, r2 = o2.usingFilter, n2 = o2.expandEntityReferences, s2 = function() {960            switch (i2) {961              case "element":962                return NodeFilter.SHOW_ELEMENT;963              case "text":964                return NodeFilter.SHOW_TEXT;965              case "comment":966                return NodeFilter.SHOW_COMMENT;967              default:968                return NodeFilter.SHOW_ALL;969            }970          }(), document.createTreeWalker(t3, s2, r2 != null ? r2 : null, n2 === true);971        }, tagName: function(t3) {972          var e2;973          return t3 != null && (e2 = t3.tagName) != null ? e2.toLowerCase() : void 0;974        }, makeElement: function(t3, e2) {975          var n2, i2, o2, r2, s2, a, u, c, l, h, p, d, f, g;976          if (e2 == null && (e2 = {}), typeof t3 == "object" ? (e2 = t3, t3 = e2.tagName) : e2 = {attributes: e2}, o2 = document.createElement(t3), e2.editable != null && (e2.attributes == null && (e2.attributes = {}), e2.attributes.contenteditable = e2.editable), e2.attributes) {977            l = e2.attributes;978            for (a in l)979              g = l[a], o2.setAttribute(a, g);980          }981          if (e2.style) {982            h = e2.style;983            for (a in h)984              g = h[a], o2.style[a] = g;985          }986          if (e2.data) {987            p = e2.data;988            for (a in p)989              g = p[a], o2.dataset[a] = g;990          }991          if (e2.className)992            for (d = e2.className.split(" "), r2 = 0, u = d.length; u > r2; r2++)993              i2 = d[r2], o2.classList.add(i2);994          if (e2.textContent && (o2.textContent = e2.textContent), e2.childNodes)995            for (f = [].concat(e2.childNodes), s2 = 0, c = f.length; c > s2; s2++)996              n2 = f[s2], o2.appendChild(n2);997          return o2;998        }, getBlockTagNames: function() {999          var t3, n2;1000          return e.blockTagNames != null ? e.blockTagNames : e.blockTagNames = function() {1001            var i2, o2;1002            i2 = e.config.blockAttributes, o2 = [];1003            for (t3 in i2)1004              n2 = i2[t3].tagName, n2 && o2.push(n2);1005            return o2;1006          }();1007        }, nodeIsBlockContainer: function(t3) {1008          return e.nodeIsBlockStartComment(t3 != null ? t3.firstChild : void 0);1009        }, nodeProbablyIsBlockContainer: function(t3) {1010          var n2, i2;1011          return n2 = e.tagName(t3), s.call(e.getBlockTagNames(), n2) >= 0 && (i2 = e.tagName(t3.firstChild), s.call(e.getBlockTagNames(), i2) < 0);1012        }, nodeIsBlockStart: function(t3, n2) {1013          var i2;1014          return i2 = (n2 != null ? n2 : {strict: true}).strict, i2 ? e.nodeIsBlockStartComment(t3) : e.nodeIsBlockStartComment(t3) || !e.nodeIsBlockStartComment(t3.firstChild) && e.nodeProbablyIsBlockContainer(t3);1015        }, nodeIsBlockStartComment: function(t3) {1016          return e.nodeIsCommentNode(t3) && (t3 != null ? t3.data : void 0) === "block";1017        }, nodeIsCommentNode: function(t3) {1018          return (t3 != null ? t3.nodeType : void 0) === Node.COMMENT_NODE;1019        }, nodeIsCursorTarget: function(t3, n2) {1020          var i2;1021          return i2 = (n2 != null ? n2 : {}).name, t3 ? e.nodeIsTextNode(t3) ? t3.data === e.ZERO_WIDTH_SPACE ? i2 ? t3.parentNode.dataset.trixCursorTarget === i2 : true : void 0 : e.nodeIsCursorTarget(t3.firstChild) : void 0;1022        }, nodeIsAttachmentElement: function(t3) {1023          return e.elementMatchesSelector(t3, e.AttachmentView.attachmentSelector);1024        }, nodeIsEmptyTextNode: function(t3) {1025          return e.nodeIsTextNode(t3) && (t3 != null ? t3.data : void 0) === "";1026        }, nodeIsTextNode: function(t3) {1027          return (t3 != null ? t3.nodeType : void 0) === Node.TEXT_NODE;1028        }});1029      }.call(this), function() {1030        var t2, n, i, o, r;1031        t2 = e.copyObject, o = e.objectsAreEqual, e.extend({normalizeRange: i = function(t3) {1032          var e2;1033          if (t3 != null)1034            return Array.isArray(t3) || (t3 = [t3, t3]), [n(t3[0]), n((e2 = t3[1]) != null ? e2 : t3[0])];1035        }, rangeIsCollapsed: function(t3) {1036          var e2, n2, o2;1037          if (t3 != null)1038            return n2 = i(t3), o2 = n2[0], e2 = n2[1], r(o2, e2);1039        }, rangesAreEqual: function(t3, e2) {1040          var n2, o2, s, a, u, c;1041          if (t3 != null && e2 != null)1042            return s = i(t3), o2 = s[0], n2 = s[1], a = i(e2), c = a[0], u = a[1], r(o2, c) && r(n2, u);1043        }}), n = function(e2) {1044          return typeof e2 == "number" ? e2 : t2(e2);1045        }, r = function(t3, e2) {1046          return typeof t3 == "number" ? t3 === e2 : o(t3, e2);1047        };1048      }.call(this), function() {1049        var t2, n, i, o, r, s, a;1050        e.registerElement = function(t3, e2) {1051          var n2, i2;1052          return e2 == null && (e2 = {}), t3 = t3.toLowerCase(), e2 = a(e2), i2 = s(e2), (n2 = i2.defaultCSS) && (delete i2.defaultCSS, o(n2, t3)), r(t3, i2);1053        }, o = function(t3, e2) {1054          var n2;1055          return n2 = i(e2), n2.textContent = t3.replace(/%t/g, e2);1056        }, i = function(e2) {1057          var n2, i2;1058          return n2 = document.createElement("style"), n2.setAttribute("type", "text/css"), n2.setAttribute("data-tag-name", e2.toLowerCase()), (i2 = t2()) && n2.setAttribute("nonce", i2), document.head.insertBefore(n2, document.head.firstChild), n2;1059        }, t2 = function() {1060          var t3;1061          return (t3 = n("trix-csp-nonce") || n("csp-nonce")) ? t3.getAttribute("content") : void 0;1062        }, n = function(t3) {1063          return document.head.querySelector("meta[name=" + t3 + "]");1064        }, s = function(t3) {1065          var e2, n2, i2;1066          n2 = {};1067          for (e2 in t3)1068            i2 = t3[e2], n2[e2] = typeof i2 == "function" ? {value: i2} : i2;1069          return n2;1070        }, a = function() {1071          var t3;1072          return t3 = function(t4) {1073            var e2, n2, i2, o2, r2;1074            for (e2 = {}, r2 = ["initialize", "connect", "disconnect"], n2 = 0, o2 = r2.length; o2 > n2; n2++)1075              i2 = r2[n2], e2[i2] = t4[i2], delete t4[i2];1076            return e2;1077          }, window.customElements ? function(e2) {1078            var n2, i2, o2, r2, s2;1079            return s2 = t3(e2), o2 = s2.initialize, n2 = s2.connect, i2 = s2.disconnect, o2 && (r2 = n2, n2 = function() {1080              return this.initialized || (this.initialized = true, o2.call(this)), r2 != null ? r2.call(this) : void 0;1081            }), n2 && (e2.connectedCallback = n2), i2 && (e2.disconnectedCallback = i2), e2;1082          } : function(e2) {1083            var n2, i2, o2, r2;1084            return r2 = t3(e2), o2 = r2.initialize, n2 = r2.connect, i2 = r2.disconnect, o2 && (e2.createdCallback = o2), n2 && (e2.attachedCallback = n2), i2 && (e2.detachedCallback = i2), e2;1085          };1086        }(), r = function() {1087          return window.customElements ? function(t3, e2) {1088            var n2;1089            return n2 = function() {1090              return typeof Reflect == "object" ? Reflect.construct(HTMLElement, [], n2) : HTMLElement.apply(this);1091            }, Object.setPrototypeOf(n2.prototype, HTMLElement.prototype), Object.setPrototypeOf(n2, HTMLElement), Object.defineProperties(n2.prototype, e2), window.customElements.define(t3, n2), n2;1092          } : function(t3, e2) {1093            var n2, i2;1094            return i2 = Object.create(HTMLElement.prototype, e2), n2 = document.registerElement(t3, {prototype: i2}), Object.defineProperty(i2, "constructor", {value: n2}), n2;1095          };1096        }();1097      }.call(this), function() {1098        var t2, n;1099        e.extend({getDOMSelection: function() {1100          var t3;1101          return t3 = window.getSelection(), t3.rangeCount > 0 ? t3 : void 0;1102        }, getDOMRange: function() {1103          var n2, i;1104          return (n2 = (i = e.getDOMSelection()) != null ? i.getRangeAt(0) : void 0) && !t2(n2) ? n2 : void 0;1105        }, setDOMRange: function(t3) {1106          var n2;1107          return n2 = window.getSelection(), n2.removeAllRanges(), n2.addRange(t3), e.selectionChangeObserver.update();1108        }}), t2 = function(t3) {1109          return n(t3.startContainer) || n(t3.endContainer);1110        }, n = function(t3) {1111          return !Object.getPrototypeOf(t3);1112        };1113      }.call(this), function() {1114        var t2;1115        t2 = {"application/x-trix-feature-detection": "test"}, e.extend({dataTransferIsPlainText: function(t3) {1116          var e2, n, i;1117          return i = t3.getData("text/plain"), n = t3.getData("text/html"), i && n ? (e2 = new DOMParser().parseFromString(n, "text/html").body, e2.textContent === i ? !e2.querySelector("*") : void 0) : i != null ? i.length : void 0;1118        }, dataTransferIsWritable: function(e2) {1119          var n, i;1120          if ((e2 != null ? e2.setData : void 0) != null) {1121            for (n in t2)1122              if (i = t2[n], !function() {1123                try {1124                  return e2.setData(n, i), e2.getData(n) === i;1125                } catch (t3) {1126                }1127              }())1128                return;1129            return true;1130          }1131        }, keyEventIsKeyboardCommand: function() {1132          return /Mac|^iP/.test(navigator.platform) ? function(t3) {1133            return t3.metaKey;1134          } : function(t3) {1135            return t3.ctrlKey;1136          };1137        }()});1138      }.call(this), function() {1139        e.extend({RTL_PATTERN: /[\u05BE\u05C0\u05C3\u05D0-\u05EA\u05F0-\u05F4\u061B\u061F\u0621-\u063A\u0640-\u064A\u066D\u0671-\u06B7\u06BA-\u06BE\u06C0-\u06CE\u06D0-\u06D5\u06E5\u06E6\u200F\u202B\u202E\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE72\uFE74\uFE76-\uFEFC]/, getDirection: function() {1140          var t2, n, i, o;1141          return n = e.makeElement("input", {dir: "auto", name: "x", dirName: "x.dir"}), t2 = e.makeElement("form"), t2.appendChild(n), i = function() {1142            try {1143              return new FormData(t2).has(n.dirName);1144            } catch (e2) {1145            }1146          }(), o = function() {1147            try {1148              return n.matches(":dir(ltr),:dir(rtl)");1149            } catch (t3) {1150            }1151          }(), i ? function(e2) {1152            return n.value = e2, new FormData(t2).get(n.dirName);1153          } : o ? function(t3) {1154            return n.value = t3, n.matches(":dir(rtl)") ? "rtl" : "ltr";1155          } : function(t3) {1156            var n2;1157            return n2 = t3.trim().charAt(0), e.RTL_PATTERN.test(n2) ? "rtl" : "ltr";1158          };1159        }()});1160      }.call(this), function() {1161      }.call(this), function() {1162        var t2, n = function(t3, e2) {1163          function n2() {1164            this.constructor = t3;1165          }1166          for (var o in e2)1167            i.call(e2, o) && (t3[o] = e2[o]);1168          return n2.prototype = e2.prototype, t3.prototype = new n2(), t3.__super__ = e2.prototype, t3;1169        }, i = {}.hasOwnProperty;1170        t2 = e.arraysAreEqual, e.Hash = function(i2) {1171          function o(t3) {1172            t3 == null && (t3 = {}), this.values = s(t3), o.__super__.constructor.apply(this, arguments);1173          }1174          var r, s, a, u, c;1175          return n(o, i2), o.fromCommonAttributesOfObjects = function(t3) {1176            var e2, n2, i3, o2, s2, a2;1177            if (t3 == null && (t3 = []), !t3.length)1178              return new this();1179            for (e2 = r(t3[0]), i3 = e2.getKeys(), a2 = t3.slice(1), n2 = 0, o2 = a2.length; o2 > n2; n2++)1180              s2 = a2[n2], i3 = e2.getKeysCommonToHash(r(s2)), e2 = e2.slice(i3);1181            return e2;1182          }, o.box = function(t3) {1183            return r(t3);1184          }, o.prototype.add = function(t3, e2) {1185            return this.merge(u(t3, e2));1186          }, o.prototype.remove = function(t3) {1187            return new e.Hash(s(this.values, t3));1188          }, o.prototype.get = function(t3) {1189            return this.values[t3];1190          }, o.prototype.has = function(t3) {1191            return t3 in this.values;1192          }, o.prototype.merge = function(t3) {1193            return new e.Hash(a(this.values, c(t3)));1194          }, o.prototype.slice = function(t3) {1195            var n2, i3, o2, r2;1196            for (r2 = {}, n2 = 0, o2 = t3.length; o2 > n2; n2++)1197              i3 = t3[n2], this.has(i3) && (r2[i3] = this.values[i3]);1198            return new e.Hash(r2);1199          }, o.prototype.getKeys = function() {1200            return Object.keys(this.values);1201          }, o.prototype.getKeysCommonToHash = function(t3) {1202            var e2, n2, i3, o2, s2;1203            for (t3 = r(t3), o2 = this.getKeys(), s2 = [], e2 = 0, i3 = o2.length; i3 > e2; e2++)1204              n2 = o2[e2], this.values[n2] === t3.values[n2] && s2.push(n2);1205            return s2;1206          }, o.prototype.isEqualTo = function(e2) {1207            return t2(this.toArray(), r(e2).toArray());1208          }, o.prototype.isEmpty = function() {1209            return this.getKeys().length === 0;1210          }, o.prototype.toArray = function() {1211            var t3, e2, n2;1212            return (this.array != null ? this.array : this.array = function() {1213              var i3;1214              e2 = [], i3 = this.values;1215              for (t3 in i3)1216                n2 = i3[t3], e2.push(t3, n2);1217              return e2;1218            }.call(this)).slice(0);1219          }, o.prototype.toObject = function() {1220            return s(this.values);1221          }, o.prototype.toJSON = function() {1222            return this.toObject();1223          }, o.prototype.contentsForInspection = function() {1224            return {values: JSON.stringify(this.values)};1225          }, u = function(t3, e2) {1226            var n2;1227            return n2 = {}, n2[t3] = e2, n2;1228          }, a = function(t3, e2) {1229            var n2, i3, o2;1230            i3 = s(t3);1231            for (n2 in e2)1232              o2 = e2[n2], i3[n2] = o2;1233            return i3;1234          }, s = function(t3, e2) {1235            var n2, i3, o2, r2, s2;1236            for (r2 = {}, s2 = Object.keys(t3).sort(), n2 = 0, o2 = s2.length; o2 > n2; n2++)1237              i3 = s2[n2], i3 !== e2 && (r2[i3] = t3[i3]);1238            return r2;1239          }, r = function(t3) {1240            return t3 instanceof e.Hash ? t3 : new e.Hash(t3);1241          }, c = function(t3) {1242            return t3 instanceof e.Hash ? t3.values : t3;1243          }, o;1244        }(e.Object);1245      }.call(this), function() {1246        e.ObjectGroup = function() {1247          function t2(t3, e2) {1248            var n, i;1249            this.objects = t3 != null ? t3 : [], i = e2.depth, n = e2.asTree, n && (this.depth = i, this.objects = this.constructor.groupObjects(this.objects, {asTree: n, depth: this.depth + 1}));1250          }1251          return t2.groupObjects = function(t3, e2) {1252            var n, i, o, r, s, a, u, c, l;1253            for (t3 == null && (t3 = []), l = e2 != null ? e2 : {}, o = l.depth, n = l.asTree, n && o == null && (o = 0), c = [], s = 0, a = t3.length; a > s; s++) {1254              if (u = t3[s], r) {1255                if ((typeof u.canBeGrouped == "function" ? u.canBeGrouped(o) : void 0) && (typeof (i = r[r.length - 1]).canBeGroupedWith == "function" ? i.canBeGroupedWith(u, o) : void 0)) {1256                  r.push(u);1257                  continue;1258                }1259                c.push(new this(r, {depth: o, asTree: n})), r = null;1260              }1261              (typeof u.canBeGrouped == "function" ? u.canBeGrouped(o) : void 0) ? r = [u] : c.push(u);1262            }1263            return r && c.push(new this(r, {depth: o, asTree: n})), c;1264          }, t2.prototype.getObjects = function() {1265            return this.objects;1266          }, t2.prototype.getDepth = function() {1267            return this.depth;1268          }, t2.prototype.getCacheKey = function() {1269            var t3, e2, n, i, o;1270            for (e2 = ["objectGroup"], o = this.getObjects(), t3 = 0, n = o.length; n > t3; t3++)1271              i = o[t3], e2.push(i.getCacheKey());1272            return e2.join("/");1273          }, t2;1274        }();1275      }.call(this), function() {1276        var t2 = function(t3, e2) {1277          function i() {1278            this.constructor = t3;1279          }1280          for (var o in e2)1281            n.call(e2, o) && (t3[o] = e2[o]);1282          return i.prototype = e2.prototype, t3.prototype = new i(), t3.__super__ = e2.prototype, t3;1283        }, n = {}.hasOwnProperty;1284        e.ObjectMap = function(e2) {1285          function n2(t3) {1286            var e3, n3, i, o, r;1287            for (t3 == null && (t3 = []), this.objects = {}, i = 0, o = t3.length; o > i; i++)1288              r = t3[i], n3 = JSON.stringify(r), (e3 = this.objects)[n3] == null && (e3[n3] = r);1289          }1290          return t2(n2, e2), n2.prototype.find = function(t3) {1291            var e3;1292            return e3 = JSON.stringify(t3), this.objects[e3];1293          }, n2;1294        }(e.BasicObject);1295      }.call(this), function() {1296        e.ElementStore = function() {1297          function t2(t3) {1298            this.reset(t3);1299          }1300          var e2;1301          return t2.prototype.add = function(t3) {1302            var n;1303            return n = e2(t3), this.elements[n] = t3;1304          }, t2.prototype.remove = function(t3) {1305            var n, i;1306            return n = e2(t3), (i = this.elements[n]) ? (delete this.elements[n], i) : void 0;1307          }, t2.prototype.reset = function(t3) {1308            var e3, n, i;1309            for (t3 == null && (t3 = []), this.elements = {}, n = 0, i = t3.length; i > n; n++)1310              e3 = t3[n], this.add(e3);1311            return t3;1312          }, e2 = function(t3) {1313            return t3.dataset.trixStoreKey;1314          }, t2;1315        }();1316      }.call(this), function() {1317      }.call(this), function() {1318        var t2 = function(t3, e2) {1319          function i() {1320            this.constructor = t3;1321          }1322          for (var o in e2)1323            n.call(e2, o) && (t3[o] = e2[o]);1324          return i.prototype = e2.prototype, t3.prototype = new i(), t3.__super__ = e2.prototype, t3;1325        }, n = {}.hasOwnProperty;1326        e.Operation = function(e2) {1327          function n2() {1328            return n2.__super__.constructor.apply(this, arguments);1329          }1330          return t2(n2, e2), n2.prototype.isPerforming = function() {1331            return this.performing === true;1332          }, n2.prototype.hasPerformed = function() {1333            return this.performed === true;1334          }, n2.prototype.hasSucceeded = function() {1335            return this.performed && this.succeeded;1336          }, n2.prototype.hasFailed = function() {1337            return this.performed && !this.succeeded;1338          }, n2.prototype.getPromise = function() {1339            return this.promise != null ? this.promise : this.promise = new Promise(function(t3) {1340              return function(e3, n3) {1341                return t3.performing = true, t3.perform(function(i, o) {1342                  return t3.succeeded = i, t3.performing = false, t3.performed = true, t3.succeeded ? e3(o) : n3(o);1343                });1344              };1345            }(this));1346          }, n2.prototype.perform = function(t3) {1347            return t3(false);1348          }, n2.prototype.release = function() {1349            var t3;1350            return (t3 = this.promise) != null && typeof t3.cancel == "function" && t3.cancel(), this.promise = null, this.performing = null, this.performed = null, this.succeeded = null;1351          }, n2.proxyMethod("getPromise().then"), n2.proxyMethod("getPromise().catch"), n2;1352        }(e.BasicObject);1353      }.call(this), function() {1354        var t2, n, i, o, r, s = function(t3, e2) {1355          function n2() {1356            this.constructor = t3;1357          }1358          for (var i2 in e2)1359            a.call(e2, i2) && (t3[i2] = e2[i2]);1360          return n2.prototype = e2.prototype, t3.prototype = new n2(), t3.__super__ = e2.prototype, t3;1361        }, a = {}.hasOwnProperty;1362        e.UTF16String = function(t3) {1363          function e2(t4, e3) {1364            this.ucs2String = t4, this.codepoints = e3, this.length = this.codepoints.length, this.ucs2Length = this.ucs2String.length;1365          }1366          return s(e2, t3), e2.box = function(t4) {1367            return t4 == null && (t4 = ""), t4 instanceof this ? t4 : this.fromUCS2String(t4 != null ? t4.toString() : void 0);1368          }, e2.fromUCS2String = function(t4) {1369            return new this(t4, o(t4));1370          }, e2.fromCodepoints = function(t4) {1371            return new this(r(t4), t4);1372          }, e2.prototype.offsetToUCS2Offset = function(t4) {1373            return r(this.codepoints.slice(0, Math.max(0, t4))).length;1374          }, e2.prototype.offsetFromUCS2Offset = function(t4) {1375            return o(this.ucs2String.slice(0, Math.max(0, t4))).length;1376          }, e2.prototype.slice = function() {1377            var t4;1378            return this.constructor.fromCodepoints((t4 = this.codepoints).slice.apply(t4, arguments));1379          }, e2.prototype.charAt = function(t4) {1380            return this.slice(t4, t4 + 1);1381          }, e2.prototype.isEqualTo = function(t4) {1382            return this.constructor.box(t4).ucs2String === this.ucs2String;1383          }, e2.prototype.toJSON = function() {1384            return this.ucs2String;1385          }, e2.prototype.getCacheKey = function() {1386            return this.ucs2String;1387          }, e2.prototype.toString = function() {1388            return this.ucs2String;1389          }, e2;1390        }(e.BasicObject), t2 = (typeof Array.from == "function" ? Array.from("\u{1F47C}").length : void 0) === 1, n = (typeof " ".codePointAt == "function" ? " ".codePointAt(0) : void 0) != null, i = (typeof String.fromCodePoint == "function" ? String.fromCodePoint(32, 128124) : void 0) === " \u{1F47C}", o = t2 && n ? function(t3) {1391          return Array.from(t3).map(function(t4) {1392            return t4.codePointAt(0);1393          });1394        } : function(t3) {1395          var e2, n2, i2, o2, r2;1396          for (o2 = [], e2 = 0, i2 = t3.length; i2 > e2; )1397            r2 = t3.charCodeAt(e2++), r2 >= 55296 && 56319 >= r2 && i2 > e2 && (n2 = t3.charCodeAt(e2++), (64512 & n2) === 56320 ? r2 = ((1023 & r2) << 10) + (1023 & n2) + 65536 : e2--), o2.push(r2);1398          return o2;1399        }, r = i ? function(t3) {1400          return String.fromCodePoint.apply(String, t3);1401        } : function(t3) {1402          var e2, n2, i2;1403          return e2 = function() {1404            var e3, o2, r2;1405            for (r2 = [], e3 = 0, o2 = t3.length; o2 > e3; e3++)1406              i2 = t3[e3], n2 = "", i2 > 65535 && (i2 -= 65536, n2 += String.fromCharCode(i2 >>> 10 & 1023 | 55296), i2 = 56320 | 1023 & i2), r2.push(n2 + String.fromCharCode(i2));1407            return r2;1408          }(), e2.join("");1409        };1410      }.call(this), function() {1411      }.call(this), function() {1412      }.call(this), function() {1413        e.config.lang = {attachFiles: "Attach Files", bold: "Bold", bullets: "Bullets", byte: "Byte", bytes: "Bytes", captionPlaceholder: "Add a caption\u2026", code: "Code", heading1: "Heading", indent: "Increase Level", italic: "Italic", link: "Link", numbers: "Numbers", outdent: "Decrease Level", quote: "Quote", redo: "Redo", remove: "Remove", strike: "Strikethrough", undo: "Undo", unlink: "Unlink", url: "URL", urlPlaceholder: "Enter a URL\u2026", GB: "GB", KB: "KB", MB: "MB", PB: "PB", TB: "TB"};1414      }.call(this), function() {1415        e.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"};1416      }.call(this), function() {1417        var t2;1418        e.config.blockAttributes = t2 = {default: {tagName: "div", parse: false}, quote: {tagName: "blockquote", nestable: true}, heading1: {tagName: "h1", terminal: true, breakOnReturn: true, group: false}, code: {tagName: "pre", terminal: true, text: {plaintext: true}}, bulletList: {tagName: "ul", parse: false}, bullet: {tagName: "li", listAttribute: "bulletList", group: false, nestable: true, test: function(n) {1419          return e.tagName(n.parentNode) === t2[this.listAttribute].tagName;1420        }}, numberList: {tagName: "ol", parse: false}, number: {tagName: "li", listAttribute: "numberList", group: false, nestable: true, test: function(n) {1421          return e.tagName(n.parentNode) === t2[this.listAttribute].tagName;1422        }}, attachmentGallery: {tagName: "div", exclusive: true, terminal: true, parse: false, group: false}};1423      }.call(this), function() {1424        var t2, n;1425        t2 = e.config.lang, n = [t2.bytes, t2.KB, t2.MB, t2.GB, t2.TB, t2.PB], e.config.fileSize = {prefix: "IEC", precision: 2, formatter: function(e2) {1426          var i, o, r, s, a;1427          switch (e2) {1428            case 0:1429              return "0 " + t2.bytes;1430            case 1:1431              return "1 " + t2.byte;1432            default:1433              return i = function() {1434                switch (this.prefix) {1435                  case "SI":1436                    return 1e3;1437                  case "IEC":1438                    return 1024;1439                }1440              }.call(this), o = Math.floor(Math.log(e2) / Math.log(i)), r = e2 / Math.pow(i, o), s = r.toFixed(this.precision), a = s.replace(/0*$/, "").replace(/\.$/, ""), a + " " + n[o];1441          }1442        }};1443      }.call(this), function() {1444        e.config.textAttributes = {bold: {tagName: "strong", inheritable: true, parser: function(t2) {1445          var e2;1446          return e2 = window.getComputedStyle(t2), e2.fontWeight === "bold" || e2.fontWeight >= 600;1447        }}, italic: {tagName: "em", inheritable: true, parser: function(t2) {1448          var e2;1449          return e2 = window.getComputedStyle(t2), e2.fontStyle === "italic";1450        }}, href: {groupTagName: "a", parser: function(t2) {1451          var n, i, o;1452          return n = e.AttachmentView.attachmentSelector, o = "a:not(" + n + ")", (i = e.findClosestElementFromNode(t2, {matchingSelector: o})) ? i.getAttribute("href") : void 0;1453        }}, strike: {tagName: "del", inheritable: true}, frozen: {style: {backgroundColor: "highlight"}}};1454      }.call(this), function() {1455        var t2, n, i, o, r;1456        r = "[data-trix-serialize=false]", o = ["contenteditable", "data-trix-id", "data-trix-store-key", "data-trix-mutable", "data-trix-placeholder", "tabindex"], n = "data-trix-serialized-attributes", i = "[" + n + "]", t2 = new RegExp("<!--block-->", "g"), e.extend({serializers: {"application/json": function(t3) {1457          var n2;1458          if (t3 instanceof e.Document)1459            n2 = t3;1460          else {1461            if (!(t3 instanceof HTMLElement))1462              throw new Error("unserializable object");1463            n2 = e.Document.fromHTML(t3.innerHTML);1464          }1465          return n2.toSerializableDocument().toJSONString();1466        }, "text/html": function(s) {1467          var a, u, c, l, h, p, d, f, g, m, v, y, b, A, C, x, w;1468          if (s instanceof e.Document)1469            l = e.DocumentView.render(s);1470          else {1471            if (!(s instanceof HTMLElement))1472              throw new Error("unserializable object");1473            l = s.cloneNode(true);1474          }1475          for (A = l.querySelectorAll(r), h = 0, g = A.length; g > h; h++)1476            c = A[h], e.removeNode(c);1477          for (p = 0, m = o.length; m > p; p++)1478            for (a = o[p], C = l.querySelectorAll("[" + a + "]"), d = 0, v = C.length; v > d; d++)1479              c = C[d], c.removeAttribute(a);1480          for (x = l.querySelectorAll(i), f = 0, y = x.length; y > f; f++) {1481            c = x[f];1482            try {1483              u = JSON.parse(c.getAttribute(n)), c.removeAttribute(n);1484              for (b in u)1485                w = u[b], c.setAttribute(b, w);1486            } catch (E) {1487            }1488          }1489          return l.innerHTML.replace(t2, "");1490        }}, deserializers: {"application/json": function(t3) {1491          return e.Document.fromJSONString(t3);1492        }, "text/html": function(t3) {1493          return e.Document.fromHTML(t3);1494        }}, serializeToContentType: function(t3, n2) {1495          var i2;1496          if (i2 = e.serializers[n2])1497            return i2(t3);1498          throw new Error("unknown content type: " + n2);1499        }, deserializeFromContentType: function(t3, n2) {1500          var i2;1501          if (i2 = e.deserializers[n2])1502            return i2(t3);1503          throw new Error("unknown content type: " + n2);1504        }});1505      }.call(this), function() {1506        var t2;1507        t2 = e.config.lang, e.config.toolbar = {getDefaultHTML: function() {1508          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="' + t2.bold + '" tabindex="-1">' + t2.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="' + t2.italic + '" tabindex="-1">' + t2.italic + '</button>\n    <button type="button" class="trix-button trix-button--icon trix-button--icon-strike" data-trix-attribute="strike" title="' + t2.strike + '" tabindex="-1">' + t2.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="' + t2.link + '" tabindex="-1">' + t2.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="' + t2.heading1 + '" tabindex="-1">' + t2.heading1 + '</button>\n    <button type="button" class="trix-button trix-button--icon trix-button--icon-quote" data-trix-attribute="quote" title="' + t2.quote + '" tabindex="-1">' + t2.quote + '</button>\n    <button type="button" class="trix-button trix-button--icon trix-button--icon-code" data-trix-attribute="code" title="' + t2.code + '" tabindex="-1">' + t2.code + '</button>\n    <button type="button" class="trix-button trix-button--icon trix-button--icon-bullet-list" data-trix-attribute="bullet" title="' + t2.bullets + '" tabindex="-1">' + t2.bullets + '</button>\n    <button type="button" class="trix-button trix-button--icon trix-button--icon-number-list" data-trix-attribute="number" title="' + t2.numbers + '" tabindex="-1">' + t2.numbers + '</button>\n    <button type="button" class="trix-button trix-button--icon trix-button--icon-decrease-nesting-level" data-trix-action="decreaseNestingLevel" title="' + t2.outdent + '" tabindex="-1">' + t2.outdent + '</button>\n    <button type="button" class="trix-button trix-button--icon trix-button--icon-increase-nesting-level" data-trix-action="increaseNestingLevel" title="' + t2.indent + '" tabindex="-1">' + t2.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="' + t2.attachFiles + '" tabindex="-1">' + t2.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="' + t2.undo + '" tabindex="-1">' + t2.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="' + t2.redo + '" tabindex="-1">' + t2.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="' + t2.urlPlaceholder + '" aria-label="' + t2.url + '" required data-trix-input>\n      <div class="trix-button-group">\n        <input type="button" class="trix-button trix-button--dialog" value="' + t2.link + '" data-trix-method="setAttribute">\n        <input type="button" class="trix-button trix-button--dialog" value="' + t2.unlink + '" data-trix-method="removeAttribute">\n      </div>\n    </div>\n  </div>\n</div>';1509        }};1510      }.call(this), function() {1511        e.config.undoInterval = 5e3;1512      }.call(this), function() {1513        e.config.attachments = {preview: {presentation: "gallery", caption: {name: true, size: true}}, file: {caption: {size: true}}};1514      }.call(this), function() {1515        e.config.keyNames = {8: "backspace", 9: "tab", 13: "return", 27: "escape", 37: "left", 39: "right", 46: "delete", 68: "d", 72: "h", 79: "o"};1516      }.call(this), function() {1517        e.config.input = {level2Enabled: true, getLevel: function() {1518          return this.level2Enabled && e.browser.supportsInputEvents ? 2 : 0;1519        }, pickFiles: function(t2) {1520          var n;1521          return n = e.makeElement("input", {type: "file", multiple: true, hidden: true, id: this.fileInputId}), n.addEventListener("change", function() {1522            return t2(n.files), e.removeNode(n);1523          }), e.removeNode(document.getElementById(this.fileInputId)), document.body.appendChild(n), n.click();1524        }, fileInputId: "trix-file-input-" + Date.now().toString(16)};1525      }.call(this), function() {1526      }.call(this), function() {1527        e.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() {1528          return this.innerHTML === "" ? this.innerHTML = e.config.toolbar.getDefaultHTML() : void 0;1529        }});1530      }.call(this), function() {1531        var t2 = function(t3, e2) {1532          function i2() {1533            this.constructor = t3;1534          }1535          for (var o in e2)1536            n.call(e2, o) && (t3[o] = e2[o]);1537          return i2.prototype = e2.prototype, t3.prototype = new i2(), t3.__super__ = e2.prototype, t3;1538        }, n = {}.hasOwnProperty, i = [].indexOf || function(t3) {1539          for (var e2 = 0, n2 = this.length; n2 > e2; e2++)1540            if (e2 in this && this[e2] === t3)1541              return e2;1542          return -1;1543        };1544        e.ObjectView = function(n2) {1545          function o(t3, e2) {1546            this.object = t3, this.options = e2 != null ? e2 : {}, this.childViews = [], this.rootView = this;1547          }1548          return t2(o, n2), o.prototype.getNodes = function() {1549            var t3, e2, n3, i2, o2;1550            for (this.nodes == null && (this.nodes = this.createNodes()), i2 = this.nodes, o2 = [], t3 = 0, e2 = i2.length; e2 > t3; t3++)1551              n3 = i2[t3], o2.push(n3.cloneNode(true));1552            return o2;1553          }, o.prototype.invalidate = function() {1554            var t3;1555            return this.nodes = null, this.childViews = [], (t3 = this.parentView) != null ? t3.invalidate() : void 0;1556          }, o.prototype.invalidateViewForObject = function(t3) {1557            var e2;1558            return (e2 = this.findViewForObject(t3)) != null ? e2.invalidate() : void 0;1559          }, o.prototype.findOrCreateCachedChildView = function(t3, e2) {1560            var n3;1561            return (n3 = this.getCachedViewForObject(e2)) ? this.recordChildView(n3) : (n3 = this.createChildView.apply(this, arguments), this.cacheViewForObject(n3, e2)), n3;1562          }, o.prototype.createChildView = function(t3, n3, i2) {1563            var o2;1564            return i2 == null && (i2 = {}), n3 instanceof e.ObjectGroup && (i2.viewClass = t3, t3 = e.ObjectGroupView), o2 = new t3(n3, i2), this.recordChildView(o2);1565          }, o.prototype.recordChildView = function(t3) {1566            return t3.parentView = this, t3.rootView = this.rootView, this.childViews.push(t3), t3;1567          }, o.prototype.getAllChildViews = function() {1568            var t3, e2, n3, i2, o2;1569            for (o2 = [], i2 = this.childViews, e2 = 0, n3 = i2.length; n3 > e2; e2++)1570              t3 = i2[e2], o2.push(t3), o2 = o2.concat(t3.getAllChildViews());1571            return o2;1572          }, o.prototype.findElement = function() {1573            return this.findElementForObject(this.object);1574          }, o.prototype.findElementForObject = function(t3) {1575            var e2;1576            return (e2 = t3 != null ? t3.id : void 0) ? this.rootView.element.querySelector("[data-trix-id='" + e2 + "']") : void 0;1577          }, o.prototype.findViewForObject = function(t3) {1578            var e2, n3, i2, o2;1579            for (i2 = this.getAllChildViews(), e2 = 0, n3 = i2.length; n3 > e2; e2++)1580              if (o2 = i2[e2], o2.object === t3)1581                return o2;1582          }, o.prototype.getViewCache = function() {1583            return this.rootView !== this ? this.rootView.getViewCache() : this.isViewCachingEnabled() ? this.viewCache != null ? this.viewCache : this.viewCache = {} : void 0;1584          }, o.prototype.isViewCachingEnabled = function() {1585            return this.shouldCacheViews !== false;1586          }, o.prototype.enableViewCaching = function() {1587            return this.shouldCacheViews = true;1588          }, o.prototype.disableViewCaching = function() {1589            return this.shouldCacheViews = false;1590          }, o.prototype.getCachedViewForObject = function(t3) {1591            var e2;1592            return (e2 = this.getViewCache()) != null ? e2[t3.getCacheKey()] : void 0;1593          }, o.prototype.cacheViewForObject = function(t3, e2) {1594            var n3;1595            return (n3 = this.getViewCache()) != null ? n3[e2.getCacheKey()] = t3 : void 0;1596          }, o.prototype.garbageCollectCachedViews = function() {1597            var t3, e2, n3, o2, r, s;1598            if (t3 = this.getViewCache()) {1599              s = this.getAllChildViews().concat(this), n3 = function() {1600                var t4, e3, n4;1601                for (n4 = [], t4 = 0, e3 = s.length; e3 > t4; t4++)1602                  r = s[t4], n4.push(r.object.getCacheKey());1603                return n4;1604              }(), o2 = [];1605              for (e2 in t3)1606                i.call(n3, e2) < 0 && o2.push(delete t3[e2]);1607              return o2;1608            }1609          }, o;1610        }(e.BasicObject);1611      }.call(this), function() {1612        var t2 = function(t3, e2) {1613          function i() {1614            this.constructor = t3;1615          }1616          for (var o in e2)1617            n.call(e2, o) && (t3[o] = e2[o]);1618          return i.prototype = e2.prototype, t3.prototype = new i(), t3.__super__ = e2.prototype, t3;1619        }, n = {}.hasOwnProperty;1620        e.ObjectGroupView = function(e2) {1621          function n2() {1622            n2.__super__.constructor.apply(this, arguments), this.objectGroup = this.object, this.viewClass = this.options.viewClass, delete this.options.viewClass;1623          }1624          return t2(n2, e2), n2.prototype.getChildViews = function() {1625            var t3, e3, n3, i;1626            if (!this.childViews.length)1627              for (i = this.objectGroup.getObjects(), t3 = 0, e3 = i.length; e3 > t3; t3++)1628                n3 = i[t3], this.findOrCreateCachedChildView(this.viewClass, n3, this.options);1629            return this.childViews;1630          }, n2.prototype.createNodes = function() {1631            var t3, e3, n3, i, o, r, s, a, u;1632            for (t3 = this.createContainerElement(), s = this.getChildViews(), e3 = 0, i = s.length; i > e3; e3++)1633              for (u = s[e3], a = u.getNodes(), n3 = 0, o = a.length; o > n3; n3++)1634                r = a[n3], t3.appendChild(r);1635            return [t3];1636          }, n2.prototype.createContainerElement = function(t3) {1637            return t3 == null && (t3 = this.objectGroup.getDepth()), this.getChildViews()[0].createContainerElement(t3);1638          }, n2;1639        }(e.ObjectView);1640      }.call(this), function() {1641        var t2 = function(t3, e2) {1642          function i() {1643            this.constructor = t3;1644          }1645          for (var o in e2)1646            n.call(e2, o) && (t3[o] = e2[o]);1647          return i.prototype = e2.prototype, t3.prototype = new i(), t3.__super__ = e2.prototype, t3;1648        }, n = {}.hasOwnProperty;1649        e.Controller = function(e2) {1650          function n2() {1651            return n2.__super__.constructor.apply(this, arguments);1652          }1653          return t2(n2, e2), n2;1654        }(e.BasicObject);1655      }.call(this), function() {1656        var t2, n, i, o, r, s, a = function(t3, e2) {1657          return function() {1658            return t3.apply(e2, arguments);1659          };1660        }, u = function(t3, e2) {1661          function n2() {1662            this.constructor = t3;1663          }1664          for (var i2 in e2)1665            c.call(e2, i2) && (t3[i2] = e2[i2]);1666          return n2.prototype = e2.prototype, t3.prototype = new n2(), t3.__super__ = e2.prototype, t3;1667        }, c = {}.hasOwnProperty, l = [].indexOf || function(t3) {1668          for (var e2 = 0, n2 = this.length; n2 > e2; e2++)1669            if (e2 in this && this[e2] === t3)1670              return e2;1671          return -1;1672        };1673        t2 = e.findClosestElementFromNode, i = e.nodeIsEmptyTextNode, n = e.nodeIsBlockStartComment, o = e.normalizeSpaces, r = e.summarizeStringChange, s = e.tagName, e.MutationObserver = function(e2) {1674          function c2(t3) {1675            this.element = t3, this.didMutate = a(this.didMutate, this), this.observer = new window.MutationObserver(this.didMutate), this.start();1676          }1677          var h, p, d, f;1678          return u(c2, e2), p = "data-trix-mutable", d = "[" + p + "]", f = {attributes: true, childList: true, characterData: true, characterDataOldValue: true, subtree: true}, c2.prototype.start = function() {1679            return this.reset(), this.observer.observe(this.element, f);1680          }, c2.prototype.stop = function() {1681            return this.observer.disconnect();1682          }, c2.prototype.didMutate = function(t3) {1683            var e3, n2;1684            return (e3 = this.mutations).push.apply(e3, this.findSignificantMutations(t3)), this.mutations.length ? ((n2 = this.delegate) != null && typeof n2.elementDidMutate == "function" && n2.elementDidMutate(this.getMutationSummary()), this.reset()) : void 0;1685          }, c2.prototype.reset = function() {1686            return this.mutations = [];1687          }, c2.prototype.findSignificantMutations = function(t3) {1688            var e3, n2, i2, o2;1689            for (o2 = [], e3 = 0, n2 = t3.length; n2 > e3; e3++)1690              i2 = t3[e3], this.mutationIsSignificant(i2) && o2.push(i2);1691            return o2;1692          }, c2.prototype.mutationIsSignificant = function(t3) {1693            var e3, n2, i2, o2;1694            if (this.nodeIsMutable(t3.target))1695              return false;1696            for (o2 = this.nodesModifiedByMutation(t3), e3 = 0, n2 = o2.length; n2 > e3; e3++)1697              if (i2 = o2[e3], this.nodeIsSignificant(i2))1698                return true;1699            return false;1700          }, c2.prototype.nodeIsSignificant = function(t3) {1701            return t3 !== this.element && !this.nodeIsMutable(t3) && !i(t3);1702          }, c2.prototype.nodeIsMutable = function(e3) {1703            return t2(e3, {matchingSelector: d});1704          }, c2.prototype.nodesModifiedByMutation = function(t3) {1705            var e3;1706            switch (e3 = [], t3.type) {1707              case "attributes":1708                t3.attributeName !== p && e3.push(t3.target);1709                break;1710              case "characterData":1711                e3.push(t3.target.parentNode), e3.push(t3.target);1712                break;1713              case "childList":1714                e3.push.apply(e3, t3.addedNodes), e3.push.apply(e3, t3.removedNodes);1715            }1716            return e3;1717          }, c2.prototype.getMutationSummary = function() {1718            return this.getTextMutationSummary();1719          }, c2.prototype.getTextMutationSummary = function() {1720            var t3, e3, n2, i2, o2, r2, s2, a2, u2, c3, h2;1721            for (a2 = this.getTextChangesFromCharacterData(), n2 = a2.additions, o2 = a2.deletions, h2 = this.getTextChangesFromChildList(), u2 = h2.additions, r2 = 0, s2 = u2.length; s2 > r2; r2++)1722              e3 = u2[r2], l.call(n2, e3) < 0 && n2.push(e3);1723            return o2.push.apply(o2, h2.deletions), c3 = {}, (t3 = n2.join("")) && (c3.textAdded = t3), (i2 = o2.join("")) && (c3.textDeleted = i2), c3;1724          }, c2.prototype.getMutationsByType = function(t3) {1725            var e3, n2, i2, o2, r2;1726            for (o2 = this.mutations, r2 = [], e3 = 0, n2 = o2.length; n2 > e3; e3++)1727              i2 = o2[e3], i2.type === t3 && r2.push(i2);1728            return r2;1729          }, c2.prototype.getTextChangesFromChildList = function() {1730            var t3, e3, i2, r2, s2, a2, u2, c3, l2, p2, d2;1731            for (t3 = [], u2 = [], a2 = this.getMutationsByType("childList"), e3 = 0, r2 = a2.length; r2 > e3; e3++)1732              s2 = a2[e3], t3.push.apply(t3, s2.addedNodes), u2.push.apply(u2, s2.removedNodes);1733            return c3 = t3.length === 0 && u2.length === 1 && n(u2[0]), c3 ? (p2 = [], d2 = ["\n"]) : (p2 = h(t3), d2 = h(u2)), {additions: function() {1734              var t4, e4, n2;1735              for (n2 = [], i2 = t4 = 0, e4 = p2.length; e4 > t4; i2 = ++t4)1736                l2 = p2[i2], l2 !== d2[i2] && n2.push(o(l2));1737              return n2;1738            }(), deletions: function() {1739              var t4, e4, n2;1740              for (n2 = [], i2 = t4 = 0, e4 = d2.length; e4 > t4; i2 = ++t4)1741                l2 = d2[i2], l2 !== p2[i2] && n2.push(o(l2));1742              return n2;1743            }()};1744          }, c2.prototype.getTextChangesFromCharacterData = function() {1745            var t3, e3, n2, i2, s2, a2, u2, c3;1746            return e3 = this.getMutationsByType("characterData"), e3.length && (c3 = e3[0], n2 = e3[e3.length - 1], s2 = o(c3.oldValue), i2 = o(n2.target.data), a2 = r(s2, i2), t3 = a2.added, u2 = a2.removed), {additions: t3 ? [t3] : [], deletions: u2 ? [u2] : []};1747          }, h = function(t3) {1748            var e3, n2, i2, o2;1749            for (t3 == null && (t3 = []), o2 = [], e3 = 0, n2 = t3.length; n2 > e3; e3++)1750              switch (i2 = t3[e3], i2.nodeType) {1751                case Node.TEXT_NODE:1752                  o2.push(i2.data);1753                  break;1754                case Node.ELEMENT_NODE:1755                  s(i2) === "br" ? o2.push("\n") : o2.push.apply(o2, h(i2.childNodes));1756              }1757            return o2;1758          }, c2;1759        }(e.BasicObject);1760      }.call(this), function() {1761        var t2 = function(t3, e2) {1762          function i() {1763            this.constructor = t3;1764          }1765          for (var o in e2)1766            n.call(e2, o) && (t3[o] = e2[o]);1767          return i.prototype = e2.prototype, t3.prototype = new i(), t3.__super__ = e2.prototype, t3;1768        }, n = {}.hasOwnProperty;1769        e.FileVerificationOperation = function(e2) {1770          function n2(t3) {1771            this.file = t3;1772          }1773          return t2(n2, e2), n2.prototype.perform = function(t3) {1774            var e3;1775            return e3 = new FileReader(), e3.onerror = function() {1776              return t3(false);1777            }, e3.onload = function(n3) {1778              return function() {1779                e3.onerror = null;1780                try {1781                  e3.abort();1782                } catch (i) {1783                }1784                return t3(true, n3.file);1785              };1786            }(this), e3.readAsArrayBuffer(this.file);1787          }, n2;1788        }(e.Operation);1789      }.call(this), function() {1790        var t2, n, i = function(t3, e2) {1791          function n2() {1792            this.constructor = t3;1793          }1794          for (var i2 in e2)1795            o.call(e2, i2) && (t3[i2] = e2[i2]);1796          return n2.prototype = e2.prototype, t3.prototype = new n2(), t3.__super__ = e2.prototype, t3;1797        }, o = {}.hasOwnProperty;1798        t2 = e.handleEvent, n = e.innerElementIsActive, e.InputController = function(o2) {1799          function r(n2) {1800            var i2;1801            this.element = n2, this.mutationObserver = new e.MutationObserver(this.element), this.mutationObserver.delegate = this;1802            for (i2 in this.events)1803              t2(i2, {onElement: this.element, withCallback: this.handlerFor(i2)});1804          }1805          return i(r, o2), r.prototype.events = {}, r.prototype.elementDidMutate = function() {1806          }, r.prototype.editorWillSyncDocumentView = function() {1807            return this.mutationObserver.stop();1808          }, r.prototype.editorDidSyncDocumentView = function() {1809            return this.mutationObserver.start();1810          }, r.prototype.requestRender = function() {1811            var t3;1812            return (t3 = this.delegate) != null && typeof t3.inputControllerDidRequestRender == "function" ? t3.inputControllerDidRequestRender() : void 0;1813          }, r.prototype.requestReparse = function() {1814            var t3;1815            return (t3 = this.delegate) != null && typeof t3.inputControllerDidRequestReparse == "function" && t3.inputControllerDidRequestReparse(), this.requestRender();1816          }, r.prototype.attachFiles = function(t3) {1817            var n2, i2;1818            return i2 = function() {1819              var i3, o3, r2;1820              for (r2 = [], i3 = 0, o3 = t3.length; o3 > i3; i3++)1821                n2 = t3[i3], r2.push(new e.FileVerificationOperation(n2));1822              return r2;1823            }(), Promise.all(i2).then(function(t4) {1824              return function(e2) {1825                return t4.handleInput(function() {1826                  var t5, n3;1827                  return (t5 = this.delegate) != null && t5.inputControllerWillAttachFiles(), (n3 = this.responder) != null && n3.insertFiles(e2), this.requestRender();1828                });1829              };1830            }(this));1831          }, r.prototype.handlerFor = function(t3) {1832            return function(e2) {1833              return function(i2) {1834                return i2.defaultPrevented ? void 0 : e2.handleInput(function() {1835                  return n(this.element) ? void 0 : (this.eventName = t3, this.events[t3].call(this, i2));1836                });1837              };1838            }(this);1839          }, r.prototype.handleInput = function(t3) {1840            var e2, n2;1841            try {1842              return (e2 = this.delegate) != null && e2.inputControllerWillHandleInput(), t3.call(this);1843            } finally {1844              (n2 = this.delegate) != null && n2.inputControllerDidHandleInput();1845            }1846          }, r.prototype.createLinkHTML = function(t3, e2) {1847            var n2;1848            return n2 = document.createElement("a"), n2.href = t3, n2.textContent = e2 != null ? e2 : t3, n2.outerHTML;1849          }, r;1850        }(e.BasicObject);1851      }.call(this), function() {1852        var t2, n, i, o, r, s, a, u, c, l, h, p, d, f = function(t3, e2) {1853          function n2() {1854            this.constructor = t3;1855          }1856          for (var i2 in e2)1857            g.call(e2, i2) && (t3[i2] = e2[i2]);1858          return n2.prototype = e2.prototype, t3.prototype = new n2(), t3.__super__ = e2.prototype, t3;1859        }, g = {}.hasOwnProperty, m = [].indexOf || function(t3) {1860          for (var e2 = 0, n2 = this.length; n2 > e2; e2++)1861            if (e2 in this && this[e2] === t3)1862              return e2;1863          return -1;1864        };1865        c = e.makeElement, l = e.objectsAreEqual, d = e.tagName, n = e.browser, a = e.keyEventIsKeyboardCommand, o = e.dataTransferIsWritable, i = e.dataTransferIsPlainText, u = e.config.keyNames, e.Level0InputController = function(n2) {1866          function s2() {1867            s2.__super__.constructor.apply(this, arguments), this.resetInputSummary();1868          }1869          var d2;1870          return f(s2, n2), d2 = 0, s2.prototype.setInputSummary = function(t3) {1871            var e2, n3;1872            t3 == null && (t3 = {}), this.inputSummary.eventName = this.eventName;1873            for (e2 in t3)1874              n3 = t3[e2], this.inputSummary[e2] = n3;1875            return this.inputSummary;1876          }, s2.prototype.resetInputSummary = function() {1877            return this.inputSummary = {};1878          }, s2.prototype.reset = function() {1879            return this.resetInputSummary(), e.selectionChangeObserver.reset();1880          }, s2.prototype.elementDidMutate = function(t3) {1881            var e2;1882            return this.isComposing() ? (e2 = this.delegate) != null && typeof e2.inputControllerDidAllowUnhandledInput == "function" ? e2.inputControllerDidAllowUnhandledInput() : void 0 : this.handleInput(function() {1883              return this.mutationIsSignificant(t3) && (this.mutationIsExpected(t3) ? this.requestRender() : this.requestReparse()), this.reset();1884            });1885          }, s2.prototype.mutationIsExpected = function(t3) {1886            var e2, n3, i2, o2, r2, s3, a2, u2, c2, l2;1887            return a2 = t3.textAdded, u2 = t3.textDeleted, this.inputSummary.preferDocument ? true : (e2 = a2 != null ? a2 === this.inputSummary.textAdded : !this.inputSummary.textAdded, n3 = u2 != null ? this.inputSummary.didDelete : !this.inputSummary.didDelete, c2 = (a2 === "\n" || a2 === " \n") && !e2, l2 = u2 === "\n" && !n3, s3 = c2 && !l2 || l2 && !c2, s3 && (o2 = this.getSelectedRange()) && (i2 = c2 ? a2.replace(/\n$/, "").length || -1 : (a2 != null ? a2.length : void 0) || 1, (r2 = this.responder) != null ? r2.positionIsBlockBreak(o2[1] + i2) : void 0) ? true : e2 && n3);1888          }, s2.prototype.mutationIsSignificant = function(t3) {1889            var e2, n3, i2;1890            return i2 = Object.keys(t3).length > 0, e2 = ((n3 = this.compositionInput) != null ? n3.getEndData() : void 0) === "", i2 || !e2;1891          }, s2.prototype.events = {keydown: function(t3) {1892            var n3, i2, o2, r2, s3, c2, l2, h2, p2;1893            if (this.isComposing() || this.resetInputSummary(), this.inputSummary.didInput = true, r2 = u[t3.keyCode]) {1894              for (i2 = this.keys, h2 = ["ctrl", "alt", "shift", "meta"], o2 = 0, c2 = h2.length; c2 > o2; o2++)1895                l2 = h2[o2], t3[l2 + "Key"] && (l2 === "ctrl" && (l2 = "control"), i2 = i2 != null ? i2[l2] : void 0);1896              (i2 != null ? i2[r2] : void 0) != null && (this.setInputSummary({keyName: r2}), e.selectionChangeObserver.reset(), i2[r2].call(this, t3));1897            }1898            return a(t3) && (n3 = String.fromCharCode(t3.keyCode).toLowerCase()) && (s3 = function() {1899              var e2, n4, i3, o3;1900              for (i3 = ["alt", "shift"], o3 = [], e2 = 0, n4 = i3.length; n4 > e2; e2++)1901                l2 = i3[e2], t3[l2 + "Key"] && o3.push(l2);1902              return o3;1903            }(), s3.push(n3), (p2 = this.delegate) != null ? p2.inputControllerDidReceiveKeyboardCommand(s3) : void 0) ? t3.preventDefault() : void 0;1904          }, keypress: function(t3) {1905            var e2, n3, i2;1906            if (this.inputSummary.eventName == null && !t3.metaKey && (!t3.ctrlKey || t3.altKey))1907              return (i2 = p(t3)) ? ((e2 = this.delegate) != null && e2.inputControllerWillPerformTyping(), (n3 = this.responder) != null && n3.insertString(i2), this.setInputSummary({textAdded: i2, didDelete: this.selectionIsExpanded()})) : void 0;1908          }, textInput: function(t3) {1909            var e2, n3, i2, o2;1910            return e2 = t3.data, o2 = this.inputSummary.textAdded, o2 && o2 !== e2 && o2.toUpperCase() === e2 ? (n3 = this.getSelectedRange(), this.setSelectedRange([n3[0], n3[1] + o2.length]), (i2 = this.responder) != null && i2.insertString(e2), this.setInputSummary({textAdded: e2}), this.setSelectedRange(n3)) : void 0;1911          }, dragenter: function(t3) {1912            return t3.preventDefault();1913          }, dragstart: function(t3) {1914            var e2, n3;1915            return n3 = t3.target, this.serializeSelectionToDataTransfer(t3.dataTransfer), this.draggedRange = this.getSelectedRange(), (e2 = this.delegate) != null && typeof e2.inputControllerDidStartDrag == "function" ? e2.inputControllerDidStartDrag() : void 0;1916          }, dragover: function(t3) {1917            var e2, n3;1918            return !this.draggedRange && !this.canAcceptDataTransfer(t3.dataTransfer) || (t3.preventDefault(), e2 = {x: t3.clientX, y: t3.clientY}, l(e2, this.draggingPoint)) ? void 0 : (this.draggingPoint = e2, (n3 = this.delegate) != null && typeof n3.inputControllerDidReceiveDragOverPoint == "function" ? n3.inputControllerDidReceiveDragOverPoint(this.draggingPoint) : void 0);1919          }, dragend: function() {1920            var t3;1921            return (t3 = this.delegate) != null && typeof t3.inputControllerDidCancelDrag == "function" && t3.inputControllerDidCancelDrag(), this.draggedRange = null, this.draggingPoint = null;1922          }, drop: function(t3) {1923            var n3, i2, o2, r2, s3, a2, u2, c2, l2;1924            return t3.preventDefault(), o2 = (s3 = t3.dataTransfer) != null ? s3.files : void 0, r2 = {x: t3.clientX, y: t3.clientY}, (a2 = this.responder) != null && a2.setLocationRangeFromPointRange(r2), (o2 != null ? o2.length : void 0) ? this.attachFiles(o2) : this.draggedRange ? ((u2 = this.delegate) != null && u2.inputControllerWillMoveText(), (c2 = this.responder) != null && c2.moveTextFromRange(this.draggedRange), this.draggedRange = null, this.requestRender()) : (i2 = t3.dataTransfer.getData("application/x-trix-document")) && (n3 = e.Document.fromJSONString(i2), (l2 = this.responder) != null && l2.insertDocument(n3), this.requestRender()), this.draggedRange = null, this.draggingPoint = null;1925          }, cut: function(t3) {1926            var e2, n3;1927            return ((e2 = this.responder) != null ? e2.selectionIsExpanded() : void 0) && (this.serializeSelectionToDataTransfer(t3.clipboardData) && t3.preventDefault(), (n3 = this.delegate) != null && n3.inputControllerWillCutText(), this.deleteInDirection("backward"), t3.defaultPrevented) ? this.requestRender() : void 0;1928          }, copy: function(t3) {1929            var e2;1930            return ((e2 = this.responder) != null ? e2.selectionIsExpanded() : void 0) && this.serializeSelectionToDataTransfer(t3.clipboardData) ? t3.preventDefault() : void 0;1931          }, paste: function(t3) {1932            var n3, o2, s3, a2, u2, c2, l2, p2, f2, g2, v, y, b, A, C, x, w, E, S, R, k, D, L;1933            return n3 = (p2 = t3.clipboardData) != null ? p2 : t3.testClipboardData, l2 = {clipboard: n3}, n3 == null || h(t3) ? void this.getPastedHTMLUsingHiddenElement(function(t4) {1934              return function(e2) {1935                var n4, i2, o3;1936                return l2.type = "text/html", l2.html = e2, (n4 = t4.delegate) != null && n4.inputControllerWillPaste(l2), (i2 = t4.responder) != null && i2.insertHTML(l2.html), t4.requestRender(), (o3 = t4.delegate) != null ? o3.inputControllerDidPaste(l2) : void 0;1937              };1938            }(this)) : ((a2 = n3.getData("URL")) ? (l2.type = "text/html", L = (c2 = n3.getData("public.url-name")) ? e.squishBreakableWhitespace(c2).trim() : a2, l2.html = this.createLinkHTML(a2, L), (f2 = this.delegate) != null && f2.inputControllerWillPaste(l2), this.setInputSummary({textAdded: L, didDelete: this.selectionIsExpanded()}), (C = this.responder) != null && C.insertHTML(l2.html), this.requestRender(), (x = this.delegate) != null && x.inputControllerDidPaste(l2)) : i(n3) ? (l2.type = "text/plain", l2.string = n3.getData("text/plain"), (w = this.delegate) != null && w.inputControllerWillPaste(l2), this.setInputSummary({textAdded: l2.string, didDelete: this.selectionIsExpanded()}), (E = this.responder) != null && E.insertString(l2.string), this.requestRender(), (S = this.delegate) != null && S.inputControllerDidPaste(l2)) : (u2 = n3.getData("text/html")) ? (l2.type = "text/html", l2.html = u2, (R = this.delegate) != null && R.inputControllerWillPaste(l2), (k = this.responder) != null && k.insertHTML(l2.html), this.requestRender(), (D = this.delegate) != null && D.inputControllerDidPaste(l2)) : m.call(n3.types, "Files") >= 0 && (s3 = (g2 = n3.items) != null && (v = g2[0]) != null && typeof v.getAsFile == "function" ? v.getAsFile() : void 0) && (!s3.name && (o2 = r(s3)) && (s3.name = "pasted-file-" + ++d2 + "." + o2), l2.type = "File", l2.file = s3, (y = this.delegate) != null && y.inputControllerWillAttachFiles(), (b = this.responder) != null && b.insertFile(l2.file), this.requestRender(), (A = this.delegate) != null && A.inputControllerDidPaste(l2)), t3.preventDefault());1939          }, compositionstart: function(t3) {1940            return this.getCompositionInput().start(t3.data);1941          }, compositionupdate: function(t3) {1942            return this.getCompositionInput().update(t3.data);1943          }, compositionend: function(t3) {1944            return this.getCompositionInput().end(t3.data);1945          }, beforeinput: function() {1946            return this.inputSummary.didInput = true;1947          }, input: function(t3) {1948            return this.inputSummary.didInput = true, t3.stopPropagation();1949          }}, s2.prototype.keys = {backspace: function(t3) {1950            var e2;1951            return (e2 = this.delegate) != null && e2.inputControllerWillPerformTyping(), this.deleteInDirection("backward", t3);1952          }, delete: function(t3) {1953            var e2;1954            return (e2 = this.delegate) != null && e2.inputControllerWillPerformTyping(), this.deleteInDirection("forward", t3);1955          }, return: function() {1956            var t3, e2;1957            return this.setInputSummary({preferDocument: true}), (t3 = this.delegate) != null && t3.inputControllerWillPerformTyping(), (e2 = this.responder) != null ? e2.insertLineBreak() : void 0;1958          }, tab: function(t3) {1959            var e2, n3;1960            return ((e2 = this.responder) != null ? e2.canIncreaseNestingLevel() : void 0) ? ((n3 = this.responder) != null && n3.increaseNestingLevel(), this.requestRender(), t3.preventDefault()) : void 0;1961          }, left: function(t3) {1962            var e2;1963            return this.selectionIsInCursorTarget() ? (t3.preventDefault(), (e2 = this.responder) != null ? e2.moveCursorInDirection("backward") : void 0) : void 0;1964          }, right: function(t3) {1965            var e2;1966            return this.selectionIsInCursorTarget() ? (t3.preventDefault(), (e2 = this.responder) != null ? e2.moveCursorInDirection("forward") : void 0) : void 0;1967          }, control: {d: function(t3) {1968            var e2;1969            return (e2 = this.delegate) != null && e2.inputControllerWillPerformTyping(), this.deleteInDirection("forward", t3);1970          }, h: function(t3) {1971            var e2;1972            return (e2 = this.delegate) != null && e2.inputControllerWillPerformTyping(), this.deleteInDirection("backward", t3);1973          }, o: function(t3) {1974            var e2, n3;1975            return t3.preventDefault(), (e2 = this.delegate) != null && e2.inputControllerWillPerformTyping(), (n3 = this.responder) != null && n3.insertString("\n", {updatePosition: false}), this.requestRender();1976          }}, shift: {return: function(t3) {1977            var e2, n3;1978            return (e2 = this.delegate) != null && e2.inputControllerWillPerformTyping(), (n3 = this.responder) != null && n3.insertString("\n"), this.requestRender(), t3.preventDefault();1979          }, tab: function(t3) {1980            var e2, n3;1981            return ((e2 = this.responder) != null ? e2.canDecreaseNestingLevel() : void 0) ? ((n3 = this.responder) != null && n3.decreaseNestingLevel(), this.requestRender(), t3.preventDefault()) : void 0;1982          }, left: function(t3) {1983            return this.selectionIsInCursorTarget() ? (t3.preventDefault(), this.expandSelectionInDirection("backward")) : void 0;1984          }, right: function(t3) {1985            return this.selectionIsInCursorTarget() ? (t3.preventDefault(), this.expandSelectionInDirection("forward")) : void 0;1986          }}, alt: {backspace: function() {1987            var t3;1988            return this.setInputSummary({preferDocument: false}), (t3 = this.delegate) != null ? t3.inputControllerWillPerformTyping() : void 0;1989          }}, meta: {backspace: function() {1990            var t3;1991            return this.setInputSummary({preferDocument: false}), (t3 = this.delegate) != null ? t3.inputControllerWillPerformTyping() : void 0;1992          }}}, s2.prototype.getCompositionInput = function() {1993            return this.isComposing() ? this.compositionInput : this.compositionInput = new t2(this);1994          }, s2.prototype.isComposing = function() {1995            return this.compositionInput != null && !this.compositionInput.isEnded();1996          }, s2.prototype.deleteInDirection = function(t3, e2) {1997            var n3;1998            return ((n3 = this.responder) != null ? n3.deleteInDirection(t3) : void 0) !== false ? this.setInputSummary({didDelete: true}) : e2 ? (e2.preventDefault(), this.requestRender()) : void 0;1999          }, s2.prototype.serializeSelectionToDataTransfer = function(t3) {2000            var n3, i2;2001            if (o(t3))2002              return n3 = (i2 = this.responder) != null ? i2.getSelectedDocument().toSerializableDocument() : void 0, t3.setData("application/x-trix-document", JSON.stringify(n3)), t3.setData("text/html", e.DocumentView.render(n3).innerHTML), t3.setData("text/plain", n3.toString().replace(/\n$/, "")), true;2003          }, s2.prototype.canAcceptDataTransfer = function(t3) {2004            var e2, n3, i2, o2, r2, s3;2005            for (s3 = {}, o2 = (i2 = t3 != null ? t3.types : void 0) != null ? i2 : [], e2 = 0, n3 = o2.length; n3 > e2; e2++)2006              r2 = o2[e2], s3[r2] = true;2007            return s3.Files || s3["application/x-trix-document"] || s3["text/html"] || s3["text/plain"];2008          }, s2.prototype.getPastedHTMLUsingHiddenElement = function(t3) {2009            var n3, i2, o2;2010            return i2 = this.getSelectedRange(), o2 = {position: "absolute", left: window.pageXOffset + "px", top: window.pageYOffset + "px", opacity: 0}, n3 = c({style: o2, tagName: "div", editable: true}), document.body.appendChild(n3), n3.focus(), requestAnimationFrame(function(o3) {2011              return function() {2012                var r2;2013                return r2 = n3.innerHTML, e.removeNode(n3), o3.setSelectedRange(i2), t3(r2);2014              };2015            }(this));2016          }, s2.proxyMethod("responder?.getSelectedRange"), s2.proxyMethod("responder?.setSelectedRange"), s2.proxyMethod("responder?.expandSelectionInDirection"), s2.proxyMethod("responder?.selectionIsInCursorTarget"), s2.proxyMethod("responder?.selectionIsExpanded"), s2;2017        }(e.InputController), r = function(t3) {2018          var e2, n2;2019          return (e2 = t3.type) != null && (n2 = e2.match(/\/(\w+)$/)) != null ? n2[1] : void 0;2020        }, s = (typeof " ".codePointAt == "function" ? " ".codePointAt(0) : void 0) != null, p = function(t3) {2021          var n2;2022          return t3.key && s && t3.key.codePointAt(0) === t3.keyCode ? t3.key : (t3.which === null ? n2 = t3.keyCode : t3.which !== 0 && t3.charCode !== 0 && (n2 = t3.charCode), n2 != null && u[n2] !== "escape" ? e.UTF16String.fromCodepoints([n2]).toString() : void 0);2023        }, h = function(t3) {2024          var e2, n2, i2, o2, r2, s2, a2, u2, c2, l2;2025          if (u2 = t3.clipboardData) {2026            if (m.call(u2.types, "text/html") >= 0) {2027              for (c2 = u2.types, i2 = 0, s2 = c2.length; s2 > i2; i2++)2028                if (l2 = c2[i2], e2 = /^CorePasteboardFlavorType/.test(l2), n2 = /^dyn\./.test(l2) && u2.getData(l2), a2 = e2 || n2)2029                  return true;2030              return false;2031            }2032            return o2 = m.call(u2.types, "com.apple.webarchive") >= 0, r2 = m.call(u2.types, "com.apple.flat-rtfd") >= 0, o2 || r2;2033          }2034        }, t2 = function(t3) {2035          function e2(t4) {2036            var e3;2037            this.inputController = t4, e3 = this.inputController, this.responder = e3.responder, this.delegate = e3.delegate, this.inputSummary = e3.inputSummary, this.data = {};2038          }2039          return f(e2, t3), e2.prototype.start = function(t4) {2040            var e3, n2;2041            return this.data.start = t4, this.isSignificant() ? (this.inputSummary.eventName === "keypress" && this.inputSummary.textAdded && (e3 = this.responder) != null && e3.deleteInDirection("left"), this.selectionIsExpanded() || (this.insertPlaceholder(), this.requestRender()), this.range = (n2 = this.responder) != null ? n2.getSelectedRange() : void 0) : void 0;2042          }, e2.prototype.update = function(t4) {2043            var e3;2044            return this.data.update = t4, this.isSignificant() && (e3 = this.selectPlaceholder()) ? (this.forgetPlaceholder(), this.range = e3) : void 0;2045          }, e2.prototype.end = function(t4) {2046            var e3, n2, i2, o2;2047            return this.data.end = t4, this.isSignificant() ? (this.forgetPlaceholder(), this.canApplyToDocument() ? (this.setInputSummary({preferDocument: true, didInput: false}), (e3 = this.delegate) != null && e3.inputControllerWillPerformTyping(), (n2 = this.responder) != null && n2.setSelectedRange(this.range), (i2 = this.responder) != null && i2.insertString(this.data.end), (o2 = this.responder) != null ? o2.setSelectedRange(this.range[0] + this.data.end.length) : void 0) : this.data.start != null || this.data.update != null ? (this.requestReparse(), this.inputController.reset()) : void 0) : this.inputController.reset();2048          }, e2.prototype.getEndData = function() {2049            return this.data.end;2050          }, e2.prototype.isEnded = function() {2051            return this.getEndData() != null;2052          }, e2.prototype.isSignificant = function() {2053            return n.composesExistingText ? this.inputSummary.didInput : true;2054          }, e2.prototype.canApplyToDocument = function() {2055            var t4, e3;2056            return ((t4 = this.data.start) != null ? t4.length : void 0) === 0 && ((e3 = this.data.end) != null ? e3.length : void 0) > 0 && this.range != null;2057          }, e2.proxyMethod("inputController.setInputSummary"), e2.proxyMethod("inputController.requestRender"), e2.proxyMethod("inputController.requestReparse"), e2.proxyMethod("responder?.selectionIsExpanded"), e2.proxyMethod("responder?.insertPlaceholder"), e2.proxyMethod("responder?.selectPlaceholder"), e2.proxyMethod("responder?.forgetPlaceholder"), e2;2058        }(e.BasicObject);2059      }.call(this), function() {2060        var t2, n, i, o = function(t3, e2) {2061          return function() {2062            return t3.apply(e2, arguments);2063          };2064        }, r = function(t3, e2) {2065          function n2() {2066            this.constructor = t3;2067          }2068          for (var i2 in e2)2069            s.call(e2, i2) && (t3[i2] = e2[i2]);2070          return n2.prototype = e2.prototype, t3.prototype = new n2(), t3.__super__ = e2.prototype, t3;2071        }, s = {}.hasOwnProperty, a = [].indexOf || function(t3) {2072          for (var e2 = 0, n2 = this.length; n2 > e2; e2++)2073            if (e2 in this && this[e2] === t3)2074              return e2;2075          return -1;2076        };2077        t2 = e.dataTransferIsPlainText, n = e.keyEventIsKeyboardCommand, i = e.objectsAreEqual, e.Level2InputController = function(s2) {2078          function u() {2079            return this.render = o(this.render, this), u.__super__.constructor.apply(this, arguments);2080          }2081          var c, l, h, p, d, f;2082          return r(u, s2), u.prototype.elementDidMutate = function() {2083            var t3;2084            return this.scheduledRender ? this.composing && (t3 = this.delegate) != null && typeof t3.inputControllerDidAllowUnhandledInput == "function" ? t3.inputControllerDidAllowUnhandledInput() : void 0 : this.reparse();2085          }, u.prototype.scheduleRender = function() {2086            return this.scheduledRender != null ? this.scheduledRender : this.scheduledRender = requestAnimationFrame(this.render);2087          }, u.prototype.render = function() {2088            var t3;2089            return cancelAnimationFrame(this.scheduledRender), this.scheduledRender = null, this.composing || (t3 = this.delegate) != null && t3.render(), typeof this.afterRender == "function" && this.afterRender(), this.afterRender = null;2090          }, u.prototype.reparse = function() {2091            var t3;2092            return (t3 = this.delegate) != null ? t3.reparse() : void 0;2093          }, u.prototype.events = {keydown: function(t3) {2094            var e2, i2, o2, r2;2095            if (n(t3)) {2096              if (e2 = l(t3), (r2 = this.delegate) != null ? r2.inputControllerDidReceiveKeyboardCommand(e2) : void 0)2097                return t3.preventDefault();2098            } else if (o2 = t3.key, t3.altKey && (o2 += "+Alt"), t3.shiftKey && (o2 += "+Shift"), i2 = this.keys[o2])2099              return this.withEvent(t3, i2);2100          }, paste: function(t3) {2101            var e2, n2, i2, o2, r2, s3, a2, u2, c2;2102            return h(t3) ? (t3.preventDefault(), this.attachFiles(t3.clipboardData.files)) : p(t3) ? (t3.preventDefault(), n2 = {type: "text/plain", string: t3.clipboardData.getData("text/plain")}, (i2 = this.delegate) != null && i2.inputControllerWillPaste(n2), (o2 = this.responder) != null && o2.insertString(n2.string), this.render(), (r2 = this.delegate) != null ? r2.inputControllerDidPaste(n2) : void 0) : (e2 = (s3 = t3.clipboardData) != null ? s3.getData("URL") : void 0) ? (t3.preventDefault(), n2 = {type: "text/html", html: this.createLinkHTML(e2)}, (a2 = this.delegate) != null && a2.inputControllerWillPaste(n2), (u2 = this.responder) != null && u2.insertHTML(n2.html), this.render(), (c2 = this.delegate) != null ? c2.inputControllerDidPaste(n2) : void 0) : void 0;2103          }, beforeinput: function(t3) {2104            var e2;2105            return (e2 = this.inputTypes[t3.inputType]) ? (this.withEvent(t3, e2), this.scheduleRender()) : void 0;2106          }, input: function() {2107            return e.selectionChangeObserver.reset();2108          }, dragstart: function(t3) {2109            var e2, n2;2110            return ((e2 = this.responder) != null ? e2.selectionContainsAttachments() : void 0) ? (t3.dataTransfer.setData("application/x-trix-dragging", true), this.dragging = {range: (n2 = this.responder) != null ? n2.getSelectedRange() : void 0, point: d(t3)}) : void 0;2111          }, dragenter: function(t3) {2112            return c(t3) ? t3.preventDefault() : void 0;2113          }, dragover: function(t3) {2114            var e2, n2;2115            if (this.dragging) {2116              if (t3.preventDefault(), e2 = d(t3), !i(e2, this.dragging.point))2117                return this.dragging.point = e2, (n2 = this.responder) != null ? n2.setLocationRangeFromPointRange(e2) : void 0;2118            } else if (c(t3))2119              return t3.preventDefault();2120          }, drop: function(t3) {2121            var e2, n2, i2, o2;2122            return this.dragging ? (t3.preventDefault(), (n2 = this.delegate) != null && n2.inputControllerWillMoveText(), (i2 = this.responder) != null && i2.moveTextFromRange(this.dragging.range), this.dragging = null, this.scheduleRender()) : c(t3) ? (t3.preventDefault(), e2 = d(t3), (o2 = this.responder) != null && o2.setLocationRangeFromPointRange(e2), this.attachFiles(t3.dataTransfer.files)) : void 0;2123          }, dragend: function() {2124            var t3;2125            return this.dragging ? ((t3 = this.responder) != null && t3.setSelectedRange(this.dragging.range), this.dragging = null) : void 0;2126          }, compositionend: function() {2127            return this.composing ? (this.composing = false, this.scheduleRender()) : void 0;2128          }}, u.prototype.keys = {ArrowLeft: function() {2129            var t3, e2;2130            return ((t3 = this.responder) != null ? t3.shouldManageMovingCursorInDirection("backward") : void 0) ? (this.event.preventDefault(), (e2 = this.responder) != null ? e2.moveCursorInDirection("backward") : void 0) : void 0;2131          }, ArrowRight: function() {2132            var t3, e2;2133            return ((t3 = this.responder) != null ? t3.shouldManageMovingCursorInDirection("forward") : void 0) ? (this.event.preventDefault(), (e2 = this.responder) != null ? e2.moveCursorInDirection("forward") : void 0) : void 0;2134          }, Backspace: function() {2135            var t3, e2, n2;2136            return ((t3 = this.responder) != null ? t3.shouldManageDeletingInDirection("backward") : void 0) ? (this.event.preventDefault(), (e2 = this.delegate) != null && e2.inputControllerWillPerformTyping(), (n2 = this.responder) != null && n2.deleteInDirection("backward"), this.render()) : void 0;2137          }, Tab: function() {2138            var t3, e2;2139            return ((t3 = this.responder) != null ? t3.canIncreaseNestingLevel() : void 0) ? (this.event.preventDefault(), (e2 = this.responder) != null && e2.increaseNestingLevel(), this.render()) : void 0;2140          }, "Tab+Shift": function() {2141            var t3, e2;2142            return ((t3 = this.responder) != null ? t3.canDecreaseNestingLevel() : void 0) ? (this.event.preventDefault(), (e2 = this.responder) != null && e2.decreaseNestingLevel(), this.render()) : void 0;2143          }}, u.prototype.inputTypes = {deleteByComposition: function() {2144            return this.deleteInDirection("backward", {recordUndoEntry: false});2145          }, deleteByCut: function() {2146            return this.deleteInDirection("backward");2147          }, deleteByDrag: function() {2148            return this.event.preventDefault(), this.withTargetDOMRange(function() {2149              var t3;2150              return this.deleteByDragRange = (t3 = this.responder) != null ? t3.getSelectedRange() : void 0;2151            });2152          }, deleteCompositionText: function() {2153            return this.deleteInDirection("backward", {recordUndoEntry: false});2154          }, deleteContent: function() {2155            return this.deleteInDirection("backward");2156          }, deleteContentBackward: function() {2157            return this.deleteInDirection("backward");2158          }, deleteContentForward: function() {2159            return this.deleteInDirection("forward");2160          }, deleteEntireSoftLine: function() {2161            return this.deleteInDirection("forward");2162          }, deleteHardLineBackward: function() {2163            return this.deleteInDirection("backward");2164          }, deleteHardLineForward: function() {2165            return this.deleteInDirection("forward");2166          }, deleteSoftLineBackward: function() {2167            return this.deleteInDirection("backward");2168          }, deleteSoftLineForward: function() {2169            return this.deleteInDirection("forward");2170          }, deleteWordBackward: function() {2171            return this.deleteInDirection("backward");2172          }, deleteWordForward: function() {2173            return this.deleteInDirection("forward");2174          }, formatBackColor: function() {2175            return this.activateAttributeIfSupported("backgroundColor", this.event.data);2176          }, formatBold: function() {2177            return this.toggleAttributeIfSupported("bold");2178          }, formatFontColor: function() {2179            return this.activateAttributeIfSupported("color", this.event.data);2180          }, formatFontName: function() {2181            return this.activateAttributeIfSupported("font", this.event.data);2182          }, formatIndent: function() {2183            var t3;2184            return ((t3 = this.responder) != null ? t3.canIncreaseNestingLevel() : void 0) ? this.withTargetDOMRange(function() {2185              var t4;2186              return (t4 = this.responder) != null ? t4.increaseNestingLevel() : void 0;2187            }) : void 0;2188          }, formatItalic: function() {2189            return this.toggleAttributeIfSupported("italic");2190          }, formatJustifyCenter: function() {2191            return this.toggleAttributeIfSupported("justifyCenter");2192          }, formatJustifyFull: function() {2193            return this.toggleAttributeIfSupported("justifyFull");2194          }, formatJustifyLeft: function() {2195            return this.toggleAttributeIfSupported("justifyLeft");2196          }, formatJustifyRight: function() {2197            return this.toggleAttributeIfSupported("justifyRight");2198          }, formatOutdent: function() {2199            var t3;2200            return ((t3 = this.responder) != null ? t3.canDecreaseNestingLevel() : void 0) ? this.withTargetDOMRange(function() {2201              var t4;2202              return (t4 = this.responder) != null ? t4.decreaseNestingLevel() : void 0;2203            }) : void 0;2204          }, formatRemove: function() {2205            return this.withTargetDOMRange(function() {2206              var t3, e2, n2, i2;2207              i2 = [];2208              for (t3 in (e2 = this.responder) != null ? e2.getCurrentAttributes() : void 0)2209                i2.push((n2 = this.responder) != null ? n2.removeCurrentAttribute(t3) : void 0);2210              return i2;2211            });2212          }, formatSetBlockTextDirection: function() {2213            return this.activateAttributeIfSupported("blockDir", this.event.data);2214          }, formatSetInlineTextDirection: function() {2215            return this.activateAttributeIfSupported("textDir", this.event.data);2216          }, formatStrikeThrough: function() {2217            return this.toggleAttributeIfSupported("strike");2218          }, formatSubscript: function() {2219            return this.toggleAttributeIfSupported("sub");2220          }, formatSuperscript: function() {2221            return this.toggleAttributeIfSupported("sup");2222          }, formatUnderline: function() {2223            return this.toggleAttributeIfSupported("underline");2224          }, historyRedo: function() {2225            var t3;2226            return (t3 = this.delegate) != null ? t3.inputControllerWillPerformRedo() : void 0;2227          }, historyUndo: function() {2228            var t3;2229            return (t3 = this.delegate) != null ? t3.inputControllerWillPerformUndo() : void 0;2230          }, insertCompositionText: function() {2231            return this.composing = true, this.insertString(this.event.data);2232          }, insertFromComposition: function() {2233            return this.composing = false, this.insertString(this.event.data);2234          }, insertFromDrop: function() {2235            var t3, e2;2236            return (t3 = this.deleteByDragRange) ? (this.deleteByDragRange = null, (e2 = this.delegate) != null && e2.inputControllerWillMoveText(), this.withTargetDOMRange(function() {2237              var e3;2238              return (e3 = this.responder) != null ? e3.moveTextFromRange(t3) : void 0;2239            })) : void 0;2240          }, insertFromPaste: function() {2241            var n2, i2, o2, r2, s3, a2, u2, c2, l2, h2, p2;2242            return n2 = this.event.dataTransfer, s3 = {dataTransfer: n2}, (i2 = n2.getData("URL")) ? (this.event.preventDefault(), s3.type = "text/html", p2 = (r2 = n2.getData("public.url-name")) ? e.squishBreakableWhitespace(r2).trim() : i2, s3.html = this.createLinkHTML(i2, p2), (a2 = this.delegate) != null && a2.inputControllerWillPaste(s3), this.withTargetDOMRange(function() {2243              var t3;2244              return (t3 = this.responder) != null ? t3.insertHTML(s3.html) : void 0;2245            }), this.afterRender = function(t3) {2246              return function() {2247                var e2;2248                return (e2 = t3.delegate) != null ? e2.inputControllerDidPaste(s3) : void 0;2249              };2250            }(this)) : t2(n2) ? (s3.type = "text/plain", s3.string = n2.getData("text/plain"), (u2 = this.delegate) != null && u2.inputControllerWillPaste(s3), this.withTargetDOMRange(function() {2251              var t3;2252              return (t3 = this.responder) != null ? t3.insertString(s3.string) : void 0;2253            }), this.afterRender = function(t3) {2254              return function() {2255                var e2;2256                return (e2 = t3.delegate) != null ? e2.inputControllerDidPaste(s3) : void 0;2257              };2258            }(this)) : (o2 = n2.getData("text/html")) ? (this.event.preventDefault(), s3.type = "text/html", s3.html = o2, (c2 = this.delegate) != null && c2.inputControllerWillPaste(s3), this.withTargetDOMRange(function() {2259              var t3;2260              return (t3 = this.responder) != null ? t3.insertHTML(s3.html) : void 0;2261            }), this.afterRender = function(t3) {2262              return function() {2263                var e2;2264                return (e2 = t3.delegate) != null ? e2.inputControllerDidPaste(s3) : void 0;2265              };2266            }(this)) : ((l2 = n2.files) != null ? l2.length : void 0) ? (s3.type = "File", s3.file = n2.files[0], (h2 = this.delegate) != null && h2.inputControllerWillPaste(s3), this.withTargetDOMRange(function() {2267              var t3;2268              return (t3 = this.responder) != null ? t3.insertFile(s3.file) : void 0;2269            }), this.afterRender = function(t3) {2270              return function() {2271                var e2;2272                return (e2 = t3.delegate) != null ? e2.inputControllerDidPaste(s3) : void 0;2273              };2274            }(this)) : void 0;2275          }, insertFromYank: function() {2276            return this.insertString(this.event.data);2277          }, insertLineBreak: function() {2278            return this.insertString("\n");2279          }, insertLink: function() {2280            return this.activateAttributeIfSupported("href", this.event.data);2281          }, insertOrderedList: function() {2282            return this.toggleAttributeIfSupported("number");2283          }, insertParagraph: function() {2284            var t3;2285            return (t3 = this.delegate) != null && t3.inputControllerWillPerformTyping(), this.withTargetDOMRange(function() {2286              var t4;2287              return (t4 = this.responder) != null ? t4.insertLineBreak() : void 0;2288            });2289          }, insertReplacementText: function() {2290            return this.insertString(this.event.dataTransfer.getData("text/plain"), {updatePosition: false});2291          }, insertText: function() {2292            var t3, e2;2293            return this.insertString((t3 = this.event.data) != null ? t3 : (e2 = this.event.dataTransfer) != null ? e2.getData("text/plain") : void 0);2294          }, insertTranspose: function() {2295            return this.insertString(this.event.data);2296          }, insertUnorderedList: function() {2297            return this.toggleAttributeIfSupported("bullet");2298          }}, u.prototype.insertString = function(t3, e2) {2299            var n2;2300            return t3 == null && (t3 = ""), (n2 = this.delegate) != null && n2.inputControllerWillPerformTyping(), this.withTargetDOMRange(function() {2301              var n3;2302              return (n3 = this.responder) != null ? n3.insertString(t3, e2) : void 0;2303            });2304          }, u.prototype.toggleAttributeIfSupported = function(t3) {2305            var n2;2306            return a.call(e.getAllAttributeNames(), t3) >= 0 ? ((n2 = this.delegate) != null && n2.inputControllerWillPerformFormatting(t3), this.withTargetDOMRange(function() {2307              var e2;2308              return (e2 = this.responder) != null ? e2.toggleCurrentAttribute(t3) : void 0;2309            })) : void 0;2310          }, u.prototype.activateAttributeIfSupported = function(t3, n2) {2311            var i2;2312            return a.call(e.getAllAttributeNames(), t3) >= 0 ? ((i2 = this.delegate) != null && i2.inputControllerWillPerformFormatting(t3), this.withTargetDOMRange(function() {2313              var e2;2314              return (e2 = this.responder) != null ? e2.setCurrentAttribute(t3, n2) : void 0;2315            })) : void 0;2316          }, u.prototype.deleteInDirection = function(t3, e2) {2317            var n2, i2, o2, r2;2318            return o2 = (e2 != null ? e2 : {recordUndoEntry: true}).recordUndoEntry, o2 && (r2 = this.delegate) != null && r2.inputControllerWillPerformTyping(), i2 = function(e3) {2319              return function() {2320                var n3;2321                return (n3 = e3.responder) != null ? n3.deleteInDirection(t3) : void 0;2322              };2323            }(this), (n2 = this.getTargetDOMRange({minLength: 2})) ? this.withTargetDOMRange(n2, i2) : i2();2324          }, u.prototype.withTargetDOMRange = function(t3, n2) {2325            var i2;2326            return typeof t3 == "function" && (n2 = t3, t3 = this.getTargetDOMRange()), t3 ? (i2 = this.responder) != null ? i2.withTargetDOMRange(t3, n2.bind(this)) : void 0 : (e.selectionChangeObserver.reset(), n2.call(this));2327          }, u.prototype.getTargetDOMRange = function(t3) {2328            var e2, n2, i2, o2;2329            return i2 = (t3 != null ? t3 : {minLength: 0}).minLength, (o2 = typeof (e2 = this.event).getTargetRanges == "function" ? e2.getTargetRanges() : void 0) && o2.length && (n2 = f(o2[0]), i2 === 0 || n2.toString().length >= i2) ? n2 : void 0;2330          }, f = function(t3) {2331            var e2;2332            return e2 = document.createRange(), e2.setStart(t3.startContainer, t3.startOffset), e2.setEnd(t3.endContainer, t3.endOffset), e2;2333          }, u.prototype.withEvent = function(t3, e2) {2334            var n2;2335            this.event = t3;2336            try {2337              n2 = e2.call(this);2338            } finally {2339              this.event = null;2340            }2341            return n2;2342          }, c = function(t3) {2343            var e2, n2;2344            return a.call((e2 = (n2 = t3.dataTransfer) != null ? n2.types : void 0) != null ? e2 : [], "Files") >= 0;2345          }, h = function(t3) {2346            var e2;2347            return (e2 = t3.clipboardData) ? a.call(e2.types, "Files") >= 0 && e2.types.length === 1 && e2.files.length >= 1 : void 0;2348          }, p = function(t3) {2349            var e2;2350            return (e2 = t3.clipboardData) ? a.call(e2.types, "text/plain") >= 0 && e2.types.length === 1 : void 0;2351          }, l = function(t3) {2352            var e2;2353            return e2 = [], t3.altKey && e2.push("alt"), t3.shiftKey && e2.push("shift"), e2.push(t3.key), e2;2354          }, d = function(t3) {2355            return {x: t3.clientX, y: t3.clientY};2356          }, u;2357        }(e.InputController);2358      }.call(this), function() {2359        var t2, n, i, o, r, s, a, u, c = function(t3, e2) {2360          return function() {2361            return t3.apply(e2, arguments);2362          };2363        }, l = function(t3, e2) {2364          function n2() {2365            this.constructor = t3;2366          }2367          for (var i2 in e2)2368            h.call(e2, i2) && (t3[i2] = e2[i2]);2369          return n2.prototype = e2.prototype, t3.prototype = new n2(), t3.__super__ = e2.prototype, t3;2370        }, h = {}.hasOwnProperty;2371        n = e.defer, i = e.handleEvent, s = e.makeElement, u = e.tagName, a = e.config, r = a.lang, t2 = a.css, o = a.keyNames, e.AttachmentEditorController = function(a2) {2372          function h2(t3, e2, n2, i2) {2373            this.attachmentPiece = t3, this.element = e2, this.container = n2, this.options = i2 != null ? i2 : {}, this.didBlurCaption = c(this.didBlurCaption, this), this.didChangeCaption = c(this.didChangeCaption, this), this.didInputCaption = c(this.didInputCaption, this), this.didKeyDownCaption = c(this.didKeyDownCaption, this), this.didClickActionButton = c(this.didClickActionButton, this), this.didClickToolbar = c(this.didClickToolbar, this), this.attachment = this.attachmentPiece.attachment, u(this.element) === "a" && (this.element = this.element.firstChild), this.install();2374          }2375          var p;2376          return l(h2, a2), p = function(t3) {2377            return function() {2378              var e2;2379              return e2 = t3.apply(this, arguments), e2["do"](), this.undos == null && (this.undos = []), this.undos.push(e2.undo);2380            };2381          }, h2.prototype.install = function() {2382            return this.makeElementMutable(), this.addToolbar(), this.attachment.isPreviewable() ? this.installCaptionEditor() : void 0;2383          }, h2.prototype.uninstall = function() {2384            var t3, e2;2385            for (this.savePendingCaption(); e2 = this.undos.pop(); )2386              e2();2387            return (t3 = this.delegate) != null ? t3.didUninstallAttachmentEditor(this) : void 0;2388          }, h2.prototype.savePendingCaption = function() {2389            var t3, e2, n2;2390            return this.pendingCaption != null ? (t3 = this.pendingCaption, this.pendingCaption = null, t3 ? (e2 = this.delegate) != null && typeof e2.attachmentEditorDidRequestUpdatingAttributesForAttachment == "function" ? e2.attachmentEditorDidRequestUpdatingAttributesForAttachment({caption: t3}, this.attachment) : void 0 : (n2 = this.delegate) != null && typeof n2.attachmentEditorDidRequestRemovingAttributeForAttachment == "function" ? n2.attachmentEditorDidRequestRemovingAttributeForAttachment("caption", this.attachment) : void 0) : void 0;2391          }, h2.prototype.makeElementMutable = p(function() {2392            return {do: function(t3) {2393              return function() {2394                return t3.element.dataset.trixMutable = true;2395              };2396            }(this), undo: function(t3) {2397              return function() {2398                return delete t3.element.dataset.trixMutable;2399              };2400            }(this)};2401          }), h2.prototype.addToolbar = p(function() {2402            var n2;2403            return n2 = s({tagName: "div", className: t2.attachmentToolbar, data: {trixMutable: true}, childNodes: s({tagName: "div", className: "trix-button-row", childNodes: s({tagName: "span", className: "trix-button-group trix-button-group--actions", childNodes: s({tagName: "button", className: "trix-button trix-button--remove", textContent: r.remove, attributes: {title: r.remove}, data: {trixAction: "remove"}})})})}), this.attachment.isPreviewable() && n2.appendChild(s({tagName: "div", className: t2.attachmentMetadataContainer, childNodes: s({tagName: "span", className: t2.attachmentMetadata, childNodes: [s({tagName: "span", className: t2.attachmentName, textContent: this.attachment.getFilename(), attributes: {title: this.attachment.getFilename()}}), s({tagName: "span", className: t2.attachmentSize, textContent: this.attachment.getFormattedFilesize()})]})})), i("click", {onElement: n2, withCallback: this.didClickToolbar}), i("click", {onElement: n2, matchingSelector: "[data-trix-action]", withCallback: this.didClickActionButton}), {do: function(t3) {2404              return function() {2405                return t3.element.appendChild(n2);2406              };2407            }(this), undo: function() {2408              return function() {2409                return e.removeNode(n2);2410              };2411            }()};2412          }), h2.prototype.installCaptionEditor = p(function() {2413            var o2, a3, u2, c2, l2;2414            return c2 = s({tagName: "textarea", className: t2.attachmentCaptionEditor, attributes: {placeholder: r.captionPlaceholder}, data: {trixMutable: true}}), c2.value = this.attachmentPiece.getCaption(), l2 = c2.cloneNode(), l2.classList.add("trix-autoresize-clone"), l2.tabIndex = -1, o2 = function() {2415              return l2.value = c2.value, c2.style.height = l2.scrollHeight + "px";2416            }, i("input", {onElement: c2, withCallback: o2}), i("input", {onElement: c2, withCallback: this.didInputCaption}), i("keydown", {onElement: c2, withCallback: this.didKeyDownCaption}), i("change", {onElement: c2, withCallback: this.didChangeCaption}), i("blur", {onElement: c2, withCallback: this.didBlurCaption}), u2 = this.element.querySelector("figcaption"), a3 = u2.cloneNode(), {do: function(e2) {2417              return function() {2418                return u2.style.display = "none", a3.appendChild(c2), a3.appendChild(l2), a3.classList.add(t2.attachmentCaption + "--editing"), u2.parentElement.insertBefore(a3, u2), o2(), e2.options.editCaption ? n(function() {2419                  return c2.focus();2420                }) : void 0;2421              };2422            }(this), undo: function() {2423              return e.removeNode(a3), u2.style.display = null;2424            }};2425          }), h2.prototype.didClickToolbar = function(t3) {2426            return t3.preventDefault(), t3.stopPropagation();2427          }, h2.prototype.didClickActionButton = function(t3) {2428            var e2, n2;2429            switch (e2 = t3.target.getAttribute("data-trix-action")) {2430              case "remove":2431                return (n2 = this.delegate) != null ? n2.attachmentEditorDidRequestRemovalOfAttachment(this.attachment) : void 0;2432            }2433          }, h2.prototype.didKeyDownCaption = function(t3) {2434            var e2;2435            return o[t3.keyCode] === "return" ? (t3.preventDefault(), this.savePendingCaption(), (e2 = this.delegate) != null && typeof e2.attachmentEditorDidRequestDeselectingAttachment == "function" ? e2.attachmentEditorDidRequestDeselectingAttachment(this.attachment) : void 0) : void 0;2436          }, h2.prototype.didInputCaption = function(t3) {2437            return this.pendingCaption = t3.target.value.replace(/\s/g, " ").trim();2438          }, h2.prototype.didChangeCaption = function() {2439            return this.savePendingCaption();2440          }, h2.prototype.didBlurCaption = function() {2441            return this.savePendingCaption();2442          }, h2;2443        }(e.BasicObject);2444      }.call(this), function() {2445        var t2, n, i, o = function(t3, e2) {2446          function n2() {2447            this.constructor = t3;2448          }2449          for (var i2 in e2)2450            r.call(e2, i2) && (t3[i2] = e2[i2]);2451          return n2.prototype = e2.prototype, t3.prototype = new n2(), t3.__super__ = e2.prototype, t3;2452        }, r = {}.hasOwnProperty;2453        i = e.makeElement, t2 = e.config.css, e.AttachmentView = function(r2) {2454          function s() {2455            s.__super__.constructor.apply(this, arguments), this.attachment = this.object, this.attachment.uploadProgressDelegate = this, this.attachmentPiece = this.options.piece;2456          }2457          var a;2458          return o(s, r2), s.attachmentSelector = "[data-trix-attachment]", s.prototype.createContentNodes = function() {2459            return [];2460          }, s.prototype.createNodes = function() {2461            var e2, n2, o2, r3, s2, u, c;2462            if (e2 = r3 = i({tagName: "figure", className: this.getClassName(), data: this.getData(), editable: false}), (n2 = this.getHref()) && (r3 = i({tagName: "a", editable: false, attributes: {href: n2, tabindex: -1}}), e2.appendChild(r3)), this.attachment.hasContent())2463              r3.innerHTML = this.attachment.getContent();2464            else2465              for (c = this.createContentNodes(), o2 = 0, s2 = c.length; s2 > o2; o2++)2466                u = c[o2], r3.appendChild(u);2467            return r3.appendChild(this.createCaptionElement()), this.attachment.isPending() && (this.progressElement = i({tagName: "progress", attributes: {class: t2.attachmentProgress, value: this.attachment.getUploadProgress(), max: 100}, data: {trixMutable: true, trixStoreKey: ["progressElement", this.attachment.id].join("/")}}), e2.appendChild(this.progressElement)), [a("left"), e2, a("right")];2468          }, s.prototype.createCaptionElement = function() {2469            var e2, n2, o2, r3, s2, a2, u;2470            return o2 = i({tagName: "figcaption", className: t2.attachmentCaption}), (e2 = this.attachmentPiece.getCaption()) ? (o2.classList.add(t2.attachmentCaption + "--edited"), o2.textContent = e2) : (n2 = this.getCaptionConfig(), n2.name && (r3 = this.attachment.getFilename()), n2.size && (a2 = this.attachment.getFormattedFilesize()), r3 && (s2 = i({tagName: "span", className: t2.attachmentName, textContent: r3}), o2.appendChild(s2)), a2 && (r3 && o2.appendChild(document.createTextNode(" ")), u = i({tagName: "span", className: t2.attachmentSize, textContent: a2}), o2.appendChild(u))), o2;2471          }, s.prototype.getClassName = function() {2472            var e2, n2;2473            return n2 = [t2.attachment, t2.attachment + "--" + this.attachment.getType()], (e2 = this.attachment.getExtension()) && n2.push(t2.attachment + "--" + e2), n2.join(" ");2474          }, s.prototype.getData = function() {2475            var t3, e2;2476            return e2 = {trixAttachment: JSON.stringify(this.attachment), trixContentType: this.attachment.getContentType(), trixId: this.attachment.id}, t3 = this.attachmentPiece.attributes, t3.isEmpty() || (e2.trixAttributes = JSON.stringify(t3)), this.attachment.isPending() && (e2.trixSerialize = false), e2;2477          }, s.prototype.getHref = function() {2478            return n(this.attachment.getContent(), "a") ? void 0 : this.attachment.getHref();2479          }, s.prototype.getCaptionConfig = function() {2480            var t3, n2, i2;2481            return i2 = this.attachment.getType(), t3 = e.copyObject((n2 = e.config.attachments[i2]) != null ? n2.caption : void 0), i2 === "file" && (t3.name = true), t3;2482          }, s.prototype.findProgressElement = function() {2483            var t3;2484            return (t3 = this.findElement()) != null ? t3.querySelector("progress") : void 0;2485          }, a = function(t3) {2486            return i({tagName: "span", textContent: e.ZERO_WIDTH_SPACE, data: {trixCursorTarget: t3, trixSerialize: false}});2487          }, s.prototype.attachmentDidChangeUploadProgress = function() {2488            var t3, e2;2489            return e2 = this.attachment.getUploadProgress(), (t3 = this.findProgressElement()) != null ? t3.value = e2 : void 0;2490          }, s;2491        }(e.ObjectView), n = function(t3, e2) {2492          var n2;2493          return n2 = i("div"), n2.innerHTML = t3 != null ? t3 : "", n2.querySelector(e2);2494        };2495      }.call(this), function() {2496        var t2, n = function(t3, e2) {2497          function n2() {2498            this.constructor = t3;2499          }2500          for (var o in e2)2501            i.call(e2, o) && (t3[o] = e2[o]);2502          return n2.prototype = e2.prototype, t3.prototype = new n2(), t3.__super__ = e2.prototype, t3;2503        }, i = {}.hasOwnProperty;2504        t2 = e.makeElement, e.PreviewableAttachmentView = function(i2) {2505          function o() {2506            o.__super__.constructor.apply(this, arguments), this.attachment.previewDelegate = this;2507          }2508          return n(o, i2), o.prototype.createContentNodes = function() {2509            return this.image = t2({tagName: "img", attributes: {src: ""}, data: {trixMutable: true}}), this.refresh(this.image), [this.image];2510          }, o.prototype.createCaptionElement = function() {2511            var t3;2512            return t3 = o.__super__.createCaptionElement.apply(this, arguments), t3.textContent || t3.setAttribute("data-trix-placeholder", e.config.lang.captionPlaceholder), t3;2513          }, o.prototype.refresh = function(t3) {2514            var e2;2515            return t3 == null && (t3 = (e2 = this.findElement()) != null ? e2.querySelector("img") : void 0), t3 ? this.updateAttributesForImage(t3) : void 0;2516          }, o.prototype.updateAttributesForImage = function(t3) {2517            var e2, n2, i3, o2, r, s;2518            return r = this.attachment.getURL(), n2 = this.attachment.getPreviewURL(), t3.src = n2 || r, n2 === r ? t3.removeAttribute("data-trix-serialized-attributes") : (i3 = JSON.stringify({src: r}), t3.setAttribute("data-trix-serialized-attributes", i3)), s = this.attachment.getWidth(), e2 = this.attachment.getHeight(), s != null && (t3.width = s), e2 != null && (t3.height = e2), o2 = ["imageElement", this.attachment.id, t3.src, t3.width, t3.height].join("/"), t3.dataset.trixStoreKey = o2;2519          }, o.prototype.attachmentDidChangeAttributes = function() {2520            return this.refresh(this.image), this.refresh();2521          }, o;2522        }(e.AttachmentView);2523      }.call(this), function() {2524        var t2, n, i, o = function(t3, e2) {2525          function n2() {2526            this.constructor = t3;2527          }2528          for (var i2 in e2)2529            r.call(e2, i2) && (t3[i2] = e2[i2]);2530          return n2.prototype = e2.prototype, t3.prototype = new n2(), t3.__super__ = e2.prototype, t3;2531        }, r = {}.hasOwnProperty;2532        i = e.makeElement, t2 = e.findInnerElement, n = e.getTextConfig, e.PieceView = function(r2) {2533          function s() {2534            var t3;2535            s.__super__.constructor.apply(this, arguments), this.piece = this.object, this.attributes = this.piece.getAttributes(), t3 = this.options, this.textConfig = t3.textConfig, this.context = t3.context, this.piece.attachment ? this.attachment = this.piece.attachment : this.string = this.piece.toString();2536          }2537          var a;2538          return o(s, r2), s.prototype.createNodes = function() {2539            var e2, n2, i2, o2, r3, s2;2540            if (s2 = this.attachment ? this.createAttachmentNodes() : this.createStringNodes(), e2 = this.createElement()) {2541              for (i2 = t2(e2), n2 = 0, o2 = s2.length; o2 > n2; n2++)2542                r3 = s2[n2], i2.appendChild(r3);2543              s2 = [e2];2544            }2545            return s2;2546          }, s.prototype.createAttachmentNodes = function() {2547            var t3, n2;2548            return t3 = this.attachment.isPreviewable() ? e.PreviewableAttachmentView : e.AttachmentView, n2 = this.createChildView(t3, this.piece.attachment, {piece: this.piece}), n2.getNodes();2549          }, s.prototype.createStringNodes = function() {2550            var t3, e2, n2, o2, r3, s2, a2, u, c, l;2551            if ((u = this.textConfig) != null ? u.plaintext : void 0)2552              return [document.createTextNode(this.string)];2553            for (a2 = [], c = this.string.split("\n"), n2 = e2 = 0, o2 = c.length; o2 > e2; n2 = ++e2)2554              l = c[n2], n2 > 0 && (t3 = i("br"), a2.push(t3)), (r3 = l.length) && (s2 = document.createTextNode(this.preserveSpaces(l)), a2.push(s2));2555            return a2;2556          }, s.prototype.createElement = function() {2557            var t3, e2, o2, r3, s2, a2, u, c, l;2558            c = {}, a2 = this.attributes;2559            for (r3 in a2)2560              if (l = a2[r3], (t3 = n(r3)) && (t3.tagName && (s2 = i(t3.tagName), o2 ? (o2.appendChild(s2), o2 = s2) : e2 = o2 = s2), t3.styleProperty && (c[t3.styleProperty] = l), t3.style)) {2561                u = t3.style;2562                for (r3 in u)2563                  l = u[r3], c[r3] = l;2564              }2565            if (Object.keys(c).length) {2566              e2 == null && (e2 = i("span"));2567              for (r3 in c)2568                l = c[r3], e2.style[r3] = l;2569            }2570            return e2;2571          }, s.prototype.createContainerElement = function() {2572            var t3, e2, o2, r3, s2;2573            r3 = this.attributes;2574            for (o2 in r3)2575              if (s2 = r3[o2], (e2 = n(o2)) && e2.groupTagName)2576                return t3 = {}, t3[o2] = s2, i(e2.groupTagName, t3);2577          }, a = e.NON_BREAKING_SPACE, s.prototype.preserveSpaces = function(t3) {2578            return this.context.isLast && (t3 = t3.replace(/\ $/, a)), t3 = t3.replace(/(\S)\ {3}(\S)/g, "$1 " + a + " $2").replace(/\ {2}/g, a + " ").replace(/\ {2}/g, " " + a), (this.context.isFirst || this.context.followsWhitespace) && (t3 = t3.replace(/^\ /, a)), t3;2579          }, s;2580        }(e.ObjectView);2581      }.call(this), function() {2582        var t2 = function(t3, e2) {2583          function i() {2584            this.constructor = t3;2585          }2586          for (var o in e2)2587            n.call(e2, o) && (t3[o] = e2[o]);2588          return i.prototype = e2.prototype, t3.prototype = new i(), t3.__super__ = e2.prototype, t3;2589        }, n = {}.hasOwnProperty;2590        e.TextView = function(n2) {2591          function i() {2592            i.__super__.constructor.apply(this, arguments), this.text = this.object, this.textConfig = this.options.textConfig;2593          }2594          var o;2595          return t2(i, n2), i.prototype.createNodes = function() {2596            var t3, n3, i2, r, s, a, u, c, l, h;2597            for (a = [], c = e.ObjectGroup.groupObjects(this.getPieces()), r = c.length - 1, i2 = n3 = 0, s = c.length; s > n3; i2 = ++n3)2598              u = c[i2], t3 = {}, i2 === 0 && (t3.isFirst = true), i2 === r && (t3.isLast = true), o(l) && (t3.followsWhitespace = true), h = this.findOrCreateCachedChildView(e.PieceView, u, {textConfig: this.textConfig, context: t3}), a.push.apply(a, h.getNodes()), l = u;2599            return a;2600          }, i.prototype.getPieces = function() {2601            var t3, e2, n3, i2, o2;2602            for (i2 = this.text.getPieces(), o2 = [], t3 = 0, e2 = i2.length; e2 > t3; t3++)2603              n3 = i2[t3], n3.hasAttribute("blockBreak") || o2.push(n3);2604            return o2;2605          }, o = function(t3) {2606            return /\s$/.test(t3 != null ? t3.toString() : void 0);2607          }, i;2608        }(e.ObjectView);2609      }.call(this), function() {2610        var t2, n, i, o = function(t3, e2) {2611          function n2() {2612            this.constructor = t3;2613          }2614          for (var i2 in e2)2615            r.call(e2, i2) && (t3[i2] = e2[i2]);2616          return n2.prototype = e2.prototype, t3.prototype = new n2(), t3.__super__ = e2.prototype, t3;2617        }, r = {}.hasOwnProperty;2618        i = e.makeElement, n = e.getBlockConfig, t2 = e.config.css, e.BlockView = function(r2) {2619          function s() {2620            s.__super__.constructor.apply(this, arguments), this.block = this.object, this.attributes = this.block.getAttributes();2621          }2622          return o(s, r2), s.prototype.createNodes = function() {2623            var t3, o2, r3, s2, a, u, c, l, h, p, d;2624            if (o2 = document.createComment("block"), c = [o2], this.block.isEmpty() ? c.push(i("br")) : (p = (l = n(this.block.getLastAttribute())) != null ? l.text : void 0, d = this.findOrCreateCachedChildView(e.TextView, this.block.text, {textConfig: p}), c.push.apply(c, d.getNodes()), this.shouldAddExtraNewlineElement() && c.push(i("br"))), this.attributes.length)2625              return c;2626            for (h = e.config.blockAttributes["default"].tagName, this.block.isRTL() && (t3 = {dir: "rtl"}), r3 = i({tagName: h, attributes: t3}), s2 = 0, a = c.length; a > s2; s2++)2627              u = c[s2], r3.appendChild(u);2628            return [r3];2629          }, s.prototype.createContainerElement = function(e2) {2630            var o2, r3, s2, a, u;2631            return o2 = this.attributes[e2], u = n(o2).tagName, e2 === 0 && this.block.isRTL() && (r3 = {dir: "rtl"}), o2 === "attachmentGallery" && (a = this.block.getBlockBreakPosition(), s2 = t2.attachmentGallery + " " + t2.attachmentGallery + "--" + a), i({tagName: u, className: s2, attributes: r3});2632          }, s.prototype.shouldAddExtraNewlineElement = function() {2633            return /\n\n$/.test(this.block.toString());2634          }, s;2635        }(e.ObjectView);2636      }.call(this), function() {2637        var t2, n, i = function(t3, e2) {2638          function n2() {2639            this.constructor = t3;2640          }2641          for (var i2 in e2)2642            o.call(e2, i2) && (t3[i2] = e2[i2]);2643          return n2.prototype = e2.prototype, t3.prototype = new n2(), t3.__super__ = e2.prototype, t3;2644        }, o = {}.hasOwnProperty;2645        t2 = e.defer, n = e.makeElement, e.DocumentView = function(o2) {2646          function r() {2647            r.__super__.constructor.apply(this, arguments), this.element = this.options.element, this.elementStore = new e.ElementStore(), this.setDocument(this.object);2648          }2649          var s, a, u;2650          return i(r, o2), r.render = function(t3) {2651            var e2, i2;2652            return e2 = n("div"), i2 = new this(t3, {element: e2}), i2.render(), i2.sync(), e2;2653          }, r.prototype.setDocument = function(t3) {2654            return t3.isEqualTo(this.document) ? void 0 : this.document = this.object = t3;2655          }, r.prototype.render = function() {2656            var t3, i2, o3, r2, s2, a2, u2;2657            if (this.childViews = [], this.shadowElement = n("div"), !this.document.isEmpty()) {2658              for (s2 = e.ObjectGroup.groupObjects(this.document.getBlocks(), {asTree: true}), a2 = [], t3 = 0, i2 = s2.length; i2 > t3; t3++)2659                r2 = s2[t3], u2 = this.findOrCreateCachedChildView(e.BlockView, r2), a2.push(function() {2660                  var t4, e2, n2, i3;2661                  for (n2 = u2.getNodes(), i3 = [], t4 = 0, e2 = n2.length; e2 > t4; t4++)2662                    o3 = n2[t4], i3.push(this.shadowElement.appendChild(o3));2663                  return i3;2664                }.call(this));2665              return a2;2666            }2667          }, r.prototype.isSynced = function() {2668            return s(this.shadowElement, this.element);2669          }, r.prototype.sync = function() {2670            var t3;2671            for (t3 = this.createDocumentFragmentForSync(); this.element.lastChild; )2672              this.element.removeChild(this.element.lastChild);2673            return this.element.appendChild(t3), this.didSync();2674          }, r.prototype.didSync = function() {2675            return this.elementStore.reset(a(this.element)), t2(function(t3) {2676              return function() {2677                return t3.garbageCollectCachedViews();2678              };2679            }(this));2680          }, r.prototype.createDocumentFragmentForSync = function() {2681            var t3, e2, n2, i2, o3, r2, s2, u2, c, l;2682            for (e2 = document.createDocumentFragment(), u2 = this.shadowElement.childNodes, n2 = 0, o3 = u2.length; o3 > n2; n2++)2683              s2 = u2[n2], e2.appendChild(s2.cloneNode(true));2684            for (c = a(e2), i2 = 0, r2 = c.length; r2 > i2; i2++)2685              t3 = c[i2], (l = this.elementStore.remove(t3)) && t3.parentNode.replaceChild(l, t3);2686            return e2;2687          }, a = function(t3) {2688            return t3.querySelectorAll("[data-trix-store-key]");2689          }, s = function(t3, e2) {2690            return u(t3.innerHTML) === u(e2.innerHTML);2691          }, u = function(t3) {2692            return t3.replace(/ /g, " ");2693          }, r;2694        }(e.ObjectView);2695      }.call(this), function() {2696        var t2, n, i, o, r, s = function(t3, e2) {2697          return function() {2698            return t3.apply(e2, arguments);2699          };2700        }, a = function(t3, e2) {2701          function n2() {2702            this.constructor = t3;2703          }2704          for (var i2 in e2)2705            u.call(e2, i2) && (t3[i2] = e2[i2]);2706          return n2.prototype = e2.prototype, t3.prototype = new n2(), t3.__super__ = e2.prototype, t3;2707        }, u = {}.hasOwnProperty;2708        i = e.findClosestElementFromNode, o = e.handleEvent, r = e.innerElementIsActive, n = e.defer, t2 = e.AttachmentView.attachmentSelector, e.CompositionController = function(u2) {2709          function c(n2, i2) {2710            this.element = n2, this.composition = i2, 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: true}), o("mousedown", {onElement: this.element, matchingSelector: t2, withCallback: this.didClickAttachment}), o("click", {onElement: this.element, matchingSelector: "a" + t2, preventDefault: true});2711          }2712          return a(c, u2), c.prototype.didFocus = function() {2713            var t3, e2, n2;2714            return t3 = function(t4) {2715              return function() {2716                var e3;2717                return t4.focused ? void 0 : (t4.focused = true, (e3 = t4.delegate) != null && typeof e3.compositionControllerDidFocus == "function" ? e3.compositionControllerDidFocus() : void 0);2718              };2719            }(this), (e2 = (n2 = this.blurPromise) != null ? n2.then(t3) : void 0) != null ? e2 : t3();2720          }, c.prototype.didBlur = function() {2721            return this.blurPromise = new Promise(function(t3) {2722              return function(e2) {2723                return n(function() {2724                  var n2;2725                  return r(t3.element) || (t3.focused = null, (n2 = t3.delegate) != null && typeof n2.compositionControllerDidBlur == "function" && n2.compositionControllerDidBlur()), t3.blurPromise = null, e2();2726                });2727              };2728            }(this));2729          }, c.prototype.didClickAttachment = function(t3, e2) {2730            var n2, o2, r2;2731            return n2 = this.findAttachmentForElement(e2), o2 = i(t3.target, {matchingSelector: "figcaption"}) != null, (r2 = this.delegate) != null && typeof r2.compositionControllerDidSelectAttachment == "function" ? r2.compositionControllerDidSelectAttachment(n2, {editCaption: o2}) : void 0;2732          }, c.prototype.getSerializableElement = function() {2733            return this.isEditingAttachment() ? this.documentView.shadowElement : this.element;2734          }, c.prototype.render = function() {2735            var t3, e2, n2;2736            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() && ((t3 = this.delegate) != null && typeof t3.compositionControllerWillSyncDocumentView == "function" && t3.compositionControllerWillSyncDocumentView(), this.documentView.sync(), (e2 = this.delegate) != null && typeof e2.compositionControllerDidSyncDocumentView == "function" && e2.compositionControllerDidSyncDocumentView()), (n2 = this.delegate) != null && typeof n2.compositionControllerDidRender == "function" ? n2.compositionControllerDidRender() : void 0;2737          }, c.prototype.rerenderViewForObject = function(t3) {2738            return this.invalidateViewForObject(t3), this.render();2739          }, c.prototype.invalidateViewForObject = function(t3) {2740            return this.documentView.invalidateViewForObject(t3);2741          }, c.prototype.isViewCachingEnabled = function() {2742            return this.documentView.isViewCachingEnabled();2743          }, c.prototype.enableViewCaching = function() {2744            return this.documentView.enableViewCaching();2745          }, c.prototype.disableViewCaching = function() {2746            return this.documentView.disableViewCaching();2747          }, c.prototype.refreshViewCache = function() {2748            return this.documentView.garbageCollectCachedViews();2749          }, c.prototype.isEditingAttachment = function() {2750            return this.attachmentEditor != null;2751          }, c.prototype.installAttachmentEditorForAttachment = function(t3, n2) {2752            var i2, o2, r2;2753            if (((r2 = this.attachmentEditor) != null ? r2.attachment : void 0) !== t3 && (o2 = this.documentView.findElementForObject(t3)))2754              return this.uninstallAttachmentEditor(), i2 = this.composition.document.getAttachmentPieceForAttachment(t3), this.attachmentEditor = new e.AttachmentEditorController(i2, o2, this.element, n2), this.attachmentEditor.delegate = this;2755          }, c.prototype.uninstallAttachmentEditor = function() {2756            var t3;2757            return (t3 = this.attachmentEditor) != null ? t3.uninstall() : void 0;2758          }, c.prototype.didUninstallAttachmentEditor = function() {2759            return this.attachmentEditor = null, this.render();2760          }, c.prototype.attachmentEditorDidRequestUpdatingAttributesForAttachment = function(t3, e2) {2761            var n2;2762            return (n2 = this.delegate) != null && typeof n2.compositionControllerWillUpdateAttachment == "function" && n2.compositionControllerWillUpdateAttachment(e2), this.composition.updateAttributesForAttachment(t3, e2);2763          }, c.prototype.attachmentEditorDidRequestRemovingAttributeForAttachment = function(t3, e2) {2764            var n2;2765            return (n2 = this.delegate) != null && typeof n2.compositionControllerWillUpdateAttachment == "function" && n2.compositionControllerWillUpdateAttachment(e2), this.composition.removeAttributeForAttachment(t3, e2);2766          }, c.prototype.attachmentEditorDidRequestRemovalOfAttachment = function(t3) {2767            var e2;2768            return (e2 = this.delegate) != null && typeof e2.compositionControllerDidRequestRemovalOfAttachment == "function" ? e2.compositionControllerDidRequestRemovalOfAttachment(t3) : void 0;2769          }, c.prototype.attachmentEditorDidRequestDeselectingAttachment = function(t3) {2770            var e2;2771            return (e2 = this.delegate) != null && typeof e2.compositionControllerDidRequestDeselectingAttachment == "function" ? e2.compositionControllerDidRequestDeselectingAttachment(t3) : void 0;2772          }, c.prototype.canSyncDocumentView = function() {2773            return !this.isEditingAttachment();2774          }, c.prototype.findAttachmentForElement = function(t3) {2775            return this.composition.document.getAttachmentById(parseInt(t3.dataset.trixId, 10));2776          }, c;2777        }(e.BasicObject);2778      }.call(this), function() {2779        var t2, n, i, o = function(t3, e2) {2780          return function() {2781            return t3.apply(e2, arguments);2782          };2783        }, r = function(t3, e2) {2784          function n2() {2785            this.constructor = t3;2786          }2787          for (var i2 in e2)2788            s.call(e2, i2) && (t3[i2] = e2[i2]);2789          return n2.prototype = e2.prototype, t3.prototype = new n2(), t3.__super__ = e2.prototype, t3;2790        }, s = {}.hasOwnProperty;2791        n = e.handleEvent, i = e.triggerEvent, t2 = e.findClosestElementFromNode, e.ToolbarController = function(e2) {2792          function s2(t3) {2793            this.element = t3, 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: true}), n("click", {onElement: this.element, matchingSelector: l, withCallback: this.didClickDialogButton}), n("keydown", {onElement: this.element, matchingSelector: h, withCallback: this.didKeyDownDialogInput});2794          }2795          var a, u, c, l, h, p, d, f, g, m, v;2796          return r(s2, e2), 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]", s2.prototype.didClickActionButton = function(t3, e3) {2797            var n2, i2, o2;2798            return (i2 = this.delegate) != null && i2.toolbarDidClickButton(), t3.preventDefault(), n2 = d(e3), this.getDialog(n2) ? this.toggleDialog(n2) : (o2 = this.delegate) != null ? o2.toolbarDidInvokeAction(n2) : void 0;2799          }, s2.prototype.didClickAttributeButton = function(t3, e3) {2800            var n2, i2, o2;2801            return (i2 = this.delegate) != null && i2.toolbarDidClickButton(), t3.preventDefault(), n2 = f(e3), this.getDialog(n2) ? this.toggleDialog(n2) : (o2 = this.delegate) != null && o2.toolbarDidToggleAttribute(n2), this.refreshAttributeButtons();2802          }, s2.prototype.didClickDialogButton = function(e3, n2) {2803            var i2, o2;2804            return i2 = t2(n2, {matchingSelector: p}), o2 = n2.getAttribute("data-trix-method"), this[o2].call(this, i2);2805          }, s2.prototype.didKeyDownDialogInput = function(t3, e3) {2806            var n2, i2;2807            return t3.keyCode === 13 && (t3.preventDefault(), n2 = e3.getAttribute("name"), i2 = this.getDialog(n2), this.setAttribute(i2)), t3.keyCode === 27 ? (t3.preventDefault(), this.hideDialog()) : void 0;2808          }, s2.prototype.updateActions = function(t3) {2809            return this.actions = t3, this.refreshActionButtons();2810          }, s2.prototype.refreshActionButtons = function() {2811            return this.eachActionButton(function(t3) {2812              return function(e3, n2) {2813                return e3.disabled = t3.actions[n2] === false;2814              };2815            }(this));2816          }, s2.prototype.eachActionButton = function(t3) {2817            var e3, n2, i2, o2, r2;2818            for (o2 = this.element.querySelectorAll(a), r2 = [], n2 = 0, i2 = o2.length; i2 > n2; n2++)2819              e3 = o2[n2], r2.push(t3(e3, d(e3)));2820            return r2;2821          }, s2.prototype.updateAttributes = function(t3) {2822            return this.attributes = t3, this.refreshAttributeButtons();2823          }, s2.prototype.refreshAttributeButtons = function() {2824            return this.eachAttributeButton(function(t3) {2825              return function(e3, n2) {2826                return e3.disabled = t3.attributes[n2] === false, t3.attributes[n2] || t3.dialogIsVisible(n2) ? (e3.setAttribute("data-trix-active", ""), e3.classList.add("trix-active")) : (e3.removeAttribute("data-trix-active"), e3.classList.remove("trix-active"));2827              };2828            }(this));2829          }, s2.prototype.eachAttributeButton = function(t3) {2830            var e3, n2, i2, o2, r2;2831            for (o2 = this.element.querySelectorAll(c), r2 = [], n2 = 0, i2 = o2.length; i2 > n2; n2++)2832              e3 = o2[n2], r2.push(t3(e3, f(e3)));2833            return r2;2834          }, s2.prototype.applyKeyboardCommand = function(t3) {2835            var e3, n2, o2, r2, s3, a2, u2;2836            for (s3 = JSON.stringify(t3.sort()), u2 = this.element.querySelectorAll("[data-trix-key]"), r2 = 0, a2 = u2.length; a2 > r2; r2++)2837              if (e3 = u2[r2], o2 = e3.getAttribute("data-trix-key").split("+"), n2 = JSON.stringify(o2.sort()), n2 === s3)2838                return i("mousedown", {onElement: e3}), true;2839            return false;2840          }, s2.prototype.dialogIsVisible = function(t3) {2841            var e3;2842            return (e3 = this.getDialog(t3)) ? e3.hasAttribute("data-trix-active") : void 0;2843          }, s2.prototype.toggleDialog = function(t3) {2844            return this.dialogIsVisible(t3) ? this.hideDialog() : this.showDialog(t3);2845          }, s2.prototype.showDialog = function(t3) {2846            var e3, n2, i2, o2, r2, s3, a2, u2, c2, l2;2847            for (this.hideDialog(), (a2 = this.delegate) != null && a2.toolbarWillShowDialog(), i2 = this.getDialog(t3), i2.setAttribute("data-trix-active", ""), i2.classList.add("trix-active"), u2 = i2.querySelectorAll("input[disabled]"), o2 = 0, s3 = u2.length; s3 > o2; o2++)2848              n2 = u2[o2], n2.removeAttribute("disabled");2849            return (e3 = f(i2)) && (r2 = m(i2, t3)) && (r2.value = (c2 = this.attributes[e3]) != null ? c2 : "", r2.select()), (l2 = this.delegate) != null ? l2.toolbarDidShowDialog(t3) : void 0;2850          }, s2.prototype.setAttribute = function(t3) {2851            var e3, n2, i2;2852            return e3 = f(t3), n2 = m(t3, e3), n2.willValidate && !n2.checkValidity() ? (n2.setAttribute("data-trix-validate", ""), n2.classList.add("trix-validate"), n2.focus()) : ((i2 = this.delegate) != null && i2.toolbarDidUpdateAttribute(e3, n2.value), this.hideDialog());2853          }, s2.prototype.removeAttribute = function(t3) {2854            var e3, n2;2855            return e3 = f(t3), (n2 = this.delegate) != null && n2.toolbarDidRemoveAttribute(e3), this.hideDialog();2856          }, s2.prototype.hideDialog = function() {2857            var t3, e3;2858            return (t3 = this.element.querySelector(u)) ? (t3.removeAttribute("data-trix-active"), t3.classList.remove("trix-active"), this.resetDialogInputs(), (e3 = this.delegate) != null ? e3.toolbarDidHideDialog(g(t3)) : void 0) : void 0;2859          }, s2.prototype.resetDialogInputs = function() {2860            var t3, e3, n2, i2, o2;2861            for (i2 = this.element.querySelectorAll(h), o2 = [], t3 = 0, n2 = i2.length; n2 > t3; t3++)2862              e3 = i2[t3], e3.setAttribute("disabled", "disabled"), e3.removeAttribute("data-trix-validate"), o2.push(e3.classList.remove("trix-validate"));2863            return o2;2864          }, s2.prototype.getDialog = function(t3) {2865            return this.element.querySelector("[data-trix-dialog=" + t3 + "]");2866          }, m = function(t3, e3) {2867            return e3 == null && (e3 = f(t3)), t3.querySelector("[data-trix-input][name='" + e3 + "']");2868          }, d = function(t3) {2869            return t3.getAttribute("data-trix-action");2870          }, f = function(t3) {2871            var e3;2872            return (e3 = t3.getAttribute("data-trix-attribute")) != null ? e3 : t3.getAttribute("data-trix-dialog-attribute");2873          }, g = function(t3) {2874            return t3.getAttribute("data-trix-dialog");2875          }, s2;2876        }(e.BasicObject);2877      }.call(this), function() {2878        var t2 = function(t3, e2) {2879          function i() {2880            this.constructor = t3;2881          }2882          for (var o in e2)2883            n.call(e2, o) && (t3[o] = e2[o]);2884          return i.prototype = e2.prototype, t3.prototype = new i(), t3.__super__ = e2.prototype, t3;2885        }, n = {}.hasOwnProperty;2886        e.ImagePreloadOperation = function(e2) {2887          function n2(t3) {2888            this.url = t3;2889          }2890          return t2(n2, e2), n2.prototype.perform = function(t3) {2891            var e3;2892            return e3 = new Image(), e3.onload = function(n3) {2893              return function() {2894                return e3.width = n3.width = e3.naturalWidth, e3.height = n3.height = e3.naturalHeight, t3(true, e3);2895              };2896            }(this), e3.onerror = function() {2897              return t3(false);2898            }, e3.src = this.url;2899          }, n2;2900        }(e.Operation);2901      }.call(this), function() {2902        var t2 = function(t3, e2) {2903          return function() {2904            return t3.apply(e2, arguments);2905          };2906        }, n = function(t3, e2) {2907          function n2() {2908            this.constructor = t3;2909          }2910          for (var o in e2)2911            i.call(e2, o) && (t3[o] = e2[o]);2912          return n2.prototype = e2.prototype, t3.prototype = new n2(), t3.__super__ = e2.prototype, t3;2913        }, i = {}.hasOwnProperty;2914        e.Attachment = function(i2) {2915          function o(n2) {2916            n2 == null && (n2 = {}), this.releaseFile = t2(this.releaseFile, this), o.__super__.constructor.apply(this, arguments), this.attributes = e.Hash.box(n2), this.didChangeAttributes();2917          }2918          return n(o, i2), o.previewablePattern = /^image(\/(gif|png|jpe?g)|$)/, o.attachmentForFile = function(t3) {2919            var e2, n2;2920            return n2 = this.attributesForFile(t3), e2 = new this(n2), e2.setFile(t3), e2;2921          }, o.attributesForFile = function(t3) {2922            return new e.Hash({filename: t3.name, filesize: t3.size, contentType: t3.type});2923          }, o.fromJSON = function(t3) {2924            return new this(t3);2925          }, o.prototype.getAttribute = function(t3) {2926            return this.attributes.get(t3);2927          }, o.prototype.hasAttribute = function(t3) {2928            return this.attributes.has(t3);2929          }, o.prototype.getAttributes = function() {2930            return this.attributes.toObject();2931          }, o.prototype.setAttributes = function(t3) {2932            var e2, n2, i3;2933            return t3 == null && (t3 = {}), e2 = this.attributes.merge(t3), this.attributes.isEqualTo(e2) ? void 0 : (this.attributes = e2, this.didChangeAttributes(), (n2 = this.previewDelegate) != null && typeof n2.attachmentDidChangeAttributes == "function" && n2.attachmentDidChangeAttributes(this), (i3 = this.delegate) != null && typeof i3.attachmentDidChangeAttributes == "function" ? i3.attachmentDidChangeAttributes(this) : void 0);2934          }, o.prototype.didChangeAttributes = function() {2935            return this.isPreviewable() ? this.preloadURL() : void 0;2936          }, o.prototype.isPending = function() {2937            return this.file != null && !(this.getURL() || this.getHref());2938          }, o.prototype.isPreviewable = function() {2939            return this.attributes.has("previewable") ? this.attributes.get("previewable") : this.constructor.previewablePattern.test(this.getContentType());2940          }, o.prototype.getType = function() {2941            return this.hasContent() ? "content" : this.isPreviewable() ? "preview" : "file";2942          }, o.prototype.getURL = function() {2943            return this.attributes.get("url");2944          }, o.prototype.getHref = function() {2945            return this.attributes.get("href");2946          }, o.prototype.getFilename = function() {2947            var t3;2948            return (t3 = this.attributes.get("filename")) != null ? t3 : "";2949          }, o.prototype.getFilesize = function() {2950            return this.attributes.get("filesize");2951          }, o.prototype.getFormattedFilesize = function() {2952            var t3;2953            return t3 = this.attributes.get("filesize"), typeof t3 == "number" ? e.config.fileSize.formatter(t3) : "";2954          }, o.prototype.getExtension = function() {2955            var t3;2956            return (t3 = this.getFilename().match(/\.(\w+)$/)) != null ? t3[1].toLowerCase() : void 0;2957          }, o.prototype.getContentType = function() {2958            return this.attributes.get("contentType");2959          }, o.prototype.hasContent = function() {2960            return this.attributes.has("content");2961          }, o.prototype.getContent = function() {2962            return this.attributes.get("content");2963          }, o.prototype.getWidth = function() {2964            return this.attributes.get("width");2965          }, o.prototype.getHeight = function() {2966            return this.attributes.get("height");2967          }, o.prototype.getFile = function() {2968            return this.file;2969          }, o.prototype.setFile = function(t3) {2970            return this.file = t3, this.isPreviewable() ? this.preloadFile() : void 0;2971          }, o.prototype.releaseFile = function() {2972            return this.releasePreloadedFile(), this.file = null;2973          }, o.prototype.getUploadProgress = function() {2974            var t3;2975            return (t3 = this.uploadProgress) != null ? t3 : 0;2976          }, o.prototype.setUploadProgress = function(t3) {2977            var e2;2978            return this.uploadProgress !== t3 ? (this.uploadProgress = t3, (e2 = this.uploadProgressDelegate) != null && typeof e2.attachmentDidChangeUploadProgress == "function" ? e2.attachmentDidChangeUploadProgress(this) : void 0) : void 0;2979          }, o.prototype.toJSON = function() {2980            return this.getAttributes();2981          }, o.prototype.getCacheKey = function() {2982            return [o.__super__.getCacheKey.apply(this, arguments), this.attributes.getCacheKey(), this.getPreviewURL()].join("/");2983          }, o.prototype.getPreviewURL = function() {2984            return this.previewURL || this.preloadingURL;2985          }, o.prototype.setPreviewURL = function(t3) {2986            var e2, n2;2987            return t3 !== this.getPreviewURL() ? (this.previewURL = t3, (e2 = this.previewDelegate) != null && typeof e2.attachmentDidChangeAttributes == "function" && e2.attachmentDidChangeAttributes(this), (n2 = this.delegate) != null && typeof n2.attachmentDidChangePreviewURL == "function" ? n2.attachmentDidChangePreviewURL(this) : void 0) : void 0;2988          }, o.prototype.preloadURL = function() {2989            return this.preload(this.getURL(), this.releaseFile);2990          }, o.prototype.preloadFile = function() {2991            return this.file ? (this.fileObjectURL = URL.createObjectURL(this.file), this.preload(this.fileObjectURL)) : void 0;2992          }, o.prototype.releasePreloadedFile = function() {2993            return this.fileObjectURL ? (URL.revokeObjectURL(this.fileObjectURL), this.fileObjectURL = null) : void 0;2994          }, o.prototype.preload = function(t3, n2) {2995            var i3;2996            return t3 && t3 !== this.getPreviewURL() ? (this.preloadingURL = t3, i3 = new e.ImagePreloadOperation(t3), i3.then(function(e2) {2997              return function(i4) {2998                var o2, r;2999                return r = i4.width, o2 = i4.height, e2.getWidth() && e2.getHeight() || e2.setAttributes({width: r, height: o2}), e2.preloadingURL = null, e2.setPreviewURL(t3), typeof n2 == "function" ? n2() : void 0;3000              };3001            }(this))["catch"](function(t4) {3002              return function() {3003                return t4.preloadingURL = null, typeof n2 == "function" ? n2() : void 0;3004              };3005            }(this))) : void 0;3006          }, o;3007        }(e.Object);3008      }.call(this), function() {3009        var t2 = function(t3, e2) {3010          function i() {3011            this.constructor = t3;3012          }3013          for (var o in e2)3014            n.call(e2, o) && (t3[o] = e2[o]);3015          return i.prototype = e2.prototype, t3.prototype = new i(), t3.__super__ = e2.prototype, t3;3016        }, n = {}.hasOwnProperty;3017        e.Piece = function(n2) {3018          function i(t3, n3) {3019            n3 == null && (n3 = {}), i.__super__.constructor.apply(this, arguments), this.attributes = e.Hash.box(n3);3020          }3021          return t2(i, n2), i.types = {}, i.registerType = function(t3, e2) {3022            return e2.type = t3, this.types[t3] = e2;3023          }, i.fromJSON = function(t3) {3024            var e2;3025            return (e2 = this.types[t3.type]) ? e2.fromJSON(t3) : void 0;3026          }, i.prototype.copyWithAttributes = function(t3) {3027            return new this.constructor(this.getValue(), t3);3028          }, i.prototype.copyWithAdditionalAttributes = function(t3) {3029            return this.copyWithAttributes(this.attributes.merge(t3));3030          }, i.prototype.copyWithoutAttribute = function(t3) {3031            return this.copyWithAttributes(this.attributes.remove(t3));3032          }, i.prototype.copy = function() {3033            return this.copyWithAttributes(this.attributes);3034          }, i.prototype.getAttribute = function(t3) {3035            return this.attributes.get(t3);3036          }, i.prototype.getAttributesHash = function() {3037            return this.attributes;3038          }, i.prototype.getAttributes = function() {3039            return this.attributes.toObject();3040          }, i.prototype.getCommonAttributes = function() {3041            var t3, e2, n3;3042            return (n3 = pieceList.getPieceAtIndex(0)) ? (t3 = n3.attributes, e2 = t3.getKeys(), pieceList.eachPiece(function(n4) {3043              return e2 = t3.getKeysCommonToHash(n4.attributes), t3 = t3.slice(e2);3044            }), t3.toObject()) : {};3045          }, i.prototype.hasAttribute = function(t3) {3046            return this.attributes.has(t3);3047          }, i.prototype.hasSameStringValueAsPiece = function(t3) {3048            return t3 != null && this.toString() === t3.toString();3049          }, i.prototype.hasSameAttributesAsPiece = function(t3) {3050            return t3 != null && (this.attributes === t3.attributes || this.attributes.isEqualTo(t3.attributes));3051          }, i.prototype.isBlockBreak = function() {3052            return false;3053          }, i.prototype.isEqualTo = function(t3) {3054            return i.__super__.isEqualTo.apply(this, arguments) || this.hasSameConstructorAs(t3) && this.hasSameStringValueAsPiece(t3) && this.hasSameAttributesAsPiece(t3);3055          }, i.prototype.isEmpty = function() {3056            return this.length === 0;3057          }, i.prototype.isSerializable = function() {3058            return true;3059          }, i.prototype.toJSON = function() {3060            return {type: this.constructor.type, attributes: this.getAttributes()};3061          }, i.prototype.contentsForInspection = function() {3062            return {type: this.constructor.type, attributes: this.attributes.inspect()};3063          }, i.prototype.canBeGrouped = function() {3064            return this.hasAttribute("href");3065          }, i.prototype.canBeGroupedWith = function(t3) {3066            return this.getAttribute("href") === t3.getAttribute("href");3067          }, i.prototype.getLength = function() {3068            return this.length;3069          }, i.prototype.canBeConsolidatedWith = function() {3070            return false;3071          }, i;3072        }(e.Object);3073      }.call(this), function() {3074        var t2 = function(t3, e2) {3075          function i() {3076            this.constructor = t3;3077          }3078          for (var o in e2)3079            n.call(e2, o) && (t3[o] = e2[o]);3080          return i.prototype = e2.prototype, t3.prototype = new i(), t3.__super__ = e2.prototype, t3;3081        }, n = {}.hasOwnProperty;3082        e.Piece.registerType("attachment", e.AttachmentPiece = function(n2) {3083          function i(t3) {3084            this.attachment = t3, i.__super__.constructor.apply(this, arguments), this.length = 1, this.ensureAttachmentExclusivelyHasAttribute("href"), this.attachment.hasContent() || this.removeProhibitedAttributes();3085          }3086          return t2(i, n2), i.fromJSON = function(t3) {3087            return new this(e.Attachment.fromJSON(t3.attachment), t3.attributes);3088          }, i.permittedAttributes = ["caption", "presentation"], i.prototype.ensureAttachmentExclusivelyHasAttribute = function(t3) {3089            return this.hasAttribute(t3) ? (this.attachment.hasAttribute(t3) || this.attachment.setAttributes(this.attributes.slice(t3)), this.attributes = this.attributes.remove(t3)) : void 0;3090          }, i.prototype.removeProhibitedAttributes = function() {3091            var t3;3092            return t3 = this.attributes.slice(this.constructor.permittedAttributes), t3.isEqualTo(this.attributes) ? void 0 : this.attributes = t3;3093          }, i.prototype.getValue = function() {3094            return this.attachment;3095          }, i.prototype.isSerializable = function() {3096            return !this.attachment.isPending();3097          }, i.prototype.getCaption = function() {3098            var t3;3099            return (t3 = this.attributes.get("caption")) != null ? t3 : "";3100          }, i.prototype.isEqualTo = function(t3) {3101            var e2;3102            return i.__super__.isEqualTo.apply(this, arguments) && this.attachment.id === (t3 != null && (e2 = t3.attachment) != null ? e2.id : void 0);3103          }, i.prototype.toString = function() {3104            return e.OBJECT_REPLACEMENT_CHARACTER;3105          }, i.prototype.toJSON = function() {3106            var t3;3107            return t3 = i.__super__.toJSON.apply(this, arguments), t3.attachment = this.attachment, t3;3108          }, i.prototype.getCacheKey = function() {3109            return [i.__super__.getCacheKey.apply(this, arguments), this.attachment.getCacheKey()].join("/");3110          }, i.prototype.toConsole = function() {3111            return JSON.stringify(this.toString());3112          }, i;3113        }(e.Piece));3114      }.call(this), function() {3115        var t2, n = function(t3, e2) {3116          function n2() {3117            this.constructor = t3;3118          }3119          for (var o in e2)3120            i.call(e2, o) && (t3[o] = e2[o]);3121          return n2.prototype = e2.prototype, t3.prototype = new n2(), t3.__super__ = e2.prototype, t3;3122        }, i = {}.hasOwnProperty;3123        t2 = e.normalizeNewlines, e.Piece.registerType("string", e.StringPiece = function(e2) {3124          function i2(e3) {3125            i2.__super__.constructor.apply(this, arguments), this.string = t2(e3), this.length = this.string.length;3126          }3127          return n(i2, e2), i2.fromJSON = function(t3) {3128            return new this(t3.string, t3.attributes);3129          }, i2.prototype.getValue = function() {3130            return this.string;3131          }, i2.prototype.toString = function() {3132            return this.string.toString();3133          }, i2.prototype.isBlockBreak = function() {3134            return this.toString() === "\n" && this.getAttribute("blockBreak") === true;3135          }, i2.prototype.toJSON = function() {3136            var t3;3137            return t3 = i2.__super__.toJSON.apply(this, arguments), t3.string = this.string, t3;3138          }, i2.prototype.canBeConsolidatedWith = function(t3) {3139            return t3 != null && this.hasSameConstructorAs(t3) && this.hasSameAttributesAsPiece(t3);3140          }, i2.prototype.consolidateWith = function(t3) {3141            return new this.constructor(this.toString() + t3.toString(), this.attributes);3142          }, i2.prototype.splitAtOffset = function(t3) {3143            var e3, n2;3144            return t3 === 0 ? (e3 = null, n2 = this) : t3 === this.length ? (e3 = this, n2 = null) : (e3 = new this.constructor(this.string.slice(0, t3), this.attributes), n2 = new this.constructor(this.string.slice(t3), this.attributes)), [e3, n2];3145          }, i2.prototype.toConsole = function() {3146            var t3;3147            return t3 = this.string, t3.length > 15 && (t3 = t3.slice(0, 14) + "\u2026"), JSON.stringify(t3.toString());3148          }, i2;3149        }(e.Piece));3150      }.call(this), function() {3151        var t2, n = function(t3, e2) {3152          function n2() {3153            this.constructor = t3;3154          }3155          for (var o2 in e2)3156            i.call(e2, o2) && (t3[o2] = e2[o2]);3157          return n2.prototype = e2.prototype, t3.prototype = new n2(), t3.__super__ = e2.prototype, t3;3158        }, i = {}.hasOwnProperty, o = [].slice;3159        t2 = e.spliceArray, e.SplittableList = function(e2) {3160          function i2(t3) {3161            t3 == null && (t3 = []), i2.__super__.constructor.apply(this, arguments), this.objects = t3.slice(0), this.length = this.objects.length;3162          }3163          var r, s, a;3164          return n(i2, e2), i2.box = function(t3) {3165            return t3 instanceof this ? t3 : new this(t3);3166          }, i2.prototype.indexOf = function(t3) {3167            return this.objects.indexOf(t3);3168          }, i2.prototype.splice = function() {3169            var e3;3170            return e3 = 1 <= arguments.length ? o.call(arguments, 0) : [], new this.constructor(t2.apply(null, [this.objects].concat(o.call(e3))));3171          }, i2.prototype.eachObject = function(t3) {3172            var e3, n2, i3, o2, r2, s2;3173            for (r2 = this.objects, s2 = [], n2 = e3 = 0, i3 = r2.length; i3 > e3; n2 = ++e3)3174              o2 = r2[n2], s2.push(t3(o2, n2));3175            return s2;3176          }, i2.prototype.insertObjectAtIndex = function(t3, e3) {3177            return this.splice(e3, 0, t3);3178          }, i2.prototype.insertSplittableListAtIndex = function(t3, e3) {3179            return this.splice.apply(this, [e3, 0].concat(o.call(t3.objects)));3180          }, i2.prototype.insertSplittableListAtPosition = function(t3, e3) {3181            var n2, i3, o2;3182            return o2 = this.splitObjectAtPosition(e3), i3 = o2[0], n2 = o2[1], new this.constructor(i3).insertSplittableListAtIndex(t3, n2);3183          }, i2.prototype.editObjectAtIndex = function(t3, e3) {3184            return this.replaceObjectAtIndex(e3(this.objects[t3]), t3);3185          }, i2.prototype.replaceObjectAtIndex = function(t3, e3) {3186            return this.splice(e3, 1, t3);3187          }, i2.prototype.removeObjectAtIndex = function(t3) {3188            return this.splice(t3, 1);3189          }, i2.prototype.getObjectAtIndex = function(t3) {3190            return this.objects[t3];3191          }, i2.prototype.getSplittableListInRange = function(t3) {3192            var e3, n2, i3, o2;3193            return i3 = this.splitObjectsAtRange(t3), n2 = i3[0], e3 = i3[1], o2 = i3[2], new this.constructor(n2.slice(e3, o2 + 1));3194          }, i2.prototype.selectSplittableList = function(t3) {3195            var e3, n2;3196            return n2 = function() {3197              var n3, i3, o2, r2;3198              for (o2 = this.objects, r2 = [], n3 = 0, i3 = o2.length; i3 > n3; n3++)3199                e3 = o2[n3], t3(e3) && r2.push(e3);3200              return r2;3201            }.call(this), new this.constructor(n2);3202          }, i2.prototype.removeObjectsInRange = function(t3) {3203            var e3, n2, i3, o2;3204            return i3 = this.splitObjectsAtRange(t3), n2 = i3[0], e3 = i3[1], o2 = i3[2], new this.constructor(n2).splice(e3, o2 - e3 + 1);3205          }, i2.prototype.transformObjectsInRange = function(t3, e3) {3206            var n2, i3, o2, r2, s2, a2, u;3207            return s2 = this.splitObjectsAtRange(t3), r2 = s2[0], i3 = s2[1], a2 = s2[2], u = function() {3208              var t4, s3, u2;3209              for (u2 = [], n2 = t4 = 0, s3 = r2.length; s3 > t4; n2 = ++t4)3210                o2 = r2[n2], u2.push(n2 >= i3 && a2 >= n2 ? e3(o2) : o2);3211              return u2;3212            }(), new this.constructor(u);3213          }, i2.prototype.splitObjectsAtRange = function(t3) {3214            var e3, n2, i3, o2, s2, u;3215            return o2 = this.splitObjectAtPosition(a(t3)), n2 = o2[0], e3 = o2[1], i3 = o2[2], s2 = new this.constructor(n2).splitObjectAtPosition(r(t3) + i3), n2 = s2[0], u = s2[1], [n2, e3, u - 1];3216          }, i2.prototype.getObjectAtPosition = function(t3) {3217            var e3, n2, i3;3218            return i3 = this.findIndexAndOffsetAtPosition(t3), e3 = i3.index, n2 = i3.offset, this.objects[e3];3219          }, i2.prototype.splitObjectAtPosition = function(t3) {3220            var e3, n2, i3, o2, r2, s2, a2, u, c, l;3221            return s2 = this.findIndexAndOffsetAtPosition(t3), e3 = s2.index, r2 = s2.offset, o2 = this.objects.slice(0), e3 != null ? r2 === 0 ? (c = e3, l = 0) : (i3 = this.getObjectAtIndex(e3), a2 = i3.splitAtOffset(r2), n2 = a2[0], u = a2[1], o2.splice(e3, 1, n2, u), c = e3 + 1, l = n2.getLength() - r2) : (c = o2.length, l = 0), [o2, c, l];3222          }, i2.prototype.consolidate = function() {3223            var t3, e3, n2, i3, o2, r2;3224            for (i3 = [], o2 = this.objects[0], r2 = this.objects.slice(1), t3 = 0, e3 = r2.length; e3 > t3; t3++)3225              n2 = r2[t3], (typeof o2.canBeConsolidatedWith == "function" ? o2.canBeConsolidatedWith(n2) : void 0) ? o2 = o2.consolidateWith(n2) : (i3.push(o2), o2 = n2);3226            return o2 != null && i3.push(o2), new this.constructor(i3);3227          }, i2.prototype.consolidateFromIndexToIndex = function(t3, e3) {3228            var n2, i3, r2;3229            return i3 = this.objects.slice(0), r2 = i3.slice(t3, e3 + 1), n2 = new this.constructor(r2).consolidate().toArray(), this.splice.apply(this, [t3, r2.length].concat(o.call(n2)));3230          }, i2.prototype.findIndexAndOffsetAtPosition = function(t3) {3231            var e3, n2, i3, o2, r2, s2, a2;3232            for (e3 = 0, a2 = this.objects, i3 = n2 = 0, o2 = a2.length; o2 > n2; i3 = ++n2) {3233              if (s2 = a2[i3], r2 = e3 + s2.getLength(), t3 >= e3 && r2 > t3)3234                return {index: i3, offset: t3 - e3};3235              e3 = r2;3236            }3237            return {index: null, offset: null};3238          }, i2.prototype.findPositionAtIndexAndOffset = function(t3, e3) {3239            var n2, i3, o2, r2, s2, a2;3240            for (s2 = 0, a2 = this.objects, n2 = i3 = 0, o2 = a2.length; o2 > i3; n2 = ++i3)3241              if (r2 = a2[n2], t3 > n2)3242                s2 += r2.getLength();3243              else if (n2 === t3) {3244                s2 += e3;3245                break;3246              }3247            return s2;3248          }, i2.prototype.getEndPosition = function() {3249            var t3, e3;3250            return this.endPosition != null ? this.endPosition : this.endPosition = function() {3251              var n2, i3, o2;3252              for (e3 = 0, o2 = this.objects, n2 = 0, i3 = o2.length; i3 > n2; n2++)3253                t3 = o2[n2], e3 += t3.getLength();3254              return e3;3255            }.call(this);3256          }, i2.prototype.toString = function() {3257            return this.objects.join("");3258          }, i2.prototype.toArray = function() {3259            return this.objects.slice(0);3260          }, i2.prototype.toJSON = function() {3261            return this.toArray();3262          }, i2.prototype.isEqualTo = function(t3) {3263            return i2.__super__.isEqualTo.apply(this, arguments) || s(this.objects, t3 != null ? t3.objects : void 0);3264          }, s = function(t3, e3) {3265            var n2, i3, o2, r2, s2;3266            if (e3 == null && (e3 = []), t3.length !== e3.length)3267              return false;3268            for (s2 = true, i3 = n2 = 0, o2 = t3.length; o2 > n2; i3 = ++n2)3269              r2 = t3[i3], s2 && !r2.isEqualTo(e3[i3]) && (s2 = false);3270            return s2;3271          }, i2.prototype.contentsForInspection = function() {3272            var t3;3273            return {objects: "[" + function() {3274              var e3, n2, i3, o2;3275              for (i3 = this.objects, o2 = [], e3 = 0, n2 = i3.length; n2 > e3; e3++)3276                t3 = i3[e3], o2.push(t3.inspect());3277              return o2;3278            }.call(this).join(", ") + "]"};3279          }, a = function(t3) {3280            return t3[0];3281          }, r = function(t3) {3282            return t3[1];3283          }, i2;3284        }(e.Object);3285      }.call(this), function() {3286        var t2 = function(t3, e2) {3287          function i() {3288            this.constructor = t3;3289          }3290          for (var o in e2)3291            n.call(e2, o) && (t3[o] = e2[o]);3292          return i.prototype = e2.prototype, t3.prototype = new i(), t3.__super__ = e2.prototype, t3;3293        }, n = {}.hasOwnProperty;3294        e.Text = function(n2) {3295          function i(t3) {3296            var n3;3297            t3 == null && (t3 = []), i.__super__.constructor.apply(this, arguments), this.pieceList = new e.SplittableList(function() {3298              var e2, i2, o;3299              for (o = [], e2 = 0, i2 = t3.length; i2 > e2; e2++)3300                n3 = t3[e2], n3.isEmpty() || o.push(n3);3301              return o;3302            }());3303          }3304          return t2(i, n2), i.textForAttachmentWithAttributes = function(t3, n3) {3305            var i2;3306            return i2 = new e.AttachmentPiece(t3, n3), new this([i2]);3307          }, i.textForStringWithAttributes = function(t3, n3) {3308            var i2;3309            return i2 = new e.StringPiece(t3, n3), new this([i2]);3310          }, i.fromJSON = function(t3) {3311            var n3, i2;3312            return i2 = function() {3313              var i3, o, r;3314              for (r = [], i3 = 0, o = t3.length; o > i3; i3++)3315                n3 = t3[i3], r.push(e.Piece.fromJSON(n3));3316              return r;3317            }(), new this(i2);3318          }, i.prototype.copy = function() {3319            return this.copyWithPieceList(this.pieceList);3320          }, i.prototype.copyWithPieceList = function(t3) {3321            return new this.constructor(t3.consolidate().toArray());3322          }, i.prototype.copyUsingObjectMap = function(t3) {3323            var e2, n3;3324            return n3 = function() {3325              var n4, i2, o, r, s;3326              for (o = this.getPieces(), s = [], n4 = 0, i2 = o.length; i2 > n4; n4++)3327                e2 = o[n4], s.push((r = t3.find(e2)) != null ? r : e2);3328              return s;3329            }.call(this), new this.constructor(n3);3330          }, i.prototype.appendText = function(t3) {3331            return this.insertTextAtPosition(t3, this.getLength());3332          }, i.prototype.insertTextAtPosition = function(t3, e2) {3333            return this.copyWithPieceList(this.pieceList.insertSplittableListAtPosition(t3.pieceList, e2));3334          }, i.prototype.removeTextAtRange = function(t3) {3335            return this.copyWithPieceList(this.pieceList.removeObjectsInRange(t3));3336          }, i.prototype.replaceTextAtRange = function(t3, e2) {3337            return this.removeTextAtRange(e2).insertTextAtPosition(t3, e2[0]);3338          }, i.prototype.moveTextFromRangeToPosition = function(t3, e2) {3339            var n3, i2;3340            if (!(t3[0] <= e2 && e2 <= t3[1]))3341              return i2 = this.getTextAtRange(t3), n3 = i2.getLength(), t3[0] < e2 && (e2 -= n3), this.removeTextAtRange(t3).insertTextAtPosition(i2, e2);3342          }, i.prototype.addAttributeAtRange = function(t3, e2, n3) {3343            var i2;3344            return i2 = {}, i2[t3] = e2, this.addAttributesAtRange(i2, n3);3345          }, i.prototype.addAttributesAtRange = function(t3, e2) {3346            return this.copyWithPieceList(this.pieceList.transformObjectsInRange(e2, function(e3) {3347              return e3.copyWithAdditionalAttributes(t3);3348            }));3349          }, i.prototype.removeAttributeAtRange = function(t3, e2) {3350            return this.copyWithPieceList(this.pieceList.transformObjectsInRange(e2, function(e3) {3351              return e3.copyWithoutAttribute(t3);3352            }));3353          }, i.prototype.setAttributesAtRange = function(t3, e2) {3354            return this.copyWithPieceList(this.pieceList.transformObjectsInRange(e2, function(e3) {3355              return e3.copyWithAttributes(t3);3356            }));3357          }, i.prototype.getAttributesAtPosition = function(t3) {3358            var e2, n3;3359            return (e2 = (n3 = this.pieceList.getObjectAtPosition(t3)) != null ? n3.getAttributes() : void 0) != null ? e2 : {};3360          }, i.prototype.getCommonAttributes = function() {3361            var t3, n3;3362            return t3 = function() {3363              var t4, e2, i2, o;3364              for (i2 = this.pieceList.toArray(), o = [], t4 = 0, e2 = i2.length; e2 > t4; t4++)3365                n3 = i2[t4], o.push(n3.getAttributes());3366              return o;3367            }.call(this), e.Hash.fromCommonAttributesOfObjects(t3).toObject();3368          }, i.prototype.getCommonAttributesAtRange = function(t3) {3369            var e2;3370            return (e2 = this.getTextAtRange(t3).getCommonAttributes()) != null ? e2 : {};3371          }, i.prototype.getExpandedRangeForAttributeAtOffset = function(t3, e2) {3372            var n3, i2, o;3373            for (n3 = o = e2, i2 = this.getLength(); n3 > 0 && this.getCommonAttributesAtRange([n3 - 1, o])[t3]; )3374              n3--;3375            for (; i2 > o && this.getCommonAttributesAtRange([e2, o + 1])[t3]; )3376              o++;3377            return [n3, o];3378          }, i.prototype.getTextAtRange = function(t3) {3379            return this.copyWithPieceList(this.pieceList.getSplittableListInRange(t3));3380          }, i.prototype.getStringAtRange = function(t3) {3381            return this.pieceList.getSplittableListInRange(t3).toString();3382          }, i.prototype.getStringAtPosition = function(t3) {3383            return this.getStringAtRange([t3, t3 + 1]);3384          }, i.prototype.startsWithString = function(t3) {3385            return this.getStringAtRange([0, t3.length]) === t3;3386          }, i.prototype.endsWithString = function(t3) {3387            var e2;3388            return e2 = this.getLength(), this.getStringAtRange([e2 - t3.length, e2]) === t3;3389          }, i.prototype.getAttachmentPieces = function() {3390            var t3, e2, n3, i2, o;3391            for (i2 = this.pieceList.toArray(), o = [], t3 = 0, e2 = i2.length; e2 > t3; t3++)3392              n3 = i2[t3], n3.attachment != null && o.push(n3);3393            return o;3394          }, i.prototype.getAttachments = function() {3395            var t3, e2, n3, i2, o;3396            for (i2 = this.getAttachmentPieces(), o = [], t3 = 0, e2 = i2.length; e2 > t3; t3++)3397              n3 = i2[t3], o.push(n3.attachment);3398            return o;3399          }, i.prototype.getAttachmentAndPositionById = function(t3) {3400            var e2, n3, i2, o, r, s;3401            for (o = 0, r = this.pieceList.toArray(), e2 = 0, n3 = r.length; n3 > e2; e2++) {3402              if (i2 = r[e2], ((s = i2.attachment) != null ? s.id : void 0) === t3)3403                return {attachment: i2.attachment, position: o};3404              o += i2.length;3405            }3406            return {attachment: null, position: null};3407          }, i.prototype.getAttachmentById = function(t3) {3408            var e2, n3, i2;3409            return i2 = this.getAttachmentAndPositionById(t3), e2 = i2.attachment, n3 = i2.position, e2;3410          }, i.prototype.getRangeOfAttachment = function(t3) {3411            var e2, n3;3412            return n3 = this.getAttachmentAndPositionById(t3.id), t3 = n3.attachment, e2 = n3.position, t3 != null ? [e2, e2 + 1] : void 0;3413          }, i.prototype.updateAttributesForAttachment = function(t3, e2) {3414            var n3;3415            return (n3 = this.getRangeOfAttachment(e2)) ? this.addAttributesAtRange(t3, n3) : this;3416          }, i.prototype.getLength = function() {3417            return this.pieceList.getEndPosition();3418          }, i.prototype.isEmpty = function() {3419            return this.getLength() === 0;3420          }, i.prototype.isEqualTo = function(t3) {3421            var e2;3422            return i.__super__.isEqualTo.apply(this, arguments) || (t3 != null && (e2 = t3.pieceList) != null ? e2.isEqualTo(this.pieceList) : void 0);3423          }, i.prototype.isBlockBreak = function() {3424            return this.getLength() === 1 && this.pieceList.getObjectAtIndex(0).isBlockBreak();3425          }, i.prototype.eachPiece = function(t3) {3426            return this.pieceList.eachObject(t3);3427          }, i.prototype.getPieces = function() {3428            return this.pieceList.toArray();3429          }, i.prototype.getPieceAtPosition = function(t3) {3430            return this.pieceList.getObjectAtPosition(t3);3431          }, i.prototype.contentsForInspection = function() {3432            return {pieceList: this.pieceList.inspect()};3433          }, i.prototype.toSerializableText = function() {3434            var t3;3435            return t3 = this.pieceList.selectSplittableList(function(t4) {3436              return t4.isSerializable();3437            }), this.copyWithPieceList(t3);3438          }, i.prototype.toString = function() {3439            return this.pieceList.toString();3440          }, i.prototype.toJSON = function() {3441            return this.pieceList.toJSON();3442          }, i.prototype.toConsole = function() {3443            var t3;3444            return JSON.stringify(function() {3445              var e2, n3, i2, o;3446              for (i2 = this.pieceList.toArray(), o = [], e2 = 0, n3 = i2.length; n3 > e2; e2++)3447                t3 = i2[e2], o.push(JSON.parse(t3.toConsole()));3448              return o;3449            }.call(this));3450          }, i.prototype.getDirection = function() {3451            return e.getDirection(this.toString());3452          }, i.prototype.isRTL = function() {3453            return this.getDirection() === "rtl";3454          }, i;3455        }(e.Object);3456      }.call(this), function() {3457        var t2, n, i, o, r, s = function(t3, e2) {3458          function n2() {3459            this.constructor = t3;3460          }3461          for (var i2 in e2)3462            a.call(e2, i2) && (t3[i2] = e2[i2]);3463          return n2.prototype = e2.prototype, t3.prototype = new n2(), t3.__super__ = e2.prototype, t3;3464        }, a = {}.hasOwnProperty, u = [].indexOf || function(t3) {3465          for (var e2 = 0, n2 = this.length; n2 > e2; e2++)3466            if (e2 in this && this[e2] === t3)3467              return e2;3468          return -1;3469        }, c = [].slice;3470        t2 = e.arraysAreEqual, r = e.spliceArray, i = e.getBlockConfig, n = e.getBlockAttributeNames, o = e.getListAttributeNames, e.Block = function(n2) {3471          function a2(t3, n3) {3472            t3 == null && (t3 = new e.Text()), n3 == null && (n3 = []), a2.__super__.constructor.apply(this, arguments), this.text = h(t3), this.attributes = n3;3473          }3474          var l, h, p, d, f, g, m, v, y;3475          return s(a2, n2), a2.fromJSON = function(t3) {3476            var n3;3477            return n3 = e.Text.fromJSON(t3.text), new this(n3, t3.attributes);3478          }, a2.prototype.isEmpty = function() {3479            return this.text.isBlockBreak();3480          }, a2.prototype.isEqualTo = function(e2) {3481            return a2.__super__.isEqualTo.apply(this, arguments) || this.text.isEqualTo(e2 != null ? e2.text : void 0) && t2(this.attributes, e2 != null ? e2.attributes : void 0);3482          }, a2.prototype.copyWithText = function(t3) {3483            return new this.constructor(t3, this.attributes);3484          }, a2.prototype.copyWithoutText = function() {3485            return this.copyWithText(null);3486          }, a2.prototype.copyWithAttributes = function(t3) {3487            return new this.constructor(this.text, t3);3488          }, a2.prototype.copyWithoutAttributes = function() {3489            return this.copyWithAttributes(null);3490          }, a2.prototype.copyUsingObjectMap = function(t3) {3491            var e2;3492            return this.copyWithText((e2 = t3.find(this.text)) ? e2 : this.text.copyUsingObjectMap(t3));3493          }, a2.prototype.addAttribute = function(t3) {3494            var e2;3495            return e2 = this.attributes.concat(d(t3)), this.copyWithAttributes(e2);3496          }, a2.prototype.removeAttribute = function(t3) {3497            var e2, n3;3498            return n3 = i(t3).listAttribute, e2 = g(g(this.attributes, t3), n3), this.copyWithAttributes(e2);3499          }, a2.prototype.removeLastAttribute = function() {3500            return this.removeAttribute(this.getLastAttribute());3501          }, a2.prototype.getLastAttribute = function() {3502            return f(this.attributes);3503          }, a2.prototype.getAttributes = function() {3504            return this.attributes.slice(0);3505          }, a2.prototype.getAttributeLevel = function() {3506            return this.attributes.length;3507          }, a2.prototype.getAttributeAtLevel = function(t3) {3508            return this.attributes[t3 - 1];3509          }, a2.prototype.hasAttribute = function(t3) {3510            return u.call(this.attributes, t3) >= 0;3511          }, a2.prototype.hasAttributes = function() {3512            return this.getAttributeLevel() > 0;3513          }, a2.prototype.getLastNestableAttribute = function() {3514            return f(this.getNestableAttributes());3515          }, a2.prototype.getNestableAttributes = function() {3516            var t3, e2, n3, o2, r2;3517            for (o2 = this.attributes, r2 = [], e2 = 0, n3 = o2.length; n3 > e2; e2++)3518              t3 = o2[e2], i(t3).nestable && r2.push(t3);3519            return r2;3520          }, a2.prototype.getNestingLevel = function() {3521            return this.getNestableAttributes().length;3522          }, a2.prototype.decreaseNestingLevel = function() {3523            var t3;3524            return (t3 = this.getLastNestableAttribute()) ? this.removeAttribute(t3) : this;3525          }, a2.prototype.increaseNestingLevel = function() {3526            var t3, e2, n3;3527            return (t3 = this.getLastNestableAttribute()) ? (n3 = this.attributes.lastIndexOf(t3), e2 = r.apply(null, [this.attributes, n3 + 1, 0].concat(c.call(d(t3)))), this.copyWithAttributes(e2)) : this;3528          }, a2.prototype.getListItemAttributes = function() {3529            var t3, e2, n3, o2, r2;3530            for (o2 = this.attributes, r2 = [], e2 = 0, n3 = o2.length; n3 > e2; e2++)3531              t3 = o2[e2], i(t3).listAttribute && r2.push(t3);3532            return r2;3533          }, a2.prototype.isListItem = function() {3534            var t3;3535            return (t3 = i(this.getLastAttribute())) != null ? t3.listAttribute : void 0;3536          }, a2.prototype.isTerminalBlock = function() {3537            var t3;3538            return (t3 = i(this.getLastAttribute())) != null ? t3.terminal : void 0;3539          }, a2.prototype.breaksOnReturn = function() {3540            var t3;3541            return (t3 = i(this.getLastAttribute())) != null ? t3.breakOnReturn : void 0;3542          }, a2.prototype.findLineBreakInDirectionFromPosition = function(t3, e2) {3543            var n3, i2;3544            return i2 = this.toString(), n3 = function() {3545              switch (t3) {3546                case "forward":3547                  return i2.indexOf("\n", e2);3548                case "backward":3549                  return i2.slice(0, e2).lastIndexOf("\n");3550              }3551            }(), n3 !== -1 ? n3 : void 0;3552          }, a2.prototype.contentsForInspection = function() {3553            return {text: this.text.inspect(), attributes: this.attributes};3554          }, a2.prototype.toString = function() {3555            return this.text.toString();3556          }, a2.prototype.toJSON = function() {3557            return {text: this.text, attributes: this.attributes};3558          }, a2.prototype.getDirection = function() {3559            return this.text.getDirection();3560          }, a2.prototype.isRTL = function() {3561            return this.text.isRTL();3562          }, a2.prototype.getLength = function() {3563            return this.text.getLength();3564          }, a2.prototype.canBeConsolidatedWith = function(t3) {3565            return !this.hasAttributes() && !t3.hasAttributes() && this.getDirection() === t3.getDirection();3566          }, a2.prototype.consolidateWith = function(t3) {3567            var n3, i2;3568            return n3 = e.Text.textForStringWithAttributes("\n"), i2 = this.getTextWithoutBlockBreak().appendText(n3), this.copyWithText(i2.appendText(t3.text));3569          }, a2.prototype.splitAtOffset = function(t3) {3570            var e2, n3;3571            return t3 === 0 ? (e2 = null, n3 = this) : t3 === this.getLength() ? (e2 = this, n3 = null) : (e2 = this.copyWithText(this.text.getTextAtRange([0, t3])), n3 = this.copyWithText(this.text.getTextAtRange([t3, this.getLength()]))), [e2, n3];3572          }, a2.prototype.getBlockBreakPosition = function() {3573            return this.text.getLength() - 1;3574          }, a2.prototype.getTextWithoutBlockBreak = function() {3575            return m(this.text) ? this.text.getTextAtRange([0, this.getBlockBreakPosition()]) : this.text.copy();3576          }, a2.prototype.canBeGrouped = function(t3) {3577            return this.attributes[t3];3578          }, a2.prototype.canBeGroupedWith = function(t3, e2) {3579            var n3, r2, s2, a3;3580            return s2 = t3.getAttributes(), r2 = s2[e2], n3 = this.attributes[e2], !(n3 !== r2 || i(n3).group === false && (a3 = s2[e2 + 1], u.call(o(), a3) < 0) || this.getDirection() !== t3.getDirection() && !t3.isEmpty());3581          }, h = function(t3) {3582            return t3 = y(t3), t3 = l(t3);3583          }, y = function(t3) {3584            var n3, i2, o2, r2, s2, a3;3585            return r2 = false, a3 = t3.getPieces(), i2 = 2 <= a3.length ? c.call(a3, 0, n3 = a3.length - 1) : (n3 = 0, []), o2 = a3[n3++], o2 == null ? t3 : (i2 = function() {3586              var t4, e2, n4;3587              for (n4 = [], t4 = 0, e2 = i2.length; e2 > t4; t4++)3588                s2 = i2[t4], s2.isBlockBreak() ? (r2 = true, n4.push(v(s2))) : n4.push(s2);3589              return n4;3590            }(), r2 ? new e.Text(c.call(i2).concat([o2])) : t3);3591          }, p = e.Text.textForStringWithAttributes("\n", {blockBreak: true}), l = function(t3) {3592            return m(t3) ? t3 : t3.appendText(p);3593          }, m = function(t3) {3594            var e2, n3;3595            return n3 = t3.getLength(), n3 === 0 ? false : (e2 = t3.getTextAtRange([n3 - 1, n3]), e2.isBlockBreak());3596          }, v = function(t3) {3597            return t3.copyWithoutAttribute("blockBreak");3598          }, d = function(t3) {3599            var e2;3600            return e2 = i(t3).listAttribute, e2 != null ? [e2, t3] : [t3];3601          }, f = function(t3) {3602            return t3.slice(-1)[0];3603          }, g = function(t3, e2) {3604            var n3;3605            return n3 = t3.lastIndexOf(e2), n3 === -1 ? t3 : r(t3, n3, 1);3606          }, a2;3607        }(e.Object);3608      }.call(this), function() {3609        var t2, n, i, o = function(t3, e2) {3610          function n2() {3611            this.constructor = t3;3612          }3613          for (var i2 in e2)3614            r.call(e2, i2) && (t3[i2] = e2[i2]);3615          return n2.prototype = e2.prototype, t3.prototype = new n2(), t3.__super__ = e2.prototype, t3;3616        }, r = {}.hasOwnProperty, s = [].indexOf || function(t3) {3617          for (var e2 = 0, n2 = this.length; n2 > e2; e2++)3618            if (e2 in this && this[e2] === t3)3619              return e2;3620          return -1;3621        }, a = [].slice;3622        n = e.tagName, i = e.walkTree, t2 = e.nodeIsAttachmentElement, e.HTMLSanitizer = function(r2) {3623          function u(t3, e2) {3624            var n2;3625            n2 = e2 != null ? e2 : {}, this.allowedAttributes = n2.allowedAttributes, this.forbiddenProtocols = n2.forbiddenProtocols, this.forbiddenElements = n2.forbiddenElements, this.allowedAttributes == null && (this.allowedAttributes = c), this.forbiddenProtocols == null && (this.forbiddenProtocols = h), this.forbiddenElements == null && (this.forbiddenElements = l), this.body = p(t3);3626          }3627          var c, l, h, p;3628          return o(u, r2), c = "style href src width height class".split(" "), h = "javascript:".split(" "), l = "script iframe".split(" "), u.sanitize = function(t3, e2) {3629            var n2;3630            return n2 = new this(t3, e2), n2.sanitize(), n2;3631          }, u.prototype.sanitize = function() {3632            return this.sanitizeElements(), this.normalizeListElementNesting();3633          }, u.prototype.getHTML = function() {3634            return this.body.innerHTML;3635          }, u.prototype.getBody = function() {3636            return this.body;3637          }, u.prototype.sanitizeElements = function() {3638            var t3, n2, o2, r3, s2;3639            for (s2 = i(this.body), r3 = []; s2.nextNode(); )3640              switch (o2 = s2.currentNode, o2.nodeType) {3641                case Node.ELEMENT_NODE:3642                  this.elementIsRemovable(o2) ? r3.push(o2) : this.sanitizeElement(o2);3643                  break;3644                case Node.COMMENT_NODE:3645                  r3.push(o2);3646              }3647            for (t3 = 0, n2 = r3.length; n2 > t3; t3++)3648              o2 = r3[t3], e.removeNode(o2);3649            return this.body;3650          }, u.prototype.sanitizeElement = function(t3) {3651            var e2, n2, i2, o2, r3;3652            for (t3.hasAttribute("href") && (o2 = t3.protocol, s.call(this.forbiddenProtocols, o2) >= 0 && t3.removeAttribute("href")), r3 = a.call(t3.attributes), e2 = 0, n2 = r3.length; n2 > e2; e2++)3653              i2 = r3[e2].name, s.call(this.allowedAttributes, i2) >= 0 || i2.indexOf("data-trix") === 0 || t3.removeAttribute(i2);3654            return t3;3655          }, u.prototype.normalizeListElementNesting = function() {3656            var t3, e2, i2, o2, r3;3657            for (r3 = a.call(this.body.querySelectorAll("ul,ol")), t3 = 0, e2 = r3.length; e2 > t3; t3++)3658              i2 = r3[t3], (o2 = i2.previousElementSibling) && n(o2) === "li" && o2.appendChild(i2);3659            return this.body;3660          }, u.prototype.elementIsRemovable = function(t3) {3661            return (t3 != null ? t3.nodeType : void 0) === Node.ELEMENT_NODE ? this.elementIsForbidden(t3) || this.elementIsntSerializable(t3) : void 0;3662          }, u.prototype.elementIsForbidden = function(t3) {3663            var e2;3664            return e2 = n(t3), s.call(this.forbiddenElements, e2) >= 0;3665          }, u.prototype.elementIsntSerializable = function(e2) {3666            return e2.getAttribute("data-trix-serialize") === "false" && !t2(e2);3667          }, p = function(t3) {3668            var e2, n2, i2, o2, r3;3669            for (t3 == null && (t3 = ""), t3 = t3.replace(/<\/html[^>]*>[^]*$/i, "</html>"), e2 = document.implementation.createHTMLDocument(""), e2.documentElement.innerHTML = t3, r3 = e2.head.querySelectorAll("style"), i2 = 0, o2 = r3.length; o2 > i2; i2++)3670              n2 = r3[i2], e2.body.appendChild(n2);3671            return e2.body;3672          }, u;3673        }(e.BasicObject);3674      }.call(this), function() {3675        var t2, n, i, o, r, s, a, u, c, l, h, p = function(t3, e2) {3676          function n2() {3677            this.constructor = t3;3678          }3679          for (var i2 in e2)3680            d.call(e2, i2) && (t3[i2] = e2[i2]);3681          return n2.prototype = e2.prototype, t3.prototype = new n2(), t3.__super__ = e2.prototype, t3;3682        }, d = {}.hasOwnProperty, f = [].indexOf || function(t3) {3683          for (var e2 = 0, n2 = this.length; n2 > e2; e2++)3684            if (e2 in this && this[e2] === t3)3685              return e2;3686          return -1;3687        };3688        t2 = e.arraysAreEqual, s = e.makeElement, l = e.tagName, r = e.getBlockTagNames, h = e.walkTree, o = e.findClosestElementFromNode, i = e.elementContainsNode, a = e.nodeIsAttachmentElement, u = e.normalizeSpaces, n = e.breakableWhitespacePattern, c = e.squishBreakableWhitespace, e.HTMLParser = function(d2) {3689          function g(t3, e2) {3690            this.html = t3, this.referenceElement = (e2 != null ? e2 : {}).referenceElement, this.blocks = [], this.blockElements = [], this.processedElements = [];3691          }3692          var m, v, y, b, A, C, x, w, E, S, R, k;3693          return p(g, d2), g.parse = function(t3, e2) {3694            var n2;3695            return n2 = new this(t3, e2), n2.parse(), n2;3696          }, g.prototype.getDocument = function() {3697            return e.Document.fromJSON(this.blocks);3698          }, g.prototype.parse = function() {3699            var t3, n2;3700            try {3701              for (this.createHiddenContainer(), t3 = e.HTMLSanitizer.sanitize(this.html).getHTML(), this.containerElement.innerHTML = t3, n2 = h(this.containerElement, {usingFilter: x}); n2.nextNode(); )3702                this.processNode(n2.currentNode);3703              return this.translateBlockElementMarginsToNewlines();3704            } finally {3705              this.removeHiddenContainer();3706            }3707          }, g.prototype.createHiddenContainer = function() {3708            return this.referenceElement ? (this.containerElement = this.referenceElement.cloneNode(false), 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 = s({tagName: "div", style: {display: "none"}}), document.body.appendChild(this.containerElement));3709          }, g.prototype.removeHiddenContainer = function() {3710            return e.removeNode(this.containerElement);3711          }, x = function(t3) {3712            return l(t3) === "style" ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT;3713          }, g.prototype.processNode = function(t3) {3714            switch (t3.nodeType) {3715              case Node.TEXT_NODE:3716                if (!this.isInsignificantTextNode(t3))3717                  return this.appendBlockForTextNode(t3), this.processTextNode(t3);3718                break;3719              case Node.ELEMENT_NODE:3720                return this.appendBlockForElement(t3), this.processElement(t3);3721            }3722          }, g.prototype.appendBlockForTextNode = function(e2) {3723            var n2, i2, o2;3724            return i2 = e2.parentNode, i2 === this.currentBlockElement && this.isBlockElement(e2.previousSibling) ? this.appendStringWithAttributes("\n") : i2 !== this.containerElement && !this.isBlockElement(i2) || (n2 = this.getBlockAttributes(i2), t2(n2, (o2 = this.currentBlock) != null ? o2.attributes : void 0)) ? void 0 : (this.currentBlock = this.appendBlockForAttributesWithElement(n2, i2), this.currentBlockElement = i2);3725          }, g.prototype.appendBlockForElement = function(e2) {3726            var n2, o2, r2, s2;3727            if (r2 = this.isBlockElement(e2), o2 = i(this.currentBlockElement, e2), r2 && !this.isBlockElement(e2.firstChild)) {3728              if ((!this.isInsignificantTextNode(e2.firstChild) || !this.isBlockElement(e2.firstElementChild)) && (n2 = this.getBlockAttributes(e2), e2.firstChild))3729                return o2 && t2(n2, this.currentBlock.attributes) ? this.appendStringWithAttributes("\n") : (this.currentBlock = this.appendBlockForAttributesWithElement(n2, e2), this.currentBlockElement = e2);3730            } else if (this.currentBlockElement && !o2 && !r2)3731              return (s2 = this.findParentBlockElement(e2)) ? this.appendBlockForElement(s2) : (this.currentBlock = this.appendEmptyBlock(), this.currentBlockElement = null);3732          }, g.prototype.findParentBlockElement = function(t3) {3733            var e2;3734            for (e2 = t3.parentElement; e2 && e2 !== this.containerElement; ) {3735              if (this.isBlockElement(e2) && f.call(this.blockElements, e2) >= 0)3736                return e2;3737              e2 = e2.parentElement;3738            }3739            return null;3740          }, g.prototype.processTextNode = function(t3) {3741            var e2, n2;3742            return n2 = t3.data, v(t3.parentNode) || (n2 = c(n2), R((e2 = t3.previousSibling) != null ? e2.textContent : void 0) && (n2 = A(n2))), this.appendStringWithAttributes(n2, this.getTextAttributes(t3.parentNode));3743          }, g.prototype.processElement = function(t3) {3744            var e2, n2, i2, o2, r2;3745            if (a(t3))3746              return e2 = w(t3, "attachment"), Object.keys(e2).length && (o2 = this.getTextAttributes(t3), this.appendAttachmentWithAttributes(e2, o2), t3.innerHTML = ""), this.processedElements.push(t3);3747            switch (l(t3)) {3748              case "br":3749                return this.isExtraBR(t3) || this.isBlockElement(t3.nextSibling) || this.appendStringWithAttributes("\n", this.getTextAttributes(t3)), this.processedElements.push(t3);3750              case "img":3751                e2 = {url: t3.getAttribute("src"), contentType: "image"}, i2 = b(t3);3752                for (n2 in i2)3753                  r2 = i2[n2], e2[n2] = r2;3754                return this.appendAttachmentWithAttributes(e2, this.getTextAttributes(t3)), this.processedElements.push(t3);3755              case "tr":3756                if (t3.parentNode.firstChild !== t3)3757                  return this.appendStringWithAttributes("\n");3758                break;3759              case "td":3760                if (t3.parentNode.firstChild !== t3)3761                  return this.appendStringWithAttributes(" | ");3762            }3763          }, g.prototype.appendBlockForAttributesWithElement = function(t3, e2) {3764            var n2;3765            return this.blockElements.push(e2), n2 = m(t3), this.blocks.push(n2), n2;3766          }, g.prototype.appendEmptyBlock = function() {3767            return this.appendBlockForAttributesWithElement([], null);3768          }, g.prototype.appendStringWithAttributes = function(t3, e2) {3769            return this.appendPiece(S(t3, e2));3770          }, g.prototype.appendAttachmentWithAttributes = function(t3, e2) {3771            return this.appendPiece(E(t3, e2));3772          }, g.prototype.appendPiece = function(t3) {3773            return this.blocks.length === 0 && this.appendEmptyBlock(), this.blocks[this.blocks.length - 1].text.push(t3);3774          }, g.prototype.appendStringToTextAtIndex = function(t3, e2) {3775            var n2, i2;3776            return i2 = this.blocks[e2].text, n2 = i2[i2.length - 1], (n2 != null ? n2.type : void 0) === "string" ? n2.string += t3 : i2.push(S(t3));3777          }, g.prototype.prependStringToTextAtIndex = function(t3, e2) {3778            var n2, i2;3779            return i2 = this.blocks[e2].text, n2 = i2[0], (n2 != null ? n2.type : void 0) === "string" ? n2.string = t3 + n2.string : i2.unshift(S(t3));3780          }, S = function(t3, e2) {3781            var n2;3782            return e2 == null && (e2 = {}), n2 = "string", t3 = u(t3), {string: t3, attributes: e2, type: n2};3783          }, E = function(t3, e2) {3784            var n2;3785            return e2 == null && (e2 = {}), n2 = "attachment", {attachment: t3, attributes: e2, type: n2};3786          }, m = function(t3) {3787            var e2;3788            return t3 == null && (t3 = {}), e2 = [], {text: e2, attributes: t3};3789          }, g.prototype.getTextAttributes = function(t3) {3790            var n2, i2, r2, s2, u2, c2, l2, h2, p2, d3, f2, g2;3791            r2 = {}, p2 = e.config.textAttributes;3792            for (n2 in p2)3793              if (u2 = p2[n2], u2.tagName && o(t3, {matchingSelector: u2.tagName, untilNode: this.containerElement}))3794                r2[n2] = true;3795              else if (u2.parser) {3796                if (g2 = u2.parser(t3)) {3797                  for (i2 = false, d3 = this.findBlockElementAncestors(t3), c2 = 0, h2 = d3.length; h2 > c2; c2++)3798                    if (s2 = d3[c2], u2.parser(s2) === g2) {3799                      i2 = true;3800                      break;3801                    }3802                  i2 || (r2[n2] = g2);3803                }3804              } else3805                u2.styleProperty && (g2 = t3.style[u2.styleProperty]) && (r2[n2] = g2);3806            if (a(t3)) {3807              f2 = w(t3, "attributes");3808              for (l2 in f2)3809                g2 = f2[l2], r2[l2] = g2;3810            }3811            return r2;3812          }, g.prototype.getBlockAttributes = function(t3) {3813            var n2, i2, o2, r2;3814            for (i2 = []; t3 && t3 !== this.containerElement; ) {3815              r2 = e.config.blockAttributes;3816              for (n2 in r2)3817                o2 = r2[n2], o2.parse !== false && l(t3) === o2.tagName && ((typeof o2.test == "function" ? o2.test(t3) : void 0) || !o2.test) && (i2.push(n2), o2.listAttribute && i2.push(o2.listAttribute));3818              t3 = t3.parentNode;3819            }3820            return i2.reverse();3821          }, g.prototype.findBlockElementAncestors = function(t3) {3822            var e2, n2;3823            for (e2 = []; t3 && t3 !== this.containerElement; )3824              n2 = l(t3), f.call(r(), n2) >= 0 && e2.push(t3), t3 = t3.parentNode;3825            return e2;3826          }, w = function(t3, e2) {3827            try {3828              return JSON.parse(t3.getAttribute("data-trix-" + e2));3829            } catch (n2) {3830              return {};3831            }3832          }, b = function(t3) {3833            var e2, n2, i2;3834            return i2 = t3.getAttribute("width"), n2 = t3.getAttribute("height"), e2 = {}, i2 && (e2.width = parseInt(i2, 10)), n2 && (e2.height = parseInt(n2, 10)), e2;3835          }, g.prototype.isBlockElement = function(t3) {3836            var e2;3837            if ((t3 != null ? t3.nodeType : void 0) === Node.ELEMENT_NODE && !a(t3) && !o(t3, {matchingSelector: "td", untilNode: this.containerElement}))3838              return e2 = l(t3), f.call(r(), e2) >= 0 || window.getComputedStyle(t3).display === "block";3839          }, g.prototype.isInsignificantTextNode = function(t3) {3840            var e2, n2, i2;3841            if ((t3 != null ? t3.nodeType : void 0) === Node.TEXT_NODE && k(t3.data) && (n2 = t3.parentNode, i2 = t3.previousSibling, e2 = t3.nextSibling, (!C(n2.previousSibling) || this.isBlockElement(n2.previousSibling)) && !v(n2)))3842              return !i2 || this.isBlockElement(i2) || !e2 || this.isBlockElement(e2);3843          }, g.prototype.isExtraBR = function(t3) {3844            return l(t3) === "br" && this.isBlockElement(t3.parentNode) && t3.parentNode.lastChild === t3;3845          }, v = function(t3) {3846            var e2;3847            return e2 = window.getComputedStyle(t3).whiteSpace, e2 === "pre" || e2 === "pre-wrap" || e2 === "pre-line";3848          }, C = function(t3) {3849            return t3 && !R(t3.textContent);3850          }, g.prototype.translateBlockElementMarginsToNewlines = function() {3851            var t3, e2, n2, i2, o2, r2, s2, a2;3852            for (e2 = this.getMarginOfDefaultBlockElement(), s2 = this.blocks, a2 = [], i2 = n2 = 0, o2 = s2.length; o2 > n2; i2 = ++n2)3853              t3 = s2[i2], (r2 = this.getMarginOfBlockElementAtIndex(i2)) && (r2.top > 2 * e2.top && this.prependStringToTextAtIndex("\n", i2), a2.push(r2.bottom > 2 * e2.bottom ? this.appendStringToTextAtIndex("\n", i2) : void 0));3854            return a2;3855          }, g.prototype.getMarginOfBlockElementAtIndex = function(t3) {3856            var e2, n2;3857            return !(e2 = this.blockElements[t3]) || !e2.textContent || (n2 = l(e2), f.call(r(), n2) >= 0 || f.call(this.processedElements, e2) >= 0) ? void 0 : y(e2);3858          }, g.prototype.getMarginOfDefaultBlockElement = function() {3859            var t3;3860            return t3 = s(e.config.blockAttributes["default"].tagName), this.containerElement.appendChild(t3), y(t3);3861          }, y = function(t3) {3862            var e2;3863            return e2 = window.getComputedStyle(t3), e2.display === "block" ? {top: parseInt(e2.marginTop), bottom: parseInt(e2.marginBottom)} : void 0;3864          }, A = function(t3) {3865            return t3.replace(RegExp("^" + n.source + "+"), "");3866          }, k = function(t3) {3867            return RegExp("^" + n.source + "*$").test(t3);3868          }, R = function(t3) {3869            return /\s$/.test(t3);3870          }, g;3871        }(e.BasicObject);3872      }.call(this), function() {3873        var t2, n, i, o, r = function(t3, e2) {3874          function n2() {3875            this.constructor = t3;3876          }3877          for (var i2 in e2)3878            s.call(e2, i2) && (t3[i2] = e2[i2]);3879          return n2.prototype = e2.prototype, t3.prototype = new n2(), t3.__super__ = e2.prototype, t3;3880        }, s = {}.hasOwnProperty, a = [].slice, u = [].indexOf || function(t3) {3881          for (var e2 = 0, n2 = this.length; n2 > e2; e2++)3882            if (e2 in this && this[e2] === t3)3883              return e2;3884          return -1;3885        };3886        t2 = e.arraysAreEqual, i = e.normalizeRange, o = e.rangeIsCollapsed, n = e.getBlockConfig, e.Document = function(s2) {3887          function c(t3) {3888            t3 == null && (t3 = []), c.__super__.constructor.apply(this, arguments), t3.length === 0 && (t3 = [new e.Block()]), this.blockList = e.SplittableList.box(t3);3889          }3890          var l;3891          return r(c, s2), c.fromJSON = function(t3) {3892            var n2, i2;3893            return i2 = function() {3894              var i3, o2, r2;3895              for (r2 = [], i3 = 0, o2 = t3.length; o2 > i3; i3++)3896                n2 = t3[i3], r2.push(e.Block.fromJSON(n2));3897              return r2;3898            }(), new this(i2);3899          }, c.fromHTML = function(t3, n2) {3900            return e.HTMLParser.parse(t3, n2).getDocument();3901          }, c.fromString = function(t3, n2) {3902            var i2;3903            return i2 = e.Text.textForStringWithAttributes(t3, n2), new this([new e.Block(i2)]);3904          }, c.prototype.isEmpty = function() {3905            var t3;3906            return this.blockList.length === 1 && (t3 = this.getBlockAtIndex(0), t3.isEmpty() && !t3.hasAttributes());3907          }, c.prototype.copy = function(t3) {3908            var e2;3909            return t3 == null && (t3 = {}), e2 = t3.consolidateBlocks ? this.blockList.consolidate().toArray() : this.blockList.toArray(), new this.constructor(e2);3910          }, c.prototype.copyUsingObjectsFromDocument = function(t3) {3911            var n2;3912            return n2 = new e.ObjectMap(t3.getObjects()), this.copyUsingObjectMap(n2);3913          }, c.prototype.copyUsingObjectMap = function(t3) {3914            var e2, n2, i2;3915            return n2 = function() {3916              var n3, o2, r2, s3;3917              for (r2 = this.getBlocks(), s3 = [], n3 = 0, o2 = r2.length; o2 > n3; n3++)3918                e2 = r2[n3], s3.push((i2 = t3.find(e2)) ? i2 : e2.copyUsingObjectMap(t3));3919              return s3;3920            }.call(this), new this.constructor(n2);3921          }, c.prototype.copyWithBaseBlockAttributes = function(t3) {3922            var e2, n2, i2;3923            return t3 == null && (t3 = []), i2 = function() {3924              var i3, o2, r2, s3;3925              for (r2 = this.getBlocks(), s3 = [], i3 = 0, o2 = r2.length; o2 > i3; i3++)3926                n2 = r2[i3], e2 = t3.concat(n2.getAttributes()), s3.push(n2.copyWithAttributes(e2));3927              return s3;3928            }.call(this), new this.constructor(i2);3929          }, c.prototype.replaceBlock = function(t3, e2) {3930            var n2;3931            return n2 = this.blockList.indexOf(t3), n2 === -1 ? this : new this.constructor(this.blockList.replaceObjectAtIndex(e2, n2));3932          }, c.prototype.insertDocumentAtRange = function(t3, e2) {3933            var n2, r2, s3, a2, u2, c2, l2;3934            return r2 = t3.blockList, u2 = (e2 = i(e2))[0], c2 = this.locationFromPosition(u2), s3 = c2.index, a2 = c2.offset, l2 = this, n2 = this.getBlockAtPosition(u2), o(e2) && n2.isEmpty() && !n2.hasAttributes() ? l2 = new this.constructor(l2.blockList.removeObjectAtIndex(s3)) : n2.getBlockBreakPosition() === a2 && u2++, l2 = l2.removeTextAtRange(e2), new this.constructor(l2.blockList.insertSplittableListAtPosition(r2, u2));3935          }, c.prototype.mergeDocumentAtRange = function(e2, n2) {3936            var o2, r2, s3, a2, u2, c2, l2, h, p, d, f, g;3937            return f = (n2 = i(n2))[0], d = this.locationFromPosition(f), r2 = this.getBlockAtIndex(d.index).getAttributes(), o2 = e2.getBaseBlockAttributes(), g = r2.slice(-o2.length), t2(o2, g) ? (l2 = r2.slice(0, -o2.length), c2 = e2.copyWithBaseBlockAttributes(l2)) : c2 = e2.copy({consolidateBlocks: true}).copyWithBaseBlockAttributes(r2), s3 = c2.getBlockCount(), a2 = c2.getBlockAtIndex(0), t2(r2, a2.getAttributes()) ? (u2 = a2.getTextWithoutBlockBreak(), p = this.insertTextAtRange(u2, n2), s3 > 1 && (c2 = new this.constructor(c2.getBlocks().slice(1)), h = f + u2.getLength(), p = p.insertDocumentAtRange(c2, h))) : p = this.insertDocumentAtRange(c2, n2), p;3938          }, c.prototype.insertTextAtRange = function(t3, e2) {3939            var n2, o2, r2, s3, a2;3940            return a2 = (e2 = i(e2))[0], s3 = this.locationFromPosition(a2), o2 = s3.index, r2 = s3.offset, n2 = this.removeTextAtRange(e2), new this.constructor(n2.blockList.editObjectAtIndex(o2, function(e3) {3941              return e3.copyWithText(e3.text.insertTextAtPosition(t3, r2));3942            }));3943          }, c.prototype.removeTextAtRange = function(t3) {3944            var e2, n2, r2, s3, a2, u2, c2, l2, h, p, d, f, g, m, v, y, b, A, C, x, w;3945            return p = t3 = i(t3), l2 = p[0], A = p[1], o(t3) ? this : (d = this.locationRangeFromRange(t3), u2 = d[0], y = d[1], a2 = u2.index, c2 = u2.offset, s3 = this.getBlockAtIndex(a2), v = y.index, b = y.offset, m = this.getBlockAtIndex(v), f = A - l2 === 1 && s3.getBlockBreakPosition() === c2 && m.getBlockBreakPosition() !== b && m.text.getStringAtPosition(b) === "\n", f ? r2 = this.blockList.editObjectAtIndex(v, function(t4) {3946              return t4.copyWithText(t4.text.removeTextAtRange([b, b + 1]));3947            }) : (h = s3.text.getTextAtRange([0, c2]), C = m.text.getTextAtRange([b, m.getLength()]), x = h.appendText(C), g = a2 !== v && c2 === 0, w = g && s3.getAttributeLevel() >= m.getAttributeLevel(), n2 = w ? m.copyWithText(x) : s3.copyWithText(x), e2 = v + 1 - a2, r2 = this.blockList.splice(a2, e2, n2)), new this.constructor(r2));3948          }, c.prototype.moveTextFromRangeToPosition = function(t3, e2) {3949            var n2, o2, r2, s3, u2, c2, l2, h, p, d;3950            return c2 = t3 = i(t3), p = c2[0], r2 = c2[1], e2 >= p && r2 >= e2 ? this : (o2 = this.getDocumentAtRange(t3), h = this.removeTextAtRange(t3), u2 = e2 > p, u2 && (e2 -= o2.getLength()), l2 = o2.getBlocks(), s3 = l2[0], n2 = 2 <= l2.length ? a.call(l2, 1) : [], n2.length === 0 ? (d = s3.getTextWithoutBlockBreak(), u2 && (e2 += 1)) : d = s3.text, h = h.insertTextAtRange(d, e2), n2.length === 0 ? h : (o2 = new this.constructor(n2), e2 += d.getLength(), h.insertDocumentAtRange(o2, e2)));3951          }, c.prototype.addAttributeAtRange = function(t3, e2, i2) {3952            var o2;3953            return o2 = this.blockList, this.eachBlockAtRange(i2, function(i3, r2, s3) {3954              return o2 = o2.editObjectAtIndex(s3, function() {3955                return n(t3) ? i3.addAttribute(t3, e2) : r2[0] === r2[1] ? i3 : i3.copyWithText(i3.text.addAttributeAtRange(t3, e2, r2));3956              });3957            }), new this.constructor(o2);3958          }, c.prototype.addAttribute = function(t3, e2) {3959            var n2;3960            return n2 = this.blockList, this.eachBlock(function(i2, o2) {3961              return n2 = n2.editObjectAtIndex(o2, function() {3962                return i2.addAttribute(t3, e2);3963              });3964            }), new this.constructor(n2);3965          }, c.prototype.removeAttributeAtRange = function(t3, e2) {3966            var i2;3967            return i2 = this.blockList, this.eachBlockAtRange(e2, function(e3, o2, r2) {3968              return n(t3) ? i2 = i2.editObjectAtIndex(r2, function() {3969                return e3.removeAttribute(t3);3970              }) : o2[0] !== o2[1] ? i2 = i2.editObjectAtIndex(r2, function() {3971                return e3.copyWithText(e3.text.removeAttributeAtRange(t3, o2));3972              }) : void 0;3973            }), new this.constructor(i2);3974          }, c.prototype.updateAttributesForAttachment = function(t3, e2) {3975            var n2, i2, o2, r2;3976            return o2 = (i2 = this.getRangeOfAttachment(e2))[0], n2 = this.locationFromPosition(o2).index, r2 = this.getTextAtIndex(n2), new this.constructor(this.blockList.editObjectAtIndex(n2, function(n3) {3977              return n3.copyWithText(r2.updateAttributesForAttachment(t3, e2));3978            }));3979          }, c.prototype.removeAttributeForAttachment = function(t3, e2) {3980            var n2;3981            return n2 = this.getRangeOfAttachment(e2), this.removeAttributeAtRange(t3, n2);3982          }, c.prototype.insertBlockBreakAtRange = function(t3) {3983            var n2, o2, r2, s3;3984            return s3 = (t3 = i(t3))[0], r2 = this.locationFromPosition(s3).offset, o2 = this.removeTextAtRange(t3), r2 === 0 && (n2 = [new e.Block()]), new this.constructor(o2.blockList.insertSplittableListAtPosition(new e.SplittableList(n2), s3));3985          }, c.prototype.applyBlockAttributeAtRange = function(t3, e2, i2) {3986            var o2, r2, s3, a2;3987            return s3 = this.expandRangeToLineBreaksAndSplitBlocks(i2), r2 = s3.document, i2 = s3.range, o2 = n(t3), o2.listAttribute ? (r2 = r2.removeLastListAttributeAtRange(i2, {exceptAttributeName: t3}), a2 = r2.convertLineBreaksToBlockBreaksInRange(i2), r2 = a2.document, i2 = a2.range) : r2 = o2.exclusive ? r2.removeBlockAttributesAtRange(i2) : o2.terminal ? r2.removeLastTerminalAttributeAtRange(i2) : r2.consolidateBlocksAtRange(i2), r2.addAttributeAtRange(t3, e2, i2);3988          }, c.prototype.removeLastListAttributeAtRange = function(t3, e2) {3989            var i2;3990            return e2 == null && (e2 = {}), i2 = this.blockList, this.eachBlockAtRange(t3, function(t4, o2, r2) {3991              var s3;3992              if ((s3 = t4.getLastAttribute()) && n(s3).listAttribute && s3 !== e2.exceptAttributeName)3993                return i2 = i2.editObjectAtIndex(r2, function() {3994                  return t4.removeAttribute(s3);3995                });3996            }), new this.constructor(i2);3997          }, c.prototype.removeLastTerminalAttributeAtRange = function(t3) {3998            var e2;3999            return e2 = this.blockList, this.eachBlockAtRange(t3, function(t4, i2, o2) {4000              var r2;4001              if ((r2 = t4.getLastAttribute()) && n(r2).terminal)4002                return e2 = e2.editObjectAtIndex(o2, function() {4003                  return t4.removeAttribute(r2);4004                });4005            }), new this.constructor(e2);4006          }, c.prototype.removeBlockAttributesAtRange = function(t3) {4007            var e2;4008            return e2 = this.blockList, this.eachBlockAtRange(t3, function(t4, n2, i2) {4009              return t4.hasAttributes() ? e2 = e2.editObjectAtIndex(i2, function() {4010                return t4.copyWithoutAttributes();4011              }) : void 0;4012            }), new this.constructor(e2);4013          }, c.prototype.expandRangeToLineBreaksAndSplitBlocks = function(t3) {4014            var e2, n2, o2, r2, s3, a2, u2, c2, l2;4015            return a2 = t3 = i(t3), l2 = a2[0], r2 = a2[1], c2 = this.locationFromPosition(l2), o2 = this.locationFromPosition(r2), e2 = this, u2 = e2.getBlockAtIndex(c2.index), (c2.offset = u2.findLineBreakInDirectionFromPosition("backward", c2.offset)) != null && (s3 = e2.positionFromLocation(c2), e2 = e2.insertBlockBreakAtRange([s3, s3 + 1]), o2.index += 1, o2.offset -= e2.getBlockAtIndex(c2.index).getLength(), c2.index += 1), c2.offset = 0, o2.offset === 0 && o2.index > c2.index ? (o2.index -= 1, o2.offset = e2.getBlockAtIndex(o2.index).getBlockBreakPosition()) : (n2 = e2.getBlockAtIndex(o2.index), n2.text.getStringAtRange([o2.offset - 1, o2.offset]) === "\n" ? o2.offset -= 1 : o2.offset = n2.findLineBreakInDirectionFromPosition("forward", o2.offset), o2.offset !== n2.getBlockBreakPosition() && (s3 = e2.positionFromLocation(o2), e2 = e2.insertBlockBreakAtRange([s3, s3 + 1]))), l2 = e2.positionFromLocation(c2), r2 = e2.positionFromLocation(o2), t3 = i([l2, r2]), {document: e2, range: t3};4016          }, c.prototype.convertLineBreaksToBlockBreaksInRange = function(t3) {4017            var e2, n2, o2;4018            return n2 = (t3 = i(t3))[0], o2 = this.getStringAtRange(t3).slice(0, -1), e2 = this, o2.replace(/.*?\n/g, function(t4) {4019              return n2 += t4.length, e2 = e2.insertBlockBreakAtRange([n2 - 1, n2]);4020            }), {document: e2, range: t3};4021          }, c.prototype.consolidateBlocksAtRange = function(t3) {4022            var e2, n2, o2, r2, s3;4023            return o2 = t3 = i(t3), s3 = o2[0], n2 = o2[1], r2 = this.locationFromPosition(s3).index, e2 = this.locationFromPosition(n2).index, new this.constructor(this.blockList.consolidateFromIndexToIndex(r2, e2));4024          }, c.prototype.getDocumentAtRange = function(t3) {4025            var e2;4026            return t3 = i(t3), e2 = this.blockList.getSplittableListInRange(t3).toArray(), new this.constructor(e2);4027          }, c.prototype.getStringAtRange = function(t3) {4028            var e2, n2, o2;4029            return o2 = t3 = i(t3), n2 = o2[o2.length - 1], n2 !== this.getLength() && (e2 = -1), this.getDocumentAtRange(t3).toString().slice(0, e2);4030          }, c.prototype.getBlockAtIndex = function(t3) {4031            return this.blockList.getObjectAtIndex(t3);4032          }, c.prototype.getBlockAtPosition = function(t3) {4033            var e2;4034            return e2 = this.locationFromPosition(t3).index, this.getBlockAtIndex(e2);4035          }, c.prototype.getTextAtIndex = function(t3) {4036            var e2;4037            return (e2 = this.getBlockAtIndex(t3)) != null ? e2.text : void 0;4038          }, c.prototype.getTextAtPosition = function(t3) {4039            var e2;4040            return e2 = this.locationFromPosition(t3).index, this.getTextAtIndex(e2);4041          }, c.prototype.getPieceAtPosition = function(t3) {4042            var e2, n2, i2;4043            return i2 = this.locationFromPosition(t3), e2 = i2.index, n2 = i2.offset, this.getTextAtIndex(e2).getPieceAtPosition(n2);4044          }, c.prototype.getCharacterAtPosition = function(t3) {4045            var e2, n2, i2;4046            return i2 = this.locationFromPosition(t3), e2 = i2.index, n2 = i2.offset, this.getTextAtIndex(e2).getStringAtRange([n2, n2 + 1]);4047          }, c.prototype.getLength = function() {4048            return this.blockList.getEndPosition();4049          }, c.prototype.getBlocks = function() {4050            return this.blockList.toArray();4051          }, c.prototype.getBlockCount = function() {4052            return this.blockList.length;4053          }, c.prototype.getEditCount = function() {4054            return this.editCount;4055          }, c.prototype.eachBlock = function(t3) {4056            return this.blockList.eachObject(t3);4057          }, c.prototype.eachBlockAtRange = function(t3, e2) {4058            var n2, o2, r2, s3, a2, u2, c2, l2, h, p, d, f;4059            if (u2 = t3 = i(t3), d = u2[0], r2 = u2[1], p = this.locationFromPosition(d), o2 = this.locationFromPosition(r2), p.index === o2.index)4060              return n2 = this.getBlockAtIndex(p.index), f = [p.offset, o2.offset], e2(n2, f, p.index);4061            for (h = [], a2 = s3 = c2 = p.index, l2 = o2.index; l2 >= c2 ? l2 >= s3 : s3 >= l2; a2 = l2 >= c2 ? ++s3 : --s3)4062              (n2 = this.getBlockAtIndex(a2)) ? (f = function() {4063                switch (a2) {4064                  case p.index:4065                    return [p.offset, n2.text.getLength()];4066                  case o2.index:4067                    return [0, o2.offset];4068                  default:4069                    return [0, n2.text.getLength()];4070                }4071              }(), h.push(e2(n2, f, a2))) : h.push(void 0);4072            return h;4073          }, c.prototype.getCommonAttributesAtRange = function(t3) {4074            var n2, r2, s3;4075            return r2 = (t3 = i(t3))[0], o(t3) ? this.getCommonAttributesAtPosition(r2) : (s3 = [], n2 = [], this.eachBlockAtRange(t3, function(t4, e2) {4076              return e2[0] !== e2[1] ? (s3.push(t4.text.getCommonAttributesAtRange(e2)), n2.push(l(t4))) : void 0;4077            }), e.Hash.fromCommonAttributesOfObjects(s3).merge(e.Hash.fromCommonAttributesOfObjects(n2)).toObject());4078          }, c.prototype.getCommonAttributesAtPosition = function(t3) {4079            var n2, i2, o2, r2, s3, a2, c2, h, p, d;4080            if (p = this.locationFromPosition(t3), s3 = p.index, h = p.offset, o2 = this.getBlockAtIndex(s3), !o2)4081              return {};4082            r2 = l(o2), n2 = o2.text.getAttributesAtPosition(h), i2 = o2.text.getAttributesAtPosition(h - 1), a2 = function() {4083              var t4, n3;4084              t4 = e.config.textAttributes, n3 = [];4085              for (c2 in t4)4086                d = t4[c2], d.inheritable && n3.push(c2);4087              return n3;4088            }();4089            for (c2 in i2)4090              d = i2[c2], (d === n2[c2] || u.call(a2, c2) >= 0) && (r2[c2] = d);4091            return r2;4092          }, c.prototype.getRangeOfCommonAttributeAtPosition = function(t3, e2) {4093            var n2, o2, r2, s3, a2, u2, c2, l2, h;4094            return a2 = this.locationFromPosition(e2), r2 = a2.index, s3 = a2.offset, h = this.getTextAtIndex(r2), u2 = h.getExpandedRangeForAttributeAtOffset(t3, s3), l2 = u2[0], o2 = u2[1], c2 = this.positionFromLocation({index: r2, offset: l2}), n2 = this.positionFromLocation({index: r2, offset: o2}), i([c2, n2]);4095          }, c.prototype.getBaseBlockAttributes = function() {4096            var t3, e2, n2, i2, o2, r2, s3;4097            for (t3 = this.getBlockAtIndex(0).getAttributes(), n2 = i2 = 1, s3 = this.getBlockCount(); s3 >= 1 ? s3 > i2 : i2 > s3; n2 = s3 >= 1 ? ++i2 : --i2)4098              e2 = this.getBlockAtIndex(n2).getAttributes(), r2 = Math.min(t3.length, e2.length), t3 = function() {4099                var n3, i3, s4;4100                for (s4 = [], o2 = n3 = 0, i3 = r2; (i3 >= 0 ? i3 > n3 : n3 > i3) && e2[o2] === t3[o2]; o2 = i3 >= 0 ? ++n3 : --n3)4101                  s4.push(e2[o2]);4102                return s4;4103              }();4104            return t3;4105          }, l = function(t3) {4106            var e2, n2;4107            return n2 = {}, (e2 = t3.getLastAttribute()) && (n2[e2] = true), n2;4108          }, c.prototype.getAttachmentById = function(t3) {4109            var e2, n2, i2, o2;4110            for (o2 = this.getAttachments(), n2 = 0, i2 = o2.length; i2 > n2; n2++)4111              if (e2 = o2[n2], e2.id === t3)4112                return e2;4113          }, c.prototype.getAttachmentPieces = function() {4114            var t3;4115            return t3 = [], this.blockList.eachObject(function(e2) {4116              var n2;4117              return n2 = e2.text, t3 = t3.concat(n2.getAttachmentPieces());4118            }), t3;4119          }, c.prototype.getAttachments = function() {4120            var t3, e2, n2, i2, o2;4121            for (i2 = this.getAttachmentPieces(), o2 = [], t3 = 0, e2 = i2.length; e2 > t3; t3++)4122              n2 = i2[t3], o2.push(n2.attachment);4123            return o2;4124          }, c.prototype.getRangeOfAttachment = function(t3) {4125            var e2, n2, o2, r2, s3, a2, u2;4126            for (r2 = 0, s3 = this.blockList.toArray(), n2 = e2 = 0, o2 = s3.length; o2 > e2; n2 = ++e2) {4127              if (a2 = s3[n2].text, u2 = a2.getRangeOfAttachment(t3))4128                return i([r2 + u2[0], r2 + u2[1]]);4129              r2 += a2.getLength();4130            }4131          }, c.prototype.getLocationRangeOfAttachment = function(t3) {4132            var e2;4133            return e2 = this.getRangeOfAttachment(t3), this.locationRangeFromRange(e2);4134          }, c.prototype.getAttachmentPieceForAttachment = function(t3) {4135            var e2, n2, i2, o2;4136            for (o2 = this.getAttachmentPieces(), e2 = 0, n2 = o2.length; n2 > e2; e2++)4137              if (i2 = o2[e2], i2.attachment === t3)4138                return i2;4139          }, c.prototype.findRangesForBlockAttribute = function(t3) {4140            var e2, n2, i2, o2, r2, s3, a2;4141            for (r2 = 0, s3 = [], a2 = this.getBlocks(), n2 = 0, i2 = a2.length; i2 > n2; n2++)4142              e2 = a2[n2], o2 = e2.getLength(), e2.hasAttribute(t3) && s3.push([r2, r2 + o2]), r2 += o2;4143            return s3;4144          }, c.prototype.findRangesForTextAttribute = function(t3, e2) {4145            var n2, i2, o2, r2, s3, a2, u2, c2, l2, h;4146            for (h = (e2 != null ? e2 : {}).withValue, a2 = 0, u2 = [], c2 = [], r2 = function(e3) {4147              return h != null ? e3.getAttribute(t3) === h : e3.hasAttribute(t3);4148            }, l2 = this.getPieces(), n2 = 0, i2 = l2.length; i2 > n2; n2++)4149              s3 = l2[n2], o2 = s3.getLength(), r2(s3) && (u2[1] === a2 ? u2[1] = a2 + o2 : c2.push(u2 = [a2, a2 + o2])), a2 += o2;4150            return c2;4151          }, c.prototype.locationFromPosition = function(t3) {4152            var e2, n2;4153            return n2 = this.blockList.findIndexAndOffsetAtPosition(Math.max(0, t3)), n2.index != null ? n2 : (e2 = this.getBlocks(), {index: e2.length - 1, offset: e2[e2.length - 1].getLength()});4154          }, c.prototype.positionFromLocation = function(t3) {4155            return this.blockList.findPositionAtIndexAndOffset(t3.index, t3.offset);4156          }, c.prototype.locationRangeFromPosition = function(t3) {4157            return i(this.locationFromPosition(t3));4158          }, c.prototype.locationRangeFromRange = function(t3) {4159            var e2, n2, o2, r2;4160            if (t3 = i(t3))4161              return r2 = t3[0], n2 = t3[1], o2 = this.locationFromPosition(r2), e2 = this.locationFromPosition(n2), i([o2, e2]);4162          }, c.prototype.rangeFromLocationRange = function(t3) {4163            var e2, n2;4164            return t3 = i(t3), e2 = this.positionFromLocation(t3[0]), o(t3) || (n2 = this.positionFromLocation(t3[1])), i([e2, n2]);4165          }, c.prototype.isEqualTo = function(t3) {4166            return this.blockList.isEqualTo(t3 != null ? t3.blockList : void 0);4167          }, c.prototype.getTexts = function() {4168            var t3, e2, n2, i2, o2;4169            for (i2 = this.getBlocks(), o2 = [], e2 = 0, n2 = i2.length; n2 > e2; e2++)4170              t3 = i2[e2], o2.push(t3.text);4171            return o2;4172          }, c.prototype.getPieces = function() {4173            var t3, e2, n2, i2, o2;4174            for (n2 = [], i2 = this.getTexts(), t3 = 0, e2 = i2.length; e2 > t3; t3++)4175              o2 = i2[t3], n2.push.apply(n2, o2.getPieces());4176            return n2;4177          }, c.prototype.getObjects = function() {4178            return this.getBlocks().concat(this.getTexts()).concat(this.getPieces());4179          }, c.prototype.toSerializableDocument = function() {4180            var t3;4181            return t3 = [], this.blockList.eachObject(function(e2) {4182              return t3.push(e2.copyWithText(e2.text.toSerializableText()));4183            }), new this.constructor(t3);4184          }, c.prototype.toString = function() {4185            return this.blockList.toString();4186          }, c.prototype.toJSON = function() {4187            return this.blockList.toJSON();4188          }, c.prototype.toConsole = function() {4189            var t3;4190            return JSON.stringify(function() {4191              var e2, n2, i2, o2;4192              for (i2 = this.blockList.toArray(), o2 = [], e2 = 0, n2 = i2.length; n2 > e2; e2++)4193                t3 = i2[e2], o2.push(JSON.parse(t3.text.toConsole()));4194              return o2;4195            }.call(this));4196          }, c;4197        }(e.Object);4198      }.call(this), function() {4199        e.LineBreakInsertion = function() {4200          function t2(t3) {4201            var e2;4202            this.composition = t3, this.document = this.composition.document, e2 = this.composition.getSelectedRange(), this.startPosition = e2[0], this.endPosition = e2[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);4203          }4204          return t2.prototype.shouldInsertBlockBreak = function() {4205            return this.block.hasAttributes() && this.block.isListItem() && !this.block.isEmpty() ? this.startLocation.offset !== 0 : this.breaksOnReturn && this.nextCharacter !== "\n";4206          }, t2.prototype.shouldBreakFormattedBlock = function() {4207            return this.block.hasAttributes() && !this.block.isListItem() && (this.breaksOnReturn && this.nextCharacter === "\n" || this.previousCharacter === "\n");4208          }, t2.prototype.shouldDecreaseListLevel = function() {4209            return this.block.hasAttributes() && this.block.isListItem() && this.block.isEmpty();4210          }, t2.prototype.shouldPrependListItem = function() {4211            return this.block.isListItem() && this.startLocation.offset === 0 && !this.block.isEmpty();4212          }, t2.prototype.shouldRemoveLastBlockAttribute = function() {4213            return this.block.hasAttributes() && !this.block.isListItem() && this.block.isEmpty();4214          }, t2;4215        }();4216      }.call(this), function() {4217        var t2, n, i, o, r, s, a, u, c, l, h = function(t3, e2) {4218          function n2() {4219            this.constructor = t3;4220          }4221          for (var i2 in e2)4222            p.call(e2, i2) && (t3[i2] = e2[i2]);4223          return n2.prototype = e2.prototype, t3.prototype = new n2(), t3.__super__ = e2.prototype, t3;4224        }, p = {}.hasOwnProperty;4225        s = e.normalizeRange, c = e.rangesAreEqual, u = e.rangeIsCollapsed, a = e.objectsAreEqual, t2 = e.arrayStartsWith, l = e.summarizeArrayChange, i = e.getAllAttributeNames, o = e.getBlockConfig, r = e.getTextConfig, n = e.extend, e.Composition = function(p2) {4226          function d() {4227            this.document = new e.Document(), this.attachments = [], this.currentAttributes = {}, this.revision = 0;4228          }4229          var f;4230          return h(d, p2), d.prototype.setDocument = function(t3) {4231            var e2;4232            return t3.isEqualTo(this.document) ? void 0 : (this.document = t3, this.refreshAttachments(), this.revision++, (e2 = this.delegate) != null && typeof e2.compositionDidChangeDocument == "function" ? e2.compositionDidChangeDocument(t3) : void 0);4233          }, d.prototype.getSnapshot = function() {4234            return {document: this.document, selectedRange: this.getSelectedRange()};4235          }, d.prototype.loadSnapshot = function(t3) {4236            var n2, i2, o2, r2;4237            return n2 = t3.document, r2 = t3.selectedRange, (i2 = this.delegate) != null && typeof i2.compositionWillLoadSnapshot == "function" && i2.compositionWillLoadSnapshot(), this.setDocument(n2 != null ? n2 : new e.Document()), this.setSelection(r2 != null ? r2 : [0, 0]), (o2 = this.delegate) != null && typeof o2.compositionDidLoadSnapshot == "function" ? o2.compositionDidLoadSnapshot() : void 0;4238          }, d.prototype.insertText = function(t3, e2) {4239            var n2, i2, o2, r2;4240            return r2 = (e2 != null ? e2 : {updatePosition: true}).updatePosition, i2 = this.getSelectedRange(), this.setDocument(this.document.insertTextAtRange(t3, i2)), o2 = i2[0], n2 = o2 + t3.getLength(), r2 && this.setSelection(n2), this.notifyDelegateOfInsertionAtRange([o2, n2]);4241          }, d.prototype.insertBlock = function(t3) {4242            var n2;4243            return t3 == null && (t3 = new e.Block()), n2 = new e.Document([t3]), this.insertDocument(n2);4244          }, d.prototype.insertDocument = function(t3) {4245            var n2, i2, o2;4246            return t3 == null && (t3 = new e.Document()), i2 = this.getSelectedRange(), this.setDocument(this.document.insertDocumentAtRange(t3, i2)), o2 = i2[0], n2 = o2 + t3.getLength(), this.setSelection(n2), this.notifyDelegateOfInsertionAtRange([o2, n2]);4247          }, d.prototype.insertString = function(t3, n2) {4248            var i2, o2;4249            return i2 = this.getCurrentTextAttributes(), o2 = e.Text.textForStringWithAttributes(t3, i2), this.insertText(o2, n2);4250          }, d.prototype.insertBlockBreak = function() {4251            var t3, e2, n2;4252            return e2 = this.getSelectedRange(), this.setDocument(this.document.insertBlockBreakAtRange(e2)), n2 = e2[0], t3 = n2 + 1, this.setSelection(t3), this.notifyDelegateOfInsertionAtRange([n2, t3]);4253          }, d.prototype.insertLineBreak = function() {4254            var t3, n2;4255            return n2 = new e.LineBreakInsertion(this), n2.shouldDecreaseListLevel() ? (this.decreaseListLevel(), this.setSelection(n2.startPosition)) : n2.shouldPrependListItem() ? (t3 = new e.Document([n2.block.copyWithoutText()]), this.insertDocument(t3)) : n2.shouldInsertBlockBreak() ? this.insertBlockBreak() : n2.shouldRemoveLastBlockAttribute() ? this.removeLastBlockAttribute() : n2.shouldBreakFormattedBlock() ? this.breakFormattedBlock(n2) : this.insertString("\n");4256          }, d.prototype.insertHTML = function(t3) {4257            var n2, i2, o2, r2;4258            return n2 = e.Document.fromHTML(t3), o2 = this.getSelectedRange(), this.setDocument(this.document.mergeDocumentAtRange(n2, o2)), r2 = o2[0], i2 = r2 + n2.getLength() - 1, this.setSelection(i2), this.notifyDelegateOfInsertionAtRange([r2, i2]);4259          }, d.prototype.replaceHTML = function(t3) {4260            var n2, i2, o2;4261            return n2 = e.Document.fromHTML(t3).copyUsingObjectsFromDocument(this.document), i2 = this.getLocationRange({strict: false}), o2 = this.document.rangeFromLocationRange(i2), this.setDocument(n2), this.setSelection(o2);4262          }, d.prototype.insertFile = function(t3) {4263            return this.insertFiles([t3]);4264          }, d.prototype.insertFiles = function(t3) {4265            var n2, i2, o2, r2, s2, a2;4266            for (i2 = [], r2 = 0, s2 = t3.length; s2 > r2; r2++)4267              o2 = t3[r2], ((a2 = this.delegate) != null ? a2.compositionShouldAcceptFile(o2) : void 0) && (n2 = e.Attachment.attachmentForFile(o2), i2.push(n2));4268            return this.insertAttachments(i2);4269          }, d.prototype.insertAttachment = function(t3) {4270            return this.insertAttachments([t3]);4271          }, d.prototype.insertAttachments = function(t3) {4272            var n2, i2, o2, r2, s2, a2, u2, c2, l2;4273            for (c2 = new e.Text(), r2 = 0, s2 = t3.length; s2 > r2; r2++)4274              n2 = t3[r2], l2 = n2.getType(), a2 = (u2 = e.config.attachments[l2]) != null ? u2.presentation : void 0, o2 = this.getCurrentTextAttributes(), a2 && (o2.presentation = a2), i2 = e.Text.textForAttachmentWithAttributes(n2, o2), c2 = c2.appendText(i2);4275            return this.insertText(c2);4276          }, d.prototype.shouldManageDeletingInDirection = function(t3) {4277            var e2;4278            if (e2 = this.getLocationRange(), u(e2)) {4279              if (t3 === "backward" && e2[0].offset === 0)4280                return true;4281              if (this.shouldManageMovingCursorInDirection(t3))4282                return true;4283            } else if (e2[0].index !== e2[1].index)4284              return true;4285            return false;4286          }, d.prototype.deleteInDirection = function(t3, e2) {4287            var n2, i2, o2, r2, s2, a2, c2, l2;4288            return r2 = (e2 != null ? e2 : {}).length, s2 = this.getLocationRange(), a2 = this.getSelectedRange(), c2 = u(a2), c2 ? o2 = t3 === "backward" && s2[0].offset === 0 : l2 = s2[0].index !== s2[1].index, o2 && this.canDecreaseBlockAttributeLevel() && (i2 = this.getBlock(), i2.isListItem() ? this.decreaseListLevel() : this.decreaseBlockAttributeLevel(), this.setSelection(a2[0]), i2.isEmpty()) ? false : (c2 && (a2 = this.getExpandedRangeInDirection(t3, {length: r2}), t3 === "backward" && (n2 = this.getAttachmentAtRange(a2))), n2 ? (this.editAttachment(n2), false) : (this.setDocument(this.document.removeTextAtRange(a2)), this.setSelection(a2[0]), o2 || l2 ? false : void 0));4289          }, d.prototype.moveTextFromRange = function(t3) {4290            var e2;4291            return e2 = this.getSelectedRange()[0], this.setDocument(this.document.moveTextFromRangeToPosition(t3, e2)), this.setSelection(e2);4292          }, d.prototype.removeAttachment = function(t3) {4293            var e2;4294            return (e2 = this.document.getRangeOfAttachment(t3)) ? (this.stopEditingAttachment(), this.setDocument(this.document.removeTextAtRange(e2)), this.setSelection(e2[0])) : void 0;4295          }, d.prototype.removeLastBlockAttribute = function() {4296            var t3, e2, n2, i2;4297            return n2 = this.getSelectedRange(), i2 = n2[0], e2 = n2[1], t3 = this.document.getBlockAtPosition(e2), this.removeCurrentAttribute(t3.getLastAttribute()), this.setSelection(i2);4298          }, f = " ", d.prototype.insertPlaceholder = function() {4299            return this.placeholderPosition = this.getPosition(), this.insertString(f);4300          }, d.prototype.selectPlaceholder = function() {4301            return this.placeholderPosition != null ? (this.setSelectedRange([this.placeholderPosition, this.placeholderPosition + f.length]), this.getSelectedRange()) : void 0;4302          }, d.prototype.forgetPlaceholder = function() {4303            return this.placeholderPosition = null;4304          }, d.prototype.hasCurrentAttribute = function(t3) {4305            var e2;4306            return e2 = this.currentAttributes[t3], e2 != null && e2 !== false;4307          }, d.prototype.toggleCurrentAttribute = function(t3) {4308            var e2;4309            return (e2 = !this.currentAttributes[t3]) ? this.setCurrentAttribute(t3, e2) : this.removeCurrentAttribute(t3);4310          }, d.prototype.canSetCurrentAttribute = function(t3) {4311            return o(t3) ? this.canSetCurrentBlockAttribute(t3) : this.canSetCurrentTextAttribute(t3);4312          }, d.prototype.canSetCurrentTextAttribute = function() {4313            var t3, e2, n2, i2, o2;4314            if (e2 = this.getSelectedDocument()) {4315              for (o2 = e2.getAttachments(), n2 = 0, i2 = o2.length; i2 > n2; n2++)4316                if (t3 = o2[n2], !t3.hasContent())4317                  return false;4318              return true;4319            }4320          }, d.prototype.canSetCurrentBlockAttribute = function() {4321            var t3;4322            if (t3 = this.getBlock())4323              return !t3.isTerminalBlock();4324          }, d.prototype.setCurrentAttribute = function(t3, e2) {4325            return o(t3) ? this.setBlockAttribute(t3, e2) : (this.setTextAttribute(t3, e2), this.currentAttributes[t3] = e2, this.notifyDelegateOfCurrentAttributesChange());4326          }, d.prototype.setTextAttribute = function(t3, n2) {4327            var i2, o2, r2, s2;4328            if (o2 = this.getSelectedRange())4329              return r2 = o2[0], i2 = o2[1], r2 !== i2 ? this.setDocument(this.document.addAttributeAtRange(t3, n2, o2)) : t3 === "href" ? (s2 = e.Text.textForStringWithAttributes(n2, {href: n2}), this.insertText(s2)) : void 0;4330          }, d.prototype.setBlockAttribute = function(t3, e2) {4331            var n2, i2;4332            if (i2 = this.getSelectedRange())4333              return this.canSetCurrentAttribute(t3) ? (n2 = this.getBlock(), this.setDocument(this.document.applyBlockAttributeAtRange(t3, e2, i2)), this.setSelection(i2)) : void 0;4334          }, d.prototype.removeCurrentAttribute = function(t3) {4335            return o(t3) ? (this.removeBlockAttribute(t3), this.updateCurrentAttributes()) : (this.removeTextAttribute(t3), delete this.currentAttributes[t3], this.notifyDelegateOfCurrentAttributesChange());4336          }, d.prototype.removeTextAttribute = function(t3) {4337            var e2;4338            if (e2 = this.getSelectedRange())4339              return this.setDocument(this.document.removeAttributeAtRange(t3, e2));4340          }, d.prototype.removeBlockAttribute = function(t3) {4341            var e2;4342            if (e2 = this.getSelectedRange())4343              return this.setDocument(this.document.removeAttributeAtRange(t3, e2));4344          }, d.prototype.canDecreaseNestingLevel = function() {4345            var t3;4346            return ((t3 = this.getBlock()) != null ? t3.getNestingLevel() : void 0) > 0;4347          }, d.prototype.canIncreaseNestingLevel = function() {4348            var e2, n2, i2;4349            if (e2 = this.getBlock())4350              return ((i2 = o(e2.getLastNestableAttribute())) != null ? i2.listAttribute : 0) ? (n2 = this.getPreviousBlock()) ? t2(n2.getListItemAttributes(), e2.getListItemAttributes()) : void 0 : e2.getNestingLevel() > 0;4351          }, d.prototype.decreaseNestingLevel = function() {4352            var t3;4353            if (t3 = this.getBlock())4354              return this.setDocument(this.document.replaceBlock(t3, t3.decreaseNestingLevel()));4355          }, d.prototype.increaseNestingLevel = function() {4356            var t3;4357            if (t3 = this.getBlock())4358              return this.setDocument(this.document.replaceBlock(t3, t3.increaseNestingLevel()));4359          }, d.prototype.canDecreaseBlockAttributeLevel = function() {4360            var t3;4361            return ((t3 = this.getBlock()) != null ? t3.getAttributeLevel() : void 0) > 0;4362          }, d.prototype.decreaseBlockAttributeLevel = function() {4363            var t3, e2;4364            return (t3 = (e2 = this.getBlock()) != null ? e2.getLastAttribute() : void 0) ? this.removeCurrentAttribute(t3) : void 0;4365          }, d.prototype.decreaseListLevel = function() {4366            var t3, e2, n2, i2, o2, r2;4367            for (r2 = this.getSelectedRange()[0], o2 = this.document.locationFromPosition(r2).index, n2 = o2, t3 = this.getBlock().getAttributeLevel(); (e2 = this.document.getBlockAtIndex(n2 + 1)) && e2.isListItem() && e2.getAttributeLevel() > t3; )4368              n2++;4369            return r2 = this.document.positionFromLocation({index: o2, offset: 0}), i2 = this.document.positionFromLocation({index: n2, offset: 0}), this.setDocument(this.document.removeLastListAttributeAtRange([r2, i2]));4370          }, d.prototype.updateCurrentAttributes = function() {4371            var t3, e2, n2, o2, r2, s2;4372            if (s2 = this.getSelectedRange({ignoreLock: true})) {4373              for (e2 = this.document.getCommonAttributesAtRange(s2), r2 = i(), n2 = 0, o2 = r2.length; o2 > n2; n2++)4374                t3 = r2[n2], e2[t3] || this.canSetCurrentAttribute(t3) || (e2[t3] = false);4375              if (!a(e2, this.currentAttributes))4376                return this.currentAttributes = e2, this.notifyDelegateOfCurrentAttributesChange();4377            }4378          }, d.prototype.getCurrentAttributes = function() {4379            return n.call({}, this.currentAttributes);4380          }, d.prototype.getCurrentTextAttributes = function() {4381            var t3, e2, n2, i2;4382            t3 = {}, n2 = this.currentAttributes;4383            for (e2 in n2)4384              i2 = n2[e2], i2 !== false && r(e2) && (t3[e2] = i2);4385            return t3;4386          }, d.prototype.freezeSelection = function() {4387            return this.setCurrentAttribute("frozen", true);4388          }, d.prototype.thawSelection = function() {4389            return this.removeCurrentAttribute("frozen");4390          }, d.prototype.hasFrozenSelection = function() {4391            return this.hasCurrentAttribute("frozen");4392          }, d.proxyMethod("getSelectionManager().getPointRange"), d.proxyMethod("getSelectionManager().setLocationRangeFromPointRange"), d.proxyMethod("getSelectionManager().createLocationRangeFromDOMRange"), d.proxyMethod("getSelectionManager().locationIsCursorTarget"), d.proxyMethod("getSelectionManager().selectionIsExpanded"), d.proxyMethod("delegate?.getSelectionManager"), d.prototype.setSelection = function(t3) {4393            var e2, n2;4394            return e2 = this.document.locationRangeFromRange(t3), (n2 = this.delegate) != null ? n2.compositionDidRequestChangingSelectionToLocationRange(e2) : void 0;4395          }, d.prototype.getSelectedRange = function() {4396            var t3;4397            return (t3 = this.getLocationRange()) ? this.document.rangeFromLocationRange(t3) : void 0;4398          }, d.prototype.setSelectedRange = function(t3) {4399            var e2;4400            return e2 = this.document.locationRangeFromRange(t3), this.getSelectionManager().setLocationRange(e2);4401          }, d.prototype.getPosition = function() {4402            var t3;4403            return (t3 = this.getLocationRange()) ? this.document.positionFromLocation(t3[0]) : void 0;4404          }, d.prototype.getLocationRange = function(t3) {4405            var e2, n2;4406            return (e2 = (n2 = this.targetLocationRange) != null ? n2 : this.getSelectionManager().getLocationRange(t3)) != null ? e2 : s({index: 0, offset: 0});4407          }, d.prototype.withTargetLocationRange = function(t3, e2) {4408            var n2;4409            this.targetLocationRange = t3;4410            try {4411              n2 = e2();4412            } finally {4413              this.targetLocationRange = null;4414            }4415            return n2;4416          }, d.prototype.withTargetRange = function(t3, e2) {4417            var n2;4418            return n2 = this.document.locationRangeFromRange(t3), this.withTargetLocationRange(n2, e2);4419          }, d.prototype.withTargetDOMRange = function(t3, e2) {4420            var n2;4421            return n2 = this.createLocationRangeFromDOMRange(t3, {strict: false}), this.withTargetLocationRange(n2, e2);4422          }, d.prototype.getExpandedRangeInDirection = function(t3, e2) {4423            var n2, i2, o2, r2;4424            return i2 = (e2 != null ? e2 : {}).length, o2 = this.getSelectedRange(), r2 = o2[0], n2 = o2[1], t3 === "backward" ? i2 ? r2 -= i2 : r2 = this.translateUTF16PositionFromOffset(r2, -1) : i2 ? n2 += i2 : n2 = this.translateUTF16PositionFromOffset(n2, 1), s([r2, n2]);4425          }, d.prototype.shouldManageMovingCursorInDirection = function(t3) {4426            var e2;4427            return this.editingAttachment ? true : (e2 = this.getExpandedRangeInDirection(t3), this.getAttachmentAtRange(e2) != null);4428          }, d.prototype.moveCursorInDirection = function(t3) {4429            var e2, n2, i2, o2;4430            return this.editingAttachment ? i2 = this.document.getRangeOfAttachment(this.editingAttachment) : (o2 = this.getSelectedRange(), i2 = this.getExpandedRangeInDirection(t3), n2 = !c(o2, i2)), this.setSelectedRange(t3 === "backward" ? i2[0] : i2[1]), n2 && (e2 = this.getAttachmentAtRange(i2)) ? this.editAttachment(e2) : void 0;4431          }, d.prototype.expandSelectionInDirection = function(t3, e2) {4432            var n2, i2;4433            return n2 = (e2 != null ? e2 : {}).length, i2 = this.getExpandedRangeInDirection(t3, {length: n2}), this.setSelectedRange(i2);4434          }, d.prototype.expandSelectionForEditing = function() {4435            return this.hasCurrentAttribute("href") ? this.expandSelectionAroundCommonAttribute("href") : void 0;4436          }, d.prototype.expandSelectionAroundCommonAttribute = function(t3) {4437            var e2, n2;4438            return e2 = this.getPosition(), n2 = this.document.getRangeOfCommonAttributeAtPosition(t3, e2), this.setSelectedRange(n2);4439          }, d.prototype.selectionContainsAttachments = function() {4440            var t3;4441            return ((t3 = this.getSelectedAttachments()) != null ? t3.length : void 0) > 0;4442          }, d.prototype.selectionIsInCursorTarget = function() {4443            return this.editingAttachment || this.positionIsCursorTarget(this.getPosition());4444          }, d.prototype.positionIsCursorTarget = function(t3) {4445            var e2;4446            return (e2 = this.document.locationFromPosition(t3)) ? this.locationIsCursorTarget(e2) : void 0;4447          }, d.prototype.positionIsBlockBreak = function(t3) {4448            var e2;4449            return (e2 = this.document.getPieceAtPosition(t3)) != null ? e2.isBlockBreak() : void 0;4450          }, d.prototype.getSelectedDocument = function() {4451            var t3;4452            return (t3 = this.getSelectedRange()) ? this.document.getDocumentAtRange(t3) : void 0;4453          }, d.prototype.getSelectedAttachments = function() {4454            var t3;4455            return (t3 = this.getSelectedDocument()) != null ? t3.getAttachments() : void 0;4456          }, d.prototype.getAttachments = function() {4457            return this.attachments.slice(0);4458          }, d.prototype.refreshAttachments = function() {4459            var t3, e2, n2, i2, o2, r2, s2, a2, u2, c2, h2, p3;4460            for (n2 = this.document.getAttachments(), a2 = l(this.attachments, n2), t3 = a2.added, h2 = a2.removed, this.attachments = n2, i2 = 0, r2 = h2.length; r2 > i2; i2++)4461              e2 = h2[i2], e2.delegate = null, (u2 = this.delegate) != null && typeof u2.compositionDidRemoveAttachment == "function" && u2.compositionDidRemoveAttachment(e2);4462            for (p3 = [], o2 = 0, s2 = t3.length; s2 > o2; o2++)4463              e2 = t3[o2], e2.delegate = this, p3.push((c2 = this.delegate) != null && typeof c2.compositionDidAddAttachment == "function" ? c2.compositionDidAddAttachment(e2) : void 0);4464            return p3;4465          }, d.prototype.attachmentDidChangeAttributes = function(t3) {4466            var e2;4467            return this.revision++, (e2 = this.delegate) != null && typeof e2.compositionDidEditAttachment == "function" ? e2.compositionDidEditAttachment(t3) : void 0;4468          }, d.prototype.attachmentDidChangePreviewURL = function(t3) {4469            var e2;4470            return this.revision++, (e2 = this.delegate) != null && typeof e2.compositionDidChangeAttachmentPreviewURL == "function" ? e2.compositionDidChangeAttachmentPreviewURL(t3) : void 0;4471          }, d.prototype.editAttachment = function(t3, e2) {4472            var n2;4473            if (t3 !== this.editingAttachment)4474              return this.stopEditingAttachment(), this.editingAttachment = t3, (n2 = this.delegate) != null && typeof n2.compositionDidStartEditingAttachment == "function" ? n2.compositionDidStartEditingAttachment(this.editingAttachment, e2) : void 0;4475          }, d.prototype.stopEditingAttachment = function() {4476            var t3;4477            if (this.editingAttachment)4478              return (t3 = this.delegate) != null && typeof t3.compositionDidStopEditingAttachment == "function" && t3.compositionDidStopEditingAttachment(this.editingAttachment), this.editingAttachment = null;4479          }, d.prototype.updateAttributesForAttachment = function(t3, e2) {4480            return this.setDocument(this.document.updateAttributesForAttachment(t3, e2));4481          }, d.prototype.removeAttributeForAttachment = function(t3, e2) {4482            return this.setDocument(this.document.removeAttributeForAttachment(t3, e2));4483          }, d.prototype.breakFormattedBlock = function(t3) {4484            var n2, i2, o2, r2, s2;4485            return i2 = t3.document, n2 = t3.block, r2 = t3.startPosition, s2 = [r2 - 1, r2], n2.getBlockBreakPosition() === t3.startLocation.offset ? (n2.breaksOnReturn() && t3.nextCharacter === "\n" ? r2 += 1 : i2 = i2.removeTextAtRange(s2), s2 = [r2, r2]) : t3.nextCharacter === "\n" ? t3.previousCharacter === "\n" ? s2 = [r2 - 1, r2 + 1] : (s2 = [r2, r2 + 1], r2 += 1) : t3.startLocation.offset - 1 !== 0 && (r2 += 1), o2 = new e.Document([n2.removeLastAttribute().copyWithoutText()]), this.setDocument(i2.insertDocumentAtRange(o2, s2)), this.setSelection(r2);4486          }, d.prototype.getPreviousBlock = function() {4487            var t3, e2;4488            return (e2 = this.getLocationRange()) && (t3 = e2[0].index, t3 > 0) ? this.document.getBlockAtIndex(t3 - 1) : void 0;4489          }, d.prototype.getBlock = function() {4490            var t3;4491            return (t3 = this.getLocationRange()) ? this.document.getBlockAtIndex(t3[0].index) : void 0;4492          }, d.prototype.getAttachmentAtRange = function(t3) {4493            var n2;4494            return n2 = this.document.getDocumentAtRange(t3), n2.toString() === e.OBJECT_REPLACEMENT_CHARACTER + "\n" ? n2.getAttachments()[0] : void 0;4495          }, d.prototype.notifyDelegateOfCurrentAttributesChange = function() {4496            var t3;4497            return (t3 = this.delegate) != null && typeof t3.compositionDidChangeCurrentAttributes == "function" ? t3.compositionDidChangeCurrentAttributes(this.currentAttributes) : void 0;4498          }, d.prototype.notifyDelegateOfInsertionAtRange = function(t3) {4499            var e2;4500            return (e2 = this.delegate) != null && typeof e2.compositionDidPerformInsertionAtRange == "function" ? e2.compositionDidPerformInsertionAtRange(t3) : void 0;4501          }, d.prototype.translateUTF16PositionFromOffset = function(t3, e2) {4502            var n2, i2;4503            return i2 = this.document.toUTF16String(), n2 = i2.offsetFromUCS2Offset(t3), i2.offsetToUCS2Offset(n2 + e2);4504          }, d;4505        }(e.BasicObject);4506      }.call(this), function() {4507        var t2 = function(t3, e2) {4508          function i() {4509            this.constructor = t3;4510          }4511          for (var o in e2)4512            n.call(e2, o) && (t3[o] = e2[o]);4513          return i.prototype = e2.prototype, t3.prototype = new i(), t3.__super__ = e2.prototype, t3;4514        }, n = {}.hasOwnProperty;4515        e.UndoManager = function(e2) {4516          function n2(t3) {4517            this.composition = t3, this.undoEntries = [], this.redoEntries = [];4518          }4519          var i;4520          return t2(n2, e2), n2.prototype.recordUndoEntry = function(t3, e3) {4521            var n3, o, r, s, a;4522            return s = e3 != null ? e3 : {}, o = s.context, n3 = s.consolidatable, r = this.undoEntries.slice(-1)[0], n3 && i(r, t3, o) ? void 0 : (a = this.createEntry({description: t3, context: o}), this.undoEntries.push(a), this.redoEntries = []);4523          }, n2.prototype.undo = function() {4524            var t3, e3;4525            return (e3 = this.undoEntries.pop()) ? (t3 = this.createEntry(e3), this.redoEntries.push(t3), this.composition.loadSnapshot(e3.snapshot)) : void 0;4526          }, n2.prototype.redo = function() {4527            var t3, e3;4528            return (t3 = this.redoEntries.pop()) ? (e3 = this.createEntry(t3), this.undoEntries.push(e3), this.composition.loadSnapshot(t3.snapshot)) : void 0;4529          }, n2.prototype.canUndo = function() {4530            return this.undoEntries.length > 0;4531          }, n2.prototype.canRedo = function() {4532            return this.redoEntries.length > 0;4533          }, n2.prototype.createEntry = function(t3) {4534            var e3, n3, i2;4535            return i2 = t3 != null ? t3 : {}, n3 = i2.description, e3 = i2.context, {description: n3 != null ? n3.toString() : void 0, context: JSON.stringify(e3), snapshot: this.composition.getSnapshot()};4536          }, i = function(t3, e3, n3) {4537            return (t3 != null ? t3.description : void 0) === (e3 != null ? e3.toString() : void 0) && (t3 != null ? t3.context : void 0) === JSON.stringify(n3);4538          }, n2;4539        }(e.BasicObject);4540      }.call(this), function() {4541        var t2;4542        e.attachmentGalleryFilter = function(e2) {4543          var n;4544          return n = new t2(e2), n.perform(), n.getSnapshot();4545        }, t2 = function() {4546          function t3(t4) {4547            this.document = t4.document, this.selectedRange = t4.selectedRange;4548          }4549          var e2, n, i;4550          return e2 = "attachmentGallery", n = "presentation", i = "gallery", t3.prototype.perform = function() {4551            return this.removeBlockAttribute(), this.applyBlockAttribute();4552          }, t3.prototype.getSnapshot = function() {4553            return {document: this.document, selectedRange: this.selectedRange};4554          }, t3.prototype.removeBlockAttribute = function() {4555            var t4, n2, i2, o, r;4556            for (o = this.findRangesOfBlocks(), r = [], t4 = 0, n2 = o.length; n2 > t4; t4++)4557              i2 = o[t4], r.push(this.document = this.document.removeAttributeAtRange(e2, i2));4558            return r;4559          }, t3.prototype.applyBlockAttribute = function() {4560            var t4, n2, i2, o, r, s;...redux-saga_v0.16.x.js
Source:redux-saga_v0.16.x.js  
1// flow-typed signature: d6d868868c26bb67334ba496927d4a482// flow-typed version: 4940ac8b5a/redux-saga_v0.16.x/flow_>=v0.56.03// @flow4declare module "redux-saga" {5  import typeof * as _effects from "redux-saga/effects";6  declare export var effects: _effects;7  declare export interface Channel {8    take: (cb: (msg: mixed) => void) => void;9    put: (msg: mixed) => void;10    flush: (cb: (msgs: mixed) => void) => void;11    close: () => void;12  }13  declare export interface Task<T> {14    isRunning: () => boolean;15    isCancelled: () => boolean;16    result: () => T | void;17    error: () => Error | void;18    cancel: () => void;19    done: Promise<T>;20  }21  declare export interface Buffer {22    isEmpty: () => boolean;23    put: (msg: mixed) => void;24    take(): mixed;25  }26  declare export interface SagaMonitor {27    effectTriggered: (options: {28      +effectId: number,29      +parentEffectId: number,30      +label: string,31      +effect: Effect32    }) => void;33    effectResolved: (effectId: number, result: mixed) => void;34    effectRejected: (effectId: number, error: Error) => void;35    effectCancelled: (effectId: number) => void;36    actionDispatched: (action: mixed) => void;37  }38  declare export type Saga<T> = Generator<Effect, T, any>;39  declare export var eventChannel: (40    sub: (emit: (msg: any) => void) => () => void,41    buffer?: Buffer,42    matcher?: (msg: mixed) => boolean43  ) => Channel;44  declare export var buffers: {45    +none: () => Buffer,46    +fixed: (limit?: number) => Buffer,47    +dropping: (limit?: number) => Buffer,48    +sliding: (limit?: number) => Buffer,49    +expanding: (initialSize?: number) => Buffer50  };51  declare export var channel: (buffer?: Buffer) => Channel;52  declare export var END: { +type: "@@redux-saga/CHANNEL_END" };53  declare export var CANCEL: Symbol;54  declare export var delay: (timeout: number) => Promise<void>;55  declare type RunSagaOptions = {56    +subscribe?: (emit: (input: any) => any) => () => void,57    +dispatch?: (output: any) => any,58    +getState?: () => any,59    +sagaMonitor?: SagaMonitor,60    +logger?: (61      level: "info" | "warning" | "error",62      ...args: Array<any>63    ) => void,64    +onError?: (error: Error) => void65  };66  declare export var runSaga: {67    <R, Fn: () => Saga<R>>(options: RunSagaOptions, saga: Fn): Task<R>,68    <R, T1, Fn: (t1: T1) => Saga<R>>(69      options: RunSagaOptions,70      saga: Fn,71      t1: T172    ): Task<R>,73    <R, T1, T2, Fn: (t1: T1, t2: T2) => Saga<R>>(74      options: RunSagaOptions,75      saga: Fn,76      t1: T1,77      t2: T278    ): Task<R>,79    <R, T1, T2, T3, Fn: (t1: T1, t2: T2, t3: T3) => Saga<R>>(80      options: RunSagaOptions,81      saga: Fn,82      t1: T1,83      t2: T2,84      t3: T385    ): Task<R>,86    <R, T1, T2, T3, T4, Fn: (t1: T1, t2: T2, t3: T3, t4: T4) => Saga<R>>(87      options: RunSagaOptions,88      saga: Fn,89      t1: T1,90      t2: T2,91      t3: T3,92      t4: T493    ): Task<R>,94    <95      R,96      T1,97      T2,98      T3,99      T4,100      T5,101      Fn: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => Saga<R>102    >(103      options: RunSagaOptions,104      saga: Fn,105      t1: T1,106      t2: T2,107      t3: T3,108      t4: T4,109      t5: T5110    ): Task<R>,111    <112      R,113      T1,114      T2,115      T3,116      T4,117      T5,118      T6,119      Fn: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6) => Saga<R>120    >(121      options: RunSagaOptions,122      saga: Fn,123      t1: T1,124      t2: T2,125      t3: T3,126      t4: T4,127      t5: T5,128      t6: T6129    ): Task<R>130  };131  declare interface SagaMiddleware {132    // TODO: This should be aligned with the official redux typings sometime133    (api: any): (next: any) => any;134    run: {135      <R, Fn: () => Saga<R>>(saga: Fn): Task<R>,136      <R, T1, Fn: (t1: T1) => Saga<R>>(saga: Fn, t1: T1): Task<R>,137      <R, T1, T2, Fn: (t1: T1, t2: T2) => Saga<R>>(138        saga: Fn,139        t1: T1,140        t2: T2141      ): Task<R>,142      <R, T1, T2, T3, Fn: (t1: T1, t2: T2, t3: T3) => Saga<R>>(143        saga: Fn,144        t1: T1,145        t2: T2,146        t3: T3147      ): Task<R>,148      <R, T1, T2, T3, T4, Fn: (t1: T1, t2: T2, t3: T3, t4: T4) => Saga<R>>(149        saga: Fn,150        t1: T1,151        t2: T2,152        t3: T3,153        t4: T4154      ): Task<R>,155      <156        R,157        T1,158        T2,159        T3,160        T4,161        T5,162        Fn: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => Saga<R>163      >(164        saga: Fn,165        t1: T1,166        t2: T2,167        t3: T3,168        t4: T4,169        t5: T5170      ): Task<R>,171      <172        R,173        T1,174        T2,175        T3,176        T4,177        T5,178        T6,179        Fn: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6) => Saga<R>180      >(181        saga: Fn,182        t1: T1,183        t2: T2,184        t3: T3,185        t4: T4,186        t5: T5,187        t6: T6188      ): Task<R>189    };190  }191  declare type createSagaMiddleware = (options?: {192    +sagaMonitor?: SagaMonitor,193    +logger?: (194      level: "info" | "warning" | "error",195      ...args: Array<any>196    ) => void,197    +onError?: (error: Error) => void198  }) => SagaMiddleware;199  declare export default createSagaMiddleware200  // Effect types201  declare export type PatternPart = string | (any => boolean);202  declare export type Pattern = PatternPart | $ReadOnlyArray<PatternPart>;203  declare export type TakeEffect<204    P: Pattern | void,205    C: Channel | void,206    M: true | void207  > = {208    +"@@redux-saga/IO": true,209    +TAKE: {210      +pattern: P,211      +channel: C,212      +maybe: M213    }214  };215  declare export type PutEffect<A: Object, C: Channel | null> = {216    +"@@redux-saga/IO": true,217    +PUT: {218      +action: A,219      +channel: C220    }221  };222  declare export type CallEffect<Ctx, Fn: Function, Args: $ReadOnlyArray<*>> = {223    +"@@redux-saga/IO": true,224    +CALL: {225      +context: Ctx,226      +fn: Fn,227      +args: Args228    }229  };230  declare export type ForkEffect<Ctx, Fn: Function, Args: $ReadOnlyArray<*>> = {231    +"@@redux-saga/IO": true,232    +FORK: {233      +context: Ctx,234      +fn: Fn,235      +args: Args236    }237  };238  declare export type CpsEffect<Ctx, Fn: Function, Args: $ReadOnlyArray<*>> = {239    +"@@redux-saga/IO": true,240    +CPS: {241      +context: Ctx,242      +fn: Fn,243      +args: Args244    }245  };246  declare export type SpawnEffect<247    Ctx,248    Fn: Function,249    Args: $ReadOnlyArray<*>250  > = {251    +"@@redux-saga/IO": true,252    +SPAWN: {253      +context: Ctx,254      +fn: Fn,255      +args: Args256    }257  };258  declare export type JoinEffect<T: Task<*>> = {259    +"@@redux-saga/IO": true,260    +JOIN: T261  };262  declare export type CancelEffect<263    T: Task<*> | "@@redux-saga/SELF_CANCELLATION"264  > = {265    +"@@redux-saga/IO": true,266    +CANCEL: T267  };268  declare export type SelectEffect<Fn: Function | void, Args: $ReadOnlyArray<*>> = {269    +"@@redux-saga/IO": true,270    +SELECT: {271      +selector: Fn,272      +args: Args273    }274  };275  declare export type ActionChannelEffect<P: Pattern, B: Buffer | void> = {276    +"@@redux-saga/IO": true,277    +ACTION_CHANNEL: {278      +buffer: B,279      +pattern: P280    }281  };282  declare export type FlushEffect = {283    +"@@redux-saga/IO": true,284    +FLUSH: Channel285  };286  declare export type CancelledEffect = {287    +"@@redux-saga/IO": true,288    +CANCELLED: {}289  };290  declare export type SetContextEffect<T: {}> = {291    +"@@redux-saga/IO": true,292    +SET_CONTEXT: T293  };294  declare export type GetContextEffect = {295    +"@@redux-saga/IO": true,296    +GET_CONTEXT: string297  };298  declare export type RaceEffect<299    R: { +[name: string]: Effect } | $ReadOnlyArray<Effect>300  > = {301    +"@@redux-saga/IO": true,302    +RACE: R303  };304  declare export type AllEffect = {305    +"@@redux-saga/IO": true,306    +ALL: { +[name: string]: Effect } | $ReadOnlyArray<Effect>307  };308  declare export type Effect =309    | TakeEffect<*, *, *>310    | PutEffect<*, *>311    | CallEffect<*, *, *>312    | ForkEffect<*, *, *>313    | CpsEffect<*, *, *>314    | SpawnEffect<*, *, *>315    | JoinEffect<*>316    | CancelEffect<*>317    | SelectEffect<*, *>318    | ActionChannelEffect<*, *>319    | FlushEffect320    | CancelledEffect321    | SetContextEffect<*>322    | GetContextEffect323    | RaceEffect<*>324    | AllEffect;325}326declare module "redux-saga/effects" {327  import type {328    ActionChannelEffect,329    AllEffect,330    Buffer,331    CallEffect,332    CancelEffect,333    CancelledEffect,334    Channel,335    CpsEffect,336    Effect,337    FlushEffect,338    ForkEffect,339    GetContextEffect,340    JoinEffect,341    Pattern,342    PutEffect,343    RaceEffect,344    Saga,345    SelectEffect,346    SetContextEffect,347    SpawnEffect,348    TakeEffect,349    Task350  } from "redux-saga";351  declare export var take: {352    <P: Pattern>(pattern: P): TakeEffect<P, void, void>,353    (channel: Channel): TakeEffect<void, Channel, void>,354    +maybe: {355      <P: Pattern>(pattern: P): TakeEffect<P, void, true>,356      (channel: Channel): TakeEffect<void, Channel, true>357    }358  };359  declare export var put: {360    <A: Object>(action: A): PutEffect<A, null>,361    <A: Object>(channel: Channel, action: A): PutEffect<A, Channel>,362    resolve: {363      <A: Object>(action: A): PutEffect<A, null>,364      <A: Object>(channel: Channel, action: A): PutEffect<A, Channel>,365    }366  };367  declare export var call: {368    // normal calls369    <R, Fn: () => R>(fn: Fn): CallEffect<null, Fn, []>,370    <R, T1, Fn: (t1: T1) => R>(fn: Fn, t1: T1): CallEffect<null, Fn, [T1]>,371    <R, T1, T2, Fn: (t1: T1, t2: T2) => R>(372      fn: Fn,373      t1: T1,374      t2: T2375    ): CallEffect<null, Fn, [T1, T2]>,376    <R, T1, T2, T3, Fn: (t1: T1, t2: T2, t3: T3) => R>(377      fn: Fn,378      t1: T1,379      t2: T2,380      t3: T3381    ): CallEffect<null, Fn, [T1, T2, T3]>,382    <R, T1, T2, T3, T4, Fn: (t1: T1, t2: T2, t3: T3, t4: T4) => R>(383      fn: Fn,384      t1: T1,385      t2: T2,386      t3: T3,387      t4: T4388    ): CallEffect<null, Fn, [T1, T2, T3, T4]>,389    <R, T1, T2, T3, T4, T5, Fn: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R>(390      fn: Fn,391      t1: T1,392      t2: T2,393      t3: T3,394      t4: T4,395      t5: T5396    ): CallEffect<null, Fn, [T1, T2, T3, T4, T5]>,397    <398      R,399      T1,400      T2,401      T3,402      T4,403      T5,404      T6,405      Fn: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6) => R406    >(407      fn: Fn,408      t1: T1,409      t2: T2,410      t3: T3,411      t4: T4,412      t5: T5,413      t6: T6414    ): CallEffect<null, Fn, [T1, T2, T3, T4, T5, T6]>,415    // with context416    <Ctx, R, Fn: () => R>(cfn: [Ctx, Fn]): CallEffect<Ctx, Fn, []>,417    <Ctx, R, T1, Fn: (t1: T1) => R>(418      cfn: [Ctx, Fn],419      t1: T1420    ): CallEffect<Ctx, Fn, [T1]>,421    <Ctx, R, T1, T2, Fn: (t1: T1, t2: T2) => R>(422      cfn: [Ctx, Fn],423      t1: T1,424      t2: T2425    ): CallEffect<Ctx, Fn, [T1, T2]>,426    <Ctx, R, T1, T2, T3, Fn: (t1: T1, t2: T2, t3: T3) => R>(427      cfn: [Ctx, Fn],428      t1: T1,429      t2: T2,430      t3: T3431    ): CallEffect<Ctx, Fn, [T1, T2, T3]>,432    <Ctx, R, T1, T2, T3, T4, Fn: (t1: T1, t2: T2, t3: T3, t4: T4) => R>(433      cfn: [Ctx, Fn],434      t1: T1,435      t2: T2,436      t3: T3,437      t4: T4438    ): CallEffect<Ctx, Fn, [T1, T2, T3, T4]>,439    <440      Ctx,441      R,442      T1,443      T2,444      T3,445      T4,446      T5,447      Fn: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R448    >(449      cfn: [Ctx, Fn],450      t1: T1,451      t2: T2,452      t3: T3,453      t4: T4,454      t5: T5455    ): CallEffect<Ctx, Fn, [T1, T2, T3, T4, T5]>,456    <457      Ctx,458      R,459      T1,460      T2,461      T3,462      T4,463      T5,464      T6,465      Fn: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6) => R466    >(467      cfn: [Ctx, Fn],468      t1: T1,469      t2: T2,470      t3: T3,471      t4: T4,472      t5: T5,473      t6: T6474    ): CallEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6]>475  };476  declare export var apply: {477    <Ctx, R, Fn: () => R>(ctx: Ctx, fn: Fn): CallEffect<Ctx, Fn, []>,478    <Ctx, R, T1, Fn: (t1: T1) => R>(479      ctx: Ctx,480      fn: Fn,481      t1: T1482    ): CallEffect<Ctx, Fn, [T1]>,483    <Ctx, R, T1, T2, Fn: (t1: T1, t2: T2) => R>(484      ctx: Ctx,485      fn: Fn,486      t1: T1,487      t2: T2488    ): CallEffect<Ctx, Fn, [T1, T2]>,489    <Ctx, R, T1, T2, T3, Fn: (t1: T1, t2: T2, t3: T3) => R>(490      ctx: Ctx,491      fn: Fn,492      t1: T1,493      t2: T2,494      t3: T3495    ): CallEffect<Ctx, Fn, [T1, T2, T3]>,496    <Ctx, R, T1, T2, T3, T4, Fn: (t1: T1, t2: T2, t3: T3, t4: T4) => R>(497      ctx: Ctx,498      fn: Fn,499      t1: T1,500      t2: T2,501      t3: T3,502      t4: T4503    ): CallEffect<Ctx, Fn, [T1, T2, T3, T4]>,504    <505      Ctx,506      R,507      T1,508      T2,509      T3,510      T4,511      T5,512      Fn: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R513    >(514      ctx: Ctx,515      fn: Fn,516      t1: T1,517      t2: T2,518      t3: T3,519      t4: T4,520      t5: T5521    ): CallEffect<Ctx, Fn, [T1, T2, T3, T4, T5]>,522    <523      Ctx,524      R,525      T1,526      T2,527      T3,528      T4,529      T5,530      T6,531      Fn: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6) => R532    >(533      ctx: Ctx,534      fn: Fn,535      t1: T1,536      t2: T2,537      t3: T3,538      t4: T4,539      t5: T5,540      t6: T6541    ): CallEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6]>542  };543  declare type NodeCallback<R> = {544    (err: Error): void,545    (err: null | void | false, result: R): void546  };547  declare export var cps: {548    // normal calls549    <R, Fn: (cb: NodeCallback<R>) => void>(fn: Fn): CpsEffect<null, Fn, []>,550    <R, T1, Fn: (t1: T1, cb: NodeCallback<R>) => void>(551      fn: Fn,552      t1: T1553    ): CpsEffect<null, Fn, [T1]>,554    <R, T1, T2, Fn: (t1: T1, t2: T2, cb: NodeCallback<R>) => void>(555      fn: Fn,556      t1: T1,557      t2: T2558    ): CpsEffect<null, Fn, [T1, T2]>,559    <R, T1, T2, T3, Fn: (t1: T1, t2: T2, t3: T3, cb: NodeCallback<R>) => void>(560      fn: Fn,561      t1: T1,562      t2: T2,563      t3: T3564    ): CpsEffect<null, Fn, [T1, T2, T3]>,565    <566      R,567      T1,568      T2,569      T3,570      T4,571      Fn: (t1: T1, t2: T2, t3: T3, t4: T4, cb: NodeCallback<R>) => void572    >(573      fn: Fn,574      t1: T1,575      t2: T2,576      t3: T3,577      t4: T4578    ): CpsEffect<null, Fn, [T1, T2, T3, T4]>,579    <580      R,581      T1,582      T2,583      T3,584      T4,585      T5,586      Fn: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, cb: NodeCallback<R>) => void587    >(588      fn: Fn,589      t1: T1,590      t2: T2,591      t3: T3,592      t4: T4,593      t5: T5594    ): CpsEffect<null, Fn, [T1, T2, T3, T4, T5]>,595    <596      R,597      T1,598      T2,599      T3,600      T4,601      T5,602      T6,603      Fn: (604        t1: T1,605        t2: T2,606        t3: T3,607        t4: T4,608        t5: T5,609        t6: T6,610        cb: NodeCallback<R>611      ) => void612    >(613      fn: Fn,614      t1: T1,615      t2: T2,616      t3: T3,617      t4: T4,618      t5: T5,619      t6: T6620    ): CpsEffect<null, Fn, [T1, T2, T3, T4, T5, T6]>,621    // with context622    <Ctx, R, Fn: (cb: NodeCallback<R>) => void>(623      cfn: [Ctx, Fn]624    ): CpsEffect<Ctx, Fn, []>,625    <Ctx, R, T1, Fn: (t1: T1, cb: NodeCallback<R>) => void>(626      cfn: [Ctx, Fn],627      t1: T1628    ): CpsEffect<Ctx, Fn, [T1]>,629    <Ctx, R, T1, T2, Fn: (t1: T1, t2: T2, cb: NodeCallback<R>) => void>(630      cfn: [Ctx, Fn],631      t1: T1,632      t2: T2633    ): CpsEffect<Ctx, Fn, [T1, T2]>,634    <635      Ctx,636      R,637      T1,638      T2,639      T3,640      Fn: (t1: T1, t2: T2, t3: T3, cb: NodeCallback<R>) => void641    >(642      cfn: [Ctx, Fn],643      t1: T1,644      t2: T2,645      t3: T3646    ): CpsEffect<Ctx, Fn, [T1, T2, T3]>,647    <648      Ctx,649      R,650      T1,651      T2,652      T3,653      T4,654      Fn: (t1: T1, t2: T2, t3: T3, t4: T4, cb: NodeCallback<R>) => void655    >(656      cfn: [Ctx, Fn],657      t1: T1,658      t2: T2,659      t3: T3,660      t4: T4661    ): CpsEffect<Ctx, Fn, [T1, T2, T3, T4]>,662    <663      Ctx,664      R,665      T1,666      T2,667      T3,668      T4,669      T5,670      Fn: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, cb: NodeCallback<R>) => void671    >(672      cfn: [Ctx, Fn],673      t1: T1,674      t2: T2,675      t3: T3,676      t4: T4,677      t5: T5678    ): CpsEffect<Ctx, Fn, [T1, T2, T3, T4, T5]>,679    <680      Ctx,681      R,682      T1,683      T2,684      T3,685      T4,686      T5,687      T6,688      Fn: (689        t1: T1,690        t2: T2,691        t3: T3,692        t4: T4,693        t5: T5,694        t6: T6,695        cb: NodeCallback<R>696      ) => void697    >(698      cfn: [Ctx, Fn],699      t1: T1,700      t2: T2,701      t3: T3,702      t4: T4,703      t5: T5,704      t6: T6705    ): CpsEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6]>706  };707  declare export var fork: {708    // normal calls709    <R, Fn: () => R>(fn: Fn): ForkEffect<null, Fn, []>,710    <R, T1, Fn: (t1: T1) => R>(fn: Fn, t1: T1): ForkEffect<null, Fn, [T1]>,711    <R, T1, T2, Fn: (t1: T1, t2: T2) => R>(712      fn: Fn,713      t1: T1,714      t2: T2715    ): ForkEffect<null, Fn, [T1, T2]>,716    <R, T1, T2, T3, Fn: (t1: T1, t2: T2, t3: T3) => R>(717      fn: Fn,718      t1: T1,719      t2: T2,720      t3: T3721    ): ForkEffect<null, Fn, [T1, T2, T3]>,722    <R, T1, T2, T3, T4, Fn: (t1: T1, t2: T2, t3: T3, t4: T4) => R>(723      fn: Fn,724      t1: T1,725      t2: T2,726      t3: T3,727      t4: T4728    ): ForkEffect<null, Fn, [T1, T2, T3, T4]>,729    <R, T1, T2, T3, T4, T5, Fn: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R>(730      fn: Fn,731      t1: T1,732      t2: T2,733      t3: T3,734      t4: T4,735      t5: T5736    ): ForkEffect<null, Fn, [T1, T2, T3, T4, T5]>,737    <738      R,739      T1,740      T2,741      T3,742      T4,743      T5,744      T6,745      Fn: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6) => R746    >(747      fn: Fn,748      t1: T1,749      t2: T2,750      t3: T3,751      t4: T4,752      t5: T5,753      t6: T6754    ): ForkEffect<null, Fn, [T1, T2, T3, T4, T5, T6]>,755    // with context756    <Ctx, R, Fn: () => R>(cfn: [Ctx, Fn]): ForkEffect<Ctx, Fn, []>,757    <Ctx, R, T1, Fn: (t1: T1) => R>(758      cfn: [Ctx, Fn],759      t1: T1760    ): ForkEffect<Ctx, Fn, [T1]>,761    <Ctx, R, T1, T2, Fn: (t1: T1, t2: T2) => R>(762      cfn: [Ctx, Fn],763      t1: T1,764      t2: T2765    ): ForkEffect<Ctx, Fn, [T1, T2]>,766    <Ctx, R, T1, T2, T3, Fn: (t1: T1, t2: T2, t3: T3) => R>(767      cfn: [Ctx, Fn],768      t1: T1,769      t2: T2,770      t3: T3771    ): ForkEffect<Ctx, Fn, [T1, T2, T3]>,772    <Ctx, R, T1, T2, T3, T4, Fn: (t1: T1, t2: T2, t3: T3, t4: T4) => R>(773      cfn: [Ctx, Fn],774      t1: T1,775      t2: T2,776      t3: T3,777      t4: T4778    ): ForkEffect<Ctx, Fn, [T1, T2, T3, T4]>,779    <780      Ctx,781      R,782      T1,783      T2,784      T3,785      T4,786      T5,787      Fn: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R788    >(789      cfn: [Ctx, Fn],790      t1: T1,791      t2: T2,792      t3: T3,793      t4: T4,794      t5: T5795    ): ForkEffect<Ctx, Fn, [T1, T2, T3, T4, T5]>,796    <797      Ctx,798      R,799      T1,800      T2,801      T3,802      T4,803      T5,804      T6,805      Fn: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6) => R806    >(807      cfn: [Ctx, Fn],808      t1: T1,809      t2: T2,810      t3: T3,811      t4: T4,812      t5: T5,813      t6: T6814    ): ForkEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6]>815  };816  declare export var spawn: {817    // normal calls818    <R, Fn: () => R>(fn: Fn): SpawnEffect<null, Fn, []>,819    <R, T1, Fn: (t1: T1) => R>(fn: Fn, t1: T1): SpawnEffect<null, Fn, [T1]>,820    <R, T1, T2, Fn: (t1: T1, t2: T2) => R>(821      fn: Fn,822      t1: T1,823      t2: T2824    ): SpawnEffect<null, Fn, [T1, T2]>,825    <R, T1, T2, T3, Fn: (t1: T1, t2: T2, t3: T3) => R>(826      fn: Fn,827      t1: T1,828      t2: T2,829      t3: T3830    ): SpawnEffect<null, Fn, [T1, T2, T3]>,831    <R, T1, T2, T3, T4, Fn: (t1: T1, t2: T2, t3: T3, t4: T4) => R>(832      fn: Fn,833      t1: T1,834      t2: T2,835      t3: T3,836      t4: T4837    ): SpawnEffect<null, Fn, [T1, T2, T3, T4]>,838    <R, T1, T2, T3, T4, T5, Fn: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R>(839      fn: Fn,840      t1: T1,841      t2: T2,842      t3: T3,843      t4: T4,844      t5: T5845    ): SpawnEffect<null, Fn, [T1, T2, T3, T4, T5]>,846    <847      R,848      T1,849      T2,850      T3,851      T4,852      T5,853      T6,854      Fn: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6) => R855    >(856      fn: Fn,857      t1: T1,858      t2: T2,859      t3: T3,860      t4: T4,861      t5: T5,862      t6: T6863    ): SpawnEffect<null, Fn, [T1, T2, T3, T4, T5, T6]>,864    // with context865    <Ctx, R, Fn: () => R>(cfn: [Ctx, Fn]): SpawnEffect<Ctx, Fn, []>,866    <Ctx, R, T1, Fn: (t1: T1) => R>(867      cfn: [Ctx, Fn],868      t1: T1869    ): SpawnEffect<Ctx, Fn, [T1]>,870    <Ctx, R, T1, T2, Fn: (t1: T1, t2: T2) => R>(871      cfn: [Ctx, Fn],872      t1: T1,873      t2: T2874    ): SpawnEffect<Ctx, Fn, [T1, T2]>,875    <Ctx, R, T1, T2, T3, Fn: (t1: T1, t2: T2, t3: T3) => R>(876      cfn: [Ctx, Fn],877      t1: T1,878      t2: T2,879      t3: T3880    ): SpawnEffect<Ctx, Fn, [T1, T2, T3]>,881    <Ctx, R, T1, T2, T3, T4, Fn: (t1: T1, t2: T2, t3: T3, t4: T4) => R>(882      cfn: [Ctx, Fn],883      t1: T1,884      t2: T2,885      t3: T3,886      t4: T4887    ): SpawnEffect<Ctx, Fn, [T1, T2, T3, T4]>,888    <889      Ctx,890      R,891      T1,892      T2,893      T3,894      T4,895      T5,896      Fn: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R897    >(898      cfn: [Ctx, Fn],899      t1: T1,900      t2: T2,901      t3: T3,902      t4: T4,903      t5: T5904    ): SpawnEffect<Ctx, Fn, [T1, T2, T3, T4, T5]>,905    <906      Ctx,907      R,908      T1,909      T2,910      T3,911      T4,912      T5,913      T6,914      Fn: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6) => R915    >(916      cfn: [Ctx, Fn],917      t1: T1,918      t2: T2,919      t3: T3,920      t4: T4,921      t5: T5,922      t6: T6923    ): SpawnEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6]>924  };925  declare export var join: {926    <T: Task<*>>(task: T): JoinEffect<T>,927    (task: Task<*>, ...tasks: $ReadOnlyArray<Task<any>>): AllEffect928  };929  declare export var cancel: {930    (): CancelEffect<"@@redux-saga/SELF_CANCELLATION">,931    <T: Task<*>>(task: T): CancelEffect<T>,932    (task: Task<*>, ...tasks: $ReadOnlyArray<Task<any>>): AllEffect933  };934  declare export var select: {935    (): SelectEffect<void, []>,936    <S, R, Fn: (state: S) => R>(fn: Fn): SelectEffect<Fn, []>,937    <S, R, T1, Fn: (state: S, t1: T1) => R>(938      fn: Fn,939      t1: T1940    ): SelectEffect<Fn, [T1]>,941    <S, R, T1, T2, Fn: (state: S, t1: T1, t2: T2) => R>(942      fn: Fn,943      t1: T1,944      t2: T2945    ): SelectEffect<Fn, [T1, T2]>,946    <S, R, T1, T2, T3, Fn: (state: S, t1: T1, t2: T2, t3: T3) => R>(947      fn: Fn,948      t1: T1,949      t2: T2,950      t3: T3951    ): SelectEffect<Fn, [T1, T2, T3]>,952    <S, R, T1, T2, T3, T4, Fn: (state: S, t1: T1, t2: T2, t3: T3, t4: T4) => R>(953      fn: Fn,954      t1: T1,955      t2: T2,956      t3: T3,957      t4: T4958    ): SelectEffect<Fn, [T1, T2, T3, T4]>,959    <960      S,961      R,962      T1,963      T2,964      T3,965      T4,966      T5,967      Fn: (state: S, t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R968    >(969      fn: Fn,970      t1: T1,971      t2: T2,972      t3: T3,973      t4: T4,974      t5: T5975    ): SelectEffect<Fn, [T1, T2, T3, T4, T5]>,976    <977      S,978      R,979      T1,980      T2,981      T3,982      T4,983      T5,984      T6,985      Fn: (state: S, t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6) => R986    >(987      fn: Fn,988      t1: T1,989      t2: T2,990      t3: T3,991      t4: T4,992      t5: T5,993      t6: T6994    ): SelectEffect<Fn, [T1, T2, T3, T4, T5, T6]>995  };996  declare export var actionChannel: {997    <P: Pattern>(pattern: P): ActionChannelEffect<P, void>,998    <P: Pattern, B: Buffer>(pattern: P, buffer: B): ActionChannelEffect<P, B>999  };1000  declare export var flush: {1001    (channel: Channel): FlushEffect1002  };1003  declare export var cancelled: {1004    (): CancelledEffect1005  };1006  declare export var setContext: {1007    <T>(ctx: T): SetContextEffect<T>1008  };1009  declare export var getContext: {1010    (prop: string): GetContextEffect1011  };1012  declare export var race: {1013    <R: { +[name: string]: Effect } | $ReadOnlyArray<Effect>>(1014      effects: R1015    ): RaceEffect<R>1016  };1017  declare export var all: {1018    (effects: { +[name: string]: Effect }): AllEffect,1019    (effects: $ReadOnlyArray<Effect>): AllEffect1020  };1021  declare export var takeEvery: {1022    // normal calls1023    <A, R, Fn: (action: A) => Saga<R>>(1024      pattern: Pattern,1025      fn: Fn1026    ): ForkEffect<null, Function, $ReadOnlyArray<any>>,1027    <A, R, T1, Fn: (t1: T1, action: A) => Saga<R>>(1028      pattern: Pattern,1029      fn: Fn,1030      t1: T11031    ): ForkEffect<null, Function, $ReadOnlyArray<any>>,1032    <A, R, T1, T2, Fn: (t1: T1, t2: T2, action: A) => Saga<R>>(1033      pattern: Pattern,1034      fn: Fn,1035      t1: T1,1036      t2: T21037    ): ForkEffect<null, Function, $ReadOnlyArray<any>>,1038    <A, R, T1, T2, T3, Fn: (t1: T1, t2: T2, t3: T3, action: A) => Saga<R>>(1039      pattern: Pattern,1040      fn: Fn,1041      t1: T1,1042      t2: T2,1043      t3: T31044    ): ForkEffect<null, Function, $ReadOnlyArray<any>>,1045    <1046      A,1047      R,1048      T1,1049      T2,1050      T3,1051      T4,1052      Fn: (t1: T1, t2: T2, t3: T3, t4: T4, action: A) => Saga<R>1053    >(1054      pattern: Pattern,1055      fn: Fn,1056      t1: T1,1057      t2: T2,1058      t3: T3,1059      t4: T41060    ): ForkEffect<null, Function, $ReadOnlyArray<any>>,1061    <1062      A,1063      R,1064      T1,1065      T2,1066      T3,1067      T4,1068      T5,1069      Fn: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, action: A) => Saga<R>1070    >(1071      pattern: Pattern,1072      fn: Fn,1073      t1: T1,1074      t2: T2,1075      t3: T3,1076      t4: T4,1077      t5: T51078    ): ForkEffect<null, Function, $ReadOnlyArray<any>>,1079    <1080      A,1081      R,1082      T1,1083      T2,1084      T3,1085      T4,1086      T5,1087      T6,1088      Fn: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, action: A) => Saga<R>1089    >(1090      pattern: Pattern,1091      fn: Fn,1092      t1: T1,1093      t2: T2,1094      t3: T3,1095      t4: T4,1096      t5: T5,1097      t6: T61098    ): ForkEffect<null, Function, $ReadOnlyArray<any>>,1099    // with channel1100    <A, R, Fn: (action: A) => Saga<R>>(1101      channel: Channel,1102      fn: Fn1103    ): ForkEffect<null, Function, $ReadOnlyArray<any>>,1104    <A, R, T1, Fn: (t1: T1, action: A) => Saga<R>>(1105      channel: Channel,1106      fn: Fn,1107      t1: T11108    ): ForkEffect<null, Function, $ReadOnlyArray<any>>,1109    <A, R, T1, T2, Fn: (t1: T1, t2: T2, action: A) => Saga<R>>(1110      channel: Channel,1111      fn: Fn,1112      t1: T1,1113      t2: T21114    ): ForkEffect<null, Function, $ReadOnlyArray<any>>,1115    <A, R, T1, T2, T3, Fn: (t1: T1, t2: T2, t3: T3, action: A) => Saga<R>>(1116      channel: Channel,1117      fn: Fn,1118      t1: T1,1119      t2: T2,1120      t3: T31121    ): ForkEffect<null, Function, $ReadOnlyArray<any>>,1122    <1123      A,1124      R,1125      T1,1126      T2,1127      T3,1128      T4,1129      Fn: (t1: T1, t2: T2, t3: T3, t4: T4, action: A) => Saga<R>1130    >(1131      channel: Channel,1132      fn: Fn,1133      t1: T1,1134      t2: T2,1135      t3: T3,1136      t4: T41137    ): ForkEffect<null, Function, $ReadOnlyArray<any>>,1138    <1139      A,1140      R,1141      T1,1142      T2,1143      T3,1144      T4,1145      T5,1146      Fn: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, action: A) => Saga<R>1147    >(1148      channel: Channel,1149      fn: Fn,1150      t1: T1,1151      t2: T2,1152      t3: T3,1153      t4: T4,1154      t5: T51155    ): ForkEffect<null, Function, $ReadOnlyArray<any>>,1156    <1157      A,1158      R,1159      T1,1160      T2,1161      T3,1162      T4,1163      T5,1164      T6,1165      Fn: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, action: A) => Saga<R>1166    >(1167      channel: Channel,1168      fn: Fn,1169      t1: T1,1170      t2: T2,1171      t3: T3,1172      t4: T4,1173      t5: T5,1174      t6: T61175    ): ForkEffect<null, Function, $ReadOnlyArray<any>>1176  };1177  declare export var takeLatest: {1178    // normal calls1179    <A, R, Fn: (action: A) => Saga<R>>(1180      pattern: Pattern,1181      fn: Fn1182    ): ForkEffect<null, Function, $ReadOnlyArray<any>>,1183    <A, R, T1, Fn: (t1: T1, action: A) => Saga<R>>(1184      pattern: Pattern,1185      fn: Fn,1186      t1: T11187    ): ForkEffect<null, Function, $ReadOnlyArray<any>>,1188    <A, R, T1, T2, Fn: (t1: T1, t2: T2, action: A) => Saga<R>>(1189      pattern: Pattern,1190      fn: Fn,1191      t1: T1,1192      t2: T21193    ): ForkEffect<null, Function, $ReadOnlyArray<any>>,1194    <A, R, T1, T2, T3, Fn: (t1: T1, t2: T2, t3: T3, action: A) => Saga<R>>(1195      pattern: Pattern,1196      fn: Fn,1197      t1: T1,1198      t2: T2,1199      t3: T31200    ): ForkEffect<null, Function, $ReadOnlyArray<any>>,1201    <1202      A,1203      R,1204      T1,1205      T2,1206      T3,1207      T4,1208      Fn: (t1: T1, t2: T2, t3: T3, t4: T4, action: A) => Saga<R>1209    >(1210      pattern: Pattern,1211      fn: Fn,1212      t1: T1,1213      t2: T2,1214      t3: T3,1215      t4: T41216    ): ForkEffect<null, Function, $ReadOnlyArray<any>>,1217    <1218      A,1219      R,1220      T1,1221      T2,1222      T3,1223      T4,1224      T5,1225      Fn: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, action: A) => Saga<R>1226    >(1227      pattern: Pattern,1228      fn: Fn,1229      t1: T1,1230      t2: T2,1231      t3: T3,1232      t4: T4,1233      t5: T51234    ): ForkEffect<null, Function, $ReadOnlyArray<any>>,1235    <1236      A,1237      R,1238      T1,1239      T2,1240      T3,1241      T4,1242      T5,1243      T6,1244      Fn: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, action: A) => Saga<R>1245    >(1246      pattern: Pattern,1247      fn: Fn,1248      t1: T1,1249      t2: T2,1250      t3: T3,1251      t4: T4,1252      t5: T5,1253      t6: T61254    ): ForkEffect<null, Function, $ReadOnlyArray<any>>,1255    // with channel1256    <A, R, Fn: (action: A) => Saga<R>>(1257      channel: Channel,1258      fn: Fn1259    ): ForkEffect<null, Function, $ReadOnlyArray<any>>,1260    <A, R, T1, Fn: (t1: T1, action: A) => Saga<R>>(1261      channel: Channel,1262      fn: Fn,1263      t1: T11264    ): ForkEffect<null, Function, $ReadOnlyArray<any>>,1265    <A, R, T1, T2, Fn: (t1: T1, t2: T2, action: A) => Saga<R>>(1266      channel: Channel,1267      fn: Fn,1268      t1: T1,1269      t2: T21270    ): ForkEffect<null, Function, $ReadOnlyArray<any>>,1271    <A, R, T1, T2, T3, Fn: (t1: T1, t2: T2, t3: T3, action: A) => Saga<R>>(1272      channel: Channel,1273      fn: Fn,1274      t1: T1,1275      t2: T2,1276      t3: T31277    ): ForkEffect<null, Function, $ReadOnlyArray<any>>,1278    <1279      A,1280      R,1281      T1,1282      T2,1283      T3,1284      T4,1285      Fn: (t1: T1, t2: T2, t3: T3, t4: T4, action: A) => Saga<R>1286    >(1287      channel: Channel,1288      fn: Fn,1289      t1: T1,1290      t2: T2,1291      t3: T3,1292      t4: T41293    ): ForkEffect<null, Function, $ReadOnlyArray<any>>,1294    <1295      A,1296      R,1297      T1,1298      T2,1299      T3,1300      T4,1301      T5,1302      Fn: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, action: A) => Saga<R>1303    >(1304      channel: Channel,1305      fn: Fn,1306      t1: T1,1307      t2: T2,1308      t3: T3,1309      t4: T4,1310      t5: T51311    ): ForkEffect<null, Function, $ReadOnlyArray<any>>,1312    <1313      A,1314      R,1315      T1,1316      T2,1317      T3,1318      T4,1319      T5,1320      T6,1321      Fn: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, action: A) => Saga<R>1322    >(1323      channel: Channel,1324      fn: Fn,1325      t1: T1,1326      t2: T2,1327      t3: T3,1328      t4: T4,1329      t5: T5,1330      t6: T61331    ): ForkEffect<null, Function, $ReadOnlyArray<any>>1332  };1333  declare export var throttle: {1334    // normal calls1335    <A, R, Fn: (action: A) => Saga<R>>(1336      ms: number,1337      pattern: Pattern,1338      fn: Fn1339    ): ForkEffect<null, Function, []>,1340    <A, R, T1, Fn: (t1: T1, action: A) => Saga<R>>(1341      ms: number,1342      pattern: Pattern,1343      fn: Fn,1344      t1: T11345    ): ForkEffect<null, Function, [T1]>,1346    <A, R, T1, T2, Fn: (t1: T1, t2: T2, action: A) => Saga<R>>(1347      ms: number,1348      pattern: Pattern,1349      fn: Fn,1350      t1: T1,1351      t2: T21352    ): ForkEffect<null, Function, [T1, T2]>,1353    <A, R, T1, T2, T3, Fn: (t1: T1, t2: T2, t3: T3, action: A) => Saga<R>>(1354      ms: number,1355      pattern: Pattern,1356      fn: Fn,1357      t1: T1,1358      t2: T2,1359      t3: T31360    ): ForkEffect<null, Function, [T1, T2, T3]>,1361    <1362      A,1363      R,1364      T1,1365      T2,1366      T3,1367      T4,1368      Fn: (t1: T1, t2: T2, t3: T3, t4: T4, action: A) => Saga<R>1369    >(1370      ms: number,1371      pattern: Pattern,1372      fn: Fn,1373      t1: T1,1374      t2: T2,1375      t3: T3,1376      t4: T41377    ): ForkEffect<null, Function, [T1, T2, T3, T4]>,1378    <1379      A,1380      R,1381      T1,1382      T2,1383      T3,1384      T4,1385      T5,1386      Fn: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, action: A) => Saga<R>1387    >(1388      ms: number,1389      pattern: Pattern,1390      fn: Fn,1391      t1: T1,1392      t2: T2,1393      t3: T3,1394      t4: T4,1395      t5: T51396    ): ForkEffect<null, Function, [T1, T2, T3, T4, T5]>,1397    <1398      A,1399      R,1400      T1,1401      T2,1402      T3,1403      T4,1404      T5,1405      T6,1406      Fn: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, action: A) => Saga<R>1407    >(1408      ms: number,1409      pattern: Pattern,1410      fn: Fn,1411      t1: T1,1412      t2: T2,1413      t3: T3,1414      t4: T4,1415      t5: T5,1416      t6: T61417    ): ForkEffect<null, Function, [T1, T2, T3, T4, T5, T6]>1418  };...go_to_goals.py
Source:go_to_goals.py  
1#! /usr/bin/env python2from numpy.core.records import array3from numpy.lib.financial import rate4from sympy.solvers.diophantine.diophantine import length5import rospy6from std_msgs.msg import Float647from sympy import *8import math9from control_msgs.msg import JointControllerState10import time 11import numpy as np12from gazebo_msgs.srv import GetLinkState 13Q1 = 1 14Q2 = 115Q3 = 116Q4 = 117Q5 = 118Q6 = 119def rads(x):20    return math.radians(x)21def callback1(data):22    global Q123    Q1=data.process_value24    return25    26def callback2(data):27    global Q228    Q2=data.process_value29    return30    31def callback3(data):32    global Q333    Q3=data.process_value34    return35    36def callback4(data):37    global Q438    Q4=data.process_value39    return40    41def callback5(data):42    global Q543    Q5=data.process_value44    return45    46def callback6(data):47    global Q648    Q6=data.process_value49    return50model_info= rospy.ServiceProxy('/gazebo/get_link_state', GetLinkState)  51def getGoals():52    global model_info, Goals53    Goals = []54    # Reach 3 object with the arm55    Goal_names= ["coke_can::link", "beer::link", "wood_cube_10cm::link"]56    for i in Goal_names:57        obj = model_info(i,"world")58        x = obj.link_state.pose.position.x59        y = obj.link_state.pose.position.y60        z = obj.link_state.pose.position.z + 0.161        Goals.append([x, y, z])62    Goals = np.array(Goals)63def getBaseLinkPos():64    global model_info65    # Reach 3 object with the arm66    obj = model_info("robot::base_link","world")67    x = obj.link_state.pose.position.x68    y = obj.link_state.pose.position.y69    return x,y70t1, t2, t3, t4, t5, t6 = symbols('t1 t2 t3 t4 t5 t6')71l = 0.575 72w = 0.27573'''74u = Wheel input  - angular vel, 4x175{S} world frame76(B) Robot base frame77Tsb = f(phi) -> phi robot's rotation wrt {S} 78u = H(0) 79'''80H = np.matrix([[ 1, 1,  (w + l)],81                              [ 1, -1, -(w + l)],82                              [ 1, -1,  (w + l)],83                              [ 1,  1, -(w + l)]])84Hpi = Matrix([[-1/(4*(l + w)), 1/(4*(l + w)), 1/(4*(l + w)), -1/(4*(l + w))],85[1/4, 1/4, 1/4, 1/4],86[-1/4, 1/4, -1/4, 1/4],87])88'''89Jbase = 90Jarm = 91'''92'''93Je = Matrix([Jbase Jarm])94'''95s = 1e-2096J11 = (sin(t1)*sin(t2))/100000000000000000000 - (42500000000000000001*sin(t1))/100000000000000000000 - (1569*cos(t2)*sin(t1))/4000 - (3397500000000000001*cos(t1))/50000000000000000000 + (cos(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)))/100000000000000000000 + (cos(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)))/100000000000000000000 + (sin(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)))/100000000000000000000 - (sin(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)))/100000000000000000000 + (cos(t5)*(cos(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)) + sin(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2))))/50000000000000000000 + (cos(t5)*(cos(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)) - sin(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1))))/50000000000000000000 - (sin(t5)*(cos(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)) + sin(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)) - sin(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1))))/50000000000000000000 + (cos(t2)*sin(t1)*sin(t3))/100000000000000000000 + (cos(t3)*sin(t1)*sin(t2))/100000000000000000000 + (sin(t1)*sin(t2)*sin(t3))/100000000000000000000 - (cos(t2)*cos(t3)*sin(t1))/10000000000000000000097J12 = (cos(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3)))/100000000000000000000 - (1569*cos(t1)*sin(t2))/4000 - (cos(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2)))/100000000000000000000 - (cos(t1)*cos(t2))/100000000000000000000 + (sin(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2)))/100000000000000000000 + (sin(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3)))/100000000000000000000 + (cos(t5)*(cos(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3)) + sin(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2))))/50000000000000000000 - (cos(t5)*(cos(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2)) - sin(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3)) + sin(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2)) - sin(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3))))/50000000000000000000 + (cos(t1)*sin(t2)*sin(t3))/100000000000000000000 - (cos(t1)*cos(t2)*cos(t3))/100000000000000000000 - (cos(t1)*cos(t2)*sin(t3))/100000000000000000000 - (cos(t1)*cos(t3)*sin(t2))/10000000000000000000098J13 = (cos(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3)))/100000000000000000000 - (cos(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2)))/100000000000000000000 + (sin(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2)))/100000000000000000000 + (sin(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3)))/100000000000000000000 + (cos(t5)*(cos(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3)) + sin(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2))))/50000000000000000000 - (cos(t5)*(cos(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2)) - sin(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3)) + sin(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2)) - sin(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3))))/5000000000000000000099J14 = (cos(t5)*(cos(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3)) + sin(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2))))/50000000000000000000 - (cos(t5)*(cos(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2)) - sin(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3)) + sin(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2)) - sin(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3))))/50000000000000000000100J15 = (cos(t5)*(cos(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3)) + sin(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2))))/5000000000 - (cos(t5)*(cos(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2)) - sin(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3))))/5000000000 + (sin(t5)*(cos(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3)) + sin(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2))))/5000000000 + (sin(t5)*(cos(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2)) - sin(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3))))/5000000000101J16 = s102J21 = (42500000000000000001*cos(t1))/100000000000000000000 - (3397500000000000001*sin(t1))/50000000000000000000 + (1569*cos(t1)*cos(t2))/4000 - (cos(t1)*sin(t2))/100000000000000000000 - (cos(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2)))/100000000000000000000 - (cos(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3)))/100000000000000000000 - (sin(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2)))/100000000000000000000 + (sin(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3)))/100000000000000000000 - (cos(t5)*(cos(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3)) + sin(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2))))/50000000000000000000 - (cos(t5)*(cos(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2)) - sin(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3)) + sin(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2))))/50000000000000000000 - (sin(t5)*(cos(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2)) - sin(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3))))/50000000000000000000 - (cos(t1)*sin(t2)*sin(t3))/100000000000000000000 + (cos(t1)*cos(t2)*cos(t3))/100000000000000000000 - (cos(t1)*cos(t2)*sin(t3))/100000000000000000000 - (cos(t1)*cos(t3)*sin(t2))/100000000000000000000103J22 = (cos(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)))/100000000000000000000 - (1569*sin(t1)*sin(t2))/4000 - (cos(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)))/100000000000000000000 - (cos(t2)*sin(t1))/100000000000000000000 + (sin(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)))/100000000000000000000 + (sin(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)))/100000000000000000000 + (cos(t5)*(cos(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)) + sin(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2))))/50000000000000000000 - (cos(t5)*(cos(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)) - sin(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1))))/50000000000000000000 + (sin(t5)*(cos(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)) + sin(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)) - sin(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1))))/50000000000000000000 - (cos(t2)*sin(t1)*sin(t3))/100000000000000000000 - (cos(t3)*sin(t1)*sin(t2))/100000000000000000000 + (sin(t1)*sin(t2)*sin(t3))/100000000000000000000 - (cos(t2)*cos(t3)*sin(t1))/100000000000000000000104J23 = (cos(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)))/100000000000000000000 - (cos(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)))/100000000000000000000 + (sin(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)))/100000000000000000000 + (sin(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)))/100000000000000000000 + (cos(t5)*(cos(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)) + sin(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2))))/50000000000000000000 - (cos(t5)*(cos(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)) - sin(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1))))/50000000000000000000 + (sin(t5)*(cos(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)) + sin(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)) - sin(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1))))/50000000000000000000 - (cos(t2)*sin(t1)*sin(t3))/100000000000000000000 - (cos(t3)*sin(t1)*sin(t2))/100000000000000000000 + (sin(t1)*sin(t2)*sin(t3))/100000000000000000000 - (cos(t2)*cos(t3)*sin(t1))/100000000000000000000105J24 = (cos(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)))/100000000000000000000 - (cos(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)))/100000000000000000000 + (sin(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)))/100000000000000000000 + (sin(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)))/100000000000000000000 + (cos(t5)*(cos(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)) + sin(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2))))/50000000000000000000 - (cos(t5)*(cos(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)) - sin(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1))))/50000000000000000000 + (sin(t5)*(cos(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)) + sin(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)) - sin(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1))))/50000000000000000000106J25 = (cos(t5)*(cos(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)) + sin(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2))))/50000000000000000000 - (cos(t5)*(cos(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)) - sin(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1))))/50000000000000000000 + (sin(t5)*(cos(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)) + sin(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)) - sin(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1))))/50000000000000000000107J26 = s108J31 = s109J32 = sin(t2)/100000000000000000000 - (1569*cos(t2))/4000 - (cos(t2)*cos(t3))/100000000000000000000 + (cos(t2)*sin(t3))/100000000000000000000 + (cos(t3)*sin(t2))/100000000000000000000 + (sin(t2)*sin(t3))/100000000000000000000 + (cos(t5)*(cos(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2)) + sin(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3))))/50000000000000000000 - (cos(t5)*(cos(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3)) - sin(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2)) + sin(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3)) - sin(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2))))/50000000000000000000 + (cos(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2)))/100000000000000000000 - (cos(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3)))/100000000000000000000 + (sin(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2)))/100000000000000000000 + (sin(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3)))/100000000000000000000110J33 = (cos(t2)*sin(t3))/100000000000000000000 - (cos(t2)*cos(t3))/100000000000000000000 + (cos(t3)*sin(t2))/100000000000000000000 + (sin(t2)*sin(t3))/100000000000000000000 + (cos(t5)*(cos(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2)) + sin(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3))))/50000000000000000000 - (cos(t5)*(cos(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3)) - sin(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2)) + sin(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3)) - sin(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2))))/50000000000000000000 + (cos(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2)))/100000000000000000000 - (cos(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3)))/100000000000000000000 + (sin(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2)))/100000000000000000000 + (sin(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3)))/100000000000000000000111J34 = (cos(t5)*(cos(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2)) + sin(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3))))/50000000000000000000 - (cos(t5)*(cos(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3)) - sin(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2)) + sin(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3)) - sin(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2))))/50000000000000000000 + (cos(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2)))/100000000000000000000 - (cos(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3)))/100000000000000000000 + (sin(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2)))/100000000000000000000 + (sin(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3)))/100000000000000000000112J35 = (cos(t5)*(cos(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2)) + sin(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3))))/50000000000000000000 - (cos(t5)*(cos(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3)) - sin(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2)) + sin(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3)) - sin(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2))))/50000000000000000000113J36 = s114z1 = Matrix([[0, 0, 1]])115z2 = Matrix([[-sin(t1), cos(t1), 0]])116z3 = Matrix([[-sin(t1), cos(t1), 0]])117z4 = Matrix([[-sin(t1), cos(t1), 0]])118z5 = Matrix([[-sin(t1), cos(t1), 0]])119z61=Matrix([sin(t5)*(cos(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3)) + sin(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2))) - cos(t5)*(cos(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2)) - sin(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3)))])120z62=Matrix([sin(t5)*(cos(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)) + sin(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2))) - cos(t5)*(cos(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)) - sin(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)))])121z63=Matrix([sin(t5)*(cos(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2)) + sin(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3))) - cos(t5)*(cos(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3)) - sin(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2)))])122z6 = Matrix([[z61,z62,z63]])123Je = Matrix([[J11, J12, J13, J14, J15, J16],124[J21,J22,J23,J24,J25,J26],125[J31,J32,J33,J34,J35,J36],126[z1.T, z2.T, z3.T, z4.T, z5.T, z6.T]])127'''128Je = Matrix([[J11, J21, J31],129            [J12, J22, J32],130            [J13, J23, J33],131            [J14, J24, J34],132            [J15, J25, J35],133            [J16, J26, J36]])134print(shape(Je))135'''136'''137inp = Matrix([u1, u2, u3, u4])138Ve = Je*inp139'''140def J_inv(q):141    global Je142    Js = Je.subs({t1: q[0], t2: q[1], t3: q[2], t4: q[3], t5: q[4], t6: q[5]}).evalf()143    try:144        Jp = (Js.T*Js).inv()*Js.T145    except:146        return -1147    return Jp148def get_end_effector_pos():149    global model_info150    endeff = model_info("robot::wrist_3_link", "world")151    x = endeff.link_state.pose.position.x152    y = endeff.link_state.pose.position.y153    z = endeff.link_state.pose.position.z154    return x,y,z155def controlArm():156    global Q1, Q2, Q3, Q4, Q5, Q6, Hpi, s, Goals, model_info157    # Q1, Q2, Q3, Q4, Q5, Q6 stands for:158    # shoulder, upperarm, forearm, wrist 1, wrsit 2, wrist 3159    loop_rate = rospy.Rate(10)160    current_goal = 0161    print("Current end effector position(x, y, z): ",get_end_effector_pos())162    if (input("Do you want to enter custom Input? (y/n): ")=="y"):163        xg = float(input("Input custom goal location X: "))164        yg = float(input("Input custom goal location Y: "))165        zg = float(input("Input custom goal location Z: "))166        current_goal = len(Goals)167        Goals=np.append(Goals,[[xg,yg,zg]],axis=0)168    Kp = 2169    while not rospy.is_shutdown():170        endeffx, endeffy, endeffz = get_end_effector_pos()171        Xerr = (Goals[current_goal][0] - endeffx)172        Yerr = (Goals[current_goal][1] - endeffy)173        Zerr = (Goals[current_goal][2] - endeffz)174        print(sqrt(Xerr**2 + Yerr**2 + Zerr**2 ))175        if(sqrt(Xerr**2 + Yerr**2 + Zerr**2 ))<0.2:176            #Go to next goal177            current_goal+=1178            print("Going to GOAL: ", current_goal+1)179        if(current_goal>len(Goals)-1):180            #End program181            break182        # Lock Q2 = rads(-90 + 35/1.571)183        # offset_rads = rads(-90 + 0/(pi/2) )184        # Q2' = rads(-90 + degrees(Q2)/(pi/2) )185        # dq2 = rads(-90 + degrees(dq[2])/(pi/2) )186        p=2.5187        x1, y1 = getBaseLinkPos()188        side = (endeffy-y1)*(Goals[current_goal][1]-y1) - (endeffx-x1)*(Goals[current_goal][0]-x1)189        print("side: ", abs(side)/side)190        191        V = Matrix([ [p*Xerr], [p*Yerr], [p*Zerr], [0], [0], [0] ])  192        #TODO: Redefine the error of the arm's position to reach an object differently193        #V = Matrix([ [p*abs(side)/side], [0], [p*Zerr], [0], [0], [0] ])  194        Q = Matrix([[Q1], [-Q2], [Q3], [Q4], [Q5], [Q6]])195        q_=J_inv(Q)*V196        197        VWheel = Matrix([ [Kp*Xerr], [Kp*Yerr], [0]])198        wheel_vel = (np.dot(H, VWheel).A1).tolist()199        wheel_vel = np.array(wheel_vel)200        if(q_==-1):201            q=Q202        elif(len(Q)==len(q_)):203            i=0204            while i<len(q_):205                if q_[i]>pi/10:206                    q_[i]=pi/10207                elif q_[i]<-pi/10:208                    q_[i]=-pi/10209                i+=1210            ind = wheel_vel>10211            wheel_vel[ind] = 10212            213            ind = wheel_vel <-10214            wheel_vel[ind]=-10215            q=Q+q_216        else:217            continue218        #print(q_)219        pub_shoulder.publish(q[0]) 220        pub_upperarm.publish(rads(-90 + (q[1]*180/pi)/(pi/2)) ) 221        pub_elbow.publish(q[2]) 222        pub_wrist1.publish(q[3])  223        pub_wrist2.publish(q[4]) 224        pub_wrist3.publish(q[5]) 225        226        wv = Float64()227        wv.data = wheel_vel[0]228        fr_pub.publish(wv)229        wv.data = wheel_vel[1]230        fl_pub.publish(wv)231        wv.data = wheel_vel[2]232        rr_pub.publish(wv)233        wv.data = wheel_vel[3]234        rl_pub.publish(wv)235        loop_rate.sleep()236    #Stop 4 motors after all the goals are reached.237    wv = Float64()238    wv.data = 0239    fr_pub.publish(wv)240    wv.data = 0241    fl_pub.publish(wv)242    wv.data = 0243    rr_pub.publish(wv)244    wv.data = 0245    rl_pub.publish(wv)246if __name__=="__main__":247    rospy.init_node("arm_ik")248    getGoals()249    rospy.Subscriber("/shoulder_pan_joint_position_controller/state/", JointControllerState, callback1, queue_size=5)250    rospy.Subscriber("/shoulder_lift_joint_position_controller/state", JointControllerState, callback2)251    rospy.Subscriber("/elbow_joint_position_controller/state", JointControllerState, callback3)252    rospy.Subscriber("/wrist_1_joint_position_controller/state", JointControllerState, callback4)    253    rospy.Subscriber("/wrist_2_joint_position_controller/state", JointControllerState, callback5)254    rospy.Subscriber("/wrist_3_joint_position_controller/state", JointControllerState, callback6)255    pub_shoulder = rospy.Publisher('/shoulder_pan_joint_position_controller/command', Float64, queue_size=5) 256    pub_upperarm = rospy.Publisher('/shoulder_lift_joint_position_controller/command', Float64, queue_size=5) 257    pub_elbow = rospy.Publisher('/elbow_joint_position_controller/command', Float64, queue_size=5) 258    pub_wrist1 = rospy.Publisher('/wrist_1_joint_position_controller/command', Float64, queue_size=5) 259    pub_wrist2 = rospy.Publisher('/wrist_2_joint_position_controller/command', Float64, queue_size=5) 260    pub_wrist3 = rospy.Publisher('/wrist_3_joint_position_controller/command', Float64, queue_size=5) 261    fr_pub = rospy.Publisher('/front_right_controller/command', Float64, queue_size=10)262    fl_pub = rospy.Publisher('/front_left_controller/command', Float64, queue_size=10)263    rr_pub = rospy.Publisher('/rear_right_controller/command', Float64, queue_size=10)264    rl_pub = rospy.Publisher('/rear_left_controller/command', Float64, queue_size=10)265    i=0266    q = Matrix([ [rads(45.001)], [rads(-90 + -80/1.571)], [rads(0.001)], [rads(0.1)], [rads(0.1)], [rads(0.1)]])267    prate = rospy.Rate(10)268    while i<1e1:269        pub_shoulder.publish(q[0]) 270        pub_upperarm.publish(rads(-90 + 35/1.571)) 271        pub_elbow.publish(q[2]) 272        pub_wrist1.publish(q[3])  273        pub_wrist2.publish(q[4]) 274        pub_wrist3.publish(q[5]) 275        fr_pub.publish(0)276        fl_pub.publish(0)277        rr_pub.publish(0)278        rl_pub.publish(0)279        i+=1280        prate.sleep()...attend_to_pests.py
Source:attend_to_pests.py  
1#! /usr/bin/env python2from numpy.core.records import array3from numpy.lib.financial import rate4from sympy.solvers.diophantine.diophantine import length5import rospy6from std_msgs.msg import Float647from sympy import *8import math9from control_msgs.msg import JointControllerState10import time 11import numpy as np12from gazebo_msgs.srv import GetLinkState 13Q1 = 1 14Q2 = 115Q3 = 116Q4 = 117Q5 = 118Q6 = 119def rads(x):20    return math.radians(x)21def callback1(data):22    global Q123    Q1=data.process_value24    return25    26def callback2(data):27    global Q228    Q2=data.process_value29    return30    31def callback3(data):32    global Q333    Q3=data.process_value34    return35    36def callback4(data):37    global Q438    Q4=data.process_value39    return40    41def callback5(data):42    global Q543    Q5=data.process_value44    return45    46def callback6(data):47    global Q648    Q6=data.process_value49    return50model_info= rospy.ServiceProxy('/gazebo/get_link_state', GetLinkState)  51def getGoals():52    global model_info, Goals53    Goals = []54    # Reach 3 object with the arm55    Goal_names= ["Bush3::link", "Bush3_10::link", "Bush3_0::link", "Bush3_1::link", "Bush3_2::link"]56    for i in Goal_names:57        obj = model_info(i,"world")58        x = obj.link_state.pose.position.x59        y = obj.link_state.pose.position.y60        y= y - 1.5*abs(y)/y61        z = obj.link_state.pose.position.z + 0.862        print("BUSH LOC: ",x,y,z)63        Goals.append([x, y, z])64    Goals = np.array(Goals)65t1, t2, t3, t4, t5, t6 = symbols('t1 t2 t3 t4 t5 t6')66l = 0.575 67w = 0.27568'''69u = Wheel input  - angular vel, 4x170{S} world frame71(B) Robot base frame72Tsb = f(phi) -> phi robot's rotation wrt {S} 73u = H(0) 74'''75H = np.matrix([[ 1, 1,  (w + l)],76                              [ 1, -1, -(w + l)],77                              [ 1, -1,  (w + l)],78                              [ 1,  1, -(w + l)]])79Hpi = Matrix([[-1/(4*(l + w)), 1/(4*(l + w)), 1/(4*(l + w)), -1/(4*(l + w))],80[1/4, 1/4, 1/4, 1/4],81[-1/4, 1/4, -1/4, 1/4],82])83'''84Jbase = 85Jarm = 86'''87'''88Je = Matrix([Jbase Jarm])89'''90s = 1e-2091J11 = (sin(t1)*sin(t2))/100000000000000000000 - (42500000000000000001*sin(t1))/100000000000000000000 - (1569*cos(t2)*sin(t1))/4000 - (3397500000000000001*cos(t1))/50000000000000000000 + (cos(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)))/100000000000000000000 + (cos(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)))/100000000000000000000 + (sin(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)))/100000000000000000000 - (sin(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)))/100000000000000000000 + (cos(t5)*(cos(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)) + sin(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2))))/50000000000000000000 + (cos(t5)*(cos(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)) - sin(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1))))/50000000000000000000 - (sin(t5)*(cos(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)) + sin(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)) - sin(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1))))/50000000000000000000 + (cos(t2)*sin(t1)*sin(t3))/100000000000000000000 + (cos(t3)*sin(t1)*sin(t2))/100000000000000000000 + (sin(t1)*sin(t2)*sin(t3))/100000000000000000000 - (cos(t2)*cos(t3)*sin(t1))/10000000000000000000092J12 = (cos(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3)))/100000000000000000000 - (1569*cos(t1)*sin(t2))/4000 - (cos(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2)))/100000000000000000000 - (cos(t1)*cos(t2))/100000000000000000000 + (sin(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2)))/100000000000000000000 + (sin(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3)))/100000000000000000000 + (cos(t5)*(cos(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3)) + sin(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2))))/50000000000000000000 - (cos(t5)*(cos(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2)) - sin(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3)) + sin(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2)) - sin(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3))))/50000000000000000000 + (cos(t1)*sin(t2)*sin(t3))/100000000000000000000 - (cos(t1)*cos(t2)*cos(t3))/100000000000000000000 - (cos(t1)*cos(t2)*sin(t3))/100000000000000000000 - (cos(t1)*cos(t3)*sin(t2))/10000000000000000000093J13 = (cos(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3)))/100000000000000000000 - (cos(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2)))/100000000000000000000 + (sin(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2)))/100000000000000000000 + (sin(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3)))/100000000000000000000 + (cos(t5)*(cos(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3)) + sin(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2))))/50000000000000000000 - (cos(t5)*(cos(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2)) - sin(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3)) + sin(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2)) - sin(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3))))/5000000000000000000094J14 = (cos(t5)*(cos(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3)) + sin(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2))))/50000000000000000000 - (cos(t5)*(cos(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2)) - sin(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3)) + sin(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2)) - sin(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3))))/5000000000000000000095J15 = (cos(t5)*(cos(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3)) + sin(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2))))/5000000000 - (cos(t5)*(cos(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2)) - sin(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3))))/5000000000 + (sin(t5)*(cos(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3)) + sin(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2))))/5000000000 + (sin(t5)*(cos(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2)) - sin(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3))))/500000000096J16 = s97J21 = (42500000000000000001*cos(t1))/100000000000000000000 - (3397500000000000001*sin(t1))/50000000000000000000 + (1569*cos(t1)*cos(t2))/4000 - (cos(t1)*sin(t2))/100000000000000000000 - (cos(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2)))/100000000000000000000 - (cos(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3)))/100000000000000000000 - (sin(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2)))/100000000000000000000 + (sin(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3)))/100000000000000000000 - (cos(t5)*(cos(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3)) + sin(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2))))/50000000000000000000 - (cos(t5)*(cos(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2)) - sin(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3)) + sin(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2))))/50000000000000000000 - (sin(t5)*(cos(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2)) - sin(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3))))/50000000000000000000 - (cos(t1)*sin(t2)*sin(t3))/100000000000000000000 + (cos(t1)*cos(t2)*cos(t3))/100000000000000000000 - (cos(t1)*cos(t2)*sin(t3))/100000000000000000000 - (cos(t1)*cos(t3)*sin(t2))/10000000000000000000098J22 = (cos(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)))/100000000000000000000 - (1569*sin(t1)*sin(t2))/4000 - (cos(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)))/100000000000000000000 - (cos(t2)*sin(t1))/100000000000000000000 + (sin(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)))/100000000000000000000 + (sin(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)))/100000000000000000000 + (cos(t5)*(cos(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)) + sin(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2))))/50000000000000000000 - (cos(t5)*(cos(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)) - sin(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1))))/50000000000000000000 + (sin(t5)*(cos(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)) + sin(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)) - sin(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1))))/50000000000000000000 - (cos(t2)*sin(t1)*sin(t3))/100000000000000000000 - (cos(t3)*sin(t1)*sin(t2))/100000000000000000000 + (sin(t1)*sin(t2)*sin(t3))/100000000000000000000 - (cos(t2)*cos(t3)*sin(t1))/10000000000000000000099J23 = (cos(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)))/100000000000000000000 - (cos(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)))/100000000000000000000 + (sin(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)))/100000000000000000000 + (sin(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)))/100000000000000000000 + (cos(t5)*(cos(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)) + sin(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2))))/50000000000000000000 - (cos(t5)*(cos(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)) - sin(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1))))/50000000000000000000 + (sin(t5)*(cos(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)) + sin(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)) - sin(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1))))/50000000000000000000 - (cos(t2)*sin(t1)*sin(t3))/100000000000000000000 - (cos(t3)*sin(t1)*sin(t2))/100000000000000000000 + (sin(t1)*sin(t2)*sin(t3))/100000000000000000000 - (cos(t2)*cos(t3)*sin(t1))/100000000000000000000100J24 = (cos(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)))/100000000000000000000 - (cos(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)))/100000000000000000000 + (sin(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)))/100000000000000000000 + (sin(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)))/100000000000000000000 + (cos(t5)*(cos(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)) + sin(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2))))/50000000000000000000 - (cos(t5)*(cos(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)) - sin(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1))))/50000000000000000000 + (sin(t5)*(cos(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)) + sin(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)) - sin(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1))))/50000000000000000000101J25 = (cos(t5)*(cos(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)) + sin(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2))))/50000000000000000000 - (cos(t5)*(cos(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)) - sin(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1))))/50000000000000000000 + (sin(t5)*(cos(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)) + sin(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)) - sin(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1))))/50000000000000000000102J26 = s103J31 = s104J32 = sin(t2)/100000000000000000000 - (1569*cos(t2))/4000 - (cos(t2)*cos(t3))/100000000000000000000 + (cos(t2)*sin(t3))/100000000000000000000 + (cos(t3)*sin(t2))/100000000000000000000 + (sin(t2)*sin(t3))/100000000000000000000 + (cos(t5)*(cos(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2)) + sin(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3))))/50000000000000000000 - (cos(t5)*(cos(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3)) - sin(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2)) + sin(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3)) - sin(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2))))/50000000000000000000 + (cos(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2)))/100000000000000000000 - (cos(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3)))/100000000000000000000 + (sin(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2)))/100000000000000000000 + (sin(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3)))/100000000000000000000105J33 = (cos(t2)*sin(t3))/100000000000000000000 - (cos(t2)*cos(t3))/100000000000000000000 + (cos(t3)*sin(t2))/100000000000000000000 + (sin(t2)*sin(t3))/100000000000000000000 + (cos(t5)*(cos(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2)) + sin(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3))))/50000000000000000000 - (cos(t5)*(cos(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3)) - sin(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2)) + sin(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3)) - sin(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2))))/50000000000000000000 + (cos(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2)))/100000000000000000000 - (cos(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3)))/100000000000000000000 + (sin(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2)))/100000000000000000000 + (sin(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3)))/100000000000000000000106J34 = (cos(t5)*(cos(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2)) + sin(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3))))/50000000000000000000 - (cos(t5)*(cos(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3)) - sin(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2)) + sin(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3)) - sin(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2))))/50000000000000000000 + (cos(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2)))/100000000000000000000 - (cos(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3)))/100000000000000000000 + (sin(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2)))/100000000000000000000 + (sin(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3)))/100000000000000000000107J35 = (cos(t5)*(cos(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2)) + sin(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3))))/50000000000000000000 - (cos(t5)*(cos(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3)) - sin(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2)) + sin(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3))))/50000000000000000000 + (sin(t5)*(cos(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3)) - sin(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2))))/50000000000000000000108J36 = s109z1 = Matrix([[0, 0, 1]])110z2 = Matrix([[-sin(t1), cos(t1), 0]])111z3 = Matrix([[-sin(t1), cos(t1), 0]])112z4 = Matrix([[-sin(t1), cos(t1), 0]])113z5 = Matrix([[-sin(t1), cos(t1), 0]])114z61=Matrix([sin(t5)*(cos(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3)) + sin(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2))) - cos(t5)*(cos(t4)*(cos(t1)*cos(t2)*sin(t3) + cos(t1)*cos(t3)*sin(t2)) - sin(t4)*(cos(t1)*sin(t2)*sin(t3) - cos(t1)*cos(t2)*cos(t3)))])115z62=Matrix([sin(t5)*(cos(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)) + sin(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2))) - cos(t5)*(cos(t4)*(cos(t2)*sin(t1)*sin(t3) + cos(t3)*sin(t1)*sin(t2)) - sin(t4)*(sin(t1)*sin(t2)*sin(t3) - cos(t2)*cos(t3)*sin(t1)))])116z63=Matrix([sin(t5)*(cos(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2)) + sin(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3))) - cos(t5)*(cos(t4)*(cos(t2)*cos(t3) - sin(t2)*sin(t3)) - sin(t4)*(cos(t2)*sin(t3) + cos(t3)*sin(t2)))])117z6 = Matrix([[z61,z62,z63]])118Je = Matrix([[J11, J12, J13, J14, J15, J16],119[J21,J22,J23,J24,J25,J26],120[J31,J32,J33,J34,J35,J36],121[z1.T, z2.T, z3.T, z4.T, z5.T, z6.T]])122'''123Je = Matrix([[J11, J21, J31],124            [J12, J22, J32],125            [J13, J23, J33],126            [J14, J24, J34],127            [J15, J25, J35],128            [J16, J26, J36]])129print(shape(Je))130'''131'''132inp = Matrix([u1, u2, u3, u4])133Ve = Je*inp134'''135def J_inv(q):136    global Je137    Js = Je.subs({t1: q[0], t2: q[1], t3: q[2], t4: q[3], t5: q[4], t6: q[5]}).evalf()138    try:139        Jp = (Js.T*Js).inv()*Js.T140    except:141        return -1142    return Jp143def get_end_effector_pos():144    global model_info145    endeff = model_info("robot::wrist_3_link", "world")146    x = endeff.link_state.pose.position.x147    y = endeff.link_state.pose.position.y148    z = endeff.link_state.pose.position.z149    return x,y,z150def controlArm():151    global Q1, Q2, Q3, Q4, Q5, Q6, Hpi, s, Goals, model_info152    # Q1, Q2, Q3, Q4, Q5, Q6 stands for:153    # shoulder, upperarm, forearm, wrist 1, wrsit 2, wrist 3154    loop_rate = rospy.Rate(10)155    current_goal = 0156    Kp = 3157    p=1158    while not rospy.is_shutdown():159        endeffx, endeffy, endeffz = get_end_effector_pos()160        Xerr = Kp*(Goals[current_goal][0] - endeffx)161        Yerr = Kp*(Goals[current_goal][1] - endeffy)162        Zerr = Kp*(Goals[current_goal][2] - endeffz)163        print(sqrt(Xerr**2 + Yerr**2 + Zerr**2 ))164        #print(Goals[current_goal][0],Goals[current_goal][0],Goals[current_goal][0])165        #print(endeffx,endeffy,endeffz)166        if(sqrt(Xerr**2 + Yerr**2 + Zerr**2 ))<3.5:167            #Go to next goal168            current_goal+=1169            print("Going to GOAL: ", current_goal+1)170        if(current_goal>len(Goals)-1):171            #End program172            break173        # Lock Q2 = rads(-90 + 35/1.571)174        V = Matrix([ [-p*Xerr], [p*Yerr], [p*Zerr], [0], [0], [0] ])  175        Q = Matrix([[Q1], [-Q2], [Q3], [Q4], [Q5], [Q6]])176        q_=J_inv(Q)*V177        178        VWheel = Matrix([ [Xerr], [Yerr], [0]])179        wheel_vel = (np.dot(H, VWheel).A1).tolist()180        wheel_vel = np.array(wheel_vel)181        if(q_==-1):182            q=Q183        elif(len(Q)==len(q_)):184            i=0185            while i<len(q_):186                if q_[i]>pi/10:187                    q_[i]=pi/10188                elif q_[i]<-pi/10:189                    q_[i]=-pi/10190                i+=1191            ind = wheel_vel>10192            wheel_vel[ind] = 10193            194            ind = wheel_vel <-10195            wheel_vel[ind]=-10196            q=Q+q_197        else:198            continue199        #print(q_)200        pub_shoulder.publish(q[0]) 201        pub_upperarm.publish(rads(-90 + (q[1]*180/pi)/(pi/2)) ) 202        pub_elbow.publish(q[2]) 203        pub_wrist1.publish(q[3])  204        pub_wrist2.publish(q[4]) 205        pub_wrist3.publish(q[5]) 206        207        wv = Float64()208        wv.data = wheel_vel[0]209        fr_pub.publish(wv)210        wv.data = wheel_vel[1]211        fl_pub.publish(wv)212        wv.data = wheel_vel[2]213        rr_pub.publish(wv)214        wv.data = wheel_vel[3]215        rl_pub.publish(wv)216        loop_rate.sleep()217    #Stop 4 motors after all the goals are reached.218    wv = Float64()219    wv.data = 0220    fr_pub.publish(wv)221    wv.data = 0222    fl_pub.publish(wv)223    wv.data = 0224    rr_pub.publish(wv)225    wv.data = 0226    rl_pub.publish(wv)227if __name__=="__main__":228    rospy.init_node("arm_ik")229    getGoals()230    rospy.Subscriber("/shoulder_pan_joint_position_controller/state/", JointControllerState, callback1, queue_size=5)231    rospy.Subscriber("/shoulder_lift_joint_position_controller/state", JointControllerState, callback2)232    rospy.Subscriber("/elbow_joint_position_controller/state", JointControllerState, callback3)233    rospy.Subscriber("/wrist_1_joint_position_controller/state", JointControllerState, callback4)    234    rospy.Subscriber("/wrist_2_joint_position_controller/state", JointControllerState, callback5)235    rospy.Subscriber("/wrist_3_joint_position_controller/state", JointControllerState, callback6)236    pub_shoulder = rospy.Publisher('/shoulder_pan_joint_position_controller/command', Float64, queue_size=5) 237    pub_upperarm = rospy.Publisher('/shoulder_lift_joint_position_controller/command', Float64, queue_size=5) 238    pub_elbow = rospy.Publisher('/elbow_joint_position_controller/command', Float64, queue_size=5) 239    pub_wrist1 = rospy.Publisher('/wrist_1_joint_position_controller/command', Float64, queue_size=5) 240    pub_wrist2 = rospy.Publisher('/wrist_2_joint_position_controller/command', Float64, queue_size=5) 241    pub_wrist3 = rospy.Publisher('/wrist_3_joint_position_controller/command', Float64, queue_size=5) 242    fr_pub = rospy.Publisher('/front_right_controller/command', Float64, queue_size=10)243    fl_pub = rospy.Publisher('/front_left_controller/command', Float64, queue_size=10)244    rr_pub = rospy.Publisher('/rear_right_controller/command', Float64, queue_size=10)245    rl_pub = rospy.Publisher('/rear_left_controller/command', Float64, queue_size=10)246    i=0247    q = Matrix([ [rads(45.001)], [rads(-90 + -80/1.571)], [rads(0.001)], [rads(0.1)], [rads(0.1)], [rads(0.1)]])248    prate = rospy.Rate(10)249    while i<1e1:250        pub_shoulder.publish(q[0]) 251        pub_upperarm.publish(rads(-90 + 35/1.571)) 252        pub_elbow.publish(q[2]) 253        pub_wrist1.publish(q[3])  254        pub_wrist2.publish(q[4]) 255        pub_wrist3.publish(q[5]) 256        fr_pub.publish(0)257        fl_pub.publish(0)258        rr_pub.publish(0)259        rl_pub.publish(0)260        i+=1261        prate.sleep()...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
