wagn 1.12.9 → 1.12.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +15 -0
  2. data/Gemfile +10 -22
  3. data/VERSION +1 -1
  4. data/app/assets/javascripts/wagn.js.coffee +3 -3
  5. data/app/controllers/account_controller.rb +23 -29
  6. data/app/controllers/admin_controller.rb +14 -20
  7. data/app/controllers/card_controller.rb +1 -39
  8. data/app/controllers/wagn_controller.rb +46 -3
  9. data/app/mailers/mailer.rb +11 -10
  10. data/config/environments/development.rb +3 -0
  11. data/{app/models → lib}/card.rb +0 -0
  12. data/lib/card/content.rb +2 -2
  13. data/lib/card/format.rb +26 -5
  14. data/{app/models → lib}/card/reference.rb +0 -0
  15. data/{app/models → lib}/card/revision.rb +0 -0
  16. data/lib/generators/wagn/templates/Gemfile +2 -0
  17. data/lib/tasks/wagn.rake +6 -7
  18. data/lib/wagn/all.rb +11 -2
  19. data/lib/wagn/application.rb +1 -0
  20. data/mods/core/formats/html_format.rb +74 -29
  21. data/mods/core/sets/all/content.rb +5 -1
  22. data/mods/core/sets/all/permissions.rb +11 -4
  23. data/mods/core/sets/all/trash.rb +6 -1
  24. data/mods/standard/chunks/include.rb +3 -5
  25. data/mods/standard/lib/stylesheets/functional.scss +2 -0
  26. data/mods/standard/lib/stylesheets/standard.scss +1 -1
  27. data/mods/standard/sets/all/account.rb +66 -53
  28. data/mods/standard/sets/all/admin.rb +16 -16
  29. data/mods/standard/sets/all/all_css.rb +2 -2
  30. data/mods/standard/sets/all/base.rb +8 -3
  31. data/mods/standard/sets/all/follow.rb +2 -2
  32. data/mods/standard/sets/all/history.rb +1 -1
  33. data/mods/standard/sets/all/json.rb +3 -2
  34. data/mods/standard/sets/all/kml.rb +3 -2
  35. data/mods/standard/sets/all/rich_html.rb +220 -169
  36. data/mods/standard/sets/all/rss.rb +2 -2
  37. data/mods/standard/sets/right/structure.rb +5 -4
  38. data/mods/standard/sets/self/head.rb +2 -2
  39. data/mods/standard/sets/type/account_request.rb +20 -27
  40. data/mods/standard/sets/type/cardtype.rb +15 -2
  41. data/mods/standard/sets/type/layout_type.rb +6 -4
  42. data/mods/standard/sets/type/search_type.rb +1 -1
  43. data/mods/standard/sets/type/set.rb +6 -3
  44. data/mods/standard/sets/type/user.rb +13 -10
  45. data/public/assets/{application-7f1664ac8e65db8af0bfa6539e23c7df.js → application-af2bc486eb3db1c02c4dcd0e23ca25fc.js} +1 -1
  46. data/public/assets/{application-7f1664ac8e65db8af0bfa6539e23c7df.js.gz → application-af2bc486eb3db1c02c4dcd0e23ca25fc.js.gz} +0 -0
  47. data/public/assets/application.js +1 -1
  48. data/public/assets/application.js.gz +0 -0
  49. data/public/assets/html5shiv-printshiv-ad36fc7219f4aeaa275f9a7fe2383413.js.gz +0 -0
  50. data/public/assets/html5shiv-printshiv.js.gz +0 -0
  51. data/public/assets/manifest.yml +2 -2
  52. data/public/assets/tinymce-22b5a139d9ff7df7643afae9ce205508.js.gz +0 -0
  53. data/public/assets/tinymce.js.gz +0 -0
  54. data/spec/lib/card/codename_spec.rb +1 -0
  55. data/spec/mods/core/sets/all/permissions_spec.rb +25 -0
  56. data/spec/mods/core/sets/all/trash_spec.rb +16 -0
  57. data/spec/mods/standard/chunks/include_spec.rb +5 -0
  58. data/spec/mods/standard/sets/all/json_spec.rb +6 -6
  59. data/spec/mods/standard/sets/all/rich_html_spec.rb +36 -0
  60. data/spec/mods/standard/sets/right/structure_spec.rb +8 -2
  61. data/wagn.gemspec +2 -2
  62. metadata +14 -38
@@ -2,10 +2,10 @@
2
2
 
3
3
  format :rss do
4
4
 
5
- view :show do |args|
5
+ def show args
6
6
  # render( args[:view] || :feed )
7
7
  @xml = Builder::XmlMarkup.new
8
- render_feed
8
+ render_feed args
9
9
  end
10
10
 
11
11
  # FIXME: integrate this with common XML features when it is added
@@ -1,10 +1,11 @@
1
- view :core do |args|
2
- with_inclusion_mode :template do
3
- self._final_core args
1
+ format :html do
2
+ view :core do |args|
3
+ with_inclusion_mode :template do
4
+ self._final_core args
5
+ end
4
6
  end
5
7
  end
6
8
 
7
-
8
9
  view :closed_content do |args|
9
10
  "#{_render_type} : #{_render_raw}"
10
11
  end
@@ -9,7 +9,7 @@ format :html do
9
9
  #{ head_title }
10
10
  #{ head_buttons }
11
11
  #{ head_stylesheets }
12
- #{ head_javascript }
12
+ #{ head_javascript }
13
13
  )
14
14
  end
15
15
 
@@ -70,7 +70,7 @@ format :html do
70
70
  def head_javascript
71
71
  varvals = [
72
72
  "window.wagn={rootPath:'#{ Wagn.config.relative_url_root }'}",
73
- "window.tinyMCEPreInit={base:\"#{wagn_path 'assets/tinymce'}\",query:'3.5.8',suffix:''}" # tinyMCE doesn't load on non-root wagns w/o preinit line
73
+ "window.tinyMCEPreInit={base:\"#{wagn_path 'assets/tinymce'}\",query:'3.5.9',suffix:''}" # tinyMCE doesn't load on non-root wagns w/o preinit line
74
74
  ]
75
75
  Wagn::Env[:recaptcha_on] and varvals << "wagn.recaptchaKey='#{Wagn.config.recaptcha_public_key}'"
76
76
  c=Card[:double_click] and !Card.toggle c.content and varvals << 'wagn.noDoubleClick=true'
@@ -3,46 +3,39 @@
3
3
  format :html do
4
4
  view :new do |args|
5
5
  #FIXME - make more use of standard new view
6
- frame_args = args.merge :title=>'Sign Up', :show_help=>true #, :optional_menu=>:never
7
- frame_args[:help_text] = case
6
+ args = args.merge :title=>'Sign Up', :optional_help => :show #, :optional_menu=>:never
7
+ args[:help_text] = case
8
8
  when card.rule_card( :add_help, :fallback=>:help ) ; nil
9
9
  when Account.create_ok? ; 'Send us the following, and we\'ll send you a password.'
10
10
  else ; 'All Account Requests are subject to review.'
11
11
  end
12
12
 
13
- success = Card.setting "#{ Card[ card.accountable? ? :signup : :request ].name }+#{ Card[ :thanks ].name }"
13
+ args[:hidden] ||={}
14
+ args[:hidden][:success] = Card.setting "#{ Card[ card.accountable? ? :signup : :request ].name }+#{ Card[ :thanks ].name }"
15
+ args[:buttons] = submit_tag 'Submit'
14
16
  # *signup+*thanks or *request+*thanks
15
17
 
16
- wrap_frame :signup, frame_args do
17
- card_form :create, 'card-form', 'main-success'=>"REDIRECT" do |f|
18
- @form = f
19
- %{
20
- #{ f.hidden_field :type_id }
21
- #{ hidden_field_tag :success, success }
22
- #{ _render_name_editor :help=>'usually first and last name' }
23
- #{ fieldset :email, text_field( 'card[account_args]', :email ), :editor=>'content' }
24
- #{ with_inclusion_mode(:new) { edit_slot } if card.structure }
25
- <fieldset><div class="button-area">#{ submit_tag 'Submit' }</div></fieldset>
26
- }
27
- end
18
+ frame_and_form :create, args, 'main-success'=>"REDIRECT" do
19
+ %{
20
+ #{ form.hidden_field :type_id }
21
+ #{ _render_name_fieldset :help=>'usually first and last name' }
22
+ #{ _render_email_fieldset }
23
+ #{ edit_slot if card.structure }
24
+ #{ _optional_render :button_fieldset, args }
25
+ }
28
26
  end
29
27
  end
30
28
 
31
29
 
32
30
  view :edit do |args|
33
- frame_args = { :title=>'Invite', :show_help=>true, :optional_menu=>:never,
34
- :help_text=>"Accept account request from: #{link_to_page card.name}"
35
- }
31
+ args[:help_text] ||= "Accept account request"
32
+ args[:hidden] ||= {
33
+ :activate => 'true',
34
+ :card => { :type_id => Card.default_accounted_type_id }
35
+ }
36
36
 
37
- wrap_frame :edit, frame_args do
38
- card_form :update, 'card-form autosave' do |f|
39
- @form= f
40
- %{
41
- #{ hidden_field_tag 'card[type_id]', Card.default_accounted_type_id }
42
- #{ hidden_field_tag :activate, 'true' }
43
- #{ _render_invitation_field }
44
- }
45
- end
37
+ frame_and_form :update, args do
38
+ _render_invitation_field
46
39
  end
47
40
  end
48
41
 
@@ -2,8 +2,21 @@
2
2
 
3
3
  format :html do
4
4
 
5
+ view :type do |args|
6
+ args.merge!(:type_class=>'no-edit') if card.cards_of_type_exist?
7
+ _final_type args
8
+ end
9
+
10
+ view :type_fieldset do |args|
11
+ if cards.cards_of_type_exist?
12
+ %{<div>Sorry, this card must remain a Cardtype so long as there are <strong>#{ card.name }</strong> cards.</div>}
13
+ else
14
+ _final_type_fieldset args
15
+ end
16
+ end
17
+
5
18
  view :watch do |args|
6
- wrap :watch, args do
19
+ wrap args do
7
20
  #type_link = card.watching_type? ? "#{watching_type_cards} | " : ""
8
21
  link_args = if card.watching?
9
22
  ["following", :off, "stop sending emails about changes to #{card.cardname}", { :hover_content=> 'unfollow' } ]
@@ -22,7 +35,7 @@ include Card::Set::Type::Basic
22
35
 
23
36
 
24
37
  def cards_of_type_exist?
25
- Account.as_bot { Card.count_by_wql :type_id=>id } > 0
38
+ !new_card? and Account.as_bot { Card.count_by_wql :type_id=>id } > 0
26
39
  end
27
40
 
28
41
  event :check_for_cards_of_type, :after=>:validate_delete do
@@ -4,8 +4,10 @@ include Card::Set::Type::Html
4
4
  view :editor, :type=>:html
5
5
  view :closed_content, :type=>:html
6
6
 
7
- view :core do |args|
8
- with_inclusion_mode :template do
9
- process_content ::CodeRay.scan( _render_raw, :html ).div
7
+ format :html do
8
+ view :core do |args|
9
+ with_inclusion_mode :template do
10
+ process_content ::CodeRay.scan( _render_raw, :html ).div
11
+ end
10
12
  end
11
- end
13
+ end
@@ -125,7 +125,7 @@ end
125
125
  format :data do
126
126
 
127
127
  view :card_list do |args|
128
- inclusion_defaults[:view] = :atom
128
+ inclusion_defaults[:view] = args[:view] || :atom
129
129
 
130
130
  search_vars[:results].map do |c|
131
131
  process_inclusion c
@@ -1,5 +1,8 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
 
3
+
4
+
5
+
3
6
  format :html do
4
7
 
5
8
  view :core do |args|
@@ -32,7 +35,7 @@ format :html do
32
35
 
33
36
  view :template_link do |args|
34
37
  args.delete :style
35
- wrap :template_link, args do
38
+ wrap args do
36
39
  link = link_to_view args[:inc_syntax], :template_editor, :class=>'slotter' #, 'slot-include'=>include_syntax
37
40
  "{{#{link}}}"
38
41
  end
@@ -43,12 +46,12 @@ format :html do
43
46
  end
44
47
 
45
48
  view :template_editor do |args|
46
- wrap :template_editor, args do
49
+ wrap args do
47
50
  %{
48
51
  <div class="template-editor-left">{{</div>
49
52
  <div class="template-editor-main">
50
53
  #{
51
- wrap_frame :template_editor, :no_slot=>true, :title=>card.label, :optional_menu_view=>:template_closer do
54
+ frame :no_slot=>true, :title=>card.label, :optional_menu_view=>:template_closer do
52
55
  _render_core args.merge(:unlabeled=>true)
53
56
  end
54
57
  }
@@ -7,16 +7,19 @@ attr_accessor :email
7
7
  format :html do
8
8
  #FIXME - should perms check permission to create account?
9
9
  view :new do |args|
10
- wrap_frame :invite, args.merge( :title=>'Invite', :show_help=>true, :optional_menu=>:never ) do
11
- card_form :create do |f|
12
- @form = f
13
- %{
14
- #{ f.hidden_field :type_id }
15
- #{ _render_name_editor :help=>'usually first and last name' }
16
- #{ fieldset :email, text_field( 'card[account_args]', :email, :size=>60 ) }
17
- #{ _render_invitation_field }
18
- }
19
- end
10
+ args.merge!(
11
+ :title=>'Invite',
12
+ :optional_help=>:show,
13
+ :optional_menu=>:never
14
+ )
15
+
16
+ frame_and_form :create, args do
17
+ %{
18
+ #{ form.hidden_field :type_id }
19
+ #{ _render_name_fieldset :help=>'usually first and last name' }
20
+ #{ _render_email_fieldset }
21
+ #{ _render_invitation_field }
22
+ }
20
23
  end
21
24
  end
22
25
 
@@ -79,7 +79,7 @@ function(){function e(e,t,i,o,a,r){for(var s=0,l=o.length;l>s;s++){var c=o[s];if
79
79
  }}}}(tinymce),function(e){e.dom.ScriptLoader=function(){function t(t,i){function n(){c.remove(l),a&&(a.onreadystatechange=a.onload=a=null),i()}function o(){"undefined"!=typeof console&&console.log&&console.log("Failed to load: "+t)}var a,r,s,l,c=e.DOM;return l=c.uniqueId(),e.isIE6&&(r=new e.util.URI(t),s=location,r.host==s.hostname&&r.port==s.port&&r.protocol+":"==s.protocol&&"file"!=r.protocol.toLowerCase())?(e.util.XHR.send({url:e._addVer(r.getURI()),success:function(e){var t=c.create("script",{type:"text/javascript"});t.text=e,document.getElementsByTagName("head")[0].appendChild(t),c.remove(t),n()},error:o}),void 0):(a=document.createElement("script"),a.id=l,a.type="text/javascript",a.src=e._addVer(t),(!e.isIE||e.isIE11)&&(a.onload=n),a.onerror=o,e.isOpera||(a.onreadystatechange=function(){var e=a.readyState;("complete"==e||"loaded"==e)&&n()}),(document.getElementsByTagName("head")[0]||document.body).appendChild(a),void 0)}var i,n=0,o=1,a=2,r={},s=[],l={},c=[],u=0;this.isDone=function(e){return r[e]==a},this.markDone=function(e){r[e]=a},this.add=this.load=function(e,t,o){var a=r[e];a==i&&(s.push(e),r[e]=n),t&&(l[e]||(l[e]=[]),l[e].push({func:t,scope:o||this}))},this.loadQueue=function(e,t){this.loadScripts(s,e,t)},this.loadScripts=function(n,s,d){function h(t){e.each(l[t],function(e){e.func.call(e.scope)}),l[t]=i}var p;c.push({func:s,scope:d||this}),(p=function(){var i=e.grep(n);n.length=0,e.each(i,function(e){return r[e]==a?(h(e),void 0):(r[e]!=o&&(r[e]=o,u++,t(e,function(){r[e]=a,u--,h(e),p()})),void 0)}),u||(e.each(c,function(e){e.func.call(e.scope)}),c.length=0)})()}},e.ScriptLoader=new e.dom.ScriptLoader}(tinymce),function(e){e.dom.RangeUtils=function(t){this.walk=function(i,n){function o(e){var t;return t=e[0],3===t.nodeType&&t===m&&g>=t.nodeValue.length&&e.splice(0,1),t=e[e.length-1],0===b&&e.length>0&&t===v&&3===t.nodeType&&e.splice(e.length-1,1),e}function a(e,t,i){for(var n=[];e&&e!=i;e=e[t])n.push(e);return n}function r(e,t){do{if(e.parentNode==t)return e;e=e.parentNode}while(e)}function s(e,t,i){var r=i?"nextSibling":"previousSibling";for(d=e,h=d.parentNode;d&&d!=t;d=h)h=d.parentNode,p=a(d==e?d:d[r],r),p.length&&(i||p.reverse(),n(o(p)))}var l,c,u,d,h,p,f,m=i.startContainer,g=i.startOffset,v=i.endContainer,b=i.endOffset;if(f=t.select("td.mceSelected,th.mceSelected"),f.length>0)return e.each(f,function(e){n([e])}),void 0;if(1==m.nodeType&&m.hasChildNodes()&&(m=m.childNodes[g]),1==v.nodeType&&v.hasChildNodes()&&(v=v.childNodes[Math.min(b-1,v.childNodes.length-1)]),m==v)return n(o([m]));for(l=t.findCommonAncestor(m,v),d=m;d;d=d.parentNode){if(d===v)return s(m,l,!0);if(d===l)break}for(d=v;d;d=d.parentNode){if(d===m)return s(v,l);if(d===l)break}c=r(m,l)||m,u=r(v,l)||v,s(m,c,!0),p=a(c==m?c:c.nextSibling,"nextSibling",u==v?u.nextSibling:u),p.length&&n(o(p)),s(v,u)},this.split=function(e){function t(e,t){return e.splitText(t)}var i=e.startContainer,n=e.startOffset,o=e.endContainer,a=e.endOffset;return i==o&&3==i.nodeType?n>0&&n<i.nodeValue.length&&(o=t(i,n),i=o.previousSibling,a>n?(a-=n,i=o=t(o,a).previousSibling,a=o.nodeValue.length,n=0):a=0):(3==i.nodeType&&n>0&&n<i.nodeValue.length&&(i=t(i,n),n=0),3==o.nodeType&&a>0&&a<o.nodeValue.length&&(o=t(o,a).previousSibling,a=o.nodeValue.length)),{startContainer:i,startOffset:n,endContainer:o,endOffset:a}}},e.dom.RangeUtils.compareRanges=function(e,t){if(e&&t){if(!e.item&&!e.duplicate)return e.startContainer==t.startContainer&&e.startOffset==t.startOffset;if(e.item&&t.item&&e.item(0)===t.item(0))return!0;if(e.isEqual&&t.isEqual&&t.isEqual(e))return!0}return!1}}(tinymce),function(e){var t=e.dom.Event,i=e.each;e.create("tinymce.ui.KeyboardNavigation",{KeyboardNavigation:function(n,o){var a,r,s,l,c,u=this,d=n.root,h=n.items,p=n.enableUpDown,f=n.enableLeftRight||!n.enableUpDown,m=n.excludeFromTabOrder;o=o||e.DOM,a=function(e){c=e.target.id},r=function(e){o.setAttrib(e.target.id,"tabindex","-1")},l=function(){var e=o.get(c);o.setAttrib(e,"tabindex","0"),e.focus()},u.focus=function(){o.get(c).focus()},u.destroy=function(){i(h,function(e){var t=o.get(e.id);o.unbind(t,"focus",a),o.unbind(t,"blur",r)});var e=o.get(d);o.unbind(e,"focus",l),o.unbind(e,"keydown",s),h=o=d=u.focus=a=r=s=l=null,u.destroy=function(){}},u.moveFocus=function(e,a){{var r,s=-1;u.controls}c&&(i(h,function(e,t){return e.id===c?(s=t,!1):void 0}),s+=e,0>s?s=h.length-1:s>=h.length&&(s=0),r=h[s],o.setAttrib(c,"tabindex","-1"),o.setAttrib(r.id,"tabindex","0"),o.get(r.id).focus(),n.actOnFocus&&n.onAction(r.id),a&&t.cancel(a))},s=function(e){var i=37,o=39,a=38,r=40,s=27,l=14,d=13,h=32;switch(e.keyCode){case i:f&&u.moveFocus(-1),t.cancel(e);break;case o:f&&u.moveFocus(1),t.cancel(e);break;case a:p&&u.moveFocus(-1),t.cancel(e);break;case r:p&&u.moveFocus(1),t.cancel(e);break;case s:n.onCancel&&(n.onCancel(),t.cancel(e));break;case l:case d:case h:n.onAction&&(n.onAction(c),t.cancel(e))}},i(h,function(e,t){var i,n;e.id||(e.id=o.uniqueId("_mce_item_")),n=o.get(e.id),m?(o.bind(n,"blur",r),i="-1"):i=0===t?"0":"-1",n.setAttribute("tabindex",i),o.bind(n,"focus",a)}),h[0]&&(c=h[0].id),o.setAttrib(d,"tabindex","-1");var g=o.get(d);o.bind(g,"focus",l),o.bind(g,"keydown",s)}})}(tinymce),function(e){var t=e.DOM,i=e.is;e.create("tinymce.ui.Control",{Control:function(t,i,n){this.id=t,this.settings=i=i||{},this.rendered=!1,this.onRender=new e.util.Dispatcher(this),this.classPrefix="",this.scope=i.scope||this,this.disabled=0,this.active=0,this.editor=n},setAriaProperty:function(e,i){var n=t.get(this.id+"_aria")||t.get(this.id);n&&t.setAttrib(n,"aria-"+e,!!i)},focus:function(){t.get(this.id).focus()},setDisabled:function(e){e!=this.disabled&&(this.setAriaProperty("disabled",e),this.setState("Disabled",e),this.setState("Enabled",!e),this.disabled=e)},isDisabled:function(){return this.disabled},setActive:function(e){e!=this.active&&(this.setState("Active",e),this.active=e,this.setAriaProperty("pressed",e))},isActive:function(){return this.active},setState:function(e,i){var n=t.get(this.id);e=this.classPrefix+e,i?t.addClass(n,e):t.removeClass(n,e)},isRendered:function(){return this.rendered},renderHTML:function(){},renderTo:function(e){t.setHTML(e,this.renderHTML())},postRender:function(){var e,t=this;i(t.disabled)&&(e=t.disabled,t.disabled=-1,t.setDisabled(e)),i(t.active)&&(e=t.active,t.active=-1,t.setActive(e))},remove:function(){t.remove(this.id),this.destroy()},destroy:function(){e.dom.Event.clear(this.id)}})}(tinymce),tinymce.create("tinymce.ui.Container:tinymce.ui.Control",{Container:function(e,t,i){this.parent(e,t,i),this.controls=[],this.lookup={}},add:function(e){return this.lookup[e.id]=e,this.controls.push(e),e},get:function(e){return this.lookup[e]}}),tinymce.create("tinymce.ui.Separator:tinymce.ui.Control",{Separator:function(e,t){this.parent(e,t),this.classPrefix="mceSeparator",this.setDisabled(!0)},renderHTML:function(){return tinymce.DOM.createHTML("span",{"class":this.classPrefix,role:"separator","aria-orientation":"vertical",tabindex:"-1"})}}),function(e){{var t=e.is;e.DOM,e.each,e.walk}e.create("tinymce.ui.MenuItem:tinymce.ui.Control",{MenuItem:function(e,t){this.parent(e,t),this.classPrefix="mceMenuItem"},setSelected:function(e){this.setState("Selected",e),this.setAriaProperty("checked",!!e),this.selected=e},isSelected:function(){return this.selected},postRender:function(){var e=this;e.parent(),t(e.selected)&&e.setSelected(e.selected)}})}(tinymce),function(e){var t=(e.is,e.DOM),i=(e.each,e.walk);e.create("tinymce.ui.Menu:tinymce.ui.MenuItem",{Menu:function(t,i){var n=this;n.parent(t,i),n.items={},n.collapsed=!1,n.menuCount=0,n.onAddItem=new e.util.Dispatcher(this)},expand:function(e){var t=this;e&&i(t,function(e){e.expand&&e.expand()},"items",t),t.collapsed=!1},collapse:function(e){var t=this;e&&i(t,function(e){e.collapse&&e.collapse()},"items",t),t.collapsed=!0},isCollapsed:function(){return this.collapsed},add:function(i){return i.settings||(i=new e.ui.MenuItem(i.id||t.uniqueId(),i)),this.onAddItem.dispatch(this,i),this.items[i.id]=i},addSeparator:function(){return this.add({separator:!0})},addMenu:function(e){return e.collapse||(e=this.createMenu(e)),this.menuCount++,this.add(e)},hasMenus:function(){return 0!==this.menuCount},remove:function(e){delete this.items[e.id]},removeAll:function(){var e=this;i(e,function(e){e.removeAll?e.removeAll():e.remove(),e.destroy()},"items",e),e.items={}},createMenu:function(i){var n=new e.ui.Menu(i.id||t.uniqueId(),i);return n.onAddItem.add(this.onAddItem.dispatch,this.onAddItem),n}})}(tinymce),function(e){var t=e.is,i=e.DOM,n=e.each,o=e.dom.Event,a=e.dom.Element;e.create("tinymce.ui.DropMenu:tinymce.ui.Menu",{DropMenu:function(n,o){o=o||{},o.container=o.container||i.doc.body,o.offset_x=o.offset_x||0,o.offset_y=o.offset_y||0,o.vp_offset_x=o.vp_offset_x||0,o.vp_offset_y=o.vp_offset_y||0,t(o.icons)&&!o.icons&&(o["class"]+=" mceNoIcons"),this.parent(n,o),this.onShowMenu=new e.util.Dispatcher(this),this.onHideMenu=new e.util.Dispatcher(this),this.classPrefix="mceMenu"},createMenu:function(t){var n,o=this,a=o.settings;return t.container=t.container||a.container,t.parent=o,t.constrain=t.constrain||a.constrain,t["class"]=t["class"]||a["class"],t.vp_offset_x=t.vp_offset_x||a.vp_offset_x,t.vp_offset_y=t.vp_offset_y||a.vp_offset_y,t.keyboard_focus=a.keyboard_focus,n=new e.ui.DropMenu(t.id||i.uniqueId(),t),n.onAddItem.add(o.onAddItem.dispatch,o.onAddItem),n},focus:function(){var e=this;e.keyboardNav&&e.keyboardNav.focus()},update:function(){var e,t,n=this,o=n.settings,a=i.get("menu_"+n.id+"_tbl"),r=i.get("menu_"+n.id+"_co");e=o.max_width?Math.min(a.offsetWidth,o.max_width):a.offsetWidth,t=o.max_height?Math.min(a.offsetHeight,o.max_height):a.offsetHeight,i.boxModel?n.element.setStyles({width:e,height:t}):n.element.setStyles({width:e+2,height:t+2}),o.max_width&&i.setStyle(r,"width",e),o.max_height&&(i.setStyle(r,"height",t),a.clientHeight<o.max_height&&i.setStyle(r,"overflow","hidden"))},showMenu:function(t,r,s){var l,c,u,d,h,p,f=this,m=f.settings,g=i.getViewPort(),v=2,b=f.classPrefix;f.collapse(1),f.isMenuVisible||(f.rendered?l=i.get("menu_"+f.id):(l=i.add(f.settings.container,f.renderNode()),n(f.items,function(e){e.postRender()}),f.element=new a("menu_"+f.id,{blocker:1,container:m.container})),e.isOpera||i.setStyles(l,{left:-65535,top:-65535}),i.show(l),f.update(),t+=m.offset_x||0,r+=m.offset_y||0,g.w-=4,g.h-=4,m.constrain&&(c=l.clientWidth-v,u=l.clientHeight-v,d=g.x+g.w,h=g.y+g.h,t+m.vp_offset_x+c>d&&(t=s?s-c:Math.max(0,d-m.vp_offset_x-c)),r+m.vp_offset_y+u>h&&(r=Math.max(0,h-m.vp_offset_y-u))),i.setStyles(l,{left:t,top:r}),f.element.update(),f.isMenuVisible=1,f.mouseClickFunc=o.add(l,"click",function(e){var t;if(e=e.target,e&&(e=i.getParent(e,"tr"))&&!i.hasClass(e,b+"ItemSub")){if(t=f.items[e.id],t.isDisabled())return;for(p=f;p;)p.hideMenu&&p.hideMenu(),p=p.settings.parent;return t.settings.onclick&&t.settings.onclick(e),!1}}),f.hasMenus()&&(f.mouseOverFunc=o.add(l,"mouseover",function(e){var t,n;if(e=e.target,e&&(e=i.getParent(e,"tr"))){if(t=f.items[e.id],f.lastMenu&&f.lastMenu.collapse(1),t.isDisabled())return;e&&i.hasClass(e,b+"ItemSub")&&(n=i.getRect(e),t.showMenu(n.x+n.w-v,n.y-v,n.x),f.lastMenu=t,i.addClass(i.get(t.id).firstChild,b+"ItemActive"))}})),o.add(l,"keydown",f._keyHandler,f),f.onShowMenu.dispatch(f),m.keyboard_focus&&f._setupKeyboardNav())},hideMenu:function(e){var t,n=this,a=i.get("menu_"+n.id);n.isMenuVisible&&(n.keyboardNav&&n.keyboardNav.destroy(),o.remove(a,"mouseover",n.mouseOverFunc),o.remove(a,"click",n.mouseClickFunc),o.remove(a,"keydown",n._keyHandler),i.hide(a),n.isMenuVisible=0,e||n.collapse(1),n.element&&n.element.hide(),(t=i.get(n.id))&&i.removeClass(t.firstChild,n.classPrefix+"ItemActive"),n.onHideMenu.dispatch(n))},add:function(e){var t,n=this;return e=n.parent(e),n.isRendered&&(t=i.get("menu_"+n.id))&&n._add(i.select("tbody",t)[0],e),e},collapse:function(e){this.parent(e),this.hideMenu(1)},remove:function(e){return i.remove(e.id),this.destroy(),this.parent(e)},destroy:function(){var e=this,t=i.get("menu_"+e.id);e.keyboardNav&&e.keyboardNav.destroy(),o.remove(t,"mouseover",e.mouseOverFunc),o.remove(i.select("a",t),"focus",e.mouseOverFunc),o.remove(t,"click",e.mouseClickFunc),o.remove(t,"keydown",e._keyHandler),e.element&&e.element.remove(),i.remove(t)},renderNode:function(){var e,t,o,r,s=this,l=s.settings;return r=i.create("div",{role:"listbox",id:"menu_"+s.id,"class":l["class"],style:"position:absolute;left:0;top:0;z-index:200000;outline:0"}),s.settings.parent&&i.setAttrib(r,"aria-parent","menu_"+s.settings.parent.id),o=i.add(r,"div",{role:"presentation",id:"menu_"+s.id+"_co","class":s.classPrefix+(l["class"]?" "+l["class"]:"")}),s.element=new a("menu_"+s.id,{blocker:1,container:l.container}),l.menu_line&&i.add(o,"span",{"class":s.classPrefix+"Line"}),e=i.add(o,"table",{role:"presentation",id:"menu_"+s.id+"_tbl",border:0,cellPadding:0,cellSpacing:0}),t=i.add(e,"tbody"),n(s.items,function(e){s._add(t,e)}),s.rendered=!0,r},_setupKeyboardNav:function(){var t,n,o=this;t=i.get("menu_"+o.id),n=i.select("a[role=option]","menu_"+o.id),n.splice(0,0,t),o.keyboardNav=new e.ui.KeyboardNavigation({root:"menu_"+o.id,items:n,onCancel:function(){o.hideMenu()},enableUpDown:!0}),t.focus()},_keyHandler:function(e){var t=this;switch(e.keyCode){case 37:t.settings.parent&&(t.hideMenu(),t.settings.parent.focus(),o.cancel(e));break;case 39:t.mouseOverFunc&&t.mouseOverFunc(e)}},_add:function(e,t){var n,o,a,r,s,l=t.settings,c=this.classPrefix;return l.separator?(a=i.add(e,"tr",{id:t.id,"class":c+"ItemSeparator"}),i.add(a,"td",{"class":c+"ItemSeparator"}),(n=a.previousSibling)&&i.addClass(n,"mceLast"),void 0):(n=a=i.add(e,"tr",{id:t.id,"class":c+"Item "+c+"ItemEnabled"}),n=r=i.add(n,l.titleItem?"th":"td"),n=o=i.add(n,"a",{id:t.id+"_aria",role:l.titleItem?"presentation":"option",href:"javascript:;",onclick:"return false;",onmousedown:"return false;"}),l.parent&&(i.setAttrib(o,"aria-haspopup","true"),i.setAttrib(o,"aria-owns","menu_"+t.id)),i.addClass(r,l["class"]),s=i.add(n,"span",{"class":"mceIcon"+(l.icon?" mce_"+l.icon:"")}),l.icon_src&&i.add(s,"img",{src:l.icon_src}),n=i.add(n,l.element||"span",{"class":"mceText",title:t.settings.title},t.settings.title),t.settings.style&&("function"==typeof t.settings.style&&(t.settings.style=t.settings.style()),i.setAttrib(n,"style",t.settings.style)),1==e.childNodes.length&&i.addClass(a,"mceFirst"),(n=a.previousSibling)&&i.hasClass(n,c+"ItemSeparator")&&i.addClass(a,"mceFirst"),t.collapse&&i.addClass(a,c+"ItemSub"),(n=a.previousSibling)&&i.removeClass(n,"mceLast"),i.addClass(a,"mceLast"),void 0)}})}(tinymce),function(e){var t=e.DOM;e.create("tinymce.ui.Button:tinymce.ui.Control",{Button:function(e,t,i){this.parent(e,t,i),this.classPrefix="mceButton"},renderHTML:function(){var e,i,n=this.classPrefix,o=this.settings;return i=t.encode(o.label||""),e='<a role="button" id="'+this.id+'" href="javascript:;" class="'+n+" "+n+"Enabled "+o["class"]+(i?" "+n+"Labeled":"")+'" onmousedown="return false;" onclick="return false;" aria-labelledby="'+this.id+'_voice" title="'+t.encode(o.title)+'">',e+=!o.image||this.editor&&this.editor.forcedHighContrastMode?'<span class="mceIcon '+o["class"]+'"></span>'+(i?'<span class="'+n+'Label">'+i+"</span>":""):'<span class="mceIcon '+o["class"]+'"><img class="mceIcon" src="'+o.image+'" alt="'+t.encode(o.title)+'" /></span>'+(i?'<span class="'+n+'Label">'+i+"</span>":""),e+='<span class="mceVoiceLabel mceIconOnly" style="display: none;" id="'+this.id+'_voice">'+o.title+"</span>",e+="</a>"},postRender:function(){var t,i=this,n=i.settings;e.isIE&&i.editor&&e.dom.Event.add(i.id,"mousedown",function(){var e=i.editor.selection.getNode().nodeName;t="IMG"===e?i.editor.selection.getBookmark():null}),e.dom.Event.add(i.id,"click",function(o){return i.isDisabled()?void 0:(e.isIE&&i.editor&&null!==t&&i.editor.selection.moveToBookmark(t),n.onclick.call(n.scope,o))}),e.dom.Event.add(i.id,"keydown",function(t){return i.isDisabled()||t.keyCode!=e.VK.SPACEBAR?void 0:(e.dom.Event.cancel(t),n.onclick.call(n.scope,t))})}})}(tinymce),function(e){var t,i=e.DOM,n=e.dom.Event,o=e.each,a=e.util.Dispatcher;e.create("tinymce.ui.ListBox:tinymce.ui.Control",{ListBox:function(t,i,n){var o=this;o.parent(t,i,n),o.items=[],o.onChange=new a(o),o.onPostRender=new a(o),o.onAdd=new a(o),o.onRenderMenu=new e.util.Dispatcher(this),o.classPrefix="mceListBox",o.marked={}},select:function(e){var i,n,a=this;return a.marked={},e==t?a.selectByIndex(-1):(n=e&&"function"==typeof e?e:function(t){return t==e},e!=a.selectedValue&&(o(a.items,function(e,t){return n(e.value)?(i=1,a.selectByIndex(t),!1):void 0}),i||a.selectByIndex(-1)),void 0)},selectByIndex:function(e){var t,n,o,a=this;a.marked={},e!=a.selectedIndex&&(t=i.get(a.id+"_text"),o=i.get(a.id+"_voiceDesc"),n=a.items[e],n?(a.selectedValue=n.value,a.selectedIndex=e,i.setHTML(t,i.encode(n.title)),i.setHTML(o,a.settings.title+" - "+n.title),i.removeClass(t,"mceTitle"),i.setAttrib(a.id,"aria-valuenow",n.title)):(i.setHTML(t,i.encode(a.settings.title)),i.setHTML(o,i.encode(a.settings.title)),i.addClass(t,"mceTitle"),a.selectedValue=a.selectedIndex=null,i.setAttrib(a.id,"aria-valuenow",a.settings.title)),t=0)},mark:function(e){this.marked[e]=!0},add:function(t,i,n){var o=this;n=n||{},n=e.extend(n,{title:t,value:i}),o.items.push(n),o.onAdd.dispatch(o,n)},getLength:function(){return this.items.length},renderHTML:function(){var e="",t=this,n=t.settings,o=t.classPrefix;return e='<span role="listbox" aria-haspopup="true" aria-labelledby="'+t.id+'_voiceDesc" aria-describedby="'+t.id+'_voiceDesc"><table role="presentation" tabindex="0" id="'+t.id+'" cellpadding="0" cellspacing="0" class="'+o+" "+o+"Enabled"+(n["class"]?" "+n["class"]:"")+'"><tbody><tr>',e+="<td>"+i.createHTML("span",{id:t.id+"_voiceDesc","class":"voiceLabel",style:"display:none;"},t.settings.title),e+=i.createHTML("a",{id:t.id+"_text",tabindex:-1,href:"javascript:;","class":"mceText",onclick:"return false;",onmousedown:"return false;"},i.encode(t.settings.title))+"</td>",e+="<td>"+i.createHTML("a",{id:t.id+"_open",tabindex:-1,href:"javascript:;","class":"mceOpen",onclick:"return false;",onmousedown:"return false;"},'<span><span style="display:none;" class="mceIconOnly" aria-hidden="true">▼</span></span>')+"</td>",e+="</tr></tbody></table></span>"},showMenu:function(){var t,a,r=this,s=i.get(this.id);if(!r.isDisabled()&&0!==r.items.length){if(r.menu&&r.menu.isMenuVisible)return r.hideMenu();r.isMenuRendered||(r.renderMenu(),r.isMenuRendered=!0),t=i.getPos(s),a=r.menu,a.settings.offset_x=t.x,a.settings.offset_y=t.y,a.settings.keyboard_focus=!e.isOpera,o(r.items,function(e){a.items[e.id]&&a.items[e.id].setSelected(0)}),o(r.items,function(e){a.items[e.id]&&r.marked[e.value]&&a.items[e.id].setSelected(1),e.value===r.selectedValue&&a.items[e.id].setSelected(1)}),a.showMenu(0,s.clientHeight),n.add(i.doc,"mousedown",r.hideMenu,r),i.addClass(r.id,r.classPrefix+"Selected")}},hideMenu:function(e){var t=this;if(t.menu&&t.menu.isMenuVisible){if(i.removeClass(t.id,t.classPrefix+"Selected"),e&&"mousedown"==e.type&&(e.target.id==t.id+"_text"||e.target.id==t.id+"_open"))return;e&&i.getParent(e.target,".mceMenu")||(i.removeClass(t.id,t.classPrefix+"Selected"),n.remove(i.doc,"mousedown",t.hideMenu,t),t.menu.hideMenu())}},renderMenu:function(){var e,n=this;e=n.settings.control_manager.createDropMenu(n.id+"_menu",{menu_line:1,"class":n.classPrefix+"Menu mceNoIcons",max_width:250,max_height:150}),e.onHideMenu.add(function(){n.hideMenu(),n.focus()}),e.add({title:n.settings.title,"class":"mceMenuItemTitle",onclick:function(){n.settings.onselect("")!==!1&&n.select("")}}),o(n.items,function(o){o.value===t?e.add({title:o.title,role:"option","class":"mceMenuItemTitle",onclick:function(){n.settings.onselect("")!==!1&&n.select("")}}):(o.id=i.uniqueId(),o.role="option",o.onclick=function(){n.settings.onselect(o.value)!==!1&&n.select(o.value)},e.add(o))}),n.onRenderMenu.dispatch(n,e),n.menu=e},postRender:function(){var t=this,o=t.classPrefix;n.add(t.id,"click",t.showMenu,t),n.add(t.id,"keydown",function(e){32==e.keyCode&&(t.showMenu(e),n.cancel(e))}),n.add(t.id,"focus",function(){t._focused||(t.keyDownHandler=n.add(t.id,"keydown",function(e){40==e.keyCode&&(t.showMenu(),n.cancel(e))}),t.keyPressHandler=n.add(t.id,"keypress",function(e){var i;13==e.keyCode&&(i=t.selectedValue,t.selectedValue=null,n.cancel(e),t.settings.onselect(i))})),t._focused=1}),n.add(t.id,"blur",function(){n.remove(t.id,"keydown",t.keyDownHandler),n.remove(t.id,"keypress",t.keyPressHandler),t._focused=0}),(e.isIE6||!i.boxModel)&&(n.add(t.id,"mouseover",function(){i.hasClass(t.id,o+"Disabled")||i.addClass(t.id,o+"Hover")}),n.add(t.id,"mouseout",function(){i.hasClass(t.id,o+"Disabled")||i.removeClass(t.id,o+"Hover")})),t.onPostRender.dispatch(t,i.get(t.id))},destroy:function(){this.parent(),n.clear(this.id+"_text"),n.clear(this.id+"_open")}})}(tinymce),function(e){{var t,i=e.DOM,n=e.dom.Event,o=e.each;e.util.Dispatcher}e.create("tinymce.ui.NativeListBox:tinymce.ui.ListBox",{NativeListBox:function(e,t){this.parent(e,t),this.classPrefix="mceNativeListBox"},setDisabled:function(e){i.get(this.id).disabled=e,this.setAriaProperty("disabled",e)},isDisabled:function(){return i.get(this.id).disabled},select:function(e){var i,n,a=this;return e==t?a.selectByIndex(-1):(n=e&&"function"==typeof e?e:function(t){return t==e},e!=a.selectedValue&&(o(a.items,function(e,t){return n(e.value)?(i=1,a.selectByIndex(t),!1):void 0}),i||a.selectByIndex(-1)),void 0)},selectByIndex:function(e){i.get(this.id).selectedIndex=e+1,this.selectedValue=this.items[e]?this.items[e].value:null},add:function(e,t,n){var o,a=this;n=n||{},n.value=t,a.isRendered()&&i.add(i.get(this.id),"option",n,e),o={title:e,value:t,attribs:n},a.items.push(o),a.onAdd.dispatch(a,o)},getLength:function(){return this.items.length},renderHTML:function(){var e,t=this;return e=i.createHTML("option",{value:""},"-- "+t.settings.title+" --"),o(t.items,function(t){e+=i.createHTML("option",{value:t.value},t.title)}),e=i.createHTML("select",{id:t.id,"class":"mceNativeListBox","aria-labelledby":t.id+"_aria"},e),e+=i.createHTML("span",{id:t.id+"_aria",style:"display: none"},t.settings.title)},postRender:function(){function e(e){var t=o.items[e.target.selectedIndex-1];t&&(t=t.value)&&(o.onChange.dispatch(o,t),o.settings.onselect&&o.settings.onselect(t))}var t,o=this,a=!0;o.rendered=!0,n.add(o.id,"change",e),n.add(o.id,"keydown",function(i){var r,s=38,l=40,c=13,u=32;return n.remove(o.id,"change",t),a=!1,r=n.add(o.id,"blur",function(){a||(a=!0,n.add(o.id,"change",e),n.remove(o.id,"blur",r))}),i.keyCode==c||i.keyCode==u?(e(i),n.cancel(i)):((i.keyCode==l||i.keyCode==s)&&i.stopImmediatePropagation(),void 0)}),o.onPostRender.dispatch(o,i.get(o.id))}})}(tinymce),function(e){{var t=e.DOM,i=e.dom.Event;e.each}e.create("tinymce.ui.MenuButton:tinymce.ui.Button",{MenuButton:function(i,n,o){this.parent(i,n,o),this.onRenderMenu=new e.util.Dispatcher(this),n.menu_container=n.menu_container||t.doc.body},showMenu:function(){var e,n,o,a=this,r=t.get(a.id);if(!a.isDisabled()){if(a.isMenuRendered||(a.renderMenu(),a.isMenuRendered=!0),a.isMenuVisible)return a.hideMenu();e=t.getPos(a.settings.menu_container),n=t.getPos(r),o=a.menu,o.settings.offset_x=n.x,o.settings.offset_y=n.y,o.settings.vp_offset_x=n.x,o.settings.vp_offset_y=n.y,o.settings.keyboard_focus=a._focused,o.showMenu(0,r.firstChild.clientHeight),i.add(t.doc,"mousedown",a.hideMenu,a),a.setState("Selected",1),a.isMenuVisible=1}},renderMenu:function(){var e,t=this;e=t.settings.control_manager.createDropMenu(t.id+"_menu",{menu_line:1,"class":this.classPrefix+"Menu",icons:t.settings.icons}),e.onHideMenu.add(function(){t.hideMenu(),t.focus()}),t.onRenderMenu.dispatch(t,e),t.menu=e},hideMenu:function(e){var n=this;e&&"mousedown"==e.type&&t.getParent(e.target,function(e){return e.id===n.id||e.id===n.id+"_open"})||(e&&t.getParent(e.target,".mceMenu")||(n.setState("Selected",0),i.remove(t.doc,"mousedown",n.hideMenu,n),n.menu&&n.menu.hideMenu()),n.isMenuVisible=0)},postRender:function(){var e=this,t=e.settings;i.add(e.id,"click",function(){e.isDisabled()||(t.onclick&&t.onclick(e.value),e.showMenu())})}})}(tinymce),function(e){{var t=e.DOM,i=e.dom.Event;e.each}e.create("tinymce.ui.SplitButton:tinymce.ui.MenuButton",{SplitButton:function(e,t,i){this.parent(e,t,i),this.classPrefix="mceSplitButton"},renderHTML:function(){var e,i,n=this,o=n.settings;return e="<tbody><tr>",i=o.image?t.createHTML("img ",{src:o.image,role:"presentation","class":"mceAction "+o["class"]}):t.createHTML("span",{"class":"mceAction "+o["class"]},""),i+=t.createHTML("span",{"class":"mceVoiceLabel mceIconOnly",id:n.id+"_voice",style:"display:none;"},o.title),e+="<td >"+t.createHTML("a",{role:"button",id:n.id+"_action",tabindex:"-1",href:"javascript:;","class":"mceAction "+o["class"],onclick:"return false;",onmousedown:"return false;",title:o.title},i)+"</td>",i=t.createHTML("span",{"class":"mceOpen "+o["class"]},'<span style="display:none;" class="mceIconOnly" aria-hidden="true">▼</span>'),e+="<td >"+t.createHTML("a",{role:"button",id:n.id+"_open",tabindex:"-1",href:"javascript:;","class":"mceOpen "+o["class"],onclick:"return false;",onmousedown:"return false;",title:o.title},i)+"</td>",e+="</tr></tbody>",e=t.createHTML("table",{role:"presentation","class":"mceSplitButton mceSplitButtonEnabled "+o["class"],cellpadding:"0",cellspacing:"0",title:o.title},e),t.createHTML("div",{id:n.id,role:"button",tabindex:"0","aria-labelledby":n.id+"_voice","aria-haspopup":"true"},e)},postRender:function(){var n,o=this,a=o.settings;a.onclick&&(n=function(e){o.isDisabled()||(a.onclick(o.value),i.cancel(e))},i.add(o.id+"_action","click",n),i.add(o.id,["click","keydown"],function(e){var t=40;32!==e.keyCode&&13!==e.keyCode&&14!==e.keyCode||e.altKey||e.ctrlKey||e.metaKey?("click"===e.type||e.keyCode===t)&&(o.showMenu(),i.cancel(e)):(n(),i.cancel(e))})),i.add(o.id+"_open","click",function(e){o.showMenu(),i.cancel(e)}),i.add([o.id,o.id+"_open"],"focus",function(){o._focused=1}),i.add([o.id,o.id+"_open"],"blur",function(){o._focused=0}),(e.isIE6||!t.boxModel)&&(i.add(o.id,"mouseover",function(){t.hasClass(o.id,"mceSplitButtonDisabled")||t.addClass(o.id,"mceSplitButtonHover")}),i.add(o.id,"mouseout",function(){t.hasClass(o.id,"mceSplitButtonDisabled")||t.removeClass(o.id,"mceSplitButtonHover")}))},destroy:function(){this.parent(),i.clear(this.id+"_action"),i.clear(this.id+"_open"),i.clear(this.id)}})}(tinymce),function(e){var t=e.DOM,i=e.dom.Event,n=e.is,o=e.each;e.create("tinymce.ui.ColorSplitButton:tinymce.ui.SplitButton",{ColorSplitButton:function(t,i,n){var o=this;o.parent(t,i,n),o.settings=i=e.extend({colors:"000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF",grid_width:8,default_color:"#888888"},o.settings),o.onShowMenu=new e.util.Dispatcher(o),o.onHideMenu=new e.util.Dispatcher(o),o.value=i.default_color},showMenu:function(){var n,o,a=this;if(!a.isDisabled()){if(a.isMenuRendered||(a.renderMenu(),a.isMenuRendered=!0),a.isMenuVisible)return a.hideMenu();n=t.get(a.id),t.show(a.id+"_menu"),t.addClass(n,"mceSplitButtonSelected"),o=t.getPos(n),t.setStyles(a.id+"_menu",{left:o.x,top:o.y+n.firstChild.clientHeight,zIndex:2e5}),n=0,i.add(t.doc,"mousedown",a.hideMenu,a),a.onShowMenu.dispatch(a),a._focused&&(a._keyHandler=i.add(a.id+"_menu","keydown",function(e){27==e.keyCode&&a.hideMenu()}),t.select("a",a.id+"_menu")[0].focus()),a.keyboardNav=new e.ui.KeyboardNavigation({root:a.id+"_menu",items:t.select("a",a.id+"_menu"),onCancel:function(){a.hideMenu(),a.focus()}}),a.keyboardNav.focus(),a.isMenuVisible=1}},hideMenu:function(e){var n=this;if(n.isMenuVisible){if(e&&"mousedown"==e.type&&t.getParent(e.target,function(e){return e.id===n.id+"_open"}))return;e&&t.getParent(e.target,".mceSplitButtonMenu")||(t.removeClass(n.id,"mceSplitButtonSelected"),i.remove(t.doc,"mousedown",n.hideMenu,n),i.remove(n.id+"_menu","keydown",n._keyHandler),t.hide(n.id+"_menu")),n.isMenuVisible=0,n.onHideMenu.dispatch(),n.keyboardNav.destroy()}},renderMenu:function(){var a,r,s,l,c,u,d=this,h=0,p=d.settings;return c=t.add(p.menu_container,"div",{role:"listbox",id:d.id+"_menu","class":p.menu_class+" "+p["class"],style:"position:absolute;left:0;top:-1000px;"}),a=t.add(c,"div",{"class":p["class"]+" mceSplitButtonMenu"}),t.add(a,"span",{"class":"mceMenuLine"}),r=t.add(a,"table",{role:"presentation","class":"mceColorSplitMenu"}),s=t.add(r,"tbody"),h=0,o(n(p.colors,"array")?p.colors:p.colors.split(","),function(i){i=i.replace(/^#/,""),h--||(l=t.add(s,"tr"),h=p.grid_width-1),r=t.add(l,"td");var n={href:"javascript:;",style:{backgroundColor:"#"+i},title:d.editor.getLang("colors."+i,i),"data-mce-color":"#"+i};e.isIE||(n.role="option"),r=t.add(r,"a",n),d.editor.forcedHighContrastMode&&(r=t.add(r,"canvas",{width:16,height:16,"aria-hidden":"true"}),r.getContext&&(u=r.getContext("2d"))?(u.fillStyle="#"+i,u.fillRect(0,0,16,16)):t.remove(r))}),p.more_colors_func&&(r=t.add(s,"tr"),r=t.add(r,"td",{colspan:p.grid_width,"class":"mceMoreColors"}),r=t.add(r,"a",{role:"option",id:d.id+"_more",href:"javascript:;",onclick:"return false;","class":"mceMoreColors"},p.more_colors_title),i.add(r,"click",function(e){return p.more_colors_func.call(p.more_colors_scope||this),i.cancel(e)})),t.addClass(a,"mceColorSplitMenu"),i.add(d.id+"_menu","mousedown",function(e){return i.cancel(e)}),i.add(d.id+"_menu","click",function(e){var i;return e=t.getParent(e.target,"a",s),e&&"a"==e.nodeName.toLowerCase()&&(i=e.getAttribute("data-mce-color"))&&d.setColor(i),!1}),c},setColor:function(e){this.displayColor(e),this.hideMenu(),this.settings.onselect(e)},displayColor:function(e){var i=this;t.setStyle(i.id+"_preview","backgroundColor",e),i.value=e},postRender:function(){var e=this,i=e.id;e.parent(),t.add(i+"_action","div",{id:i+"_preview","class":"mceColorPreview"}),t.setStyle(e.id+"_preview","backgroundColor",e.value)},destroy:function(){var e=this;e.parent(),i.clear(e.id+"_menu"),i.clear(e.id+"_more"),t.remove(e.id+"_menu"),e.keyboardNav&&e.keyboardNav.destroy()}})}(tinymce),function(e){var t=e.DOM,i=e.each,n=e.dom.Event;e.create("tinymce.ui.ToolbarGroup:tinymce.ui.Container",{renderHTML:function(){var i=this,n=[],o=i.controls,a=e.each,r=i.settings;return n.push('<div id="'+i.id+'" role="group" aria-labelledby="'+i.id+'_voice">'),n.push("<span role='application'>"),n.push('<span id="'+i.id+'_voice" class="mceVoiceLabel" style="display:none;">'+t.encode(r.name)+"</span>"),a(o,function(e){n.push(e.renderHTML())}),n.push("</span>"),n.push("</div>"),n.join("")},focus:function(){var e=this;t.get(e.id).focus()},postRender:function(){var n=this,o=[];i(n.controls,function(e){i(e.controls,function(e){e.id&&o.push(e)})}),n.keyNav=new e.ui.KeyboardNavigation({root:n.id,items:o,onCancel:function(){e.isWebKit&&t.get(n.editor.id+"_ifr").focus(),n.editor.focus()},excludeFromTabOrder:!n.settings.tab_focus_toolbar})},destroy:function(){var e=this;e.parent(),e.keyNav.destroy(),n.clear(e.id)}})}(tinymce),function(e){{var t=e.DOM;e.each}e.create("tinymce.ui.Toolbar:tinymce.ui.Container",{renderHTML:function(){var e,i,n,o,a,r,s=this,l="",c=s.settings;for(r=s.controls,n=0;n<r.length;n++)i=r[n],o=r[n-1],a=r[n+1],0===n&&(e="mceToolbarStart",i.Button?e+=" mceToolbarStartButton":i.SplitButton?e+=" mceToolbarStartSplitButton":i.ListBox&&(e+=" mceToolbarStartListBox"),l+=t.createHTML("td",{"class":e},t.createHTML("span",null,"<!-- IE -->"))),o&&i.ListBox&&(o.Button||o.SplitButton)&&(l+=t.createHTML("td",{"class":"mceToolbarEnd"},t.createHTML("span",null,"<!-- IE -->"))),l+=t.stdMode?'<td style="position: relative">'+i.renderHTML()+"</td>":"<td>"+i.renderHTML()+"</td>",a&&i.ListBox&&(a.Button||a.SplitButton)&&(l+=t.createHTML("td",{"class":"mceToolbarStart"},t.createHTML("span",null,"<!-- IE -->")));return e="mceToolbarEnd",i.Button?e+=" mceToolbarEndButton":i.SplitButton?e+=" mceToolbarEndSplitButton":i.ListBox&&(e+=" mceToolbarEndListBox"),l+=t.createHTML("td",{"class":e},t.createHTML("span",null,"<!-- IE -->")),t.createHTML("table",{id:s.id,"class":"mceToolbar"+(c["class"]?" "+c["class"]:""),cellpadding:"0",cellspacing:"0",align:s.settings.align||"",role:"presentation",tabindex:"-1"},"<tbody><tr>"+l+"</tr></tbody>")}})}(tinymce),function(e){{var t=e.util.Dispatcher;e.each}e.create("tinymce.AddOnManager",{AddOnManager:function(){var e=this;e.items=[],e.urls={},e.lookup={},e.onAdd=new t(e)},get:function(e){return this.lookup[e]?this.lookup[e].instance:void 0},dependencies:function(e){var t;return this.lookup[e]&&(t=this.lookup[e].dependencies),t||[]},requireLangPack:function(t){var i=e.settings;i&&i.language&&i.language_load!==!1&&e.ScriptLoader.add(this.urls[t]+"/langs/"+i.language+".js")
80
80
  },add:function(e,t,i){return this.items.push(t),this.lookup[e]={instance:t,dependencies:i},this.onAdd.dispatch(this,e,t),t},createUrl:function(e,t){return"object"==typeof t?t:{prefix:e.prefix,resource:t,suffix:e.suffix}},addComponents:function(t,i){var n=this.urls[t];e.each(i,function(t){e.ScriptLoader.add(n+"/"+t)})},load:function(t,i,n,o){function a(){var a=r.dependencies(t);e.each(a,function(e){var t=r.createUrl(i,e);r.load(t.resource,t,void 0,void 0)}),n&&(o?n.call(o):n.call(e.ScriptLoader))}var r=this,s=i;r.urls[t]||("object"==typeof i&&(s=i.prefix+i.resource+i.suffix),0!==s.indexOf("/")&&-1==s.indexOf("://")&&(s=e.baseURL+"/"+s),r.urls[t]=s.substring(0,s.lastIndexOf("/")),r.lookup[t]?a():e.ScriptLoader.add(s,a,o))}}),e.PluginManager=new e.AddOnManager,e.ThemeManager=new e.AddOnManager}(tinymce),function(e){var t,i=e.each,n=e.extend,o=e.DOM,a=e.dom.Event,r=(e.ThemeManager,e.PluginManager,e.explode),s=e.util.Dispatcher,l=0;e.documentBaseURL=window.location.href.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,""),/[\/\\]$/.test(e.documentBaseURL)||(e.documentBaseURL+="/"),e.baseURL=new e.util.URI(e.documentBaseURL).toAbsolute(e.baseURL),e.baseURI=new e.util.URI(e.baseURL),e.onBeforeUnload=new s(e),a.add(window,"beforeunload",function(t){e.onBeforeUnload.dispatch(e,t)}),e.onAddEditor=new s(e),e.onRemoveEditor=new s(e),e.EditorManager=n(e,{editors:[],i18n:{},activeEditor:null,init:function(t){function n(e){var t=e.id;return t||(t=e.name,t=t&&!o.get(t)?e.name:o.uniqueId(),e.setAttribute("id",t)),t}function s(t,i,n){var o=t[i];if(o)return e.is(o,"string")&&(n=o.replace(/\.\w+$/,""),n=n?e.resolve(n):0,o=e.resolve(o)),o.apply(n||this,Array.prototype.slice.call(arguments,2))}function c(e,t){return t.constructor===RegExp?t.test(e.className):o.hasClass(e,t)}var u,d=this,h=(e.ScriptLoader,[]);d.settings=t,a.bind(window,"ready",function(){var a,d;switch(s(t,"onpageload"),t.mode){case"exact":a=t.elements||"",a.length>0&&i(r(a),function(n){o.get(n)?(u=new e.Editor(n,t),h.push(u),u.render(1)):i(document.forms,function(a){i(a.elements,function(i){i.name===n&&(n="mce_editor_"+l++,o.setAttrib(i,"id",n),u=new e.Editor(n,t),h.push(u),u.render(1))})})});break;case"textareas":case"specific_textareas":i(o.select("textarea"),function(i){t.editor_deselector&&c(i,t.editor_deselector)||(!t.editor_selector||c(i,t.editor_selector))&&(u=new e.Editor(n(i),t),h.push(u),u.render(1))});break;default:t.types?i(t.types,function(a){i(o.select(a.selector),function(i){var o=new e.Editor(n(i),e.extend({},t,a));h.push(o),o.render(1)})}):t.selector&&i(o.select(t.selector),function(i){var o=new e.Editor(n(i),t);h.push(o),o.render(1)})}t.oninit&&(a=d=0,i(h,function(e){d++,e.initialized?a++:e.onInit.add(function(){a++,a==d&&s(t,"oninit")}),a==d&&s(t,"oninit")}))})},get:function(e){return e===t?this.editors:this.editors.hasOwnProperty(e)?this.editors[e]:t},getInstanceById:function(e){return this.get(e)},add:function(e){var t=this,i=t.editors;return i[e.id]=e,i.push(e),t._setActive(e),t.onAddEditor.dispatch(t,e),e},remove:function(e){var t,i=this,n=i.editors;if(!n[e.id])return null;for(delete n[e.id],t=0;t<n.length;t++)if(n[t]==e){n.splice(t,1);break}return i.activeEditor==e&&i._setActive(n[0]),e.destroy(),i.onRemoveEditor.dispatch(i,e),e},execCommand:function(t,i,n){function o(){s.destroy(),a.detachEvent("onunload",o),a=a.tinyMCE=a.tinymce=null}var a,r=this,s=r.get(n);switch(t){case"mceFocus":return s.focus(),!0;case"mceAddEditor":case"mceAddControl":return r.get(n)||new e.Editor(n,r.settings).render(),!0;case"mceAddFrameControl":return a=n.window,a.tinyMCE=tinyMCE,a.tinymce=e,e.DOM.doc=a.document,e.DOM.win=a,s=new e.Editor(n.element_id,n),s.render(),e.isIE&&!e.isIE11&&a.attachEvent("onunload",o),n.page_window=null,!0;case"mceRemoveEditor":case"mceRemoveControl":return s&&s.remove(),!0;case"mceToggleEditor":return s?(s.isHidden()?s.show():s.hide(),!0):(r.execCommand("mceAddControl",0,n),!0)}return r.activeEditor?r.activeEditor.execCommand(t,i,n):!1},execInstanceCommand:function(e,t,i,n){var o=this.get(e);return o?o.execCommand(t,i,n):!1},triggerSave:function(){i(this.editors,function(e){e.save()})},addI18n:function(t,n){var o=this.i18n;e.is(t,"string")?i(n,function(e,i){o[t+"."+i]=e}):i(t,function(e,t){i(e,function(e,n){i(e,function(e,i){"common"===n?o[t+"."+i]=e:o[t+"."+n+"."+i]=e})})})},_setActive:function(e){this.selectedInstance=this.activeEditor=e}})}(tinymce),function(e){var t=e.DOM,i=e.dom.Event,n=e.extend,o=e.each,a=e.isGecko,r=e.isIE,s=(e.isWebKit,e.is),l=e.ThemeManager,c=e.PluginManager,u=e.explode;e.create("tinymce.Editor",{Editor:function(t,i){var o=this,a=!0;o.settings=i=n({id:t,language:"en",theme:"advanced",skin:"default",delta_width:0,delta_height:0,popup_css:"",plugins:"",document_base_url:e.documentBaseURL,add_form_submit_trigger:a,submit_patch:a,add_unload_trigger:a,convert_urls:a,relative_urls:a,remove_script_host:a,table_inline_editing:!1,object_resizing:a,accessibility_focus:a,doctype:e.isIE6?'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">':"<!DOCTYPE>",visual:a,font_size_style_values:"xx-small,x-small,small,medium,large,x-large,xx-large",font_size_legacy_values:"xx-small,small,medium,large,x-large,xx-large,300%",apply_source_formatting:a,directionality:"ltr",forced_root_block:"p",hidden_input:a,padd_empty_editor:a,render_ui:a,indentation:"30px",fix_table_elements:a,inline_styles:a,convert_fonts_to_spans:a,indent:"simple",indent_before:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,li,area,table,thead,tfoot,tbody,tr,section,article,hgroup,aside,figure,option,optgroup,datalist",indent_after:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,li,area,table,thead,tfoot,tbody,tr,section,article,hgroup,aside,figure,option,optgroup,datalist",validate:a,entity_encoding:"named",url_converter:o.convertURL,url_converter_scope:o,ie7_compat:a},i),o.id=o.editorId=t,o.isNotDirty=!1,o.plugins={},o.documentBaseURI=new e.util.URI(i.document_base_url||e.documentBaseURL,{base_uri:tinyMCE.baseURI}),o.baseURI=e.baseURI,o.contentCSS=[],o.contentStyles=[],o.setupEvents(),o.execCommands={},o.queryStateCommands={},o.queryValueCommands={},o.execCallback("setup",o)},render:function(){function n(){r.language&&r.language_load!==!1&&d.add(e.baseURL+"/langs/"+r.language+".js"),r.theme&&"function"!=typeof r.theme&&"-"!=r.theme.charAt(0)&&!l.urls[r.theme]&&l.load(r.theme,"themes/"+r.theme+"/editor_template"+e.suffix+".js"),o(u(r.plugins),function(t){if(t&&!c.urls[t])if("-"==t.charAt(0)){t=t.substr(1,t.length);var i=c.dependencies(t);o(i,function(t){var i={prefix:"plugins/",resource:t,suffix:"/editor_plugin"+e.suffix+".js"};t=c.createUrl(i,t),c.load(t.resource,t)})}else{if("safari"==t)return;c.load(t,{prefix:"plugins/",resource:t,suffix:"/editor_plugin"+e.suffix+".js"})}}),d.loadQueue(function(){a.removed||a.init()})}var a=this,r=a.settings,s=a.id,d=e.ScriptLoader;return i.domLoaded?(tinyMCE.settings=r,a.getElement()&&(!e.isIDevice||e.isIOS5)&&(!/TEXTAREA|INPUT/i.test(a.getElement().nodeName)&&r.hidden_input&&t.getParent(s,"form")&&t.insertAfter(t.create("input",{type:"hidden",name:s}),s),r.content_editable||(a.orgVisibility=a.getElement().style.visibility,a.getElement().style.visibility="hidden"),e.WindowManager&&(a.windowManager=new e.WindowManager(a)),"xml"==r.encoding&&a.onGetContent.add(function(e,i){i.save&&(i.content=t.encode(i.content))}),r.add_form_submit_trigger&&a.onSubmit.addToTop(function(){a.initialized&&(a.save(),a.isNotDirty=1)}),r.add_unload_trigger&&(a._beforeUnload=tinyMCE.onBeforeUnload.add(function(){!a.initialized||a.destroyed||a.isHidden()||a.save({format:"raw",no_events:!0})})),e.addUnload(a.destroy,a),r.submit_patch&&a.onBeforeRenderUI.add(function(){var t=a.getElement().form;t&&(t._mceOldSubmit||(t.submit.nodeType||t.submit.length||(a.formElement=t,t._mceOldSubmit=t.submit,t.submit=function(){return e.triggerSave(),a.isNotDirty=1,a.formElement._mceOldSubmit(a.formElement)}),t=null))}),n()),void 0):(i.add(window,"ready",function(){a.render()}),void 0)},init:function(){function i(t){var n,a=c.get(t),r=c.urls[t]||e.documentBaseURL.replace(/\/$/,"");a&&-1===e.inArray(w,t)&&(o(c.dependencies(t),function(e){i(e)}),n=new a(b,r),b.plugins[t]=n,n.init&&(n.init(b,r),w.push(t)))}var n,a,s,d,h,p,f,m,g,v,b=this,y=b.settings,_=b.getElement(),w=[];if(e.add(b),y.aria_label=y.aria_label||t.getAttrib(_,"aria-label",b.getLang("aria.rich_text_area")),y.theme&&("function"!=typeof y.theme?(y.theme=y.theme.replace(/-/,""),h=l.get(y.theme),b.theme=new h,b.theme.init&&b.theme.init(b,l.urls[y.theme]||e.documentBaseURL.replace(/\/$/,""))):b.theme=y.theme),o(u(y.plugins.replace(/\-/g,"")),i),y.popup_css!==!1&&(y.popup_css=y.popup_css?b.documentBaseURI.toAbsolute(y.popup_css):b.baseURI.toAbsolute("themes/"+y.theme+"/skins/"+y.skin+"/dialog.css")),y.popup_css_add&&(y.popup_css+=","+b.documentBaseURI.toAbsolute(y.popup_css_add)),b.controlManager=new e.ControlManager(b),b.onBeforeRenderUI.dispatch(b,b.controlManager),y.render_ui&&b.theme&&(b.orgDisplay=_.style.display,"function"!=typeof y.theme?(a=y.width||_.style.width||_.offsetWidth,s=y.height||_.style.height||_.offsetHeight,d=y.min_height||100,g=/^[0-9\.]+(|px)$/i,g.test(""+a)&&(a=Math.max(parseInt(a,10)+(h.deltaWidth||0),100)),g.test(""+s)&&(s=Math.max(parseInt(s,10)+(h.deltaHeight||0),d)),h=b.theme.renderUI({targetNode:_,width:a,height:s,deltaWidth:y.delta_width,deltaHeight:y.delta_height}),t.setStyles(h.sizeContainer||h.editorContainer,{width:a,height:s}),s=(h.iframeHeight||s)+("number"==typeof s?h.deltaHeight||0:""),d>s&&(s=d)):(h=y.theme(b,_),h.editorContainer.nodeType&&(h.editorContainer=h.editorContainer.id=h.editorContainer.id||b.id+"_parent"),h.iframeContainer.nodeType&&(h.iframeContainer=h.iframeContainer.id=h.iframeContainer.id||b.id+"_iframecontainer"),s=h.iframeHeight||_.offsetHeight,r&&(b.onInit.add(function(e){e.dom.bind(e.getBody(),"beforedeactivate keydown keyup",function(){e.bookmark=e.selection.getBookmark(1)})}),b.onNodeChange.add(function(e){document.activeElement.id==e.id+"_ifr"&&(e.bookmark=e.selection.getBookmark(1))}))),b.editorContainer=h.editorContainer),y.content_css&&o(u(y.content_css),function(e){b.contentCSS.push(b.documentBaseURI.toAbsolute(e))}),y.content_style&&b.contentStyles.push(y.content_style),y.content_editable)return _=n=h=null,b.initContentBody();for(document.domain&&location.hostname!=document.domain&&(e.relaxedDomain=document.domain),b.iframeHTML=y.doctype+'<html><head xmlns="http://www.w3.org/1999/xhtml">',y.document_base_url!=e.documentBaseURL&&(b.iframeHTML+='<base href="'+b.documentBaseURI.getURI()+'" />'),e.isIE8&&(b.iframeHTML+=y.ie7_compat?'<meta http-equiv="X-UA-Compatible" content="IE=7" />':'<meta http-equiv="X-UA-Compatible" content="IE=edge" />'),b.iframeHTML+='<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />',v=0;v<b.contentCSS.length;v++)b.iframeHTML+='<link type="text/css" rel="stylesheet" href="'+b.contentCSS[v]+'" />';b.contentCSS=[],f=y.body_id||"tinymce",-1!=f.indexOf("=")&&(f=b.getParam("body_id","","hash"),f=f[b.id]||f),m=y.body_class||"",-1!=m.indexOf("=")&&(m=b.getParam("body_class","","hash"),m=m[b.id]||""),b.iframeHTML+='</head><body id="'+f+'" class="mceContentBody '+m+'" onload="window.parent.tinyMCE.get(\''+b.id+"').onLoad.dispatch();\"><br></body></html>",e.relaxedDomain&&(r||e.isOpera&&parseFloat(opera.version())<11)&&(p='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinyMCE.get("'+b.id+'");document.write(ed.iframeHTML);document.close();ed.initContentBody();})()'),n=t.add(h.iframeContainer,"iframe",{id:b.id+"_ifr",src:p||'javascript:""',frameBorder:"0",allowTransparency:"true",title:y.aria_label,style:{width:"100%",height:s,display:"block"}}),b.contentAreaContainer=h.iframeContainer,h.editorContainer&&(t.get(h.editorContainer).style.display=b.orgDisplay),_.style.visibility=b.orgVisibility,t.get(b.id).style.display="none",t.setAttrib(b.id,"aria-hidden",!0),e.relaxedDomain&&p||b.initContentBody(),_=n=h=null},initContentBody:function(){var i,n,a=this,s=a.settings,l=t.get(a.id),c=a.getDoc();r&&e.relaxedDomain||s.content_editable||(c.open(),c.write(a.iframeHTML),c.close(),e.relaxedDomain&&(c.domain=e.relaxedDomain)),s.content_editable&&(t.addClass(l,"mceContentBody"),a.contentDocument=c=s.content_document||document,a.contentWindow=s.content_window||window,a.bodyElement=l,s.content_document=s.content_window=null),i=a.getBody(),i.disabled=!0,s.readonly||(i.contentEditable=a.getParam("content_editable_state",!0)),i.disabled=!1,a.schema=new e.html.Schema(s),a.dom=new e.dom.DOMUtils(c,{keep_values:!0,url_converter:a.convertURL,url_converter_scope:a,hex_colors:s.force_hex_style_colors,class_filter:s.class_filter,update_styles:!0,root_element:s.content_editable?a.id:null,schema:a.schema}),a.parser=new e.html.DomParser(s,a.schema),a.parser.addAttributeFilter("src,href,style",function(e,t){for(var i,n,o,r=e.length,s=a.dom;r--;)i=e[r],n=i.attr(t),o="data-mce-"+t,i.attributes.map[o]||("style"===t?i.attr(o,s.serializeStyle(s.parseStyle(n),i.name)):i.attr(o,a.convertURL(n,t,i.name)))}),a.parser.addNodeFilter("script",function(e){for(var t,i=e.length;i--;)t=e[i],t.attr("type","mce-"+(t.attr("type")||"text/javascript"))}),a.parser.addNodeFilter("#cdata",function(e){for(var t,i=e.length;i--;)t=e[i],t.type=8,t.name="#comment",t.value="[CDATA["+t.value+"]]"}),a.parser.addNodeFilter("p,h1,h2,h3,h4,h5,h6,div",function(t){for(var i,n=t.length,o=a.schema.getNonEmptyElements();n--;)i=t[n],i.isEmpty(o)&&(i.empty().append(new e.html.Node("br",1)).shortEnded=!0)}),a.serializer=new e.dom.Serializer(s,a.dom,a.schema),a.selection=new e.dom.Selection(a.dom,a.getWin(),a.serializer,a),a.formatter=new e.Formatter(a),a.undoManager=new e.UndoManager(a),a.forceBlocks=new e.ForceBlocks(a),a.enterKey=new e.EnterKey(a),a.editorCommands=new e.EditorCommands(a),a.onExecCommand.add(function(e,t){/^(FontName|FontSize)$/.test(t)||a.nodeChanged()}),a.serializer.onPreProcess.add(function(e,t){return a.onPreProcess.dispatch(a,t,e)}),a.serializer.onPostProcess.add(function(e,t){return a.onPostProcess.dispatch(a,t,e)}),a.onPreInit.dispatch(a),s.browser_spellcheck||s.gecko_spellcheck||(c.body.spellcheck=!1),s.readonly||a.bindNativeEvents(),a.controlManager.onPostRender.dispatch(a,a.controlManager),a.onPostRender.dispatch(a),a.quirks=e.util.Quirks(a),s.directionality&&(i.dir=s.directionality),s.nowrap&&(i.style.whiteSpace="nowrap"),s.protect&&a.onBeforeSetContent.add(function(e,t){o(s.protect,function(e){t.content=t.content.replace(e,function(e){return"<!--mce:protected "+escape(e)+"-->"})})}),a.onSetContent.add(function(){a.addVisual(a.getBody())}),s.padd_empty_editor&&a.onPostProcess.add(function(e,t){t.content=t.content.replace(/^(<p[^>]*>(&nbsp;|&#160;|\s|\u00a0|)<\/p>[\r\n]*|<br \/>[\r\n]*)$/,"")}),a.load({initial:!0,format:"html"}),a.startContent=a.getContent({format:"raw"}),a.initialized=!0,a.onInit.dispatch(a),a.execCallback("setupcontent_callback",a.id,i,c),a.execCallback("init_instance_callback",a),a.focus(!0),a.nodeChanged({initial:!0}),a.contentStyles.length>0&&(n="",o(a.contentStyles,function(e){n+=e+"\r\n"}),a.dom.addStyle(n)),o(a.contentCSS,function(e){a.dom.loadCSS(e)}),s.auto_focus&&setTimeout(function(){var t=e.get(s.auto_focus);t.selection.select(t.getBody(),1),t.selection.collapse(1),t.getBody().focus(),t.getWin().focus()},100),l=c=i=null},focus:function(t){var i,n,o,a,r=this,s=r.selection,l=r.settings.content_editable,c=r.getDoc();t||(r.bookmark&&(s.moveToBookmark(r.bookmark),r.bookmark=null),n=s.getRng(),n.item&&(o=n.item(0)),r._refreshContentEditable(),l||r.getWin().focus(),(e.isGecko||l)&&(a=r.getBody(),a.setActive&&!e.isIE11?a.setActive():a.focus(),l&&s.normalize()),o&&o.ownerDocument==c&&(n=c.body.createControlRange(),n.addElement(o),n.select())),e.activeEditor!=r&&(null!=(i=e.activeEditor)&&i.onDeactivate.dispatch(i,r),r.onActivate.dispatch(r,i)),e._setActive(r)},execCallback:function(t){var i,n=this,o=n.settings[t];if(o)return n.callbackLookup&&(i=n.callbackLookup[t])&&(o=i.func,i=i.scope),s(o,"string")&&(i=o.replace(/\.\w+$/,""),i=i?e.resolve(i):0,o=e.resolve(o),n.callbackLookup=n.callbackLookup||{},n.callbackLookup[t]={func:o,scope:i}),o.apply(i||n,Array.prototype.slice.call(arguments,1))},translate:function(t){var i=this.settings.language||"en",n=e.i18n;return t?n[i+"."+t]||t.replace(/\{\#([^\}]+)\}/g,function(e,t){return n[i+"."+t]||"{#"+t+"}"}):""},getLang:function(t,i){return e.i18n[(this.settings.language||"en")+"."+t]||(s(i)?i:"{#"+t+"}")},getParam:function(t,i,n){var a,r=e.trim,l=s(this.settings[t])?this.settings[t]:i;return"hash"===n?(a={},s(l,"string")?o(l.indexOf("=")>0?l.split(/[;,](?![^=;,]*(?:[;,]|$))/):l.split(","),function(e){e=e.split("="),a[r(e[0])]=e.length>1?r(e[1]):r(e)}):a=l,a):l},nodeChanged:function(e){var t,i=this,n=i.selection;i.initialized&&(e=e||{},t=n.getStart()||i.getBody(),t=r&&t.ownerDocument!=i.getDoc()?i.getBody():t,e.parents=[],i.dom.getParent(t,function(t){return"BODY"==t.nodeName?!0:(e.parents.push(t),void 0)}),i.onNodeChange.dispatch(i,e?e.controlManager||i.controlManager:i.controlManager,t,n.isCollapsed(),e))},addButton:function(e,t){var i=this;i.buttons=i.buttons||{},i.buttons[e]=t},addCommand:function(e,t,i){this.execCommands[e]={func:t,scope:i||this}},addQueryStateHandler:function(e,t,i){this.queryStateCommands[e]={func:t,scope:i||this}},addQueryValueHandler:function(e,t,i){this.queryValueCommands[e]={func:t,scope:i||this}},addShortcut:function(e,t,i,n){var a,r=this;return r.settings.custom_shortcuts===!1?!1:(r.shortcuts=r.shortcuts||{},s(i,"string")&&(a=i,i=function(){r.execCommand(a,!1,null)}),s(i,"object")&&(a=i,i=function(){r.execCommand(a[0],a[1],a[2])}),o(u(e),function(e){var a={func:i,scope:n||this,desc:r.translate(t),alt:!1,ctrl:!1,shift:!1};o(u(e,"+"),function(e){switch(e){case"alt":case"ctrl":case"shift":a[e]=!0;break;default:a.charCode=e.charCodeAt(0),a.keyCode=e.toUpperCase().charCodeAt(0)}}),r.shortcuts[(a.ctrl?"ctrl":"")+","+(a.alt?"alt":"")+","+(a.shift?"shift":"")+","+a.keyCode]=a}),!0)},execCommand:function(e,t,i,a){var r,s,l=this,c=0;return/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(e)||a&&a.skip_focus||l.focus(),a=n({},a),l.onBeforeExecCommand.dispatch(l,e,t,i,a),a.terminate?!1:l.execCallback("execcommand_callback",l.id,l.selection.getNode(),e,t,i)?(l.onExecCommand.dispatch(l,e,t,i,a),!0):(r=l.execCommands[e])&&(s=r.func.call(r.scope,t,i),s!==!0)?(l.onExecCommand.dispatch(l,e,t,i,a),s):(o(l.plugins,function(n){return n.execCommand&&n.execCommand(e,t,i)?(l.onExecCommand.dispatch(l,e,t,i,a),c=1,!1):void 0}),c?!0:l.theme&&l.theme.execCommand&&l.theme.execCommand(e,t,i)?(l.onExecCommand.dispatch(l,e,t,i,a),!0):l.editorCommands.execCommand(e,t,i)?(l.onExecCommand.dispatch(l,e,t,i,a),!0):(l.getDoc().execCommand(e,t,i),l.onExecCommand.dispatch(l,e,t,i,a),void 0))},queryCommandState:function(e){var t,i,n=this;if(!n._isHidden()){if((t=n.queryStateCommands[e])&&(i=t.func.call(t.scope),i!==!0))return i;if(t=n.editorCommands.queryCommandState(e),-1!==t)return t;try{return this.getDoc().queryCommandState(e)}catch(o){}}},queryCommandValue:function(e){var t,i,n=this;if(!n._isHidden()){if((t=n.queryValueCommands[e])&&(i=t.func.call(t.scope),i!==!0))return i;if(t=n.editorCommands.queryCommandValue(e),s(t))return t;try{return this.getDoc().queryCommandValue(e)}catch(o){}}},show:function(){var e=this;t.show(e.getContainer()),t.hide(e.id),e.load()},hide:function(){var e=this,i=e.getDoc();r&&i&&i.execCommand("SelectAll"),e.save(),t.hide(e.getContainer()),t.setStyle(e.id,"display",e.orgDisplay)},isHidden:function(){return!t.isHidden(this.id)},setProgressState:function(e,t,i){return this.onSetProgressState.dispatch(this,e,t,i),e},load:function(e){var t,i=this,n=i.getElement();return n?(e=e||{},e.load=!0,t=i.setContent(s(n.value)?n.value:n.innerHTML,e),e.element=n,e.no_events||i.onLoadContent.dispatch(i,e),e.element=n=null,t):void 0},save:function(e){var i,n,a=this,r=a.getElement();if(r&&a.initialized)return e=e||{},e.save=!0,e.element=r,i=e.content=a.getContent(e),e.no_events||a.onSaveContent.dispatch(a,e),i=e.content,/TEXTAREA|INPUT/i.test(r.nodeName)?r.value=i:(r.innerHTML=i,(n=t.getParent(a.id,"form"))&&o(n.elements,function(e){return e.name==a.id?(e.value=i,!1):void 0})),e.element=r=null,i},setContent:function(t,i){var n,o=this,a=o.getBody();return i=i||{},i.format=i.format||"html",i.set=!0,i.content=t,i.no_events||o.onBeforeSetContent.dispatch(o,i),t=i.content,e.isIE||0!==t.length&&!/^\s+$/.test(t)?("raw"!==i.format&&(t=new e.html.Serializer({},o.schema).serialize(o.parser.parse(t))),i.content=e.trim(t),o.dom.setHTML(a,i.content),i.no_events||o.onSetContent.dispatch(o,i),o.settings.content_editable&&document.activeElement!==o.getBody()||o.selection.normalize(),i.content):(n=o.settings.forced_root_block,t=n?"<"+n+'><br data-mce-bogus="1"></'+n+">":'<br data-mce-bogus="1">',a.innerHTML=t,o.selection.select(a,!0),o.selection.collapse(!0),void 0)},getContent:function(t){var i,n=this,o=n.getBody();return t=t||{},t.format=t.format||"html",t.get=!0,t.getInner=!0,t.no_events||n.onBeforeGetContent.dispatch(n,t),i="raw"==t.format?o.innerHTML:"text"==t.format?o.innerText||o.textContent:n.serializer.serialize(o,t),t.content="text"!=t.format?e.trim(i):i,t.no_events||n.onGetContent.dispatch(n,t),t.content},isDirty:function(){var t=this;return e.trim(t.startContent)!=e.trim(t.getContent({format:"raw",no_events:1}))&&!t.isNotDirty},getContainer:function(){var e=this;return e.container||(e.container=t.get(e.editorContainer||e.id+"_parent")),e.container},getContentAreaContainer:function(){return this.contentAreaContainer},getElement:function(){return t.get(this.settings.content_element||this.id)},getWin:function(){var e,i=this;return i.contentWindow||(e=t.get(i.id+"_ifr"),e&&(i.contentWindow=e.contentWindow)),i.contentWindow},getDoc:function(){var e,t=this;return t.contentDocument||(e=t.getWin(),e&&(t.contentDocument=e.document)),t.contentDocument},getBody:function(){return this.bodyElement||this.getDoc().body},convertURL:function(e,t,i){var n=this,o=n.settings;return o.urlconverter_callback?n.execCallback("urlconverter_callback",e,i,!0,t):!o.convert_urls||i&&"LINK"==i.nodeName||0===e.indexOf("file:")?e:o.relative_urls?n.documentBaseURI.toRelative(e):e=n.documentBaseURI.toAbsolute(e,o.remove_script_host)},addVisual:function(e){var t,i=this,n=i.settings,a=i.dom;e=e||i.getBody(),s(i.hasVisual)||(i.hasVisual=n.visual),o(a.select("table,a",e),function(e){var o;switch(e.nodeName){case"TABLE":return t=n.visual_table_class||"mceItemTable",o=a.getAttrib(e,"border"),o&&"0"!=o||(i.hasVisual?a.addClass(e,t):a.removeClass(e,t)),void 0;case"A":return a.getAttrib(e,"href",!1)||(o=a.getAttrib(e,"name")||e.id,t="mceItemAnchor",o&&(i.hasVisual?a.addClass(e,t):a.removeClass(e,t))),void 0}}),i.onVisualAid.dispatch(i,e,i.hasVisual)},remove:function(){var n=this,o=n.getContainer(),a=n.getDoc();n.removed||(n.removed=1,r&&a&&a.execCommand("SelectAll"),n.save(),t.setStyle(n.id,"display",n.orgDisplay),n.settings.content_editable||(i.unbind(n.getWin()),i.unbind(n.getDoc())),i.unbind(n.getBody()),i.clear(o),n.execCallback("remove_instance_callback",n),n.onRemove.dispatch(n),n.onExecCommand.listeners=[],e.remove(n),t.remove(o))},destroy:function(t){var n=this;n.destroyed||(a&&(i.unbind(n.getDoc()),i.unbind(n.getWin()),i.unbind(n.getBody())),t||(e.removeUnload(n.destroy),tinyMCE.onBeforeUnload.remove(n._beforeUnload),n.theme&&n.theme.destroy&&n.theme.destroy(),n.controlManager.destroy(),n.selection.destroy(),n.dom.destroy()),n.formElement&&(n.formElement.submit=n.formElement._mceOldSubmit,n.formElement._mceOldSubmit=null),n.contentAreaContainer=n.formElement=n.container=n.settings.content_element=n.bodyElement=n.contentDocument=n.contentWindow=null,n.selection&&(n.selection=n.selection.win=n.selection.dom=n.selection.dom.doc=null),n.destroyed=1)},_refreshContentEditable:function(){var e,t,i=this;i._isHidden()&&(e=i.getBody(),t=e.parentNode,t.removeChild(e),t.appendChild(e),e.focus())},_isHidden:function(){var e;return a?(e=this.selection.getSel(),!e||!e.rangeCount||0===e.rangeCount):0}})}(tinymce),function(e){var t=e.each;e.Editor.prototype.setupEvents=function(){var i=this,n=i.settings;t(["onPreInit","onBeforeRenderUI","onPostRender","onLoad","onInit","onRemove","onActivate","onDeactivate","onClick","onEvent","onMouseUp","onMouseDown","onDblClick","onKeyDown","onKeyUp","onKeyPress","onContextMenu","onSubmit","onReset","onPaste","onPreProcess","onPostProcess","onBeforeSetContent","onBeforeGetContent","onSetContent","onGetContent","onLoadContent","onSaveContent","onNodeChange","onChange","onBeforeExecCommand","onExecCommand","onUndo","onRedo","onVisualAid","onSetProgressState","onSetAttrib"],function(t){i[t]=new e.util.Dispatcher(i)}),n.cleanup_callback&&(i.onBeforeSetContent.add(function(e,t){t.content=e.execCallback("cleanup_callback","insert_to_editor",t.content,t)}),i.onPreProcess.add(function(e,t){t.set&&e.execCallback("cleanup_callback","insert_to_editor_dom",t.node,t),t.get&&e.execCallback("cleanup_callback","get_from_editor_dom",t.node,t)}),i.onPostProcess.add(function(e,t){t.set&&(t.content=e.execCallback("cleanup_callback","insert_to_editor",t.content,t)),t.get&&(t.content=e.execCallback("cleanup_callback","get_from_editor",t.content,t))})),n.save_callback&&i.onGetContent.add(function(e,t){t.save&&(t.content=e.execCallback("save_callback",e.id,t.content,e.getBody()))}),n.handle_event_callback&&i.onEvent.add(function(e,t,n){i.execCallback("handle_event_callback",t,e,n)===!1&&(t.preventDefault(),t.stopPropagation())}),n.handle_node_change_callback&&i.onNodeChange.add(function(e,t,i){e.execCallback("handle_node_change_callback",e.id,i,-1,-1,!0,e.selection.isCollapsed())}),n.save_callback&&i.onSaveContent.add(function(e,t){var i=e.execCallback("save_callback",e.id,t.content,e.getBody());i&&(t.content=i)}),n.onchange_callback&&i.onChange.add(function(e,t){e.execCallback("onchange_callback",e,t)})},e.Editor.prototype.bindNativeEvents=function(){function i(e,t){e.type;s.removed||s.onEvent.dispatch(s,e,t)!==!1&&s[r[e.fakeType||e.type]].dispatch(s,e,t)}function n(){s.focus(!0)}function o(t,i){65==i.keyCode&&e.VK.metaKeyPressed(i)||s.selection.normalize(),s.nodeChanged()}function a(i,n){(i.altKey||i.ctrlKey||i.metaKey)&&t(s.shortcuts,function(t){var o=e.isMac?i.metaKey:i.ctrlKey;if(t.ctrl==o&&t.alt==i.altKey&&t.shift==i.shiftKey)return i.keyCode==t.keyCode||i.charCode&&i.charCode==t.charCode?(i.preventDefault(),n&&t.func.call(t.scope),!0):void 0})}var r,s=this,l=s.settings,c=s.dom;r={mouseup:"onMouseUp",mousedown:"onMouseDown",click:"onClick",keyup:"onKeyUp",keydown:"onKeyDown",keypress:"onKeyPress",submit:"onSubmit",reset:"onReset",contextmenu:"onContextMenu",dblclick:"onDblClick",paste:"onPaste"},t(r,function(t,n){var o=l.content_editable?s.getBody():s.getDoc();switch(n){case"contextmenu":c.bind(o,n,i);break;case"paste":c.bind(s.getBody(),n,i);break;case"submit":case"reset":c.bind(s.getElement().form||e.DOM.getParent(s.id,"form"),n,i);break;default:c.bind(o,n,i)}}),c.bind(l.content_editable?s.getBody():e.isGecko?s.getDoc():s.getWin(),"focus",function(){s.focus(!0)}),l.content_editable&&e.isOpera&&(c.bind(s.getBody(),"click",n),c.bind(s.getBody(),"keydown",n)),s.onMouseUp.add(o),s.onKeyUp.add(function(t,i){var n=i.keyCode;(n>=33&&36>=n||n>=37&&40>=n||13==n||45==n||46==n||8==n||e.isMac&&(91==n||93==n)||i.ctrlKey)&&o(t,i)}),s.onReset.add(function(){s.setContent(s.startContent,{format:"raw"})}),s.onKeyUp.add(function(e,t){a(t)}),s.onKeyPress.add(function(e,t){a(t)}),s.onKeyDown.add(function(e,t){a(t,!0)}),e.isOpera&&s.onClick.add(function(e,t){t.preventDefault()})}}(tinymce),function(e){var t,i=e.each,n=!0,o=!1;e.EditorCommands=function(a){function r(e,t,i){var a;return e=e.toLowerCase(),(a=b.exec[e])?(a(e,t,i),n):o}function s(e){var t;return e=e.toLowerCase(),(t=b.state[e])?t(e):-1}function l(e){var t;return e=e.toLowerCase(),(t=b.value[e])?t(e):o}function c(e,t){t=t||"exec",i(e,function(e,n){i(n.toLowerCase().split(","),function(i){b[t][i]=e})})}function u(e,i,n){return i===t&&(i=o),n===t&&(n=null),a.getDoc().execCommand(e,i,n)}function d(e){return _.match(e)}function h(e,i){_.toggle(e,i?{value:i}:t)}function p(e){m=v.getBookmark(e)}function f(){v.moveToBookmark(m)}var m,g=a.dom,v=a.selection,b={state:{},exec:{},value:{}},y=a.settings,_=a.formatter;e.extend(this,{execCommand:r,queryCommandState:s,queryCommandValue:l,addCommands:c}),c({"mceResetDesignMode,mceBeginUndoLevel":function(){},"mceEndUndoLevel,mceAddUndoLevel":function(){a.undoManager.add()},"Cut,Copy,Paste":function(t){var i,o=a.getDoc();try{u(t)}catch(r){i=n}(i||!o.queryCommandSupported(t))&&(e.isGecko?a.windowManager.confirm(a.getLang("clipboard_msg"),function(e){e&&open("http://www.mozilla.org/editor/midasdemo/securityprefs.html","_blank")}):a.windowManager.alert(a.getLang("clipboard_no_support")))},unlink:function(e){v.isCollapsed()&&v.select(v.getNode()),u(e),v.collapse(o)},"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull":function(e){var t=e.substring(7);i("left,center,right,full".split(","),function(e){t!=e&&_.remove("align"+e)}),h("align"+t),r("mceRepaint")},"InsertUnorderedList,InsertOrderedList":function(e){var t,i;u(e),t=g.getParent(v.getNode(),"ol,ul"),t&&(i=t.parentNode,/^(H[1-6]|P|ADDRESS|PRE)$/.test(i.nodeName)&&(p(),g.split(i,t),f()))},"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":function(e){h(e)},"ForeColor,HiliteColor,FontName":function(e,t,i){h(e,i)},FontSize:function(t,i,n){var o,a;n>=1&&7>=n&&(a=e.explode(y.font_size_style_values),o=e.explode(y.font_size_classes),n=o?o[n-1]||n:a[n-1]||n),h(t,n)},RemoveFormat:function(e){_.remove(e)},mceBlockQuote:function(){h("blockquote")},FormatBlock:function(e,t,i){return h(i||"p")},mceCleanup:function(){var e=v.getBookmark();a.setContent(a.getContent({cleanup:n}),{cleanup:n}),v.moveToBookmark(e)},mceRemoveNode:function(e,t,i){var o=i||v.getNode();o!=a.getBody()&&(p(),a.dom.remove(o,n),f())},mceSelectNodeDepth:function(e,t,i){var n=0;g.getParent(v.getNode(),function(e){return 1==e.nodeType&&n++==i?(v.select(e),o):void 0},a.getBody())},mceSelectNode:function(e,t,i){v.select(i)},mceInsertContent:function(t,i,n){var o,r,s,l,c,u,d,h,p,f,m,b,y,_;if(o=a.parser,r=new e.html.Serializer({},a.schema),y='<span id="mce_marker" data-mce-type="bookmark"></span>',u={content:n,format:"html"},v.onBeforeSetContent.dispatch(v,u),n=u.content,-1==n.indexOf("{$caret}")&&(n+="{$caret}"),n=n.replace(/\{\$caret\}/,y),v.isCollapsed()||a.getDoc().execCommand("Delete",!1,null),s=v.getNode(),u={context:s.nodeName.toLowerCase()},c=o.parse(n,u),m=c.lastChild,"mce_marker"==m.attr("id"))for(d=m,m=m.prev;m;m=m.walk(!0))if(3==m.type||!g.isBlock(m.name)){m.parent.insert(d,m,"br"===m.name);break}if(u.invalid){for(v.setContent(y),s=v.getNode(),l=a.getBody(),9==s.nodeType?s=m=l:m=s;m!==l;)s=m,m=m.parentNode;n=s==l?l.innerHTML:g.getOuterHTML(s),n=r.serialize(o.parse(n.replace(/<span (id="mce_marker"|id=mce_marker).+?<\/span>/i,function(){return r.serialize(c)}))),s==l?g.setHTML(l,n):g.setOuterHTML(s,n)}else n=r.serialize(c),m=s.firstChild,b=s.lastChild,!m||m===b&&"BR"===m.nodeName?g.setHTML(s,n):v.setContent(n);d=g.get("mce_marker"),h=g.getRect(d),p=g.getViewPort(a.getWin()),(h.y+h.h>p.y+p.h||h.y<p.y||h.x>p.x+p.w||h.x<p.x)&&(_=e.isIE?a.getDoc().documentElement:a.getBody(),_.scrollLeft=h.x,_.scrollTop=h.y-p.h+25),f=g.createRng(),m=d.previousSibling,m&&3==m.nodeType?f.setStart(m,m.nodeValue.length):(f.setStartBefore(d),f.setEndBefore(d)),g.remove(d),v.setRng(f),v.onSetContent.dispatch(v,u),a.addVisual()},mceInsertRawHTML:function(e,t,i){v.setContent("tiny_mce_marker"),a.setContent(a.getContent().replace(/tiny_mce_marker/g,function(){return i}))},mceToggleFormat:function(e,t,i){h(i)},mceSetContent:function(e,t,i){a.setContent(i)},"Indent,Outdent":function(e){var t,n,o;t=y.indentation,n=/[a-z%]+$/i.exec(t),t=parseInt(t),s("InsertUnorderedList")||s("InsertOrderedList")?u(e):(y.forced_root_block||g.getParent(v.getNode(),g.isBlock)||_.apply("div"),i(v.getSelectedBlocks(),function(i){"outdent"==e?(o=Math.max(0,parseInt(i.style.paddingLeft||0)-t),g.setStyle(i,"paddingLeft",o?o+n:"")):g.setStyle(i,"paddingLeft",parseInt(i.style.paddingLeft||0)+t+n)}))},mceRepaint:function(){if(e.isGecko)try{p(n),v.getSel()&&v.getSel().selectAllChildren(a.getBody()),v.collapse(n),f()}catch(t){}},mceToggleFormat:function(e,t,i){_.toggle(i)},InsertHorizontalRule:function(){a.execCommand("mceInsertContent",!1,"<hr />")},mceToggleVisualAid:function(){a.hasVisual=!a.hasVisual,a.addVisual()},mceReplaceContent:function(e,t,i){a.execCommand("mceInsertContent",!1,i.replace(/\{\$selection\}/g,v.getContent({format:"text"})))},mceInsertLink:function(e,t,i){var n;"string"==typeof i&&(i={href:i}),n=g.getParent(v.getNode(),"a"),i.href=i.href.replace(" ","%20"),n&&i.href||_.remove("link"),i.href&&_.apply("link",i,n)
81
81
  },selectAll:function(){var e=g.getRoot(),t=g.createRng();v.getRng().setStart?(t.setStart(e,0),t.setEnd(e,e.childNodes.length),v.setRng(t)):u("SelectAll")}}),c({"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull":function(t){var i="align"+t.substring(7),o=v.isCollapsed()?[g.getParent(v.getNode(),g.isBlock)]:v.getSelectedBlocks(),a=e.map(o,function(e){return!!_.matchNode(e,i)});return-1!==e.inArray(a,n)},"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":function(e){return d(e)},mceBlockQuote:function(){return d("blockquote")},Outdent:function(){var e;if(y.inline_styles){if((e=g.getParent(v.getStart(),g.isBlock))&&parseInt(e.style.paddingLeft)>0)return n;if((e=g.getParent(v.getEnd(),g.isBlock))&&parseInt(e.style.paddingLeft)>0)return n}return s("InsertUnorderedList")||s("InsertOrderedList")||!y.inline_styles&&!!g.getParent(v.getNode(),"BLOCKQUOTE")},"InsertUnorderedList,InsertOrderedList":function(e){var t=g.getParent(v.getNode(),"ul,ol");return t&&("insertunorderedlist"===e&&"UL"===t.tagName||"insertorderedlist"===e&&"OL"===t.tagName)}},"state"),c({"FontSize,FontName":function(e){var t,i=0;return(t=g.getParent(v.getNode(),"span"))&&(i="fontsize"==e?t.style.fontSize:t.style.fontFamily.replace(/, /g,",").replace(/[\'\"]/g,"").toLowerCase()),i}},"value"),c({Undo:function(){a.undoManager.undo()},Redo:function(){a.undoManager.redo()}})}}(tinymce),function(e){var t=e.util.Dispatcher;e.UndoManager=function(i){function n(){return e.trim(i.getContent({format:"raw",no_events:1}).replace(/<span[^>]+data-mce-bogus[^>]+>[\u200B\uFEFF]+<\/span>/g,""))}function o(){a.typing=!1,a.add()}var a,r,s,l,c,u=0,d=[];return onBeforeAdd=new t(a),s=new t(a),l=new t(a),c=new t(a),s.add(function(e,t){return e.hasUndo()?i.onChange.dispatch(i,t,e):void 0}),l.add(function(e,t){return i.onUndo.dispatch(i,t,e)}),c.add(function(e,t){return i.onRedo.dispatch(i,t,e)}),i.onInit.add(function(){a.add()}),i.onBeforeExecCommand.add(function(e,t,i,n,o){"Undo"==t||"Redo"==t||"mceRepaint"==t||o&&o.skip_undo||a.beforeChange()}),i.onExecCommand.add(function(e,t,i,n,o){"Undo"==t||"Redo"==t||"mceRepaint"==t||o&&o.skip_undo||a.add()}),i.onSaveContent.add(o),i.dom.bind(i.dom.getRoot(),"dragend",o),i.dom.bind(i.getBody(),"focusout",function(){!i.removed&&a.typing&&o()}),i.onKeyUp.add(function(e,t){var i=t.keyCode;(i>=33&&36>=i||i>=37&&40>=i||45==i||13==i||t.ctrlKey)&&o()}),i.onKeyDown.add(function(e,t){var i=t.keyCode;return i>=33&&36>=i||i>=37&&40>=i||45==i?(a.typing&&o(),void 0):((16>i||i>20)&&224!=i&&91!=i&&!a.typing&&(a.beforeChange(),a.typing=!0,a.add()),void 0)}),i.onMouseDown.add(function(){a.typing&&o()}),i.addShortcut("ctrl+z","undo_desc","Undo"),i.addShortcut("ctrl+y","redo_desc","Redo"),a={data:d,typing:!1,onBeforeAdd:onBeforeAdd,onAdd:s,onUndo:l,onRedo:c,beforeChange:function(){r=i.selection.getBookmark(2,!0)},add:function(e){var t,o,s=i.settings;if(e=e||{},e.content=n(),a.onBeforeAdd.dispatch(a,e),o=d[u],o&&o.content==e.content)return null;if(d[u]&&(d[u].beforeBookmark=r),s.custom_undo_redo_levels&&d.length>s.custom_undo_redo_levels){for(t=0;t<d.length-1;t++)d[t]=d[t+1];d.length--,u=d.length}return e.bookmark=i.selection.getBookmark(2,!0),u<d.length-1&&(d.length=u+1),d.push(e),u=d.length-1,a.onAdd.dispatch(a,e),i.isNotDirty=0,e},undo:function(){var e;return a.typing&&(a.add(),a.typing=!1),u>0&&(e=d[--u],i.setContent(e.content,{format:"raw"}),i.selection.moveToBookmark(e.beforeBookmark),a.onUndo.dispatch(a,e)),e},redo:function(){var e;return u<d.length-1&&(e=d[++u],i.setContent(e.content,{format:"raw"}),i.selection.moveToBookmark(e.bookmark),a.onRedo.dispatch(a,e)),e},clear:function(){d=[],u=0,a.typing=!1},hasUndo:function(){return u>0||this.typing},hasRedo:function(){return u<d.length-1&&!this.typing}}}}(tinymce),tinymce.ForceBlocks=function(e){function t(){var t,r,s,l,c,u,d,h,p,f=o.getStart(),m=e.getBody(),g=-16777215;if(f&&1===f.nodeType&&i.forced_root_block){for(;f&&f!=m;){if(a[f.nodeName])return;f=f.parentNode}for(t=o.getRng(),t.setStart?(r=t.startContainer,s=t.startOffset,l=t.endContainer,c=t.endOffset):(t.item&&(f=t.item(0),t=e.getDoc().body.createTextRange(),t.moveToElementText(f)),p=t.parentElement().ownerDocument===e.getDoc(),tmpRng=t.duplicate(),tmpRng.collapse(!0),s=-1*tmpRng.move("character",g),tmpRng.collapsed||(tmpRng=t.duplicate(),tmpRng.collapse(!1),c=-1*tmpRng.move("character",g)-s)),f=m.firstChild;f;)if(3===f.nodeType||1==f.nodeType&&!a[f.nodeName]){if(3===f.nodeType&&0==f.nodeValue.length){d=f,f=f.nextSibling,n.remove(d);continue}u||(u=n.create(i.forced_root_block),f.parentNode.insertBefore(u,f),h=!0),d=f,f=f.nextSibling,u.appendChild(d)}else u=null,f=f.nextSibling;if(h){if(t.setStart)t.setStart(r,s),t.setEnd(l,c),o.setRng(t);else if(p)try{t=e.getDoc().body.createTextRange(),t.moveToElementText(m),t.collapse(!0),t.moveStart("character",s),c>0&&t.moveEnd("character",c),t.select()}catch(v){}e.nodeChanged()}}}var i=e.settings,n=e.dom,o=e.selection,a=e.schema.getBlockElements();i.forced_root_block&&(e.onKeyUp.add(t),e.onNodeChange.add(t))},function(e){var t=(e.DOM,e.dom.Event),i=e.each,n=e.extend;e.create("tinymce.ControlManager",{ControlManager:function(t,n){var o=this;n=n||{},o.editor=t,o.controls={},o.onAdd=new e.util.Dispatcher(o),o.onPostRender=new e.util.Dispatcher(o),o.prefix=n.prefix||t.id+"_",o._cls={},o.onPostRender.add(function(){i(o.controls,function(e){e.postRender()})})},get:function(e){return this.controls[this.prefix+e]||this.controls[e]},setActive:function(e,t){var i=null;return(i=this.get(e))&&i.setActive(t),i},setDisabled:function(e,t){var i=null;return(i=this.get(e))&&i.setDisabled(t),i},add:function(e){var t=this;return e&&(t.controls[e.id]=e,t.onAdd.dispatch(e,t)),e},createControl:function(e){var t,n,o,a,r=this,s=r.editor;for(r.controlFactories||(r.controlFactories=[],i(s.plugins,function(e){e.createControl&&r.controlFactories.push(e)})),a=r.controlFactories,n=0,o=a.length;o>n;n++)if(t=a[n].createControl(e,r))return r.add(t);return"|"===e||"separator"===e?r.createSeparator():s.buttons&&(t=s.buttons[e])?r.createButton(e,t):r.add(t)},createDropMenu:function(t,i,o){var a,r,s,l,c=this,u=c.editor;return i=n({"class":"mceDropDown",constrain:u.settings.constrain_menus},i),i["class"]=i["class"]+" "+u.getParam("skin")+"Skin",(s=u.getParam("skin_variant"))&&(i["class"]+=" "+u.getParam("skin")+"Skin"+s.substring(0,1).toUpperCase()+s.substring(1)),i["class"]+="rtl"==u.settings.directionality?" mceRtl":"",t=c.prefix+t,l=o||c._cls.dropmenu||e.ui.DropMenu,a=c.controls[t]=new l(t,i),a.onAddItem.add(function(e,t){var i=t.settings;i.title=u.getLang(i.title,i.title),i.onclick||(i.onclick=function(){i.cmd&&u.execCommand(i.cmd,i.ui||!1,i.value)})}),u.onRemove.add(function(){a.destroy()}),e.isIE&&(a.onShowMenu.add(function(){u.focus(),r=u.selection.getBookmark(1)}),a.onHideMenu.add(function(){r&&(u.selection.moveToBookmark(r),r=0)})),c.add(a)},createListBox:function(i,o,a){function r(t){return t.settings.use_accessible_selects&&!e.isGecko}var s,l,c=this,u=c.editor;return c.get(i)?null:(o.title=u.translate(o.title),o.scope=o.scope||u,o.onselect||(o.onselect=function(e){u.execCommand(o.cmd,o.ui||!1,e||o.value)}),o=n({title:o.title,"class":"mce_"+i,scope:o.scope,control_manager:c},o),i=c.prefix+i,u.settings.use_native_selects||r(u)?s=new e.ui.NativeListBox(i,o):(l=a||c._cls.listbox||e.ui.ListBox,s=new l(i,o,u)),c.controls[i]=s,e.isWebKit&&s.onPostRender.add(function(e,i){t.add(i,"mousedown",function(){u.bookmark=u.selection.getBookmark(1)}),t.add(i,"focus",function(){u.selection.moveToBookmark(u.bookmark),u.bookmark=null})}),s.hideMenu&&u.onMouseDown.add(s.hideMenu,s),c.add(s))},createButton:function(t,i,o){var a,r,s=this,l=s.editor;return s.get(t)?null:(i.title=l.translate(i.title),i.label=l.translate(i.label),i.scope=i.scope||l,i.onclick||i.menu_button||(i.onclick=function(){l.execCommand(i.cmd,i.ui||!1,i.value)}),i=n({title:i.title,"class":"mce_"+t,unavailable_prefix:l.getLang("unavailable",""),scope:i.scope,control_manager:s},i),t=s.prefix+t,i.menu_button?(r=o||s._cls.menubutton||e.ui.MenuButton,a=new r(t,i,l),l.onMouseDown.add(a.hideMenu,a)):(r=s._cls.button||e.ui.Button,a=new r(t,i,l)),s.add(a))},createMenuButton:function(e,t,i){return t=t||{},t.menu_button=1,this.createButton(e,t,i)},createSplitButton:function(t,i,o){var a,r,s=this,l=s.editor;return s.get(t)?null:(i.title=l.translate(i.title),i.scope=i.scope||l,i.onclick||(i.onclick=function(e){l.execCommand(i.cmd,i.ui||!1,e||i.value)}),i.onselect||(i.onselect=function(e){l.execCommand(i.cmd,i.ui||!1,e||i.value)}),i=n({title:i.title,"class":"mce_"+t,scope:i.scope,control_manager:s},i),t=s.prefix+t,r=o||s._cls.splitbutton||e.ui.SplitButton,a=s.add(new r(t,i,l)),l.onMouseDown.add(a.hideMenu,a),a)},createColorSplitButton:function(t,i,o){var a,r,s,l=this,c=l.editor;return l.get(t)?null:(i.title=c.translate(i.title),i.scope=i.scope||c,i.onclick||(i.onclick=function(t){e.isIE&&(s=c.selection.getBookmark(1)),c.execCommand(i.cmd,i.ui||!1,t||i.value)}),i.onselect||(i.onselect=function(e){c.execCommand(i.cmd,i.ui||!1,e||i.value)}),i=n({title:i.title,"class":"mce_"+t,menu_class:c.getParam("skin")+"Skin",scope:i.scope,more_colors_title:c.getLang("more_colors")},i),t=l.prefix+t,r=o||l._cls.colorsplitbutton||e.ui.ColorSplitButton,a=new r(t,i,c),c.onMouseDown.add(a.hideMenu,a),c.onRemove.add(function(){a.destroy()}),e.isIE&&(a.onShowMenu.add(function(){c.focus(),s=c.selection.getBookmark(1)}),a.onHideMenu.add(function(){s&&(c.selection.moveToBookmark(s),s=0)})),l.add(a))},createToolbar:function(t,i,n){var o,a,r=this;return t=r.prefix+t,a=n||r._cls.toolbar||e.ui.Toolbar,o=new a(t,i,r.editor),r.get(t)?null:r.add(o)},createToolbarGroup:function(t,i,n){var o,a,r=this;return t=r.prefix+t,a=n||this._cls.toolbarGroup||e.ui.ToolbarGroup,o=new a(t,i,r.editor),r.get(t)?null:r.add(o)},createSeparator:function(t){var i=t||this._cls.separator||e.ui.Separator;return new i},setControlType:function(e,t){return this._cls[e.toLowerCase()]=t},destroy:function(){i(this.controls,function(e){e.destroy()}),this.controls=null}})}(tinymce),function(e){var t=e.util.Dispatcher,i=e.each,n=e.isIE,o=e.isOpera;e.create("tinymce.WindowManager",{WindowManager:function(e){var i=this;i.editor=e,i.onOpen=new t(i),i.onClose=new t(i),i.params={},i.features={}},open:function(t,a){var r,s,l,c,u=this,d="",h="modal"==u.editor.settings.dialog_type,p=e.DOM.getViewPort();t=t||{},a=a||{},s=o?p.w:screen.width,l=o?p.h:screen.height,t.name=t.name||"mc_"+(new Date).getTime(),t.width=parseInt(t.width||320),t.height=parseInt(t.height||240),t.resizable=!0,t.left=t.left||parseInt(s/2)-t.width/2,t.top=t.top||parseInt(l/2)-t.height/2,a.inline=!1,a.mce_width=t.width,a.mce_height=t.height,a.mce_auto_focus=t.auto_focus,h&&n&&(t.center=!0,t.help=!1,t.dialogWidth=t.width+"px",t.dialogHeight=t.height+"px",t.scroll=t.scrollbars||!1),i(t,function(t,i){e.is(t,"boolean")&&(t=t?"yes":"no"),/^(name|url)$/.test(i)||(d+=n&&h?(d?";":"")+i+":"+t:(d?",":"")+i+"="+t)}),u.features=t,u.params=a,u.onOpen.dispatch(u,t,a),c=t.url||t.file,c=e._addVer(c);try{n&&h?(r=1,window.showModalDialog(c,window,d)):r=window.open(c,t.name,d)}catch(f){}r||alert(u.editor.getLang("popup_blocked"))},close:function(e){e.close(),this.onClose.dispatch(this)},createInstance:function(t,i,n,o,a,r){var s=e.resolve(t);return new s(i,n,o,a,r)},confirm:function(e,t,i,n){n=n||window,t.call(i||this,n.confirm(this._decode(this.editor.getLang(e,e))))},alert:function(e,t,i,n){var o=this;n=n||window,n.alert(o._decode(o.editor.getLang(e,e))),t&&t.call(i||o)},resizeBy:function(e,t,i){i.resizeBy(e,t)},_decode:function(t){return e.DOM.decode(t).replace(/\\n/g,"\n")}})}(tinymce),function(e){e.Formatter=function(t){function i(e){return e.nodeType&&(e=e.nodeName),!!t.schema.getTextBlockElements()[e.toLowerCase()]}function n(e,t){return O.getParents(e,t,O.getRoot())}function o(e){return 1===e.nodeType&&"_mce_caret"===e.id}function a(){l({alignleft:[{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"left"},defaultBlock:"div"},{selector:"img,table",collapsed:!1,styles:{"float":"left"}}],aligncenter:[{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"center"},defaultBlock:"div"},{selector:"img",collapsed:!1,styles:{display:"block",marginLeft:"auto",marginRight:"auto"}},{selector:"table",collapsed:!1,styles:{marginLeft:"auto",marginRight:"auto"}}],alignright:[{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"right"},defaultBlock:"div"},{selector:"img,table",collapsed:!1,styles:{"float":"right"}}],alignfull:[{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"justify"},defaultBlock:"div"}],bold:[{inline:"strong",remove:"all"},{inline:"span",styles:{fontWeight:"bold"}},{inline:"b",remove:"all"}],italic:[{inline:"em",remove:"all"},{inline:"span",styles:{fontStyle:"italic"}},{inline:"i",remove:"all"}],underline:[{inline:"span",styles:{textDecoration:"underline"},exact:!0},{inline:"u",remove:"all"}],strikethrough:[{inline:"span",styles:{textDecoration:"line-through"},exact:!0},{inline:"strike",remove:"all"}],forecolor:{inline:"span",styles:{color:"%value"},wrap_links:!1},hilitecolor:{inline:"span",styles:{backgroundColor:"%value"},wrap_links:!1},fontname:{inline:"span",styles:{fontFamily:"%value"}},fontsize:{inline:"span",styles:{fontSize:"%value"}},fontsize_class:{inline:"span",attributes:{"class":"%value"}},blockquote:{block:"blockquote",wrapper:1,remove:"all"},subscript:{inline:"sub"},superscript:{inline:"sup"},link:{inline:"a",selector:"a",remove:"all",split:!0,deep:!0,onmatch:function(){return!0},onformat:function(e,t,i){B(i,function(t,i){O.setAttrib(e,i,t)})}},removeformat:[{selector:"b,strong,em,i,font,u,strike",remove:"all",split:!0,expand:!1,block_expand:!0,deep:!0},{selector:"span",attributes:["style","class"],remove:"empty",split:!0,expand:!1,deep:!0},{selector:"*",attributes:["style","class"],split:!1,expand:!1,deep:!0}]}),B("p h1 h2 h3 h4 h5 h6 div address pre div code dt dd samp".split(/\s/),function(e){l(e,{block:e,remove:"all"})}),l(t.settings.formats)}function r(){t.addShortcut("ctrl+b","bold_desc","Bold"),t.addShortcut("ctrl+i","italic_desc","Italic"),t.addShortcut("ctrl+u","underline_desc","Underline");for(var e=1;6>=e;e++)t.addShortcut("ctrl+"+e,"",["FormatBlock",!1,"h"+e]);t.addShortcut("ctrl+7","",["FormatBlock",!1,"p"]),t.addShortcut("ctrl+8","",["FormatBlock",!1,"div"]),t.addShortcut("ctrl+9","",["FormatBlock",!1,"address"])}function s(e){return e?H[e]:H}function l(e,t){e&&("string"!=typeof e?B(e,function(e,t){l(t,e)}):(t=t.length?t:[t],B(t,function(e){e.deep===I&&(e.deep=!e.selector),e.split===I&&(e.split=!e.selector||e.inline),e.remove===I&&e.selector&&!e.inline&&(e.remove="none"),e.selector&&e.inline&&(e.mixed=!0,e.block_expand=!0),"string"==typeof e.classes&&(e.classes=e.classes.split(/\s+/))}),H[e]=t))}function c(n,a,r){function l(e,t){t=t||y,e&&(t.onformat&&t.onformat(e,t,a,r),B(t.styles,function(t,i){O.setStyle(e,i,_(t,a))}),B(t.attributes,function(t,i){O.setAttrib(e,i,_(t,a))}),B(t.classes,function(t){t=_(t,a),O.hasClass(e,t)||O.addClass(e,t)}))}function u(){function e(e,t){var i=new L(t);for(r=i.current();r;r=i.prev())if(r.childNodes.length>1||r==e||"BR"==r.tagName)return r}var i=t.selection.getRng(),n=i.startContainer,o=i.endContainer;if(n!=o&&0===i.endOffset){var a=e(n,o),s=3==a.nodeType?a.length:a.childNodes.length;i.setEnd(a,s)}return i}function d(t,i,n,o,a){var r,s,l=[],c=-1,u=-1,d=-1;return B(t.childNodes,function(e,t){return"UL"===e.nodeName||"OL"===e.nodeName?(c=t,r=e,!1):void 0}),B(t.childNodes,function(e,t){"SPAN"===e.nodeName&&"bookmark"==O.getAttrib(e,"data-mce-type")&&(e.id==i.id+"_start"?u=t:e.id==i.id+"_end"&&(d=t))}),0>=c||c>u&&d>c?(B(e.grep(t.childNodes),a),0):(s=O.clone(n,V),B(e.grep(t.childNodes),function(e,t){(c>u&&c>t||u>c&&t>c)&&(l.push(e),e.parentNode.removeChild(e))}),c>u?t.insertBefore(s,r):u>c&&t.insertBefore(s,r.nextSibling),o.push(s),B(l,function(e){s.appendChild(e)}),s)}function p(t,r,s){var c,u,p=[],f=!0;c=y.inline||y.block,u=O.create(c),l(u),j.walk(t,function(t){function m(t){var _,w,C,k,T;return T=f,_=t.nodeName.toLowerCase(),w=t.parentNode.nodeName.toLowerCase(),1===t.nodeType&&Y(t)&&(T=f,f="true"===Y(t),k=!0),b(_,"br")?(v=0,y.block&&O.remove(t),void 0):y.wrapper&&h(t,n,a)?(v=0,void 0):f&&!k&&y.block&&!y.wrapper&&i(_)?(t=O.rename(t,c),l(t),p.push(t),v=0,void 0):y.selector&&(B(g,function(e){"collapsed"in e&&e.collapsed!==x||O.is(t,e.selector)&&!o(t)&&(l(t,e),C=!0)}),!y.inline||C)?(v=0,void 0):(!f||k||!F(c,_)||!F(w,c)||!s&&3===t.nodeType&&1===t.nodeValue.length&&65279===t.nodeValue.charCodeAt(0)||o(t)||y.inline&&z(t)?"li"==_&&r?v=d(t,r,u,p,m):(v=0,B(e.grep(t.childNodes),m),k&&(f=T),v=0):(v||(v=O.clone(u,V),t.parentNode.insertBefore(v,t),p.push(v)),v.appendChild(t)),void 0)}var v;B(t,m)}),y.wrap_links===!1&&B(p,function(t){function i(t){var n,o,a;if("A"===t.nodeName){for(o=O.clone(u,V),p.push(o),a=e.grep(t.childNodes),n=0;n<a.length;n++)o.appendChild(a[n]);t.appendChild(o)}B(e.grep(t.childNodes),i)}i(t)}),B(p,function(e){function t(e){var t=0;return B(e.childNodes,function(e){w(e)||S(e)||t++}),t}function i(e){var t,i;return B(e.childNodes,function(e){return 1!=e.nodeType||S(e)||o(e)?void 0:(t=e,V)}),t&&v(t,y)&&(i=O.clone(t,V),l(i),O.replace(i,e,K),O.remove(t,1)),i||e}var r;if(r=t(e),(p.length>1||!z(e))&&0===r)return O.remove(e,1),void 0;if(y.inline||y.wrapper){if(y.exact||1!==r||(e=i(e)),B(g,function(t){B(O.select(t.inline,e),function(e){var i;if(t.wrap_links===!1){i=e.parentNode;do if("A"===i.nodeName)return;while(i=i.parentNode)}k(t,a,e,t.exact?e:null)})}),h(e.parentNode,n,a))return O.remove(e,1),e=0,K;y.merge_with_parents&&O.getParent(e.parentNode,function(t){return h(t,n,a)?(O.remove(e,1),e=0,K):void 0}),e&&y.merge_siblings!==!1&&(e=E(D(e),e),e=E(e,D(e,K)))}})}var f,m,g=s(n),y=g[0],x=R.isCollapsed();if(y)if(r)r.nodeType?(m=O.createRng(),m.setStartBefore(r),m.setEndAfter(r),p(C(m,g),null,!0)):p(r,null,!0);else if(x&&y.inline&&!O.select("td.mceSelected,th.mceSelected").length)A("apply",n,a);else{var T=t.selection.getNode();$||!g[0].defaultBlock||O.getParent(T,O.isBlock)||c(g[0].defaultBlock),t.selection.setRng(u()),f=R.getBookmark(),p(C(R.getRng(K),g),f),y.styles&&(y.styles.color||y.styles.textDecoration)&&(e.walk(T,G,"childNodes"),G(T)),R.moveToBookmark(f),P(R.getRng(K)),t.nodeChanged()}}function u(i,o,a){function r(t){var i,n,a,s,l;if(3!==t.nodeType){if(1===t.nodeType&&Y(t)&&(s=y,y="true"===Y(t),l=!0),i=e.grep(t.childNodes),y&&!l)for(n=0,a=v.length;a>n&&!k(v[n],o,t,t);n++);if(b.deep&&i.length){for(n=0,a=i.length;a>n;n++)r(i[n]);l&&(y=s)}}}function l(e){var t;return B(n(e.parentNode).reverse(),function(e){var n;t||"_start"==e.id||"_end"==e.id||(n=h(e,i,o),n&&n.split!==!1&&(t=e))}),t}function c(e,t,i,n){var a,r,s,l,c,u;if(e){for(u=e.parentNode,a=t.parentNode;a&&a!=u;a=a.parentNode){for(r=O.clone(a,V),c=0;c<v.length;c++)if(k(v[c],o,r,r)){r=0;break}r&&(s&&r.appendChild(s),l||(l=r),s=r)}!n||b.mixed&&z(e)||(t=O.split(e,t)),s&&(i.parentNode.insertBefore(s,i),l.appendChild(i))}return t}function u(e){return c(l(e),e,e,!0)}function d(e){var t=O.get(e?"_start":"_end"),i=t[e?"firstChild":"lastChild"];return S(i)&&(i=i[e?"firstChild":"lastChild"]),O.remove(t,!0),i}function f(e){var i,n;e=C(e,v,K),b.split&&(i=N(e,K),n=N(e),i!=n?(/^(TR|TD)$/.test(i.nodeName)&&i.firstChild&&(i=("TD"==i.nodeName?i.firstChild:i.firstChild.firstChild)||i),i=x(i,"span",{id:"_start","data-mce-type":"bookmark"}),n=x(n,"span",{id:"_end","data-mce-type":"bookmark"}),u(i),u(n),i=d(K),n=d()):i=n=u(i),e.startContainer=i.parentNode,e.startOffset=q(i),e.endContainer=n.parentNode,e.endOffset=q(n)+1),j.walk(e,function(e){B(e,function(e){r(e),1===e.nodeType&&"underline"===t.dom.getStyle(e,"text-decoration")&&e.parentNode&&"underline"===X(e.parentNode)&&k({deep:!1,exact:!0,inline:"span",styles:{textDecoration:"underline"}},null,e)})})}var m,g,v=s(i),b=v[0],y=!0;return a?(a.nodeType?(g=O.createRng(),g.setStartBefore(a),g.setEndAfter(a),f(g)):f(a),void 0):(R.isCollapsed()&&b.inline&&!O.select("td.mceSelected,th.mceSelected").length?A("remove",i,o):(m=R.getBookmark(),f(R.getRng(K)),R.moveToBookmark(m),b.inline&&p(i,o,R.getStart())&&P(R.getRng(!0)),t.nodeChanged()),void 0)}function d(e,t,i){var n=s(e);!p(e,t,i)||"toggle"in n[0]&&!n[0].toggle?c(e,t,i):u(e,t,i)}function h(e,t,i,n){function o(e,t,o){var a,r,s,l=t[o];if(t.onmatch)return t.onmatch(e,t,o);if(l)if(l.length===I){for(a in l)if(l.hasOwnProperty(a)){if(r="attributes"===o?O.getAttrib(e,a):y(e,a),n&&!r&&!t.exact)return;if((!n||t.exact)&&!b(r,_(l[a],i)))return}}else for(s=0;s<l.length;s++)if("attributes"===o?O.getAttrib(e,l[s]):y(e,l[s]))return t;return t}var a,r,l,c=s(t);if(c&&e)for(r=0;r<c.length;r++)if(a=c[r],v(e,a)&&o(e,a,"attributes")&&o(e,a,"styles")){if(l=a.classes)for(r=0;r<l.length;r++)if(!O.hasClass(e,l[r]))return;return a}}function p(e,t,i){function n(i){return i=O.getParent(i,function(i){return!!h(i,e,t,!0)}),h(i,e,t)}var o;return i?n(i):(i=R.getNode(),n(i)?K:(o=R.getStart(),o!=i&&n(o)?K:V))}function f(e,t){var i,n=[],o={};return i=R.getStart(),O.getParent(i,function(i){var a,r;for(a=0;a<e.length;a++)r=e[a],!o[r]&&h(i,r,t)&&(o[r]=!0,n.push(r))},O.getRoot()),n}function m(e){var t,i,o,a,r,l=s(e);if(l)for(t=R.getStart(),i=n(t),a=l.length-1;a>=0;a--){if(r=l[a].selector,!r)return K;for(o=i.length-1;o>=0;o--)if(O.is(i[o],r))return K}return V}function g(e,i,o){var a;return M||(M={},a={},t.onNodeChange.addToTop(function(e,t,i){var o=n(i),r={};B(M,function(e,t){B(o,function(i){return h(i,t,{},e.similar)?(a[t]||(B(e,function(e){e(!0,{node:i,format:t,parents:o})}),a[t]=e),r[t]=e,!1):void 0})}),B(a,function(e,t){r[t]||(delete a[t],B(e,function(e){e(!1,{node:i,format:t,parents:o})}))})})),B(e.split(","),function(e){M[e]||(M[e]=[],M[e].similar=o),M[e].push(i)}),this}function v(e,t){return b(e,t.inline)?K:b(e,t.block)?K:t.selector?O.is(e,t.selector):void 0}function b(e,t){return e=e||"",t=t||"",e=""+(e.nodeName||e),t=""+(t.nodeName||t),e.toLowerCase()==t.toLowerCase()}function y(e,t){var i=O.getStyle(e,t);return("color"==t||"backgroundColor"==t)&&(i=O.toHex(i)),"fontWeight"==t&&700==i&&(i="bold"),""+i}function _(e,t){return"string"!=typeof e?e=e(t):t&&(e=e.replace(/%(\w+)/g,function(e,i){return t[i]||e})),e}function w(e){return e&&3===e.nodeType&&/^([\t \r\n]+|)$/.test(e.nodeValue)}function x(e,t,i){var n=O.create(t,i);return e.parentNode.insertBefore(n,e),n.appendChild(e),n}function C(e,o,a){function r(e){function t(e){return"BR"==e.nodeName&&e.getAttribute("data-mce-bogus")&&!e.nextSibling}var i,n,a,r,s;if(i=n=e?m:v,r=e?"previousSibling":"nextSibling",s=O.getRoot(),3==i.nodeType&&!w(i)&&(e?g>0:y<i.nodeValue.length))return i;for(;;){if(!o[0].block_expand&&z(n))return n;for(a=n[r];a;a=a[r])if(!S(a)&&!w(a)&&!t(a))return n;if(n.parentNode==s){i=n;break}n=n.parentNode}return i}function s(e,t){for(t===I&&(t=3===e.nodeType?e.length:e.childNodes.length);e&&e.hasChildNodes();)e=e.childNodes[t],e&&(t=3===e.nodeType?e.length:e.childNodes.length);return{node:e,offset:t}}function l(e){for(var t=e;t;){if(1===t.nodeType&&Y(t))return"false"===Y(t)?t:e;t=t.parentNode}return e}function c(e,i,n){function o(e,t){var i,o,r=e.nodeValue;return"undefined"==typeof t&&(t=n?r.length:0),n?(i=r.lastIndexOf(" ",t),o=r.lastIndexOf(" ",t),i=i>o?i:o,-1===i||a||i++):(i=r.indexOf(" ",t),o=r.indexOf(" ",t),i=-1!==i&&(-1===o||o>i)?i:o),i}var r,s,l,c;if(3===e.nodeType){if(l=o(e,i),-1!==l)return{container:e,offset:l};c=e}for(r=new L(e,O.getParent(e,z)||t.getBody());s=r[n?"prev":"next"]();)if(3===s.nodeType){if(c=s,l=o(s),-1!==l)return{container:s,offset:l}}else if(z(s))break;return c?(i=n?0:c.length,{container:c,offset:i}):void 0}function u(t,i){var a,r,s,l;for(3==t.nodeType&&0===t.nodeValue.length&&t[i]&&(t=t[i]),a=n(t),r=0;r<a.length;r++)for(s=0;s<o.length;s++)if(l=o[s],!("collapsed"in l&&l.collapsed!==e.collapsed)&&O.is(a[r],l.selector))return a[r];return t}function d(e,t){var a;if(o[0].wrapper||(a=O.getParent(e,o[0].block)),a||(a=O.getParent(3==e.nodeType?e.parentNode:e,i)),a&&o[0].wrapper&&(a=n(a,"ul,ol").reverse()[0]||a),!a)for(a=e;a[t]&&!z(a[t])&&(a=a[t],!b(a,"br")););return a||e}var h,p,f,m=e.startContainer,g=e.startOffset,v=e.endContainer,y=e.endOffset;if(1==m.nodeType&&m.hasChildNodes()&&(h=m.childNodes.length-1,m=m.childNodes[g>h?h:g],3==m.nodeType&&(g=0)),1==v.nodeType&&v.hasChildNodes()&&(h=v.childNodes.length-1,v=v.childNodes[y>h?h:y-1],3==v.nodeType&&(y=v.nodeValue.length)),m=l(m),v=l(v),(S(m.parentNode)||S(m))&&(m=S(m)?m:m.parentNode,m=m.nextSibling||m,3==m.nodeType&&(g=0)),(S(v.parentNode)||S(v))&&(v=S(v)?v:v.parentNode,v=v.previousSibling||v,3==v.nodeType&&(y=v.length)),o[0].inline&&(e.collapsed&&(f=c(m,g,!0),f&&(m=f.container,g=f.offset),f=c(v,y),f&&(v=f.container,y=f.offset)),p=s(v,y),p.node)){for(;p.node&&0===p.offset&&p.node.previousSibling;)p=s(p.node.previousSibling);p.node&&p.offset>0&&3===p.node.nodeType&&" "===p.node.nodeValue.charAt(p.offset-1)&&p.offset>1&&(v=p.node,v.splitText(p.offset-1))}return(o[0].inline||o[0].block_expand)&&(o[0].inline&&3==m.nodeType&&0!==g||(m=r(!0)),o[0].inline&&3==v.nodeType&&y!==v.nodeValue.length||(v=r())),o[0].selector&&o[0].expand!==V&&!o[0].inline&&(m=u(m,"previousSibling"),v=u(v,"nextSibling")),(o[0].block||o[0].selector)&&(m=d(m,"previousSibling"),v=d(v,"nextSibling"),o[0].block&&(z(m)||(m=r(!0)),z(v)||(v=r()))),1==m.nodeType&&(g=q(m),m=m.parentNode),1==v.nodeType&&(y=q(v)+1,v=v.parentNode),{startContainer:m,startOffset:g,endContainer:v,endOffset:y}}function k(e,t,i,n){var o,a,r;if(!v(i,e))return V;if("all"!=e.remove)for(B(e.styles,function(e,o){e=_(e,t),"number"==typeof o&&(o=e,n=0),(!n||b(y(n,o),e))&&O.setStyle(i,o,""),r=1}),r&&""==O.getAttrib(i,"style")&&(i.removeAttribute("style"),i.removeAttribute("data-mce-style")),B(e.attributes,function(e,o){var a;if(e=_(e,t),"number"==typeof o&&(o=e,n=0),!n||b(O.getAttrib(n,o),e)){if("class"==o&&(e=O.getAttrib(i,o),e&&(a="",B(e.split(/\s+/),function(e){/mce\w+/.test(e)&&(a+=(a?" ":"")+e)}),a)))return O.setAttrib(i,o,a),void 0;"class"==o&&i.removeAttribute("className"),U.test(o)&&i.removeAttribute("data-mce-"+o),i.removeAttribute(o)}}),B(e.classes,function(e){e=_(e,t),(!n||O.hasClass(n,e))&&O.removeClass(i,e)}),a=O.getAttribs(i),o=0;o<a.length;o++)if(0!==a[o].nodeName.indexOf("_"))return V;return"none"!=e.remove?(T(i,e),K):void 0}function T(t,i){function n(e,t,i){return e=D(e,t,i),!e||"BR"==e.nodeName||z(e)}var o,a=t.parentNode;i.block&&($?a==O.getRoot()&&(i.list_block&&b(t,i.list_block)||B(e.grep(t.childNodes),function(e){F($,e.nodeName.toLowerCase())?o?o.appendChild(e):o=x(e,$):o=0})):z(t)&&!z(a)&&(n(t,V)||n(t.firstChild,K,1)||t.insertBefore(O.create("br"),t.firstChild),n(t,K)||n(t.lastChild,V,1)||t.appendChild(O.create("br")))),i.selector&&i.inline&&!b(i.inline,t)||O.remove(t,1)}function D(e,t,i){if(e)for(t=t?"nextSibling":"previousSibling",e=i?e:e[t];e;e=e[t])if(1==e.nodeType||!w(e))return e}function S(e){return e&&1==e.nodeType&&"bookmark"==e.getAttribute("data-mce-type")}function E(t,i){function n(e,t){function i(e){var t={};return B(O.getAttribs(e),function(i){var n=i.nodeName.toLowerCase();0!==n.indexOf("_")&&"style"!==n&&(t[n]=O.getAttrib(e,n))}),t}function n(e,t){var i,n;for(n in e)if(e.hasOwnProperty(n)){if(i=t[n],i===I)return V;if(e[n]!=i)return V;delete t[n]}for(n in t)if(t.hasOwnProperty(n))return V;return K}return e.nodeName!=t.nodeName?V:n(i(e),i(t))?n(O.parseStyle(O.getAttrib(e,"style")),O.parseStyle(O.getAttrib(t,"style")))?K:V:V}function o(e,t){for(a=e;a;a=a[t]){if(3==a.nodeType&&0!==a.nodeValue.length)return e;if(1==a.nodeType&&!S(a))return a}return e}var a,r;if(t&&i&&(t=o(t,"previousSibling"),i=o(i,"nextSibling"),n(t,i))){for(a=t.nextSibling;a&&a!=i;)r=a,a=a.nextSibling,t.appendChild(r);return O.remove(i),B(e.grep(i.childNodes),function(e){t.appendChild(e)}),t}return i}function N(e,i){var n,o,a;return n=e[i?"startContainer":"endContainer"],o=e[i?"startOffset":"endOffset"],1==n.nodeType&&(a=n.childNodes.length-1,!i&&o&&o--,n=n.childNodes[o>a?a:o]),3===n.nodeType&&i&&o>=n.nodeValue.length&&(n=new L(n,t.getBody()).next()||n),3!==n.nodeType||i||0!==o||(n=new L(n,t.getBody()).prev()||n),n}function A(n,o,a){function r(e){var i=O.create("span",{id:b,"data-mce-bogus":!0,style:y?"color:red":""});return e&&i.appendChild(t.getDoc().createTextNode(W)),i}function l(e,t){for(;e;){if(3===e.nodeType&&e.nodeValue!==W||e.childNodes.length>1)return!1;t&&1===e.nodeType&&t.push(e),e=e.firstChild}return!0}function d(e){for(;e;){if(e.id===b)return e;e=e.parentNode}}function p(e){var t;if(e)for(t=new L(e,e),e=t.current();e;e=t.next())if(3===e.nodeType)return e}function f(e,t){var i,n;if(e)n=R.getRng(!0),l(e)?(t!==!1&&(n.setStartBefore(e),n.setEndBefore(e)),O.remove(e)):(i=p(e),i.nodeValue.charAt(0)===W&&(i=i.deleteData(0,1)),O.remove(e,1)),R.setRng(n);else if(e=d(R.getStart()),!e)for(;e=O.get(b);)f(e,!1)}function m(){var e,t,i,n,l,u,h;e=R.getRng(!0),n=e.startOffset,u=e.startContainer,h=u.nodeValue,t=d(R.getStart()),t&&(i=p(t)),h&&n>0&&n<h.length&&/\w/.test(h.charAt(n))&&/\w/.test(h.charAt(n-1))?(l=R.getBookmark(),e.collapse(!0),e=C(e,s(o)),e=j.split(e),c(o,a,e),R.moveToBookmark(l)):(t&&i.nodeValue===W?c(o,a,t):(t=r(!0),i=t.firstChild,e.insertNode(t),n=1,c(o,a,t)),R.setCursorLocation(i,n))}function g(){var e,t,n,l,c,d,p,f,m=R.getRng(!0),g=[];for(e=m.startContainer,t=m.startOffset,c=e,3==e.nodeType&&((t!=e.nodeValue.length||e.nodeValue===W)&&(l=!0),c=c.parentNode);c;){if(h(c,o,a)){d=c;break}c.nextSibling&&(l=!0),g.push(c),c=c.parentNode}if(d)if(l)n=R.getBookmark(),m.collapse(!0),m=C(m,s(o),!0),m=j.split(m),u(o,a,m),R.moveToBookmark(n);else{for(f=r(),c=f,p=g.length-1;p>=0;p--)c.appendChild(O.clone(g[p],!1)),c=c.firstChild;c.appendChild(O.doc.createTextNode(W)),c=c.firstChild;var v=O.getParent(d,i);v&&O.isEmpty(v)?d.parentNode.replaceChild(f,d):O.insertAfter(f,d),R.setCursorLocation(c,1),O.isEmpty(d)&&O.remove(d)}}function v(){var t;t=d(R.getStart()),t&&!O.isEmpty(t)&&e.walk(t,function(e){1!=e.nodeType||e.id===b||O.isEmpty(e)||O.setAttrib(e,"data-mce-bogus",null)},"childNodes")}var b="_mce_caret",y=t.settings.caret_debug;self._hasCaretEvents||(t.onBeforeGetContent.addToTop(function(){var e,t=[];if(l(d(R.getStart()),t))for(e=t.length;e--;)O.setAttrib(t[e],"data-mce-bogus","1")}),e.each("onMouseUp onKeyUp".split(" "),function(e){t[e].addToTop(function(){f(),v()})}),t.onKeyDown.addToTop(function(e,t){var i=t.keyCode;(8==i||37==i||39==i)&&f(d(R.getStart())),v()}),R.onSetContent.add(v),self._hasCaretEvents=!0),"apply"==n?m():g()}function P(e){var t,i,n,o,a,r=e.startContainer,s=e.startOffset;if(3==r.nodeType&&s>=r.nodeValue.length&&(s=q(r),r=r.parentNode,t=!0),1==r.nodeType)for(o=r.childNodes,r=o[Math.min(s,o.length-1)],i=new L(r,O.getParent(r,O.isBlock)),(s>o.length-1||t)&&i.next(),n=i.current();n;n=i.next())if(3==n.nodeType&&!w(n))return a=O.create("a",null,W),n.parentNode.insertBefore(a,n),e.setStart(n,0),R.setRng(e),O.remove(a),void 0}var M,I,H={},B=e.each,O=t.dom,R=t.selection,L=e.dom.TreeWalker,j=new e.dom.RangeUtils(O),F=t.schema.isValidChild,z=(e.isArray,O.isBlock),$=t.settings.forced_root_block,q=O.nodeIndex,W="",U=/^(src|href|style)$/,V=!1,K=!0,Y=O.getContentEditable,X=function(e){var i;return t.dom.getParent(e,function(e){return i=t.dom.getStyle(e,"text-decoration"),i&&"none"!==i}),i},G=function(e){var i;1===e.nodeType&&e.parentNode&&1===e.parentNode.nodeType&&(i=X(e.parentNode),t.dom.getStyle(e,"color")&&i?t.dom.setStyle(e,"text-decoration",i):t.dom.getStyle(e,"textdecoration")===i&&t.dom.setStyle(e,"text-decoration",null))};e.extend(this,{get:s,register:l,apply:c,remove:u,toggle:d,match:p,matchAll:f,matchNode:h,canApply:m,formatChanged:g}),a(),r()}}(tinymce),tinymce.onAddEditor.add(function(e,t){function i(t,i){e.each(i,function(e,i){e&&r.setStyle(t,i,e)}),r.rename(t,"span")}function n(i,n){r=i.dom,s.convert_fonts_to_spans&&e.each(r.select("font,u,strike",n.node),function(e){o[e.nodeName.toLowerCase()](t.dom,e)})}var o,a,r,s=t.settings;s.inline_styles&&(a=e.explode(s.font_size_legacy_values),o={font:function(e,t){i(t,{backgroundColor:t.style.backgroundColor,color:t.color,fontFamily:t.face,fontSize:a[parseInt(t.size,10)-1]})},u:function(e,t){i(t,{textDecoration:"underline"})},strike:function(e,t){i(t,{textDecoration:"line-through"})}},t.onPreProcess.add(n),t.onSetContent.add(n),t.onInit.add(function(){t.selection.onSetContent.add(n)}))}),function(e){var t=e.dom.TreeWalker;e.EnterKey=function(i){function n(n){function c(e){return e&&o.isBlock(e)&&!/^(TD|TH|CAPTION|FORM)$/.test(e.nodeName)&&!/^(fixed|absolute)/i.test(e.style.position)&&"true"!==o.getContentEditable(e)}function u(t){var i;e.isIE&&!e.isIE11&&o.isBlock(t)&&(i=a.getRng(),t.appendChild(o.create("span",null," ")),a.select(t),t.lastChild.outerHTML="",a.setRng(i))}function d(e){for(var t,i=e,n=[];i=i.firstChild;){if(o.isBlock(i))return;1!=i.nodeType||l[i.nodeName.toLowerCase()]||n.push(i)
82
- }for(t=n.length;t--;)i=n[t],!i.hasChildNodes()||i.firstChild==i.lastChild&&""===i.firstChild.nodeValue?o.remove(i):"A"==i.nodeName&&" "===(i.innerText||i.textContent)&&o.remove(i)}function h(e){var n,r,s,c,u,d,h=e;if(s=o.createRng(),e.hasChildNodes()){for(n=new t(e,e);r=n.current();){if(3==r.nodeType){s.setStart(r,0),s.setEnd(r,0);break}if(l[r.nodeName.toLowerCase()]){s.setStartBefore(r),s.setEndBefore(r);break}h=r,r=n.next()}r||(s.setStart(h,0),s.setEnd(h,0))}else"BR"==e.nodeName?e.nextSibling&&o.isBlock(e.nextSibling)?((!S||9>S)&&(d=o.create("br"),e.parentNode.insertBefore(d,e)),s.setStartBefore(e),s.setEndBefore(e)):(s.setStartAfter(e),s.setEndAfter(e)):(s.setStart(e,0),s.setEnd(e,0));a.setRng(s),o.remove(d),u=o.getViewPort(i.getWin()),c=o.getPos(e).y,(c<u.y||c+25>u.y+u.h)&&i.getWin().scrollTo(0,c<u.y?c:c-u.h+25)}function p(t){var i,n,a,s=k;if(i=t||"TABLE"==M?o.create(t||H):D.cloneNode(!1),a=i,r.keep_styles!==!1)do if(/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(s.nodeName)){if("_mce_caret"==s.id)continue;n=s.cloneNode(!1),o.setAttrib(n,"id",""),i.hasChildNodes()?(n.appendChild(i.firstChild),i.appendChild(n)):(a=n,i.appendChild(n))}while(s=s.parentNode);return(!e.isIE||e.isIE11)&&(a.innerHTML='<br data-mce-bogus="1">'),i}function f(e){var i,n,o;if(3==k.nodeType&&(e?T>0:T<k.nodeValue.length))return!1;if(k.parentNode==D&&B&&!e)return!0;if(e&&1==k.nodeType&&k==D.firstChild)return!0;if("TABLE"===k.nodeName||k.previousSibling&&"TABLE"==k.previousSibling.nodeName)return B&&!e||!B&&e;for(i=new t(k,D),3==k.nodeType&&(e&&0==T?i.prev():e||T!=k.nodeValue.length||i.next());n=i.current();){if(1===n.nodeType){if(!n.getAttribute("data-mce-bogus")&&(o=n.nodeName.toLowerCase(),l[o]&&"br"!==o))return!1}else if(3===n.nodeType&&!/^[ \t\r\n]*$/.test(n.nodeValue))return!1;e?i.prev():i.next()}return!0}function m(e,t){var i,n,a,r,s,l=H||"P";if(n=o.getParent(e,o.isBlock),!n||!c(n)){if(n=n||C,!n.hasChildNodes())return i=o.create(l),n.appendChild(i),O.setStart(i,0),O.setEnd(i,0),i;for(r=e;r.parentNode!=n;)r=r.parentNode;for(;r&&!o.isBlock(r);)a=r,r=r.previousSibling;if(a){for(i=o.create(l),a.parentNode.insertBefore(i,a),r=a;r&&!o.isBlock(r);)s=r.nextSibling,i.appendChild(r),r=s;O.setStart(e,t),O.setEnd(e,t)}}return e}function g(){function e(e){for(var t=P[e?"firstChild":"lastChild"];t&&1!=t.nodeType;)t=t[e?"nextSibling":"previousSibling"];return t===D}N=H?p(H):o.create("BR"),e(!0)&&e()?o.replace(N,P):e(!0)?P.parentNode.insertBefore(N,P):e()?(o.insertAfter(N,P),u(N)):(x=O.cloneRange(),x.setStartAfter(D),x.setEndAfter(P),A=x.extractContents(),o.insertAfter(A,P),o.insertAfter(N,P)),o.remove(D),h(N),s.add()}function v(){for(var e,i=new t(k,D);e=i.next();)if(l[e.nodeName.toLowerCase()]||e.length>0)return!0}function b(){var t,i,n;k&&3==k.nodeType&&T>=k.nodeValue.length&&(e.isIE&&!e.isIE11||v()||(t=o.create("br"),O.insertNode(t),O.setStartAfter(t),O.setEndAfter(t),i=!0)),t=o.create("br"),O.insertNode(t),e.isIE&&!e.isIE11&&"PRE"==M&&(!S||8>S)&&t.parentNode.insertBefore(o.doc.createTextNode("\r"),t),n=o.create("span",{},"&nbsp;"),t.parentNode.insertBefore(n,t),a.scrollIntoView(n),o.remove(n),i?(O.setStartBefore(t),O.setEndBefore(t)):(O.setStartAfter(t),O.setEndAfter(t)),a.setRng(O),s.add()}function y(e){do 3===e.nodeType&&(e.nodeValue=e.nodeValue.replace(/^[\r\n]+/,"")),e=e.firstChild;while(e)}function _(e){var t,i,n=o.getRoot();for(t=e;t!==n&&"false"!==o.getContentEditable(t);)"true"===o.getContentEditable(t)&&(i=t),t=t.parentNode;return t!==n?i:n}function w(t){var i;(!e.isIE||e.isIE11)&&(t.normalize(),i=t.lastChild,(!i||/^(left|right)$/gi.test(o.getStyle(i,"float",!0)))&&o.add(t,"br"))}var x,C,k,T,D,S,E,N,A,P,M,I,H,B,O=a.getRng(!0);if(!O.collapsed)return i.execCommand("Delete"),void 0;if(!n.isDefaultPrevented()&&(k=O.startContainer,T=O.startOffset,H=(r.force_p_newlines?"p":"")||r.forced_root_block,H=H?H.toUpperCase():"",S=o.doc.documentMode,E=n.shiftKey,1==k.nodeType&&k.hasChildNodes()&&(B=T>k.childNodes.length-1,k=k.childNodes[Math.min(T,k.childNodes.length-1)]||k,T=B&&3==k.nodeType?k.nodeValue.length:0),C=_(k))){if(s.beforeChange(),!o.isBlock(C)&&C!=o.getRoot())return(!H||E)&&b(),void 0;if((H&&!E||!H&&E)&&(k=m(k,T)),D=o.getParent(k,o.isBlock),P=D?o.getParent(D.parentNode,o.isBlock):null,M=D?D.nodeName.toUpperCase():"",I=P?P.nodeName.toUpperCase():"","LI"!=I||n.ctrlKey||(D=P,M=I),"LI"==M){if(!H&&E)return b(),void 0;if(o.isEmpty(D))return/^(UL|OL|LI)$/.test(P.parentNode.nodeName)?!1:(g(),void 0)}if("PRE"==M&&r.br_in_pre!==!1){if(!E)return b(),void 0}else if(!H&&!E&&"LI"!=M||H&&E)return b(),void 0;H=H||"P",f()?(N=/^(H[1-6]|PRE)$/.test(M)&&"HGROUP"!=I?p(H):p(),r.end_container_on_empty_block&&c(P)&&o.isEmpty(D)?N=o.split(P,D):o.insertAfter(N,D),h(N)):f(!0)?(N=D.parentNode.insertBefore(p(),D),u(N)):(x=O.cloneRange(),x.setEndAfter(D),A=x.extractContents(),y(A),N=A.firstChild,o.insertAfter(A,D),d(N),w(D),h(N)),o.setAttrib(N,"id",""),s.add()}}var o=i.dom,a=i.selection,r=i.settings,s=i.undoManager,l=i.schema.getNonEmptyElements();i.onKeyDown.add(function(e,t){13==t.keyCode&&n(t)!==!1&&t.preventDefault()})}}(tinymce),function(){var e,t,i,n,o,a,r;window.wagn||(window.wagn={}),$.extend(wagn,{editorContentFunctionMap:{".tinymce-textarea":function(){return tinyMCE.get(this[0].id).getContent()},".pointer-select":function(){return o(this.val())},".pointer-multiselect":function(){return o(this.val())},".pointer-radio-list":function(){return o(this.find("input:checked").val())},".pointer-list-ul":function(){return o(this.find("input").map(function(){return $(this).val()}))},".pointer-checkbox-list":function(){return o(this.find("input:checked").map(function(){return $(this).val()}))},".perm-editor":function(){return n(this)},".wikirate-topic-tree":function(){return o(this.find(".jstree-clicked").map(function(){return $.trim($(this).text())}))}},editorInitFunctionMap:{".date-editor":function(){return this.datepicker({dateFormat:"yy-mm-dd"})},textarea:function(){return $(this).autosize()},".tinymce-textarea":function(){return wagn.initTinyMCE(this[0].id)},".pointer-list-editor":function(){return this.sortable(),wagn.initPointerList(this.find("input"))},".file-upload":function(){return this.fileupload({add:wagn.chooseFile})},".etherpad-textarea":function(){return $(this).closest("form").find(".edit-submit-button").attr("class","etherpad-submit-button")},".wikirate-topic-tree":function(){return $(this).jstree({plugins:["themes","html_data","ui","crrm"],ui:{select_multiple_modifier:"on",initially_select:$(this).closest(".editor").find(".initial-content").text().split("|"),selected_parent_close:!1},themes:{icons:!1}})}},initPointerList:function(e){var t;return t=e.closest("ul").attr("options-card"),e.autocomplete({source:wagn.prepUrl(wagn.rootPath+"/"+t+".json?view=name_complete")})},setTinyMCEConfig:function(e){var t;return t=function(){try{return $.parseJSON(e)}catch(t){return{}}},wagn.tinyMCEConfig=t()},initTinyMCE:function(e){var t,i,n;return t={plugins:"autoresize",autoresize_max_height:500},n=null!=wagn.tinyMCEConfig?wagn.tinyMCEConfig:{},i={mode:"exact",elements:e,content_css:wagn.cssPath,entity_encoding:"raw"},$.extend(t,n,i),tinyMCE.init(t)},chooseFile:function(e,t){var i,n,o,a;return o=t.files[0],$(this).closest("form").data("file-data",t),(a=$(this).slot().find(".name-editor input"))&&a[0]&&""===a.val()&&a.val(o.name.replace(/\..*$/,"").replace(/_/g," ")),n=$(this).closest(".card-editor"),n.find(".choose-file").hide(),n.find(".chosen-filename").text(o.name),n.find(".chosen-file").show(),i=this.name.replace(/attach\]$/,"content]"),n.append('<input type="hidden" value="CHOSEN" class="upload-card-content" name="'+i+'">')},openMenu:function(e,t){var i,n;return n=$(e),i=n.data("menu"),null==i&&(i=wagn.generateMenu(n.slot(),n.data("menu-vars")),n.data("menu",i),i.menu({position:{my:"right top",at:"left-2 top-3"},icons:{submenu:"ui-icon-carat-1-w"}})),t&&i.addClass("card-menu-tappable"),i.show(),i.position({my:"right top",at:"right+2 top+2",of:e})},closeMenu:function(e){return $(e).hide(),$(e).menu("collapseAll",null,!0)},generateMenu:function(e,t){var i,n,o;return o=$.extend(!0,{},wagn.menu_template),i=wagn.generateMenuItems(o,t),n=$('<ul class="card-menu">'+i.join("\n")+"</ul>"),e.append(n),n},generateMenuItems:function(e,t){var i;return i=[],$.each(e,function(e,n){var o,a,r,s;return n["if"]&&!t[n["if"]]?!0:(n.text&&(n.text=n.text.replace(/\%\{([^}]*)\}/,function(e,i){return t[i]}),n.text=$("<div/>").text(n.text).html()),o=n.link?t[n.link]:n.plain?"<a>"+n.plain+"</a>":n.page?(r=t[n.page]||n.page,s=n.text||r,'<a href="'+wagn.rootPath+"/"+wagn.linkname(r)+'">'+s+" &crarr;</a>"):wagn.generateStandardMenuItem(n,t),o?(n.list&&(a=wagn.generateListTemplate(n.list,t))&&a.length>0&&(n.sub=a),n.sub&&(o+="<ul>"+wagn.generateMenuItems(n.sub,t).join("\n")+"</ul>"),i.push("<li>"+o+"</li>")):void 0)}),i},linkname:function(e){return e.replace(/[^\w\*\+]/g," ").replace(/\s+/g,"_")},generateListTemplate:function(e,t){var i,n;return i=[],(n=t[e.name])&&$.each(n,function(t,n){var o;return o=$.extend({},e.template),$.map(o,function(e,t){return o[t]=n[o[t]]||o[t]}),i.push(o)}),e.append&&(i=i.concat(e.append)),i},generateStandardMenuItem:function(e,t){var i,n,o,a;return i=wagn.linkname(t.self),n=e.path_opts||{},e.related&&(e.view="related",n.related="object"==typeof e.related?$.extend({},e.related,{name:t[e.related.name]}):(e.text||(e.text=e.related),{name:"+*"+e.related})),e.view?("home"!==e.view&&(n.view=e.view),o=wagn.rootPath+"/"+i,$.isEmptyObject(n)||(o+="?"+$.param(n)),a=e.text||e.view,'<a href="'+o+'" data-remote="true" class="slotter">'+a+"</a>"):void 0}}),$(window).ready(function(){var i;return $("body").on("click",".cancel-upload",function(){var e,t;return t=$(this).closest(".card-editor"),t.find(".chosen-file").hide(),t.find(".choose-file").show(),$(this).closest("form").data("file-data",null),e=t.find(".upload-card-content").remove()}),$(".navbox").autocomplete({html:"html",source:e,select:t}),$("body").on("mouseenter",".card-menu-link",function(){return wagn.openMenu(this,!1)}),$("body").on("mouseleave",".card-menu",function(){return wagn.closeMenu(this)}),$(document).on("tap",".card-header",function(e){var t;return t=$(this).find(".card-menu-link"),!t[0]||t.data("menu")||e.pageX-$(this).offset().left<$(this).width()/2?void 0:(wagn.openMenu(t,!0),e.preventDefault())}),$(document).on("tap","body",function(e){return $(e.target).closest(".card-header")[0]||$(e.target).closest(".card-menu-link")[0]?void 0:$(".card-menu").hide()}),$(document).on("tap",".ui-menu-icon",function(e){return $(this).closest("li").trigger("mouseenter"),e.preventDefault()}),$("body").on("click",".pointer-item-add",function(e){var t,i,n;return i=$(this).closest(".content-editor").find(".pointer-li:last"),n=i.clone(),t=n.find("input"),t.val(""),i.after(n),wagn.initPointerList(t),e.preventDefault()}),$("body").on("click",".pointer-item-delete",function(){var e;return e=$(this).closest("li"),e.closest("ul").find(".pointer-li").length>1?e.remove():e.find("input").val(""),event.preventDefault()}),$("body").on("click",".perm-vals input",function(){return $(this).slot().find("#inherit").attr("checked",!1)}),$("body").on("click",".perm-editor #inherit",function(){var e;return e=$(this).slot(),e.find(".perm-group input:checked").attr("checked",!1),e.find(".perm-indiv input").val("")}),$("body").on("click",".rule-submit-button",function(){var e;return e=$(this).closest("form"),e.find(".set-editor input:checked").val()?!0:(e.find(".set-editor").addClass("attention"),$(this).notify("To what Set of cards does this Rule apply?"),!1)}),$("body").on("click",".etherpad-submit-button",function(){var e,t;return wagn.padform=$(this).closest("form"),e=$(wagn.padform).find("iframe")[0].src,-1!==(t=e.indexOf("?"))&&(e=e.slice(0,t)),$.get(e+"/export/html",function(e){return $(wagn.padform).find(".etherpad-textarea")[0].value=e,$(wagn.padform)[0].submit()}),!1}),$("body").on("click",".shade-view h1",function(){var e;return e=$(this).slot().find(".shade-content").is(":hidden"),r($(this).closest(".pointer-list").find(".shade-content:visible").parent()),e?r($(this).slot()):void 0}),(i=$(".shade-view h1")[0])&&$(i).trigger("click"),$("body").on("mouseenter","#wikirate-nav > a",function(){var e,t;return t=$(this).find("ul"),t[0]?t.css("display","inline-block"):(e=$(this),$.ajax(e.attr("href"),{data:{view:"navdrop",layout:"none",index:$("#wikirate-nav > a").index(e)},success:function(t){return wagn.d=t,e.prepend($(t).menu())}}))}),$("body").on("mouseleave","#wikirate-nav ul",function(){return $(this).hide()}),$("body").on("change",".go-to-selected select",function(){var e;return e=$(this).val(),""!==e?window.location=wagn.rootPath+escape(e):void 0})}),$(document).bind("mobileinit",function(){return $.mobile.autoInitializePage=!1,$.mobile.ajaxEnabled=!1}),r=function(e){return e.find(".shade-content").slideToggle(1e3),e.find(".ui-icon").toggleClass("ui-icon-triangle-1-e ui-icon-triangle-1-s")},n=function(e){var t,i;return e.find("#inherit").attr("checked")?"_left":(t=e.find(".perm-group input:checked").map(function(){return $(this).val()}),i=e.find(".perm-indiv input").map(function(){return $(this).val()}),o($.makeArray(t).concat($.makeArray(i))))},o=function(e){var t;return t=$.map($.makeArray(e),function(e){return e?"[["+e+"]]":void 0}),$.makeArray(t).join("\n")},a=0,e=function(e,t){var n,o;return n=this.element.closest("form"),o=n.serialize()+"&view=complete",this.xhr=$.ajax({url:wagn.prepUrl(wagn.rootPath+"/:search.json"),data:o,dataType:"json",wagReq:++a,success:function(n){return this.wagReq===a?t(i(e.term,n)):void 0},error:function(){return this.wagReq===a?t([]):void 0}})},i=function(e,t){var i;return i=[],$.each(["search","add","new"],function(n,o){var a,r;return(r=t[o])?(a={value:e,prefix:o,icon:"plus",label:'<strong class="highlight">'+e+"</strong>"},"search"===o?(a.icon=o,a.term=e):"add"===o?a.href="/card/new?card[name]="+encodeURIComponent(r):"new"===o&&(a.type="add",a.href="/new/"+r[1]),i.push(a)):void 0}),$.each(t["goto"],function(e,t){return i.push({icon:"arrowreturnthick-1-e",prefix:"go to",value:t[0],label:t[1],href:"/"+t[2]})}),$.each(i,function(e,t){return t.label='<span class="navbox-item-label"><a class="ui-icon ui-icon-'+t.icon+'"></a>'+t.prefix+':</span> <span class="navbox-item-value">'+t.label+"</span>"}),i},t=function(e,t){return t.item.term?$(this).closest("form").submit():window.location=wagn.rootPath+t.item.href,$(this).attr("disabled","disabled")}}.call(this),function(){var e,t,i;$.extend(wagn,{initializeEditors:function(e,t){return null==t&&(t=wagn.editorInitFunctionMap),$.each(t,function(t,i){return $.each(e.find(t),function(){return i.call($(this))})})},prepUrl:function(e,t){var i,n,o;return o={},i=$("#main").children(".card-slot").data("cardName"),null!=i&&(o.main=i),t&&(t.isMain()&&(o.is_main=!0),n=t.data("slot"),null!=n&&wagn.slotParams(n,o,"slot")),e+((e.match(/\?/)?"&":"?")+$.param(o))},slotParams:function(e,i,n){return $.each(e,function(e,o){var a;return a=n+"["+t(e)+"]","items"===e?wagn.slotParams(o,i,a):i[a]=o})},pingName:function(e,t){return $.getJSON(wagn.rootPath+"/",{format:"json",view:"status","card[name]":e},t)}}),jQuery.fn.extend({slot:function(){return this.closest(".card-slot")},setSlotContent:function(e){var t,i,n;return t=this.slot(),n=$(e),n[0]?(i=t.attr("data-slot"))&&null!=i&&n.attr("data-slot",i):n=e,t.replaceWith(n),n},notify:function(e){var t,i,n;return n=this.slot(),i=n.find(".card-notice"),i[0]||(i=$('<div class="card-notice"></div>'),t=n.find(".card-form"),t[0]?$(t[0]).append(i):n.append(i)),i.html(e),i.show("blind")},report:function(e){var t;return t=this.slot().find(".card-report"),t[0]?(t.hide(),t.html(e),t.show("drop",750),setTimeout(function(){return t.hide("drop",750)},3e3)):!1},isMain:function(){return this.slot().parent("#main")[0]},loadCaptcha:function(){return Recaptcha.create(wagn.recaptchaKey,this[0])},autosave:function(){var e,t,i,n;if(n=this.slot(),!this.attr("no-autosave")){if(t=this.closest("fieldset"),t[0]){if(!(e=t.data("cardId")))return;i=": "+t.data("cardName")}else e=n.data("cardId"),i="";return $.ajax(wagn.rootPath+"/card/save_draft/~"+e,{data:{"card[content]":this.val()},type:"POST",success:function(){return n.report("draft saved"+i)}})}},setContentFieldsFromMap:function(e){var t;return null==e&&(e=wagn.editorContentFunctionMap),t=$(this),$.each(e,function(e,i){return t.setContentFields(e,i)})},setContentFields:function(e,t){return $.each(this.find(e),function(){return $(this).setContentField(t)})},setContentField:function(e){var t,i,n;return t=this.closest(".card-editor").find(".card-content"),i=t.val(),n=e.call(this),t.val(n),i!==n?t.change():void 0}}),setInterval(function(){return $(".card-form").setContentFieldsFromMap()},2e4),$(window).ready(function(){return $.ajaxSetup({cache:!1}),setTimeout(function(){return wagn.initializeEditors($("body"))},10),$("body").on("ajax:success",".slotter",function(e,t){var i,n;return t.redirect?window.location=t.redirect:(n=$(this).attr("notify-success"),i=$(this).setSlotContent(t),i.jquery&&(wagn.initializeEditors(i),null!=n)?i.notify(n):void 0)}),$("body").on("ajax:error",".slotter",function(e,t){var i,n;return i=t.responseText,403===t.status?$(this).setSlotContent(i):($(this).notify(i),n=$(this).slot(),409===t.status?n.find(".current_revision_id").val(n.find(".new-current-revision-id").text()):449===t.status?n.find(".recaptcha-box").loadCaptcha():void 0)}),$("body").on("click","button.slotter",function(){return $.rails.allowAction($(this))?$.rails.handleRemote($(this)):!1}),$("body").on("ajax:beforeSend",".slotter",function(t,i,n){var o,a,r,s,l;if(!n.skip_before_send&&(n.url.match(/home_view/)||(n.url=wagn.prepUrl(n.url,$(this).slot())),$(this).is("form"))){if(wagn.recaptchaKey&&"on"===$(this).attr("recaptcha")&&!$(this).find(".recaptcha-box")[0])return e(this),!1;if(a=$(this).data("file-data"))return s=$(this).find(".file-upload"),s[1]?($(this).notify("Wagn does not yet support multiple files in a single form."),!1):(l=s.data("fileupload"),l._isXHRUpload(l.options)||($(this).find("[name=success]").val("_self"),n.url+="&simulate_xhr=true",r=function(e){return e.find("body").html()},n.dataFilter=r),o=$.extend(n,l._getAJAXSettings(a),{url:n.url}),o.skip_before_send=!0,$.ajax(o),!1)}}),$("body").on("submit",".card-form",function(){return $(this).setContentFieldsFromMap(),$(this).find(".card-content").attr("no-autosave","true"),!0}),$("body").on("click",".submitter",function(){return $(this).closest("form").submit()}),$("body").on("click",".renamer-updater",function(){return $(this).closest("form").find(".update_referencers").val("true")}),$("body").on("submit",".card-name-form",function(){var e;return e=$(this).find(".confirm-rename"),e.is(":hidden")?($(this).find("#referers").val()>0&&$(this).find(".renamer-updater").show(),e.show("blind"),!1):void 0}),$("body").on("click","button.redirecter",function(){return window.location=$(this).attr("href")}),wagn.noDoubleClick||$("body").on("dblclick",".card-slot",function(){var e;return e=$(this),e.find(".card-editor")[0]?!1:e.closest(".card-header")[0]?!1:e.data("cardId")?(e.addClass("slotter"),e.attr("href",wagn.rootPath+"/card/edit/~"+e.data("cardId")),$.rails.handleRemote(e),!1):!1}),$("body").on("dblclick",".nodblclick",function(){return!1}),$("body").on("submit","form.slotter",function(){var e,t;return(t=$(this).attr("main-success"))&&$(this).isMain()&&(e=$(this).find("[name=success]"),e&&!e.val().match(/^REDIRECT/))?e.val("REDIRECT"===t?t+": "+e.val():t):void 0}),$(".card-slot").on("click",".standard-delete",function(){var e;if("true"!==$(this).attr("success-ready"))return e=$(this).isMain()?"REDIRECT: *previous":"TEXT:"+$(this).slot().data("cardName")+" removed",$(this).attr("href",$(this).attr("href")+"?success="+encodeURIComponent(e)),$(this).attr("success-ready","true")}),$("body").on("change",".live-type-field",function(){return $(this).data("params",$(this).closest("form").serialize()),$(this).data("url",$(this).attr("href"))}),$("body").on("change",".edit-type-field",function(){return $(this).closest("form").submit()}),$("body").on("change",".autosave .card-content",function(){var e;return e=$(this),setTimeout(function(){return e.autosave()},500)}),$("body").on("mouseenter","[hover_content]",function(){return $(this).attr("hover_restore",$(this).html()),$(this).html($(this).attr("hover_content"))}),$("body").on("mouseleave","[hover_content]",function(){return $(this).html($(this).attr("hover_restore"))}),$("body").on("keyup",".name-editor input",function(){var e,t;return e=$(this),t=e.val(),wagn.pingName(t,function(i){var n,o,a,r,s,l,c;return e.val()!==t?null:(c=i.status,c?(n=e.parent(),o=e.closest("fieldset").find("legend"),r=o.find(".name-messages"),r[0]||(r=$('<span class="name-messages"></span>'),o.append(r)),n.removeClass("real-name virtual-name known-name"),l=e.slot().data("cardId"),"unknown"===c||l&&parseInt(l)===i.id?r.html(""):(n.addClass(c+"-name known-name"),a=s="virtual"===c?"in virtual":"already in",r.html('"<a href="'+wagn.rootPath+"/"+i.url_key+'">'+t+'</a>" '+s+" use"))):void 0)})}),$("body").on("click",".render-error-link",function(e){var t;return t=$(this).closest(".render-error").find(".render-error-message"),t.show(),e.preventDefault()})}),e=function(e){var t,i;return i="https://www.google.com/recaptcha/api/js/recaptcha_ajax.js",t=$('<div class="recaptcha-box"></div>'),$(e).children().last().after(t),$.getScript(i,function(){return t.loadCaptcha()})},t=function(e){return e.replace(/([a-z])([A-Z])/g,function(e){return e[0]+"_"+e[1].toLowerCase()})},i=function(e){return"undefined"!=typeof console&&null!==console?console.log(e):void 0}}.call(this),wagn.menu_template=[{text:"edit",view:"edit","if":"edit",sub:[{text:"content",view:"edit"},{text:"name",view:"edit_name"},{text:"type: %{type}",view:"edit_type"},{text:"structure",related:{name:"structure",view:"edit"},"if":"structure"},{link:"delete","if":"delete"}]},{text:"view",view:"home",sub:[{text:"refresh",view:"home"},{text:"page",page:"self"},{text:"type: %{type}",page:"type"},{text:"history",view:"history","if":"edit"},{text:"structure",related:{name:"structure"},"if":"structure"}]},{text:"discuss",related:{name:"+discussion"},"if":"discuss"},{text:"advanced",view:"options",sub:[{text:"rules",view:"options",list:{name:"related_sets",template:{view:"options",text:"text",path_opts:"path_opts"}}},{plain:"related",list:{name:"piecenames",template:{page:"item"},append:[{related:"children","if":"creator"},{related:"mates"}]}},{related:"referred to by","if":"creator",sub:[{text:"all",related:"referred to by"},{text:"links",related:"linked to by"},{text:"inclusions",related:"included by"}]},{related:"refers to","if":"creator",sub:[{text:"all",related:"refers to"},{text:"links",related:"links to"},{text:"inclusions",related:"includes"}]},{related:"editors","if":"creator",sub:[{text:"all editors",related:"editors"},{text:"creator: %{creator}",page:"creator"},{text:"last editor: %{updater}",page:"updater"}]}]},{link:"watch","if":"watch"},{view:"account","if":"account",sub:[{view:"account",text:"details"},{related:"roles"},{related:"created"},{related:"edited"}]}],/*
82
+ }for(t=n.length;t--;)i=n[t],!i.hasChildNodes()||i.firstChild==i.lastChild&&""===i.firstChild.nodeValue?o.remove(i):"A"==i.nodeName&&" "===(i.innerText||i.textContent)&&o.remove(i)}function h(e){var n,r,s,c,u,d,h=e;if(s=o.createRng(),e.hasChildNodes()){for(n=new t(e,e);r=n.current();){if(3==r.nodeType){s.setStart(r,0),s.setEnd(r,0);break}if(l[r.nodeName.toLowerCase()]){s.setStartBefore(r),s.setEndBefore(r);break}h=r,r=n.next()}r||(s.setStart(h,0),s.setEnd(h,0))}else"BR"==e.nodeName?e.nextSibling&&o.isBlock(e.nextSibling)?((!S||9>S)&&(d=o.create("br"),e.parentNode.insertBefore(d,e)),s.setStartBefore(e),s.setEndBefore(e)):(s.setStartAfter(e),s.setEndAfter(e)):(s.setStart(e,0),s.setEnd(e,0));a.setRng(s),o.remove(d),u=o.getViewPort(i.getWin()),c=o.getPos(e).y,(c<u.y||c+25>u.y+u.h)&&i.getWin().scrollTo(0,c<u.y?c:c-u.h+25)}function p(t){var i,n,a,s=k;if(i=t||"TABLE"==M?o.create(t||H):D.cloneNode(!1),a=i,r.keep_styles!==!1)do if(/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(s.nodeName)){if("_mce_caret"==s.id)continue;n=s.cloneNode(!1),o.setAttrib(n,"id",""),i.hasChildNodes()?(n.appendChild(i.firstChild),i.appendChild(n)):(a=n,i.appendChild(n))}while(s=s.parentNode);return(!e.isIE||e.isIE11)&&(a.innerHTML='<br data-mce-bogus="1">'),i}function f(e){var i,n,o;if(3==k.nodeType&&(e?T>0:T<k.nodeValue.length))return!1;if(k.parentNode==D&&B&&!e)return!0;if(e&&1==k.nodeType&&k==D.firstChild)return!0;if("TABLE"===k.nodeName||k.previousSibling&&"TABLE"==k.previousSibling.nodeName)return B&&!e||!B&&e;for(i=new t(k,D),3==k.nodeType&&(e&&0==T?i.prev():e||T!=k.nodeValue.length||i.next());n=i.current();){if(1===n.nodeType){if(!n.getAttribute("data-mce-bogus")&&(o=n.nodeName.toLowerCase(),l[o]&&"br"!==o))return!1}else if(3===n.nodeType&&!/^[ \t\r\n]*$/.test(n.nodeValue))return!1;e?i.prev():i.next()}return!0}function m(e,t){var i,n,a,r,s,l=H||"P";if(n=o.getParent(e,o.isBlock),!n||!c(n)){if(n=n||C,!n.hasChildNodes())return i=o.create(l),n.appendChild(i),O.setStart(i,0),O.setEnd(i,0),i;for(r=e;r.parentNode!=n;)r=r.parentNode;for(;r&&!o.isBlock(r);)a=r,r=r.previousSibling;if(a){for(i=o.create(l),a.parentNode.insertBefore(i,a),r=a;r&&!o.isBlock(r);)s=r.nextSibling,i.appendChild(r),r=s;O.setStart(e,t),O.setEnd(e,t)}}return e}function g(){function e(e){for(var t=P[e?"firstChild":"lastChild"];t&&1!=t.nodeType;)t=t[e?"nextSibling":"previousSibling"];return t===D}N=H?p(H):o.create("BR"),e(!0)&&e()?o.replace(N,P):e(!0)?P.parentNode.insertBefore(N,P):e()?(o.insertAfter(N,P),u(N)):(x=O.cloneRange(),x.setStartAfter(D),x.setEndAfter(P),A=x.extractContents(),o.insertAfter(A,P),o.insertAfter(N,P)),o.remove(D),h(N),s.add()}function v(){for(var e,i=new t(k,D);e=i.next();)if(l[e.nodeName.toLowerCase()]||e.length>0)return!0}function b(){var t,i,n;k&&3==k.nodeType&&T>=k.nodeValue.length&&(e.isIE&&!e.isIE11||v()||(t=o.create("br"),O.insertNode(t),O.setStartAfter(t),O.setEndAfter(t),i=!0)),t=o.create("br"),O.insertNode(t),e.isIE&&!e.isIE11&&"PRE"==M&&(!S||8>S)&&t.parentNode.insertBefore(o.doc.createTextNode("\r"),t),n=o.create("span",{},"&nbsp;"),t.parentNode.insertBefore(n,t),a.scrollIntoView(n),o.remove(n),i?(O.setStartBefore(t),O.setEndBefore(t)):(O.setStartAfter(t),O.setEndAfter(t)),a.setRng(O),s.add()}function y(e){do 3===e.nodeType&&(e.nodeValue=e.nodeValue.replace(/^[\r\n]+/,"")),e=e.firstChild;while(e)}function _(e){var t,i,n=o.getRoot();for(t=e;t!==n&&"false"!==o.getContentEditable(t);)"true"===o.getContentEditable(t)&&(i=t),t=t.parentNode;return t!==n?i:n}function w(t){var i;(!e.isIE||e.isIE11)&&(t.normalize(),i=t.lastChild,(!i||/^(left|right)$/gi.test(o.getStyle(i,"float",!0)))&&o.add(t,"br"))}var x,C,k,T,D,S,E,N,A,P,M,I,H,B,O=a.getRng(!0);if(!O.collapsed)return i.execCommand("Delete"),void 0;if(!n.isDefaultPrevented()&&(k=O.startContainer,T=O.startOffset,H=(r.force_p_newlines?"p":"")||r.forced_root_block,H=H?H.toUpperCase():"",S=o.doc.documentMode,E=n.shiftKey,1==k.nodeType&&k.hasChildNodes()&&(B=T>k.childNodes.length-1,k=k.childNodes[Math.min(T,k.childNodes.length-1)]||k,T=B&&3==k.nodeType?k.nodeValue.length:0),C=_(k))){if(s.beforeChange(),!o.isBlock(C)&&C!=o.getRoot())return(!H||E)&&b(),void 0;if((H&&!E||!H&&E)&&(k=m(k,T)),D=o.getParent(k,o.isBlock),P=D?o.getParent(D.parentNode,o.isBlock):null,M=D?D.nodeName.toUpperCase():"",I=P?P.nodeName.toUpperCase():"","LI"!=I||n.ctrlKey||(D=P,M=I),"LI"==M){if(!H&&E)return b(),void 0;if(o.isEmpty(D))return/^(UL|OL|LI)$/.test(P.parentNode.nodeName)?!1:(g(),void 0)}if("PRE"==M&&r.br_in_pre!==!1){if(!E)return b(),void 0}else if(!H&&!E&&"LI"!=M||H&&E)return b(),void 0;H=H||"P",f()?(N=/^(H[1-6]|PRE)$/.test(M)&&"HGROUP"!=I?p(H):p(),r.end_container_on_empty_block&&c(P)&&o.isEmpty(D)?N=o.split(P,D):o.insertAfter(N,D),h(N)):f(!0)?(N=D.parentNode.insertBefore(p(),D),u(N)):(x=O.cloneRange(),x.setEndAfter(D),A=x.extractContents(),y(A),N=A.firstChild,o.insertAfter(A,D),d(N),w(D),h(N)),o.setAttrib(N,"id",""),s.add()}}var o=i.dom,a=i.selection,r=i.settings,s=i.undoManager,l=i.schema.getNonEmptyElements();i.onKeyDown.add(function(e,t){13==t.keyCode&&n(t)!==!1&&t.preventDefault()})}}(tinymce),function(){var e,t,i,n,o,a,r;window.wagn||(window.wagn={}),$.extend(wagn,{editorContentFunctionMap:{".tinymce-textarea":function(){return tinyMCE.get(this[0].id).getContent()},".pointer-select":function(){return o(this.val())},".pointer-multiselect":function(){return o(this.val())},".pointer-radio-list":function(){return o(this.find("input:checked").val())},".pointer-list-ul":function(){return o(this.find("input").map(function(){return $(this).val()}))},".pointer-checkbox-list":function(){return o(this.find("input:checked").map(function(){return $(this).val()}))},".perm-editor":function(){return n(this)},".wikirate-topic-tree":function(){return o(this.find(".jstree-clicked").map(function(){return $.trim($(this).text())}))}},editorInitFunctionMap:{".date-editor":function(){return this.datepicker({dateFormat:"yy-mm-dd"})},textarea:function(){return $(this).autosize()},".tinymce-textarea":function(){return wagn.initTinyMCE(this[0].id)},".pointer-list-editor":function(){return this.sortable(),wagn.initPointerList(this.find("input"))},".file-upload":function(){return this.fileupload({add:wagn.chooseFile})},".etherpad-textarea":function(){return $(this).closest("form").find(".edit-submit-button").attr("class","etherpad-submit-button")},".wikirate-topic-tree":function(){return $(this).jstree({plugins:["themes","html_data","ui","crrm"],ui:{select_multiple_modifier:"on",initially_select:$(this).closest(".editor").find(".initial-content").text().split("|"),selected_parent_close:!1},themes:{icons:!1}})}},initPointerList:function(e){var t;return t=e.closest("ul").attr("options-card"),e.autocomplete({source:wagn.prepUrl(wagn.rootPath+"/"+t+".json?view=name_complete")})},setTinyMCEConfig:function(e){var t;return t=function(){try{return $.parseJSON(e)}catch(t){return{}}},wagn.tinyMCEConfig=t()},initTinyMCE:function(e){var t,i,n;return t={plugins:"autoresize",autoresize_max_height:500},n=null!=wagn.tinyMCEConfig?wagn.tinyMCEConfig:{},i={mode:"exact",elements:e,content_css:wagn.cssPath,entity_encoding:"raw"},$.extend(t,n,i),tinyMCE.init(t)},chooseFile:function(e,t){var i,n,o,a;return o=t.files[0],$(this).closest("form").data("file-data",t),(a=$(this).slot().find(".name-editor input"))&&a[0]&&""===a.val()&&a.val(o.name.replace(/\..*$/,"").replace(/_/g," ")),n=$(this).closest(".card-editor"),n.find(".choose-file").hide(),n.find(".chosen-filename").text(o.name),n.find(".chosen-file").show(),i=this.name.replace(/attach\]$/,"content]"),n.append('<input type="hidden" value="CHOSEN" class="upload-card-content" name="'+i+'">')},openMenu:function(e,t){var i,n;return n=$(e),i=n.data("menu"),null==i&&(i=wagn.generateMenu(n.slot(),n.data("menu-vars")),n.data("menu",i),i.menu({position:{my:"right top",at:"left-2 top-3"},icons:{submenu:"ui-icon-carat-1-w"}})),t&&i.addClass("card-menu-tappable"),i.show(),i.position({my:"right top",at:"right+2 top+2",of:e})},closeMenu:function(e){return $(e).hide(),$(e).menu("collapseAll",null,!0)},generateMenu:function(e,t){var i,n,o;return o=$.extend(!0,{},wagn.menu_template),i=wagn.generateMenuItems(o,t),n=$('<ul class="card-menu">'+i.join("\n")+"</ul>"),e.append(n),n},generateMenuItems:function(e,t){var i;return i=[],$.each(e,function(e,n){var o,a,r,s;return n["if"]&&!t[n["if"]]?!0:(n.text&&(n.text=n.text.replace(/\%\{([^}]*)\}/,function(e,i){return t[i]}),n.text=$("<div/>").text(n.text).html()),o=n.link?t[n.link]:n.plain?"<a>"+n.plain+"</a>":n.page?(r=t[n.page]||n.page,s=n.text||r,'<a href="'+wagn.rootPath+"/"+wagn.linkname(r)+'">'+s+" &crarr;</a>"):wagn.generateStandardMenuItem(n,t),o?(n.list&&(a=wagn.generateListTemplate(n.list,t))&&a.length>0&&(n.sub=a),n.sub&&(o+="<ul>"+wagn.generateMenuItems(n.sub,t).join("\n")+"</ul>"),i.push("<li>"+o+"</li>")):void 0)}),i},linkname:function(e){return e.replace(/[^\w\*\+]/g," ").replace(/\s+/g,"_")},generateListTemplate:function(e,t){var i,n;return i=[],(n=t[e.name])&&$.each(n,function(t,n){var o;return o=$.extend({},e.template),$.map(o,function(e,t){return o[t]=n[o[t]]||o[t]}),i.push(o)}),e.append&&(i=i.concat(e.append)),i},generateStandardMenuItem:function(e,t){var i,n,o,a;return i=wagn.linkname(t.self),n=e.path_opts||{},e.related&&(e.view="related",n.related="object"==typeof e.related?$.extend({},e.related,{name:t[e.related.name]}):(e.text||(e.text=e.related),{name:"+*"+e.related})),e.view?("home"!==e.view&&(n.view=e.view),o=wagn.rootPath+"/"+i,$.isEmptyObject(n)||(o+="?"+$.param(n)),a=e.text||e.view,'<a href="'+o+'" data-remote="true" class="slotter">'+a+"</a>"):void 0}}),$(window).ready(function(){var i;return $("body").on("click",".cancel-upload",function(){var e,t;return t=$(this).closest(".card-editor"),t.find(".chosen-file").hide(),t.find(".choose-file").show(),$(this).closest("form").data("file-data",null),e=t.find(".upload-card-content").remove()}),$(".navbox").autocomplete({html:"html",source:e,select:t}),$("body").on("mouseenter",".card-menu-link",function(){return wagn.openMenu(this,!1)}),$("body").on("mouseleave",".card-menu",function(){return wagn.closeMenu(this)}),$(document).on("tap",".card-header",function(e){var t;return t=$(this).find(".card-menu-link"),!t[0]||t.data("menu")||e.pageX-$(this).offset().left<$(this).width()/2?void 0:(wagn.openMenu(t,!0),e.preventDefault())}),$(document).on("tap","body",function(e){return $(e.target).closest(".card-header")[0]||$(e.target).closest(".card-menu-link")[0]?void 0:$(".card-menu").hide()}),$(document).on("tap",".ui-menu-icon",function(e){return $(this).closest("li").trigger("mouseenter"),e.preventDefault()}),$("body").on("click",".pointer-item-add",function(e){var t,i,n;return i=$(this).closest(".content-editor").find(".pointer-li:last"),n=i.clone(),t=n.find("input"),t.val(""),i.after(n),wagn.initPointerList(t),e.preventDefault()}),$("body").on("click",".pointer-item-delete",function(){var e;return e=$(this).closest("li"),e.closest("ul").find(".pointer-li").length>1?e.remove():e.find("input").val(""),event.preventDefault()}),$("body").on("click",".perm-vals input",function(){return $(this).slot().find("#inherit").attr("checked",!1)}),$("body").on("click",".perm-editor #inherit",function(){var e;return e=$(this).slot(),e.find(".perm-group input:checked").attr("checked",!1),e.find(".perm-indiv input").val("")}),$("body").on("click",".rule-submit-button",function(){var e;return e=$(this).closest("form"),e.find(".set-editor input:checked").val()?!0:(e.find(".set-editor").addClass("attention"),$(this).notify("To what Set of cards does this Rule apply?"),!1)}),$("body").on("click",".shade-view h1",function(){var e;return e=$(this).slot().find(".shade-content").is(":hidden"),r($(this).closest(".pointer-list").find(".shade-content:visible").parent()),e?r($(this).slot()):void 0}),(i=$(".shade-view h1")[0])&&$(i).trigger("click"),$("body").on("mouseenter","#wikirate-nav > a",function(){var e,t;return t=$(this).find("ul"),t[0]?t.css("display","inline-block"):(e=$(this),$.ajax(e.attr("href"),{data:{view:"navdrop",layout:"none",index:$("#wikirate-nav > a").index(e)},success:function(t){return wagn.d=t,e.prepend($(t).menu())}}))}),$("body").on("mouseleave","#wikirate-nav ul",function(){return $(this).hide()}),$("body").on("change",".go-to-selected select",function(){var e;return e=$(this).val(),""!==e?window.location=wagn.rootPath+escape(e):void 0})}),$(document).bind("mobileinit",function(){return $.mobile.autoInitializePage=!1,$.mobile.ajaxEnabled=!1}),r=function(e){return e.find(".shade-content").slideToggle(1e3),e.find(".ui-icon").toggleClass("ui-icon-triangle-1-e ui-icon-triangle-1-s")},n=function(e){var t,i;return e.find("#inherit").attr("checked")?"_left":(t=e.find(".perm-group input:checked").map(function(){return $(this).val()}),i=e.find(".perm-indiv input").map(function(){return $(this).val()}),o($.makeArray(t).concat($.makeArray(i))))},o=function(e){var t;return t=$.map($.makeArray(e),function(e){return e?"[["+e+"]]":void 0}),$.makeArray(t).join("\n")},a=0,e=function(e,t){var n,o;return n=this.element.closest("form"),o=n.serialize()+"&view=complete",this.xhr=$.ajax({url:wagn.prepUrl(wagn.rootPath+"/:search.json"),data:o,dataType:"json",wagReq:++a,success:function(n){return this.wagReq===a?t(i(e.term,n)):void 0},error:function(){return this.wagReq===a?t([]):void 0}})},i=function(e,t){var i;return i=[],$.each(["search","add","new"],function(n,o){var a,r;return(r=t[o])?(a={value:e,prefix:o,icon:"plus",label:'<strong class="highlight">'+e+"</strong>"},"search"===o?(a.icon=o,a.term=e):"add"===o?a.href="/card/new?card[name]="+encodeURIComponent(r):"new"===o&&(a.type="add",a.href="/new/"+r[1]),i.push(a)):void 0}),$.each(t["goto"],function(e,t){return i.push({icon:"arrowreturnthick-1-e",prefix:"go to",value:t[0],label:t[1],href:"/"+t[2]})}),$.each(i,function(e,t){return t.label='<span class="navbox-item-label"><a class="ui-icon ui-icon-'+t.icon+'"></a>'+t.prefix+':</span> <span class="navbox-item-value">'+t.label+"</span>"}),i},t=function(e,t){return t.item.term?$(this).closest("form").submit():window.location=wagn.rootPath+t.item.href,$(this).attr("disabled","disabled")}}.call(this),function(){var e,t,i;$.extend(wagn,{initializeEditors:function(e,t){return null==t&&(t=wagn.editorInitFunctionMap),$.each(t,function(t,i){return $.each(e.find(t),function(){return i.call($(this))})})},prepUrl:function(e,t){var i,n,o;return o={},i=$("#main").children(".card-slot").data("cardName"),null!=i&&(o.main=i),t&&(t.isMain()&&(o.is_main=!0),n=t.data("slot"),null!=n&&wagn.slotParams(n,o,"slot")),e+((e.match(/\?/)?"&":"?")+$.param(o))},slotParams:function(e,i,n){return $.each(e,function(e,o){var a;return a=n+"["+t(e)+"]","items"===e?wagn.slotParams(o,i,a):i[a]=o})},pingName:function(e,t){return $.getJSON(wagn.rootPath+"/",{format:"json",view:"status","card[name]":e},t)}}),jQuery.fn.extend({slot:function(){return this.closest(".card-slot")},setSlotContent:function(e){var t,i,n;return t=this.slot(),n=$(e),n[0]?(i=t.attr("data-slot"))&&null!=i&&n.attr("data-slot",i):n=e,t.replaceWith(n),n},notify:function(e){var t,i,n;return n=this.slot(),i=n.find(".card-notice"),i[0]||(i=$('<div class="card-notice"></div>'),t=n.find(".card-form"),t[0]?$(t[0]).append(i):n.append(i)),i.html(e),i.show("blind")},report:function(e){var t;return t=this.slot().find(".card-report"),t[0]?(t.hide(),t.html(e),t.show("drop",750),setTimeout(function(){return t.hide("drop",750)},3e3)):!1},isMain:function(){return this.slot().parent("#main")[0]},loadCaptcha:function(){return Recaptcha.create(wagn.recaptchaKey,this[0])},autosave:function(){var e,t,i,n;if(n=this.slot(),!this.attr("no-autosave")){if(t=this.closest("fieldset"),t[0]){if(!(e=t.data("cardId")))return;i=": "+t.data("cardName")}else e=n.data("cardId"),i="";return $.ajax(wagn.rootPath+"/card/save_draft/~"+e,{data:{"card[content]":this.val()},type:"POST",success:function(){return n.report("draft saved"+i)}})}},setContentFieldsFromMap:function(e){var t;return null==e&&(e=wagn.editorContentFunctionMap),t=$(this),$.each(e,function(e,i){return t.setContentFields(e,i)})},setContentFields:function(e,t){return $.each(this.find(e),function(){return $(this).setContentField(t)})},setContentField:function(e){var t,i,n;return t=this.closest(".card-editor").find(".card-content"),i=t.val(),n=e.call(this),t.val(n),i!==n?t.change():void 0}}),setInterval(function(){return $(".card-form").setContentFieldsFromMap()},2e4),$(window).ready(function(){return $.ajaxSetup({cache:!1}),setTimeout(function(){return wagn.initializeEditors($("body"))},10),$("body").on("ajax:success",".slotter",function(e,t){var i,n;return t.redirect?window.location=t.redirect:(n=$(this).attr("notify-success"),i=$(this).setSlotContent(t),i.jquery&&(wagn.initializeEditors(i),null!=n)?i.notify(n):void 0)}),$("body").on("ajax:error",".slotter",function(e,t){var i,n;return i=t.responseText,403===t.status?$(this).setSlotContent(i):($(this).notify(i),n=$(this).slot(),409===t.status?n.find(".current_revision_id").val(n.find(".new-current-revision-id").text()):449===t.status?n.find(".recaptcha-box").loadCaptcha():void 0)}),$("body").on("click","button.slotter",function(){return $.rails.allowAction($(this))?$.rails.handleRemote($(this)):!1}),$("body").on("ajax:beforeSend",".slotter",function(t,i,n){var o,a,r,s,l;if(!n.skip_before_send&&(n.url.match(/home_view/)||(n.url=wagn.prepUrl(n.url,$(this).slot())),$(this).is("form"))){if(wagn.recaptchaKey&&"on"===$(this).attr("recaptcha")&&!$(this).find(".recaptcha-box")[0])return e(this),!1;if(a=$(this).data("file-data"))return s=$(this).find(".file-upload"),s[1]?($(this).notify("Wagn does not yet support multiple files in a single form."),!1):(l=s.data("fileupload"),l._isXHRUpload(l.options)||($(this).find("[name=success]").val("_self"),n.url+="&simulate_xhr=true",r=function(e){return e.find("body").html()},n.dataFilter=r),o=$.extend(n,l._getAJAXSettings(a),{url:n.url}),o.skip_before_send=!0,$.ajax(o),!1)}}),$("body").on("submit",".card-form",function(){return $(this).setContentFieldsFromMap(),$(this).find(".card-content").attr("no-autosave","true"),!0}),$("body").on("click",".submitter",function(){return $(this).closest("form").submit()}),$("body").on("click",".renamer-updater",function(){return $(this).closest("form").find("#card_update_referencers").val("true")}),$("body").on("submit",".edit_name-view .card-form",function(){var e;return e=$(this).find(".confirm_rename-view"),e.is(":hidden")?($(this).find("#referers").val()>0&&$(this).find(".renamer-updater").show(),e.show("blind"),!1):void 0}),$("body").on("click","button.redirecter",function(){return window.location=$(this).attr("href")}),wagn.noDoubleClick||$("body").on("dblclick",".card-slot",function(){var e;return e=$(this),e.find(".card-editor")[0]?!1:e.closest(".card-header")[0]?!1:e.data("cardId")?(e.addClass("slotter"),e.attr("href",wagn.rootPath+"/card/edit/~"+e.data("cardId")),$.rails.handleRemote(e),!1):!1}),$("body").on("dblclick",".nodblclick",function(){return!1}),$("body").on("submit","form.slotter",function(){var e,t;return(t=$(this).attr("main-success"))&&$(this).isMain()&&(e=$(this).find("[name=success]"),e&&!e.val().match(/^REDIRECT/))?e.val("REDIRECT"===t?t+": "+e.val():t):void 0}),$(".card-slot").on("click",".standard-delete",function(){var e;if("true"!==$(this).attr("success-ready"))return e=$(this).isMain()?"REDIRECT: *previous":"TEXT:"+$(this).slot().data("cardName")+" removed",$(this).attr("href",$(this).attr("href")+"?success="+encodeURIComponent(e)),$(this).attr("success-ready","true")}),$("body").on("change",".live-type-field",function(){return $(this).data("params",$(this).closest("form").serialize()),$(this).data("url",$(this).attr("href"))}),$("body").on("change",".edit-type-field",function(){return $(this).closest("form").submit()}),$("body").on("change",".autosave .card-content",function(){var e;return e=$(this),setTimeout(function(){return e.autosave()},500)}),$("body").on("mouseenter","[hover_content]",function(){return $(this).attr("hover_restore",$(this).html()),$(this).html($(this).attr("hover_content"))}),$("body").on("mouseleave","[hover_content]",function(){return $(this).html($(this).attr("hover_restore"))}),$("body").on("keyup",".name-editor input",function(){var e,t;return e=$(this),t=e.val(),wagn.pingName(t,function(i){var n,o,a,r,s,l,c;return e.val()!==t?null:(c=i.status,c?(n=e.parent(),o=e.closest("fieldset").find("legend"),r=o.find(".name-messages"),r[0]||(r=$('<span class="name-messages"></span>'),o.append(r)),n.removeClass("real-name virtual-name known-name"),l=e.slot().data("cardId"),"unknown"===c||l&&parseInt(l)===i.id?r.html(""):(n.addClass(c+"-name known-name"),a=s="virtual"===c?"in virtual":"already in",r.html('"<a href="'+wagn.rootPath+"/"+i.url_key+'">'+t+'</a>" '+s+" use"))):void 0)})}),$("body").on("click",".render-error-link",function(e){var t;return t=$(this).closest(".render-error").find(".render-error-message"),t.show(),e.preventDefault()})}),e=function(e){var t,i;return i="https://www.google.com/recaptcha/api/js/recaptcha_ajax.js",t=$('<div class="recaptcha-box"></div>'),$(e).children().last().after(t),$.getScript(i,function(){return t.loadCaptcha()})},t=function(e){return e.replace(/([a-z])([A-Z])/g,function(e){return e[0]+"_"+e[1].toLowerCase()})},i=function(e){return"undefined"!=typeof console&&null!==console?console.log(e):void 0}}.call(this),wagn.menu_template=[{text:"edit",view:"edit","if":"edit",sub:[{text:"content",view:"edit"},{text:"name",view:"edit_name"},{text:"type: %{type}",view:"edit_type"},{text:"structure",related:{name:"structure",view:"edit"},"if":"structure"},{link:"delete","if":"delete"}]},{text:"view",view:"home",sub:[{text:"refresh",view:"home"},{text:"page",page:"self"},{text:"type: %{type}",page:"type"},{text:"history",view:"history","if":"edit"},{text:"structure",related:{name:"structure"},"if":"structure"}]},{text:"discuss",related:{name:"+discussion"},"if":"discuss"},{text:"advanced",view:"options",sub:[{text:"rules",view:"options",list:{name:"related_sets",template:{view:"options",text:"text",path_opts:"path_opts"}}},{plain:"related",list:{name:"piecenames",template:{page:"item"},append:[{related:"children","if":"creator"},{related:"mates"}]}},{related:"referred to by","if":"creator",sub:[{text:"all",related:"referred to by"},{text:"links",related:"linked to by"},{text:"inclusions",related:"included by"}]},{related:"refers to","if":"creator",sub:[{text:"all",related:"refers to"},{text:"links",related:"links to"},{text:"inclusions",related:"includes"}]},{related:"editors","if":"creator",sub:[{text:"all editors",related:"editors"},{text:"creator: %{creator}",page:"creator"},{text:"last editor: %{updater}",page:"updater"}]}]},{link:"watch","if":"watch"},{view:"account","if":"account",sub:[{view:"account",text:"details"},{related:"roles"},{related:"created"},{related:"edited"}]}],/*
83
83
  * jQuery Mobile Framework Git Build: SHA1: 07a30fb0138f34a880ca7c9c9427319d1f976eda <> Date: Mon Jul 16 01:56:11 2012 +0200
84
84
  * http://jquerymobile.com
85
85
  *
@@ -79,7 +79,7 @@ function(){function e(e,t,i,o,a,r){for(var s=0,l=o.length;l>s;s++){var c=o[s];if
79
79
  }}}}(tinymce),function(e){e.dom.ScriptLoader=function(){function t(t,i){function n(){c.remove(l),a&&(a.onreadystatechange=a.onload=a=null),i()}function o(){"undefined"!=typeof console&&console.log&&console.log("Failed to load: "+t)}var a,r,s,l,c=e.DOM;return l=c.uniqueId(),e.isIE6&&(r=new e.util.URI(t),s=location,r.host==s.hostname&&r.port==s.port&&r.protocol+":"==s.protocol&&"file"!=r.protocol.toLowerCase())?(e.util.XHR.send({url:e._addVer(r.getURI()),success:function(e){var t=c.create("script",{type:"text/javascript"});t.text=e,document.getElementsByTagName("head")[0].appendChild(t),c.remove(t),n()},error:o}),void 0):(a=document.createElement("script"),a.id=l,a.type="text/javascript",a.src=e._addVer(t),(!e.isIE||e.isIE11)&&(a.onload=n),a.onerror=o,e.isOpera||(a.onreadystatechange=function(){var e=a.readyState;("complete"==e||"loaded"==e)&&n()}),(document.getElementsByTagName("head")[0]||document.body).appendChild(a),void 0)}var i,n=0,o=1,a=2,r={},s=[],l={},c=[],u=0;this.isDone=function(e){return r[e]==a},this.markDone=function(e){r[e]=a},this.add=this.load=function(e,t,o){var a=r[e];a==i&&(s.push(e),r[e]=n),t&&(l[e]||(l[e]=[]),l[e].push({func:t,scope:o||this}))},this.loadQueue=function(e,t){this.loadScripts(s,e,t)},this.loadScripts=function(n,s,d){function h(t){e.each(l[t],function(e){e.func.call(e.scope)}),l[t]=i}var p;c.push({func:s,scope:d||this}),(p=function(){var i=e.grep(n);n.length=0,e.each(i,function(e){return r[e]==a?(h(e),void 0):(r[e]!=o&&(r[e]=o,u++,t(e,function(){r[e]=a,u--,h(e),p()})),void 0)}),u||(e.each(c,function(e){e.func.call(e.scope)}),c.length=0)})()}},e.ScriptLoader=new e.dom.ScriptLoader}(tinymce),function(e){e.dom.RangeUtils=function(t){this.walk=function(i,n){function o(e){var t;return t=e[0],3===t.nodeType&&t===m&&g>=t.nodeValue.length&&e.splice(0,1),t=e[e.length-1],0===b&&e.length>0&&t===v&&3===t.nodeType&&e.splice(e.length-1,1),e}function a(e,t,i){for(var n=[];e&&e!=i;e=e[t])n.push(e);return n}function r(e,t){do{if(e.parentNode==t)return e;e=e.parentNode}while(e)}function s(e,t,i){var r=i?"nextSibling":"previousSibling";for(d=e,h=d.parentNode;d&&d!=t;d=h)h=d.parentNode,p=a(d==e?d:d[r],r),p.length&&(i||p.reverse(),n(o(p)))}var l,c,u,d,h,p,f,m=i.startContainer,g=i.startOffset,v=i.endContainer,b=i.endOffset;if(f=t.select("td.mceSelected,th.mceSelected"),f.length>0)return e.each(f,function(e){n([e])}),void 0;if(1==m.nodeType&&m.hasChildNodes()&&(m=m.childNodes[g]),1==v.nodeType&&v.hasChildNodes()&&(v=v.childNodes[Math.min(b-1,v.childNodes.length-1)]),m==v)return n(o([m]));for(l=t.findCommonAncestor(m,v),d=m;d;d=d.parentNode){if(d===v)return s(m,l,!0);if(d===l)break}for(d=v;d;d=d.parentNode){if(d===m)return s(v,l);if(d===l)break}c=r(m,l)||m,u=r(v,l)||v,s(m,c,!0),p=a(c==m?c:c.nextSibling,"nextSibling",u==v?u.nextSibling:u),p.length&&n(o(p)),s(v,u)},this.split=function(e){function t(e,t){return e.splitText(t)}var i=e.startContainer,n=e.startOffset,o=e.endContainer,a=e.endOffset;return i==o&&3==i.nodeType?n>0&&n<i.nodeValue.length&&(o=t(i,n),i=o.previousSibling,a>n?(a-=n,i=o=t(o,a).previousSibling,a=o.nodeValue.length,n=0):a=0):(3==i.nodeType&&n>0&&n<i.nodeValue.length&&(i=t(i,n),n=0),3==o.nodeType&&a>0&&a<o.nodeValue.length&&(o=t(o,a).previousSibling,a=o.nodeValue.length)),{startContainer:i,startOffset:n,endContainer:o,endOffset:a}}},e.dom.RangeUtils.compareRanges=function(e,t){if(e&&t){if(!e.item&&!e.duplicate)return e.startContainer==t.startContainer&&e.startOffset==t.startOffset;if(e.item&&t.item&&e.item(0)===t.item(0))return!0;if(e.isEqual&&t.isEqual&&t.isEqual(e))return!0}return!1}}(tinymce),function(e){var t=e.dom.Event,i=e.each;e.create("tinymce.ui.KeyboardNavigation",{KeyboardNavigation:function(n,o){var a,r,s,l,c,u=this,d=n.root,h=n.items,p=n.enableUpDown,f=n.enableLeftRight||!n.enableUpDown,m=n.excludeFromTabOrder;o=o||e.DOM,a=function(e){c=e.target.id},r=function(e){o.setAttrib(e.target.id,"tabindex","-1")},l=function(){var e=o.get(c);o.setAttrib(e,"tabindex","0"),e.focus()},u.focus=function(){o.get(c).focus()},u.destroy=function(){i(h,function(e){var t=o.get(e.id);o.unbind(t,"focus",a),o.unbind(t,"blur",r)});var e=o.get(d);o.unbind(e,"focus",l),o.unbind(e,"keydown",s),h=o=d=u.focus=a=r=s=l=null,u.destroy=function(){}},u.moveFocus=function(e,a){{var r,s=-1;u.controls}c&&(i(h,function(e,t){return e.id===c?(s=t,!1):void 0}),s+=e,0>s?s=h.length-1:s>=h.length&&(s=0),r=h[s],o.setAttrib(c,"tabindex","-1"),o.setAttrib(r.id,"tabindex","0"),o.get(r.id).focus(),n.actOnFocus&&n.onAction(r.id),a&&t.cancel(a))},s=function(e){var i=37,o=39,a=38,r=40,s=27,l=14,d=13,h=32;switch(e.keyCode){case i:f&&u.moveFocus(-1),t.cancel(e);break;case o:f&&u.moveFocus(1),t.cancel(e);break;case a:p&&u.moveFocus(-1),t.cancel(e);break;case r:p&&u.moveFocus(1),t.cancel(e);break;case s:n.onCancel&&(n.onCancel(),t.cancel(e));break;case l:case d:case h:n.onAction&&(n.onAction(c),t.cancel(e))}},i(h,function(e,t){var i,n;e.id||(e.id=o.uniqueId("_mce_item_")),n=o.get(e.id),m?(o.bind(n,"blur",r),i="-1"):i=0===t?"0":"-1",n.setAttribute("tabindex",i),o.bind(n,"focus",a)}),h[0]&&(c=h[0].id),o.setAttrib(d,"tabindex","-1");var g=o.get(d);o.bind(g,"focus",l),o.bind(g,"keydown",s)}})}(tinymce),function(e){var t=e.DOM,i=e.is;e.create("tinymce.ui.Control",{Control:function(t,i,n){this.id=t,this.settings=i=i||{},this.rendered=!1,this.onRender=new e.util.Dispatcher(this),this.classPrefix="",this.scope=i.scope||this,this.disabled=0,this.active=0,this.editor=n},setAriaProperty:function(e,i){var n=t.get(this.id+"_aria")||t.get(this.id);n&&t.setAttrib(n,"aria-"+e,!!i)},focus:function(){t.get(this.id).focus()},setDisabled:function(e){e!=this.disabled&&(this.setAriaProperty("disabled",e),this.setState("Disabled",e),this.setState("Enabled",!e),this.disabled=e)},isDisabled:function(){return this.disabled},setActive:function(e){e!=this.active&&(this.setState("Active",e),this.active=e,this.setAriaProperty("pressed",e))},isActive:function(){return this.active},setState:function(e,i){var n=t.get(this.id);e=this.classPrefix+e,i?t.addClass(n,e):t.removeClass(n,e)},isRendered:function(){return this.rendered},renderHTML:function(){},renderTo:function(e){t.setHTML(e,this.renderHTML())},postRender:function(){var e,t=this;i(t.disabled)&&(e=t.disabled,t.disabled=-1,t.setDisabled(e)),i(t.active)&&(e=t.active,t.active=-1,t.setActive(e))},remove:function(){t.remove(this.id),this.destroy()},destroy:function(){e.dom.Event.clear(this.id)}})}(tinymce),tinymce.create("tinymce.ui.Container:tinymce.ui.Control",{Container:function(e,t,i){this.parent(e,t,i),this.controls=[],this.lookup={}},add:function(e){return this.lookup[e.id]=e,this.controls.push(e),e},get:function(e){return this.lookup[e]}}),tinymce.create("tinymce.ui.Separator:tinymce.ui.Control",{Separator:function(e,t){this.parent(e,t),this.classPrefix="mceSeparator",this.setDisabled(!0)},renderHTML:function(){return tinymce.DOM.createHTML("span",{"class":this.classPrefix,role:"separator","aria-orientation":"vertical",tabindex:"-1"})}}),function(e){{var t=e.is;e.DOM,e.each,e.walk}e.create("tinymce.ui.MenuItem:tinymce.ui.Control",{MenuItem:function(e,t){this.parent(e,t),this.classPrefix="mceMenuItem"},setSelected:function(e){this.setState("Selected",e),this.setAriaProperty("checked",!!e),this.selected=e},isSelected:function(){return this.selected},postRender:function(){var e=this;e.parent(),t(e.selected)&&e.setSelected(e.selected)}})}(tinymce),function(e){var t=(e.is,e.DOM),i=(e.each,e.walk);e.create("tinymce.ui.Menu:tinymce.ui.MenuItem",{Menu:function(t,i){var n=this;n.parent(t,i),n.items={},n.collapsed=!1,n.menuCount=0,n.onAddItem=new e.util.Dispatcher(this)},expand:function(e){var t=this;e&&i(t,function(e){e.expand&&e.expand()},"items",t),t.collapsed=!1},collapse:function(e){var t=this;e&&i(t,function(e){e.collapse&&e.collapse()},"items",t),t.collapsed=!0},isCollapsed:function(){return this.collapsed},add:function(i){return i.settings||(i=new e.ui.MenuItem(i.id||t.uniqueId(),i)),this.onAddItem.dispatch(this,i),this.items[i.id]=i},addSeparator:function(){return this.add({separator:!0})},addMenu:function(e){return e.collapse||(e=this.createMenu(e)),this.menuCount++,this.add(e)},hasMenus:function(){return 0!==this.menuCount},remove:function(e){delete this.items[e.id]},removeAll:function(){var e=this;i(e,function(e){e.removeAll?e.removeAll():e.remove(),e.destroy()},"items",e),e.items={}},createMenu:function(i){var n=new e.ui.Menu(i.id||t.uniqueId(),i);return n.onAddItem.add(this.onAddItem.dispatch,this.onAddItem),n}})}(tinymce),function(e){var t=e.is,i=e.DOM,n=e.each,o=e.dom.Event,a=e.dom.Element;e.create("tinymce.ui.DropMenu:tinymce.ui.Menu",{DropMenu:function(n,o){o=o||{},o.container=o.container||i.doc.body,o.offset_x=o.offset_x||0,o.offset_y=o.offset_y||0,o.vp_offset_x=o.vp_offset_x||0,o.vp_offset_y=o.vp_offset_y||0,t(o.icons)&&!o.icons&&(o["class"]+=" mceNoIcons"),this.parent(n,o),this.onShowMenu=new e.util.Dispatcher(this),this.onHideMenu=new e.util.Dispatcher(this),this.classPrefix="mceMenu"},createMenu:function(t){var n,o=this,a=o.settings;return t.container=t.container||a.container,t.parent=o,t.constrain=t.constrain||a.constrain,t["class"]=t["class"]||a["class"],t.vp_offset_x=t.vp_offset_x||a.vp_offset_x,t.vp_offset_y=t.vp_offset_y||a.vp_offset_y,t.keyboard_focus=a.keyboard_focus,n=new e.ui.DropMenu(t.id||i.uniqueId(),t),n.onAddItem.add(o.onAddItem.dispatch,o.onAddItem),n},focus:function(){var e=this;e.keyboardNav&&e.keyboardNav.focus()},update:function(){var e,t,n=this,o=n.settings,a=i.get("menu_"+n.id+"_tbl"),r=i.get("menu_"+n.id+"_co");e=o.max_width?Math.min(a.offsetWidth,o.max_width):a.offsetWidth,t=o.max_height?Math.min(a.offsetHeight,o.max_height):a.offsetHeight,i.boxModel?n.element.setStyles({width:e,height:t}):n.element.setStyles({width:e+2,height:t+2}),o.max_width&&i.setStyle(r,"width",e),o.max_height&&(i.setStyle(r,"height",t),a.clientHeight<o.max_height&&i.setStyle(r,"overflow","hidden"))},showMenu:function(t,r,s){var l,c,u,d,h,p,f=this,m=f.settings,g=i.getViewPort(),v=2,b=f.classPrefix;f.collapse(1),f.isMenuVisible||(f.rendered?l=i.get("menu_"+f.id):(l=i.add(f.settings.container,f.renderNode()),n(f.items,function(e){e.postRender()}),f.element=new a("menu_"+f.id,{blocker:1,container:m.container})),e.isOpera||i.setStyles(l,{left:-65535,top:-65535}),i.show(l),f.update(),t+=m.offset_x||0,r+=m.offset_y||0,g.w-=4,g.h-=4,m.constrain&&(c=l.clientWidth-v,u=l.clientHeight-v,d=g.x+g.w,h=g.y+g.h,t+m.vp_offset_x+c>d&&(t=s?s-c:Math.max(0,d-m.vp_offset_x-c)),r+m.vp_offset_y+u>h&&(r=Math.max(0,h-m.vp_offset_y-u))),i.setStyles(l,{left:t,top:r}),f.element.update(),f.isMenuVisible=1,f.mouseClickFunc=o.add(l,"click",function(e){var t;if(e=e.target,e&&(e=i.getParent(e,"tr"))&&!i.hasClass(e,b+"ItemSub")){if(t=f.items[e.id],t.isDisabled())return;for(p=f;p;)p.hideMenu&&p.hideMenu(),p=p.settings.parent;return t.settings.onclick&&t.settings.onclick(e),!1}}),f.hasMenus()&&(f.mouseOverFunc=o.add(l,"mouseover",function(e){var t,n;if(e=e.target,e&&(e=i.getParent(e,"tr"))){if(t=f.items[e.id],f.lastMenu&&f.lastMenu.collapse(1),t.isDisabled())return;e&&i.hasClass(e,b+"ItemSub")&&(n=i.getRect(e),t.showMenu(n.x+n.w-v,n.y-v,n.x),f.lastMenu=t,i.addClass(i.get(t.id).firstChild,b+"ItemActive"))}})),o.add(l,"keydown",f._keyHandler,f),f.onShowMenu.dispatch(f),m.keyboard_focus&&f._setupKeyboardNav())},hideMenu:function(e){var t,n=this,a=i.get("menu_"+n.id);n.isMenuVisible&&(n.keyboardNav&&n.keyboardNav.destroy(),o.remove(a,"mouseover",n.mouseOverFunc),o.remove(a,"click",n.mouseClickFunc),o.remove(a,"keydown",n._keyHandler),i.hide(a),n.isMenuVisible=0,e||n.collapse(1),n.element&&n.element.hide(),(t=i.get(n.id))&&i.removeClass(t.firstChild,n.classPrefix+"ItemActive"),n.onHideMenu.dispatch(n))},add:function(e){var t,n=this;return e=n.parent(e),n.isRendered&&(t=i.get("menu_"+n.id))&&n._add(i.select("tbody",t)[0],e),e},collapse:function(e){this.parent(e),this.hideMenu(1)},remove:function(e){return i.remove(e.id),this.destroy(),this.parent(e)},destroy:function(){var e=this,t=i.get("menu_"+e.id);e.keyboardNav&&e.keyboardNav.destroy(),o.remove(t,"mouseover",e.mouseOverFunc),o.remove(i.select("a",t),"focus",e.mouseOverFunc),o.remove(t,"click",e.mouseClickFunc),o.remove(t,"keydown",e._keyHandler),e.element&&e.element.remove(),i.remove(t)},renderNode:function(){var e,t,o,r,s=this,l=s.settings;return r=i.create("div",{role:"listbox",id:"menu_"+s.id,"class":l["class"],style:"position:absolute;left:0;top:0;z-index:200000;outline:0"}),s.settings.parent&&i.setAttrib(r,"aria-parent","menu_"+s.settings.parent.id),o=i.add(r,"div",{role:"presentation",id:"menu_"+s.id+"_co","class":s.classPrefix+(l["class"]?" "+l["class"]:"")}),s.element=new a("menu_"+s.id,{blocker:1,container:l.container}),l.menu_line&&i.add(o,"span",{"class":s.classPrefix+"Line"}),e=i.add(o,"table",{role:"presentation",id:"menu_"+s.id+"_tbl",border:0,cellPadding:0,cellSpacing:0}),t=i.add(e,"tbody"),n(s.items,function(e){s._add(t,e)}),s.rendered=!0,r},_setupKeyboardNav:function(){var t,n,o=this;t=i.get("menu_"+o.id),n=i.select("a[role=option]","menu_"+o.id),n.splice(0,0,t),o.keyboardNav=new e.ui.KeyboardNavigation({root:"menu_"+o.id,items:n,onCancel:function(){o.hideMenu()},enableUpDown:!0}),t.focus()},_keyHandler:function(e){var t=this;switch(e.keyCode){case 37:t.settings.parent&&(t.hideMenu(),t.settings.parent.focus(),o.cancel(e));break;case 39:t.mouseOverFunc&&t.mouseOverFunc(e)}},_add:function(e,t){var n,o,a,r,s,l=t.settings,c=this.classPrefix;return l.separator?(a=i.add(e,"tr",{id:t.id,"class":c+"ItemSeparator"}),i.add(a,"td",{"class":c+"ItemSeparator"}),(n=a.previousSibling)&&i.addClass(n,"mceLast"),void 0):(n=a=i.add(e,"tr",{id:t.id,"class":c+"Item "+c+"ItemEnabled"}),n=r=i.add(n,l.titleItem?"th":"td"),n=o=i.add(n,"a",{id:t.id+"_aria",role:l.titleItem?"presentation":"option",href:"javascript:;",onclick:"return false;",onmousedown:"return false;"}),l.parent&&(i.setAttrib(o,"aria-haspopup","true"),i.setAttrib(o,"aria-owns","menu_"+t.id)),i.addClass(r,l["class"]),s=i.add(n,"span",{"class":"mceIcon"+(l.icon?" mce_"+l.icon:"")}),l.icon_src&&i.add(s,"img",{src:l.icon_src}),n=i.add(n,l.element||"span",{"class":"mceText",title:t.settings.title},t.settings.title),t.settings.style&&("function"==typeof t.settings.style&&(t.settings.style=t.settings.style()),i.setAttrib(n,"style",t.settings.style)),1==e.childNodes.length&&i.addClass(a,"mceFirst"),(n=a.previousSibling)&&i.hasClass(n,c+"ItemSeparator")&&i.addClass(a,"mceFirst"),t.collapse&&i.addClass(a,c+"ItemSub"),(n=a.previousSibling)&&i.removeClass(n,"mceLast"),i.addClass(a,"mceLast"),void 0)}})}(tinymce),function(e){var t=e.DOM;e.create("tinymce.ui.Button:tinymce.ui.Control",{Button:function(e,t,i){this.parent(e,t,i),this.classPrefix="mceButton"},renderHTML:function(){var e,i,n=this.classPrefix,o=this.settings;return i=t.encode(o.label||""),e='<a role="button" id="'+this.id+'" href="javascript:;" class="'+n+" "+n+"Enabled "+o["class"]+(i?" "+n+"Labeled":"")+'" onmousedown="return false;" onclick="return false;" aria-labelledby="'+this.id+'_voice" title="'+t.encode(o.title)+'">',e+=!o.image||this.editor&&this.editor.forcedHighContrastMode?'<span class="mceIcon '+o["class"]+'"></span>'+(i?'<span class="'+n+'Label">'+i+"</span>":""):'<span class="mceIcon '+o["class"]+'"><img class="mceIcon" src="'+o.image+'" alt="'+t.encode(o.title)+'" /></span>'+(i?'<span class="'+n+'Label">'+i+"</span>":""),e+='<span class="mceVoiceLabel mceIconOnly" style="display: none;" id="'+this.id+'_voice">'+o.title+"</span>",e+="</a>"},postRender:function(){var t,i=this,n=i.settings;e.isIE&&i.editor&&e.dom.Event.add(i.id,"mousedown",function(){var e=i.editor.selection.getNode().nodeName;t="IMG"===e?i.editor.selection.getBookmark():null}),e.dom.Event.add(i.id,"click",function(o){return i.isDisabled()?void 0:(e.isIE&&i.editor&&null!==t&&i.editor.selection.moveToBookmark(t),n.onclick.call(n.scope,o))}),e.dom.Event.add(i.id,"keydown",function(t){return i.isDisabled()||t.keyCode!=e.VK.SPACEBAR?void 0:(e.dom.Event.cancel(t),n.onclick.call(n.scope,t))})}})}(tinymce),function(e){var t,i=e.DOM,n=e.dom.Event,o=e.each,a=e.util.Dispatcher;e.create("tinymce.ui.ListBox:tinymce.ui.Control",{ListBox:function(t,i,n){var o=this;o.parent(t,i,n),o.items=[],o.onChange=new a(o),o.onPostRender=new a(o),o.onAdd=new a(o),o.onRenderMenu=new e.util.Dispatcher(this),o.classPrefix="mceListBox",o.marked={}},select:function(e){var i,n,a=this;return a.marked={},e==t?a.selectByIndex(-1):(n=e&&"function"==typeof e?e:function(t){return t==e},e!=a.selectedValue&&(o(a.items,function(e,t){return n(e.value)?(i=1,a.selectByIndex(t),!1):void 0}),i||a.selectByIndex(-1)),void 0)},selectByIndex:function(e){var t,n,o,a=this;a.marked={},e!=a.selectedIndex&&(t=i.get(a.id+"_text"),o=i.get(a.id+"_voiceDesc"),n=a.items[e],n?(a.selectedValue=n.value,a.selectedIndex=e,i.setHTML(t,i.encode(n.title)),i.setHTML(o,a.settings.title+" - "+n.title),i.removeClass(t,"mceTitle"),i.setAttrib(a.id,"aria-valuenow",n.title)):(i.setHTML(t,i.encode(a.settings.title)),i.setHTML(o,i.encode(a.settings.title)),i.addClass(t,"mceTitle"),a.selectedValue=a.selectedIndex=null,i.setAttrib(a.id,"aria-valuenow",a.settings.title)),t=0)},mark:function(e){this.marked[e]=!0},add:function(t,i,n){var o=this;n=n||{},n=e.extend(n,{title:t,value:i}),o.items.push(n),o.onAdd.dispatch(o,n)},getLength:function(){return this.items.length},renderHTML:function(){var e="",t=this,n=t.settings,o=t.classPrefix;return e='<span role="listbox" aria-haspopup="true" aria-labelledby="'+t.id+'_voiceDesc" aria-describedby="'+t.id+'_voiceDesc"><table role="presentation" tabindex="0" id="'+t.id+'" cellpadding="0" cellspacing="0" class="'+o+" "+o+"Enabled"+(n["class"]?" "+n["class"]:"")+'"><tbody><tr>',e+="<td>"+i.createHTML("span",{id:t.id+"_voiceDesc","class":"voiceLabel",style:"display:none;"},t.settings.title),e+=i.createHTML("a",{id:t.id+"_text",tabindex:-1,href:"javascript:;","class":"mceText",onclick:"return false;",onmousedown:"return false;"},i.encode(t.settings.title))+"</td>",e+="<td>"+i.createHTML("a",{id:t.id+"_open",tabindex:-1,href:"javascript:;","class":"mceOpen",onclick:"return false;",onmousedown:"return false;"},'<span><span style="display:none;" class="mceIconOnly" aria-hidden="true">▼</span></span>')+"</td>",e+="</tr></tbody></table></span>"},showMenu:function(){var t,a,r=this,s=i.get(this.id);if(!r.isDisabled()&&0!==r.items.length){if(r.menu&&r.menu.isMenuVisible)return r.hideMenu();r.isMenuRendered||(r.renderMenu(),r.isMenuRendered=!0),t=i.getPos(s),a=r.menu,a.settings.offset_x=t.x,a.settings.offset_y=t.y,a.settings.keyboard_focus=!e.isOpera,o(r.items,function(e){a.items[e.id]&&a.items[e.id].setSelected(0)}),o(r.items,function(e){a.items[e.id]&&r.marked[e.value]&&a.items[e.id].setSelected(1),e.value===r.selectedValue&&a.items[e.id].setSelected(1)}),a.showMenu(0,s.clientHeight),n.add(i.doc,"mousedown",r.hideMenu,r),i.addClass(r.id,r.classPrefix+"Selected")}},hideMenu:function(e){var t=this;if(t.menu&&t.menu.isMenuVisible){if(i.removeClass(t.id,t.classPrefix+"Selected"),e&&"mousedown"==e.type&&(e.target.id==t.id+"_text"||e.target.id==t.id+"_open"))return;e&&i.getParent(e.target,".mceMenu")||(i.removeClass(t.id,t.classPrefix+"Selected"),n.remove(i.doc,"mousedown",t.hideMenu,t),t.menu.hideMenu())}},renderMenu:function(){var e,n=this;e=n.settings.control_manager.createDropMenu(n.id+"_menu",{menu_line:1,"class":n.classPrefix+"Menu mceNoIcons",max_width:250,max_height:150}),e.onHideMenu.add(function(){n.hideMenu(),n.focus()}),e.add({title:n.settings.title,"class":"mceMenuItemTitle",onclick:function(){n.settings.onselect("")!==!1&&n.select("")}}),o(n.items,function(o){o.value===t?e.add({title:o.title,role:"option","class":"mceMenuItemTitle",onclick:function(){n.settings.onselect("")!==!1&&n.select("")}}):(o.id=i.uniqueId(),o.role="option",o.onclick=function(){n.settings.onselect(o.value)!==!1&&n.select(o.value)},e.add(o))}),n.onRenderMenu.dispatch(n,e),n.menu=e},postRender:function(){var t=this,o=t.classPrefix;n.add(t.id,"click",t.showMenu,t),n.add(t.id,"keydown",function(e){32==e.keyCode&&(t.showMenu(e),n.cancel(e))}),n.add(t.id,"focus",function(){t._focused||(t.keyDownHandler=n.add(t.id,"keydown",function(e){40==e.keyCode&&(t.showMenu(),n.cancel(e))}),t.keyPressHandler=n.add(t.id,"keypress",function(e){var i;13==e.keyCode&&(i=t.selectedValue,t.selectedValue=null,n.cancel(e),t.settings.onselect(i))})),t._focused=1}),n.add(t.id,"blur",function(){n.remove(t.id,"keydown",t.keyDownHandler),n.remove(t.id,"keypress",t.keyPressHandler),t._focused=0}),(e.isIE6||!i.boxModel)&&(n.add(t.id,"mouseover",function(){i.hasClass(t.id,o+"Disabled")||i.addClass(t.id,o+"Hover")}),n.add(t.id,"mouseout",function(){i.hasClass(t.id,o+"Disabled")||i.removeClass(t.id,o+"Hover")})),t.onPostRender.dispatch(t,i.get(t.id))},destroy:function(){this.parent(),n.clear(this.id+"_text"),n.clear(this.id+"_open")}})}(tinymce),function(e){{var t,i=e.DOM,n=e.dom.Event,o=e.each;e.util.Dispatcher}e.create("tinymce.ui.NativeListBox:tinymce.ui.ListBox",{NativeListBox:function(e,t){this.parent(e,t),this.classPrefix="mceNativeListBox"},setDisabled:function(e){i.get(this.id).disabled=e,this.setAriaProperty("disabled",e)},isDisabled:function(){return i.get(this.id).disabled},select:function(e){var i,n,a=this;return e==t?a.selectByIndex(-1):(n=e&&"function"==typeof e?e:function(t){return t==e},e!=a.selectedValue&&(o(a.items,function(e,t){return n(e.value)?(i=1,a.selectByIndex(t),!1):void 0}),i||a.selectByIndex(-1)),void 0)},selectByIndex:function(e){i.get(this.id).selectedIndex=e+1,this.selectedValue=this.items[e]?this.items[e].value:null},add:function(e,t,n){var o,a=this;n=n||{},n.value=t,a.isRendered()&&i.add(i.get(this.id),"option",n,e),o={title:e,value:t,attribs:n},a.items.push(o),a.onAdd.dispatch(a,o)},getLength:function(){return this.items.length},renderHTML:function(){var e,t=this;return e=i.createHTML("option",{value:""},"-- "+t.settings.title+" --"),o(t.items,function(t){e+=i.createHTML("option",{value:t.value},t.title)}),e=i.createHTML("select",{id:t.id,"class":"mceNativeListBox","aria-labelledby":t.id+"_aria"},e),e+=i.createHTML("span",{id:t.id+"_aria",style:"display: none"},t.settings.title)},postRender:function(){function e(e){var t=o.items[e.target.selectedIndex-1];t&&(t=t.value)&&(o.onChange.dispatch(o,t),o.settings.onselect&&o.settings.onselect(t))}var t,o=this,a=!0;o.rendered=!0,n.add(o.id,"change",e),n.add(o.id,"keydown",function(i){var r,s=38,l=40,c=13,u=32;return n.remove(o.id,"change",t),a=!1,r=n.add(o.id,"blur",function(){a||(a=!0,n.add(o.id,"change",e),n.remove(o.id,"blur",r))}),i.keyCode==c||i.keyCode==u?(e(i),n.cancel(i)):((i.keyCode==l||i.keyCode==s)&&i.stopImmediatePropagation(),void 0)}),o.onPostRender.dispatch(o,i.get(o.id))}})}(tinymce),function(e){{var t=e.DOM,i=e.dom.Event;e.each}e.create("tinymce.ui.MenuButton:tinymce.ui.Button",{MenuButton:function(i,n,o){this.parent(i,n,o),this.onRenderMenu=new e.util.Dispatcher(this),n.menu_container=n.menu_container||t.doc.body},showMenu:function(){var e,n,o,a=this,r=t.get(a.id);if(!a.isDisabled()){if(a.isMenuRendered||(a.renderMenu(),a.isMenuRendered=!0),a.isMenuVisible)return a.hideMenu();e=t.getPos(a.settings.menu_container),n=t.getPos(r),o=a.menu,o.settings.offset_x=n.x,o.settings.offset_y=n.y,o.settings.vp_offset_x=n.x,o.settings.vp_offset_y=n.y,o.settings.keyboard_focus=a._focused,o.showMenu(0,r.firstChild.clientHeight),i.add(t.doc,"mousedown",a.hideMenu,a),a.setState("Selected",1),a.isMenuVisible=1}},renderMenu:function(){var e,t=this;e=t.settings.control_manager.createDropMenu(t.id+"_menu",{menu_line:1,"class":this.classPrefix+"Menu",icons:t.settings.icons}),e.onHideMenu.add(function(){t.hideMenu(),t.focus()}),t.onRenderMenu.dispatch(t,e),t.menu=e},hideMenu:function(e){var n=this;e&&"mousedown"==e.type&&t.getParent(e.target,function(e){return e.id===n.id||e.id===n.id+"_open"})||(e&&t.getParent(e.target,".mceMenu")||(n.setState("Selected",0),i.remove(t.doc,"mousedown",n.hideMenu,n),n.menu&&n.menu.hideMenu()),n.isMenuVisible=0)},postRender:function(){var e=this,t=e.settings;i.add(e.id,"click",function(){e.isDisabled()||(t.onclick&&t.onclick(e.value),e.showMenu())})}})}(tinymce),function(e){{var t=e.DOM,i=e.dom.Event;e.each}e.create("tinymce.ui.SplitButton:tinymce.ui.MenuButton",{SplitButton:function(e,t,i){this.parent(e,t,i),this.classPrefix="mceSplitButton"},renderHTML:function(){var e,i,n=this,o=n.settings;return e="<tbody><tr>",i=o.image?t.createHTML("img ",{src:o.image,role:"presentation","class":"mceAction "+o["class"]}):t.createHTML("span",{"class":"mceAction "+o["class"]},""),i+=t.createHTML("span",{"class":"mceVoiceLabel mceIconOnly",id:n.id+"_voice",style:"display:none;"},o.title),e+="<td >"+t.createHTML("a",{role:"button",id:n.id+"_action",tabindex:"-1",href:"javascript:;","class":"mceAction "+o["class"],onclick:"return false;",onmousedown:"return false;",title:o.title},i)+"</td>",i=t.createHTML("span",{"class":"mceOpen "+o["class"]},'<span style="display:none;" class="mceIconOnly" aria-hidden="true">▼</span>'),e+="<td >"+t.createHTML("a",{role:"button",id:n.id+"_open",tabindex:"-1",href:"javascript:;","class":"mceOpen "+o["class"],onclick:"return false;",onmousedown:"return false;",title:o.title},i)+"</td>",e+="</tr></tbody>",e=t.createHTML("table",{role:"presentation","class":"mceSplitButton mceSplitButtonEnabled "+o["class"],cellpadding:"0",cellspacing:"0",title:o.title},e),t.createHTML("div",{id:n.id,role:"button",tabindex:"0","aria-labelledby":n.id+"_voice","aria-haspopup":"true"},e)},postRender:function(){var n,o=this,a=o.settings;a.onclick&&(n=function(e){o.isDisabled()||(a.onclick(o.value),i.cancel(e))},i.add(o.id+"_action","click",n),i.add(o.id,["click","keydown"],function(e){var t=40;32!==e.keyCode&&13!==e.keyCode&&14!==e.keyCode||e.altKey||e.ctrlKey||e.metaKey?("click"===e.type||e.keyCode===t)&&(o.showMenu(),i.cancel(e)):(n(),i.cancel(e))})),i.add(o.id+"_open","click",function(e){o.showMenu(),i.cancel(e)}),i.add([o.id,o.id+"_open"],"focus",function(){o._focused=1}),i.add([o.id,o.id+"_open"],"blur",function(){o._focused=0}),(e.isIE6||!t.boxModel)&&(i.add(o.id,"mouseover",function(){t.hasClass(o.id,"mceSplitButtonDisabled")||t.addClass(o.id,"mceSplitButtonHover")}),i.add(o.id,"mouseout",function(){t.hasClass(o.id,"mceSplitButtonDisabled")||t.removeClass(o.id,"mceSplitButtonHover")}))},destroy:function(){this.parent(),i.clear(this.id+"_action"),i.clear(this.id+"_open"),i.clear(this.id)}})}(tinymce),function(e){var t=e.DOM,i=e.dom.Event,n=e.is,o=e.each;e.create("tinymce.ui.ColorSplitButton:tinymce.ui.SplitButton",{ColorSplitButton:function(t,i,n){var o=this;o.parent(t,i,n),o.settings=i=e.extend({colors:"000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF",grid_width:8,default_color:"#888888"},o.settings),o.onShowMenu=new e.util.Dispatcher(o),o.onHideMenu=new e.util.Dispatcher(o),o.value=i.default_color},showMenu:function(){var n,o,a=this;if(!a.isDisabled()){if(a.isMenuRendered||(a.renderMenu(),a.isMenuRendered=!0),a.isMenuVisible)return a.hideMenu();n=t.get(a.id),t.show(a.id+"_menu"),t.addClass(n,"mceSplitButtonSelected"),o=t.getPos(n),t.setStyles(a.id+"_menu",{left:o.x,top:o.y+n.firstChild.clientHeight,zIndex:2e5}),n=0,i.add(t.doc,"mousedown",a.hideMenu,a),a.onShowMenu.dispatch(a),a._focused&&(a._keyHandler=i.add(a.id+"_menu","keydown",function(e){27==e.keyCode&&a.hideMenu()}),t.select("a",a.id+"_menu")[0].focus()),a.keyboardNav=new e.ui.KeyboardNavigation({root:a.id+"_menu",items:t.select("a",a.id+"_menu"),onCancel:function(){a.hideMenu(),a.focus()}}),a.keyboardNav.focus(),a.isMenuVisible=1}},hideMenu:function(e){var n=this;if(n.isMenuVisible){if(e&&"mousedown"==e.type&&t.getParent(e.target,function(e){return e.id===n.id+"_open"}))return;e&&t.getParent(e.target,".mceSplitButtonMenu")||(t.removeClass(n.id,"mceSplitButtonSelected"),i.remove(t.doc,"mousedown",n.hideMenu,n),i.remove(n.id+"_menu","keydown",n._keyHandler),t.hide(n.id+"_menu")),n.isMenuVisible=0,n.onHideMenu.dispatch(),n.keyboardNav.destroy()}},renderMenu:function(){var a,r,s,l,c,u,d=this,h=0,p=d.settings;return c=t.add(p.menu_container,"div",{role:"listbox",id:d.id+"_menu","class":p.menu_class+" "+p["class"],style:"position:absolute;left:0;top:-1000px;"}),a=t.add(c,"div",{"class":p["class"]+" mceSplitButtonMenu"}),t.add(a,"span",{"class":"mceMenuLine"}),r=t.add(a,"table",{role:"presentation","class":"mceColorSplitMenu"}),s=t.add(r,"tbody"),h=0,o(n(p.colors,"array")?p.colors:p.colors.split(","),function(i){i=i.replace(/^#/,""),h--||(l=t.add(s,"tr"),h=p.grid_width-1),r=t.add(l,"td");var n={href:"javascript:;",style:{backgroundColor:"#"+i},title:d.editor.getLang("colors."+i,i),"data-mce-color":"#"+i};e.isIE||(n.role="option"),r=t.add(r,"a",n),d.editor.forcedHighContrastMode&&(r=t.add(r,"canvas",{width:16,height:16,"aria-hidden":"true"}),r.getContext&&(u=r.getContext("2d"))?(u.fillStyle="#"+i,u.fillRect(0,0,16,16)):t.remove(r))}),p.more_colors_func&&(r=t.add(s,"tr"),r=t.add(r,"td",{colspan:p.grid_width,"class":"mceMoreColors"}),r=t.add(r,"a",{role:"option",id:d.id+"_more",href:"javascript:;",onclick:"return false;","class":"mceMoreColors"},p.more_colors_title),i.add(r,"click",function(e){return p.more_colors_func.call(p.more_colors_scope||this),i.cancel(e)})),t.addClass(a,"mceColorSplitMenu"),i.add(d.id+"_menu","mousedown",function(e){return i.cancel(e)}),i.add(d.id+"_menu","click",function(e){var i;return e=t.getParent(e.target,"a",s),e&&"a"==e.nodeName.toLowerCase()&&(i=e.getAttribute("data-mce-color"))&&d.setColor(i),!1}),c},setColor:function(e){this.displayColor(e),this.hideMenu(),this.settings.onselect(e)},displayColor:function(e){var i=this;t.setStyle(i.id+"_preview","backgroundColor",e),i.value=e},postRender:function(){var e=this,i=e.id;e.parent(),t.add(i+"_action","div",{id:i+"_preview","class":"mceColorPreview"}),t.setStyle(e.id+"_preview","backgroundColor",e.value)},destroy:function(){var e=this;e.parent(),i.clear(e.id+"_menu"),i.clear(e.id+"_more"),t.remove(e.id+"_menu"),e.keyboardNav&&e.keyboardNav.destroy()}})}(tinymce),function(e){var t=e.DOM,i=e.each,n=e.dom.Event;e.create("tinymce.ui.ToolbarGroup:tinymce.ui.Container",{renderHTML:function(){var i=this,n=[],o=i.controls,a=e.each,r=i.settings;return n.push('<div id="'+i.id+'" role="group" aria-labelledby="'+i.id+'_voice">'),n.push("<span role='application'>"),n.push('<span id="'+i.id+'_voice" class="mceVoiceLabel" style="display:none;">'+t.encode(r.name)+"</span>"),a(o,function(e){n.push(e.renderHTML())}),n.push("</span>"),n.push("</div>"),n.join("")},focus:function(){var e=this;t.get(e.id).focus()},postRender:function(){var n=this,o=[];i(n.controls,function(e){i(e.controls,function(e){e.id&&o.push(e)})}),n.keyNav=new e.ui.KeyboardNavigation({root:n.id,items:o,onCancel:function(){e.isWebKit&&t.get(n.editor.id+"_ifr").focus(),n.editor.focus()},excludeFromTabOrder:!n.settings.tab_focus_toolbar})},destroy:function(){var e=this;e.parent(),e.keyNav.destroy(),n.clear(e.id)}})}(tinymce),function(e){{var t=e.DOM;e.each}e.create("tinymce.ui.Toolbar:tinymce.ui.Container",{renderHTML:function(){var e,i,n,o,a,r,s=this,l="",c=s.settings;for(r=s.controls,n=0;n<r.length;n++)i=r[n],o=r[n-1],a=r[n+1],0===n&&(e="mceToolbarStart",i.Button?e+=" mceToolbarStartButton":i.SplitButton?e+=" mceToolbarStartSplitButton":i.ListBox&&(e+=" mceToolbarStartListBox"),l+=t.createHTML("td",{"class":e},t.createHTML("span",null,"<!-- IE -->"))),o&&i.ListBox&&(o.Button||o.SplitButton)&&(l+=t.createHTML("td",{"class":"mceToolbarEnd"},t.createHTML("span",null,"<!-- IE -->"))),l+=t.stdMode?'<td style="position: relative">'+i.renderHTML()+"</td>":"<td>"+i.renderHTML()+"</td>",a&&i.ListBox&&(a.Button||a.SplitButton)&&(l+=t.createHTML("td",{"class":"mceToolbarStart"},t.createHTML("span",null,"<!-- IE -->")));return e="mceToolbarEnd",i.Button?e+=" mceToolbarEndButton":i.SplitButton?e+=" mceToolbarEndSplitButton":i.ListBox&&(e+=" mceToolbarEndListBox"),l+=t.createHTML("td",{"class":e},t.createHTML("span",null,"<!-- IE -->")),t.createHTML("table",{id:s.id,"class":"mceToolbar"+(c["class"]?" "+c["class"]:""),cellpadding:"0",cellspacing:"0",align:s.settings.align||"",role:"presentation",tabindex:"-1"},"<tbody><tr>"+l+"</tr></tbody>")}})}(tinymce),function(e){{var t=e.util.Dispatcher;e.each}e.create("tinymce.AddOnManager",{AddOnManager:function(){var e=this;e.items=[],e.urls={},e.lookup={},e.onAdd=new t(e)},get:function(e){return this.lookup[e]?this.lookup[e].instance:void 0},dependencies:function(e){var t;return this.lookup[e]&&(t=this.lookup[e].dependencies),t||[]},requireLangPack:function(t){var i=e.settings;i&&i.language&&i.language_load!==!1&&e.ScriptLoader.add(this.urls[t]+"/langs/"+i.language+".js")
80
80
  },add:function(e,t,i){return this.items.push(t),this.lookup[e]={instance:t,dependencies:i},this.onAdd.dispatch(this,e,t),t},createUrl:function(e,t){return"object"==typeof t?t:{prefix:e.prefix,resource:t,suffix:e.suffix}},addComponents:function(t,i){var n=this.urls[t];e.each(i,function(t){e.ScriptLoader.add(n+"/"+t)})},load:function(t,i,n,o){function a(){var a=r.dependencies(t);e.each(a,function(e){var t=r.createUrl(i,e);r.load(t.resource,t,void 0,void 0)}),n&&(o?n.call(o):n.call(e.ScriptLoader))}var r=this,s=i;r.urls[t]||("object"==typeof i&&(s=i.prefix+i.resource+i.suffix),0!==s.indexOf("/")&&-1==s.indexOf("://")&&(s=e.baseURL+"/"+s),r.urls[t]=s.substring(0,s.lastIndexOf("/")),r.lookup[t]?a():e.ScriptLoader.add(s,a,o))}}),e.PluginManager=new e.AddOnManager,e.ThemeManager=new e.AddOnManager}(tinymce),function(e){var t,i=e.each,n=e.extend,o=e.DOM,a=e.dom.Event,r=(e.ThemeManager,e.PluginManager,e.explode),s=e.util.Dispatcher,l=0;e.documentBaseURL=window.location.href.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,""),/[\/\\]$/.test(e.documentBaseURL)||(e.documentBaseURL+="/"),e.baseURL=new e.util.URI(e.documentBaseURL).toAbsolute(e.baseURL),e.baseURI=new e.util.URI(e.baseURL),e.onBeforeUnload=new s(e),a.add(window,"beforeunload",function(t){e.onBeforeUnload.dispatch(e,t)}),e.onAddEditor=new s(e),e.onRemoveEditor=new s(e),e.EditorManager=n(e,{editors:[],i18n:{},activeEditor:null,init:function(t){function n(e){var t=e.id;return t||(t=e.name,t=t&&!o.get(t)?e.name:o.uniqueId(),e.setAttribute("id",t)),t}function s(t,i,n){var o=t[i];if(o)return e.is(o,"string")&&(n=o.replace(/\.\w+$/,""),n=n?e.resolve(n):0,o=e.resolve(o)),o.apply(n||this,Array.prototype.slice.call(arguments,2))}function c(e,t){return t.constructor===RegExp?t.test(e.className):o.hasClass(e,t)}var u,d=this,h=(e.ScriptLoader,[]);d.settings=t,a.bind(window,"ready",function(){var a,d;switch(s(t,"onpageload"),t.mode){case"exact":a=t.elements||"",a.length>0&&i(r(a),function(n){o.get(n)?(u=new e.Editor(n,t),h.push(u),u.render(1)):i(document.forms,function(a){i(a.elements,function(i){i.name===n&&(n="mce_editor_"+l++,o.setAttrib(i,"id",n),u=new e.Editor(n,t),h.push(u),u.render(1))})})});break;case"textareas":case"specific_textareas":i(o.select("textarea"),function(i){t.editor_deselector&&c(i,t.editor_deselector)||(!t.editor_selector||c(i,t.editor_selector))&&(u=new e.Editor(n(i),t),h.push(u),u.render(1))});break;default:t.types?i(t.types,function(a){i(o.select(a.selector),function(i){var o=new e.Editor(n(i),e.extend({},t,a));h.push(o),o.render(1)})}):t.selector&&i(o.select(t.selector),function(i){var o=new e.Editor(n(i),t);h.push(o),o.render(1)})}t.oninit&&(a=d=0,i(h,function(e){d++,e.initialized?a++:e.onInit.add(function(){a++,a==d&&s(t,"oninit")}),a==d&&s(t,"oninit")}))})},get:function(e){return e===t?this.editors:this.editors.hasOwnProperty(e)?this.editors[e]:t},getInstanceById:function(e){return this.get(e)},add:function(e){var t=this,i=t.editors;return i[e.id]=e,i.push(e),t._setActive(e),t.onAddEditor.dispatch(t,e),e},remove:function(e){var t,i=this,n=i.editors;if(!n[e.id])return null;for(delete n[e.id],t=0;t<n.length;t++)if(n[t]==e){n.splice(t,1);break}return i.activeEditor==e&&i._setActive(n[0]),e.destroy(),i.onRemoveEditor.dispatch(i,e),e},execCommand:function(t,i,n){function o(){s.destroy(),a.detachEvent("onunload",o),a=a.tinyMCE=a.tinymce=null}var a,r=this,s=r.get(n);switch(t){case"mceFocus":return s.focus(),!0;case"mceAddEditor":case"mceAddControl":return r.get(n)||new e.Editor(n,r.settings).render(),!0;case"mceAddFrameControl":return a=n.window,a.tinyMCE=tinyMCE,a.tinymce=e,e.DOM.doc=a.document,e.DOM.win=a,s=new e.Editor(n.element_id,n),s.render(),e.isIE&&!e.isIE11&&a.attachEvent("onunload",o),n.page_window=null,!0;case"mceRemoveEditor":case"mceRemoveControl":return s&&s.remove(),!0;case"mceToggleEditor":return s?(s.isHidden()?s.show():s.hide(),!0):(r.execCommand("mceAddControl",0,n),!0)}return r.activeEditor?r.activeEditor.execCommand(t,i,n):!1},execInstanceCommand:function(e,t,i,n){var o=this.get(e);return o?o.execCommand(t,i,n):!1},triggerSave:function(){i(this.editors,function(e){e.save()})},addI18n:function(t,n){var o=this.i18n;e.is(t,"string")?i(n,function(e,i){o[t+"."+i]=e}):i(t,function(e,t){i(e,function(e,n){i(e,function(e,i){"common"===n?o[t+"."+i]=e:o[t+"."+n+"."+i]=e})})})},_setActive:function(e){this.selectedInstance=this.activeEditor=e}})}(tinymce),function(e){var t=e.DOM,i=e.dom.Event,n=e.extend,o=e.each,a=e.isGecko,r=e.isIE,s=(e.isWebKit,e.is),l=e.ThemeManager,c=e.PluginManager,u=e.explode;e.create("tinymce.Editor",{Editor:function(t,i){var o=this,a=!0;o.settings=i=n({id:t,language:"en",theme:"advanced",skin:"default",delta_width:0,delta_height:0,popup_css:"",plugins:"",document_base_url:e.documentBaseURL,add_form_submit_trigger:a,submit_patch:a,add_unload_trigger:a,convert_urls:a,relative_urls:a,remove_script_host:a,table_inline_editing:!1,object_resizing:a,accessibility_focus:a,doctype:e.isIE6?'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">':"<!DOCTYPE>",visual:a,font_size_style_values:"xx-small,x-small,small,medium,large,x-large,xx-large",font_size_legacy_values:"xx-small,small,medium,large,x-large,xx-large,300%",apply_source_formatting:a,directionality:"ltr",forced_root_block:"p",hidden_input:a,padd_empty_editor:a,render_ui:a,indentation:"30px",fix_table_elements:a,inline_styles:a,convert_fonts_to_spans:a,indent:"simple",indent_before:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,li,area,table,thead,tfoot,tbody,tr,section,article,hgroup,aside,figure,option,optgroup,datalist",indent_after:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,li,area,table,thead,tfoot,tbody,tr,section,article,hgroup,aside,figure,option,optgroup,datalist",validate:a,entity_encoding:"named",url_converter:o.convertURL,url_converter_scope:o,ie7_compat:a},i),o.id=o.editorId=t,o.isNotDirty=!1,o.plugins={},o.documentBaseURI=new e.util.URI(i.document_base_url||e.documentBaseURL,{base_uri:tinyMCE.baseURI}),o.baseURI=e.baseURI,o.contentCSS=[],o.contentStyles=[],o.setupEvents(),o.execCommands={},o.queryStateCommands={},o.queryValueCommands={},o.execCallback("setup",o)},render:function(){function n(){r.language&&r.language_load!==!1&&d.add(e.baseURL+"/langs/"+r.language+".js"),r.theme&&"function"!=typeof r.theme&&"-"!=r.theme.charAt(0)&&!l.urls[r.theme]&&l.load(r.theme,"themes/"+r.theme+"/editor_template"+e.suffix+".js"),o(u(r.plugins),function(t){if(t&&!c.urls[t])if("-"==t.charAt(0)){t=t.substr(1,t.length);var i=c.dependencies(t);o(i,function(t){var i={prefix:"plugins/",resource:t,suffix:"/editor_plugin"+e.suffix+".js"};t=c.createUrl(i,t),c.load(t.resource,t)})}else{if("safari"==t)return;c.load(t,{prefix:"plugins/",resource:t,suffix:"/editor_plugin"+e.suffix+".js"})}}),d.loadQueue(function(){a.removed||a.init()})}var a=this,r=a.settings,s=a.id,d=e.ScriptLoader;return i.domLoaded?(tinyMCE.settings=r,a.getElement()&&(!e.isIDevice||e.isIOS5)&&(!/TEXTAREA|INPUT/i.test(a.getElement().nodeName)&&r.hidden_input&&t.getParent(s,"form")&&t.insertAfter(t.create("input",{type:"hidden",name:s}),s),r.content_editable||(a.orgVisibility=a.getElement().style.visibility,a.getElement().style.visibility="hidden"),e.WindowManager&&(a.windowManager=new e.WindowManager(a)),"xml"==r.encoding&&a.onGetContent.add(function(e,i){i.save&&(i.content=t.encode(i.content))}),r.add_form_submit_trigger&&a.onSubmit.addToTop(function(){a.initialized&&(a.save(),a.isNotDirty=1)}),r.add_unload_trigger&&(a._beforeUnload=tinyMCE.onBeforeUnload.add(function(){!a.initialized||a.destroyed||a.isHidden()||a.save({format:"raw",no_events:!0})})),e.addUnload(a.destroy,a),r.submit_patch&&a.onBeforeRenderUI.add(function(){var t=a.getElement().form;t&&(t._mceOldSubmit||(t.submit.nodeType||t.submit.length||(a.formElement=t,t._mceOldSubmit=t.submit,t.submit=function(){return e.triggerSave(),a.isNotDirty=1,a.formElement._mceOldSubmit(a.formElement)}),t=null))}),n()),void 0):(i.add(window,"ready",function(){a.render()}),void 0)},init:function(){function i(t){var n,a=c.get(t),r=c.urls[t]||e.documentBaseURL.replace(/\/$/,"");a&&-1===e.inArray(w,t)&&(o(c.dependencies(t),function(e){i(e)}),n=new a(b,r),b.plugins[t]=n,n.init&&(n.init(b,r),w.push(t)))}var n,a,s,d,h,p,f,m,g,v,b=this,y=b.settings,_=b.getElement(),w=[];if(e.add(b),y.aria_label=y.aria_label||t.getAttrib(_,"aria-label",b.getLang("aria.rich_text_area")),y.theme&&("function"!=typeof y.theme?(y.theme=y.theme.replace(/-/,""),h=l.get(y.theme),b.theme=new h,b.theme.init&&b.theme.init(b,l.urls[y.theme]||e.documentBaseURL.replace(/\/$/,""))):b.theme=y.theme),o(u(y.plugins.replace(/\-/g,"")),i),y.popup_css!==!1&&(y.popup_css=y.popup_css?b.documentBaseURI.toAbsolute(y.popup_css):b.baseURI.toAbsolute("themes/"+y.theme+"/skins/"+y.skin+"/dialog.css")),y.popup_css_add&&(y.popup_css+=","+b.documentBaseURI.toAbsolute(y.popup_css_add)),b.controlManager=new e.ControlManager(b),b.onBeforeRenderUI.dispatch(b,b.controlManager),y.render_ui&&b.theme&&(b.orgDisplay=_.style.display,"function"!=typeof y.theme?(a=y.width||_.style.width||_.offsetWidth,s=y.height||_.style.height||_.offsetHeight,d=y.min_height||100,g=/^[0-9\.]+(|px)$/i,g.test(""+a)&&(a=Math.max(parseInt(a,10)+(h.deltaWidth||0),100)),g.test(""+s)&&(s=Math.max(parseInt(s,10)+(h.deltaHeight||0),d)),h=b.theme.renderUI({targetNode:_,width:a,height:s,deltaWidth:y.delta_width,deltaHeight:y.delta_height}),t.setStyles(h.sizeContainer||h.editorContainer,{width:a,height:s}),s=(h.iframeHeight||s)+("number"==typeof s?h.deltaHeight||0:""),d>s&&(s=d)):(h=y.theme(b,_),h.editorContainer.nodeType&&(h.editorContainer=h.editorContainer.id=h.editorContainer.id||b.id+"_parent"),h.iframeContainer.nodeType&&(h.iframeContainer=h.iframeContainer.id=h.iframeContainer.id||b.id+"_iframecontainer"),s=h.iframeHeight||_.offsetHeight,r&&(b.onInit.add(function(e){e.dom.bind(e.getBody(),"beforedeactivate keydown keyup",function(){e.bookmark=e.selection.getBookmark(1)})}),b.onNodeChange.add(function(e){document.activeElement.id==e.id+"_ifr"&&(e.bookmark=e.selection.getBookmark(1))}))),b.editorContainer=h.editorContainer),y.content_css&&o(u(y.content_css),function(e){b.contentCSS.push(b.documentBaseURI.toAbsolute(e))}),y.content_style&&b.contentStyles.push(y.content_style),y.content_editable)return _=n=h=null,b.initContentBody();for(document.domain&&location.hostname!=document.domain&&(e.relaxedDomain=document.domain),b.iframeHTML=y.doctype+'<html><head xmlns="http://www.w3.org/1999/xhtml">',y.document_base_url!=e.documentBaseURL&&(b.iframeHTML+='<base href="'+b.documentBaseURI.getURI()+'" />'),e.isIE8&&(b.iframeHTML+=y.ie7_compat?'<meta http-equiv="X-UA-Compatible" content="IE=7" />':'<meta http-equiv="X-UA-Compatible" content="IE=edge" />'),b.iframeHTML+='<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />',v=0;v<b.contentCSS.length;v++)b.iframeHTML+='<link type="text/css" rel="stylesheet" href="'+b.contentCSS[v]+'" />';b.contentCSS=[],f=y.body_id||"tinymce",-1!=f.indexOf("=")&&(f=b.getParam("body_id","","hash"),f=f[b.id]||f),m=y.body_class||"",-1!=m.indexOf("=")&&(m=b.getParam("body_class","","hash"),m=m[b.id]||""),b.iframeHTML+='</head><body id="'+f+'" class="mceContentBody '+m+'" onload="window.parent.tinyMCE.get(\''+b.id+"').onLoad.dispatch();\"><br></body></html>",e.relaxedDomain&&(r||e.isOpera&&parseFloat(opera.version())<11)&&(p='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinyMCE.get("'+b.id+'");document.write(ed.iframeHTML);document.close();ed.initContentBody();})()'),n=t.add(h.iframeContainer,"iframe",{id:b.id+"_ifr",src:p||'javascript:""',frameBorder:"0",allowTransparency:"true",title:y.aria_label,style:{width:"100%",height:s,display:"block"}}),b.contentAreaContainer=h.iframeContainer,h.editorContainer&&(t.get(h.editorContainer).style.display=b.orgDisplay),_.style.visibility=b.orgVisibility,t.get(b.id).style.display="none",t.setAttrib(b.id,"aria-hidden",!0),e.relaxedDomain&&p||b.initContentBody(),_=n=h=null},initContentBody:function(){var i,n,a=this,s=a.settings,l=t.get(a.id),c=a.getDoc();r&&e.relaxedDomain||s.content_editable||(c.open(),c.write(a.iframeHTML),c.close(),e.relaxedDomain&&(c.domain=e.relaxedDomain)),s.content_editable&&(t.addClass(l,"mceContentBody"),a.contentDocument=c=s.content_document||document,a.contentWindow=s.content_window||window,a.bodyElement=l,s.content_document=s.content_window=null),i=a.getBody(),i.disabled=!0,s.readonly||(i.contentEditable=a.getParam("content_editable_state",!0)),i.disabled=!1,a.schema=new e.html.Schema(s),a.dom=new e.dom.DOMUtils(c,{keep_values:!0,url_converter:a.convertURL,url_converter_scope:a,hex_colors:s.force_hex_style_colors,class_filter:s.class_filter,update_styles:!0,root_element:s.content_editable?a.id:null,schema:a.schema}),a.parser=new e.html.DomParser(s,a.schema),a.parser.addAttributeFilter("src,href,style",function(e,t){for(var i,n,o,r=e.length,s=a.dom;r--;)i=e[r],n=i.attr(t),o="data-mce-"+t,i.attributes.map[o]||("style"===t?i.attr(o,s.serializeStyle(s.parseStyle(n),i.name)):i.attr(o,a.convertURL(n,t,i.name)))}),a.parser.addNodeFilter("script",function(e){for(var t,i=e.length;i--;)t=e[i],t.attr("type","mce-"+(t.attr("type")||"text/javascript"))}),a.parser.addNodeFilter("#cdata",function(e){for(var t,i=e.length;i--;)t=e[i],t.type=8,t.name="#comment",t.value="[CDATA["+t.value+"]]"}),a.parser.addNodeFilter("p,h1,h2,h3,h4,h5,h6,div",function(t){for(var i,n=t.length,o=a.schema.getNonEmptyElements();n--;)i=t[n],i.isEmpty(o)&&(i.empty().append(new e.html.Node("br",1)).shortEnded=!0)}),a.serializer=new e.dom.Serializer(s,a.dom,a.schema),a.selection=new e.dom.Selection(a.dom,a.getWin(),a.serializer,a),a.formatter=new e.Formatter(a),a.undoManager=new e.UndoManager(a),a.forceBlocks=new e.ForceBlocks(a),a.enterKey=new e.EnterKey(a),a.editorCommands=new e.EditorCommands(a),a.onExecCommand.add(function(e,t){/^(FontName|FontSize)$/.test(t)||a.nodeChanged()}),a.serializer.onPreProcess.add(function(e,t){return a.onPreProcess.dispatch(a,t,e)}),a.serializer.onPostProcess.add(function(e,t){return a.onPostProcess.dispatch(a,t,e)}),a.onPreInit.dispatch(a),s.browser_spellcheck||s.gecko_spellcheck||(c.body.spellcheck=!1),s.readonly||a.bindNativeEvents(),a.controlManager.onPostRender.dispatch(a,a.controlManager),a.onPostRender.dispatch(a),a.quirks=e.util.Quirks(a),s.directionality&&(i.dir=s.directionality),s.nowrap&&(i.style.whiteSpace="nowrap"),s.protect&&a.onBeforeSetContent.add(function(e,t){o(s.protect,function(e){t.content=t.content.replace(e,function(e){return"<!--mce:protected "+escape(e)+"-->"})})}),a.onSetContent.add(function(){a.addVisual(a.getBody())}),s.padd_empty_editor&&a.onPostProcess.add(function(e,t){t.content=t.content.replace(/^(<p[^>]*>(&nbsp;|&#160;|\s|\u00a0|)<\/p>[\r\n]*|<br \/>[\r\n]*)$/,"")}),a.load({initial:!0,format:"html"}),a.startContent=a.getContent({format:"raw"}),a.initialized=!0,a.onInit.dispatch(a),a.execCallback("setupcontent_callback",a.id,i,c),a.execCallback("init_instance_callback",a),a.focus(!0),a.nodeChanged({initial:!0}),a.contentStyles.length>0&&(n="",o(a.contentStyles,function(e){n+=e+"\r\n"}),a.dom.addStyle(n)),o(a.contentCSS,function(e){a.dom.loadCSS(e)}),s.auto_focus&&setTimeout(function(){var t=e.get(s.auto_focus);t.selection.select(t.getBody(),1),t.selection.collapse(1),t.getBody().focus(),t.getWin().focus()},100),l=c=i=null},focus:function(t){var i,n,o,a,r=this,s=r.selection,l=r.settings.content_editable,c=r.getDoc();t||(r.bookmark&&(s.moveToBookmark(r.bookmark),r.bookmark=null),n=s.getRng(),n.item&&(o=n.item(0)),r._refreshContentEditable(),l||r.getWin().focus(),(e.isGecko||l)&&(a=r.getBody(),a.setActive&&!e.isIE11?a.setActive():a.focus(),l&&s.normalize()),o&&o.ownerDocument==c&&(n=c.body.createControlRange(),n.addElement(o),n.select())),e.activeEditor!=r&&(null!=(i=e.activeEditor)&&i.onDeactivate.dispatch(i,r),r.onActivate.dispatch(r,i)),e._setActive(r)},execCallback:function(t){var i,n=this,o=n.settings[t];if(o)return n.callbackLookup&&(i=n.callbackLookup[t])&&(o=i.func,i=i.scope),s(o,"string")&&(i=o.replace(/\.\w+$/,""),i=i?e.resolve(i):0,o=e.resolve(o),n.callbackLookup=n.callbackLookup||{},n.callbackLookup[t]={func:o,scope:i}),o.apply(i||n,Array.prototype.slice.call(arguments,1))},translate:function(t){var i=this.settings.language||"en",n=e.i18n;return t?n[i+"."+t]||t.replace(/\{\#([^\}]+)\}/g,function(e,t){return n[i+"."+t]||"{#"+t+"}"}):""},getLang:function(t,i){return e.i18n[(this.settings.language||"en")+"."+t]||(s(i)?i:"{#"+t+"}")},getParam:function(t,i,n){var a,r=e.trim,l=s(this.settings[t])?this.settings[t]:i;return"hash"===n?(a={},s(l,"string")?o(l.indexOf("=")>0?l.split(/[;,](?![^=;,]*(?:[;,]|$))/):l.split(","),function(e){e=e.split("="),a[r(e[0])]=e.length>1?r(e[1]):r(e)}):a=l,a):l},nodeChanged:function(e){var t,i=this,n=i.selection;i.initialized&&(e=e||{},t=n.getStart()||i.getBody(),t=r&&t.ownerDocument!=i.getDoc()?i.getBody():t,e.parents=[],i.dom.getParent(t,function(t){return"BODY"==t.nodeName?!0:(e.parents.push(t),void 0)}),i.onNodeChange.dispatch(i,e?e.controlManager||i.controlManager:i.controlManager,t,n.isCollapsed(),e))},addButton:function(e,t){var i=this;i.buttons=i.buttons||{},i.buttons[e]=t},addCommand:function(e,t,i){this.execCommands[e]={func:t,scope:i||this}},addQueryStateHandler:function(e,t,i){this.queryStateCommands[e]={func:t,scope:i||this}},addQueryValueHandler:function(e,t,i){this.queryValueCommands[e]={func:t,scope:i||this}},addShortcut:function(e,t,i,n){var a,r=this;return r.settings.custom_shortcuts===!1?!1:(r.shortcuts=r.shortcuts||{},s(i,"string")&&(a=i,i=function(){r.execCommand(a,!1,null)}),s(i,"object")&&(a=i,i=function(){r.execCommand(a[0],a[1],a[2])}),o(u(e),function(e){var a={func:i,scope:n||this,desc:r.translate(t),alt:!1,ctrl:!1,shift:!1};o(u(e,"+"),function(e){switch(e){case"alt":case"ctrl":case"shift":a[e]=!0;break;default:a.charCode=e.charCodeAt(0),a.keyCode=e.toUpperCase().charCodeAt(0)}}),r.shortcuts[(a.ctrl?"ctrl":"")+","+(a.alt?"alt":"")+","+(a.shift?"shift":"")+","+a.keyCode]=a}),!0)},execCommand:function(e,t,i,a){var r,s,l=this,c=0;return/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(e)||a&&a.skip_focus||l.focus(),a=n({},a),l.onBeforeExecCommand.dispatch(l,e,t,i,a),a.terminate?!1:l.execCallback("execcommand_callback",l.id,l.selection.getNode(),e,t,i)?(l.onExecCommand.dispatch(l,e,t,i,a),!0):(r=l.execCommands[e])&&(s=r.func.call(r.scope,t,i),s!==!0)?(l.onExecCommand.dispatch(l,e,t,i,a),s):(o(l.plugins,function(n){return n.execCommand&&n.execCommand(e,t,i)?(l.onExecCommand.dispatch(l,e,t,i,a),c=1,!1):void 0}),c?!0:l.theme&&l.theme.execCommand&&l.theme.execCommand(e,t,i)?(l.onExecCommand.dispatch(l,e,t,i,a),!0):l.editorCommands.execCommand(e,t,i)?(l.onExecCommand.dispatch(l,e,t,i,a),!0):(l.getDoc().execCommand(e,t,i),l.onExecCommand.dispatch(l,e,t,i,a),void 0))},queryCommandState:function(e){var t,i,n=this;if(!n._isHidden()){if((t=n.queryStateCommands[e])&&(i=t.func.call(t.scope),i!==!0))return i;if(t=n.editorCommands.queryCommandState(e),-1!==t)return t;try{return this.getDoc().queryCommandState(e)}catch(o){}}},queryCommandValue:function(e){var t,i,n=this;if(!n._isHidden()){if((t=n.queryValueCommands[e])&&(i=t.func.call(t.scope),i!==!0))return i;if(t=n.editorCommands.queryCommandValue(e),s(t))return t;try{return this.getDoc().queryCommandValue(e)}catch(o){}}},show:function(){var e=this;t.show(e.getContainer()),t.hide(e.id),e.load()},hide:function(){var e=this,i=e.getDoc();r&&i&&i.execCommand("SelectAll"),e.save(),t.hide(e.getContainer()),t.setStyle(e.id,"display",e.orgDisplay)},isHidden:function(){return!t.isHidden(this.id)},setProgressState:function(e,t,i){return this.onSetProgressState.dispatch(this,e,t,i),e},load:function(e){var t,i=this,n=i.getElement();return n?(e=e||{},e.load=!0,t=i.setContent(s(n.value)?n.value:n.innerHTML,e),e.element=n,e.no_events||i.onLoadContent.dispatch(i,e),e.element=n=null,t):void 0},save:function(e){var i,n,a=this,r=a.getElement();if(r&&a.initialized)return e=e||{},e.save=!0,e.element=r,i=e.content=a.getContent(e),e.no_events||a.onSaveContent.dispatch(a,e),i=e.content,/TEXTAREA|INPUT/i.test(r.nodeName)?r.value=i:(r.innerHTML=i,(n=t.getParent(a.id,"form"))&&o(n.elements,function(e){return e.name==a.id?(e.value=i,!1):void 0})),e.element=r=null,i},setContent:function(t,i){var n,o=this,a=o.getBody();return i=i||{},i.format=i.format||"html",i.set=!0,i.content=t,i.no_events||o.onBeforeSetContent.dispatch(o,i),t=i.content,e.isIE||0!==t.length&&!/^\s+$/.test(t)?("raw"!==i.format&&(t=new e.html.Serializer({},o.schema).serialize(o.parser.parse(t))),i.content=e.trim(t),o.dom.setHTML(a,i.content),i.no_events||o.onSetContent.dispatch(o,i),o.settings.content_editable&&document.activeElement!==o.getBody()||o.selection.normalize(),i.content):(n=o.settings.forced_root_block,t=n?"<"+n+'><br data-mce-bogus="1"></'+n+">":'<br data-mce-bogus="1">',a.innerHTML=t,o.selection.select(a,!0),o.selection.collapse(!0),void 0)},getContent:function(t){var i,n=this,o=n.getBody();return t=t||{},t.format=t.format||"html",t.get=!0,t.getInner=!0,t.no_events||n.onBeforeGetContent.dispatch(n,t),i="raw"==t.format?o.innerHTML:"text"==t.format?o.innerText||o.textContent:n.serializer.serialize(o,t),t.content="text"!=t.format?e.trim(i):i,t.no_events||n.onGetContent.dispatch(n,t),t.content},isDirty:function(){var t=this;return e.trim(t.startContent)!=e.trim(t.getContent({format:"raw",no_events:1}))&&!t.isNotDirty},getContainer:function(){var e=this;return e.container||(e.container=t.get(e.editorContainer||e.id+"_parent")),e.container},getContentAreaContainer:function(){return this.contentAreaContainer},getElement:function(){return t.get(this.settings.content_element||this.id)},getWin:function(){var e,i=this;return i.contentWindow||(e=t.get(i.id+"_ifr"),e&&(i.contentWindow=e.contentWindow)),i.contentWindow},getDoc:function(){var e,t=this;return t.contentDocument||(e=t.getWin(),e&&(t.contentDocument=e.document)),t.contentDocument},getBody:function(){return this.bodyElement||this.getDoc().body},convertURL:function(e,t,i){var n=this,o=n.settings;return o.urlconverter_callback?n.execCallback("urlconverter_callback",e,i,!0,t):!o.convert_urls||i&&"LINK"==i.nodeName||0===e.indexOf("file:")?e:o.relative_urls?n.documentBaseURI.toRelative(e):e=n.documentBaseURI.toAbsolute(e,o.remove_script_host)},addVisual:function(e){var t,i=this,n=i.settings,a=i.dom;e=e||i.getBody(),s(i.hasVisual)||(i.hasVisual=n.visual),o(a.select("table,a",e),function(e){var o;switch(e.nodeName){case"TABLE":return t=n.visual_table_class||"mceItemTable",o=a.getAttrib(e,"border"),o&&"0"!=o||(i.hasVisual?a.addClass(e,t):a.removeClass(e,t)),void 0;case"A":return a.getAttrib(e,"href",!1)||(o=a.getAttrib(e,"name")||e.id,t="mceItemAnchor",o&&(i.hasVisual?a.addClass(e,t):a.removeClass(e,t))),void 0}}),i.onVisualAid.dispatch(i,e,i.hasVisual)},remove:function(){var n=this,o=n.getContainer(),a=n.getDoc();n.removed||(n.removed=1,r&&a&&a.execCommand("SelectAll"),n.save(),t.setStyle(n.id,"display",n.orgDisplay),n.settings.content_editable||(i.unbind(n.getWin()),i.unbind(n.getDoc())),i.unbind(n.getBody()),i.clear(o),n.execCallback("remove_instance_callback",n),n.onRemove.dispatch(n),n.onExecCommand.listeners=[],e.remove(n),t.remove(o))},destroy:function(t){var n=this;n.destroyed||(a&&(i.unbind(n.getDoc()),i.unbind(n.getWin()),i.unbind(n.getBody())),t||(e.removeUnload(n.destroy),tinyMCE.onBeforeUnload.remove(n._beforeUnload),n.theme&&n.theme.destroy&&n.theme.destroy(),n.controlManager.destroy(),n.selection.destroy(),n.dom.destroy()),n.formElement&&(n.formElement.submit=n.formElement._mceOldSubmit,n.formElement._mceOldSubmit=null),n.contentAreaContainer=n.formElement=n.container=n.settings.content_element=n.bodyElement=n.contentDocument=n.contentWindow=null,n.selection&&(n.selection=n.selection.win=n.selection.dom=n.selection.dom.doc=null),n.destroyed=1)},_refreshContentEditable:function(){var e,t,i=this;i._isHidden()&&(e=i.getBody(),t=e.parentNode,t.removeChild(e),t.appendChild(e),e.focus())},_isHidden:function(){var e;return a?(e=this.selection.getSel(),!e||!e.rangeCount||0===e.rangeCount):0}})}(tinymce),function(e){var t=e.each;e.Editor.prototype.setupEvents=function(){var i=this,n=i.settings;t(["onPreInit","onBeforeRenderUI","onPostRender","onLoad","onInit","onRemove","onActivate","onDeactivate","onClick","onEvent","onMouseUp","onMouseDown","onDblClick","onKeyDown","onKeyUp","onKeyPress","onContextMenu","onSubmit","onReset","onPaste","onPreProcess","onPostProcess","onBeforeSetContent","onBeforeGetContent","onSetContent","onGetContent","onLoadContent","onSaveContent","onNodeChange","onChange","onBeforeExecCommand","onExecCommand","onUndo","onRedo","onVisualAid","onSetProgressState","onSetAttrib"],function(t){i[t]=new e.util.Dispatcher(i)}),n.cleanup_callback&&(i.onBeforeSetContent.add(function(e,t){t.content=e.execCallback("cleanup_callback","insert_to_editor",t.content,t)}),i.onPreProcess.add(function(e,t){t.set&&e.execCallback("cleanup_callback","insert_to_editor_dom",t.node,t),t.get&&e.execCallback("cleanup_callback","get_from_editor_dom",t.node,t)}),i.onPostProcess.add(function(e,t){t.set&&(t.content=e.execCallback("cleanup_callback","insert_to_editor",t.content,t)),t.get&&(t.content=e.execCallback("cleanup_callback","get_from_editor",t.content,t))})),n.save_callback&&i.onGetContent.add(function(e,t){t.save&&(t.content=e.execCallback("save_callback",e.id,t.content,e.getBody()))}),n.handle_event_callback&&i.onEvent.add(function(e,t,n){i.execCallback("handle_event_callback",t,e,n)===!1&&(t.preventDefault(),t.stopPropagation())}),n.handle_node_change_callback&&i.onNodeChange.add(function(e,t,i){e.execCallback("handle_node_change_callback",e.id,i,-1,-1,!0,e.selection.isCollapsed())}),n.save_callback&&i.onSaveContent.add(function(e,t){var i=e.execCallback("save_callback",e.id,t.content,e.getBody());i&&(t.content=i)}),n.onchange_callback&&i.onChange.add(function(e,t){e.execCallback("onchange_callback",e,t)})},e.Editor.prototype.bindNativeEvents=function(){function i(e,t){e.type;s.removed||s.onEvent.dispatch(s,e,t)!==!1&&s[r[e.fakeType||e.type]].dispatch(s,e,t)}function n(){s.focus(!0)}function o(t,i){65==i.keyCode&&e.VK.metaKeyPressed(i)||s.selection.normalize(),s.nodeChanged()}function a(i,n){(i.altKey||i.ctrlKey||i.metaKey)&&t(s.shortcuts,function(t){var o=e.isMac?i.metaKey:i.ctrlKey;if(t.ctrl==o&&t.alt==i.altKey&&t.shift==i.shiftKey)return i.keyCode==t.keyCode||i.charCode&&i.charCode==t.charCode?(i.preventDefault(),n&&t.func.call(t.scope),!0):void 0})}var r,s=this,l=s.settings,c=s.dom;r={mouseup:"onMouseUp",mousedown:"onMouseDown",click:"onClick",keyup:"onKeyUp",keydown:"onKeyDown",keypress:"onKeyPress",submit:"onSubmit",reset:"onReset",contextmenu:"onContextMenu",dblclick:"onDblClick",paste:"onPaste"},t(r,function(t,n){var o=l.content_editable?s.getBody():s.getDoc();switch(n){case"contextmenu":c.bind(o,n,i);break;case"paste":c.bind(s.getBody(),n,i);break;case"submit":case"reset":c.bind(s.getElement().form||e.DOM.getParent(s.id,"form"),n,i);break;default:c.bind(o,n,i)}}),c.bind(l.content_editable?s.getBody():e.isGecko?s.getDoc():s.getWin(),"focus",function(){s.focus(!0)}),l.content_editable&&e.isOpera&&(c.bind(s.getBody(),"click",n),c.bind(s.getBody(),"keydown",n)),s.onMouseUp.add(o),s.onKeyUp.add(function(t,i){var n=i.keyCode;(n>=33&&36>=n||n>=37&&40>=n||13==n||45==n||46==n||8==n||e.isMac&&(91==n||93==n)||i.ctrlKey)&&o(t,i)}),s.onReset.add(function(){s.setContent(s.startContent,{format:"raw"})}),s.onKeyUp.add(function(e,t){a(t)}),s.onKeyPress.add(function(e,t){a(t)}),s.onKeyDown.add(function(e,t){a(t,!0)}),e.isOpera&&s.onClick.add(function(e,t){t.preventDefault()})}}(tinymce),function(e){var t,i=e.each,n=!0,o=!1;e.EditorCommands=function(a){function r(e,t,i){var a;return e=e.toLowerCase(),(a=b.exec[e])?(a(e,t,i),n):o}function s(e){var t;return e=e.toLowerCase(),(t=b.state[e])?t(e):-1}function l(e){var t;return e=e.toLowerCase(),(t=b.value[e])?t(e):o}function c(e,t){t=t||"exec",i(e,function(e,n){i(n.toLowerCase().split(","),function(i){b[t][i]=e})})}function u(e,i,n){return i===t&&(i=o),n===t&&(n=null),a.getDoc().execCommand(e,i,n)}function d(e){return _.match(e)}function h(e,i){_.toggle(e,i?{value:i}:t)}function p(e){m=v.getBookmark(e)}function f(){v.moveToBookmark(m)}var m,g=a.dom,v=a.selection,b={state:{},exec:{},value:{}},y=a.settings,_=a.formatter;e.extend(this,{execCommand:r,queryCommandState:s,queryCommandValue:l,addCommands:c}),c({"mceResetDesignMode,mceBeginUndoLevel":function(){},"mceEndUndoLevel,mceAddUndoLevel":function(){a.undoManager.add()},"Cut,Copy,Paste":function(t){var i,o=a.getDoc();try{u(t)}catch(r){i=n}(i||!o.queryCommandSupported(t))&&(e.isGecko?a.windowManager.confirm(a.getLang("clipboard_msg"),function(e){e&&open("http://www.mozilla.org/editor/midasdemo/securityprefs.html","_blank")}):a.windowManager.alert(a.getLang("clipboard_no_support")))},unlink:function(e){v.isCollapsed()&&v.select(v.getNode()),u(e),v.collapse(o)},"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull":function(e){var t=e.substring(7);i("left,center,right,full".split(","),function(e){t!=e&&_.remove("align"+e)}),h("align"+t),r("mceRepaint")},"InsertUnorderedList,InsertOrderedList":function(e){var t,i;u(e),t=g.getParent(v.getNode(),"ol,ul"),t&&(i=t.parentNode,/^(H[1-6]|P|ADDRESS|PRE)$/.test(i.nodeName)&&(p(),g.split(i,t),f()))},"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":function(e){h(e)},"ForeColor,HiliteColor,FontName":function(e,t,i){h(e,i)},FontSize:function(t,i,n){var o,a;n>=1&&7>=n&&(a=e.explode(y.font_size_style_values),o=e.explode(y.font_size_classes),n=o?o[n-1]||n:a[n-1]||n),h(t,n)},RemoveFormat:function(e){_.remove(e)},mceBlockQuote:function(){h("blockquote")},FormatBlock:function(e,t,i){return h(i||"p")},mceCleanup:function(){var e=v.getBookmark();a.setContent(a.getContent({cleanup:n}),{cleanup:n}),v.moveToBookmark(e)},mceRemoveNode:function(e,t,i){var o=i||v.getNode();o!=a.getBody()&&(p(),a.dom.remove(o,n),f())},mceSelectNodeDepth:function(e,t,i){var n=0;g.getParent(v.getNode(),function(e){return 1==e.nodeType&&n++==i?(v.select(e),o):void 0},a.getBody())},mceSelectNode:function(e,t,i){v.select(i)},mceInsertContent:function(t,i,n){var o,r,s,l,c,u,d,h,p,f,m,b,y,_;if(o=a.parser,r=new e.html.Serializer({},a.schema),y='<span id="mce_marker" data-mce-type="bookmark"></span>',u={content:n,format:"html"},v.onBeforeSetContent.dispatch(v,u),n=u.content,-1==n.indexOf("{$caret}")&&(n+="{$caret}"),n=n.replace(/\{\$caret\}/,y),v.isCollapsed()||a.getDoc().execCommand("Delete",!1,null),s=v.getNode(),u={context:s.nodeName.toLowerCase()},c=o.parse(n,u),m=c.lastChild,"mce_marker"==m.attr("id"))for(d=m,m=m.prev;m;m=m.walk(!0))if(3==m.type||!g.isBlock(m.name)){m.parent.insert(d,m,"br"===m.name);break}if(u.invalid){for(v.setContent(y),s=v.getNode(),l=a.getBody(),9==s.nodeType?s=m=l:m=s;m!==l;)s=m,m=m.parentNode;n=s==l?l.innerHTML:g.getOuterHTML(s),n=r.serialize(o.parse(n.replace(/<span (id="mce_marker"|id=mce_marker).+?<\/span>/i,function(){return r.serialize(c)}))),s==l?g.setHTML(l,n):g.setOuterHTML(s,n)}else n=r.serialize(c),m=s.firstChild,b=s.lastChild,!m||m===b&&"BR"===m.nodeName?g.setHTML(s,n):v.setContent(n);d=g.get("mce_marker"),h=g.getRect(d),p=g.getViewPort(a.getWin()),(h.y+h.h>p.y+p.h||h.y<p.y||h.x>p.x+p.w||h.x<p.x)&&(_=e.isIE?a.getDoc().documentElement:a.getBody(),_.scrollLeft=h.x,_.scrollTop=h.y-p.h+25),f=g.createRng(),m=d.previousSibling,m&&3==m.nodeType?f.setStart(m,m.nodeValue.length):(f.setStartBefore(d),f.setEndBefore(d)),g.remove(d),v.setRng(f),v.onSetContent.dispatch(v,u),a.addVisual()},mceInsertRawHTML:function(e,t,i){v.setContent("tiny_mce_marker"),a.setContent(a.getContent().replace(/tiny_mce_marker/g,function(){return i}))},mceToggleFormat:function(e,t,i){h(i)},mceSetContent:function(e,t,i){a.setContent(i)},"Indent,Outdent":function(e){var t,n,o;t=y.indentation,n=/[a-z%]+$/i.exec(t),t=parseInt(t),s("InsertUnorderedList")||s("InsertOrderedList")?u(e):(y.forced_root_block||g.getParent(v.getNode(),g.isBlock)||_.apply("div"),i(v.getSelectedBlocks(),function(i){"outdent"==e?(o=Math.max(0,parseInt(i.style.paddingLeft||0)-t),g.setStyle(i,"paddingLeft",o?o+n:"")):g.setStyle(i,"paddingLeft",parseInt(i.style.paddingLeft||0)+t+n)}))},mceRepaint:function(){if(e.isGecko)try{p(n),v.getSel()&&v.getSel().selectAllChildren(a.getBody()),v.collapse(n),f()}catch(t){}},mceToggleFormat:function(e,t,i){_.toggle(i)},InsertHorizontalRule:function(){a.execCommand("mceInsertContent",!1,"<hr />")},mceToggleVisualAid:function(){a.hasVisual=!a.hasVisual,a.addVisual()},mceReplaceContent:function(e,t,i){a.execCommand("mceInsertContent",!1,i.replace(/\{\$selection\}/g,v.getContent({format:"text"})))},mceInsertLink:function(e,t,i){var n;"string"==typeof i&&(i={href:i}),n=g.getParent(v.getNode(),"a"),i.href=i.href.replace(" ","%20"),n&&i.href||_.remove("link"),i.href&&_.apply("link",i,n)
81
81
  },selectAll:function(){var e=g.getRoot(),t=g.createRng();v.getRng().setStart?(t.setStart(e,0),t.setEnd(e,e.childNodes.length),v.setRng(t)):u("SelectAll")}}),c({"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull":function(t){var i="align"+t.substring(7),o=v.isCollapsed()?[g.getParent(v.getNode(),g.isBlock)]:v.getSelectedBlocks(),a=e.map(o,function(e){return!!_.matchNode(e,i)});return-1!==e.inArray(a,n)},"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":function(e){return d(e)},mceBlockQuote:function(){return d("blockquote")},Outdent:function(){var e;if(y.inline_styles){if((e=g.getParent(v.getStart(),g.isBlock))&&parseInt(e.style.paddingLeft)>0)return n;if((e=g.getParent(v.getEnd(),g.isBlock))&&parseInt(e.style.paddingLeft)>0)return n}return s("InsertUnorderedList")||s("InsertOrderedList")||!y.inline_styles&&!!g.getParent(v.getNode(),"BLOCKQUOTE")},"InsertUnorderedList,InsertOrderedList":function(e){var t=g.getParent(v.getNode(),"ul,ol");return t&&("insertunorderedlist"===e&&"UL"===t.tagName||"insertorderedlist"===e&&"OL"===t.tagName)}},"state"),c({"FontSize,FontName":function(e){var t,i=0;return(t=g.getParent(v.getNode(),"span"))&&(i="fontsize"==e?t.style.fontSize:t.style.fontFamily.replace(/, /g,",").replace(/[\'\"]/g,"").toLowerCase()),i}},"value"),c({Undo:function(){a.undoManager.undo()},Redo:function(){a.undoManager.redo()}})}}(tinymce),function(e){var t=e.util.Dispatcher;e.UndoManager=function(i){function n(){return e.trim(i.getContent({format:"raw",no_events:1}).replace(/<span[^>]+data-mce-bogus[^>]+>[\u200B\uFEFF]+<\/span>/g,""))}function o(){a.typing=!1,a.add()}var a,r,s,l,c,u=0,d=[];return onBeforeAdd=new t(a),s=new t(a),l=new t(a),c=new t(a),s.add(function(e,t){return e.hasUndo()?i.onChange.dispatch(i,t,e):void 0}),l.add(function(e,t){return i.onUndo.dispatch(i,t,e)}),c.add(function(e,t){return i.onRedo.dispatch(i,t,e)}),i.onInit.add(function(){a.add()}),i.onBeforeExecCommand.add(function(e,t,i,n,o){"Undo"==t||"Redo"==t||"mceRepaint"==t||o&&o.skip_undo||a.beforeChange()}),i.onExecCommand.add(function(e,t,i,n,o){"Undo"==t||"Redo"==t||"mceRepaint"==t||o&&o.skip_undo||a.add()}),i.onSaveContent.add(o),i.dom.bind(i.dom.getRoot(),"dragend",o),i.dom.bind(i.getBody(),"focusout",function(){!i.removed&&a.typing&&o()}),i.onKeyUp.add(function(e,t){var i=t.keyCode;(i>=33&&36>=i||i>=37&&40>=i||45==i||13==i||t.ctrlKey)&&o()}),i.onKeyDown.add(function(e,t){var i=t.keyCode;return i>=33&&36>=i||i>=37&&40>=i||45==i?(a.typing&&o(),void 0):((16>i||i>20)&&224!=i&&91!=i&&!a.typing&&(a.beforeChange(),a.typing=!0,a.add()),void 0)}),i.onMouseDown.add(function(){a.typing&&o()}),i.addShortcut("ctrl+z","undo_desc","Undo"),i.addShortcut("ctrl+y","redo_desc","Redo"),a={data:d,typing:!1,onBeforeAdd:onBeforeAdd,onAdd:s,onUndo:l,onRedo:c,beforeChange:function(){r=i.selection.getBookmark(2,!0)},add:function(e){var t,o,s=i.settings;if(e=e||{},e.content=n(),a.onBeforeAdd.dispatch(a,e),o=d[u],o&&o.content==e.content)return null;if(d[u]&&(d[u].beforeBookmark=r),s.custom_undo_redo_levels&&d.length>s.custom_undo_redo_levels){for(t=0;t<d.length-1;t++)d[t]=d[t+1];d.length--,u=d.length}return e.bookmark=i.selection.getBookmark(2,!0),u<d.length-1&&(d.length=u+1),d.push(e),u=d.length-1,a.onAdd.dispatch(a,e),i.isNotDirty=0,e},undo:function(){var e;return a.typing&&(a.add(),a.typing=!1),u>0&&(e=d[--u],i.setContent(e.content,{format:"raw"}),i.selection.moveToBookmark(e.beforeBookmark),a.onUndo.dispatch(a,e)),e},redo:function(){var e;return u<d.length-1&&(e=d[++u],i.setContent(e.content,{format:"raw"}),i.selection.moveToBookmark(e.bookmark),a.onRedo.dispatch(a,e)),e},clear:function(){d=[],u=0,a.typing=!1},hasUndo:function(){return u>0||this.typing},hasRedo:function(){return u<d.length-1&&!this.typing}}}}(tinymce),tinymce.ForceBlocks=function(e){function t(){var t,r,s,l,c,u,d,h,p,f=o.getStart(),m=e.getBody(),g=-16777215;if(f&&1===f.nodeType&&i.forced_root_block){for(;f&&f!=m;){if(a[f.nodeName])return;f=f.parentNode}for(t=o.getRng(),t.setStart?(r=t.startContainer,s=t.startOffset,l=t.endContainer,c=t.endOffset):(t.item&&(f=t.item(0),t=e.getDoc().body.createTextRange(),t.moveToElementText(f)),p=t.parentElement().ownerDocument===e.getDoc(),tmpRng=t.duplicate(),tmpRng.collapse(!0),s=-1*tmpRng.move("character",g),tmpRng.collapsed||(tmpRng=t.duplicate(),tmpRng.collapse(!1),c=-1*tmpRng.move("character",g)-s)),f=m.firstChild;f;)if(3===f.nodeType||1==f.nodeType&&!a[f.nodeName]){if(3===f.nodeType&&0==f.nodeValue.length){d=f,f=f.nextSibling,n.remove(d);continue}u||(u=n.create(i.forced_root_block),f.parentNode.insertBefore(u,f),h=!0),d=f,f=f.nextSibling,u.appendChild(d)}else u=null,f=f.nextSibling;if(h){if(t.setStart)t.setStart(r,s),t.setEnd(l,c),o.setRng(t);else if(p)try{t=e.getDoc().body.createTextRange(),t.moveToElementText(m),t.collapse(!0),t.moveStart("character",s),c>0&&t.moveEnd("character",c),t.select()}catch(v){}e.nodeChanged()}}}var i=e.settings,n=e.dom,o=e.selection,a=e.schema.getBlockElements();i.forced_root_block&&(e.onKeyUp.add(t),e.onNodeChange.add(t))},function(e){var t=(e.DOM,e.dom.Event),i=e.each,n=e.extend;e.create("tinymce.ControlManager",{ControlManager:function(t,n){var o=this;n=n||{},o.editor=t,o.controls={},o.onAdd=new e.util.Dispatcher(o),o.onPostRender=new e.util.Dispatcher(o),o.prefix=n.prefix||t.id+"_",o._cls={},o.onPostRender.add(function(){i(o.controls,function(e){e.postRender()})})},get:function(e){return this.controls[this.prefix+e]||this.controls[e]},setActive:function(e,t){var i=null;return(i=this.get(e))&&i.setActive(t),i},setDisabled:function(e,t){var i=null;return(i=this.get(e))&&i.setDisabled(t),i},add:function(e){var t=this;return e&&(t.controls[e.id]=e,t.onAdd.dispatch(e,t)),e},createControl:function(e){var t,n,o,a,r=this,s=r.editor;for(r.controlFactories||(r.controlFactories=[],i(s.plugins,function(e){e.createControl&&r.controlFactories.push(e)})),a=r.controlFactories,n=0,o=a.length;o>n;n++)if(t=a[n].createControl(e,r))return r.add(t);return"|"===e||"separator"===e?r.createSeparator():s.buttons&&(t=s.buttons[e])?r.createButton(e,t):r.add(t)},createDropMenu:function(t,i,o){var a,r,s,l,c=this,u=c.editor;return i=n({"class":"mceDropDown",constrain:u.settings.constrain_menus},i),i["class"]=i["class"]+" "+u.getParam("skin")+"Skin",(s=u.getParam("skin_variant"))&&(i["class"]+=" "+u.getParam("skin")+"Skin"+s.substring(0,1).toUpperCase()+s.substring(1)),i["class"]+="rtl"==u.settings.directionality?" mceRtl":"",t=c.prefix+t,l=o||c._cls.dropmenu||e.ui.DropMenu,a=c.controls[t]=new l(t,i),a.onAddItem.add(function(e,t){var i=t.settings;i.title=u.getLang(i.title,i.title),i.onclick||(i.onclick=function(){i.cmd&&u.execCommand(i.cmd,i.ui||!1,i.value)})}),u.onRemove.add(function(){a.destroy()}),e.isIE&&(a.onShowMenu.add(function(){u.focus(),r=u.selection.getBookmark(1)}),a.onHideMenu.add(function(){r&&(u.selection.moveToBookmark(r),r=0)})),c.add(a)},createListBox:function(i,o,a){function r(t){return t.settings.use_accessible_selects&&!e.isGecko}var s,l,c=this,u=c.editor;return c.get(i)?null:(o.title=u.translate(o.title),o.scope=o.scope||u,o.onselect||(o.onselect=function(e){u.execCommand(o.cmd,o.ui||!1,e||o.value)}),o=n({title:o.title,"class":"mce_"+i,scope:o.scope,control_manager:c},o),i=c.prefix+i,u.settings.use_native_selects||r(u)?s=new e.ui.NativeListBox(i,o):(l=a||c._cls.listbox||e.ui.ListBox,s=new l(i,o,u)),c.controls[i]=s,e.isWebKit&&s.onPostRender.add(function(e,i){t.add(i,"mousedown",function(){u.bookmark=u.selection.getBookmark(1)}),t.add(i,"focus",function(){u.selection.moveToBookmark(u.bookmark),u.bookmark=null})}),s.hideMenu&&u.onMouseDown.add(s.hideMenu,s),c.add(s))},createButton:function(t,i,o){var a,r,s=this,l=s.editor;return s.get(t)?null:(i.title=l.translate(i.title),i.label=l.translate(i.label),i.scope=i.scope||l,i.onclick||i.menu_button||(i.onclick=function(){l.execCommand(i.cmd,i.ui||!1,i.value)}),i=n({title:i.title,"class":"mce_"+t,unavailable_prefix:l.getLang("unavailable",""),scope:i.scope,control_manager:s},i),t=s.prefix+t,i.menu_button?(r=o||s._cls.menubutton||e.ui.MenuButton,a=new r(t,i,l),l.onMouseDown.add(a.hideMenu,a)):(r=s._cls.button||e.ui.Button,a=new r(t,i,l)),s.add(a))},createMenuButton:function(e,t,i){return t=t||{},t.menu_button=1,this.createButton(e,t,i)},createSplitButton:function(t,i,o){var a,r,s=this,l=s.editor;return s.get(t)?null:(i.title=l.translate(i.title),i.scope=i.scope||l,i.onclick||(i.onclick=function(e){l.execCommand(i.cmd,i.ui||!1,e||i.value)}),i.onselect||(i.onselect=function(e){l.execCommand(i.cmd,i.ui||!1,e||i.value)}),i=n({title:i.title,"class":"mce_"+t,scope:i.scope,control_manager:s},i),t=s.prefix+t,r=o||s._cls.splitbutton||e.ui.SplitButton,a=s.add(new r(t,i,l)),l.onMouseDown.add(a.hideMenu,a),a)},createColorSplitButton:function(t,i,o){var a,r,s,l=this,c=l.editor;return l.get(t)?null:(i.title=c.translate(i.title),i.scope=i.scope||c,i.onclick||(i.onclick=function(t){e.isIE&&(s=c.selection.getBookmark(1)),c.execCommand(i.cmd,i.ui||!1,t||i.value)}),i.onselect||(i.onselect=function(e){c.execCommand(i.cmd,i.ui||!1,e||i.value)}),i=n({title:i.title,"class":"mce_"+t,menu_class:c.getParam("skin")+"Skin",scope:i.scope,more_colors_title:c.getLang("more_colors")},i),t=l.prefix+t,r=o||l._cls.colorsplitbutton||e.ui.ColorSplitButton,a=new r(t,i,c),c.onMouseDown.add(a.hideMenu,a),c.onRemove.add(function(){a.destroy()}),e.isIE&&(a.onShowMenu.add(function(){c.focus(),s=c.selection.getBookmark(1)}),a.onHideMenu.add(function(){s&&(c.selection.moveToBookmark(s),s=0)})),l.add(a))},createToolbar:function(t,i,n){var o,a,r=this;return t=r.prefix+t,a=n||r._cls.toolbar||e.ui.Toolbar,o=new a(t,i,r.editor),r.get(t)?null:r.add(o)},createToolbarGroup:function(t,i,n){var o,a,r=this;return t=r.prefix+t,a=n||this._cls.toolbarGroup||e.ui.ToolbarGroup,o=new a(t,i,r.editor),r.get(t)?null:r.add(o)},createSeparator:function(t){var i=t||this._cls.separator||e.ui.Separator;return new i},setControlType:function(e,t){return this._cls[e.toLowerCase()]=t},destroy:function(){i(this.controls,function(e){e.destroy()}),this.controls=null}})}(tinymce),function(e){var t=e.util.Dispatcher,i=e.each,n=e.isIE,o=e.isOpera;e.create("tinymce.WindowManager",{WindowManager:function(e){var i=this;i.editor=e,i.onOpen=new t(i),i.onClose=new t(i),i.params={},i.features={}},open:function(t,a){var r,s,l,c,u=this,d="",h="modal"==u.editor.settings.dialog_type,p=e.DOM.getViewPort();t=t||{},a=a||{},s=o?p.w:screen.width,l=o?p.h:screen.height,t.name=t.name||"mc_"+(new Date).getTime(),t.width=parseInt(t.width||320),t.height=parseInt(t.height||240),t.resizable=!0,t.left=t.left||parseInt(s/2)-t.width/2,t.top=t.top||parseInt(l/2)-t.height/2,a.inline=!1,a.mce_width=t.width,a.mce_height=t.height,a.mce_auto_focus=t.auto_focus,h&&n&&(t.center=!0,t.help=!1,t.dialogWidth=t.width+"px",t.dialogHeight=t.height+"px",t.scroll=t.scrollbars||!1),i(t,function(t,i){e.is(t,"boolean")&&(t=t?"yes":"no"),/^(name|url)$/.test(i)||(d+=n&&h?(d?";":"")+i+":"+t:(d?",":"")+i+"="+t)}),u.features=t,u.params=a,u.onOpen.dispatch(u,t,a),c=t.url||t.file,c=e._addVer(c);try{n&&h?(r=1,window.showModalDialog(c,window,d)):r=window.open(c,t.name,d)}catch(f){}r||alert(u.editor.getLang("popup_blocked"))},close:function(e){e.close(),this.onClose.dispatch(this)},createInstance:function(t,i,n,o,a,r){var s=e.resolve(t);return new s(i,n,o,a,r)},confirm:function(e,t,i,n){n=n||window,t.call(i||this,n.confirm(this._decode(this.editor.getLang(e,e))))},alert:function(e,t,i,n){var o=this;n=n||window,n.alert(o._decode(o.editor.getLang(e,e))),t&&t.call(i||o)},resizeBy:function(e,t,i){i.resizeBy(e,t)},_decode:function(t){return e.DOM.decode(t).replace(/\\n/g,"\n")}})}(tinymce),function(e){e.Formatter=function(t){function i(e){return e.nodeType&&(e=e.nodeName),!!t.schema.getTextBlockElements()[e.toLowerCase()]}function n(e,t){return O.getParents(e,t,O.getRoot())}function o(e){return 1===e.nodeType&&"_mce_caret"===e.id}function a(){l({alignleft:[{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"left"},defaultBlock:"div"},{selector:"img,table",collapsed:!1,styles:{"float":"left"}}],aligncenter:[{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"center"},defaultBlock:"div"},{selector:"img",collapsed:!1,styles:{display:"block",marginLeft:"auto",marginRight:"auto"}},{selector:"table",collapsed:!1,styles:{marginLeft:"auto",marginRight:"auto"}}],alignright:[{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"right"},defaultBlock:"div"},{selector:"img,table",collapsed:!1,styles:{"float":"right"}}],alignfull:[{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"justify"},defaultBlock:"div"}],bold:[{inline:"strong",remove:"all"},{inline:"span",styles:{fontWeight:"bold"}},{inline:"b",remove:"all"}],italic:[{inline:"em",remove:"all"},{inline:"span",styles:{fontStyle:"italic"}},{inline:"i",remove:"all"}],underline:[{inline:"span",styles:{textDecoration:"underline"},exact:!0},{inline:"u",remove:"all"}],strikethrough:[{inline:"span",styles:{textDecoration:"line-through"},exact:!0},{inline:"strike",remove:"all"}],forecolor:{inline:"span",styles:{color:"%value"},wrap_links:!1},hilitecolor:{inline:"span",styles:{backgroundColor:"%value"},wrap_links:!1},fontname:{inline:"span",styles:{fontFamily:"%value"}},fontsize:{inline:"span",styles:{fontSize:"%value"}},fontsize_class:{inline:"span",attributes:{"class":"%value"}},blockquote:{block:"blockquote",wrapper:1,remove:"all"},subscript:{inline:"sub"},superscript:{inline:"sup"},link:{inline:"a",selector:"a",remove:"all",split:!0,deep:!0,onmatch:function(){return!0},onformat:function(e,t,i){B(i,function(t,i){O.setAttrib(e,i,t)})}},removeformat:[{selector:"b,strong,em,i,font,u,strike",remove:"all",split:!0,expand:!1,block_expand:!0,deep:!0},{selector:"span",attributes:["style","class"],remove:"empty",split:!0,expand:!1,deep:!0},{selector:"*",attributes:["style","class"],split:!1,expand:!1,deep:!0}]}),B("p h1 h2 h3 h4 h5 h6 div address pre div code dt dd samp".split(/\s/),function(e){l(e,{block:e,remove:"all"})}),l(t.settings.formats)}function r(){t.addShortcut("ctrl+b","bold_desc","Bold"),t.addShortcut("ctrl+i","italic_desc","Italic"),t.addShortcut("ctrl+u","underline_desc","Underline");for(var e=1;6>=e;e++)t.addShortcut("ctrl+"+e,"",["FormatBlock",!1,"h"+e]);t.addShortcut("ctrl+7","",["FormatBlock",!1,"p"]),t.addShortcut("ctrl+8","",["FormatBlock",!1,"div"]),t.addShortcut("ctrl+9","",["FormatBlock",!1,"address"])}function s(e){return e?H[e]:H}function l(e,t){e&&("string"!=typeof e?B(e,function(e,t){l(t,e)}):(t=t.length?t:[t],B(t,function(e){e.deep===I&&(e.deep=!e.selector),e.split===I&&(e.split=!e.selector||e.inline),e.remove===I&&e.selector&&!e.inline&&(e.remove="none"),e.selector&&e.inline&&(e.mixed=!0,e.block_expand=!0),"string"==typeof e.classes&&(e.classes=e.classes.split(/\s+/))}),H[e]=t))}function c(n,a,r){function l(e,t){t=t||y,e&&(t.onformat&&t.onformat(e,t,a,r),B(t.styles,function(t,i){O.setStyle(e,i,_(t,a))}),B(t.attributes,function(t,i){O.setAttrib(e,i,_(t,a))}),B(t.classes,function(t){t=_(t,a),O.hasClass(e,t)||O.addClass(e,t)}))}function u(){function e(e,t){var i=new L(t);for(r=i.current();r;r=i.prev())if(r.childNodes.length>1||r==e||"BR"==r.tagName)return r}var i=t.selection.getRng(),n=i.startContainer,o=i.endContainer;if(n!=o&&0===i.endOffset){var a=e(n,o),s=3==a.nodeType?a.length:a.childNodes.length;i.setEnd(a,s)}return i}function d(t,i,n,o,a){var r,s,l=[],c=-1,u=-1,d=-1;return B(t.childNodes,function(e,t){return"UL"===e.nodeName||"OL"===e.nodeName?(c=t,r=e,!1):void 0}),B(t.childNodes,function(e,t){"SPAN"===e.nodeName&&"bookmark"==O.getAttrib(e,"data-mce-type")&&(e.id==i.id+"_start"?u=t:e.id==i.id+"_end"&&(d=t))}),0>=c||c>u&&d>c?(B(e.grep(t.childNodes),a),0):(s=O.clone(n,V),B(e.grep(t.childNodes),function(e,t){(c>u&&c>t||u>c&&t>c)&&(l.push(e),e.parentNode.removeChild(e))}),c>u?t.insertBefore(s,r):u>c&&t.insertBefore(s,r.nextSibling),o.push(s),B(l,function(e){s.appendChild(e)}),s)}function p(t,r,s){var c,u,p=[],f=!0;c=y.inline||y.block,u=O.create(c),l(u),j.walk(t,function(t){function m(t){var _,w,C,k,T;return T=f,_=t.nodeName.toLowerCase(),w=t.parentNode.nodeName.toLowerCase(),1===t.nodeType&&Y(t)&&(T=f,f="true"===Y(t),k=!0),b(_,"br")?(v=0,y.block&&O.remove(t),void 0):y.wrapper&&h(t,n,a)?(v=0,void 0):f&&!k&&y.block&&!y.wrapper&&i(_)?(t=O.rename(t,c),l(t),p.push(t),v=0,void 0):y.selector&&(B(g,function(e){"collapsed"in e&&e.collapsed!==x||O.is(t,e.selector)&&!o(t)&&(l(t,e),C=!0)}),!y.inline||C)?(v=0,void 0):(!f||k||!F(c,_)||!F(w,c)||!s&&3===t.nodeType&&1===t.nodeValue.length&&65279===t.nodeValue.charCodeAt(0)||o(t)||y.inline&&z(t)?"li"==_&&r?v=d(t,r,u,p,m):(v=0,B(e.grep(t.childNodes),m),k&&(f=T),v=0):(v||(v=O.clone(u,V),t.parentNode.insertBefore(v,t),p.push(v)),v.appendChild(t)),void 0)}var v;B(t,m)}),y.wrap_links===!1&&B(p,function(t){function i(t){var n,o,a;if("A"===t.nodeName){for(o=O.clone(u,V),p.push(o),a=e.grep(t.childNodes),n=0;n<a.length;n++)o.appendChild(a[n]);t.appendChild(o)}B(e.grep(t.childNodes),i)}i(t)}),B(p,function(e){function t(e){var t=0;return B(e.childNodes,function(e){w(e)||S(e)||t++}),t}function i(e){var t,i;return B(e.childNodes,function(e){return 1!=e.nodeType||S(e)||o(e)?void 0:(t=e,V)}),t&&v(t,y)&&(i=O.clone(t,V),l(i),O.replace(i,e,K),O.remove(t,1)),i||e}var r;if(r=t(e),(p.length>1||!z(e))&&0===r)return O.remove(e,1),void 0;if(y.inline||y.wrapper){if(y.exact||1!==r||(e=i(e)),B(g,function(t){B(O.select(t.inline,e),function(e){var i;if(t.wrap_links===!1){i=e.parentNode;do if("A"===i.nodeName)return;while(i=i.parentNode)}k(t,a,e,t.exact?e:null)})}),h(e.parentNode,n,a))return O.remove(e,1),e=0,K;y.merge_with_parents&&O.getParent(e.parentNode,function(t){return h(t,n,a)?(O.remove(e,1),e=0,K):void 0}),e&&y.merge_siblings!==!1&&(e=E(D(e),e),e=E(e,D(e,K)))}})}var f,m,g=s(n),y=g[0],x=R.isCollapsed();if(y)if(r)r.nodeType?(m=O.createRng(),m.setStartBefore(r),m.setEndAfter(r),p(C(m,g),null,!0)):p(r,null,!0);else if(x&&y.inline&&!O.select("td.mceSelected,th.mceSelected").length)A("apply",n,a);else{var T=t.selection.getNode();$||!g[0].defaultBlock||O.getParent(T,O.isBlock)||c(g[0].defaultBlock),t.selection.setRng(u()),f=R.getBookmark(),p(C(R.getRng(K),g),f),y.styles&&(y.styles.color||y.styles.textDecoration)&&(e.walk(T,G,"childNodes"),G(T)),R.moveToBookmark(f),P(R.getRng(K)),t.nodeChanged()}}function u(i,o,a){function r(t){var i,n,a,s,l;if(3!==t.nodeType){if(1===t.nodeType&&Y(t)&&(s=y,y="true"===Y(t),l=!0),i=e.grep(t.childNodes),y&&!l)for(n=0,a=v.length;a>n&&!k(v[n],o,t,t);n++);if(b.deep&&i.length){for(n=0,a=i.length;a>n;n++)r(i[n]);l&&(y=s)}}}function l(e){var t;return B(n(e.parentNode).reverse(),function(e){var n;t||"_start"==e.id||"_end"==e.id||(n=h(e,i,o),n&&n.split!==!1&&(t=e))}),t}function c(e,t,i,n){var a,r,s,l,c,u;if(e){for(u=e.parentNode,a=t.parentNode;a&&a!=u;a=a.parentNode){for(r=O.clone(a,V),c=0;c<v.length;c++)if(k(v[c],o,r,r)){r=0;break}r&&(s&&r.appendChild(s),l||(l=r),s=r)}!n||b.mixed&&z(e)||(t=O.split(e,t)),s&&(i.parentNode.insertBefore(s,i),l.appendChild(i))}return t}function u(e){return c(l(e),e,e,!0)}function d(e){var t=O.get(e?"_start":"_end"),i=t[e?"firstChild":"lastChild"];return S(i)&&(i=i[e?"firstChild":"lastChild"]),O.remove(t,!0),i}function f(e){var i,n;e=C(e,v,K),b.split&&(i=N(e,K),n=N(e),i!=n?(/^(TR|TD)$/.test(i.nodeName)&&i.firstChild&&(i=("TD"==i.nodeName?i.firstChild:i.firstChild.firstChild)||i),i=x(i,"span",{id:"_start","data-mce-type":"bookmark"}),n=x(n,"span",{id:"_end","data-mce-type":"bookmark"}),u(i),u(n),i=d(K),n=d()):i=n=u(i),e.startContainer=i.parentNode,e.startOffset=q(i),e.endContainer=n.parentNode,e.endOffset=q(n)+1),j.walk(e,function(e){B(e,function(e){r(e),1===e.nodeType&&"underline"===t.dom.getStyle(e,"text-decoration")&&e.parentNode&&"underline"===X(e.parentNode)&&k({deep:!1,exact:!0,inline:"span",styles:{textDecoration:"underline"}},null,e)})})}var m,g,v=s(i),b=v[0],y=!0;return a?(a.nodeType?(g=O.createRng(),g.setStartBefore(a),g.setEndAfter(a),f(g)):f(a),void 0):(R.isCollapsed()&&b.inline&&!O.select("td.mceSelected,th.mceSelected").length?A("remove",i,o):(m=R.getBookmark(),f(R.getRng(K)),R.moveToBookmark(m),b.inline&&p(i,o,R.getStart())&&P(R.getRng(!0)),t.nodeChanged()),void 0)}function d(e,t,i){var n=s(e);!p(e,t,i)||"toggle"in n[0]&&!n[0].toggle?c(e,t,i):u(e,t,i)}function h(e,t,i,n){function o(e,t,o){var a,r,s,l=t[o];if(t.onmatch)return t.onmatch(e,t,o);if(l)if(l.length===I){for(a in l)if(l.hasOwnProperty(a)){if(r="attributes"===o?O.getAttrib(e,a):y(e,a),n&&!r&&!t.exact)return;if((!n||t.exact)&&!b(r,_(l[a],i)))return}}else for(s=0;s<l.length;s++)if("attributes"===o?O.getAttrib(e,l[s]):y(e,l[s]))return t;return t}var a,r,l,c=s(t);if(c&&e)for(r=0;r<c.length;r++)if(a=c[r],v(e,a)&&o(e,a,"attributes")&&o(e,a,"styles")){if(l=a.classes)for(r=0;r<l.length;r++)if(!O.hasClass(e,l[r]))return;return a}}function p(e,t,i){function n(i){return i=O.getParent(i,function(i){return!!h(i,e,t,!0)}),h(i,e,t)}var o;return i?n(i):(i=R.getNode(),n(i)?K:(o=R.getStart(),o!=i&&n(o)?K:V))}function f(e,t){var i,n=[],o={};return i=R.getStart(),O.getParent(i,function(i){var a,r;for(a=0;a<e.length;a++)r=e[a],!o[r]&&h(i,r,t)&&(o[r]=!0,n.push(r))},O.getRoot()),n}function m(e){var t,i,o,a,r,l=s(e);if(l)for(t=R.getStart(),i=n(t),a=l.length-1;a>=0;a--){if(r=l[a].selector,!r)return K;for(o=i.length-1;o>=0;o--)if(O.is(i[o],r))return K}return V}function g(e,i,o){var a;return M||(M={},a={},t.onNodeChange.addToTop(function(e,t,i){var o=n(i),r={};B(M,function(e,t){B(o,function(i){return h(i,t,{},e.similar)?(a[t]||(B(e,function(e){e(!0,{node:i,format:t,parents:o})}),a[t]=e),r[t]=e,!1):void 0})}),B(a,function(e,t){r[t]||(delete a[t],B(e,function(e){e(!1,{node:i,format:t,parents:o})}))})})),B(e.split(","),function(e){M[e]||(M[e]=[],M[e].similar=o),M[e].push(i)}),this}function v(e,t){return b(e,t.inline)?K:b(e,t.block)?K:t.selector?O.is(e,t.selector):void 0}function b(e,t){return e=e||"",t=t||"",e=""+(e.nodeName||e),t=""+(t.nodeName||t),e.toLowerCase()==t.toLowerCase()}function y(e,t){var i=O.getStyle(e,t);return("color"==t||"backgroundColor"==t)&&(i=O.toHex(i)),"fontWeight"==t&&700==i&&(i="bold"),""+i}function _(e,t){return"string"!=typeof e?e=e(t):t&&(e=e.replace(/%(\w+)/g,function(e,i){return t[i]||e})),e}function w(e){return e&&3===e.nodeType&&/^([\t \r\n]+|)$/.test(e.nodeValue)}function x(e,t,i){var n=O.create(t,i);return e.parentNode.insertBefore(n,e),n.appendChild(e),n}function C(e,o,a){function r(e){function t(e){return"BR"==e.nodeName&&e.getAttribute("data-mce-bogus")&&!e.nextSibling}var i,n,a,r,s;if(i=n=e?m:v,r=e?"previousSibling":"nextSibling",s=O.getRoot(),3==i.nodeType&&!w(i)&&(e?g>0:y<i.nodeValue.length))return i;for(;;){if(!o[0].block_expand&&z(n))return n;for(a=n[r];a;a=a[r])if(!S(a)&&!w(a)&&!t(a))return n;if(n.parentNode==s){i=n;break}n=n.parentNode}return i}function s(e,t){for(t===I&&(t=3===e.nodeType?e.length:e.childNodes.length);e&&e.hasChildNodes();)e=e.childNodes[t],e&&(t=3===e.nodeType?e.length:e.childNodes.length);return{node:e,offset:t}}function l(e){for(var t=e;t;){if(1===t.nodeType&&Y(t))return"false"===Y(t)?t:e;t=t.parentNode}return e}function c(e,i,n){function o(e,t){var i,o,r=e.nodeValue;return"undefined"==typeof t&&(t=n?r.length:0),n?(i=r.lastIndexOf(" ",t),o=r.lastIndexOf(" ",t),i=i>o?i:o,-1===i||a||i++):(i=r.indexOf(" ",t),o=r.indexOf(" ",t),i=-1!==i&&(-1===o||o>i)?i:o),i}var r,s,l,c;if(3===e.nodeType){if(l=o(e,i),-1!==l)return{container:e,offset:l};c=e}for(r=new L(e,O.getParent(e,z)||t.getBody());s=r[n?"prev":"next"]();)if(3===s.nodeType){if(c=s,l=o(s),-1!==l)return{container:s,offset:l}}else if(z(s))break;return c?(i=n?0:c.length,{container:c,offset:i}):void 0}function u(t,i){var a,r,s,l;for(3==t.nodeType&&0===t.nodeValue.length&&t[i]&&(t=t[i]),a=n(t),r=0;r<a.length;r++)for(s=0;s<o.length;s++)if(l=o[s],!("collapsed"in l&&l.collapsed!==e.collapsed)&&O.is(a[r],l.selector))return a[r];return t}function d(e,t){var a;if(o[0].wrapper||(a=O.getParent(e,o[0].block)),a||(a=O.getParent(3==e.nodeType?e.parentNode:e,i)),a&&o[0].wrapper&&(a=n(a,"ul,ol").reverse()[0]||a),!a)for(a=e;a[t]&&!z(a[t])&&(a=a[t],!b(a,"br")););return a||e}var h,p,f,m=e.startContainer,g=e.startOffset,v=e.endContainer,y=e.endOffset;if(1==m.nodeType&&m.hasChildNodes()&&(h=m.childNodes.length-1,m=m.childNodes[g>h?h:g],3==m.nodeType&&(g=0)),1==v.nodeType&&v.hasChildNodes()&&(h=v.childNodes.length-1,v=v.childNodes[y>h?h:y-1],3==v.nodeType&&(y=v.nodeValue.length)),m=l(m),v=l(v),(S(m.parentNode)||S(m))&&(m=S(m)?m:m.parentNode,m=m.nextSibling||m,3==m.nodeType&&(g=0)),(S(v.parentNode)||S(v))&&(v=S(v)?v:v.parentNode,v=v.previousSibling||v,3==v.nodeType&&(y=v.length)),o[0].inline&&(e.collapsed&&(f=c(m,g,!0),f&&(m=f.container,g=f.offset),f=c(v,y),f&&(v=f.container,y=f.offset)),p=s(v,y),p.node)){for(;p.node&&0===p.offset&&p.node.previousSibling;)p=s(p.node.previousSibling);p.node&&p.offset>0&&3===p.node.nodeType&&" "===p.node.nodeValue.charAt(p.offset-1)&&p.offset>1&&(v=p.node,v.splitText(p.offset-1))}return(o[0].inline||o[0].block_expand)&&(o[0].inline&&3==m.nodeType&&0!==g||(m=r(!0)),o[0].inline&&3==v.nodeType&&y!==v.nodeValue.length||(v=r())),o[0].selector&&o[0].expand!==V&&!o[0].inline&&(m=u(m,"previousSibling"),v=u(v,"nextSibling")),(o[0].block||o[0].selector)&&(m=d(m,"previousSibling"),v=d(v,"nextSibling"),o[0].block&&(z(m)||(m=r(!0)),z(v)||(v=r()))),1==m.nodeType&&(g=q(m),m=m.parentNode),1==v.nodeType&&(y=q(v)+1,v=v.parentNode),{startContainer:m,startOffset:g,endContainer:v,endOffset:y}}function k(e,t,i,n){var o,a,r;if(!v(i,e))return V;if("all"!=e.remove)for(B(e.styles,function(e,o){e=_(e,t),"number"==typeof o&&(o=e,n=0),(!n||b(y(n,o),e))&&O.setStyle(i,o,""),r=1}),r&&""==O.getAttrib(i,"style")&&(i.removeAttribute("style"),i.removeAttribute("data-mce-style")),B(e.attributes,function(e,o){var a;if(e=_(e,t),"number"==typeof o&&(o=e,n=0),!n||b(O.getAttrib(n,o),e)){if("class"==o&&(e=O.getAttrib(i,o),e&&(a="",B(e.split(/\s+/),function(e){/mce\w+/.test(e)&&(a+=(a?" ":"")+e)}),a)))return O.setAttrib(i,o,a),void 0;"class"==o&&i.removeAttribute("className"),U.test(o)&&i.removeAttribute("data-mce-"+o),i.removeAttribute(o)}}),B(e.classes,function(e){e=_(e,t),(!n||O.hasClass(n,e))&&O.removeClass(i,e)}),a=O.getAttribs(i),o=0;o<a.length;o++)if(0!==a[o].nodeName.indexOf("_"))return V;return"none"!=e.remove?(T(i,e),K):void 0}function T(t,i){function n(e,t,i){return e=D(e,t,i),!e||"BR"==e.nodeName||z(e)}var o,a=t.parentNode;i.block&&($?a==O.getRoot()&&(i.list_block&&b(t,i.list_block)||B(e.grep(t.childNodes),function(e){F($,e.nodeName.toLowerCase())?o?o.appendChild(e):o=x(e,$):o=0})):z(t)&&!z(a)&&(n(t,V)||n(t.firstChild,K,1)||t.insertBefore(O.create("br"),t.firstChild),n(t,K)||n(t.lastChild,V,1)||t.appendChild(O.create("br")))),i.selector&&i.inline&&!b(i.inline,t)||O.remove(t,1)}function D(e,t,i){if(e)for(t=t?"nextSibling":"previousSibling",e=i?e:e[t];e;e=e[t])if(1==e.nodeType||!w(e))return e}function S(e){return e&&1==e.nodeType&&"bookmark"==e.getAttribute("data-mce-type")}function E(t,i){function n(e,t){function i(e){var t={};return B(O.getAttribs(e),function(i){var n=i.nodeName.toLowerCase();0!==n.indexOf("_")&&"style"!==n&&(t[n]=O.getAttrib(e,n))}),t}function n(e,t){var i,n;for(n in e)if(e.hasOwnProperty(n)){if(i=t[n],i===I)return V;if(e[n]!=i)return V;delete t[n]}for(n in t)if(t.hasOwnProperty(n))return V;return K}return e.nodeName!=t.nodeName?V:n(i(e),i(t))?n(O.parseStyle(O.getAttrib(e,"style")),O.parseStyle(O.getAttrib(t,"style")))?K:V:V}function o(e,t){for(a=e;a;a=a[t]){if(3==a.nodeType&&0!==a.nodeValue.length)return e;if(1==a.nodeType&&!S(a))return a}return e}var a,r;if(t&&i&&(t=o(t,"previousSibling"),i=o(i,"nextSibling"),n(t,i))){for(a=t.nextSibling;a&&a!=i;)r=a,a=a.nextSibling,t.appendChild(r);return O.remove(i),B(e.grep(i.childNodes),function(e){t.appendChild(e)}),t}return i}function N(e,i){var n,o,a;return n=e[i?"startContainer":"endContainer"],o=e[i?"startOffset":"endOffset"],1==n.nodeType&&(a=n.childNodes.length-1,!i&&o&&o--,n=n.childNodes[o>a?a:o]),3===n.nodeType&&i&&o>=n.nodeValue.length&&(n=new L(n,t.getBody()).next()||n),3!==n.nodeType||i||0!==o||(n=new L(n,t.getBody()).prev()||n),n}function A(n,o,a){function r(e){var i=O.create("span",{id:b,"data-mce-bogus":!0,style:y?"color:red":""});return e&&i.appendChild(t.getDoc().createTextNode(W)),i}function l(e,t){for(;e;){if(3===e.nodeType&&e.nodeValue!==W||e.childNodes.length>1)return!1;t&&1===e.nodeType&&t.push(e),e=e.firstChild}return!0}function d(e){for(;e;){if(e.id===b)return e;e=e.parentNode}}function p(e){var t;if(e)for(t=new L(e,e),e=t.current();e;e=t.next())if(3===e.nodeType)return e}function f(e,t){var i,n;if(e)n=R.getRng(!0),l(e)?(t!==!1&&(n.setStartBefore(e),n.setEndBefore(e)),O.remove(e)):(i=p(e),i.nodeValue.charAt(0)===W&&(i=i.deleteData(0,1)),O.remove(e,1)),R.setRng(n);else if(e=d(R.getStart()),!e)for(;e=O.get(b);)f(e,!1)}function m(){var e,t,i,n,l,u,h;e=R.getRng(!0),n=e.startOffset,u=e.startContainer,h=u.nodeValue,t=d(R.getStart()),t&&(i=p(t)),h&&n>0&&n<h.length&&/\w/.test(h.charAt(n))&&/\w/.test(h.charAt(n-1))?(l=R.getBookmark(),e.collapse(!0),e=C(e,s(o)),e=j.split(e),c(o,a,e),R.moveToBookmark(l)):(t&&i.nodeValue===W?c(o,a,t):(t=r(!0),i=t.firstChild,e.insertNode(t),n=1,c(o,a,t)),R.setCursorLocation(i,n))}function g(){var e,t,n,l,c,d,p,f,m=R.getRng(!0),g=[];for(e=m.startContainer,t=m.startOffset,c=e,3==e.nodeType&&((t!=e.nodeValue.length||e.nodeValue===W)&&(l=!0),c=c.parentNode);c;){if(h(c,o,a)){d=c;break}c.nextSibling&&(l=!0),g.push(c),c=c.parentNode}if(d)if(l)n=R.getBookmark(),m.collapse(!0),m=C(m,s(o),!0),m=j.split(m),u(o,a,m),R.moveToBookmark(n);else{for(f=r(),c=f,p=g.length-1;p>=0;p--)c.appendChild(O.clone(g[p],!1)),c=c.firstChild;c.appendChild(O.doc.createTextNode(W)),c=c.firstChild;var v=O.getParent(d,i);v&&O.isEmpty(v)?d.parentNode.replaceChild(f,d):O.insertAfter(f,d),R.setCursorLocation(c,1),O.isEmpty(d)&&O.remove(d)}}function v(){var t;t=d(R.getStart()),t&&!O.isEmpty(t)&&e.walk(t,function(e){1!=e.nodeType||e.id===b||O.isEmpty(e)||O.setAttrib(e,"data-mce-bogus",null)},"childNodes")}var b="_mce_caret",y=t.settings.caret_debug;self._hasCaretEvents||(t.onBeforeGetContent.addToTop(function(){var e,t=[];if(l(d(R.getStart()),t))for(e=t.length;e--;)O.setAttrib(t[e],"data-mce-bogus","1")}),e.each("onMouseUp onKeyUp".split(" "),function(e){t[e].addToTop(function(){f(),v()})}),t.onKeyDown.addToTop(function(e,t){var i=t.keyCode;(8==i||37==i||39==i)&&f(d(R.getStart())),v()}),R.onSetContent.add(v),self._hasCaretEvents=!0),"apply"==n?m():g()}function P(e){var t,i,n,o,a,r=e.startContainer,s=e.startOffset;if(3==r.nodeType&&s>=r.nodeValue.length&&(s=q(r),r=r.parentNode,t=!0),1==r.nodeType)for(o=r.childNodes,r=o[Math.min(s,o.length-1)],i=new L(r,O.getParent(r,O.isBlock)),(s>o.length-1||t)&&i.next(),n=i.current();n;n=i.next())if(3==n.nodeType&&!w(n))return a=O.create("a",null,W),n.parentNode.insertBefore(a,n),e.setStart(n,0),R.setRng(e),O.remove(a),void 0}var M,I,H={},B=e.each,O=t.dom,R=t.selection,L=e.dom.TreeWalker,j=new e.dom.RangeUtils(O),F=t.schema.isValidChild,z=(e.isArray,O.isBlock),$=t.settings.forced_root_block,q=O.nodeIndex,W="",U=/^(src|href|style)$/,V=!1,K=!0,Y=O.getContentEditable,X=function(e){var i;return t.dom.getParent(e,function(e){return i=t.dom.getStyle(e,"text-decoration"),i&&"none"!==i}),i},G=function(e){var i;1===e.nodeType&&e.parentNode&&1===e.parentNode.nodeType&&(i=X(e.parentNode),t.dom.getStyle(e,"color")&&i?t.dom.setStyle(e,"text-decoration",i):t.dom.getStyle(e,"textdecoration")===i&&t.dom.setStyle(e,"text-decoration",null))};e.extend(this,{get:s,register:l,apply:c,remove:u,toggle:d,match:p,matchAll:f,matchNode:h,canApply:m,formatChanged:g}),a(),r()}}(tinymce),tinymce.onAddEditor.add(function(e,t){function i(t,i){e.each(i,function(e,i){e&&r.setStyle(t,i,e)}),r.rename(t,"span")}function n(i,n){r=i.dom,s.convert_fonts_to_spans&&e.each(r.select("font,u,strike",n.node),function(e){o[e.nodeName.toLowerCase()](t.dom,e)})}var o,a,r,s=t.settings;s.inline_styles&&(a=e.explode(s.font_size_legacy_values),o={font:function(e,t){i(t,{backgroundColor:t.style.backgroundColor,color:t.color,fontFamily:t.face,fontSize:a[parseInt(t.size,10)-1]})},u:function(e,t){i(t,{textDecoration:"underline"})},strike:function(e,t){i(t,{textDecoration:"line-through"})}},t.onPreProcess.add(n),t.onSetContent.add(n),t.onInit.add(function(){t.selection.onSetContent.add(n)}))}),function(e){var t=e.dom.TreeWalker;e.EnterKey=function(i){function n(n){function c(e){return e&&o.isBlock(e)&&!/^(TD|TH|CAPTION|FORM)$/.test(e.nodeName)&&!/^(fixed|absolute)/i.test(e.style.position)&&"true"!==o.getContentEditable(e)}function u(t){var i;e.isIE&&!e.isIE11&&o.isBlock(t)&&(i=a.getRng(),t.appendChild(o.create("span",null," ")),a.select(t),t.lastChild.outerHTML="",a.setRng(i))}function d(e){for(var t,i=e,n=[];i=i.firstChild;){if(o.isBlock(i))return;1!=i.nodeType||l[i.nodeName.toLowerCase()]||n.push(i)
82
- }for(t=n.length;t--;)i=n[t],!i.hasChildNodes()||i.firstChild==i.lastChild&&""===i.firstChild.nodeValue?o.remove(i):"A"==i.nodeName&&" "===(i.innerText||i.textContent)&&o.remove(i)}function h(e){var n,r,s,c,u,d,h=e;if(s=o.createRng(),e.hasChildNodes()){for(n=new t(e,e);r=n.current();){if(3==r.nodeType){s.setStart(r,0),s.setEnd(r,0);break}if(l[r.nodeName.toLowerCase()]){s.setStartBefore(r),s.setEndBefore(r);break}h=r,r=n.next()}r||(s.setStart(h,0),s.setEnd(h,0))}else"BR"==e.nodeName?e.nextSibling&&o.isBlock(e.nextSibling)?((!S||9>S)&&(d=o.create("br"),e.parentNode.insertBefore(d,e)),s.setStartBefore(e),s.setEndBefore(e)):(s.setStartAfter(e),s.setEndAfter(e)):(s.setStart(e,0),s.setEnd(e,0));a.setRng(s),o.remove(d),u=o.getViewPort(i.getWin()),c=o.getPos(e).y,(c<u.y||c+25>u.y+u.h)&&i.getWin().scrollTo(0,c<u.y?c:c-u.h+25)}function p(t){var i,n,a,s=k;if(i=t||"TABLE"==M?o.create(t||H):D.cloneNode(!1),a=i,r.keep_styles!==!1)do if(/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(s.nodeName)){if("_mce_caret"==s.id)continue;n=s.cloneNode(!1),o.setAttrib(n,"id",""),i.hasChildNodes()?(n.appendChild(i.firstChild),i.appendChild(n)):(a=n,i.appendChild(n))}while(s=s.parentNode);return(!e.isIE||e.isIE11)&&(a.innerHTML='<br data-mce-bogus="1">'),i}function f(e){var i,n,o;if(3==k.nodeType&&(e?T>0:T<k.nodeValue.length))return!1;if(k.parentNode==D&&B&&!e)return!0;if(e&&1==k.nodeType&&k==D.firstChild)return!0;if("TABLE"===k.nodeName||k.previousSibling&&"TABLE"==k.previousSibling.nodeName)return B&&!e||!B&&e;for(i=new t(k,D),3==k.nodeType&&(e&&0==T?i.prev():e||T!=k.nodeValue.length||i.next());n=i.current();){if(1===n.nodeType){if(!n.getAttribute("data-mce-bogus")&&(o=n.nodeName.toLowerCase(),l[o]&&"br"!==o))return!1}else if(3===n.nodeType&&!/^[ \t\r\n]*$/.test(n.nodeValue))return!1;e?i.prev():i.next()}return!0}function m(e,t){var i,n,a,r,s,l=H||"P";if(n=o.getParent(e,o.isBlock),!n||!c(n)){if(n=n||C,!n.hasChildNodes())return i=o.create(l),n.appendChild(i),O.setStart(i,0),O.setEnd(i,0),i;for(r=e;r.parentNode!=n;)r=r.parentNode;for(;r&&!o.isBlock(r);)a=r,r=r.previousSibling;if(a){for(i=o.create(l),a.parentNode.insertBefore(i,a),r=a;r&&!o.isBlock(r);)s=r.nextSibling,i.appendChild(r),r=s;O.setStart(e,t),O.setEnd(e,t)}}return e}function g(){function e(e){for(var t=P[e?"firstChild":"lastChild"];t&&1!=t.nodeType;)t=t[e?"nextSibling":"previousSibling"];return t===D}N=H?p(H):o.create("BR"),e(!0)&&e()?o.replace(N,P):e(!0)?P.parentNode.insertBefore(N,P):e()?(o.insertAfter(N,P),u(N)):(x=O.cloneRange(),x.setStartAfter(D),x.setEndAfter(P),A=x.extractContents(),o.insertAfter(A,P),o.insertAfter(N,P)),o.remove(D),h(N),s.add()}function v(){for(var e,i=new t(k,D);e=i.next();)if(l[e.nodeName.toLowerCase()]||e.length>0)return!0}function b(){var t,i,n;k&&3==k.nodeType&&T>=k.nodeValue.length&&(e.isIE&&!e.isIE11||v()||(t=o.create("br"),O.insertNode(t),O.setStartAfter(t),O.setEndAfter(t),i=!0)),t=o.create("br"),O.insertNode(t),e.isIE&&!e.isIE11&&"PRE"==M&&(!S||8>S)&&t.parentNode.insertBefore(o.doc.createTextNode("\r"),t),n=o.create("span",{},"&nbsp;"),t.parentNode.insertBefore(n,t),a.scrollIntoView(n),o.remove(n),i?(O.setStartBefore(t),O.setEndBefore(t)):(O.setStartAfter(t),O.setEndAfter(t)),a.setRng(O),s.add()}function y(e){do 3===e.nodeType&&(e.nodeValue=e.nodeValue.replace(/^[\r\n]+/,"")),e=e.firstChild;while(e)}function _(e){var t,i,n=o.getRoot();for(t=e;t!==n&&"false"!==o.getContentEditable(t);)"true"===o.getContentEditable(t)&&(i=t),t=t.parentNode;return t!==n?i:n}function w(t){var i;(!e.isIE||e.isIE11)&&(t.normalize(),i=t.lastChild,(!i||/^(left|right)$/gi.test(o.getStyle(i,"float",!0)))&&o.add(t,"br"))}var x,C,k,T,D,S,E,N,A,P,M,I,H,B,O=a.getRng(!0);if(!O.collapsed)return i.execCommand("Delete"),void 0;if(!n.isDefaultPrevented()&&(k=O.startContainer,T=O.startOffset,H=(r.force_p_newlines?"p":"")||r.forced_root_block,H=H?H.toUpperCase():"",S=o.doc.documentMode,E=n.shiftKey,1==k.nodeType&&k.hasChildNodes()&&(B=T>k.childNodes.length-1,k=k.childNodes[Math.min(T,k.childNodes.length-1)]||k,T=B&&3==k.nodeType?k.nodeValue.length:0),C=_(k))){if(s.beforeChange(),!o.isBlock(C)&&C!=o.getRoot())return(!H||E)&&b(),void 0;if((H&&!E||!H&&E)&&(k=m(k,T)),D=o.getParent(k,o.isBlock),P=D?o.getParent(D.parentNode,o.isBlock):null,M=D?D.nodeName.toUpperCase():"",I=P?P.nodeName.toUpperCase():"","LI"!=I||n.ctrlKey||(D=P,M=I),"LI"==M){if(!H&&E)return b(),void 0;if(o.isEmpty(D))return/^(UL|OL|LI)$/.test(P.parentNode.nodeName)?!1:(g(),void 0)}if("PRE"==M&&r.br_in_pre!==!1){if(!E)return b(),void 0}else if(!H&&!E&&"LI"!=M||H&&E)return b(),void 0;H=H||"P",f()?(N=/^(H[1-6]|PRE)$/.test(M)&&"HGROUP"!=I?p(H):p(),r.end_container_on_empty_block&&c(P)&&o.isEmpty(D)?N=o.split(P,D):o.insertAfter(N,D),h(N)):f(!0)?(N=D.parentNode.insertBefore(p(),D),u(N)):(x=O.cloneRange(),x.setEndAfter(D),A=x.extractContents(),y(A),N=A.firstChild,o.insertAfter(A,D),d(N),w(D),h(N)),o.setAttrib(N,"id",""),s.add()}}var o=i.dom,a=i.selection,r=i.settings,s=i.undoManager,l=i.schema.getNonEmptyElements();i.onKeyDown.add(function(e,t){13==t.keyCode&&n(t)!==!1&&t.preventDefault()})}}(tinymce),function(){var e,t,i,n,o,a,r;window.wagn||(window.wagn={}),$.extend(wagn,{editorContentFunctionMap:{".tinymce-textarea":function(){return tinyMCE.get(this[0].id).getContent()},".pointer-select":function(){return o(this.val())},".pointer-multiselect":function(){return o(this.val())},".pointer-radio-list":function(){return o(this.find("input:checked").val())},".pointer-list-ul":function(){return o(this.find("input").map(function(){return $(this).val()}))},".pointer-checkbox-list":function(){return o(this.find("input:checked").map(function(){return $(this).val()}))},".perm-editor":function(){return n(this)},".wikirate-topic-tree":function(){return o(this.find(".jstree-clicked").map(function(){return $.trim($(this).text())}))}},editorInitFunctionMap:{".date-editor":function(){return this.datepicker({dateFormat:"yy-mm-dd"})},textarea:function(){return $(this).autosize()},".tinymce-textarea":function(){return wagn.initTinyMCE(this[0].id)},".pointer-list-editor":function(){return this.sortable(),wagn.initPointerList(this.find("input"))},".file-upload":function(){return this.fileupload({add:wagn.chooseFile})},".etherpad-textarea":function(){return $(this).closest("form").find(".edit-submit-button").attr("class","etherpad-submit-button")},".wikirate-topic-tree":function(){return $(this).jstree({plugins:["themes","html_data","ui","crrm"],ui:{select_multiple_modifier:"on",initially_select:$(this).closest(".editor").find(".initial-content").text().split("|"),selected_parent_close:!1},themes:{icons:!1}})}},initPointerList:function(e){var t;return t=e.closest("ul").attr("options-card"),e.autocomplete({source:wagn.prepUrl(wagn.rootPath+"/"+t+".json?view=name_complete")})},setTinyMCEConfig:function(e){var t;return t=function(){try{return $.parseJSON(e)}catch(t){return{}}},wagn.tinyMCEConfig=t()},initTinyMCE:function(e){var t,i,n;return t={plugins:"autoresize",autoresize_max_height:500},n=null!=wagn.tinyMCEConfig?wagn.tinyMCEConfig:{},i={mode:"exact",elements:e,content_css:wagn.cssPath,entity_encoding:"raw"},$.extend(t,n,i),tinyMCE.init(t)},chooseFile:function(e,t){var i,n,o,a;return o=t.files[0],$(this).closest("form").data("file-data",t),(a=$(this).slot().find(".name-editor input"))&&a[0]&&""===a.val()&&a.val(o.name.replace(/\..*$/,"").replace(/_/g," ")),n=$(this).closest(".card-editor"),n.find(".choose-file").hide(),n.find(".chosen-filename").text(o.name),n.find(".chosen-file").show(),i=this.name.replace(/attach\]$/,"content]"),n.append('<input type="hidden" value="CHOSEN" class="upload-card-content" name="'+i+'">')},openMenu:function(e,t){var i,n;return n=$(e),i=n.data("menu"),null==i&&(i=wagn.generateMenu(n.slot(),n.data("menu-vars")),n.data("menu",i),i.menu({position:{my:"right top",at:"left-2 top-3"},icons:{submenu:"ui-icon-carat-1-w"}})),t&&i.addClass("card-menu-tappable"),i.show(),i.position({my:"right top",at:"right+2 top+2",of:e})},closeMenu:function(e){return $(e).hide(),$(e).menu("collapseAll",null,!0)},generateMenu:function(e,t){var i,n,o;return o=$.extend(!0,{},wagn.menu_template),i=wagn.generateMenuItems(o,t),n=$('<ul class="card-menu">'+i.join("\n")+"</ul>"),e.append(n),n},generateMenuItems:function(e,t){var i;return i=[],$.each(e,function(e,n){var o,a,r,s;return n["if"]&&!t[n["if"]]?!0:(n.text&&(n.text=n.text.replace(/\%\{([^}]*)\}/,function(e,i){return t[i]}),n.text=$("<div/>").text(n.text).html()),o=n.link?t[n.link]:n.plain?"<a>"+n.plain+"</a>":n.page?(r=t[n.page]||n.page,s=n.text||r,'<a href="'+wagn.rootPath+"/"+wagn.linkname(r)+'">'+s+" &crarr;</a>"):wagn.generateStandardMenuItem(n,t),o?(n.list&&(a=wagn.generateListTemplate(n.list,t))&&a.length>0&&(n.sub=a),n.sub&&(o+="<ul>"+wagn.generateMenuItems(n.sub,t).join("\n")+"</ul>"),i.push("<li>"+o+"</li>")):void 0)}),i},linkname:function(e){return e.replace(/[^\w\*\+]/g," ").replace(/\s+/g,"_")},generateListTemplate:function(e,t){var i,n;return i=[],(n=t[e.name])&&$.each(n,function(t,n){var o;return o=$.extend({},e.template),$.map(o,function(e,t){return o[t]=n[o[t]]||o[t]}),i.push(o)}),e.append&&(i=i.concat(e.append)),i},generateStandardMenuItem:function(e,t){var i,n,o,a;return i=wagn.linkname(t.self),n=e.path_opts||{},e.related&&(e.view="related",n.related="object"==typeof e.related?$.extend({},e.related,{name:t[e.related.name]}):(e.text||(e.text=e.related),{name:"+*"+e.related})),e.view?("home"!==e.view&&(n.view=e.view),o=wagn.rootPath+"/"+i,$.isEmptyObject(n)||(o+="?"+$.param(n)),a=e.text||e.view,'<a href="'+o+'" data-remote="true" class="slotter">'+a+"</a>"):void 0}}),$(window).ready(function(){var i;return $("body").on("click",".cancel-upload",function(){var e,t;return t=$(this).closest(".card-editor"),t.find(".chosen-file").hide(),t.find(".choose-file").show(),$(this).closest("form").data("file-data",null),e=t.find(".upload-card-content").remove()}),$(".navbox").autocomplete({html:"html",source:e,select:t}),$("body").on("mouseenter",".card-menu-link",function(){return wagn.openMenu(this,!1)}),$("body").on("mouseleave",".card-menu",function(){return wagn.closeMenu(this)}),$(document).on("tap",".card-header",function(e){var t;return t=$(this).find(".card-menu-link"),!t[0]||t.data("menu")||e.pageX-$(this).offset().left<$(this).width()/2?void 0:(wagn.openMenu(t,!0),e.preventDefault())}),$(document).on("tap","body",function(e){return $(e.target).closest(".card-header")[0]||$(e.target).closest(".card-menu-link")[0]?void 0:$(".card-menu").hide()}),$(document).on("tap",".ui-menu-icon",function(e){return $(this).closest("li").trigger("mouseenter"),e.preventDefault()}),$("body").on("click",".pointer-item-add",function(e){var t,i,n;return i=$(this).closest(".content-editor").find(".pointer-li:last"),n=i.clone(),t=n.find("input"),t.val(""),i.after(n),wagn.initPointerList(t),e.preventDefault()}),$("body").on("click",".pointer-item-delete",function(){var e;return e=$(this).closest("li"),e.closest("ul").find(".pointer-li").length>1?e.remove():e.find("input").val(""),event.preventDefault()}),$("body").on("click",".perm-vals input",function(){return $(this).slot().find("#inherit").attr("checked",!1)}),$("body").on("click",".perm-editor #inherit",function(){var e;return e=$(this).slot(),e.find(".perm-group input:checked").attr("checked",!1),e.find(".perm-indiv input").val("")}),$("body").on("click",".rule-submit-button",function(){var e;return e=$(this).closest("form"),e.find(".set-editor input:checked").val()?!0:(e.find(".set-editor").addClass("attention"),$(this).notify("To what Set of cards does this Rule apply?"),!1)}),$("body").on("click",".etherpad-submit-button",function(){var e,t;return wagn.padform=$(this).closest("form"),e=$(wagn.padform).find("iframe")[0].src,-1!==(t=e.indexOf("?"))&&(e=e.slice(0,t)),$.get(e+"/export/html",function(e){return $(wagn.padform).find(".etherpad-textarea")[0].value=e,$(wagn.padform)[0].submit()}),!1}),$("body").on("click",".shade-view h1",function(){var e;return e=$(this).slot().find(".shade-content").is(":hidden"),r($(this).closest(".pointer-list").find(".shade-content:visible").parent()),e?r($(this).slot()):void 0}),(i=$(".shade-view h1")[0])&&$(i).trigger("click"),$("body").on("mouseenter","#wikirate-nav > a",function(){var e,t;return t=$(this).find("ul"),t[0]?t.css("display","inline-block"):(e=$(this),$.ajax(e.attr("href"),{data:{view:"navdrop",layout:"none",index:$("#wikirate-nav > a").index(e)},success:function(t){return wagn.d=t,e.prepend($(t).menu())}}))}),$("body").on("mouseleave","#wikirate-nav ul",function(){return $(this).hide()}),$("body").on("change",".go-to-selected select",function(){var e;return e=$(this).val(),""!==e?window.location=wagn.rootPath+escape(e):void 0})}),$(document).bind("mobileinit",function(){return $.mobile.autoInitializePage=!1,$.mobile.ajaxEnabled=!1}),r=function(e){return e.find(".shade-content").slideToggle(1e3),e.find(".ui-icon").toggleClass("ui-icon-triangle-1-e ui-icon-triangle-1-s")},n=function(e){var t,i;return e.find("#inherit").attr("checked")?"_left":(t=e.find(".perm-group input:checked").map(function(){return $(this).val()}),i=e.find(".perm-indiv input").map(function(){return $(this).val()}),o($.makeArray(t).concat($.makeArray(i))))},o=function(e){var t;return t=$.map($.makeArray(e),function(e){return e?"[["+e+"]]":void 0}),$.makeArray(t).join("\n")},a=0,e=function(e,t){var n,o;return n=this.element.closest("form"),o=n.serialize()+"&view=complete",this.xhr=$.ajax({url:wagn.prepUrl(wagn.rootPath+"/:search.json"),data:o,dataType:"json",wagReq:++a,success:function(n){return this.wagReq===a?t(i(e.term,n)):void 0},error:function(){return this.wagReq===a?t([]):void 0}})},i=function(e,t){var i;return i=[],$.each(["search","add","new"],function(n,o){var a,r;return(r=t[o])?(a={value:e,prefix:o,icon:"plus",label:'<strong class="highlight">'+e+"</strong>"},"search"===o?(a.icon=o,a.term=e):"add"===o?a.href="/card/new?card[name]="+encodeURIComponent(r):"new"===o&&(a.type="add",a.href="/new/"+r[1]),i.push(a)):void 0}),$.each(t["goto"],function(e,t){return i.push({icon:"arrowreturnthick-1-e",prefix:"go to",value:t[0],label:t[1],href:"/"+t[2]})}),$.each(i,function(e,t){return t.label='<span class="navbox-item-label"><a class="ui-icon ui-icon-'+t.icon+'"></a>'+t.prefix+':</span> <span class="navbox-item-value">'+t.label+"</span>"}),i},t=function(e,t){return t.item.term?$(this).closest("form").submit():window.location=wagn.rootPath+t.item.href,$(this).attr("disabled","disabled")}}.call(this),function(){var e,t,i;$.extend(wagn,{initializeEditors:function(e,t){return null==t&&(t=wagn.editorInitFunctionMap),$.each(t,function(t,i){return $.each(e.find(t),function(){return i.call($(this))})})},prepUrl:function(e,t){var i,n,o;return o={},i=$("#main").children(".card-slot").data("cardName"),null!=i&&(o.main=i),t&&(t.isMain()&&(o.is_main=!0),n=t.data("slot"),null!=n&&wagn.slotParams(n,o,"slot")),e+((e.match(/\?/)?"&":"?")+$.param(o))},slotParams:function(e,i,n){return $.each(e,function(e,o){var a;return a=n+"["+t(e)+"]","items"===e?wagn.slotParams(o,i,a):i[a]=o})},pingName:function(e,t){return $.getJSON(wagn.rootPath+"/",{format:"json",view:"status","card[name]":e},t)}}),jQuery.fn.extend({slot:function(){return this.closest(".card-slot")},setSlotContent:function(e){var t,i,n;return t=this.slot(),n=$(e),n[0]?(i=t.attr("data-slot"))&&null!=i&&n.attr("data-slot",i):n=e,t.replaceWith(n),n},notify:function(e){var t,i,n;return n=this.slot(),i=n.find(".card-notice"),i[0]||(i=$('<div class="card-notice"></div>'),t=n.find(".card-form"),t[0]?$(t[0]).append(i):n.append(i)),i.html(e),i.show("blind")},report:function(e){var t;return t=this.slot().find(".card-report"),t[0]?(t.hide(),t.html(e),t.show("drop",750),setTimeout(function(){return t.hide("drop",750)},3e3)):!1},isMain:function(){return this.slot().parent("#main")[0]},loadCaptcha:function(){return Recaptcha.create(wagn.recaptchaKey,this[0])},autosave:function(){var e,t,i,n;if(n=this.slot(),!this.attr("no-autosave")){if(t=this.closest("fieldset"),t[0]){if(!(e=t.data("cardId")))return;i=": "+t.data("cardName")}else e=n.data("cardId"),i="";return $.ajax(wagn.rootPath+"/card/save_draft/~"+e,{data:{"card[content]":this.val()},type:"POST",success:function(){return n.report("draft saved"+i)}})}},setContentFieldsFromMap:function(e){var t;return null==e&&(e=wagn.editorContentFunctionMap),t=$(this),$.each(e,function(e,i){return t.setContentFields(e,i)})},setContentFields:function(e,t){return $.each(this.find(e),function(){return $(this).setContentField(t)})},setContentField:function(e){var t,i,n;return t=this.closest(".card-editor").find(".card-content"),i=t.val(),n=e.call(this),t.val(n),i!==n?t.change():void 0}}),setInterval(function(){return $(".card-form").setContentFieldsFromMap()},2e4),$(window).ready(function(){return $.ajaxSetup({cache:!1}),setTimeout(function(){return wagn.initializeEditors($("body"))},10),$("body").on("ajax:success",".slotter",function(e,t){var i,n;return t.redirect?window.location=t.redirect:(n=$(this).attr("notify-success"),i=$(this).setSlotContent(t),i.jquery&&(wagn.initializeEditors(i),null!=n)?i.notify(n):void 0)}),$("body").on("ajax:error",".slotter",function(e,t){var i,n;return i=t.responseText,403===t.status?$(this).setSlotContent(i):($(this).notify(i),n=$(this).slot(),409===t.status?n.find(".current_revision_id").val(n.find(".new-current-revision-id").text()):449===t.status?n.find(".recaptcha-box").loadCaptcha():void 0)}),$("body").on("click","button.slotter",function(){return $.rails.allowAction($(this))?$.rails.handleRemote($(this)):!1}),$("body").on("ajax:beforeSend",".slotter",function(t,i,n){var o,a,r,s,l;if(!n.skip_before_send&&(n.url.match(/home_view/)||(n.url=wagn.prepUrl(n.url,$(this).slot())),$(this).is("form"))){if(wagn.recaptchaKey&&"on"===$(this).attr("recaptcha")&&!$(this).find(".recaptcha-box")[0])return e(this),!1;if(a=$(this).data("file-data"))return s=$(this).find(".file-upload"),s[1]?($(this).notify("Wagn does not yet support multiple files in a single form."),!1):(l=s.data("fileupload"),l._isXHRUpload(l.options)||($(this).find("[name=success]").val("_self"),n.url+="&simulate_xhr=true",r=function(e){return e.find("body").html()},n.dataFilter=r),o=$.extend(n,l._getAJAXSettings(a),{url:n.url}),o.skip_before_send=!0,$.ajax(o),!1)}}),$("body").on("submit",".card-form",function(){return $(this).setContentFieldsFromMap(),$(this).find(".card-content").attr("no-autosave","true"),!0}),$("body").on("click",".submitter",function(){return $(this).closest("form").submit()}),$("body").on("click",".renamer-updater",function(){return $(this).closest("form").find(".update_referencers").val("true")}),$("body").on("submit",".card-name-form",function(){var e;return e=$(this).find(".confirm-rename"),e.is(":hidden")?($(this).find("#referers").val()>0&&$(this).find(".renamer-updater").show(),e.show("blind"),!1):void 0}),$("body").on("click","button.redirecter",function(){return window.location=$(this).attr("href")}),wagn.noDoubleClick||$("body").on("dblclick",".card-slot",function(){var e;return e=$(this),e.find(".card-editor")[0]?!1:e.closest(".card-header")[0]?!1:e.data("cardId")?(e.addClass("slotter"),e.attr("href",wagn.rootPath+"/card/edit/~"+e.data("cardId")),$.rails.handleRemote(e),!1):!1}),$("body").on("dblclick",".nodblclick",function(){return!1}),$("body").on("submit","form.slotter",function(){var e,t;return(t=$(this).attr("main-success"))&&$(this).isMain()&&(e=$(this).find("[name=success]"),e&&!e.val().match(/^REDIRECT/))?e.val("REDIRECT"===t?t+": "+e.val():t):void 0}),$(".card-slot").on("click",".standard-delete",function(){var e;if("true"!==$(this).attr("success-ready"))return e=$(this).isMain()?"REDIRECT: *previous":"TEXT:"+$(this).slot().data("cardName")+" removed",$(this).attr("href",$(this).attr("href")+"?success="+encodeURIComponent(e)),$(this).attr("success-ready","true")}),$("body").on("change",".live-type-field",function(){return $(this).data("params",$(this).closest("form").serialize()),$(this).data("url",$(this).attr("href"))}),$("body").on("change",".edit-type-field",function(){return $(this).closest("form").submit()}),$("body").on("change",".autosave .card-content",function(){var e;return e=$(this),setTimeout(function(){return e.autosave()},500)}),$("body").on("mouseenter","[hover_content]",function(){return $(this).attr("hover_restore",$(this).html()),$(this).html($(this).attr("hover_content"))}),$("body").on("mouseleave","[hover_content]",function(){return $(this).html($(this).attr("hover_restore"))}),$("body").on("keyup",".name-editor input",function(){var e,t;return e=$(this),t=e.val(),wagn.pingName(t,function(i){var n,o,a,r,s,l,c;return e.val()!==t?null:(c=i.status,c?(n=e.parent(),o=e.closest("fieldset").find("legend"),r=o.find(".name-messages"),r[0]||(r=$('<span class="name-messages"></span>'),o.append(r)),n.removeClass("real-name virtual-name known-name"),l=e.slot().data("cardId"),"unknown"===c||l&&parseInt(l)===i.id?r.html(""):(n.addClass(c+"-name known-name"),a=s="virtual"===c?"in virtual":"already in",r.html('"<a href="'+wagn.rootPath+"/"+i.url_key+'">'+t+'</a>" '+s+" use"))):void 0)})}),$("body").on("click",".render-error-link",function(e){var t;return t=$(this).closest(".render-error").find(".render-error-message"),t.show(),e.preventDefault()})}),e=function(e){var t,i;return i="https://www.google.com/recaptcha/api/js/recaptcha_ajax.js",t=$('<div class="recaptcha-box"></div>'),$(e).children().last().after(t),$.getScript(i,function(){return t.loadCaptcha()})},t=function(e){return e.replace(/([a-z])([A-Z])/g,function(e){return e[0]+"_"+e[1].toLowerCase()})},i=function(e){return"undefined"!=typeof console&&null!==console?console.log(e):void 0}}.call(this),wagn.menu_template=[{text:"edit",view:"edit","if":"edit",sub:[{text:"content",view:"edit"},{text:"name",view:"edit_name"},{text:"type: %{type}",view:"edit_type"},{text:"structure",related:{name:"structure",view:"edit"},"if":"structure"},{link:"delete","if":"delete"}]},{text:"view",view:"home",sub:[{text:"refresh",view:"home"},{text:"page",page:"self"},{text:"type: %{type}",page:"type"},{text:"history",view:"history","if":"edit"},{text:"structure",related:{name:"structure"},"if":"structure"}]},{text:"discuss",related:{name:"+discussion"},"if":"discuss"},{text:"advanced",view:"options",sub:[{text:"rules",view:"options",list:{name:"related_sets",template:{view:"options",text:"text",path_opts:"path_opts"}}},{plain:"related",list:{name:"piecenames",template:{page:"item"},append:[{related:"children","if":"creator"},{related:"mates"}]}},{related:"referred to by","if":"creator",sub:[{text:"all",related:"referred to by"},{text:"links",related:"linked to by"},{text:"inclusions",related:"included by"}]},{related:"refers to","if":"creator",sub:[{text:"all",related:"refers to"},{text:"links",related:"links to"},{text:"inclusions",related:"includes"}]},{related:"editors","if":"creator",sub:[{text:"all editors",related:"editors"},{text:"creator: %{creator}",page:"creator"},{text:"last editor: %{updater}",page:"updater"}]}]},{link:"watch","if":"watch"},{view:"account","if":"account",sub:[{view:"account",text:"details"},{related:"roles"},{related:"created"},{related:"edited"}]}],/*
82
+ }for(t=n.length;t--;)i=n[t],!i.hasChildNodes()||i.firstChild==i.lastChild&&""===i.firstChild.nodeValue?o.remove(i):"A"==i.nodeName&&" "===(i.innerText||i.textContent)&&o.remove(i)}function h(e){var n,r,s,c,u,d,h=e;if(s=o.createRng(),e.hasChildNodes()){for(n=new t(e,e);r=n.current();){if(3==r.nodeType){s.setStart(r,0),s.setEnd(r,0);break}if(l[r.nodeName.toLowerCase()]){s.setStartBefore(r),s.setEndBefore(r);break}h=r,r=n.next()}r||(s.setStart(h,0),s.setEnd(h,0))}else"BR"==e.nodeName?e.nextSibling&&o.isBlock(e.nextSibling)?((!S||9>S)&&(d=o.create("br"),e.parentNode.insertBefore(d,e)),s.setStartBefore(e),s.setEndBefore(e)):(s.setStartAfter(e),s.setEndAfter(e)):(s.setStart(e,0),s.setEnd(e,0));a.setRng(s),o.remove(d),u=o.getViewPort(i.getWin()),c=o.getPos(e).y,(c<u.y||c+25>u.y+u.h)&&i.getWin().scrollTo(0,c<u.y?c:c-u.h+25)}function p(t){var i,n,a,s=k;if(i=t||"TABLE"==M?o.create(t||H):D.cloneNode(!1),a=i,r.keep_styles!==!1)do if(/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(s.nodeName)){if("_mce_caret"==s.id)continue;n=s.cloneNode(!1),o.setAttrib(n,"id",""),i.hasChildNodes()?(n.appendChild(i.firstChild),i.appendChild(n)):(a=n,i.appendChild(n))}while(s=s.parentNode);return(!e.isIE||e.isIE11)&&(a.innerHTML='<br data-mce-bogus="1">'),i}function f(e){var i,n,o;if(3==k.nodeType&&(e?T>0:T<k.nodeValue.length))return!1;if(k.parentNode==D&&B&&!e)return!0;if(e&&1==k.nodeType&&k==D.firstChild)return!0;if("TABLE"===k.nodeName||k.previousSibling&&"TABLE"==k.previousSibling.nodeName)return B&&!e||!B&&e;for(i=new t(k,D),3==k.nodeType&&(e&&0==T?i.prev():e||T!=k.nodeValue.length||i.next());n=i.current();){if(1===n.nodeType){if(!n.getAttribute("data-mce-bogus")&&(o=n.nodeName.toLowerCase(),l[o]&&"br"!==o))return!1}else if(3===n.nodeType&&!/^[ \t\r\n]*$/.test(n.nodeValue))return!1;e?i.prev():i.next()}return!0}function m(e,t){var i,n,a,r,s,l=H||"P";if(n=o.getParent(e,o.isBlock),!n||!c(n)){if(n=n||C,!n.hasChildNodes())return i=o.create(l),n.appendChild(i),O.setStart(i,0),O.setEnd(i,0),i;for(r=e;r.parentNode!=n;)r=r.parentNode;for(;r&&!o.isBlock(r);)a=r,r=r.previousSibling;if(a){for(i=o.create(l),a.parentNode.insertBefore(i,a),r=a;r&&!o.isBlock(r);)s=r.nextSibling,i.appendChild(r),r=s;O.setStart(e,t),O.setEnd(e,t)}}return e}function g(){function e(e){for(var t=P[e?"firstChild":"lastChild"];t&&1!=t.nodeType;)t=t[e?"nextSibling":"previousSibling"];return t===D}N=H?p(H):o.create("BR"),e(!0)&&e()?o.replace(N,P):e(!0)?P.parentNode.insertBefore(N,P):e()?(o.insertAfter(N,P),u(N)):(x=O.cloneRange(),x.setStartAfter(D),x.setEndAfter(P),A=x.extractContents(),o.insertAfter(A,P),o.insertAfter(N,P)),o.remove(D),h(N),s.add()}function v(){for(var e,i=new t(k,D);e=i.next();)if(l[e.nodeName.toLowerCase()]||e.length>0)return!0}function b(){var t,i,n;k&&3==k.nodeType&&T>=k.nodeValue.length&&(e.isIE&&!e.isIE11||v()||(t=o.create("br"),O.insertNode(t),O.setStartAfter(t),O.setEndAfter(t),i=!0)),t=o.create("br"),O.insertNode(t),e.isIE&&!e.isIE11&&"PRE"==M&&(!S||8>S)&&t.parentNode.insertBefore(o.doc.createTextNode("\r"),t),n=o.create("span",{},"&nbsp;"),t.parentNode.insertBefore(n,t),a.scrollIntoView(n),o.remove(n),i?(O.setStartBefore(t),O.setEndBefore(t)):(O.setStartAfter(t),O.setEndAfter(t)),a.setRng(O),s.add()}function y(e){do 3===e.nodeType&&(e.nodeValue=e.nodeValue.replace(/^[\r\n]+/,"")),e=e.firstChild;while(e)}function _(e){var t,i,n=o.getRoot();for(t=e;t!==n&&"false"!==o.getContentEditable(t);)"true"===o.getContentEditable(t)&&(i=t),t=t.parentNode;return t!==n?i:n}function w(t){var i;(!e.isIE||e.isIE11)&&(t.normalize(),i=t.lastChild,(!i||/^(left|right)$/gi.test(o.getStyle(i,"float",!0)))&&o.add(t,"br"))}var x,C,k,T,D,S,E,N,A,P,M,I,H,B,O=a.getRng(!0);if(!O.collapsed)return i.execCommand("Delete"),void 0;if(!n.isDefaultPrevented()&&(k=O.startContainer,T=O.startOffset,H=(r.force_p_newlines?"p":"")||r.forced_root_block,H=H?H.toUpperCase():"",S=o.doc.documentMode,E=n.shiftKey,1==k.nodeType&&k.hasChildNodes()&&(B=T>k.childNodes.length-1,k=k.childNodes[Math.min(T,k.childNodes.length-1)]||k,T=B&&3==k.nodeType?k.nodeValue.length:0),C=_(k))){if(s.beforeChange(),!o.isBlock(C)&&C!=o.getRoot())return(!H||E)&&b(),void 0;if((H&&!E||!H&&E)&&(k=m(k,T)),D=o.getParent(k,o.isBlock),P=D?o.getParent(D.parentNode,o.isBlock):null,M=D?D.nodeName.toUpperCase():"",I=P?P.nodeName.toUpperCase():"","LI"!=I||n.ctrlKey||(D=P,M=I),"LI"==M){if(!H&&E)return b(),void 0;if(o.isEmpty(D))return/^(UL|OL|LI)$/.test(P.parentNode.nodeName)?!1:(g(),void 0)}if("PRE"==M&&r.br_in_pre!==!1){if(!E)return b(),void 0}else if(!H&&!E&&"LI"!=M||H&&E)return b(),void 0;H=H||"P",f()?(N=/^(H[1-6]|PRE)$/.test(M)&&"HGROUP"!=I?p(H):p(),r.end_container_on_empty_block&&c(P)&&o.isEmpty(D)?N=o.split(P,D):o.insertAfter(N,D),h(N)):f(!0)?(N=D.parentNode.insertBefore(p(),D),u(N)):(x=O.cloneRange(),x.setEndAfter(D),A=x.extractContents(),y(A),N=A.firstChild,o.insertAfter(A,D),d(N),w(D),h(N)),o.setAttrib(N,"id",""),s.add()}}var o=i.dom,a=i.selection,r=i.settings,s=i.undoManager,l=i.schema.getNonEmptyElements();i.onKeyDown.add(function(e,t){13==t.keyCode&&n(t)!==!1&&t.preventDefault()})}}(tinymce),function(){var e,t,i,n,o,a,r;window.wagn||(window.wagn={}),$.extend(wagn,{editorContentFunctionMap:{".tinymce-textarea":function(){return tinyMCE.get(this[0].id).getContent()},".pointer-select":function(){return o(this.val())},".pointer-multiselect":function(){return o(this.val())},".pointer-radio-list":function(){return o(this.find("input:checked").val())},".pointer-list-ul":function(){return o(this.find("input").map(function(){return $(this).val()}))},".pointer-checkbox-list":function(){return o(this.find("input:checked").map(function(){return $(this).val()}))},".perm-editor":function(){return n(this)},".wikirate-topic-tree":function(){return o(this.find(".jstree-clicked").map(function(){return $.trim($(this).text())}))}},editorInitFunctionMap:{".date-editor":function(){return this.datepicker({dateFormat:"yy-mm-dd"})},textarea:function(){return $(this).autosize()},".tinymce-textarea":function(){return wagn.initTinyMCE(this[0].id)},".pointer-list-editor":function(){return this.sortable(),wagn.initPointerList(this.find("input"))},".file-upload":function(){return this.fileupload({add:wagn.chooseFile})},".etherpad-textarea":function(){return $(this).closest("form").find(".edit-submit-button").attr("class","etherpad-submit-button")},".wikirate-topic-tree":function(){return $(this).jstree({plugins:["themes","html_data","ui","crrm"],ui:{select_multiple_modifier:"on",initially_select:$(this).closest(".editor").find(".initial-content").text().split("|"),selected_parent_close:!1},themes:{icons:!1}})}},initPointerList:function(e){var t;return t=e.closest("ul").attr("options-card"),e.autocomplete({source:wagn.prepUrl(wagn.rootPath+"/"+t+".json?view=name_complete")})},setTinyMCEConfig:function(e){var t;return t=function(){try{return $.parseJSON(e)}catch(t){return{}}},wagn.tinyMCEConfig=t()},initTinyMCE:function(e){var t,i,n;return t={plugins:"autoresize",autoresize_max_height:500},n=null!=wagn.tinyMCEConfig?wagn.tinyMCEConfig:{},i={mode:"exact",elements:e,content_css:wagn.cssPath,entity_encoding:"raw"},$.extend(t,n,i),tinyMCE.init(t)},chooseFile:function(e,t){var i,n,o,a;return o=t.files[0],$(this).closest("form").data("file-data",t),(a=$(this).slot().find(".name-editor input"))&&a[0]&&""===a.val()&&a.val(o.name.replace(/\..*$/,"").replace(/_/g," ")),n=$(this).closest(".card-editor"),n.find(".choose-file").hide(),n.find(".chosen-filename").text(o.name),n.find(".chosen-file").show(),i=this.name.replace(/attach\]$/,"content]"),n.append('<input type="hidden" value="CHOSEN" class="upload-card-content" name="'+i+'">')},openMenu:function(e,t){var i,n;return n=$(e),i=n.data("menu"),null==i&&(i=wagn.generateMenu(n.slot(),n.data("menu-vars")),n.data("menu",i),i.menu({position:{my:"right top",at:"left-2 top-3"},icons:{submenu:"ui-icon-carat-1-w"}})),t&&i.addClass("card-menu-tappable"),i.show(),i.position({my:"right top",at:"right+2 top+2",of:e})},closeMenu:function(e){return $(e).hide(),$(e).menu("collapseAll",null,!0)},generateMenu:function(e,t){var i,n,o;return o=$.extend(!0,{},wagn.menu_template),i=wagn.generateMenuItems(o,t),n=$('<ul class="card-menu">'+i.join("\n")+"</ul>"),e.append(n),n},generateMenuItems:function(e,t){var i;return i=[],$.each(e,function(e,n){var o,a,r,s;return n["if"]&&!t[n["if"]]?!0:(n.text&&(n.text=n.text.replace(/\%\{([^}]*)\}/,function(e,i){return t[i]}),n.text=$("<div/>").text(n.text).html()),o=n.link?t[n.link]:n.plain?"<a>"+n.plain+"</a>":n.page?(r=t[n.page]||n.page,s=n.text||r,'<a href="'+wagn.rootPath+"/"+wagn.linkname(r)+'">'+s+" &crarr;</a>"):wagn.generateStandardMenuItem(n,t),o?(n.list&&(a=wagn.generateListTemplate(n.list,t))&&a.length>0&&(n.sub=a),n.sub&&(o+="<ul>"+wagn.generateMenuItems(n.sub,t).join("\n")+"</ul>"),i.push("<li>"+o+"</li>")):void 0)}),i},linkname:function(e){return e.replace(/[^\w\*\+]/g," ").replace(/\s+/g,"_")},generateListTemplate:function(e,t){var i,n;return i=[],(n=t[e.name])&&$.each(n,function(t,n){var o;return o=$.extend({},e.template),$.map(o,function(e,t){return o[t]=n[o[t]]||o[t]}),i.push(o)}),e.append&&(i=i.concat(e.append)),i},generateStandardMenuItem:function(e,t){var i,n,o,a;return i=wagn.linkname(t.self),n=e.path_opts||{},e.related&&(e.view="related",n.related="object"==typeof e.related?$.extend({},e.related,{name:t[e.related.name]}):(e.text||(e.text=e.related),{name:"+*"+e.related})),e.view?("home"!==e.view&&(n.view=e.view),o=wagn.rootPath+"/"+i,$.isEmptyObject(n)||(o+="?"+$.param(n)),a=e.text||e.view,'<a href="'+o+'" data-remote="true" class="slotter">'+a+"</a>"):void 0}}),$(window).ready(function(){var i;return $("body").on("click",".cancel-upload",function(){var e,t;return t=$(this).closest(".card-editor"),t.find(".chosen-file").hide(),t.find(".choose-file").show(),$(this).closest("form").data("file-data",null),e=t.find(".upload-card-content").remove()}),$(".navbox").autocomplete({html:"html",source:e,select:t}),$("body").on("mouseenter",".card-menu-link",function(){return wagn.openMenu(this,!1)}),$("body").on("mouseleave",".card-menu",function(){return wagn.closeMenu(this)}),$(document).on("tap",".card-header",function(e){var t;return t=$(this).find(".card-menu-link"),!t[0]||t.data("menu")||e.pageX-$(this).offset().left<$(this).width()/2?void 0:(wagn.openMenu(t,!0),e.preventDefault())}),$(document).on("tap","body",function(e){return $(e.target).closest(".card-header")[0]||$(e.target).closest(".card-menu-link")[0]?void 0:$(".card-menu").hide()}),$(document).on("tap",".ui-menu-icon",function(e){return $(this).closest("li").trigger("mouseenter"),e.preventDefault()}),$("body").on("click",".pointer-item-add",function(e){var t,i,n;return i=$(this).closest(".content-editor").find(".pointer-li:last"),n=i.clone(),t=n.find("input"),t.val(""),i.after(n),wagn.initPointerList(t),e.preventDefault()}),$("body").on("click",".pointer-item-delete",function(){var e;return e=$(this).closest("li"),e.closest("ul").find(".pointer-li").length>1?e.remove():e.find("input").val(""),event.preventDefault()}),$("body").on("click",".perm-vals input",function(){return $(this).slot().find("#inherit").attr("checked",!1)}),$("body").on("click",".perm-editor #inherit",function(){var e;return e=$(this).slot(),e.find(".perm-group input:checked").attr("checked",!1),e.find(".perm-indiv input").val("")}),$("body").on("click",".rule-submit-button",function(){var e;return e=$(this).closest("form"),e.find(".set-editor input:checked").val()?!0:(e.find(".set-editor").addClass("attention"),$(this).notify("To what Set of cards does this Rule apply?"),!1)}),$("body").on("click",".shade-view h1",function(){var e;return e=$(this).slot().find(".shade-content").is(":hidden"),r($(this).closest(".pointer-list").find(".shade-content:visible").parent()),e?r($(this).slot()):void 0}),(i=$(".shade-view h1")[0])&&$(i).trigger("click"),$("body").on("mouseenter","#wikirate-nav > a",function(){var e,t;return t=$(this).find("ul"),t[0]?t.css("display","inline-block"):(e=$(this),$.ajax(e.attr("href"),{data:{view:"navdrop",layout:"none",index:$("#wikirate-nav > a").index(e)},success:function(t){return wagn.d=t,e.prepend($(t).menu())}}))}),$("body").on("mouseleave","#wikirate-nav ul",function(){return $(this).hide()}),$("body").on("change",".go-to-selected select",function(){var e;return e=$(this).val(),""!==e?window.location=wagn.rootPath+escape(e):void 0})}),$(document).bind("mobileinit",function(){return $.mobile.autoInitializePage=!1,$.mobile.ajaxEnabled=!1}),r=function(e){return e.find(".shade-content").slideToggle(1e3),e.find(".ui-icon").toggleClass("ui-icon-triangle-1-e ui-icon-triangle-1-s")},n=function(e){var t,i;return e.find("#inherit").attr("checked")?"_left":(t=e.find(".perm-group input:checked").map(function(){return $(this).val()}),i=e.find(".perm-indiv input").map(function(){return $(this).val()}),o($.makeArray(t).concat($.makeArray(i))))},o=function(e){var t;return t=$.map($.makeArray(e),function(e){return e?"[["+e+"]]":void 0}),$.makeArray(t).join("\n")},a=0,e=function(e,t){var n,o;return n=this.element.closest("form"),o=n.serialize()+"&view=complete",this.xhr=$.ajax({url:wagn.prepUrl(wagn.rootPath+"/:search.json"),data:o,dataType:"json",wagReq:++a,success:function(n){return this.wagReq===a?t(i(e.term,n)):void 0},error:function(){return this.wagReq===a?t([]):void 0}})},i=function(e,t){var i;return i=[],$.each(["search","add","new"],function(n,o){var a,r;return(r=t[o])?(a={value:e,prefix:o,icon:"plus",label:'<strong class="highlight">'+e+"</strong>"},"search"===o?(a.icon=o,a.term=e):"add"===o?a.href="/card/new?card[name]="+encodeURIComponent(r):"new"===o&&(a.type="add",a.href="/new/"+r[1]),i.push(a)):void 0}),$.each(t["goto"],function(e,t){return i.push({icon:"arrowreturnthick-1-e",prefix:"go to",value:t[0],label:t[1],href:"/"+t[2]})}),$.each(i,function(e,t){return t.label='<span class="navbox-item-label"><a class="ui-icon ui-icon-'+t.icon+'"></a>'+t.prefix+':</span> <span class="navbox-item-value">'+t.label+"</span>"}),i},t=function(e,t){return t.item.term?$(this).closest("form").submit():window.location=wagn.rootPath+t.item.href,$(this).attr("disabled","disabled")}}.call(this),function(){var e,t,i;$.extend(wagn,{initializeEditors:function(e,t){return null==t&&(t=wagn.editorInitFunctionMap),$.each(t,function(t,i){return $.each(e.find(t),function(){return i.call($(this))})})},prepUrl:function(e,t){var i,n,o;return o={},i=$("#main").children(".card-slot").data("cardName"),null!=i&&(o.main=i),t&&(t.isMain()&&(o.is_main=!0),n=t.data("slot"),null!=n&&wagn.slotParams(n,o,"slot")),e+((e.match(/\?/)?"&":"?")+$.param(o))},slotParams:function(e,i,n){return $.each(e,function(e,o){var a;return a=n+"["+t(e)+"]","items"===e?wagn.slotParams(o,i,a):i[a]=o})},pingName:function(e,t){return $.getJSON(wagn.rootPath+"/",{format:"json",view:"status","card[name]":e},t)}}),jQuery.fn.extend({slot:function(){return this.closest(".card-slot")},setSlotContent:function(e){var t,i,n;return t=this.slot(),n=$(e),n[0]?(i=t.attr("data-slot"))&&null!=i&&n.attr("data-slot",i):n=e,t.replaceWith(n),n},notify:function(e){var t,i,n;return n=this.slot(),i=n.find(".card-notice"),i[0]||(i=$('<div class="card-notice"></div>'),t=n.find(".card-form"),t[0]?$(t[0]).append(i):n.append(i)),i.html(e),i.show("blind")},report:function(e){var t;return t=this.slot().find(".card-report"),t[0]?(t.hide(),t.html(e),t.show("drop",750),setTimeout(function(){return t.hide("drop",750)},3e3)):!1},isMain:function(){return this.slot().parent("#main")[0]},loadCaptcha:function(){return Recaptcha.create(wagn.recaptchaKey,this[0])},autosave:function(){var e,t,i,n;if(n=this.slot(),!this.attr("no-autosave")){if(t=this.closest("fieldset"),t[0]){if(!(e=t.data("cardId")))return;i=": "+t.data("cardName")}else e=n.data("cardId"),i="";return $.ajax(wagn.rootPath+"/card/save_draft/~"+e,{data:{"card[content]":this.val()},type:"POST",success:function(){return n.report("draft saved"+i)}})}},setContentFieldsFromMap:function(e){var t;return null==e&&(e=wagn.editorContentFunctionMap),t=$(this),$.each(e,function(e,i){return t.setContentFields(e,i)})},setContentFields:function(e,t){return $.each(this.find(e),function(){return $(this).setContentField(t)})},setContentField:function(e){var t,i,n;return t=this.closest(".card-editor").find(".card-content"),i=t.val(),n=e.call(this),t.val(n),i!==n?t.change():void 0}}),setInterval(function(){return $(".card-form").setContentFieldsFromMap()},2e4),$(window).ready(function(){return $.ajaxSetup({cache:!1}),setTimeout(function(){return wagn.initializeEditors($("body"))},10),$("body").on("ajax:success",".slotter",function(e,t){var i,n;return t.redirect?window.location=t.redirect:(n=$(this).attr("notify-success"),i=$(this).setSlotContent(t),i.jquery&&(wagn.initializeEditors(i),null!=n)?i.notify(n):void 0)}),$("body").on("ajax:error",".slotter",function(e,t){var i,n;return i=t.responseText,403===t.status?$(this).setSlotContent(i):($(this).notify(i),n=$(this).slot(),409===t.status?n.find(".current_revision_id").val(n.find(".new-current-revision-id").text()):449===t.status?n.find(".recaptcha-box").loadCaptcha():void 0)}),$("body").on("click","button.slotter",function(){return $.rails.allowAction($(this))?$.rails.handleRemote($(this)):!1}),$("body").on("ajax:beforeSend",".slotter",function(t,i,n){var o,a,r,s,l;if(!n.skip_before_send&&(n.url.match(/home_view/)||(n.url=wagn.prepUrl(n.url,$(this).slot())),$(this).is("form"))){if(wagn.recaptchaKey&&"on"===$(this).attr("recaptcha")&&!$(this).find(".recaptcha-box")[0])return e(this),!1;if(a=$(this).data("file-data"))return s=$(this).find(".file-upload"),s[1]?($(this).notify("Wagn does not yet support multiple files in a single form."),!1):(l=s.data("fileupload"),l._isXHRUpload(l.options)||($(this).find("[name=success]").val("_self"),n.url+="&simulate_xhr=true",r=function(e){return e.find("body").html()},n.dataFilter=r),o=$.extend(n,l._getAJAXSettings(a),{url:n.url}),o.skip_before_send=!0,$.ajax(o),!1)}}),$("body").on("submit",".card-form",function(){return $(this).setContentFieldsFromMap(),$(this).find(".card-content").attr("no-autosave","true"),!0}),$("body").on("click",".submitter",function(){return $(this).closest("form").submit()}),$("body").on("click",".renamer-updater",function(){return $(this).closest("form").find("#card_update_referencers").val("true")}),$("body").on("submit",".edit_name-view .card-form",function(){var e;return e=$(this).find(".confirm_rename-view"),e.is(":hidden")?($(this).find("#referers").val()>0&&$(this).find(".renamer-updater").show(),e.show("blind"),!1):void 0}),$("body").on("click","button.redirecter",function(){return window.location=$(this).attr("href")}),wagn.noDoubleClick||$("body").on("dblclick",".card-slot",function(){var e;return e=$(this),e.find(".card-editor")[0]?!1:e.closest(".card-header")[0]?!1:e.data("cardId")?(e.addClass("slotter"),e.attr("href",wagn.rootPath+"/card/edit/~"+e.data("cardId")),$.rails.handleRemote(e),!1):!1}),$("body").on("dblclick",".nodblclick",function(){return!1}),$("body").on("submit","form.slotter",function(){var e,t;return(t=$(this).attr("main-success"))&&$(this).isMain()&&(e=$(this).find("[name=success]"),e&&!e.val().match(/^REDIRECT/))?e.val("REDIRECT"===t?t+": "+e.val():t):void 0}),$(".card-slot").on("click",".standard-delete",function(){var e;if("true"!==$(this).attr("success-ready"))return e=$(this).isMain()?"REDIRECT: *previous":"TEXT:"+$(this).slot().data("cardName")+" removed",$(this).attr("href",$(this).attr("href")+"?success="+encodeURIComponent(e)),$(this).attr("success-ready","true")}),$("body").on("change",".live-type-field",function(){return $(this).data("params",$(this).closest("form").serialize()),$(this).data("url",$(this).attr("href"))}),$("body").on("change",".edit-type-field",function(){return $(this).closest("form").submit()}),$("body").on("change",".autosave .card-content",function(){var e;return e=$(this),setTimeout(function(){return e.autosave()},500)}),$("body").on("mouseenter","[hover_content]",function(){return $(this).attr("hover_restore",$(this).html()),$(this).html($(this).attr("hover_content"))}),$("body").on("mouseleave","[hover_content]",function(){return $(this).html($(this).attr("hover_restore"))}),$("body").on("keyup",".name-editor input",function(){var e,t;return e=$(this),t=e.val(),wagn.pingName(t,function(i){var n,o,a,r,s,l,c;return e.val()!==t?null:(c=i.status,c?(n=e.parent(),o=e.closest("fieldset").find("legend"),r=o.find(".name-messages"),r[0]||(r=$('<span class="name-messages"></span>'),o.append(r)),n.removeClass("real-name virtual-name known-name"),l=e.slot().data("cardId"),"unknown"===c||l&&parseInt(l)===i.id?r.html(""):(n.addClass(c+"-name known-name"),a=s="virtual"===c?"in virtual":"already in",r.html('"<a href="'+wagn.rootPath+"/"+i.url_key+'">'+t+'</a>" '+s+" use"))):void 0)})}),$("body").on("click",".render-error-link",function(e){var t;return t=$(this).closest(".render-error").find(".render-error-message"),t.show(),e.preventDefault()})}),e=function(e){var t,i;return i="https://www.google.com/recaptcha/api/js/recaptcha_ajax.js",t=$('<div class="recaptcha-box"></div>'),$(e).children().last().after(t),$.getScript(i,function(){return t.loadCaptcha()})},t=function(e){return e.replace(/([a-z])([A-Z])/g,function(e){return e[0]+"_"+e[1].toLowerCase()})},i=function(e){return"undefined"!=typeof console&&null!==console?console.log(e):void 0}}.call(this),wagn.menu_template=[{text:"edit",view:"edit","if":"edit",sub:[{text:"content",view:"edit"},{text:"name",view:"edit_name"},{text:"type: %{type}",view:"edit_type"},{text:"structure",related:{name:"structure",view:"edit"},"if":"structure"},{link:"delete","if":"delete"}]},{text:"view",view:"home",sub:[{text:"refresh",view:"home"},{text:"page",page:"self"},{text:"type: %{type}",page:"type"},{text:"history",view:"history","if":"edit"},{text:"structure",related:{name:"structure"},"if":"structure"}]},{text:"discuss",related:{name:"+discussion"},"if":"discuss"},{text:"advanced",view:"options",sub:[{text:"rules",view:"options",list:{name:"related_sets",template:{view:"options",text:"text",path_opts:"path_opts"}}},{plain:"related",list:{name:"piecenames",template:{page:"item"},append:[{related:"children","if":"creator"},{related:"mates"}]}},{related:"referred to by","if":"creator",sub:[{text:"all",related:"referred to by"},{text:"links",related:"linked to by"},{text:"inclusions",related:"included by"}]},{related:"refers to","if":"creator",sub:[{text:"all",related:"refers to"},{text:"links",related:"links to"},{text:"inclusions",related:"includes"}]},{related:"editors","if":"creator",sub:[{text:"all editors",related:"editors"},{text:"creator: %{creator}",page:"creator"},{text:"last editor: %{updater}",page:"updater"}]}]},{link:"watch","if":"watch"},{view:"account","if":"account",sub:[{view:"account",text:"details"},{related:"roles"},{related:"created"},{related:"edited"}]}],/*
83
83
  * jQuery Mobile Framework Git Build: SHA1: 07a30fb0138f34a880ca7c9c9427319d1f976eda <> Date: Mon Jul 16 01:56:11 2012 +0200
84
84
  * http://jquerymobile.com
85
85
  *
@@ -31,8 +31,8 @@ images/ui-icons_888888_256x240.png: images/ui-icons_888888_256x240-95fd3047e1f73
31
31
  images/ui-icons_888888_256x240/index.png: images/ui-icons_888888_256x240-95fd3047e1f7325d995a21c729b04125.png
32
32
  images/ui-icons_cd0a0a_256x240.png: images/ui-icons_cd0a0a_256x240-c0c1ec6a8bcf48fec40303e975a4dfa6.png
33
33
  images/ui-icons_cd0a0a_256x240/index.png: images/ui-icons_cd0a0a_256x240-c0c1ec6a8bcf48fec40303e975a4dfa6.png
34
- application.js: application-7f1664ac8e65db8af0bfa6539e23c7df.js
35
- application/index.js: application-7f1664ac8e65db8af0bfa6539e23c7df.js
34
+ application.js: application-af2bc486eb3db1c02c4dcd0e23ca25fc.js
35
+ application/index.js: application-af2bc486eb3db1c02c4dcd0e23ca25fc.js
36
36
  html5shiv-printshiv.js: html5shiv-printshiv-ad36fc7219f4aeaa275f9a7fe2383413.js
37
37
  html5shiv-printshiv/index.js: html5shiv-printshiv-ad36fc7219f4aeaa275f9a7fe2383413.js
38
38
  tinymce.js: tinymce-22b5a139d9ff7df7643afae9ce205508.js
Binary file
@@ -27,4 +27,5 @@ describe Card::Codename, "Codename" do
27
27
  end
28
28
  end
29
29
  end
30
+
30
31
  end
@@ -36,10 +36,12 @@ module PermissionSpecHelper
36
36
  end
37
37
 
38
38
  def assert_hidden( card, msg='' )
39
+ assert !card.ok?(:read)
39
40
  assert_equal [], Card.search(:id=>card.id).map(&:name), msg
40
41
  end
41
42
 
42
43
  def assert_not_hidden( card, msg='' )
44
+ assert card.ok?(:read)
43
45
  assert_equal [card.name], Card.search(:id=>card.id).map(&:name), msg
44
46
  end
45
47
 
@@ -346,6 +348,26 @@ describe Card::Set::All::Permissions do
346
348
  assert_hidden_from( @u1, @c2 )
347
349
  assert_hidden_from( @u3, @c2 )
348
350
  end
351
+
352
+ context "create permissions" do
353
+ before do
354
+ Account.as_bot do
355
+ Card.create! :name=>'*structure+*right+*create', :type=>'Pointer', :content=>'[[Anyone Signed In]]'
356
+ Card.create! :name=>'*self+*right+*create', :type=>'Pointer', :content=>'[[Anyone Signed In]]'
357
+ end
358
+ end
359
+
360
+ it "should inherit" do
361
+ Account.as(:auth) do
362
+ Card.fetch( 'A+*self' ).ok?(:create).should be_true #explicitly granted above
363
+ Card.fetch( 'A+*right').ok?(:create).should be_false #by default restricted
364
+
365
+ Card.fetch( 'A+*self+*structure', :new=>{} ).ok?(:create).should be_true # +*structure granted;
366
+ Card.fetch( 'A+*right+*structure', :new=>{} ).ok?(:create).should be_false # can't create A+B, therefore can't create A+B+C
367
+ end
368
+ end
369
+
370
+ end
349
371
 
350
372
 
351
373
  it "private wql" do
@@ -472,6 +494,9 @@ describe Card::Set::All::Permissions do
472
494
  end
473
495
  end
474
496
  end
497
+
498
+
499
+
475
500
  end
476
501
 
477
502
 
@@ -0,0 +1,16 @@
1
+ # -*- encoding : utf-8 -*-
2
+ require 'wagn/spec_helper'
3
+
4
+ describe Card::Set::All::Trash do
5
+
6
+ it "certain 'all rules' should be indestructable" do
7
+ Account.as_bot do
8
+ name = '*all+*default'
9
+ card = Card[name]
10
+ card.delete
11
+ card.errors[:delete].first.should == "#{name} is an indestructible rule"
12
+ Card[name].should be
13
+ end
14
+ end
15
+
16
+ end
@@ -21,6 +21,11 @@ describe Card::Chunk::Include, "Inclusion" do
21
21
  it "should handle empty inclusions" do
22
22
  instance = @class.new( @class.full_match( '{{ }}' ) , nil )
23
23
  instance.name.should == ''
24
+ instance.options[:inc_syntax].should == ' '
25
+ instance1 = @class.new( @class.full_match( '{{|}}' ) , nil )
26
+ instance1.name.should == ''
27
+ instance1.options[:inc_syntax].should == '|'
28
+
24
29
  end
25
30
 
26
31
  it "should handle no pipes" do
@@ -4,22 +4,22 @@ require 'wagn/spec_helper'
4
4
  describe Card::Set::All::Json, "JSON mod" do
5
5
  context "status view" do
6
6
  it "should handle real and virtual cards" do
7
- r = Card::JsonFormat
8
- real_json = r.new(Card['T'])._render_show :view=>:status
7
+ jf = Card::JsonFormat
8
+ real_json = jf.new(Card['T']).show :view=>:status
9
9
  JSON[real_json].should == {"key"=>"t","status"=>"real","id"=>Card['T'].id, 'url_key'=>'T'}
10
- virtual_json = r.new(Card.fetch('T+*self'))._render_show :view=>:status
10
+ virtual_json = jf.new(Card.fetch('T+*self')).show :view=>:status
11
11
  JSON[virtual_json].should == {"key"=>"t+*self","status"=>"virtual",'url_key'=>'T+*self'}
12
12
  end
13
13
 
14
14
  it "should treat both unknown and unreadable cards as unknown" do
15
15
  Account.as Card::AnonID do
16
- r = Card::JsonFormat
16
+ jf = Card::JsonFormat
17
17
 
18
18
  unknown = Card.new :name=>'sump'
19
19
  unreadable = Card.new :name=>'kumq', :type=>'Fruit'
20
- unknown_json = r.new(unknown)._render_show :view=>:status
20
+ unknown_json = jf.new(unknown).show :view=>:status
21
21
  JSON[unknown_json].should == {"key"=>"sump","status"=>"unknown", 'url_key'=>'sump'}
22
- unreadable_json = r.new(unreadable)._render_show :view=>:status
22
+ unreadable_json = jf.new(unreadable).show :view=>:status
23
23
  JSON[unreadable_json].should == {"key"=>"kumq","status"=>"unknown", 'url_key'=>'kumq'}
24
24
  end
25
25
  end
@@ -7,4 +7,40 @@ describe Card::Set::All::RichHtml do
7
7
  render_content('{{+cardipoo|open}}').match(/Add \<span/ ).should_not be_nil
8
8
  end
9
9
  end
10
+ context "type_list" do
11
+ before do
12
+ @card = Card['UserForm'] # no cards with this type
13
+ end
14
+ it "should get type options from type_field renderer method" do
15
+ Card::HtmlFormat.new(@card).type_field.should match(/<option [^>]*selected/)
16
+ tf=Card::HtmlFormat.new(@card).type_field(:no_current_type=>true)
17
+ tf.should_not match(/<option [^>]*selected/)
18
+ tf.scan(/<option /).length.should == 23
19
+ tf=Card::HtmlFormat.new(@card).type_field
20
+ tf.should match(/<option [^>]*selected/)
21
+ tf.scan(/<option /).length.should == 23
22
+ end
23
+ it "should get type list" do
24
+ Account.as :anonymous do
25
+ tf=Card::HtmlFormat.new(@card).type_field(:no_current_type=>true)
26
+ tf.should_not match(/<option [^>]*selected/)
27
+ tf.scan(/<option /).length.should == 1
28
+ tf=Card::HtmlFormat.new(@card).type_field
29
+ tf.should match(/<option [^>]*selected/)
30
+ tf.scan(/<option /).length.should == 2
31
+ end
32
+ end
33
+ end
34
+ context "type and header" do
35
+ it "should render type without no-edit class when no cards of type" do
36
+ card = Card['UserForm'] # no cards with this type
37
+ Card::HtmlFormat.new(card).render_type.should match(/<a [^>]* class="([^"]* )?cardtype[^"]*"/)
38
+ Card::HtmlFormat.new(card).render_type.should_not match(/<a [^>]* class="([^"]* )?no-edit[^"]*"/)
39
+ end
40
+ it "should render type header with no-edit class when cards of type exist" do
41
+ no_edit_card = Card['cardtype a']
42
+ Card::HtmlFormat.new(no_edit_card).render_type.should match(/<a [^>]* class="([^"]* )?cardtype[^"]*"/)
43
+ Card::HtmlFormat.new(no_edit_card).render_type.should match(/<a [^>]* class="([^"]* )?no-edit[^"]*"/)
44
+ end
45
+ end
10
46
  end
@@ -2,9 +2,15 @@
2
2
  require 'wagn/spec_helper'
3
3
 
4
4
  describe Card::Set::Right::Structure do
5
- it "closed_content is rendered as title + raw" do
5
+ it "closed_content is rendered as type + raw" do
6
6
  template = Card.new(:name=>'A+*right+*structure', :content=>'[[link]] {{inclusion}}')
7
7
  Card::Format.new(template)._render(:closed_content).should ==
8
- '<a href="/Basic" class="cardtype default-type">Basic</a> : [[link]] {{inclusion}}'
8
+ '<a href="/Basic" class="cardtype">Basic</a> : [[link]] {{inclusion}}'
9
+ end
10
+
11
+ it "closed_content is rendered as type + raw" do
12
+ template = Card.new(:name=>'A+*right+*structure', :type=>'Html', :content=>'[[link]] {{inclusion}}')
13
+ Card::Format.new(template)._render(:closed_content).should ==
14
+ '<a href="/HTML" class="cardtype">HTML</a> : [[link]] {{inclusion}}'
9
15
  end
10
16
  end