spina 0.11.1 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of spina might be problematic. Click here for more details.

Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +41 -12
  3. data/Rakefile +1 -0
  4. data/app/assets/fonts/spina/ics_spina.eot +0 -0
  5. data/app/assets/fonts/spina/ics_spina.svg +5 -3
  6. data/app/assets/fonts/spina/ics_spina.ttf +0 -0
  7. data/app/assets/fonts/spina/ics_spina.woff +0 -0
  8. data/app/assets/icons/spina/lock.svg +3 -0
  9. data/app/assets/icons/spina/preview/ics_spina-preview.html +16 -1
  10. data/app/assets/javascripts/spina/admin/application.coffee.erb +3 -25
  11. data/app/assets/javascripts/spina/admin/navigation.coffee +7 -0
  12. data/app/assets/javascripts/spina/admin/pages.coffee.erb +1 -13
  13. data/app/assets/javascripts/spina/admin/trix.coffee.erb +2 -1
  14. data/app/assets/stylesheets/spina/_admin_editing.sass +0 -4
  15. data/app/assets/stylesheets/spina/_buttons.sass +8 -8
  16. data/app/assets/stylesheets/spina/_configuration.sass +5 -1
  17. data/app/assets/stylesheets/spina/_custom_animations.sass +26 -26
  18. data/app/assets/stylesheets/spina/_fonts.sass +5 -1
  19. data/app/assets/stylesheets/spina/_forms.sass +66 -33
  20. data/app/assets/stylesheets/spina/_gallery.sass +32 -15
  21. data/app/assets/stylesheets/spina/_ics_spina.scss +1 -0
  22. data/app/assets/stylesheets/spina/_login.sass +10 -4
  23. data/app/assets/stylesheets/spina/_mixins.sass +5 -0
  24. data/app/assets/stylesheets/spina/_modal.sass +4 -4
  25. data/app/assets/stylesheets/spina/_notifications.sass +5 -5
  26. data/app/assets/stylesheets/spina/_sortable_lists.sass +9 -9
  27. data/app/assets/stylesheets/spina/_tables.sass +9 -9
  28. data/app/assets/stylesheets/spina/_wizard.sass +5 -5
  29. data/app/assets/stylesheets/spina/admin/application.sass +4 -1
  30. data/app/assets/stylesheets/spina/application.sass +0 -1
  31. data/app/assets/stylesheets/spina.sass +23 -27
  32. data/app/controllers/spina/admin/accounts_controller.rb +2 -7
  33. data/app/controllers/spina/admin/admin_controller.rb +8 -3
  34. data/app/controllers/spina/admin/attachments_controller.rb +0 -2
  35. data/app/controllers/spina/admin/navigations_controller.rb +3 -2
  36. data/app/controllers/spina/admin/pages_controller.rb +7 -8
  37. data/app/controllers/spina/admin/password_resets_controller.rb +49 -0
  38. data/app/controllers/spina/admin/photos_controller.rb +15 -34
  39. data/app/controllers/spina/admin/sessions_controller.rb +1 -1
  40. data/app/controllers/spina/admin/users_controller.rb +8 -9
  41. data/app/controllers/spina/application_controller.rb +3 -9
  42. data/app/controllers/spina/pages_controller.rb +3 -3
  43. data/app/helpers/spina/admin/pages_helper.rb +16 -23
  44. data/app/mailers/spina/user_mailer.rb +21 -0
  45. data/app/models/concerns/spina/optionable.rb +12 -0
  46. data/app/models/concerns/spina/part.rb +5 -1
  47. data/app/models/concerns/spina/partable.rb +20 -5
  48. data/app/models/concerns/spina/photo_collectable.rb +24 -0
  49. data/app/models/spina/account.rb +16 -6
  50. data/app/models/spina/layout_part.rb +1 -0
  51. data/app/models/spina/option.rb +17 -0
  52. data/app/models/spina/page.rb +36 -63
  53. data/app/models/spina/page_part.rb +1 -0
  54. data/app/models/spina/photo_collection.rb +1 -13
  55. data/app/models/spina/structure_item.rb +4 -8
  56. data/app/models/spina/structure_part.rb +2 -13
  57. data/app/models/spina/user.rb +1 -0
  58. data/app/presenters/spina/pages/menu_presenter.rb +18 -49
  59. data/app/views/layouts/spina/mail.html.erb +1 -0
  60. data/app/views/spina/admin/page_partables/{colors → options}/_form.html.haml +2 -3
  61. data/app/views/spina/admin/page_partables/photo_collections/_form.html.haml +7 -7
  62. data/app/views/spina/admin/page_partables/structures/_form.html.haml +7 -8
  63. data/app/views/spina/admin/pages/_form.html.haml +2 -2
  64. data/app/views/spina/admin/pages/_form_advanced.html.haml +2 -2
  65. data/app/views/spina/admin/password_resets/edit.html.haml +13 -0
  66. data/app/views/spina/admin/password_resets/new.html.haml +13 -0
  67. data/app/views/spina/admin/photos/_photo.html.haml +2 -1
  68. data/app/views/spina/admin/photos/{_wysihtml5_select.html.haml → _trix_select.html.haml} +2 -4
  69. data/app/views/spina/admin/photos/create.js.erb +3 -5
  70. data/app/views/spina/admin/photos/{wysihtml5_infinite_scroll.js.erb → trix_infinite_scroll.js.erb} +0 -2
  71. data/app/views/spina/admin/photos/{wysihtml5_insert.js.coffee → trix_insert.js.erb} +2 -2
  72. data/app/views/spina/admin/photos/trix_select.js.erb +3 -0
  73. data/app/views/spina/admin/sessions/new.html.haml +3 -1
  74. data/app/views/spina/admin/shared/_primary_navigation.html.haml +1 -1
  75. data/app/views/spina/admin/shared/_rich_text_field.html.haml +2 -1
  76. data/app/views/spina/admin/structure_items/_fields.html.haml +3 -3
  77. data/app/views/spina/admin/structure_partables/lines/_form.html.haml +5 -2
  78. data/app/views/spina/admin/structure_partables/options/_form.html.haml +7 -0
  79. data/app/views/spina/admin/structure_partables/photo_collections/_form.html.haml +12 -9
  80. data/app/views/spina/admin/structure_partables/photos/_form.html.haml +10 -7
  81. data/app/views/spina/admin/structure_partables/texts/_form.html.haml +5 -2
  82. data/app/views/spina/admin/users/_form.html.haml +1 -1
  83. data/app/views/spina/shared/_admin_bar.html.haml +1 -1
  84. data/app/views/spina/shared/_navigation.html.haml +1 -1
  85. data/app/views/spina/user_mailer/forgot_password.html.erb +1 -0
  86. data/app/views/spina/user_mailer/forgot_password.txt.erb +1 -0
  87. data/config/locales/en.yml +10 -0
  88. data/config/locales/nl.yml +2 -0
  89. data/config/routes.rb +5 -9
  90. data/db/migrate/1_create_spina_tables.rb +8 -7
  91. data/db/migrate/2_create_spina_translation_tables.rb +7 -26
  92. data/db/migrate/3_create_spina_navigations.rb +1 -1
  93. data/db/migrate/4_add_password_reset_token_to_spina_users.rb +6 -0
  94. data/db/migrate/5_remove_translated_columns.rb +11 -0
  95. data/db/migrate/6_create_spina_options.rb +8 -0
  96. data/lib/generators/spina/install_generator.rb +0 -22
  97. data/lib/generators/spina/templates/app/views/default/shared/_navigation.html.haml +1 -1
  98. data/lib/generators/spina/templates/app/views/demo/shared/_navigation.html.haml +1 -1
  99. data/lib/generators/spina/templates/config/initializers/themes/default.rb +9 -0
  100. data/lib/generators/spina/templates/config/initializers/themes/demo.rb +1 -9
  101. data/lib/spina/engine.rb +4 -3
  102. data/lib/spina/theme.rb +2 -1
  103. data/lib/spina/version.rb +1 -1
  104. data/lib/spina.rb +0 -23
  105. metadata +32 -69
  106. data/app/assets/images/spina/marker.png +0 -0
  107. data/app/assets/images/spina/mask.png +0 -0
  108. data/app/assets/images/spina/wheel.png +0 -0
  109. data/app/assets/stylesheets/spina/_cards.sass +0 -54
  110. data/app/assets/stylesheets/spina/_farbtastic.sass +0 -37
  111. data/app/assets/stylesheets/spina/_wysihtml5.sass +0 -79
  112. data/app/assets/stylesheets/spina/wysihtml5_textarea.sass +0 -14
  113. data/app/controllers/spina/admin/page_parts_controller.rb +0 -11
  114. data/app/helpers/spina/application_helper.rb +0 -30
  115. data/app/models/spina/ability.rb +0 -20
  116. data/app/models/spina/color.rb +0 -7
  117. data/app/presenters/spina/pages/breadcrumb.rb +0 -102
  118. data/app/views/layouts/spina/email.html.erb +0 -124
  119. data/app/views/spina/admin/layout_partables/colors/_form.html.haml +0 -4
  120. data/app/views/spina/admin/page_parts/_wysihtml5_link.html.haml +0 -12
  121. data/app/views/spina/admin/page_parts/insert_wysihtml5_link.js +0 -5
  122. data/app/views/spina/admin/page_parts/wysihtml5_link.js +0 -2
  123. data/app/views/spina/admin/photos/create_and_select.js.erb +0 -7
  124. data/app/views/spina/admin/photos/create_multiple.js.erb +0 -4
  125. data/app/views/spina/admin/photos/wysihtml5_select.js.erb +0 -3
  126. data/vendor/assets/javascripts/spina/jquery.farbtastic.js +0 -345
  127. data/vendor/assets/javascripts/spina/morris.js +0 -1767
  128. data/vendor/assets/javascripts/spina/raphael.js +0 -8111
  129. data/vendor/assets/javascripts/spina/wysihtml5.js +0 -269
  130. data/vendor/assets/javascripts/spina/wysihtml5_parser_rules.js +0 -551
  131. data/vendor/assets/stylesheets/spina/_morris.scss +0 -2
@@ -1,269 +0,0 @@
1
- /*
2
- wysihtml5 v0.4.0pre
3
- https://github.com/xing/wysihtml5
4
-
5
- Author: Christopher Blum (https://github.com/tiff)
6
-
7
- Copyright (C) 2012 XING AG
8
- Licensed under the MIT license (MIT)
9
-
10
- Rangy, a cross-browser JavaScript range and selection library
11
- http://code.google.com/p/rangy/
12
-
13
- Copyright 2011, Tim Down
14
- Licensed under the MIT license.
15
- Version: 1.2.2
16
- Build date: 13 November 2011
17
- */
18
- var wysihtml5={version:"0.4.0pre",commands:{},dom:{},quirks:{},toolbar:{},lang:{},selection:{},views:{},INVISIBLE_SPACE:"\ufeff",EMPTY_FUNCTION:function(){},ELEMENT_NODE:1,TEXT_NODE:3,BACKSPACE_KEY:8,ENTER_KEY:13,ESCAPE_KEY:27,SPACE_KEY:32,DELETE_KEY:46};
19
- window.rangy=function(){function a(a,b){var c=typeof a[b];return c==l||!(c!=h||!a[b])||"unknown"==c}function c(a,b){return!(typeof a[b]!=h||!a[b])}function b(a,b){return typeof a[b]!=p}function d(a){return function(b,c){for(var d=c.length;d--;)if(!a(b,c[d]))return!1;return!0}}function e(a){return a&&r(a,q)&&v(a,D)}function f(a){window.alert("Rangy not supported in your browser. Reason: "+a);t.initialized=!0;t.supported=!1}function g(){if(!t.initialized){var b,d=!1,l=!1;a(document,"createRange")&&
20
- (b=document.createRange(),r(b,u)&&v(b,n)&&(d=!0),b.detach());(b=c(document,"body")?document.body:document.getElementsByTagName("body")[0])&&a(b,"createTextRange")&&(b=b.createTextRange(),e(b)&&(l=!0));d||l||f("Neither Range nor TextRange are implemented");t.initialized=!0;t.features={implementsDomRange:d,implementsTextRange:l};d=A.concat(w);l=0;for(b=d.length;l<b;++l)try{d[l](t)}catch(h){c(window,"console")&&a(window.console,"log")&&window.console.log("Init listener threw an exception. Continuing.",
21
- h)}}}function k(a){this.name=a;this.supported=this.initialized=!1}var h="object",l="function",p="undefined",n="startContainer startOffset endContainer endOffset collapsed commonAncestorContainer START_TO_START START_TO_END END_TO_START END_TO_END".split(" "),u="setStart setStartBefore setStartAfter setEnd setEndBefore setEndAfter collapse selectNode selectNodeContents compareBoundaryPoints deleteContents extractContents cloneContents insertNode surroundContents cloneRange toString detach".split(" "),
22
- D="boundingHeight boundingLeft boundingTop boundingWidth htmlText text".split(" "),q="collapse compareEndPoints duplicate getBookmark moveToBookmark moveToElementText parentElement pasteHTML select setEndPoint getBoundingClientRect".split(" "),r=d(a),s=d(c),v=d(b),t={version:"1.2.2",initialized:!1,supported:!0,util:{isHostMethod:a,isHostObject:c,isHostProperty:b,areHostMethods:r,areHostObjects:s,areHostProperties:v,isTextRange:e},features:{},modules:{},config:{alertOnWarn:!1,preferTextRange:!1}};
23
- t.fail=f;t.warn=function(a){a="Rangy warning: "+a;t.config.alertOnWarn?window.alert(a):typeof window.console!=p&&typeof window.console.log!=p&&window.console.log(a)};({}).hasOwnProperty?t.util.extend=function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])}:f("hasOwnProperty not supported");var w=[],A=[];t.init=g;t.addInitListener=function(a){t.initialized?a(t):w.push(a)};var z=[];t.addCreateMissingNativeApiListener=function(a){z.push(a)};t.createMissingNativeApi=function(a){a=a||window;g();
24
- for(var b=0,c=z.length;b<c;++b)z[b](a)};k.prototype.fail=function(a){this.initialized=!0;this.supported=!1;throw Error("Module '"+this.name+"' failed to load: "+a);};k.prototype.warn=function(a){t.warn("Module "+this.name+": "+a)};k.prototype.createError=function(a){return Error("Error in Rangy "+this.name+" module: "+a)};t.createModule=function(a,b){var c=new k(a);t.modules[a]=c;A.push(function(a){b(a,c);c.initialized=!0;c.supported=!0})};t.requireModules=function(a){for(var b=0,c=a.length,d,e;b<
25
- c;++b){e=a[b];d=t.modules[e];if(!(d&&d instanceof k))throw Error("Module '"+e+"' not found");if(!d.supported)throw Error("Module '"+e+"' not supported");}};var E=!1,s=function(a){E||(E=!0,t.initialized||g())};if(typeof window==p)f("No window found");else if(typeof document==p)f("No document found");else return a(document,"addEventListener")&&document.addEventListener("DOMContentLoaded",s,!1),a(window,"addEventListener")?window.addEventListener("load",s,!1):a(window,"attachEvent")?window.attachEvent("onload",
26
- s):f("Window does not have required addEventListener or attachEvent method"),t}();
27
- rangy.createModule("DomUtil",function(a,c){function b(a){for(var b=0;a=a.previousSibling;)b++;return b}function d(a,b){var c=[],d;for(d=a;d;d=d.parentNode)c.push(d);for(d=b;d;d=d.parentNode)if(r(c,d))return d;return null}function e(a,b,c){for(c=c?a:a.parentNode;c;){a=c.parentNode;if(a===b)return c;c=a}return null}function f(a){a=a.nodeType;return 3==a||4==a||8==a}function g(a,b){var c=b.nextSibling,d=b.parentNode;c?d.insertBefore(a,c):d.appendChild(a);return a}function k(a){if(9==a.nodeType)return a;
28
- if(typeof a.ownerDocument!=u)return a.ownerDocument;if(typeof a.document!=u)return a.document;if(a.parentNode)return k(a.parentNode);throw Error("getDocument: no document found for node");}function h(a){return a?f(a)?'"'+a.data+'"':1==a.nodeType?"<"+a.nodeName+(a.id?' id="'+a.id+'"':"")+">["+a.childNodes.length+"]":a.nodeName:"[No node]"}function l(a){this._next=this.root=a}function p(a,b){this.node=a;this.offset=b}function n(a){this.code=this[a];this.codeName=a;this.message="DOMException: "+this.codeName}
29
- var u="undefined",D=a.util;D.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||c.fail("document missing a Node creation method");D.isHostMethod(document,"getElementsByTagName")||c.fail("document missing getElementsByTagName method");var q=document.createElement("div");D.areHostMethods(q,["insertBefore","appendChild","cloneNode"])||c.fail("Incomplete Element implementation");D.isHostProperty(q,"innerHTML")||c.fail("Element is missing innerHTML property");q=document.createTextNode("test");
30
- D.areHostMethods(q,["splitText","deleteData","insertData","appendData","cloneNode"])||c.fail("Incomplete Text Node implementation");var r=function(a,b){for(var c=a.length;c--;)if(a[c]===b)return!0;return!1};l.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var a=this._current=this._next,b;if(this._current){b=a.firstChild;if(!b)for(b=null;a!==this.root&&!(b=a.nextSibling);)a=a.parentNode;this._next=b}return this._current},detach:function(){this._current=this._next=this.root=
31
- null}};p.prototype={equals:function(a){return this.node===a.node&this.offset==a.offset},inspect:function(){return"[DomPosition("+h(this.node)+":"+this.offset+")]"}};n.prototype={INDEX_SIZE_ERR:1,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INVALID_STATE_ERR:11};n.prototype.toString=function(){return this.message};a.dom={arrayContains:r,isHtmlNamespace:function(a){var b;return typeof a.namespaceURI==u||null===(b=a.namespaceURI)||"http://www.w3.org/1999/xhtml"==
32
- b},parentElement:function(a){a=a.parentNode;return 1==a.nodeType?a:null},getNodeIndex:b,getNodeLength:function(a){var b;return f(a)?a.length:(b=a.childNodes)?b.length:0},getCommonAncestor:d,isAncestorOf:function(a,b,c){for(b=c?b:b.parentNode;b;){if(b===a)return!0;b=b.parentNode}return!1},getClosestAncestorIn:e,isCharacterDataNode:f,insertAfter:g,splitDataNode:function(a,b){var c=a.cloneNode(!1);c.deleteData(0,b);a.deleteData(b,a.length-b);g(c,a);return c},getDocument:k,getWindow:function(a){a=k(a);
33
- if(typeof a.defaultView!=u)return a.defaultView;if(typeof a.parentWindow!=u)return a.parentWindow;throw Error("Cannot get a window object for node");},getIframeWindow:function(a){if(typeof a.contentWindow!=u)return a.contentWindow;if(typeof a.contentDocument!=u)return a.contentDocument.defaultView;throw Error("getIframeWindow: No Window object found for iframe element");},getIframeDocument:function(a){if(typeof a.contentDocument!=u)return a.contentDocument;if(typeof a.contentWindow!=u)return a.contentWindow.document;
34
- throw Error("getIframeWindow: No Document object found for iframe element");},getBody:function(a){return D.isHostObject(a,"body")?a.body:a.getElementsByTagName("body")[0]},getRootContainer:function(a){for(var b;b=a.parentNode;)a=b;return a},comparePoints:function(a,c,l,h){var f;if(a==l)return c===h?0:c<h?-1:1;if(f=e(l,a,!0))return c<=b(f)?-1:1;if(f=e(a,l,!0))return b(f)<h?-1:1;c=d(a,l);a=a===c?c:e(a,c,!0);l=l===c?c:e(l,c,!0);if(a===l)throw Error("comparePoints got to case 4 and childA and childB are the same!");
35
- for(c=c.firstChild;c;){if(c===a)return-1;if(c===l)return 1;c=c.nextSibling}throw Error("Should not be here!");},inspectNode:h,fragmentFromNodeChildren:function(a){for(var b=k(a).createDocumentFragment(),c;c=a.firstChild;)b.appendChild(c);return b},createIterator:function(a){return new l(a)},DomPosition:p};a.DOMException=n});
36
- rangy.createModule("DomRange",function(a,c){function b(a,b){return 3!=a.nodeType&&(m.isAncestorOf(a,b.startContainer,!0)||m.isAncestorOf(a,b.endContainer,!0))}function d(a){return m.getDocument(a.startContainer)}function e(a,b,c){if(b=a._listeners[b])for(var d=0,e=b.length;d<e;++d)b[d].call(a,{target:a,args:c})}function f(a){return new I(a.parentNode,m.getNodeIndex(a))}function g(a){return new I(a.parentNode,m.getNodeIndex(a)+1)}function k(a,b,c){var d=11==a.nodeType?a.firstChild:a;m.isCharacterDataNode(b)?
37
- c==b.length?m.insertAfter(a,b):b.parentNode.insertBefore(a,0==c?b:m.splitDataNode(b,c)):c>=b.childNodes.length?b.appendChild(a):b.insertBefore(a,b.childNodes[c]);return d}function h(a){for(var b,c,e=d(a.range).createDocumentFragment();c=a.next();){b=a.isPartiallySelectedSubtree();c=c.cloneNode(!b);b&&(b=a.getSubtreeIterator(),c.appendChild(h(b)),b.detach(!0));if(10==c.nodeType)throw new F("HIERARCHY_REQUEST_ERR");e.appendChild(c)}return e}function l(a,b,c){var d,e;for(c=c||{stop:!1};d=a.next();)if(a.isPartiallySelectedSubtree())if(!1===
38
- b(d)){c.stop=!0;break}else{if(d=a.getSubtreeIterator(),l(d,b,c),d.detach(!0),c.stop)break}else for(d=m.createIterator(d);e=d.next();)if(!1===b(e)){c.stop=!0;return}}function p(a){for(var b;a.next();)a.isPartiallySelectedSubtree()?(b=a.getSubtreeIterator(),p(b),b.detach(!0)):a.remove()}function n(a){for(var b,c=d(a.range).createDocumentFragment(),e;b=a.next();){a.isPartiallySelectedSubtree()?(b=b.cloneNode(!1),e=a.getSubtreeIterator(),b.appendChild(n(e)),e.detach(!0)):a.remove();if(10==b.nodeType)throw new F("HIERARCHY_REQUEST_ERR");
39
- c.appendChild(b)}return c}function u(a,b,c){var d=!(!b||!b.length),e,h=!!c;d&&(e=RegExp("^("+b.join("|")+")$"));var f=[];l(new q(a,!1),function(a){d&&!e.test(a.nodeType)||h&&!c(a)||f.push(a)});return f}function D(a){return"["+("undefined"==typeof a.getName?"Range":a.getName())+"("+m.inspectNode(a.startContainer)+":"+a.startOffset+", "+m.inspectNode(a.endContainer)+":"+a.endOffset+")]"}function q(a,b){this.range=a;this.clonePartiallySelectedTextNodes=b;if(!a.collapsed){this.sc=a.startContainer;this.so=
40
- a.startOffset;this.ec=a.endContainer;this.eo=a.endOffset;var c=a.commonAncestorContainer;this.sc===this.ec&&m.isCharacterDataNode(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc!==c||m.isCharacterDataNode(this.sc)?m.getClosestAncestorIn(this.sc,c,!0):this.sc.childNodes[this.so],this._last=this.ec!==c||m.isCharacterDataNode(this.ec)?m.getClosestAncestorIn(this.ec,c,!0):this.ec.childNodes[this.eo-1])}}function r(a){this.code=this[a];
41
- this.codeName=a;this.message="RangeException: "+this.codeName}function s(a,b,c){this.nodes=u(a,b,c);this._next=this.nodes[0];this._position=0}function v(a){return function(b,c){for(var d,e=c?b:b.parentNode;e;){d=e.nodeType;if(m.arrayContains(a,d))return e;e=e.parentNode}return null}}function t(a,b){if(da(a,b))throw new r("INVALID_NODE_TYPE_ERR");}function w(a){if(!a.startContainer)throw new F("INVALID_STATE_ERR");}function A(a,b){if(!m.arrayContains(b,a.nodeType))throw new r("INVALID_NODE_TYPE_ERR");
42
- }function z(a,b){if(0>b||b>(m.isCharacterDataNode(a)?a.length:a.childNodes.length))throw new F("INDEX_SIZE_ERR");}function E(a,b){if(S(a,!0)!==S(b,!0))throw new F("WRONG_DOCUMENT_ERR");}function y(a){if(ea(a,!0))throw new F("NO_MODIFICATION_ALLOWED_ERR");}function B(a,b){if(!a)throw new F(b);}function x(a){w(a);if(!m.arrayContains(M,a.startContainer.nodeType)&&!S(a.startContainer,!0)||!m.arrayContains(M,a.endContainer.nodeType)&&!S(a.endContainer,!0)||!(a.startOffset<=(m.isCharacterDataNode(a.startContainer)?
43
- a.startContainer.length:a.startContainer.childNodes.length)&&a.endOffset<=(m.isCharacterDataNode(a.endContainer)?a.endContainer.length:a.endContainer.childNodes.length)))throw Error("Range error: Range is no longer valid after DOM mutation ("+a.inspect()+")");}function L(){}function H(a){a.START_TO_START=U;a.START_TO_END=Y;a.END_TO_END=fa;a.END_TO_START=Z;a.NODE_BEFORE=$;a.NODE_AFTER=aa;a.NODE_BEFORE_AND_AFTER=ba;a.NODE_INSIDE=V}function G(a){H(a);H(a.prototype)}function N(a,b){return function(){x(this);
44
- var c=this.startContainer,d=this.startOffset,e=this.commonAncestorContainer,h=new q(this,!0);c!==e&&(c=m.getClosestAncestorIn(c,e,!0),d=g(c),c=d.node,d=d.offset);l(h,y);h.reset();e=a(h);h.detach();b(this,c,d,c,d);return e}}function P(c,d,e){function l(a,b){return function(c){w(this);A(c,J);A(Q(c),M);c=(a?f:g)(c);(b?h:T)(this,c.node,c.offset)}}function h(a,b,c){var e=a.endContainer,l=a.endOffset;if(b!==a.startContainer||c!==a.startOffset){if(Q(b)!=Q(e)||1==m.comparePoints(b,c,e,l))e=b,l=c;d(a,b,c,
45
- e,l)}}function T(a,b,c){var e=a.startContainer,l=a.startOffset;if(b!==a.endContainer||c!==a.endOffset){if(Q(b)!=Q(e)||-1==m.comparePoints(b,c,e,l))e=b,l=c;d(a,e,l,b,c)}}c.prototype=new L;a.util.extend(c.prototype,{setStart:function(a,b){w(this);t(a,!0);z(a,b);h(this,a,b)},setEnd:function(a,b){w(this);t(a,!0);z(a,b);T(this,a,b)},setStartBefore:l(!0,!0),setStartAfter:l(!1,!0),setEndBefore:l(!0,!1),setEndAfter:l(!1,!1),collapse:function(a){x(this);a?d(this,this.startContainer,this.startOffset,this.startContainer,
46
- this.startOffset):d(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(a){w(this);t(a,!0);d(this,a,0,a,m.getNodeLength(a))},selectNode:function(a){w(this);t(a,!1);A(a,J);var b=f(a);a=g(a);d(this,b.node,b.offset,a.node,a.offset)},extractContents:N(n,d),deleteContents:N(p,d),canSurroundContents:function(){x(this);y(this.startContainer);y(this.endContainer);var a=new q(this,!0),c=a._first&&b(a._first,this)||a._last&&b(a._last,this);a.detach();return!c},
47
- detach:function(){e(this)},splitBoundaries:function(){x(this);var a=this.startContainer,b=this.startOffset,c=this.endContainer,e=this.endOffset,l=a===c;m.isCharacterDataNode(c)&&(0<e&&e<c.length)&&m.splitDataNode(c,e);m.isCharacterDataNode(a)&&(0<b&&b<a.length)&&(a=m.splitDataNode(a,b),l?(e-=b,c=a):c==a.parentNode&&e>=m.getNodeIndex(a)&&e++,b=0);d(this,a,b,c,e)},normalizeBoundaries:function(){x(this);var a=this.startContainer,b=this.startOffset,c=this.endContainer,e=this.endOffset,l=function(a){var b=
48
- a.nextSibling;b&&b.nodeType==a.nodeType&&(c=a,e=a.length,a.appendData(b.data),b.parentNode.removeChild(b))},h=function(d){var l=d.previousSibling;if(l&&l.nodeType==d.nodeType){a=d;var h=d.length;b=l.length;d.insertData(0,l.data);l.parentNode.removeChild(l);a==c?(e+=b,c=a):c==d.parentNode&&(l=m.getNodeIndex(d),e==l?(c=d,e=h):e>l&&e--)}},f=!0;m.isCharacterDataNode(c)?c.length==e&&l(c):(0<e&&(f=c.childNodes[e-1])&&m.isCharacterDataNode(f)&&l(f),f=!this.collapsed);f?m.isCharacterDataNode(a)?0==b&&h(a):
49
- b<a.childNodes.length&&(l=a.childNodes[b])&&m.isCharacterDataNode(l)&&h(l):(a=c,b=e);d(this,a,b,c,e)},collapseToPoint:function(a,b){w(this);t(a,!0);z(a,b);a===this.startContainer&&b===this.startOffset&&a===this.endContainer&&b===this.endOffset||d(this,a,b,a,b)}});G(c)}function O(a){a.collapsed=a.startContainer===a.endContainer&&a.startOffset===a.endOffset;a.commonAncestorContainer=a.collapsed?a.startContainer:m.getCommonAncestor(a.startContainer,a.endContainer)}function R(a,b,c,d,l){var h=a.startContainer!==
50
- b||a.startOffset!==c,f=a.endContainer!==d||a.endOffset!==l;a.startContainer=b;a.startOffset=c;a.endContainer=d;a.endOffset=l;O(a);e(a,"boundarychange",{startMoved:h,endMoved:f})}function C(a){this.startContainer=a;this.startOffset=0;this.endContainer=a;this.endOffset=0;this._listeners={boundarychange:[],detach:[]};O(this)}a.requireModules(["DomUtil"]);var m=a.dom,I=m.DomPosition,F=a.DOMException;q.prototype={_current:null,_next:null,_first:null,_last:null,isSingleCharacterDataNode:!1,reset:function(){this._current=
51
- null;this._next=this._first},hasNext:function(){return!!this._next},next:function(){var a=this._current=this._next;a&&(this._next=a!==this._last?a.nextSibling:null,m.isCharacterDataNode(a)&&this.clonePartiallySelectedTextNodes&&(a===this.ec&&(a=a.cloneNode(!0)).deleteData(this.eo,a.length-this.eo),this._current===this.sc&&(a=a.cloneNode(!0)).deleteData(0,this.so)));return a},remove:function(){var a=this._current,b,c;!m.isCharacterDataNode(a)||a!==this.sc&&a!==this.ec?a.parentNode&&a.parentNode.removeChild(a):
52
- (b=a===this.sc?this.so:0,c=a===this.ec?this.eo:a.length,b!=c&&a.deleteData(b,c-b))},isPartiallySelectedSubtree:function(){return b(this._current,this.range)},getSubtreeIterator:function(){var a;if(this.isSingleCharacterDataNode)a=this.range.cloneRange(),a.collapse();else{a=new C(d(this.range));var b=this._current,c=b,e=0,l=b,h=m.getNodeLength(b);m.isAncestorOf(b,this.sc,!0)&&(c=this.sc,e=this.so);m.isAncestorOf(b,this.ec,!0)&&(l=this.ec,h=this.eo);R(a,c,e,l,h)}return new q(a,this.clonePartiallySelectedTextNodes)},
53
- detach:function(a){a&&this.range.detach();this.range=this._current=this._next=this._first=this._last=this.sc=this.so=this.ec=this.eo=null}};r.prototype={BAD_BOUNDARYPOINTS_ERR:1,INVALID_NODE_TYPE_ERR:2};r.prototype.toString=function(){return this.message};s.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){this._current=this._next;this._next=this.nodes[++this._position];return this._current},detach:function(){this._current=this._next=this.nodes=null}};var J=[1,3,4,5,
54
- 7,8,10],M=[2,9,11],K=[1,3,4,5,7,8,10,11],T=[1,3,4,5,7,8],Q=m.getRootContainer,S=v([9,11]),ea=v([5,6,10,12]),da=v([6,10,12]),ca=document.createElement("style"),W=!1;try{ca.innerHTML="<b>x</b>",W=3==ca.firstChild.nodeType}catch(ga){}a.features.htmlParsingConforms=W;var X="startContainer startOffset endContainer endOffset collapsed commonAncestorContainer".split(" "),U=0,Y=1,fa=2,Z=3,$=0,aa=1,ba=2,V=3;L.prototype={attachListener:function(a,b){this._listeners[a].push(b)},compareBoundaryPoints:function(a,
55
- b){x(this);E(this.startContainer,b.startContainer);var c=a==Z||a==U?"start":"end",d=a==Y||a==U?"start":"end";return m.comparePoints(this[c+"Container"],this[c+"Offset"],b[d+"Container"],b[d+"Offset"])},insertNode:function(a){x(this);A(a,K);y(this.startContainer);if(m.isAncestorOf(a,this.startContainer,!0))throw new F("HIERARCHY_REQUEST_ERR");a=k(a,this.startContainer,this.startOffset);this.setStartBefore(a)},cloneContents:function(){x(this);var a,b;if(this.collapsed)return d(this).createDocumentFragment();
56
- if(this.startContainer===this.endContainer&&m.isCharacterDataNode(this.startContainer))return a=this.startContainer.cloneNode(!0),a.data=a.data.slice(this.startOffset,this.endOffset),b=d(this).createDocumentFragment(),b.appendChild(a),b;b=new q(this,!0);a=h(b);b.detach();return a},canSurroundContents:function(){x(this);y(this.startContainer);y(this.endContainer);var a=new q(this,!0),c=a._first&&b(a._first,this)||a._last&&b(a._last,this);a.detach();return!c},surroundContents:function(a){A(a,T);if(!this.canSurroundContents())throw new r("BAD_BOUNDARYPOINTS_ERR");
57
- var b=this.extractContents();if(a.hasChildNodes())for(;a.lastChild;)a.removeChild(a.lastChild);k(a,this.startContainer,this.startOffset);a.appendChild(b);this.selectNode(a)},cloneRange:function(){x(this);for(var a=new C(d(this)),b=X.length,c;b--;)c=X[b],a[c]=this[c];return a},toString:function(){x(this);var a=this.startContainer;if(a===this.endContainer&&m.isCharacterDataNode(a))return 3==a.nodeType||4==a.nodeType?a.data.slice(this.startOffset,this.endOffset):"";var b=[],a=new q(this,!0);l(a,function(a){3!=
58
- a.nodeType&&4!=a.nodeType||b.push(a.data)});a.detach();return b.join("")},compareNode:function(a){x(this);var b=a.parentNode,c=m.getNodeIndex(a);if(!b)throw new F("NOT_FOUND_ERR");a=this.comparePoint(b,c);b=this.comparePoint(b,c+1);return 0>a?0<b?ba:$:0<b?aa:V},comparePoint:function(a,b){x(this);B(a,"HIERARCHY_REQUEST_ERR");E(a,this.startContainer);return 0>m.comparePoints(a,b,this.startContainer,this.startOffset)?-1:0<m.comparePoints(a,b,this.endContainer,this.endOffset)?1:0},createContextualFragment:W?
59
- function(a){var b=this.startContainer,c=m.getDocument(b);if(!b)throw new F("INVALID_STATE_ERR");var d=null;1==b.nodeType?d=b:m.isCharacterDataNode(b)&&(d=m.parentElement(b));d=null===d||"HTML"==d.nodeName&&m.isHtmlNamespace(m.getDocument(d).documentElement)&&m.isHtmlNamespace(d)?c.createElement("body"):d.cloneNode(!1);d.innerHTML=a;return m.fragmentFromNodeChildren(d)}:function(a){w(this);var b=d(this).createElement("body");b.innerHTML=a;return m.fragmentFromNodeChildren(b)},toHtml:function(){x(this);
60
- var a=d(this).createElement("div");a.appendChild(this.cloneContents());return a.innerHTML},intersectsNode:function(a,b){x(this);B(a,"NOT_FOUND_ERR");if(m.getDocument(a)!==d(this))return!1;var c=a.parentNode,e=m.getNodeIndex(a);B(c,"NOT_FOUND_ERR");var l=m.comparePoints(c,e,this.endContainer,this.endOffset),c=m.comparePoints(c,e+1,this.startContainer,this.startOffset);return b?0>=l&&0<=c:0>l&&0<c},isPointInRange:function(a,b){x(this);B(a,"HIERARCHY_REQUEST_ERR");E(a,this.startContainer);return 0<=
61
- m.comparePoints(a,b,this.startContainer,this.startOffset)&&0>=m.comparePoints(a,b,this.endContainer,this.endOffset)},intersectsRange:function(a,b){x(this);if(d(a)!=d(this))throw new F("WRONG_DOCUMENT_ERR");var c=m.comparePoints(this.startContainer,this.startOffset,a.endContainer,a.endOffset),e=m.comparePoints(this.endContainer,this.endOffset,a.startContainer,a.startOffset);return b?0>=c&&0<=e:0>c&&0<e},intersection:function(a){if(this.intersectsRange(a)){var b=m.comparePoints(this.startContainer,
62
- this.startOffset,a.startContainer,a.startOffset),c=m.comparePoints(this.endContainer,this.endOffset,a.endContainer,a.endOffset),d=this.cloneRange();-1==b&&d.setStart(a.startContainer,a.startOffset);1==c&&d.setEnd(a.endContainer,a.endOffset);return d}return null},union:function(a){if(this.intersectsRange(a,!0)){var b=this.cloneRange();-1==m.comparePoints(a.startContainer,a.startOffset,this.startContainer,this.startOffset)&&b.setStart(a.startContainer,a.startOffset);1==m.comparePoints(a.endContainer,
63
- a.endOffset,this.endContainer,this.endOffset)&&b.setEnd(a.endContainer,a.endOffset);return b}throw new r("Ranges do not intersect");},containsNode:function(a,b){return b?this.intersectsNode(a,!1):this.compareNode(a)==V},containsNodeContents:function(a){return 0<=this.comparePoint(a,0)&&0>=this.comparePoint(a,m.getNodeLength(a))},containsRange:function(a){return this.intersection(a).equals(a)},containsNodeText:function(a){var b=this.cloneRange();b.selectNode(a);var c=b.getNodes([3]);return 0<c.length?
64
- (b.setStart(c[0],0),a=c.pop(),b.setEnd(a,a.length),a=this.containsRange(b),b.detach(),a):this.containsNodeContents(a)},createNodeIterator:function(a,b){x(this);return new s(this,a,b)},getNodes:function(a,b){x(this);return u(this,a,b)},getDocument:function(){return d(this)},collapseBefore:function(a){w(this);this.setEndBefore(a);this.collapse(!1)},collapseAfter:function(a){w(this);this.setStartAfter(a);this.collapse(!0)},getName:function(){return"DomRange"},equals:function(a){return C.rangesEqual(this,
65
- a)},inspect:function(){return D(this)}};P(C,R,function(a){w(a);a.startContainer=a.startOffset=a.endContainer=a.endOffset=null;a.collapsed=a.commonAncestorContainer=null;e(a,"detach",null);a._listeners=null});a.rangePrototype=L.prototype;C.rangeProperties=X;C.RangeIterator=q;C.copyComparisonConstants=G;C.createPrototypeRange=P;C.inspect=D;C.getRangeDocument=d;C.rangesEqual=function(a,b){return a.startContainer===b.startContainer&&a.startOffset===b.startOffset&&a.endContainer===b.endContainer&&a.endOffset===
66
- b.endOffset};a.DomRange=C;a.RangeException=r});
67
- rangy.createModule("WrappedRange",function(a,c){function b(a,b,c,d){var e=a.duplicate();e.collapse(c);var h=e.parentElement();f.isAncestorOf(b,h,!0)||(h=b);if(!h.canHaveHTML)return new g(h.parentNode,f.getNodeIndex(h));b=f.getDocument(h).createElement("span");var k,s=c?"StartToStart":"StartToEnd";do h.insertBefore(b,b.previousSibling),e.moveToElementText(b);while(0<(k=e.compareEndPoints(s,a))&&b.previousSibling);s=b.nextSibling;if(-1==k&&s&&f.isCharacterDataNode(s)){e.setEndPoint(c?"EndToStart":"EndToEnd",
68
- a);if(/[\r\n]/.test(s.data))for(h=e.duplicate(),c=h.text.replace(/\r\n/g,"\r").length,c=h.moveStart("character",c);-1==h.compareEndPoints("StartToEnd",h);)c++,h.moveStart("character",1);else c=e.text.length;h=new g(s,c)}else s=(d||!c)&&b.previousSibling,h=(c=(d||c)&&b.nextSibling)&&f.isCharacterDataNode(c)?new g(c,0):s&&f.isCharacterDataNode(s)?new g(s,s.length):new g(h,f.getNodeIndex(b));b.parentNode.removeChild(b);return h}function d(a,b){var c,d,e=a.offset,h=f.getDocument(a.node),g=h.body.createTextRange(),
69
- k=f.isCharacterDataNode(a.node);k?(c=a.node,d=c.parentNode):(c=a.node.childNodes,c=e<c.length?c[e]:null,d=a.node);h=h.createElement("span");h.innerHTML="&#feff;";c?d.insertBefore(h,c):d.appendChild(h);g.moveToElementText(h);g.collapse(!b);d.removeChild(h);if(k)g[b?"moveStart":"moveEnd"]("character",e);return g}a.requireModules(["DomUtil","DomRange"]);var e,f=a.dom,g=f.DomPosition,k=a.DomRange;if(a.features.implementsDomRange&&(!a.features.implementsTextRange||!a.config.preferTextRange))(function(){function b(a){for(var c=
70
- d.length,e;c--;)e=d[c],a[e]=a.nativeRange[e]}var c,d=k.rangeProperties,h;e=function(a){if(!a)throw Error("Range must be specified");this.nativeRange=a;b(this)};k.createPrototypeRange(e,function(a,b,c,d,e){var h=a.endContainer!==d||a.endOffset!=e;if(a.startContainer!==b||a.startOffset!=c||h)a.setEnd(d,e),a.setStart(b,c)},function(a){a.nativeRange.detach();a.detached=!0;for(var b=d.length,c;b--;)c=d[b],a[c]=null});c=e.prototype;c.selectNode=function(a){this.nativeRange.selectNode(a);b(this)};c.deleteContents=
71
- function(){this.nativeRange.deleteContents();b(this)};c.extractContents=function(){var a=this.nativeRange.extractContents();b(this);return a};c.cloneContents=function(){return this.nativeRange.cloneContents()};c.surroundContents=function(a){this.nativeRange.surroundContents(a);b(this)};c.collapse=function(a){this.nativeRange.collapse(a);b(this)};c.cloneRange=function(){return new e(this.nativeRange.cloneRange())};c.refresh=function(){b(this)};c.toString=function(){return this.nativeRange.toString()};
72
- var g=document.createTextNode("test");f.getBody(document).appendChild(g);var q=document.createRange();q.setStart(g,0);q.setEnd(g,0);try{q.setStart(g,1),c.setStart=function(a,c){this.nativeRange.setStart(a,c);b(this)},c.setEnd=function(a,c){this.nativeRange.setEnd(a,c);b(this)},h=function(a){return function(c){this.nativeRange[a](c);b(this)}}}catch(r){c.setStart=function(a,c){try{this.nativeRange.setStart(a,c)}catch(d){this.nativeRange.setEnd(a,c),this.nativeRange.setStart(a,c)}b(this)},c.setEnd=function(a,
73
- c){try{this.nativeRange.setEnd(a,c)}catch(d){this.nativeRange.setStart(a,c),this.nativeRange.setEnd(a,c)}b(this)},h=function(a,c){return function(d){try{this.nativeRange[a](d)}catch(e){this.nativeRange[c](d),this.nativeRange[a](d)}b(this)}}}c.setStartBefore=h("setStartBefore","setEndBefore");c.setStartAfter=h("setStartAfter","setEndAfter");c.setEndBefore=h("setEndBefore","setStartBefore");c.setEndAfter=h("setEndAfter","setStartAfter");q.selectNodeContents(g);c.selectNodeContents=q.startContainer==
74
- g&&q.endContainer==g&&0==q.startOffset&&q.endOffset==g.length?function(a){this.nativeRange.selectNodeContents(a);b(this)}:function(a){this.setStart(a,0);this.setEnd(a,k.getEndOffset(a))};q.selectNodeContents(g);q.setEnd(g,3);h=document.createRange();h.selectNodeContents(g);h.setEnd(g,4);h.setStart(g,2);-1==q.compareBoundaryPoints(q.START_TO_END,h)&1==q.compareBoundaryPoints(q.END_TO_START,h)?c.compareBoundaryPoints=function(a,b){b=b.nativeRange||b;a==b.START_TO_END?a=b.END_TO_START:a==b.END_TO_START&&
75
- (a=b.START_TO_END);return this.nativeRange.compareBoundaryPoints(a,b)}:c.compareBoundaryPoints=function(a,b){return this.nativeRange.compareBoundaryPoints(a,b.nativeRange||b)};a.util.isHostMethod(q,"createContextualFragment")&&(c.createContextualFragment=function(a){return this.nativeRange.createContextualFragment(a)});f.getBody(document).removeChild(g);q.detach();h.detach()})(),a.createNativeRange=function(a){a=a||document;return a.createRange()};else if(a.features.implementsTextRange){e=function(a){this.textRange=
76
- a;this.refresh()};e.prototype=new k(document);e.prototype.refresh=function(){var a,c,d=this.textRange;a=d.parentElement();var e=d.duplicate();e.collapse(!0);c=e.parentElement();e=d.duplicate();e.collapse(!1);d=e.parentElement();c=c==d?c:f.getCommonAncestor(c,d);c=c==a?c:f.getCommonAncestor(a,c);0==this.textRange.compareEndPoints("StartToEnd",this.textRange)?c=a=b(this.textRange,c,!0,!0):(a=b(this.textRange,c,!0,!1),c=b(this.textRange,c,!1,!1));this.setStart(a.node,a.offset);this.setEnd(c.node,c.offset)};
77
- k.copyComparisonConstants(e);var h=function(){return this}();"undefined"==typeof h.Range&&(h.Range=e);a.createNativeRange=function(a){a=a||document;return a.body.createTextRange()}}a.features.implementsTextRange&&(e.rangeToTextRange=function(a){if(a.collapsed)return d(new g(a.startContainer,a.startOffset),!0);var b=d(new g(a.startContainer,a.startOffset),!0),c=d(new g(a.endContainer,a.endOffset),!1);a=f.getDocument(a.startContainer).body.createTextRange();a.setEndPoint("StartToStart",b);a.setEndPoint("EndToEnd",
78
- c);return a});e.prototype.getName=function(){return"WrappedRange"};a.WrappedRange=e;a.createRange=function(b){b=b||document;return new e(a.createNativeRange(b))};a.createRangyRange=function(a){a=a||document;return new k(a)};a.createIframeRange=function(b){return a.createRange(f.getIframeDocument(b))};a.createIframeRangyRange=function(b){return a.createRangyRange(f.getIframeDocument(b))};a.addCreateMissingNativeApiListener(function(b){b=b.document;"undefined"==typeof b.createRange&&(b.createRange=
79
- function(){return a.createRange(this)});b=b=null})});
80
- rangy.createModule("WrappedSelection",function(a,c){function b(a){return(a||window).getSelection()}function d(a){return(a||window).document.selection}function e(a,b,c){var d=c?"end":"start";c=c?"start":"end";a.anchorNode=b[d+"Container"];a.anchorOffset=b[d+"Offset"];a.focusNode=b[c+"Container"];a.focusOffset=b[c+"Offset"]}function f(a){a.anchorNode=a.focusNode=null;a.anchorOffset=a.focusOffset=0;a.rangeCount=0;a.isCollapsed=!0;a._ranges.length=0}function g(b){var c;b instanceof v?(c=b._selectionNativeRange,
81
- c||(c=a.createNativeRange(r.getDocument(b.startContainer)),c.setEnd(b.endContainer,b.endOffset),c.setStart(b.startContainer,b.startOffset),b._selectionNativeRange=c,b.attachListener("detach",function(){this._selectionNativeRange=null}))):b instanceof t?c=b.nativeRange:a.features.implementsDomRange&&b instanceof r.getWindow(b.startContainer).Range&&(c=b);return c}function k(a){var b=a.getNodes(),c;a:if(b.length&&1==b[0].nodeType){c=1;for(var d=b.length;c<d;++c)if(!r.isAncestorOf(b[0],b[c])){c=!1;break a}c=
82
- !0}else c=!1;if(!c)throw Error("getSingleElementFromRange: range "+a.inspect()+" did not consist of a single element");return b[0]}function h(a,b){var c=new t(b);a._ranges=[c];e(a,c,!1);a.rangeCount=1;a.isCollapsed=c.collapsed}function l(b){b._ranges.length=0;if("None"==b.docSelection.type)f(b);else{var c=b.docSelection.createRange();if(c&&"undefined"!=typeof c.text)h(b,c);else{b.rangeCount=c.length;for(var d,l=r.getDocument(c.item(0)),g=0;g<b.rangeCount;++g)d=a.createRange(l),d.selectNode(c.item(g)),
83
- b._ranges.push(d);b.isCollapsed=1==b.rangeCount&&b._ranges[0].collapsed;e(b,b._ranges[b.rangeCount-1],!1)}}}function p(a,b){for(var c=a.docSelection.createRange(),d=k(b),e=r.getDocument(c.item(0)),e=r.getBody(e).createControlRange(),h=0,f=c.length;h<f;++h)e.add(c.item(h));try{e.add(d)}catch(g){throw Error("addRange(): Element within the specified Range could not be added to control selection (does it have layout?)");}e.select();l(a)}function n(a,b,c){this.nativeSelection=a;this.docSelection=b;this._ranges=
84
- [];this.win=c;this.refresh()}function u(a,b){for(var c=r.getDocument(b[0].startContainer),c=r.getBody(c).createControlRange(),d=0,e;d<rangeCount;++d){e=k(b[d]);try{c.add(e)}catch(h){throw Error("setRanges(): Element within the one of the specified Ranges could not be added to control selection (does it have layout?)");}}c.select();l(a)}function D(a,b){if(a.anchorNode&&r.getDocument(a.anchorNode)!==r.getDocument(b))throw new w("WRONG_DOCUMENT_ERR");}function q(a){var b=[],c=new A(a.anchorNode,a.anchorOffset),
85
- d=new A(a.focusNode,a.focusOffset),e="function"==typeof a.getName?a.getName():"Selection";if("undefined"!=typeof a.rangeCount)for(var h=0,l=a.rangeCount;h<l;++h)b[h]=v.inspect(a.getRangeAt(h));return"["+e+"(Ranges: "+b.join(", ")+")(anchor: "+c.inspect()+", focus: "+d.inspect()+"]"}a.requireModules(["DomUtil","DomRange","WrappedRange"]);a.config.checkSelectionRanges=!0;var r=a.dom,s=a.util,v=a.DomRange,t=a.WrappedRange,w=a.DOMException,A=r.DomPosition,z,E,y=a.util.isHostMethod(window,"getSelection"),
86
- B=a.util.isHostObject(document,"selection"),x=B&&(!y||a.config.preferTextRange);x?(z=d,a.isSelectionValid=function(a){a=(a||window).document;var b=a.selection;return"None"!=b.type||r.getDocument(b.createRange().parentElement())==a}):y?(z=b,a.isSelectionValid=function(){return!0}):c.fail("Neither document.selection or window.getSelection() detected.");a.getNativeSelection=z;var y=z(),L=a.createNativeRange(document),H=r.getBody(document),G=s.areHostObjects(y,s.areHostProperties(y,["anchorOffset","focusOffset"]));
87
- a.features.selectionHasAnchorAndFocus=G;var N=s.isHostMethod(y,"extend");a.features.selectionHasExtend=N;var P="number"==typeof y.rangeCount;a.features.selectionHasRangeCount=P;var O=!1,R=!0;s.areHostMethods(y,["addRange","getRangeAt","removeAllRanges"])&&("number"==typeof y.rangeCount&&a.features.implementsDomRange)&&function(){var a=document.createElement("iframe");H.appendChild(a);var b=r.getIframeDocument(a);b.open();b.write("<html><head></head><body>12</body></html>");b.close();var c=r.getIframeWindow(a).getSelection(),
88
- d=b.documentElement.lastChild.firstChild,b=b.createRange();b.setStart(d,1);b.collapse(!0);c.addRange(b);R=1==c.rangeCount;c.removeAllRanges();var e=b.cloneRange();b.setStart(d,0);e.setEnd(d,2);c.addRange(b);c.addRange(e);O=2==c.rangeCount;b.detach();e.detach();H.removeChild(a)}();a.features.selectionSupportsMultipleRanges=O;a.features.collapsedNonEditableSelectionsSupported=R;var C=!1,m;H&&s.isHostMethod(H,"createControlRange")&&(m=H.createControlRange(),s.areHostProperties(m,["item","add"])&&(C=
89
- !0));a.features.implementsControlRange=C;E=G?function(a){return a.anchorNode===a.focusNode&&a.anchorOffset===a.focusOffset}:function(a){return a.rangeCount?a.getRangeAt(a.rangeCount-1).collapsed:!1};var I;s.isHostMethod(y,"getRangeAt")?I=function(a,b){try{return a.getRangeAt(b)}catch(c){return null}}:G&&(I=function(b){var c=r.getDocument(b.anchorNode),c=a.createRange(c);c.setStart(b.anchorNode,b.anchorOffset);c.setEnd(b.focusNode,b.focusOffset);c.collapsed!==this.isCollapsed&&(c.setStart(b.focusNode,
90
- b.focusOffset),c.setEnd(b.anchorNode,b.anchorOffset));return c});a.getSelection=function(a){a=a||window;var b=a._rangySelection,c=z(a),e=B?d(a):null;b?(b.nativeSelection=c,b.docSelection=e,b.refresh(a)):(b=new n(c,e,a),a._rangySelection=b);return b};a.getIframeSelection=function(b){return a.getSelection(r.getIframeWindow(b))};m=n.prototype;if(!x&&G&&s.areHostMethods(y,["removeAllRanges","addRange"])){m.removeAllRanges=function(){this.nativeSelection.removeAllRanges();f(this)};var F=function(b,c){var d=
91
- v.getRangeDocument(c),d=a.createRange(d);d.collapseToPoint(c.endContainer,c.endOffset);b.nativeSelection.addRange(g(d));b.nativeSelection.extend(c.startContainer,c.startOffset);b.refresh()};m.addRange=P?function(b,c){if(C&&B&&"Control"==this.docSelection.type)p(this,b);else if(c&&N)F(this,b);else{var d;O?d=this.rangeCount:(this.removeAllRanges(),d=0);this.nativeSelection.addRange(g(b));this.rangeCount=this.nativeSelection.rangeCount;this.rangeCount==d+1?(a.config.checkSelectionRanges&&(d=I(this.nativeSelection,
92
- this.rangeCount-1))&&!v.rangesEqual(d,b)&&(b=new t(d)),this._ranges[this.rangeCount-1]=b,e(this,b,K(this.nativeSelection)),this.isCollapsed=E(this)):this.refresh()}}:function(a,b){b&&N?F(this,a):(this.nativeSelection.addRange(g(a)),this.refresh())};m.setRanges=function(a){if(C&&1<a.length)u(this,a);else{this.removeAllRanges();for(var b=0,c=a.length;b<c;++b)this.addRange(a[b])}}}else if(s.isHostMethod(y,"empty")&&s.isHostMethod(L,"select")&&C&&x)m.removeAllRanges=function(){try{if(this.docSelection.empty(),
93
- "None"!=this.docSelection.type){var a;if(this.anchorNode)a=r.getDocument(this.anchorNode);else if("Control"==this.docSelection.type){var b=this.docSelection.createRange();b.length&&(a=r.getDocument(b.item(0)).body.createTextRange())}a&&(a.body.createTextRange().select(),this.docSelection.empty())}}catch(c){}f(this)},m.addRange=function(a){"Control"==this.docSelection.type?p(this,a):(t.rangeToTextRange(a).select(),this._ranges[0]=a,this.rangeCount=1,this.isCollapsed=this._ranges[0].collapsed,e(this,
94
- a,!1))},m.setRanges=function(a){this.removeAllRanges();var b=a.length;1<b?u(this,a):b&&this.addRange(a[0])};else return c.fail("No means of selecting a Range or TextRange was found"),!1;m.getRangeAt=function(a){if(0>a||a>=this.rangeCount)throw new w("INDEX_SIZE_ERR");return this._ranges[a]};var J;if(x)J=function(b){var c;a.isSelectionValid(b.win)?c=b.docSelection.createRange():(c=r.getBody(b.win.document).createTextRange(),c.collapse(!0));"Control"==b.docSelection.type?l(b):c&&"undefined"!=typeof c.text?
95
- h(b,c):f(b)};else if(s.isHostMethod(y,"getRangeAt")&&"number"==typeof y.rangeCount)J=function(b){if(C&&B&&"Control"==b.docSelection.type)l(b);else if(b._ranges.length=b.rangeCount=b.nativeSelection.rangeCount,b.rangeCount){for(var c=0,d=b.rangeCount;c<d;++c)b._ranges[c]=new a.WrappedRange(b.nativeSelection.getRangeAt(c));e(b,b._ranges[b.rangeCount-1],K(b.nativeSelection));b.isCollapsed=E(b)}else f(b)};else if(G&&"boolean"==typeof y.isCollapsed&&"boolean"==typeof L.collapsed&&a.features.implementsDomRange)J=
96
- function(a){var b;b=a.nativeSelection;b.anchorNode?(b=I(b,0),a._ranges=[b],a.rangeCount=1,b=a.nativeSelection,a.anchorNode=b.anchorNode,a.anchorOffset=b.anchorOffset,a.focusNode=b.focusNode,a.focusOffset=b.focusOffset,a.isCollapsed=E(a)):f(a)};else return c.fail("No means of obtaining a Range or TextRange from the user's selection was found"),!1;m.refresh=function(a){var b=a?this._ranges.slice(0):null;J(this);if(a){a=b.length;if(a!=this._ranges.length)return!1;for(;a--;)if(!v.rangesEqual(b[a],this._ranges[a]))return!1;
97
- return!0}};var M=function(a,b){var c=a.getAllRanges(),d=!1;a.removeAllRanges();for(var e=0,h=c.length;e<h;++e)d||b!==c[e]?a.addRange(c[e]):d=!0;a.rangeCount||f(a)};m.removeRange=C?function(a){if("Control"==this.docSelection.type){var b=this.docSelection.createRange();a=k(a);for(var c=r.getDocument(b.item(0)),c=r.getBody(c).createControlRange(),d,e=!1,h=0,f=b.length;h<f;++h)d=b.item(h),d!==a||e?c.add(b.item(h)):e=!0;c.select();l(this)}else M(this,a)}:function(a){M(this,a)};var K;!x&&G&&a.features.implementsDomRange?
98
- (K=function(a){var b=!1;a.anchorNode&&(b=1==r.comparePoints(a.anchorNode,a.anchorOffset,a.focusNode,a.focusOffset));return b},m.isBackwards=function(){return K(this)}):K=m.isBackwards=function(){return!1};m.toString=function(){for(var a=[],b=0,c=this.rangeCount;b<c;++b)a[b]=""+this._ranges[b];return a.join("")};m.collapse=function(b,c){D(this,b);var d=a.createRange(r.getDocument(b));d.collapseToPoint(b,c);this.removeAllRanges();this.addRange(d);this.isCollapsed=!0};m.collapseToStart=function(){if(this.rangeCount){var a=
99
- this._ranges[0];this.collapse(a.startContainer,a.startOffset)}else throw new w("INVALID_STATE_ERR");};m.collapseToEnd=function(){if(this.rangeCount){var a=this._ranges[this.rangeCount-1];this.collapse(a.endContainer,a.endOffset)}else throw new w("INVALID_STATE_ERR");};m.selectAllChildren=function(b){D(this,b);var c=a.createRange(r.getDocument(b));c.selectNodeContents(b);this.removeAllRanges();this.addRange(c)};m.deleteFromDocument=function(){if(C&&B&&"Control"==this.docSelection.type){for(var a=this.docSelection.createRange(),
100
- b;a.length;)b=a.item(0),a.remove(b),b.parentNode.removeChild(b);this.refresh()}else if(this.rangeCount){a=this.getAllRanges();this.removeAllRanges();b=0;for(var c=a.length;b<c;++b)a[b].deleteContents();this.addRange(a[c-1])}};m.getAllRanges=function(){return this._ranges.slice(0)};m.setSingleRange=function(a){this.setRanges([a])};m.containsNode=function(a,b){for(var c=0,d=this._ranges.length;c<d;++c)if(this._ranges[c].containsNode(a,b))return!0;return!1};m.toHtml=function(){var a="";if(this.rangeCount){for(var a=
101
- v.getRangeDocument(this._ranges[0]).createElement("div"),b=0,c=this._ranges.length;b<c;++b)a.appendChild(this._ranges[b].cloneContents());a=a.innerHTML}return a};m.getName=function(){return"WrappedSelection"};m.inspect=function(){return q(this)};m.detach=function(){this.win=this.anchorNode=this.focusNode=this.win._rangySelection=null};n.inspect=q;a.Selection=n;a.selectionPrototype=m;a.addCreateMissingNativeApiListener(function(b){"undefined"==typeof b.getSelection&&(b.getSelection=function(){return a.getSelection(this)});
102
- b=null})});var Base=function(){};
103
- Base.extend=function(a,c){var b=Base.prototype.extend;Base._prototyping=!0;var d=new this;b.call(d,a);d.base=function(){};delete Base._prototyping;var e=d.constructor,f=d.constructor=function(){if(!Base._prototyping)if(this._constructing||this.constructor==f)this._constructing=!0,e.apply(this,arguments),delete this._constructing;else if(null!=arguments[0])return(arguments[0].extend||b).call(arguments[0],d)};f.ancestor=this;f.extend=this.extend;f.forEach=this.forEach;f.implement=this.implement;f.prototype=
104
- d;f.toString=this.toString;f.valueOf=function(a){return"object"==a?f:e.valueOf()};b.call(f,c);"function"==typeof f.init&&f.init();return f};
105
- Base.prototype={extend:function(a,c){if(1<arguments.length){var b=this[a];if(b&&"function"==typeof c&&(!b.valueOf||b.valueOf()!=c.valueOf())&&/\bbase\b/.test(c)){var d=c.valueOf();c=function(){var a=this.base||Base.prototype.base;this.base=b;var c=d.apply(this,arguments);this.base=a;return c};c.valueOf=function(a){return"object"==a?c:d};c.toString=Base.toString}this[a]=c}else if(a){var e=Base.prototype.extend;Base._prototyping||"function"==typeof this||(e=this.extend||e);for(var f={toSource:null},
106
- g=["constructor","toString","valueOf"],k=Base._prototyping?0:1;h=g[k++];)a[h]!=f[h]&&e.call(this,h,a[h]);for(var h in a)f[h]||e.call(this,h,a[h])}return this}};
107
- Base=Base.extend({constructor:function(a){this.extend(a)}},{ancestor:Object,version:"1.1",forEach:function(a,c,b){for(var d in a)void 0===this.prototype[d]&&c.call(b,a[d],d,a)},implement:function(){for(var a=0;a<arguments.length;a++)if("function"==typeof arguments[a])arguments[a](this.prototype);else this.prototype.extend(arguments[a]);return this},toString:function(){return String(this.valueOf())}});
108
- wysihtml5.browser=function(){var a=navigator.userAgent,c=document.createElement("div"),b=-1!==a.indexOf("MSIE")&&-1===a.indexOf("Opera"),d=-1!==a.indexOf("Gecko")&&-1===a.indexOf("KHTML"),e=-1!==a.indexOf("AppleWebKit/"),f=-1!==a.indexOf("Chrome/"),g=-1!==a.indexOf("Opera/");return{USER_AGENT:a,supported:function(){var a=this.USER_AGENT.toLowerCase(),b="contentEditable"in c,d=document.execCommand&&document.queryCommandSupported&&document.queryCommandState,e=document.querySelector&&document.querySelectorAll,
109
- a=this.isIos()&&5>+(/ipad|iphone|ipod/.test(a)&&a.match(/ os (\d+).+? like mac os x/)||[,0])[1]||this.isAndroid()&&4>+(a.match(/android (\d+)/)||[,0])[1]||-1!==a.indexOf("opera mobi")||-1!==a.indexOf("hpwos/");return b&&d&&e&&!a},isTouchDevice:function(){return this.supportsEvent("touchmove")},isIos:function(){return/ipad|iphone|ipod/i.test(this.USER_AGENT)},isAndroid:function(){return-1!==this.USER_AGENT.indexOf("Android")},supportsSandboxedIframes:function(){return b},throwsMixedContentWarningWhenIframeSrcIsEmpty:function(){return!("querySelector"in
110
- document)},displaysCaretInEmptyContentEditableCorrectly:function(){return b},hasCurrentStyleProperty:function(){return"currentStyle"in c},hasHistoryIssue:function(){return d&&"Mac"===navigator.platform.substr(0,3)},insertsLineBreaksOnReturn:function(){return d},supportsPlaceholderAttributeOn:function(a){return"placeholder"in a},supportsEvent:function(a){var b;(b="on"+a in c)||(c.setAttribute("on"+a,"return;"),b="function"===typeof c["on"+a]);return b},supportsEventsInIframeCorrectly:function(){return!g},
111
- supportsHTML5Tags:function(a){a=a.createElement("div");a.innerHTML="<article>foo</article>";return"<article>foo</article>"===a.innerHTML.toLowerCase()},supportsCommand:function(){var a={formatBlock:b,insertUnorderedList:b||e,insertOrderedList:b||e},c={insertHTML:d};return function(b,d){if(!a[d]){try{return b.queryCommandSupported(d)}catch(e){}try{return b.queryCommandEnabled(d)}catch(f){return!!c[d]}}return!1}}(),doesAutoLinkingInContentEditable:function(){return b},canDisableAutoLinking:function(){return this.supportsCommand(document,
112
- "AutoUrlDetect")},clearsContentEditableCorrectly:function(){return d||g||e},supportsGetAttributeCorrectly:function(){return"1"!=document.createElement("td").getAttribute("rowspan")},canSelectImagesInContentEditable:function(){return d||b||g},autoScrollsToCaret:function(){return!e},autoClosesUnclosedTags:function(){var a=c.cloneNode(!1),b;a.innerHTML="<p><div></div>";a=a.innerHTML.toLowerCase();b="<p></p><div></div>"===a||"<p><div></div></p>"===a;this.autoClosesUnclosedTags=function(){return b};return b},
113
- supportsNativeGetElementsByClassName:function(){return-1!==String(document.getElementsByClassName).indexOf("[native code]")},supportsSelectionModify:function(){return"getSelection"in window&&"modify"in window.getSelection()},needsSpaceAfterLineBreak:function(){return g},supportsSpeechApiOn:function(b){return 11<=(a.match(/Chrome\/(\d+)/)||[,0])[1]&&("onwebkitspeechchange"in b||"speech"in b)},crashesWhenDefineProperty:function(a){return b&&("XMLHttpRequest"===a||"XDomainRequest"===a)},doesAsyncFocus:function(){return b},
114
- hasProblemsSettingCaretAfterImg:function(){return b},hasUndoInContextMenu:function(){return d||f||g},hasInsertNodeIssue:function(){return g},hasIframeFocusIssue:function(){return b},createsNestedInvalidMarkupAfterPaste:function(){return e}}}();
115
- wysihtml5.lang.array=function(a){return{contains:function(c){if(a.indexOf)return-1!==a.indexOf(c);for(var b=0,d=a.length;b<d;b++)if(a[b]===c)return!0;return!1},without:function(c){c=wysihtml5.lang.array(c);for(var b=[],d=0,e=a.length;d<e;d++)c.contains(a[d])||b.push(a[d]);return b},get:function(){for(var c=0,b=a.length,d=[];c<b;c++)d.push(a[c]);return d}}};
116
- wysihtml5.lang.Dispatcher=Base.extend({on:function(a,c){this.events=this.events||{};this.events[a]=this.events[a]||[];this.events[a].push(c);return this},off:function(a,c){this.events=this.events||{};var b=0,d,e;if(a){d=this.events[a]||[];for(e=[];b<d.length;b++)d[b]!==c&&c&&e.push(d[b]);this.events[a]=e}else this.events={};return this},fire:function(a,c){this.events=this.events||{};for(var b=this.events[a]||[],d=0;d<b.length;d++)b[d].call(this,c);return this},observe:function(){return this.on.apply(this,
117
- arguments)},stopObserving:function(){return this.off.apply(this,arguments)}});wysihtml5.lang.object=function(a){return{merge:function(c){for(var b in c)a[b]=c[b];return this},get:function(){return a},clone:function(){var c={},b;for(b in a)c[b]=a[b];return c},isArray:function(){return"[object Array]"===Object.prototype.toString.call(a)}}};
118
- (function(){var a=/^\s+/,c=/\s+$/,b=/[&<>"]/g,d={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"};wysihtml5.lang.string=function(e){e=String(e);return{trim:function(){return e.replace(a,"").replace(c,"")},interpolate:function(a){for(var b in a)e=this.replace("#{"+b+"}").by(a[b]);return e},replace:function(a){return{by:function(b){return e.split(a).join(b)}}},escapeHTML:function(){return e.replace(b,function(a){return d[a]})}}}})();
119
- (function(a){function c(a){return a.replace(e,function(a,b){var c=(b.match(f)||[])[1]||"",d=k[c];b=b.replace(f,"");b.split(d).length>b.split(c).length&&(b+=c,c="");var e=d=b;b.length>g&&(e=e.substr(0,g)+"...");"www."===d.substr(0,4)&&(d="http://"+d);return'<a href="'+d+'">'+e+"</a>"+c})}function b(h){if(!d.contains(h.nodeName))if(h.nodeType===a.TEXT_NODE&&h.data.match(e)){var l=h.parentNode,f=a.lang.string(h.data).escapeHTML(),g;g=l.ownerDocument;var k=g._wysihtml5_tempElement;k||(k=g._wysihtml5_tempElement=
120
- g.createElement("div"));g=k;g.innerHTML="<span></span>"+c(f);for(g.removeChild(g.firstChild);g.firstChild;)l.insertBefore(g.firstChild,h);l.removeChild(h)}else{l=a.lang.array(h.childNodes).get();f=l.length;for(g=0;g<f;g++)b(l[g]);return h}}var d=a.lang.array("CODE PRE A SCRIPT HEAD TITLE STYLE".split(" ")),e=/((https?:\/\/|www\.)[^\s<]{3,})/gi,f=/([^\w\/\-](,?))$/i,g=100,k={")":"(","]":"[","}":"{"};a.dom.autoLink=function(a){var c;a:{c=a;for(var e;c.parentNode;){c=c.parentNode;e=c.nodeName;if(d.contains(e)){c=
121
- !0;break a}if("body"===e)break}c=!1}if(c)return a;a===a.ownerDocument.documentElement&&(a=a.ownerDocument.body);return b(a)};a.dom.autoLink.URL_REG_EXP=e})(wysihtml5);
122
- (function(a){var c=a.dom;c.addClass=function(a,d){var e=a.classList;if(e)return e.add(d);c.hasClass(a,d)||(a.className+=" "+d)};c.removeClass=function(a,c){var e=a.classList;if(e)return e.remove(c);a.className=a.className.replace(RegExp("(^|\\s+)"+c+"(\\s+|$)")," ")};c.hasClass=function(a,c){var e=a.classList;if(e)return e.contains(c);e=a.className;return 0<e.length&&(e==c||RegExp("(^|\\s)"+c+"(\\s|$)").test(e))}})(wysihtml5);
123
- wysihtml5.dom.contains=function(){var a=document.documentElement;if(a.contains)return function(a,b){b.nodeType!==wysihtml5.ELEMENT_NODE&&(b=b.parentNode);return a!==b&&a.contains(b)};if(a.compareDocumentPosition)return function(a,b){return!!(a.compareDocumentPosition(b)&16)}}();
124
- wysihtml5.dom.convertToList=function(){function a(a,b){var d=a.createElement("li");b.appendChild(d);return d}return function(c,b){if("UL"===c.nodeName||"OL"===c.nodeName||"MENU"===c.nodeName)return c;var d=c.ownerDocument,e=d.createElement(b),f=c.querySelectorAll("br"),g=f.length,k,h,l,p,n;for(n=0;n<g;n++)for(k=f[n];(h=k.parentNode)&&h!==c&&h.lastChild===k;){if("block"===wysihtml5.dom.getStyle("display").from(h)){h.removeChild(k);break}wysihtml5.dom.insert(k).after(k.parentNode)}f=wysihtml5.lang.array(c.childNodes).get();
125
- g=f.length;for(n=0;n<g;n++)p=p||a(d,e),k=f[n],h="block"===wysihtml5.dom.getStyle("display").from(k),l="BR"===k.nodeName,h?(p=p.firstChild?a(d,e):p,p.appendChild(k),p=null):l?p=p.firstChild?null:p:p.appendChild(k);0===f.length&&a(d,e);c.parentNode.replaceChild(e,c);return e}}();wysihtml5.dom.copyAttributes=function(a){return{from:function(c){return{to:function(b){for(var d,e=0,f=a.length;e<f;e++)d=a[e],"undefined"!==typeof c[d]&&""!==c[d]&&(b[d]=c[d]);return{andTo:arguments.callee}}}}}};
126
- (function(a){var c=["-webkit-box-sizing","-moz-box-sizing","-ms-box-sizing","box-sizing"],b=function(b){var e;a:{e=0;for(var f=c.length;e<f;e++)if("border-box"===a.getStyle(c[e]).from(b)){e=c[e];break a}e=void 0}return e?parseInt(a.getStyle("width").from(b),10)<b.offsetWidth:!1};a.copyStyles=function(d){return{from:function(e){b(e)&&(d=wysihtml5.lang.array(d).without(c));for(var f="",g=d.length,k=0,h;k<g;k++)h=d[k],f+=h+":"+a.getStyle(h).from(e)+";";return{to:function(b){a.setStyles(f).on(b);return{andTo:arguments.callee}}}}}}})(wysihtml5.dom);
127
- (function(a){a.dom.delegate=function(c,b,d,e){return a.dom.observe(c,d,function(d){for(var g=d.target,k=a.lang.array(c.querySelectorAll(b));g&&g!==c;){if(k.contains(g)){e.call(g,d);break}g=g.parentNode}})}})(wysihtml5);
128
- wysihtml5.dom.getAsDom=function(){var a="abbr article aside audio bdi canvas command datalist details figcaption figure footer header hgroup keygen mark meter nav output progress rp rt ruby svg section source summary time track video wbr".split(" ");return function(c,b){b=b||document;var d;if("object"===typeof c&&c.nodeType)d=b.createElement("div"),d.appendChild(c);else if(wysihtml5.browser.supportsHTML5Tags(b))d=b.createElement("div"),d.innerHTML=c;else{d=b;if(!d._wysihtml5_supportsHTML5Tags){for(var e=
129
- 0,f=a.length;e<f;e++)d.createElement(a[e]);d._wysihtml5_supportsHTML5Tags=!0}d=b;e=d.createElement("div");e.style.display="none";d.body.appendChild(e);try{e.innerHTML=c}catch(g){}d.body.removeChild(e);d=e}return d}}();
130
- wysihtml5.dom.getParentElement=function(){function a(a,b){return b&&b.length?"string"===typeof b?a===b:wysihtml5.lang.array(b).contains(a):!0}return function(c,b,d){d=d||50;if(b.className||b.classRegExp){a:{var e=b.nodeName,f=b.className;for(b=b.classRegExp;d--&&c&&"BODY"!==c.nodeName;){var g;if(g=c.nodeType===wysihtml5.ELEMENT_NODE)if(g=a(c.nodeName,e)){g=f;var k=(c.className||"").match(b)||[];g=g?k[k.length-1]===g:!!k.length}if(g)break a;c=c.parentNode}c=null}return c}a:{e=b.nodeName;for(f=d;f--&&
131
- c&&"BODY"!==c.nodeName;){if(a(c.nodeName,e))break a;c=c.parentNode}c=null}return c}}();
132
- wysihtml5.dom.getStyle=function(){function a(a){return a.replace(b,function(a){return a.charAt(1).toUpperCase()})}var c={"float":"styleFloat"in document.createElement("div").style?"styleFloat":"cssFloat"},b=/\-[a-z]/g;return function(b){return{from:function(e){if(e.nodeType===wysihtml5.ELEMENT_NODE){var f=e.ownerDocument,g=c[b]||a(b),k=e.style,h=e.currentStyle,l=k[g];if(l)return l;if(h)try{return h[g]}catch(p){}var g=f.defaultView||f.parentWindow,f=("height"===b||"width"===b)&&"TEXTAREA"===e.nodeName,
133
- n;if(g.getComputedStyle)return f&&(n=k.overflow,k.overflow="hidden"),e=g.getComputedStyle(e,null).getPropertyValue(b),f&&(k.overflow=n||""),e}}}}}();wysihtml5.dom.hasElementWithTagName=function(){var a={},c=1;return function(b,d){var e=(b._wysihtml5_identifier||(b._wysihtml5_identifier=c++))+":"+d,f=a[e];f||(f=a[e]=b.getElementsByTagName(d));return 0<f.length}}();
134
- (function(a){var c={},b=1;a.dom.hasElementWithClassName=function(d,e){if(!a.browser.supportsNativeGetElementsByClassName())return!!d.querySelector("."+e);var f=(d._wysihtml5_identifier||(d._wysihtml5_identifier=b++))+":"+e,g=c[f];g||(g=c[f]=d.getElementsByClassName(e));return 0<g.length}})(wysihtml5);wysihtml5.dom.insert=function(a){return{after:function(c){c.parentNode.insertBefore(a,c.nextSibling)},before:function(c){c.parentNode.insertBefore(a,c)},into:function(c){c.appendChild(a)}}};
135
- wysihtml5.dom.insertCSS=function(a){a=a.join("\n");return{into:function(c){var b=c.createElement("style");b.type="text/css";b.styleSheet?b.styleSheet.cssText=a:b.appendChild(c.createTextNode(a));var d=c.querySelector("head link");d?d.parentNode.insertBefore(b,d):(c=c.querySelector("head"))&&c.appendChild(b)}}};
136
- wysihtml5.dom.observe=function(a,c,b){c="string"===typeof c?[c]:c;for(var d,e,f=0,g=c.length;f<g;f++)e=c[f],a.addEventListener?a.addEventListener(e,b,!1):(d=function(c){"target"in c||(c.target=c.srcElement);c.preventDefault=c.preventDefault||function(){this.returnValue=!1};c.stopPropagation=c.stopPropagation||function(){this.cancelBubble=!0};b.call(a,c)},a.attachEvent("on"+e,d));return{stop:function(){for(var e,h=0,l=c.length;h<l;h++)e=c[h],a.removeEventListener?a.removeEventListener(e,b,!1):a.detachEvent("on"+
137
- e,d)}}};
138
- wysihtml5.dom.parse=function(){function a(c,e){var h=c.childNodes,l=h.length,f=b[c.nodeType],g=0,p,f=f&&f(c);if(!f)return null;for(g=0;g<l;g++)(p=a(h[g],e))&&f.appendChild(p);if(e&&!(f.nodeName.toLowerCase()!==d||f.childNodes.length&&f.attributes.length)){for(h=f.ownerDocument.createDocumentFragment();f.firstChild;)h.appendChild(f.firstChild);return h}return f}function c(a,b){b=b.toLowerCase();var c;if(c="IMG"==a.nodeName)if(c="src"==b){var d;a:{try{d=a.complete&&!a.mozMatchesSelector(":-moz-broken");break a}catch(e){if(a.complete&&
139
- "complete"===a.readyState){d=!0;break a}}d=void 0}c=!0===d}return c?a.src:k&&"outerHTML"in a?-1!=a.outerHTML.toLowerCase().indexOf(" "+b+"=")?a.getAttribute(b):null:a.getAttribute(b)}var b={1:function(a){var b,h,f=g.tags;h=a.nodeName.toLowerCase();b=a.scopeName;if(a._wysihtml5)return null;a._wysihtml5=1;if("wysihtml5-temp"===a.className)return null;b&&"HTML"!=b&&(h=b+":"+h);"outerHTML"in a&&(wysihtml5.browser.autoClosesUnclosedTags()||("P"!==a.nodeName||"</p>"===a.outerHTML.slice(-4).toLowerCase())||
140
- (h="div"));if(h in f){b=f[h];if(!b||b.remove)return null;b="string"===typeof b?{rename_tag:b}:b}else if(a.firstChild)b={rename_tag:d};else return null;h=a.ownerDocument.createElement(b.rename_tag||h);var f={},k=b.set_class,s=b.add_class,v=b.set_attributes,t=b.check_attributes,w=g.classes,A=0,z=[];b=[];var E=[],y=[],B;v&&(f=wysihtml5.lang.object(v).clone());if(t)for(B in t)if(v=l[t[B]])v=v(c(a,B)),"string"===typeof v&&(f[B]=v);k&&z.push(k);if(s)for(B in s)if(v=p[s[B]])k=v(c(a,B)),"string"===typeof k&&
141
- z.push(k);w["_wysihtml5-temp-placeholder"]=1;(y=a.getAttribute("class"))&&(z=z.concat(y.split(e)));for(s=z.length;A<s;A++)a=z[A],w[a]&&b.push(a);for(w=b.length;w--;)a=b[w],wysihtml5.lang.array(E).contains(a)||E.unshift(a);E.length&&(f["class"]=E.join(" "));for(B in f)try{h.setAttribute(B,f[B])}catch(x){}f.src&&("undefined"!==typeof f.width&&h.setAttribute("width",f.width),"undefined"!==typeof f.height&&h.setAttribute("height",f.height));return h},3:function(a){var b=a.nextSibling;if(b&&b.nodeType===
142
- wysihtml5.TEXT_NODE)b.data=a.data+b.data;else return b=a.data.replace(h,""),a.ownerDocument.createTextNode(b)}},d="span",e=/\s+/,f={tags:{},classes:{}},g={},k=!wysihtml5.browser.supportsGetAttributeCorrectly(),h=/\uFEFF/g,l={url:function(){var a=/^https?:\/\//i;return function(b){return b&&b.match(a)?b.replace(a,function(a){return a.toLowerCase()}):null}}(),src:function(){var a=/^(\/|https?:\/\/)/i;return function(b){return b&&b.match(a)?b.replace(a,function(a){return a.toLowerCase()}):null}}(),href:function(){var a=
143
- /^(\/|https?:\/\/|mailto:)/i;return function(b){return b&&b.match(a)?b.replace(a,function(a){return a.toLowerCase()}):null}}(),alt:function(){var a=/[^ a-z0-9_\-]/gi;return function(b){return b?b.replace(a,""):""}}(),numbers:function(){var a=/\D/g;return function(b){return(b=(b||"").replace(a,""))||null}}()},p={align_img:function(){var a={left:"wysiwyg-float-left",right:"wysiwyg-float-right"};return function(b){return a[String(b).toLowerCase()]}}(),align_text:function(){var a={left:"wysiwyg-text-align-left",
144
- right:"wysiwyg-text-align-right",center:"wysiwyg-text-align-center",justify:"wysiwyg-text-align-justify"};return function(b){return a[String(b).toLowerCase()]}}(),clear_br:function(){var a={left:"wysiwyg-clear-left",right:"wysiwyg-clear-right",both:"wysiwyg-clear-both",all:"wysiwyg-clear-both"};return function(b){return a[String(b).toLowerCase()]}}(),size_font:function(){var a={1:"wysiwyg-font-size-xx-small",2:"wysiwyg-font-size-small",3:"wysiwyg-font-size-medium",4:"wysiwyg-font-size-large",5:"wysiwyg-font-size-x-large",
145
- 6:"wysiwyg-font-size-xx-large",7:"wysiwyg-font-size-xx-large","-":"wysiwyg-font-size-smaller","+":"wysiwyg-font-size-larger"};return function(b){return a[String(b).charAt(0)]}}()};return function(b,c,d,e){wysihtml5.lang.object(g).merge(f).merge(c).get();d=d||b.ownerDocument||document;c=d.createDocumentFragment();var h="string"===typeof b,l;for(b=h?wysihtml5.dom.getAsDom(b,d):b;b.firstChild;)l=b.firstChild,d=a(l,e),b.removeChild(l),d&&c.appendChild(d);b.innerHTML="";b.appendChild(c);return h?wysihtml5.quirks.getCorrectInnerHTML(b):
146
- b}}();wysihtml5.dom.removeEmptyTextNodes=function(a){for(var c=wysihtml5.lang.array(a.childNodes).get(),b=c.length,d=0;d<b;d++)a=c[d],a.nodeType===wysihtml5.TEXT_NODE&&""===a.data&&a.parentNode.removeChild(a)};wysihtml5.dom.renameElement=function(a,c){for(var b=a.ownerDocument.createElement(c),d;d=a.firstChild;)b.appendChild(d);wysihtml5.dom.copyAttributes(["align","className"]).from(a).to(b);a.parentNode.replaceChild(b,a);return b};
147
- wysihtml5.dom.replaceWithChildNodes=function(a){if(a.parentNode)if(a.firstChild){for(var c=a.ownerDocument.createDocumentFragment();a.firstChild;)c.appendChild(a.firstChild);a.parentNode.replaceChild(c,a)}else a.parentNode.removeChild(a)};
148
- (function(a){function c(a){var c=a.ownerDocument.createElement("br");a.appendChild(c)}a.resolveList=function(b,d){if(b.nodeName.match(/^(MENU|UL|OL)$/)){var e=b.ownerDocument,f=e.createDocumentFragment(),g=b.previousElementSibling||b.previousSibling,k,h;if(d)for(g&&"block"!==a.getStyle("display").from(g)&&c(f);h=b.firstElementChild||b.firstChild;){for(e=h.lastChild;g=h.firstChild;)k=(k=g===e)&&"block"!==a.getStyle("display").from(g)&&"BR"!==g.nodeName,f.appendChild(g),k&&c(f);h.parentNode.removeChild(h)}else for(;h=
149
- b.firstElementChild||b.firstChild;){if(h.querySelector&&h.querySelector("div, p, ul, ol, menu, blockquote, h1, h2, h3, h4, h5, h6"))for(;g=h.firstChild;)f.appendChild(g);else{for(k=e.createElement("p");g=h.firstChild;)k.appendChild(g);f.appendChild(k)}h.parentNode.removeChild(h)}b.parentNode.replaceChild(f,b)}}})(wysihtml5.dom);
150
- (function(a){var c=document,b="parent top opener frameElement frames localStorage globalStorage sessionStorage indexedDB".split(" "),d="open close openDialog showModalDialog alert confirm prompt openDatabase postMessage XMLHttpRequest XDomainRequest".split(" "),e=["referrer","write","open","close"];a.dom.Sandbox=Base.extend({constructor:function(b,c){this.callback=b||a.EMPTY_FUNCTION;this.config=a.lang.object({}).merge(c).get();this.iframe=this._createIframe()},insertInto:function(a){"string"===typeof a&&
151
- (a=c.getElementById(a));a.appendChild(this.iframe)},getIframe:function(){return this.iframe},getWindow:function(){this._readyError()},getDocument:function(){this._readyError()},destroy:function(){var a=this.getIframe();a.parentNode.removeChild(a)},_readyError:function(){throw Error("wysihtml5.Sandbox: Sandbox iframe isn't loaded yet");},_createIframe:function(){var b=this,d=c.createElement("iframe");d.className="wysihtml5-sandbox";a.dom.setAttributes({security:"restricted",allowtransparency:"true",
152
- frameborder:0,width:0,height:0,marginwidth:0,marginheight:0}).on(d);a.browser.throwsMixedContentWarningWhenIframeSrcIsEmpty()&&(d.src="javascript:'<html></html>'");d.onload=function(){d.onreadystatechange=d.onload=null;b._onLoadIframe(d)};d.onreadystatechange=function(){/loaded|complete/.test(d.readyState)&&(d.onreadystatechange=d.onload=null,b._onLoadIframe(d))};return d},_onLoadIframe:function(f){if(a.dom.contains(c.documentElement,f)){var g=this,k=f.contentWindow,h=f.contentWindow.document,l=this._getHtml({charset:c.characterSet||
153
- c.charset||"utf-8",stylesheets:this.config.stylesheets});h.open("text/html","replace");h.write(l);h.close();this.getWindow=function(){return f.contentWindow};this.getDocument=function(){return f.contentWindow.document};k.onerror=function(a,b,c){throw Error("wysihtml5.Sandbox: "+a,b,c);};if(!a.browser.supportsSandboxedIframes()){var p,l=0;for(p=b.length;l<p;l++)this._unset(k,b[l]);l=0;for(p=d.length;l<p;l++)this._unset(k,d[l],a.EMPTY_FUNCTION);l=0;for(p=e.length;l<p;l++)this._unset(h,e[l]);this._unset(h,
154
- "cookie","",!0)}this.loaded=!0;setTimeout(function(){g.callback(g)},0)}},_getHtml:function(b){var c=b.stylesheets,d="",e=0,l;if(c="string"===typeof c?[c]:c)for(l=c.length;e<l;e++)d+='<link rel="stylesheet" href="'+c[e]+'">';b.stylesheets=d;return a.lang.string('<!DOCTYPE html><html><head><meta charset="#{charset}">#{stylesheets}</head><body></body></html>').interpolate(b)},_unset:function(b,c,d,e){try{b[c]=d}catch(l){}try{b.__defineGetter__(c,function(){return d})}catch(p){}if(e)try{b.__defineSetter__(c,
155
- function(){})}catch(n){}if(!a.browser.crashesWhenDefineProperty(c))try{var u={get:function(){return d}};e&&(u.set=function(){});Object.defineProperty(b,c,u)}catch(D){}}})})(wysihtml5);(function(){var a={className:"class"};wysihtml5.dom.setAttributes=function(c){return{on:function(b){for(var d in c)b.setAttribute(a[d]||d,c[d])}}}})();
156
- wysihtml5.dom.setStyles=function(a){return{on:function(c){c=c.style;if("string"===typeof a)c.cssText+=";"+a;else for(var b in a)"float"===b?(c.cssFloat=a[b],c.styleFloat=a[b]):c[b]=a[b]}}};
157
- (function(a){a.simulatePlaceholder=function(c,b,d){var e=function(){b.hasPlaceholderSet()&&b.clear();b.placeholderSet=!1;a.removeClass(b.element,"placeholder")},f=function(){b.isEmpty()&&(b.placeholderSet=!0,b.setValue(d),a.addClass(b.element,"placeholder"))};c.on("set_placeholder",f).on("unset_placeholder",e).on("focus:composer",e).on("paste:composer",e).on("blur:composer",f);f()}})(wysihtml5.dom);
158
- (function(a){var c=document.documentElement;"textContent"in c?(a.setTextContent=function(a,c){a.textContent=c},a.getTextContent=function(a){return a.textContent}):"innerText"in c?(a.setTextContent=function(a,c){a.innerText=c},a.getTextContent=function(a){return a.innerText}):(a.setTextContent=function(a,c){a.nodeValue=c},a.getTextContent=function(a){return a.nodeValue})})(wysihtml5.dom);
159
- wysihtml5.quirks.cleanPastedHTML=function(){var a={"a u":wysihtml5.dom.replaceWithChildNodes};return function(c,b,d){b=b||a;d=d||c.ownerDocument||document;var e="string"===typeof c,f,g,k,h=0;c=e?wysihtml5.dom.getAsDom(c,d):c;for(k in b)for(f=c.querySelectorAll(k),d=b[k],g=f.length;h<g;h++)d(f[h]);return e?c.innerHTML:c}}();
160
- wysihtml5.quirks.ensureProperClearing=function(){var a=function(){var a=this;setTimeout(function(){var b=a.innerHTML.toLowerCase();if("<p>&nbsp;</p>"==b||"<p>&nbsp;</p><p>&nbsp;</p>"==b)a.innerHTML=""},0)};return function(c){wysihtml5.dom.observe(c.element,["cut","keydown"],a)}}();
161
- (function(a){a.quirks.getCorrectInnerHTML=function(c){var b=c.innerHTML;if(-1===b.indexOf("%7E"))return b;c=c.querySelectorAll("[href*='~'], [src*='~']");var d,e,f,g;g=0;for(f=c.length;g<f;g++)d=c[g].href||c[g].src,e=a.lang.string(d).replace("~").by("%7E"),b=a.lang.string(b).replace(e).by(d);return b}})(wysihtml5);
162
- (function(a){a.quirks.redraw=function(c){a.dom.addClass(c,"wysihtml5-quirks-redraw");a.dom.removeClass(c,"wysihtml5-quirks-redraw");try{var b=c.ownerDocument;b.execCommand("italic",!1,null);b.execCommand("italic",!1,null)}catch(d){}}})(wysihtml5);
163
- (function(a){var c=a.dom;a.Selection=Base.extend({constructor:function(a){window.rangy.init();this.editor=a;this.composer=a.composer;this.doc=this.composer.doc},getBookmark:function(){var a=this.getRange();return a&&a.cloneRange()},setBookmark:function(a){a&&this.setSelection(a)},setBefore:function(a){var c=rangy.createRange(this.doc);c.setStartBefore(a);c.setEndBefore(a);return this.setSelection(c)},setAfter:function(a){var c=rangy.createRange(this.doc);c.setStartAfter(a);c.setEndAfter(a);return this.setSelection(c)},
164
- selectNode:function(b,d){var e=rangy.createRange(this.doc),f=b.nodeType===a.ELEMENT_NODE,g="canHaveHTML"in b?b.canHaveHTML:"IMG"!==b.nodeName,k=f?b.innerHTML:b.data,k=""===k||k===a.INVISIBLE_SPACE,h=c.getStyle("display").from(b),h="block"===h||"list-item"===h;if(k&&f&&g&&!d)try{b.innerHTML=a.INVISIBLE_SPACE}catch(l){}g?e.selectNodeContents(b):e.selectNode(b);g&&k&&f?e.collapse(h):g&&k&&(e.setStartAfter(b),e.setEndAfter(b));this.setSelection(e)},getSelectedNode:function(a){if(a&&this.doc.selection&&
165
- "Control"===this.doc.selection.type&&(a=this.doc.selection.createRange())&&a.length)return a.item(0);a=this.getSelection(this.doc);return a.focusNode===a.anchorNode?a.focusNode:(a=this.getRange(this.doc))?a.commonAncestorContainer:this.doc.body},executeAndRestore:function(b,d){var e=this.doc.body,f=d&&e.scrollTop,g=d&&e.scrollLeft,k='<span class="_wysihtml5-temp-placeholder">'+a.INVISIBLE_SPACE+"</span>",h=this.getRange(this.doc),l;if(h){a.browser.hasInsertNodeIssue()?this.doc.execCommand("insertHTML",
166
- !1,k):(k=h.createContextualFragment(k),h.insertNode(k));try{b(h.startContainer,h.endContainer)}catch(p){setTimeout(function(){throw p;},0)}(h=this.doc.querySelector("._wysihtml5-temp-placeholder"))?(k=rangy.createRange(this.doc),l=h.nextSibling,a.browser.hasInsertNodeIssue()&&l&&"BR"===l.nodeName?(l=this.doc.createTextNode(a.INVISIBLE_SPACE),c.insert(l).after(h),k.setStartBefore(l),k.setEndBefore(l)):(k.selectNode(h),k.deleteContents()),this.setSelection(k)):e.focus();d&&(e.scrollTop=f,e.scrollLeft=
167
- g);try{h.parentNode.removeChild(h)}catch(n){}}else b(e,e)},executeAndRestoreSimple:function(a){var c,e,f=this.getRange(),g=this.doc.body,k;if(f){c=f.getNodes([3]);g=c[0]||f.startContainer;k=c[c.length-1]||f.endContainer;c=g===f.startContainer?f.startOffset:0;e=k===f.endContainer?f.endOffset:k.length;try{a(f.startContainer,f.endContainer)}catch(h){setTimeout(function(){throw h;},0)}a=rangy.createRange(this.doc);try{a.setStart(g,c)}catch(l){}try{a.setEnd(k,e)}catch(p){}try{this.setSelection(a)}catch(n){}}else a(g,
168
- g)},set:function(a,c){var e=rangy.createRange(this.doc);e.setStart(a,c||0);this.setSelection(e)},insertHTML:function(a){a=rangy.createRange(this.doc).createContextualFragment(a);var c=a.lastChild;this.insertNode(a);c&&this.setAfter(c)},insertNode:function(a){var c=this.getRange();c&&c.insertNode(a)},surround:function(a){var c=this.getRange();if(c)try{c.surroundContents(a),this.selectNode(a)}catch(e){a.appendChild(c.extractContents()),c.insertNode(a)}},scrollIntoView:function(){var b=this.doc,c=b.documentElement.scrollHeight>
169
- b.documentElement.offsetHeight,e;(e=b._wysihtml5ScrollIntoViewElement)||(e=b.createElement("span"),e.innerHTML=a.INVISIBLE_SPACE);e=b._wysihtml5ScrollIntoViewElement=e;if(c){this.insertNode(e);var c=e,f=0;if(c.parentNode){do f+=c.offsetTop||0,c=c.offsetParent;while(c)}c=f;e.parentNode.removeChild(e);c>=b.body.scrollTop+b.documentElement.offsetHeight-5&&(b.body.scrollTop=c)}},selectLine:function(){a.browser.supportsSelectionModify()?this._selectLine_W3C():this.doc.selection&&this._selectLine_MSIE()},
170
- _selectLine_W3C:function(){var a=this.doc.defaultView.getSelection();a.modify("extend","left","lineboundary");a.modify("extend","right","lineboundary")},_selectLine_MSIE:function(){var a=this.doc.selection.createRange(),c=a.boundingTop,e=this.doc.body.scrollWidth,f;if(a.moveToPoint){0===c&&(f=this.doc.createElement("span"),this.insertNode(f),c=f.offsetTop,f.parentNode.removeChild(f));c+=1;for(f=-10;f<e;f+=2)try{a.moveToPoint(f,c);break}catch(g){}for(f=this.doc.selection.createRange();0<=e;e--)try{f.moveToPoint(e,
171
- c);break}catch(k){}a.setEndPoint("EndToEnd",f);a.select()}},getText:function(){var a=this.getSelection();return a?a.toString():""},getNodes:function(a,c){var e=this.getRange();return e?e.getNodes([a],c):[]},getRange:function(){var a=this.getSelection();return a&&a.rangeCount&&a.getRangeAt(0)},getSelection:function(){return rangy.getSelection(this.doc.defaultView||this.doc.parentWindow)},setSelection:function(a){return rangy.getSelection(this.doc.defaultView||this.doc.parentWindow).setSingleRange(a)}})})(wysihtml5);
172
- (function(a,c){function b(a,b){return c.dom.isCharacterDataNode(a)?0==b?!!a.previousSibling:b==a.length?!!a.nextSibling:!0:0<b&&b<a.childNodes.length}function d(a,b,e){var f;c.dom.isCharacterDataNode(b)&&(0==e?(e=c.dom.getNodeIndex(b),b=b.parentNode):e==b.length?(e=c.dom.getNodeIndex(b)+1,b=b.parentNode):f=c.dom.splitDataNode(b,e));if(!f){f=b.cloneNode(!1);f.id&&f.removeAttribute("id");for(var g;g=b.childNodes[e];)f.appendChild(g);c.dom.insertAfter(f,b)}return b==a?f:d(a,f.parentNode,c.dom.getNodeIndex(f))}
173
- function e(b){this.firstTextNode=(this.isElementMerge=b.nodeType==a.ELEMENT_NODE)?b.lastChild:b;this.textNodes=[this.firstTextNode]}function f(a,b,c,d){this.tagNames=a||[g];this.cssClass=b||"";this.similarClassRegExp=c;this.normalize=d;this.applyToAnyTagName=!1}var g="span",k=/\s+/g;e.prototype={doMerge:function(){for(var a=[],b,c,d=0,e=this.textNodes.length;d<e;++d)b=this.textNodes[d],c=b.parentNode,a[d]=b.data,d&&(c.removeChild(b),c.hasChildNodes()||c.parentNode.removeChild(c));return this.firstTextNode.data=
174
- a=a.join("")},getLength:function(){for(var a=this.textNodes.length,b=0;a--;)b+=this.textNodes[a].length;return b},toString:function(){for(var a=[],b=0,c=this.textNodes.length;b<c;++b)a[b]="'"+this.textNodes[b].data+"'";return"[Merge("+a.join(",")+")]"}};f.prototype={getAncestorWithClass:function(b){for(var d;b;){if(this.cssClass)if(d=this.cssClass,b.className){var e=b.className.match(this.similarClassRegExp)||[];d=e[e.length-1]===d}else d=!1;else d=!0;if(b.nodeType==a.ELEMENT_NODE&&c.dom.arrayContains(this.tagNames,
175
- b.tagName.toLowerCase())&&d)return b;b=b.parentNode}return!1},postApply:function(a,b){for(var c=a[0],d=a[a.length-1],f=[],g,k=c,r=d,s=0,v=d.length,t,w,A=0,z=a.length;A<z;++A)t=a[A],(w=this.getAdjacentMergeableTextNode(t.parentNode,!1))?(g||(g=new e(w),f.push(g)),g.textNodes.push(t),t===c&&(k=g.firstTextNode,s=k.length),t===d&&(r=g.firstTextNode,v=g.getLength())):g=null;if(c=this.getAdjacentMergeableTextNode(d.parentNode,!0))g||(g=new e(d),f.push(g)),g.textNodes.push(c);if(f.length){A=0;for(z=f.length;A<
176
- z;++A)f[A].doMerge();b.setStart(k,s);b.setEnd(r,v)}},getAdjacentMergeableTextNode:function(b,c){var d=b.nodeType==a.TEXT_NODE,e=d?b.parentNode:b,f=c?"nextSibling":"previousSibling";if(d){if((d=b[f])&&d.nodeType==a.TEXT_NODE)return d}else if((d=e[f])&&this.areElementsMergeable(b,d))return d[c?"firstChild":"lastChild"];return null},areElementsMergeable:function(a,b){var d;if(d=c.dom.arrayContains(this.tagNames,(a.tagName||"").toLowerCase()))if(d=c.dom.arrayContains(this.tagNames,(b.tagName||"").toLowerCase()))if(d=
177
- a.className.replace(k," ")==b.className.replace(k," "))a:if(a.attributes.length!=b.attributes.length)d=!1;else{d=0;for(var e=a.attributes.length,f,g;d<e;++d)if(f=a.attributes[d],g=f.name,"class"!=g&&(g=b.attributes.getNamedItem(g),f.specified!=g.specified||f.specified&&f.nodeValue!==g.nodeValue)){d=!1;break a}d=!0}return d},createContainer:function(a){a=a.createElement(this.tagNames[0]);this.cssClass&&(a.className=this.cssClass);return a},applyToTextNode:function(a){var b=a.parentNode;1==b.childNodes.length&&
178
- c.dom.arrayContains(this.tagNames,b.tagName.toLowerCase())?this.cssClass&&(a=this.cssClass,b.className?(b.className&&(b.className=b.className.replace(this.similarClassRegExp,"")),b.className+=" "+a):b.className=a):(b=this.createContainer(c.dom.getDocument(a)),a.parentNode.insertBefore(b,a),b.appendChild(a))},isRemovable:function(b){return c.dom.arrayContains(this.tagNames,b.tagName.toLowerCase())&&a.lang.string(b.className).trim()==this.cssClass},undoToTextNode:function(a,c,e){c.containsNode(e)||
179
- (a=c.cloneRange(),a.selectNode(e),a.isPointInRange(c.endContainer,c.endOffset)&&b(c.endContainer,c.endOffset)&&(d(e,c.endContainer,c.endOffset),c.setEndAfter(e)),a.isPointInRange(c.startContainer,c.startOffset)&&b(c.startContainer,c.startOffset)&&(e=d(e,c.startContainer,c.startOffset)));this.similarClassRegExp&&e.className&&(e.className=e.className.replace(this.similarClassRegExp,""));if(this.isRemovable(e)){c=e;for(e=c.parentNode;c.firstChild;)e.insertBefore(c.firstChild,c);e.removeChild(c)}},applyToRange:function(b){var c=
180
- b.getNodes([a.TEXT_NODE]);if(!c.length)try{var d=this.createContainer(b.endContainer.ownerDocument);b.surroundContents(d);this.selectNode(b,d);return}catch(e){}b.splitBoundaries();c=b.getNodes([a.TEXT_NODE]);if(c.length){for(var f=0,g=c.length;f<g;++f)d=c[f],this.getAncestorWithClass(d)||this.applyToTextNode(d);b.setStart(c[0],0);d=c[c.length-1];b.setEnd(d,d.length);this.normalize&&this.postApply(c,b)}},undoToRange:function(b){var c=b.getNodes([a.TEXT_NODE]),d,e;c.length?(b.splitBoundaries(),c=b.getNodes([a.TEXT_NODE])):
181
- (c=b.endContainer.ownerDocument.createTextNode(a.INVISIBLE_SPACE),b.insertNode(c),b.selectNode(c),c=[c]);for(var f=0,g=c.length;f<g;++f)d=c[f],(e=this.getAncestorWithClass(d))&&this.undoToTextNode(d,b,e);1==g?this.selectNode(b,c[0]):(b.setStart(c[0],0),d=c[c.length-1],b.setEnd(d,d.length),this.normalize&&this.postApply(c,b))},selectNode:function(b,c){var d=c.nodeType===a.ELEMENT_NODE,e="canHaveHTML"in c?c.canHaveHTML:!0,f=d?c.innerHTML:c.data;if((f=""===f||f===a.INVISIBLE_SPACE)&&d&&e)try{c.innerHTML=
182
- a.INVISIBLE_SPACE}catch(g){}b.selectNodeContents(c);f&&d?b.collapse(!1):f&&(b.setStartAfter(c),b.setEndAfter(c))},getTextSelectedByRange:function(a,b){var c=b.cloneRange();c.selectNodeContents(a);var d=c.intersection(b),d=d?d.toString():"";c.detach();return d},isAppliedToRange:function(b){var c=[],d,e=b.getNodes([a.TEXT_NODE]);if(!e.length)return(d=this.getAncestorWithClass(b.startContainer))?[d]:!1;for(var f=0,g=e.length,k;f<g;++f)if(k=this.getTextSelectedByRange(e[f],b),d=this.getAncestorWithClass(e[f]),
183
- ""==k||d)c.push(d);else return!1;return c},toggleRange:function(a){this.isAppliedToRange(a)?this.undoToRange(a):this.applyToRange(a)}};a.selection.HTMLApplier=f})(wysihtml5,rangy);
184
- wysihtml5.Commands=Base.extend({constructor:function(a){this.editor=a;this.composer=a.composer;this.doc=this.composer.doc},support:function(a){return wysihtml5.browser.supportsCommand(this.doc,a)},exec:function(a,c){var b=wysihtml5.commands[a],d=wysihtml5.lang.array(arguments).get(),e=b&&b.exec,f=null;this.editor.fire("beforecommand:composer");if(e)d.unshift(this.composer),f=e.apply(b,d);else try{f=this.doc.execCommand(a,!1,c)}catch(g){}this.editor.fire("aftercommand:composer");return f},state:function(a,
185
- c){var b=wysihtml5.commands[a],d=wysihtml5.lang.array(arguments).get(),e=b&&b.state;if(e)return d.unshift(this.composer),e.apply(b,d);try{return this.doc.queryCommandState(a)}catch(f){return!1}}});wysihtml5.commands.bold={exec:function(a,c){return wysihtml5.commands.formatInline.exec(a,c,"b")},state:function(a,c){return wysihtml5.commands.formatInline.state(a,c,"b")}};
186
- (function(a){function c(c,g){var k=c.doc,h="_wysihtml5-temp-"+ +new Date,l=0,p,n,u;a.commands.formatInline.exec(c,b,d,h,/non-matching-class/g);p=k.querySelectorAll(d+"."+h);for(h=p.length;l<h;l++)for(u in n=p[l],n.removeAttribute("class"),g)n.setAttribute(u,g[u]);l=n;1===h&&(u=e.getTextContent(n),h=!!n.querySelector("*"),u=""===u||u===a.INVISIBLE_SPACE,!h&&u&&(e.setTextContent(n,g.text||n.href),k=k.createTextNode(" "),c.selection.setAfter(n),e.insert(k).after(n),l=k));c.selection.setAfter(l)}var b,
187
- d="A",e=a.dom;a.commands.createLink={exec:function(a,b,d){var h=this.state(a,b);h?a.selection.executeAndRestore(function(){for(var a=h.length,b=0,c,d,f;b<a;b++)c=h[b],d=e.getParentElement(c,{nodeName:"code"}),f=e.getTextContent(c),f.match(e.autoLink.URL_REG_EXP)&&!d?e.renameElement(c,"code"):e.replaceWithChildNodes(c)}):(d="object"===typeof d?d:{href:d},c(a,d))},state:function(b,c){return a.commands.formatInline.state(b,c,"A")}}})(wysihtml5);
188
- (function(a){var c=/wysiwyg-font-size-[0-9a-z\-]+/g;a.commands.fontSize={exec:function(b,d,e){return a.commands.formatInline.exec(b,d,"span","wysiwyg-font-size-"+e,c)},state:function(b,d,e){return a.commands.formatInline.state(b,d,"span","wysiwyg-font-size-"+e,c)}}})(wysihtml5);
189
- (function(a){var c=/wysiwyg-color-[0-9a-z]+/g;a.commands.foreColor={exec:function(b,d,e){return a.commands.formatInline.exec(b,d,"span","wysiwyg-color-"+e,c)},state:function(b,d,e){return a.commands.formatInline.state(b,d,"span","wysiwyg-color-"+e,c)}}})(wysihtml5);
190
- (function(a){function c(b){for(b=b.previousSibling;b&&b.nodeType===a.TEXT_NODE&&!a.lang.string(b.data).trim();)b=b.previousSibling;return b}function b(b){for(b=b.nextSibling;b&&b.nodeType===a.TEXT_NODE&&!a.lang.string(b.data).trim();)b=b.nextSibling;return b}function d(a){return"BR"===a.nodeName||"block"===g.getStyle("display").from(a)?!0:!1}function e(b,c,d,e){if(e)var f=g.observe(b,"DOMNodeInserted",function(b){b=b.target;var c;b.nodeType===a.ELEMENT_NODE&&(c=g.getStyle("display").from(b),"inline"!==
191
- c.substr(0,6)&&(b.className+=" "+e))});b.execCommand(c,!1,d);f&&f.stop()}function f(d,e){d.selection.selectLine();d.selection.surround(e);var f=b(e),g=c(e);f&&"BR"===f.nodeName&&f.parentNode.removeChild(f);g&&"BR"===g.nodeName&&g.parentNode.removeChild(g);(f=e.lastChild)&&"BR"===f.nodeName&&f.parentNode.removeChild(f);d.selection.selectNode(e,a.browser.displaysCaretInEmptyContentEditableCorrectly())}var g=a.dom,k="H1 H2 H3 H4 H5 H6 P BLOCKQUOTE DIV".split(" ");a.commands.formatBlock={exec:function(h,
192
- l,p,n,u){var D=h.doc,q=this.state(h,l,p,n,u),r=h.config.useLineBreaks,s=r?"DIV":"P",v;p="string"===typeof p?p.toUpperCase():p;if(q)h.selection.executeAndRestoreSimple(function(){u&&(q.className=q.className.replace(u,""));if(a.lang.string(q.className).trim()||!r&&"P"!==p)g.renameElement(q,"P"===p?"DIV":s);else{var e=q,f=e.ownerDocument,h=b(e),l=c(e);h&&!d(h)&&e.parentNode.insertBefore(f.createElement("br"),h);l&&!d(l)&&e.parentNode.insertBefore(f.createElement("br"),e);g.replaceWithChildNodes(q)}});
193
- else{if(null===p||a.lang.array(k).contains(p))if(v=h.selection.getSelectedNode(),q=g.getParentElement(v,{nodeName:k})){h.selection.executeAndRestore(function(){p&&(q=g.renameElement(q,p));if(n){var a=q;a.className?(a.className=a.className.replace(u,""),a.className+=" "+n):a.className=n}});return}h.commands.support(l)?e(D,l,p||s,n):(q=D.createElement(p||s),n&&(q.className=n),f(h,q))}},state:function(a,b,c,d,e){c="string"===typeof c?c.toUpperCase():c;a=a.selection.getSelectedNode();return g.getParentElement(a,
194
- {nodeName:c,className:d,classRegExp:e})}}})(wysihtml5);
195
- (function(a){function c(c,f,g){var k=c+":"+f;if(!d[k]){var h=d,l=a.selection.HTMLApplier,p=b[c];c=p?[c.toLowerCase(),p.toLowerCase()]:[c.toLowerCase()];h[k]=new l(c,f,g,!0)}return d[k]}var b={strong:"b",em:"i",b:"strong",i:"em"},d={};a.commands.formatInline={exec:function(a,b,d,k,h){b=a.selection.getRange();if(!b)return!1;c(d,k,h).toggleRange(b);a.selection.setSelection(b)},state:function(d,f,g,k,h){f=d.doc;var l=b[g]||g;return!a.dom.hasElementWithTagName(f,g)&&!a.dom.hasElementWithTagName(f,l)||
196
- k&&!a.dom.hasElementWithClassName(f,k)?!1:(d=d.selection.getRange())?c(g,k,h).isAppliedToRange(d):!1}}})(wysihtml5);wysihtml5.commands.insertHTML={exec:function(a,c,b){a.commands.support(c)?a.doc.execCommand(c,!1,b):a.selection.insertHTML(b)},state:function(){return!1}};
197
- (function(a){a.commands.insertImage={exec:function(c,b,d){d="object"===typeof d?d:{src:d};var e=c.doc;if(b=this.state(c))c.selection.setBefore(b),d=b.parentNode,d.removeChild(b),a.dom.removeEmptyTextNodes(d),"A"!==d.nodeName||d.firstChild||(c.selection.setAfter(d),d.parentNode.removeChild(d)),a.quirks.redraw(c.element);else{b=e.createElement("IMG");for(var f in d)b.setAttribute("className"===f?"class":f,d[f]);c.selection.insertNode(b);a.browser.hasProblemsSettingCaretAfterImg()?(d=e.createTextNode(a.INVISIBLE_SPACE),
198
- c.selection.insertNode(d),c.selection.setAfter(d)):c.selection.setAfter(b)}},state:function(c){var b;if(!a.dom.hasElementWithTagName(c.doc,"IMG"))return!1;b=c.selection.getSelectedNode();if(!b)return!1;if("IMG"===b.nodeName)return b;if(b.nodeType!==a.ELEMENT_NODE)return!1;b=c.selection.getText();if(b=a.lang.string(b).trim())return!1;c=c.selection.getNodes(a.ELEMENT_NODE,function(a){return"IMG"===a.nodeName});return 1!==c.length?!1:c[0]}}})(wysihtml5);
199
- (function(a){var c="<br>"+(a.browser.needsSpaceAfterLineBreak()?" ":"");a.commands.insertLineBreak={exec:function(b,d){b.commands.support(d)?(b.doc.execCommand(d,!1,null),a.browser.autoScrollsToCaret()||b.selection.scrollIntoView()):b.commands.exec("insertHTML",c)},state:function(){return!1}}})(wysihtml5);
200
- wysihtml5.commands.insertOrderedList={exec:function(a,c){var b=a.doc,d=a.selection.getSelectedNode(),e=wysihtml5.dom.getParentElement(d,{nodeName:"OL"}),f=wysihtml5.dom.getParentElement(d,{nodeName:"UL"}),d="_wysihtml5-temp-"+(new Date).getTime(),g;e||f||!a.commands.support(c)?e?a.selection.executeAndRestore(function(){wysihtml5.dom.resolveList(e,a.config.useLineBreaks)}):f?a.selection.executeAndRestore(function(){wysihtml5.dom.renameElement(f,"ol")}):(a.commands.exec("formatBlock","div",d),g=b.querySelector("."+
201
- d),b=""===g.innerHTML||g.innerHTML===wysihtml5.INVISIBLE_SPACE||"<br>"===g.innerHTML,a.selection.executeAndRestore(function(){e=wysihtml5.dom.convertToList(g,"ol")}),b&&a.selection.selectNode(e.querySelector("li"),!0)):b.execCommand(c,!1,null)},state:function(a){a=a.selection.getSelectedNode();return wysihtml5.dom.getParentElement(a,{nodeName:"OL"})}};
202
- wysihtml5.commands.insertUnorderedList={exec:function(a,c){var b=a.doc,d=a.selection.getSelectedNode(),e=wysihtml5.dom.getParentElement(d,{nodeName:"UL"}),f=wysihtml5.dom.getParentElement(d,{nodeName:"OL"}),d="_wysihtml5-temp-"+(new Date).getTime(),g;e||f||!a.commands.support(c)?e?a.selection.executeAndRestore(function(){wysihtml5.dom.resolveList(e,a.config.useLineBreaks)}):f?a.selection.executeAndRestore(function(){wysihtml5.dom.renameElement(f,"ul")}):(a.commands.exec("formatBlock","div",d),g=b.querySelector("."+
203
- d),b=""===g.innerHTML||g.innerHTML===wysihtml5.INVISIBLE_SPACE||"<br>"===g.innerHTML,a.selection.executeAndRestore(function(){e=wysihtml5.dom.convertToList(g,"ul")}),b&&a.selection.selectNode(e.querySelector("li"),!0)):b.execCommand(c,!1,null)},state:function(a){a=a.selection.getSelectedNode();return wysihtml5.dom.getParentElement(a,{nodeName:"UL"})}};
204
- wysihtml5.commands.italic={exec:function(a,c){return wysihtml5.commands.formatInline.exec(a,c,"i")},state:function(a,c){return wysihtml5.commands.formatInline.state(a,c,"i")}};(function(a){var c=/wysiwyg-text-align-[0-9a-z]+/g;a.commands.justifyCenter={exec:function(b,d){return a.commands.formatBlock.exec(b,"formatBlock",null,"wysiwyg-text-align-center",c)},state:function(b,d){return a.commands.formatBlock.state(b,"formatBlock",null,"wysiwyg-text-align-center",c)}}})(wysihtml5);
205
- (function(a){var c=/wysiwyg-text-align-[0-9a-z]+/g;a.commands.justifyLeft={exec:function(b,d){return a.commands.formatBlock.exec(b,"formatBlock",null,"wysiwyg-text-align-left",c)},state:function(b,d){return a.commands.formatBlock.state(b,"formatBlock",null,"wysiwyg-text-align-left",c)}}})(wysihtml5);
206
- (function(a){var c=/wysiwyg-text-align-[0-9a-z]+/g;a.commands.justifyRight={exec:function(b,d){return a.commands.formatBlock.exec(b,"formatBlock",null,"wysiwyg-text-align-right",c)},state:function(b,d){return a.commands.formatBlock.state(b,"formatBlock",null,"wysiwyg-text-align-right",c)}}})(wysihtml5);
207
- (function(a){var c=/wysiwyg-text-align-[0-9a-z]+/g;a.commands.justifyFull={exec:function(b,d){return a.commands.formatBlock.exec(b,"formatBlock",null,"wysiwyg-text-align-justify",c)},state:function(b,d){return a.commands.formatBlock.state(b,"formatBlock",null,"wysiwyg-text-align-justify",c)}}})(wysihtml5);wysihtml5.commands.redo={exec:function(a){return a.undoManager.redo()},state:function(a){return!1}};
208
- wysihtml5.commands.underline={exec:function(a,c){return wysihtml5.commands.formatInline.exec(a,c,"u")},state:function(a,c){return wysihtml5.commands.formatInline.state(a,c,"u")}};wysihtml5.commands.undo={exec:function(a){return a.undoManager.undo()},state:function(a){return!1}};
209
- (function(a){var c='<span id="_wysihtml5-undo" class="_wysihtml5-temp">'+a.INVISIBLE_SPACE+"</span>",b='<span id="_wysihtml5-redo" class="_wysihtml5-temp">'+a.INVISIBLE_SPACE+"</span>",d=a.dom;a.UndoManager=a.lang.Dispatcher.extend({constructor:function(a){this.editor=a;this.composer=a.composer;this.element=this.composer.element;this.position=0;this.historyStr=[];this.historyDom=[];this.transact();this._observe()},_observe:function(){var e=this,f=this.composer.sandbox.getDocument(),g;d.observe(this.element,
210
- "keydown",function(a){if(!a.altKey&&(a.ctrlKey||a.metaKey)){var b=a.keyCode,c=90===b&&a.shiftKey||89===b;90!==b||a.shiftKey?c&&(e.redo(),a.preventDefault()):(e.undo(),a.preventDefault())}});d.observe(this.element,"keydown",function(a){a=a.keyCode;a!==g&&(g=a,8!==a&&46!==a||e.transact())});if(a.browser.hasUndoInContextMenu()){var k,h,l=function(){for(var a;a=f.querySelector("._wysihtml5-temp");)a.parentNode.removeChild(a);clearInterval(k)};d.observe(this.element,"contextmenu",function(){l();e.composer.selection.executeAndRestoreSimple(function(){e.element.lastChild&&
211
- e.composer.selection.setAfter(e.element.lastChild);f.execCommand("insertHTML",!1,c);f.execCommand("insertHTML",!1,b);f.execCommand("undo",!1,null)});k=setInterval(function(){f.getElementById("_wysihtml5-redo")?(l(),e.redo()):f.getElementById("_wysihtml5-undo")||(l(),e.undo())},400);h||(h=!0,d.observe(document,"mousedown",l),d.observe(f,["mousedown","paste","cut","copy"],l))})}this.editor.on("newword:composer",function(){e.transact()}).on("beforecommand:composer",function(){e.transact()})},transact:function(){var b=
212
- this.historyStr[this.position-1],c=this.composer.getValue();if(c!==b){25<(this.historyStr.length=this.historyDom.length=this.position)&&(this.historyStr.shift(),this.historyDom.shift(),this.position--);this.position++;var d=this.composer.selection.getRange(),b=d.startContainer||this.element,k=d.startOffset||0,h;b.nodeType===a.ELEMENT_NODE?d=b:(d=b.parentNode,h=this.getChildNodeIndex(d,b));d.setAttribute("data-wysihtml5-selection-offset",k);"undefined"!==typeof h&&d.setAttribute("data-wysihtml5-selection-node",
213
- h);h=this.element.cloneNode(!!c);this.historyDom.push(h);this.historyStr.push(c);d.removeAttribute("data-wysihtml5-selection-offset");d.removeAttribute("data-wysihtml5-selection-node")}},undo:function(){this.transact();this.undoPossible()&&(this.set(this.historyDom[--this.position-1]),this.editor.fire("undo:composer"))},redo:function(){this.redoPossible()&&(this.set(this.historyDom[++this.position-1]),this.editor.fire("redo:composer"))},undoPossible:function(){return 1<this.position},redoPossible:function(){return this.position<
214
- this.historyStr.length},set:function(a){this.element.innerHTML="";for(var b=0,c=a.childNodes,d=a.childNodes.length;b<d;b++)this.element.appendChild(c[b].cloneNode(!0));a.hasAttribute("data-wysihtml5-selection-offset")?(b=a.getAttribute("data-wysihtml5-selection-offset"),c=a.getAttribute("data-wysihtml5-selection-node"),a=this.element):(a=this.element.querySelector("[data-wysihtml5-selection-offset]")||this.element,b=a.getAttribute("data-wysihtml5-selection-offset"),c=a.getAttribute("data-wysihtml5-selection-node"),
215
- a.removeAttribute("data-wysihtml5-selection-offset"),a.removeAttribute("data-wysihtml5-selection-node"));null!==c&&(a=this.getChildNodeByIndex(a,+c));this.composer.selection.set(a,b)},getChildNodeIndex:function(a,b){for(var c=0,d=a.childNodes,h=d.length;c<h;c++)if(d[c]===b)return c},getChildNodeByIndex:function(a,b){return a.childNodes[b]}})})(wysihtml5);
216
- wysihtml5.views.View=Base.extend({constructor:function(a,c,b){this.parent=a;this.element=c;this.config=b;this._observeViewChange()},_observeViewChange:function(){var a=this;this.parent.on("beforeload",function(){a.parent.on("change_view",function(c){c===a.name?(a.parent.currentView=a,a.show(),setTimeout(function(){a.focus()},0)):a.hide()})})},focus:function(){if(this.element.ownerDocument.querySelector(":focus")!==this.element)try{this.element.focus()}catch(a){}},hide:function(){this.element.style.display=
217
- "none"},show:function(){this.element.style.display=""},disable:function(){this.element.setAttribute("disabled","disabled")},enable:function(){this.element.removeAttribute("disabled")}});
218
- (function(a){var c=a.dom,b=a.browser;a.views.Composer=a.views.View.extend({name:"composer",CARET_HACK:"<br>",constructor:function(a,b,c){this.base(a,b,c);this.textarea=this.parent.textarea;this._initSandbox()},clear:function(){this.element.innerHTML=b.displaysCaretInEmptyContentEditableCorrectly()?"":this.CARET_HACK},getValue:function(b){var c=this.isEmpty()?"":a.quirks.getCorrectInnerHTML(this.element);b&&(c=this.parent.parse(c));return c},setValue:function(a,b){b&&(a=this.parent.parse(a));try{this.element.innerHTML=
219
- a}catch(c){this.element.innerText=a}},show:function(){this.iframe.style.display=this._displayStyle||"";this.textarea.element.disabled||(this.disable(),this.enable())},hide:function(){this._displayStyle=c.getStyle("display").from(this.iframe);"none"===this._displayStyle&&(this._displayStyle=null);this.iframe.style.display="none"},disable:function(){this.parent.fire("disable:composer");this.element.removeAttribute("contentEditable")},enable:function(){this.parent.fire("enable:composer");this.element.setAttribute("contentEditable",
220
- "true")},focus:function(b){a.browser.doesAsyncFocus()&&this.hasPlaceholderSet()&&this.clear();this.base();var c=this.element.lastChild;b&&c&&("BR"===c.nodeName?this.selection.setBefore(this.element.lastChild):this.selection.setAfter(this.element.lastChild))},getTextContent:function(){return c.getTextContent(this.element)},hasPlaceholderSet:function(){return this.getTextContent()==this.textarea.element.getAttribute("placeholder")&&this.placeholderSet},isEmpty:function(){var a=this.element.innerHTML.toLowerCase();
221
- return""===a||"<br>"===a||"<p></p>"===a||"<p><br></p>"===a||this.hasPlaceholderSet()},_initSandbox:function(){var a=this;this.sandbox=new c.Sandbox(function(){a._create()},{stylesheets:this.config.stylesheets});this.iframe=this.sandbox.getIframe();var b=this.textarea.element;c.insert(this.iframe).after(b);if(b.form){var f=document.createElement("input");f.type="hidden";f.name="_wysihtml5_mode";f.value=1;c.insert(f).after(b)}},_create:function(){var d=this;this.doc=this.sandbox.getDocument();this.element=
222
- this.doc.body;this.textarea=this.parent.textarea;this.element.innerHTML=this.textarea.getValue(!0);this.selection=new a.Selection(this.parent);this.commands=new a.Commands(this.parent);c.copyAttributes("className spellcheck title lang dir accessKey".split(" ")).from(this.textarea.element).to(this.element);c.addClass(this.element,this.config.composerClassName);this.config.style&&this.style();this.observe();var e=this.config.name;e&&(c.addClass(this.element,e),c.addClass(this.iframe,e));this.enable();
223
- this.textarea.element.disabled&&this.disable();(e="string"===typeof this.config.placeholder?this.config.placeholder:this.textarea.element.getAttribute("placeholder"))&&c.simulatePlaceholder(this.parent,this,e);this.commands.exec("styleWithCSS",!1);this._initAutoLinking();this._initObjectResizing();this._initUndoManager();this._initLineBreaking();!this.textarea.element.hasAttribute("autofocus")&&document.querySelector(":focus")!=this.textarea.element||b.isIos()||setTimeout(function(){d.focus(!0)},
224
- 100);b.clearsContentEditableCorrectly()||a.quirks.ensureProperClearing(this);this.initSync&&this.config.sync&&this.initSync();this.textarea.hide();this.parent.fire("beforeload").fire("load")},_initAutoLinking:function(){var d=this,e=b.canDisableAutoLinking(),f=b.doesAutoLinkingInContentEditable();e&&this.commands.exec("autoUrlDetect",!1);if(this.config.autoLink){if(!f||f&&e)this.parent.on("newword:composer",function(){c.getTextContent(d.element).match(c.autoLink.URL_REG_EXP)&&d.selection.executeAndRestore(function(a,
225
- b){c.autoLink(b.parentNode)})}),c.observe(this.element,"blur",function(){c.autoLink(d.element)});var g=this.sandbox.getDocument().getElementsByTagName("a"),k=c.autoLink.URL_REG_EXP,h=function(b){b=a.lang.string(c.getTextContent(b)).trim();"www."===b.substr(0,4)&&(b="http://"+b);return b};c.observe(this.element,"keydown",function(a){if(g.length){a=d.selection.getSelectedNode(a.target.ownerDocument);var b=c.getParentElement(a,{nodeName:"A"},4),e;b&&(e=h(b),setTimeout(function(){var a=h(b);a!==e&&a.match(k)&&
226
- b.setAttribute("href",a)},0))}})}},_initObjectResizing:function(){this.commands.exec("enableObjectResizing",!0);if(b.supportsEvent("resizeend")){var d=["width","height"],e=d.length,f=this.element;c.observe(f,"resizeend",function(b){b=b.target||b.srcElement;var c=b.style,h=0,l;if("IMG"===b.nodeName){for(;h<e;h++)l=d[h],c[l]&&(b.setAttribute(l,parseInt(c[l],10)),c[l]="");a.quirks.redraw(f)}})}},_initUndoManager:function(){this.undoManager=new a.UndoManager(this.parent)},_initLineBreaking:function(){function d(a){var b=
227
- c.getParentElement(a,{nodeName:["P","DIV"]},2);b&&e.selection.executeAndRestore(function(){e.config.useLineBreaks?c.replaceWithChildNodes(b):"P"!==b.nodeName&&c.renameElement(b,"p")})}var e=this,f="LI P H1 H2 H3 H4 H5 H6".split(" "),g=["UL","OL","MENU"];this.config.useLineBreaks||c.observe(this.element,["focus","keydown"],function(){if(e.isEmpty()){var a=e.doc.createElement("P");e.element.innerHTML="";e.element.appendChild(a);b.displaysCaretInEmptyContentEditableCorrectly()?e.selection.selectNode(a,
228
- !0):(a.innerHTML="<br>",e.selection.setBefore(a.firstChild))}});b.createsNestedInvalidMarkupAfterPaste()&&c.observe(this.element,"paste",function(b){b=e.doc.createTextNode(a.INVISIBLE_SPACE);e.selection.insertNode(b)});c.observe(this.doc,"keydown",function(b){var h=b.keyCode;if(!b.shiftKey&&(h===a.ENTER_KEY||h===a.BACKSPACE_KEY)){var l=c.getParentElement(e.selection.getSelectedNode(),{nodeName:f},4);l?setTimeout(function(){var b=e.selection.getSelectedNode(),f;if("LI"===l.nodeName){if(!b)return;(f=
229
- c.getParentElement(b,{nodeName:g},2))||d(b)}h===a.ENTER_KEY&&l.nodeName.match(/^H[1-6]$/)&&d(b)},0):e.config.useLineBreaks&&(h===a.ENTER_KEY&&!a.browser.insertsLineBreaksOnReturn())&&(e.commands.exec("insertLineBreak"),b.preventDefault())}})}})})(wysihtml5);
230
- (function(a){var c=a.dom,b=document,d=window,e=b.createElement("div"),f="background-color color cursor font-family font-size font-style font-variant font-weight line-height letter-spacing text-align text-decoration text-indent text-rendering word-break word-wrap word-spacing".split(" "),g="background-color border-collapse border-bottom-color border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-style border-top-width clear display float margin-bottom margin-left margin-right margin-top outline-color outline-offset outline-width outline-style padding-left padding-right padding-top padding-bottom position top left right bottom z-index vertical-align text-align -webkit-box-sizing -moz-box-sizing -ms-box-sizing box-sizing -webkit-box-shadow -moz-box-shadow -ms-box-shadow box-shadow -webkit-border-top-right-radius -moz-border-radius-topright border-top-right-radius -webkit-border-bottom-right-radius -moz-border-radius-bottomright border-bottom-right-radius -webkit-border-bottom-left-radius -moz-border-radius-bottomleft border-bottom-left-radius -webkit-border-top-left-radius -moz-border-radius-topleft border-top-left-radius width height".split(" "),
231
- k=["html { height: 100%; }","body { height: 100%; padding: 1px 0 0 0; margin: -1px 0 0 0; }","body > p:first-child { margin-top: 0; }","._wysihtml5-temp { display: none; }",a.browser.isGecko?"body.placeholder { color: graytext !important; }":"body.placeholder { color: #a9a9a9 !important; }","img:-moz-broken { -moz-force-broken-image-icon: 1; height: 24px; width: 24px; }"],h=function(a){if(a.setActive)try{a.setActive()}catch(e){}else{var f=a.style,h=b.documentElement.scrollTop||
232
- b.body.scrollTop,g=b.documentElement.scrollLeft||b.body.scrollLeft,f={position:f.position,top:f.top,left:f.left,WebkitUserSelect:f.WebkitUserSelect};c.setStyles({position:"absolute",top:"-99999px",left:"-99999px",WebkitUserSelect:"none"}).on(a);a.focus();c.setStyles(f).on(a);d.scrollTo&&d.scrollTo(g,h)}};a.views.Composer.prototype.style=function(){var d=this,p=b.querySelector(":focus"),n=this.textarea.element,u=n.hasAttribute("placeholder"),D=u&&n.getAttribute("placeholder"),q=n.style.display,r=n.disabled,
233
- s;this.focusStylesHost=e.cloneNode(!1);this.blurStylesHost=e.cloneNode(!1);this.disabledStylesHost=e.cloneNode(!1);u&&n.removeAttribute("placeholder");n===p&&n.blur();n.disabled=!1;n.style.display=s="none";if(n.getAttribute("rows")&&"auto"===c.getStyle("height").from(n)||n.getAttribute("cols")&&"auto"===c.getStyle("width").from(n))n.style.display=s=q;c.copyStyles(g).from(n).to(this.iframe).andTo(this.blurStylesHost);c.copyStyles(f).from(n).to(this.element).andTo(this.blurStylesHost);c.insertCSS(k).into(this.element.ownerDocument);
234
- n.disabled=!0;c.copyStyles(g).from(n).to(this.disabledStylesHost);c.copyStyles(f).from(n).to(this.disabledStylesHost);n.disabled=r;n.style.display=q;h(n);n.style.display=s;c.copyStyles(g).from(n).to(this.focusStylesHost);c.copyStyles(f).from(n).to(this.focusStylesHost);n.style.display=q;c.copyStyles(["display"]).from(n).to(this.iframe);var v=a.lang.array(g).without(["display"]);p?p.focus():n.blur();u&&n.setAttribute("placeholder",D);this.parent.on("focus:composer",function(){c.copyStyles(v).from(d.focusStylesHost).to(d.iframe);
235
- c.copyStyles(f).from(d.focusStylesHost).to(d.element)});this.parent.on("blur:composer",function(){c.copyStyles(v).from(d.blurStylesHost).to(d.iframe);c.copyStyles(f).from(d.blurStylesHost).to(d.element)});this.parent.observe("disable:composer",function(){c.copyStyles(v).from(d.disabledStylesHost).to(d.iframe);c.copyStyles(f).from(d.disabledStylesHost).to(d.element)});this.parent.observe("enable:composer",function(){c.copyStyles(v).from(d.blurStylesHost).to(d.iframe);c.copyStyles(f).from(d.blurStylesHost).to(d.element)});
236
- return this}})(wysihtml5);
237
- (function(a){var c=a.dom,b=a.browser,d={66:"bold",73:"italic",85:"underline"};a.views.Composer.prototype.observe=function(){var e=this,f=this.getValue(),g=this.sandbox.getIframe(),k=this.element,h=b.supportsEventsInIframeCorrectly()?k:this.sandbox.getWindow();c.observe(g,"DOMNodeRemoved",function(){clearInterval(l);e.parent.fire("destroy:composer")});var l=setInterval(function(){c.contains(document.documentElement,g)||(clearInterval(l),e.parent.fire("destroy:composer"))},250);c.observe(h,"focus",
238
- function(){e.parent.fire("focus").fire("focus:composer");setTimeout(function(){f=e.getValue()},0)});c.observe(h,"blur",function(){f!==e.getValue()&&e.parent.fire("change").fire("change:composer");e.parent.fire("blur").fire("blur:composer")});c.observe(k,"dragenter",function(){e.parent.fire("unset_placeholder")});c.observe(k,["drop","paste"],function(){setTimeout(function(){e.parent.fire("paste").fire("paste:composer")},0)});c.observe(k,"keyup",function(b){b=b.keyCode;b!==a.SPACE_KEY&&b!==a.ENTER_KEY||
239
- e.parent.fire("newword:composer")});this.parent.on("paste:composer",function(){setTimeout(function(){e.parent.fire("newword:composer")},0)});b.canSelectImagesInContentEditable()||c.observe(k,"mousedown",function(a){var b=a.target;"IMG"===b.nodeName&&(e.selection.selectNode(b),a.preventDefault())});b.hasHistoryIssue()&&b.supportsSelectionModify()&&c.observe(k,"keydown",function(a){if(a.metaKey||a.ctrlKey){var b=a.keyCode,c=k.ownerDocument.defaultView.getSelection();if(37===b||39===b)37===b&&(c.modify("extend",
240
- "left","lineboundary"),a.shiftKey||c.collapseToStart()),39===b&&(c.modify("extend","right","lineboundary"),a.shiftKey||c.collapseToEnd()),a.preventDefault()}});c.observe(k,"keydown",function(a){var b=d[a.keyCode];(a.ctrlKey||a.metaKey)&&(!a.altKey&&b)&&(e.commands.exec(b),a.preventDefault())});c.observe(k,"keydown",function(b){var c=e.selection.getSelectedNode(!0),d=b.keyCode;!c||("IMG"!==c.nodeName||d!==a.BACKSPACE_KEY&&d!==a.DELETE_KEY)||(d=c.parentNode,d.removeChild(c),"A"!==d.nodeName||d.firstChild||
241
- d.parentNode.removeChild(d),setTimeout(function(){a.quirks.redraw(k)},0),b.preventDefault())});b.hasIframeFocusIssue()&&(c.observe(this.iframe,"focus",function(){setTimeout(function(){e.doc.querySelector(":focus")!==e.element&&e.focus()},0)}),c.observe(this.element,"blur",function(){setTimeout(function(){e.selection.getSelection().removeAllRanges()},0)}));var p={IMG:"Image: ",A:"Link: "};c.observe(k,"mouseover",function(a){a=a.target;var b=a.nodeName;"A"!==b&&"IMG"!==b||a.hasAttribute("title")||(b=
242
- p[b]+(a.getAttribute("href")||a.getAttribute("src")),a.setAttribute("title",b))})}})(wysihtml5);
243
- (function(a){a.views.Synchronizer=Base.extend({constructor:function(a,b,d){this.editor=a;this.textarea=b;this.composer=d;this._observe()},fromComposerToTextarea:function(c){this.textarea.setValue(a.lang.string(this.composer.getValue()).trim(),c)},fromTextareaToComposer:function(a){var b=this.textarea.getValue();b?this.composer.setValue(b,a):(this.composer.clear(),this.editor.fire("set_placeholder"))},sync:function(a){"textarea"===this.editor.currentView.name?this.fromTextareaToComposer(a):this.fromComposerToTextarea(a)},
244
- _observe:function(){var c,b=this,d=this.textarea.element.form,e=function(){c=setInterval(function(){b.fromComposerToTextarea()},400)},f=function(){clearInterval(c);c=null};e();d&&(a.dom.observe(d,"submit",function(){b.sync(!0)}),a.dom.observe(d,"reset",function(){setTimeout(function(){b.fromTextareaToComposer()},0)}));this.editor.on("change_view",function(a){"composer"!==a||c?"textarea"===a&&(b.fromComposerToTextarea(!0),f()):(b.fromTextareaToComposer(!0),e())});this.editor.on("destroy:composer",
245
- f)}})})(wysihtml5);
246
- wysihtml5.views.Textarea=wysihtml5.views.View.extend({name:"textarea",constructor:function(a,c,b){this.base(a,c,b);this._observe()},clear:function(){this.element.value=""},getValue:function(a){var c=this.isEmpty()?"":this.element.value;a&&(c=this.parent.parse(c));return c},setValue:function(a,c){c&&(a=this.parent.parse(a));this.element.value=a},hasPlaceholderSet:function(){var a=wysihtml5.browser.supportsPlaceholderAttributeOn(this.element),c=this.element.getAttribute("placeholder")||null,b=this.element.value;
247
- return a&&!b||b===c},isEmpty:function(){return!wysihtml5.lang.string(this.element.value).trim()||this.hasPlaceholderSet()},_observe:function(){var a=this.element,c=this.parent,b={focusin:"focus",focusout:"blur"},d=wysihtml5.browser.supportsEvent("focusin")?["focusin","focusout","change"]:["focus","blur","change"];c.on("beforeload",function(){wysihtml5.dom.observe(a,d,function(a){a=b[a.type]||a.type;c.fire(a).fire(a+":textarea")});wysihtml5.dom.observe(a,["paste","drop"],function(){setTimeout(function(){c.fire("paste").fire("paste:textarea")},
248
- 0)})})}});
249
- (function(a){var c=a.dom;a.toolbar.Dialog=a.lang.Dispatcher.extend({constructor:function(a,c){this.link=a;this.container=c},_observe:function(){if(!this._observed){var b=this,d=function(a){var c=b._serialize();c==b.elementToChange?b.fire("edit",c):b.fire("save",c);b.hide();a.preventDefault();a.stopPropagation()};c.observe(b.link,"click",function(){c.hasClass(b.link,"wysihtml5-command-dialog-opened")&&setTimeout(function(){b.hide()},0)});c.observe(this.container,"keydown",function(c){var e=c.keyCode;
250
- e===a.ENTER_KEY&&d(c);e===a.ESCAPE_KEY&&(b.fire("cancel"),b.hide())});c.delegate(this.container,"[data-wysihtml5-dialog-action=save]","click",d);c.delegate(this.container,"[data-wysihtml5-dialog-action=cancel]","click",function(a){b.fire("cancel");b.hide();a.preventDefault();a.stopPropagation()});for(var e=this.container.querySelectorAll("input, select, textarea"),f=0,g=e.length,k=function(){clearInterval(b.interval)};f<g;f++)c.observe(e[f],"change",k);this._observed=!0}},_serialize:function(){for(var a=
251
- this.elementToChange||{},c=this.container.querySelectorAll("[data-wysihtml5-dialog-field]"),e=c.length,f=0;f<e;f++)a[c[f].getAttribute("data-wysihtml5-dialog-field")]=c[f].value;return a},_interpolate:function(a){for(var c,e,f=document.querySelector(":focus"),g=this.container.querySelectorAll("[data-wysihtml5-dialog-field]"),k=g.length,h=0;h<k;h++)c=g[h],c===f||a&&"hidden"===c.type||(e=c.getAttribute("data-wysihtml5-dialog-field"),e=this.elementToChange?this.elementToChange[e]||"":c.defaultValue,
252
- c.value=e)},show:function(a){if(!c.hasClass(this.link,"wysihtml5-command-dialog-opened")){var d=this,e=this.container.querySelector("input, select, textarea");this.elementToChange=a;this._observe();this._interpolate();a&&(this.interval=setInterval(function(){d._interpolate(!0)},500));c.addClass(this.link,"wysihtml5-command-dialog-opened");this.container.style.display="";this.fire("show");if(e&&!a)try{e.focus()}catch(f){}}},hide:function(){clearInterval(this.interval);this.elementToChange=null;c.removeClass(this.link,
253
- "wysihtml5-command-dialog-opened");this.container.style.display="none";this.fire("hide")}})})(wysihtml5);
254
- (function(a){var c=a.dom,b={position:"relative"},d={left:0,margin:0,opacity:0,overflow:"hidden",padding:0,position:"absolute",top:0,zIndex:1},e={cursor:"inherit",fontSize:"50px",height:"50px",marginTop:"-25px",outline:0,padding:0,position:"absolute",right:"-4px",top:"50%"},f={"x-webkit-speech":"",speech:""};a.toolbar.Speech=function(g,k){var h=document.createElement("input");if(a.browser.supportsSpeechApiOn(h)){var l=g.editor.textarea.element.getAttribute("lang");l&&(f.lang=l);l=document.createElement("div");
255
- a.lang.object(d).merge({width:k.offsetWidth+"px",height:k.offsetHeight+"px"});c.insert(h).into(l);c.insert(l).into(k);c.setStyles(e).on(h);c.setAttributes(f).on(h);c.setStyles(d).on(l);c.setStyles(b).on(k);c.observe(h,"onwebkitspeechchange"in h?"webkitspeechchange":"speechchange",function(){g.execCommand("insertText",h.value);h.value=""});c.observe(h,"click",function(a){c.hasClass(k,"wysihtml5-command-disabled")&&a.preventDefault();a.stopPropagation()})}else k.style.display="none"}})(wysihtml5);
256
- (function(a){var c=a.dom;a.toolbar.Toolbar=Base.extend({constructor:function(b,c){this.editor=b;this.container="string"===typeof c?document.getElementById(c):c;this.composer=b.composer;this._getLinks("command");this._getLinks("action");this._observe();this.show();for(var e=this.container.querySelectorAll("[data-wysihtml5-command=insertSpeech]"),f=e.length,g=0;g<f;g++)new a.toolbar.Speech(this,e[g])},_getLinks:function(b){for(var c=this[b+"Links"]=a.lang.array(this.container.querySelectorAll("[data-wysihtml5-"+
257
- b+"]")).get(),e=c.length,f=0,g=this[b+"Mapping"]={},k,h,l,p,n;f<e;f++)k=c[f],l=k.getAttribute("data-wysihtml5-"+b),p=k.getAttribute("data-wysihtml5-"+b+"-value"),h=this.container.querySelector("[data-wysihtml5-"+b+"-group='"+l+"']"),n=this._getDialog(k,l),g[l+":"+p]={link:k,group:h,name:l,value:p,dialog:n,state:!1}},_getDialog:function(b,c){var e=this,f=this.container.querySelector("[data-wysihtml5-dialog='"+c+"']"),g,k;f&&(g=new a.toolbar.Dialog(b,f),g.on("show",function(){k=e.composer.selection.getBookmark();
258
- e.editor.fire("show:dialog",{command:c,dialogContainer:f,commandLink:b})}),g.on("save",function(a){k&&e.composer.selection.setBookmark(k);e._execCommand(c,a);e.editor.fire("save:dialog",{command:c,dialogContainer:f,commandLink:b})}),g.on("cancel",function(){e.editor.focus(!1);e.editor.fire("cancel:dialog",{command:c,dialogContainer:f,commandLink:b})}));return g},execCommand:function(a,c){if(!this.commandsDisabled){var e=this.commandMapping[a+":"+c];e&&e.dialog&&!e.state?e.dialog.show():this._execCommand(a,
259
- c)}},_execCommand:function(a,c){this.editor.focus(!1);this.composer.commands.exec(a,c);this._updateLinkStates()},execAction:function(a){var c=this.editor;"change_view"===a&&(c.currentView===c.textarea?c.fire("change_view","composer"):c.fire("change_view","textarea"))},_observe:function(){for(var a=this,d=this.editor,e=this.container,f=this.commandLinks.concat(this.actionLinks),g=f.length,k=0;k<g;k++)if("A"===f[k].nodeName)c.setAttributes({href:"javascript:;",unselectable:"on"}).on(f[k]);else c.setAttributes({unselectable:"on"}).on(f[k]);
260
- c.delegate(e,"[data-wysihtml5-command], [data-wysihtml5-action]","mousedown",function(a){a.preventDefault()});c.delegate(e,"[data-wysihtml5-command]","click",function(c){var d=this.getAttribute("data-wysihtml5-command"),e=this.getAttribute("data-wysihtml5-command-value");a.execCommand(d,e);c.preventDefault()});c.delegate(e,"[data-wysihtml5-action]","click",function(c){var d=this.getAttribute("data-wysihtml5-action");a.execAction(d);c.preventDefault()});d.on("focus:composer",function(){a.bookmark=
261
- null;clearInterval(a.interval);a.interval=setInterval(function(){a._updateLinkStates()},500)});d.on("blur:composer",function(){clearInterval(a.interval)});d.on("destroy:composer",function(){clearInterval(a.interval)});d.on("change_view",function(d){setTimeout(function(){a.commandsDisabled="composer"!==d;a._updateLinkStates();a.commandsDisabled?c.addClass(e,"wysihtml5-commands-disabled"):c.removeClass(e,"wysihtml5-commands-disabled")},0)})},_updateLinkStates:function(){var b=this.commandMapping,d=
262
- this.actionMapping,e,f,g;for(e in b)g=b[e],this.commandsDisabled?(f=!1,c.removeClass(g.link,"wysihtml5-command-active"),g.group&&c.removeClass(g.group,"wysihtml5-command-active"),g.dialog&&g.dialog.hide()):(f=this.composer.commands.state(g.name,g.value),a.lang.object(f).isArray()&&(f=1===f.length?f[0]:!0),c.removeClass(g.link,"wysihtml5-command-disabled"),g.group&&c.removeClass(g.group,"wysihtml5-command-disabled")),g.state!==f&&((g.state=f)?(c.addClass(g.link,"wysihtml5-command-active"),g.group&&
263
- c.addClass(g.group,"wysihtml5-command-active"),g.dialog&&("object"===typeof f?g.dialog.show(f):g.dialog.hide())):(c.removeClass(g.link,"wysihtml5-command-active"),g.group&&c.removeClass(g.group,"wysihtml5-command-active"),g.dialog&&g.dialog.hide()));for(e in d)b=d[e],"change_view"===b.name&&(b.state=this.editor.currentView===this.editor.textarea,b.state?c.addClass(b.link,"wysihtml5-action-active"):c.removeClass(b.link,"wysihtml5-action-active"))},show:function(){this.container.style.display=""},hide:function(){this.container.style.display=
264
- "none"}})})(wysihtml5);
265
- (function(a){var c={name:void 0,style:!0,toolbar:void 0,autoLink:!0,parserRules:{tags:{br:{},span:{},div:{},p:{}},classes:{}},parser:a.dom.parse,composerClassName:"wysihtml5-editor",bodyClassName:"wysihtml5-supported",useLineBreaks:!0,stylesheets:[],placeholderText:void 0,supportTouchDevices:!0,cleanUp:!0};a.Editor=a.lang.Dispatcher.extend({constructor:function(b,d){this.textareaElement="string"===typeof b?document.getElementById(b):b;this.config=a.lang.object({}).merge(c).merge(d).get();this.currentView=
266
- this.textarea=new a.views.Textarea(this,this.textareaElement,this.config);this._isCompatible=a.browser.supported();if(!this._isCompatible||!this.config.supportTouchDevices&&a.browser.isTouchDevice()){var e=this;setTimeout(function(){e.fire("beforeload").fire("load")},0)}else{a.dom.addClass(document.body,this.config.bodyClassName);this.currentView=this.composer=new a.views.Composer(this,this.textareaElement,this.config);"function"===typeof this.config.parser&&this._initParser();this.on("beforeload",
267
- function(){this.synchronizer=new a.views.Synchronizer(this,this.textarea,this.composer);this.config.toolbar&&(this.toolbar=new a.toolbar.Toolbar(this,this.config.toolbar))});try{console.log("Heya! This page is using wysihtml5 for rich text editing. Check out https://github.com/xing/wysihtml5")}catch(f){}}},isCompatible:function(){return this._isCompatible},clear:function(){this.currentView.clear();return this},getValue:function(a){return this.currentView.getValue(a)},setValue:function(a,c){this.fire("unset_placeholder");
268
- if(!a)return this.clear();this.currentView.setValue(a,c);return this},focus:function(a){this.currentView.focus(a);return this},disable:function(){this.currentView.disable();return this},enable:function(){this.currentView.enable();return this},isEmpty:function(){return this.currentView.isEmpty()},hasPlaceholderSet:function(){return this.currentView.hasPlaceholderSet()},parse:function(b){var c=this.config.parser(b,this.config.parserRules,this.composer.sandbox.getDocument(),this.config.cleanUp);"object"===
269
- typeof b&&a.quirks.redraw(b);return c},_initParser:function(){this.on("paste:composer",function(){var b=this;b.composer.selection.executeAndRestore(function(){a.quirks.cleanPastedHTML(b.composer.element);b.parse(b.composer.element)},!0)})}})})(wysihtml5);